@shopify/hydrogen-react 0.0.0-next-81b4528 → 0.0.0-next-a09da91
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/dev/AddToCartButton.js +70 -0
- package/dist/dev/AddToCartButton.js.map +1 -0
- package/dist/dev/AddToCartButton.mjs +70 -0
- package/dist/dev/AddToCartButton.mjs.map +1 -0
- package/dist/dev/BaseButton.js +31 -0
- package/dist/dev/BaseButton.js.map +1 -0
- package/dist/dev/BaseButton.mjs +31 -0
- package/dist/dev/BaseButton.mjs.map +1 -0
- package/dist/dev/index.js +2 -0
- package/dist/dev/index.js.map +1 -1
- package/dist/dev/index.mjs +2 -0
- package/dist/dev/index.mjs.map +1 -1
- package/dist/prod/AddToCartButton.js +70 -0
- package/dist/prod/AddToCartButton.js.map +1 -0
- package/dist/prod/AddToCartButton.mjs +70 -0
- package/dist/prod/AddToCartButton.mjs.map +1 -0
- package/dist/prod/BaseButton.js +31 -0
- package/dist/prod/BaseButton.js.map +1 -0
- package/dist/prod/BaseButton.mjs +31 -0
- package/dist/prod/BaseButton.mjs.map +1 -0
- package/dist/prod/index.js +2 -0
- package/dist/prod/index.js.map +1 -1
- package/dist/prod/index.mjs +2 -0
- package/dist/prod/index.mjs.map +1 -1
- package/dist/types/AddToCartButton.d.ts +22 -0
- package/dist/types/BaseButton.d.ts +15 -0
- package/dist/types/index.d.cts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/umd/hydrogen-react.dev.js +301 -199
- package/dist/umd/hydrogen-react.dev.js.map +1 -1
- package/dist/umd/hydrogen-react.prod.js +17 -17
- package/dist/umd/hydrogen-react.prod.js.map +1 -1
- package/package.json +1 -1
|
@@ -766,7 +766,7 @@ query CartQuery($id: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ)
|
|
|
766
766
|
${cartFragment}
|
|
767
767
|
`;
|
|
768
768
|
const SFAPI_VERSION = "2022-10";
|
|
769
|
-
var _jsxFileName$
|
|
769
|
+
var _jsxFileName$d = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ShopifyProvider.tsx";
|
|
770
770
|
const ShopifyContext = React.createContext({
|
|
771
771
|
storeDomain: "test.myshopify.com",
|
|
772
772
|
storefrontToken: "abc123",
|
|
@@ -797,7 +797,7 @@ ${cartFragment}
|
|
|
797
797
|
value: finalConfig,
|
|
798
798
|
__self: this,
|
|
799
799
|
__source: {
|
|
800
|
-
fileName: _jsxFileName$
|
|
800
|
+
fileName: _jsxFileName$d,
|
|
801
801
|
lineNumber: 49,
|
|
802
802
|
columnNumber: 5
|
|
803
803
|
}
|
|
@@ -1312,7 +1312,7 @@ ${cartFragment}
|
|
|
1312
1312
|
function isCartFetchResultEvent(event) {
|
|
1313
1313
|
return event.type === "RESOLVE" || event.type === "ERROR" || event.type === "CART_COMPLETED";
|
|
1314
1314
|
}
|
|
1315
|
-
var _jsxFileName$
|
|
1315
|
+
var _jsxFileName$c = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/CartProvider.tsx";
|
|
1316
1316
|
const CartContext = React.createContext(null);
|
|
1317
1317
|
function useCart() {
|
|
1318
1318
|
const context = React.useContext(CartContext);
|
|
@@ -1625,7 +1625,7 @@ ${cartFragment}
|
|
|
1625
1625
|
value: cartContextValue,
|
|
1626
1626
|
__self: this,
|
|
1627
1627
|
__source: {
|
|
1628
|
-
fileName: _jsxFileName$
|
|
1628
|
+
fileName: _jsxFileName$c,
|
|
1629
1629
|
lineNumber: 425,
|
|
1630
1630
|
columnNumber: 5
|
|
1631
1631
|
}
|
|
@@ -1791,7 +1791,267 @@ fragment ImageFragment on Image {
|
|
|
1791
1791
|
height
|
|
1792
1792
|
}
|
|
1793
1793
|
`;
|
|
1794
|
-
var _jsxFileName$
|
|
1794
|
+
var _jsxFileName$b = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ProductProvider.tsx";
|
|
1795
|
+
const ProductOptionsContext = React.createContext(null);
|
|
1796
|
+
function ProductProvider({
|
|
1797
|
+
children,
|
|
1798
|
+
data: product,
|
|
1799
|
+
initialVariantId: explicitVariantId
|
|
1800
|
+
}) {
|
|
1801
|
+
const variants = React.useMemo(() => {
|
|
1802
|
+
var _a;
|
|
1803
|
+
return flattenConnection((_a = product.variants) != null ? _a : {});
|
|
1804
|
+
}, [product.variants]);
|
|
1805
|
+
if (!isProductVariantArray(variants)) {
|
|
1806
|
+
throw new Error(`<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'`);
|
|
1807
|
+
}
|
|
1808
|
+
const options = React.useMemo(() => getOptions(variants), [variants]);
|
|
1809
|
+
const [selectedVariant, setSelectedVariant] = React.useState(() => getVariantBasedOnIdProp(explicitVariantId, variants));
|
|
1810
|
+
const [selectedOptions, setSelectedOptions] = React.useState(() => getSelectedOptions(selectedVariant));
|
|
1811
|
+
React.useEffect(() => {
|
|
1812
|
+
const newSelectedVariant = getVariantBasedOnIdProp(explicitVariantId, variants);
|
|
1813
|
+
setSelectedVariant(newSelectedVariant);
|
|
1814
|
+
setSelectedOptions(getSelectedOptions(newSelectedVariant));
|
|
1815
|
+
}, [explicitVariantId, variants]);
|
|
1816
|
+
const setSelectedOption = React.useCallback((name, value2) => {
|
|
1817
|
+
setSelectedOptions((selectedOptions2) => {
|
|
1818
|
+
const opts = {
|
|
1819
|
+
...selectedOptions2,
|
|
1820
|
+
[name]: value2
|
|
1821
|
+
};
|
|
1822
|
+
setSelectedVariant(getSelectedVariant(variants, opts));
|
|
1823
|
+
return opts;
|
|
1824
|
+
});
|
|
1825
|
+
}, [setSelectedOptions, variants]);
|
|
1826
|
+
const isOptionInStock = React.useCallback((option, value2) => {
|
|
1827
|
+
var _a;
|
|
1828
|
+
const proposedVariant = getSelectedVariant(variants, {
|
|
1829
|
+
...selectedOptions,
|
|
1830
|
+
...{
|
|
1831
|
+
[option]: value2
|
|
1832
|
+
}
|
|
1833
|
+
});
|
|
1834
|
+
return (_a = proposedVariant == null ? void 0 : proposedVariant.availableForSale) != null ? _a : true;
|
|
1835
|
+
}, [selectedOptions, variants]);
|
|
1836
|
+
const sellingPlanGroups = React.useMemo(() => {
|
|
1837
|
+
var _a;
|
|
1838
|
+
return flattenConnection((_a = product.sellingPlanGroups) != null ? _a : {}).map((sellingPlanGroup) => {
|
|
1839
|
+
var _a2;
|
|
1840
|
+
return {
|
|
1841
|
+
...sellingPlanGroup,
|
|
1842
|
+
sellingPlans: flattenConnection((_a2 = sellingPlanGroup == null ? void 0 : sellingPlanGroup.sellingPlans) != null ? _a2 : {})
|
|
1843
|
+
};
|
|
1844
|
+
});
|
|
1845
|
+
}, [product.sellingPlanGroups]);
|
|
1846
|
+
const [selectedSellingPlan, setSelectedSellingPlan] = React.useState(void 0);
|
|
1847
|
+
const selectedSellingPlanAllocation = React.useMemo(() => {
|
|
1848
|
+
var _a, _b;
|
|
1849
|
+
if (!selectedVariant || !selectedSellingPlan) {
|
|
1850
|
+
return;
|
|
1851
|
+
}
|
|
1852
|
+
if (!((_a = selectedVariant.sellingPlanAllocations) == null ? void 0 : _a.nodes) && !((_b = selectedVariant.sellingPlanAllocations) == null ? void 0 : _b.edges)) {
|
|
1853
|
+
throw new Error(`<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation`);
|
|
1854
|
+
}
|
|
1855
|
+
return flattenConnection(selectedVariant.sellingPlanAllocations).find((allocation) => {
|
|
1856
|
+
var _a2;
|
|
1857
|
+
return ((_a2 = allocation == null ? void 0 : allocation.sellingPlan) == null ? void 0 : _a2.id) === selectedSellingPlan.id;
|
|
1858
|
+
});
|
|
1859
|
+
}, [selectedVariant, selectedSellingPlan]);
|
|
1860
|
+
const value = React.useMemo(() => ({
|
|
1861
|
+
variants,
|
|
1862
|
+
variantsConnection: product.variants,
|
|
1863
|
+
options,
|
|
1864
|
+
selectedVariant,
|
|
1865
|
+
setSelectedVariant,
|
|
1866
|
+
selectedOptions,
|
|
1867
|
+
setSelectedOption,
|
|
1868
|
+
setSelectedOptions,
|
|
1869
|
+
isOptionInStock,
|
|
1870
|
+
selectedSellingPlan,
|
|
1871
|
+
setSelectedSellingPlan,
|
|
1872
|
+
selectedSellingPlanAllocation,
|
|
1873
|
+
sellingPlanGroups,
|
|
1874
|
+
sellingPlanGroupsConnection: product.sellingPlanGroups
|
|
1875
|
+
}), [isOptionInStock, options, product.sellingPlanGroups, product.variants, selectedOptions, selectedSellingPlan, selectedSellingPlanAllocation, selectedVariant, sellingPlanGroups, setSelectedOption, variants]);
|
|
1876
|
+
return /* @__PURE__ */ React__default.default.createElement(ProductOptionsContext.Provider, {
|
|
1877
|
+
value,
|
|
1878
|
+
__self: this,
|
|
1879
|
+
__source: {
|
|
1880
|
+
fileName: _jsxFileName$b,
|
|
1881
|
+
lineNumber: 201,
|
|
1882
|
+
columnNumber: 5
|
|
1883
|
+
}
|
|
1884
|
+
}, children);
|
|
1885
|
+
}
|
|
1886
|
+
function useProduct() {
|
|
1887
|
+
const context = React.useContext(ProductOptionsContext);
|
|
1888
|
+
if (!context) {
|
|
1889
|
+
throw new Error(`'useProduct' must be a child of <ProductProvider />`);
|
|
1890
|
+
}
|
|
1891
|
+
return context;
|
|
1892
|
+
}
|
|
1893
|
+
function getSelectedVariant(variants, choices) {
|
|
1894
|
+
var _a, _b;
|
|
1895
|
+
if (!variants.length || ((_b = (_a = variants == null ? void 0 : variants[0]) == null ? void 0 : _a.selectedOptions) == null ? void 0 : _b.length) !== Object.keys(choices).length) {
|
|
1896
|
+
return;
|
|
1897
|
+
}
|
|
1898
|
+
return variants == null ? void 0 : variants.find((variant) => {
|
|
1899
|
+
return Object.entries(choices).every(([name, value]) => {
|
|
1900
|
+
var _a2;
|
|
1901
|
+
return (_a2 = variant == null ? void 0 : variant.selectedOptions) == null ? void 0 : _a2.some((option) => (option == null ? void 0 : option.name) === name && (option == null ? void 0 : option.value) === value);
|
|
1902
|
+
});
|
|
1903
|
+
});
|
|
1904
|
+
}
|
|
1905
|
+
function getOptions(variants) {
|
|
1906
|
+
const map = variants.reduce((memo, variant) => {
|
|
1907
|
+
var _a;
|
|
1908
|
+
if (!variant.selectedOptions) {
|
|
1909
|
+
throw new Error(`'getOptions' requires 'variant.selectedOptions'`);
|
|
1910
|
+
}
|
|
1911
|
+
(_a = variant == null ? void 0 : variant.selectedOptions) == null ? void 0 : _a.forEach((opt) => {
|
|
1912
|
+
var _a2, _b, _c, _d;
|
|
1913
|
+
memo[(_a2 = opt == null ? void 0 : opt.name) != null ? _a2 : ""] = memo[(_b = opt == null ? void 0 : opt.name) != null ? _b : ""] || /* @__PURE__ */ new Set();
|
|
1914
|
+
memo[(_c = opt == null ? void 0 : opt.name) != null ? _c : ""].add((_d = opt == null ? void 0 : opt.value) != null ? _d : "");
|
|
1915
|
+
});
|
|
1916
|
+
return memo;
|
|
1917
|
+
}, {});
|
|
1918
|
+
return Object.keys(map).map((option) => {
|
|
1919
|
+
return {
|
|
1920
|
+
name: option,
|
|
1921
|
+
values: Array.from(map[option])
|
|
1922
|
+
};
|
|
1923
|
+
});
|
|
1924
|
+
}
|
|
1925
|
+
function getVariantBasedOnIdProp(explicitVariantId, variants) {
|
|
1926
|
+
if (explicitVariantId) {
|
|
1927
|
+
const foundVariant = variants.find((variant) => (variant == null ? void 0 : variant.id) === explicitVariantId);
|
|
1928
|
+
if (!foundVariant) {
|
|
1929
|
+
console.warn(`<ProductProvider/> received a 'initialVariantId' prop, but could not actually find a variant with that ID`);
|
|
1930
|
+
}
|
|
1931
|
+
return foundVariant;
|
|
1932
|
+
}
|
|
1933
|
+
if (explicitVariantId === null) {
|
|
1934
|
+
return null;
|
|
1935
|
+
}
|
|
1936
|
+
if (explicitVariantId === void 0) {
|
|
1937
|
+
return variants.find((variant) => variant == null ? void 0 : variant.availableForSale) || variants[0];
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
function getSelectedOptions(selectedVariant) {
|
|
1941
|
+
return (selectedVariant == null ? void 0 : selectedVariant.selectedOptions) ? selectedVariant.selectedOptions.reduce((memo, optionSet) => {
|
|
1942
|
+
var _a, _b;
|
|
1943
|
+
memo[(_a = optionSet == null ? void 0 : optionSet.name) != null ? _a : ""] = (_b = optionSet == null ? void 0 : optionSet.value) != null ? _b : "";
|
|
1944
|
+
return memo;
|
|
1945
|
+
}, {}) : {};
|
|
1946
|
+
}
|
|
1947
|
+
function isProductVariantArray(maybeVariantArray) {
|
|
1948
|
+
if (!maybeVariantArray || !Array.isArray(maybeVariantArray)) {
|
|
1949
|
+
return false;
|
|
1950
|
+
}
|
|
1951
|
+
return true;
|
|
1952
|
+
}
|
|
1953
|
+
var _jsxFileName$a = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/BaseButton.tsx";
|
|
1954
|
+
function BaseButton(props) {
|
|
1955
|
+
const {
|
|
1956
|
+
as,
|
|
1957
|
+
onClick,
|
|
1958
|
+
defaultOnClick,
|
|
1959
|
+
children,
|
|
1960
|
+
buttonRef,
|
|
1961
|
+
...passthroughProps
|
|
1962
|
+
} = props;
|
|
1963
|
+
const handleOnClick = React.useCallback((event) => {
|
|
1964
|
+
if (onClick) {
|
|
1965
|
+
const clickShouldContinue = onClick(event);
|
|
1966
|
+
if (typeof clickShouldContinue === "boolean" && clickShouldContinue === false || (event == null ? void 0 : event.defaultPrevented))
|
|
1967
|
+
return;
|
|
1968
|
+
}
|
|
1969
|
+
defaultOnClick == null ? void 0 : defaultOnClick(event);
|
|
1970
|
+
}, [defaultOnClick, onClick]);
|
|
1971
|
+
const Component = as || "button";
|
|
1972
|
+
return /* @__PURE__ */ React__default.default.createElement(Component, {
|
|
1973
|
+
ref: buttonRef,
|
|
1974
|
+
onClick: handleOnClick,
|
|
1975
|
+
...passthroughProps,
|
|
1976
|
+
__self: this,
|
|
1977
|
+
__source: {
|
|
1978
|
+
fileName: _jsxFileName$a,
|
|
1979
|
+
lineNumber: 59,
|
|
1980
|
+
columnNumber: 5
|
|
1981
|
+
}
|
|
1982
|
+
}, children);
|
|
1983
|
+
}
|
|
1984
|
+
var _jsxFileName$9 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/AddToCartButton.tsx";
|
|
1985
|
+
function AddToCartButton(props) {
|
|
1986
|
+
var _a;
|
|
1987
|
+
const [addingItem, setAddingItem] = React.useState(false);
|
|
1988
|
+
const {
|
|
1989
|
+
variantId: explicitVariantId,
|
|
1990
|
+
quantity = 1,
|
|
1991
|
+
attributes,
|
|
1992
|
+
sellingPlanId,
|
|
1993
|
+
onClick,
|
|
1994
|
+
children,
|
|
1995
|
+
accessibleAddingToCartLabel,
|
|
1996
|
+
...passthroughProps
|
|
1997
|
+
} = props;
|
|
1998
|
+
const {
|
|
1999
|
+
status,
|
|
2000
|
+
linesAdd
|
|
2001
|
+
} = useCart();
|
|
2002
|
+
const {
|
|
2003
|
+
selectedVariant
|
|
2004
|
+
} = useProduct();
|
|
2005
|
+
const variantId = (_a = explicitVariantId != null ? explicitVariantId : selectedVariant == null ? void 0 : selectedVariant.id) != null ? _a : "";
|
|
2006
|
+
const disabled = explicitVariantId === null || variantId === "" || selectedVariant === null || addingItem || passthroughProps.disabled;
|
|
2007
|
+
React.useEffect(() => {
|
|
2008
|
+
if (addingItem && status === "idle") {
|
|
2009
|
+
setAddingItem(false);
|
|
2010
|
+
}
|
|
2011
|
+
}, [status, addingItem]);
|
|
2012
|
+
const handleAddItem = React.useCallback(() => {
|
|
2013
|
+
setAddingItem(true);
|
|
2014
|
+
linesAdd([{
|
|
2015
|
+
quantity,
|
|
2016
|
+
merchandiseId: variantId || "",
|
|
2017
|
+
attributes,
|
|
2018
|
+
sellingPlanId
|
|
2019
|
+
}]);
|
|
2020
|
+
}, [linesAdd, quantity, variantId, attributes, sellingPlanId]);
|
|
2021
|
+
return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement(BaseButton, {
|
|
2022
|
+
...passthroughProps,
|
|
2023
|
+
disabled,
|
|
2024
|
+
onClick,
|
|
2025
|
+
defaultOnClick: handleAddItem,
|
|
2026
|
+
__self: this,
|
|
2027
|
+
__source: {
|
|
2028
|
+
fileName: _jsxFileName$9,
|
|
2029
|
+
lineNumber: 71,
|
|
2030
|
+
columnNumber: 7
|
|
2031
|
+
}
|
|
2032
|
+
}, children), accessibleAddingToCartLabel ? /* @__PURE__ */ React__default.default.createElement("p", {
|
|
2033
|
+
style: {
|
|
2034
|
+
position: "absolute",
|
|
2035
|
+
width: "1px",
|
|
2036
|
+
height: "1px",
|
|
2037
|
+
padding: "0",
|
|
2038
|
+
margin: "-1px",
|
|
2039
|
+
overflow: "hidden",
|
|
2040
|
+
clip: "rect(0, 0, 0, 0)",
|
|
2041
|
+
whiteSpace: "nowrap",
|
|
2042
|
+
borderWidth: "0"
|
|
2043
|
+
},
|
|
2044
|
+
role: "alert",
|
|
2045
|
+
"aria-live": "assertive",
|
|
2046
|
+
__self: this,
|
|
2047
|
+
__source: {
|
|
2048
|
+
fileName: _jsxFileName$9,
|
|
2049
|
+
lineNumber: 80,
|
|
2050
|
+
columnNumber: 9
|
|
2051
|
+
}
|
|
2052
|
+
}, addingItem ? accessibleAddingToCartLabel : null) : null);
|
|
2053
|
+
}
|
|
2054
|
+
var _jsxFileName$8 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ExternalVideo.tsx";
|
|
1795
2055
|
function ExternalVideo(props) {
|
|
1796
2056
|
var _a, _b;
|
|
1797
2057
|
const {
|
|
@@ -1826,7 +2086,7 @@ fragment ImageFragment on Image {
|
|
|
1826
2086
|
loading,
|
|
1827
2087
|
__self: this,
|
|
1828
2088
|
__source: {
|
|
1829
|
-
fileName: _jsxFileName$
|
|
2089
|
+
fileName: _jsxFileName$8,
|
|
1830
2090
|
lineNumber: 56,
|
|
1831
2091
|
columnNumber: 5
|
|
1832
2092
|
}
|
|
@@ -1905,7 +2165,7 @@ fragment ImageFragment on Image {
|
|
|
1905
2165
|
}
|
|
1906
2166
|
return { width: null, height: null };
|
|
1907
2167
|
}
|
|
1908
|
-
var _jsxFileName$
|
|
2168
|
+
var _jsxFileName$7 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/Image.tsx";
|
|
1909
2169
|
function Image({
|
|
1910
2170
|
data,
|
|
1911
2171
|
width,
|
|
@@ -1974,7 +2234,7 @@ fragment ImageFragment on Image {
|
|
|
1974
2234
|
decoding,
|
|
1975
2235
|
__self: this,
|
|
1976
2236
|
__source: {
|
|
1977
|
-
fileName: _jsxFileName$
|
|
2237
|
+
fileName: _jsxFileName$7,
|
|
1978
2238
|
lineNumber: 150,
|
|
1979
2239
|
columnNumber: 5
|
|
1980
2240
|
}
|
|
@@ -2010,7 +2270,7 @@ fragment ImageFragment on Image {
|
|
|
2010
2270
|
scale
|
|
2011
2271
|
})} ${size}w`).join(", ");
|
|
2012
2272
|
}
|
|
2013
|
-
var _jsxFileName$
|
|
2273
|
+
var _jsxFileName$6 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/Video.tsx";
|
|
2014
2274
|
function Video(props) {
|
|
2015
2275
|
var _a, _b;
|
|
2016
2276
|
const {
|
|
@@ -2037,7 +2297,7 @@ fragment ImageFragment on Image {
|
|
|
2037
2297
|
poster: posterUrl,
|
|
2038
2298
|
__self: this,
|
|
2039
2299
|
__source: {
|
|
2040
|
-
fileName: _jsxFileName$
|
|
2300
|
+
fileName: _jsxFileName$6,
|
|
2041
2301
|
lineNumber: 42,
|
|
2042
2302
|
columnNumber: 5
|
|
2043
2303
|
}
|
|
@@ -2052,7 +2312,7 @@ fragment ImageFragment on Image {
|
|
|
2052
2312
|
type: source.mimeType,
|
|
2053
2313
|
__self: this,
|
|
2054
2314
|
__source: {
|
|
2055
|
-
fileName: _jsxFileName$
|
|
2315
|
+
fileName: _jsxFileName$6,
|
|
2056
2316
|
lineNumber: 54,
|
|
2057
2317
|
columnNumber: 11
|
|
2058
2318
|
}
|
|
@@ -2105,7 +2365,7 @@ fragment ImageFragment on Image {
|
|
|
2105
2365
|
}, [url, stringifiedOptions, options]);
|
|
2106
2366
|
return status;
|
|
2107
2367
|
}
|
|
2108
|
-
var _jsxFileName$
|
|
2368
|
+
var _jsxFileName$5 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ModelViewer.tsx";
|
|
2109
2369
|
function ModelViewer(props) {
|
|
2110
2370
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2111
2371
|
const [modelViewer, setModelViewer] = React.useState(void 0);
|
|
@@ -2243,13 +2503,13 @@ fragment ImageFragment on Image {
|
|
|
2243
2503
|
scale: passthroughProps.scale,
|
|
2244
2504
|
__self: this,
|
|
2245
2505
|
__source: {
|
|
2246
|
-
fileName: _jsxFileName$
|
|
2506
|
+
fileName: _jsxFileName$5,
|
|
2247
2507
|
lineNumber: 222,
|
|
2248
2508
|
columnNumber: 5
|
|
2249
2509
|
}
|
|
2250
2510
|
}, children);
|
|
2251
2511
|
}
|
|
2252
|
-
var _jsxFileName$
|
|
2512
|
+
var _jsxFileName$4 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/MediaFile.tsx";
|
|
2253
2513
|
function MediaFile({
|
|
2254
2514
|
data,
|
|
2255
2515
|
mediaOptions,
|
|
@@ -2269,7 +2529,7 @@ fragment ImageFragment on Image {
|
|
|
2269
2529
|
data: data.image,
|
|
2270
2530
|
__self: this,
|
|
2271
2531
|
__source: {
|
|
2272
|
-
fileName: _jsxFileName$
|
|
2532
|
+
fileName: _jsxFileName$4,
|
|
2273
2533
|
lineNumber: 54,
|
|
2274
2534
|
columnNumber: 9
|
|
2275
2535
|
}
|
|
@@ -2282,7 +2542,7 @@ fragment ImageFragment on Image {
|
|
|
2282
2542
|
data,
|
|
2283
2543
|
__self: this,
|
|
2284
2544
|
__source: {
|
|
2285
|
-
fileName: _jsxFileName$
|
|
2545
|
+
fileName: _jsxFileName$4,
|
|
2286
2546
|
lineNumber: 63,
|
|
2287
2547
|
columnNumber: 9
|
|
2288
2548
|
}
|
|
@@ -2295,7 +2555,7 @@ fragment ImageFragment on Image {
|
|
|
2295
2555
|
data,
|
|
2296
2556
|
__self: this,
|
|
2297
2557
|
__source: {
|
|
2298
|
-
fileName: _jsxFileName$
|
|
2558
|
+
fileName: _jsxFileName$4,
|
|
2299
2559
|
lineNumber: 68,
|
|
2300
2560
|
columnNumber: 9
|
|
2301
2561
|
}
|
|
@@ -2308,7 +2568,7 @@ fragment ImageFragment on Image {
|
|
|
2308
2568
|
data,
|
|
2309
2569
|
__self: this,
|
|
2310
2570
|
__source: {
|
|
2311
|
-
fileName: _jsxFileName$
|
|
2571
|
+
fileName: _jsxFileName$4,
|
|
2312
2572
|
lineNumber: 78,
|
|
2313
2573
|
columnNumber: 9
|
|
2314
2574
|
}
|
|
@@ -2322,7 +2582,7 @@ fragment ImageFragment on Image {
|
|
|
2322
2582
|
}
|
|
2323
2583
|
}
|
|
2324
2584
|
}
|
|
2325
|
-
var _jsxFileName$
|
|
2585
|
+
var _jsxFileName$3 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/Metafield.tsx";
|
|
2326
2586
|
function Metafield(props) {
|
|
2327
2587
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2328
2588
|
const {
|
|
@@ -2353,7 +2613,7 @@ fragment ImageFragment on Image {
|
|
|
2353
2613
|
...passthroughProps,
|
|
2354
2614
|
__self: this,
|
|
2355
2615
|
__source: {
|
|
2356
|
-
fileName: _jsxFileName$
|
|
2616
|
+
fileName: _jsxFileName$3,
|
|
2357
2617
|
lineNumber: 68,
|
|
2358
2618
|
columnNumber: 9
|
|
2359
2619
|
}
|
|
@@ -2365,7 +2625,7 @@ fragment ImageFragment on Image {
|
|
|
2365
2625
|
...passthroughProps,
|
|
2366
2626
|
__self: this,
|
|
2367
2627
|
__source: {
|
|
2368
|
-
fileName: _jsxFileName$
|
|
2628
|
+
fileName: _jsxFileName$3,
|
|
2369
2629
|
lineNumber: 76,
|
|
2370
2630
|
columnNumber: 9
|
|
2371
2631
|
}
|
|
@@ -2379,7 +2639,7 @@ fragment ImageFragment on Image {
|
|
|
2379
2639
|
...passthroughProps,
|
|
2380
2640
|
__self: this,
|
|
2381
2641
|
__source: {
|
|
2382
|
-
fileName: _jsxFileName$
|
|
2642
|
+
fileName: _jsxFileName$3,
|
|
2383
2643
|
lineNumber: 86,
|
|
2384
2644
|
columnNumber: 9
|
|
2385
2645
|
}
|
|
@@ -2391,7 +2651,7 @@ fragment ImageFragment on Image {
|
|
|
2391
2651
|
...passthroughProps,
|
|
2392
2652
|
__self: this,
|
|
2393
2653
|
__source: {
|
|
2394
|
-
fileName: _jsxFileName$
|
|
2654
|
+
fileName: _jsxFileName$3,
|
|
2395
2655
|
lineNumber: 94,
|
|
2396
2656
|
columnNumber: 9
|
|
2397
2657
|
}
|
|
@@ -2406,7 +2666,7 @@ fragment ImageFragment on Image {
|
|
|
2406
2666
|
},
|
|
2407
2667
|
__self: this,
|
|
2408
2668
|
__source: {
|
|
2409
|
-
fileName: _jsxFileName$
|
|
2669
|
+
fileName: _jsxFileName$3,
|
|
2410
2670
|
lineNumber: 102,
|
|
2411
2671
|
columnNumber: 9
|
|
2412
2672
|
}
|
|
@@ -2421,7 +2681,7 @@ fragment ImageFragment on Image {
|
|
|
2421
2681
|
},
|
|
2422
2682
|
__self: this,
|
|
2423
2683
|
__source: {
|
|
2424
|
-
fileName: _jsxFileName$
|
|
2684
|
+
fileName: _jsxFileName$3,
|
|
2425
2685
|
lineNumber: 111,
|
|
2426
2686
|
columnNumber: 9
|
|
2427
2687
|
}
|
|
@@ -2434,7 +2694,7 @@ fragment ImageFragment on Image {
|
|
|
2434
2694
|
...passthroughProps,
|
|
2435
2695
|
__self: this,
|
|
2436
2696
|
__source: {
|
|
2437
|
-
fileName: _jsxFileName$
|
|
2697
|
+
fileName: _jsxFileName$3,
|
|
2438
2698
|
lineNumber: 122,
|
|
2439
2699
|
columnNumber: 9
|
|
2440
2700
|
}
|
|
@@ -2446,7 +2706,7 @@ fragment ImageFragment on Image {
|
|
|
2446
2706
|
...passthroughProps,
|
|
2447
2707
|
__self: this,
|
|
2448
2708
|
__source: {
|
|
2449
|
-
fileName: _jsxFileName$
|
|
2709
|
+
fileName: _jsxFileName$3,
|
|
2450
2710
|
lineNumber: 133,
|
|
2451
2711
|
columnNumber: 9
|
|
2452
2712
|
}
|
|
@@ -2461,7 +2721,7 @@ fragment ImageFragment on Image {
|
|
|
2461
2721
|
...passthroughProps,
|
|
2462
2722
|
__self: this,
|
|
2463
2723
|
__source: {
|
|
2464
|
-
fileName: _jsxFileName$
|
|
2724
|
+
fileName: _jsxFileName$3,
|
|
2465
2725
|
lineNumber: 144,
|
|
2466
2726
|
columnNumber: 9
|
|
2467
2727
|
}
|
|
@@ -2474,7 +2734,7 @@ fragment ImageFragment on Image {
|
|
|
2474
2734
|
...passthroughProps,
|
|
2475
2735
|
__self: this,
|
|
2476
2736
|
__source: {
|
|
2477
|
-
fileName: _jsxFileName$
|
|
2737
|
+
fileName: _jsxFileName$3,
|
|
2478
2738
|
lineNumber: 154,
|
|
2479
2739
|
columnNumber: 9
|
|
2480
2740
|
}
|
|
@@ -2482,7 +2742,7 @@ fragment ImageFragment on Image {
|
|
|
2482
2742
|
key: `${ref != null ? ref : ""}-${index2}`,
|
|
2483
2743
|
__self: this,
|
|
2484
2744
|
__source: {
|
|
2485
|
-
fileName: _jsxFileName$
|
|
2745
|
+
fileName: _jsxFileName$3,
|
|
2486
2746
|
lineNumber: 158,
|
|
2487
2747
|
columnNumber: 13
|
|
2488
2748
|
}
|
|
@@ -2496,7 +2756,7 @@ fragment ImageFragment on Image {
|
|
|
2496
2756
|
...passthroughProps,
|
|
2497
2757
|
__self: this,
|
|
2498
2758
|
__source: {
|
|
2499
|
-
fileName: _jsxFileName$
|
|
2759
|
+
fileName: _jsxFileName$3,
|
|
2500
2760
|
lineNumber: 167,
|
|
2501
2761
|
columnNumber: 11
|
|
2502
2762
|
}
|
|
@@ -2508,7 +2768,7 @@ fragment ImageFragment on Image {
|
|
|
2508
2768
|
...passthroughProps,
|
|
2509
2769
|
__self: this,
|
|
2510
2770
|
__source: {
|
|
2511
|
-
fileName: _jsxFileName$
|
|
2771
|
+
fileName: _jsxFileName$3,
|
|
2512
2772
|
lineNumber: 172,
|
|
2513
2773
|
columnNumber: 11
|
|
2514
2774
|
}
|
|
@@ -2516,7 +2776,7 @@ fragment ImageFragment on Image {
|
|
|
2516
2776
|
data: ref.previewImage,
|
|
2517
2777
|
__self: this,
|
|
2518
2778
|
__source: {
|
|
2519
|
-
fileName: _jsxFileName$
|
|
2779
|
+
fileName: _jsxFileName$3,
|
|
2520
2780
|
lineNumber: 173,
|
|
2521
2781
|
columnNumber: 13
|
|
2522
2782
|
}
|
|
@@ -2528,7 +2788,7 @@ fragment ImageFragment on Image {
|
|
|
2528
2788
|
data: ref,
|
|
2529
2789
|
__self: this,
|
|
2530
2790
|
__source: {
|
|
2531
|
-
fileName: _jsxFileName$
|
|
2791
|
+
fileName: _jsxFileName$3,
|
|
2532
2792
|
lineNumber: 178,
|
|
2533
2793
|
columnNumber: 16
|
|
2534
2794
|
}
|
|
@@ -2541,7 +2801,7 @@ fragment ImageFragment on Image {
|
|
|
2541
2801
|
...passthroughProps,
|
|
2542
2802
|
__self: this,
|
|
2543
2803
|
__source: {
|
|
2544
|
-
fileName: _jsxFileName$
|
|
2804
|
+
fileName: _jsxFileName$3,
|
|
2545
2805
|
lineNumber: 185,
|
|
2546
2806
|
columnNumber: 5
|
|
2547
2807
|
}
|
|
@@ -2859,7 +3119,7 @@ fragment ImageFragment on Image {
|
|
|
2859
3119
|
return () => memoized != null ? memoized : memoized = new Intl.NumberFormat(locale, options);
|
|
2860
3120
|
}, [locale, options]);
|
|
2861
3121
|
}
|
|
2862
|
-
var _jsxFileName$
|
|
3122
|
+
var _jsxFileName$2 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/Money.tsx";
|
|
2863
3123
|
function Money({
|
|
2864
3124
|
data,
|
|
2865
3125
|
as,
|
|
@@ -2888,7 +3148,7 @@ fragment ImageFragment on Image {
|
|
|
2888
3148
|
...passthroughProps,
|
|
2889
3149
|
__self: this,
|
|
2890
3150
|
__source: {
|
|
2891
|
-
fileName: _jsxFileName$
|
|
3151
|
+
fileName: _jsxFileName$2,
|
|
2892
3152
|
lineNumber: 65,
|
|
2893
3153
|
columnNumber: 5
|
|
2894
3154
|
}
|
|
@@ -2897,7 +3157,7 @@ fragment ImageFragment on Image {
|
|
|
2897
3157
|
function isMoney(maybeMoney) {
|
|
2898
3158
|
return typeof maybeMoney.amount === "string" && !!maybeMoney.amount && typeof maybeMoney.currencyCode === "string" && !!maybeMoney.currencyCode;
|
|
2899
3159
|
}
|
|
2900
|
-
var _jsxFileName$
|
|
3160
|
+
var _jsxFileName$1 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ProductPrice.tsx";
|
|
2901
3161
|
function ProductPrice(props) {
|
|
2902
3162
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2903
3163
|
const {
|
|
@@ -2947,7 +3207,7 @@ fragment ImageFragment on Image {
|
|
|
2947
3207
|
measurement,
|
|
2948
3208
|
__self: this,
|
|
2949
3209
|
__source: {
|
|
2950
|
-
fileName: _jsxFileName$
|
|
3210
|
+
fileName: _jsxFileName$1,
|
|
2951
3211
|
lineNumber: 81,
|
|
2952
3212
|
columnNumber: 7
|
|
2953
3213
|
}
|
|
@@ -2958,171 +3218,12 @@ fragment ImageFragment on Image {
|
|
|
2958
3218
|
data: price,
|
|
2959
3219
|
__self: this,
|
|
2960
3220
|
__source: {
|
|
2961
|
-
fileName: _jsxFileName$
|
|
3221
|
+
fileName: _jsxFileName$1,
|
|
2962
3222
|
lineNumber: 85,
|
|
2963
3223
|
columnNumber: 10
|
|
2964
3224
|
}
|
|
2965
3225
|
});
|
|
2966
3226
|
}
|
|
2967
|
-
var _jsxFileName$1 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ProductProvider.tsx";
|
|
2968
|
-
const ProductOptionsContext = React.createContext(null);
|
|
2969
|
-
function ProductProvider({
|
|
2970
|
-
children,
|
|
2971
|
-
data: product,
|
|
2972
|
-
initialVariantId: explicitVariantId
|
|
2973
|
-
}) {
|
|
2974
|
-
const variants = React.useMemo(() => {
|
|
2975
|
-
var _a;
|
|
2976
|
-
return flattenConnection((_a = product.variants) != null ? _a : {});
|
|
2977
|
-
}, [product.variants]);
|
|
2978
|
-
if (!isProductVariantArray(variants)) {
|
|
2979
|
-
throw new Error(`<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'`);
|
|
2980
|
-
}
|
|
2981
|
-
const options = React.useMemo(() => getOptions(variants), [variants]);
|
|
2982
|
-
const [selectedVariant, setSelectedVariant] = React.useState(() => getVariantBasedOnIdProp(explicitVariantId, variants));
|
|
2983
|
-
const [selectedOptions, setSelectedOptions] = React.useState(() => getSelectedOptions(selectedVariant));
|
|
2984
|
-
React.useEffect(() => {
|
|
2985
|
-
const newSelectedVariant = getVariantBasedOnIdProp(explicitVariantId, variants);
|
|
2986
|
-
setSelectedVariant(newSelectedVariant);
|
|
2987
|
-
setSelectedOptions(getSelectedOptions(newSelectedVariant));
|
|
2988
|
-
}, [explicitVariantId, variants]);
|
|
2989
|
-
const setSelectedOption = React.useCallback((name, value2) => {
|
|
2990
|
-
setSelectedOptions((selectedOptions2) => {
|
|
2991
|
-
const opts = {
|
|
2992
|
-
...selectedOptions2,
|
|
2993
|
-
[name]: value2
|
|
2994
|
-
};
|
|
2995
|
-
setSelectedVariant(getSelectedVariant(variants, opts));
|
|
2996
|
-
return opts;
|
|
2997
|
-
});
|
|
2998
|
-
}, [setSelectedOptions, variants]);
|
|
2999
|
-
const isOptionInStock = React.useCallback((option, value2) => {
|
|
3000
|
-
var _a;
|
|
3001
|
-
const proposedVariant = getSelectedVariant(variants, {
|
|
3002
|
-
...selectedOptions,
|
|
3003
|
-
...{
|
|
3004
|
-
[option]: value2
|
|
3005
|
-
}
|
|
3006
|
-
});
|
|
3007
|
-
return (_a = proposedVariant == null ? void 0 : proposedVariant.availableForSale) != null ? _a : true;
|
|
3008
|
-
}, [selectedOptions, variants]);
|
|
3009
|
-
const sellingPlanGroups = React.useMemo(() => {
|
|
3010
|
-
var _a;
|
|
3011
|
-
return flattenConnection((_a = product.sellingPlanGroups) != null ? _a : {}).map((sellingPlanGroup) => {
|
|
3012
|
-
var _a2;
|
|
3013
|
-
return {
|
|
3014
|
-
...sellingPlanGroup,
|
|
3015
|
-
sellingPlans: flattenConnection((_a2 = sellingPlanGroup == null ? void 0 : sellingPlanGroup.sellingPlans) != null ? _a2 : {})
|
|
3016
|
-
};
|
|
3017
|
-
});
|
|
3018
|
-
}, [product.sellingPlanGroups]);
|
|
3019
|
-
const [selectedSellingPlan, setSelectedSellingPlan] = React.useState(void 0);
|
|
3020
|
-
const selectedSellingPlanAllocation = React.useMemo(() => {
|
|
3021
|
-
var _a, _b;
|
|
3022
|
-
if (!selectedVariant || !selectedSellingPlan) {
|
|
3023
|
-
return;
|
|
3024
|
-
}
|
|
3025
|
-
if (!((_a = selectedVariant.sellingPlanAllocations) == null ? void 0 : _a.nodes) && !((_b = selectedVariant.sellingPlanAllocations) == null ? void 0 : _b.edges)) {
|
|
3026
|
-
throw new Error(`<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation`);
|
|
3027
|
-
}
|
|
3028
|
-
return flattenConnection(selectedVariant.sellingPlanAllocations).find((allocation) => {
|
|
3029
|
-
var _a2;
|
|
3030
|
-
return ((_a2 = allocation == null ? void 0 : allocation.sellingPlan) == null ? void 0 : _a2.id) === selectedSellingPlan.id;
|
|
3031
|
-
});
|
|
3032
|
-
}, [selectedVariant, selectedSellingPlan]);
|
|
3033
|
-
const value = React.useMemo(() => ({
|
|
3034
|
-
variants,
|
|
3035
|
-
variantsConnection: product.variants,
|
|
3036
|
-
options,
|
|
3037
|
-
selectedVariant,
|
|
3038
|
-
setSelectedVariant,
|
|
3039
|
-
selectedOptions,
|
|
3040
|
-
setSelectedOption,
|
|
3041
|
-
setSelectedOptions,
|
|
3042
|
-
isOptionInStock,
|
|
3043
|
-
selectedSellingPlan,
|
|
3044
|
-
setSelectedSellingPlan,
|
|
3045
|
-
selectedSellingPlanAllocation,
|
|
3046
|
-
sellingPlanGroups,
|
|
3047
|
-
sellingPlanGroupsConnection: product.sellingPlanGroups
|
|
3048
|
-
}), [isOptionInStock, options, product.sellingPlanGroups, product.variants, selectedOptions, selectedSellingPlan, selectedSellingPlanAllocation, selectedVariant, sellingPlanGroups, setSelectedOption, variants]);
|
|
3049
|
-
return /* @__PURE__ */ React__default.default.createElement(ProductOptionsContext.Provider, {
|
|
3050
|
-
value,
|
|
3051
|
-
__self: this,
|
|
3052
|
-
__source: {
|
|
3053
|
-
fileName: _jsxFileName$1,
|
|
3054
|
-
lineNumber: 201,
|
|
3055
|
-
columnNumber: 5
|
|
3056
|
-
}
|
|
3057
|
-
}, children);
|
|
3058
|
-
}
|
|
3059
|
-
function useProduct() {
|
|
3060
|
-
const context = React.useContext(ProductOptionsContext);
|
|
3061
|
-
if (!context) {
|
|
3062
|
-
throw new Error(`'useProduct' must be a child of <ProductProvider />`);
|
|
3063
|
-
}
|
|
3064
|
-
return context;
|
|
3065
|
-
}
|
|
3066
|
-
function getSelectedVariant(variants, choices) {
|
|
3067
|
-
var _a, _b;
|
|
3068
|
-
if (!variants.length || ((_b = (_a = variants == null ? void 0 : variants[0]) == null ? void 0 : _a.selectedOptions) == null ? void 0 : _b.length) !== Object.keys(choices).length) {
|
|
3069
|
-
return;
|
|
3070
|
-
}
|
|
3071
|
-
return variants == null ? void 0 : variants.find((variant) => {
|
|
3072
|
-
return Object.entries(choices).every(([name, value]) => {
|
|
3073
|
-
var _a2;
|
|
3074
|
-
return (_a2 = variant == null ? void 0 : variant.selectedOptions) == null ? void 0 : _a2.some((option) => (option == null ? void 0 : option.name) === name && (option == null ? void 0 : option.value) === value);
|
|
3075
|
-
});
|
|
3076
|
-
});
|
|
3077
|
-
}
|
|
3078
|
-
function getOptions(variants) {
|
|
3079
|
-
const map = variants.reduce((memo, variant) => {
|
|
3080
|
-
var _a;
|
|
3081
|
-
if (!variant.selectedOptions) {
|
|
3082
|
-
throw new Error(`'getOptions' requires 'variant.selectedOptions'`);
|
|
3083
|
-
}
|
|
3084
|
-
(_a = variant == null ? void 0 : variant.selectedOptions) == null ? void 0 : _a.forEach((opt) => {
|
|
3085
|
-
var _a2, _b, _c, _d;
|
|
3086
|
-
memo[(_a2 = opt == null ? void 0 : opt.name) != null ? _a2 : ""] = memo[(_b = opt == null ? void 0 : opt.name) != null ? _b : ""] || /* @__PURE__ */ new Set();
|
|
3087
|
-
memo[(_c = opt == null ? void 0 : opt.name) != null ? _c : ""].add((_d = opt == null ? void 0 : opt.value) != null ? _d : "");
|
|
3088
|
-
});
|
|
3089
|
-
return memo;
|
|
3090
|
-
}, {});
|
|
3091
|
-
return Object.keys(map).map((option) => {
|
|
3092
|
-
return {
|
|
3093
|
-
name: option,
|
|
3094
|
-
values: Array.from(map[option])
|
|
3095
|
-
};
|
|
3096
|
-
});
|
|
3097
|
-
}
|
|
3098
|
-
function getVariantBasedOnIdProp(explicitVariantId, variants) {
|
|
3099
|
-
if (explicitVariantId) {
|
|
3100
|
-
const foundVariant = variants.find((variant) => (variant == null ? void 0 : variant.id) === explicitVariantId);
|
|
3101
|
-
if (!foundVariant) {
|
|
3102
|
-
console.warn(`<ProductProvider/> received a 'initialVariantId' prop, but could not actually find a variant with that ID`);
|
|
3103
|
-
}
|
|
3104
|
-
return foundVariant;
|
|
3105
|
-
}
|
|
3106
|
-
if (explicitVariantId === null) {
|
|
3107
|
-
return null;
|
|
3108
|
-
}
|
|
3109
|
-
if (explicitVariantId === void 0) {
|
|
3110
|
-
return variants.find((variant) => variant == null ? void 0 : variant.availableForSale) || variants[0];
|
|
3111
|
-
}
|
|
3112
|
-
}
|
|
3113
|
-
function getSelectedOptions(selectedVariant) {
|
|
3114
|
-
return (selectedVariant == null ? void 0 : selectedVariant.selectedOptions) ? selectedVariant.selectedOptions.reduce((memo, optionSet) => {
|
|
3115
|
-
var _a, _b;
|
|
3116
|
-
memo[(_a = optionSet == null ? void 0 : optionSet.name) != null ? _a : ""] = (_b = optionSet == null ? void 0 : optionSet.value) != null ? _b : "";
|
|
3117
|
-
return memo;
|
|
3118
|
-
}, {}) : {};
|
|
3119
|
-
}
|
|
3120
|
-
function isProductVariantArray(maybeVariantArray) {
|
|
3121
|
-
if (!maybeVariantArray || !Array.isArray(maybeVariantArray)) {
|
|
3122
|
-
return false;
|
|
3123
|
-
}
|
|
3124
|
-
return true;
|
|
3125
|
-
}
|
|
3126
3227
|
var _jsxFileName = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ShopPayButton.tsx";
|
|
3127
3228
|
const SHOPJS_URL = "https://cdn.shopify.com/shopifycloud/shop-js/v1.0/client.js";
|
|
3128
3229
|
function ShopPayButton({
|
|
@@ -3256,6 +3357,7 @@ fragment ImageFragment on Image {
|
|
|
3256
3357
|
}
|
|
3257
3358
|
};
|
|
3258
3359
|
}
|
|
3360
|
+
exports2.AddToCartButton = AddToCartButton;
|
|
3259
3361
|
exports2.CartProvider = CartProvider;
|
|
3260
3362
|
exports2.ExternalVideo = ExternalVideo;
|
|
3261
3363
|
exports2.Image = Image;
|