@one-commerce/sdk-core 1.24.0-UNITYONE-11259.0 → 1.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/lib/bundles/bundle.esm.js +114 -25
  2. package/lib/bundles/bundle.esm.js.map +1 -1
  3. package/lib/bundles/bundle.esm.min.js +1 -1
  4. package/lib/bundles/bundle.esm.min.js.map +1 -1
  5. package/lib/bundles/bundle.umd.js +114 -24
  6. package/lib/bundles/bundle.umd.js.map +1 -1
  7. package/lib/bundles/bundle.umd.min.js +1 -1
  8. package/lib/bundles/bundle.umd.min.js.map +1 -1
  9. package/lib/cjs/backoffice/context.js +57 -33
  10. package/lib/cjs/backoffice/context.js.map +1 -1
  11. package/lib/cjs/events.js +0 -14
  12. package/lib/cjs/events.js.map +1 -1
  13. package/lib/cjs/index.js +17 -10
  14. package/lib/cjs/index.js.map +1 -1
  15. package/lib/cjs/shop/services.js +25 -0
  16. package/lib/cjs/shop/services.js.map +1 -1
  17. package/lib/cjs/utils.js +1 -43
  18. package/lib/cjs/utils.js.map +1 -1
  19. package/lib/esm/backoffice/context.js +11 -1
  20. package/lib/esm/backoffice/context.js.map +1 -1
  21. package/lib/esm/events.js +0 -13
  22. package/lib/esm/events.js.map +1 -1
  23. package/lib/esm/index.js +10 -9
  24. package/lib/esm/index.js.map +1 -1
  25. package/lib/esm/shop/services.js +20 -0
  26. package/lib/esm/shop/services.js.map +1 -1
  27. package/lib/esm/utils.js +0 -8
  28. package/lib/esm/utils.js.map +1 -1
  29. package/lib/types/backoffice/context.d.ts +6 -2
  30. package/lib/types/backoffice/context.d.ts.map +1 -1
  31. package/lib/types/events.d.ts +0 -1
  32. package/lib/types/events.d.ts.map +1 -1
  33. package/lib/types/index.d.ts +13 -15
  34. package/lib/types/index.d.ts.map +1 -1
  35. package/lib/types/shop/services.d.ts +8 -0
  36. package/lib/types/shop/services.d.ts.map +1 -1
  37. package/lib/types/utils.d.ts +0 -3
  38. package/lib/types/utils.d.ts.map +1 -1
  39. package/package.json +3 -3
  40. package/lib/cjs/shop/context.js +0 -88
  41. package/lib/cjs/shop/context.js.map +0 -1
  42. package/lib/esm/shop/context.js +0 -36
  43. package/lib/esm/shop/context.js.map +0 -1
  44. package/lib/types/shop/context.d.ts +0 -16
  45. package/lib/types/shop/context.d.ts.map +0 -1
@@ -294,6 +294,85 @@ var BaseCallClass = /*#__PURE__*/function () {
294
294
  return BaseCallClass;
295
295
  }();
296
296
 
