@one-commerce/sdk-core 1.19.3-alpha.0 → 1.19.4

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.
@@ -5,7 +5,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.BackofficeUser = exports.BackofficeTenant = exports.BackofficePlugin = exports.BackofficeOrderpath = exports.BackofficeLayout = exports.BackofficeCustomer = exports.BackofficeCatalog = exports.BackofficeAuthorization = void 0;
8
+ exports.BackofficeUser = exports.BackofficeTenant = exports.BackofficePlugin = exports.BackofficeLayout = exports.BackofficeCustomer = exports.BackofficeCatalog = exports.BackofficeAuthorization = void 0;
9
9
 
10
10
  var _utils = require("../utils");
11
11
 
@@ -135,15 +135,15 @@ var BackofficeTenant = /*#__PURE__*/function (_BaseCallClass3) {
135
135
 
136
136
  exports.BackofficeTenant = BackofficeTenant;
137
137
 
138
- var BackofficeOrderpath = /*#__PURE__*/function (_BaseCallClass4) {
139
- _inherits(BackofficeOrderpath, _BaseCallClass4);
138
+ var BackofficeLayout = /*#__PURE__*/function (_BaseCallClass4) {
139
+ _inherits(BackofficeLayout, _BaseCallClass4);
140
140
 
141
- var _super4 = _createSuper(BackofficeOrderpath);
141
+ var _super4 = _createSuper(BackofficeLayout);
142
142
 
143
- function BackofficeOrderpath() {
143
+ function BackofficeLayout() {
144
144
  var _this4;
145
145
 
146
- _classCallCheck(this, BackofficeOrderpath);
146
+ _classCallCheck(this, BackofficeLayout);
147
147
 
148
148
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
149
149
  args[_key4] = arguments[_key4];
@@ -151,25 +151,27 @@ var BackofficeOrderpath = /*#__PURE__*/function (_BaseCallClass4) {
151
151
 
152
152
  _this4 = _super4.call.apply(_super4, [this].concat(args));
153
153
 
154
- _defineProperty(_assertThisInitialized(_this4), "serviceName", 'orderpath');
154
+ _defineProperty(_assertThisInitialized(_this4), "serviceName", 'layout');
155
+
156
+ _defineProperty(_assertThisInitialized(_this4), "isAsideOpened", void 0);
155
157
 
156
158
  return _this4;
157
159
  }
158
160
 
159
- return _createClass(BackofficeOrderpath);
161
+ return _createClass(BackofficeLayout);
160
162
  }(_utils.BaseCallClass);
161
163
 
162
- exports.BackofficeOrderpath = BackofficeOrderpath;
164
+ exports.BackofficeLayout = BackofficeLayout;
163
165
 
164
- var BackofficeLayout = /*#__PURE__*/function (_BaseCallClass5) {
165
- _inherits(BackofficeLayout, _BaseCallClass5);
166
+ var BackofficeAuthorization = /*#__PURE__*/function (_BaseCallClass5) {
167
+ _inherits(BackofficeAuthorization, _BaseCallClass5);
166
168
 
167
- var _super5 = _createSuper(BackofficeLayout);
169
+ var _super5 = _createSuper(BackofficeAuthorization);
168
170
 
169
- function BackofficeLayout() {
171
+ function BackofficeAuthorization() {
170
172
  var _this5;
171
173
 
172
- _classCallCheck(this, BackofficeLayout);
174
+ _classCallCheck(this, BackofficeAuthorization);
173
175
 
174
176
  for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
175
177
  args[_key5] = arguments[_key5];
@@ -177,39 +179,11 @@ var BackofficeLayout = /*#__PURE__*/function (_BaseCallClass5) {
177
179
 
178
180
  _this5 = _super5.call.apply(_super5, [this].concat(args));
179
181
 
180
- _defineProperty(_assertThisInitialized(_this5), "serviceName", 'layout');
181
-
182
- _defineProperty(_assertThisInitialized(_this5), "isAsideOpened", void 0);
182
+ _defineProperty(_assertThisInitialized(_this5), "serviceName", 'authorization');
183
183
 
184
184
  return _this5;
185
185
  }
186
186
 
187
- return _createClass(BackofficeLayout);
188
- }(_utils.BaseCallClass);
189
-
190
- exports.BackofficeLayout = BackofficeLayout;
191
-
192
- var BackofficeAuthorization = /*#__PURE__*/function (_BaseCallClass6) {
193
- _inherits(BackofficeAuthorization, _BaseCallClass6);
194
-
195
- var _super6 = _createSuper(BackofficeAuthorization);
196
-
197
- function BackofficeAuthorization() {
198
- var _this6;
199
-
200
- _classCallCheck(this, BackofficeAuthorization);
201
-
202
- for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
203
- args[_key6] = arguments[_key6];
204
- }
205
-
206
- _this6 = _super6.call.apply(_super6, [this].concat(args));
207
-
208
- _defineProperty(_assertThisInitialized(_this6), "serviceName", 'authorization');
209
-
210
- return _this6;
211
- }
212
-
213
187
  _createClass(BackofficeAuthorization, [{
214
188
  key: "getAuthToken",
215
189
  value: function getAuthToken() {
@@ -222,29 +196,29 @@ var BackofficeAuthorization = /*#__PURE__*/function (_BaseCallClass6) {
222
196
 
223
197
  exports.BackofficeAuthorization = BackofficeAuthorization;
224
198
 
225
- var BackofficeCustomer = /*#__PURE__*/function (_BaseCallClass7) {
226
- _inherits(BackofficeCustomer, _BaseCallClass7);
199
+ var BackofficeCustomer = /*#__PURE__*/function (_BaseCallClass6) {
200
+ _inherits(BackofficeCustomer, _BaseCallClass6);
227
201
 
228
- var _super7 = _createSuper(BackofficeCustomer);
202
+ var _super6 = _createSuper(BackofficeCustomer);
229
203
 
230
204
  function BackofficeCustomer() {
231
- var _this7;
205
+ var _this6;
232
206
 
233
207
  _classCallCheck(this, BackofficeCustomer);
234
208
 
235
- for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
236
- args[_key7] = arguments[_key7];
209
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
210
+ args[_key6] = arguments[_key6];
237
211
  }
238
212
 
239
- _this7 = _super7.call.apply(_super7, [this].concat(args));
213
+ _this6 = _super6.call.apply(_super6, [this].concat(args));
240
214
 
241
- _defineProperty(_assertThisInitialized(_this7), "serviceName", 'customer');
215
+ _defineProperty(_assertThisInitialized(_this6), "serviceName", 'customer');
242
216
 
243
- _defineProperty(_assertThisInitialized(_this7), "id", void 0);
217
+ _defineProperty(_assertThisInitialized(_this6), "id", void 0);
244
218
 
245
- _defineProperty(_assertThisInitialized(_this7), "name", void 0);
219
+ _defineProperty(_assertThisInitialized(_this6), "name", void 0);
246
220
 
247
- return _this7;
221
+ return _this6;
248
222
  }
249
223
 
250
224
  return _createClass(BackofficeCustomer);
@@ -252,31 +226,31 @@ var BackofficeCustomer = /*#__PURE__*/function (_BaseCallClass7) {
252
226
 
253
227
  exports.BackofficeCustomer = BackofficeCustomer;
254
228
 
255
- var BackofficePlugin = /*#__PURE__*/function (_BaseCallClass8) {
256
- _inherits(BackofficePlugin, _BaseCallClass8);
229
+ var BackofficePlugin = /*#__PURE__*/function (_BaseCallClass7) {
230
+ _inherits(BackofficePlugin, _BaseCallClass7);
257
231
 
258
- var _super8 = _createSuper(BackofficePlugin);
232
+ var _super7 = _createSuper(BackofficePlugin);
259
233
 
260
234
  function BackofficePlugin() {
261
- var _this8;
235
+ var _this7;
262
236
 
263
237
  _classCallCheck(this, BackofficePlugin);
264
238
 
265
- for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
266
- args[_key8] = arguments[_key8];
239
+ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
240
+ args[_key7] = arguments[_key7];
267
241
  }
268
242
 
269
- _this8 = _super8.call.apply(_super8, [this].concat(args));
243
+ _this7 = _super7.call.apply(_super7, [this].concat(args));
270
244
 
271
- _defineProperty(_assertThisInitialized(_this8), "serviceName", 'plugin');
245
+ _defineProperty(_assertThisInitialized(_this7), "serviceName", 'plugin');
272
246
 
273
- _defineProperty(_assertThisInitialized(_this8), "id", void 0);
247
+ _defineProperty(_assertThisInitialized(_this7), "id", void 0);
274
248
 
275
- _defineProperty(_assertThisInitialized(_this8), "srcUrl", void 0);
249
+ _defineProperty(_assertThisInitialized(_this7), "srcUrl", void 0);
276
250
 
277
- _defineProperty(_assertThisInitialized(_this8), "name", void 0);
251
+ _defineProperty(_assertThisInitialized(_this7), "name", void 0);
278
252
 
279
- return _this8;
253
+ return _this7;
280
254
  }
281
255
 
282
256
  return _createClass(BackofficePlugin);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/backoffice/services.ts"],"names":["BackofficeCatalog","call","id","BaseCallClass","BackofficeUser","BackofficeTenant","BackofficeOrderpath","BackofficeLayout","BackofficeAuthorization","BackofficeCustomer","BackofficePlugin"],"mappings":";;;;;;;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;IAEaA,iB;;;;;;;;;;;;;;;;kEACG,S;;;;;;;WAEd,2BAA2C;AACzC,aAAO,KAAKC,IAAL,CAAU,iBAAV,CAAP;AACD;;;WACD,sBAAoBC,EAApB,EAAkD;AAChD,aAAO,KAAKD,IAAL,CAAU,cAAV,EAA0BC,EAA1B,CAAP;AACD;;;;EARoCC,oB;;;;IAW1BC,c;;;;;;;;;;;;;;;;mEACG,M;;;;;;;;;;;;;;EADoBD,oB;;;;IAQvBE,gB;;;;;;;;;;;;;;;;mEACG,Q;;;;;;;;;;;;EADsBF,oB;;;;IAOzBG,mB;;;;;;;;;;;;;;;;mEACG,W;;;;;;EADyBH,oB;;;;IAI5BI,gB;;;;;;;;;;;;;;;;mEACG,Q;;;;;;;;EADsBJ,oB;;;;IAKzBK,uB;;;;;;;;;;;;;;;;mEACG,e;;;;;;;WAEd,wBAAgC;AAC9B,aAAO,KAAKP,IAAL,CAAU,cAAV,CAAP;AACD;;;;EAL0CE,oB;;;;IAQhCM,kB;;;;;;;;;;;;;;;;mEACG,U;;;;;;;;;;EADwBN,oB;;;;IAM3BO,gB;;;;;;;;;;;;;;;;mEACG,Q;;;;;;;;;;;;EADsBP,oB","sourcesContent":["import {Backoffice} from \"@one-commerce/sdk-shared\";\n\nimport {BaseCallClass} from \"../utils\";\n\nexport class BackofficeCatalog extends BaseCallClass implements Backoffice.Catalog {\n serviceName = 'catalog'\n\n fetchCategories(): Promise<Array<unknown>> {\n return this.call('fetchCategories')\n }\n public fetchProduct(id: string): Promise<unknown> {\n return this.call('fetchProduct', id)\n }\n}\n\nexport class BackofficeUser extends BaseCallClass implements Backoffice.User {\n serviceName = 'user'\n email?: string;\n id!: string;\n name?: string;\n authorities!: Array<string>;\n}\n\nexport class BackofficeTenant extends BaseCallClass implements Backoffice.Tenant {\n serviceName = 'tenant'\n tenantKey?: string;\n language?: string;\n currency?: string;\n}\n\nexport class BackofficeOrderpath extends BaseCallClass implements Backoffice.Orderpath {\n serviceName = 'orderpath'\n}\n\nexport class BackofficeLayout extends BaseCallClass implements Backoffice.Layout {\n serviceName = 'layout'\n isAsideOpened!: boolean;\n}\n\nexport class BackofficeAuthorization extends BaseCallClass implements Backoffice.Authorization {\n serviceName = 'authorization'\n\n getAuthToken(): Promise<string> {\n return this.call('getAuthToken')\n }\n}\n\nexport class BackofficeCustomer extends BaseCallClass implements Backoffice.Customer {\n serviceName = 'customer'\n id?: string;\n name?: string;\n}\n\nexport class BackofficePlugin extends BaseCallClass implements Backoffice.Plugin {\n serviceName = 'plugin'\n id: string;\n srcUrl?: string;\n name?: string;\n}\n"],"file":"services.js"}
1
+ {"version":3,"sources":["../../../src/backoffice/services.ts"],"names":["BackofficeCatalog","call","id","BaseCallClass","BackofficeUser","BackofficeTenant","BackofficeLayout","BackofficeAuthorization","BackofficeCustomer","BackofficePlugin"],"mappings":";;;;;;;;;AACA;;;;;;;;;;;;;;;;;;;;;;;;IAEaA,iB;;;;;;;;;;;;;;;;kEACG,S;;;;;;;WAEd,2BAA2C;AACzC,aAAO,KAAKC,IAAL,CAAU,iBAAV,CAAP;AACD;;;WACD,sBAAoBC,EAApB,EAAkD;AAChD,aAAO,KAAKD,IAAL,CAAU,cAAV,EAA0BC,EAA1B,CAAP;AACD;;;;EARoCC,oB;;;;IAW1BC,c;;;;;;;;;;;;;;;;mEACG,M;;;;;;;;;;;;;;EADoBD,oB;;;;IAQvBE,gB;;;;;;;;;;;;;;;;mEACG,Q;;;;;;;;;;;;EADsBF,oB;;;;IAOzBG,gB;;;;;;;;;;;;;;;;mEACG,Q;;;;;;;;EADsBH,oB;;;;IAKzBI,uB;;;;;;;;;;;;;;;;mEACG,e;;;;;;;WAEd,wBAAgC;AAC9B,aAAO,KAAKN,IAAL,CAAU,cAAV,CAAP;AACD;;;;EAL0CE,oB;;;;IAQhCK,kB;;;;;;;;;;;;;;;;mEACG,U;;;;;;;;;;EADwBL,oB;;;;IAM3BM,gB;;;;;;;;;;;;;;;;mEACG,Q;;;;;;;;;;;;EADsBN,oB","sourcesContent":["import { Backoffice } from \"@one-commerce/sdk-shared\";\nimport { BaseCallClass } from \"../utils\";\n\nexport class BackofficeCatalog extends BaseCallClass implements Backoffice.Catalog {\n serviceName = 'catalog'\n\n fetchCategories(): Promise<Array<unknown>> {\n return this.call('fetchCategories')\n }\n public fetchProduct(id: string): Promise<unknown> {\n return this.call('fetchProduct', id)\n }\n}\n\nexport class BackofficeUser extends BaseCallClass implements Backoffice.User {\n serviceName = 'user'\n email?: string;\n id!: string;\n name?: string;\n authorities!: Array<string>;\n}\n\nexport class BackofficeTenant extends BaseCallClass implements Backoffice.Tenant {\n serviceName = 'tenant'\n tenantKey?: string;\n language?: string;\n currency?: string;\n}\n\nexport class BackofficeLayout extends BaseCallClass implements Backoffice.Layout {\n serviceName = 'layout'\n isAsideOpened!: boolean;\n}\n\nexport class BackofficeAuthorization extends BaseCallClass implements Backoffice.Authorization {\n serviceName = 'authorization'\n\n getAuthToken(): Promise<string> {\n return this.call('getAuthToken')\n }\n}\n\nexport class BackofficeCustomer extends BaseCallClass implements Backoffice.Customer {\n serviceName = 'customer'\n id?: string;\n name?: string;\n}\n\nexport class BackofficePlugin extends BaseCallClass implements Backoffice.Plugin {\n serviceName = 'plugin'\n id: string;\n srcUrl?: string;\n name?: string;\n}\n"],"file":"services.js"}
package/lib/cjs/index.js CHANGED
@@ -169,7 +169,11 @@ var Sdk = /*#__PURE__*/function (_Events) {
169
169
  _createClass(Sdk, [{
170
170
  key: "initializeContextClass",
171
171
  value: function initializeContextClass() {
172
- return new this.contextClass(this.callFunction.bind(this));
172
+ if (this.contextClass) {
173
+ return new this.contextClass(this.callFunction.bind(this));
174
+ }
175
+
176
+ return {};
173
177
  }
174
178
  }, {
175
179
  key: "initializeServiceGetters",
@@ -254,11 +258,15 @@ var Sdk = /*#__PURE__*/function (_Events) {
254
258
  method: fun,
255
259
  payload: payload
256
260
  });
257
- return new Promise(function (resolve) {
261
+ return new Promise(function (resolve, reject) {
258
262
  var onChannelMessage = function onChannelMessage(response) {
259
263
  if (response.callId === callId) {
260
264
  _this4.channel.unsubscribe(_sdkShared.Message.METHOD_RESULT, onChannelMessage);
261
265
 
266
+ if (response !== null && response !== void 0 && response.isException) {
267
+ return reject(response.result);
268
+ }
269
+
262
270
  return resolve(response.result);
263
271
  }
264
272
  };
@@ -325,7 +333,6 @@ var BackofficeSdk = /*#__PURE__*/function (_Sdk) {
325
333
  hash: '',
326
334
  query: {}
327
335
  },
328
- orderpath: new _services.BackofficeOrderpath(_this5.callFunction.bind(_assertThisInitialized(_this5))),
329
336
  catalog: new _services.BackofficeCatalog(_this5.callFunction.bind(_assertThisInitialized(_this5))),
330
337
  user: new _services.BackofficeUser(_this5.callFunction.bind(_assertThisInitialized(_this5))),
331
338
  tenant: new _services.BackofficeTenant(_this5.callFunction.bind(_assertThisInitialized(_this5))),
@@ -370,7 +377,8 @@ var ShopSdk = /*#__PURE__*/function (_Sdk2) {
370
377
  catalog: new _services2.ShopCatalog(_this6.callFunction.bind(_assertThisInitialized(_this6))),
371
378
  account: new _services2.ShopAccount(_this6.callFunction.bind(_assertThisInitialized(_this6))),
372
379
  utils: new _services2.ShopUtils(_this6.callFunction.bind(_assertThisInitialized(_this6))),
373
- config: new _services2.ShopConfig(_this6.callFunction.bind(_assertThisInitialized(_this6)))
380
+ config: new _services2.ShopConfig(_this6.callFunction.bind(_assertThisInitialized(_this6))),
381
+ wishlist: new _services2.ShopWishlist(_this6.callFunction.bind(_assertThisInitialized(_this6)))
374
382
  });
375
383
 
376
384
  return _this6;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"names":["SdkInternalEvents","SdkEvents","Sdk","options","initializeServiceGetters","origin","channel","Channel","targetOrigin","target","window","parent","subscribe","Message","INIT","payload","log","Object","entries","instances","forEach","key","value","BaseCallClass","update","attributesForKey","warn","emit","isInitialized","UPDATE","FRAME_HEIGHT_REQUEST","autoheight","sendFrameHeight","connect","then","initializeHeightObserver","setupOptions","contextClass","callFunction","bind","keys","serviceName","defineProperty","get","body","document","html","documentElement","height","Math","max","scrollHeight","offsetHeight","clientHeight","postMessage","FRAME_HEIGHT_CHANGE","onMutationObserved","querySelector","config","attributes","attributeOldValue","characterData","characterDataOldValue","childList","subtree","heightMutationObserver","MutationObserver","observe","debug","context","service","fun","callId","METHOD_CALL","method","Promise","resolve","onChannelMessage","response","unsubscribe","METHOD_RESULT","result","event","NAVIGATION_PUSH","data","console","Events","BackofficeSdk","route","hash","query","orderpath","BackofficeOrderpath","catalog","BackofficeCatalog","user","BackofficeUser","tenant","BackofficeTenant","layout","BackofficeLayout","authorization","BackofficeAuthorization","customer","BackofficeCustomer","plugin","BackofficePlugin","initializeContextClass","ShopSdk","ShopAuthorization","cart","ShopCart","ShopCatalog","account","ShopAccount","utils","ShopUtils","ShopConfig"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAMA;;AAEA;;AAGA;;AAUA;;AACA;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIKA,iB;;WAAAA,iB;AAAAA,EAAAA,iB;AAAAA,EAAAA,iB;GAAAA,iB,KAAAA,iB;;IAIOC,S;;;WAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;GAAAA,S,yBAAAA,S;;IAuBGC,G;;;;;AAkCb,eAAYC,OAAZ,EAAiC;AAAA;;AAAA;;AAC/B;;AAD+B;;AAAA,iEA/BZ,IA+BY;;AAAA,6EA9BA,IA8BA;;AAAA;;AAAA,oEA5BjB,KA4BiB;;AAAA;;AAAA;;AAE/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;;;;EADqBzG,G;;;;IAkBtB0G,O;;;;;;;;;;;;;;;;iEACC;AACVpB,MAAAA,KAAK,EAAE;AACLC,QAAAA,IAAI,EAAE,EADD;AAELC,QAAAA,KAAK,EAAE;AAFF,OADG;AAKVW,MAAAA,aAAa,EAAE,IAAIQ,4BAAJ,CAAsB,OAAKvE,YAAL,CAAkBC,IAAlB,gCAAtB,CALL;AAMVuE,MAAAA,IAAI,EAAE,IAAIC,mBAAJ,CAAa,OAAKzE,YAAL,CAAkBC,IAAlB,gCAAb,CANI;AAOVsD,MAAAA,OAAO,EAAE,IAAImB,sBAAJ,CAAgB,OAAK1E,YAAL,CAAkBC,IAAlB,gCAAhB,CAPC;AAQV0E,MAAAA,OAAO,EAAE,IAAIC,sBAAJ,CAAgB,OAAK5E,YAAL,CAAkBC,IAAlB,gCAAhB,CARC;AASV4E,MAAAA,KAAK,EAAE,IAAIC,oBAAJ,CAAc,OAAK9E,YAAL,CAAkBC,IAAlB,gCAAd,CATG;AAUVmB,MAAAA,MAAM,EAAE,IAAI2D,qBAAJ,CAAe,OAAK/E,YAAL,CAAkBC,IAAlB,gCAAf;AAVE,K;;;;;;EADerC,G","sourcesContent":["import {\n Backoffice,\n Message,\n Route,\n Shop\n} from \"@one-commerce/sdk-shared\";\nimport Channel from \"iframe-channel\"\n\nimport {\n AddToCartContext,\n} from \"./backoffice/context\";\nimport {\n BackofficeAuthorization,\n BackofficeCatalog,\n BackofficeCustomer,\n BackofficeLayout,\n BackofficeOrderpath,\n BackofficePlugin,\n BackofficeTenant,\n BackofficeUser,\n} from \"./backoffice/services\";\nimport Events from \"./events\";\nimport {\n ShopAccount, ShopAuthorization,\n ShopCart,\n ShopCatalog, ShopConfig, ShopUtils,\n} from \"./shop/services\";\nimport { BaseCallClass, generateCallId } from \"./utils\";\n\nexport type AvailableContext = AddToCartContext\n\nenum SdkInternalEvents {\n INIT='INIT',\n UPDATE='UPDATE'\n}\nexport enum SdkEvents {\n INIT='INIT',\n UPDATE='UPDATE',\n}\nexport interface SdkOptions {\n debug?: boolean\n autoheight?: boolean\n origin: string,\n context?: Class<AvailableContext>;\n}\n\ninterface NamedNavigationPayload {\n name: string\n params: any\n}\n\ninterface PathNavigationPayload {\n path: string\n params: any\n}\n\nexport type Class<T = any> = new (...args: any[]) => T;\n\nabstract class Sdk<T> extends Events {\n private channel!: Channel;\n private static debug = false\n private autoheight = true\n private heightMutationObserver = null\n origin: string;\n isInitialized = false\n instances!: T;\n contextClass?: Class<AvailableContext>;\n\n private static log(...data: any[]) {\n Sdk.debug && console.log('[SDK Core] ', ...data)\n }\n\n private static warn(...data: any[]) {\n console.warn('[SDK Core] ', ...data)\n }\n\n public initializeContextClass(): AvailableContext {\n return new this.contextClass(this.callFunction.bind(this))\n }\n\n private initializeServiceGetters(): void {\n if (this.instances) {\n Object.keys(this.instances).forEach((serviceName: string) => {\n Object.defineProperty(this, serviceName, {\n get: () => {\n return this.isInitialized ? this.instances![serviceName as keyof T] : null\n }\n })\n })\n }\n }\n\n constructor(options: SdkOptions) {\n super()\n this.initializeServiceGetters()\n this.origin = options.origin\n this.channel = new Channel({\n targetOrigin: this.origin,\n target: window.parent,\n })\n this.channel.subscribe(Message.INIT, (payload: any) => {\n Sdk.log('Handling INIT message')\n Object.entries(this.instances!).forEach(([key, value]: [key: string, value: BaseCallClass | Record<string, any>]) => {\n if (value instanceof BaseCallClass) {\n value.update(payload)\n } else {\n const attributesForKey = payload[key]\n if (typeof attributesForKey !== 'undefined') {\n BaseCallClass.update(value as Record<string, any>, payload[key])\n } else {\n Sdk.warn(`Missing attributes for ${key} in `, payload)\n }\n }\n })\n Sdk.log('Emitting INIT with payload ', this.instances)\n this.emit(SdkInternalEvents.INIT, this.instances)\n this.isInitialized = true\n })\n this.channel.subscribe(Message.UPDATE, (payload: any) => {\n Sdk.log('Emitting UPDATE with payload ', payload)\n this.emit(SdkInternalEvents.UPDATE, payload)\n })\n this.channel.subscribe(Message.FRAME_HEIGHT_REQUEST, (payload: any) => {\n if (this.autoheight) {\n Sdk.log('Request for iframe height')\n this.sendFrameHeight()\n }\n })\n this.channel.connect().then(() => {\n Sdk.log('Connected with ONe SDK')\n if(this.autoheight) {\n this.initializeHeightObserver()\n }\n })\n this.setupOptions(options)\n Sdk.log('Initialized.')\n }\n\n private sendFrameHeight() {\n const body = document.body, html = document.documentElement;\n const height = Math.max(body.scrollHeight, body.offsetHeight,\n html.clientHeight, html.scrollHeight, html.offsetHeight);\n this.channel.postMessage(Message.FRAME_HEIGHT_CHANGE, height)\n }\n\n private initializeHeightObserver() {\n if (\"MutationObserver\" in window) {\n const onMutationObserved = () => {\n this.sendFrameHeight()\n }\n const target = document.querySelector('body'),\n config = {\n attributes: true,\n attributeOldValue: false,\n characterData: true,\n characterDataOldValue: false,\n childList: true,\n subtree: true\n }\n\n this.heightMutationObserver = new MutationObserver(onMutationObserved)\n\n Sdk.log('Create body MutationObserver')\n this.heightMutationObserver.observe(target, config)\n } else {\n Sdk.warn('MutationObserver not available. Auto-height functionality disabled.')\n }\n }\n\n private setupOptions(options?: SdkOptions) {\n if (options) {\n if (typeof options.debug !== 'undefined') {\n Sdk.debug = options.debug\n }\n if (typeof options.autoheight !== 'undefined') {\n this.autoheight = options.autoheight\n }\n this.contextClass = options.context\n }\n }\n protected callFunction(service: string, fun: string, ...payload: any) {\n const callId: string = generateCallId()\n if (this.isInitialized) {\n Sdk.log(`Call ID ${callId} for ${service}:${fun}`, payload)\n this.channel.postMessage(Message.METHOD_CALL, {\n callId,\n service,\n method: fun,\n payload: payload,\n })\n return new Promise((resolve) => {\n const onChannelMessage = (response: any) => {\n if (response.callId === callId) {\n this.channel.unsubscribe(Message.METHOD_RESULT, onChannelMessage)\n return resolve(response.result)\n }\n }\n this.channel.subscribe(Message.METHOD_RESULT, onChannelMessage)\n })\n }\n Sdk.log('SDK is not initialized!')\n return Promise.resolve(null)\n }\n\n public navigate(event: NamedNavigationPayload | PathNavigationPayload) {\n this.channel.postMessage(Message.NAVIGATION_PUSH, event)\n }\n\n}\n\nexport interface BackofficeInstances extends Backoffice.Api {\n route: Route,\n orderpath: BackofficeOrderpath,\n catalog: BackofficeCatalog,\n user: BackofficeUser,\n tenant: BackofficeTenant,\n layout: BackofficeLayout,\n authorization: BackofficeAuthorization,\n customer: BackofficeCustomer,\n plugin: BackofficePlugin,\n context: AvailableContext\n}\n\nexport interface ShopInstances extends Shop.Api {\n authorization: ShopAuthorization,\n route: Route,\n cart: ShopCart,\n catalog: ShopCatalog,\n account: ShopAccount,\n utils: ShopUtils\n config: ShopConfig\n}\n\nexport class BackofficeSdk extends Sdk<BackofficeInstances> {\n instances = {\n route: {\n hash: '',\n query: {},\n },\n orderpath: new BackofficeOrderpath(this.callFunction.bind(this)),\n catalog: new BackofficeCatalog(this.callFunction.bind(this)),\n user: new BackofficeUser(this.callFunction.bind(this)),\n tenant: new BackofficeTenant(this.callFunction.bind(this)),\n layout: new BackofficeLayout(this.callFunction.bind(this)),\n authorization: new BackofficeAuthorization(this.callFunction.bind(this)),\n customer: new BackofficeCustomer(this.callFunction.bind(this)),\n plugin: new BackofficePlugin(this.callFunction.bind(this)),\n context: this.initializeContextClass()\n }\n}\n\nexport class ShopSdk extends Sdk<ShopInstances> {\n instances = {\n route: {\n hash: '',\n query: {},\n },\n authorization: new ShopAuthorization(this.callFunction.bind(this)),\n cart: new ShopCart(this.callFunction.bind(this)),\n catalog: new ShopCatalog(this.callFunction.bind(this)),\n account: new ShopAccount(this.callFunction.bind(this)),\n utils: new ShopUtils(this.callFunction.bind(this)),\n config: new ShopConfig(this.callFunction.bind(this))\n }\n}\n\nexport {\n AddToCartContext\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/index.ts"],"names":["SdkInternalEvents","SdkEvents","Sdk","options","initializeServiceGetters","origin","channel","Channel","targetOrigin","target","window","parent","subscribe","Message","INIT","payload","log","Object","entries","instances","forEach","key","value","BaseCallClass","update","attributesForKey","warn","emit","isInitialized","UPDATE","FRAME_HEIGHT_REQUEST","autoheight","sendFrameHeight","connect","then","initializeHeightObserver","setupOptions","contextClass","callFunction","bind","keys","serviceName","defineProperty","get","body","document","html","documentElement","height","Math","max","scrollHeight","offsetHeight","clientHeight","postMessage","FRAME_HEIGHT_CHANGE","onMutationObserved","querySelector","config","attributes","attributeOldValue","characterData","characterDataOldValue","childList","subtree","heightMutationObserver","MutationObserver","observe","debug","context","service","fun","callId","METHOD_CALL","method","Promise","resolve","reject","onChannelMessage","response","unsubscribe","METHOD_RESULT","isException","result","event","NAVIGATION_PUSH","data","console","Events","BackofficeSdk","route","hash","query","catalog","BackofficeCatalog","user","BackofficeUser","tenant","BackofficeTenant","layout","BackofficeLayout","authorization","BackofficeAuthorization","customer","BackofficeCustomer","plugin","BackofficePlugin","initializeContextClass","ShopSdk","ShopAuthorization","cart","ShopCart","ShopCatalog","account","ShopAccount","utils","ShopUtils","ShopConfig","wishlist","ShopWishlist"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAMA;;AAEA;;AAGA;;AASA;;AACA;;AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIKA,iB;;WAAAA,iB;AAAAA,EAAAA,iB;AAAAA,EAAAA,iB;GAAAA,iB,KAAAA,iB;;IAIOC,S;;;WAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;GAAAA,S,yBAAAA,S;;IAuBGC,G;;;;;AAqCb,eAAYC,OAAZ,EAAiC;AAAA;;AAAA;;AAC/B;;AAD+B;;AAAA,iEAlCZ,IAkCY;;AAAA,6EAjCA,IAiCA;;AAAA;;AAAA,oEA/BjB,KA+BiB;;AAAA;;AAAA;;AAE/B,UAAKC,wBAAL;;AACA,UAAKC,MAAL,GAAcF,OAAO,CAACE,MAAtB;AACA,UAAKC,OAAL,GAAe,IAAIC,yBAAJ,CAAY;AACzBC,MAAAA,YAAY,EAAE,MAAKH,MADM;AAEzBI,MAAAA,MAAM,EAAEC,MAAM,CAACC;AAFU,KAAZ,CAAf;;AAIA,UAAKL,OAAL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AAAA,KAAK,EAAE;AAFF,OADG;AAKVS,MAAAA,aAAa,EAAE,IAAIQ,4BAAJ,CAAsB,OAAKvE,YAAL,CAAkBC,IAAlB,gCAAtB,CALL;AAMVuE,MAAAA,IAAI,EAAE,IAAIC,mBAAJ,CAAa,OAAKzE,YAAL,CAAkBC,IAAlB,gCAAb,CANI;AAOVsD,MAAAA,OAAO,EAAE,IAAImB,sBAAJ,CAAgB,OAAK1E,YAAL,CAAkBC,IAAlB,gCAAhB,CAPC;AAQV0E,MAAAA,OAAO,EAAE,IAAIC,sBAAJ,CAAgB,OAAK5E,YAAL,CAAkBC,IAAlB,gCAAhB,CARC;AASV4E,MAAAA,KAAK,EAAE,IAAIC,oBAAJ,CAAc,OAAK9E,YAAL,CAAkBC,IAAlB,gCAAd,CATG;AAUVmB,MAAAA,MAAM,EAAE,IAAI2D,qBAAJ,CAAe,OAAK/E,YAAL,CAAkBC,IAAlB,gCAAf,CAVE;AAWV+E,MAAAA,QAAQ,EAAE,IAAIC,uBAAJ,CAAiB,OAAKjF,YAAL,CAAkBC,IAAlB,gCAAjB;AAXA,K;;;;;;EADerC,G","sourcesContent":["import {\n Backoffice,\n Message,\n Route,\n Shop\n} from \"@one-commerce/sdk-shared\";\nimport Channel from \"iframe-channel\"\n\nimport {\n AddToCartContext,\n} from \"./backoffice/context\";\nimport {\n BackofficeAuthorization,\n BackofficeCatalog,\n BackofficeCustomer,\n BackofficeLayout,\n BackofficePlugin,\n BackofficeTenant,\n BackofficeUser,\n} from \"./backoffice/services\";\nimport Events from \"./events\";\nimport {\n ShopAccount,\n ShopAuthorization,\n ShopCart,\n ShopCatalog,\n ShopConfig,\n ShopUtils,\n ShopWishlist,\n} from \"./shop/services\";\nimport { BaseCallClass, generateCallId } from \"./utils\";\n\nexport type AvailableContext = AddToCartContext\n\nenum SdkInternalEvents {\n INIT='INIT',\n UPDATE='UPDATE'\n}\nexport enum SdkEvents {\n INIT='INIT',\n UPDATE='UPDATE',\n}\nexport interface SdkOptions {\n debug?: boolean\n autoheight?: boolean\n origin: string,\n context?: Class<AvailableContext>;\n}\n\ninterface NamedNavigationPayload {\n name: string\n params: any\n}\n\ninterface PathNavigationPayload {\n path: string\n params: any\n}\n\nexport type Class<T = any> = new (...args: any[]) => T;\n\nabstract class Sdk<T> extends Events {\n private channel!: Channel;\n private static debug = false\n private autoheight = true\n private heightMutationObserver = null\n origin: string;\n isInitialized = false\n instances!: T;\n contextClass?: Class<AvailableContext>;\n\n private static log(...data: any[]) {\n Sdk.debug && console.log('[SDK Core] ', ...data)\n }\n\n private static warn(...data: any[]) {\n console.warn('[SDK Core] ', ...data)\n }\n\n public initializeContextClass(): AvailableContext {\n if (this.contextClass) {\n return new this.contextClass(this.callFunction.bind(this))\n }\n return {} as AvailableContext\n }\n\n private initializeServiceGetters(): void {\n if (this.instances) {\n Object.keys(this.instances).forEach((serviceName: string) => {\n Object.defineProperty(this, serviceName, {\n get: () => {\n return this.isInitialized ? this.instances![serviceName as keyof T] : null\n }\n })\n })\n }\n }\n\n constructor(options: SdkOptions) {\n super()\n this.initializeServiceGetters()\n this.origin = options.origin\n this.channel = new Channel({\n targetOrigin: this.origin,\n target: window.parent,\n })\n this.channel.subscribe(Message.INIT, (payload: any) => {\n Sdk.log('Handling INIT message')\n Object.entries(this.instances!).forEach(([key, value]: [key: string, value: BaseCallClass | Record<string, any>]) => {\n if (value instanceof BaseCallClass) {\n value.update(payload)\n } else {\n const attributesForKey = payload[key]\n if (typeof attributesForKey !== 'undefined') {\n BaseCallClass.update(value as Record<string, any>, payload[key])\n } else {\n Sdk.warn(`Missing attributes for ${key} in `, payload)\n }\n }\n })\n Sdk.log('Emitting INIT with payload ', this.instances)\n this.emit(SdkInternalEvents.INIT, this.instances)\n this.isInitialized = true\n })\n this.channel.subscribe(Message.UPDATE, (payload: any) => {\n Sdk.log('Emitting UPDATE with payload ', payload)\n this.emit(SdkInternalEvents.UPDATE, payload)\n })\n this.channel.subscribe(Message.FRAME_HEIGHT_REQUEST, (payload: any) => {\n if (this.autoheight) {\n Sdk.log('Request for iframe height')\n this.sendFrameHeight()\n }\n })\n this.channel.connect().then(() => {\n Sdk.log('Connected with ONe SDK')\n if(this.autoheight) {\n this.initializeHeightObserver()\n }\n })\n this.setupOptions(options)\n Sdk.log('Initialized.')\n }\n\n private sendFrameHeight() {\n const body = document.body, html = document.documentElement;\n const height = Math.max(body.scrollHeight, body.offsetHeight,\n html.clientHeight, html.scrollHeight, html.offsetHeight);\n this.channel.postMessage(Message.FRAME_HEIGHT_CHANGE, height)\n }\n\n private initializeHeightObserver() {\n if (\"MutationObserver\" in window) {\n const onMutationObserved = () => {\n this.sendFrameHeight()\n }\n const target = document.querySelector('body'),\n config = {\n attributes: true,\n attributeOldValue: false,\n characterData: true,\n characterDataOldValue: false,\n childList: true,\n subtree: true\n }\n\n this.heightMutationObserver = new MutationObserver(onMutationObserved)\n\n Sdk.log('Create body MutationObserver')\n this.heightMutationObserver.observe(target, config)\n } else {\n Sdk.warn('MutationObserver not available. Auto-height functionality disabled.')\n }\n }\n\n private setupOptions(options?: SdkOptions) {\n if (options) {\n if (typeof options.debug !== 'undefined') {\n Sdk.debug = options.debug\n }\n if (typeof options.autoheight !== 'undefined') {\n this.autoheight = options.autoheight\n }\n this.contextClass = options.context\n }\n }\n protected callFunction(service: string, fun: string, ...payload: any) {\n const callId: string = generateCallId()\n if (this.isInitialized) {\n Sdk.log(`Call ID ${callId} for ${service}:${fun}`, payload)\n this.channel.postMessage(Message.METHOD_CALL, {\n callId,\n service,\n method: fun,\n payload: payload,\n })\n return new Promise((resolve, reject) => {\n const onChannelMessage = (response: any) => {\n if (response.callId === callId) {\n this.channel.unsubscribe(Message.METHOD_RESULT, onChannelMessage)\n if (response?.isException) {\n return reject(response.result);\n }\n\n return resolve(response.result);\n }\n }\n this.channel.subscribe(Message.METHOD_RESULT, onChannelMessage)\n })\n }\n Sdk.log('SDK is not initialized!')\n return Promise.resolve(null)\n }\n\n public navigate(event: NamedNavigationPayload | PathNavigationPayload) {\n this.channel.postMessage(Message.NAVIGATION_PUSH, event)\n }\n\n}\n\nexport interface BackofficeInstances extends Backoffice.Api {\n route: Route,\n catalog: BackofficeCatalog,\n user: BackofficeUser,\n tenant: BackofficeTenant,\n layout: BackofficeLayout,\n authorization: BackofficeAuthorization,\n customer: BackofficeCustomer,\n plugin: BackofficePlugin,\n context: AvailableContext\n}\n\nexport interface ShopInstances extends Shop.Api {\n authorization: ShopAuthorization,\n route: Route,\n cart: ShopCart,\n catalog: ShopCatalog,\n account: ShopAccount,\n utils: ShopUtils\n config: ShopConfig,\n wishlist: ShopWishlist,\n}\n\nexport class BackofficeSdk extends Sdk<BackofficeInstances> {\n instances = {\n route: {\n hash: '',\n query: {},\n },\n catalog: new BackofficeCatalog(this.callFunction.bind(this)),\n user: new BackofficeUser(this.callFunction.bind(this)),\n tenant: new BackofficeTenant(this.callFunction.bind(this)),\n layout: new BackofficeLayout(this.callFunction.bind(this)),\n authorization: new BackofficeAuthorization(this.callFunction.bind(this)),\n customer: new BackofficeCustomer(this.callFunction.bind(this)),\n plugin: new BackofficePlugin(this.callFunction.bind(this)),\n context: this.initializeContextClass()\n }\n}\n\nexport class ShopSdk extends Sdk<ShopInstances> {\n instances = {\n route: {\n hash: '',\n query: {},\n },\n authorization: new ShopAuthorization(this.callFunction.bind(this)),\n cart: new ShopCart(this.callFunction.bind(this)),\n catalog: new ShopCatalog(this.callFunction.bind(this)),\n account: new ShopAccount(this.callFunction.bind(this)),\n utils: new ShopUtils(this.callFunction.bind(this)),\n config: new ShopConfig(this.callFunction.bind(this)),\n wishlist: new ShopWishlist(this.callFunction.bind(this)),\n }\n}\n\nexport {\n AddToCartContext\n}\n"],"file":"index.js"}
@@ -5,7 +5,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.ShopUtils = exports.ShopConfig = exports.ShopCatalog = exports.ShopCart = exports.ShopAuthorization = exports.ShopAccount = void 0;
8
+ exports.ShopWishlist = exports.ShopUtils = exports.ShopConfig = exports.ShopCatalog = exports.ShopCart = exports.ShopAuthorization = exports.ShopAccount = void 0;
9
9
 
10
10
  var _utils = require("../utils");
11
11
 
@@ -73,15 +73,15 @@ var ShopCatalog = /*#__PURE__*/function (_BaseCallClass) {
73
73
 
74
74
  exports.ShopCatalog = ShopCatalog;
75
75
 
76
- var ShopAccount = /*#__PURE__*/function (_BaseCallClass2) {
77
- _inherits(ShopAccount, _BaseCallClass2);
76
+ var ShopWishlist = /*#__PURE__*/function (_BaseCallClass2) {
77
+ _inherits(ShopWishlist, _BaseCallClass2);
78
78
 
79
- var _super2 = _createSuper(ShopAccount);
79
+ var _super2 = _createSuper(ShopWishlist);
80
80
 
81
- function ShopAccount() {
81
+ function ShopWishlist() {
82
82
  var _this2;
83
83
 
84
- _classCallCheck(this, ShopAccount);
84
+ _classCallCheck(this, ShopWishlist);
85
85
 
86
86
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
87
87
  args[_key2] = arguments[_key2];
@@ -89,17 +89,60 @@ var ShopAccount = /*#__PURE__*/function (_BaseCallClass2) {
89
89
 
90
90
  _this2 = _super2.call.apply(_super2, [this].concat(args));
91
91
 
92
- _defineProperty(_assertThisInitialized(_this2), "serviceName", 'account');
92
+ _defineProperty(_assertThisInitialized(_this2), "serviceName", 'wishlist');
93
93
 
94
- _defineProperty(_assertThisInitialized(_this2), "client", void 0);
94
+ return _this2;
95
+ }
95
96
 
96
- _defineProperty(_assertThisInitialized(_this2), "isAuthenticated", void 0);
97
+ _createClass(ShopWishlist, [{
98
+ key: "addProductsToWishlist",
99
+ value: function addProductsToWishlist(wishlistId, newProduct) {
100
+ return this.call('addProductsToWishlist', wishlistId, newProduct);
101
+ }
102
+ }, {
103
+ key: "getWishlists",
104
+ value: function getWishlists() {
105
+ return this.call('getWishlists');
106
+ }
107
+ }, {
108
+ key: "createWishlist",
109
+ value: function createWishlist(name) {
110
+ return this.call('createWishlist', name);
111
+ }
112
+ }]);
97
113
 
98
- _defineProperty(_assertThisInitialized(_this2), "user", void 0);
114
+ return ShopWishlist;
115
+ }(_utils.BaseCallClass);
99
116
 
100
- _defineProperty(_assertThisInitialized(_this2), "manager", void 0);
117
+ exports.ShopWishlist = ShopWishlist;
101
118
 
102
- return _this2;
119
+ var ShopAccount = /*#__PURE__*/function (_BaseCallClass3) {
120
+ _inherits(ShopAccount, _BaseCallClass3);
121
+
122
+ var _super3 = _createSuper(ShopAccount);
123
+
124
+ function ShopAccount() {
125
+ var _this3;
126
+
127
+ _classCallCheck(this, ShopAccount);
128
+
129
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
130
+ args[_key3] = arguments[_key3];
131
+ }
132
+
133
+ _this3 = _super3.call.apply(_super3, [this].concat(args));
134
+
135
+ _defineProperty(_assertThisInitialized(_this3), "serviceName", 'account');
136
+
137
+ _defineProperty(_assertThisInitialized(_this3), "client", void 0);
138
+
139
+ _defineProperty(_assertThisInitialized(_this3), "isAuthenticated", void 0);
140
+
141
+ _defineProperty(_assertThisInitialized(_this3), "user", void 0);
142
+
143
+ _defineProperty(_assertThisInitialized(_this3), "manager", void 0);
144
+
145
+ return _this3;
103
146
  }
104
147
 
105
148
  _createClass(ShopAccount, [{
@@ -118,31 +161,31 @@ var ShopAccount = /*#__PURE__*/function (_BaseCallClass2) {
118
161
 
119
162
  exports.ShopAccount = ShopAccount;
120
163
 
121
- var ShopCart = /*#__PURE__*/function (_BaseCallClass3) {
122
- _inherits(ShopCart, _BaseCallClass3);
164
+ var ShopCart = /*#__PURE__*/function (_BaseCallClass4) {
165
+ _inherits(ShopCart, _BaseCallClass4);
123
166
 
124
- var _super3 = _createSuper(ShopCart);
167
+ var _super4 = _createSuper(ShopCart);
125
168
 
126
169
  function ShopCart() {
127
- var _this3;
170
+ var _this4;
128
171
 
129
172
  _classCallCheck(this, ShopCart);
130
173
 
131
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
132
- args[_key3] = arguments[_key3];
174
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
175
+ args[_key4] = arguments[_key4];
133
176
  }
134
177
 
135
- _this3 = _super3.call.apply(_super3, [this].concat(args));
178
+ _this4 = _super4.call.apply(_super4, [this].concat(args));
136
179
 
137
- _defineProperty(_assertThisInitialized(_this3), "serviceName", 'cart');
180
+ _defineProperty(_assertThisInitialized(_this4), "serviceName", 'cart');
138
181
 
139
- _defineProperty(_assertThisInitialized(_this3), "carts", void 0);
182
+ _defineProperty(_assertThisInitialized(_this4), "carts", void 0);
140
183
 
141
- _defineProperty(_assertThisInitialized(_this3), "currentCart", void 0);
184
+ _defineProperty(_assertThisInitialized(_this4), "currentCart", void 0);
142
185
 
143
- _defineProperty(_assertThisInitialized(_this3), "totalCartPrice", void 0);
186
+ _defineProperty(_assertThisInitialized(_this4), "totalCartPrice", void 0);
144
187
 
145
- return _this3;
188
+ return _this4;
146
189
  }
147
190
 
148
191
  _createClass(ShopCart, [{
@@ -157,25 +200,25 @@ var ShopCart = /*#__PURE__*/function (_BaseCallClass3) {
157
200
 
158
201
  exports.ShopCart = ShopCart;
159
202
 
160
- var ShopAuthorization = /*#__PURE__*/function (_BaseCallClass4) {
161
- _inherits(ShopAuthorization, _BaseCallClass4);
203
+ var ShopAuthorization = /*#__PURE__*/function (_BaseCallClass5) {
204
+ _inherits(ShopAuthorization, _BaseCallClass5);
162
205
 
163
- var _super4 = _createSuper(ShopAuthorization);
206
+ var _super5 = _createSuper(ShopAuthorization);
164
207
 
165
208
  function ShopAuthorization() {
166
- var _this4;
209
+ var _this5;
167
210
 
168
211
  _classCallCheck(this, ShopAuthorization);
169
212
 
170
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
171
- args[_key4] = arguments[_key4];
213
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
214
+ args[_key5] = arguments[_key5];
172
215
  }
173
216
 
174
- _this4 = _super4.call.apply(_super4, [this].concat(args));
217
+ _this5 = _super5.call.apply(_super5, [this].concat(args));
175
218
 
176
- _defineProperty(_assertThisInitialized(_this4), "serviceName", 'authorization');
219
+ _defineProperty(_assertThisInitialized(_this5), "serviceName", 'authorization');
177
220
 
178
- return _this4;
221
+ return _this5;
179
222
  }
180
223
 
181
224
  _createClass(ShopAuthorization, [{
@@ -190,41 +233,41 @@ var ShopAuthorization = /*#__PURE__*/function (_BaseCallClass4) {
190
233
 
191
234
  exports.ShopAuthorization = ShopAuthorization;
192
235
 
193
- var ShopUtils = /*#__PURE__*/function (_BaseCallClass5) {
194
- _inherits(ShopUtils, _BaseCallClass5);
236
+ var ShopUtils = /*#__PURE__*/function (_BaseCallClass6) {
237
+ _inherits(ShopUtils, _BaseCallClass6);
195
238
 
196
- var _super5 = _createSuper(ShopUtils);
239
+ var _super6 = _createSuper(ShopUtils);
197
240
 
198
241
  function ShopUtils(call) {
199
- var _this5;
242
+ var _this6;
200
243
 
201
244
  _classCallCheck(this, ShopUtils);
202
245
 
203
- _this5 = _super5.call(this, call);
246
+ _this6 = _super6.call(this, call);
204
247
 
205
- _defineProperty(_assertThisInitialized(_this5), "serviceName", 'utils');
248
+ _defineProperty(_assertThisInitialized(_this6), "serviceName", 'utils');
206
249
 
207
- _defineProperty(_assertThisInitialized(_this5), "currency", void 0);
250
+ _defineProperty(_assertThisInitialized(_this6), "currency", void 0);
208
251
 
209
- _defineProperty(_assertThisInitialized(_this5), "isAnonymousAndPurchaseDisabled", void 0);
252
+ _defineProperty(_assertThisInitialized(_this6), "isAnonymousAndPurchaseDisabled", void 0);
210
253
 
211
- _defineProperty(_assertThisInitialized(_this5), "isB2B", void 0);
254
+ _defineProperty(_assertThisInitialized(_this6), "isB2B", void 0);
212
255
 
213
- _defineProperty(_assertThisInitialized(_this5), "isB2BAndPlatformIsNotOpened", void 0);
256
+ _defineProperty(_assertThisInitialized(_this6), "isB2BAndPlatformIsNotOpened", void 0);
214
257
 
215
- _defineProperty(_assertThisInitialized(_this5), "isIndexPage", void 0);
258
+ _defineProperty(_assertThisInitialized(_this6), "isIndexPage", void 0);
216
259
 
217
- _defineProperty(_assertThisInitialized(_this5), "isPurchaseEnabledOrAuthenticated", void 0);
260
+ _defineProperty(_assertThisInitialized(_this6), "isPurchaseEnabledOrAuthenticated", void 0);
218
261
 
219
- _defineProperty(_assertThisInitialized(_this5), "routes", void 0);
262
+ _defineProperty(_assertThisInitialized(_this6), "routes", void 0);
220
263
 
221
- _this5.routes = {
222
- getCategoryPath: _this5.getCategoryPath,
223
- getManufacturerSearchUrl: _this5.getManufacturerSearchUrl,
224
- getProductUrl: _this5.getProductUrl,
225
- isExternalUrl: _this5.isExternalUrl
264
+ _this6.routes = {
265
+ getCategoryPath: _this6.getCategoryPath,
266
+ getManufacturerSearchUrl: _this6.getManufacturerSearchUrl,
267
+ getProductUrl: _this6.getProductUrl,
268
+ isExternalUrl: _this6.isExternalUrl
226
269
  };
227
- return _this5;
270
+ return _this6;
228
271
  }
229
272
 
230
273
  _createClass(ShopUtils, [{
@@ -254,43 +297,43 @@ var ShopUtils = /*#__PURE__*/function (_BaseCallClass5) {
254
297
 
255
298
  exports.ShopUtils = ShopUtils;
256
299
 
257
- var ShopConfig = /*#__PURE__*/function (_BaseCallClass6) {
258
- _inherits(ShopConfig, _BaseCallClass6);
300
+ var ShopConfig = /*#__PURE__*/function (_BaseCallClass7) {
301
+ _inherits(ShopConfig, _BaseCallClass7);
259
302
 
260
- var _super6 = _createSuper(ShopConfig);
303
+ var _super7 = _createSuper(ShopConfig);
261
304
 
262
305
  function ShopConfig() {
263
- var _this6;
306
+ var _this7;
264
307
 
265
308
  _classCallCheck(this, ShopConfig);
266
309
 
267
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
268
- args[_key5] = arguments[_key5];
310
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
311
+ args[_key6] = arguments[_key6];
269
312
  }
270
313
 
271
- _this6 = _super6.call.apply(_super6, [this].concat(args));
314
+ _this7 = _super7.call.apply(_super7, [this].concat(args));
272
315
 
273
- _defineProperty(_assertThisInitialized(_this6), "serviceName", 'config');
316
+ _defineProperty(_assertThisInitialized(_this7), "serviceName", 'config');
274
317
 
275
- _defineProperty(_assertThisInitialized(_this6), "accessMode", void 0);
318
+ _defineProperty(_assertThisInitialized(_this7), "accessMode", void 0);
276
319
 
277
- _defineProperty(_assertThisInitialized(_this6), "isB2CRegistrationEnabled", void 0);
320
+ _defineProperty(_assertThisInitialized(_this7), "isB2CRegistrationEnabled", void 0);
278
321
 
279
- _defineProperty(_assertThisInitialized(_this6), "isCatalogOpened", void 0);
322
+ _defineProperty(_assertThisInitialized(_this7), "isCatalogOpened", void 0);
280
323
 
281
- _defineProperty(_assertThisInitialized(_this6), "isGrossSelected", void 0);
324
+ _defineProperty(_assertThisInitialized(_this7), "isGrossSelected", void 0);
282
325
 
283
- _defineProperty(_assertThisInitialized(_this6), "isPlatformClosed", void 0);
326
+ _defineProperty(_assertThisInitialized(_this7), "isPlatformClosed", void 0);
284
327
 
285
- _defineProperty(_assertThisInitialized(_this6), "isPlatformOpened", void 0);
328
+ _defineProperty(_assertThisInitialized(_this7), "isPlatformOpened", void 0);
286
329
 
287
- _defineProperty(_assertThisInitialized(_this6), "isPurchaseEnabled", void 0);
330
+ _defineProperty(_assertThisInitialized(_this7), "isPurchaseEnabled", void 0);
288
331
 
289
- _defineProperty(_assertThisInitialized(_this6), "isRegistrationEnabled", void 0);
332
+ _defineProperty(_assertThisInitialized(_this7), "isRegistrationEnabled", void 0);
290
333
 
291
- _defineProperty(_assertThisInitialized(_this6), "currency", void 0);
334
+ _defineProperty(_assertThisInitialized(_this7), "currency", void 0);
292
335
 
293
- return _this6;
336
+ return _this7;
294
337
  }
295
338
 
296
339
  return _createClass(ShopConfig);