@gfed-medusa/sf-lib-common 2.1.0 → 2.2.1
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/components/cart-mismatch-banner/index.d.ts +2 -2
- package/dist/components/cart-mismatch-banner/index.d.ts.map +1 -1
- package/dist/components/cart-mismatch-banner/index.js +3 -1
- package/dist/components/cart-mismatch-banner/index.js.map +1 -1
- package/dist/components/delete-button/index.d.ts +2 -2
- package/dist/components/delete-button/index.d.ts.map +1 -1
- package/dist/components/delete-button/index.js +3 -1
- package/dist/components/delete-button/index.js.map +1 -1
- package/dist/components/error-message/index.d.ts +2 -2
- package/dist/components/error-message/index.d.ts.map +1 -1
- package/dist/components/free-shipping-price-nudge/index.d.ts +2 -2
- package/dist/components/free-shipping-price-nudge/index.d.ts.map +1 -1
- package/dist/components/interactive-link/index.d.ts +2 -2
- package/dist/components/interactive-link/index.d.ts.map +1 -1
- package/dist/components/line-item-options/index.d.ts +2 -2
- package/dist/components/line-item-price/index.d.ts +2 -2
- package/dist/components/line-item-price/index.d.ts.map +1 -1
- package/dist/components/localized-client-link/index.d.ts +2 -2
- package/dist/components/localized-client-link/index.d.ts.map +1 -1
- package/dist/components/modal/index.d.ts +2 -2
- package/dist/components/modal/index.d.ts.map +1 -1
- package/dist/components/preview-price/index.d.ts +2 -2
- package/dist/components/preview-price/index.d.ts.map +1 -1
- package/dist/components/product-preview/index.d.ts +2 -2
- package/dist/components/submit-button/index.d.ts +2 -2
- package/dist/lib/context/apollo-context.d.ts +2 -2
- package/dist/lib/context/modal-context.d.ts +2 -2
- package/dist/lib/data/cart.d.ts.map +1 -1
- package/dist/lib/data/cart.js +11 -13
- package/dist/lib/data/cart.js.map +1 -1
- package/dist/lib/data/client-actions.d.ts +14 -0
- package/dist/lib/data/client-actions.d.ts.map +1 -0
- package/dist/lib/data/client-actions.js +19 -0
- package/dist/lib/data/client-actions.js.map +1 -0
- package/dist/lib/data/context.d.ts +8 -12
- package/dist/lib/data/context.d.ts.map +1 -1
- package/dist/lib/data/context.js +2 -1
- package/dist/lib/data/context.js.map +1 -1
- package/dist/lib/data/cookies.d.ts +6 -6
- package/dist/lib/data/cookies.d.ts.map +1 -1
- package/dist/lib/data/cookies.js +29 -13
- package/dist/lib/data/cookies.js.map +1 -1
- package/dist/lib/data/customer.d.ts +2 -2
- package/dist/lib/data/customer.d.ts.map +1 -1
- package/dist/lib/data/customer.js +7 -7
- package/dist/lib/data/customer.js.map +1 -1
- package/dist/lib/data/next-context.d.ts.map +1 -1
- package/dist/lib/data/next-context.js +6 -35
- package/dist/lib/data/next-context.js.map +1 -1
- package/dist/lib/data/orders.d.ts +2 -1
- package/dist/lib/data/orders.d.ts.map +1 -1
- package/dist/lib/data/orders.js +4 -4
- package/dist/lib/data/orders.js.map +1 -1
- package/dist/lib/data/regions.js +1 -1
- package/dist/lib/gql/fragments/cart.d.ts +9 -9
- package/dist/lib/gql/fragments/customer.d.ts +3 -3
- package/dist/lib/gql/fragments/product.d.ts +8 -8
- package/dist/lib/gql/fragments/product.d.ts.map +1 -1
- package/dist/lib/gql/mutations/cart.d.ts +4 -4
- package/dist/lib/gql/queries/collections.d.ts +2 -2
- package/dist/lib/gql/queries/customer.d.ts +2 -2
- package/dist/lib/gql/queries/footer.d.ts +2 -2
- package/dist/lib/gql/queries/product.d.ts +3 -3
- package/dist/lib/gql/queries/product.d.ts.map +1 -1
- package/dist/types/graphql.d.ts.map +1 -1
- package/package.json +4 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Cart, Customer } from "../../types/graphql.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime14 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/cart-mismatch-banner/index.d.ts
|
|
5
5
|
declare function CartMismatchBanner(props: {
|
|
6
6
|
customer: Customer;
|
|
7
7
|
cart: Cart;
|
|
8
|
-
}):
|
|
8
|
+
}): react_jsx_runtime14.JSX.Element | undefined;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { CartMismatchBanner };
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/cart-mismatch-banner/index.tsx"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/cart-mismatch-banner/index.tsx"],"sourcesContent":[],"mappings":";;;;iBAYS,kBAAA;YAAsC;EAAtC,IAAA,EAAsD,IAAtD;CAAsC,CAAA,EAAsB,mBAAA,CAAA,GAAA,CAAA,OAAA,GAAtB,SAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { useStorefrontContext } from "../../lib/data/context.js";
|
|
3
4
|
import { transferCart } from "../../lib/data/customer.js";
|
|
4
5
|
import { useState } from "react";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -11,12 +12,13 @@ function CartMismatchBanner(props) {
|
|
|
11
12
|
const { customer, cart } = props;
|
|
12
13
|
const [isPending, setIsPending] = useState(false);
|
|
13
14
|
const [actionText, setActionText] = useState("Run transfer again");
|
|
15
|
+
const ctx = useStorefrontContext();
|
|
14
16
|
if (!customer || !!cart.customerId) return;
|
|
15
17
|
const handleSubmit = async () => {
|
|
16
18
|
try {
|
|
17
19
|
setIsPending(true);
|
|
18
20
|
setActionText("Transferring..");
|
|
19
|
-
await transferCart();
|
|
21
|
+
await transferCart(ctx);
|
|
20
22
|
} catch {
|
|
21
23
|
setActionText("Run transfer again");
|
|
22
24
|
setIsPending(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/cart-mismatch-banner/index.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\n\nimport { ExclamationCircleSolid } from '@medusajs/icons';\nimport { Button } from '@medusajs/ui';\n\nimport { transferCart } from '@/lib/data/customer';\nimport { Customer } from '@/types/graphql';\nimport { Cart } from '@/types/graphql';\n\nfunction CartMismatchBanner(props: { customer: Customer; cart: Cart }) {\n const { customer, cart } = props;\n const [isPending, setIsPending] = useState(false);\n const [actionText, setActionText] = useState('Run transfer again');\n\n if (!customer || !!cart.customerId) {\n return;\n }\n\n const handleSubmit = async () => {\n try {\n setIsPending(true);\n setActionText('Transferring..');\n\n await transferCart();\n } catch {\n setActionText('Run transfer again');\n setIsPending(false);\n }\n };\n\n return (\n <div className=\"small:gap-2 small:p-4 mt-2 flex items-center justify-center gap-1 bg-orange-300 p-2 text-center text-sm text-orange-800\">\n <div className=\"small:flex-row small:gap-2 flex flex-col items-center gap-1\">\n <span className=\"flex items-center gap-1\">\n <ExclamationCircleSolid className=\"inline\" />\n Something went wrong when we tried to transfer your cart\n </span>\n\n <span>·</span>\n\n <Button\n variant=\"transparent\"\n className=\"bg-transparent p-0 text-orange-950 hover:bg-transparent focus:bg-transparent active:bg-transparent disabled:text-orange-500\"\n size=\"base\"\n disabled={isPending}\n onClick={handleSubmit}\n >\n {actionText}\n </Button>\n </div>\n </div>\n );\n}\n\nexport { CartMismatchBanner };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/cart-mismatch-banner/index.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\n\nimport { ExclamationCircleSolid } from '@medusajs/icons';\nimport { Button } from '@medusajs/ui';\n\nimport { useStorefrontContext } from '@/lib/data/context';\nimport { transferCart } from '@/lib/data/customer';\nimport { Customer } from '@/types/graphql';\nimport { Cart } from '@/types/graphql';\n\nfunction CartMismatchBanner(props: { customer: Customer; cart: Cart }) {\n const { customer, cart } = props;\n const [isPending, setIsPending] = useState(false);\n const [actionText, setActionText] = useState('Run transfer again');\n const ctx = useStorefrontContext();\n\n if (!customer || !!cart.customerId) {\n return;\n }\n\n const handleSubmit = async () => {\n try {\n setIsPending(true);\n setActionText('Transferring..');\n\n await transferCart(ctx);\n } catch {\n setActionText('Run transfer again');\n setIsPending(false);\n }\n };\n\n return (\n <div className=\"small:gap-2 small:p-4 mt-2 flex items-center justify-center gap-1 bg-orange-300 p-2 text-center text-sm text-orange-800\">\n <div className=\"small:flex-row small:gap-2 flex flex-col items-center gap-1\">\n <span className=\"flex items-center gap-1\">\n <ExclamationCircleSolid className=\"inline\" />\n Something went wrong when we tried to transfer your cart\n </span>\n\n <span>·</span>\n\n <Button\n variant=\"transparent\"\n className=\"bg-transparent p-0 text-orange-950 hover:bg-transparent focus:bg-transparent active:bg-transparent disabled:text-orange-500\"\n size=\"base\"\n disabled={isPending}\n onClick={handleSubmit}\n >\n {actionText}\n </Button>\n </div>\n </div>\n );\n}\n\nexport { CartMismatchBanner };\n"],"mappings":";;;;;;;;;;AAYA,SAAS,mBAAmB,OAA2C;CACrE,MAAM,EAAE,UAAU,SAAS;CAC3B,MAAM,CAAC,WAAW,gBAAgB,SAAS,MAAM;CACjD,MAAM,CAAC,YAAY,iBAAiB,SAAS,qBAAqB;CAClE,MAAM,MAAM,sBAAsB;AAElC,KAAI,CAAC,YAAY,CAAC,CAAC,KAAK,WACtB;CAGF,MAAM,eAAe,YAAY;AAC/B,MAAI;AACF,gBAAa,KAAK;AAClB,iBAAc,iBAAiB;AAE/B,SAAM,aAAa,IAAI;UACjB;AACN,iBAAc,qBAAqB;AACnC,gBAAa,MAAM;;;AAIvB,QACE,oBAAC;EAAI,WAAU;YACb,qBAAC;GAAI,WAAU;;IACb,qBAAC;KAAK,WAAU;gBACd,oBAAC,0BAAuB,WAAU,WAAW;MAExC;IAEP,oBAAC,oBAAK,MAAQ;IAEd,oBAAC;KACC,SAAQ;KACR,WAAU;KACV,MAAK;KACL,UAAU;KACV,SAAS;eAER;MACM;;IACL;GACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime10 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/components/delete-button/index.d.ts
|
|
4
4
|
declare const DeleteButton: ({
|
|
@@ -9,7 +9,7 @@ declare const DeleteButton: ({
|
|
|
9
9
|
id: string;
|
|
10
10
|
children?: React.ReactNode;
|
|
11
11
|
className?: string;
|
|
12
|
-
}) =>
|
|
12
|
+
}) => react_jsx_runtime10.JSX.Element;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { DeleteButton };
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/delete-button/index.tsx"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/delete-button/index.tsx"],"sourcesContent":[],"mappings":";;;cAQM;;;;;;aAMO,KAAA,CAAM;EANb,SAAA,CAAA,EAAA,MAmCL;CAnCqB,EAAA,GAQrB,mBAAA,CAAA,GAAA,CAAA,OARqB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { deleteLineItem } from "../../lib/data/cart.js";
|
|
2
|
+
import { useStorefrontContext } from "../../lib/data/context.js";
|
|
2
3
|
import { useState } from "react";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { Spinner, Trash } from "@medusajs/icons";
|
|
@@ -6,10 +7,11 @@ import { clx } from "@medusajs/ui";
|
|
|
6
7
|
|
|
7
8
|
//#region src/components/delete-button/index.tsx
|
|
8
9
|
const DeleteButton = ({ id, children, className }) => {
|
|
10
|
+
const ctx = useStorefrontContext();
|
|
9
11
|
const [isDeleting, setIsDeleting] = useState(false);
|
|
10
12
|
const handleDelete = async (id$1) => {
|
|
11
13
|
setIsDeleting(true);
|
|
12
|
-
await deleteLineItem(id$1).catch((err) => {
|
|
14
|
+
await deleteLineItem(id$1, ctx).catch((err) => {
|
|
13
15
|
setIsDeleting(false);
|
|
14
16
|
});
|
|
15
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["id"],"sources":["../../../src/components/delete-button/index.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport { Spinner, Trash } from '@medusajs/icons';\nimport { clx } from '@medusajs/ui';\n\nimport { deleteLineItem } from '@/lib/data/cart';\n\nconst DeleteButton = ({\n id,\n children,\n className,\n}: {\n id: string;\n children?: React.ReactNode;\n className?: string;\n}) => {\n const [isDeleting, setIsDeleting] = useState(false);\n\n const handleDelete = async (id: string) => {\n setIsDeleting(true);\n await deleteLineItem(id).catch((err) => {\n setIsDeleting(false);\n });\n };\n\n return (\n <div\n className={clx(\n 'text-small-regular flex items-center justify-between',\n className\n )}\n >\n <button\n className=\"text-ui-fg-subtle hover:text-ui-fg-base flex cursor-pointer gap-x-1\"\n onClick={() => handleDelete(id)}\n >\n {isDeleting ? <Spinner className=\"animate-spin\" /> : <Trash />}\n <span>{children}</span>\n </button>\n </div>\n );\n};\n\nexport { DeleteButton };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["id"],"sources":["../../../src/components/delete-button/index.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport { Spinner, Trash } from '@medusajs/icons';\nimport { clx } from '@medusajs/ui';\n\nimport { deleteLineItem } from '@/lib/data/cart';\nimport { useStorefrontContext } from '@/lib/data/context';\n\nconst DeleteButton = ({\n id,\n children,\n className,\n}: {\n id: string;\n children?: React.ReactNode;\n className?: string;\n}) => {\n const ctx = useStorefrontContext();\n const [isDeleting, setIsDeleting] = useState(false);\n\n const handleDelete = async (id: string) => {\n setIsDeleting(true);\n await deleteLineItem(id, ctx).catch((err) => {\n setIsDeleting(false);\n });\n };\n\n return (\n <div\n className={clx(\n 'text-small-regular flex items-center justify-between',\n className\n )}\n >\n <button\n className=\"text-ui-fg-subtle hover:text-ui-fg-base flex cursor-pointer gap-x-1\"\n onClick={() => handleDelete(id)}\n >\n {isDeleting ? <Spinner className=\"animate-spin\" /> : <Trash />}\n <span>{children}</span>\n </button>\n </div>\n );\n};\n\nexport { DeleteButton };\n"],"mappings":";;;;;;;;AAQA,MAAM,gBAAgB,EACpB,IACA,UACA,gBAKI;CACJ,MAAM,MAAM,sBAAsB;CAClC,MAAM,CAAC,YAAY,iBAAiB,SAAS,MAAM;CAEnD,MAAM,eAAe,OAAO,SAAe;AACzC,gBAAc,KAAK;AACnB,QAAM,eAAeA,MAAI,IAAI,CAAC,OAAO,QAAQ;AAC3C,iBAAc,MAAM;IACpB;;AAGJ,QACE,oBAAC;EACC,WAAW,IACT,wDACA,UACD;YAED,qBAAC;GACC,WAAU;GACV,eAAe,aAAa,GAAG;cAE9B,aAAa,oBAAC,WAAQ,WAAU,iBAAiB,GAAG,oBAAC,UAAQ,EAC9D,oBAAC,UAAM,WAAgB;IAChB;GACL"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime12 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/components/error-message/index.d.ts
|
|
4
4
|
declare const ErrorMessage: ({
|
|
@@ -7,7 +7,7 @@ declare const ErrorMessage: ({
|
|
|
7
7
|
}: {
|
|
8
8
|
error?: string | null;
|
|
9
9
|
"data-testid"?: string;
|
|
10
|
-
}) =>
|
|
10
|
+
}) => react_jsx_runtime12.JSX.Element | null;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { ErrorMessage };
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/error-message/index.tsx"],"sourcesContent":[],"mappings":";;;cAAM;;iBAAgB;AAMrB;;;AAAA,CAAA,EAAA,GAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/error-message/index.tsx"],"sourcesContent":[],"mappings":";;;cAAM;;iBAAgB;AAMrB;;;AAAA,CAAA,EAAA,GAAA,mBAAA,CAAA,GAAA,CAAA,OAAA,GAaA,IAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Cart } from "../../types/graphql.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
3
3
|
import { StoreCartShippingOption } from "@medusajs/types";
|
|
4
4
|
|
|
5
5
|
//#region src/components/free-shipping-price-nudge/index.d.ts
|
|
@@ -11,7 +11,7 @@ declare function ShippingPriceNudge({
|
|
|
11
11
|
variant?: 'popup' | 'inline';
|
|
12
12
|
cart: Cart;
|
|
13
13
|
shippingOptions: StoreCartShippingOption[];
|
|
14
|
-
}):
|
|
14
|
+
}): react_jsx_runtime11.JSX.Element | undefined;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { ShippingPriceNudge };
|
|
17
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/free-shipping-price-nudge/index.tsx"],"sourcesContent":[],"mappings":";;;;;iBA0ES,kBAAA;;;;;;QAMD;EANC,eAAA,EAOU,uBAPQ,EAAA;CACzB,CAAA,EAOD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/free-shipping-price-nudge/index.tsx"],"sourcesContent":[],"mappings":";;;;;iBA0ES,kBAAA;;;;;;QAMD;EANC,eAAA,EAOU,uBAPQ,EAAA;CACzB,CAAA,EAOD,mBAAA,CAAA,GAAA,CAAA,OAAA,GAPC,SAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime15 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/components/interactive-link/index.d.ts
|
|
4
4
|
type InteractiveLinkProps = {
|
|
@@ -11,7 +11,7 @@ declare const InteractiveLink: ({
|
|
|
11
11
|
children,
|
|
12
12
|
onClick,
|
|
13
13
|
...props
|
|
14
|
-
}: InteractiveLinkProps) =>
|
|
14
|
+
}: InteractiveLinkProps) => react_jsx_runtime15.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { InteractiveLink };
|
|
17
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/interactive-link/index.tsx"],"sourcesContent":[],"mappings":";;;KAKK,oBAAA;;aAEQ,KAAA,CAAM;EAFd,OAAA,CAAA,EAAA,GAAA,GAAA,IAAA;AAEuB,CAAA;cAItB,eAAmB,EAAA,CAAA;EAAA,IAAA;EAAA,QAAA;EAAA,OAAA;EAAA,GAAA;AAAA,CAAA,EAKtB,oBALsB,EAAA,GAKF,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/interactive-link/index.tsx"],"sourcesContent":[],"mappings":";;;KAKK,oBAAA;;aAEQ,KAAA,CAAM;EAFd,OAAA,CAAA,EAAA,GAAA,GAAA,IAAA;AAEuB,CAAA;cAItB,eAAmB,EAAA,CAAA;EAAA,IAAA;EAAA,QAAA;EAAA,OAAA;EAAA,GAAA;AAAA,CAAA,EAKtB,oBALsB,EAAA,GAKF,mBAAA,CAAA,GAAA,CAAA,OALE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Maybe, ProductVariant } from "../../types/graphql.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime13 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/line-item-options/index.d.ts
|
|
5
5
|
type LineItemOptionsProps = {
|
|
@@ -11,7 +11,7 @@ declare const LineItemOptions: ({
|
|
|
11
11
|
variant,
|
|
12
12
|
"data-testid": dataTestid,
|
|
13
13
|
"data-value": dataValue
|
|
14
|
-
}: LineItemOptionsProps) =>
|
|
14
|
+
}: LineItemOptionsProps) => react_jsx_runtime13.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { LineItemOptions };
|
|
17
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LineItem } from "../../types/graphql.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/line-item-price/index.d.ts
|
|
5
5
|
type LineItemPriceProps = {
|
|
@@ -11,7 +11,7 @@ declare const LineItemPrice: ({
|
|
|
11
11
|
item,
|
|
12
12
|
style,
|
|
13
13
|
currencyCode
|
|
14
|
-
}: LineItemPriceProps) =>
|
|
14
|
+
}: LineItemPriceProps) => react_jsx_runtime3.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { LineItemPrice };
|
|
17
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/line-item-price/index.tsx"],"sourcesContent":[],"mappings":";;;;KAMK,kBAAA;QACG;;EADH,YAAA,EAAA,MAAA;AACW,CAAA;cAKV,aAAiB,EAAA,CAAA;EAAA,IAAA;EAAA,KAAA;EAAA;AAAA,CAAA,EAIpB,kBAJoB,EAAA,GAIF,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/line-item-price/index.tsx"],"sourcesContent":[],"mappings":";;;;KAMK,kBAAA;QACG;;EADH,YAAA,EAAA,MAAA;AACW,CAAA;cAKV,aAAiB,EAAA,CAAA;EAAA,IAAA;EAAA,KAAA;EAAA;AAAA,CAAA,EAIpB,kBAJoB,EAAA,GAIF,kBAAA,CAAA,GAAA,CAAA,OAJE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnchorHTMLAttributes, DetailedHTMLProps } from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/localized-client-link/index.d.ts
|
|
5
5
|
type LocalizedClientLinkProps = DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
|
|
@@ -11,7 +11,7 @@ declare const LocalizedClientLink: ({
|
|
|
11
11
|
children,
|
|
12
12
|
href,
|
|
13
13
|
...props
|
|
14
|
-
}: LocalizedClientLinkProps) =>
|
|
14
|
+
}: LocalizedClientLinkProps) => react_jsx_runtime4.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { LocalizedClientLink };
|
|
17
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/localized-client-link/index.tsx"],"sourcesContent":[],"mappings":";;;;KAEK,wBAAA,GAA2B,kBAC9B,qBAAqB,oBACrB;;;AAJ8D;;cAW1D,mBARJ,EAAA,CAAA;EAAA,QAAA;EAAA,IAAA;EAAA,GAAA;AAAA,CAAA,EAYC,wBAZD,EAAA,GAYyB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/localized-client-link/index.tsx"],"sourcesContent":[],"mappings":";;;;KAEK,wBAAA,GAA2B,kBAC9B,qBAAqB,oBACrB;;;AAJ8D;;cAW1D,mBARJ,EAAA,CAAA;EAAA,QAAA;EAAA,IAAA;EAAA,GAAA;AAAA,CAAA,EAYC,wBAZD,EAAA,GAYyB,kBAAA,CAAA,GAAA,CAAA,OAZzB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/modal/index.d.ts
|
|
5
5
|
type ModalProps = {
|
|
@@ -20,7 +20,7 @@ declare const Modal: {
|
|
|
20
20
|
children,
|
|
21
21
|
"data-testid": dataTestId,
|
|
22
22
|
"aria-label": ariaLabel
|
|
23
|
-
}: ModalProps):
|
|
23
|
+
}: ModalProps): react_jsx_runtime5.JSX.Element;
|
|
24
24
|
Title: React.FC<{
|
|
25
25
|
children: React.ReactNode;
|
|
26
26
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/modal/index.tsx"],"sourcesContent":[],"mappings":";;;;KAQK,UAAA;;;EAAA,IAAA,CAAA,EAAA,OAAU,GAAA,QAAA,GAKH,OAAM;EAKZ,MAAA,CAAA,EAqEL,OAAA;YA1EW,KAAA,CAAM;;;;cAKZ;;;;;;;;;KAQH,aAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/modal/index.tsx"],"sourcesContent":[],"mappings":";;;;KAQK,UAAA;;;EAAA,IAAA,CAAA,EAAA,OAAU,GAAA,QAAA,GAKH,OAAM;EAKZ,MAAA,CAAA,EAqEL,OAAA;YA1EW,KAAA,CAAM;;;;cAKZ;;;;;;;;;KAQH,aAAU,kBAAA,CAAA,GAAA,CAAA;;IAAV,QAAA,EA+D+B,KAAA,CAAM,SA/DrC;EAAU,CAAA,CAAA;EA+DqB,WAAM,UAAA,CAAA;cAeA,KAAA,CAAM;EAAN,CAAA,CAAA;;IAQD,QAAA,EAAN,KAAA,CAAM,SAAA;;EAIJ,MAAM,UAAA,CAAA;cAAN,KAAA,CAAM"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { VariantPrice } from "../../types/prices.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime6 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/preview-price/index.d.ts
|
|
5
5
|
declare function PreviewPrice({
|
|
6
6
|
price
|
|
7
7
|
}: {
|
|
8
8
|
price: VariantPrice;
|
|
9
|
-
}):
|
|
9
|
+
}): react_jsx_runtime6.JSX.Element | null;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { PreviewPrice };
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/preview-price/index.tsx"],"sourcesContent":[],"mappings":";;;;iBAIS,YAAA;;;SAAiC;IAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/preview-price/index.tsx"],"sourcesContent":[],"mappings":";;;;iBAIS,YAAA;;;SAAiC;IAAc,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Product } from "../../types/graphql.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime7 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/product-preview/index.d.ts
|
|
5
5
|
type ProductPreviewProps = {
|
|
@@ -9,7 +9,7 @@ type ProductPreviewProps = {
|
|
|
9
9
|
declare function ProductPreview({
|
|
10
10
|
product,
|
|
11
11
|
isFeatured
|
|
12
|
-
}: ProductPreviewProps):
|
|
12
|
+
}: ProductPreviewProps): react_jsx_runtime7.JSX.Element;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { ProductPreview, ProductPreviewProps };
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/submit-button/index.d.ts
|
|
5
5
|
declare function SubmitButton({
|
|
@@ -14,7 +14,7 @@ declare function SubmitButton({
|
|
|
14
14
|
className?: string;
|
|
15
15
|
'data-testid'?: string;
|
|
16
16
|
isLoading?: boolean;
|
|
17
|
-
}):
|
|
17
|
+
}): react_jsx_runtime2.JSX.Element;
|
|
18
18
|
//#endregion
|
|
19
19
|
export { SubmitButton };
|
|
20
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { PropsWithChildren } from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/context/apollo-context.d.ts
|
|
5
5
|
declare function ApolloClientProvider({
|
|
6
6
|
children
|
|
7
|
-
}: PropsWithChildren):
|
|
7
|
+
}: PropsWithChildren): react_jsx_runtime1.JSX.Element;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { ApolloClientProvider };
|
|
10
10
|
//# sourceMappingURL=apollo-context.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/context/modal-context.d.ts
|
|
5
5
|
interface ModalContext {
|
|
@@ -13,7 +13,7 @@ interface ModalProviderProps {
|
|
|
13
13
|
declare const ModalProvider: ({
|
|
14
14
|
children,
|
|
15
15
|
close
|
|
16
|
-
}: ModalProviderProps) =>
|
|
16
|
+
}: ModalProviderProps) => react_jsx_runtime0.JSX.Element;
|
|
17
17
|
declare const useModal: () => ModalContext;
|
|
18
18
|
//#endregion
|
|
19
19
|
export { ModalProvider, useModal };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart.d.ts","names":[],"sources":["../../../src/lib/data/cart.ts"],"sourcesContent":[],"mappings":";;;;;cA2Ba,oBACN,sBACJ,QAAQ;cAmBE,mBACL,0CACD,sBACJ,QAAQ;AAxBE,
|
|
1
|
+
{"version":3,"file":"cart.d.ts","names":[],"sources":["../../../src/lib/data/cart.ts"],"sourcesContent":[],"mappings":";;;;;cA2Ba,oBACN,sBACJ,QAAQ;cAmBE,mBACL,0CACD,sBACJ,QAAQ;AAxBE,cA8DA,cA3CZ,EAAA,CAAA,MAAA,EAAA,MAAA,EAAA,GAAA,EA6CM,iBA7CN,EAAA,GA8CE,OA9CF,CA8CU,sBA9CV,CAAA,gBAAA,CAAA,GAAA,IAAA,CAAA;AAlBM,iBAyGe,eAAA,CAzGf,GAAA,EAyGoC,iBAzGpC,CAAA,EAyGqD,OAzGrD,CAAA;EACI,gBAAA,EAkHW,SAAA,CAAU,uBAlHrB,EAAA;CAAR,CAAA"}
|
package/dist/lib/data/cart.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { graphqlFetch, graphqlMutation } from "../gql/apollo-client.js";
|
|
2
|
-
import { DELETE_LINE_ITEM_MUTATION, UPDATE_CART_MUTATION } from "../gql/mutations/cart.js";
|
|
3
|
-
import { medusaError } from "../utils/medusa-error.js";
|
|
4
1
|
import { getAuthHeaders, getCacheOptions, getCacheTag, getCartId } from "./cookies.js";
|
|
5
2
|
import { sdk } from "../config/medusa.js";
|
|
3
|
+
import { graphqlFetch, graphqlMutation } from "../gql/apollo-client.js";
|
|
4
|
+
import { DELETE_LINE_ITEM_MUTATION, UPDATE_CART_MUTATION } from "../gql/mutations/cart.js";
|
|
6
5
|
import { GET_CART_QUERY } from "../gql/queries/cart.js";
|
|
6
|
+
import { medusaError } from "../utils/medusa-error.js";
|
|
7
7
|
|
|
8
8
|
//#region src/lib/data/cart.ts
|
|
9
9
|
const retrieveCart = async (ctx) => {
|
|
@@ -30,11 +30,10 @@ const updateCart = async (data, ctx) => {
|
|
|
30
30
|
data
|
|
31
31
|
}
|
|
32
32
|
}))?.updateCart ?? null;
|
|
33
|
-
if (cart
|
|
34
|
-
const
|
|
35
|
-
ctx
|
|
36
|
-
|
|
37
|
-
ctx.revalidate(fulfillmentCacheTag);
|
|
33
|
+
if (cart) {
|
|
34
|
+
const { revalidateTag } = await import("next/cache");
|
|
35
|
+
revalidateTag(getCacheTag("carts", ctx));
|
|
36
|
+
revalidateTag(getCacheTag("fulfillment", ctx));
|
|
38
37
|
}
|
|
39
38
|
return cart;
|
|
40
39
|
} catch (err) {
|
|
@@ -53,11 +52,10 @@ const deleteLineItem = async (lineId, ctx) => {
|
|
|
53
52
|
lineItemId: lineId
|
|
54
53
|
}
|
|
55
54
|
}))?.deleteLineItem ?? null;
|
|
56
|
-
if (deletedLineItem
|
|
57
|
-
const
|
|
58
|
-
ctx
|
|
59
|
-
|
|
60
|
-
ctx.revalidate(fulfillmentCacheTag);
|
|
55
|
+
if (deletedLineItem) {
|
|
56
|
+
const { revalidateTag } = await import("next/cache");
|
|
57
|
+
revalidateTag(getCacheTag("carts", ctx));
|
|
58
|
+
revalidateTag(getCacheTag("fulfillment", ctx));
|
|
61
59
|
}
|
|
62
60
|
return deletedLineItem;
|
|
63
61
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart.js","names":["error: any"],"sources":["../../../src/lib/data/cart.ts"],"sourcesContent":["import { HttpTypes } from '@medusajs/types';\n\nimport {\n Cart,\n DeleteLineItemMutation,\n DeleteLineItemMutationVariables,\n GetCartQuery,\n GetCartQueryVariables,\n UpdateCartMutation,\n UpdateCartMutationVariables,\n} from '../../types/graphql';\nimport { sdk } from '../config/medusa';\nimport { graphqlFetch, graphqlMutation } from '../gql/apollo-client';\nimport {\n DELETE_LINE_ITEM_MUTATION,\n UPDATE_CART_MUTATION,\n} from '../gql/mutations/cart';\nimport { GET_CART_QUERY } from '../gql/queries/cart';\nimport { medusaError } from '../utils/medusa-error';\nimport type { StorefrontContext } from './context';\nimport {\n getAuthHeaders,\n getCacheOptions,\n getCacheTag,\n getCartId,\n} from './cookies';\n\nexport const retrieveCart = async (\n ctx: StorefrontContext\n): Promise<Cart | null> => {\n const id = getCartId(ctx);\n if (!id) {\n return null;\n }\n\n try {\n const data = await graphqlFetch<GetCartQuery, GetCartQueryVariables>({\n query: GET_CART_QUERY,\n variables: { id },\n });\n\n return data?.cart ?? null;\n } catch (error) {\n console.error('Failed to fetch cart:', error);\n return null;\n }\n};\n\nexport const updateCart = async (\n data: UpdateCartMutationVariables['data'],\n ctx: StorefrontContext\n): Promise<UpdateCartMutation['updateCart'] | null> => {\n const cartId = getCartId(ctx);\n\n if (!cartId) {\n throw new Error(\n 'No existing cart found, please create one before updating'\n );\n }\n\n try {\n const result = await graphqlMutation<\n UpdateCartMutation,\n UpdateCartMutationVariables\n >({\n mutation: UPDATE_CART_MUTATION,\n variables: {\n id: cartId,\n data,\n },\n });\n\n const cart = result?.updateCart ?? null;\n\n if (cart
|
|
1
|
+
{"version":3,"file":"cart.js","names":["error: any"],"sources":["../../../src/lib/data/cart.ts"],"sourcesContent":["import { HttpTypes } from '@medusajs/types';\n\nimport {\n Cart,\n DeleteLineItemMutation,\n DeleteLineItemMutationVariables,\n GetCartQuery,\n GetCartQueryVariables,\n UpdateCartMutation,\n UpdateCartMutationVariables,\n} from '../../types/graphql';\nimport { sdk } from '../config/medusa';\nimport { graphqlFetch, graphqlMutation } from '../gql/apollo-client';\nimport {\n DELETE_LINE_ITEM_MUTATION,\n UPDATE_CART_MUTATION,\n} from '../gql/mutations/cart';\nimport { GET_CART_QUERY } from '../gql/queries/cart';\nimport { medusaError } from '../utils/medusa-error';\nimport type { StorefrontContext } from './context';\nimport {\n getAuthHeaders,\n getCacheOptions,\n getCacheTag,\n getCartId,\n} from './cookies';\n\nexport const retrieveCart = async (\n ctx: StorefrontContext\n): Promise<Cart | null> => {\n const id = getCartId(ctx);\n if (!id) {\n return null;\n }\n\n try {\n const data = await graphqlFetch<GetCartQuery, GetCartQueryVariables>({\n query: GET_CART_QUERY,\n variables: { id },\n });\n\n return data?.cart ?? null;\n } catch (error) {\n console.error('Failed to fetch cart:', error);\n return null;\n }\n};\n\nexport const updateCart = async (\n data: UpdateCartMutationVariables['data'],\n ctx: StorefrontContext\n): Promise<UpdateCartMutation['updateCart'] | null> => {\n const cartId = getCartId(ctx);\n\n if (!cartId) {\n throw new Error(\n 'No existing cart found, please create one before updating'\n );\n }\n\n try {\n const result = await graphqlMutation<\n UpdateCartMutation,\n UpdateCartMutationVariables\n >({\n mutation: UPDATE_CART_MUTATION,\n variables: {\n id: cartId,\n data,\n },\n });\n\n const cart = result?.updateCart ?? null;\n\n if (cart) {\n const { revalidateTag } = await import('next/cache');\n const cartCacheTag = getCacheTag('carts', ctx);\n revalidateTag(cartCacheTag);\n\n const fulfillmentCacheTag = getCacheTag('fulfillment', ctx);\n revalidateTag(fulfillmentCacheTag);\n }\n\n return cart;\n } catch (err) {\n medusaError(err);\n }\n};\n\nexport const deleteLineItem = async (\n lineId: string,\n ctx: StorefrontContext\n): Promise<DeleteLineItemMutation['deleteLineItem'] | null> => {\n if (!lineId) {\n throw new Error('Missing lineItem ID when deleting line item');\n }\n\n const cartId = getCartId(ctx);\n\n if (!cartId) {\n throw new Error('Missing cart ID when deleting line item');\n }\n\n try {\n const result = await graphqlMutation<\n DeleteLineItemMutation,\n DeleteLineItemMutationVariables\n >({\n mutation: DELETE_LINE_ITEM_MUTATION,\n variables: {\n cartId,\n lineItemId: lineId,\n },\n });\n\n const deletedLineItem = result?.deleteLineItem ?? null;\n\n if (deletedLineItem) {\n const { revalidateTag } = await import('next/cache');\n const cartCacheTag = getCacheTag('carts', ctx);\n revalidateTag(cartCacheTag);\n\n const fulfillmentCacheTag = getCacheTag('fulfillment', ctx);\n revalidateTag(fulfillmentCacheTag);\n }\n\n return deletedLineItem;\n } catch (error: any) {\n console.error('GraphQL deleteLineItem error:', error.message);\n throw error;\n }\n};\n\nexport async function listCartOptions(ctx: StorefrontContext) {\n const cartId = getCartId(ctx);\n const headers = {\n ...getAuthHeaders(ctx),\n };\n const next = {\n ...getCacheOptions('shippingOptions', ctx),\n };\n\n return await sdk.client.fetch<{\n shipping_options: HttpTypes.StoreCartShippingOption[];\n }>('/store/shipping-options', {\n query: { cart_id: cartId },\n next,\n headers,\n cache: 'force-cache',\n });\n}\n"],"mappings":";;;;;;;;AA2BA,MAAa,eAAe,OAC1B,QACyB;CACzB,MAAM,KAAK,UAAU,IAAI;AACzB,KAAI,CAAC,GACH,QAAO;AAGT,KAAI;AAMF,UALa,MAAM,aAAkD;GACnE,OAAO;GACP,WAAW,EAAE,IAAI;GAClB,CAAC,GAEW,QAAQ;UACd,OAAO;AACd,UAAQ,MAAM,yBAAyB,MAAM;AAC7C,SAAO;;;AAIX,MAAa,aAAa,OACxB,MACA,QACqD;CACrD,MAAM,SAAS,UAAU,IAAI;AAE7B,KAAI,CAAC,OACH,OAAM,IAAI,MACR,4DACD;AAGH,KAAI;EAYF,MAAM,QAXS,MAAM,gBAGnB;GACA,UAAU;GACV,WAAW;IACT,IAAI;IACJ;IACD;GACF,CAAC,GAEmB,cAAc;AAEnC,MAAI,MAAM;GACR,MAAM,EAAE,kBAAkB,MAAM,OAAO;AAEvC,iBADqB,YAAY,SAAS,IAAI,CACnB;AAG3B,iBAD4B,YAAY,eAAe,IAAI,CACzB;;AAGpC,SAAO;UACA,KAAK;AACZ,cAAY,IAAI;;;AAIpB,MAAa,iBAAiB,OAC5B,QACA,QAC6D;AAC7D,KAAI,CAAC,OACH,OAAM,IAAI,MAAM,8CAA8C;CAGhE,MAAM,SAAS,UAAU,IAAI;AAE7B,KAAI,CAAC,OACH,OAAM,IAAI,MAAM,0CAA0C;AAG5D,KAAI;EAYF,MAAM,mBAXS,MAAM,gBAGnB;GACA,UAAU;GACV,WAAW;IACT;IACA,YAAY;IACb;GACF,CAAC,GAE8B,kBAAkB;AAElD,MAAI,iBAAiB;GACnB,MAAM,EAAE,kBAAkB,MAAM,OAAO;AAEvC,iBADqB,YAAY,SAAS,IAAI,CACnB;AAG3B,iBAD4B,YAAY,eAAe,IAAI,CACzB;;AAGpC,SAAO;UACAA,OAAY;AACnB,UAAQ,MAAM,iCAAiC,MAAM,QAAQ;AAC7D,QAAM;;;AAIV,eAAsB,gBAAgB,KAAwB;CAC5D,MAAM,SAAS,UAAU,IAAI;CAC7B,MAAM,UAAU,EACd,GAAG,eAAe,IAAI,EACvB;CACD,MAAM,OAAO,EACX,GAAG,gBAAgB,mBAAmB,IAAI,EAC3C;AAED,QAAO,MAAM,IAAI,OAAO,MAErB,2BAA2B;EAC5B,OAAO,EAAE,SAAS,QAAQ;EAC1B;EACA;EACA,OAAO;EACR,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { removeAuthTokenAction, removeCartIdAction, setAuthTokenAction, setCartIdAction } from "./cookies.js";
|
|
2
|
+
import { updateRegionAction } from "./next-context.js";
|
|
3
|
+
|
|
4
|
+
//#region src/lib/data/client-actions.d.ts
|
|
5
|
+
declare const useStorefrontActions: () => {
|
|
6
|
+
setCartId: typeof setCartIdAction;
|
|
7
|
+
removeCartId: typeof removeCartIdAction;
|
|
8
|
+
setAuthToken: typeof setAuthTokenAction;
|
|
9
|
+
removeAuthToken: typeof removeAuthTokenAction;
|
|
10
|
+
updateRegion: typeof updateRegionAction;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { useStorefrontActions };
|
|
14
|
+
//# sourceMappingURL=client-actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-actions.d.ts","names":[],"sources":["../../../src/lib/data/client-actions.tsx"],"sourcesContent":[],"mappings":";;;;cAUa;;EAAA,YAAA,EAAA,yBAQZ"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { removeAuthTokenAction, removeCartIdAction, setAuthTokenAction, setCartIdAction } from "./cookies.js";
|
|
4
|
+
import { updateRegionAction } from "./next-context.js";
|
|
5
|
+
|
|
6
|
+
//#region src/lib/data/client-actions.tsx
|
|
7
|
+
const useStorefrontActions = () => {
|
|
8
|
+
return {
|
|
9
|
+
setCartId: setCartIdAction,
|
|
10
|
+
removeCartId: removeCartIdAction,
|
|
11
|
+
setAuthToken: setAuthTokenAction,
|
|
12
|
+
removeAuthToken: removeAuthTokenAction,
|
|
13
|
+
updateRegion: updateRegionAction
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { useStorefrontActions };
|
|
19
|
+
//# sourceMappingURL=client-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-actions.js","names":[],"sources":["../../../src/lib/data/client-actions.tsx"],"sourcesContent":["'use client';\n\nimport {\n removeAuthTokenAction,\n removeCartIdAction,\n setAuthTokenAction,\n setCartIdAction,\n} from './cookies';\nimport { updateRegionAction } from './next-context';\n\nexport const useStorefrontActions = () => {\n return {\n setCartId: setCartIdAction,\n removeCartId: removeCartIdAction,\n setAuthToken: setAuthTokenAction,\n removeAuthToken: removeAuthTokenAction,\n updateRegion: updateRegionAction,\n };\n};\n"],"mappings":";;;;;;AAUA,MAAa,6BAA6B;AACxC,QAAO;EACL,WAAW;EACX,cAAc;EACd,cAAc;EACd,iBAAiB;EACjB,cAAc;EACf"}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
+
import { useStorefrontActions } from "./client-actions.js";
|
|
1
2
|
import { ReactNode } from "react";
|
|
2
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime9 from "react/jsx-runtime";
|
|
3
4
|
|
|
4
5
|
//#region src/lib/data/context.d.ts
|
|
5
6
|
interface StorefrontContext {
|
|
6
|
-
cartId
|
|
7
|
-
customerToken
|
|
8
|
-
cacheId
|
|
9
|
-
cookieHeader
|
|
7
|
+
cartId: string;
|
|
8
|
+
customerToken: string;
|
|
9
|
+
cacheId: string;
|
|
10
|
+
cookieHeader: string;
|
|
10
11
|
revalidate?: (tag: string) => void;
|
|
11
|
-
updateRegion?: (countryCode: string, currentPath: string) => Promise<void>;
|
|
12
|
-
setCartId?: (id: string) => Promise<void>;
|
|
13
|
-
removeCartId?: () => Promise<void>;
|
|
14
|
-
setAuthToken?: (token: string) => Promise<void>;
|
|
15
|
-
removeAuthToken?: () => Promise<void>;
|
|
16
12
|
}
|
|
17
13
|
declare const StorefrontProvider: ({
|
|
18
14
|
children,
|
|
@@ -20,8 +16,8 @@ declare const StorefrontProvider: ({
|
|
|
20
16
|
}: {
|
|
21
17
|
children: ReactNode;
|
|
22
18
|
value: StorefrontContext;
|
|
23
|
-
}) =>
|
|
19
|
+
}) => react_jsx_runtime9.JSX.Element;
|
|
24
20
|
declare const useStorefrontContext: () => StorefrontContext;
|
|
25
21
|
//#endregion
|
|
26
|
-
export { StorefrontContext, StorefrontProvider, useStorefrontContext };
|
|
22
|
+
export { StorefrontContext, StorefrontProvider, useStorefrontActions, useStorefrontContext };
|
|
27
23
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","names":[],"sources":["../../../src/lib/data/context.tsx"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.ts","names":[],"sources":["../../../src/lib/data/context.tsx"],"sourcesContent":[],"mappings":";;;;;UAIiB,iBAAA;;;;EAAA,YAAA,EAAA,MAAiB;EAYrB,UAAA,CAAA,EAAA,CAAA,GAAA,EAAA,MAYZ,EAAA,GAAA,IAAA;;AAZkC,cAAtB,kBAAsB,EAAA,CAAA;EAAA,QAAA;EAAA;CAAA,EAAA;EAIvB,QAAA,EAAA,SAAA;EACH,KAAA,EAAA,iBAAA;CACR,EAAA,GAAA,kBAAA,CAAA,GAAA,CAAA,OAAA;AAMA,cAEY,oBAFZ,EAAA,GAAA,GAEgC,iBAFhC"}
|
package/dist/lib/data/context.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { useStorefrontActions } from "./client-actions.js";
|
|
3
4
|
import { createContext, useContext } from "react";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
|
|
@@ -14,5 +15,5 @@ const StorefrontProvider = ({ children, value }) => {
|
|
|
14
15
|
const useStorefrontContext = () => useContext(StorefrontReactContext);
|
|
15
16
|
|
|
16
17
|
//#endregion
|
|
17
|
-
export { StorefrontProvider, useStorefrontContext };
|
|
18
|
+
export { StorefrontProvider, useStorefrontActions, useStorefrontContext };
|
|
18
19
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","names":[],"sources":["../../../src/lib/data/context.tsx"],"sourcesContent":["'use client';\n\nimport { type ReactNode, createContext, useContext } from 'react';\n\nexport interface StorefrontContext {\n cartId
|
|
1
|
+
{"version":3,"file":"context.js","names":[],"sources":["../../../src/lib/data/context.tsx"],"sourcesContent":["'use client';\n\nimport { type ReactNode, createContext, useContext } from 'react';\n\nexport interface StorefrontContext {\n cartId: string;\n customerToken: string;\n cacheId: string;\n cookieHeader: string;\n revalidate?: (tag: string) => void;\n}\n\nconst StorefrontReactContext = createContext<StorefrontContext>(\n {} as StorefrontContext\n);\n\nexport const StorefrontProvider = ({\n children,\n value,\n}: {\n children: ReactNode;\n value: StorefrontContext;\n}) => {\n return (\n <StorefrontReactContext.Provider value={value}>\n {children}\n </StorefrontReactContext.Provider>\n );\n};\n\nexport const useStorefrontContext = () => useContext(StorefrontReactContext);\nexport { useStorefrontActions } from './client-actions';\n"],"mappings":";;;;;;;AAYA,MAAM,yBAAyB,cAC7B,EAAE,CACH;AAED,MAAa,sBAAsB,EACjC,UACA,YAII;AACJ,QACE,oBAAC,uBAAuB;EAAgB;EACrC;GAC+B;;AAItC,MAAa,6BAA6B,WAAW,uBAAuB"}
|
|
@@ -8,11 +8,11 @@ declare const getCacheTag: (tag: string, ctx: StorefrontContext) => string;
|
|
|
8
8
|
declare const getCacheOptions: (tag: string, ctx: StorefrontContext) => {
|
|
9
9
|
tags: string[];
|
|
10
10
|
} | {};
|
|
11
|
-
declare const getCartId: (ctx: StorefrontContext) => string
|
|
12
|
-
declare
|
|
13
|
-
declare
|
|
14
|
-
declare
|
|
15
|
-
declare
|
|
11
|
+
declare const getCartId: (ctx: StorefrontContext) => string;
|
|
12
|
+
declare function setCartIdAction(id: string): Promise<void>;
|
|
13
|
+
declare function removeCartIdAction(): Promise<void>;
|
|
14
|
+
declare function setAuthTokenAction(token: string): Promise<void>;
|
|
15
|
+
declare function removeAuthTokenAction(): Promise<void>;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { getAuthHeaders, getCacheOptions, getCacheTag, getCartId,
|
|
17
|
+
export { getAuthHeaders, getCacheOptions, getCacheTag, getCartId, removeAuthTokenAction, removeCartIdAction, setAuthTokenAction, setCartIdAction };
|
|
18
18
|
//# sourceMappingURL=cookies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookies.d.ts","names":[],"sources":["../../../src/lib/data/cookies.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"cookies.d.ts","names":[],"sources":["../../../src/lib/data/cookies.ts"],"sourcesContent":[],"mappings":";;;cAIa,sBACN;;AADP,CAAA,GAAa,CAAA,CAAA;AAYA,cAAA,WAAiC,EAAA,CAAA,GAAA,EAAA,MAAA,EAAA,GAAiB,EAAjB,iBAAiB,EAAA,GAAA,MAAA;AAUlD,cAAA,eAEN,EAAA,CAAA,GAAA,EAAA,MAAA,EAAA,GAAiB,EAAjB,iBAAiB,EAAA,GAAA;EAeX,IAAA,EAAA,MAEZ,EAAA;AAED,CAAA,GAAsB,CAAA,CAAA;AAWA,cAfT,SAe2B,EAAA,CAAA,GAAA,EAfT,iBAeS,EAAA,GAAA,MAAA;AAMlB,iBAjBA,eAAA,CAiBgC,EAAA,EAAA,MAAA,CAAA,EAjBN,OAiBM,CAAA,IAAA,CAAA;AAWhC,iBAjBA,kBAAA,CAAA,CAiBqB,EAjBH,OAiBG,CAAA,IAAA,CAAA;iBAXrB,kBAAA,iBAAgC;iBAWhC,qBAAA,CAAA,GAAqB"}
|