@anker-in/campaign-ui 0.5.10 → 0.5.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 (246) hide show
  1. package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.d.ts +1 -0
  2. package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.js +2 -0
  3. package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.js.map +7 -0
  4. package/dist/cjs/components/credits/context/hooks/useSubscriptions.d.ts +5 -0
  5. package/dist/cjs/components/credits/context/hooks/useSubscriptions.js +2 -0
  6. package/dist/cjs/components/credits/context/hooks/useSubscriptions.js.map +7 -0
  7. package/dist/cjs/components/credits/context/provider.d.ts +2 -1
  8. package/dist/cjs/components/credits/context/provider.js +1 -1
  9. package/dist/cjs/components/credits/context/provider.js.map +3 -3
  10. package/dist/cjs/components/credits/modal/MyRewardsModal.d.ts +32 -0
  11. package/dist/cjs/components/credits/modal/MyRewardsModal.js +2 -0
  12. package/dist/cjs/components/credits/modal/MyRewardsModal.js.map +7 -0
  13. package/dist/cjs/components/credits/modal/activitiesModal.js +2 -0
  14. package/dist/cjs/components/credits/modal/activitiesModal.js.map +7 -0
  15. package/dist/cjs/helpers/fetchResponse.d.ts +14 -0
  16. package/dist/cjs/helpers/fetchResponse.js +2 -0
  17. package/dist/cjs/helpers/fetchResponse.js.map +7 -0
  18. package/dist/cjs/helpers/fetcher.d.ts +2 -0
  19. package/dist/cjs/helpers/fetcher.js +2 -0
  20. package/dist/cjs/helpers/fetcher.js.map +7 -0
  21. package/dist/cjs/helpers/index.d.ts +2 -0
  22. package/dist/cjs/helpers/index.js +2 -0
  23. package/dist/cjs/helpers/index.js.map +7 -0
  24. package/dist/cjs/helpers/track.d.ts +15 -0
  25. package/dist/cjs/helpers/track.js +2 -0
  26. package/dist/cjs/helpers/track.js.map +7 -0
  27. package/dist/cjs/helpers/utils.d.ts +3 -0
  28. package/dist/cjs/helpers/utils.js +2 -0
  29. package/dist/cjs/helpers/utils.js.map +7 -0
  30. package/dist/cjs/index.css +2 -0
  31. package/dist/cjs/index.css.map +7 -0
  32. package/dist/cjs/shopify/context/ShopifyProvider.d.ts +10 -0
  33. package/dist/cjs/shopify/fetchers/create-cart.d.ts +13 -0
  34. package/dist/cjs/shopify/fetchers/get-products-by-handles.d.ts +7 -0
  35. package/dist/cjs/shopify/fetchers/index.d.ts +2 -0
  36. package/dist/cjs/shopify/fragments/article.d.ts +2 -0
  37. package/dist/cjs/shopify/fragments/blog.d.ts +1 -0
  38. package/dist/cjs/shopify/fragments/cart.d.ts +1 -0
  39. package/dist/cjs/shopify/fragments/collection.d.ts +1 -0
  40. package/dist/cjs/shopify/fragments/image.d.ts +1 -0
  41. package/dist/cjs/shopify/fragments/index.d.ts +11 -0
  42. package/dist/cjs/shopify/fragments/metafields.d.ts +2 -0
  43. package/dist/cjs/shopify/fragments/page-info.d.ts +1 -0
  44. package/dist/cjs/shopify/fragments/page.d.ts +1 -0
  45. package/dist/cjs/shopify/fragments/product.d.ts +1 -0
  46. package/dist/cjs/shopify/fragments/seo.d.ts +1 -0
  47. package/dist/cjs/shopify/fragments/variant.d.ts +1 -0
  48. package/dist/cjs/shopify/gql/fragment-masking.d.ts +15 -0
  49. package/dist/cjs/shopify/gql/gql.d.ts +87 -0
  50. package/dist/cjs/shopify/gql/graphql.d.ts +7669 -0
  51. package/dist/cjs/shopify/gql/index.d.ts +3 -0
  52. package/dist/cjs/shopify/hooks/index.d.ts +2 -0
  53. package/dist/cjs/shopify/hooks/useCreateCart.d.ts +2 -0
  54. package/dist/cjs/shopify/hooks/useProductsByHandles.d.ts +4 -0
  55. package/dist/cjs/shopify/mutations/create-cart.d.ts +1 -0
  56. package/dist/cjs/shopify/queries/get-product-by-handles.d.ts +1 -0
  57. package/dist/cjs/shopify/queries/index.d.ts +1 -0
  58. package/dist/cjs/shopify/src/index.d.ts +5 -0
  59. package/dist/cjs/shopify/tsup.config.d.ts +2 -0
  60. package/dist/cjs/shopify/types/article.d.ts +48 -0
  61. package/dist/cjs/shopify/types/cart.d.ts +173 -0
  62. package/dist/cjs/shopify/types/checkout.d.ts +42 -0
  63. package/dist/cjs/shopify/types/collection.d.ts +122 -0
  64. package/dist/cjs/shopify/types/common.d.ts +42 -0
  65. package/dist/cjs/shopify/types/config.d.ts +12 -0
  66. package/dist/cjs/shopify/types/customer.d.ts +30 -0
  67. package/dist/cjs/shopify/types/fetcher.d.ts +38 -0
  68. package/dist/cjs/shopify/types/index.d.ts +10 -0
  69. package/dist/cjs/shopify/types/page.d.ts +33 -0
  70. package/dist/cjs/shopify/types/product.d.ts +174 -0
  71. package/dist/cjs/shopify/types/search.d.ts +54 -0
  72. package/dist/cjs/shopify/types/site.d.ts +33 -0
  73. package/dist/cjs/shopify/types/type-helper.d.ts +5 -0
  74. package/dist/cjs/shopify/utils/colors.d.ts +3 -0
  75. package/dist/cjs/shopify/utils/const.d.ts +76 -0
  76. package/dist/cjs/shopify/utils/cookie.d.ts +15 -0
  77. package/dist/cjs/shopify/utils/errors.d.ts +38 -0
  78. package/dist/cjs/shopify/utils/fetch-graphql-api.d.ts +19 -0
  79. package/dist/cjs/shopify/utils/handle-fetch-response.d.ts +5 -0
  80. package/dist/cjs/shopify/utils/helper.d.ts +28 -0
  81. package/dist/cjs/shopify/utils/normalize/cart.d.ts +7 -0
  82. package/dist/cjs/shopify/utils/normalize/customer.d.ts +3 -0
  83. package/dist/cjs/shopify/utils/normalize/index.d.ts +2 -0
  84. package/dist/cjs/shopify/utils/normalize/metafield.d.ts +5 -0
  85. package/dist/cjs/shopify/utils/normalize/product.d.ts +16 -0
  86. package/dist/cjs/shopify/utils/store.d.ts +2 -0
  87. package/dist/cjs/shopify/utils/type-helper.d.ts +5 -0
  88. package/dist/cjs/templates/Credits.types.d.ts +1 -0
  89. package/dist/cjs/templates/Credits.types.js.map +1 -1
  90. package/dist/cjs/templates/{Credits.js → credits.js} +1 -1
  91. package/dist/cjs/templates/{Credits.js.map → credits.js.map} +2 -2
  92. package/dist/cjs/tsconfig.tsbuildinfo +1 -0
  93. package/dist/esm/components/credits/context/hooks/useSendEmailValidation.d.ts +1 -0
  94. package/dist/esm/components/credits/context/hooks/useSendEmailValidation.js +2 -0
  95. package/dist/esm/components/credits/context/hooks/useSendEmailValidation.js.map +7 -0
  96. package/dist/esm/components/credits/context/hooks/useSubscriptions.d.ts +5 -0
  97. package/dist/esm/components/credits/context/hooks/useSubscriptions.js +2 -0
  98. package/dist/esm/components/credits/context/hooks/useSubscriptions.js.map +7 -0
  99. package/dist/esm/components/credits/context/provider.d.ts +2 -1
  100. package/dist/esm/components/credits/context/provider.js +1 -1
  101. package/dist/esm/components/credits/context/provider.js.map +3 -3
  102. package/dist/esm/components/credits/modal/MyRewardsModal.d.ts +32 -0
  103. package/dist/esm/components/credits/modal/MyRewardsModal.js +2 -0
  104. package/dist/esm/components/credits/modal/MyRewardsModal.js.map +7 -0
  105. package/dist/esm/components/credits/modal/activitiesModal.js +2 -0
  106. package/dist/esm/components/credits/modal/activitiesModal.js.map +7 -0
  107. package/dist/esm/helpers/fetchResponse.d.ts +14 -0
  108. package/dist/esm/helpers/fetchResponse.js +2 -0
  109. package/dist/esm/helpers/fetchResponse.js.map +7 -0
  110. package/dist/esm/helpers/fetcher.d.ts +2 -0
  111. package/dist/esm/helpers/fetcher.js +2 -0
  112. package/dist/esm/helpers/fetcher.js.map +7 -0
  113. package/dist/esm/helpers/index.d.ts +2 -0
  114. package/dist/esm/helpers/index.js +2 -0
  115. package/dist/esm/helpers/index.js.map +7 -0
  116. package/dist/esm/helpers/track.d.ts +15 -0
  117. package/dist/esm/helpers/track.js +2 -0
  118. package/dist/esm/helpers/track.js.map +7 -0
  119. package/dist/esm/helpers/utils.d.ts +3 -0
  120. package/dist/esm/helpers/utils.js +2 -0
  121. package/dist/esm/helpers/utils.js.map +7 -0
  122. package/dist/esm/index.css +2 -0
  123. package/dist/esm/index.css.map +7 -0
  124. package/dist/esm/shopify/context/ShopifyProvider.d.ts +10 -0
  125. package/dist/esm/shopify/fetchers/create-cart.d.ts +13 -0
  126. package/dist/esm/shopify/fetchers/get-products-by-handles.d.ts +7 -0
  127. package/dist/esm/shopify/fetchers/index.d.ts +2 -0
  128. package/dist/esm/shopify/fragments/article.d.ts +2 -0
  129. package/dist/esm/shopify/fragments/blog.d.ts +1 -0
  130. package/dist/esm/shopify/fragments/cart.d.ts +1 -0
  131. package/dist/esm/shopify/fragments/collection.d.ts +1 -0
  132. package/dist/esm/shopify/fragments/image.d.ts +1 -0
  133. package/dist/esm/shopify/fragments/index.d.ts +11 -0
  134. package/dist/esm/shopify/fragments/metafields.d.ts +2 -0
  135. package/dist/esm/shopify/fragments/page-info.d.ts +1 -0
  136. package/dist/esm/shopify/fragments/page.d.ts +1 -0
  137. package/dist/esm/shopify/fragments/product.d.ts +1 -0
  138. package/dist/esm/shopify/fragments/seo.d.ts +1 -0
  139. package/dist/esm/shopify/fragments/variant.d.ts +1 -0
  140. package/dist/esm/shopify/gql/fragment-masking.d.ts +15 -0
  141. package/dist/esm/shopify/gql/gql.d.ts +87 -0
  142. package/dist/esm/shopify/gql/graphql.d.ts +7669 -0
  143. package/dist/esm/shopify/gql/index.d.ts +3 -0
  144. package/dist/esm/shopify/hooks/index.d.ts +2 -0
  145. package/dist/esm/shopify/hooks/useCreateCart.d.ts +2 -0
  146. package/dist/esm/shopify/hooks/useProductsByHandles.d.ts +4 -0
  147. package/dist/esm/shopify/mutations/create-cart.d.ts +1 -0
  148. package/dist/esm/shopify/queries/get-product-by-handles.d.ts +1 -0
  149. package/dist/esm/shopify/queries/index.d.ts +1 -0
  150. package/dist/esm/shopify/src/index.d.ts +5 -0
  151. package/dist/esm/shopify/tsup.config.d.ts +2 -0
  152. package/dist/esm/shopify/types/article.d.ts +48 -0
  153. package/dist/esm/shopify/types/cart.d.ts +173 -0
  154. package/dist/esm/shopify/types/checkout.d.ts +42 -0
  155. package/dist/esm/shopify/types/collection.d.ts +122 -0
  156. package/dist/esm/shopify/types/common.d.ts +42 -0
  157. package/dist/esm/shopify/types/config.d.ts +12 -0
  158. package/dist/esm/shopify/types/customer.d.ts +30 -0
  159. package/dist/esm/shopify/types/fetcher.d.ts +38 -0
  160. package/dist/esm/shopify/types/index.d.ts +10 -0
  161. package/dist/esm/shopify/types/page.d.ts +33 -0
  162. package/dist/esm/shopify/types/product.d.ts +174 -0
  163. package/dist/esm/shopify/types/search.d.ts +54 -0
  164. package/dist/esm/shopify/types/site.d.ts +33 -0
  165. package/dist/esm/shopify/types/type-helper.d.ts +5 -0
  166. package/dist/esm/shopify/utils/colors.d.ts +3 -0
  167. package/dist/esm/shopify/utils/const.d.ts +76 -0
  168. package/dist/esm/shopify/utils/cookie.d.ts +15 -0
  169. package/dist/esm/shopify/utils/errors.d.ts +38 -0
  170. package/dist/esm/shopify/utils/fetch-graphql-api.d.ts +19 -0
  171. package/dist/esm/shopify/utils/handle-fetch-response.d.ts +5 -0
  172. package/dist/esm/shopify/utils/helper.d.ts +28 -0
  173. package/dist/esm/shopify/utils/normalize/cart.d.ts +7 -0
  174. package/dist/esm/shopify/utils/normalize/customer.d.ts +3 -0
  175. package/dist/esm/shopify/utils/normalize/index.d.ts +2 -0
  176. package/dist/esm/shopify/utils/normalize/metafield.d.ts +5 -0
  177. package/dist/esm/shopify/utils/normalize/product.d.ts +16 -0
  178. package/dist/esm/shopify/utils/store.d.ts +2 -0
  179. package/dist/esm/shopify/utils/type-helper.d.ts +5 -0
  180. package/dist/esm/templates/Credits.types.d.ts +1 -0
  181. package/dist/esm/templates/Credits.types.js.map +1 -1
  182. package/dist/esm/templates/credits.js +2 -0
  183. package/dist/esm/templates/{Credits.js.map → credits.js.map} +2 -2
  184. package/dist/esm/tsconfig.tsbuildinfo +1 -0
  185. package/package.json +19 -19
  186. package/src/components/credits/context/provider.tsx +4 -0
  187. package/src/components/credits/modal/ActivitiesModal.tsx +6 -1
  188. package/src/templates/Credits.tsx +1 -0
  189. package/src/templates/Credits.types.ts +1 -0
  190. package/dist/cjs/components/credits/modal/ActivitiesModal.js +0 -2
  191. package/dist/cjs/components/credits/modal/ActivitiesModal.js.map +0 -7
  192. package/dist/esm/components/credits/modal/ActivitiesModal.js +0 -2
  193. package/dist/esm/components/credits/modal/ActivitiesModal.js.map +0 -7
  194. package/dist/esm/templates/Credits.js +0 -2
  195. /package/dist/cjs/components/credits/creditsBenefits/{BenefitItem.d.ts → benefitItem.d.ts} +0 -0
  196. /package/dist/cjs/components/credits/creditsBenefits/{BenefitItem.js → benefitItem.js} +0 -0
  197. /package/dist/cjs/components/credits/creditsBenefits/{BenefitItem.js.map → benefitItem.js.map} +0 -0
  198. /package/dist/cjs/components/credits/creditsBenefits/{IconInfo.d.ts → iconInfo.d.ts} +0 -0
  199. /package/dist/cjs/components/credits/creditsBenefits/{IconInfo.js → iconInfo.js} +0 -0
  200. /package/dist/cjs/components/credits/creditsBenefits/{IconInfo.js.map → iconInfo.js.map} +0 -0
  201. /package/dist/cjs/components/credits/modal/{ActivitiesModal.d.ts → activitiesModal.d.ts} +0 -0
  202. /package/dist/cjs/components/credits/modal/{CreditsUploadReceiptModal.d.ts → creditsUploadReceiptModal.d.ts} +0 -0
  203. /package/dist/cjs/components/credits/modal/{CreditsUploadReceiptModal.js → creditsUploadReceiptModal.js} +0 -0
  204. /package/dist/cjs/components/credits/modal/{CreditsUploadReceiptModal.js.map → creditsUploadReceiptModal.js.map} +0 -0
  205. /package/dist/cjs/components/credits/modal/{LoadingDots.d.ts → loadingDots.d.ts} +0 -0
  206. /package/dist/cjs/components/credits/modal/{LoadingDots.js → loadingDots.js} +0 -0
  207. /package/dist/cjs/components/credits/modal/{LoadingDots.js.map → loadingDots.js.map} +0 -0
  208. /package/dist/cjs/components/credits/modal/{ModalContainer.d.ts → modalContainer.d.ts} +0 -0
  209. /package/dist/cjs/components/credits/modal/{ModalContainer.js → modalContainer.js} +0 -0
  210. /package/dist/cjs/components/credits/modal/{ModalContainer.js.map → modalContainer.js.map} +0 -0
  211. /package/dist/cjs/components/credits/modal/{RulesModal.d.ts → rulesModal.d.ts} +0 -0
  212. /package/dist/cjs/components/credits/modal/{RulesModal.js → rulesModal.js} +0 -0
  213. /package/dist/cjs/components/credits/modal/{RulesModal.js.map → rulesModal.js.map} +0 -0
  214. /package/dist/cjs/components/credits/modal/{SubscribeModal.d.ts → subscribeModal.d.ts} +0 -0
  215. /package/dist/cjs/components/credits/modal/{SubscribeModal.js → subscribeModal.js} +0 -0
  216. /package/dist/cjs/components/credits/modal/{SubscribeModal.js.map → subscribeModal.js.map} +0 -0
  217. /package/dist/cjs/components/credits/modal/{Tip.d.ts → tip.d.ts} +0 -0
  218. /package/dist/cjs/components/credits/modal/{Tip.js → tip.js} +0 -0
  219. /package/dist/cjs/components/credits/modal/{Tip.js.map → tip.js.map} +0 -0
  220. /package/dist/cjs/templates/{Credits.d.ts → credits.d.ts} +0 -0
  221. /package/dist/esm/components/credits/creditsBenefits/{BenefitItem.d.ts → benefitItem.d.ts} +0 -0
  222. /package/dist/esm/components/credits/creditsBenefits/{BenefitItem.js → benefitItem.js} +0 -0
  223. /package/dist/esm/components/credits/creditsBenefits/{BenefitItem.js.map → benefitItem.js.map} +0 -0
  224. /package/dist/esm/components/credits/creditsBenefits/{IconInfo.d.ts → iconInfo.d.ts} +0 -0
  225. /package/dist/esm/components/credits/creditsBenefits/{IconInfo.js → iconInfo.js} +0 -0
  226. /package/dist/esm/components/credits/creditsBenefits/{IconInfo.js.map → iconInfo.js.map} +0 -0
  227. /package/dist/esm/components/credits/modal/{ActivitiesModal.d.ts → activitiesModal.d.ts} +0 -0
  228. /package/dist/esm/components/credits/modal/{CreditsUploadReceiptModal.d.ts → creditsUploadReceiptModal.d.ts} +0 -0
  229. /package/dist/esm/components/credits/modal/{CreditsUploadReceiptModal.js → creditsUploadReceiptModal.js} +0 -0
  230. /package/dist/esm/components/credits/modal/{CreditsUploadReceiptModal.js.map → creditsUploadReceiptModal.js.map} +0 -0
  231. /package/dist/esm/components/credits/modal/{LoadingDots.d.ts → loadingDots.d.ts} +0 -0
  232. /package/dist/esm/components/credits/modal/{LoadingDots.js → loadingDots.js} +0 -0
  233. /package/dist/esm/components/credits/modal/{LoadingDots.js.map → loadingDots.js.map} +0 -0
  234. /package/dist/esm/components/credits/modal/{ModalContainer.d.ts → modalContainer.d.ts} +0 -0
  235. /package/dist/esm/components/credits/modal/{ModalContainer.js → modalContainer.js} +0 -0
  236. /package/dist/esm/components/credits/modal/{ModalContainer.js.map → modalContainer.js.map} +0 -0
  237. /package/dist/esm/components/credits/modal/{RulesModal.d.ts → rulesModal.d.ts} +0 -0
  238. /package/dist/esm/components/credits/modal/{RulesModal.js → rulesModal.js} +0 -0
  239. /package/dist/esm/components/credits/modal/{RulesModal.js.map → rulesModal.js.map} +0 -0
  240. /package/dist/esm/components/credits/modal/{SubscribeModal.d.ts → subscribeModal.d.ts} +0 -0
  241. /package/dist/esm/components/credits/modal/{SubscribeModal.js → subscribeModal.js} +0 -0
  242. /package/dist/esm/components/credits/modal/{SubscribeModal.js.map → subscribeModal.js.map} +0 -0
  243. /package/dist/esm/components/credits/modal/{Tip.d.ts → tip.d.ts} +0 -0
  244. /package/dist/esm/components/credits/modal/{Tip.js → tip.js} +0 -0
  245. /package/dist/esm/components/credits/modal/{Tip.js.map → tip.js.map} +0 -0
  246. /package/dist/esm/templates/{Credits.d.ts → credits.d.ts} +0 -0
