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

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.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
 
@@ -17,7 +17,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
17
17
 
18
18
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
19
19
 
20
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
20
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
21
21
 
22
22
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
23
23
 
@@ -27,7 +27,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
27
27
 
28
28
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
29
29
 
30
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
30
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
31
31
 
32
32
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
33
33
 
@@ -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);
@@ -1 +1 @@
1
- {"version":3,"file":"services.js","names":["ShopCatalog","productId","call","categoryId","BaseCallClass","ShopAccount","name","ShopCart","amount","where","cartId","ShopAuthorization","ShopUtils","routes","getCategoryPath","getManufacturerSearchUrl","getProductUrl","isExternalUrl","id","manufacturer","product","url","ShopConfig"],"sources":["../../../src/shop/services.ts"],"sourcesContent":["import {Shop} from \"@one-commerce/sdk-shared\";\nimport {BaseCallClass} from \"../utils\";\n\n\nexport class ShopCatalog extends BaseCallClass implements Shop.Catalog {\n serviceName = 'catalog'\n categories!: Array<any>;\n selectedCategoryId!: string | null;\n\n fetchProduct(productId: string): Promise<any> {\n return this.call('fetchProduct', productId)\n }\n\n getCategoryById(categoryId: string): Promise<any> {\n return this.call('getCategoryById', categoryId)\n }\n\n\n}\n\nexport class ShopAccount extends BaseCallClass implements Shop.Account {\n serviceName = 'account'\n client!: {\n id: string;\n name: string;\n externalId?: string;\n tin?: string;\n phone?: string;\n segmentId?: string;\n segments: {\n additionalSegments?: Array<{\n id: string;\n name: string;\n externalId?: string;\n parentSegmentId?: string;\n }>;\n mainSegment: {\n id: string;\n name: string;\n externalId?: string;\n parentSegmentId?: string;\n };\n };\n warehouseId?: string;\n termPayment?: {\n id: string;\n label?: string;\n paymentDaysPeriod?: number;\n };\n isTaxPayer?: boolean;\n billingAddress?: {\n city: string;\n country: string;\n id: string;\n isDefault: boolean;\n name: string;\n phone: string;\n street: string;\n type: string;\n zipCode: string\n }\n };\n isAuthenticated!: boolean;\n user!: {\n email?: string;\n name?: string;\n phone?: string;\n /**\n * @deprecated Use non-nested function instead\n */\n hasSegment(name: string): Promise<boolean>\n };\n\n hasSegment(name: string): Promise<boolean> {\n return this.call('hasSegment', name)\n }\n\n manager!: {\n additionalEmail?: string;\n email: string; id: string;\n landlinePhone?: string;\n mobilePhone?: string;\n name: string;\n photo?: string\n };\n\n logout(): void {\n // NotImplementedYet\n }\n}\n\nexport class ShopCart extends BaseCallClass implements Shop.Cart {\n serviceName = 'cart'\n carts!: Array<any>;\n currentCart!: any;\n totalCartPrice!: number;\n\n addToCart(productId: string, amount: number, where: string, cartId?: string): Promise<void> {\n return this.call('addToCart', productId, amount, where, cartId)\n }\n}\n\nexport class ShopAuthorization extends BaseCallClass implements Shop.Authorization {\n serviceName = 'authorization'\n\n getAuthToken(): Promise<string> {\n return this.call('getAuthToken')\n }\n}\n\nexport class ShopUtils extends BaseCallClass implements Shop.Utils {\n serviceName = 'utils'\n currency!: any;\n isAnonymousAndPurchaseDisabled!: boolean;\n isB2B!: boolean;\n isB2BAndPlatformIsNotOpened!: boolean;\n isIndexPage!: boolean;\n isPurchaseEnabledOrAuthenticated!: boolean;\n\n constructor(call: (service: string, fun: string, ...arg: any) => Promise<any>) {\n super(call)\n this.routes = {\n getCategoryPath: this.getCategoryPath,\n getManufacturerSearchUrl: this.getManufacturerSearchUrl,\n getProductUrl: this.getProductUrl,\n isExternalUrl: this.isExternalUrl\n }\n }\n\n getCategoryPath(id?: string): Promise<string | null> {\n return this.call('getCategoryPath', id)\n }\n\n getManufacturerSearchUrl(manufacturer: string): Promise<string> {\n return this.call('getManufacturerSearchUrl', manufacturer)\n }\n\n getProductUrl(product: any): Promise<string | null> {\n return this.call('getProductUrl', product)\n }\n\n isExternalUrl(url: string): Promise<boolean> {\n return this.call('isExternalUrl', url)\n }\n\n routes: {\n /**\n * @deprecated Use non-nested function instead\n */\n getCategoryPath(id?: string): (Promise<string | null> | string | null);\n /**\n * @deprecated Use non-nested function instead\n */\n getManufacturerSearchUrl(manufacturer: string): (Promise<string> | string);\n /**\n * @deprecated Use non-nested function instead\n */\n getProductUrl(product: any): (Promise<string | null> | string | null);\n /**\n * @deprecated Use non-nested function instead\n */\n isExternalUrl(url: string): (Promise<boolean> | boolean)\n };\n}\n\nexport class ShopConfig extends BaseCallClass implements Shop.Config {\n serviceName = 'config'\n accessMode!: string;\n isB2CRegistrationEnabled!: boolean;\n isCatalogOpened!: boolean;\n isGrossSelected!: boolean;\n isPlatformClosed!: boolean;\n isPlatformOpened!: boolean;\n isPurchaseEnabled!: boolean;\n isRegistrationEnabled!: boolean;\n currency: any;\n}\n"],"mappings":";;;;;;;;;AACA;;;;;;;;;;;;;;;;;;;;;;;;IAGaA,W;;;;;;;;;;;;;;;;kEACG,S;;;;;;;;;;;WAId,sBAAaC,SAAb,EAA8C;MAC5C,OAAO,KAAKC,IAAL,CAAU,cAAV,EAA0BD,SAA1B,CAAP;IACD;;;WAED,yBAAgBE,UAAhB,EAAkD;MAChD,OAAO,KAAKD,IAAL,CAAU,iBAAV,EAA6BC,UAA7B,CAAP;IACD;;;;EAX8BC,oB;;;;IAgBpBC,W;;;;;;;;;;;;;;;;mEACG,S;;;;;;;;;;;;;;;WAoDd,oBAAWC,IAAX,EAA2C;MACzC,OAAO,KAAKJ,IAAL,CAAU,YAAV,EAAwBI,IAAxB,CAAP;IACD;;;WAWD,kBAAe,CACb;IACD;;;;EApE8BF,oB;;;;IAuEpBG,Q;;;;;;;;;;;;;;;;mEACG,M;;;;;;;;;;;;;WAKd,mBAAUN,SAAV,EAA6BO,MAA7B,EAA6CC,KAA7C,EAA4DC,MAA5D,EAA4F;MAC1F,OAAO,KAAKR,IAAL,CAAU,WAAV,EAAuBD,SAAvB,EAAkCO,MAAlC,EAA0CC,KAA1C,EAAiDC,MAAjD,CAAP;IACD;;;;EAR2BN,oB;;;;IAWjBO,iB;;;;;;;;;;;;;;;;mEACG,e;;;;;;;WAEd,wBAAgC;MAC9B,OAAO,KAAKT,IAAL,CAAU,cAAV,CAAP;IACD;;;;EALoCE,oB;;;;IAQ1BQ,S;;;;;EASX,mBAAYV,IAAZ,EAA+E;IAAA;;IAAA;;IAC7E,4BAAMA,IAAN;;IAD6E,+DARjE,OAQiE;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAE7E,OAAKW,MAAL,GAAc;MACZC,eAAe,EAAE,OAAKA,eADV;MAEZC,wBAAwB,EAAE,OAAKA,wBAFnB;MAGZC,aAAa,EAAE,OAAKA,aAHR;MAIZC,aAAa,EAAE,OAAKA;IAJR,CAAd;IAF6E;EAQ9E;;;;WAED,yBAAgBC,EAAhB,EAAqD;MACnD,OAAO,KAAKhB,IAAL,CAAU,iBAAV,EAA6BgB,EAA7B,CAAP;IACD;;;WAED,kCAAyBC,YAAzB,EAAgE;MAC9D,OAAO,KAAKjB,IAAL,CAAU,0BAAV,EAAsCiB,YAAtC,CAAP;IACD;;;WAED,uBAAcC,OAAd,EAAoD;MAClD,OAAO,KAAKlB,IAAL,CAAU,eAAV,EAA2BkB,OAA3B,CAAP;IACD;;;WAED,uBAAcC,GAAd,EAA6C;MAC3C,OAAO,KAAKnB,IAAL,CAAU,eAAV,EAA2BmB,GAA3B,CAAP;IACD;;;;EAjC4BjB,oB;;;;IAuDlBkB,U;;;;;;;;;;;;;;;;mEACG,Q;;;;;;;;;;;;;;;;;;;;;;;;EADgBlB,oB"}
1
+ {"version":3,"sources":["../../../src/shop/services.ts"],"names":["ShopCatalog","productId","call","categoryId","BaseCallClass","ShopWishlist","wishlistId","newProduct","name","ShopAccount","ShopCart","amount","where","cartId","ShopAuthorization","ShopUtils","routes","getCategoryPath","getManufacturerSearchUrl","getProductUrl","isExternalUrl","id","manufacturer","product","url","ShopConfig"],"mappings":";;;;;;;;;AAEA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;AASX,qBAAYb,IAAZ,EAA+E;AAAA;;AAAA;;AAC7E,gCAAMA,IAAN;;AAD6E,mEARjE,OAQiE;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAE7E,WAAKc,MAAL,GAAc;AACZC,MAAAA,eAAe,EAAE,OAAKA,eADV;AAEZC,MAAAA,wBAAwB,EAAE,OAAKA,wBAFnB;AAGZC,MAAAA,aAAa,EAAE,OAAKA,aAHR;AAIZC,MAAAA,aAAa,EAAE,OAAKA;AAJR,KAAd;AAF6E;AAQ9E;;;;WAED,yBAAgBC,EAAhB,EAAqD;AACnD,aAAO,KAAKnB,IAAL,CAAU,iBAAV,EAA6BmB,EAA7B,CAAP;AACD;;;WAED,kCAAyBC,YAAzB,EAAgE;AAC9D,aAAO,KAAKpB,IAAL,CAAU,0BAAV,EAAsCoB,YAAtC,CAAP;AACD;;;WAED,uBAAcC,OAAd,EAAoD;AAClD,aAAO,KAAKrB,IAAL,CAAU,eAAV,EAA2BqB,OAA3B,CAAP;AACD;;;WAED,uBAAcC,GAAd,EAA6C;AAC3C,aAAO,KAAKtB,IAAL,CAAU,eAAV,EAA2BsB,GAA3B,CAAP;AACD;;;;EAjC4BpB,oB;;;;IAuDlBqB,U;;;;;;;;;;;;;;;;mEACG,Q;;;;;;;;;;;;;;;;;;;;;;;;EADgBrB,oB","sourcesContent":["import {Shop} from \"@one-commerce/sdk-shared\";\n\nimport {BaseCallClass} from \"../utils\";\n\nexport class ShopCatalog extends BaseCallClass implements Shop.Catalog {\n serviceName = 'catalog'\n categories!: Array<any>;\n selectedCategoryId!: string | null;\n\n fetchProduct(productId: string): Promise<any> {\n return this.call('fetchProduct', productId)\n }\n\n getCategoryById(categoryId: string): Promise<any> {\n return this.call('getCategoryById', categoryId)\n }\n}\nexport class ShopWishlist extends BaseCallClass implements Shop.Wishlist {\n serviceName = 'wishlist'\n\n addProductsToWishlist(wishlistId: string, newProduct: any): Promise<void> {\n return this.call('addProductsToWishlist', wishlistId, newProduct)\n }\n\n getWishlists(): Promise<any> {\n return this.call('getWishlists')\n }\n\n createWishlist(name: string): Promise<any> {\n return this.call('createWishlist', name)\n }\n}\nexport class ShopAccount extends BaseCallClass implements Shop.Account {\n serviceName = 'account'\n client!: {\n id: string;\n name: string;\n externalId?: string;\n tin?: string;\n phone?: string;\n segmentId?: string;\n segments: {\n additionalSegments?: Array<{\n id: string;\n name: string;\n externalId?: string;\n parentSegmentId?: string;\n }>;\n mainSegment: {\n id: string;\n name: string;\n externalId?: string;\n parentSegmentId?: string;\n };\n };\n warehouseId?: string;\n termPayment?: {\n id: string;\n label?: string;\n paymentDaysPeriod?: number;\n };\n isTaxPayer?: boolean;\n billingAddress?: {\n city: string;\n country: string;\n id: string;\n isDefault: boolean;\n name: string;\n phone: string;\n street: string;\n type: string;\n zipCode: string\n }\n };\n isAuthenticated!: boolean;\n user!: {\n id?: string,\n clientId?: string,\n email?: string;\n name?: string;\n phone?: string;\n rol?: {\n name: string;\n id: string;\n }\n /**\n * @deprecated Use non-nested function instead\n */\n hasSegment(name: string): Promise<boolean>\n };\n\n hasSegment(name: string): Promise<boolean> {\n return this.call('hasSegment', name)\n }\n\n manager!: {\n additionalEmail?: string;\n email: string; id: string;\n landlinePhone?: string;\n mobilePhone?: string;\n name: string;\n photo?: string\n };\n\n logout(): void {\n // NotImplementedYet\n }\n}\n\nexport class ShopCart extends BaseCallClass implements Shop.Cart {\n serviceName = 'cart'\n carts!: Array<any>;\n currentCart!: any;\n totalCartPrice!: number;\n\n addToCart(productId: string, amount: number, where: string, cartId?: string): Promise<void> {\n return this.call('addToCart', productId, amount, where, cartId)\n }\n}\n\nexport class ShopAuthorization extends BaseCallClass implements Shop.Authorization {\n serviceName = 'authorization'\n\n getAuthToken(): Promise<string> {\n return this.call('getAuthToken')\n }\n}\n\nexport class ShopUtils extends BaseCallClass implements Shop.Utils {\n serviceName = 'utils'\n currency!: any;\n isAnonymousAndPurchaseDisabled!: boolean;\n isB2B!: boolean;\n isB2BAndPlatformIsNotOpened!: boolean;\n isIndexPage!: boolean;\n isPurchaseEnabledOrAuthenticated!: boolean;\n\n constructor(call: (service: string, fun: string, ...arg: any) => Promise<any>) {\n super(call)\n this.routes = {\n getCategoryPath: this.getCategoryPath,\n getManufacturerSearchUrl: this.getManufacturerSearchUrl,\n getProductUrl: this.getProductUrl,\n isExternalUrl: this.isExternalUrl\n }\n }\n\n getCategoryPath(id?: string): Promise<string | null> {\n return this.call('getCategoryPath', id)\n }\n\n getManufacturerSearchUrl(manufacturer: string): Promise<string> {\n return this.call('getManufacturerSearchUrl', manufacturer)\n }\n\n getProductUrl(product: any): Promise<string | null> {\n return this.call('getProductUrl', product)\n }\n\n isExternalUrl(url: string): Promise<boolean> {\n return this.call('isExternalUrl', url)\n }\n\n routes: {\n /**\n * @deprecated Use non-nested function instead\n */\n getCategoryPath(id?: string): (Promise<string | null> | string | null);\n /**\n * @deprecated Use non-nested function instead\n */\n getManufacturerSearchUrl(manufacturer: string): (Promise<string> | string);\n /**\n * @deprecated Use non-nested function instead\n */\n getProductUrl(product: any): (Promise<string | null> | string | null);\n /**\n * @deprecated Use non-nested function instead\n */\n isExternalUrl(url: string): (Promise<boolean> | boolean)\n };\n}\n\nexport class ShopConfig extends BaseCallClass implements Shop.Config {\n serviceName = 'config'\n accessMode!: string;\n isB2CRegistrationEnabled!: boolean;\n isCatalogOpened!: boolean;\n isGrossSelected!: boolean;\n isPlatformClosed!: boolean;\n isPlatformOpened!: boolean;\n isPurchaseEnabled!: boolean;\n isRegistrationEnabled!: boolean;\n currency: any;\n}\n"],"file":"services.js"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["dec2hex","dec","toString","padStart","generateCallId","arr","Uint8Array","window","crypto","getRandomValues","Array","from","join","BaseCallClass","call","fun","arg","serviceName","payload","attributes","update","target","Object","keys","forEach","key"],"sources":["../../src/utils.ts"],"sourcesContent":["const dec2hex = (dec: number): string => {\n return dec.toString(16).padStart(2, \"0\")\n}\n\n// generateId :: Integer -> String\nexport function generateCallId () {\n const arr = new Uint8Array((10 || 40) / 2)\n window.crypto.getRandomValues(arr)\n return Array.from(arr, dec2hex).join('')\n}\n\nexport class BaseCallClass {\n serviceName = ''\n call: (fun: string, ...arg: any[]) => Promise<any>;\n constructor(call: (service: string, fun: string, ...arg: any) => Promise<any>) {\n this.call = (fun: string, ...arg: any) => {\n return call(this.serviceName, fun, ...arg)\n }\n }\n static update(target: Record<string, any>, payload: Record<string, any>) {\n Object.keys(payload).forEach((key: string) => {\n target[key] = payload[key]\n })\n }\n update(payload: any) {\n const attributes: any = payload[this.serviceName]\n if (attributes) {\n BaseCallClass.update(this, attributes)\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAMA,OAAO,GAAI,SAAXA,OAAW,CAACC,GAAD,EAAyB;EACxC,OAAOA,GAAG,CAACC,QAAJ,CAAa,EAAb,EAAiBC,QAAjB,CAA0B,CAA1B,EAA6B,GAA7B,CAAP;AACD,CAFD,C,CAIA;;;AACO,SAASC,cAAT,GAA2B;EAChC,IAAMC,GAAG,GAAG,IAAIC,UAAJ,CAAe,CAAC,MAAM,EAAP,IAAa,CAA5B,CAAZ;EACAC,MAAM,CAACC,MAAP,CAAcC,eAAd,CAA8BJ,GAA9B;EACA,OAAOK,KAAK,CAACC,IAAN,CAAWN,GAAX,EAAgBL,OAAhB,EAAyBY,IAAzB,CAA8B,EAA9B,CAAP;AACD;;IAEYC,a;EAGX,uBAAYC,IAAZ,EAA+E;IAAA;;IAAA;;IAAA,qCAFjE,EAEiE;;IAAA;;IAC7E,KAAKA,IAAL,GAAY,UAACC,GAAD,EAA8B;MAAA,kCAAbC,GAAa;QAAbA,GAAa;MAAA;;MACxC,OAAOF,IAAI,MAAJ,UAAK,KAAI,CAACG,WAAV,EAAuBF,GAAvB,SAA+BC,GAA/B,EAAP;IACD,CAFD;EAGD;;;;WAMD,gBAAOE,OAAP,EAAqB;MACnB,IAAMC,UAAe,GAAGD,OAAO,CAAC,KAAKD,WAAN,CAA/B;;MACA,IAAIE,UAAJ,EAAgB;QACdN,aAAa,CAACO,MAAd,CAAqB,IAArB,EAA2BD,UAA3B;MACD;IACF;;;WAVD,gBAAcE,MAAd,EAA2CH,OAA3C,EAAyE;MACvEI,MAAM,CAACC,IAAP,CAAYL,OAAZ,EAAqBM,OAArB,CAA6B,UAACC,GAAD,EAAiB;QAC5CJ,MAAM,CAACI,GAAD,CAAN,GAAcP,OAAO,CAACO,GAAD,CAArB;MACD,CAFD;IAGD"}
1
+ {"version":3,"sources":["../../src/utils.ts"],"names":["dec2hex","dec","toString","padStart","generateCallId","arr","Uint8Array","window","crypto","getRandomValues","Array","from","join","BaseCallClass","call","fun","arg","serviceName","payload","attributes","update","target","Object","keys","forEach","key"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAMA,OAAO,GAAI,SAAXA,OAAW,CAACC,GAAD,EAAyB;AACxC,SAAOA,GAAG,CAACC,QAAJ,CAAa,EAAb,EAAiBC,QAAjB,CAA0B,CAA1B,EAA6B,GAA7B,CAAP;AACD,CAFD,C,CAIA;;;AACO,SAASC,cAAT,GAA2B;AAChC,MAAMC,GAAG,GAAG,IAAIC,UAAJ,CAAe,CAAC,MAAM,EAAP,IAAa,CAA5B,CAAZ;AACAC,EAAAA,MAAM,CAACC,MAAP,CAAcC,eAAd,CAA8BJ,GAA9B;AACA,SAAOK,KAAK,CAACC,IAAN,CAAWN,GAAX,EAAgBL,OAAhB,EAAyBY,IAAzB,CAA8B,EAA9B,CAAP;AACD;;IAEYC,a;AAGX,yBAAYC,IAAZ,EAA+E;AAAA;;AAAA;;AAAA,yCAFjE,EAEiE;;AAAA;;AAC7E,SAAKA,IAAL,GAAY,UAACC,GAAD,EAA8B;AAAA,wCAAbC,GAAa;AAAbA,QAAAA,GAAa;AAAA;;AACxC,aAAOF,IAAI,MAAJ,UAAK,KAAI,CAACG,WAAV,EAAuBF,GAAvB,SAA+BC,GAA/B,EAAP;AACD,KAFD;AAGD;;;;WAMD,gBAAOE,OAAP,EAAqB;AACnB,UAAMC,UAAe,GAAGD,OAAO,CAAC,KAAKD,WAAN,CAA/B;;AACA,UAAIE,UAAJ,EAAgB;AACdN,QAAAA,aAAa,CAACO,MAAd,CAAqB,IAArB,EAA2BD,UAA3B;AACD;AACF;;;WAVD,gBAAcE,MAAd,EAA2CH,OAA3C,EAAyE;AACvEI,MAAAA,MAAM,CAACC,IAAP,CAAYL,OAAZ,EAAqBM,OAArB,CAA6B,UAACC,GAAD,EAAiB;AAC5CJ,QAAAA,MAAM,CAACI,GAAD,CAAN,GAAcP,OAAO,CAACO,GAAD,CAArB;AACD,OAFD;AAGD","sourcesContent":["const dec2hex = (dec: number): string => {\n return dec.toString(16).padStart(2, \"0\")\n}\n\n// generateId :: Integer -> String\nexport function generateCallId () {\n const arr = new Uint8Array((10 || 40) / 2)\n window.crypto.getRandomValues(arr)\n return Array.from(arr, dec2hex).join('')\n}\n\nexport class BaseCallClass {\n serviceName = ''\n call: (fun: string, ...arg: any[]) => Promise<any>;\n constructor(call: (service: string, fun: string, ...arg: any) => Promise<any>) {\n this.call = (fun: string, ...arg: any) => {\n return call(this.serviceName, fun, ...arg)\n }\n }\n static update(target: Record<string, any>, payload: Record<string, any>) {\n Object.keys(payload).forEach((key: string) => {\n target[key] = payload[key]\n })\n }\n update(payload: any) {\n const attributes: any = payload[this.serviceName]\n if (attributes) {\n BaseCallClass.update(this, attributes)\n }\n }\n}\n"],"file":"utils.js"}
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","names":["BaseCallClass","ContextCallClass","AddToCartContext","closePlugin","call","closePluginAndAddToCart","closePluginAndRefreshCart"],"sources":["../../../src/backoffice/context.ts"],"sourcesContent":["import {Backoffice} from \"@one-commerce/sdk-shared\";\nimport {BaseCallClass} from \"../utils\";\n\nclass ContextCallClass extends BaseCallClass {\n serviceName = 'context'\n}\n\nexport class AddToCartContext extends ContextCallClass implements Backoffice.Context.AddToCart {\n productId: string;\n cartId: string;\n warehouses: Array<any>;\n meta: unknown;\n closePlugin(): Promise<void> {\n return this.call('closePlugin')\n }\n closePluginAndAddToCart(): Promise<void> {\n return this.call('closePluginAndAddToCart')\n }\n closePluginAndRefreshCart(): Promise<void> {\n return this.call('closePluginAndRefreshCart')\n }\n}\n\nexport type AvailableContext = AddToCartContext\n"],"mappings":";;AACA,SAAQA,aAAR,QAA4B,UAA5B;;AAEA,MAAMC,gBAAN,SAA+BD,aAA/B,CAA6C;EAAA;IAAA;;IAAA,qCAC7B,SAD6B;EAAA;;AAAA;;AAI7C,OAAO,MAAME,gBAAN,SAA+BD,gBAA/B,CAAwF;EAAA;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;EAAA;;EAK7FE,WAAW,GAAkB;IAC3B,OAAO,KAAKC,IAAL,CAAU,aAAV,CAAP;EACD;;EACDC,uBAAuB,GAAkB;IACvC,OAAO,KAAKD,IAAL,CAAU,yBAAV,CAAP;EACD;;EACDE,yBAAyB,GAAkB;IACzC,OAAO,KAAKF,IAAL,CAAU,2BAAV,CAAP;EACD;;AAb4F"}
1
+ {"version":3,"sources":["../../../src/backoffice/context.ts"],"names":["BaseCallClass","ContextCallClass","AddToCartContext","closePlugin","call","closePluginAndAddToCart","closePluginAndRefreshCart"],"mappings":";;AACA,SAAQA,aAAR,QAA4B,UAA5B;;AAEA,MAAMC,gBAAN,SAA+BD,aAA/B,CAA6C;AAAA;AAAA;;AAAA,yCAC7B,SAD6B;AAAA;;AAAA;;AAI7C,OAAO,MAAME,gBAAN,SAA+BD,gBAA/B,CAAwF;AAAA;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;AAAA;;AAK7FE,EAAAA,WAAW,GAAkB;AAC3B,WAAO,KAAKC,IAAL,CAAU,aAAV,CAAP;AACD;;AACDC,EAAAA,uBAAuB,GAAkB;AACvC,WAAO,KAAKD,IAAL,CAAU,yBAAV,CAAP;AACD;;AACDE,EAAAA,yBAAyB,GAAkB;AACzC,WAAO,KAAKF,IAAL,CAAU,2BAAV,CAAP;AACD;;AAb4F","sourcesContent":["import {Backoffice} from \"@one-commerce/sdk-shared\";\nimport {BaseCallClass} from \"../utils\";\n\nclass ContextCallClass extends BaseCallClass {\n serviceName = 'context'\n}\n\nexport class AddToCartContext extends ContextCallClass implements Backoffice.Context.AddToCart {\n productId: string;\n cartId: string;\n warehouses: Array<any>;\n meta: unknown;\n closePlugin(): Promise<void> {\n return this.call('closePlugin')\n }\n closePluginAndAddToCart(): Promise<void> {\n return this.call('closePluginAndAddToCart')\n }\n closePluginAndRefreshCart(): Promise<void> {\n return this.call('closePluginAndRefreshCart')\n }\n}\n\nexport type AvailableContext = AddToCartContext\n"],"file":"context.js"}
@@ -46,14 +46,6 @@ export class BackofficeTenant extends BaseCallClass {
46
46
  _defineProperty(this, "currency", void 0);
47
47
  }
48
48
 
49
- }
50
- export class BackofficeOrderpath extends BaseCallClass {
51
- constructor(...args) {
52
- super(...args);
53
-
54
- _defineProperty(this, "serviceName", 'orderpath');
55
- }
56
-
57
49
  }
