@one-commerce/sdk-core 1.22.0 → 1.22.1-UNITYONE-11259.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 (39) hide show
  1. package/lib/bundles/bundle.esm.js +26 -90
  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 +25 -90
  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 +11 -18
  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 +10 -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 +15 -13
  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
@@ -300,85 +300,6 @@
300
300
  return BaseCallClass;
301
301
  }();
302
302
 
303
- var ContextCallClass = /*#__PURE__*/function (_BaseCallClass) {
304
- _inherits(ContextCallClass, _BaseCallClass);
305
-
306
- var _super = _createSuper(ContextCallClass);
307
-
308
- function ContextCallClass() {
309
- var _this;
310
-
311
- _classCallCheck(this, ContextCallClass);
312
-
313
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
314
- args[_key] = arguments[_key];
315
- }
316
-
317
- _this = _super.call.apply(_super, [this].concat(args));
318
-
319
- _defineProperty(_assertThisInitialized(_this), "serviceName", 'context');
320
-
321
- return _this;
322
- }
323
-
324
- return _createClass(ContextCallClass);
325
- }(BaseCallClass);
326
-
327
- var AddToCartContext = /*#__PURE__*/function (_ContextCallClass) {
328
- _inherits(AddToCartContext, _ContextCallClass);
329
-
330
- var _super2 = _createSuper(AddToCartContext);
331
-
332
- function AddToCartContext() {
333
- var _this2;
334
-
335
- _classCallCheck(this, AddToCartContext);
336
-
337
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
338
- args[_key2] = arguments[_key2];
339
- }
340
-
341
- _this2 = _super2.call.apply(_super2, [this].concat(args));
342
-
343
- _defineProperty(_assertThisInitialized(_this2), "productId", void 0);
344
-
345
- _defineProperty(_assertThisInitialized(_this2), "cartId", void 0);
346
-
347
- _defineProperty(_assertThisInitialized(_this2), "offerId", void 0);
348
-
349
- _defineProperty(_assertThisInitialized(_this2), "warehouses", void 0);
350
-
351
- _defineProperty(_assertThisInitialized(_this2), "warehouseId", void 0);
352
-
353
- _defineProperty(_assertThisInitialized(_this2), "meta", void 0);
354
-
355
- _defineProperty(_assertThisInitialized(_this2), "pluginProductLines", void 0);
356
-
357
- _defineProperty(_assertThisInitialized(_this2), "productLines", void 0);
358
-
359
- return _this2;
360
- }
361
-
362
- _createClass(AddToCartContext, [{
363
- key: "closePlugin",
364
- value: function closePlugin() {
365
- return this.call('closePlugin');
366
- }
367
- }, {
368
- key: "closePluginAndAddToCart",
369
- value: function closePluginAndAddToCart() {
370
- return this.call('closePluginAndAddToCart');
371
- }
372
- }, {
373
- key: "closePluginAndRefreshCart",
374
- value: function closePluginAndRefreshCart() {
375
- return this.call('closePluginAndRefreshCart');
376
- }
377
- }]);
378
-
379
- return AddToCartContext;
380
- }(ContextCallClass);
381
-
382
303
  var BackofficeCatalog = /*#__PURE__*/function (_BaseCallClass) {
383
304
  _inherits(BackofficeCatalog, _BaseCallClass);
384
305
 
@@ -641,6 +562,20 @@
641
562
 
642
563
  this._callbacks[key].push(callback);
643
564
  }
565
+ }, {
566
+ key: "off",
567
+ value: function off(key, callback) {
568
+ // if the key exists
569
+ if (this._callbacks[key] !== undefined) {
570
+ // iterate through the callbacks for the event key
571
+ for (var i = 0; i < this._callbacks[key].length; i++) {
572
+ // if the callback matches, remove it
573
+ if (this._callbacks[key][i] === callback) {
574
+ this._callbacks[key].splice(i, 1);
575
+ }
576
+ }
577
+ }
578
+ }
644
579
  }, {
645
580
  key: "emit",
646
581
  value: function emit(key) {
@@ -1056,15 +991,6 @@
1056
991
  }
1057
992
 
1058
993
  _createClass(Sdk, [{
1059
- key: "initializeContextClass",
1060
- value: function initializeContextClass() {
1061
- if (this.contextClass) {
1062
- return new this.contextClass(this.callFunction.bind(this));
1063
- }
1064
-
1065
- return {};
1066
- }
1067
- }, {
1068
994
  key: "initializeServiceGetters",
1069
995
  value: function initializeServiceGetters() {
1070
996
  var _this2 = this;
@@ -1079,6 +1005,15 @@
1079
1005
  });
1080
1006
  }
1081
1007
  }
1008
+ }, {
1009
+ key: "initializeContextClass",
1010
+ value: function initializeContextClass() {
1011
+ if (this.contextClass) {
1012
+ return new this.contextClass(this.callFunction.bind(this));
1013
+ }
1014
+
1015
+ return {};
1016
+ }
1082
1017
  }, {
1083
1018
  key: "sendFrameHeight",
1084
1019
  value: function sendFrameHeight() {
@@ -1265,7 +1200,8 @@
1265
1200
  account: new ShopAccount(_this6.callFunction.bind(_assertThisInitialized(_this6))),
1266
1201
  utils: new ShopUtils(_this6.callFunction.bind(_assertThisInitialized(_this6))),
1267
1202
  config: new ShopConfig(_this6.callFunction.bind(_assertThisInitialized(_this6))),
1268
- wishlist: new ShopWishlist(_this6.callFunction.bind(_assertThisInitialized(_this6)))
1203
+ wishlist: new ShopWishlist(_this6.callFunction.bind(_assertThisInitialized(_this6))),
1204
+ context: _this6.initializeContextClass()
1269
1205
  });
1270
1206
 
1271
1207
  return _this6;
@@ -1274,7 +1210,6 @@
1274
1210
  return _createClass(ShopSdk);
1275
1211
  }(Sdk);
1276
1212
 
1277
- exports.AddToCartContext = AddToCartContext;
1278
1213
  exports.BackofficeSdk = BackofficeSdk;
1279
1214
  exports.ShopSdk = ShopSdk;
1280
1215