@gfed-medusa/sf-lib-common 1.1.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/breadcrumbs/index.d.ts +4 -6
- package/dist/components/breadcrumbs/index.d.ts.map +1 -1
- package/dist/components/breadcrumbs/index.js.map +1 -1
- package/dist/components/cart-mismatch-banner/index.js +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 +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/free-shipping-price-nudge/index.js +2 -2
- package/dist/components/free-shipping-price-nudge/index.js.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/interactive-link/index.js +1 -1
- package/dist/components/line-item-options/index.d.ts +2 -2
- package/dist/components/line-item-options/index.d.ts.map +1 -1
- 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 +5 -12
- package/dist/components/localized-client-link/index.d.ts.map +1 -1
- package/dist/components/localized-client-link/index.js +3 -9
- package/dist/components/localized-client-link/index.js.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/modal/index.js +1 -1
- package/dist/components/preview-price/index.d.ts +2 -2
- package/dist/components/product-card/index.d.ts +2 -2
- package/dist/components/product-card/index.d.ts.map +1 -1
- package/dist/components/product-card/index.js +3 -4
- package/dist/components/product-card/index.js.map +1 -1
- package/dist/components/product-preview/index.d.ts +2 -2
- package/dist/components/product-preview/index.d.ts.map +1 -1
- package/dist/components/product-preview/index.js +1 -1
- package/dist/components/submit-button/index.d.ts +2 -2
- package/dist/lib/context/apollo-context.d.ts +2 -2
- package/dist/lib/context/apollo-context.d.ts.map +1 -1
- package/dist/lib/context/modal-context.d.ts +2 -2
- package/dist/lib/context/modal-context.d.ts.map +1 -1
- package/dist/lib/data/cart.d.ts +7 -17
- package/dist/lib/data/cart.d.ts.map +1 -1
- package/dist/lib/data/cart.js +23 -46
- package/dist/lib/data/cart.js.map +1 -1
- package/dist/lib/data/context.d.ts +27 -0
- package/dist/lib/data/context.d.ts.map +1 -0
- package/dist/lib/data/context.js +18 -0
- package/dist/lib/data/context.js.map +1 -0
- package/dist/lib/data/cookies.d.ts +12 -9
- package/dist/lib/data/cookies.d.ts.map +1 -1
- package/dist/lib/data/cookies.js +26 -28
- package/dist/lib/data/cookies.js.map +1 -1
- package/dist/lib/data/customer.d.ts +3 -2
- package/dist/lib/data/customer.d.ts.map +1 -1
- package/dist/lib/data/customer.js +11 -10
- package/dist/lib/data/customer.js.map +1 -1
- package/dist/lib/data/next-context.d.ts +8 -0
- package/dist/lib/data/next-context.d.ts.map +1 -0
- package/dist/lib/data/next-context.js +65 -0
- package/dist/lib/data/next-context.js.map +1 -0
- package/dist/lib/data/orders.js +1 -1
- package/dist/lib/data/regions.d.ts +3 -2
- package/dist/lib/data/regions.d.ts.map +1 -1
- package/dist/lib/data/regions.js +5 -5
- package/dist/lib/data/regions.js.map +1 -1
- package/dist/lib/gql/apollo-client.js +2 -1
- package/dist/lib/gql/apollo-client.js.map +1 -1
- package/dist/lib/gql/fragments/cart.d.ts +9 -9
- package/dist/lib/gql/fragments/cart.d.ts.map +1 -1
- 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/cart.d.ts +2 -2
- package/dist/lib/gql/queries/collections.d.ts +2 -2
- package/dist/lib/gql/queries/collections.d.ts.map +1 -1
- 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/footer.d.ts.map +1 -1
- package/dist/lib/gql/queries/footer.js +1 -55
- package/dist/lib/gql/queries/footer.js.map +1 -1
- package/dist/lib/utils/env.js +1 -1
- package/dist/lib/utils/env.js.map +1 -1
- package/dist/types/graphql.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/components/cart-button/index.d.ts +0 -7
- package/dist/components/cart-button/index.d.ts.map +0 -1
- package/dist/components/cart-button/index.js +0 -12
- package/dist/components/cart-button/index.js.map +0 -1
- package/dist/components/cart-dropdown/index.d.ts +0 -12
- package/dist/components/cart-dropdown/index.d.ts.map +0 -1
- package/dist/components/cart-dropdown/index.js +0 -197
- package/dist/components/cart-dropdown/index.js.map +0 -1
- package/dist/components/footer/index.d.ts +0 -7
- package/dist/components/footer/index.d.ts.map +0 -1
- package/dist/components/footer/index.js +0 -110
- package/dist/components/footer/index.js.map +0 -1
- package/dist/components/layout-country-select/index.d.ts +0 -16
- package/dist/components/layout-country-select/index.d.ts.map +0 -1
- package/dist/components/layout-country-select/index.js +0 -92
- package/dist/components/layout-country-select/index.js.map +0 -1
- package/dist/components/nav/index.d.ts +0 -7
- package/dist/components/nav/index.d.ts.map +0 -1
- package/dist/components/nav/index.js +0 -66
- package/dist/components/nav/index.js.map +0 -1
- package/dist/components/portable-text/index.d.ts +0 -13
- package/dist/components/portable-text/index.d.ts.map +0 -1
- package/dist/components/portable-text/index.js +0 -330
- package/dist/components/portable-text/index.js.map +0 -1
- package/dist/components/search-modal/index.d.ts +0 -12
- package/dist/components/search-modal/index.d.ts.map +0 -1
- package/dist/components/search-modal/index.js +0 -139
- package/dist/components/search-modal/index.js.map +0 -1
- package/dist/components/side-menu/index.d.ts +0 -12
- package/dist/components/side-menu/index.d.ts.map +0 -1
- package/dist/components/side-menu/index.js +0 -99
- package/dist/components/side-menu/index.js.map +0 -1
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import * as react0 from "react";
|
|
2
|
-
import * as lucide_react0 from "lucide-react";
|
|
3
1
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
2
|
|
|
5
3
|
//#region src/components/breadcrumbs/index.d.ts
|
|
6
|
-
declare const SEPARATOR_ICONS: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
4
|
+
declare const SEPARATOR_ICONS: Record<string, React.ComponentType<{
|
|
5
|
+
size?: number;
|
|
6
|
+
className?: string;
|
|
7
|
+
}>>;
|
|
10
8
|
interface BreadcrumbsProps {
|
|
11
9
|
separatorIcon?: keyof typeof SEPARATOR_ICONS;
|
|
12
10
|
iconSize?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/breadcrumbs/index.tsx"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/breadcrumbs/index.tsx"],"sourcesContent":[],"mappings":";;;cAiBM,iBAAiB,eAErB,KAAA,CAAM;;;AAyCW,CAAA,CAAA,CAAA;AA3CU,UAQnB,gBAAA,CAAgB;EA+BjB,aAAA,CAAW,EAAA,MAAA,OA9BW,eA8BX;EAClB,QAAA,CAAA,EAAA,MAAA;EACA,aAAA,CAAA,EAAA,MAAA;;iBAFO,WAAA,CAIN;EAAA,aAAA;EAAA,QAAA;EAAA;AAAA,CAAA,EAAA,gBAAA,CAAA,EAAgB,kBAAA,CAAA,GAAA,CAAA,OAAhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["segments: string[]"],"sources":["../../../src/components/breadcrumbs/index.tsx"],"sourcesContent":["'use client';\n\nimport { Fragment } from 'react';\n\nimport { usePathname } from 'next/navigation';\n\nimport { SlashIcon, Tally1 } from 'lucide-react';\n\nimport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbPage,\n BreadcrumbSeparator,\n} from '@gfed-medusa/sf-lib-ui/components/breadcrumb';\n\nconst SEPARATOR_ICONS = {\n verticalLine: Tally1,\n slash: SlashIcon,\n}
|
|
1
|
+
{"version":3,"file":"index.js","names":["SEPARATOR_ICONS: Record<\n string,\n React.ComponentType<{ size?: number; className?: string }>\n>","segments: string[]"],"sources":["../../../src/components/breadcrumbs/index.tsx"],"sourcesContent":["'use client';\n\nimport { Fragment } from 'react';\n\nimport { usePathname } from 'next/navigation';\n\nimport { SlashIcon, Tally1 } from 'lucide-react';\n\nimport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbPage,\n BreadcrumbSeparator,\n} from '@gfed-medusa/sf-lib-ui/components/breadcrumb';\n\nconst SEPARATOR_ICONS: Record<\n string,\n React.ComponentType<{ size?: number; className?: string }>\n> = {\n verticalLine: Tally1,\n slash: SlashIcon,\n};\n\ninterface BreadcrumbsProps {\n separatorIcon?: keyof typeof SEPARATOR_ICONS;\n iconSize?: number;\n iconClassName?: string;\n}\n\nconst formatSegmentLabel = (segment: string): string =>\n segment.charAt(0).toUpperCase() + segment.slice(1).replace(/-/g, ' ');\n\nconst createBreadcrumbItems = (segments: string[]) => [\n { label: 'Home', href: '/' },\n ...segments.map((segment, index) => ({\n href: '/' + segments.slice(0, index + 1).join('/'),\n label: formatSegmentLabel(segment),\n })),\n];\n\n// Helper function to check if a string is a locale code (e.g., 'en', 'en-US')\nconst isLocaleCode = (segment: string): boolean =>\n /^[a-zA-Z]{2}(-[a-zA-Z]{2})?$/.test(segment);\n\nconst getPathSegments = (pathname: string): string[] => {\n const segments: string[] = pathname.split('/').filter(Boolean);\n\n if (segments.length > 0 && isLocaleCode(segments[0] ?? '')) {\n segments.shift();\n }\n\n return segments;\n};\n\nfunction Breadcrumbs({\n iconClassName,\n iconSize,\n separatorIcon,\n}: BreadcrumbsProps) {\n const pathname = usePathname();\n const pathSegments = getPathSegments(pathname);\n const breadcrumbItems = createBreadcrumbItems(pathSegments);\n const SeparatorIcon = separatorIcon ? SEPARATOR_ICONS[separatorIcon] : null;\n\n return (\n <Breadcrumb className=\"mt-3\">\n <BreadcrumbList className=\"lg:gap-6\">\n {breadcrumbItems.map((item, index) => {\n const isLast = index === breadcrumbItems.length - 1;\n\n return (\n <Fragment key={item.href}>\n <BreadcrumbItem className=\"text-sm\">\n {isLast ? (\n <BreadcrumbPage>{item.label}</BreadcrumbPage>\n ) : (\n <BreadcrumbLink href={item.href}>{item.label}</BreadcrumbLink>\n )}\n </BreadcrumbItem>\n {!isLast && (\n <BreadcrumbSeparator>\n {SeparatorIcon && (\n <SeparatorIcon size={iconSize} className={iconClassName} />\n )}\n </BreadcrumbSeparator>\n )}\n </Fragment>\n );\n })}\n </BreadcrumbList>\n </Breadcrumb>\n );\n}\n\nexport { Breadcrumbs };\n"],"mappings":";;;;;;;;;AAiBA,MAAMA,kBAGF;CACF,cAAc;CACd,OAAO;CACR;AAQD,MAAM,sBAAsB,YAC1B,QAAQ,OAAO,EAAE,CAAC,aAAa,GAAG,QAAQ,MAAM,EAAE,CAAC,QAAQ,MAAM,IAAI;AAEvE,MAAM,yBAAyB,aAAuB,CACpD;CAAE,OAAO;CAAQ,MAAM;CAAK,EAC5B,GAAG,SAAS,KAAK,SAAS,WAAW;CACnC,MAAM,MAAM,SAAS,MAAM,GAAG,QAAQ,EAAE,CAAC,KAAK,IAAI;CAClD,OAAO,mBAAmB,QAAQ;CACnC,EAAE,CACJ;AAGD,MAAM,gBAAgB,YACpB,+BAA+B,KAAK,QAAQ;AAE9C,MAAM,mBAAmB,aAA+B;CACtD,MAAMC,WAAqB,SAAS,MAAM,IAAI,CAAC,OAAO,QAAQ;AAE9D,KAAI,SAAS,SAAS,KAAK,aAAa,SAAS,MAAM,GAAG,CACxD,UAAS,OAAO;AAGlB,QAAO;;AAGT,SAAS,YAAY,EACnB,eACA,UACA,iBACmB;CAGnB,MAAM,kBAAkB,sBADH,gBADJ,aAAa,CACgB,CACa;CAC3D,MAAM,gBAAgB,gBAAgB,gBAAgB,iBAAiB;AAEvE,QACE,oBAAC;EAAW,WAAU;YACpB,oBAAC;GAAe,WAAU;aACvB,gBAAgB,KAAK,MAAM,UAAU;IACpC,MAAM,SAAS,UAAU,gBAAgB,SAAS;AAElD,WACE,qBAAC,uBACC,oBAAC;KAAe,WAAU;eACvB,SACC,oBAAC,4BAAgB,KAAK,QAAuB,GAE7C,oBAAC;MAAe,MAAM,KAAK;gBAAO,KAAK;OAAuB;MAEjD,EAChB,CAAC,UACA,oBAAC,iCACE,iBACC,oBAAC;KAAc,MAAM;KAAU,WAAW;MAAiB,GAEzC,KAbX,KAAK,KAeT;KAEb;IACa;GACN"}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { transferCart } from "../../lib/data/customer.js";
|
|
4
4
|
import { useState } from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { Button } from "@medusajs/ui";
|
|
7
6
|
import { ExclamationCircleSolid } from "@medusajs/icons";
|
|
7
|
+
import { Button } from "@medusajs/ui";
|
|
8
8
|
|
|
9
9
|
//#region src/components/cart-mismatch-banner/index.tsx
|
|
10
10
|
function CartMismatchBanner(props) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime3 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_runtime3.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":";;;cAOM;;;;;;aAMO,KAAA,CAAM;EANb,SAAA,CAAA,EAAA,MAkCL;CAlCqB,EAAA,GAQrB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/delete-button/index.tsx"],"sourcesContent":[],"mappings":";;;cAOM;;;;;;aAMO,KAAA,CAAM;EANb,SAAA,CAAA,EAAA,MAkCL;CAlCqB,EAAA,GAQrB,kBAAA,CAAA,GAAA,CAAA,OARqB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { deleteLineItem } from "../../lib/data/cart.js";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { clx } from "@medusajs/ui";
|
|
5
4
|
import { Spinner, Trash } from "@medusajs/icons";
|
|
5
|
+
import { clx } from "@medusajs/ui";
|
|
6
6
|
|
|
7
7
|
//#region src/components/delete-button/index.tsx
|
|
8
8
|
const DeleteButton = ({ id, children, className }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime4 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_runtime4.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,kBAAA,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_runtime7 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_runtime7.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,kBAAA,CAAA,GAAA,CAAA,OAAA,GAPC,SAAA"}
|
|
@@ -4,8 +4,8 @@ import { convertToLocale } from "../../lib/utils/money.js";
|
|
|
4
4
|
import { LocalizedClientLink } from "../localized-client-link/index.js";
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { Button, clx } from "@medusajs/ui";
|
|
8
7
|
import { CheckCircleSolid, XMark } from "@medusajs/icons";
|
|
8
|
+
import { Button, clx } from "@medusajs/ui";
|
|
9
9
|
|
|
10
10
|
//#region src/components/free-shipping-price-nudge/index.tsx
|
|
11
11
|
const computeTarget = (cart, price) => {
|
|
@@ -113,7 +113,7 @@ function FreeShippingInline({ cart, price }) {
|
|
|
113
113
|
function FreeShippingPopup({ cart, price }) {
|
|
114
114
|
const [isClosed, setIsClosed] = useState(false);
|
|
115
115
|
return /* @__PURE__ */ jsxs("div", {
|
|
116
|
-
className: clx("fixed
|
|
116
|
+
className: clx("fixed bottom-5 right-5 z-10 flex flex-col items-end gap-2 transition-all duration-500 ease-in-out", {
|
|
117
117
|
"invisible opacity-0 delay-1000": price.target_reached,
|
|
118
118
|
"invisible opacity-0": isClosed,
|
|
119
119
|
"visible opacity-100": !price.target_reached && !isClosed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/free-shipping-price-nudge/index.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\n\nimport { CheckCircleSolid, XMark } from '@medusajs/icons';\nimport {\n HttpTypes,\n StoreCartShippingOption,\n StorePrice,\n} from '@medusajs/types';\nimport { Button, clx } from '@medusajs/ui';\n\nimport { convertToLocale } from '@/lib/utils/money';\nimport { Cart } from '@/types/graphql';\nimport { StoreFreeShippingPrice } from '@/types/prices';\n\nimport { LocalizedClientLink } from '../localized-client-link';\n\nconst computeTarget = (cart: Cart, price: HttpTypes.StorePrice) => {\n const priceRule = (price.price_rules || []).find(\n (pr) => pr.attribute === 'item_total'\n )!;\n\n const currentAmount = cart.itemTotal;\n const targetAmount = parseFloat(priceRule.value);\n\n if (priceRule.operator === 'gt') {\n return {\n current_amount: currentAmount,\n target_amount: targetAmount,\n target_reached: currentAmount > targetAmount,\n target_remaining:\n currentAmount > targetAmount ? 0 : targetAmount + 1 - currentAmount,\n remaining_percentage: (currentAmount / targetAmount) * 100,\n };\n } else if (priceRule.operator === 'gte') {\n return {\n current_amount: currentAmount,\n target_amount: targetAmount,\n target_reached: currentAmount > targetAmount,\n target_remaining:\n currentAmount > targetAmount ? 0 : targetAmount - currentAmount,\n remaining_percentage: (currentAmount / targetAmount) * 100,\n };\n } else if (priceRule.operator === 'lt') {\n return {\n current_amount: currentAmount,\n target_amount: targetAmount,\n target_reached: targetAmount > currentAmount,\n target_remaining:\n targetAmount > currentAmount ? 0 : currentAmount + 1 - targetAmount,\n remaining_percentage: (currentAmount / targetAmount) * 100,\n };\n } else if (priceRule.operator === 'lte') {\n return {\n current_amount: currentAmount,\n target_amount: targetAmount,\n target_reached: targetAmount > currentAmount,\n target_remaining:\n targetAmount > currentAmount ? 0 : currentAmount - targetAmount,\n remaining_percentage: (currentAmount / targetAmount) * 100,\n };\n } else {\n return {\n current_amount: currentAmount,\n target_amount: targetAmount,\n target_reached: currentAmount === targetAmount,\n target_remaining:\n targetAmount > currentAmount ? 0 : targetAmount - currentAmount,\n remaining_percentage: (currentAmount / targetAmount) * 100,\n };\n }\n};\n\nfunction ShippingPriceNudge({\n variant = 'inline',\n cart,\n shippingOptions,\n}: {\n variant?: 'popup' | 'inline';\n cart: Cart;\n shippingOptions: StoreCartShippingOption[];\n}) {\n if (!cart || !shippingOptions?.length) {\n return;\n }\n\n // Check if any shipping options have a conditional price based on item_total\n const freeShippingPrice = shippingOptions\n .map((shippingOption) => {\n const calculatedPrice = shippingOption.calculated_price;\n\n if (!calculatedPrice) {\n return;\n }\n\n // Get all prices that are:\n // 1. Currency code is same as the cart's\n // 2. Have a rule that is set on item_total\n const validCurrencyPrices = shippingOption.prices.filter(\n (price) =>\n price.currency_code === cart.currencyCode &&\n (price.price_rules || []).some(\n (priceRule) => priceRule.attribute === 'item_total'\n )\n );\n\n return validCurrencyPrices.map((price) => {\n return {\n ...price,\n shipping_option_id: shippingOption.id,\n ...computeTarget(cart, price),\n };\n });\n })\n .flat(1)\n .filter(Boolean)\n // We focus here entirely on free shipping, but this can be edited to handle multiple layers\n // of reduced shipping prices.\n .find((price) => price?.amount === 0);\n\n if (!freeShippingPrice) {\n return;\n }\n\n if (variant === 'popup') {\n return <FreeShippingPopup cart={cart} price={freeShippingPrice} />;\n } else {\n return <FreeShippingInline cart={cart} price={freeShippingPrice} />;\n }\n}\n\nfunction FreeShippingInline({\n cart,\n price,\n}: {\n cart: Cart;\n price: StorePrice & {\n target_reached: boolean;\n target_remaining: number;\n remaining_percentage: number;\n };\n}) {\n return (\n <div className=\"rounded-lg border bg-neutral-100 p-2\">\n <div className=\"space-y-1.5\">\n <div className=\"flex justify-between text-xs text-neutral-600\">\n <div>\n {price.target_reached ? (\n <div className=\"flex items-center gap-1.5\">\n <CheckCircleSolid className=\"inline-block text-green-500\" />{' '}\n Free Shipping unlocked!\n </div>\n ) : (\n `Unlock Free Shipping`\n )}\n </div>\n\n <div\n className={clx('visible', {\n 'invisible opacity-0': price.target_reached,\n })}\n >\n Only{' '}\n <span className=\"text-neutral-950\">\n {convertToLocale({\n amount: price.target_remaining,\n currency_code: cart.currencyCode,\n })}\n </span>{' '}\n away\n </div>\n </div>\n <div className=\"flex justify-between gap-1\">\n <div\n className={clx(\n 'h-1 max-w-full rounded-full bg-gradient-to-r from-zinc-400 to-zinc-500 duration-500 ease-in-out',\n {\n 'from-green-400 to-green-500': price.target_reached,\n }\n )}\n style={{ width: `${price.remaining_percentage}%` }}\n ></div>\n <div className=\"h-1 w-fit flex-grow rounded-full bg-neutral-300\"></div>\n </div>\n </div>\n </div>\n );\n}\n\nfunction FreeShippingPopup({\n cart,\n price,\n}: {\n cart: Cart;\n price: StoreFreeShippingPrice;\n}) {\n const [isClosed, setIsClosed] = useState(false);\n\n return (\n <div\n className={clx(\n 'fixed right-5 bottom-5 z-10 flex flex-col items-end gap-2 transition-all duration-500 ease-in-out',\n {\n 'invisible opacity-0 delay-1000': price.target_reached,\n 'invisible opacity-0': isClosed,\n 'visible opacity-100': !price.target_reached && !isClosed,\n }\n )}\n >\n <div>\n <Button\n className=\"rounded-full border-none bg-neutral-900 p-2 text-[15px] shadow-none outline-none\"\n onClick={() => setIsClosed(true)}\n >\n <XMark />\n </Button>\n </div>\n\n <div className=\"w-[400px] rounded-lg bg-black p-6 text-white\">\n <div className=\"pb-4\">\n <div className=\"space-y-3\">\n <div className=\"flex justify-between text-[15px] text-neutral-400\">\n <div>\n {price.target_reached ? (\n <div className=\"flex items-center gap-1.5\">\n <CheckCircleSolid className=\"inline-block text-green-500\" />{' '}\n Free Shipping unlocked!\n </div>\n ) : (\n `Unlock Free Shipping`\n )}\n </div>\n\n <div\n className={clx('visible', {\n 'invisible opacity-0': price.target_reached,\n })}\n >\n Only{' '}\n <span className=\"text-white\">\n {convertToLocale({\n amount: price.target_remaining,\n currency_code: cart.currencyCode,\n })}\n </span>{' '}\n away\n </div>\n </div>\n <div className=\"flex justify-between gap-1\">\n <div\n className={clx(\n 'h-1.5 max-w-full rounded-full bg-gradient-to-r from-zinc-400 to-zinc-500 duration-500 ease-in-out',\n {\n 'from-green-400 to-green-500': price.target_reached,\n }\n )}\n style={{ width: `${price.remaining_percentage}%` }}\n ></div>\n <div className=\"h-1.5 w-fit flex-grow rounded-full bg-zinc-600\"></div>\n </div>\n </div>\n </div>\n\n <div className=\"flex gap-3\">\n <LocalizedClientLink\n className=\"rounded-2xl border-[1px] border-white bg-transparent px-4 py-2.5 text-[15px] shadow-none outline-none\"\n href=\"/cart\"\n >\n View cart\n </LocalizedClientLink>\n\n <LocalizedClientLink\n className=\"flex-grow rounded-2xl border-[1px] border-white bg-white px-4 py-2.5 text-center text-[15px] text-neutral-950 shadow-none outline-none\"\n href=\"/store\"\n >\n View products\n </LocalizedClientLink>\n </div>\n </div>\n </div>\n );\n}\n\nexport { ShippingPriceNudge };\n"],"mappings":";;;;;;;;;;AAkBA,MAAM,iBAAiB,MAAY,UAAgC;CACjE,MAAM,aAAa,MAAM,eAAe,EA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I,WAAU;gBACb,qBAAC;MAAI,WAAU;iBACb,oBAAC,mBACE,MAAM,iBACL,qBAAC;OAAI,WAAU;;QACb,oBAAC,oBAAiB,WAAU,gCAAgC;QAAC;QAAI;;QAE7D,GAEN,yBAEE,EAEN,qBAAC;OACC,WAAW,IAAI,WAAW,EACxB,uBAAuB,MAAM,gBAC9B,CAAC;;QACH;QACM;QACL,oBAAC;SAAK,WAAU;mBACb,gBAAgB;UACf,QAAQ,MAAM;UACd,eAAe,KAAK;UACrB,CAAC;UACG;QAAC;QAAI;;QAER;OACF,EACN,qBAAC;MAAI,WAAU;iBACb,oBAAC;OACC,WAAW,IACT,qGACA,EACE,+BAA+B,MAAM,gBACtC,CACF;OACD,OAAO,EAAE,OAAO,GAAG,MAAM,qBAAqB,IAAI;QAC7C,EACP,oBAAC,SAAI,WAAU,mDAAuD;OAClE;MACF;KACF,EAEN,qBAAC;IAAI,WAAU;eACb,oBAAC;KACC,WAAU;KACV,MAAK;eACN;MAEqB,EAEtB,oBAAC;KACC,WAAU;KACV,MAAK;eACN;MAEqB;KAClB;IACF;GACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/free-shipping-price-nudge/index.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\n\nimport { CheckCircleSolid, XMark } from '@medusajs/icons';\nimport {\n HttpTypes,\n StoreCartShippingOption,\n StorePrice,\n} from '@medusajs/types';\nimport { Button, clx } from '@medusajs/ui';\n\nimport { convertToLocale } from '@/lib/utils/money';\nimport { Cart } from '@/types/graphql';\nimport { StoreFreeShippingPrice } from '@/types/prices';\n\nimport { LocalizedClientLink } from '../localized-client-link';\n\nconst computeTarget = (cart: Cart, price: HttpTypes.StorePrice) => {\n const priceRule = (price.price_rules || []).find(\n (pr) => pr.attribute === 'item_total'\n )!;\n\n const currentAmount = cart.itemTotal;\n const targetAmount = parseFloat(priceRule.value);\n\n if (priceRule.operator === 'gt') {\n return {\n current_amount: currentAmount,\n target_amount: targetAmount,\n target_reached: currentAmount > targetAmount,\n target_remaining:\n currentAmount > targetAmount ? 0 : targetAmount + 1 - currentAmount,\n remaining_percentage: (currentAmount / targetAmount) * 100,\n };\n } else if (priceRule.operator === 'gte') {\n return {\n current_amount: currentAmount,\n target_amount: targetAmount,\n target_reached: currentAmount > targetAmount,\n target_remaining:\n currentAmount > targetAmount ? 0 : targetAmount - currentAmount,\n remaining_percentage: (currentAmount / targetAmount) * 100,\n };\n } else if (priceRule.operator === 'lt') {\n return {\n current_amount: currentAmount,\n target_amount: targetAmount,\n target_reached: targetAmount > currentAmount,\n target_remaining:\n targetAmount > currentAmount ? 0 : currentAmount + 1 - targetAmount,\n remaining_percentage: (currentAmount / targetAmount) * 100,\n };\n } else if (priceRule.operator === 'lte') {\n return {\n current_amount: currentAmount,\n target_amount: targetAmount,\n target_reached: targetAmount > currentAmount,\n target_remaining:\n targetAmount > currentAmount ? 0 : currentAmount - targetAmount,\n remaining_percentage: (currentAmount / targetAmount) * 100,\n };\n } else {\n return {\n current_amount: currentAmount,\n target_amount: targetAmount,\n target_reached: currentAmount === targetAmount,\n target_remaining:\n targetAmount > currentAmount ? 0 : targetAmount - currentAmount,\n remaining_percentage: (currentAmount / targetAmount) * 100,\n };\n }\n};\n\nfunction ShippingPriceNudge({\n variant = 'inline',\n cart,\n shippingOptions,\n}: {\n variant?: 'popup' | 'inline';\n cart: Cart;\n shippingOptions: StoreCartShippingOption[];\n}) {\n if (!cart || !shippingOptions?.length) {\n return;\n }\n\n // Check if any shipping options have a conditional price based on item_total\n const freeShippingPrice = shippingOptions\n .map((shippingOption) => {\n const calculatedPrice = shippingOption.calculated_price;\n\n if (!calculatedPrice) {\n return;\n }\n\n // Get all prices that are:\n // 1. Currency code is same as the cart's\n // 2. Have a rule that is set on item_total\n const validCurrencyPrices = shippingOption.prices.filter(\n (price) =>\n price.currency_code === cart.currencyCode &&\n (price.price_rules || []).some(\n (priceRule) => priceRule.attribute === 'item_total'\n )\n );\n\n return validCurrencyPrices.map((price) => {\n return {\n ...price,\n shipping_option_id: shippingOption.id,\n ...computeTarget(cart, price),\n };\n });\n })\n .flat(1)\n .filter(Boolean)\n // We focus here entirely on free shipping, but this can be edited to handle multiple layers\n // of reduced shipping prices.\n .find((price) => price?.amount === 0);\n\n if (!freeShippingPrice) {\n return;\n }\n\n if (variant === 'popup') {\n return <FreeShippingPopup cart={cart} price={freeShippingPrice} />;\n } else {\n return <FreeShippingInline cart={cart} price={freeShippingPrice} />;\n }\n}\n\nfunction FreeShippingInline({\n cart,\n price,\n}: {\n cart: Cart;\n price: StorePrice & {\n target_reached: boolean;\n target_remaining: number;\n remaining_percentage: number;\n };\n}) {\n return (\n <div className=\"rounded-lg border bg-neutral-100 p-2\">\n <div className=\"space-y-1.5\">\n <div className=\"flex justify-between text-xs text-neutral-600\">\n <div>\n {price.target_reached ? (\n <div className=\"flex items-center gap-1.5\">\n <CheckCircleSolid className=\"inline-block text-green-500\" />{' '}\n Free Shipping unlocked!\n </div>\n ) : (\n `Unlock Free Shipping`\n )}\n </div>\n\n <div\n className={clx('visible', {\n 'invisible opacity-0': price.target_reached,\n })}\n >\n Only{' '}\n <span className=\"text-neutral-950\">\n {convertToLocale({\n amount: price.target_remaining,\n currency_code: cart.currencyCode,\n })}\n </span>{' '}\n away\n </div>\n </div>\n <div className=\"flex justify-between gap-1\">\n <div\n className={clx(\n 'h-1 max-w-full rounded-full bg-gradient-to-r from-zinc-400 to-zinc-500 duration-500 ease-in-out',\n {\n 'from-green-400 to-green-500': price.target_reached,\n }\n )}\n style={{ width: `${price.remaining_percentage}%` }}\n ></div>\n <div className=\"h-1 w-fit flex-grow rounded-full bg-neutral-300\"></div>\n </div>\n </div>\n </div>\n );\n}\n\nfunction FreeShippingPopup({\n cart,\n price,\n}: {\n cart: Cart;\n price: StoreFreeShippingPrice;\n}) {\n const [isClosed, setIsClosed] = useState(false);\n\n return (\n <div\n className={clx(\n 'fixed bottom-5 right-5 z-10 flex flex-col items-end gap-2 transition-all duration-500 ease-in-out',\n {\n 'invisible opacity-0 delay-1000': price.target_reached,\n 'invisible opacity-0': isClosed,\n 'visible opacity-100': !price.target_reached && !isClosed,\n }\n )}\n >\n <div>\n <Button\n className=\"rounded-full border-none bg-neutral-900 p-2 text-[15px] shadow-none outline-none\"\n onClick={() => setIsClosed(true)}\n >\n <XMark />\n </Button>\n </div>\n\n <div className=\"w-[400px] rounded-lg bg-black p-6 text-white\">\n <div className=\"pb-4\">\n <div className=\"space-y-3\">\n <div className=\"flex justify-between text-[15px] text-neutral-400\">\n <div>\n {price.target_reached ? (\n <div className=\"flex items-center gap-1.5\">\n <CheckCircleSolid className=\"inline-block text-green-500\" />{' '}\n Free Shipping unlocked!\n </div>\n ) : (\n `Unlock Free Shipping`\n )}\n </div>\n\n <div\n className={clx('visible', {\n 'invisible opacity-0': price.target_reached,\n })}\n >\n Only{' '}\n <span className=\"text-white\">\n {convertToLocale({\n amount: price.target_remaining,\n currency_code: cart.currencyCode,\n })}\n </span>{' '}\n away\n </div>\n </div>\n <div className=\"flex justify-between gap-1\">\n <div\n className={clx(\n 'h-1.5 max-w-full rounded-full bg-gradient-to-r from-zinc-400 to-zinc-500 duration-500 ease-in-out',\n {\n 'from-green-400 to-green-500': price.target_reached,\n }\n )}\n style={{ width: `${price.remaining_percentage}%` }}\n ></div>\n <div className=\"h-1.5 w-fit flex-grow rounded-full bg-zinc-600\"></div>\n </div>\n </div>\n </div>\n\n <div className=\"flex gap-3\">\n <LocalizedClientLink\n className=\"rounded-2xl border-[1px] border-white bg-transparent px-4 py-2.5 text-[15px] shadow-none outline-none\"\n href=\"/cart\"\n >\n View cart\n </LocalizedClientLink>\n\n <LocalizedClientLink\n className=\"flex-grow rounded-2xl border-[1px] border-white bg-white px-4 py-2.5 text-center text-[15px] text-neutral-950 shadow-none outline-none\"\n href=\"/store\"\n >\n View products\n </LocalizedClientLink>\n </div>\n </div>\n </div>\n );\n}\n\nexport { ShippingPriceNudge };\n"],"mappings":";;;;;;;;;;A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,EAEN,qBAAC;GAAI,WAAU;cACb,oBAAC;IAAI,WAAU;cACb,qBAAC;KAAI,WAAU;gBACb,qBAAC;MAAI,WAAU;iBACb,oBAAC,mBACE,MAAM,iBACL,qBAAC;OAAI,WAAU;;QACb,oBAAC,oBAAiB,WAAU,gCAAgC;QAAC;QAAI;;QAE7D,GAEN,yBAEE,EAEN,qBAAC;OACC,WAAW,IAAI,WAAW,EACxB,uBAAuB,MAAM,gBAC9B,CAAC;;QACH;QACM;QACL,oBAAC;SAAK,WAAU;mBACb,gBAAgB;UACf,QAAQ,MAAM;UACd,eAAe,KAAK;UACrB,CAAC;UACG;QAAC;QAAI;;QAER;OACF,EACN,qBAAC;MAAI,WAAU;iBACb,oBAAC;OACC,WAAW,IACT,qGACA,EACE,+BAA+B,MAAM,gBACtC,CACF;OACD,OAAO,EAAE,OAAO,GAAG,MAAM,qBAAqB,IAAI;QAC7C,EACP,oBAAC,SAAI,WAAU,mDAAuD;OAClE;MACF;KACF,EAEN,qBAAC;IAAI,WAAU;eACb,oBAAC;KACC,WAAU;KACV,MAAK;eACN;MAEqB,EAEtB,oBAAC;KACC,WAAU;KACV,MAAK;eACN;MAEqB;KAClB;IACF;GACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime2 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_runtime2.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,kBAAA,CAAA,GAAA,CAAA,OALE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LocalizedClientLink } from "../localized-client-link/index.js";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Text } from "@medusajs/ui";
|
|
4
3
|
import { ArrowUpRightMini } from "@medusajs/icons";
|
|
4
|
+
import { Text } from "@medusajs/ui";
|
|
5
5
|
|
|
6
6
|
//#region src/components/interactive-link/index.tsx
|
|
7
7
|
const InteractiveLink = ({ href, children, onClick, ...props }) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Maybe, ProductVariant } from "../../types/graphql.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime15 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_runtime15.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { LineItemOptions };
|
|
17
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/line-item-options/index.tsx"],"sourcesContent":[],"mappings":";;;;KAIK,oBAAA;YACO,MAAM;;EADb,YAAA,CAAA,EAGY,KAHZ,CAGkB,cAHE,CAAA;CACP;cAKZ,eALM,EAAA,CAAA;EAAA,OAAA;EAAA,aAAA,EAKa,UALb;EAAA,YAAA,EAKa;AALb,CAAA,EAST,oBATS,EAAA,GASW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/line-item-options/index.tsx"],"sourcesContent":[],"mappings":";;;;KAIK,oBAAA;YACO,MAAM;;EADb,YAAA,CAAA,EAGY,KAHZ,CAGkB,cAHE,CAAA;CACP;cAKZ,eALM,EAAA,CAAA;EAAA,OAAA;EAAA,aAAA,EAKa,UALb;EAAA,YAAA,EAKa;AALb,CAAA,EAST,oBATS,EAAA,GASW,mBAAA,CAAA,GAAA,CAAA,OATX"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LineItem } from "../../types/graphql.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime14 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_runtime14.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,mBAAA,CAAA,GAAA,CAAA,OAJE"}
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as
|
|
1
|
+
import { AnchorHTMLAttributes, DetailedHTMLProps } from "react";
|
|
2
|
+
import * as react_jsx_runtime10 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>;
|
|
6
6
|
/**
|
|
7
|
-
* Use this component to create
|
|
7
|
+
* Use this component to create an anchor link that persists the current country code in the url,
|
|
8
8
|
* without having to explicitly pass it as a prop.
|
|
9
9
|
*/
|
|
10
10
|
declare const LocalizedClientLink: ({
|
|
11
11
|
children,
|
|
12
12
|
href,
|
|
13
13
|
...props
|
|
14
|
-
}:
|
|
15
|
-
children?: React.ReactNode;
|
|
16
|
-
href: string;
|
|
17
|
-
className?: string;
|
|
18
|
-
onClick?: () => void;
|
|
19
|
-
passHref?: true;
|
|
20
|
-
[x: string]: any;
|
|
21
|
-
}) => react_jsx_runtime14.JSX.Element;
|
|
14
|
+
}: LocalizedClientLinkProps) => react_jsx_runtime10.JSX.Element;
|
|
22
15
|
//#endregion
|
|
23
16
|
export { LocalizedClientLink };
|
|
24
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":"
|
|
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,mBAAA,CAAA,GAAA,CAAA,OAZzB"}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { useParams } from "next/navigation";
|
|
5
1
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import Link from "next/link";
|
|
7
2
|
|
|
8
3
|
//#region src/components/localized-client-link/index.tsx
|
|
9
4
|
/**
|
|
10
|
-
* Use this component to create
|
|
5
|
+
* Use this component to create an anchor link that persists the current country code in the url,
|
|
11
6
|
* without having to explicitly pass it as a prop.
|
|
12
7
|
*/
|
|
13
8
|
const LocalizedClientLink = ({ children, href, ...props }) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
href: `/${countryCode}${href}`,
|
|
9
|
+
return /* @__PURE__ */ jsx("a", {
|
|
10
|
+
href: `/dk${href}`,
|
|
17
11
|
...props,
|
|
18
12
|
children
|
|
19
13
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/localized-client-link/index.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/localized-client-link/index.tsx"],"sourcesContent":["import { AnchorHTMLAttributes, DetailedHTMLProps } from 'react';\n\ntype LocalizedClientLinkProps = DetailedHTMLProps<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n HTMLAnchorElement\n>;\n\n/**\n * Use this component to create an anchor link that persists the current country code in the url,\n * without having to explicitly pass it as a prop.\n */\nconst LocalizedClientLink = ({\n children,\n href,\n ...props\n}: LocalizedClientLinkProps) => {\n return (\n <a href={`/dk${href}`} {...props}>\n {children}\n </a>\n );\n};\n\nexport { LocalizedClientLink };\n"],"mappings":";;;;;;;AAWA,MAAM,uBAAuB,EAC3B,UACA,MACA,GAAG,YAC2B;AAC9B,QACE,oBAAC;EAAE,MAAM,MAAM;EAAQ,GAAI;EACxB;GACC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime11 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_runtime11.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,
|
|
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,mBAAA,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,9 +1,9 @@
|
|
|
1
1
|
import { ModalProvider, useModal } from "../../lib/context/modal-context.js";
|
|
2
2
|
import React, { Fragment } from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { Dialog, Transition } from "@headlessui/react";
|
|
5
4
|
import { clx } from "@medusajs/ui";
|
|
6
5
|
import { X } from "@gfed-medusa/sf-lib-ui/icons/x";
|
|
6
|
+
import { Dialog, Transition } from "@headlessui/react";
|
|
7
7
|
|
|
8
8
|
//#region src/components/modal/index.tsx
|
|
9
9
|
const Modal = ({ isOpen, close, size = "medium", search = false, children, "data-testid": dataTestId, "aria-label": ariaLabel }) => {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { VariantPrice } from "../../types/prices.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime12 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_runtime12.JSX.Element | null;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { PreviewPrice };
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime8 from "react/jsx-runtime";
|
|
2
2
|
import { VariantProps } from "class-variance-authority";
|
|
3
3
|
import * as class_variance_authority_types0 from "class-variance-authority/types";
|
|
4
4
|
|
|
@@ -59,7 +59,7 @@ declare function ProductCard({
|
|
|
59
59
|
variant,
|
|
60
60
|
size,
|
|
61
61
|
className
|
|
62
|
-
}: ProductCardProps):
|
|
62
|
+
}: ProductCardProps): react_jsx_runtime8.JSX.Element;
|
|
63
63
|
//#endregion
|
|
64
64
|
export { ProductCard };
|
|
65
65
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/product-card/index.tsx"],"sourcesContent":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/product-card/index.tsx"],"sourcesContent":[],"mappings":";;;;;cAYM;;;IAoBL,+BAAA,CAAA;AA5BiE,UA8BxD,KAAA,CAtBJ;EAsBI,OAAA,EAAK,MAAA;EAKL,GAAA,CAAA,EAAA,MAAO;AAYH;UAZJ,OAAA,CAe6C;EAC5C,EAAA,EAAA,MAAA;EADwB,KAAA,EAAA;IAAY,GAAA,EAAA,MAAA;IAuC/B,GAAA,CAAA,EAAA,MAAW;EACzB,CAAA;EACA,QAAA,CAAA,EAAA;IACA,QAAA,EAAA,MAAA;IACA,MAAA,EAAA,MAAA;EACA,CAAA;EACA,KAAA,EAAA,MAAA;EACA,IAAA,CAAA,EAAA,MAAA;EACC,KAAA,EAlDM,KAkDN;;UA/CO,gBAAA,SAAyB,YA+ChB,CAAA,OA/CoC,mBA+CpC,CAAA,CAAA;WA9CR;;;;;;;;;;;;;;;;;;;;;;;;;iBAsCK,WAAA;;;;;;;;GAQb,mBAAgB,kBAAA,CAAA,GAAA,CAAA"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import Link from "next/link";
|
|
5
4
|
import Image from "next/image";
|
|
6
|
-
import { cn } from "@gfed-medusa/sf-lib-ui/lib/utils";
|
|
7
5
|
import { cva } from "class-variance-authority";
|
|
8
6
|
import { Badge } from "@gfed-medusa/sf-lib-ui/components/badge";
|
|
9
7
|
import { Button } from "@gfed-medusa/sf-lib-ui/components/button";
|
|
10
8
|
import { RatingCount } from "@gfed-medusa/sf-lib-ui/components/rating-count";
|
|
11
9
|
import { VariantSelector } from "@gfed-medusa/sf-lib-ui/components/variant-selector";
|
|
10
|
+
import { cn } from "@gfed-medusa/sf-lib-ui/lib/utils";
|
|
12
11
|
|
|
13
12
|
//#region src/components/product-card/index.tsx
|
|
14
13
|
const productCardVariants = cva("rounded-2xl border overflow-hidden transition", {
|
|
@@ -60,7 +59,7 @@ function ProductCard({ product, rating, badge, variants, variant, size, classNam
|
|
|
60
59
|
className: "flex items-center justify-between",
|
|
61
60
|
children: [/* @__PURE__ */ jsx("h3", {
|
|
62
61
|
className: "truncate text-base font-medium",
|
|
63
|
-
children: product.href ? /* @__PURE__ */ jsx(
|
|
62
|
+
children: product.href ? /* @__PURE__ */ jsx("a", {
|
|
64
63
|
href: product.href,
|
|
65
64
|
className: "hover:underline",
|
|
66
65
|
children: product.title
|
|
@@ -100,7 +99,7 @@ function ProductCard({ product, rating, badge, variants, variant, size, classNam
|
|
|
100
99
|
children: [
|
|
101
100
|
/* @__PURE__ */ jsx("h3", {
|
|
102
101
|
className: "truncate text-base font-medium",
|
|
103
|
-
children: product.href ? /* @__PURE__ */ jsx(
|
|
102
|
+
children: product.href ? /* @__PURE__ */ jsx("a", {
|
|
104
103
|
href: product.href,
|
|
105
104
|
className: "hover:underline",
|
|
106
105
|
children: product.title
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/product-card/index.tsx"],"sourcesContent":["'use client';\n\nimport Image from 'next/image';\
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/product-card/index.tsx"],"sourcesContent":["'use client';\n\nimport Image from 'next/image';\n\nimport { type VariantProps, cva } from 'class-variance-authority';\n\nimport { Badge } from '@gfed-medusa/sf-lib-ui/components/badge';\nimport { Button } from '@gfed-medusa/sf-lib-ui/components/button';\nimport { RatingCount } from '@gfed-medusa/sf-lib-ui/components/rating-count';\nimport { VariantSelector } from '@gfed-medusa/sf-lib-ui/components/variant-selector';\nimport { cn } from '@gfed-medusa/sf-lib-ui/lib/utils';\n\nconst productCardVariants = cva(\n 'rounded-2xl border overflow-hidden transition',\n {\n variants: {\n variant: {\n default: 'flex flex-col shadow-sm hover:shadow-md',\n withAddToCart: 'flex flex-col shadow-sm hover:shadow-md',\n minimal: 'flex flex-col hover:shadow hover:border-muted-foreground/30',\n },\n size: {\n sm: 'w-48',\n md: 'w-64',\n lg: 'w-80',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'md',\n },\n }\n);\n\ninterface Price {\n current: string;\n old?: string;\n}\n\ninterface Product {\n id: string;\n image: {\n src: string;\n alt?: string;\n };\n localize?: {\n currency: string;\n locale: string;\n };\n title: string;\n href?: string;\n price: Price;\n}\n\ninterface ProductCardProps extends VariantProps<typeof productCardVariants> {\n product: Product;\n rating?: {\n average: number;\n count?: number;\n };\n badge?: {\n label: string;\n variant?: 'default' | 'sale' | 'new' | 'limited';\n };\n variants?: {\n options: {\n value: string;\n label?: string;\n imageSrc?: string;\n color?: string;\n }[];\n value: string;\n onChange: (value: string) => void;\n };\n quantity?: {\n value: number;\n onChange: (value: number) => void;\n };\n className?: string;\n}\n\nconst formatPrice = (price: Price, locale = 'en-GB', currency = 'GBP') => {\n const formatter = new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n });\n\n return {\n currentPrice: formatter.format(Number(price.current)),\n oldPrice: price.old ? formatter.format(Number(price.old)) : undefined,\n };\n};\n\nexport function ProductCard({\n product,\n rating,\n badge,\n variants,\n variant,\n size,\n className,\n}: ProductCardProps) {\n const { currentPrice, oldPrice } = formatPrice(\n product.price,\n product.localize?.locale,\n product.localize?.currency\n );\n\n switch (variant) {\n case 'minimal':\n return (\n <div\n className={cn(\n productCardVariants({ variant, size }),\n 'w-60 overflow-hidden rounded-2xl border p-0 shadow-sm'\n )}\n >\n <div className=\"h-72 w-full overflow-hidden\">\n {/* eslint-disable-next-line @next/next/no-img-element -- needed for minimal variant */}\n <img\n src={product.image.src}\n alt={product.image.alt ?? product.title}\n className=\"h-full w-full object-cover\"\n />\n </div>\n\n <div className=\"flex flex-col gap-1 p-3\">\n <div className=\"flex items-center justify-between\">\n <h3 className=\"truncate text-base font-medium\">\n {product.href ? (\n <a href={product.href} className=\"hover:underline\">\n {product.title}\n </a>\n ) : (\n product.title\n )}\n </h3>\n <p className=\"mt-0 text-lg font-semibold text-gray-900\">\n {currentPrice}\n </p>\n </div>\n <p className=\"text-xs text-gray-500\">7 colors</p>\n </div>\n </div>\n );\n default:\n return (\n <div className={cn(productCardVariants({ variant, size }), className)}>\n {/* Image */}\n <div className=\"relative\">\n <Image\n src={product.image.src || '/assets/images/missing-img.webp'}\n alt={product.image.alt ?? product.title}\n width={500}\n height={500}\n className={cn('w-full object-cover')}\n />\n {badge && (\n <div className=\"absolute left-2 top-2\">\n <Badge variant=\"default\">{badge.label}</Badge>\n </div>\n )}\n </div>\n\n {/* Content */}\n <div className=\"flex flex-col gap-2 p-3\">\n <h3 className=\"truncate text-base font-medium\">\n {product.href ? (\n <a href={product.href} className=\"hover:underline\">\n {product.title}\n </a>\n ) : (\n product.title\n )}\n </h3>\n\n {/* Price */}\n <div className=\"flex items-center gap-2\">\n <p className=\"text-lg font-semibold\">{currentPrice}</p>\n {oldPrice && (\n <p className=\"text-muted-foreground text-sm line-through\">\n {oldPrice}\n </p>\n )}\n </div>\n\n {/* Rating */}\n {rating !== undefined && (\n <div\n data-testid=\"product-card-rating\"\n className=\"flex items-center gap-2\"\n >\n <RatingCount\n average={rating.average}\n ratingCount={rating.count}\n />\n </div>\n )}\n\n {/* Variant Selector */}\n {variants && (\n <VariantSelector\n options={variants.options}\n value={variants.value ?? ''}\n onChange={variants.onChange}\n type=\"color\"\n />\n )}\n\n {/* Add to Cart button */}\n {variant === 'withAddToCart' && (\n <Button variant=\"default\" className=\"w-full cursor-pointer\">\n Add to Cart\n </Button>\n )}\n </div>\n </div>\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;AAYA,MAAM,sBAAsB,IAC1B,iDACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,eAAe;GACf,SAAS;GACV;EACD,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACL;EACF;CACD,iBAAiB;EACf,SAAS;EACT,MAAM;EACP;CACF,CACF;AAiDD,MAAM,eAAe,OAAc,SAAS,SAAS,WAAW,UAAU;CACxE,MAAM,YAAY,IAAI,KAAK,aAAa,QAAQ;EAC9C,OAAO;EACP;EACD,CAAC;AAEF,QAAO;EACL,cAAc,UAAU,OAAO,OAAO,MAAM,QAAQ,CAAC;EACrD,UAAU,MAAM,MAAM,UAAU,OAAO,OAAO,MAAM,IAAI,CAAC,GAAG;EAC7D;;AAGH,SAAgB,YAAY,EAC1B,SACA,QACA,OACA,UACA,SACA,MACA,aACmB;CACnB,MAAM,EAAE,cAAc,aAAa,YACjC,QAAQ,OACR,QAAQ,UAAU,QAClB,QAAQ,UAAU,SACnB;AAED,SAAQ,SAAR;EACE,KAAK,UACH,QACE,qBAAC;GACC,WAAW,GACT,oBAAoB;IAAE;IAAS;IAAM,CAAC,EACtC,wDACD;cAED,oBAAC;IAAI,WAAU;cAEb,oBAAC;KACC,KAAK,QAAQ,MAAM;KACnB,KAAK,QAAQ,MAAM,OAAO,QAAQ;KAClC,WAAU;MACV;KACE,EAEN,qBAAC;IAAI,WAAU;eACb,qBAAC;KAAI,WAAU;gBACb,oBAAC;MAAG,WAAU;gBACX,QAAQ,OACP,oBAAC;OAAE,MAAM,QAAQ;OAAM,WAAU;iBAC9B,QAAQ;QACP,GAEJ,QAAQ;OAEP,EACL,oBAAC;MAAE,WAAU;gBACV;OACC;MACA,EACN,oBAAC;KAAE,WAAU;eAAwB;MAAY;KAC7C;IACF;EAEV,QACE,QACE,qBAAC;GAAI,WAAW,GAAG,oBAAoB;IAAE;IAAS;IAAM,CAAC,EAAE,UAAU;cAEnE,qBAAC;IAAI,WAAU;eACb,oBAAC;KACC,KAAK,QAAQ,MAAM,OAAO;KAC1B,KAAK,QAAQ,MAAM,OAAO,QAAQ;KAClC,OAAO;KACP,QAAQ;KACR,WAAW,GAAG,sBAAsB;MACpC,EACD,SACC,oBAAC;KAAI,WAAU;eACb,oBAAC;MAAM,SAAQ;gBAAW,MAAM;OAAc;MAC1C;KAEJ,EAGN,qBAAC;IAAI,WAAU;;KACb,oBAAC;MAAG,WAAU;gBACX,QAAQ,OACP,oBAAC;OAAE,MAAM,QAAQ;OAAM,WAAU;iBAC9B,QAAQ;QACP,GAEJ,QAAQ;OAEP;KAGL,qBAAC;MAAI,WAAU;iBACb,oBAAC;OAAE,WAAU;iBAAyB;QAAiB,EACtD,YACC,oBAAC;OAAE,WAAU;iBACV;QACC;OAEF;KAGL,WAAW,UACV,oBAAC;MACC,eAAY;MACZ,WAAU;gBAEV,oBAAC;OACC,SAAS,OAAO;OAChB,aAAa,OAAO;QACpB;OACE;KAIP,YACC,oBAAC;MACC,SAAS,SAAS;MAClB,OAAO,SAAS,SAAS;MACzB,UAAU,SAAS;MACnB,MAAK;OACL;KAIH,YAAY,mBACX,oBAAC;MAAO,SAAQ;MAAU,WAAU;gBAAwB;OAEnD;;KAEP;IACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Product } from "../../types/graphql.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 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_runtime0.JSX.Element;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { ProductPreview, ProductPreviewProps };
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/product-preview/index.tsx"],"sourcesContent":[],"mappings":";;;;KASY,mBAAA;WACD;;AADX,CAAA;AAGE,iBAEO,cAAA,CAAc;EAAA,OAAA;EAAA;AAAA,CAAA,EAA0B,mBAA1B,CAAA,EAA6C,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/components/product-preview/index.tsx"],"sourcesContent":[],"mappings":";;;;KASY,mBAAA;WACD;;AADX,CAAA;AAGE,iBAEO,cAAA,CAAc;EAAA,OAAA;EAAA;AAAA,CAAA,EAA0B,mBAA1B,CAAA,EAA6C,kBAAA,CAAA,GAAA,CAAA,OAA7C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LocalizedClientLink } from "../localized-client-link/index.js";
|
|
2
|
-
import { Thumbnail } from "../thumbnail/index.js";
|
|
3
2
|
import { PreviewPrice } from "../preview-price/index.js";
|
|
4
3
|
import { getProductPrice } from "../../lib/utils/get-product-price.js";
|
|
4
|
+
import { Thumbnail } from "../thumbnail/index.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { Text } from "@medusajs/ui";
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime1 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_runtime1.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_runtime6 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_runtime6.JSX.Element;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { ApolloClientProvider };
|
|
10
10
|
//# sourceMappingURL=apollo-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apollo-context.d.ts","names":[],"sources":["../../../src/lib/context/apollo-context.tsx"],"sourcesContent":[],"mappings":";;;;iBAQS,oBAAA;;GAAmC,oBAAiB,
|
|
1
|
+
{"version":3,"file":"apollo-context.d.ts","names":[],"sources":["../../../src/lib/context/apollo-context.tsx"],"sourcesContent":[],"mappings":";;;;iBAQS,oBAAA;;GAAmC,oBAAiB,kBAAA,CAAA,GAAA,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime9 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_runtime9.JSX.Element;
|
|
17
17
|
declare const useModal: () => ModalContext;
|
|
18
18
|
//#endregion
|
|
19
19
|
export { ModalProvider, useModal };
|