@plasmicpkgs/commerce-shopify 0.0.1 → 0.0.6
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/dist/commerce-shopify.cjs.development.js +192 -41
- package/dist/commerce-shopify.cjs.development.js.map +1 -1
- package/dist/commerce-shopify.cjs.production.min.js +1 -1
- package/dist/commerce-shopify.cjs.production.min.js.map +1 -1
- package/dist/commerce-shopify.esm.js +192 -41
- package/dist/commerce-shopify.esm.js.map +1 -1
- package/dist/provider.d.ts +10 -0
- package/dist/registerCommerceProvider.d.ts +5 -5
- package/dist/registerable.d.ts +2 -0
- package/dist/site/use-brands.d.ts +11 -0
- package/dist/site/use-categories.d.ts +11 -0
- package/dist/types/site.d.ts +7 -1
- package/dist/utils/normalize.d.ts +3 -0
- package/dist/utils/queries/get-all-products-query.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import registerComponent from '@plasmicapp/host/registerComponent';
|
|
2
1
|
import React, { useMemo, useCallback } from 'react';
|
|
3
2
|
import { FetcherError, ValidationError, CommerceError, useCart, useCommerce as useCommerce$1, getCommerceProvider as getCommerceProvider$1 } from '@plasmicpkgs/commerce';
|
|
4
3
|
import Cookies from 'js-cookie';
|
|
5
4
|
import debounce from 'lodash.debounce';
|
|
5
|
+
import registerGlobalContext from '@plasmicapp/host/registerGlobalContext';
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
8
|
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
@@ -173,9 +173,9 @@ var runtime = (function (exports) {
|
|
|
173
173
|
// This is a polyfill for %IteratorPrototype% for environments that
|
|
174
174
|
// don't natively support it.
|
|
175
175
|
var IteratorPrototype = {};
|
|
176
|
-
IteratorPrototype
|
|
176
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
177
177
|
return this;
|
|
178
|
-
};
|
|
178
|
+
});
|
|
179
179
|
|
|
180
180
|
var getProto = Object.getPrototypeOf;
|
|
181
181
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
@@ -189,8 +189,9 @@ var runtime = (function (exports) {
|
|
|
189
189
|
|
|
190
190
|
var Gp = GeneratorFunctionPrototype.prototype =
|
|
191
191
|
Generator.prototype = Object.create(IteratorPrototype);
|
|
192
|
-
GeneratorFunction.prototype =
|
|
193
|
-
|
|
192
|
+
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
193
|
+
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
194
|
+
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
194
195
|
GeneratorFunction.displayName = define(
|
|
195
196
|
GeneratorFunctionPrototype,
|
|
196
197
|
toStringTagSymbol,
|
|
@@ -304,9 +305,9 @@ var runtime = (function (exports) {
|
|
|
304
305
|
}
|
|
305
306
|
|
|
306
307
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
307
|
-
AsyncIterator.prototype
|
|
308
|
+
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
308
309
|
return this;
|
|
309
|
-
};
|
|
310
|
+
});
|
|
310
311
|
exports.AsyncIterator = AsyncIterator;
|
|
311
312
|
|
|
312
313
|
// Note that simple async functions are implemented on top of
|
|
@@ -499,13 +500,13 @@ var runtime = (function (exports) {
|
|
|
499
500
|
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
500
501
|
// object to not be returned from this call. This ensures that doesn't happen.
|
|
501
502
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
502
|
-
Gp
|
|
503
|
+
define(Gp, iteratorSymbol, function() {
|
|
503
504
|
return this;
|
|
504
|
-
};
|
|
505
|
+
});
|
|
505
506
|
|
|
506
|
-
Gp
|
|
507
|
+
define(Gp, "toString", function() {
|
|
507
508
|
return "[object Generator]";
|
|
508
|
-
};
|
|
509
|
+
});
|
|
509
510
|
|
|
510
511
|
function pushTryEntry(locs) {
|
|
511
512
|
var entry = { tryLoc: locs[0] };
|
|
@@ -824,14 +825,19 @@ try {
|
|
|
824
825
|
} catch (accidentalStrictMode) {
|
|
825
826
|
// This module should not be running in strict mode, so the above
|
|
826
827
|
// assignment should always work unless something is misconfigured. Just
|
|
827
|
-
// in case runtime.js accidentally runs in strict mode,
|
|
828
|
+
// in case runtime.js accidentally runs in strict mode, in modern engines
|
|
829
|
+
// we can explicitly access globalThis. In older engines we can escape
|
|
828
830
|
// strict mode using a global Function call. This could conceivably fail
|
|
829
831
|
// if a Content Security Policy forbids using Function, but in that case
|
|
830
832
|
// the proper solution is to fix the accidental strict mode problem. If
|
|
831
833
|
// you've misconfigured your bundler to force strict mode and applied a
|
|
832
834
|
// CSP to forbid Function, and you're not willing to fix either of those
|
|
833
835
|
// problems, please detail your unique predicament in a GitHub issue.
|
|
834
|
-
|
|
836
|
+
if (typeof globalThis === "object") {
|
|
837
|
+
globalThis.regeneratorRuntime = runtime;
|
|
838
|
+
} else {
|
|
839
|
+
Function("r", "regeneratorRuntime = r")(runtime);
|
|
840
|
+
}
|
|
835
841
|
}
|
|
836
842
|
});
|
|
837
843
|
|
|
@@ -1235,6 +1241,9 @@ var colorMap = {
|
|
|
1235
1241
|
yellowgreen: '#9ACD32'
|
|
1236
1242
|
};
|
|
1237
1243
|
|
|
1244
|
+
var _excluded = ["originalSrc"],
|
|
1245
|
+
_excluded2 = ["id", "title", "vendor", "images", "variants", "description", "descriptionHtml", "handle", "priceRange", "options", "metafields"];
|
|
1246
|
+
|
|
1238
1247
|
var money = function money(_ref) {
|
|
1239
1248
|
var amount = _ref.amount,
|
|
1240
1249
|
currencyCode = _ref.currencyCode;
|
|
@@ -1281,7 +1290,7 @@ var normalizeProductImages = function normalizeProductImages(_ref3) {
|
|
|
1281
1290
|
return edges == null ? void 0 : edges.map(function (_ref4) {
|
|
1282
1291
|
var _ref4$node = _ref4.node,
|
|
1283
1292
|
url = _ref4$node.originalSrc,
|
|
1284
|
-
rest = _objectWithoutPropertiesLoose(_ref4$node,
|
|
1293
|
+
rest = _objectWithoutPropertiesLoose(_ref4$node, _excluded);
|
|
1285
1294
|
|
|
1286
1295
|
return _extends({
|
|
1287
1296
|
url: url
|
|
@@ -1336,7 +1345,7 @@ function normalizeProduct(_ref8) {
|
|
|
1336
1345
|
handle = _ref8.handle,
|
|
1337
1346
|
priceRange = _ref8.priceRange,
|
|
1338
1347
|
options = _ref8.options,
|
|
1339
|
-
rest = _objectWithoutPropertiesLoose(_ref8,
|
|
1348
|
+
rest = _objectWithoutPropertiesLoose(_ref8, _excluded2);
|
|
1340
1349
|
|
|
1341
1350
|
return _extends({
|
|
1342
1351
|
id: id,
|
|
@@ -1422,19 +1431,21 @@ export const normalizePage = (
|
|
|
1422
1431
|
|
|
1423
1432
|
export const normalizePages = (edges: PageEdge[], locale?: string): Page[] =>
|
|
1424
1433
|
edges?.map((edge) => normalizePage(edge.node, locale))
|
|
1425
|
-
|
|
1426
|
-
export const normalizeCategory = ({
|
|
1427
|
-
title: name,
|
|
1428
|
-
handle,
|
|
1429
|
-
id,
|
|
1430
|
-
}: Collection): Category => ({
|
|
1431
|
-
id,
|
|
1432
|
-
name,
|
|
1433
|
-
slug: handle,
|
|
1434
|
-
path: `/${handle}`,
|
|
1435
|
-
})
|
|
1436
1434
|
*/
|
|
1437
1435
|
|
|
1436
|
+
|
|
1437
|
+
var normalizeCategory = function normalizeCategory(_ref10) {
|
|
1438
|
+
var name = _ref10.title,
|
|
1439
|
+
handle = _ref10.handle,
|
|
1440
|
+
id = _ref10.id;
|
|
1441
|
+
return {
|
|
1442
|
+
id: id,
|
|
1443
|
+
name: name,
|
|
1444
|
+
slug: handle,
|
|
1445
|
+
path: "/" + handle
|
|
1446
|
+
};
|
|
1447
|
+
};
|
|
1448
|
+
|
|
1438
1449
|
/*
|
|
1439
1450
|
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
1440
1451
|
Changes: None
|
|
@@ -1477,6 +1488,14 @@ var checkoutToCart = function checkoutToCart(checkoutPayload) {
|
|
|
1477
1488
|
return normalizeCart(checkoutPayload == null ? void 0 : checkoutPayload.checkout);
|
|
1478
1489
|
};
|
|
1479
1490
|
|
|
1491
|
+
/*
|
|
1492
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
1493
|
+
Changes: None
|
|
1494
|
+
*/
|
|
1495
|
+
var getSiteCollectionsQuery =
|
|
1496
|
+
/* GraphQL */
|
|
1497
|
+
"\n query getSiteCollections($first: Int!) {\n collections(first: $first) {\n edges {\n node {\n id\n title\n handle\n }\n }\n }\n }\n";
|
|
1498
|
+
|
|
1480
1499
|
/*
|
|
1481
1500
|
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
1482
1501
|
Changes:
|
|
@@ -1484,11 +1503,19 @@ var checkoutToCart = function checkoutToCart(checkoutPayload) {
|
|
|
1484
1503
|
*/
|
|
1485
1504
|
var productConnectionFragment =
|
|
1486
1505
|
/* GraphQL */
|
|
1487
|
-
"\n fragment productConnection on ProductConnection {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n title\n vendor\n handle\n priceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n }\n options {\n id\n name\n values\n }\n variants(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n title\n sku\n availableForSale\n requiresShipping\n selectedOptions {\n name\n value\n }\n priceV2 {\n amount\n currencyCode\n }\n compareAtPriceV2 {\n amount\n currencyCode\n }\n }\n }\n }\n images(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n originalSrc\n altText\n width\n height\n }\n }\n }\n }\n }\n }\n";
|
|
1506
|
+
"\n fragment productConnection on ProductConnection {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n title\n vendor\n handle\n description\n descriptionHtml\n priceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n }\n options {\n id\n name\n values\n }\n variants(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n title\n sku\n availableForSale\n requiresShipping\n selectedOptions {\n name\n value\n }\n priceV2 {\n amount\n currencyCode\n }\n compareAtPriceV2 {\n amount\n currencyCode\n }\n }\n }\n }\n images(first: 250) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n originalSrc\n altText\n width\n height\n }\n }\n }\n }\n }\n }\n";
|
|
1488
1507
|
var getAllProductsQuery =
|
|
1489
1508
|
/* GraphQL */
|
|
1490
1509
|
"\n query getAllProducts(\n $first: Int = 250\n $query: String = \"\"\n $sortKey: ProductSortKeys = RELEVANCE\n $reverse: Boolean = false\n ) {\n products(\n first: $first\n sortKey: $sortKey\n reverse: $reverse\n query: $query\n ) {\n ...productConnection\n }\n }\n\n " + productConnectionFragment + "\n";
|
|
1491
1510
|
|
|
1511
|
+
/*
|
|
1512
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
1513
|
+
Changes: None
|
|
1514
|
+
*/
|
|
1515
|
+
var getAllProductVendors =
|
|
1516
|
+
/* GraphQL */
|
|
1517
|
+
"\n query getAllProductVendors($first: Int = 250, $cursor: String) {\n products(first: $first, after: $cursor) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n vendor\n }\n cursor\n }\n }\n }\n";
|
|
1518
|
+
|
|
1492
1519
|
/*
|
|
1493
1520
|
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
1494
1521
|
Changes: None
|
|
@@ -1560,7 +1587,7 @@ var handler = {
|
|
|
1560
1587
|
products = brandId ? (_data$node = data.node) == null ? void 0 : (_data$node$products = _data$node.products) == null ? void 0 : (_data$node$products$e = _data$node$products.edges) == null ? void 0 : _data$node$products$e.filter(function (_ref2) {
|
|
1561
1588
|
var vendor = _ref2.node.vendor;
|
|
1562
1589
|
return vendor.replace(/\s+/g, '-').toLowerCase() === ("" + brandId).toLowerCase();
|
|
1563
|
-
}).slice(0, input.count) : (_data$node2 = data.node) == null ? void 0 : (_data$node2$products = _data$node2.products) == null ? void 0 : _data$node2$products.edges;
|
|
1590
|
+
}).slice(0, input.count) : (_data$node2 = data.node) == null ? void 0 : (_data$node2$products = _data$node2.products) == null ? void 0 : _data$node2$products.edges.slice(0, input.count);
|
|
1564
1591
|
_context.next = 15;
|
|
1565
1592
|
break;
|
|
1566
1593
|
|
|
@@ -2044,6 +2071,136 @@ var handler$4 = {
|
|
|
2044
2071
|
}
|
|
2045
2072
|
};
|
|
2046
2073
|
|
|
2074
|
+
var handler$5 = {
|
|
2075
|
+
fetchOptions: {
|
|
2076
|
+
query: getSiteCollectionsQuery
|
|
2077
|
+
},
|
|
2078
|
+
fetcher: function fetcher(_ref) {
|
|
2079
|
+
return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
2080
|
+
var _data$collections$edg, _data$collections, _data$collections$edg2;
|
|
2081
|
+
|
|
2082
|
+
var fetch, data;
|
|
2083
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
2084
|
+
while (1) {
|
|
2085
|
+
switch (_context.prev = _context.next) {
|
|
2086
|
+
case 0:
|
|
2087
|
+
fetch = _ref.fetch;
|
|
2088
|
+
_context.next = 3;
|
|
2089
|
+
return fetch({
|
|
2090
|
+
query: getSiteCollectionsQuery,
|
|
2091
|
+
variables: {
|
|
2092
|
+
first: 250
|
|
2093
|
+
}
|
|
2094
|
+
});
|
|
2095
|
+
|
|
2096
|
+
case 3:
|
|
2097
|
+
data = _context.sent;
|
|
2098
|
+
console.log("dale", "useCategories", data);
|
|
2099
|
+
return _context.abrupt("return", (_data$collections$edg = (_data$collections = data.collections) == null ? void 0 : (_data$collections$edg2 = _data$collections.edges) == null ? void 0 : _data$collections$edg2.map(function (_ref2) {
|
|
2100
|
+
var node = _ref2.node;
|
|
2101
|
+
return normalizeCategory(node);
|
|
2102
|
+
})) != null ? _data$collections$edg : []);
|
|
2103
|
+
|
|
2104
|
+
case 6:
|
|
2105
|
+
case "end":
|
|
2106
|
+
return _context.stop();
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
}, _callee);
|
|
2110
|
+
}))();
|
|
2111
|
+
},
|
|
2112
|
+
useHook: function useHook(_ref3) {
|
|
2113
|
+
var useData = _ref3.useData;
|
|
2114
|
+
return function (input) {
|
|
2115
|
+
var response = useData({
|
|
2116
|
+
swrOptions: _extends({
|
|
2117
|
+
revalidateOnFocus: false
|
|
2118
|
+
}, input == null ? void 0 : input.swrOptions)
|
|
2119
|
+
});
|
|
2120
|
+
return useMemo(function () {
|
|
2121
|
+
return Object.create(response, {
|
|
2122
|
+
isEmpty: {
|
|
2123
|
+
get: function get() {
|
|
2124
|
+
var _response$data$length, _response$data;
|
|
2125
|
+
|
|
2126
|
+
return ((_response$data$length = (_response$data = response.data) == null ? void 0 : _response$data.length) != null ? _response$data$length : 0) <= 0;
|
|
2127
|
+
},
|
|
2128
|
+
enumerable: true
|
|
2129
|
+
}
|
|
2130
|
+
});
|
|
2131
|
+
}, [response]);
|
|
2132
|
+
};
|
|
2133
|
+
}
|
|
2134
|
+
};
|
|
2135
|
+
|
|
2136
|
+
var handler$6 = {
|
|
2137
|
+
fetchOptions: {
|
|
2138
|
+
query: getAllProductVendors
|
|
2139
|
+
},
|
|
2140
|
+
fetcher: function fetcher(_ref) {
|
|
2141
|
+
return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
2142
|
+
var fetch, data, vendorsStrings;
|
|
2143
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
2144
|
+
while (1) {
|
|
2145
|
+
switch (_context.prev = _context.next) {
|
|
2146
|
+
case 0:
|
|
2147
|
+
fetch = _ref.fetch;
|
|
2148
|
+
_context.next = 3;
|
|
2149
|
+
return fetch({
|
|
2150
|
+
query: getAllProductVendors,
|
|
2151
|
+
variables: {
|
|
2152
|
+
first: 250
|
|
2153
|
+
}
|
|
2154
|
+
});
|
|
2155
|
+
|
|
2156
|
+
case 3:
|
|
2157
|
+
data = _context.sent;
|
|
2158
|
+
vendorsStrings = data.products.edges.map(function (_ref2) {
|
|
2159
|
+
var vendor = _ref2.node.vendor;
|
|
2160
|
+
return vendor;
|
|
2161
|
+
});
|
|
2162
|
+
return _context.abrupt("return", Array.from(new Set(vendorsStrings).values()).map(function (v) {
|
|
2163
|
+
var id = v.replace(/\s+/g, '-').toLowerCase();
|
|
2164
|
+
return {
|
|
2165
|
+
entityId: id,
|
|
2166
|
+
name: v,
|
|
2167
|
+
path: "brands/" + id
|
|
2168
|
+
};
|
|
2169
|
+
}));
|
|
2170
|
+
|
|
2171
|
+
case 6:
|
|
2172
|
+
case "end":
|
|
2173
|
+
return _context.stop();
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
}, _callee);
|
|
2177
|
+
}))();
|
|
2178
|
+
},
|
|
2179
|
+
useHook: function useHook(_ref3) {
|
|
2180
|
+
var useData = _ref3.useData;
|
|
2181
|
+
return function (input) {
|
|
2182
|
+
var response = useData({
|
|
2183
|
+
swrOptions: _extends({
|
|
2184
|
+
revalidateOnFocus: false
|
|
2185
|
+
}, input == null ? void 0 : input.swrOptions)
|
|
2186
|
+
});
|
|
2187
|
+
return useMemo(function () {
|
|
2188
|
+
return Object.create(response, {
|
|
2189
|
+
isEmpty: {
|
|
2190
|
+
get: function get() {
|
|
2191
|
+
var _response$data$length, _response$data;
|
|
2192
|
+
|
|
2193
|
+
return ((_response$data$length = (_response$data = response.data) == null ? void 0 : _response$data.length) != null ? _response$data$length : 0) <= 0;
|
|
2194
|
+
},
|
|
2195
|
+
enumerable: true
|
|
2196
|
+
}
|
|
2197
|
+
});
|
|
2198
|
+
}, [response]);
|
|
2199
|
+
};
|
|
2200
|
+
}
|
|
2201
|
+
};
|
|
2202
|
+
|
|
2203
|
+
var _excluded$1 = ["locale"];
|
|
2047
2204
|
var getFetcher = function getFetcher(storeDomain, accessToken) {
|
|
2048
2205
|
return /*#__PURE__*/function () {
|
|
2049
2206
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref) {
|
|
@@ -2054,7 +2211,7 @@ var getFetcher = function getFetcher(storeDomain, accessToken) {
|
|
|
2054
2211
|
switch (_context.prev = _context.next) {
|
|
2055
2212
|
case 0:
|
|
2056
2213
|
_ref$url = _ref.url, url = _ref$url === void 0 ? "https://" + storeDomain + "/api/2021-07/graphql.json" : _ref$url, _ref$method = _ref.method, method = _ref$method === void 0 ? 'POST' : _ref$method, variables = _ref.variables, query = _ref.query;
|
|
2057
|
-
_ref3 = variables != null ? variables : {}, locale = _ref3.locale, vars = _objectWithoutPropertiesLoose(_ref3,
|
|
2214
|
+
_ref3 = variables != null ? variables : {}, locale = _ref3.locale, vars = _objectWithoutPropertiesLoose(_ref3, _excluded$1);
|
|
2058
2215
|
_context.t0 = handleFetchResponse;
|
|
2059
2216
|
_context.next = 5;
|
|
2060
2217
|
return fetch(url, {
|
|
@@ -2108,6 +2265,10 @@ var getShopifyProvider = function getShopifyProvider(storeDomain, accessToken) {
|
|
|
2108
2265
|
fetcher: getFetcher(storeDomain, accessToken),
|
|
2109
2266
|
products: {
|
|
2110
2267
|
useSearch: handler
|
|
2268
|
+
},
|
|
2269
|
+
site: {
|
|
2270
|
+
useCategories: handler$5,
|
|
2271
|
+
useBrands: handler$6
|
|
2111
2272
|
}
|
|
2112
2273
|
};
|
|
2113
2274
|
};
|
|
@@ -2128,9 +2289,6 @@ var commerceProviderMeta = {
|
|
|
2128
2289
|
name: "plasmic-commerce-shopify-provider",
|
|
2129
2290
|
displayName: "Shopify Provider",
|
|
2130
2291
|
props: {
|
|
2131
|
-
children: {
|
|
2132
|
-
type: "slot"
|
|
2133
|
-
},
|
|
2134
2292
|
storeDomain: "string",
|
|
2135
2293
|
accessToken: "string"
|
|
2136
2294
|
},
|
|
@@ -2142,20 +2300,13 @@ function CommerceProviderComponent(props) {
|
|
|
2142
2300
|
var storeDomain = props.storeDomain,
|
|
2143
2301
|
accessToken = props.accessToken,
|
|
2144
2302
|
children = props.children;
|
|
2145
|
-
|
|
2146
|
-
if (!storeDomain) {
|
|
2147
|
-
return React.createElement("p", null, " You must set the store domain url ");
|
|
2148
|
-
} else if (!accessToken) {
|
|
2149
|
-
return React.createElement("p", null, " You must set the access token ");
|
|
2150
|
-
}
|
|
2151
|
-
|
|
2152
2303
|
var CommerceProvider = getCommerceProvider(storeDomain, accessToken);
|
|
2153
|
-
return React.createElement(CommerceProvider, null,
|
|
2304
|
+
return React.createElement(CommerceProvider, null, children);
|
|
2154
2305
|
}
|
|
2155
2306
|
|
|
2156
2307
|
function registerCommerceProvider(loader, customCommerceProviderMeta) {
|
|
2157
2308
|
var doRegisterComponent = function doRegisterComponent() {
|
|
2158
|
-
return loader ? loader.
|
|
2309
|
+
return loader ? loader.registerGlobalContext.apply(loader, arguments) : registerGlobalContext.apply(void 0, arguments);
|
|
2159
2310
|
};
|
|
2160
2311
|
|
|
2161
2312
|
doRegisterComponent(CommerceProviderComponent, customCommerceProviderMeta != null ? customCommerceProviderMeta : commerceProviderMeta);
|