297
+ var ContextCallClass = /*#__PURE__*/function (_BaseCallClass) {
298
+ _inherits(ContextCallClass, _BaseCallClass);
299
+
300
+ var _super = _createSuper(ContextCallClass);
301
+
302
+ function ContextCallClass() {
303
+ var _this;
304
+
305
+ _classCallCheck(this, ContextCallClass);
306
+
307
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
308
+ args[_key] = arguments[_key];
309
+ }
310
+
311
+ _this = _super.call.apply(_super, [this].concat(args));
312
+
313
+ _defineProperty(_assertThisInitialized(_this), "serviceName", 'context');
314
+
315
+ return _this;
316
+ }
317
+
318
+ return _createClass(ContextCallClass);
319
+ }(BaseCallClass);
320
+
321
+ var AddToCartContext = /*#__PURE__*/function (_ContextCallClass) {
322
+ _inherits(AddToCartContext, _ContextCallClass);
323
+
324
+ var _super2 = _createSuper(AddToCartContext);
325
+
326
+ function AddToCartContext() {
327
+ var _this2;
328
+
329
+ _classCallCheck(this, AddToCartContext);
330
+
331
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
332
+ args[_key2] = arguments[_key2];
333
+ }
334
+
335
+ _this2 = _super2.call.apply(_super2, [this].concat(args));
336
+
337
+ _defineProperty(_assertThisInitialized(_this2), "productId", void 0);
338
+
339
+ _defineProperty(_assertThisInitialized(_this2), "cartId", void 0);
340
+
341
+ _defineProperty(_assertThisInitialized(_this2), "offerId", void 0);
342
+
343
+ _defineProperty(_assertThisInitialized(_this2), "warehouses", void 0);
344
+
345
+ _defineProperty(_assertThisInitialized(_this2), "warehouseId", void 0);
346
+
347
+ _defineProperty(_assertThisInitialized(_this2), "meta", void 0);
348
+
349
+ _defineProperty(_assertThisInitialized(_this2), "pluginProductLines", void 0);
350
+
351
+ _defineProperty(_assertThisInitialized(_this2), "productLines", void 0);
352
+
353
+ return _this2;
354
+ }
355
+
356
+ _createClass(AddToCartContext, [{
357
+ key: "closePlugin",
358
+ value: function closePlugin() {
359
+ return this.call('closePlugin');
360
+ }
361
+ }, {
362
+ key: "closePluginAndAddToCart",
363
+ value: function closePluginAndAddToCart() {
364
+ return this.call('closePluginAndAddToCart');
365
+ }
366
+ }, {
367
+ key: "closePluginAndRefreshCart",
368
+ value: function closePluginAndRefreshCart() {
369
+ return this.call('closePluginAndRefreshCart');
370
+ }
371
+ }]);
372
+
373
+ return AddToCartContext;
374
+ }(ContextCallClass);
375
+
297
376
  var BackofficeCatalog = /*#__PURE__*/function (_BaseCallClass) {
298
377
  _inherits(BackofficeCatalog, _BaseCallClass);
299
378
 
@@ -556,20 +635,6 @@ var Events = /*#__PURE__*/function () {
556
635
 
557
636
  this._callbacks[key].push(callback);
558
637
  }
559
- }, {
560
- key: "off",
561
- value: function off(key, callback) {
562
- // if the key exists
563
- if (this._callbacks[key] !== undefined) {
564
- // iterate through the callbacks for the event key
565
- for (var i = 0; i < this._callbacks[key].length; i++) {
566
- // if the callback matches, remove it
567
- if (this._callbacks[key][i] === callback) {
568
- this._callbacks[key].splice(i, 1);
569
- }
570
- }
571
- }
572
- }
573
638
  }, {
574
639
  key: "emit",
575
640
  value: function emit(key) {
@@ -623,6 +688,31 @@ var ShopCatalog = /*#__PURE__*/function (_BaseCallClass) {
623
688
  value: function fetchProduct(productId) {
624
689
  return this.call('fetchProduct', productId);
625
690
  }
691
+ }, {
692
+ key: "fetchProducts",
693
+ value: function fetchProducts(page) {
694
+ return this.call('fetchProducts', page);
695
+ }
696
+ }, {
697
+ key: "fetchStocksForProductsAndWarehouses",
698
+ value: function fetchStocksForProductsAndWarehouses(products, warehouses) {
699
+ return this.call('fetchStocksForProductsAndWarehouses', products, warehouses);
700
+ }
701
+ }, {
702
+ key: "getProductPrice",
703
+ value: function getProductPrice(productId, isGross) {
704
+ return this.call('getProductPrice', productId, isGross);
705
+ }
706
+ }, {
707
+ key: "fetchPricingForProducts",
708
+ value: function fetchPricingForProducts(products) {
709
+ return this.call('fetchPricingForProducts', products);
710
+ }
711
+ }, {
712
+ key: "fetchWarehouses",
713
+ value: function fetchWarehouses() {
714
+ return this.call('fetchWarehouses');
715
+ }
626
716
  }, {
627
717
  key: "getCategoryById",
628
718
  value: function getCategoryById(categoryId) {
@@ -1046,6 +1136,15 @@ var Sdk = /*#__PURE__*/function (_Events) {
1046
1136
  }
1047
1137
 
1048
1138
  _createClass(Sdk, [{
1139
+ key: "initializeContextClass",
1140
+ value: function initializeContextClass() {
1141
+ if (this.contextClass) {
1142
+ return new this.contextClass(this.callFunction.bind(this));
1143
+ }
1144
+
1145
+ return {};
1146
+ }
1147
+ }, {
1049
1148
  key: "initializeServiceGetters",
1050
1149
  value: function initializeServiceGetters() {
1051
1150
  var _this2 = this;
@@ -1060,15 +1159,6 @@ var Sdk = /*#__PURE__*/function (_Events) {
1060
1159
  });
1061
1160
  }
1062
1161
  }
1063
- }, {
1064
- key: "initializeContextClass",
1065
- value: function initializeContextClass() {
1066
- if (this.contextClass) {
1067
- return new this.contextClass(this.callFunction.bind(this));
1068
- }
1069
-
1070
- return {};
1071
- }
1072
1162
  }, {
1073
1163
  key: "sendFrameHeight",
1074
1164
  value: function sendFrameHeight() {
@@ -1257,7 +1347,6 @@ var ShopSdk = /*#__PURE__*/function (_Sdk2) {
1257
1347
  config: new ShopConfig(_this6.callFunction.bind(_assertThisInitialized(_this6))),
1258
1348
  tenant: new ShopTenant(_this6.callFunction.bind(_assertThisInitialized(_this6))),
1259
1349
  wishlist: new ShopWishlist(_this6.callFunction.bind(_assertThisInitialized(_this6))),
1260
- context: _this6.initializeContextClass(),
1261
1350
  plugin: new ShopPlugin(_this6.callFunction.bind(_assertThisInitialized(_this6)))
1262
1351
  });
1263
1352
 
@@ -1267,5 +1356,5 @@ var ShopSdk = /*#__PURE__*/function (_Sdk2) {
1267
1356
  return _createClass(ShopSdk);
1268
1357
  }(Sdk);
1269
1358
 
1270
- export { BackofficeSdk, SdkEvents, ShopSdk };
1359
+ export { AddToCartContext, BackofficeSdk, SdkEvents, ShopSdk };
1271
1360
  //# sourceMappingURL=bundle.esm.js.map