58
50
  export class BackofficeLayout extends BaseCallClass {
59
51
  constructor(...args) {
@@ -1 +1 @@
1
- {"version":3,"file":"services.js","names":["BaseCallClass","BackofficeCatalog","fetchCategories","call","fetchProduct","id","BackofficeUser","BackofficeTenant","BackofficeOrderpath","BackofficeLayout","BackofficeAuthorization","getAuthToken","BackofficeCustomer","BackofficePlugin"],"sources":["../../../src/backoffice/services.ts"],"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"],"mappings":";;AAEA,SAAQA,aAAR,QAA4B,UAA5B;AAEA,OAAO,MAAMC,iBAAN,SAAgCD,aAAhC,CAA4E;EAAA;IAAA;;IAAA,qCACnE,SADmE;EAAA;;EAGjFE,eAAe,GAA4B;IACzC,OAAO,KAAKC,IAAL,CAAU,iBAAV,CAAP;EACD;;EACMC,YAAY,CAACC,EAAD,EAA+B;IAChD,OAAO,KAAKF,IAAL,CAAU,cAAV,EAA0BE,EAA1B,CAAP;EACD;;AARgF;AAWnF,OAAO,MAAMC,cAAN,SAA6BN,aAA7B,CAAsE;EAAA;IAAA;;IAAA,qCAC7D,MAD6D;;IAAA;;IAAA;;IAAA;;IAAA;EAAA;;AAAA;AAQ7E,OAAO,MAAMO,gBAAN,SAA+BP,aAA/B,CAA0E;EAAA;IAAA;;IAAA,qCACjE,QADiE;;IAAA;;IAAA;;IAAA;EAAA;;AAAA;AAOjF,OAAO,MAAMQ,mBAAN,SAAkCR,aAAlC,CAAgF;EAAA;IAAA;;IAAA,qCACvE,WADuE;EAAA;;AAAA;AAIvF,OAAO,MAAMS,gBAAN,SAA+BT,aAA/B,CAA0E;EAAA;IAAA;;IAAA,qCACjE,QADiE;;IAAA;EAAA;;AAAA;AAKjF,OAAO,MAAMU,uBAAN,SAAsCV,aAAtC,CAAwF;EAAA;IAAA;;IAAA,qCAC/E,eAD+E;EAAA;;EAG7FW,YAAY,GAAoB;IAC9B,OAAO,KAAKR,IAAL,CAAU,cAAV,CAAP;EACD;;AAL4F;AAQ/F,OAAO,MAAMS,kBAAN,SAAiCZ,aAAjC,CAA8E;EAAA;IAAA;;IAAA,qCACrE,UADqE;;IAAA;;IAAA;EAAA;;AAAA;AAMrF,OAAO,MAAMa,gBAAN,SAA+Bb,aAA/B,CAA0E;EAAA;IAAA;;IAAA,qCACjE,QADiE;;IAAA;;IAAA;;IAAA;EAAA;;AAAA"}
1
+ {"version":3,"sources":["../../../src/backoffice/services.ts"],"names":["BaseCallClass","BackofficeCatalog","fetchCategories","call","fetchProduct","id","BackofficeUser","BackofficeTenant","BackofficeLayout","BackofficeAuthorization","getAuthToken","BackofficeCustomer","BackofficePlugin"],"mappings":";;AACA,SAASA,aAAT,QAA8B,UAA9B;AAEA,OAAO,MAAMC,iBAAN,SAAgCD,aAAhC,CAA4E;AAAA;AAAA;;AAAA,yCACnE,SADmE;AAAA;;AAGjFE,EAAAA,eAAe,GAA4B;AACzC,WAAO,KAAKC,IAAL,CAAU,iBAAV,CAAP;AACD;;AACMC,EAAAA,YAAY,CAACC,EAAD,EAA+B;AAChD,WAAO,KAAKF,IAAL,CAAU,cAAV,EAA0BE,EAA1B,CAAP;AACD;;AARgF;AAWnF,OAAO,MAAMC,cAAN,SAA6BN,aAA7B,CAAsE;AAAA;AAAA;;AAAA,yCAC7D,MAD6D;;AAAA;;AAAA;;AAAA;;AAAA;AAAA;;AAAA;AAQ7E,OAAO,MAAMO,gBAAN,SAA+BP,aAA/B,CAA0E;AAAA;AAAA;;AAAA,yCACjE,QADiE;;AAAA;;AAAA;;AAAA;AAAA;;AAAA;AAOjF,OAAO,MAAMQ,gBAAN,SAA+BR,aAA/B,CAA0E;AAAA;AAAA;;AAAA,yCACjE,QADiE;;AAAA;AAAA;;AAAA;AAKjF,OAAO,MAAMS,uBAAN,SAAsCT,aAAtC,CAAwF;AAAA;AAAA;;AAAA,yCAC/E,eAD+E;AAAA;;AAG7FU,EAAAA,YAAY,GAAoB;AAC9B,WAAO,KAAKP,IAAL,CAAU,cAAV,CAAP;AACD;;AAL4F;AAQ/F,OAAO,MAAMQ,kBAAN,SAAiCX,aAAjC,CAA8E;AAAA;AAAA;;AAAA,yCACrE,UADqE;;AAAA;;AAAA;AAAA;;AAAA;AAMrF,OAAO,MAAMY,gBAAN,SAA+BZ,aAA/B,CAA0E;AAAA;AAAA;;AAAA,yCACjE,QADiE;;AAAA;;AAAA;;AAAA;AAAA;;AAAA","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"}
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","names":["Events","constructor","_callbacks","on","key","callback","undefined","push","emit","params","i","length"],"sources":["../../src/events.ts"],"sourcesContent":["class Events {\n _callbacks: Record<string, any>\n constructor () {\n this._callbacks = {}\n }\n\n on<T>(key: string, callback: (arg: T) => void) {\n // create an empty array for the event key\n if (this._callbacks[key] === undefined) { this._callbacks[key] = [] }\n // save the callback in the array for the event key\n this._callbacks[key].push(callback)\n }\n\n emit(key: string, ...params: Array<any>) {\n // if the key exists\n if (this._callbacks[key] !== undefined) {\n // iterate through the callbacks for the event key\n for (let i=0; i<this._callbacks[key].length; i++) {\n // trigger the callbacks with all provided params\n this._callbacks[key][i](...params)\n }\n }\n }\n}\n\nexport default Events\n"],"mappings":";;AAAA,MAAMA,MAAN,CAAa;EAEXC,WAAW,GAAI;IAAA;;IACb,KAAKC,UAAL,GAAkB,EAAlB;EACD;;EAEDC,EAAE,CAAIC,GAAJ,EAAiBC,QAAjB,EAA6C;IAC7C;IACA,IAAI,KAAKH,UAAL,CAAgBE,GAAhB,MAAyBE,SAA7B,EAAwC;MAAE,KAAKJ,UAAL,CAAgBE,GAAhB,IAAuB,EAAvB;IAA2B,CAFxB,CAG7C;;;IACA,KAAKF,UAAL,CAAgBE,GAAhB,EAAqBG,IAArB,CAA0BF,QAA1B;EACD;;EAEDG,IAAI,CAACJ,GAAD,EAAc,GAAGK,MAAjB,EAAqC;IACvC;IACA,IAAI,KAAKP,UAAL,CAAgBE,GAAhB,MAAyBE,SAA7B,EAAwC;MACtC;MACA,KAAK,IAAII,CAAC,GAAC,CAAX,EAAcA,CAAC,GAAC,KAAKR,UAAL,CAAgBE,GAAhB,EAAqBO,MAArC,EAA6CD,CAAC,EAA9C,EAAkD;QAChD;QACA,KAAKR,UAAL,CAAgBE,GAAhB,EAAqBM,CAArB,EAAwB,GAAGD,MAA3B;MACD;IACF;EACF;;AAtBU;;AAyBb,eAAeT,MAAf"}
1
+ {"version":3,"sources":["../../src/events.ts"],"names":["Events","constructor","_callbacks","on","key","callback","undefined","push","emit","params","i","length"],"mappings":";;AAAA,MAAMA,MAAN,CAAa;AAEXC,EAAAA,WAAW,GAAI;AAAA;;AACb,SAAKC,UAAL,GAAkB,EAAlB;AACD;;AAEDC,EAAAA,EAAE,CAAIC,GAAJ,EAAiBC,QAAjB,EAA6C;AAC7C;AACA,QAAI,KAAKH,UAAL,CAAgBE,GAAhB,MAAyBE,SAA7B,EAAwC;AAAE,WAAKJ,UAAL,CAAgBE,GAAhB,IAAuB,EAAvB;AAA2B,KAFxB,CAG7C;;;AACA,SAAKF,UAAL,CAAgBE,GAAhB,EAAqBG,IAArB,CAA0BF,QAA1B;AACD;;AAEDG,EAAAA,IAAI,CAACJ,GAAD,EAAc,GAAGK,MAAjB,EAAqC;AACvC;AACA,QAAI,KAAKP,UAAL,CAAgBE,GAAhB,MAAyBE,SAA7B,EAAwC;AACtC;AACA,WAAK,IAAII,CAAC,GAAC,CAAX,EAAcA,CAAC,GAAC,KAAKR,UAAL,CAAgBE,GAAhB,EAAqBO,MAArC,EAA6CD,CAAC,EAA9C,EAAkD;AAChD;AACA,aAAKR,UAAL,CAAgBE,GAAhB,EAAqBM,CAArB,EAAwB,GAAGD,MAA3B;AACD;AACF;AACF;;AAtBU;;AAyBb,eAAeT,MAAf","sourcesContent":["class Events {\n _callbacks: Record<string, any>\n constructor () {\n this._callbacks = {}\n }\n\n on<T>(key: string, callback: (arg: T) => void) {\n // create an empty array for the event key\n if (this._callbacks[key] === undefined) { this._callbacks[key] = [] }\n // save the callback in the array for the event key\n this._callbacks[key].push(callback)\n }\n\n emit(key: string, ...params: Array<any>) {\n // if the key exists\n if (this._callbacks[key] !== undefined) {\n // iterate through the callbacks for the event key\n for (let i=0; i<this._callbacks[key].length; i++) {\n // trigger the callbacks with all provided params\n this._callbacks[key][i](...params)\n }\n }\n }\n}\n\nexport default Events\n"],"file":"events.js"}
package/lib/esm/index.js CHANGED
@@ -3,9 +3,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
3
3
  import { Message } from "@one-commerce/sdk-shared";
4
4
  import Channel from "iframe-channel";
5
5
  import { AddToCartContext } from "./backoffice/context";
6
- import { BackofficeAuthorization, BackofficeCatalog, BackofficeCustomer, BackofficeLayout, BackofficeOrderpath, BackofficePlugin, BackofficeTenant, BackofficeUser } from "./backoffice/services";
6
+ import { BackofficeAuthorization, BackofficeCatalog, BackofficeCustomer, BackofficeLayout, BackofficePlugin, BackofficeTenant, BackofficeUser } from "./backoffice/services";
7
7
  import Events from "./events";
8
- import { ShopAccount, ShopAuthorization, ShopCart, ShopCatalog, ShopConfig, ShopUtils } from "./shop/services";
8
+ import { ShopAccount, ShopAuthorization, ShopCart, ShopCatalog, ShopConfig, ShopUtils, ShopWishlist } from "./shop/services";
9
9
  import { BaseCallClass, generateCallId } from "./utils";
10
10
  var SdkInternalEvents;
11
11
 
@@ -168,10 +168,15 @@ class Sdk extends Events {
168
168
  method: fun,
169
169
  payload: payload
170
170
  });
171
- return new Promise(resolve => {
171
+ return new Promise((resolve, reject) => {
172
172
  const onChannelMessage = response => {
173
173
  if (response.callId === callId) {
174
174
  this.channel.unsubscribe(Message.METHOD_RESULT, onChannelMessage);
175
+
176
+ if (response !== null && response !== void 0 && response.isException) {
177
+ return reject(response.result);
178
+ }
179
+
175
180
  return resolve(response.result);
176
181
  }
177
182
  };
@@ -201,7 +206,6 @@ export class BackofficeSdk extends Sdk {
201
206
  hash: '',
202
207
  query: {}
203
208
  },
204
- orderpath: new BackofficeOrderpath(this.callFunction.bind(this)),
205
209
  catalog: new BackofficeCatalog(this.callFunction.bind(this)),
206
210
  user: new BackofficeUser(this.callFunction.bind(this)),
207
211
  tenant: new BackofficeTenant(this.callFunction.bind(this)),
@@ -228,7 +232,8 @@ export class ShopSdk extends Sdk {
228
232
  catalog: new ShopCatalog(this.callFunction.bind(this)),
229
233
  account: new ShopAccount(this.callFunction.bind(this)),
230
234
  utils: new ShopUtils(this.callFunction.bind(this)),
231
- config: new ShopConfig(this.callFunction.bind(this))
235
+ config: new ShopConfig(this.callFunction.bind(this)),
236
+ wishlist: new ShopWishlist(this.callFunction.bind(this))
232
237
  });
233
238
  }
234
239
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Message","Channel","AddToCartContext","BackofficeAuthorization","BackofficeCatalog","BackofficeCustomer","BackofficeLayout","BackofficeOrderpath","BackofficePlugin","BackofficeTenant","BackofficeUser","Events","ShopAccount","ShopAuthorization","ShopCart","ShopCatalog","ShopConfig","ShopUtils","BaseCallClass","generateCallId","SdkInternalEvents","SdkEvents","Sdk","log","data","debug","console","warn","initializeContextClass","contextClass","callFunction","bind","initializeServiceGetters","instances","Object","keys","forEach","serviceName","defineProperty","get","isInitialized","constructor","options","origin","channel","targetOrigin","target","window","parent","subscribe","INIT","payload","entries","key","value","update","attributesForKey","emit","UPDATE","FRAME_HEIGHT_REQUEST","autoheight","sendFrameHeight","connect","then","initializeHeightObserver","setupOptions","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","context","service","fun","callId","METHOD_CALL","method","Promise","resolve","onChannelMessage","response","unsubscribe","METHOD_RESULT","result","navigate","event","NAVIGATION_PUSH","BackofficeSdk","route","hash","query","orderpath","catalog","user","tenant","layout","authorization","customer","plugin","ShopSdk","cart","account","utils"],"sources":["../../src/index.ts"],"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 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) => {\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 }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B,CAAf;IAVE,CADkC;EAAA;;AAAA;AAehD,SACE7B,gBADF"}
1
+ {"version":3,"sources":["../../src/index.ts"],"names":["Message","Channel","AddToCartContext","BackofficeAuthorization","BackofficeCatalog","BackofficeCustomer","BackofficeLayout","BackofficePlugin","BackofficeTenant","BackofficeUser","Events","ShopAccount","ShopAuthorization","ShopCart","ShopCatalog","ShopConfig","ShopUtils","ShopWishlist","BaseCallClass","generateCallId","SdkInternalEvents","SdkEvents","Sdk","log","data","debug","console","warn","initializeContextClass","contextClass","callFunction","bind","initializeServiceGetters","instances","Object","keys","forEach","serviceName","defineProperty","get","isInitialized","constructor","options","origin","channel","targetOrigin","target","window","parent","subscribe","INIT","payload","entries","key","value","update","attributesForKey","emit","UPDATE","FRAME_HEIGHT_REQUEST","autoheight","sendFrameHeight","connect","then","initializeHeightObserver","setupOptions","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","context","service","fun","callId","METHOD_CALL","method","Promise","resolve","reject","onChannelMessage","response","unsubscribe","METHOD_RESULT","isException","result","navigate","event","NAVIGATION_PUSH","BackofficeSdk","route","hash","query","catalog","user","tenant","layout","authorization","customer","plugin","ShopSdk","cart","account","utils","wishlist"],"mappings":";;AAAA,SAEEA,OAFF,QAKO,0BALP;AAMA,OAAOC,OAAP,MAAoB,gBAApB;AAEA,SACEC,gBADF,QAEO,sBAFP;AAGA,SACEC,uBADF,EAEEC,iBAFF,EAGEC,kBAHF,EAIEC,gBAJF,EAKEC,gBALF,EAMEC,gBANF,EAOEC,cAPF,QAQO,uBARP;AASA,OAAOC,MAAP,MAAmB,UAAnB;AACA,SACEC,WADF,EAEEC,iBAFF,EAGEC,QAHF,EAIEC,WAJF,EAKEC,UALF,EAMEC,SANF,EAOEC,YAPF,QAQO,iBARP;AASA,SAASC,aAAT,EAAwB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AAvB,CAAd,CATG;AAUViD,MAAAA,MAAM,EAAE,IAAIjE,UAAJ,CAAe,KAAKe,YAAL,CAAkBC,IAAlB,CAAuB,IAAvB,CAAf,CAVE;AAWV4F,MAAAA,QAAQ,EAAE,IAAI1G,YAAJ,CAAiB,KAAKa,YAAL,CAAkBC,IAAlB,CAAuB,IAAvB,CAAjB;AAXA,KADkC;AAAA;;AAAA;AAgBhD,SACE7B,gBADF","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"}
@@ -20,6 +20,26 @@ export class ShopCatalog extends BaseCallClass {
20
20
  return this.call('getCategoryById', categoryId);
21
21
  }
22
22
 
23
+ }
24
+ export class ShopWishlist extends BaseCallClass {
25
+ constructor(...args) {
26
+ super(...args);
27
+
28
+ _defineProperty(this, "serviceName", 'wishlist');
29
+ }
30
+
31
+ addProductsToWishlist(wishlistId, newProduct) {
32
+ return this.call('addProductsToWishlist', wishlistId, newProduct);
33
+ }
34
+
35
+ getWishlists() {
36
+ return this.call('getWishlists');
37
+ }
38
+
39
+ createWishlist(name) {
40
+ return this.call('createWishlist', name);
41
+ }
42
+
23
43
  }
24
44
  export class ShopAccount extends BaseCallClass {
25
45
  constructor(...args) {
@@ -1 +1 @@
1
- {"version":3,"file":"services.js","names":["BaseCallClass","ShopCatalog","fetchProduct","productId","call","getCategoryById","categoryId","ShopAccount","hasSegment","name","logout","ShopCart","addToCart","amount","where","cartId","ShopAuthorization","getAuthToken","ShopUtils","constructor","routes","getCategoryPath","getManufacturerSearchUrl","getProductUrl","isExternalUrl","id","manufacturer","product","url","ShopConfig"],"sources":["../../../src/shop/services.ts"],"sourcesContent":["import {Shop} from \"@one-commerce/sdk-shared\";\nimport {BaseCallClass} from \"../utils\";\n\n\nexport class ShopCatalog extends BaseCallClass implements Shop.Catalog {\n serviceName = 'catalog'\n categories!: Array<any>;\n selectedCategoryId!: string | null;\n\n fetchProduct(productId: string): Promise<any> {\n return this.call('fetchProduct', productId)\n }\n\n getCategoryById(categoryId: string): Promise<any> {\n return this.call('getCategoryById', categoryId)\n }\n\n\n}\n\nexport class ShopAccount extends BaseCallClass implements Shop.Account {\n serviceName = 'account'\n client!: {\n id: string;\n name: string;\n externalId?: string;\n tin?: string;\n phone?: string;\n segmentId?: string;\n segments: {\n additionalSegments?: Array<{\n id: string;\n name: string;\n externalId?: string;\n parentSegmentId?: string;\n }>;\n mainSegment: {\n id: string;\n name: string;\n externalId?: string;\n parentSegmentId?: string;\n };\n };\n warehouseId?: string;\n termPayment?: {\n id: string;\n label?: string;\n paymentDaysPeriod?: number;\n };\n isTaxPayer?: boolean;\n billingAddress?: {\n city: string;\n country: string;\n id: string;\n isDefault: boolean;\n name: string;\n phone: string;\n street: string;\n type: string;\n zipCode: string\n }\n };\n isAuthenticated!: boolean;\n user!: {\n email?: string;\n name?: string;\n phone?: string;\n /**\n * @deprecated Use non-nested function instead\n */\n hasSegment(name: string): Promise<boolean>\n };\n\n hasSegment(name: string): Promise<boolean> {\n return this.call('hasSegment', name)\n }\n\n manager!: {\n additionalEmail?: string;\n email: string; id: string;\n landlinePhone?: string;\n mobilePhone?: string;\n name: string;\n photo?: string\n };\n\n logout(): void {\n // NotImplementedYet\n }\n}\n\nexport class ShopCart extends BaseCallClass implements Shop.Cart {\n serviceName = 'cart'\n carts!: Array<any>;\n currentCart!: any;\n totalCartPrice!: number;\n\n addToCart(productId: string, amount: number, where: string, cartId?: string): Promise<void> {\n return this.call('addToCart', productId, amount, where, cartId)\n }\n}\n\nexport class ShopAuthorization extends BaseCallClass implements Shop.Authorization {\n serviceName = 'authorization'\n\n getAuthToken(): Promise<string> {\n return this.call('getAuthToken')\n }\n}\n\nexport class ShopUtils extends BaseCallClass implements Shop.Utils {\n serviceName = 'utils'\n currency!: any;\n isAnonymousAndPurchaseDisabled!: boolean;\n isB2B!: boolean;\n isB2BAndPlatformIsNotOpened!: boolean;\n isIndexPage!: boolean;\n isPurchaseEnabledOrAuthenticated!: boolean;\n\n constructor(call: (service: string, fun: string, ...arg: any) => Promise<any>) {\n super(call)\n this.routes = {\n getCategoryPath: this.getCategoryPath,\n getManufacturerSearchUrl: this.getManufacturerSearchUrl,\n getProductUrl: this.getProductUrl,\n isExternalUrl: this.isExternalUrl\n }\n }\n\n getCategoryPath(id?: string): Promise<string | null> {\n return this.call('getCategoryPath', id)\n }\n\n getManufacturerSearchUrl(manufacturer: string): Promise<string> {\n return this.call('getManufacturerSearchUrl', manufacturer)\n }\n\n getProductUrl(product: any): Promise<string | null> {\n return this.call('getProductUrl', product)\n }\n\n isExternalUrl(url: string): Promise<boolean> {\n return this.call('isExternalUrl', url)\n }\n\n routes: {\n /**\n * @deprecated Use non-nested function instead\n */\n getCategoryPath(id?: string): (Promise<string | null> | string | null);\n /**\n * @deprecated Use non-nested function instead\n */\n getManufacturerSearchUrl(manufacturer: string): (Promise<string> | string);\n /**\n * @deprecated Use non-nested function instead\n */\n getProductUrl(product: any): (Promise<string | null> | string | null);\n /**\n * @deprecated Use non-nested function instead\n */\n isExternalUrl(url: string): (Promise<boolean> | boolean)\n };\n}\n\nexport class ShopConfig extends BaseCallClass implements Shop.Config {\n serviceName = 'config'\n accessMode!: string;\n isB2CRegistrationEnabled!: boolean;\n isCatalogOpened!: boolean;\n isGrossSelected!: boolean;\n isPlatformClosed!: boolean;\n isPlatformOpened!: boolean;\n isPurchaseEnabled!: boolean;\n isRegistrationEnabled!: boolean;\n currency: any;\n}\n"],"mappings":";;AACA,SAAQA,aAAR,QAA4B,UAA5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E,KAAKgB,MAAL,GAAc;MACZC,eAAe,EAAE,KAAKA,eADV;MAEZC,wBAAwB,EAAE,KAAKA,wBAFnB;MAGZC,aAAa,EAAE,KAAKA,aAHR;MAIZC,aAAa,EAAE,KAAKA;IAJR,CAAd;EAMD;;EAEDH,eAAe,CAACI,EAAD,EAAsC;IACnD,OAAO,KAAKrB,IAAL,CAAU,iBAAV,EAA6BqB,EAA7B,CAAP;EACD;;EAEDH,wBAAwB,CAACI,YAAD,EAAwC;IAC9D,OAAO,KAAKtB,IAAL,CAAU,0BAAV,EAAsCsB,YAAtC,CAAP;EACD;;EAEDH,aAAa,CAACI,OAAD,EAAuC;IAClD,OAAO,KAAKvB,IAAL,CAAU,eAAV,EAA2BuB,OAA3B,CAAP;EACD;;EAEDH,aAAa,CAACI,GAAD,EAAgC;IAC3C,OAAO,KAAKxB,IAAL,CAAU,eAAV,EAA2BwB,GAA3B,CAAP;EACD;;AAjCgE;AAuDnE,OAAO,MAAMC,UAAN,SAAyB7B,aAAzB,CAA8D;EAAA;IAAA;;IAAA,qCACrD,QADqD;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;EAAA;;AAAA"}
1
+ {"version":3,"sources":["../../../src/shop/services.ts"],"names":["BaseCallClass","ShopCatalog","fetchProduct","productId","call","getCategoryById","categoryId","ShopWishlist","addProductsToWishlist","wishlistId","newProduct","getWishlists","createWishlist","name","ShopAccount","hasSegment","logout","ShopCart","addToCart","amount","where","cartId","ShopAuthorization","getAuthToken","ShopUtils","constructor","routes","getCategoryPath","getManufacturerSearchUrl","getProductUrl","isExternalUrl","id","manufacturer","product","url","ShopConfig"],"mappings":";;AAEA,SAAQA,aAAR,QAA4B,UAA5B;AAEA,OAAO,MAAMC,WAAN,SAA0BD,aAA1B,CAAgE;AAAA;AAAA;;AAAA,yCACvD,SADuD;;AAAA;;AAAA;AAAA;;AAKrEE,EAAAA,YAAY,CAACC,SAAD,EAAkC;AAC5C,WAAO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E;AAAA;AAAA;;AAAA,yCACnE,eADmE;AAAA;;AAGjFuB,EAAAA,YAAY,GAAoB;AAC9B,WAAO,KAAKnB,IAAL,CAAU,cAAV,CAAP;AACD;;AALgF;AAQnF,OAAO,MAAMoB,SAAN,SAAwBxB,aAAxB,CAA4D;AASjEyB,EAAAA,WAAW,CAACrB,IAAD,EAAoE;AAC7E,UAAMA,IAAN;;AAD6E,yCARjE,OAQiE;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAE7E,SAAKsB,MAAL,GAAc;AACZC,MAAAA,eAAe,EAAE,KAAKA,eADV;AAEZC,MAAAA,wBAAwB,EAAE,KAAKA,wBAFnB;AAGZC,MAAAA,aAAa,EAAE,KAAKA,aAHR;AAIZC,MAAAA,aAAa,EAAE,KAAKA;AAJR,KAAd;AAMD;;AAEDH,EAAAA,eAAe,CAACI,EAAD,EAAsC;AACnD,WAAO,KAAK3B,IAAL,CAAU,iBAAV,EAA6B2B,EAA7B,CAAP;AACD;;AAEDH,EAAAA,wBAAwB,CAACI,YAAD,EAAwC;AAC9D,WAAO,KAAK5B,IAAL,CAAU,0BAAV,EAAsC4B,YAAtC,CAAP;AACD;;AAEDH,EAAAA,aAAa,CAACI,OAAD,EAAuC;AAClD,WAAO,KAAK7B,IAAL,CAAU,eAAV,EAA2B6B,OAA3B,CAAP;AACD;;AAEDH,EAAAA,aAAa,CAACI,GAAD,EAAgC;AAC3C,WAAO,KAAK9B,IAAL,CAAU,eAAV,EAA2B8B,GAA3B,CAAP;AACD;;AAjCgE;AAuDnE,OAAO,MAAMC,UAAN,SAAyBnC,aAAzB,CAA8D;AAAA;AAAA;;AAAA,yCACrD,QADqD;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;AAAA;;AAAA","sourcesContent":["import {Shop} from \"@one-commerce/sdk-shared\";\n\nimport {BaseCallClass} from \"../utils\";\n\nexport class ShopCatalog extends BaseCallClass implements Shop.Catalog {\n serviceName = 'catalog'\n categories!: Array<any>;\n selectedCategoryId!: string | null;\n\n fetchProduct(productId: string): Promise<any> {\n return this.call('fetchProduct', productId)\n }\n\n getCategoryById(categoryId: string): Promise<any> {\n return this.call('getCategoryById', categoryId)\n }\n}\nexport class ShopWishlist extends BaseCallClass implements Shop.Wishlist {\n serviceName = 'wishlist'\n\n addProductsToWishlist(wishlistId: string, newProduct: any): Promise<void> {\n return this.call('addProductsToWishlist', wishlistId, newProduct)\n }\n\n getWishlists(): Promise<any> {\n return this.call('getWishlists')\n }\n\n createWishlist(name: string): Promise<any> {\n return this.call('createWishlist', name)\n }\n}\nexport class ShopAccount extends BaseCallClass implements Shop.Account {\n serviceName = 'account'\n client!: {\n id: string;\n name: string;\n externalId?: string;\n tin?: string;\n phone?: string;\n segmentId?: string;\n segments: {\n additionalSegments?: Array<{\n id: string;\n name: string;\n externalId?: string;\n parentSegmentId?: string;\n }>;\n mainSegment: {\n id: string;\n name: string;\n externalId?: string;\n parentSegmentId?: string;\n };\n };\n warehouseId?: string;\n termPayment?: {\n id: string;\n label?: string;\n paymentDaysPeriod?: number;\n };\n isTaxPayer?: boolean;\n billingAddress?: {\n city: string;\n country: string;\n id: string;\n isDefault: boolean;\n name: string;\n phone: string;\n street: string;\n type: string;\n zipCode: string\n }\n };\n isAuthenticated!: boolean;\n user!: {\n id?: string,\n clientId?: string,\n email?: string;\n name?: string;\n phone?: string;\n rol?: {\n name: string;\n id: string;\n }\n /**\n * @deprecated Use non-nested function instead\n */\n hasSegment(name: string): Promise<boolean>\n };\n\n hasSegment(name: string): Promise<boolean> {\n return this.call('hasSegment', name)\n }\n\n manager!: {\n additionalEmail?: string;\n email: string; id: string;\n landlinePhone?: string;\n mobilePhone?: string;\n name: string;\n photo?: string\n };\n\n logout(): void {\n // NotImplementedYet\n }\n}\n\nexport class ShopCart extends BaseCallClass implements Shop.Cart {\n serviceName = 'cart'\n carts!: Array<any>;\n currentCart!: any;\n totalCartPrice!: number;\n\n addToCart(productId: string, amount: number, where: string, cartId?: string): Promise<void> {\n return this.call('addToCart', productId, amount, where, cartId)\n }\n}\n\nexport class ShopAuthorization extends BaseCallClass implements Shop.Authorization {\n serviceName = 'authorization'\n\n getAuthToken(): Promise<string> {\n return this.call('getAuthToken')\n }\n}\n\nexport class ShopUtils extends BaseCallClass implements Shop.Utils {\n serviceName = 'utils'\n currency!: any;\n isAnonymousAndPurchaseDisabled!: boolean;\n isB2B!: boolean;\n isB2BAndPlatformIsNotOpened!: boolean;\n isIndexPage!: boolean;\n isPurchaseEnabledOrAuthenticated!: boolean;\n\n constructor(call: (service: string, fun: string, ...arg: any) => Promise<any>) {\n super(call)\n this.routes = {\n getCategoryPath: this.getCategoryPath,\n getManufacturerSearchUrl: this.getManufacturerSearchUrl,\n getProductUrl: this.getProductUrl,\n isExternalUrl: this.isExternalUrl\n }\n }\n\n getCategoryPath(id?: string): Promise<string | null> {\n return this.call('getCategoryPath', id)\n }\n\n getManufacturerSearchUrl(manufacturer: string): Promise<string> {\n return this.call('getManufacturerSearchUrl', manufacturer)\n }\n\n getProductUrl(product: any): Promise<string | null> {\n return this.call('getProductUrl', product)\n }\n\n isExternalUrl(url: string): Promise<boolean> {\n return this.call('isExternalUrl', url)\n }\n\n routes: {\n /**\n * @deprecated Use non-nested function instead\n */\n getCategoryPath(id?: string): (Promise<string | null> | string | null);\n /**\n * @deprecated Use non-nested function instead\n */\n getManufacturerSearchUrl(manufacturer: string): (Promise<string> | string);\n /**\n * @deprecated Use non-nested function instead\n */\n getProductUrl(product: any): (Promise<string | null> | string | null);\n /**\n * @deprecated Use non-nested function instead\n */\n isExternalUrl(url: string): (Promise<boolean> | boolean)\n };\n}\n\nexport class ShopConfig extends BaseCallClass implements Shop.Config {\n serviceName = 'config'\n accessMode!: string;\n isB2CRegistrationEnabled!: boolean;\n isCatalogOpened!: boolean;\n isGrossSelected!: boolean;\n isPlatformClosed!: boolean;\n isPlatformOpened!: boolean;\n isPurchaseEnabled!: boolean;\n isRegistrationEnabled!: boolean;\n currency: any;\n}\n"],"file":"services.js"}