@shopify/shop-minis-react 0.0.11 → 0.0.13
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/_virtual/debounce.js +8 -0
- package/dist/_virtual/debounce.js.map +1 -0
- package/dist/components/commerce/merchant-card.js +201 -0
- package/dist/components/commerce/merchant-card.js.map +1 -0
- package/dist/components/commerce/product-card.js +11 -9
- package/dist/components/commerce/product-card.js.map +1 -1
- package/dist/hooks/product/useCuratedProducts.js +20 -0
- package/dist/hooks/product/useCuratedProducts.js.map +1 -0
- package/dist/hooks/product/useProduct.js +24 -0
- package/dist/hooks/product/useProduct.js.map +1 -0
- package/dist/hooks/product/useProductMedia.js +24 -0
- package/dist/hooks/product/useProductMedia.js.map +1 -0
- package/dist/hooks/product/useProductSearch.js +44 -0
- package/dist/hooks/product/useProductSearch.js.map +1 -0
- package/dist/hooks/product/useProductVariants.js +21 -0
- package/dist/hooks/product/useProductVariants.js.map +1 -0
- package/dist/hooks/product/useProducts.js +17 -0
- package/dist/hooks/product/useProducts.js.map +1 -0
- package/dist/hooks/shop/useShop.js +17 -0
- package/dist/hooks/shop/useShop.js.map +1 -0
- package/dist/hooks/user/useFollowedShops.js +21 -0
- package/dist/hooks/user/useFollowedShops.js.map +1 -0
- package/dist/hooks/user/useRecentProducts.js +21 -0
- package/dist/hooks/user/useRecentProducts.js.map +1 -0
- package/dist/hooks/user/useRecentShops.js +21 -0
- package/dist/hooks/user/useRecentShops.js.map +1 -0
- package/dist/hooks/user/useSavedProducts.js +21 -0
- package/dist/hooks/user/useSavedProducts.js.map +1 -0
- package/dist/index.js +210 -178
- package/dist/index.js.map +1 -1
- package/dist/internal/useShopActionsPaginatedDataFetching.js +24 -24
- package/dist/internal/useShopActionsPaginatedDataFetching.js.map +1 -1
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js +12 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js.map +1 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js +17 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js.map +1 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTrim.js +15 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTrim.js.map +1 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js +12 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js.map +1 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js +22 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js.map +1 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js +14 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js.map +1 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js +12 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js.map +1 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_trimmedEndIndex.js +16 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_trimmedEndIndex.js.map +1 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/debounce.js +61 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/debounce.js.map +1 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js +14 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js.map +1 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js +13 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js.map +1 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js +16 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js.map +1 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/now.js +14 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/now.js.map +1 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toNumber.js +29 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toNumber.js.map +1 -0
- package/dist/types/minisSDK.generated.d.js.map +1 -1
- package/package.json +4 -3
- package/src/base.css +273 -0
- package/src/components/commerce/merchant-card.tsx +262 -0
- package/src/components/commerce/product-card.tsx +3 -1
- package/src/components/index.ts +1 -0
- package/src/hooks/index.ts +11 -0
- package/src/hooks/product/useCuratedProducts.doc.ts +32 -0
- package/src/hooks/product/useCuratedProducts.example.tsx +10 -0
- package/src/hooks/product/useCuratedProducts.ts +41 -0
- package/src/hooks/product/useProduct.ts +45 -0
- package/src/hooks/product/useProductMedia.ts +51 -0
- package/src/hooks/product/useProductSearch.doc.ts +32 -0
- package/src/hooks/product/useProductSearch.example.tsx +13 -0
- package/src/hooks/product/useProductSearch.ts +95 -0
- package/src/hooks/product/useProductVariants.ts +48 -0
- package/src/hooks/product/useProducts.ts +38 -0
- package/src/hooks/shop/useShop.doc.ts +31 -0
- package/src/hooks/shop/useShop.example.tsx +7 -0
- package/src/hooks/shop/useShop.ts +38 -0
- package/src/hooks/user/useFollowedShops.ts +43 -0
- package/src/hooks/user/useRecentProducts.doc.ts +32 -0
- package/src/hooks/user/useRecentProducts.example.tsx +13 -0
- package/src/hooks/user/useRecentProducts.ts +46 -0
- package/src/hooks/user/useRecentShops.ts +43 -0
- package/src/hooks/user/useSavedProducts.doc.ts +32 -0
- package/src/hooks/user/useSavedProducts.example.tsx +13 -0
- package/src/hooks/user/useSavedProducts.ts +46 -0
- package/src/index.css +1 -221
- package/src/internal/useShopActionsPaginatedDataFetching.ts +8 -8
- package/src/types/minisSDK.generated.d.ts +239 -4
- package/src/dev.tsx +0 -868
- package/src/mockActions.ts +0 -237
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useMemo as a } from "react";
|
|
2
|
+
import { useShopActions as l } from "../../internal/useShopActions.js";
|
|
3
|
+
import { useShopActionsPaginatedDataFetching as c } from "../../internal/useShopActionsPaginatedDataFetching.js";
|
|
4
|
+
const u = (s) => {
|
|
5
|
+
const { getFollowedShops: t } = l(), { skip: e = !1, ...r } = s ?? {}, { data: o, ...n } = c(
|
|
6
|
+
t,
|
|
7
|
+
r,
|
|
8
|
+
{
|
|
9
|
+
skip: e,
|
|
10
|
+
hook: "useFollowedShops"
|
|
11
|
+
}
|
|
12
|
+
), p = a(() => o ?? null, [o]);
|
|
13
|
+
return {
|
|
14
|
+
...n,
|
|
15
|
+
shops: p
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
u as useFollowedShops
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=useFollowedShops.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFollowedShops.js","sources":["../../../src/hooks/user/useFollowedShops.ts"],"sourcesContent":["import {useMemo} from 'react'\n\nimport {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'\nimport {\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n Shop,\n} from '../../types'\n\nexport interface UseFollowedShopsParams extends PaginatedDataHookOptionsBase {}\n\ninterface UseFollowedShopsReturns extends PaginatedDataHookReturnsBase {\n /**\n * The followed shops returned from the query.\n */\n shops: Shop[] | null\n}\n\nexport const useFollowedShops = (\n params?: UseFollowedShopsParams\n): UseFollowedShopsReturns => {\n const {getFollowedShops} = useShopActions()\n const {skip = false, ...restParams} = params ?? {}\n\n const {data, ...rest} = useShopActionsPaginatedDataFetching(\n getFollowedShops,\n restParams,\n {\n skip,\n hook: 'useFollowedShops',\n }\n )\n\n const shops = useMemo(() => {\n return data ?? null\n }, [data])\n\n return {\n ...rest,\n shops,\n }\n}\n"],"names":["useFollowedShops","params","getFollowedShops","useShopActions","skip","restParams","data","rest","useShopActionsPaginatedDataFetching","shops","useMemo"],"mappings":";;;AAmBa,MAAAA,IAAmB,CAC9BC,MAC4B;AACtB,QAAA,EAAC,kBAAAC,EAAgB,IAAIC,EAAe,GACpC,EAAC,MAAAC,IAAO,IAAO,GAAGC,EAAU,IAAIJ,KAAU,CAAC,GAE3C,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtBN;AAAA,IACAG;AAAA,IACA;AAAA,MACE,MAAAD;AAAA,MACA,MAAM;AAAA,IAAA;AAAA,EAEV,GAEMK,IAAQC,EAAQ,MACbJ,KAAQ,MACd,CAACA,CAAI,CAAC;AAEF,SAAA;AAAA,IACL,GAAGC;AAAA,IACH,OAAAE;AAAA,EACF;AACF;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useMemo as u } from "react";
|
|
2
|
+
import { useShopActions as i } from "../../internal/useShopActions.js";
|
|
3
|
+
import { useShopActionsPaginatedDataFetching as p } from "../../internal/useShopActionsPaginatedDataFetching.js";
|
|
4
|
+
const h = (o) => {
|
|
5
|
+
const { getRecentProducts: s } = i(), { skip: e, ...r } = o ?? {}, { data: t, ...c } = p(
|
|
6
|
+
s,
|
|
7
|
+
r,
|
|
8
|
+
{
|
|
9
|
+
skip: e,
|
|
10
|
+
hook: "useRecentProducts"
|
|
11
|
+
}
|
|
12
|
+
), n = u(() => t ?? null, [t]);
|
|
13
|
+
return {
|
|
14
|
+
...c,
|
|
15
|
+
products: n
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
h as useRecentProducts
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=useRecentProducts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRecentProducts.js","sources":["../../../src/hooks/user/useRecentProducts.ts"],"sourcesContent":["import {useMemo} from 'react'\n\nimport {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'\nimport {\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n Product,\n} from '../../types'\n\nexport interface UseRecentProductsParams extends PaginatedDataHookOptionsBase {\n includeSensitive?: boolean\n}\n\nexport interface UseRecentProductsReturns extends PaginatedDataHookReturnsBase {\n products: Product[] | null\n}\n\n/**\n * Hook to fetch recently viewed products.\n * @param params - Options for the hook.\n */\nexport const useRecentProducts = (\n params?: UseRecentProductsParams\n): UseRecentProductsReturns => {\n const {getRecentProducts} = useShopActions()\n const {skip, ...shopActionParams} = params ?? {}\n\n const {data, ...rest} = useShopActionsPaginatedDataFetching(\n getRecentProducts,\n shopActionParams,\n {\n skip,\n hook: 'useRecentProducts',\n }\n )\n\n const products = useMemo(() => {\n return data ?? null\n }, [data])\n\n return {\n ...rest,\n products,\n }\n}\n"],"names":["useRecentProducts","params","getRecentProducts","useShopActions","skip","shopActionParams","data","rest","useShopActionsPaginatedDataFetching","products","useMemo"],"mappings":";;;AAsBa,MAAAA,IAAoB,CAC/BC,MAC6B;AACvB,QAAA,EAAC,mBAAAC,EAAiB,IAAIC,EAAe,GACrC,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIJ,KAAU,CAAC,GAEzC,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtBN;AAAA,IACAG;AAAA,IACA;AAAA,MACE,MAAAD;AAAA,MACA,MAAM;AAAA,IAAA;AAAA,EAEV,GAEMK,IAAWC,EAAQ,MAChBJ,KAAQ,MACd,CAACA,CAAI,CAAC;AAEF,SAAA;AAAA,IACL,GAAGC;AAAA,IACH,UAAAE;AAAA,EACF;AACF;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useMemo as p } from "react";
|
|
2
|
+
import { useShopActions as a } from "../../internal/useShopActions.js";
|
|
3
|
+
import { useShopActionsPaginatedDataFetching as h } from "../../internal/useShopActionsPaginatedDataFetching.js";
|
|
4
|
+
const S = (t) => {
|
|
5
|
+
const { getRecentShops: s } = a(), { skip: e = !1, ...n } = t ?? {}, { data: o, ...r } = h(
|
|
6
|
+
s,
|
|
7
|
+
n,
|
|
8
|
+
{
|
|
9
|
+
skip: e,
|
|
10
|
+
hook: "useRecentShops"
|
|
11
|
+
}
|
|
12
|
+
), c = p(() => o ?? null, [o]);
|
|
13
|
+
return {
|
|
14
|
+
...r,
|
|
15
|
+
shops: c
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
S as useRecentShops
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=useRecentShops.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRecentShops.js","sources":["../../../src/hooks/user/useRecentShops.ts"],"sourcesContent":["import {useMemo} from 'react'\n\nimport {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'\nimport {\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n Shop,\n} from '../../types'\n\nexport interface UseRecentShopsParams extends PaginatedDataHookOptionsBase {}\n\ninterface UseRecentShopsReturns extends PaginatedDataHookReturnsBase {\n /**\n * The recent shops returned from the query.\n */\n shops: Shop[] | null\n}\n\nexport const useRecentShops = (\n params?: UseRecentShopsParams\n): UseRecentShopsReturns => {\n const {getRecentShops} = useShopActions()\n const {skip = false, ...restParams} = params ?? {}\n\n const {data, ...rest} = useShopActionsPaginatedDataFetching(\n getRecentShops,\n restParams,\n {\n skip,\n hook: 'useRecentShops',\n }\n )\n\n const shops = useMemo(() => {\n return data ?? null\n }, [data])\n\n return {\n ...rest,\n shops,\n }\n}\n"],"names":["useRecentShops","params","getRecentShops","useShopActions","skip","restParams","data","rest","useShopActionsPaginatedDataFetching","shops","useMemo"],"mappings":";;;AAmBa,MAAAA,IAAiB,CAC5BC,MAC0B;AACpB,QAAA,EAAC,gBAAAC,EAAc,IAAIC,EAAe,GAClC,EAAC,MAAAC,IAAO,IAAO,GAAGC,EAAU,IAAIJ,KAAU,CAAC,GAE3C,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtBN;AAAA,IACAG;AAAA,IACA;AAAA,MACE,MAAAD;AAAA,MACA,MAAM;AAAA,IAAA;AAAA,EAEV,GAEMK,IAAQC,EAAQ,MACbJ,KAAQ,MACd,CAACA,CAAI,CAAC;AAEF,SAAA;AAAA,IACL,GAAGC;AAAA,IACH,OAAAE;AAAA,EACF;AACF;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useMemo as u } from "react";
|
|
2
|
+
import { useShopActions as a } from "../../internal/useShopActions.js";
|
|
3
|
+
import { useShopActionsPaginatedDataFetching as d } from "../../internal/useShopActionsPaginatedDataFetching.js";
|
|
4
|
+
const h = (t) => {
|
|
5
|
+
const { getSavedProducts: s } = a(), { skip: r, ...e } = t ?? {}, { data: o, ...c } = d(
|
|
6
|
+
s,
|
|
7
|
+
e,
|
|
8
|
+
{
|
|
9
|
+
skip: r,
|
|
10
|
+
hook: "useSavedProducts"
|
|
11
|
+
}
|
|
12
|
+
), n = u(() => o ?? null, [o]);
|
|
13
|
+
return {
|
|
14
|
+
...c,
|
|
15
|
+
products: n
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
h as useSavedProducts
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=useSavedProducts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSavedProducts.js","sources":["../../../src/hooks/user/useSavedProducts.ts"],"sourcesContent":["import {useMemo} from 'react'\n\nimport {useShopActions} from '../../internal/useShopActions'\nimport {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'\nimport {\n PaginatedDataHookOptionsBase,\n PaginatedDataHookReturnsBase,\n Product,\n} from '../../types'\n\nexport interface UseSavedProductsParams extends PaginatedDataHookOptionsBase {\n includeSensitive?: boolean\n}\n\nexport interface UseSavedProductsReturns extends PaginatedDataHookReturnsBase {\n products: Product[] | null\n}\n\n/**\n * Hook to fetch saved (favorited) products.\n * @param params - Options for the hook.\n */\nexport const useSavedProducts = (\n params?: UseSavedProductsParams\n): UseSavedProductsReturns => {\n const {getSavedProducts} = useShopActions()\n const {skip, ...shopActionParams} = params ?? {}\n\n const {data, ...rest} = useShopActionsPaginatedDataFetching(\n getSavedProducts,\n shopActionParams,\n {\n skip,\n hook: 'useSavedProducts',\n }\n )\n\n const products = useMemo(() => {\n return data ?? null\n }, [data])\n\n return {\n ...rest,\n products,\n }\n}\n"],"names":["useSavedProducts","params","getSavedProducts","useShopActions","skip","shopActionParams","data","rest","useShopActionsPaginatedDataFetching","products","useMemo"],"mappings":";;;AAsBa,MAAAA,IAAmB,CAC9BC,MAC4B;AACtB,QAAA,EAAC,kBAAAC,EAAgB,IAAIC,EAAe,GACpC,EAAC,MAAAC,GAAM,GAAGC,EAAgB,IAAIJ,KAAU,CAAC,GAEzC,EAAC,MAAAK,GAAM,GAAGC,EAAA,IAAQC;AAAA,IACtBN;AAAA,IACAG;AAAA,IACA;AAAA,MACE,MAAAD;AAAA,MACA,MAAM;AAAA,IAAA;AAAA,EAEV,GAEMK,IAAWC,EAAQ,MAChBJ,KAAQ,MACd,CAACA,CAAI,CAAC;AAEF,SAAA;AAAA,IACL,GAAGC;AAAA,IACH,UAAAE;AAAA,EACF;AACF;"}
|
package/dist/index.js
CHANGED
|
@@ -1,194 +1,226 @@
|
|
|
1
1
|
import { MinisContainer as o } from "./components/MinisContainer.js";
|
|
2
|
-
import { ProductCard as a, ProductCardBadge as i, ProductCardCurrentPrice as
|
|
3
|
-
import { ProductLink as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
2
|
+
import { ProductCard as a, ProductCardBadge as i, ProductCardCurrentPrice as n, ProductCardFavoriteButton as c, ProductCardImage as l, ProductCardImageContainer as u, ProductCardInfo as d, ProductCardOriginalPrice as s, ProductCardPrice as p, ProductCardRoot as m, ProductCardTitle as f } from "./components/commerce/product-card.js";
|
|
3
|
+
import { ProductLink as C, ProductLinkActions as g, ProductLinkCurrentPrice as P, ProductLinkDiscountPrice as D, ProductLinkImage as S, ProductLinkInfo as A, ProductLinkOriginalPrice as h, ProductLinkPrice as L, ProductLinkRating as k, ProductLinkRoot as I, ProductLinkTitle as T } from "./components/commerce/product-link.js";
|
|
4
|
+
import { MerchantCard as w, MerchantCardImage as R, MerchantCardImageContainer as v, MerchantCardInfo as b, MerchantCardLogo as F, MerchantCardName as B, MerchantCardPrimitive as y, MerchantCardRating as E, MerchantCardRoot as H } from "./components/commerce/merchant-card.js";
|
|
5
|
+
import { Accordion as G, AccordionContent as N, AccordionItem as U, AccordionTrigger as V } from "./components/atoms/accordion.js";
|
|
6
|
+
import { Alert as j, AlertDescription as q, AlertTitle as J } from "./components/atoms/alert.js";
|
|
7
|
+
import { AlertDialog as Q, AlertDialogAction as W, AlertDialogCancel as X, AlertDialogContent as Y, AlertDialogDescription as Z, AlertDialogFooter as _, AlertDialogHeader as $, AlertDialogOverlay as rr, AlertDialogPortal as er, AlertDialogTitle as or, AlertDialogTrigger as tr } from "./components/atoms/alert-dialog.js";
|
|
8
|
+
import { Avatar as ir, AvatarFallback as nr, AvatarImage as cr } from "./components/atoms/avatar.js";
|
|
9
|
+
import { Badge as ur, badgeVariants as dr } from "./components/atoms/badge.js";
|
|
10
|
+
import { Button as pr, buttonVariants as mr } from "./components/atoms/button.js";
|
|
11
|
+
import { Card as xr, CardAction as Cr, CardContent as gr, CardDescription as Pr, CardFooter as Dr, CardHeader as Sr, CardTitle as Ar } from "./components/atoms/card.js";
|
|
12
|
+
import { Carousel as Lr, CarouselContent as kr, CarouselItem as Ir, CarouselNext as Tr, CarouselPrevious as Mr } from "./components/atoms/carousel.js";
|
|
13
|
+
import { Checkbox as Rr } from "./components/atoms/checkbox.js";
|
|
14
|
+
import { Dialog as br, DialogClose as Fr, DialogContent as Br, DialogDescription as yr, DialogFooter as Er, DialogHeader as Hr, DialogOverlay as Or, DialogPortal as Gr, DialogTitle as Nr, DialogTrigger as Ur } from "./components/atoms/dialog.js";
|
|
15
|
+
import { Drawer as zr, DrawerClose as jr, DrawerContent as qr, DrawerDescription as Jr, DrawerFooter as Kr, DrawerHeader as Qr, DrawerOverlay as Wr, DrawerPortal as Xr, DrawerTitle as Yr, DrawerTrigger as Zr } from "./components/atoms/drawer.js";
|
|
16
|
+
import { Input as $r } from "./components/atoms/input.js";
|
|
17
|
+
import { Label as ee } from "./components/atoms/label.js";
|
|
18
|
+
import { Progress as te } from "./components/atoms/progress.js";
|
|
19
|
+
import { RadioGroup as ie, RadioGroupItem as ne } from "./components/atoms/radio-group.js";
|
|
20
|
+
import { ResizableHandle as le, ResizablePanel as ue, ResizablePanelGroup as de } from "./components/atoms/resizable.js";
|
|
21
|
+
import { ScrollArea as pe, ScrollBar as me } from "./components/atoms/scroll-area.js";
|
|
22
|
+
import { Select as xe, SelectContent as Ce, SelectGroup as ge, SelectItem as Pe, SelectLabel as De, SelectScrollDownButton as Se, SelectScrollUpButton as Ae, SelectSeparator as he, SelectTrigger as Le, SelectValue as ke } from "./components/atoms/select.js";
|
|
23
|
+
import { Separator as Te } from "./components/atoms/separator.js";
|
|
24
|
+
import { Sheet as we, SheetClose as Re, SheetContent as ve, SheetDescription as be, SheetFooter as Fe, SheetHeader as Be, SheetTitle as ye, SheetTrigger as Ee } from "./components/atoms/sheet.js";
|
|
25
|
+
import { Toaster as Oe } from "./components/atoms/sonner.js";
|
|
26
|
+
import { useRecentProducts as Ne } from "./hooks/user/useRecentProducts.js";
|
|
27
|
+
import { useRecentShops as Ve } from "./hooks/user/useRecentShops.js";
|
|
28
|
+
import { useSavedProducts as je } from "./hooks/user/useSavedProducts.js";
|
|
29
|
+
import { useSavedProductsActions as Je } from "./hooks/user/useSavedProductsActions.js";
|
|
30
|
+
import { useFollowedShops as Qe } from "./hooks/user/useFollowedShops.js";
|
|
31
|
+
import { useFollowedShopsActions as Xe } from "./hooks/user/useFollowedShopsActions.js";
|
|
32
|
+
import { useCurrentUser as Ze } from "./hooks/user/useCurrentUser.js";
|
|
33
|
+
import { useOrders as $e } from "./hooks/user/useOrders.js";
|
|
34
|
+
import { useBuyerAttributes as eo } from "./hooks/user/useBuyerAttributes.js";
|
|
35
|
+
import { useProductListActions as to } from "./hooks/product/useProductListActions.js";
|
|
36
|
+
import { useProductLists as io } from "./hooks/product/useProductLists.js";
|
|
37
|
+
import { useProductList as co } from "./hooks/product/useProductList.js";
|
|
38
|
+
import { useProduct as uo } from "./hooks/product/useProduct.js";
|
|
39
|
+
import { useProducts as po } from "./hooks/product/useProducts.js";
|
|
40
|
+
import { useProductVariants as fo } from "./hooks/product/useProductVariants.js";
|
|
41
|
+
import { useProductMedia as Co } from "./hooks/product/useProductMedia.js";
|
|
42
|
+
import { useProductSearch as Po } from "./hooks/product/useProductSearch.js";
|
|
43
|
+
import { useRecommendedProducts as So } from "./hooks/product/useRecommendedProducts.js";
|
|
44
|
+
import { usePopularProducts as ho } from "./hooks/product/usePopularProducts.js";
|
|
45
|
+
import { useCuratedProducts as ko } from "./hooks/product/useCuratedProducts.js";
|
|
46
|
+
import { useAsyncStorage as To } from "./hooks/storage/useAsyncStorage.js";
|
|
47
|
+
import { useSecureStorage as wo } from "./hooks/storage/useSecureStorage.js";
|
|
48
|
+
import { useImageUpload as vo } from "./hooks/storage/useImageUpload.js";
|
|
49
|
+
import { useShopNavigation as Fo } from "./hooks/navigation/useShopNavigation.js";
|
|
50
|
+
import { useCloseMini as yo } from "./hooks/navigation/useCloseMini.js";
|
|
51
|
+
import { useDeeplink as Ho } from "./hooks/navigation/useDeeplink.js";
|
|
52
|
+
import { useShop as Go } from "./hooks/shop/useShop.js";
|
|
53
|
+
import { useShopCartActions as Uo } from "./hooks/shop/useShopCartActions.js";
|
|
54
|
+
import { useRecommendedShops as zo } from "./hooks/shop/useRecommendedShops.js";
|
|
55
|
+
import { useErrorToast as qo } from "./hooks/util/useErrorToast.js";
|
|
56
|
+
import { useErrorScreen as Ko } from "./hooks/util/useErrorScreen.js";
|
|
57
|
+
import { useShare as Wo } from "./hooks/util/useShare.js";
|
|
58
|
+
import { useImagePicker as Yo } from "./hooks/util/useImagePicker.js";
|
|
59
|
+
import { MiniEntityNotFoundError as _o, MiniError as $o, MiniNetworkError as rt, formatError as et } from "./utils/errors.js";
|
|
60
|
+
import { parseUrl as tt } from "./utils/parseUrl.js";
|
|
61
|
+
import { Consent as it, ConsentStatus as nt, CurrencyCode as ct, Gender as lt } from "./types/minisSDK.generated.d.js";
|
|
50
62
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
63
|
+
G as Accordion,
|
|
64
|
+
N as AccordionContent,
|
|
65
|
+
U as AccordionItem,
|
|
66
|
+
V as AccordionTrigger,
|
|
67
|
+
j as Alert,
|
|
68
|
+
q as AlertDescription,
|
|
69
|
+
Q as AlertDialog,
|
|
70
|
+
W as AlertDialogAction,
|
|
71
|
+
X as AlertDialogCancel,
|
|
72
|
+
Y as AlertDialogContent,
|
|
73
|
+
Z as AlertDialogDescription,
|
|
74
|
+
_ as AlertDialogFooter,
|
|
75
|
+
$ as AlertDialogHeader,
|
|
76
|
+
rr as AlertDialogOverlay,
|
|
77
|
+
er as AlertDialogPortal,
|
|
78
|
+
or as AlertDialogTitle,
|
|
79
|
+
tr as AlertDialogTrigger,
|
|
80
|
+
J as AlertTitle,
|
|
81
|
+
ir as Avatar,
|
|
82
|
+
nr as AvatarFallback,
|
|
83
|
+
cr as AvatarImage,
|
|
84
|
+
ur as Badge,
|
|
85
|
+
pr as Button,
|
|
86
|
+
xr as Card,
|
|
87
|
+
Cr as CardAction,
|
|
88
|
+
gr as CardContent,
|
|
89
|
+
Pr as CardDescription,
|
|
90
|
+
Dr as CardFooter,
|
|
91
|
+
Sr as CardHeader,
|
|
92
|
+
Ar as CardTitle,
|
|
93
|
+
Lr as Carousel,
|
|
94
|
+
kr as CarouselContent,
|
|
95
|
+
Ir as CarouselItem,
|
|
96
|
+
Tr as CarouselNext,
|
|
97
|
+
Mr as CarouselPrevious,
|
|
98
|
+
Rr as Checkbox,
|
|
99
|
+
it as Consent,
|
|
100
|
+
nt as ConsentStatus,
|
|
101
|
+
ct as CurrencyCode,
|
|
102
|
+
br as Dialog,
|
|
103
|
+
Fr as DialogClose,
|
|
104
|
+
Br as DialogContent,
|
|
105
|
+
yr as DialogDescription,
|
|
106
|
+
Er as DialogFooter,
|
|
107
|
+
Hr as DialogHeader,
|
|
108
|
+
Or as DialogOverlay,
|
|
109
|
+
Gr as DialogPortal,
|
|
110
|
+
Nr as DialogTitle,
|
|
111
|
+
Ur as DialogTrigger,
|
|
112
|
+
zr as Drawer,
|
|
113
|
+
jr as DrawerClose,
|
|
114
|
+
qr as DrawerContent,
|
|
115
|
+
Jr as DrawerDescription,
|
|
116
|
+
Kr as DrawerFooter,
|
|
117
|
+
Qr as DrawerHeader,
|
|
118
|
+
Wr as DrawerOverlay,
|
|
119
|
+
Xr as DrawerPortal,
|
|
120
|
+
Yr as DrawerTitle,
|
|
121
|
+
Zr as DrawerTrigger,
|
|
122
|
+
lt as Gender,
|
|
123
|
+
$r as Input,
|
|
124
|
+
ee as Label,
|
|
125
|
+
w as MerchantCard,
|
|
126
|
+
R as MerchantCardImage,
|
|
127
|
+
v as MerchantCardImageContainer,
|
|
128
|
+
b as MerchantCardInfo,
|
|
129
|
+
F as MerchantCardLogo,
|
|
130
|
+
B as MerchantCardName,
|
|
131
|
+
y as MerchantCardPrimitive,
|
|
132
|
+
E as MerchantCardRating,
|
|
133
|
+
H as MerchantCardRoot,
|
|
134
|
+
_o as MiniEntityNotFoundError,
|
|
135
|
+
$o as MiniError,
|
|
136
|
+
rt as MiniNetworkError,
|
|
116
137
|
o as MinisContainer,
|
|
117
138
|
a as ProductCard,
|
|
118
139
|
i as ProductCardBadge,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
140
|
+
n as ProductCardCurrentPrice,
|
|
141
|
+
c as ProductCardFavoriteButton,
|
|
142
|
+
l as ProductCardImage,
|
|
122
143
|
u as ProductCardImageContainer,
|
|
123
144
|
d as ProductCardInfo,
|
|
124
|
-
|
|
125
|
-
|
|
145
|
+
s as ProductCardOriginalPrice,
|
|
146
|
+
p as ProductCardPrice,
|
|
126
147
|
m as ProductCardRoot,
|
|
127
148
|
f as ProductCardTitle,
|
|
128
|
-
|
|
129
|
-
|
|
149
|
+
C as ProductLink,
|
|
150
|
+
g as ProductLinkActions,
|
|
130
151
|
P as ProductLinkCurrentPrice,
|
|
131
152
|
D as ProductLinkDiscountPrice,
|
|
132
153
|
S as ProductLinkImage,
|
|
133
154
|
A as ProductLinkInfo,
|
|
134
|
-
|
|
155
|
+
h as ProductLinkOriginalPrice,
|
|
135
156
|
L as ProductLinkPrice,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
157
|
+
k as ProductLinkRating,
|
|
158
|
+
I as ProductLinkRoot,
|
|
159
|
+
T as ProductLinkTitle,
|
|
160
|
+
te as Progress,
|
|
161
|
+
ie as RadioGroup,
|
|
162
|
+
ne as RadioGroupItem,
|
|
163
|
+
le as ResizableHandle,
|
|
164
|
+
ue as ResizablePanel,
|
|
165
|
+
de as ResizablePanelGroup,
|
|
166
|
+
pe as ScrollArea,
|
|
167
|
+
me as ScrollBar,
|
|
168
|
+
xe as Select,
|
|
169
|
+
Ce as SelectContent,
|
|
170
|
+
ge as SelectGroup,
|
|
171
|
+
Pe as SelectItem,
|
|
172
|
+
De as SelectLabel,
|
|
173
|
+
Se as SelectScrollDownButton,
|
|
174
|
+
Ae as SelectScrollUpButton,
|
|
175
|
+
he as SelectSeparator,
|
|
176
|
+
Le as SelectTrigger,
|
|
177
|
+
ke as SelectValue,
|
|
178
|
+
Te as Separator,
|
|
179
|
+
we as Sheet,
|
|
180
|
+
Re as SheetClose,
|
|
181
|
+
ve as SheetContent,
|
|
182
|
+
be as SheetDescription,
|
|
183
|
+
Fe as SheetFooter,
|
|
184
|
+
Be as SheetHeader,
|
|
185
|
+
ye as SheetTitle,
|
|
186
|
+
Ee as SheetTrigger,
|
|
187
|
+
Oe as Toaster,
|
|
188
|
+
dr as badgeVariants,
|
|
189
|
+
mr as buttonVariants,
|
|
190
|
+
et as formatError,
|
|
191
|
+
tt as parseUrl,
|
|
192
|
+
To as useAsyncStorage,
|
|
193
|
+
eo as useBuyerAttributes,
|
|
194
|
+
yo as useCloseMini,
|
|
195
|
+
ko as useCuratedProducts,
|
|
196
|
+
Ze as useCurrentUser,
|
|
197
|
+
Ho as useDeeplink,
|
|
198
|
+
Ko as useErrorScreen,
|
|
199
|
+
qo as useErrorToast,
|
|
200
|
+
Qe as useFollowedShops,
|
|
201
|
+
Xe as useFollowedShopsActions,
|
|
202
|
+
Yo as useImagePicker,
|
|
203
|
+
vo as useImageUpload,
|
|
204
|
+
$e as useOrders,
|
|
205
|
+
ho as usePopularProducts,
|
|
206
|
+
uo as useProduct,
|
|
207
|
+
co as useProductList,
|
|
208
|
+
to as useProductListActions,
|
|
209
|
+
io as useProductLists,
|
|
210
|
+
Co as useProductMedia,
|
|
211
|
+
Po as useProductSearch,
|
|
212
|
+
fo as useProductVariants,
|
|
213
|
+
po as useProducts,
|
|
214
|
+
Ne as useRecentProducts,
|
|
215
|
+
Ve as useRecentShops,
|
|
216
|
+
So as useRecommendedProducts,
|
|
217
|
+
zo as useRecommendedShops,
|
|
218
|
+
je as useSavedProducts,
|
|
219
|
+
Je as useSavedProductsActions,
|
|
220
|
+
wo as useSecureStorage,
|
|
221
|
+
Wo as useShare,
|
|
222
|
+
Go as useShop,
|
|
223
|
+
Uo as useShopCartActions,
|
|
224
|
+
Fo as useShopNavigation
|
|
193
225
|
};
|
|
194
226
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { useState as A, useCallback as
|
|
1
|
+
import { useState as A, useCallback as l, useMemo as O, useEffect as D } from "react";
|
|
2
2
|
import { MiniError as M, formatError as b } from "../utils/errors.js";
|
|
3
3
|
const V = (g, c, h) => {
|
|
4
|
-
const [r,
|
|
4
|
+
const [r, f] = A({
|
|
5
5
|
data: null,
|
|
6
6
|
pageInfo: { hasNextPage: !1, endCursor: null },
|
|
7
7
|
loading: !1,
|
|
8
8
|
error: null
|
|
9
|
-
}), p = h?.skip === !0, { validator: y, hook: t } = h, w =
|
|
10
|
-
(
|
|
9
|
+
}), p = h?.skip === !0, { validator: y, hook: t } = h, w = l(
|
|
10
|
+
(d) => {
|
|
11
11
|
try {
|
|
12
|
-
return y?.(
|
|
13
|
-
} catch (
|
|
14
|
-
return
|
|
12
|
+
return y?.(d), null;
|
|
13
|
+
} catch (o) {
|
|
14
|
+
return o instanceof Error ? o : new M({
|
|
15
15
|
hook: t,
|
|
16
16
|
message: "Validation failed"
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
[y, t]
|
|
21
|
-
), I = O(() => c, [JSON.stringify(c)]), e =
|
|
22
|
-
async (
|
|
23
|
-
setLoading:
|
|
21
|
+
), I = O(() => c, [JSON.stringify(c)]), e = l(
|
|
22
|
+
async (d, {
|
|
23
|
+
setLoading: o = !0,
|
|
24
24
|
setError: N = !0,
|
|
25
25
|
resetOnError: i = !0,
|
|
26
26
|
throwOnError: k = !0,
|
|
27
27
|
appendData: C = !1
|
|
28
28
|
} = {}) => {
|
|
29
29
|
let E = null, u = null;
|
|
30
|
-
|
|
30
|
+
f((a) => ({
|
|
31
31
|
...a,
|
|
32
|
-
loading:
|
|
32
|
+
loading: o ? !0 : a.loading
|
|
33
33
|
}));
|
|
34
34
|
try {
|
|
35
|
-
const a = await g({ ...I, ...
|
|
35
|
+
const a = await g({ ...I, ...d });
|
|
36
36
|
if (a.ok)
|
|
37
|
-
u = w(a.data.data),
|
|
37
|
+
u = w(a.data.data), f((s) => {
|
|
38
38
|
let P = a.data.data;
|
|
39
|
-
return C &&
|
|
40
|
-
...
|
|
39
|
+
return C && s.data && Array.isArray(s.data) && Array.isArray(a.data.data) && (P = [...s.data, ...a.data.data]), {
|
|
40
|
+
...s,
|
|
41
41
|
data: P,
|
|
42
42
|
pageInfo: a.data.pageInfo,
|
|
43
43
|
loading: !1,
|
|
@@ -47,25 +47,25 @@ const V = (g, c, h) => {
|
|
|
47
47
|
else
|
|
48
48
|
throw a.error;
|
|
49
49
|
} catch (a) {
|
|
50
|
-
E = b({ hook: t }, a);
|
|
50
|
+
console.log("caught 1", a), E = b({ hook: t }, a);
|
|
51
51
|
}
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
52
|
+
const n = u || E;
|
|
53
|
+
if (n && (N || i) && f((a) => ({
|
|
54
54
|
data: i ? null : a.data,
|
|
55
55
|
pageInfo: i ? { hasNextPage: !1, endCursor: null } : a.pageInfo,
|
|
56
56
|
loading: !1,
|
|
57
|
-
error:
|
|
58
|
-
})),
|
|
59
|
-
throw
|
|
57
|
+
error: n
|
|
58
|
+
})), n && k)
|
|
59
|
+
throw n;
|
|
60
60
|
},
|
|
61
61
|
[g, I, t, w]
|
|
62
|
-
), m =
|
|
62
|
+
), m = l(async () => {
|
|
63
63
|
await e({ fetchPolicy: "network-only" }, {
|
|
64
64
|
setLoading: !1,
|
|
65
65
|
resetOnError: !1,
|
|
66
66
|
throwOnError: !0
|
|
67
67
|
});
|
|
68
|
-
}, [e]), x =
|
|
68
|
+
}, [e]), x = l(async () => {
|
|
69
69
|
!r.pageInfo.hasNextPage || !r.pageInfo.endCursor || await e({ after: r.pageInfo.endCursor }, {
|
|
70
70
|
setLoading: !1,
|
|
71
71
|
setError: !1,
|