@one-commerce/sdk-backoffice-vue3 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.
@@ -73,7 +73,18 @@ exports.Errors = exports.Message = void 0;
73
73
 
74
74
  var api = {};
75
75
 
76
- Object.defineProperty(api, "__esModule", { value: true });
76
+ (function (exports) {
77
+ Object.defineProperty(exports, "__esModule", { value: true });
78
+ exports.Backoffice = void 0;
79
+ (function (Backoffice) {
80
+ (function (Context) {
81
+ (function (AvailableContext) {
82
+ AvailableContext["ADD_TO_CART"] = "backofficeAddToCart";
83
+ })(Context.AvailableContext || (Context.AvailableContext = {}));
84
+ })(Backoffice.Context || (Backoffice.Context = {}));
85
+ })(exports.Backoffice || (exports.Backoffice = {}));
86
+
87
+ }(api));
77
88
 
78
89
  (function (exports) {
79
90
  var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
@@ -241,32 +252,6 @@ class BackofficePlugin extends BaseCallClass {
241
252
  _defineProperty$2(this, "name", void 0);
242
253
  }
243
254
 
244
- }
245
- class BackofficeAddToCartContext extends BaseCallClass {
246
- constructor(...args) {
247
- super(...args);
248
-
249
- _defineProperty$2(this, "serviceName", 'addToCartContext');
250
-
251
- _defineProperty$2(this, "productId", void 0);
252
-
253
- _defineProperty$2(this, "cartId", void 0);
254
-
255
- _defineProperty$2(this, "warehouses", void 0);
256
- }
257
-
258
- closePlugin() {
259
- this.call('closePlugin');
260
- }
261
-
262
- closePluginAndAddToCart() {
263
- this.call('closePluginAndAddToCart');
264
- }
265
-
266
- closePluginAndRefreshCart() {
267
- this.call('closePluginAndRefreshCart');
268
- }
269
-
270
255
  }
271
256
 
272
257
  function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -325,6 +310,10 @@ class Sdk extends Events {
325
310
  console.warn('[SDK Core] ', ...data);
326
311
  }
327
312
 
313
+ initializeContextClass() {
314
+ return new this.contextClass(this.callFunction.bind(this));
315
+ }
316
+
328
317
  initializeServiceGetters() {
329
318
  if (this.instances) {
330
319
  Object.keys(this.instances).forEach(serviceName => {
@@ -352,6 +341,8 @@ class Sdk extends Events {
352
341
 
353
342
  _defineProperty(this, "instances", void 0);
354
343
 
344
+ _defineProperty(this, "contextClass", void 0);
345
+
355
346
  this.initializeServiceGetters();
356
347
  this.origin = options.origin;
357
348
  this.channel = new Channel({
@@ -437,6 +428,8 @@ class Sdk extends Events {
437
428
  if (typeof options.autoheight !== 'undefined') {
438
429
  this.autoheight = options.autoheight;
439
430
  }
431
+
432
+ this.contextClass = options.context;
440
433
  }
441
434
  }
442
435
 
@@ -492,7 +485,7 @@ class BackofficeSdk extends Sdk {
492
485
  authorization: new BackofficeAuthorization(this.callFunction.bind(this)),
493
486
  customer: new BackofficeCustomer(this.callFunction.bind(this)),
494
487
  plugin: new BackofficePlugin(this.callFunction.bind(this)),
495
- addToCartContext: new BackofficeAddToCartContext(this.callFunction.bind(this))
488
+ context: this.initializeContextClass()
496
489
  });
497
490
  }
498
491
 
@@ -533,7 +526,7 @@ var index = {
533
526
  obj.authorization.update(payload);
534
527
  obj.customer.update(payload);
535
528
  obj.plugin.update(payload);
536
- obj.addToCartContext.update(payload);
529
+ obj.context.update(payload);
537
530
  };
538
531
 
539
532
  sdk.on(SdkEvents.INIT, function (payload) {