@one-commerce/sdk-core 1.18.0-alpha.0 → 1.19.0-alpha.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 (38) hide show
  1. package/lib/bundles/bundle.esm.js +22 -48
  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 +22 -48
  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 +84 -0
  10. package/lib/cjs/backoffice/context.js.map +1 -0
  11. package/lib/cjs/{backofficeServices.js → backoffice/services.js} +3 -52
  12. package/lib/cjs/backoffice/services.js.map +1 -0
  13. package/lib/cjs/index.js +26 -17
  14. package/lib/cjs/index.js.map +1 -1
  15. package/lib/cjs/{shopServices.js → shop/services.js} +2 -2
  16. package/lib/cjs/shop/services.js.map +1 -0
  17. package/lib/esm/backoffice/context.js +31 -0
  18. package/lib/esm/backoffice/context.js.map +1 -0
  19. package/lib/esm/{backofficeServices.js → backoffice/services.js} +2 -28
  20. package/lib/esm/backoffice/services.js.map +1 -0
  21. package/lib/esm/index.js +11 -3
  22. package/lib/esm/index.js.map +1 -1
  23. package/lib/esm/{shopServices.js → shop/services.js} +2 -2
  24. package/lib/esm/shop/services.js.map +1 -0
  25. package/lib/types/backoffice/context.d.ts +13 -0
  26. package/lib/types/backoffice/context.d.ts.map +1 -0
  27. package/lib/types/{backofficeServices.d.ts → backoffice/services.d.ts} +2 -11
  28. package/lib/types/backoffice/services.d.ts.map +1 -0
  29. package/lib/types/index.d.ts +10 -4
  30. package/lib/types/index.d.ts.map +1 -1
  31. package/lib/types/{shopServices.d.ts → shop/services.d.ts} +2 -2
  32. package/lib/types/{shopServices.d.ts.map → shop/services.d.ts.map} +1 -1
  33. package/package.json +3 -3
  34. package/lib/cjs/backofficeServices.js.map +0 -1
  35. package/lib/cjs/shopServices.js.map +0 -1
  36. package/lib/esm/backofficeServices.js.map +0 -1
  37. package/lib/esm/shopServices.js.map +0 -1
  38. package/lib/types/backofficeServices.d.ts.map +0 -1
@@ -213,7 +213,18 @@ exports.Errors = exports.Message = void 0;
213
213
 
214
214
  var api = {};
215
215
 
216
- Object.defineProperty(api, "__esModule", { value: true });
216
+ (function (exports) {
217
+ Object.defineProperty(exports, "__esModule", { value: true });
218
+ exports.Backoffice = void 0;
219
+ (function (Backoffice) {
220
+ (function (Context) {
221
+ (function (AvailableContext) {
222
+ AvailableContext["ADD_TO_CART"] = "backofficeAddToCart";
223
+ })(Context.AvailableContext || (Context.AvailableContext = {}));
224
+ })(Backoffice.Context || (Backoffice.Context = {}));
225
+ })(exports.Backoffice || (exports.Backoffice = {}));
226
+
227
+ }(api));
217
228
 
218
229
  (function (exports) {
219
230
  var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
@@ -519,52 +530,6 @@ var BackofficePlugin = /*#__PURE__*/function (_BaseCallClass8) {
519
530
 
520
531
  return _createClass(BackofficePlugin);
521
532
  }(BaseCallClass);
522
- var BackofficeAddToCartContext = /*#__PURE__*/function (_BaseCallClass9) {
523
- _inherits(BackofficeAddToCartContext, _BaseCallClass9);
524
-
525
- var _super9 = _createSuper(BackofficeAddToCartContext);
526
-
527
- function BackofficeAddToCartContext() {
528
- var _this9;
529
-
530
- _classCallCheck(this, BackofficeAddToCartContext);
531
-
532
- for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
533
- args[_key9] = arguments[_key9];
534
- }
535
-
536
- _this9 = _super9.call.apply(_super9, [this].concat(args));
537
-
538
- _defineProperty(_assertThisInitialized(_this9), "serviceName", 'addToCartContext');
539
-
540
- _defineProperty(_assertThisInitialized(_this9), "productId", void 0);
541
-
542
- _defineProperty(_assertThisInitialized(_this9), "cartId", void 0);
543
-
544
- _defineProperty(_assertThisInitialized(_this9), "warehouses", void 0);
545
-
546
- return _this9;
547
- }
548
-
549
- _createClass(BackofficeAddToCartContext, [{
550
- key: "closePlugin",
551
- value: function closePlugin() {
552
- this.call('closePlugin');
553
- }
554
- }, {
555
- key: "closePluginAndAddToCart",
556
- value: function closePluginAndAddToCart() {
557
- this.call('closePluginAndAddToCart');
558
- }
559
- }, {
560
- key: "closePluginAndRefreshCart",
561
- value: function closePluginAndRefreshCart() {
562
- this.call('closePluginAndRefreshCart');
563
- }
564
- }]);
565
-
566
- return BackofficeAddToCartContext;
567
- }(BaseCallClass);
568
533
 
569
534
  var Events = /*#__PURE__*/function () {
570
535
  function Events() {
@@ -897,6 +862,8 @@ var Sdk = /*#__PURE__*/function (_Events) {
897
862
 
898
863
  _defineProperty(_assertThisInitialized(_this), "instances", void 0);
899
864
 
865
+ _defineProperty(_assertThisInitialized(_this), "contextClass", void 0);
866
+
900
867
  _this.initializeServiceGetters();
901
868
 
902
869
  _this.origin = options.origin;
@@ -960,6 +927,11 @@ var Sdk = /*#__PURE__*/function (_Events) {
960
927
  }
961
928
 
962
929
  _createClass(Sdk, [{
930
+ key: "initializeContextClass",
931
+ value: function initializeContextClass() {
932
+ return new this.contextClass(this.callFunction.bind(this));
933
+ }
934
+ }, {
963
935
  key: "initializeServiceGetters",
964
936
  value: function initializeServiceGetters() {
965
937
  var _this2 = this;
@@ -1019,6 +991,8 @@ var Sdk = /*#__PURE__*/function (_Events) {
1019
991
  if (typeof options.autoheight !== 'undefined') {
1020
992
  this.autoheight = options.autoheight;
1021
993
  }
994
+
995
+ this.contextClass = options.context;
1022
996
  }
1023
997
  }
1024
998
  }, {
@@ -1119,7 +1093,7 @@ var BackofficeSdk = /*#__PURE__*/function (_Sdk) {
1119
1093
  authorization: new BackofficeAuthorization(_this5.callFunction.bind(_assertThisInitialized(_this5))),
1120
1094
  customer: new BackofficeCustomer(_this5.callFunction.bind(_assertThisInitialized(_this5))),
1121
1095
  plugin: new BackofficePlugin(_this5.callFunction.bind(_assertThisInitialized(_this5))),
1122
- addToCartContext: new BackofficeAddToCartContext(_this5.callFunction.bind(_assertThisInitialized(_this5)))
1096
+ context: _this5.initializeContextClass()
1123
1097
  });
1124
1098
 
1125
1099
  return _this5;