@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
@@ -294,85 +294,6 @@ 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
-
376
297
  var BackofficeCatalog = /*#__PURE__*/function (_BaseCallClass) {
377
298
  _inherits(BackofficeCatalog, _BaseCallClass);
378
299
 
@@ -635,6 +556,20 @@ var Events = /*#__PURE__*/function () {
635
556
 
636
557
  this._callbacks[key].push(callback);
637
558
  }
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
+ }
638
573
  }, {
639
574
  key: "emit",
640
575
  value: function emit(key) {
@@ -1050,15 +985,6 @@ var Sdk = /*#__PURE__*/function (_Events) {
1050
985
  }
1051
986
 
1052
987
  _createClass(Sdk, [{
1053
- key: "initializeContextClass",
1054
- value: function initializeContextClass() {
1055
- if (this.contextClass) {
1056
- return new this.contextClass(this.callFunction.bind(this));
1057
- }
1058
-
1059
- return {};
1060
- }
1061
- }, {
1062
988
  key: "initializeServiceGetters",
1063
989
  value: function initializeServiceGetters() {
1064
990
  var _this2 = this;
@@ -1073,6 +999,15 @@ var Sdk = /*#__PURE__*/function (_Events) {
1073
999
  });
1074
1000
  }
1075
1001
  }
1002
+ }, {
1003
+ key: "initializeContextClass",
1004
+ value: function initializeContextClass() {
1005
+ if (this.contextClass) {
1006
+ return new this.contextClass(this.callFunction.bind(this));
1007
+ }
1008
+
1009
+ return {};
1010
+ }
1076
1011
  }, {
1077
1012
  key: "sendFrameHeight",
1078
1013
  value: function sendFrameHeight() {
@@ -1259,7 +1194,8 @@ var ShopSdk = /*#__PURE__*/function (_Sdk2) {
1259
1194
  account: new ShopAccount(_this6.callFunction.bind(_assertThisInitialized(_this6))),
1260
1195
  utils: new ShopUtils(_this6.callFunction.bind(_assertThisInitialized(_this6))),
1261
1196
  config: new ShopConfig(_this6.callFunction.bind(_assertThisInitialized(_this6))),
1262
- wishlist: new ShopWishlist(_this6.callFunction.bind(_assertThisInitialized(_this6)))
1197
+ wishlist: new ShopWishlist(_this6.callFunction.bind(_assertThisInitialized(_this6))),
1198
+ context: _this6.initializeContextClass()
1263
1199
  });
1264
1200
 
1265
1201
  return _this6;
@@ -1268,5 +1204,5 @@ var ShopSdk = /*#__PURE__*/function (_Sdk2) {
1268
1204
  return _createClass(ShopSdk);
1269
1205
  }(Sdk);
1270
1206
 
1271
- export { AddToCartContext, BackofficeSdk, SdkEvents, ShopSdk };
1207
+ export { BackofficeSdk, SdkEvents, ShopSdk };
1272
1208
  //# sourceMappingURL=bundle.esm.js.map