@one-commerce/sdk-backoffice-vue3 1.18.0-alpha.0 → 1.19.2-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.
- package/lib/bundles/bundle.esm.js +52 -34
- package/lib/bundles/bundle.esm.js.map +1 -1
- package/lib/bundles/bundle.esm.min.js +1 -1
- package/lib/bundles/bundle.esm.min.js.map +1 -1
- package/lib/bundles/bundle.umd.js +52 -33
- package/lib/bundles/bundle.umd.js.map +1 -1
- package/lib/bundles/bundle.umd.min.js +1 -1
- package/lib/bundles/bundle.umd.min.js.map +1 -1
- package/lib/cjs/index.js +7 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/index.js +3 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/types/index.d.ts +2 -1
- package/lib/types/index.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -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$
|
|
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$
|
|
29
|
+
function _defineProperty$5(obj, key, value) {
|
|
30
30
|
if (key in obj) {
|
|
31
31
|
Object.defineProperty(obj, key, {
|
|
32
32
|
value: value,
|
|
@@ -100,7 +100,7 @@ var lib = {exports: {}};
|
|
|
100
100
|
|
|
101
101
|
var Channel = /*@__PURE__*/getDefaultExportFromCjs(lib.exports);
|
|
102
102
|
|
|
103
|
-
function _defineProperty$
|
|
103
|
+
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
104
|
|
|
105
105
|
const dec2hex = dec => {
|
|
106
106
|
return dec.toString(16).padStart(2, "0");
|
|
@@ -114,9 +114,9 @@ function generateCallId() {
|
|
|
114
114
|
}
|
|
115
115
|
class BaseCallClass {
|
|
116
116
|
constructor(call) {
|
|
117
|
-
_defineProperty$
|
|
117
|
+
_defineProperty$4(this, "serviceName", '');
|
|
118
118
|
|
|
119
|
-
_defineProperty$
|
|
119
|
+
_defineProperty$4(this, "call", void 0);
|
|
120
120
|
|
|
121
121
|
this.call = (fun, ...arg) => {
|
|
122
122
|
return call(this.serviceName, fun, ...arg);
|
|
@@ -139,6 +139,42 @@ class BaseCallClass {
|
|
|
139
139
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
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; }
|
|
143
|
+
|
|
144
|
+
class ContextCallClass extends BaseCallClass {
|
|
145
|
+
constructor(...args) {
|
|
146
|
+
super(...args);
|
|
147
|
+
|
|
148
|
+
_defineProperty$3(this, "serviceName", 'context');
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
class AddToCartContext extends ContextCallClass {
|
|
154
|
+
constructor(...args) {
|
|
155
|
+
super(...args);
|
|
156
|
+
|
|
157
|
+
_defineProperty$3(this, "productId", void 0);
|
|
158
|
+
|
|
159
|
+
_defineProperty$3(this, "cartId", void 0);
|
|
160
|
+
|
|
161
|
+
_defineProperty$3(this, "warehouses", void 0);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
closePlugin() {
|
|
165
|
+
return this.call('closePlugin');
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
closePluginAndAddToCart() {
|
|
169
|
+
return this.call('closePluginAndAddToCart');
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
closePluginAndRefreshCart() {
|
|
173
|
+
return this.call('closePluginAndRefreshCart');
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
}
|
|
177
|
+
|
|
142
178
|
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
179
|
class BackofficeCatalog extends BaseCallClass {
|
|
144
180
|
constructor(...args) {
|
|
@@ -241,32 +277,6 @@ class BackofficePlugin extends BaseCallClass {
|
|
|
241
277
|
_defineProperty$2(this, "name", void 0);
|
|
242
278
|
}
|
|
243
279
|
|
|
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
280
|
}
|
|
271
281
|
|
|
272
282
|
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 +335,10 @@ class Sdk extends Events {
|
|
|
325
335
|
console.warn('[SDK Core] ', ...data);
|
|
326
336
|
}
|
|
327
337
|
|
|
338
|
+
initializeContextClass() {
|
|
339
|
+
return new this.contextClass(this.callFunction.bind(this));
|
|
340
|
+
}
|
|
341
|
+
|
|
328
342
|
initializeServiceGetters() {
|
|
329
343
|
if (this.instances) {
|
|
330
344
|
Object.keys(this.instances).forEach(serviceName => {
|
|
@@ -352,6 +366,8 @@ class Sdk extends Events {
|
|
|
352
366
|
|
|
353
367
|
_defineProperty(this, "instances", void 0);
|
|
354
368
|
|
|
369
|
+
_defineProperty(this, "contextClass", void 0);
|
|
370
|
+
|
|
355
371
|
this.initializeServiceGetters();
|
|
356
372
|
this.origin = options.origin;
|
|
357
373
|
this.channel = new Channel({
|
|
@@ -437,6 +453,8 @@ class Sdk extends Events {
|
|
|
437
453
|
if (typeof options.autoheight !== 'undefined') {
|
|
438
454
|
this.autoheight = options.autoheight;
|
|
439
455
|
}
|
|
456
|
+
|
|
457
|
+
this.contextClass = options.context;
|
|
440
458
|
}
|
|
441
459
|
}
|
|
442
460
|
|
|
@@ -492,7 +510,7 @@ class BackofficeSdk extends Sdk {
|
|
|
492
510
|
authorization: new BackofficeAuthorization(this.callFunction.bind(this)),
|
|
493
511
|
customer: new BackofficeCustomer(this.callFunction.bind(this)),
|
|
494
512
|
plugin: new BackofficePlugin(this.callFunction.bind(this)),
|
|
495
|
-
|
|
513
|
+
context: this.initializeContextClass()
|
|
496
514
|
});
|
|
497
515
|
}
|
|
498
516
|
|
|
@@ -533,7 +551,7 @@ var index = {
|
|
|
533
551
|
obj.authorization.update(payload);
|
|
534
552
|
obj.customer.update(payload);
|
|
535
553
|
obj.plugin.update(payload);
|
|
536
|
-
obj.
|
|
554
|
+
obj.context.update(payload);
|
|
537
555
|
};
|
|
538
556
|
|
|
539
557
|
sdk.on(SdkEvents.INIT, function (payload) {
|
|
@@ -552,5 +570,5 @@ var index = {
|
|
|
552
570
|
}
|
|
553
571
|
};
|
|
554
572
|
|
|
555
|
-
export { index as default, useOneSdk };
|
|
573
|
+
export { AddToCartContext, index as default, useOneSdk };
|
|
556
574
|
//# sourceMappingURL=bundle.esm.js.map
|