@shopify/shop-minis-react 0.0.11 → 0.0.12

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.
Files changed (99) hide show
  1. package/dist/_virtual/debounce.js +8 -0
  2. package/dist/_virtual/debounce.js.map +1 -0
  3. package/dist/_virtual/index2.js +3 -2
  4. package/dist/_virtual/index2.js.map +1 -1
  5. package/dist/_virtual/index3.js +2 -3
  6. package/dist/_virtual/index3.js.map +1 -1
  7. package/dist/components/commerce/merchant-card.js +201 -0
  8. package/dist/components/commerce/merchant-card.js.map +1 -0
  9. package/dist/components/commerce/product-card.js +11 -9
  10. package/dist/components/commerce/product-card.js.map +1 -1
  11. package/dist/hooks/product/useCuratedProducts.js +20 -0
  12. package/dist/hooks/product/useCuratedProducts.js.map +1 -0
  13. package/dist/hooks/product/useProduct.js +24 -0
  14. package/dist/hooks/product/useProduct.js.map +1 -0
  15. package/dist/hooks/product/useProductMedia.js +24 -0
  16. package/dist/hooks/product/useProductMedia.js.map +1 -0
  17. package/dist/hooks/product/useProductSearch.js +44 -0
  18. package/dist/hooks/product/useProductSearch.js.map +1 -0
  19. package/dist/hooks/product/useProductVariants.js +21 -0
  20. package/dist/hooks/product/useProductVariants.js.map +1 -0
  21. package/dist/hooks/product/useProducts.js +17 -0
  22. package/dist/hooks/product/useProducts.js.map +1 -0
  23. package/dist/hooks/shop/useShop.js +17 -0
  24. package/dist/hooks/shop/useShop.js.map +1 -0
  25. package/dist/hooks/user/useFollowedShops.js +21 -0
  26. package/dist/hooks/user/useFollowedShops.js.map +1 -0
  27. package/dist/hooks/user/useRecentProducts.js +21 -0
  28. package/dist/hooks/user/useRecentProducts.js.map +1 -0
  29. package/dist/hooks/user/useRecentShops.js +21 -0
  30. package/dist/hooks/user/useRecentShops.js.map +1 -0
  31. package/dist/hooks/user/useSavedProducts.js +21 -0
  32. package/dist/hooks/user/useSavedProducts.js.map +1 -0
  33. package/dist/index.js +210 -178
  34. package/dist/index.js.map +1 -1
  35. package/dist/internal/useShopActionsPaginatedDataFetching.js +24 -24
  36. package/dist/internal/useShopActionsPaginatedDataFetching.js.map +1 -1
  37. package/dist/node_modules/.pnpm/@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +1 -1
  38. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js +12 -0
  39. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js.map +1 -0
  40. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js +17 -0
  41. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js.map +1 -0
  42. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTrim.js +15 -0
  43. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTrim.js.map +1 -0
  44. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js +12 -0
  45. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js.map +1 -0
  46. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js +22 -0
  47. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js.map +1 -0
  48. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js +14 -0
  49. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js.map +1 -0
  50. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js +12 -0
  51. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js.map +1 -0
  52. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_trimmedEndIndex.js +16 -0
  53. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_trimmedEndIndex.js.map +1 -0
  54. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/debounce.js +61 -0
  55. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/debounce.js.map +1 -0
  56. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js +14 -0
  57. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js.map +1 -0
  58. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js +13 -0
  59. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js.map +1 -0
  60. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js +16 -0
  61. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js.map +1 -0
  62. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/now.js +14 -0
  63. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/now.js.map +1 -0
  64. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toNumber.js +29 -0
  65. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toNumber.js.map +1 -0
  66. package/dist/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js +1 -1
  67. package/dist/types/minisSDK.generated.d.js.map +1 -1
  68. package/package.json +4 -3
  69. package/src/base.css +264 -0
  70. package/src/components/commerce/merchant-card.tsx +262 -0
  71. package/src/components/commerce/product-card.tsx +3 -1
  72. package/src/components/index.ts +1 -0
  73. package/src/hooks/index.ts +11 -0
  74. package/src/hooks/product/useCuratedProducts.doc.ts +32 -0
  75. package/src/hooks/product/useCuratedProducts.example.tsx +10 -0
  76. package/src/hooks/product/useCuratedProducts.ts +41 -0
  77. package/src/hooks/product/useProduct.ts +45 -0
  78. package/src/hooks/product/useProductMedia.ts +51 -0
  79. package/src/hooks/product/useProductSearch.doc.ts +32 -0
  80. package/src/hooks/product/useProductSearch.example.tsx +13 -0
  81. package/src/hooks/product/useProductSearch.ts +95 -0
  82. package/src/hooks/product/useProductVariants.ts +48 -0
  83. package/src/hooks/product/useProducts.ts +38 -0
  84. package/src/hooks/shop/useShop.doc.ts +31 -0
  85. package/src/hooks/shop/useShop.example.tsx +7 -0
  86. package/src/hooks/shop/useShop.ts +38 -0
  87. package/src/hooks/user/useFollowedShops.ts +43 -0
  88. package/src/hooks/user/useRecentProducts.doc.ts +32 -0
  89. package/src/hooks/user/useRecentProducts.example.tsx +13 -0
  90. package/src/hooks/user/useRecentProducts.ts +46 -0
  91. package/src/hooks/user/useRecentShops.ts +43 -0
  92. package/src/hooks/user/useSavedProducts.doc.ts +32 -0
  93. package/src/hooks/user/useSavedProducts.example.tsx +13 -0
  94. package/src/hooks/user/useSavedProducts.ts +46 -0
  95. package/src/index.css +1 -221
  96. package/src/internal/useShopActionsPaginatedDataFetching.ts +8 -8
  97. package/src/types/minisSDK.generated.d.ts +239 -4
  98. package/src/dev.tsx +0 -868
  99. package/src/mockActions.ts +0 -237