@@ -0,0 +1,3 @@
1
+ export * from './fragment-masking';
2
+ export * from './gql';
3
+ export * from './graphql';
@@ -0,0 +1,2 @@
1
+ export { useProductsByHandles } from './useProductsByHandles';
2
+ export { useCreateCartMutation } from './useCreateCart';
@@ -0,0 +1,2 @@
1
+ import { CartInput } from '../gql';
2
+ export declare function useCreateCartMutation(): import("swr/mutation").SWRMutationResponse<import("src").Cart | undefined, any, "createCart", CartInput>;
@@ -0,0 +1,4 @@
1
+ import { GetProductsMetafieldQueryRoot } from '../fetchers/get-products-by-handles';
2
+ import { ShopifyHookOptions } from '../types/fetcher';
3
+ import { GetProductsByHandlesReq } from '../fetchers/get-products-by-handles';
4
+ export declare function useProductsByHandles({ handles, metafieldIdentifiers, }: ShopifyHookOptions<GetProductsByHandlesReq, GetProductsMetafieldQueryRoot>): import("swr").SWRResponse<import("src").Product[], any, any>;
@@ -0,0 +1 @@
1
+ export declare const createCartMutation: string;
@@ -0,0 +1 @@
1
+ export declare const getProductsByHandlesQuery: (handles: string[]) => string;
@@ -0,0 +1 @@
1
+ export { getProductsByHandlesQuery } from './get-product-by-handles';
@@ -0,0 +1,5 @@
1
+ export * from '../fetchers';
2
+ export * from '../hooks';
3
+ export * from '../queries';
4
+ export * from '../fragments';
5
+ export * from '../types';
@@ -0,0 +1,2 @@
1
+ declare const _default: import("tsup").Options | import("tsup").Options[] | ((overrideOptions: import("tsup").Options) => import("tsup").Options | import("tsup").Options[] | Promise<import("tsup").Options | import("tsup").Options[]>);
2
+ export default _default;
@@ -0,0 +1,48 @@
1
+ import { Article, ArticleEdge } from '../gql';
2
+ export type ArticleResponse = {
3
+ blog: {
4
+ title: string;
5
+ seo: string;
6
+ article: Article;
7
+ articles: {
8
+ edges: ArticleEdge[];
9
+ pageInfo: {
10
+ hasNextPage: boolean;
11
+ hasPreviousPage: boolean;
12
+ };
13
+ };
14
+ handle: string;
15
+ };
16
+ };
17
+ export type ArticleImage = {
18
+ url: string;
19
+ alt?: string;
20
+ };
21
+ export type ArticleTypes = {
22
+ article: Article;
23
+ metafields: any;
24
+ };
25
+ export type ArticleQuery = {
26
+ locale: string;
27
+ blog: string;
28
+ slug: string;
29
+ };
30
+ export type GetArticleOperation = {
31
+ data: {
32
+ blog_article?: ArticleTypes;
33
+ error?: string;
34
+ };
35
+ variables: {
36
+ blog: string;
37
+ slug: string;
38
+ };
39
+ };
40
+ export type GetAllArticleOperation<T extends ArticleTypes = ArticleTypes> = {
41
+ data: {
42
+ articles: T['article'][];
43
+ };
44
+ variables: {
45
+ first?: number;
46
+ after?: string;
47
+ };
48
+ };
@@ -0,0 +1,173 @@
1
+ import { ProductVariant, Product } from '../types/product';
2
+ import { Cart as ShopifyCart } from '../gql';
3
+ import { Discount } from './common';
4
+ import { CustomerAddress } from './customer';
5
+ export type Attributes = {
6
+ key: string;
7
+ value: string;
8
+ }[];
9
+ export type ShopifyCartOperation = {
10
+ cart: ShopifyCart;
11
+ variables: {
12
+ cartId: string;
13
+ };
14
+ };
15
+ export type ShopifyCreateCartOperation = {
16
+ cartCreate: {
17
+ cart: Cart;
18
+ };
19
+ variables: {
20
+ buyerIdentity?: any;
21
+ lines: {
22
+ merchandiseId: string;
23
+ quantity: number;
24
+ attributes?: any;
25
+ }[];
26
+ attributes?: {};
27
+ };
28
+ };
29
+ export type ShopifyAddToCartOperation = {
30
+ cartLinesAdd: {
31
+ cart: ShopifyCart;
32
+ };
33
+ variables: {
34
+ cartId: string;
35
+ buyerIdentity?: any;
36
+ lines: {
37
+ merchandiseId: string;
38
+ quantity: number;
39
+ attributes?: any;
40
+ }[];
41
+ attributes?: {};
42
+ };
43
+ };
44
+ export type ShopifyRemoveFromCartOperation = {
45
+ cartLinesRemove: {
46
+ cart: ShopifyCart;
47
+ };
48
+ variables: {
49
+ cartId: string;
50
+ lineIds: string[];
51
+ };
52
+ };
53
+ export type ShopifyUpdateCartOperation = {
54
+ cartLinesUpdate: {
55
+ cart: ShopifyCart;
56
+ };
57
+ variables: {
58
+ cartId: string;
59
+ lines: {
60
+ id: string;
61
+ merchandiseId?: string;
62
+ quantity?: number;
63
+ attributes?: any;
64
+ }[];
65
+ attributes?: any;
66
+ };
67
+ };
68
+ export type ShopifyCodesUpdateCartOperation = {
69
+ cartDiscountCodesUpdate: {
70
+ cart: ShopifyCart;
71
+ };
72
+ variables: {
73
+ cartId: string;
74
+ discountCodes: string[];
75
+ };
76
+ };
77
+ export type CartAttributesUpdateOperation = {
78
+ cartAttributesUpdate: {
79
+ cart: ShopifyCart;
80
+ };
81
+ variables: {
82
+ cartId: string;
83
+ attributes: any;
84
+ };
85
+ };
86
+ export type InputArribute = {
87
+ key?: string;
88
+ value?: string;
89
+ };
90
+ export type subInputValue = {
91
+ [key: string]: string;
92
+ };
93
+ export type InputLineItem = {
94
+ merchandiseId: string;
95
+ quantity: number;
96
+ attributes: any;
97
+ buyerIdentity?: any;
98
+ sellingPlanId?: string;
99
+ };
100
+ export type SelectedOption = {
101
+ id?: string;
102
+ name: string;
103
+ value: string;
104
+ };
105
+ export type LineItem = {
106
+ id: string;
107
+ variantId: string;
108
+ productId: string;
109
+ name: string;
110
+ quantity: number;
111
+ discounts: Discount[];
112
+ path: string;
113
+ variant: ProductVariant;
114
+ totalAmount: number;
115
+ subtotalAmount: number;
116
+ options?: SelectedOption[];
117
+ discountAllocations?: DiscountAllocations[];
118
+ product?: Product;
119
+ customAttributes?: any;
120
+ attributes?: any;
121
+ sellingPlan?: string;
122
+ };
123
+ export type Discounts = {
124
+ applicable: boolean;
125
+ code: string;
126
+ };
127
+ export type DiscountAllocations = {
128
+ amount: number;
129
+ code: string;
130
+ };
131
+ export type EstimatedCost = {
132
+ amount: string;
133
+ currencyCode: string;
134
+ };
135
+ export type SelectedDeliveryOption = {
136
+ code: string;
137
+ estimatedCost: EstimatedCost;
138
+ handle: string;
139
+ title: string;
140
+ };
141
+ export type DeliveryGroups = {
142
+ deliveryAddress: CustomerAddress;
143
+ deliveryOptions: any;
144
+ id: string;
145
+ selectedDeliveryOption?: any;
146
+ };
147
+ export type Cart = {
148
+ id: string;
149
+ customerId?: string;
150
+ email?: string;
151
+ createdAt: string;
152
+ currency: {
153
+ code: string;
154
+ };
155
+ taxesIncluded?: boolean;
156
+ lineItems: LineItem[];
157
+ totalLineItemsDiscount?: number;
158
+ orderDiscounts?: number;
159
+ lineItemsSubtotalPrice: number;
160
+ subtotalPrice: number;
161
+ totalPrice: number;
162
+ totalTaxAmount: number;
163
+ discountCodes: Discounts[];
164
+ discountAllocations?: DiscountAllocations[];
165
+ discounts?: Discount[];
166
+ url?: string;
167
+ ready: boolean;
168
+ orderStatusUrl?: any;
169
+ customAttributes?: any;
170
+ buyerIdentity?: any;
171
+ deliveryAmount?: number;
172
+ deliveryGroups?: DeliveryGroups[];
173
+ };
@@ -0,0 +1,42 @@
1
+ export type ShopifyGetCheckoutOperation = {
2
+ node: {
3
+ id: string;
4
+ webUrl: string;
5
+ completedAt: string;
6
+ };
7
+ variables: {
8
+ checkoutId: string;
9
+ };
10
+ };
11
+ export type ShopifyCreateCheckoutOperation = {
12
+ checkoutCreate: {
13
+ checkout: {
14
+ id: string;
15
+ webUrl: string;
16
+ };
17
+ };
18
+ variables: {
19
+ customAttributes?: any;
20
+ lineItems: {
21
+ variantId: string;
22
+ quantity: number;
23
+ customAttributes?: any;
24
+ }[];
25
+ };
26
+ };
27
+ export type ShopifyCheckoutDiscountApplyOperation = {
28
+ checkoutDiscountCodeApplyV2: {
29
+ checkout: {
30
+ id: string;
31
+ webUrl: string;
32
+ };
33
+ };
34
+ variables: {
35
+ checkoutId: string;
36
+ discountCode: string;
37
+ };
38
+ };
39
+ export type Checkout = {
40
+ id?: string;
41
+ webUrl?: string;
42
+ };
@@ -0,0 +1,122 @@
1
+ import { ProductTypes } from './product';
2
+ import { Collection, Image, Maybe } from '../gql';
3
+ export type CollectionsMetafield = {
4
+ [key: string]: string[];
5
+ };
6
+ export type FilterPriceTxt = {
7
+ text: string;
8
+ gte: string;
9
+ lte: string;
10
+ };
11
+ export type FiltersPairMetafield = {
12
+ collections: {
13
+ [key: string]: {
14
+ filter_params: string[];
15
+ price?: [number[]];
16
+ };
17
+ };
18
+ filters_label: {
19
+ [key: string]: any;
20
+ };
21
+ cabletype?: {
22
+ [key: string]: any;
23
+ };
24
+ length?: {
25
+ [key: string]: any;
26
+ };
27
+ videoports?: {
28
+ [key: string]: any;
29
+ };
30
+ datatransferspeed?: {
31
+ [key: string]: any;
32
+ };
33
+ connectivity?: {
34
+ [key: string]: any;
35
+ };
36
+ numberofports?: {
37
+ [key: string]: any;
38
+ };
39
+ porttype?: {
40
+ [key: string]: any;
41
+ };
42
+ numberofdevicespowered?: {
43
+ [key: string]: any;
44
+ };
45
+ chargingtechnology?: {
46
+ [key: string]: any;
47
+ };
48
+ capacity?: {
49
+ [key: string]: any;
50
+ };
51
+ product_type: {
52
+ [key: string]: any;
53
+ };
54
+ price: FilterPriceTxt;
55
+ filter_txt: {
56
+ [key: string]: any;
57
+ };
58
+ [key: string]: any;
59
+ };
60
+ export type FiltersPair = {
61
+ label: string;
62
+ value: string;
63
+ options: Array<{
64
+ value: string;
65
+ label: string;
66
+ }>;
67
+ };
68
+ export type CategoryImage = {
69
+ url: string;
70
+ alt?: string;
71
+ };
72
+ export type Category<T extends ProductTypes = ProductTypes> = {
73
+ id: string;
74
+ name: string;
75
+ slug: string;
76
+ path: string;
77
+ description?: string;
78
+ descriptionHtml?: string;
79
+ image?: Maybe<Image>;
80
+ products?: T['product'][];
81
+ filters?: any;
82
+ pageInfo?: any;
83
+ seo?: any;
84
+ initData?: any;
85
+ metafields?: {
86
+ [key: string]: any;
87
+ };
88
+ };
89
+ export type CategoryTypes = {
90
+ collection: Category;
91
+ };
92
+ export type GetCollectionOperation<T extends CategoryTypes = CategoryTypes> = {
93
+ collectionByHandle: Collection;
94
+ variables: {
95
+ handle?: string;
96
+ first?: number;
97
+ after?: string;
98
+ last?: string;
99
+ before?: string;
100
+ reverse?: boolean;
101
+ sortKey?: string;
102
+ filters?: any;
103
+ };
104
+ };
105
+ export type CollectionQuery = {
106
+ locale?: string;
107
+ handle?: string;
108
+ queryArgument?: {
109
+ first?: number;
110
+ after?: string;
111
+ last?: string;
112
+ before?: string;
113
+ reverse?: boolean;
114
+ sortKey?: string;
115
+ filters?: any;
116
+ };
117
+ };
118
+ export type PriceLabel = {
119
+ text: string;
120
+ gte: string;
121
+ lte: string;
122
+ };
@@ -0,0 +1,42 @@
1
+ export type Discount = {
2
+ value?: number;
3
+ percentage?: number;
4
+ amount?: number;
5
+ currencyCode?: string;
6
+ };
7
+ export type Measurement = {
8
+ value: number;
9
+ unit: 'KILOGRAMS' | 'GRAMS' | 'POUNDS' | 'OUNCES';
10
+ };
11
+ export type Image = {
12
+ url: string;
13
+ altText?: string;
14
+ width?: number;
15
+ height?: number;
16
+ };
17
+ export type Maybe<T> = T | null;
18
+ export type ExtractVariables<T> = T extends {
19
+ variables?: object;
20
+ } ? T['variables'] : undefined;
21
+ export interface CommerceAPIFetchOptions<T> {
22
+ variables?: ExtractVariables<T>;
23
+ preview?: boolean;
24
+ }
25
+ export type Connection<T> = {
26
+ edges: Array<Edge<T>>;
27
+ };
28
+ export type Edge<T> = {
29
+ node: T;
30
+ };
31
+ export type Menu = {
32
+ title: string;
33
+ path: string;
34
+ };
35
+ export type Money = {
36
+ amount: string;
37
+ currencyCode: string;
38
+ };
39
+ export type SEO = {
40
+ title: string;
41
+ description: string;
42
+ };
@@ -0,0 +1,12 @@
1
+ export type SiteConfig = {
2
+ locale: string;
3
+ metafieldsNamespace: string;
4
+ cartIdCookieName: string;
5
+ brand: string;
6
+ appName: string;
7
+ };
8
+ export type ShopifyConfig = {
9
+ storefrontToken: string;
10
+ storeDomain: string;
11
+ };
12
+ export type ShopifyContextValue = SiteConfig & ShopifyConfig;
@@ -0,0 +1,30 @@
1
+ export interface GetCustomerQueryResponse {
2
+ }
3
+ export type CustomerAddress = {
4
+ id: string;
5
+ firstName: string;
6
+ lastName: string;
7
+ address1: string;
8
+ address2: string;
9
+ city: string;
10
+ province: string;
11
+ provinceCode: string;
12
+ countryCodeV2: string;
13
+ phone: string;
14
+ zip: string;
15
+ };
16
+ export type Customer = {
17
+ id: string;
18
+ firstName?: string;
19
+ lastName?: string;
20
+ displayName?: string;
21
+ email: string;
22
+ phone?: string;
23
+ tags?: string[];
24
+ acceptsMarketing?: boolean;
25
+ createdAt?: string;
26
+ orders: {
27
+ id: string;
28
+ }[];
29
+ defaultAddress?: CustomerAddress;
30
+ };
@@ -0,0 +1,38 @@
1
+ import { HasMetafieldsIdentifier } from '../gql';
2
+ import { PartialRecord } from './type-helper';
3
+ import { SWRMutationResponse } from 'swr/mutation';
4
+ import { ShopifyConfig } from './config';
5
+ type RequestBasicParams = {
6
+ query?: string;
7
+ config: ShopifyConfig;
8
+ };
9
+ export declare enum HasMetafieldQueryRoot {
10
+ Product = "product",
11
+ Variant = "variant",
12
+ Page = "page",
13
+ Article = "article",
14
+ Blog = "blog",
15
+ Collection = "collection",
16
+ Shop = "shop",
17
+ Cart = "cart",
18
+ Customer = "customer",
19
+ Location = "location",
20
+ Market = "market",
21
+ Order = "order"
22
+ }
23
+ export type ConstructMetafieldIdentifiersQueryInput<Roots extends HasMetafieldQueryRoot> = Partial<Record<Roots, HasMetafieldsIdentifier[]>>;
24
+ type RequestWithOptions<T, M extends HasMetafieldQueryRoot> = RequestBasicParams & {
25
+ options: T & {
26
+ metafieldIdentifiers?: PartialRecord<M, HasMetafieldsIdentifier[]>;
27
+ metafieldsNamespace: string;
28
+ };
29
+ };
30
+ export type ShopifyFetcherVariables<T, M extends HasMetafieldQueryRoot> = M extends HasMetafieldQueryRoot ? T & PartialRecord<`${M}MetafieldIdentifiers`, HasMetafieldsIdentifier[]> : T;
31
+ export type ShopifyFetcher<Data = Record<string, any>, Req = undefined, Metafields extends HasMetafieldQueryRoot = HasMetafieldQueryRoot> = (req: Req extends Record<string, any> ? RequestWithOptions<Req, Metafields> : RequestBasicParams) => Promise<Data>;
32
+ export type ShopifyHookOptions<T, M extends HasMetafieldQueryRoot> = {
33
+ locale?: string;
34
+ query?: string;
35
+ metafieldIdentifiers?: PartialRecord<M, HasMetafieldsIdentifier[]>;
36
+ } & T;
37
+ export type ShopifyMutationHook<Req, Metafields extends HasMetafieldQueryRoot> = (options: ShopifyHookOptions<Req, Metafields>) => SWRMutationResponse;
38
+ export {};
@@ -0,0 +1,10 @@
1
+ export * from './common';
2
+ export * from './cart';
3
+ export * from './checkout';
4
+ export * from './page';
5
+ export * from './product';
6
+ export * from './site';
7
+ export * from './collection';
8
+ export * from './search';
9
+ export * from './article';
10
+ export * from './customer';
@@ -0,0 +1,33 @@
1
+ export type Page = {
2
+ id: string;
3
+ handle: string;
4
+ name: string;
5
+ path?: string;
6
+ body: string;
7
+ is_visible?: boolean;
8
+ sort_order?: number;
9
+ url?: string;
10
+ seo?: any;
11
+ metafields?: {
12
+ [key: string]: any;
13
+ };
14
+ };
15
+ export type PageTypes = {
16
+ page: Page;
17
+ };
18
+ export type GetAllPagesOperation<T extends PageTypes = PageTypes> = {
19
+ data: {
20
+ pages: T['page'][];
21
+ };
22
+ };
23
+ export type GetPageOperation<T extends PageTypes = PageTypes> = {
24
+ data: {
25
+ page?: T['page'];
26
+ metafields?: {
27
+ [key: string]: any;
28
+ };
29
+ };
30
+ variables: {
31
+ id: string;
32
+ };
33
+ };