@shopify/hydrogen-react 0.0.0-next-59d697b → 0.0.0-next-29ed1ff
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/CartCheckoutButton.js +2 -1
- package/dist/dev/CartCheckoutButton.js.map +1 -1
- package/dist/dev/CartCheckoutButton.mjs +2 -1
- package/dist/dev/CartCheckoutButton.mjs.map +1 -1
- package/dist/prod/CartCheckoutButton.js +2 -1
- package/dist/prod/CartCheckoutButton.js.map +1 -1
- package/dist/prod/CartCheckoutButton.mjs +2 -1
- package/dist/prod/CartCheckoutButton.mjs.map +1 -1
- package/dist/types/CartCheckoutButton.d.ts +2 -1
- package/dist/umd/hydrogen-react.dev.js +2 -2
- 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
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const react = require("react");
|
|
4
4
|
const CartProvider = require("./CartProvider.js");
|
|
5
|
+
const BaseButton = require("./BaseButton.js");
|
|
5
6
|
const jsxRuntime = require("react/jsx-runtime");
|
|
6
7
|
function CartCheckoutButton(props) {
|
|
7
8
|
const [requestedCheckout, setRequestedCheckout] = react.useState(false);
|
|
@@ -18,7 +19,7 @@ function CartCheckoutButton(props) {
|
|
|
18
19
|
window.location.href = checkoutUrl;
|
|
19
20
|
}
|
|
20
21
|
}, [requestedCheckout, status, checkoutUrl]);
|
|
21
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BaseButton.BaseButton, {
|
|
22
23
|
...passthroughProps,
|
|
23
24
|
disabled: requestedCheckout || passthroughProps.disabled,
|
|
24
25
|
onClick: () => setRequestedCheckout(true),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartCheckoutButton.js","sources":["../../src/CartCheckoutButton.tsx"],"sourcesContent":["import {ReactNode, useEffect, useState} from 'react';\nimport {useCart} from './CartProvider.js';\n\ntype PropsWeControl = 'onClick';\n\n/**\n * The `CartCheckoutButton` component renders a button that redirects to the checkout URL for the cart.\n * It must be a descendent of a `CartProvider` component.\n */\nexport function CartCheckoutButton(\n props: Omit<
|
|
1
|
+
{"version":3,"file":"CartCheckoutButton.js","sources":["../../src/CartCheckoutButton.tsx"],"sourcesContent":["import {ReactNode, useEffect, useState} from 'react';\nimport {useCart} from './CartProvider.js';\nimport {BaseButton, BaseButtonProps} from './BaseButton.js';\n\ntype PropsWeControl = 'onClick';\n\n/**\n * The `CartCheckoutButton` component renders a button that redirects to the checkout URL for the cart.\n * It must be a descendent of a `CartProvider` component.\n */\nexport function CartCheckoutButton(\n props: Omit<BaseButtonProps<'button'>, PropsWeControl> & {\n /** A `ReactNode` element. */\n children: ReactNode;\n }\n) {\n const [requestedCheckout, setRequestedCheckout] = useState(false);\n const {status, checkoutUrl} = useCart();\n const {children, ...passthroughProps} = props;\n\n useEffect(() => {\n if (requestedCheckout && checkoutUrl && status === 'idle') {\n window.location.href = checkoutUrl;\n }\n }, [requestedCheckout, status, checkoutUrl]);\n\n return (\n <BaseButton\n {...passthroughProps}\n disabled={requestedCheckout || passthroughProps.disabled}\n onClick={() => setRequestedCheckout(true)}\n >\n {children}\n </BaseButton>\n );\n}\n"],"names":["CartCheckoutButton","props","requestedCheckout","setRequestedCheckout","useState","status","checkoutUrl","useCart","children","passthroughProps","useEffect","window","location","href","BaseButton","disabled"],"mappings":";;;;;;AAUO,SAASA,mBACdC,OAIA;AACA,QAAM,CAACC,mBAAmBC,oBAApB,IAA4CC,eAAS,KAAD;AACpD,QAAA;AAAA,IAACC;AAAAA,IAAQC;AAAAA,MAAeC,aAA9B,QAAA;AACM,QAAA;AAAA,IAACC;AAAAA,OAAaC;AAAAA,EAAoBR,IAAAA;AAExCS,QAAAA,UAAU,MAAM;AACVR,QAAAA,qBAAqBI,eAAeD,WAAW,QAAQ;AACzDM,aAAOC,SAASC,OAAOP;AAAAA,IACxB;AAAA,EACA,GAAA,CAACJ,mBAAmBG,QAAQC,WAA5B,CAJM;AAMT,wCACGQ,WAAAA,YAAD;AAAA,IAAA,GACML;AAAAA,IACJ,UAAUP,qBAAqBO,iBAAiBM;AAAAA,IAChD,SAAS,MAAMZ,qBAAqB,IAAD;AAAA,IAHrC;AAAA,EAAA,CADF;AASD;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useState, useEffect } from "react";
|
|
2
2
|
import { useCart } from "./CartProvider.mjs";
|
|
3
|
+
import { BaseButton } from "./BaseButton.mjs";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
function CartCheckoutButton(props) {
|
|
5
6
|
const [requestedCheckout, setRequestedCheckout] = useState(false);
|
|
@@ -16,7 +17,7 @@ function CartCheckoutButton(props) {
|
|
|
16
17
|
window.location.href = checkoutUrl;
|
|
17
18
|
}
|
|
18
19
|
}, [requestedCheckout, status, checkoutUrl]);
|
|
19
|
-
return /* @__PURE__ */ jsx(
|
|
20
|
+
return /* @__PURE__ */ jsx(BaseButton, {
|
|
20
21
|
...passthroughProps,
|
|
21
22
|
disabled: requestedCheckout || passthroughProps.disabled,
|
|
22
23
|
onClick: () => setRequestedCheckout(true),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartCheckoutButton.mjs","sources":["../../src/CartCheckoutButton.tsx"],"sourcesContent":["import {ReactNode, useEffect, useState} from 'react';\nimport {useCart} from './CartProvider.js';\n\ntype PropsWeControl = 'onClick';\n\n/**\n * The `CartCheckoutButton` component renders a button that redirects to the checkout URL for the cart.\n * It must be a descendent of a `CartProvider` component.\n */\nexport function CartCheckoutButton(\n props: Omit<
|
|
1
|
+
{"version":3,"file":"CartCheckoutButton.mjs","sources":["../../src/CartCheckoutButton.tsx"],"sourcesContent":["import {ReactNode, useEffect, useState} from 'react';\nimport {useCart} from './CartProvider.js';\nimport {BaseButton, BaseButtonProps} from './BaseButton.js';\n\ntype PropsWeControl = 'onClick';\n\n/**\n * The `CartCheckoutButton` component renders a button that redirects to the checkout URL for the cart.\n * It must be a descendent of a `CartProvider` component.\n */\nexport function CartCheckoutButton(\n props: Omit<BaseButtonProps<'button'>, PropsWeControl> & {\n /** A `ReactNode` element. */\n children: ReactNode;\n }\n) {\n const [requestedCheckout, setRequestedCheckout] = useState(false);\n const {status, checkoutUrl} = useCart();\n const {children, ...passthroughProps} = props;\n\n useEffect(() => {\n if (requestedCheckout && checkoutUrl && status === 'idle') {\n window.location.href = checkoutUrl;\n }\n }, [requestedCheckout, status, checkoutUrl]);\n\n return (\n <BaseButton\n {...passthroughProps}\n disabled={requestedCheckout || passthroughProps.disabled}\n onClick={() => setRequestedCheckout(true)}\n >\n {children}\n </BaseButton>\n );\n}\n"],"names":["CartCheckoutButton","props","requestedCheckout","setRequestedCheckout","useState","status","checkoutUrl","useCart","children","passthroughProps","useEffect","window","location","href","disabled"],"mappings":";;;;AAUO,SAASA,mBACdC,OAIA;AACA,QAAM,CAACC,mBAAmBC,oBAApB,IAA4CC,SAAS,KAAD;AACpD,QAAA;AAAA,IAACC;AAAAA,IAAQC;AAAAA,MAAeC,QAA9B;AACM,QAAA;AAAA,IAACC;AAAAA,OAAaC;AAAAA,EAAoBR,IAAAA;AAExCS,YAAU,MAAM;AACVR,QAAAA,qBAAqBI,eAAeD,WAAW,QAAQ;AACzDM,aAAOC,SAASC,OAAOP;AAAAA,IACxB;AAAA,EACA,GAAA,CAACJ,mBAAmBG,QAAQC,WAA5B,CAJM;AAMT,6BACG,YAAD;AAAA,IAAA,GACMG;AAAAA,IACJ,UAAUP,qBAAqBO,iBAAiBK;AAAAA,IAChD,SAAS,MAAMX,qBAAqB,IAAD;AAAA,IAHrC;AAAA,EAAA,CADF;AASD;"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const react = require("react");
|
|
4
4
|
const CartProvider = require("./CartProvider.js");
|
|
5
|
+
const BaseButton = require("./BaseButton.js");
|
|
5
6
|
const jsxRuntime = require("react/jsx-runtime");
|
|
6
7
|
function CartCheckoutButton(props) {
|
|
7
8
|
const [requestedCheckout, setRequestedCheckout] = react.useState(false);
|
|
@@ -18,7 +19,7 @@ function CartCheckoutButton(props) {
|
|
|
18
19
|
window.location.href = checkoutUrl;
|
|
19
20
|
}
|
|
20
21
|
}, [requestedCheckout, status, checkoutUrl]);
|
|
21
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BaseButton.BaseButton, {
|
|
22
23
|
...passthroughProps,
|
|
23
24
|
disabled: requestedCheckout || passthroughProps.disabled,
|
|
24
25
|
onClick: () => setRequestedCheckout(true),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartCheckoutButton.js","sources":["../../src/CartCheckoutButton.tsx"],"sourcesContent":["import {ReactNode, useEffect, useState} from 'react';\nimport {useCart} from './CartProvider.js';\n\ntype PropsWeControl = 'onClick';\n\n/**\n * The `CartCheckoutButton` component renders a button that redirects to the checkout URL for the cart.\n * It must be a descendent of a `CartProvider` component.\n */\nexport function CartCheckoutButton(\n props: Omit<
|
|
1
|
+
{"version":3,"file":"CartCheckoutButton.js","sources":["../../src/CartCheckoutButton.tsx"],"sourcesContent":["import {ReactNode, useEffect, useState} from 'react';\nimport {useCart} from './CartProvider.js';\nimport {BaseButton, BaseButtonProps} from './BaseButton.js';\n\ntype PropsWeControl = 'onClick';\n\n/**\n * The `CartCheckoutButton` component renders a button that redirects to the checkout URL for the cart.\n * It must be a descendent of a `CartProvider` component.\n */\nexport function CartCheckoutButton(\n props: Omit<BaseButtonProps<'button'>, PropsWeControl> & {\n /** A `ReactNode` element. */\n children: ReactNode;\n }\n) {\n const [requestedCheckout, setRequestedCheckout] = useState(false);\n const {status, checkoutUrl} = useCart();\n const {children, ...passthroughProps} = props;\n\n useEffect(() => {\n if (requestedCheckout && checkoutUrl && status === 'idle') {\n window.location.href = checkoutUrl;\n }\n }, [requestedCheckout, status, checkoutUrl]);\n\n return (\n <BaseButton\n {...passthroughProps}\n disabled={requestedCheckout || passthroughProps.disabled}\n onClick={() => setRequestedCheckout(true)}\n >\n {children}\n </BaseButton>\n );\n}\n"],"names":["CartCheckoutButton","props","requestedCheckout","setRequestedCheckout","useState","status","checkoutUrl","useCart","children","passthroughProps","useEffect","window","location","href","BaseButton","disabled"],"mappings":";;;;;;AAUO,SAASA,mBACdC,OAIA;AACA,QAAM,CAACC,mBAAmBC,oBAApB,IAA4CC,eAAS,KAAD;AACpD,QAAA;AAAA,IAACC;AAAAA,IAAQC;AAAAA,MAAeC,aAA9B,QAAA;AACM,QAAA;AAAA,IAACC;AAAAA,OAAaC;AAAAA,EAAoBR,IAAAA;AAExCS,QAAAA,UAAU,MAAM;AACVR,QAAAA,qBAAqBI,eAAeD,WAAW,QAAQ;AACzDM,aAAOC,SAASC,OAAOP;AAAAA,IACxB;AAAA,EACA,GAAA,CAACJ,mBAAmBG,QAAQC,WAA5B,CAJM;AAMT,wCACGQ,WAAAA,YAAD;AAAA,IAAA,GACML;AAAAA,IACJ,UAAUP,qBAAqBO,iBAAiBM;AAAAA,IAChD,SAAS,MAAMZ,qBAAqB,IAAD;AAAA,IAHrC;AAAA,EAAA,CADF;AASD;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useState, useEffect } from "react";
|
|
2
2
|
import { useCart } from "./CartProvider.mjs";
|
|
3
|
+
import { BaseButton } from "./BaseButton.mjs";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
function CartCheckoutButton(props) {
|
|
5
6
|
const [requestedCheckout, setRequestedCheckout] = useState(false);
|
|
@@ -16,7 +17,7 @@ function CartCheckoutButton(props) {
|
|
|
16
17
|
window.location.href = checkoutUrl;
|
|
17
18
|
}
|
|
18
19
|
}, [requestedCheckout, status, checkoutUrl]);
|
|
19
|
-
return /* @__PURE__ */ jsx(
|
|
20
|
+
return /* @__PURE__ */ jsx(BaseButton, {
|
|
20
21
|
...passthroughProps,
|
|
21
22
|
disabled: requestedCheckout || passthroughProps.disabled,
|
|
22
23
|
onClick: () => setRequestedCheckout(true),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartCheckoutButton.mjs","sources":["../../src/CartCheckoutButton.tsx"],"sourcesContent":["import {ReactNode, useEffect, useState} from 'react';\nimport {useCart} from './CartProvider.js';\n\ntype PropsWeControl = 'onClick';\n\n/**\n * The `CartCheckoutButton` component renders a button that redirects to the checkout URL for the cart.\n * It must be a descendent of a `CartProvider` component.\n */\nexport function CartCheckoutButton(\n props: Omit<
|
|
1
|
+
{"version":3,"file":"CartCheckoutButton.mjs","sources":["../../src/CartCheckoutButton.tsx"],"sourcesContent":["import {ReactNode, useEffect, useState} from 'react';\nimport {useCart} from './CartProvider.js';\nimport {BaseButton, BaseButtonProps} from './BaseButton.js';\n\ntype PropsWeControl = 'onClick';\n\n/**\n * The `CartCheckoutButton` component renders a button that redirects to the checkout URL for the cart.\n * It must be a descendent of a `CartProvider` component.\n */\nexport function CartCheckoutButton(\n props: Omit<BaseButtonProps<'button'>, PropsWeControl> & {\n /** A `ReactNode` element. */\n children: ReactNode;\n }\n) {\n const [requestedCheckout, setRequestedCheckout] = useState(false);\n const {status, checkoutUrl} = useCart();\n const {children, ...passthroughProps} = props;\n\n useEffect(() => {\n if (requestedCheckout && checkoutUrl && status === 'idle') {\n window.location.href = checkoutUrl;\n }\n }, [requestedCheckout, status, checkoutUrl]);\n\n return (\n <BaseButton\n {...passthroughProps}\n disabled={requestedCheckout || passthroughProps.disabled}\n onClick={() => setRequestedCheckout(true)}\n >\n {children}\n </BaseButton>\n );\n}\n"],"names":["CartCheckoutButton","props","requestedCheckout","setRequestedCheckout","useState","status","checkoutUrl","useCart","children","passthroughProps","useEffect","window","location","href","disabled"],"mappings":";;;;AAUO,SAASA,mBACdC,OAIA;AACA,QAAM,CAACC,mBAAmBC,oBAApB,IAA4CC,SAAS,KAAD;AACpD,QAAA;AAAA,IAACC;AAAAA,IAAQC;AAAAA,MAAeC,QAA9B;AACM,QAAA;AAAA,IAACC;AAAAA,OAAaC;AAAAA,EAAoBR,IAAAA;AAExCS,YAAU,MAAM;AACVR,QAAAA,qBAAqBI,eAAeD,WAAW,QAAQ;AACzDM,aAAOC,SAASC,OAAOP;AAAAA,IACxB;AAAA,EACA,GAAA,CAACJ,mBAAmBG,QAAQC,WAA5B,CAJM;AAMT,6BACG,YAAD;AAAA,IAAA,GACMG;AAAAA,IACJ,UAAUP,qBAAqBO,iBAAiBK;AAAAA,IAChD,SAAS,MAAMX,qBAAqB,IAAD;AAAA,IAHrC;AAAA,EAAA,CADF;AASD;"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { BaseButtonProps } from './BaseButton.js';
|
|
2
3
|
declare type PropsWeControl = 'onClick';
|
|
3
4
|
/**
|
|
4
5
|
* The `CartCheckoutButton` component renders a button that redirects to the checkout URL for the cart.
|
|
5
6
|
* It must be a descendent of a `CartProvider` component.
|
|
6
7
|
*/
|
|
7
|
-
export declare function CartCheckoutButton(props: Omit<
|
|
8
|
+
export declare function CartCheckoutButton(props: Omit<BaseButtonProps<'button'>, PropsWeControl> & {
|
|
8
9
|
/** A `ReactNode` element. */
|
|
9
10
|
children: ReactNode;
|
|
10
11
|
}): JSX.Element;
|
|
@@ -2067,14 +2067,14 @@ fragment ImageFragment on Image {
|
|
|
2067
2067
|
window.location.href = checkoutUrl;
|
|
2068
2068
|
}
|
|
2069
2069
|
}, [requestedCheckout, status, checkoutUrl]);
|
|
2070
|
-
return /* @__PURE__ */ React__default.default.createElement(
|
|
2070
|
+
return /* @__PURE__ */ React__default.default.createElement(BaseButton, {
|
|
2071
2071
|
...passthroughProps,
|
|
2072
2072
|
disabled: requestedCheckout || passthroughProps.disabled,
|
|
2073
2073
|
onClick: () => setRequestedCheckout(true),
|
|
2074
2074
|
__self: this,
|
|
2075
2075
|
__source: {
|
|
2076
2076
|
fileName: _jsxFileName$9,
|
|
2077
|
-
lineNumber:
|
|
2077
|
+
lineNumber: 28,
|
|
2078
2078
|
columnNumber: 5
|
|
2079
2079
|
}
|
|
2080
2080
|
}, children);
|