@one-commerce/sdk-core 2.3.6 → 2.3.9

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 (52) hide show
  1. package/lib/bundles/bundle.esm.js +1577 -0
  2. package/lib/bundles/bundle.esm.js.map +1 -0
  3. package/lib/bundles/bundle.esm.min.js +2 -0
  4. package/lib/bundles/bundle.esm.min.js.map +1 -0
  5. package/lib/bundles/bundle.umd.js +1593 -0
  6. package/lib/bundles/bundle.umd.js.map +1 -0
  7. package/lib/bundles/bundle.umd.min.js +2 -0
  8. package/lib/bundles/bundle.umd.min.js.map +1 -0
  9. package/lib/cjs/backoffice/context.js +196 -0
  10. package/lib/cjs/backoffice/context.js.map +1 -0
  11. package/lib/cjs/backoffice/services.js +298 -0
  12. package/lib/cjs/backoffice/services.js.map +1 -0
  13. package/lib/cjs/events.js +75 -0
  14. package/lib/cjs/events.js.map +1 -0
  15. package/lib/cjs/index.js +418 -0
  16. package/lib/cjs/index.js.map +1 -0
  17. package/lib/cjs/shop/context.js +144 -0
  18. package/lib/cjs/shop/context.js.map +1 -0
  19. package/lib/cjs/shop/services.js +435 -0
  20. package/lib/cjs/shop/services.js.map +1 -0
  21. package/lib/cjs/utils.js +111 -0
  22. package/lib/cjs/utils.js.map +1 -0
  23. package/lib/esm/backoffice/context.js +100 -0
  24. package/lib/esm/backoffice/context.js.map +1 -0
  25. package/lib/esm/backoffice/services.js +114 -0
  26. package/lib/esm/backoffice/services.js.map +1 -0
  27. package/lib/esm/events.js +47 -0
  28. package/lib/esm/events.js.map +1 -0
  29. package/lib/esm/index.js +244 -0
  30. package/lib/esm/index.js.map +1 -0
  31. package/lib/esm/shop/context.js +70 -0
  32. package/lib/esm/shop/context.js.map +1 -0
  33. package/lib/esm/shop/services.js +218 -0
  34. package/lib/esm/shop/services.js.map +1 -0
  35. package/lib/esm/utils.js +47 -0
  36. package/lib/esm/utils.js.map +1 -0
  37. package/lib/types/backoffice/context.d.ts +66 -0
  38. package/lib/types/backoffice/context.d.ts.map +1 -0
  39. package/lib/types/backoffice/services.d.ts +49 -0
  40. package/lib/types/backoffice/services.d.ts.map +1 -0
  41. package/lib/types/events.d.ts +9 -0
  42. package/lib/types/events.d.ts.map +1 -0
  43. package/lib/types/iframe-channel.d.ts +19 -0
  44. package/lib/types/index.d.ts +107 -0
  45. package/lib/types/index.d.ts.map +1 -0
  46. package/lib/types/shop/context.d.ts +30 -0
  47. package/lib/types/shop/context.d.ts.map +1 -0
  48. package/lib/types/shop/services.d.ts +161 -0
  49. package/lib/types/shop/services.d.ts.map +1 -0
  50. package/lib/types/utils.d.ts +12 -0
  51. package/lib/types/utils.d.ts.map +1 -0
  52. package/package.json +3 -3
