@one-commerce/sdk-core 2.3.6 → 2.3.7
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 +1577 -0
- package/lib/bundles/bundle.esm.js.map +1 -0
- package/lib/bundles/bundle.esm.min.js +2 -0
- package/lib/bundles/bundle.esm.min.js.map +1 -0
- package/lib/bundles/bundle.umd.js +1593 -0
- package/lib/bundles/bundle.umd.js.map +1 -0
- package/lib/bundles/bundle.umd.min.js +2 -0
- package/lib/bundles/bundle.umd.min.js.map +1 -0
- package/lib/cjs/backoffice/context.js +196 -0
- package/lib/cjs/backoffice/context.js.map +1 -0
- package/lib/cjs/backoffice/services.js +298 -0
- package/lib/cjs/backoffice/services.js.map +1 -0
- package/lib/cjs/events.js +75 -0
- package/lib/cjs/events.js.map +1 -0
- package/lib/cjs/index.js +418 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/shop/context.js +144 -0
- package/lib/cjs/shop/context.js.map +1 -0
- package/lib/cjs/shop/services.js +435 -0
- package/lib/cjs/shop/services.js.map +1 -0
- package/lib/cjs/utils.js +111 -0
- package/lib/cjs/utils.js.map +1 -0
- package/lib/esm/backoffice/context.js +100 -0
- package/lib/esm/backoffice/context.js.map +1 -0
- package/lib/esm/backoffice/services.js +114 -0
- package/lib/esm/backoffice/services.js.map +1 -0
- package/lib/esm/events.js +47 -0
- package/lib/esm/events.js.map +1 -0
- package/lib/esm/index.js +244 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/shop/context.js +70 -0
- package/lib/esm/shop/context.js.map +1 -0
- package/lib/esm/shop/services.js +218 -0
- package/lib/esm/shop/services.js.map +1 -0
- package/lib/esm/utils.js +47 -0
- package/lib/esm/utils.js.map +1 -0
- package/lib/types/backoffice/context.d.ts +66 -0
- package/lib/types/backoffice/context.d.ts.map +1 -0
- package/lib/types/backoffice/services.d.ts +49 -0
- package/lib/types/backoffice/services.d.ts.map +1 -0
- package/lib/types/events.d.ts +9 -0
- package/lib/types/events.d.ts.map +1 -0
- package/lib/types/iframe-channel.d.ts +19 -0
- package/lib/types/index.d.ts +107 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/shop/context.d.ts +30 -0
- package/lib/types/shop/context.d.ts.map +1 -0
- package/lib/types/shop/services.d.ts +161 -0
- package/lib/types/shop/services.d.ts.map +1 -0
- package/lib/types/utils.d.ts +12 -0
- package/lib/types/utils.d.ts.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.BackofficeUser = exports.BackofficeTenant = exports.BackofficePlugin = exports.BackofficeOrderpath = exports.BackofficeLayout = exports.BackofficeCustomer = exports.BackofficeCatalog = exports.BackofficeAuthorization = void 0;
|
|
9
|
+
|
|
10
|
+
var _utils = require("../utils");
|
|
11
|
+
|
|
12
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
|
+
|
|
14
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
15
|
+
|
|
16
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
17
|
+
|
|
18
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
19
|
+
|
|
20
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21
|
+
|
|
22
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
23
|
+
|
|
24
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
25
|
+
|
|
26
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
27
|
+
|
|
28
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
29
|
+
|
|
30
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
31
|
+
|
|
32
|
+
function _defineProperty(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; }
|
|
33
|
+
|
|
34
|
+
var BackofficeCatalog = /*#__PURE__*/function (_BaseCallClass) {
|
|
35
|
+
_inherits(BackofficeCatalog, _BaseCallClass);
|
|
36
|
+
|
|
37
|
+
var _super = _createSuper(BackofficeCatalog);
|
|
38
|
+
|
|
39
|
+
function BackofficeCatalog() {
|
|
40
|
+
var _this;
|
|
41
|
+
|
|
42
|
+
_classCallCheck(this, BackofficeCatalog);
|
|
43
|
+
|
|
44
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
45
|
+
args[_key] = arguments[_key];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
49
|
+
|
|
50
|
+
_defineProperty(_assertThisInitialized(_this), "serviceName", 'catalog');
|
|
51
|
+
|
|
52
|
+
return _this;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
_createClass(BackofficeCatalog, [{
|
|
56
|
+
key: "fetchCategories",
|
|
57
|
+
value: function fetchCategories() {
|
|
58
|
+
return this.call('fetchCategories');
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "fetchProduct",
|
|
62
|
+
value: function fetchProduct(id) {
|
|
63
|
+
return this.call('fetchProduct', id);
|
|
64
|
+
}
|
|
65
|
+
}]);
|
|
66
|
+
|
|
67
|
+
return BackofficeCatalog;
|
|
68
|
+
}(_utils.BaseCallClass);
|
|
69
|
+
|
|
70
|
+
exports.BackofficeCatalog = BackofficeCatalog;
|
|
71
|
+
|
|
72
|
+
var BackofficeUser = /*#__PURE__*/function (_BaseCallClass2) {
|
|
73
|
+
_inherits(BackofficeUser, _BaseCallClass2);
|
|
74
|
+
|
|
75
|
+
var _super2 = _createSuper(BackofficeUser);
|
|
76
|
+
|
|
77
|
+
function BackofficeUser() {
|
|
78
|
+
var _this2;
|
|
79
|
+
|
|
80
|
+
_classCallCheck(this, BackofficeUser);
|
|
81
|
+
|
|
82
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
83
|
+
args[_key2] = arguments[_key2];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
_this2 = _super2.call.apply(_super2, [this].concat(args));
|
|
87
|
+
|
|
88
|
+
_defineProperty(_assertThisInitialized(_this2), "serviceName", 'user');
|
|
89
|
+
|
|
90
|
+
_defineProperty(_assertThisInitialized(_this2), "email", void 0);
|
|
91
|
+
|
|
92
|
+
_defineProperty(_assertThisInitialized(_this2), "id", void 0);
|
|
93
|
+
|
|
94
|
+
_defineProperty(_assertThisInitialized(_this2), "name", void 0);
|
|
95
|
+
|
|
96
|
+
_defineProperty(_assertThisInitialized(_this2), "authorities", void 0);
|
|
97
|
+
|
|
98
|
+
return _this2;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return _createClass(BackofficeUser);
|
|
102
|
+
}(_utils.BaseCallClass);
|
|
103
|
+
|
|
104
|
+
exports.BackofficeUser = BackofficeUser;
|
|
105
|
+
|
|
106
|
+
var BackofficeTenant = /*#__PURE__*/function (_BaseCallClass3) {
|
|
107
|
+
_inherits(BackofficeTenant, _BaseCallClass3);
|
|
108
|
+
|
|
109
|
+
var _super3 = _createSuper(BackofficeTenant);
|
|
110
|
+
|
|
111
|
+
function BackofficeTenant() {
|
|
112
|
+
var _this3;
|
|
113
|
+
|
|
114
|
+
_classCallCheck(this, BackofficeTenant);
|
|
115
|
+
|
|
116
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
117
|
+
args[_key3] = arguments[_key3];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
_this3 = _super3.call.apply(_super3, [this].concat(args));
|
|
121
|
+
|
|
122
|
+
_defineProperty(_assertThisInitialized(_this3), "serviceName", 'tenant');
|
|
123
|
+
|
|
124
|
+
_defineProperty(_assertThisInitialized(_this3), "tenantKey", void 0);
|
|
125
|
+
|
|
126
|
+
_defineProperty(_assertThisInitialized(_this3), "language", void 0);
|
|
127
|
+
|
|
128
|
+
_defineProperty(_assertThisInitialized(_this3), "currency", void 0);
|
|
129
|
+
|
|
130
|
+
return _this3;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return _createClass(BackofficeTenant);
|
|
134
|
+
}(_utils.BaseCallClass);
|
|
135
|
+
|
|
136
|
+
exports.BackofficeTenant = BackofficeTenant;
|
|
137
|
+
|
|
138
|
+
var BackofficeLayout = /*#__PURE__*/function (_BaseCallClass4) {
|
|
139
|
+
_inherits(BackofficeLayout, _BaseCallClass4);
|
|
140
|
+
|
|
141
|
+
var _super4 = _createSuper(BackofficeLayout);
|
|
142
|
+
|
|
143
|
+
function BackofficeLayout() {
|
|
144
|
+
var _this4;
|
|
145
|
+
|
|
146
|
+
_classCallCheck(this, BackofficeLayout);
|
|
147
|
+
|
|
148
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
149
|
+
args[_key4] = arguments[_key4];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
_this4 = _super4.call.apply(_super4, [this].concat(args));
|
|
153
|
+
|
|
154
|
+
_defineProperty(_assertThisInitialized(_this4), "serviceName", 'layout');
|
|
155
|
+
|
|
156
|
+
_defineProperty(_assertThisInitialized(_this4), "isAsideOpened", void 0);
|
|
157
|
+
|
|
158
|
+
return _this4;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return _createClass(BackofficeLayout);
|
|
162
|
+
}(_utils.BaseCallClass);
|
|
163
|
+
|
|
164
|
+
exports.BackofficeLayout = BackofficeLayout;
|
|
165
|
+
|
|
166
|
+
var BackofficeAuthorization = /*#__PURE__*/function (_BaseCallClass5) {
|
|
167
|
+
_inherits(BackofficeAuthorization, _BaseCallClass5);
|
|
168
|
+
|
|
169
|
+
var _super5 = _createSuper(BackofficeAuthorization);
|
|
170
|
+
|
|
171
|
+
function BackofficeAuthorization() {
|
|
172
|
+
var _this5;
|
|
173
|
+
|
|
174
|
+
_classCallCheck(this, BackofficeAuthorization);
|
|
175
|
+
|
|
176
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
177
|
+
args[_key5] = arguments[_key5];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
_this5 = _super5.call.apply(_super5, [this].concat(args));
|
|
181
|
+
|
|
182
|
+
_defineProperty(_assertThisInitialized(_this5), "serviceName", 'authorization');
|
|
183
|
+
|
|
184
|
+
return _this5;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
_createClass(BackofficeAuthorization, [{
|
|
188
|
+
key: "getAuthToken",
|
|
189
|
+
value: function getAuthToken() {
|
|
190
|
+
return this.call('getAuthToken');
|
|
191
|
+
}
|
|
192
|
+
}]);
|
|
193
|
+
|
|
194
|
+
return BackofficeAuthorization;
|
|
195
|
+
}(_utils.BaseCallClass);
|
|
196
|
+
|
|
197
|
+
exports.BackofficeAuthorization = BackofficeAuthorization;
|
|
198
|
+
|
|
199
|
+
var BackofficeCustomer = /*#__PURE__*/function (_BaseCallClass6) {
|
|
200
|
+
_inherits(BackofficeCustomer, _BaseCallClass6);
|
|
201
|
+
|
|
202
|
+
var _super6 = _createSuper(BackofficeCustomer);
|
|
203
|
+
|
|
204
|
+
function BackofficeCustomer() {
|
|
205
|
+
var _this6;
|
|
206
|
+
|
|
207
|
+
_classCallCheck(this, BackofficeCustomer);
|
|
208
|
+
|
|
209
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
210
|
+
args[_key6] = arguments[_key6];
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
_this6 = _super6.call.apply(_super6, [this].concat(args));
|
|
214
|
+
|
|
215
|
+
_defineProperty(_assertThisInitialized(_this6), "serviceName", 'customer');
|
|
216
|
+
|
|
217
|
+
_defineProperty(_assertThisInitialized(_this6), "id", void 0);
|
|
218
|
+
|
|
219
|
+
_defineProperty(_assertThisInitialized(_this6), "name", void 0);
|
|
220
|
+
|
|
221
|
+
return _this6;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return _createClass(BackofficeCustomer);
|
|
225
|
+
}(_utils.BaseCallClass);
|
|
226
|
+
|
|
227
|
+
exports.BackofficeCustomer = BackofficeCustomer;
|
|
228
|
+
|
|
229
|
+
var BackofficePlugin = /*#__PURE__*/function (_BaseCallClass7) {
|
|
230
|
+
_inherits(BackofficePlugin, _BaseCallClass7);
|
|
231
|
+
|
|
232
|
+
var _super7 = _createSuper(BackofficePlugin);
|
|
233
|
+
|
|
234
|
+
function BackofficePlugin() {
|
|
235
|
+
var _this7;
|
|
236
|
+
|
|
237
|
+
_classCallCheck(this, BackofficePlugin);
|
|
238
|
+
|
|
239
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
240
|
+
args[_key7] = arguments[_key7];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
_this7 = _super7.call.apply(_super7, [this].concat(args));
|
|
244
|
+
|
|
245
|
+
_defineProperty(_assertThisInitialized(_this7), "serviceName", 'plugin');
|
|
246
|
+
|
|
247
|
+
_defineProperty(_assertThisInitialized(_this7), "id", void 0);
|
|
248
|
+
|
|
249
|
+
_defineProperty(_assertThisInitialized(_this7), "srcUrl", void 0);
|
|
250
|
+
|
|
251
|
+
_defineProperty(_assertThisInitialized(_this7), "name", void 0);
|
|
252
|
+
|
|
253
|
+
return _this7;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return _createClass(BackofficePlugin);
|
|
257
|
+
}(_utils.BaseCallClass);
|
|
258
|
+
|
|
259
|
+
exports.BackofficePlugin = BackofficePlugin;
|
|
260
|
+
|
|
261
|
+
var BackofficeOrderpath = /*#__PURE__*/function (_BaseCallClass8) {
|
|
262
|
+
_inherits(BackofficeOrderpath, _BaseCallClass8);
|
|
263
|
+
|
|
264
|
+
var _super8 = _createSuper(BackofficeOrderpath);
|
|
265
|
+
|
|
266
|
+
function BackofficeOrderpath() {
|
|
267
|
+
var _this8;
|
|
268
|
+
|
|
269
|
+
_classCallCheck(this, BackofficeOrderpath);
|
|
270
|
+
|
|
271
|
+
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
|
272
|
+
args[_key8] = arguments[_key8];
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
_this8 = _super8.call.apply(_super8, [this].concat(args));
|
|
276
|
+
|
|
277
|
+
_defineProperty(_assertThisInitialized(_this8), "serviceName", 'orderpath');
|
|
278
|
+
|
|
279
|
+
return _this8;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
_createClass(BackofficeOrderpath, [{
|
|
283
|
+
key: "fetchCart",
|
|
284
|
+
value: function fetchCart(id) {
|
|
285
|
+
return this.call('fetchCart', id);
|
|
286
|
+
}
|
|
287
|
+
}, {
|
|
288
|
+
key: "fetchOffer",
|
|
289
|
+
value: function fetchOffer(id) {
|
|
290
|
+
return this.call('fetchOffer', id);
|
|
291
|
+
}
|
|
292
|
+
}]);
|
|
293
|
+
|
|
294
|
+
return BackofficeOrderpath;
|
|
295
|
+
}(_utils.BaseCallClass);
|
|
296
|
+
|
|
297
|
+
exports.BackofficeOrderpath = BackofficeOrderpath;
|
|
298
|
+
//# sourceMappingURL=services.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/backoffice/services.ts"],"names":["BackofficeCatalog","call","id","BaseCallClass","BackofficeUser","BackofficeTenant","BackofficeLayout","BackofficeAuthorization","BackofficeCustomer","BackofficePlugin","BackofficeOrderpath"],"mappings":";;;;;;;;;AACA;;;;;;;;;;;;;;;;;;;;;;;;IAEaA,iB;;;;;;;;;;;;;;;;kEACG,S;;;;;;;WAEd,2BAA2C;AACzC,aAAO,KAAKC,IAAL,CAAU,iBAAV,CAAP;AACD;;;WACD,sBAAoBC,EAApB,EAAkD;AAChD,aAAO,KAAKD,IAAL,CAAU,cAAV,EAA0BC,EAA1B,CAAP;AACD;;;;EARoCC,oB;;;;IAW1BC,c;;;;;;;;;;;;;;;;mEACG,M;;;;;;;;;;;;;;EADoBD,oB;;;;IAQvBE,gB;;;;;;;;;;;;;;;;mEACG,Q;;;;;;;;;;;;EADsBF,oB;;;;IAOzBG,gB;;;;;;;;;;;;;;;;mEACG,Q;;;;;;;;EADsBH,oB;;;;IAKzBI,uB;;;;;;;;;;;;;;;;mEACG,e;;;;;;;WAEd,wBAAgC;AAC9B,aAAO,KAAKN,IAAL,CAAU,cAAV,CAAP;AACD;;;;EAL0CE,oB;;;;IAQhCK,kB;;;;;;;;;;;;;;;;mEACG,U;;;;;;;;;;EADwBL,oB;;;;IAM3BM,gB;;;;;;;;;;;;;;;;mEACG,Q;;;;;;;;;;;;EADsBN,oB;;;;IAOzBO,mB;;;;;;;;;;;;;;;;mEACG,W;;;;;;;WACd,mBAAUR,EAAV,EAAwC;AACtC,aAAO,KAAKD,IAAL,CAAU,WAAV,EAAuBC,EAAvB,CAAP;AACD;;;WACD,oBAAWA,EAAX,EAAyC;AACvC,aAAO,KAAKD,IAAL,CAAU,YAAV,EAAwBC,EAAxB,CAAP;AACD;;;;EAPsCC,oB","sourcesContent":["import { Backoffice } from \"@one-commerce/sdk-shared\";\nimport { BaseCallClass } from \"../utils\";\n\nexport class BackofficeCatalog extends BaseCallClass implements Backoffice.Catalog {\n serviceName = 'catalog'\n\n fetchCategories(): Promise<Array<unknown>> {\n return this.call('fetchCategories')\n }\n public fetchProduct(id: string): Promise<unknown> {\n return this.call('fetchProduct', id)\n }\n}\n\nexport class BackofficeUser extends BaseCallClass implements Backoffice.User {\n serviceName = 'user'\n email?: string;\n id!: string;\n name?: string;\n authorities!: Array<string>;\n}\n\nexport class BackofficeTenant extends BaseCallClass implements Backoffice.Tenant {\n serviceName = 'tenant'\n tenantKey?: string;\n language?: string;\n currency?: { code: string; iso: string; symbol: string; };\n}\n\nexport class BackofficeLayout extends BaseCallClass implements Backoffice.Layout {\n serviceName = 'layout'\n isAsideOpened!: boolean;\n}\n\nexport class BackofficeAuthorization extends BaseCallClass implements Backoffice.Authorization {\n serviceName = 'authorization'\n\n getAuthToken(): Promise<string> {\n return this.call('getAuthToken')\n }\n}\n\nexport class BackofficeCustomer extends BaseCallClass implements Backoffice.Customer {\n serviceName = 'customer'\n id?: string;\n name?: string;\n}\n\nexport class BackofficePlugin extends BaseCallClass implements Backoffice.Plugin {\n serviceName = 'plugin'\n id: string;\n srcUrl?: string;\n name?: string;\n}\n\nexport class BackofficeOrderpath extends BaseCallClass implements Backoffice.Orderpath {\n serviceName = 'orderpath'\n fetchCart(id: string): Promise<unknown> {\n return this.call('fetchCart', id)\n }\n fetchOffer(id: string): Promise<unknown> {\n return this.call('fetchOffer', id)\n }\n}\n"],"file":"services.js"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
|
|
10
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
11
|
+
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
|
|
14
|
+
function _defineProperty(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; }
|
|
15
|
+
|
|
16
|
+
var Events = /*#__PURE__*/function () {
|
|
17
|
+
function Events() {
|
|
18
|
+
_classCallCheck(this, Events);
|
|
19
|
+
|
|
20
|
+
_defineProperty(this, "_callbacks", void 0);
|
|
21
|
+
|
|
22
|
+
this._callbacks = {};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
_createClass(Events, [{
|
|
26
|
+
key: "on",
|
|
27
|
+
value: function on(key, callback) {
|
|
28
|
+
// create an empty array for the event key
|
|
29
|
+
if (this._callbacks[key] === undefined) {
|
|
30
|
+
this._callbacks[key] = [];
|
|
31
|
+
} // save the callback in the array for the event key
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
this._callbacks[key].push(callback);
|
|
35
|
+
}
|
|
36
|
+
}, {
|
|
37
|
+
key: "off",
|
|
38
|
+
value: function off(key, callback) {
|
|
39
|
+
// if the key exists
|
|
40
|
+
if (this._callbacks[key] !== undefined) {
|
|
41
|
+
// iterate through the callbacks for the event key
|
|
42
|
+
for (var i = 0; i < this._callbacks[key].length; i++) {
|
|
43
|
+
// if the callback matches, remove it
|
|
44
|
+
if (this._callbacks[key][i] === callback) {
|
|
45
|
+
this._callbacks[key].splice(i, 1);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
key: "emit",
|
|
52
|
+
value: function emit(key) {
|
|
53
|
+
// if the key exists
|
|
54
|
+
if (this._callbacks[key] !== undefined) {
|
|
55
|
+
for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
56
|
+
params[_key - 1] = arguments[_key];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// iterate through the callbacks for the event key
|
|
60
|
+
for (var i = 0; i < this._callbacks[key].length; i++) {
|
|
61
|
+
var _this$_callbacks$key;
|
|
62
|
+
|
|
63
|
+
// trigger the callbacks with all provided params
|
|
64
|
+
(_this$_callbacks$key = this._callbacks[key])[i].apply(_this$_callbacks$key, params);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}]);
|
|
69
|
+
|
|
70
|
+
return Events;
|
|
71
|
+
}();
|
|
72
|
+
|
|
73
|
+
var _default = Events;
|
|
74
|
+
exports["default"] = _default;
|
|
75
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/events.ts"],"names":["Events","_callbacks","key","callback","undefined","push","i","length","splice","params"],"mappings":";;;;;;;;;;;;;;;IAAMA,M;AAEJ,oBAAe;AAAA;;AAAA;;AACb,SAAKC,UAAL,GAAkB,EAAlB;AACD;;;;WAED,YAAMC,GAAN,EAAmBC,QAAnB,EAA+C;AAC7C;AACA,UAAI,KAAKF,UAAL,CAAgBC,GAAhB,MAAyBE,SAA7B,EAAwC;AAAE,aAAKH,UAAL,CAAgBC,GAAhB,IAAuB,EAAvB;AAA2B,OAFxB,CAG7C;;;AACA,WAAKD,UAAL,CAAgBC,GAAhB,EAAqBG,IAArB,CAA0BF,QAA1B;AACD;;;WAED,aAAOD,GAAP,EAAoBC,QAApB,EAAgD;AAC9C;AACA,UAAI,KAAKF,UAAL,CAAgBC,GAAhB,MAAyBE,SAA7B,EAAwC;AACtC;AACA,aAAK,IAAIE,CAAC,GAAC,CAAX,EAAcA,CAAC,GAAC,KAAKL,UAAL,CAAgBC,GAAhB,EAAqBK,MAArC,EAA6CD,CAAC,EAA9C,EAAkD;AAChD;AACA,cAAI,KAAKL,UAAL,CAAgBC,GAAhB,EAAqBI,CAArB,MAA4BH,QAAhC,EAA0C;AACxC,iBAAKF,UAAL,CAAgBC,GAAhB,EAAqBM,MAArB,CAA4BF,CAA5B,EAA+B,CAA/B;AACD;AACF;AACF;AACF;;;WAED,cAAKJ,GAAL,EAAyC;AACvC;AACA,UAAI,KAAKD,UAAL,CAAgBC,GAAhB,MAAyBE,SAA7B,EAAwC;AAAA,0CAFrBK,MAEqB;AAFrBA,UAAAA,MAEqB;AAAA;;AACtC;AACA,aAAK,IAAIH,CAAC,GAAC,CAAX,EAAcA,CAAC,GAAC,KAAKL,UAAL,CAAgBC,GAAhB,EAAqBK,MAArC,EAA6CD,CAAC,EAA9C,EAAkD;AAAA;;AAChD;AACA,uCAAKL,UAAL,CAAgBC,GAAhB,GAAqBI,CAArB,8BAA2BG,MAA3B;AACD;AACF;AACF;;;;;;eAGYT,M","sourcesContent":["class Events {\n _callbacks: Record<string, any>\n constructor () {\n this._callbacks = {}\n }\n\n on<T>(key: string, callback: (arg: T) => void) {\n // create an empty array for the event key\n if (this._callbacks[key] === undefined) { this._callbacks[key] = [] }\n // save the callback in the array for the event key\n this._callbacks[key].push(callback)\n }\n\n off<T>(key: string, callback: (arg: T) => void) {\n // if the key exists\n if (this._callbacks[key] !== undefined) {\n // iterate through the callbacks for the event key\n for (let i=0; i<this._callbacks[key].length; i++) {\n // if the callback matches, remove it\n if (this._callbacks[key][i] === callback) {\n this._callbacks[key].splice(i, 1)\n }\n }\n }\n }\n\n emit(key: string, ...params: Array<any>) {\n // if the key exists\n if (this._callbacks[key] !== undefined) {\n // iterate through the callbacks for the event key\n for (let i=0; i<this._callbacks[key].length; i++) {\n // trigger the callbacks with all provided params\n this._callbacks[key][i](...params)\n }\n }\n }\n}\n\nexport default Events\n"],"file":"events.js"}
|