@ikas/storefront-config 4.0.0-alpha.5 → 4.0.0-alpha.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/index.ts +16 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront-config",
3
- "version": "4.0.0-alpha.5",
3
+ "version": "4.0.0-alpha.50",
4
4
  "description": "Common configuration for ikas storefront packages.",
5
5
  "main": "./src/index.ts",
6
6
  "module": "./src/index.ts",
@@ -17,7 +17,7 @@
17
17
  "license": "ISC",
18
18
  "dependencies": {},
19
19
  "devDependencies": {
20
- "@ikas/storefront-models": "^4.0.0-alpha.5",
20
+ "@ikas/storefront-models": "^4.0.0-alpha.50",
21
21
  "prettier": "^2.2.1",
22
22
  "rollup": "^2.75.6",
23
23
  "rollup-plugin-terser": "^7.0.2",
@@ -27,6 +27,6 @@
27
27
  "typescript-transform-paths": "^2.2.2"
28
28
  },
29
29
  "peerDependencies": {
30
- "@ikas/storefront-models": "^4.0.0-alpha.5"
30
+ "@ikas/storefront-models": "^4.0.0-alpha.50"
31
31
  }
32
32
  }
package/src/index.ts CHANGED
@@ -41,6 +41,8 @@ export class IkasStorefrontConfig {
41
41
  private static currentPageComponents?: Record<string, any>;
42
42
  private static isEditor = false;
43
43
 
44
+ private static sessionId?: string;
45
+ private static visitorId?: string;
44
46
  private static observers: IkasStorefrontConfigObserver[] = [];
45
47
 
46
48
  static addObserver(observer: IkasStorefrontConfigObserver) {
@@ -63,6 +65,9 @@ export class IkasStorefrontConfig {
63
65
  //@ts-ignore
64
66
  IkasStorefrontConfig[key] = value;
65
67
  });
68
+ if (config.token) {
69
+ IkasStorefrontConfig.apiKey = config.token;
70
+ }
66
71
  this.notify();
67
72
  } catch (err) {
68
73
  console.error(err);
@@ -258,6 +263,14 @@ export class IkasStorefrontConfig {
258
263
  static getIsEditor() {
259
264
  return IkasStorefrontConfig.isEditor;
260
265
  }
266
+
267
+ static getSessionId() {
268
+ return IkasStorefrontConfig.sessionId;
269
+ }
270
+
271
+ static getVisitorId() {
272
+ return IkasStorefrontConfig.visitorId;
273
+ }
261
274
  }
262
275
 
263
276
  export type IkasStorefrontConfigObserver = {
@@ -272,6 +285,7 @@ export type IkasStorefrontConfigParams = {
272
285
  adminApiUrl?: string;
273
286
  cdnUrl?: string;
274
287
  apiKey?: string;
288
+ token?: string;
275
289
  customerToken?: string;
276
290
  storefrontId?: string;
277
291
  storefrontRoutingId?: string;
@@ -298,4 +312,6 @@ export type IkasStorefrontConfigParams = {
298
312
  merchantSettings?: IkasMerchantSettings | null;
299
313
  currentPageComponents?: Record<string, any>;
300
314
  isEditor: boolean;
315
+ sessionId?: string;
316
+ visitorId?: string;
301
317
  };