@one-commerce/sdk-core 1.24.0 → 1.25.0-UNITYONE-11259.1

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 (39) hide show
  1. package/lib/bundles/bundle.esm.js +146 -28
  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 +148 -28
  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 +33 -57
  10. package/lib/cjs/backoffice/context.js.map +1 -1
  11. package/lib/cjs/events.js +14 -0
  12. package/lib/cjs/events.js.map +1 -1
  13. package/lib/cjs/index.js +27 -11
  14. package/lib/cjs/index.js.map +1 -1
  15. package/lib/cjs/shop/context.js +88 -0
  16. package/lib/cjs/shop/context.js.map +1 -0
  17. package/lib/cjs/utils.js +43 -1
  18. package/lib/cjs/utils.js.map +1 -1
  19. package/lib/esm/backoffice/context.js +1 -11
  20. package/lib/esm/backoffice/context.js.map +1 -1
  21. package/lib/esm/events.js +13 -0
  22. package/lib/esm/events.js.map +1 -1
  23. package/lib/esm/index.js +13 -11
  24. package/lib/esm/index.js.map +1 -1
  25. package/lib/esm/shop/context.js +36 -0
  26. package/lib/esm/shop/context.js.map +1 -0
  27. package/lib/esm/utils.js +8 -0
  28. package/lib/esm/utils.js.map +1 -1
  29. package/lib/types/backoffice/context.d.ts +2 -6
  30. package/lib/types/backoffice/context.d.ts.map +1 -1
  31. package/lib/types/events.d.ts +1 -0
  32. package/lib/types/events.d.ts.map +1 -1
  33. package/lib/types/index.d.ts +16 -14
  34. package/lib/types/index.d.ts.map +1 -1
  35. package/lib/types/shop/context.d.ts +16 -0
  36. package/lib/types/shop/context.d.ts.map +1 -0
  37. package/lib/types/utils.d.ts +3 -0
  38. package/lib/types/utils.d.ts.map +1 -1
  39. package/package.json +3 -3
@@ -293,41 +293,94 @@ var BaseCallClass = /*#__PURE__*/function () {
293
293
 
294
294
  return BaseCallClass;
295
295
  }();
296
-
297
296
  var ContextCallClass = /*#__PURE__*/function (_BaseCallClass) {
298
297
  _inherits(ContextCallClass, _BaseCallClass);
299
298
 
300
299
  var _super = _createSuper(ContextCallClass);
301
300
 
302
301
  function ContextCallClass() {
303
- var _this;
302
+ var _this2;
304
303
 
305
304
  _classCallCheck(this, ContextCallClass);
306
305
 
307
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
308
- args[_key] = arguments[_key];
306
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
307
+ args[_key2] = arguments[_key2];
309
308
  }
310
309
 
311
- _this = _super.call.apply(_super, [this].concat(args));
310
+ _this2 = _super.call.apply(_super, [this].concat(args));
312
311
 
313
- _defineProperty(_assertThisInitialized(_this), "serviceName", 'context');
312
+ _defineProperty(_assertThisInitialized(_this2), "serviceName", 'context');
314
313
 
315
- return _this;
314
+ return _this2;
316
315
  }
317
316
 
318
317
  return _createClass(ContextCallClass);
319
318
  }(BaseCallClass);
320
319
 
