@gfed-medusa/sf-lib-common 3.3.5 → 3.3.7
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 +2 -2
- package/dist/components/breadcrumbs/index.js +2 -6
- package/dist/components/breadcrumbs/index.js.map +1 -1
- 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 -8
- package/dist/components/cart-mismatch-banner/index.js.map +1 -1
- package/dist/components/country-select/index.js +1 -3
- package/dist/components/country-select/index.js.map +1 -1
- package/dist/components/delete-button/index.d.ts +2 -2
- package/dist/components/error-message/index.d.ts +2 -2
- package/dist/components/error-message/index.d.ts.map +1 -1
- package/dist/components/error-message/index.js +1 -3
- package/dist/components/error-message/index.js.map +1 -1
- package/dist/components/free-shipping-price-nudge/index.d.ts +2 -2
- package/dist/components/free-shipping-price-nudge/index.js +47 -64
- 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/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.js +6 -10
- 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 +6 -8
- package/dist/components/modal/index.js.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/preview-price/index.js +1 -3
- package/dist/components/preview-price/index.js.map +1 -1
- 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 +2 -2
- package/dist/components/product-card/index.js.map +1 -1
- package/dist/components/product-preview/index.d.ts +5 -4
- package/dist/components/product-preview/index.d.ts.map +1 -1
- package/dist/components/product-preview/index.js.map +1 -1
- package/dist/components/submit-button/index.d.ts +2 -2
- package/dist/lib/config/medusa.js +2 -3
- package/dist/lib/config/medusa.js.map +1 -1
- 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/apollo-context.js +1 -2
- package/dist/lib/context/apollo-context.js.map +1 -1
- package/dist/lib/context/modal-context.d.ts +2 -2
- package/dist/lib/context/modal-context.js +1 -3
- package/dist/lib/context/modal-context.js.map +1 -1
- package/dist/lib/data/cart.js +17 -35
- package/dist/lib/data/cart.js.map +1 -1
- package/dist/lib/data/categories.d.ts +4 -15
- package/dist/lib/data/categories.d.ts.map +1 -1
- package/dist/lib/data/categories.js +5 -3
- package/dist/lib/data/categories.js.map +1 -1
- package/dist/lib/data/client-actions.js +2 -7
- package/dist/lib/data/client-actions.js.map +1 -1
- package/dist/lib/data/collections.js +4 -7
- package/dist/lib/data/collections.js.map +1 -1
- package/dist/lib/data/context.d.ts +2 -2
- package/dist/lib/data/context.d.ts.map +1 -1
- package/dist/lib/data/context.js +1 -3
- package/dist/lib/data/context.js.map +1 -1
- package/dist/lib/data/cookies-actions.d.ts.map +1 -1
- package/dist/lib/data/cookies-actions.js +14 -20
- package/dist/lib/data/cookies-actions.js.map +1 -1
- package/dist/lib/data/cookies-utils.js +3 -9
- package/dist/lib/data/cookies-utils.js.map +1 -1
- package/dist/lib/data/customer.js +10 -19
- package/dist/lib/data/customer.js.map +1 -1
- package/dist/lib/data/footer.js +1 -2
- package/dist/lib/data/footer.js.map +1 -1
- package/dist/lib/data/home-banner.d.ts +7 -0
- package/dist/lib/data/home-banner.d.ts.map +1 -0
- package/dist/lib/data/home-banner.js +16 -0
- package/dist/lib/data/home-banner.js.map +1 -0
- package/dist/lib/data/orders.js +2 -3
- package/dist/lib/data/orders.js.map +1 -1
- package/dist/lib/data/regions.js +6 -9
- package/dist/lib/data/regions.js.map +1 -1
- package/dist/lib/globals/expose-globals.js +1 -1
- package/dist/lib/gql/apollo-client.js +7 -12
- 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/customer.d.ts.map +1 -1
- 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 +6 -6
- package/dist/lib/gql/queries/cart.d.ts +2 -2
- package/dist/lib/gql/queries/cart.d.ts.map +1 -1
- package/dist/lib/gql/queries/collections.d.ts +3 -3
- 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/customer.d.ts.map +1 -1
- package/dist/lib/gql/queries/footer.d.ts +3 -3
- package/dist/lib/gql/queries/home-banner.d.ts +7 -0
- package/dist/lib/gql/queries/home-banner.d.ts.map +1 -0
- package/dist/lib/gql/queries/home-banner.js +46 -0
- package/dist/lib/gql/queries/home-banner.js.map +1 -0
- package/dist/lib/gql/queries/order.d.ts +4 -4
- package/dist/lib/gql/queries/product.d.ts +2 -2
- package/dist/lib/gql/queries/product.d.ts.map +1 -1
- package/dist/lib/gql/queries/product.js +3 -12
- package/dist/lib/gql/queries/product.js.map +1 -1
- package/dist/lib/gql/queries/regions.d.ts +3 -3
- package/dist/lib/gql/queries/shipping.d.ts +3 -3
- package/dist/lib/hooks/use-apollo.d.ts +2 -2
- package/dist/lib/hooks/use-apollo.js +1 -2
- package/dist/lib/hooks/use-apollo.js.map +1 -1
- package/dist/lib/hooks/use-cart.js +1 -3
- package/dist/lib/hooks/use-cart.js.map +1 -1
- package/dist/lib/hooks/use-customer.js +1 -3
- package/dist/lib/hooks/use-customer.js.map +1 -1
- package/dist/lib/utils/data-types.js +1 -1
- package/dist/lib/utils/data-types.js.map +1 -1
- package/dist/lib/utils/get-percentage-diff.js +1 -3
- package/dist/lib/utils/get-percentage-diff.js.map +1 -1
- package/dist/lib/utils/get-product-price.d.ts +3 -2
- package/dist/lib/utils/get-product-price.d.ts.map +1 -1
- package/dist/lib/utils/get-product-price.js +5 -15
- package/dist/lib/utils/get-product-price.js.map +1 -1
- package/dist/lib/utils/imagekit.d.ts.map +1 -1
- package/dist/lib/utils/imagekit.js +4 -6
- package/dist/lib/utils/imagekit.js.map +1 -1
- package/dist/lib/utils/medusa-error.js +2 -5
- package/dist/lib/utils/medusa-error.js.map +1 -1
- package/dist/types/cms.d.ts +27 -1
- package/dist/types/cms.d.ts.map +1 -1
- package/dist/types/graphql.d.ts +121 -12
- package/dist/types/graphql.d.ts.map +1 -1
- package/dist/types/graphql.js +258 -87
- package/dist/types/graphql.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { gql } from "@apollo/client";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/gql/queries/home-banner.ts
|
|
4
|
+
const GET_HOME_BANNER_QUERY = gql`
|
|
5
|
+
query GetHomeBanner {
|
|
6
|
+
homeBanner {
|
|
7
|
+
_id
|
|
8
|
+
_type
|
|
9
|
+
eyebrow
|
|
10
|
+
title
|
|
11
|
+
description
|
|
12
|
+
showPoweredBy
|
|
13
|
+
buttons {
|
|
14
|
+
label
|
|
15
|
+
href
|
|
16
|
+
openInNewTab
|
|
17
|
+
}
|
|
18
|
+
secondaryBanners {
|
|
19
|
+
title
|
|
20
|
+
description
|
|
21
|
+
showPoweredBy
|
|
22
|
+
image {
|
|
23
|
+
alt
|
|
24
|
+
asset {
|
|
25
|
+
url
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
button {
|
|
29
|
+
label
|
|
30
|
+
href
|
|
31
|
+
openInNewTab
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
image {
|
|
35
|
+
alt
|
|
36
|
+
asset {
|
|
37
|
+
url
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { GET_HOME_BANNER_QUERY };
|
|
46
|
+
//# sourceMappingURL=home-banner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"home-banner.js","names":[],"sources":["../../../../src/lib/gql/queries/home-banner.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const GET_HOME_BANNER_QUERY = gql`\n query GetHomeBanner {\n homeBanner {\n _id\n _type\n eyebrow\n title\n description\n showPoweredBy\n buttons {\n label\n href\n openInNewTab\n }\n secondaryBanners {\n title\n description\n showPoweredBy\n image {\n alt\n asset {\n url\n }\n }\n button {\n label\n href\n openInNewTab\n }\n }\n image {\n alt\n asset {\n url\n }\n }\n }\n }\n`;\n"],"mappings":";;;AAEA,MAAa,wBAAwB,GAAG"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _apollo_client34 from "@apollo/client";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/gql/queries/order.d.ts
|
|
4
|
-
declare const ORDER_FRAGMENT:
|
|
5
|
-
declare const GET_ORDER_QUERY:
|
|
6
|
-
declare const GET_ORDERS_QUERY:
|
|
4
|
+
declare const ORDER_FRAGMENT: _apollo_client34.DocumentNode;
|
|
5
|
+
declare const GET_ORDER_QUERY: _apollo_client34.DocumentNode;
|
|
6
|
+
declare const GET_ORDERS_QUERY: _apollo_client34.DocumentNode;
|
|
7
7
|
//#endregion
|
|
8
8
|
export { GET_ORDERS_QUERY, GET_ORDER_QUERY, ORDER_FRAGMENT };
|
|
9
9
|
//# sourceMappingURL=order.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _apollo_client27 from "@apollo/client";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/gql/queries/product.d.ts
|
|
4
|
-
declare const GET_PRODUCT_CATEGORIES_QUERY:
|
|
4
|
+
declare const GET_PRODUCT_CATEGORIES_QUERY: _apollo_client27.DocumentNode;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { GET_PRODUCT_CATEGORIES_QUERY };
|
|
7
7
|
//# sourceMappingURL=product.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/product.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"product.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/product.ts"],"sourcesContent":[],"mappings":";;;cAEa,8BAoBZ,gBAAA,CApBwC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PRODUCT_CATEGORY_FRAGMENT } from "../fragments/product.js";
|
|
2
1
|
import { gql } from "@apollo/client";
|
|
3
2
|
|
|
4
3
|
//#region src/lib/gql/queries/product.ts
|
|
@@ -17,19 +16,11 @@ const GET_PRODUCT_CATEGORIES_QUERY = gql`
|
|
|
17
16
|
handle: $handle
|
|
18
17
|
parent_category_id: $parent_category_id
|
|
19
18
|
) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
categoryChildren {
|
|
25
|
-
...ProductCategory
|
|
26
|
-
}
|
|
27
|
-
products {
|
|
28
|
-
count
|
|
29
|
-
}
|
|
19
|
+
id
|
|
20
|
+
name
|
|
21
|
+
handle
|
|
30
22
|
}
|
|
31
23
|
}
|
|
32
|
-
${PRODUCT_CATEGORY_FRAGMENT}
|
|
33
24
|
`;
|
|
34
25
|
|
|
35
26
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product.js","names":[],"sources":["../../../../src/lib/gql/queries/product.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\
|
|
1
|
+
{"version":3,"file":"product.js","names":[],"sources":["../../../../src/lib/gql/queries/product.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const GET_PRODUCT_CATEGORIES_QUERY = gql`\n query GetProductCategories(\n $limit: Int\n $offset: Int\n $q: String\n $handle: String\n $parent_category_id: String\n ) {\n productCategories(\n limit: $limit\n offset: $offset\n q: $q\n handle: $handle\n parent_category_id: $parent_category_id\n ) {\n id\n name\n handle\n }\n }\n`;\n"],"mappings":";;;AAEA,MAAa,+BAA+B,GAAG"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _apollo_client30 from "@apollo/client";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/gql/queries/regions.d.ts
|
|
4
|
-
declare const LIST_REGIONS_QUERY:
|
|
5
|
-
declare const GET_REGION_QUERY:
|
|
4
|
+
declare const LIST_REGIONS_QUERY: _apollo_client30.DocumentNode;
|
|
5
|
+
declare const GET_REGION_QUERY: _apollo_client30.DocumentNode;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { GET_REGION_QUERY, LIST_REGIONS_QUERY };
|
|
8
8
|
//# sourceMappingURL=regions.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _apollo_client0 from "@apollo/client";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/gql/queries/shipping.d.ts
|
|
4
|
-
declare const SHIPPING_OPTION_FRAGMENT:
|
|
5
|
-
declare const GET_SHIPPING_OPTIONS_QUERY:
|
|
4
|
+
declare const SHIPPING_OPTION_FRAGMENT: _apollo_client0.DocumentNode;
|
|
5
|
+
declare const GET_SHIPPING_OPTIONS_QUERY: _apollo_client0.DocumentNode;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { GET_SHIPPING_OPTIONS_QUERY, SHIPPING_OPTION_FRAGMENT };
|
|
8
8
|
//# sourceMappingURL=shipping.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _apollo_client1 from "@apollo/client";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/hooks/use-apollo.d.ts
|
|
4
|
-
declare function useApollo():
|
|
4
|
+
declare function useApollo(): _apollo_client1.ApolloClient;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { useApollo };
|
|
7
7
|
//# sourceMappingURL=use-apollo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-apollo.js","names":[],"sources":["../../../src/lib/hooks/use-apollo.tsx"],"sourcesContent":["import { useMemo } from 'react';\n\nimport { initializeApollo } from '@/lib/gql/apollo-client';\n\nexport function useApollo() {\n const storedClient = useMemo(initializeApollo, []);\n\n return storedClient;\n}\n"],"mappings":";;;;AAIA,SAAgB,YAAY;
|
|
1
|
+
{"version":3,"file":"use-apollo.js","names":[],"sources":["../../../src/lib/hooks/use-apollo.tsx"],"sourcesContent":["import { useMemo } from 'react';\n\nimport { initializeApollo } from '@/lib/gql/apollo-client';\n\nexport function useApollo() {\n const storedClient = useMemo(initializeApollo, []);\n\n return storedClient;\n}\n"],"mappings":";;;;AAIA,SAAgB,YAAY;AAG1B,QAFqB,QAAQ,kBAAkB,EAAE,CAAC"}
|
|
@@ -7,9 +7,7 @@ const CART_SWR_KEY = "medusa-cart";
|
|
|
7
7
|
const useCart = () => {
|
|
8
8
|
const { data, error, isLoading, mutate: swrMutate } = useSWR(CART_SWR_KEY, async () => {
|
|
9
9
|
const response = await fetch("/api/horz/cart", { credentials: "include" });
|
|
10
|
-
if (!response.ok)
|
|
11
|
-
throw new Error("Failed to fetch cart");
|
|
12
|
-
}
|
|
10
|
+
if (!response.ok) throw new Error("Failed to fetch cart");
|
|
13
11
|
const { cart } = await response.json();
|
|
14
12
|
return cart;
|
|
15
13
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-cart.js","names":[],"sources":["../../../src/lib/hooks/use-cart.ts"],"sourcesContent":["'use client';\n\nimport useSWR, { mutate } from 'swr';\n\nimport { Cart } from '../../types/graphql';\n\nconst CART_SWR_KEY = 'medusa-cart';\n\nexport const useCart = () => {\n const {\n data,\n error,\n isLoading,\n mutate: swrMutate,\n } = useSWR<Cart | null>(\n CART_SWR_KEY,\n async () => {\n const response = await fetch('/api/horz/cart', {\n credentials: 'include',\n });\n\n if (!response.ok) {\n throw new Error('Failed to fetch cart');\n }\n\n const { cart } = await response.json();\n return cart;\n },\n {\n revalidateOnFocus: false,\n revalidateOnReconnect: false,\n }\n );\n\n return {\n cart: data,\n error,\n isLoading,\n mutate: swrMutate,\n };\n};\n\nexport const mutateCart = () => {\n return mutate(CART_SWR_KEY);\n};\n"],"mappings":";;;;;AAMA,MAAM,eAAe;AAErB,MAAa,gBAAgB;CAC3B,MAAM,EACJ,MACA,OACA,WACA,QAAQ,cACN,OACF,cACA,YAAY;EACV,MAAM,WAAW,MAAM,MAAM,kBAAkB,EAC7C,aAAa,WACd,CAAC;AAEF,MAAI,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"use-cart.js","names":[],"sources":["../../../src/lib/hooks/use-cart.ts"],"sourcesContent":["'use client';\n\nimport useSWR, { mutate } from 'swr';\n\nimport { Cart } from '../../types/graphql';\n\nconst CART_SWR_KEY = 'medusa-cart';\n\nexport const useCart = () => {\n const {\n data,\n error,\n isLoading,\n mutate: swrMutate,\n } = useSWR<Cart | null>(\n CART_SWR_KEY,\n async () => {\n const response = await fetch('/api/horz/cart', {\n credentials: 'include',\n });\n\n if (!response.ok) {\n throw new Error('Failed to fetch cart');\n }\n\n const { cart } = await response.json();\n return cart;\n },\n {\n revalidateOnFocus: false,\n revalidateOnReconnect: false,\n }\n );\n\n return {\n cart: data,\n error,\n isLoading,\n mutate: swrMutate,\n };\n};\n\nexport const mutateCart = () => {\n return mutate(CART_SWR_KEY);\n};\n"],"mappings":";;;;;AAMA,MAAM,eAAe;AAErB,MAAa,gBAAgB;CAC3B,MAAM,EACJ,MACA,OACA,WACA,QAAQ,cACN,OACF,cACA,YAAY;EACV,MAAM,WAAW,MAAM,MAAM,kBAAkB,EAC7C,aAAa,WACd,CAAC;AAEF,MAAI,CAAC,SAAS,GACZ,OAAM,IAAI,MAAM,uBAAuB;EAGzC,MAAM,EAAE,SAAS,MAAM,SAAS,MAAM;AACtC,SAAO;IAET;EACE,mBAAmB;EACnB,uBAAuB;EACxB,CACF;AAED,QAAO;EACL,MAAM;EACN;EACA;EACA,QAAQ;EACT;;AAGH,MAAa,mBAAmB;AAC9B,QAAO,OAAO,aAAa"}
|
|
@@ -7,9 +7,7 @@ const CUSTOMER_SWR_KEY = "medusa-customer";
|
|
|
7
7
|
const useCustomer = () => {
|
|
8
8
|
const { data, error, isLoading, mutate: swrMutate } = useSWR(CUSTOMER_SWR_KEY, async () => {
|
|
9
9
|
const response = await fetch("/api/horz/customer", { credentials: "include" });
|
|
10
|
-
if (!response.ok)
|
|
11
|
-
throw new Error("Failed to fetch customer");
|
|
12
|
-
}
|
|
10
|
+
if (!response.ok) throw new Error("Failed to fetch customer");
|
|
13
11
|
const { customer } = await response.json();
|
|
14
12
|
return customer;
|
|
15
13
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-customer.js","names":[],"sources":["../../../src/lib/hooks/use-customer.tsx"],"sourcesContent":["'use client';\n\nimport useSWR from 'swr';\n\nimport { Customer } from '../../types/graphql';\n\nconst CUSTOMER_SWR_KEY = 'medusa-customer';\n\nexport const useCustomer = () => {\n const {\n data,\n error,\n isLoading,\n mutate: swrMutate,\n } = useSWR<Customer | null>(\n CUSTOMER_SWR_KEY,\n async () => {\n const response = await fetch('/api/horz/customer', {\n credentials: 'include',\n });\n\n if (!response.ok) {\n throw new Error('Failed to fetch customer');\n }\n\n const { customer } = await response.json();\n\n return customer;\n },\n {\n revalidateOnFocus: false,\n revalidateOnReconnect: false,\n }\n );\n\n return {\n customer: data,\n error,\n isLoading,\n mutate: swrMutate,\n };\n};\n"],"mappings":";;;;;AAMA,MAAM,mBAAmB;AAEzB,MAAa,oBAAoB;CAC/B,MAAM,EACJ,MACA,OACA,WACA,QAAQ,cACN,OACF,kBACA,YAAY;EACV,MAAM,WAAW,MAAM,MAAM,sBAAsB,EACjD,aAAa,WACd,CAAC;AAEF,MAAI,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"use-customer.js","names":[],"sources":["../../../src/lib/hooks/use-customer.tsx"],"sourcesContent":["'use client';\n\nimport useSWR from 'swr';\n\nimport { Customer } from '../../types/graphql';\n\nconst CUSTOMER_SWR_KEY = 'medusa-customer';\n\nexport const useCustomer = () => {\n const {\n data,\n error,\n isLoading,\n mutate: swrMutate,\n } = useSWR<Customer | null>(\n CUSTOMER_SWR_KEY,\n async () => {\n const response = await fetch('/api/horz/customer', {\n credentials: 'include',\n });\n\n if (!response.ok) {\n throw new Error('Failed to fetch customer');\n }\n\n const { customer } = await response.json();\n\n return customer;\n },\n {\n revalidateOnFocus: false,\n revalidateOnReconnect: false,\n }\n );\n\n return {\n customer: data,\n error,\n isLoading,\n mutate: swrMutate,\n };\n};\n"],"mappings":";;;;;AAMA,MAAM,mBAAmB;AAEzB,MAAa,oBAAoB;CAC/B,MAAM,EACJ,MACA,OACA,WACA,QAAQ,cACN,OACF,kBACA,YAAY;EACV,MAAM,WAAW,MAAM,MAAM,sBAAsB,EACjD,aAAa,WACd,CAAC;AAEF,MAAI,CAAC,SAAS,GACZ,OAAM,IAAI,MAAM,2BAA2B;EAG7C,MAAM,EAAE,aAAa,MAAM,SAAS,MAAM;AAE1C,SAAO;IAET;EACE,mBAAmB;EACnB,uBAAuB;EACxB,CACF;AAED,QAAO;EACL,UAAU;EACV;EACA;EACA,QAAQ;EACT"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const isObject = (input) => input instanceof Object;
|
|
3
3
|
const isArray = (input) => Array.isArray(input);
|
|
4
4
|
const isEmpty = (input) => {
|
|
5
|
-
return input === null || input ===
|
|
5
|
+
return input === null || input === void 0 || isObject(input) && Object.keys(input).length === 0 || isArray(input) && input.length === 0 || typeof input === "string" && input.trim().length === 0;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-types.js","names":[],"sources":["../../../src/lib/utils/data-types.ts"],"sourcesContent":["export const isObject = (input: any) => input instanceof Object;\nexport const isArray = (input: any) => Array.isArray(input);\nexport const isEmpty = (input: any) => {\n return (\n input === null ||\n input === undefined ||\n (isObject(input) && Object.keys(input).length === 0) ||\n (isArray(input) && (input as any[]).length === 0) ||\n (typeof input === 'string' && input.trim().length === 0)\n );\n};\n"],"mappings":";AAAA,MAAa,YAAY,UAAe,iBAAiB;AACzD,MAAa,WAAW,UAAe,MAAM,QAAQ,MAAM;AAC3D,MAAa,WAAW,UAAe;AACrC,QACE,UAAU,QACV,UAAU,
|
|
1
|
+
{"version":3,"file":"data-types.js","names":[],"sources":["../../../src/lib/utils/data-types.ts"],"sourcesContent":["export const isObject = (input: any) => input instanceof Object;\nexport const isArray = (input: any) => Array.isArray(input);\nexport const isEmpty = (input: any) => {\n return (\n input === null ||\n input === undefined ||\n (isObject(input) && Object.keys(input).length === 0) ||\n (isArray(input) && (input as any[]).length === 0) ||\n (typeof input === 'string' && input.trim().length === 0)\n );\n};\n"],"mappings":";AAAA,MAAa,YAAY,UAAe,iBAAiB;AACzD,MAAa,WAAW,UAAe,MAAM,QAAQ,MAAM;AAC3D,MAAa,WAAW,UAAe;AACrC,QACE,UAAU,QACV,UAAU,UACT,SAAS,MAAM,IAAI,OAAO,KAAK,MAAM,CAAC,WAAW,KACjD,QAAQ,MAAM,IAAK,MAAgB,WAAW,KAC9C,OAAO,UAAU,YAAY,MAAM,MAAM,CAAC,WAAW"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
//#region src/lib/utils/get-percentage-diff.ts
|
|
2
2
|
const getPercentageDiff = (original, calculated) => {
|
|
3
|
-
|
|
4
|
-
const decrease = diff / original * 100;
|
|
5
|
-
return decrease.toFixed();
|
|
3
|
+
return ((original - calculated) / original * 100).toFixed();
|
|
6
4
|
};
|
|
7
5
|
|
|
8
6
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-percentage-diff.js","names":[],"sources":["../../../src/lib/utils/get-percentage-diff.ts"],"sourcesContent":["export const getPercentageDiff = (original: number, calculated: number) => {\n const diff = original - calculated;\n const decrease = (diff / original) * 100;\n\n return decrease.toFixed();\n};\n"],"mappings":";AAAA,MAAa,qBAAqB,UAAkB,eAAuB;
|
|
1
|
+
{"version":3,"file":"get-percentage-diff.js","names":[],"sources":["../../../src/lib/utils/get-percentage-diff.ts"],"sourcesContent":["export const getPercentageDiff = (original: number, calculated: number) => {\n const diff = original - calculated;\n const decrease = (diff / original) * 100;\n\n return decrease.toFixed();\n};\n"],"mappings":";AAAA,MAAa,qBAAqB,UAAkB,eAAuB;AAIzE,UAHa,WAAW,cACC,WAAY,KAErB,SAAS"}
|
|
@@ -10,14 +10,15 @@ declare const getPricesForVariant: (variant: any) => {
|
|
|
10
10
|
price_type: any;
|
|
11
11
|
percentage_diff: string;
|
|
12
12
|
} | null;
|
|
13
|
+
type ProductWithPricing = Pick<Product, 'id' | 'variants'>;
|
|
13
14
|
declare function getProductPrice({
|
|
14
15
|
product,
|
|
15
16
|
variantId
|
|
16
17
|
}: {
|
|
17
|
-
product:
|
|
18
|
+
product: ProductWithPricing;
|
|
18
19
|
variantId?: string;
|
|
19
20
|
}): {
|
|
20
|
-
product:
|
|
21
|
+
product: ProductWithPricing;
|
|
21
22
|
cheapestPrice: {
|
|
22
23
|
calculated_price_number: any;
|
|
23
24
|
calculated_price: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-product-price.d.ts","names":[],"sources":["../../../src/lib/utils/get-product-price.ts"],"sourcesContent":[],"mappings":";;;cAKa;;EAAA,gBAAA,EAAA,MAwBZ;
|
|
1
|
+
{"version":3,"file":"get-product-price.d.ts","names":[],"sources":["../../../src/lib/utils/get-product-price.ts"],"sourcesContent":[],"mappings":";;;cAKa;;EAAA,gBAAA,EAAA,MAwBZ;EAEI,qBAAkB,EAAA,GAAA;EAEP,cAAA,EAAA,MAAe;EAC7B,aAAA,EAAA,GAAA;EACA,UAAA,EAAA,GAAA;EAES,eAAA,EAAA,MAAA;;KANN,kBAAA,GAAqB,KAAK;iBAEf,eAAA;;;;WAIL"}
|
|
@@ -3,9 +3,7 @@ import { getPercentageDiff } from "./get-percentage-diff.js";
|
|
|
3
3
|
|
|
4
4
|
//#region src/lib/utils/get-product-price.ts
|
|
5
5
|
const getPricesForVariant = (variant) => {
|
|
6
|
-
if (!variant?.price?.amount)
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
6
|
+
if (!variant?.price?.amount) return null;
|
|
9
7
|
return {
|
|
10
8
|
calculated_price_number: variant.price?.amount,
|
|
11
9
|
calculated_price: convertToLocale({
|
|
@@ -23,26 +21,18 @@ const getPricesForVariant = (variant) => {
|
|
|
23
21
|
};
|
|
24
22
|
};
|
|
25
23
|
function getProductPrice({ product, variantId }) {
|
|
26
|
-
if (!product || !product.id)
|
|
27
|
-
throw new Error("No product provided");
|
|
28
|
-
}
|
|
24
|
+
if (!product || !product.id) throw new Error("No product provided");
|
|
29
25
|
const cheapestPrice = () => {
|
|
30
|
-
if (!product || !product.variants?.length)
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
26
|
+
if (!product || !product.variants?.length) return null;
|
|
33
27
|
const cheapestVariant = product.variants.filter((v) => !!v.price).sort((a, b) => {
|
|
34
28
|
return (a.price?.amount ?? 0) - (b.price?.amount ?? 0);
|
|
35
29
|
})[0];
|
|
36
30
|
return getPricesForVariant(cheapestVariant);
|
|
37
31
|
};
|
|
38
32
|
const variantPrice = () => {
|
|
39
|
-
if (!product || !variantId)
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
33
|
+
if (!product || !variantId) return null;
|
|
42
34
|
const variant = product.variants?.find((v) => v.id === variantId || v.sku === variantId);
|
|
43
|
-
if (!variant)
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
35
|
+
if (!variant) return null;
|
|
46
36
|
return getPricesForVariant(variant);
|
|
47
37
|
};
|
|
48
38
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-product-price.js","names":["cheapestVariant: any","variant: any"],"sources":["../../../src/lib/utils/get-product-price.ts"],"sourcesContent":["import { Product } from '@/types/graphql';\n\nimport { getPercentageDiff } from './get-percentage-diff';\nimport { convertToLocale } from './money';\n\nexport const getPricesForVariant = (variant: any) => {\n if (!variant?.price?.amount) {\n return null;\n }\n\n return {\n calculated_price_number: variant.price?.amount,\n calculated_price: convertToLocale({\n amount: variant.price.amount,\n currency_code: variant.price.currencyCode || '',\n }),\n original_price_number:\n variant.originalPrice?.amount || variant.price.amount,\n original_price: convertToLocale({\n amount: variant.originalPrice?.amount || variant.price.amount,\n currency_code: variant.price.currencyCode || '',\n }),\n currency_code: variant.price.currencyCode,\n price_type: variant.price.priceType || 'default',\n percentage_diff: getPercentageDiff(\n variant.originalPrice?.amount || variant.price.amount,\n variant.price.amount\n ),\n };\n};\n\nexport function getProductPrice({\n product,\n variantId,\n}: {\n product:
|
|
1
|
+
{"version":3,"file":"get-product-price.js","names":["cheapestVariant: any","variant: any"],"sources":["../../../src/lib/utils/get-product-price.ts"],"sourcesContent":["import { Product } from '@/types/graphql';\n\nimport { getPercentageDiff } from './get-percentage-diff';\nimport { convertToLocale } from './money';\n\nexport const getPricesForVariant = (variant: any) => {\n if (!variant?.price?.amount) {\n return null;\n }\n\n return {\n calculated_price_number: variant.price?.amount,\n calculated_price: convertToLocale({\n amount: variant.price.amount,\n currency_code: variant.price.currencyCode || '',\n }),\n original_price_number:\n variant.originalPrice?.amount || variant.price.amount,\n original_price: convertToLocale({\n amount: variant.originalPrice?.amount || variant.price.amount,\n currency_code: variant.price.currencyCode || '',\n }),\n currency_code: variant.price.currencyCode,\n price_type: variant.price.priceType || 'default',\n percentage_diff: getPercentageDiff(\n variant.originalPrice?.amount || variant.price.amount,\n variant.price.amount\n ),\n };\n};\n\ntype ProductWithPricing = Pick<Product, 'id' | 'variants'>;\n\nexport function getProductPrice({\n product,\n variantId,\n}: {\n product: ProductWithPricing;\n variantId?: string;\n}) {\n if (!product || !product.id) {\n throw new Error('No product provided');\n }\n\n const cheapestPrice = () => {\n if (!product || !product.variants?.length) {\n return null;\n }\n\n const cheapestVariant: any = product.variants\n .filter((v: any) => !!v.price)\n .sort((a: any, b: any) => {\n return (a.price?.amount ?? 0) - (b.price?.amount ?? 0);\n })[0];\n\n return getPricesForVariant(cheapestVariant);\n };\n\n const variantPrice = () => {\n if (!product || !variantId) {\n return null;\n }\n\n const variant: any = product.variants?.find(\n (v) => v.id === variantId || v.sku === variantId\n );\n\n if (!variant) {\n return null;\n }\n\n return getPricesForVariant(variant);\n };\n\n return {\n product,\n cheapestPrice: cheapestPrice(),\n variantPrice: variantPrice(),\n };\n}\n"],"mappings":";;;;AAKA,MAAa,uBAAuB,YAAiB;AACnD,KAAI,CAAC,SAAS,OAAO,OACnB,QAAO;AAGT,QAAO;EACL,yBAAyB,QAAQ,OAAO;EACxC,kBAAkB,gBAAgB;GAChC,QAAQ,QAAQ,MAAM;GACtB,eAAe,QAAQ,MAAM,gBAAgB;GAC9C,CAAC;EACF,uBACE,QAAQ,eAAe,UAAU,QAAQ,MAAM;EACjD,gBAAgB,gBAAgB;GAC9B,QAAQ,QAAQ,eAAe,UAAU,QAAQ,MAAM;GACvD,eAAe,QAAQ,MAAM,gBAAgB;GAC9C,CAAC;EACF,eAAe,QAAQ,MAAM;EAC7B,YAAY,QAAQ,MAAM,aAAa;EACvC,iBAAiB,kBACf,QAAQ,eAAe,UAAU,QAAQ,MAAM,QAC/C,QAAQ,MAAM,OACf;EACF;;AAKH,SAAgB,gBAAgB,EAC9B,SACA,aAIC;AACD,KAAI,CAAC,WAAW,CAAC,QAAQ,GACvB,OAAM,IAAI,MAAM,sBAAsB;CAGxC,MAAM,sBAAsB;AAC1B,MAAI,CAAC,WAAW,CAAC,QAAQ,UAAU,OACjC,QAAO;EAGT,MAAMA,kBAAuB,QAAQ,SAClC,QAAQ,MAAW,CAAC,CAAC,EAAE,MAAM,CAC7B,MAAM,GAAQ,MAAW;AACxB,WAAQ,EAAE,OAAO,UAAU,MAAM,EAAE,OAAO,UAAU;IACpD,CAAC;AAEL,SAAO,oBAAoB,gBAAgB;;CAG7C,MAAM,qBAAqB;AACzB,MAAI,CAAC,WAAW,CAAC,UACf,QAAO;EAGT,MAAMC,UAAe,QAAQ,UAAU,MACpC,MAAM,EAAE,OAAO,aAAa,EAAE,QAAQ,UACxC;AAED,MAAI,CAAC,QACH,QAAO;AAGT,SAAO,oBAAoB,QAAQ;;AAGrC,QAAO;EACL;EACA,eAAe,eAAe;EAC9B,cAAc,cAAc;EAC7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imagekit.d.ts","names":[],"sources":["../../../src/lib/utils/imagekit.ts"],"sourcesContent":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"imagekit.d.ts","names":[],"sources":["../../../src/lib/utils/imagekit.ts"],"sourcesContent":[],"mappings":";iBAKgB,cAAA;EAAA,KAAA,CAAA,EAAA,MAAA"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
//#region src/lib/utils/imagekit.ts
|
|
2
|
+
const EXTERNAL_STORAGES = ["cdn.sanity.io", "cdn.shopify.com"];
|
|
2
3
|
function getImageKitUrl(src, options) {
|
|
3
4
|
if (!src) return src;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
if (src.includes("ik.imagekit.io")) {
|
|
7
|
-
return src;
|
|
8
|
-
}
|
|
5
|
+
const normalizedEndpoint = "https://ik.imagekit.io/94rjnwlop".replace(/\/$/, "");
|
|
6
|
+
if (src.includes("ik.imagekit.io")) return src;
|
|
9
7
|
const params = [];
|
|
10
8
|
if (options?.width) params.push(`w-${options.width}`);
|
|
11
9
|
if (options?.height) params.push(`h-${options.height}`);
|
|
@@ -14,7 +12,7 @@ function getImageKitUrl(src, options) {
|
|
|
14
12
|
const transformStr = params.length > 0 ? `tr:${params.join(",")}` : "";
|
|
15
13
|
if (src.startsWith("http://") || src.startsWith("https://")) {
|
|
16
14
|
let urlPath = src.replace(/^https?:\/\//, "");
|
|
17
|
-
urlPath = urlPath.replace(
|
|
15
|
+
for (const domain of EXTERNAL_STORAGES) urlPath = urlPath.replace(/* @__PURE__ */ new RegExp(`^${domain}/`), "");
|
|
18
16
|
return transformStr ? `${normalizedEndpoint}/${transformStr}/${urlPath}` : `${normalizedEndpoint}/${urlPath}`;
|
|
19
17
|
}
|
|
20
18
|
const normalizedSrc = src.startsWith("/") ? src.slice(1) : src;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imagekit.js","names":["params: string[]"],"sources":["../../../src/lib/utils/imagekit.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"imagekit.js","names":["params: string[]"],"sources":["../../../src/lib/utils/imagekit.ts"],"sourcesContent":["const EXTERNAL_STORAGES = [\n 'cdn.sanity.io',\n 'cdn.shopify.com',\n];\n\nexport function getImageKitUrl(\n src: string,\n options?: { width?: number; height?: number; quality?: number }\n): string {\n if (!src) return src;\n\n const publicEndpoint = 'https://ik.imagekit.io/94rjnwlop';\n const normalizedEndpoint = publicEndpoint.replace(/\\/$/, '');\n\n if (src.includes('ik.imagekit.io')) {\n return src;\n }\n\n const params: string[] = [];\n if (options?.width) params.push(`w-${options.width}`);\n if (options?.height) params.push(`h-${options.height}`);\n if (options?.quality) params.push(`q-${options.quality}`);\n params.push('f-auto');\n\n const transformStr = params.length > 0 ? `tr:${params.join(',')}` : '';\n\n if (src.startsWith('http://') || src.startsWith('https://')) {\n let urlPath = src.replace(/^https?:\\/\\//, '');\n for (const domain of EXTERNAL_STORAGES) {\n urlPath = urlPath.replace(new RegExp(`^${domain}/`), '');\n }\n return transformStr\n ? `${normalizedEndpoint}/${transformStr}/${urlPath}`\n : `${normalizedEndpoint}/${urlPath}`;\n }\n\n const normalizedSrc = src.startsWith('/') ? src.slice(1) : src;\n return transformStr\n ? `${normalizedEndpoint}/${transformStr}/${normalizedSrc}`\n : `${normalizedEndpoint}/${normalizedSrc}`;\n}\n"],"mappings":";AAAA,MAAM,oBAAoB,CACxB,iBACA,kBACD;AAED,SAAgB,eACd,KACA,SACQ;AACR,KAAI,CAAC,IAAK,QAAO;CAGjB,MAAM,qBADiB,mCACmB,QAAQ,OAAO,GAAG;AAE5D,KAAI,IAAI,SAAS,iBAAiB,CAChC,QAAO;CAGT,MAAMA,SAAmB,EAAE;AAC3B,KAAI,SAAS,MAAO,QAAO,KAAK,KAAK,QAAQ,QAAQ;AACrD,KAAI,SAAS,OAAQ,QAAO,KAAK,KAAK,QAAQ,SAAS;AACvD,KAAI,SAAS,QAAS,QAAO,KAAK,KAAK,QAAQ,UAAU;AACzD,QAAO,KAAK,SAAS;CAErB,MAAM,eAAe,OAAO,SAAS,IAAI,MAAM,OAAO,KAAK,IAAI,KAAK;AAEpE,KAAI,IAAI,WAAW,UAAU,IAAI,IAAI,WAAW,WAAW,EAAE;EAC3D,IAAI,UAAU,IAAI,QAAQ,gBAAgB,GAAG;AAC7C,OAAK,MAAM,UAAU,kBACnB,WAAU,QAAQ,wBAAQ,IAAI,OAAO,IAAI,OAAO,GAAG,EAAE,GAAG;AAE1D,SAAO,eACH,GAAG,mBAAmB,GAAG,aAAa,GAAG,YACzC,GAAG,mBAAmB,GAAG;;CAG/B,MAAM,gBAAgB,IAAI,WAAW,IAAI,GAAG,IAAI,MAAM,EAAE,GAAG;AAC3D,QAAO,eACH,GAAG,mBAAmB,GAAG,aAAa,GAAG,kBACzC,GAAG,mBAAmB,GAAG"}
|
|
@@ -8,11 +8,8 @@ function medusaError(error) {
|
|
|
8
8
|
console.error("Headers:", error.response.headers);
|
|
9
9
|
const message = error.response.data.message || error.response.data;
|
|
10
10
|
throw new Error(message.charAt(0).toUpperCase() + message.slice(1) + ".");
|
|
11
|
-
} else if (error.request)
|
|
12
|
-
|
|
13
|
-
} else {
|
|
14
|
-
throw new Error("Error setting up the request: " + error.message);
|
|
15
|
-
}
|
|
11
|
+
} else if (error.request) throw new Error("No response received: " + error.request);
|
|
12
|
+
else throw new Error("Error setting up the request: " + error.message);
|
|
16
13
|
}
|
|
17
14
|
|
|
18
15
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"medusa-error.js","names":[],"sources":["../../../src/lib/utils/medusa-error.ts"],"sourcesContent":["export function medusaError(error: any): never {\n if (error.response) {\n // The request was made and the server responded with a status code\n // that falls out of the range of 2xx\n const u = new URL(error.config.url, error.config.baseURL);\n console.error('Resource:', u.toString());\n console.error('Response data:', error.response.data);\n console.error('Status code:', error.response.status);\n console.error('Headers:', error.response.headers);\n\n // Extracting the error message from the response data\n const message = error.response.data.message || error.response.data;\n\n throw new Error(message.charAt(0).toUpperCase() + message.slice(1) + '.');\n } else if (error.request) {\n // The request was made but no response was received\n throw new Error('No response received: ' + error.request);\n } else {\n // Something happened in setting up the request that triggered an Error\n throw new Error('Error setting up the request: ' + error.message);\n }\n}\n"],"mappings":";AAAA,SAAgB,YAAY,OAAmB;AAC7C,KAAI,MAAM,UAAU;EAGlB,MAAM,IAAI,IAAI,IAAI,MAAM,OAAO,KAAK,MAAM,OAAO,QAAQ;AACzD,UAAQ,MAAM,aAAa,EAAE,UAAU,CAAC;AACxC,UAAQ,MAAM,kBAAkB,MAAM,SAAS,KAAK;AACpD,UAAQ,MAAM,gBAAgB,MAAM,SAAS,OAAO;AACpD,UAAQ,MAAM,YAAY,MAAM,SAAS,QAAQ;EAGjD,MAAM,UAAU,MAAM,SAAS,KAAK,WAAW,MAAM,SAAS;AAE9D,QAAM,IAAI,MAAM,QAAQ,OAAO,EAAE,CAAC,aAAa,GAAG,QAAQ,MAAM,EAAE,GAAG,IAAI;YAChE,MAAM,
|
|
1
|
+
{"version":3,"file":"medusa-error.js","names":[],"sources":["../../../src/lib/utils/medusa-error.ts"],"sourcesContent":["export function medusaError(error: any): never {\n if (error.response) {\n // The request was made and the server responded with a status code\n // that falls out of the range of 2xx\n const u = new URL(error.config.url, error.config.baseURL);\n console.error('Resource:', u.toString());\n console.error('Response data:', error.response.data);\n console.error('Status code:', error.response.status);\n console.error('Headers:', error.response.headers);\n\n // Extracting the error message from the response data\n const message = error.response.data.message || error.response.data;\n\n throw new Error(message.charAt(0).toUpperCase() + message.slice(1) + '.');\n } else if (error.request) {\n // The request was made but no response was received\n throw new Error('No response received: ' + error.request);\n } else {\n // Something happened in setting up the request that triggered an Error\n throw new Error('Error setting up the request: ' + error.message);\n }\n}\n"],"mappings":";AAAA,SAAgB,YAAY,OAAmB;AAC7C,KAAI,MAAM,UAAU;EAGlB,MAAM,IAAI,IAAI,IAAI,MAAM,OAAO,KAAK,MAAM,OAAO,QAAQ;AACzD,UAAQ,MAAM,aAAa,EAAE,UAAU,CAAC;AACxC,UAAQ,MAAM,kBAAkB,MAAM,SAAS,KAAK;AACpD,UAAQ,MAAM,gBAAgB,MAAM,SAAS,OAAO;AACpD,UAAQ,MAAM,YAAY,MAAM,SAAS,QAAQ;EAGjD,MAAM,UAAU,MAAM,SAAS,KAAK,WAAW,MAAM,SAAS;AAE9D,QAAM,IAAI,MAAM,QAAQ,OAAO,EAAE,CAAC,aAAa,GAAG,QAAQ,MAAM,EAAE,GAAG,IAAI;YAChE,MAAM,QAEf,OAAM,IAAI,MAAM,2BAA2B,MAAM,QAAQ;KAGzD,OAAM,IAAI,MAAM,mCAAmC,MAAM,QAAQ"}
|
package/dist/types/cms.d.ts
CHANGED
|
@@ -27,6 +27,32 @@ type SanityImage = {
|
|
|
27
27
|
asset?: SanityImageAsset | null;
|
|
28
28
|
caption?: string | null;
|
|
29
29
|
};
|
|
30
|
+
type BannerLink = {
|
|
31
|
+
__typename?: 'BannerButton';
|
|
32
|
+
href?: string | null;
|
|
33
|
+
label?: string | null;
|
|
34
|
+
openInNewTab?: boolean | null;
|
|
35
|
+
};
|
|
36
|
+
type SecondaryBannerContent = {
|
|
37
|
+
__typename?: 'SecondaryBanner';
|
|
38
|
+
button?: BannerLink | null;
|
|
39
|
+
description?: string | null;
|
|
40
|
+
image?: SanityImage | null;
|
|
41
|
+
showPoweredBy?: boolean | null;
|
|
42
|
+
title?: string | null;
|
|
43
|
+
};
|
|
44
|
+
type HomeBannerContent = {
|
|
45
|
+
__typename?: 'HomeBanner';
|
|
46
|
+
_id: string;
|
|
47
|
+
_type: string;
|
|
48
|
+
buttons?: BannerLink[] | null;
|
|
49
|
+
description?: string | null;
|
|
50
|
+
eyebrow?: string | null;
|
|
51
|
+
image?: SanityImage | null;
|
|
52
|
+
showPoweredBy?: boolean | null;
|
|
53
|
+
secondaryBanners?: SecondaryBannerContent[] | null;
|
|
54
|
+
title?: string | null;
|
|
55
|
+
};
|
|
30
56
|
type FileBlock = {
|
|
31
57
|
__typename?: 'FileBlock';
|
|
32
58
|
_key: string;
|
|
@@ -81,5 +107,5 @@ type TextBlock = {
|
|
|
81
107
|
};
|
|
82
108
|
type RichTextBlock = FileBlock | ImageBlock | TextBlock;
|
|
83
109
|
//#endregion
|
|
84
|
-
export { FileBlock, IconLinkMark, ImageBlock, LinkMark, MarkDef, RichTextBlock, SanityFileAsset, SanityImage, SanityImageAsset, Span, TextBlock };
|
|
110
|
+
export { BannerLink, FileBlock, HomeBannerContent, IconLinkMark, ImageBlock, LinkMark, MarkDef, RichTextBlock, SanityFileAsset, SanityImage, SanityImageAsset, SecondaryBannerContent, Span, TextBlock };
|
|
85
111
|
//# sourceMappingURL=cms.d.ts.map
|
package/dist/types/cms.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cms.d.ts","names":[],"sources":["../../src/types/cms.ts"],"sourcesContent":[],"mappings":";KAEY,eAAA;EAAA,UAAA,CAAA,EAAA,iBAAe;EASf,GAAA,EAAA,MAAA;EAeA,QAAA,CAAA,EAAA,MAAW,GAAA,IAAA;EAOX,
|
|
1
|
+
{"version":3,"file":"cms.d.ts","names":[],"sources":["../../src/types/cms.ts"],"sourcesContent":[],"mappings":";KAEY,eAAA;EAAA,UAAA,CAAA,EAAA,iBAAe;EASf,GAAA,EAAA,MAAA;EAeA,QAAA,CAAA,EAAA,MAAW,GAAA,IAAA;EAOX,gBAAU,CAAA,EAAA,MAAA,GAAA,IAAA;EAOV,IAAA,CAAA,EAAA,MAAA,GAAA,IAAA;EASA,GAAA,EAAA,MAAA;CAIA;AAGF,KA7CE,gBAAA,GA6CF;EAEW,UAAA,CAAA,EAAA,kBAAA;EAAsB,GAAA,EAAA,MAAA;EAI/B,QAAA,CAAA,EAAA;IAOA,UAAU,CAAA,EAAA;MASV,WAAQ,EAAA,MAAA;MAQR,MAAA,EAAY,MAAA;MAcZ,KAAO,EAAA,MAAA;IAEP,CAAA,GAAI,IAAA;IAQJ,QAAS,CAAA,EAAA,OAAA,GAIT,IAAA;IAOA,QAAA,CAAA,EAAA,OAAa,GAAA,IAAA;EAAG,CAAA,GAAA,IAAA;EAAY,GAAA,EAAA,MAAA;CAAa;AAAS,KA/FlD,WAAA,GA+FkD;;;UA5FpD;;;KAIE,UAAA;;;;;;KAOA,sBAAA;;WAED;;UAED;;;;KAKE,iBAAA;;;;YAIA;;;UAGF;;qBAEW;;;KAIT,SAAA;;;;UAIF;;KAGE,UAAA;;;;;UAKF;;;KAIE,QAAA;;;;;;;KAQA,YAAA;;;;;;;;cAQE;;;;;KAMF,OAAA,GAAU,eAAe;KAEzB,IAAA;;;;;;;KAQA,SAAA;;;;YAIA;;;aAGC;;;KAID,aAAA,GAAgB,YAAY,aAAa"}
|