@@ -0,0 +1,218 @@
1
+ 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; }
2
+
3
+ import { BaseCallClass } from "../utils";
4
+ export class ShopCatalog extends BaseCallClass {
5
+ constructor(...args) {
6
+ super(...args);
7
+
8
+ _defineProperty(this, "serviceName", 'catalog');
9
+
10
+ _defineProperty(this, "categories", void 0);
11
+
12
+ _defineProperty(this, "selectedCategoryId", void 0);
13
+ }
14
+
15
+ fetchProduct(productId) {
16
+ return this.call('fetchProduct', productId);
17
+ }
18
+
19
+ fetchProducts(page) {
20
+ return this.call('fetchProducts', page);
21
+ }
22
+
23
+ fetchStocksForProductsAndWarehouses(products, warehouses) {
24
+ return this.call('fetchStocksForProductsAndWarehouses', products, warehouses);
25
+ }
26
+
27
+ getProductPrice(productId, isGross) {
28
+ return this.call('getProductPrice', productId, isGross);
29
+ }
30
+
31
+ fetchPricingForProducts(products) {
32
+ return this.call('fetchPricingForProducts', products);
33
+ }
34
+
35
+ fetchWarehouses() {
36
+ return this.call('fetchWarehouses');
37
+ }
38
+
39
+ getCategoryById(categoryId) {
40
+ return this.call('getCategoryById', categoryId);
41
+ }
42
+
43
+ }
44
+ export class ShopWishlist extends BaseCallClass {
45
+ constructor(...args) {
46
+ super(...args);
47
+
48
+ _defineProperty(this, "serviceName", 'wishlist');
49
+ }
50
+
51
+ addProductsToWishlist(wishlistId, newProduct) {
52
+ return this.call('addProductsToWishlist', wishlistId, newProduct);
53
+ }
54
+
55
+ getWishlists() {
56
+ return this.call('getWishlists');
57
+ }
58
+
59
+ createWishlist(name) {
60
+ return this.call('createWishlist', name);
61
+ }
62
+
63
+ }
64
+ export class ShopAccount extends BaseCallClass {
65
+ constructor(...args) {
66
+ super(...args);
67
+
68
+ _defineProperty(this, "serviceName", 'account');
69
+
70
+ _defineProperty(this, "client", void 0);
71
+
72
+ _defineProperty(this, "isAuthenticated", void 0);
73
+
74
+ _defineProperty(this, "user", void 0);
75
+
76
+ _defineProperty(this, "manager", void 0);
77
+ }
78
+
79
+ hasSegment(name) {
80
+ return this.call('hasSegment', name);
81
+ }
82
+
83
+ logout() {// NotImplementedYet
84
+ }
85
+
86
+ }
87
+ export class ShopCart extends BaseCallClass {
88
+ constructor(...args) {
89
+ super(...args);
90
+
91
+ _defineProperty(this, "serviceName", 'cart');
92
+
93
+ _defineProperty(this, "carts", void 0);
94
+
95
+ _defineProperty(this, "currentCart", void 0);
96
+
97
+ _defineProperty(this, "totalCartPrice", void 0);
98
+ }
99
+
100
+ addToCart(productId, amount, where, cartId) {
101
+ return this.call('addToCart', productId, amount, where, cartId);
102
+ }
103
+
104
+ }
105
+ export class ShopAuthorization extends BaseCallClass {
106
+ constructor(...args) {
107
+ super(...args);
108
+
109
+ _defineProperty(this, "serviceName", 'authorization');
110
+ }
111
+
112
+ getAuthToken() {
113
+ return this.call('getAuthToken');
114
+ }
115
+
116
+ }
117
+ export class ShopUtils extends BaseCallClass {
118
+ notify(options) {
119
+ return this.call('notify', options);
120
+ }
121
+
122
+ constructor(call) {
123
+ super(call);
124
+
125
+ _defineProperty(this, "serviceName", 'utils');
126
+
127
+ _defineProperty(this, "currency", void 0);
128
+
129
+ _defineProperty(this, "isAnonymousAndPurchaseDisabled", void 0);
130
+
131
+ _defineProperty(this, "isB2B", void 0);
132
+
133
+ _defineProperty(this, "isB2BAndPlatformIsNotOpened", void 0);
134
+
135
+ _defineProperty(this, "isIndexPage", void 0);
136
+
137
+ _defineProperty(this, "isPurchaseEnabledOrAuthenticated", void 0);
138
+
139
+ _defineProperty(this, "routes", void 0);
140
+
141
+ this.routes = {
142
+ getCategoryPath: this.getCategoryPath,
143
+ getManufacturerSearchUrl: this.getManufacturerSearchUrl,
144
+ getProductUrl: this.getProductUrl,
145
+ isExternalUrl: this.isExternalUrl
146
+ };
147
+ }
148
+
149
+ getCategoryPath(id) {
150
+ return this.call('getCategoryPath', id);
151
+ }
152
+
153
+ getManufacturerSearchUrl(manufacturer) {
154
+ return this.call('getManufacturerSearchUrl', manufacturer);
155
+ }
156
+
157
+ getProductUrl(product) {
158
+ return this.call('getProductUrl', product);
159
+ }
160
+
161
+ isExternalUrl(url) {
162
+ return this.call('isExternalUrl', url);
163
+ }
164
+
165
+ }
166
+ export class ShopConfig extends BaseCallClass {
167
+ constructor(...args) {
168
+ super(...args);
169
+
170
+ _defineProperty(this, "serviceName", 'config');
171
+
172
+ _defineProperty(this, "accessMode", void 0);
173
+
174
+ _defineProperty(this, "isB2CRegistrationEnabled", void 0);
175
+
176
+ _defineProperty(this, "isCatalogOpened", void 0);
177
+
178
+ _defineProperty(this, "isGrossSelected", void 0);
179
+
180
+ _defineProperty(this, "isPlatformClosed", void 0);
181
+
182
+ _defineProperty(this, "isPlatformOpened", void 0);
183
+
184
+ _defineProperty(this, "isPurchaseEnabled", void 0);
185
+
186
+ _defineProperty(this, "isRegistrationEnabled", void 0);
187
+
188
+ _defineProperty(this, "currency", void 0);
189
+ }
190
+
191
+ }
192
+ export class ShopTenant extends BaseCallClass {
193
+ constructor(...args) {
194
+ super(...args);
195
+
196
+ _defineProperty(this, "serviceName", 'tenant');
197
+
198
+ _defineProperty(this, "tenantKey", void 0);
199
+
200
+ _defineProperty(this, "language", void 0);
201
+ }
202
+
203
+ }
204
+ export class ShopPlugin extends BaseCallClass {
205
+ constructor(...args) {
206
+ super(...args);
207
+
208
+ _defineProperty(this, "serviceName", 'plugin');
209
+
210
+ _defineProperty(this, "id", void 0);
211
+
212
+ _defineProperty(this, "srcUrl", void 0);
213
+
214
+ _defineProperty(this, "name", void 0);
215
+ }
216
+
217
+ }
218
+ //# sourceMappingURL=services.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/shop/services.ts"],"names":["BaseCallClass","ShopCatalog","fetchProduct","productId","call","fetchProducts","page","fetchStocksForProductsAndWarehouses","products","warehouses","getProductPrice","isGross","fetchPricingForProducts","fetchWarehouses","getCategoryById","categoryId","ShopWishlist","addProductsToWishlist","wishlistId","newProduct","getWishlists","createWishlist","name","ShopAccount","hasSegment","logout","ShopCart","addToCart","amount","where","cartId","ShopAuthorization","getAuthToken","ShopUtils","notify","options","constructor","routes","getCategoryPath","getManufacturerSearchUrl","getProductUrl","isExternalUrl","id","manufacturer","product","url","ShopConfig","ShopTenant","ShopPlugin"],"mappings":";;AAEA,SAASA,aAAT,QAA8B,UAA9B;AAEA,OAAO,MAAMC,WAAN,SAA0BD,aAA1B,CAAgE;AAAA;AAAA;;AAAA,yCACvD,SADuD;;AAAA;;AAAA;AAAA;;AAKrEE,EAAAA,YAAY,CAACC,SAAD,EAAkC;AAC5C,WAAO,KAAKC,IAAL,CAAU,cAAV,EAA0BD,SAA1B,CAAP;AACD;;AAEDE,EAAAA,aAAa,CAACC,IAAD,EAAkC;AAC7C,WAAO,KAAKF,IAAL,CAAU,eAAV,EAA2BE,IAA3B,CAAP;AACD;;AAEDC,EAAAA,mCAAmC,CAACC,QAAD,EAA0BC,UAA1B,EAAuE;AACxG,WAAO,KAAKL,IAAL,CAAU,qCAAV,EAAiDI,QAAjD,EAA2DC,UAA3D,CAAP;AACD;;AAEDC,EAAAA,eAAe,CAACP,SAAD,EAAoBQ,OAApB,EAAwD;AACrE,WAAO,K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,IAAL,CAAU,eAAV,EAA2ByC,GAA3B,CAAP;AACD;;AApCgE;AA0DnE,OAAO,MAAMC,UAAN,SAAyB9C,aAAzB,CAA8D;AAAA;AAAA;;AAAA,yCACrD,QADqD;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;AAAA;;AAAA;AAarE,OAAO,MAAM+C,UAAN,SAAyB/C,aAAzB,CAA8D;AAAA;AAAA;;AAAA,yCACrD,QADqD;;AAAA;;AAAA;AAAA;;AAAA;AAMrE,OAAO,MAAMgD,UAAN,SAAyBhD,aAAzB,CAA8D;AAAA;AAAA;;AAAA,yCACrD,QADqD;;AAAA;;AAAA;;AAAA;AAAA;;AAAA","sourcesContent":["import { Shop } from \"@one-commerce/sdk-shared\";\n\nimport { BaseCallClass } from \"../utils\";\n\nexport class ShopCatalog extends BaseCallClass implements Shop.Catalog {\n serviceName = 'catalog'\n categories!: Array<any>;\n selectedCategoryId!: string | null;\n\n fetchProduct(productId: string): Promise<any> {\n return this.call('fetchProduct', productId)\n }\n\n fetchProducts(page: unknown): Promise<unknown> {\n return this.call('fetchProducts', page)\n }\n\n fetchStocksForProductsAndWarehouses(products: Array<string>, warehouses: Array<string>): Promise<unknown> {\n return this.call('fetchStocksForProductsAndWarehouses', products, warehouses)\n }\n\n getProductPrice(productId: string, isGross: boolean): Promise<unknown> {\n return this.call('getProductPrice', productId, isGross)\n }\n\n fetchPricingForProducts(products: Array<{\n productId: string\n quantity?: number\n }>): Promise<unknown> {\n return this.call('fetchPricingForProducts', products)\n }\n\n fetchWarehouses(): Promise<unknown> {\n return this.call('fetchWarehouses')\n }\n\n getCategoryById(categoryId: string): Promise<any> {\n return this.call('getCategoryById', categoryId)\n }\n}\nexport class ShopWishlist extends BaseCallClass implements Shop.Wishlist {\n serviceName = 'wishlist'\n\n addProductsToWishlist(wishlistId: string, newProduct: any): Promise<void> {\n return this.call('addProductsToWishlist', wishlistId, newProduct)\n }\n\n getWishlists(): Promise<any> {\n return this.call('getWishlists')\n }\n\n createWishlist(name: string): Promise<any> {\n return this.call('createWishlist', name)\n }\n}\nexport class ShopAccount extends BaseCallClass implements Shop.Account {\n serviceName = 'account'\n client!: {\n id: string;\n name: string;\n externalId?: string;\n tin?: string;\n phone?: string;\n segmentId?: string;\n segments: {\n additionalSegments?: Array<{\n id: string;\n name: string;\n externalId?: string;\n parentSegmentId?: string;\n }>;\n mainSegment: {\n id: string;\n name: string;\n externalId?: string;\n parentSegmentId?: string;\n };\n };\n warehouseId?: string;\n termPayment?: {\n id: string;\n label?: string;\n paymentDaysPeriod?: number;\n };\n isTaxPayer?: boolean;\n billingAddress?: {\n city: string;\n country: string;\n id: string;\n isDefault: boolean;\n name: string;\n phone: string;\n street: string;\n type: string;\n zipCode: string\n }\n };\n isAuthenticated!: boolean;\n user!: {\n id?: string,\n clientId?: string,\n email?: string;\n name?: string;\n phone?: string;\n rol?: {\n name: string;\n id: string;\n }\n /**\n * @deprecated Use non-nested function instead\n */\n hasSegment(name: string): Promise<boolean>\n };\n\n hasSegment(name: string): Promise<boolean> {\n return this.call('hasSegment', name)\n }\n\n manager!: {\n additionalEmail?: string;\n email: string; id: string;\n landlinePhone?: string;\n mobilePhone?: string;\n name: string;\n photo?: string\n };\n\n logout(): void {\n // NotImplementedYet\n }\n}\n\nexport class ShopCart extends BaseCallClass implements Shop.Cart {\n serviceName = 'cart'\n carts!: Array<any>;\n currentCart!: any;\n totalCartPrice!: number;\n\n addToCart(productId: string, amount: number, where: string, cartId?: string): Promise<void> {\n return this.call('addToCart', productId, amount, where, cartId)\n }\n}\n\nexport class ShopAuthorization extends BaseCallClass implements Shop.Authorization {\n serviceName = 'authorization'\n\n getAuthToken(): Promise<string> {\n return this.call('getAuthToken')\n }\n}\n\nexport class ShopUtils extends BaseCallClass implements Shop.Utils {\n serviceName = 'utils'\n currency!: any;\n isAnonymousAndPurchaseDisabled!: boolean;\n isB2B!: boolean;\n isB2BAndPlatformIsNotOpened!: boolean;\n isIndexPage!: boolean;\n isPurchaseEnabledOrAuthenticated!: boolean;\n notify(options: NotificationOptions | string): Promise<void> {\n return this.call('notify', options)\n }\n\n constructor(call: (service: string, fun: string, ...arg: any) => Promise<any>) {\n super(call)\n this.routes = {\n getCategoryPath: this.getCategoryPath,\n getManufacturerSearchUrl: this.getManufacturerSearchUrl,\n getProductUrl: this.getProductUrl,\n isExternalUrl: this.isExternalUrl\n }\n }\n\n getCategoryPath(id?: string): Promise<string | null> {\n return this.call('getCategoryPath', id)\n }\n\n getManufacturerSearchUrl(manufacturer: string): Promise<string> {\n return this.call('getManufacturerSearchUrl', manufacturer)\n }\n\n getProductUrl(product: any): Promise<string | null> {\n return this.call('getProductUrl', product)\n }\n\n isExternalUrl(url: string): Promise<boolean> {\n return this.call('isExternalUrl', url)\n }\n\n routes: {\n /**\n * @deprecated Use non-nested function instead\n */\n getCategoryPath(id?: string): (Promise<string | null> | string | null);\n /**\n * @deprecated Use non-nested function instead\n */\n getManufacturerSearchUrl(manufacturer: string): (Promise<string> | string);\n /**\n * @deprecated Use non-nested function instead\n */\n getProductUrl(product: any): (Promise<string | null> | string | null);\n /**\n * @deprecated Use non-nested function instead\n */\n isExternalUrl(url: string): (Promise<boolean> | boolean)\n };\n}\n\nexport class ShopConfig extends BaseCallClass implements Shop.Config {\n serviceName = 'config'\n accessMode!: string;\n isB2CRegistrationEnabled!: boolean;\n isCatalogOpened!: boolean;\n isGrossSelected!: boolean;\n isPlatformClosed!: boolean;\n isPlatformOpened!: boolean;\n isPurchaseEnabled!: boolean;\n isRegistrationEnabled!: boolean;\n currency: any;\n}\n\nexport class ShopTenant extends BaseCallClass implements Shop.Tenant {\n serviceName = 'tenant'\n tenantKey: string | null;\n language: string;\n}\n\nexport class ShopPlugin extends BaseCallClass implements Shop.Plugin {\n serviceName = 'plugin'\n id: string;\n srcUrl?: string;\n name?: string;\n}\n"],"file":"services.js"}
@@ -0,0 +1,47 @@
1
+ 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; }
2
+
3
+ const dec2hex = dec => {
4
+ return dec.toString(16).padStart(2, "0");
5
+ }; // generateId :: Integer -> String
6
+
7
+
8
+ export function generateCallId() {
9
+ const arr = new Uint8Array((10 || 40) / 2);
10
+ window.crypto.getRandomValues(arr);
11
+ return Array.from(arr, dec2hex).join('');
12
+ }
13
+ export class BaseCallClass {
14
+ constructor(call) {
15
+ _defineProperty(this, "serviceName", '');
16
+
17
+ _defineProperty(this, "call", void 0);
18
+
19
+ this.call = (fun, ...arg) => {
20
+ return call(this.serviceName, fun, ...arg);
21
+ };
22
+ }
23
+
24
+ static update(target, payload) {
25
+ Object.keys(payload).forEach(key => {
26
+ target[key] = payload[key];
27
+ });
28
+ }
29
+
30
+ update(payload) {
31
+ const attributes = payload[this.serviceName];
32
+
33
+ if (attributes) {
34
+ BaseCallClass.update(this, attributes);
35
+ }
36
+ }
37
+
38
+ }
39
+ export class ContextCallClass extends BaseCallClass {
40
+ constructor(...args) {
41
+ super(...args);
42
+
43
+ _defineProperty(this, "serviceName", 'context');
44
+ }
45
+
46
+ }
47
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils.ts"],"names":["dec2hex","dec","toString","padStart","generateCallId","arr","Uint8Array","window","crypto","getRandomValues","Array","from","join","BaseCallClass","constructor","call","fun","arg","serviceName","update","target","payload","Object","keys","forEach","key","attributes","ContextCallClass"],"mappings":";;AAAA,MAAMA,OAAO,GAAKC,GAAD,IAAyB;AACxC,SAAOA,GAAG,CAACC,QAAJ,CAAa,EAAb,EAAiBC,QAAjB,CAA0B,CAA1B,EAA6B,GAA7B,CAAP;AACD,CAFD,C,CAIA;;;AACA,OAAO,SAASC,cAAT,GAA2B;AAChC,QAAMC,GAAG,GAAG,IAAIC,UAAJ,CAAe,CAAC,MAAM,EAAP,IAAa,CAA5B,CAAZ;AACAC,EAAAA,MAAM,CAACC,MAAP,CAAcC,eAAd,CAA8BJ,GAA9B;AACA,SAAOK,KAAK,CAACC,IAAN,CAAWN,GAAX,EAAgBL,OAAhB,EAAyBY,IAAzB,CAA8B,EAA9B,CAAP;AACD;AAED,OAAO,MAAMC,aAAN,CAAoB;AAGzBC,EAAAA,WAAW,CAACC,IAAD,EAAoE;AAAA,yCAFjE,EAEiE;;AAAA;;AAC7E,SAAKA,IAAL,GAAY,CAACC,GAAD,EAAc,GAAGC,GAAjB,KAA8B;AACxC,aAAOF,IAAI,CAAC,KAAKG,WAAN,EAAmBF,GAAnB,EAAwB,GAAGC,GAA3B,CAAX;AACD,KAFD;AAGD;;AACY,SAANE,MAAM,CAACC,MAAD,EAA8BC,OAA9B,EAA4D;AACvEC,IAAAA,MAAM,CAACC,IAAP,CAAYF,OAAZ,EAAqBG,OAArB,CAA8BC,GAAD,IAAiB;AAC5CL,MAAAA,MAAM,CAACK,GAAD,CAAN,GAAcJ,OAAO,CAACI,GAAD,CAArB;AACD,KAFD;AAGD;;AACDN,EAAAA,MAAM,CAACE,OAAD,EAAe;AACnB,UAAMK,UAAe,GAAGL,OAAO,CAAC,KAAKH,WAAN,CAA/B;;AACA,QAAIQ,UAAJ,EAAgB;AACdb,MAAAA,aAAa,CAACM,MAAd,CAAqB,IAArB,EAA2BO,UAA3B;AACD;AACF;;AAlBwB;AAoB3B,OAAO,MAAMC,gBAAN,SAA+Bd,aAA/B,CAA6C;AAAA;AAAA;;AAAA,yCACpC,SADoC;AAAA;;AAAA","sourcesContent":["const dec2hex = (dec: number): string => {\n return dec.toString(16).padStart(2, \"0\")\n}\n\n// generateId :: Integer -> String\nexport function generateCallId () {\n const arr = new Uint8Array((10 || 40) / 2)\n window.crypto.getRandomValues(arr)\n return Array.from(arr, dec2hex).join('')\n}\n\nexport class BaseCallClass {\n serviceName = ''\n call: (fun: string, ...arg: any[]) => Promise<any>;\n constructor(call: (service: string, fun: string, ...arg: any) => Promise<any>) {\n this.call = (fun: string, ...arg: any) => {\n return call(this.serviceName, fun, ...arg)\n }\n }\n static update(target: Record<string, any>, payload: Record<string, any>) {\n Object.keys(payload).forEach((key: string) => {\n target[key] = payload[key]\n })\n }\n update(payload: any) {\n const attributes: any = payload[this.serviceName]\n if (attributes) {\n BaseCallClass.update(this, attributes)\n }\n }\n}\nexport class ContextCallClass extends BaseCallClass {\n serviceName = 'context'\n}\n"],"file":"utils.js"}
@@ -0,0 +1,66 @@
1
+ import { Backoffice } from "@one-commerce/sdk-shared";
2
+ import { ContextCallClass } from "../utils";
3
+ export declare class AddToCartContext extends ContextCallClass implements Backoffice.Context.AddToCart {
4
+ productId: string;
5
+ cartId: string | null;
6
+ offerId: string | null;
7
+ warehouses: Array<any>;
8
+ warehouseId: string;
9
+ meta: unknown;
10
+ pluginProductLines: Array<any>;
11
+ productLines: Array<any>;
12
+ productAmount: number;
13
+ closePlugin(): Promise<void>;
14
+ closePluginAndAddToCart(): Promise<void>;
15
+ closePluginAndRefreshCart(): Promise<void>;
16
+ }
17
+ export declare class DocumentsContext extends ContextCallClass implements Backoffice.Context.Documents {
18
+ orderDetails?: {
19
+ orderId: string | number;
20
+ orderNumber: string | number;
21
+ paymentMethodId: string | number;
22
+ paymentStatus: string;
23
+ clientId: string | number;
24
+ shipments: Array<any>;
25
+ price: any;
26
+ };
27
+ invoiceDetails?: {
28
+ number: string | number;
29
+ isPaid: boolean;
30
+ leftToPay: number;
31
+ amountPaid: number;
32
+ clientId: string | number;
33
+ totalPrices: any;
34
+ };
35
+ selectedInvoices?: [
36
+ {
37
+ number: string | number;
38
+ isPaid: boolean;
39
+ leftToPay: number;
40
+ amountPaid: number;
41
+ clientId: string | number;
42
+ totalPrices: any;
43
+ }
44
+ ];
45
+ clientContextId?: string | number;
46
+ operatorId?: string | number;
47
+ meta: unknown;
48
+ closePlugin(): Promise<void>;
49
+ closePluginAndRefreshView(): Promise<void>;
50
+ }
51
+ export declare class EditProductLinesOnCartContext extends ContextCallClass implements Backoffice.Context.EditProductLinesOnCart {
52
+ productId: string;
53
+ cartId: string | null;
54
+ offerId: string | null;
55
+ warehouses: Array<any>;
56
+ warehouseId: string;
57
+ meta: unknown;
58
+ productLineId: string;
59
+ productLines: Array<any>;
60
+ pluginProductLines: Array<any>;
61
+ productAmount: number;
62
+ closePlugin(): Promise<void>;
63
+ closePluginAndRefreshCart(): Promise<void>;
64
+ }
65
+ export declare type BackofficeAvailableContext = AddToCartContext | EditProductLinesOnCartContext;
66
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/backoffice/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAE1C,qBAAa,gBAAiB,SAAQ,gBAAiB,YAAW,UAAU,CAAC,OAAO,CAAC,SAAS;IAC5F,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,kBAAkB,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/B,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAG5B,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;IAGxC,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC;CAG3C;AAED,qBAAa,gBAAiB,SAAQ,gBAAiB,YAAW,UAAU,CAAC,OAAO,CAAC,SAAS;IAC5F,YAAY,CAAC,EAAE;QACb,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;QACzB,WAAW,EAAE,MAAM,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O,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,kBAAkB,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAG5B,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC;CAG3C;AAED,oBAAY,0BAA0B,GAAG,gBAAgB,GAAG,6BAA6B,CAAA"}
@@ -0,0 +1,49 @@
1
+ import { Backoffice } from "@one-commerce/sdk-shared";
2
+ import { BaseCallClass } from "../utils";
3
+ export declare class BackofficeCatalog extends BaseCallClass implements Backoffice.Catalog {
4
+ serviceName: string;
5
+ fetchCategories(): Promise<Array<unknown>>;
6
+ fetchProduct(id: string): Promise<unknown>;
7
+ }
8
+ export declare class BackofficeUser extends BaseCallClass implements Backoffice.User {
9
+ serviceName: string;
10
+ email?: string;
11
+ id: string;
12
+ name?: string;
13
+ authorities: Array<string>;
14
+ }
15
+ export declare class BackofficeTenant extends BaseCallClass implements Backoffice.Tenant {
16
+ serviceName: string;
17
+ tenantKey?: string;
18
+ language?: string;
19
+ currency?: {
20
+ code: string;
21
+ iso: string;
22
+ symbol: string;
23
+ };
24
+ }
25
+ export declare class BackofficeLayout extends BaseCallClass implements Backoffice.Layout {
26
+ serviceName: string;
27
+ isAsideOpened: boolean;
28
+ }
29
+ export declare class BackofficeAuthorization extends BaseCallClass implements Backoffice.Authorization {
30
+ serviceName: string;
31
+ getAuthToken(): Promise<string>;
32
+ }
33
+ export declare class BackofficeCustomer extends BaseCallClass implements Backoffice.Customer {
34
+ serviceName: string;
35
+ id?: string;
36
+ name?: string;
37
+ }
38
+ export declare class BackofficePlugin extends BaseCallClass implements Backoffice.Plugin {
39
+ serviceName: string;
40
+ id: string;
41
+ srcUrl?: string;
42
+ name?: string;
43
+ }
44
+ export declare class BackofficeOrderpath extends BaseCallClass implements Backoffice.Orderpath {
45
+ serviceName: string;
46
+ fetchCart(id: string): Promise<unknown>;
47
+ fetchOffer(id: string): Promise<unknown>;
48
+ }
49
+ //# sourceMappingURL=services.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../src/backoffice/services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,qBAAa,iBAAkB,SAAQ,aAAc,YAAW,UAAU,CAAC,OAAO;IAChF,WAAW,SAAY;IAEvB,eAAe,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAGnC,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAGlD;AAED,qBAAa,cAAe,SAAQ,aAAc,YAAW,UAAU,CAAC,IAAI;IAC1E,WAAW,SAAS;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,EAAG,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,EAAG,KAAK,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED,qBAAa,gBAAiB,SAAQ,aAAc,YAAW,UAAU,CAAC,MAAM;IAC9E,WAAW,SAAW;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;KAAE,CAAC;CAC3D;AAED,qBAAa,gBAAiB,SAAQ,aAAc,YAAW,UAAU,CAAC,MAAM;IAC9E,WAAW,SAAW;IACtB,aAAa,EAAG,OAAO,CAAC;CACzB;AAED,qBAAa,uBAAwB,SAAQ,aAAc,YAAW,UAAU,CAAC,aAAa;IAC5F,WAAW,SAAkB;IAE7B,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;CAGhC;AAED,qBAAa,kBAAmB,SAAQ,aAAc,YAAW,UAAU,CAAC,QAAQ;IAClF,WAAW,SAAa;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,gBAAiB,SAAQ,aAAc,YAAW,UAAU,CAAC,MAAM;IAC9E,WAAW,SAAW;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,mBAAoB,SAAQ,aAAc,YAAW,UAAU,CAAC,SAAS;IACpF,WAAW,SAAc;IACzB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAGvC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAGzC"}
@@ -0,0 +1,9 @@
1
+ declare class Events {
2
+ _callbacks: Record<string, any>;
3
+ constructor();
4
+ on<T>(key: string, callback: (arg: T) => void): void;
5
+ off<T>(key: string, callback: (arg: T) => void): void;
6
+ emit(key: string, ...params: Array<any>): void;
7
+ }
8
+ export default Events;
9
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/events.ts"],"names":[],"mappings":"AAAA,cAAM,MAAM;IACV,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;;IAK/B,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI;IAO7C,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI;IAa9C,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC;CAUxC;AAED,eAAe,MAAM,CAAA"}
@@ -0,0 +1,19 @@
1
+ declare module 'iframe-channel' {
2
+ interface ChannelOptions {
3
+ targetOrigin?: string
4
+ target?: typeof window.parent
5
+ subscribes?: { [k: string]: any }
6
+ attemptInterval?: number
7
+ maxAttempts?: number
8
+ }
9
+ class Channel {
10
+ constructor(options: ChannelOptions);
11
+ postMessage(type: string | number, data: any, opts?: { hasFunction: boolean, functionKeys: Array<string> }): Promise<void>;
12
+ connect(): Promise<void>;
13
+ clearQueue(): void;
14
+ destory(): void;
15
+ subscribe(type: string | number, fun?: Function): void;
16
+ unsubscribe(type: string | number, fun?: Function): void;
17
+ }
18
+ export default Channel
19
+ }
@@ -0,0 +1,107 @@
1
+ import { Backoffice, Route, Shop } from "@one-commerce/sdk-shared";
2
+ import { AddToCartContext as BackofficeAddToCartContext, BackofficeAvailableContext, DocumentsContext as BackofficeDocumentsContext, EditProductLinesOnCartContext as BackofficeEditProductLinesOnCartContext } from "./backoffice/context";
3
+ import { BackofficeAuthorization, BackofficeCatalog, BackofficeCustomer, BackofficeLayout, BackofficeOrderpath, BackofficePlugin, BackofficeTenant, BackofficeUser } from "./backoffice/services";
4
+ import Events from "./events";
5
+ import { AddToCartContext as ShopAddToCartContext, ShopAvailableContext, EditProductLinesOnCartContext as ShopEditProductLinesOnCartContext } from "./shop/context";
6
+ import { ShopAccount, ShopAuthorization, ShopCart, ShopCatalog, ShopConfig, ShopPlugin, ShopTenant, ShopUtils, ShopWishlist } from "./shop/services";
7
+ export declare enum SdkEvents {
8
+ INIT = "INIT",
9
+ UPDATE = "UPDATE"
10
+ }
11
+ export interface SdkOptions<S> {
12
+ debug?: boolean;
13
+ autoheight?: boolean;
14
+ origin: string;
15
+ context?: Class<S>;
16
+ }
17
+ interface NamedNavigationPayload {
18
+ name: string;
19
+ params: any;
20
+ }
21
+ interface PathNavigationPayload {
22
+ path: string;
23
+ params: any;
24
+ }
25
+ export declare type Class<T = any> = new (...args: any[]) => T;
26
+ declare abstract class Sdk<T, S = BackofficeAvailableContext | ShopAvailableContext> extends Events {
27
+ private channel;
28
+ private static debug;
29
+ private autoheight;
30
+ private heightMutationObserver;
31
+ origin: string;
32
+ isInitialized: boolean;
33
+ instances: T;
34
+ contextClass?: Class<S>;
35
+ private static log;
36
+ private static warn;
37
+ private initializeServiceGetters;
38
+ initializeContextClass(): S;
39
+ constructor(options: SdkOptions<S>);
40
+ private sendFrameHeight;
41
+ private initializeHeightObserver;
42
+ private setupOptions;
43
+ protected callFunction(service: string, fun: string, ...payload: any): Promise<any>;
44
+ navigate(event: NamedNavigationPayload | PathNavigationPayload): void;
45
+ }
46
+ export interface BackofficeInstances extends Backoffice.Api {
47
+ route: Route;
48
+ catalog: BackofficeCatalog;
49
+ user: BackofficeUser;
50
+ tenant: BackofficeTenant;
51
+ layout: BackofficeLayout;
52
+ authorization: BackofficeAuthorization;
53
+ customer: BackofficeCustomer;
54
+ plugin: BackofficePlugin;
55
+ context: BackofficeAvailableContext;
56
+ orderpath: BackofficeOrderpath;
57
+ }
58
+ export interface ShopInstances extends Shop.Api {
59
+ authorization: ShopAuthorization;
60
+ route: Route;
61
+ cart: ShopCart;
62
+ catalog: ShopCatalog;
63
+ account: ShopAccount;
64
+ utils: ShopUtils;
65
+ config: ShopConfig;
66
+ wishlist: ShopWishlist;
67
+ context: ShopAvailableContext;
68
+ tenant: ShopTenant;
69
+ plugin: ShopPlugin;
70
+ }
71
+ export declare class BackofficeSdk extends Sdk<BackofficeInstances, BackofficeAvailableContext> {
72
+ instances: {
73
+ route: {
74
+ hash: string;
75
+ query: {};
76
+ };
77
+ catalog: BackofficeCatalog;
78
+ user: BackofficeUser;
79
+ tenant: BackofficeTenant;
80
+ layout: BackofficeLayout;
81
+ authorization: BackofficeAuthorization;
82
+ customer: BackofficeCustomer;
83
+ plugin: BackofficePlugin;
84
+ orderpath: BackofficeOrderpath;
85
+ context: BackofficeAvailableContext;
86
+ };
87
+ }
88
+ export declare class ShopSdk extends Sdk<ShopInstances, ShopAvailableContext> {
89
+ instances: {
90
+ route: {
91
+ hash: string;
92
+ query: {};
93
+ };
94
+ authorization: ShopAuthorization;
95
+ cart: ShopCart;
96
+ catalog: ShopCatalog;
97
+ account: ShopAccount;
98
+ utils: ShopUtils;
99
+ config: ShopConfig;
100
+ tenant: ShopTenant;
101
+ wishlist: ShopWishlist;
102
+ context: ShopAvailableContext;
103
+ plugin: ShopPlugin;
104
+ };
105
+ }
106
+ export { BackofficeDocumentsContext, BackofficeAddToCartContext, BackofficeEditProductLinesOnCartContext, ShopAddToCartContext, ShopEditProductLinesOnCartContext, };
107
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,KAAK,EACL,IAAI,EACL,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,gBAAgB,IAAI,0BAA0B,EAC9C,0BAA0B,EAC1B,gBAAgB,IAAI,0BAA0B,EAC9C,6BAA6B,IAAI,uCAAuC,EACzE,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EACL,gBAAgB,IAAI,oBAAoB,EACxC,oBAAoB,EACpB,6BAA6B,IAAI,iCAAiC,EACnE,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,UAAU,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACT,YAAY,EACb,MAAM,iBAAiB,CAAC;AAQzB,oBAAY,SAAS;IACnB,IAAI,SAAO;IACX,MAAM,WAAS;CAChB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,GAAG,qBAAqB;CAItE;AAED,MAAM,WAAW,mBAAoB,SAAQ,UAAU,CAAC,GAAG;IACzD,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,gBAAgB,CAAC;IACzB,aAAa,EAAE,uBAAuB,CAAC;IACvC,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE,0BAA0B,CAAA;IACnC,SAAS,EAAE,mBAAmB,CAAC;CAChC;AAED,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,GAAG;IAC7C,aAAa,EAAE,iBAAiB,CAAC;IACjC,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,WAAW,CAAC;IACrB,KAAK,EAAE,SAAS,CAAA;IAChB,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,oBAAoB,CAAA;IAC7B,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,qBAAa,aAAc,SAAQ,GAAG,CAAC,mBAAmB,EAAE,0BAA0B,CAAC;IACrF,SAAS;;;;;;;;;;;;;;MAcR;CACF;AAED,qBAAa,OAAQ,SAAQ,GAAG,CAAC,aAAa,EAAE,oBAAoB,CAAC;IACnE,SAAS;;;;;;;;;;;;;;;MAeR;CACF;AAED,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,uCAAuC,EACvC,oBAAoB,EACpB,iCAAiC,GAClC,CAAA"}
@@ -0,0 +1,30 @@
1
+ import { Shop } from "@one-commerce/sdk-shared";
2
+ import { ContextCallClass } from "../utils";
3
+ export declare class AddToCartContext extends ContextCallClass implements Shop.Context.AddToCart {
4
+ productId: string;
5
+ cartId: string;
6
+ warehouses: Array<any>;
7
+ warehouseId: string;
8
+ meta: unknown;
9
+ pluginProductLines: Array<any>;
10
+ productLines: Array<any>;
11
+ productAmount: number;
12
+ closePlugin(): Promise<void>;
13
+ closePluginAndAddToCart(): Promise<void>;
14
+ closePluginAndRefreshCart(): Promise<void>;
15
+ }
16
+ export declare class EditProductLinesOnCartContext extends ContextCallClass implements Shop.Context.EditProductLinesOnCart {
17
+ productId: string;
18
+ cartId: string | null;
19
+ warehouses: Array<any>;
20
+ warehouseId: string;
21
+ meta: unknown;
22
+ productLineId: string;
23
+ productLines: Array<any>;
24
+ pluginProductLines: Array<any>;
25
+ productAmount: number;
26
+ closePlugin(): Promise<void>;
27
+ closePluginAndRefreshCart(): Promise<void>;
28
+ }
29
+ export declare type ShopAvailableContext = AddToCartContext | EditProductLinesOnCartContext;
30
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/shop/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,qBAAa,gBAAiB,SAAQ,gBAAiB,YAAW,IAAI,CAAC,OAAO,CAAC,SAAS;IACtF,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,kBAAkB,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/B,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAG5B,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;IAGxC,yBAAyB,IAA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