@@ -0,0 +1,38 @@
1
+ import {useMemo} from 'react'
2
+
3
+ import {useShopActions} from '../../internal/useShopActions'
4
+ import {useShopActionsDataFetching} from '../../internal/useShopActionsDataFetching'
5
+ import {DataHookOptionsBase, DataHookReturnsBase, Product} from '../../types'
6
+
7
+ export interface UseProductsParams extends DataHookOptionsBase {
8
+ /**
9
+ * The product IDs to fetch.
10
+ */
11
+ ids: string[]
12
+ }
13
+
14
+ interface UseProductsReturns extends DataHookReturnsBase {
15
+ /**
16
+ * The products returned from the query.
17
+ */
18
+ products: Product[] | null
19
+ }
20
+
21
+ export const useProducts = (params: UseProductsParams): UseProductsReturns => {
22
+ const {getProducts} = useShopActions()
23
+ const {skip = false, ...restParams} = params
24
+
25
+ const {data, ...rest} = useShopActionsDataFetching(getProducts, restParams, {
26
+ skip,
27
+ hook: 'useProducts',
28
+ })
29
+
30
+ const products = useMemo(() => {
31
+ return data ?? null
32
+ }, [data])
33
+
34
+ return {
35
+ ...rest,
36
+ products,
37
+ }
38
+ }
@@ -0,0 +1,31 @@
1
+ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs'
2
+
3
+ const data: ReferenceEntityTemplateSchema = {
4
+ name: 'useShop',
5
+ category: 'hooks',
6
+ subCategory: 'shop',
7
+ isVisualComponent: false,
8
+ related: [],
9
+ description: 'The `useShop` hook enables fetching a shop by its ID.',
10
+ type: 'hook',
11
+ defaultExample: {
12
+ codeblock: {
13
+ tabs: [
14
+ {
15
+ code: './useShop.example.tsx',
16
+ language: 'tsx',
17
+ },
18
+ ],
19
+ title: 'Example code',
20
+ },
21
+ },
22
+ definitions: [
23
+ {
24
+ title: '',
25
+ type: 'UseShopGeneratedType',
26
+ description: '',
27
+ },
28
+ ],
29
+ }
30
+
31
+ export default data
@@ -0,0 +1,7 @@
1
+ import {useShop} from '@shopify/shop-minis-react'
2
+
3
+ export default function MyComponent() {
4
+ const {shop, loading, error} = useShop({id: 'gid://shopify/Shop/1234567890'})
5
+
6
+ console.log({shop, loading, error})
7
+ }
@@ -0,0 +1,38 @@
1
+ import {useMemo} from 'react'
2
+
3
+ import {useShopActions} from '../../internal/useShopActions'
4
+ import {useShopActionsDataFetching} from '../../internal/useShopActionsDataFetching'
5
+ import {DataHookOptionsBase, DataHookReturnsBase, Shop} from '../../types'
6
+
7
+ export interface UseShopParams extends DataHookOptionsBase {
8
+ /**
9
+ * The shop ID to fetch.
10
+ */
11
+ id: string
12
+ }
13
+
14
+ interface UseShopReturns extends DataHookReturnsBase {
15
+ /**
16
+ * The shop returned from the query.
17
+ */
18
+ shop: Shop | null
19
+ }
20
+
21
+ export const useShop = (params: UseShopParams): UseShopReturns => {
22
+ const {getShop} = useShopActions()
23
+ const {skip = false, ...restParams} = params
24
+
25
+ const {data, ...rest} = useShopActionsDataFetching(getShop, restParams, {
26
+ skip,
27
+ hook: 'useShop',
28
+ })
29
+
30
+ const shop = useMemo(() => {
31
+ return data ?? null
32
+ }, [data])
33
+
34
+ return {
35
+ ...rest,
36
+ shop,
37
+ }
38
+ }
@@ -0,0 +1,43 @@
1
+ import {useMemo} from 'react'
2
+
3
+ import {useShopActions} from '../../internal/useShopActions'
4
+ import {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'
5
+ import {
6
+ PaginatedDataHookOptionsBase,
7
+ PaginatedDataHookReturnsBase,
8
+ Shop,
9
+ } from '../../types'
10
+
11
+ export interface UseFollowedShopsParams extends PaginatedDataHookOptionsBase {}
12
+
13
+ interface UseFollowedShopsReturns extends PaginatedDataHookReturnsBase {
14
+ /**
15
+ * The followed shops returned from the query.
16
+ */
17
+ shops: Shop[] | null
18
+ }
19
+
20
+ export const useFollowedShops = (
21
+ params?: UseFollowedShopsParams
22
+ ): UseFollowedShopsReturns => {
23
+ const {getFollowedShops} = useShopActions()
24
+ const {skip = false, ...restParams} = params ?? {}
25
+
26
+ const {data, ...rest} = useShopActionsPaginatedDataFetching(
27
+ getFollowedShops,
28
+ restParams,
29
+ {
30
+ skip,
31
+ hook: 'useFollowedShops',
32
+ }
33
+ )
34
+
35
+ const shops = useMemo(() => {
36
+ return data ?? null
37
+ }, [data])
38
+
39
+ return {
40
+ ...rest,
41
+ shops,
42
+ }
43
+ }
@@ -0,0 +1,32 @@
1
+ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs'
2
+
3
+ const data: ReferenceEntityTemplateSchema = {
4
+ name: 'useRecentProducts',
5
+ category: 'hooks',
6
+ subCategory: 'user',
7
+ isVisualComponent: false,
8
+ related: [],
9
+ description:
10
+ "The `useRecentProducts` hook fetches the current user's recently viewed products.",
11
+ type: 'hook',
12
+ defaultExample: {
13
+ codeblock: {
14
+ tabs: [
15
+ {
16
+ code: './useRecentProducts.example.tsx',
17
+ language: 'tsx',
18
+ },
19
+ ],
20
+ title: 'Example code',
21
+ },
22
+ },
23
+ definitions: [
24
+ {
25
+ title: '',
26
+ type: 'UseRecentProductsGeneratedType',
27
+ description: '',
28
+ },
29
+ ],
30
+ }
31
+
32
+ export default data
@@ -0,0 +1,13 @@
1
+ import {useEffect} from 'react'
2
+
3
+ import {useRecentProducts, Button} from '@shopify/shop-minis-react'
4
+
5
+ export default function MyComponent() {
6
+ const {products, fetchMore} = useRecentProducts({first: 10})
7
+
8
+ useEffect(() => {
9
+ console.log(products)
10
+ }, [products])
11
+
12
+ return <Button onClick={fetchMore}>Fetch more</Button>
13
+ }
@@ -0,0 +1,46 @@
1
+ import {useMemo} from 'react'
2
+
3
+ import {useShopActions} from '../../internal/useShopActions'
4
+ import {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'
5
+ import {
6
+ PaginatedDataHookOptionsBase,
7
+ PaginatedDataHookReturnsBase,
8
+ Product,
9
+ } from '../../types'
10
+
11
+ export interface UseRecentProductsParams extends PaginatedDataHookOptionsBase {
12
+ includeSensitive?: boolean
13
+ }
14
+
15
+ export interface UseRecentProductsReturns extends PaginatedDataHookReturnsBase {
16
+ products: Product[] | null
17
+ }
18
+
19
+ /**
20
+ * Hook to fetch recently viewed products.
21
+ * @param params - Options for the hook.
22
+ */
23
+ export const useRecentProducts = (
24
+ params?: UseRecentProductsParams
25
+ ): UseRecentProductsReturns => {
26
+ const {getRecentProducts} = useShopActions()
27
+ const {skip, ...shopActionParams} = params ?? {}
28
+
29
+ const {data, ...rest} = useShopActionsPaginatedDataFetching(
30
+ getRecentProducts,
31
+ shopActionParams,
32
+ {
33
+ skip,
34
+ hook: 'useRecentProducts',
35
+ }
36
+ )
37
+
38
+ const products = useMemo(() => {
39
+ return data ?? null
40
+ }, [data])
41
+
42
+ return {
43
+ ...rest,
44
+ products,
45
+ }
46
+ }
@@ -0,0 +1,43 @@
1
+ import {useMemo} from 'react'
2
+
3
+ import {useShopActions} from '../../internal/useShopActions'
4
+ import {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'
5
+ import {
6
+ PaginatedDataHookOptionsBase,
7
+ PaginatedDataHookReturnsBase,
8
+ Shop,
9
+ } from '../../types'
10
+
11
+ export interface UseRecentShopsParams extends PaginatedDataHookOptionsBase {}
12
+
13
+ interface UseRecentShopsReturns extends PaginatedDataHookReturnsBase {
14
+ /**
15
+ * The recent shops returned from the query.
16
+ */
17
+ shops: Shop[] | null
18
+ }
19
+
20
+ export const useRecentShops = (
21
+ params?: UseRecentShopsParams
22
+ ): UseRecentShopsReturns => {
23
+ const {getRecentShops} = useShopActions()
24
+ const {skip = false, ...restParams} = params ?? {}
25
+
26
+ const {data, ...rest} = useShopActionsPaginatedDataFetching(
27
+ getRecentShops,
28
+ restParams,
29
+ {
30
+ skip,
31
+ hook: 'useRecentShops',
32
+ }
33
+ )
34
+
35
+ const shops = useMemo(() => {
36
+ return data ?? null
37
+ }, [data])
38
+
39
+ return {
40
+ ...rest,
41
+ shops,
42
+ }
43
+ }
@@ -0,0 +1,32 @@
1
+ import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs'
2
+
3
+ const data: ReferenceEntityTemplateSchema = {
4
+ name: 'useSavedProducts',
5
+ category: 'hooks',
6
+ subCategory: 'user',
7
+ isVisualComponent: false,
8
+ related: [],
9
+ description:
10
+ "The `useSavedProducts` hook fetches the current user's saved products.",
11
+ type: 'hook',
12
+ defaultExample: {
13
+ codeblock: {
14
+ tabs: [
15
+ {
16
+ code: './useSavedProducts.example.tsx',
17
+ language: 'tsx',
18
+ },
19
+ ],
20
+ title: 'Example code',
21
+ },
22
+ },
23
+ definitions: [
24
+ {
25
+ title: '',
26
+ type: 'UseSavedProductsGeneratedType',
27
+ description: '',
28
+ },
29
+ ],
30
+ }
31
+
32
+ export default data
@@ -0,0 +1,13 @@
1
+ import {useEffect} from 'react'
2
+
3
+ import {useSavedProducts, Button} from '@shopify/shop-minis-react'
4
+
5
+ export default function MyComponent() {
6
+ const {products, fetchMore} = useSavedProducts({first: 10})
7
+
8
+ useEffect(() => {
9
+ console.log(products)
10
+ }, [products])
11
+
12
+ return <Button onClick={fetchMore}>Fetch more</Button>
13
+ }
@@ -0,0 +1,46 @@
1
+ import {useMemo} from 'react'
2
+
3
+ import {useShopActions} from '../../internal/useShopActions'
4
+ import {useShopActionsPaginatedDataFetching} from '../../internal/useShopActionsPaginatedDataFetching'
5
+ import {
6
+ PaginatedDataHookOptionsBase,
7
+ PaginatedDataHookReturnsBase,
8
+ Product,
9
+ } from '../../types'
10
+
11
+ export interface UseSavedProductsParams extends PaginatedDataHookOptionsBase {
12
+ includeSensitive?: boolean
13
+ }
14
+
15
+ export interface UseSavedProductsReturns extends PaginatedDataHookReturnsBase {
16
+ products: Product[] | null
17
+ }
18
+
19
+ /**
20
+ * Hook to fetch saved (favorited) products.
21
+ * @param params - Options for the hook.
22
+ */
23
+ export const useSavedProducts = (
24
+ params?: UseSavedProductsParams
25
+ ): UseSavedProductsReturns => {
26
+ const {getSavedProducts} = useShopActions()
27
+ const {skip, ...shopActionParams} = params ?? {}
28
+
29
+ const {data, ...rest} = useShopActionsPaginatedDataFetching(
30
+ getSavedProducts,
31
+ shopActionParams,
32
+ {
33
+ skip,
34
+ hook: 'useSavedProducts',
35
+ }
36
+ )
37
+
38
+ const products = useMemo(() => {
39
+ return data ?? null
40
+ }, [data])
41
+
42
+ return {
43
+ ...rest,
44
+ products,
45
+ }
46
+ }
package/src/index.css CHANGED
@@ -1,222 +1,2 @@
1
- @import 'tailwindcss';
2
- @import 'tw-animate-css';
1
+ @import './base.css';
3
2
  @source '../node_modules/@shopify/shop-minis-react/src/**/*.{js,ts,jsx,tsx}';
4
-
5
- @custom-variant dark (&:is(.dark *));
6
-
7
- @theme inline {
8
- --radius-sm: calc(var(--radius) - 4px);
9
- --radius-md: calc(var(--radius) - 2px);
10
- --radius-lg: var(--radius);
11
- --radius-xl: calc(var(--radius) + 4px);
12
- --color-background: var(--background);
13
- --color-foreground: var(--foreground);
14
- --color-card: var(--card);
15
- --color-card-foreground: var(--card-foreground);
16
- --color-popover: var(--popover);
17
- --color-popover-foreground: var(--popover-foreground);
18
- --color-primary: var(--primary);
19
- --color-primary-foreground: var(--primary-foreground);
20
- --color-secondary: var(--secondary);
21
- --color-secondary-foreground: var(--secondary-foreground);
22
- --color-muted: var(--muted);
23
- --color-muted-foreground: var(--muted-foreground);
24
- --color-accent: var(--accent);
25
- --color-accent-foreground: var(--accent-foreground);
26
- --color-destructive: var(--destructive);
27
- --color-border: var(--border);
28
- --color-input: var(--input);
29
- --color-ring: var(--ring);
30
- --color-chart-1: var(--chart-1);
31
- --color-chart-2: var(--chart-2);
32
- --color-chart-3: var(--chart-3);
33
- --color-chart-4: var(--chart-4);
34
- --color-chart-5: var(--chart-5);
35
- --color-sidebar: var(--sidebar);
36
- --color-sidebar-foreground: var(--sidebar-foreground);
37
- --color-sidebar-primary: var(--sidebar-primary);
38
- --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
39
- --color-sidebar-accent: var(--sidebar-accent);
40
- --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
41
- --color-sidebar-border: var(--sidebar-border);
42
- --color-sidebar-ring: var(--sidebar-ring);
43
-
44
- /* Grayscale palette colors for Tailwind */
45
- --color-grayscale-d100: var(--grayscale-d100);
46
- --color-grayscale-d93: var(--grayscale-d93);
47
- --color-grayscale-d90: var(--grayscale-d90);
48
- --color-grayscale-d80: var(--grayscale-d80);
49
- --color-grayscale-d70: var(--grayscale-d70);
50
- --color-grayscale-d60: var(--grayscale-d60);
51
- --color-grayscale-d50: var(--grayscale-d50);
52
- --color-grayscale-l40: var(--grayscale-l40);
53
- --color-grayscale-l20: var(--grayscale-l20);
54
- --color-grayscale-l10: var(--grayscale-l10);
55
- --color-grayscale-l6: var(--grayscale-l6);
56
- --color-grayscale-l5: var(--grayscale-l5);
57
- --color-grayscale-l0: var(--grayscale-l0);
58
- }
59
-
60
- :root {
61
- --radius: 0.65rem;
62
-
63
- /* Palette Colors - Purple */
64
- --purple-d80: #1b163b;
65
- --purple-d60: #322c7d;
66
- --purple-d50: #4524db;
67
- --purple-p40: #5433eb;
68
- --purple-l30: #6445ed;
69
- --purple-l20: #9c83f8;
70
- --purple-l10: #dbd1ff;
71
- --purple-l5: #eeeaff;
72
- --purple-l2: #f7f5ff;
73
-
74
- /* Palette Colors - Grayscale */
75
- --grayscale-d100: #000000;
76
- --grayscale-d93: #121212;
77
- --grayscale-d90: #1a1a1a;
78
- --grayscale-d80: #2a2a2a;
79
- --grayscale-d70: #404040;
80
- --grayscale-d60: #656667;
81
- --grayscale-d50: #6f7071;
82
- --grayscale-l40: #a6a8a9;
83
- --grayscale-l20: #c9cbcc;
84
- --grayscale-l10: #e1e4e5;
85
- --grayscale-l6: #eef0f1;
86
- --grayscale-l5: #f2f4f5;
87
- --grayscale-l0: #ffffff;
88
-
89
- /* Palette Colors - Green */
90
- --green-d90: #002e24;
91
- --green-d80: #004839;
92
- --green-d70: #008552;
93
- --green-l30: #92d08d;
94
- --green-l20: #baebcb;
95
- --green-l10: #d2f2de;
96
- --green-l5: #e4f6eb;
97
-
98
- /* Palette Colors - Poppy */
99
- --poppy-d80: #481609;
100
- --poppy-d70: #832711;
101
- --poppy-d50: #d92a0f;
102
- --poppy-l40: #f05d38;
103
- --poppy-l20: #ff967d;
104
- --poppy-l10: #ffd2c2;
105
- --poppy-l4: #ffece9;
106
-
107
- /* Palette Colors - Ochre */
108
- --ochre-d90: #443600;
109
- --ochre-d70: #8c6e01;
110
- --ochre-d60: #c29d05;
111
- --ochre-l50: #e3be2b;
112
- --ochre-l30: #f8db67;
113
- --ochre-l20: #ffec9f;
114
- --ochre-l10: #fff4cb;
115
- --ochre-l6: #fff9e2;
116
-
117
- /* Palette Colors - Brand */
118
- --brand-aqua: #8dc0c6;
119
- --brand-violet: #a327c2;
120
- --brand-magenta: #d354ff;
121
- --brand-olive: #8b8f01;
122
- --brand-lime: #c7de00;
123
- --brand-sage: #d8e59d;
124
- --brand-sand: #f4f4ed;
125
-
126
- /* Semantic Colors */
127
- --background: var(--grayscale-l0);
128
- --foreground: var(--grayscale-d100);
129
- --card: var(--grayscale-l0);
130
- --card-foreground: var(--grayscale-d100);
131
- --popover: var(--grayscale-l0);
132
- --popover-foreground: var(--grayscale-d100);
133
- --primary: var(--purple-p40);
134
- --primary-foreground: var(--grayscale-l0);
135
- --secondary: var(--grayscale-l5);
136
- --secondary-foreground: var(--grayscale-d70);
137
- --muted: var(--grayscale-l5);
138
- --muted-foreground: var(--grayscale-d70);
139
- --accent: var(--grayscale-l5);
140
- --accent-foreground: var(--grayscale-d70);
141
- --destructive: var(--poppy-d50);
142
- --border: rgba(0, 0, 0, 0.1);
143
- --input: var(--grayscale-l20);
144
- --ring: var(--purple-p40);
145
- --chart-1: var(--ochre-d90);
146
- --chart-2: var(--green-d70);
147
- --chart-3: var(--green-l30);
148
- --chart-4: var(--grayscale-d50);
149
- --chart-5: var(--green-l20);
150
- --sidebar: var(--grayscale-l5);
151
- --sidebar-foreground: var(--grayscale-d100);
152
- --sidebar-primary: var(--purple-p40);
153
- --sidebar-primary-foreground: var(--purple-l20);
154
- --sidebar-accent: var(--grayscale-l5);
155
- --sidebar-accent-foreground: var(--grayscale-d70);
156
- --sidebar-border: rgba(0, 0, 0, 0.1);
157
- --sidebar-ring: var(--purple-p40);
158
- }
159
-
160
- .dark {
161
- /* Dark mode semantic colors */
162
- --background: var(--grayscale-d93);
163
- --foreground: var(--grayscale-l0);
164
- --card: var(--grayscale-d93);
165
- --card-foreground: var(--grayscale-l0);
166
- --popover: var(--grayscale-d93);
167
- --popover-foreground: var(--grayscale-l0);
168
- --primary: var(--purple-l20);
169
- --primary-foreground: var(--grayscale-d100);
170
- --secondary: var(--grayscale-d80);
171
- --secondary-foreground: var(--grayscale-l0);
172
- --muted: var(--grayscale-d80);
173
- --muted-foreground: var(--grayscale-l20);
174
- --accent: var(--grayscale-d80);
175
- --accent-foreground: var(--grayscale-l0);
176
- --destructive: var(--poppy-l40);
177
- --border: rgba(255, 255, 255, 0.2);
178
- --input: var(--grayscale-l40);
179
- --ring: var(--purple-l20);
180
- --chart-1: var(--green-l30);
181
- --chart-2: var(--grayscale-d60);
182
- --chart-3: var(--green-l20);
183
- --chart-4: var(--grayscale-d60);
184
- --chart-5: var(--ochre-l30);
185
- --sidebar: var(--grayscale-d80);
186
- --sidebar-foreground: var(--grayscale-l0);
187
- --sidebar-primary: var(--purple-l20);
188
- --sidebar-primary-foreground: var(--purple-l10);
189
- --sidebar-accent: var(--grayscale-d80);
190
- --sidebar-accent-foreground: var(--grayscale-l0);
191
- --sidebar-border: rgba(255, 255, 255, 0.2);
192
- --sidebar-ring: var(--purple-l20);
193
- }
194
-
195
- @layer base {
196
- * {
197
- @apply border-border outline-ring/50;
198
- }
199
- body {
200
- @apply bg-background text-foreground;
201
- }
202
- }
203
-
204
- html,
205
- body {
206
- touch-action: manipulation;
207
- }
208
-
209
- /* Disable text selection */
210
- body {
211
- -webkit-user-select: none;
212
- -moz-user-select: -moz-none;
213
- -ms-user-select: none;
214
- user-select: none;
215
- }
216
-
217
- /* Disable image drag */
218
- img,
219
- .no-drag {
220
- -webkit-user-drag: none;
221
- user-drag: none;
222
- }
@@ -45,18 +45,17 @@ export const useShopActionsPaginatedDataFetching = <
45
45
  const skip = options?.skip === true
46
46
  const {validator, hook} = options
47
47
  const runValidator = useCallback(
48
- (dataToValidate: S) => {
48
+ (dataToValidate: S): Error | null => {
49
49
  try {
50
50
  validator?.(dataToValidate)
51
51
  return null
52
52
  } catch (err) {
53
- return (
54
- err ??
55
- new MiniError({
56
- hook,
57
- message: 'Validation failed',
58
- })
59
- )
53
+ if (err instanceof Error) return err
54
+
55
+ return new MiniError({
56
+ hook,
57
+ message: 'Validation failed',
58
+ })
60
59
  }
61
60
  },
62
61
  [validator, hook]
@@ -128,6 +127,7 @@ export const useShopActionsPaginatedDataFetching = <
128
127
  throw result.error
129
128
  }
130
129
  } catch (err) {
130
+ console.log('caught 1', err)
131
131
  queryError = formatError({hook}, err)
132
132
  }
133
133