@one-commerce/sdk-backoffice-vue3 1.17.1 → 1.19.1-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.
@@ -17,7 +17,7 @@ function _objectSpread2(target) {
17
17
  for (var i = 1; i < arguments.length; i++) {
18
18
  var source = null != arguments[i] ? arguments[i] : {};
19
19
  i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
20
- _defineProperty$4(target, key, source[key]);
20
+ _defineProperty$5(target, key, source[key]);
21
21
  }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
22
22
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
23
23
  });
@@ -26,7 +26,7 @@ function _objectSpread2(target) {
26
26
  return target;
27
27
  }
28
28
 
29
- function _defineProperty$4(obj, key, value) {
29
+ function _defineProperty$5(obj, key, value) {
30
30
  if (key in obj) {
31
31
  Object.defineProperty(obj, key, {
32
32
  value: value,
@@ -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) {
@@ -100,7 +111,7 @@ var lib = {exports: {}};
100
111
 
101
112
  var Channel = /*@__PURE__*/getDefaultExportFromCjs(lib.exports);
102
113
 
103
- function _defineProperty$3(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; }
114
+ function _defineProperty$4(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; }
104
115
 
105
116
  const dec2hex = dec => {
106
117
  return dec.toString(16).padStart(2, "0");
@@ -114,9 +125,9 @@ function generateCallId() {
114
125
  }
115
126
  class BaseCallClass {
116
127
  constructor(call) {
117
- _defineProperty$3(this, "serviceName", '');
128
+ _defineProperty$4(this, "serviceName", '');
118
129
 
119
- _defineProperty$3(this, "call", void 0);
130
+ _defineProperty$4(this, "call", void 0);
120
131
 
121
132
  this.call = (fun, ...arg) => {
122
133
  return call(this.serviceName, fun, ...arg);
@@ -139,6 +150,34 @@ class BaseCallClass {
139
150
 
140
151
  }
141
152
 
153
+ function _defineProperty$3(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; }
154
+ class AddToCartContext extends BaseCallClass {
155
+ constructor(...args) {
156
+ super(...args);
157
+
158
+ _defineProperty$3(this, "serviceName", main.Backoffice.Context.AvailableContext.ADD_TO_CART);
159
+
160
+ _defineProperty$3(this, "productId", void 0);
161
+
162
+ _defineProperty$3(this, "cartId", void 0);
163
+
164
+ _defineProperty$3(this, "warehouses", void 0);
165
+ }
166
+
167
+ closePlugin() {
168
+ return this.call('closePlugin');
169
+ }
170
+
171
+ closePluginAndAddToCart() {
172
+ return this.call('closePluginAndAddToCart');
173
+ }
174
+
175
+ closePluginAndRefreshCart() {
176
+ return this.call('closePluginAndRefreshCart');
177
+ }
178
+
179
+ }
180
+
142
181
  function _defineProperty$2(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; }
143
182
  class BackofficeCatalog extends BaseCallClass {
144
183
  constructor(...args) {
@@ -299,6 +338,10 @@ class Sdk extends Events {
299
338
  console.warn('[SDK Core] ', ...data);
300
339
  }
301
340
 
341
+ initializeContextClass() {
342
+ return new this.contextClass(this.callFunction.bind(this));
343
+ }
344
+
302
345
  initializeServiceGetters() {
303
346
  if (this.instances) {
304
347
  Object.keys(this.instances).forEach(serviceName => {
@@ -326,6 +369,8 @@ class Sdk extends Events {
326
369
 
327
370
  _defineProperty(this, "instances", void 0);
328
371
 
372
+ _defineProperty(this, "contextClass", void 0);
373
+
329
374
  this.initializeServiceGetters();
330
375
  this.origin = options.origin;
331
376
  this.channel = new Channel({
@@ -411,6 +456,8 @@ class Sdk extends Events {
411
456
  if (typeof options.autoheight !== 'undefined') {
412
457
  this.autoheight = options.autoheight;
413
458
  }
459
+
460
+ this.contextClass = options.context;
414
461
  }
415
462
  }
416
463
 
@@ -465,7 +512,8 @@ class BackofficeSdk extends Sdk {
465
512
  layout: new BackofficeLayout(this.callFunction.bind(this)),
466
513
  authorization: new BackofficeAuthorization(this.callFunction.bind(this)),
467
514
  customer: new BackofficeCustomer(this.callFunction.bind(this)),
468
- plugin: new BackofficePlugin(this.callFunction.bind(this))
515
+ plugin: new BackofficePlugin(this.callFunction.bind(this)),
516
+ context: this.initializeContextClass()
469
517
  });
470
518
  }
471
519
 
@@ -506,6 +554,7 @@ var index = {
506
554
  obj.authorization.update(payload);
507
555
  obj.customer.update(payload);
508
556
  obj.plugin.update(payload);
557
+ obj.context.update(payload);
509
558
  };
510
559
 
511
560
  sdk.on(SdkEvents.INIT, function (payload) {
@@ -524,5 +573,5 @@ var index = {
524
573
  }
525
574
  };
526
575
 
527
- export { index as default, useOneSdk };
576
+ export { AddToCartContext, index as default, useOneSdk };
528
577
  //# sourceMappingURL=bundle.esm.js.map