Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
feat(api-client): added storefrontUrl as a registration param (#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal-Dziedzinski authored May 19, 2020
1 parent 9e9cee3 commit aa75ddb
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 40 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ Another way of doing this:

```js
module.exports = {
shopwareEndpoint: "https://shopware-2.vuestorefront.io",
shopwareAccessToken: "SWSCTXJOZMQWCXA4OUTNZ0REYG",
shopwareEndpoint: "https://shopware6-demo.vuestorefront.io",
shopwareAccessToken: "SWSCVJJET0RQAXFNBMTDZTV1OQ",
};
```

Expand Down
7 changes: 4 additions & 3 deletions docs/guide/CHEATSHEET.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ There will be a more streamlined, interactive development setup, but for now we'

Note: You can skip this section if you just want to try the PWA. It will be preconfigured to use a public instance.

1. Make sure you have a running Shopware 6 instance (preferably stable 6.0 once available)
1. Make sure you have a running Shopware 6 instance (preferably stable 6.2 once available)
2. Clone [SwagShopwarePwa](https://github.com/elkmod/SwagShopwarePwa) into your `custom/plugins` directory.
3. Install the plugin by running `bin/console plugin:install --activate SwagShopwarePwa`
4. Refresh the indices using `bin/console dal:refresh:index`
5. Go to the admin panel and copy the API access key from your sales channel settings
6. Make sure that you have proper domain configured in your sales channel settings - should contain your PWA instance URL (otherwise, the customer registration won't be possible - since v6.2)

#### PWA setup

Expand All @@ -53,8 +54,8 @@ Now you have complete ShopwarePWA project running locally

```
module.exports = {
shopwareEndpoint: "https://shopware-2.vuestorefront.io",
shopwareAccessToken: "SWSCTXJOZMQWCXA4OUTNZ0REYG"
shopwareEndpoint: "https://shopware6-demo.vuestorefront.io/",
shopwareAccessToken: "SWSCVJJET0RQAXFNBMTDZTV1OQ"
};
```

Expand Down
4 changes: 2 additions & 2 deletions docs/landing/getting-started/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ Instead of using the interactive CLI to configure your backend connection, you c

```js
module.exports = {
shopwareEndpoint: "https://shopware-2.vuestorefront.io",
shopwareAccessToken: "SWSCTXJOZMQWCXA4OUTNZ0REYG",
shopwareEndpoint: "https://shopware6-demo.vuestorefront.io",
shopwareAccessToken: "SWSCVJJET0RQAXFNBMTDZTV1OQ",
};
```

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/extensions/shopware-pwa-extension.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { GluegunToolbox } from "gluegun";

const defaultConfig = {
shopwareEndpoint: "https://shopware-2.vuestorefront.io",
shopwareAccessToken: "SWSCTXJOZMQWCXA4OUTNZ0REYG",
shopwareEndpoint: "https://shopware6-demo.vuestorefront.io",
shopwareAccessToken: "SWSCVJJET0RQAXFNBMTDZTV1OQ",
};
// add your CLI-specific functionality here, which will then be accessible
// to your commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ export interface CustomerRegistrationParams {
BillingAddress
> /** TODO: replace Partial with correct optional fields in BillingAddress */;
shippingAddress?: ShippingAddress;
/**
* storefrontUrl - should be one of the domains that are assigned to the corresponding sales channel (admin panel)
*/
storefrontUrl?: string;
}
1 change: 1 addition & 0 deletions packages/default-theme/components/SwRegister.vue
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export default {
email: this.email,
password: this.password,
salutationId: this.salutation.id,
storefrontUrl: window?.location?.origin,
billingAddress: {
firstName: this.firstName,
salutationId: this.salutation.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Object {
"translations": null,
"updatedAt": "2019-12-05T14:00:29+00:00",
"uploadedAt": "2019-12-05T14:00:29+00:00",
"url": "https://shopware-2.vuestorefront.io/media/af/1e/04/1575554429/fashion_ZA028248_007_p_5.png.png",
"url": "https://shopware6-demo.vuestorefront.io/media/af/1e/04/1575554429/fashion_ZA028248_007_p_5.png.png",
"user": null,
"userId": "e7fcae1311294d9ea3b8973909529b5f",
"versionId": null,
Expand Down Expand Up @@ -466,7 +466,7 @@ Object {
"translations": null,
"updatedAt": "2019-12-05T14:00:29+00:00",
"uploadedAt": "2019-12-05T14:00:29+00:00",
"url": "https://shopware-2.vuestorefront.io/media/af/1e/04/1575554429/fashion_ZA028248_007_p_5.png.png",
"url": "https://shopware6-demo.vuestorefront.io/media/af/1e/04/1575554429/fashion_ZA028248_007_p_5.png.png",
"user": null,
"userId": "e7fcae1311294d9ea3b8973909529b5f",
"versionId": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Object {
"translations": null,
"updatedAt": "2019-12-05T14:00:29+00:00",
"uploadedAt": "2019-12-05T14:00:29+00:00",
"url": "https://shopware-2.vuestorefront.io/media/af/1e/04/1575554429/fashion_ZA028248_007_p_5.png.png",
"url": "https://shopware6-demo.vuestorefront.io/media/af/1e/04/1575554429/fashion_ZA028248_007_p_5.png.png",
"user": null,
"userId": "e7fcae1311294d9ea3b8973909529b5f",
"versionId": null,
Expand Down Expand Up @@ -466,7 +466,7 @@ Object {
"translations": null,
"updatedAt": "2019-12-05T14:00:29+00:00",
"uploadedAt": "2019-12-05T14:00:29+00:00",
"url": "https://shopware-2.vuestorefront.io/media/af/1e/04/1575554429/fashion_ZA028248_007_p_5.png.png",
"url": "https://shopware6-demo.vuestorefront.io/media/af/1e/04/1575554429/fashion_ZA028248_007_p_5.png.png",
"user": null,
"userId": "e7fcae1311294d9ea3b8973909529b5f",
"versionId": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Object {
"mediaId": "9f0b3206a1424bfe9f6070b56b705ac5",
"translated": Array [],
"updatedAt": null,
"url": "https://shopware-2.vuestorefront.io/thumbnail/8c/92/83/1579175271/people-2563491_1920_800x800.jpg",
"url": "https://shopware6-demo.vuestorefront.io/thumbnail/8c/92/83/1579175271/people-2563491_1920_800x800.jpg",
"versionId": null,
"width": 800,
},
Expand All @@ -139,7 +139,7 @@ Object {
"mediaId": "9f0b3206a1424bfe9f6070b56b705ac5",
"translated": Array [],
"updatedAt": null,
"url": "https://shopware-2.vuestorefront.io/thumbnail/8c/92/83/1579175271/people-2563491_1920_1920x1920.jpg",
"url": "https://shopware6-demo.vuestorefront.io/thumbnail/8c/92/83/1579175271/people-2563491_1920_1920x1920.jpg",
"versionId": null,
"width": 1920,
},
Expand All @@ -163,7 +163,7 @@ Object {
"mediaId": "9f0b3206a1424bfe9f6070b56b705ac5",
"translated": Array [],
"updatedAt": null,
"url": "https://shopware-2.vuestorefront.io/thumbnail/8c/92/83/1579175271/people-2563491_1920_400x400.jpg",
"url": "https://shopware6-demo.vuestorefront.io/thumbnail/8c/92/83/1579175271/people-2563491_1920_400x400.jpg",
"versionId": null,
"width": 400,
},
Expand All @@ -178,7 +178,7 @@ Object {
"translations": null,
"updatedAt": "2020-01-16T11:47:52+00:00",
"uploadedAt": "2020-01-16T11:47:51+00:00",
"url": "https://shopware-2.vuestorefront.io/media/8c/92/83/1579175271/people-2563491_1920.jpg",
"url": "https://shopware6-demo.vuestorefront.io/media/8c/92/83/1579175271/people-2563491_1920.jpg",
"user": null,
"userId": "e7fcae1311294d9ea3b8973909529b5f",
"versionId": null,
Expand Down Expand Up @@ -13263,7 +13263,7 @@ Object {
"mediaId": "1d3da9a2f78f41cb9aeca34246f3da4c",
"translated": Array [],
"updatedAt": "mockedValue",
"url": "https://shopware-2.vuestorefront.io/thumbnail/10/02/ae/1577713689/Banner1_800x800.jpg",
"url": "https://shopware6-demo.vuestorefront.io/thumbnail/10/02/ae/1577713689/Banner1_800x800.jpg",
"versionId": null,
"width": 800,
},
Expand All @@ -13287,7 +13287,7 @@ Object {
"mediaId": "1d3da9a2f78f41cb9aeca34246f3da4c",
"translated": Array [],
"updatedAt": "mockedValue",
"url": "https://shopware-2.vuestorefront.io/thumbnail/10/02/ae/1577713689/Banner1_1920x1920.jpg",
"url": "https://shopware6-demo.vuestorefront.io/thumbnail/10/02/ae/1577713689/Banner1_1920x1920.jpg",
"versionId": null,
"width": 1920,
},
Expand All @@ -13311,7 +13311,7 @@ Object {
"mediaId": "1d3da9a2f78f41cb9aeca34246f3da4c",
"translated": Array [],
"updatedAt": "mockedValue",
"url": "https://shopware-2.vuestorefront.io/thumbnail/10/02/ae/1577713689/Banner1_400x400.jpg",
"url": "https://shopware6-demo.vuestorefront.io/thumbnail/10/02/ae/1577713689/Banner1_400x400.jpg",
"versionId": null,
"width": 400,
},
Expand All @@ -13326,7 +13326,7 @@ Object {
"translations": null,
"updatedAt": "mockedValue",
"uploadedAt": "2019-12-30T13:48:09+00:00",
"url": "https://shopware-2.vuestorefront.io/media/10/02/ae/1577713689/Banner1.jpg",
"url": "https://shopware6-demo.vuestorefront.io/media/10/02/ae/1577713689/Banner1.jpg",
"user": null,
"userId": "e7fcae1311294d9ea3b8973909529b5f",
"versionId": null,
Expand Down Expand Up @@ -13740,7 +13740,7 @@ Object {
"translations": null,
"updatedAt": "mockedValue",
"uploadedAt": "2019-12-05T14:05:00+00:00",
"url": "https://shopware-2.vuestorefront.io/media/8b/34/6b/1575554700/fashion_ZA029590_011_p1_6.jpg.jpg",
"url": "https://shopware6-demo.vuestorefront.io/media/8b/34/6b/1575554700/fashion_ZA029590_011_p1_6.jpg.jpg",
"user": null,
"userId": "e7fcae1311294d9ea3b8973909529b5f",
"versionId": null,
Expand Down Expand Up @@ -14397,7 +14397,7 @@ Object {
"translations": null,
"updatedAt": "mockedValue",
"uploadedAt": "2019-12-05T14:04:08+00:00",
"url": "https://shopware-2.vuestorefront.io/media/56/89/0f/1575554648/fashion_ZA029580_008_p_5.jpg.jpg",
"url": "https://shopware6-demo.vuestorefront.io/media/56/89/0f/1575554648/fashion_ZA029580_008_p_5.jpg.jpg",
"user": null,
"userId": "e7fcae1311294d9ea3b8973909529b5f",
"versionId": null,
Expand Down Expand Up @@ -15081,7 +15081,7 @@ Object {
"translations": null,
"updatedAt": "mockedValue",
"uploadedAt": "2019-12-05T13:55:41+00:00",
"url": "https://shopware-2.vuestorefront.io/media/49/51/58/1575554141/fashion_ZA028139_181_p1_5.png.png",
"url": "https://shopware6-demo.vuestorefront.io/media/49/51/58/1575554141/fashion_ZA028139_181_p1_5.png.png",
"user": null,
"userId": "e7fcae1311294d9ea3b8973909529b5f",
"versionId": null,
Expand Down Expand Up @@ -15530,7 +15530,7 @@ Object {
"translations": null,
"updatedAt": "mockedValue",
"uploadedAt": "2019-12-05T13:56:24+00:00",
"url": "https://shopware-2.vuestorefront.io/media/d4/09/a5/1575554184/fashion_ZA028528_052_p_5.png.png",
"url": "https://shopware6-demo.vuestorefront.io/media/d4/09/a5/1575554184/fashion_ZA028528_052_p_5.png.png",
"user": null,
"userId": "e7fcae1311294d9ea3b8973909529b5f",
"versionId": null,
Expand Down Expand Up @@ -16047,7 +16047,7 @@ Object {
"translations": null,
"updatedAt": "mockedValue",
"uploadedAt": "2019-12-05T14:03:27+00:00",
"url": "https://shopware-2.vuestorefront.io/media/15/3b/d3/1575554607/fashion_ZA029424_031_p1_5.jpg.jpg",
"url": "https://shopware6-demo.vuestorefront.io/media/15/3b/d3/1575554607/fashion_ZA029424_031_p1_5.jpg.jpg",
"user": null,
"userId": "e7fcae1311294d9ea3b8973909529b5f",
"versionId": null,
Expand Down Expand Up @@ -16566,7 +16566,7 @@ Object {
"translations": null,
"updatedAt": "mockedValue",
"uploadedAt": "2019-12-05T14:00:43+00:00",
"url": "https://shopware-2.vuestorefront.io/media/79/f3/e5/1575554443/fashion_ZA028199_161_p2_5.png.png",
"url": "https://shopware6-demo.vuestorefront.io/media/79/f3/e5/1575554443/fashion_ZA028199_161_p2_5.png.png",
"user": null,
"userId": "e7fcae1311294d9ea3b8973909529b5f",
"versionId": null,
Expand Down Expand Up @@ -17250,7 +17250,7 @@ Object {
"translations": null,
"updatedAt": "mockedValue",
"uploadedAt": "2019-12-05T13:58:47+00:00",
"url": "https://shopware-2.vuestorefront.io/media/8c/1f/f9/1575554327/fashion_ZA028387_001_p_5.png.png",
"url": "https://shopware6-demo.vuestorefront.io/media/8c/1f/f9/1575554327/fashion_ZA028387_001_p_5.png.png",
"user": null,
"userId": "e7fcae1311294d9ea3b8973909529b5f",
"versionId": null,
Expand Down Expand Up @@ -17699,7 +17699,7 @@ Object {
"translations": null,
"updatedAt": "mockedValue",
"uploadedAt": "2019-12-05T13:56:05+00:00",
"url": "https://shopware-2.vuestorefront.io/media/7a/e9/b5/1575554165/fashion_ZA028132_167_p2_5.png.png",
"url": "https://shopware6-demo.vuestorefront.io/media/7a/e9/b5/1575554165/fashion_ZA028132_167_p2_5.png.png",
"user": null,
"userId": "e7fcae1311294d9ea3b8973909529b5f",
"versionId": null,
Expand Down Expand Up @@ -18426,7 +18426,7 @@ Object {
"translations": null,
"updatedAt": "mockedValue",
"uploadedAt": "2019-12-05T14:05:58+00:00",
"url": "https://shopware-2.vuestorefront.io/media/a6/c8/4b/1575554758/fashion_ZA029547_128_p1_6.jpg.jpg",
"url": "https://shopware6-demo.vuestorefront.io/media/a6/c8/4b/1575554758/fashion_ZA029547_128_p1_6.jpg.jpg",
"user": null,
"userId": "e7fcae1311294d9ea3b8973909529b5f",
"versionId": null,
Expand Down Expand Up @@ -19155,7 +19155,7 @@ Object {
"translations": null,
"updatedAt": "mockedValue",
"uploadedAt": "2019-12-05T08:57:35+00:00",
"url": "https://shopware-2.vuestorefront.io/media/d7/7b/e5/1575536255/imported_ZA027319_011_p_1.png.png",
"url": "https://shopware6-demo.vuestorefront.io/media/d7/7b/e5/1575536255/imported_ZA027319_011_p_1.png.png",
"user": null,
"userId": "e7fcae1311294d9ea3b8973909529b5f",
"versionId": null,
Expand Down Expand Up @@ -19816,7 +19816,7 @@ Object {
"translations": null,
"updatedAt": "mockedValue",
"uploadedAt": "2019-12-05T13:57:52+00:00",
"url": "https://shopware-2.vuestorefront.io/media/50/69/83/1575554272/fashion_ZA027998_001_p_1.png.png",
"url": "https://shopware6-demo.vuestorefront.io/media/50/69/83/1575554272/fashion_ZA027998_001_p_1.png.png",
"user": null,
"userId": "e7fcae1311294d9ea3b8973909529b5f",
"versionId": null,
Expand Down Expand Up @@ -21240,7 +21240,7 @@ Object {
"translations": null,
"updatedAt": "2019-12-05T14:00:29+00:00",
"uploadedAt": "2019-12-05T14:00:29+00:00",
"url": "https://shopware-2.vuestorefront.io/media/af/1e/04/1575554429/fashion_ZA028248_007_p_5.png.png",
"url": "https://shopware6-demo.vuestorefront.io/media/af/1e/04/1575554429/fashion_ZA028248_007_p_5.png.png",
"user": null,
"userId": "e7fcae1311294d9ea3b8973909529b5f",
"versionId": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ Object {
"translations": null,
"updatedAt": "2019-12-05T13:52:24+00:00",
"uploadedAt": "2019-12-05T13:52:24+00:00",
"url": "https://shopware-2.vuestorefront.io/media/0b/5f/78/1575553944/fashion_ZA027049_008_t4_6.png.png",
"url": "https://shopware6-demo.vuestorefront.io/media/0b/5f/78/1575553944/fashion_ZA027049_008_t4_6.png.png",
"versionId": null,
},
"mediaId": "6b056c5a7c0c4e68933aa44e806e387e",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe("CustomerService - register", () => {
lastName: name.lastName(),
password: internet.password(8),
email: internet.email(),
storefrontUrl: internet.domainName(),
billingAddress: {
countryId: random.uuid(),
street: address.streetName(),
Expand Down
8 changes: 4 additions & 4 deletions packages/shopware-6-client/__tests__/settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { apiService } from "../src/apiService";
import { ConfigChangedArgs } from "../src";
import { random } from "faker";

const DEFAULT_ENDPOINT = "https://shopware-2.vuestorefront.io";
const DEFAULT_ENDPOINT = "https://shopware6-demo.vuestorefront.io";
const DEFAULT_TIMEOUT = 10000;

describe("Settings", () => {
Expand Down Expand Up @@ -70,19 +70,19 @@ describe("Settings", () => {

it("should have default config with empty invocation", () => {
update();
expect(config.accessToken).toEqual("SWSCTXJOZMQWCXA4OUTNZ0REYG");
expect(config.accessToken).toEqual("SWSCVJJET0RQAXFNBMTDZTV1OQ");
expect(config.contextToken).toEqual("");
});

it("should change defaultPaginationLimit", () => {
update({ defaultPaginationLimit: 50 });
expect(config.accessToken).toEqual("SWSCTXJOZMQWCXA4OUTNZ0REYG");
expect(config.accessToken).toEqual("SWSCVJJET0RQAXFNBMTDZTV1OQ");
expect(config.defaultPaginationLimit).toEqual(50);
});

it("should change default timeout", () => {
update({ timeout: 50 });
expect(config.accessToken).toEqual("SWSCTXJOZMQWCXA4OUTNZ0REYG");
expect(config.accessToken).toEqual("SWSCVJJET0RQAXFNBMTDZTV1OQ");
expect(config.timeout).toEqual(50);
});
});
Expand Down
4 changes: 2 additions & 2 deletions packages/shopware-6-client/src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export interface ClientSettings {
}

const defaultConfig: ClientSettings = {
endpoint: "https://shopware-2.vuestorefront.io",
accessToken: "SWSCTXJOZMQWCXA4OUTNZ0REYG",
endpoint: "https://shopware6-demo.vuestorefront.io",
accessToken: "SWSCVJJET0RQAXFNBMTDZTV1OQ",
contextToken: "",
defaultPaginationLimit: 10,
timeout: 10000, // ms
Expand Down

1 comment on commit aa75ddb

@vercel
Copy link

@vercel vercel bot commented on aa75ddb May 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.