321
- var AddToCartContext = /*#__PURE__*/function (_ContextCallClass) {
320
+ var AddToCartContext$1 = /*#__PURE__*/function (_ContextCallClass) {
322
321
  _inherits(AddToCartContext, _ContextCallClass);
323
322
 
324
- var _super2 = _createSuper(AddToCartContext);
323
+ var _super = _createSuper(AddToCartContext);
325
324
 
326
325
  function AddToCartContext() {
327
- var _this2;
326
+ var _this;
328
327
 
329
328
  _classCallCheck(this, AddToCartContext);
330
329
 
330
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
331
+ args[_key] = arguments[_key];
332
+ }
333
+
334
+ _this = _super.call.apply(_super, [this].concat(args));
335
+
336
+ _defineProperty(_assertThisInitialized(_this), "productId", void 0);
337
+
338
+ _defineProperty(_assertThisInitialized(_this), "cartId", void 0);
339
+
340
+ _defineProperty(_assertThisInitialized(_this), "offerId", void 0);
341
+
342
+ _defineProperty(_assertThisInitialized(_this), "warehouses", void 0);
343
+
344
+ _defineProperty(_assertThisInitialized(_this), "warehouseId", void 0);
345
+
346
+ _defineProperty(_assertThisInitialized(_this), "meta", void 0);
347
+
348
+ _defineProperty(_assertThisInitialized(_this), "pluginProductLines", void 0);
349
+
350
+ _defineProperty(_assertThisInitialized(_this), "productLines", void 0);
351
+
352
+ return _this;
353
+ }
354
+
355
+ _createClass(AddToCartContext, [{
356
+ key: "closePlugin",
357
+ value: function closePlugin() {
358
+ return this.call('closePlugin');
359
+ }
360
+ }, {
361
+ key: "closePluginAndAddToCart",
362
+ value: function closePluginAndAddToCart() {
363
+ return this.call('closePluginAndAddToCart');
364
+ }
365
+ }, {
366
+ key: "closePluginAndRefreshCart",
367
+ value: function closePluginAndRefreshCart() {
368
+ return this.call('closePluginAndRefreshCart');
369
+ }
370
+ }]);
371
+
372
+ return AddToCartContext;
373
+ }(ContextCallClass);
374
+ var EditProductLinesOnCartContext = /*#__PURE__*/function (_ContextCallClass2) {
375
+ _inherits(EditProductLinesOnCartContext, _ContextCallClass2);
376
+
377
+ var _super2 = _createSuper(EditProductLinesOnCartContext);
378
+
379
+ function EditProductLinesOnCartContext() {
380
+ var _this2;
381
+
382
+ _classCallCheck(this, EditProductLinesOnCartContext);
383
+
331
384
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
332
385
  args[_key2] = arguments[_key2];
333
386
  }
@@ -346,23 +399,20 @@ var AddToCartContext = /*#__PURE__*/function (_ContextCallClass) {
346
399
 
347
400
  _defineProperty(_assertThisInitialized(_this2), "meta", void 0);
348
401
 
349
- _defineProperty(_assertThisInitialized(_this2), "pluginProductLines", void 0);
402
+ _defineProperty(_assertThisInitialized(_this2), "productLineId", void 0);
350
403
 
351
404
  _defineProperty(_assertThisInitialized(_this2), "productLines", void 0);
352
405
 
406
+ _defineProperty(_assertThisInitialized(_this2), "pluginProductLines", void 0);
407
+
353
408
  return _this2;
354
409
  }
355
410
 
356
- _createClass(AddToCartContext, [{
411
+ _createClass(EditProductLinesOnCartContext, [{
357
412
  key: "closePlugin",
358
413
  value: function closePlugin() {
359
414
  return this.call('closePlugin');
360
415
  }
361
- }, {
362
- key: "closePluginAndAddToCart",
363
- value: function closePluginAndAddToCart() {
364
- return this.call('closePluginAndAddToCart');
365
- }
366
416
  }, {
367
417
  key: "closePluginAndRefreshCart",
368
418
  value: function closePluginAndRefreshCart() {
@@ -370,7 +420,7 @@ var AddToCartContext = /*#__PURE__*/function (_ContextCallClass) {
370
420
  }
371
421
  }]);
372
422
 
373
- return AddToCartContext;
423
+ return EditProductLinesOnCartContext;
374
424
  }(ContextCallClass);
375
425
 
376
426
  var BackofficeCatalog = /*#__PURE__*/function (_BaseCallClass) {
@@ -635,6 +685,20 @@ var Events = /*#__PURE__*/function () {
635
685
 
636
686
  this._callbacks[key].push(callback);
637
687
  }
688
+ }, {
689
+ key: "off",
690
+ value: function off(key, callback) {
691
+ // if the key exists
692
+ if (this._callbacks[key] !== undefined) {
693
+ // iterate through the callbacks for the event key
694
+ for (var i = 0; i < this._callbacks[key].length; i++) {
695
+ // if the callback matches, remove it
696
+ if (this._callbacks[key][i] === callback) {
697
+ this._callbacks[key].splice(i, 1);
698
+ }
699
+ }
700
+ }
701
+ }
638
702
  }, {
639
703
  key: "emit",
640
704
  value: function emit(key) {
@@ -658,6 +722,59 @@ var Events = /*#__PURE__*/function () {
658
722
  return Events;
659
723
  }();
660
724
 
725
+ var AddToCartContext = /*#__PURE__*/function (_ContextCallClass) {
726
+ _inherits(AddToCartContext, _ContextCallClass);
727
+
728
+ var _super = _createSuper(AddToCartContext);
729
+
730
+ function AddToCartContext() {
731
+ var _this;
732
+
733
+ _classCallCheck(this, AddToCartContext);
734
+
735
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
736
+ args[_key] = arguments[_key];
737
+ }
738
+
739
+ _this = _super.call.apply(_super, [this].concat(args));
740
+
741
+ _defineProperty(_assertThisInitialized(_this), "productId", void 0);
742
+
743
+ _defineProperty(_assertThisInitialized(_this), "cartId", void 0);
744
+
745
+ _defineProperty(_assertThisInitialized(_this), "warehouses", void 0);
746
+
747
+ _defineProperty(_assertThisInitialized(_this), "warehouseId", void 0);
748
+
749
+ _defineProperty(_assertThisInitialized(_this), "meta", void 0);
750
+
751
+ _defineProperty(_assertThisInitialized(_this), "pluginProductLines", void 0);
752
+
753
+ _defineProperty(_assertThisInitialized(_this), "productLines", void 0);
754
+
755
+ return _this;
756
+ }
757
+
758
+ _createClass(AddToCartContext, [{
759
+ key: "closePlugin",
760
+ value: function closePlugin() {
761
+ return this.call('closePlugin');
762
+ }
763
+ }, {
764
+ key: "closePluginAndAddToCart",
765
+ value: function closePluginAndAddToCart() {
766
+ return this.call('closePluginAndAddToCart');
767
+ }
768
+ }, {
769
+ key: "closePluginAndRefreshCart",
770
+ value: function closePluginAndRefreshCart() {
771
+ return this.call('closePluginAndRefreshCart');
772
+ }
773
+ }]);
774
+
775
+ return AddToCartContext;
776
+ }(ContextCallClass);
777
+
661
778
  var ShopCatalog = /*#__PURE__*/function (_BaseCallClass) {
662
779
  _inherits(ShopCatalog, _BaseCallClass);
663
780
 
@@ -1136,15 +1253,6 @@ var Sdk = /*#__PURE__*/function (_Events) {
1136
1253
  }
1137
1254
 
1138
1255
  _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
- }, {
1148
1256
  key: "initializeServiceGetters",
1149
1257
  value: function initializeServiceGetters() {
1150
1258
  var _this2 = this;
@@ -1159,6 +1267,15 @@ var Sdk = /*#__PURE__*/function (_Events) {
1159
1267
  });
1160
1268
  }
1161
1269
  }
1270
+ }, {
1271
+ key: "initializeContextClass",
1272
+ value: function initializeContextClass() {
1273
+ if (this.contextClass) {
1274
+ return new this.contextClass(this.callFunction.bind(this));
1275
+ }
1276
+
1277
+ return {};
1278
+ }
1162
1279
  }, {
1163
1280
  key: "sendFrameHeight",
1164
1281
  value: function sendFrameHeight() {
@@ -1347,6 +1464,7 @@ var ShopSdk = /*#__PURE__*/function (_Sdk2) {
1347
1464
  config: new ShopConfig(_this6.callFunction.bind(_assertThisInitialized(_this6))),
1348
1465
  tenant: new ShopTenant(_this6.callFunction.bind(_assertThisInitialized(_this6))),
1349
1466
  wishlist: new ShopWishlist(_this6.callFunction.bind(_assertThisInitialized(_this6))),
1467
+ context: _this6.initializeContextClass(),
1350
1468
  plugin: new ShopPlugin(_this6.callFunction.bind(_assertThisInitialized(_this6)))
1351
1469
  });
1352
1470
 
@@ -1356,5 +1474,5 @@ var ShopSdk = /*#__PURE__*/function (_Sdk2) {
1356
1474
  return _createClass(ShopSdk);
1357
1475
  }(Sdk);
1358
1476
 
1359
- export { AddToCartContext, BackofficeSdk, SdkEvents, ShopSdk };
1477
+ export { AddToCartContext$1 as BackofficeAddToCartContext, EditProductLinesOnCartContext as BackofficeEditProductLinesOnCartContext, BackofficeSdk, SdkEvents, AddToCartContext as ShopAddToCartContext, ShopSdk };
1360
1478
  //# sourceMappingURL=bundle.esm.js.map