@searchspring/snap-platforms 0.56.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.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +12 -0
  3. package/dist/cjs/bigcommerce/src/addToCart.d.ts +8 -0
  4. package/dist/cjs/bigcommerce/src/addToCart.d.ts.map +1 -0
  5. package/dist/cjs/bigcommerce/src/addToCart.js +156 -0
  6. package/dist/cjs/bigcommerce/src/index.d.ts +2 -0
  7. package/dist/cjs/bigcommerce/src/index.d.ts.map +1 -0
  8. package/dist/cjs/bigcommerce/src/index.js +17 -0
  9. package/dist/cjs/magento2/src/addToCart.d.ts +10 -0
  10. package/dist/cjs/magento2/src/addToCart.d.ts.map +1 -0
  11. package/dist/cjs/magento2/src/addToCart.js +155 -0
  12. package/dist/cjs/magento2/src/getFormKey.d.ts +2 -0
  13. package/dist/cjs/magento2/src/getFormKey.d.ts.map +1 -0
  14. package/dist/cjs/magento2/src/getFormKey.js +9 -0
  15. package/dist/cjs/magento2/src/getUenc.d.ts +2 -0
  16. package/dist/cjs/magento2/src/getUenc.d.ts.map +1 -0
  17. package/dist/cjs/magento2/src/getUenc.js +8 -0
  18. package/dist/cjs/magento2/src/index.d.ts +4 -0
  19. package/dist/cjs/magento2/src/index.d.ts.map +1 -0
  20. package/dist/cjs/magento2/src/index.js +19 -0
  21. package/dist/cjs/shopify/src/addToCart.d.ts +13 -0
  22. package/dist/cjs/shopify/src/addToCart.d.ts.map +1 -0
  23. package/dist/cjs/shopify/src/addToCart.js +116 -0
  24. package/dist/cjs/shopify/src/index.d.ts +2 -0
  25. package/dist/cjs/shopify/src/index.d.ts.map +1 -0
  26. package/dist/cjs/shopify/src/index.js +17 -0
  27. package/dist/esm/magento2/src/addToCart.d.ts +10 -0
  28. package/dist/esm/magento2/src/addToCart.d.ts.map +1 -0
  29. package/dist/esm/magento2/src/addToCart.js +79 -0
  30. package/dist/esm/magento2/src/getFormKey.d.ts +2 -0
  31. package/dist/esm/magento2/src/getFormKey.d.ts.map +1 -0
  32. package/dist/esm/magento2/src/getFormKey.js +5 -0
  33. package/dist/esm/magento2/src/getUenc.d.ts +2 -0
  34. package/dist/esm/magento2/src/getUenc.d.ts.map +1 -0
  35. package/dist/esm/magento2/src/getUenc.js +4 -0
  36. package/dist/esm/magento2/src/index.d.ts +4 -0
  37. package/dist/esm/magento2/src/index.d.ts.map +1 -0
  38. package/dist/esm/magento2/src/index.js +3 -0
  39. package/dist/esm/shopify/src/addToCart.d.ts +13 -0
  40. package/dist/esm/shopify/src/addToCart.d.ts.map +1 -0
  41. package/dist/esm/shopify/src/addToCart.js +62 -0
  42. package/dist/esm/shopify/src/index.d.ts +2 -0
  43. package/dist/esm/shopify/src/index.d.ts.map +1 -0
  44. package/dist/esm/shopify/src/index.js +1 -0
  45. package/package.json +46 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Searchspring
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # Snap Platforms
2
+
3
+ <a href="https://www.npmjs.com/package/@searchspring/snap-platforms"><img alt="NPM Status" src="https://img.shields.io/npm/v/@searchspring/snap-platforms.svg?style=flat"></a>
4
+
5
+ Snap Platforms contains functionality that makes working with various shoping plaforms easier. Several platforms have standardized APIs that can be leveraged for things like adding products to the cart. The most commonly used platforms are currently supported with a standard `addToCart` function. This function can be used within Snap projects. Each platform may also support other functionality, checkout the documenation for each platform to find out more.
6
+
7
+
8
+ [BigCommerce](https://github.com/searchspring/snap/tree/main/packages/snap-platforms/bigcommerce)
9
+
10
+ [Magento2](https://github.com/searchspring/snap/tree/main/packages/snap-platforms/magento2)
11
+
12
+ [Shopify](https://github.com/searchspring/snap/tree/main/packages/snap-platforms/shopify)
@@ -0,0 +1,8 @@
1
+ import type { Product } from '@searchspring/snap-store-mobx';
2
+ type BigCommerceAddToCartConfig = {
3
+ redirect?: boolean | string;
4
+ idFieldName?: string;
5
+ };
6
+ export declare const addToCart: (items: Product[], config?: BigCommerceAddToCartConfig) => Promise<void>;
7
+ export {};
8
+ //# sourceMappingURL=addToCart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addToCart.d.ts","sourceRoot":"","sources":["../../../../bigcommerce/src/addToCart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE7D,KAAK,0BAA0B,GAAG;IACjC,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAWF,eAAO,MAAM,SAAS,UAAiB,OAAO,EAAE,WAAW,0BAA0B,kBAkDpF,CAAC"}
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.addToCart = void 0;
51
+ var addToCart = function (items, config) { return __awaiter(void 0, void 0, void 0, function () {
52
+ var formData, i;
53
+ return __generator(this, function (_a) {
54
+ switch (_a.label) {
55
+ case 0:
56
+ if (!items) {
57
+ console.error('Error: no products to add');
58
+ return [2 /*return*/];
59
+ }
60
+ formData = {
61
+ line_items: [],
62
+ };
63
+ items.map(function (item) {
64
+ var _a, _b, _c;
65
+ var id = (_c = (_b = (_a = item === null || item === void 0 ? void 0 : item.display) === null || _a === void 0 ? void 0 : _a.mappings) === null || _b === void 0 ? void 0 : _b.core) === null || _c === void 0 ? void 0 : _c.uid;
66
+ // try to find custom field in data
67
+ if (config === null || config === void 0 ? void 0 : config.idFieldName) {
68
+ var level_1 = item;
69
+ config.idFieldName.split('.').map(function (field) {
70
+ if (level_1[field]) {
71
+ level_1 = level_1[field];
72
+ }
73
+ else {
74
+ console.error('Error: couldnt find column in item data. please check your idFieldName is correct in the config.');
75
+ return;
76
+ }
77
+ });
78
+ if (level_1 && level_1 !== item) {
79
+ id = level_1;
80
+ }
81
+ }
82
+ if (id && item.quantity) {
83
+ var obj = {
84
+ product_id: id,
85
+ quantity: item.quantity,
86
+ };
87
+ formData.line_items.push(obj);
88
+ }
89
+ });
90
+ if (!formData.line_items.length) return [3 /*break*/, 4];
91
+ i = 0;
92
+ _a.label = 1;
93
+ case 1:
94
+ if (!(i < formData.line_items.length)) return [3 /*break*/, 4];
95
+ return [4 /*yield*/, addSingleProductv1(formData.line_items[i])];
96
+ case 2:
97
+ _a.sent();
98
+ _a.label = 3;
99
+ case 3:
100
+ i++;
101
+ return [3 /*break*/, 1];
102
+ case 4:
103
+ // do redirect (or not)
104
+ if ((config === null || config === void 0 ? void 0 : config.redirect) !== false) {
105
+ setTimeout(function () { return (window.location.href = typeof (config === null || config === void 0 ? void 0 : config.redirect) == 'string' ? config === null || config === void 0 ? void 0 : config.redirect : '/cart.php'); });
106
+ }
107
+ return [2 /*return*/];
108
+ }
109
+ });
110
+ }); };
111
+ exports.addToCart = addToCart;
112
+ var addSingleProductv1 = function (item) { return __awaiter(void 0, void 0, void 0, function () {
113
+ var endpoint, payload, init, response, err_1;
114
+ return __generator(this, function (_a) {
115
+ switch (_a.label) {
116
+ case 0:
117
+ if (!item) {
118
+ console.error('Error: no product to add');
119
+ return [2 /*return*/];
120
+ }
121
+ endpoint = {
122
+ route: "/remote/v1/cart/add",
123
+ method: 'POST',
124
+ accept: 'application/json',
125
+ content: 'application/json',
126
+ success: 200,
127
+ };
128
+ _a.label = 1;
129
+ case 1:
130
+ _a.trys.push([1, 3, , 4]);
131
+ payload = JSON.stringify(__assign(__assign({}, item), { action: 'add' }));
132
+ init = {
133
+ method: endpoint.method,
134
+ credentials: 'same-origin',
135
+ headers: {
136
+ // note: no authorization
137
+ Accept: endpoint.accept,
138
+ 'Content-Type': endpoint.content,
139
+ },
140
+ body: payload,
141
+ };
142
+ return [4 /*yield*/, fetch(endpoint.route, init)];
143
+ case 2:
144
+ response = _a.sent();
145
+ if (response.status !== endpoint.success) {
146
+ throw new Error("Error: addToCart responded with ".concat(response.status, ", ").concat(response));
147
+ }
148
+ return [3 /*break*/, 4];
149
+ case 3:
150
+ err_1 = _a.sent();
151
+ console.error(err_1);
152
+ return [3 /*break*/, 4];
153
+ case 4: return [2 /*return*/];
154
+ }
155
+ });
156
+ }); };
@@ -0,0 +1,2 @@
1
+ export * from './addToCart';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../bigcommerce/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./addToCart"), exports);
@@ -0,0 +1,10 @@
1
+ import type { Product } from '@searchspring/snap-store-mobx';
2
+ type Magento2AddToCartConfig = {
3
+ formKey?: string;
4
+ uenc?: string;
5
+ redirect?: boolean | string;
6
+ idFieldName?: string;
7
+ };
8
+ export declare const addToCart: (data: Product[], config?: Magento2AddToCartConfig) => Promise<void>;
9
+ export {};
10
+ //# sourceMappingURL=addToCart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addToCart.d.ts","sourceRoot":"","sources":["../../../../magento2/src/addToCart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAI7D,KAAK,uBAAuB,GAAG;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAQF,eAAO,MAAM,SAAS,SAAgB,OAAO,EAAE,WAAW,uBAAuB,kBAsFhF,CAAC"}
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.addToCart = void 0;
40
+ var getFormKey_1 = require("./getFormKey");
41
+ var getUenc_1 = require("./getUenc");
42
+ var addToCart = function (data, config) { return __awaiter(void 0, void 0, void 0, function () {
43
+ var form_key, uenc, lineItems, _loop_1, i;
44
+ return __generator(this, function (_a) {
45
+ switch (_a.label) {
46
+ case 0:
47
+ if (!data) {
48
+ console.error('Error: no products to add');
49
+ return [2 /*return*/];
50
+ }
51
+ form_key = (config === null || config === void 0 ? void 0 : config.formKey) || (0, getFormKey_1.getFormKey)();
52
+ uenc = (config === null || config === void 0 ? void 0 : config.uenc) || (0, getUenc_1.getUenc)();
53
+ lineItems = [];
54
+ data.map(function (item) { return __awaiter(void 0, void 0, void 0, function () {
55
+ var sku, level_1, attributes_1, options_1;
56
+ var _a, _b, _c, _d;
57
+ return __generator(this, function (_e) {
58
+ sku = (_b = (_a = item === null || item === void 0 ? void 0 : item.display) === null || _a === void 0 ? void 0 : _a.mappings.core) === null || _b === void 0 ? void 0 : _b.uid;
59
+ if (config === null || config === void 0 ? void 0 : config.idFieldName) {
60
+ level_1 = item;
61
+ config.idFieldName.split('.').map(function (field) {
62
+ if (level_1[field]) {
63
+ level_1 = level_1[field];
64
+ }
65
+ else {
66
+ console.error('Error: couldnt find column in item data. please check your idFieldName is correct in the config.');
67
+ return;
68
+ }
69
+ });
70
+ if (level_1 && level_1 !== item) {
71
+ sku = level_1;
72
+ }
73
+ }
74
+ if (sku && item.quantity) {
75
+ attributes_1 = [];
76
+ options_1 = (_d = (_c = item.variants) === null || _c === void 0 ? void 0 : _c.active) === null || _d === void 0 ? void 0 : _d.options;
77
+ if (options_1) {
78
+ Object.keys(options_1).forEach(function (option) {
79
+ var attrId = options_1[option].attributeId;
80
+ var optionId = options_1[option].optionId;
81
+ var attributeObj = {
82
+ name: attrId,
83
+ val: optionId,
84
+ };
85
+ attributes_1.push(attributeObj);
86
+ });
87
+ }
88
+ lineItems.push({
89
+ product_id: sku,
90
+ quantity: item.quantity,
91
+ attributes: attributes_1,
92
+ });
93
+ }
94
+ return [2 /*return*/];
95
+ });
96
+ }); });
97
+ if (!lineItems.length) return [3 /*break*/, 5];
98
+ _loop_1 = function (i) {
99
+ var itemData, quantity, form, response, err_1;
100
+ return __generator(this, function (_b) {
101
+ switch (_b.label) {
102
+ case 0:
103
+ itemData = lineItems[i];
104
+ quantity = itemData.quantity || 1;
105
+ form = new FormData();
106
+ form.append('product', itemData.product_id);
107
+ form.append('form_key', form_key || '');
108
+ form.append('uenc', uenc || '');
109
+ form.append('qty', quantity.toString());
110
+ itemData.attributes.forEach(function (att) {
111
+ form.append("super_attribute[".concat(att.name, "]"), att.val);
112
+ });
113
+ _b.label = 1;
114
+ case 1:
115
+ _b.trys.push([1, 3, , 4]);
116
+ return [4 /*yield*/, fetch(window.location.origin + '/checkout/cart/add/uenc/' + uenc + '/product/' + itemData.product_id + '/addon_product/1/', {
117
+ method: 'POST',
118
+ body: form,
119
+ })];
120
+ case 2:
121
+ response = _b.sent();
122
+ if (response.status !== 200) {
123
+ throw new Error("Error: addToCart responded with ".concat(response.status, ", ").concat(response));
124
+ }
125
+ return [3 /*break*/, 4];
126
+ case 3:
127
+ err_1 = _b.sent();
128
+ console.error('Error:', err_1);
129
+ return [3 /*break*/, 4];
130
+ case 4: return [2 /*return*/];
131
+ }
132
+ });
133
+ };
134
+ i = 0;
135
+ _a.label = 1;
136
+ case 1:
137
+ if (!(i < lineItems.length)) return [3 /*break*/, 4];
138
+ return [5 /*yield**/, _loop_1(i)];
139
+ case 2:
140
+ _a.sent();
141
+ _a.label = 3;
142
+ case 3:
143
+ i++;
144
+ return [3 /*break*/, 1];
145
+ case 4:
146
+ // do redirect (or not)
147
+ if ((config === null || config === void 0 ? void 0 : config.redirect) !== false) {
148
+ setTimeout(function () { return (window.location.href = typeof (config === null || config === void 0 ? void 0 : config.redirect) == 'string' ? config === null || config === void 0 ? void 0 : config.redirect : '/checkout/cart/'); });
149
+ }
150
+ _a.label = 5;
151
+ case 5: return [2 /*return*/];
152
+ }
153
+ });
154
+ }); };
155
+ exports.addToCart = addToCart;
@@ -0,0 +1,2 @@
1
+ export declare const getFormKey: () => string;
2
+ //# sourceMappingURL=getFormKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFormKey.d.ts","sourceRoot":"","sources":["../../../../magento2/src/getFormKey.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,cAGtB,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFormKey = void 0;
4
+ var snap_toolbox_1 = require("@searchspring/snap-toolbox");
5
+ var getFormKey = function () {
6
+ var formKey = snap_toolbox_1.cookies.get('form_key') ? snap_toolbox_1.cookies.get('form_key') : '';
7
+ return formKey;
8
+ };
9
+ exports.getFormKey = getFormKey;
@@ -0,0 +1,2 @@
1
+ export declare const getUenc: () => string;
2
+ //# sourceMappingURL=getUenc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getUenc.d.ts","sourceRoot":"","sources":["../../../../magento2/src/getUenc.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,cAGnB,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getUenc = void 0;
4
+ var getUenc = function () {
5
+ var uenc = typeof btoa == 'function' ? btoa(window.location.href) : '';
6
+ return uenc;
7
+ };
8
+ exports.getUenc = getUenc;
@@ -0,0 +1,4 @@
1
+ export * from './addToCart';
2
+ export * from './getUenc';
3
+ export * from './getFormKey';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../magento2/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./addToCart"), exports);
18
+ __exportStar(require("./getUenc"), exports);
19
+ __exportStar(require("./getFormKey"), exports);
@@ -0,0 +1,13 @@
1
+ import type { Product } from '@searchspring/snap-store-mobx';
2
+ type ShopifyAddToCartConfig = {
3
+ redirect?: boolean | string;
4
+ idFieldName?: string;
5
+ };
6
+ declare global {
7
+ interface Window {
8
+ Shopify: any;
9
+ }
10
+ }
11
+ export declare const addToCart: (data: Product[], config?: ShopifyAddToCartConfig) => Promise<void>;
12
+ export {};
13
+ //# sourceMappingURL=addToCart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addToCart.d.ts","sourceRoot":"","sources":["../../../../shopify/src/addToCart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE7D,KAAK,sBAAsB,GAAG;IAC7B,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,OAAO,EAAE,GAAG,CAAC;KACb;CACD;AASD,eAAO,MAAM,SAAS,SAAgB,OAAO,EAAE,WAAW,sBAAsB,kBAkE/E,CAAC"}
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.addToCart = void 0;
40
+ var addToCart = function (data, config) { return __awaiter(void 0, void 0, void 0, function () {
41
+ var formData, response, err_1;
42
+ var _a, _b;
43
+ return __generator(this, function (_c) {
44
+ switch (_c.label) {
45
+ case 0:
46
+ if (!window.Shopify) {
47
+ console.error('Error: window.Shopify not found');
48
+ return [2 /*return*/];
49
+ }
50
+ if (!data) {
51
+ console.error('Error: no products to add');
52
+ return [2 /*return*/];
53
+ }
54
+ formData = {
55
+ items: [],
56
+ };
57
+ data.map(function (item) {
58
+ var _a, _b;
59
+ var id = Number((_b = (_a = item === null || item === void 0 ? void 0 : item.display) === null || _a === void 0 ? void 0 : _a.mappings.core) === null || _b === void 0 ? void 0 : _b.uid);
60
+ if (config === null || config === void 0 ? void 0 : config.idFieldName) {
61
+ var level_1 = item;
62
+ config.idFieldName.split('.').map(function (field) {
63
+ if (level_1 && level_1[field]) {
64
+ level_1 = level_1[field];
65
+ }
66
+ else {
67
+ console.error('Error: couldnt find column in item data. please check your idFieldName is correct in the config.');
68
+ }
69
+ });
70
+ if (level_1 && level_1 !== item) {
71
+ id = level_1;
72
+ }
73
+ }
74
+ // cast as number
75
+ if (id === null || id === void 0 ? void 0 : id.toString().match(/^[0-9]+$/)) {
76
+ id = +id;
77
+ }
78
+ if (id && item.quantity) {
79
+ var obj = {
80
+ id: id,
81
+ quantity: item.quantity,
82
+ };
83
+ formData.items.push(obj);
84
+ }
85
+ });
86
+ _c.label = 1;
87
+ case 1:
88
+ _c.trys.push([1, 3, , 4]);
89
+ return [4 /*yield*/, fetch(((_b = (_a = window === null || window === void 0 ? void 0 : window.Shopify) === null || _a === void 0 ? void 0 : _a.routes) === null || _b === void 0 ? void 0 : _b.root) + 'cart/add.js', {
90
+ method: 'POST',
91
+ headers: {
92
+ 'Content-Type': 'application/json',
93
+ },
94
+ body: JSON.stringify(formData),
95
+ })];
96
+ case 2:
97
+ response = _c.sent();
98
+ if (response.status === 200) {
99
+ // do redirect (or not)
100
+ if ((config === null || config === void 0 ? void 0 : config.redirect) !== false) {
101
+ setTimeout(function () { return (window.location.href = typeof (config === null || config === void 0 ? void 0 : config.redirect) == 'string' ? config === null || config === void 0 ? void 0 : config.redirect : '/cart'); });
102
+ }
103
+ }
104
+ else {
105
+ throw new Error("Error: addToCart responded with ".concat(response.status, ", ").concat(response));
106
+ }
107
+ return [3 /*break*/, 4];
108
+ case 3:
109
+ err_1 = _c.sent();
110
+ console.error(err_1);
111
+ return [3 /*break*/, 4];
112
+ case 4: return [2 /*return*/];
113
+ }
114
+ });
115
+ }); };
116
+ exports.addToCart = addToCart;
@@ -0,0 +1,2 @@
1
+ export * from './addToCart';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../shopify/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./addToCart"), exports);
@@ -0,0 +1,10 @@
1
+ import type { Product } from '@searchspring/snap-store-mobx';
2
+ type Magento2AddToCartConfig = {
3
+ formKey?: string;
4
+ uenc?: string;
5
+ redirect?: boolean | string;
6
+ idFieldName?: string;
7
+ };
8
+ export declare const addToCart: (data: Product[], config?: Magento2AddToCartConfig) => Promise<void>;
9
+ export {};
10
+ //# sourceMappingURL=addToCart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addToCart.d.ts","sourceRoot":"","sources":["../../../../magento2/src/addToCart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAI7D,KAAK,uBAAuB,GAAG;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAQF,eAAO,MAAM,SAAS,SAAgB,OAAO,EAAE,WAAW,uBAAuB,kBAsFhF,CAAC"}
@@ -0,0 +1,79 @@
1
+ import { getFormKey } from './getFormKey';
2
+ import { getUenc } from './getUenc';
3
+ export const addToCart = async (data, config) => {
4
+ if (!data) {
5
+ console.error('Error: no products to add');
6
+ return;
7
+ }
8
+ const form_key = config?.formKey || getFormKey();
9
+ const uenc = config?.uenc || getUenc();
10
+ const lineItems = [];
11
+ data.map(async (item) => {
12
+ let sku = item?.display?.mappings.core?.uid;
13
+ if (config?.idFieldName) {
14
+ let level = item;
15
+ config.idFieldName.split('.').map((field) => {
16
+ if (level[field]) {
17
+ level = level[field];
18
+ }
19
+ else {
20
+ console.error('Error: couldnt find column in item data. please check your idFieldName is correct in the config.');
21
+ return;
22
+ }
23
+ });
24
+ if (level && level !== item) {
25
+ sku = level;
26
+ }
27
+ }
28
+ if (sku && item.quantity) {
29
+ const attributes = [];
30
+ const options = item.variants?.active?.options;
31
+ if (options) {
32
+ Object.keys(options).forEach((option) => {
33
+ const attrId = options[option].attributeId;
34
+ const optionId = options[option].optionId;
35
+ const attributeObj = {
36
+ name: attrId,
37
+ val: optionId,
38
+ };
39
+ attributes.push(attributeObj);
40
+ });
41
+ }
42
+ lineItems.push({
43
+ product_id: sku,
44
+ quantity: item.quantity,
45
+ attributes: attributes,
46
+ });
47
+ }
48
+ });
49
+ if (lineItems.length) {
50
+ for (let i = 0; i < lineItems.length; i++) {
51
+ const itemData = lineItems[i];
52
+ const quantity = itemData.quantity || 1;
53
+ const form = new FormData();
54
+ form.append('product', itemData.product_id);
55
+ form.append('form_key', form_key || '');
56
+ form.append('uenc', uenc || '');
57
+ form.append('qty', quantity.toString());
58
+ itemData.attributes.forEach((att) => {
59
+ form.append(`super_attribute[${att.name}]`, att.val);
60
+ });
61
+ try {
62
+ const response = await fetch(window.location.origin + '/checkout/cart/add/uenc/' + uenc + '/product/' + itemData.product_id + '/addon_product/1/', {
63
+ method: 'POST',
64
+ body: form,
65
+ });
66
+ if (response.status !== 200) {
67
+ throw new Error(`Error: addToCart responded with ${response.status}, ${response}`);
68
+ }
69
+ }
70
+ catch (err) {
71
+ console.error('Error:', err);
72
+ }
73
+ }
74
+ // do redirect (or not)
75
+ if (config?.redirect !== false) {
76
+ setTimeout(() => (window.location.href = typeof config?.redirect == 'string' ? config?.redirect : '/checkout/cart/'));
77
+ }
78
+ }
79
+ };
@@ -0,0 +1,2 @@
1
+ export declare const getFormKey: () => string;
2
+ //# sourceMappingURL=getFormKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFormKey.d.ts","sourceRoot":"","sources":["../../../../magento2/src/getFormKey.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,cAGtB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { cookies } from '@searchspring/snap-toolbox';
2
+ export const getFormKey = () => {
3
+ const formKey = cookies.get('form_key') ? cookies.get('form_key') : '';
4
+ return formKey;
5
+ };
@@ -0,0 +1,2 @@
1
+ export declare const getUenc: () => string;
2
+ //# sourceMappingURL=getUenc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getUenc.d.ts","sourceRoot":"","sources":["../../../../magento2/src/getUenc.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,cAGnB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export const getUenc = () => {
2
+ const uenc = typeof btoa == 'function' ? btoa(window.location.href) : '';
3
+ return uenc;
4
+ };
@@ -0,0 +1,4 @@
1
+ export * from './addToCart';
2
+ export * from './getUenc';
3
+ export * from './getFormKey';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../magento2/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './addToCart';
2
+ export * from './getUenc';
3
+ export * from './getFormKey';
@@ -0,0 +1,13 @@
1
+ import type { Product } from '@searchspring/snap-store-mobx';
2
+ type ShopifyAddToCartConfig = {
3
+ redirect?: boolean | string;
4
+ idFieldName?: string;
5
+ };
6
+ declare global {
7
+ interface Window {
8
+ Shopify: any;
9
+ }
10
+ }
11
+ export declare const addToCart: (data: Product[], config?: ShopifyAddToCartConfig) => Promise<void>;
12
+ export {};
13
+ //# sourceMappingURL=addToCart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addToCart.d.ts","sourceRoot":"","sources":["../../../../shopify/src/addToCart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE7D,KAAK,sBAAsB,GAAG;IAC7B,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,OAAO,EAAE,GAAG,CAAC;KACb;CACD;AASD,eAAO,MAAM,SAAS,SAAgB,OAAO,EAAE,WAAW,sBAAsB,kBAkE/E,CAAC"}
@@ -0,0 +1,62 @@
1
+ export const addToCart = async (data, config) => {
2
+ if (!window.Shopify) {
3
+ console.error('Error: window.Shopify not found');
4
+ return;
5
+ }
6
+ if (!data) {
7
+ console.error('Error: no products to add');
8
+ return;
9
+ }
10
+ const formData = {
11
+ items: [],
12
+ };
13
+ data.map((item) => {
14
+ let id = Number(item?.display?.mappings.core?.uid);
15
+ if (config?.idFieldName) {
16
+ let level = item;
17
+ config.idFieldName.split('.').map((field) => {
18
+ if (level && level[field]) {
19
+ level = level[field];
20
+ }
21
+ else {
22
+ console.error('Error: couldnt find column in item data. please check your idFieldName is correct in the config.');
23
+ }
24
+ });
25
+ if (level && level !== item) {
26
+ id = level;
27
+ }
28
+ }
29
+ // cast as number
30
+ if (id?.toString().match(/^[0-9]+$/)) {
31
+ id = +id;
32
+ }
33
+ if (id && item.quantity) {
34
+ const obj = {
35
+ id: id,
36
+ quantity: item.quantity,
37
+ };
38
+ formData.items.push(obj);
39
+ }
40
+ });
41
+ try {
42
+ const response = await fetch(window?.Shopify?.routes?.root + 'cart/add.js', {
43
+ method: 'POST',
44
+ headers: {
45
+ 'Content-Type': 'application/json',
46
+ },
47
+ body: JSON.stringify(formData),
48
+ });
49
+ if (response.status === 200) {
50
+ // do redirect (or not)
51
+ if (config?.redirect !== false) {
52
+ setTimeout(() => (window.location.href = typeof config?.redirect == 'string' ? config?.redirect : '/cart'));
53
+ }
54
+ }
55
+ else {
56
+ throw new Error(`Error: addToCart responded with ${response.status}, ${response}`);
57
+ }
58
+ }
59
+ catch (err) {
60
+ console.error(err);
61
+ }
62
+ };
@@ -0,0 +1,2 @@
1
+ export * from './addToCart';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../shopify/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './addToCart';
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@searchspring/snap-platforms",
3
+ "version": "0.56.0",
4
+ "description": "Snap Platforms Library",
5
+ "author": "Searchspring",
6
+ "license": "MIT",
7
+ "repository": "https://github.com/searchspring/snap",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "scripts": {
12
+ "build": "rm -rf ./dist && rm -fr ./components/dist && tsc && tsc -p tsconfig.cjs.json",
13
+ "build:docs": "typedoc --out docs src/index.ts",
14
+ "dev": "tsc --watch",
15
+ "format": "prettier --write 'src/**/*.{js,jsx,ts,tsx}'",
16
+ "lint": "eslint './**/*.{js,jsx,ts,tsx}'",
17
+ "test": "jest",
18
+ "test:watch": "jest --watch"
19
+ },
20
+ "dependencies": {
21
+ "@searchspring/snap-store-mobx": "^0.54.0",
22
+ "@searchspring/snap-toolbox": "^0.54.0"
23
+ },
24
+ "sideEffects": false,
25
+ "files": [
26
+ "dist/**/*"
27
+ ],
28
+ "exports": {
29
+ "./shopify": {
30
+ "types": "./dist/esm/shopify/src/index.d.ts",
31
+ "import": "./dist/esm/shopify/src/index.js",
32
+ "require": "./dist/cjs/shopify/src/index.js"
33
+ },
34
+ "./magento2": {
35
+ "types": "./dist/esm/magento2/src/index.d.ts",
36
+ "import": "./dist/esm/magento2/src/index.js",
37
+ "require": "./dist/cjs/magento2/src/index.js"
38
+ },
39
+ "./bigcommerce": {
40
+ "types": "./dist/esm/bigcommerce/src/index.d.ts",
41
+ "import": "./dist/esm/bigcommerce/src/index.js",
42
+ "require": "./dist/cjs/bigcommerce/src/index.js"
43
+ }
44
+ },
45
+ "gitHead": "3326303c739fd3bbb23e6477b275b89f7df3bb74"
46
+ }