@anker-in/campaign-ui 0.2.10-beta.1 → 0.2.10-beta.2
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/cjs/components/credits/context/hooks/useActivities.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useActivities.js.map +2 -2
- package/dist/cjs/components/credits/context/hooks/useMyRewards.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useMyRewards.js.map +2 -2
- package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.d.ts +1 -1
- package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.js.map +2 -2
- package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js.map +2 -2
- package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js.map +2 -2
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.js.map +2 -2
- package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.js.map +2 -2
- package/dist/cjs/components/credits/context/hooks/useSubscribed.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useSubscribed.js.map +2 -2
- package/dist/cjs/components/credits/creditsCash/index.js +1 -1
- package/dist/cjs/components/credits/creditsCash/index.js.map +2 -2
- package/dist/cjs/components/credits/creditsCash/type.d.ts +1 -1
- package/dist/cjs/components/credits/creditsCash/type.js.map +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/index.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/index.js.map +2 -2
- package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.js +1 -1
- package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.js.map +2 -2
- package/dist/cjs/components/credits/type.d.ts +1 -1
- package/dist/cjs/components/credits/type.js.map +1 -1
- package/dist/cjs/index.d.ts +6 -6
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/shopify/context/ShopifyProvider.d.ts +1 -1
- package/dist/cjs/shopify/fetchers/create-cart.d.ts +1 -1
- package/dist/cjs/shopify/fetchers/get-products-by-handles.d.ts +1 -1
- package/dist/cjs/shopify/hooks/useProductsByHandles.d.ts +1 -1
- package/dist/cjs/shopify/types/cart.d.ts +1 -1
- package/dist/cjs/shopify/types/fetcher.d.ts +1 -1
- package/dist/cjs/shopify/types/product.d.ts +1 -1
- package/dist/cjs/shopify/utils/cookie.d.ts +1 -1
- package/dist/cjs/shopify/utils/fetch-graphql-api.d.ts +1 -1
- package/dist/cjs/shopify/utils/normalize/cart.d.ts +3 -3
- package/dist/cjs/shopify/utils/normalize/customer.d.ts +1 -1
- package/dist/esm/components/credits/context/hooks/useActivities.js +1 -1
- package/dist/esm/components/credits/context/hooks/useActivities.js.map +2 -2
- package/dist/esm/components/credits/context/hooks/useMyRewards.js +1 -1
- package/dist/esm/components/credits/context/hooks/useMyRewards.js.map +2 -2
- package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.d.ts +1 -1
- package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.js +1 -1
- package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.js.map +2 -2
- package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js +1 -1
- package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js.map +2 -2
- package/dist/esm/components/credits/context/hooks/useRedeemProduct.js +1 -1
- package/dist/esm/components/credits/context/hooks/useRedeemProduct.js.map +2 -2
- package/dist/esm/components/credits/context/hooks/useRedeemableList.js +1 -1
- package/dist/esm/components/credits/context/hooks/useRedeemableList.js.map +2 -2
- package/dist/esm/components/credits/context/hooks/useSendEmailValidation.js +1 -1
- package/dist/esm/components/credits/context/hooks/useSendEmailValidation.js.map +2 -2
- package/dist/esm/components/credits/context/hooks/useSubscribed.js +1 -1
- package/dist/esm/components/credits/context/hooks/useSubscribed.js.map +2 -2
- package/dist/esm/components/credits/creditsCash/index.js +1 -1
- package/dist/esm/components/credits/creditsCash/index.js.map +2 -2
- package/dist/esm/components/credits/creditsCash/type.d.ts +1 -1
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js.map +2 -2
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js.map +2 -2
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +2 -2
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +2 -2
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +2 -2
- package/dist/esm/components/credits/creditsRedeemList/index.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/index.js.map +2 -2
- package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js +1 -1
- package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js.map +2 -2
- package/dist/esm/components/credits/type.d.ts +1 -1
- package/dist/esm/index.d.ts +6 -6
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/shopify/context/ShopifyProvider.d.ts +1 -1
- package/dist/esm/shopify/fetchers/create-cart.d.ts +1 -1
- package/dist/esm/shopify/fetchers/get-products-by-handles.d.ts +1 -1
- package/dist/esm/shopify/hooks/useProductsByHandles.d.ts +1 -1
- package/dist/esm/shopify/types/cart.d.ts +1 -1
- package/dist/esm/shopify/types/fetcher.d.ts +1 -1
- package/dist/esm/shopify/types/product.d.ts +1 -1
- package/dist/esm/shopify/utils/cookie.d.ts +1 -1
- package/dist/esm/shopify/utils/fetch-graphql-api.d.ts +1 -1
- package/dist/esm/shopify/utils/normalize/cart.d.ts +3 -3
- package/dist/esm/shopify/utils/normalize/customer.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/credits/context/hooks/useActivities.ts +1 -1
- package/src/components/credits/context/hooks/useMyRewards.ts +1 -1
- package/src/components/credits/context/hooks/useRedeemAndBuy.ts +2 -2
- package/src/components/credits/context/hooks/useRedeemCoupon.ts +1 -1
- package/src/components/credits/context/hooks/useRedeemProduct.ts +1 -1
- package/src/components/credits/context/hooks/useRedeemableList.ts +1 -1
- package/src/components/credits/context/hooks/useSendEmailValidation.ts +1 -1
- package/src/components/credits/context/hooks/useSubscribed.ts +1 -1
- package/src/components/credits/creditsCash/index.tsx +2 -2
- package/src/components/credits/creditsCash/type.ts +1 -1
- package/src/components/credits/creditsRedeemList/AddressForm/index.tsx +1 -1
- package/src/components/credits/creditsRedeemList/RedeemCouponModal.tsx +1 -1
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx +1 -1
- package/src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx +1 -1
- package/src/components/credits/creditsRedeemList/RedeemProductModal/index.tsx +1 -1
- package/src/components/credits/creditsRedeemList/index.tsx +1 -1
- package/src/components/credits/creditsWaysToGetCredits/useActions.ts +1 -1
- package/src/components/credits/type.ts +1 -1
- package/src/index.ts +6 -6
- package/src/shopify/context/ShopifyProvider.tsx +1 -1
- package/src/shopify/fetchers/create-cart.ts +2 -2
- package/src/shopify/fetchers/get-products-by-handles.ts +2 -2
- package/src/shopify/hooks/useCreateCart.ts +1 -1
- package/src/shopify/hooks/useProductsByHandles.ts +2 -2
- package/src/shopify/types/cart.ts +1 -1
- package/src/shopify/types/fetcher.ts +1 -1
- package/src/shopify/types/product.ts +1 -1
- package/src/shopify/utils/cookie.ts +1 -1
- package/src/shopify/utils/fetch-graphql-api.ts +1 -1
- package/src/shopify/utils/normalize/cart.ts +3 -3
- package/src/shopify/utils/normalize/customer.ts +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/creditsRedeemList/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Container, Heading, Tabs, TabsList, TabsTrigger } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCallback, useMemo, useState } from 'react'\n\nimport RedeemCouponModal from './RedeemCouponModal'\nimport RedeemProductModal from './RedeemProductModal'\nimport { useCreditsContext } from '../context/provider'\nimport useRedeemableList from '../context/hooks/useRedeemableList'\nimport { AlpcConsumeType, AlpcErrorCode } from '../context/const'\nimport { useProductsByHandles } from '
|
|
5
|
-
"mappings": "AAoGI,OACiB,OAAAA,EADjB,QAAAC,MAAA,oBApGJ,OAAS,aAAAC,EAAW,WAAAC,EAAS,QAAAC,EAAM,YAAAC,EAAU,eAAAC,MAAmB,wBAChE,OAAOC,MAAgB,aACvB,OAAS,eAAAC,EAAa,WAAAC,EAAS,YAAAC,MAAgB,QAE/C,OAAOC,MAAuB,sBAC9B,OAAOC,MAAwB,uBAC/B,OAAS,qBAAAC,MAAyB,sBAClC,OAAOC,MAAuB,qCAC9B,OAAS,mBAAAC,EAAiB,iBAAAC,MAAqB,mBAC/C,OAAS,wBAAAC,MAA4B,
|
|
4
|
+
"sourcesContent": ["import { Container, Heading, Tabs, TabsList, TabsTrigger } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCallback, useMemo, useState } from 'react'\n\nimport RedeemCouponModal from './RedeemCouponModal'\nimport RedeemProductModal from './RedeemProductModal'\nimport { useCreditsContext } from '../context/provider'\nimport useRedeemableList from '../context/hooks/useRedeemableList'\nimport { AlpcConsumeType, AlpcErrorCode } from '../context/const'\nimport { useProductsByHandles } from '@shopify/hooks/useProductsByHandles'\nimport type { RedeemableItem as RedeemableItemType } from '../type'\nimport { RedeemableItem } from './RedeemableItem'\nimport RulesModal from '../modal/rulesModal'\nimport { CreditsRedeemListCopy } from './type'\nimport { gaTrack } from '../../../helpers/track'\n\nexport function CreditsRedeemList({\n copy,\n className = '',\n tabClassName = '',\n hideTitle = false,\n cardClassName,\n activate,\n}: {\n copy: CreditsRedeemListCopy\n className?: string\n tabClassName?: string\n hideTitle?: boolean\n cardClassName?: string\n activate: {\n openAuthCodePopup: () => void\n isSuccess: boolean\n setOnSuccess: (callback: Function) => void\n }\n}) {\n const {\n profile,\n openSignUpPopup,\n gtm: { pageGroup },\n } = useCreditsContext()\n const isLogin = Object.keys(profile || {}).length > 0\n\n const [activeTab, setActiveTab] = useState<string>(copy.list[0].label)\n\n const [popRedeemData, setPopRedeemData] = useState<RedeemableItemType | undefined>(undefined)\n\n const [rules, setRules] = useState<string | string[]>()\n\n const { listLoading, redeemableList, getRedeemableList } = useRedeemableList()\n\n const alpcList = useMemo(() => {\n return redeemableList.map(item => {\n return {\n id: item.id.toString(),\n title: item.name,\n consumeCredits: item.consume_credits,\n remainingInventory: item.remaining_inventory,\n isLimited: !!item.is_limited,\n consumeType: item.consume_type,\n handle: item.sku_handle,\n sku: item.goods_sku,\n image: item.goods_url,\n }\n })\n }, [copy.list, activeTab, redeemableList])\n\n const handles = alpcList.map(item => item.handle)\n const { data: products } = useProductsByHandles({ handles })\n\n const list = useMemo(() => {\n const currentList = copy.list.find(item => item.label === activeTab)\n return currentList?.list\n .filter(item => alpcList.some(alpcItem => alpcItem.id === item.id))\n .map(item => {\n const alpcItem = alpcList.find(alpcItem => alpcItem.id === item.id)\n const product = products?.find(product => product.handle === alpcItem?.handle)\n const variant = product?.variants.find(variant => variant.sku === alpcItem?.sku)\n if (alpcItem?.consumeType === AlpcConsumeType.Product && (!product || !variant)) return null\n return {\n alpc: alpcList.find(alpcItem => alpcItem.id === item.id),\n config: item,\n product,\n variant,\n }\n })\n .filter(item => item !== null) as unknown as RedeemableItemType[]\n }, [alpcList, products])\n\n const handleRedeemError = useCallback(\n (errorCode: AlpcErrorCode) => {\n if (errorCode === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n getRedeemableList()\n }\n },\n [getRedeemableList]\n )\n\n console.log('popRedeemData', popRedeemData)\n\n return (\n <Container className={classNames('relative bg-[#F5F5F7]', className)}>\n {!hideTitle && <Heading as=\"h2\" size=\"4\" html={copy.title} />}\n\n <Tabs\n shape=\"rounded\"\n align=\"left\"\n className={classNames('sticky top-0 z-20 py-[24px] md:justify-center', tabClassName)}\n value={activeTab.toString()}\n onValueChange={value => {\n setActiveTab(value)\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_navigation',\n event_parameters: {\n navigation: value,\n page_group: pageGroup,\n },\n })\n }}\n >\n <TabsList>\n {copy.list.map(item => (\n <TabsTrigger key={item.label} value={item.label}>\n {item.label}\n </TabsTrigger>\n ))}\n </TabsList>\n </Tabs>\n {/* PC\u7AEF */}\n {!!alpcList?.length && !listLoading && (\n <div\n className={classNames('relative grid grid-cols-4 gap-[16px] md:grid-cols-2 md:gap-[12px] md-xl:grid-cols-3')}\n >\n {list?.map(item => (\n <RedeemableItem\n key={item?.alpc?.id}\n copy={copy}\n item={item}\n onRedeem={(item: RedeemableItemType) => {\n if (!isLogin) {\n openSignUpPopup()\n } else if (!profile?.activated && !activate.isSuccess) {\n activate.openAuthCodePopup()\n activate.setOnSuccess(() => {\n setPopRedeemData(item)\n })\n } else {\n setPopRedeemData(item)\n }\n }}\n onRulesOpen={setRules}\n className={cardClassName}\n />\n ))}\n </div>\n )}\n\n {popRedeemData?.alpc?.consumeType === AlpcConsumeType.Coupon && copy?.redeemModal?.coupon && popRedeemData && (\n <RedeemCouponModal\n isOpen={!!popRedeemData}\n item={popRedeemData}\n copy={copy}\n onError={handleRedeemError}\n onClose={() => {\n setPopRedeemData(undefined)\n }}\n />\n )}\n {popRedeemData?.alpc?.consumeType === AlpcConsumeType.Product && copy?.redeemModal && popRedeemData && (\n <RedeemProductModal\n isOpen={!!popRedeemData}\n item={popRedeemData}\n copy={copy}\n onError={handleRedeemError}\n onClose={() => {\n setPopRedeemData(undefined)\n }}\n />\n )}\n {rules && (\n <RulesModal\n overlayClassName=\"md:px-[16px] md:items-center\"\n className=\"md:h-fit md:rounded-b-[16px]\"\n isOpen={rules.length > 0}\n onClose={() => setRules([])}\n titleClassName=\"border-b-transparent h-[56px]\"\n rules={rules}\n scrollClassName=\"md:mt-[8px] md:mb-[24px] md:pt-0\"\n title={copy?.ruleLabel}\n ruleClassName=\"text-[#1d1d1f] font-bold\"\n />\n )}\n </Container>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAoGI,OACiB,OAAAA,EADjB,QAAAC,MAAA,oBApGJ,OAAS,aAAAC,EAAW,WAAAC,EAAS,QAAAC,EAAM,YAAAC,EAAU,eAAAC,MAAmB,wBAChE,OAAOC,MAAgB,aACvB,OAAS,eAAAC,EAAa,WAAAC,EAAS,YAAAC,MAAgB,QAE/C,OAAOC,MAAuB,sBAC9B,OAAOC,MAAwB,uBAC/B,OAAS,qBAAAC,MAAyB,sBAClC,OAAOC,MAAuB,qCAC9B,OAAS,mBAAA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AAAsC,GAAM,IAAIH,GACT1C,EAACkB,EAAA,CAEC,KAAMI,EACN,KAAMoB,EACN,SAAWA,GAA6B,CACjCX,EAEM,CAACH,GAAS,WAAa,CAACD,EAAS,WAC1CA,EAAS,kBAAkB,EAC3BA,EAAS,aAAa,IAAM,CAC1BQ,EAAiBO,CAAI,CACvB,CAAC,GAEDP,EAAiBO,CAAI,EAPrBb,EAAgB,CASpB,EACA,YAAaQ,EACb,UAAWX,GAhBNgB,GAAM,MAAM,EAiBnB,CACD,EACH,EAGDR,GAAe,MAAM,cAAgBnB,EAAgB,QAAUO,GAAM,aAAa,QAAUY,GAC3FlC,EAACW,EAAA,CACC,OAAQ,CAAC,CAACuB,EACV,KAAMA,EACN,KAAMZ,EACN,QAAS2B,EACT,QAAS,IAAM,CACbd,EAAiB,MAAS,CAC5B,EACF,EAEDD,GAAe,MAAM,cAAgBnB,EAAgB,SAAWO,GAAM,aAAeY,GACpFlC,EAACY,EAAA,CACC,OAAQ,CAAC,CAACsB,EACV,KAAMA,EACN,KAAMZ,EACN,QAAS2B,EACT,QAAS,IAAM,CACbd,EAAiB,MAAS,CAC5B,EACF,EAEDC,GACCpC,EAACmB,EAAA,CACC,iBAAiB,+BACjB,UAAU,+BACV,OAAQiB,EAAM,OAAS,EACvB,QAAS,IAAMC,EAAS,CAAC,CAAC,EAC1B,eAAe,gCACf,MAAOD,EACP,gBAAgB,mCAChB,MAAOd,GAAM,UACb,cAAc,2BAChB,GAEJ,CAEJ",
|
|
6
6
|
"names": ["jsx", "jsxs", "Container", "Heading", "Tabs", "TabsList", "TabsTrigger", "classNames", "useCallback", "useMemo", "useState", "RedeemCouponModal", "RedeemProductModal", "useCreditsContext", "useRedeemableList", "AlpcConsumeType", "AlpcErrorCode", "useProductsByHandles", "RedeemableItem", "RulesModal", "gaTrack", "CreditsRedeemList", "copy", "className", "tabClassName", "hideTitle", "cardClassName", "activate", "profile", "openSignUpPopup", "pageGroup", "isLogin", "activeTab", "setActiveTab", "popRedeemData", "setPopRedeemData", "rules", "setRules", "listLoading", "redeemableList", "getRedeemableList", "alpcList", "item", "handles", "products", "list", "alpcItem", "product", "variant", "handleRedeemError", "errorCode", "value"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{TaskType as t}from"./type";import{useCreditsContext as L}from"../context/provider";import{useMemo as d}from"react";import C from"../context/hooks/useReceiptUploaded";import{useFirstPurchaseFinished as P}from"../context/hooks/useFirstPurchaseFinished";import{useSubscribed as g}from"../context/hooks/useSubscribed";import{useShopifyContext as v}from"
|
|
1
|
+
import{TaskType as t}from"./type";import{useCreditsContext as L}from"../context/provider";import{useMemo as d}from"react";import C from"../context/hooks/useReceiptUploaded";import{useFirstPurchaseFinished as P}from"../context/hooks/useFirstPurchaseFinished";import{useSubscribed as g}from"../context/hooks/useSubscribed";import{useShopifyContext as v}from"@shopify/context/ShopifyProvider";import{gaTrack as F}from"../../../helpers/track";const x=({copy:e,subscribe:u,uploadReceipt:c,activate:m,gaParameters:n})=>{const{openSignUpPopup:a,gtm:p,profile:o}=L(),l=g(),s=P(),b=C(),{appName:h}=v(),r=d(()=>(o?.first_name||o?.last_name)&&o?.phone_number&&o?.dob,[o]);return d(()=>{const i=({buttonName:k,id:f,callback:N})=>{F({event:"ga4Event",event_name:"lp_button",member_active_status:o?.activated?"active":"not active",event_parameters:{page_group:p.pageGroup,position:n?.position||e.title,button_name:k,info:f}}),N()};return{actions:{[t.Activate]:{finished:o?.activated,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.Activate})},notFinished:{buttonLabel:e?.activate,handleClick:()=>i({buttonName:e?.activate,callback:()=>m.openAuthCodePopup(),id:t.Activate})},completed:{buttonLabel:e?.completed}},[t.Subscribe]:{finished:l,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.Subscribe})},notFinished:{buttonLabel:e?.subscribe,handleClick:()=>i({buttonName:e?.subscribe,callback:()=>u.openSubscribePopup(),id:t.Subscribe})},completed:{buttonLabel:e?.completed}},[t.CompleteProfile]:{finished:r,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.CompleteProfile})},notFinished:{buttonLabel:e?.completeProfile,link:`/account/profile?app=${h}`,handleClick:()=>i({buttonName:e?.completeProfile,callback:()=>{},id:t.CompleteProfile})},completed:{buttonLabel:e?.completed}},[t.FirstPurchase]:{finished:s,notLogin:{buttonLabel:e?.makeFirstPurchase,handleClick:()=>i({buttonName:e?.makeFirstPurchase,callback:a,id:t.FirstPurchase})},notFinished:{buttonLabel:e?.makeFirstPurchase,link:e?.goShopLink,handleClick:()=>i({buttonName:e?.makeFirstPurchase,callback:()=>{},id:t.FirstPurchase})},completed:{buttonLabel:e?.completed}},[t.UploadReceipt]:{finished:b,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.UploadReceipt})},notFinished:{buttonLabel:e?.uploadReceipt,handleClick:()=>i({buttonName:e?.uploadReceipt,callback:()=>c.openUploadReceiptPopup(),id:t.UploadReceipt})},completed:{buttonLabel:e?.completed}},[t.Shop]:{finished:!1,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.Shop})},notFinished:{buttonLabel:e?.shopNow,link:e?.goShopLink,handleClick:()=>i({buttonName:e?.shopNow,callback:()=>{},id:t.Shop})},completed:{buttonLabel:e?.completed}}}}},[o?.activated,e?.joinNow,e?.activate,e?.completed,e?.subscribe,e?.completeProfile,e?.makeFirstPurchase,e?.uploadReceipt,e?.shopNow,e.title,e?.goShopLink,l,r,s,b,n?.position,a])};export{x as useActions};
|
|
2
2
|
//# sourceMappingURL=useActions.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/creditsWaysToGetCredits/useActions.ts"],
|
|
4
|
-
"sourcesContent": ["import { TaskType } from './type'\nimport { useCreditsContext } from '../context/provider'\nimport { useMemo } from 'react'\nimport useReceiptUploaded from '../context/hooks/useReceiptUploaded'\nimport { useFirstPurchaseFinished } from '../context/hooks/useFirstPurchaseFinished'\nimport { useSubscribed } from '../context/hooks/useSubscribed'\nimport type { CreditsWaysToGetCreditsProps } from './type'\nimport { useShopifyContext } from '
|
|
5
|
-
"mappings": "AAAA,OAAS,YAAAA,MAAgB,SACzB,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,WAAAC,MAAe,QACxB,OAAOC,MAAwB,sCAC/B,OAAS,4BAAAC,MAAgC,4CACzC,OAAS,iBAAAC,MAAqB,iCAE9B,OAAS,qBAAAC,MAAyB,
|
|
4
|
+
"sourcesContent": ["import { TaskType } from './type'\nimport { useCreditsContext } from '../context/provider'\nimport { useMemo } from 'react'\nimport useReceiptUploaded from '../context/hooks/useReceiptUploaded'\nimport { useFirstPurchaseFinished } from '../context/hooks/useFirstPurchaseFinished'\nimport { useSubscribed } from '../context/hooks/useSubscribed'\nimport type { CreditsWaysToGetCreditsProps } from './type'\nimport { useShopifyContext } from '@shopify/context/ShopifyProvider'\nimport { gaTrack } from '../../../helpers/track'\n\nexport const useActions = ({\n copy,\n subscribe,\n uploadReceipt,\n activate,\n gaParameters,\n}: CreditsWaysToGetCreditsProps & {\n gaParameters?: {\n position: string\n }\n}) => {\n const { openSignUpPopup, gtm, profile } = useCreditsContext()\n const isSubscribed = useSubscribed()\n const firstPurchaseFinished = useFirstPurchaseFinished()\n const uploadedReceipt = useReceiptUploaded()\n const { appName } = useShopifyContext()\n\n const profileCompleted = useMemo(() => {\n return (profile?.first_name || profile?.last_name) && profile?.phone_number && profile?.dob\n }, [profile])\n\n return useMemo(() => {\n const handleClickWithTrack = ({\n buttonName,\n id,\n callback,\n }: {\n buttonName: string\n id?: string\n callback: () => void\n }) => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n member_active_status: profile?.activated ? 'active' : 'not active',\n event_parameters: {\n page_group: gtm.pageGroup,\n position: gaParameters?.position || copy.title,\n button_name: buttonName,\n info: id,\n },\n })\n callback()\n }\n return {\n actions: {\n [TaskType.Activate]: {\n finished: profile?.activated,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({ buttonName: copy?.joinNow, callback: openSignUpPopup, id: TaskType.Activate }),\n },\n notFinished: {\n buttonLabel: copy?.activate,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.activate,\n callback: () => activate.openAuthCodePopup(),\n id: TaskType.Activate,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.Subscribe]: {\n finished: isSubscribed,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({ buttonName: copy?.joinNow, callback: openSignUpPopup, id: TaskType.Subscribe }),\n },\n notFinished: {\n buttonLabel: copy?.subscribe,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.subscribe,\n callback: () => subscribe.openSubscribePopup(),\n id: TaskType.Subscribe,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.CompleteProfile]: {\n finished: profileCompleted,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.joinNow,\n callback: openSignUpPopup,\n id: TaskType.CompleteProfile,\n }),\n },\n notFinished: {\n buttonLabel: copy?.completeProfile,\n link: `/account/profile?app=${appName}`,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.completeProfile,\n callback: () => {},\n id: TaskType.CompleteProfile,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.FirstPurchase]: {\n finished: firstPurchaseFinished,\n notLogin: {\n buttonLabel: copy?.makeFirstPurchase,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.makeFirstPurchase,\n callback: openSignUpPopup,\n id: TaskType.FirstPurchase,\n }),\n },\n notFinished: {\n buttonLabel: copy?.makeFirstPurchase,\n link: copy?.goShopLink,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.makeFirstPurchase,\n callback: () => {},\n id: TaskType.FirstPurchase,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.UploadReceipt]: {\n finished: uploadedReceipt,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.joinNow,\n callback: openSignUpPopup,\n id: TaskType.UploadReceipt,\n }),\n },\n notFinished: {\n buttonLabel: copy?.uploadReceipt,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.uploadReceipt,\n callback: () => uploadReceipt.openUploadReceiptPopup(),\n id: TaskType.UploadReceipt,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.Shop]: {\n finished: false,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.joinNow,\n callback: openSignUpPopup,\n id: TaskType.Shop,\n }),\n },\n notFinished: {\n buttonLabel: copy?.shopNow,\n link: copy?.goShopLink,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.shopNow,\n callback: () => {},\n id: TaskType.Shop,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n },\n }\n }, [\n profile?.activated,\n copy?.joinNow,\n copy?.activate,\n copy?.completed,\n copy?.subscribe,\n copy?.completeProfile,\n copy?.makeFirstPurchase,\n copy?.uploadReceipt,\n copy?.shopNow,\n copy.title,\n copy?.goShopLink,\n isSubscribed,\n profileCompleted,\n firstPurchaseFinished,\n uploadedReceipt,\n gaParameters?.position,\n openSignUpPopup,\n ])\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,YAAAA,MAAgB,SACzB,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,WAAAC,MAAe,QACxB,OAAOC,MAAwB,sCAC/B,OAAS,4BAAAC,MAAgC,4CACzC,OAAS,iBA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,IAAME,EAAc,uBAAuB,EACrD,GAAIX,EAAS,aACf,CAAC,CACL,EACA,UAAW,CACT,YAAaS,GAAM,SACrB,CACF,EACA,CAACT,EAAS,IAAI,EAAG,CACf,SAAU,GACV,SAAU,CACR,YAAaS,GAAM,QACnB,YAAa,IACXa,EAAqB,CACnB,WAAYb,GAAM,QAClB,SAAUK,EACV,GAAId,EAAS,IACf,CAAC,CACL,EACA,YAAa,CACX,YAAaS,GAAM,QACnB,KAAMA,GAAM,WACZ,YAAa,IACXa,EAAqB,CACnB,WAAYb,GAAM,QAClB,SAAU,IAAM,CAAC,EACjB,GAAIT,EAAS,IACf,CAAC,CACL,EACA,UAAW,CACT,YAAaS,GAAM,SACrB,CACF,CACF,CACF,CACF,EAAG,CACDO,GAAS,UACTP,GAAM,QACNA,GAAM,SACNA,GAAM,UACNA,GAAM,UACNA,GAAM,gBACNA,GAAM,kBACNA,GAAM,cACNA,GAAM,QACNA,EAAK,MACLA,GAAM,WACNQ,EACAI,EACAH,EACAC,EACAN,GAAc,SACdC,CACF,CAAC,CACH",
|
|
6
6
|
"names": ["TaskType", "useCreditsContext", "useMemo", "useReceiptUploaded", "useFirstPurchaseFinished", "useSubscribed", "useShopifyContext", "gaTrack", "useActions", "copy", "subscribe", "uploadReceipt", "activate", "gaParameters", "openSignUpPopup", "gtm", "profile", "isSubscribed", "firstPurchaseFinished", "uploadedReceipt", "appName", "profileCompleted", "handleClickWithTrack", "buttonName", "id", "callback"]
|
|
7
7
|
}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './components/index';
|
|
2
|
-
export { ShopifyProvider, useShopifyContext } from '
|
|
3
|
-
export * from '
|
|
4
|
-
export * from '
|
|
5
|
-
export * from '
|
|
6
|
-
export * from '
|
|
7
|
-
export type { Cart, LineItem, Product, ProductVariant, ProductImage, ProductMedia, ProductPrice, VariantCoupon, Discount, } from '
|
|
2
|
+
export { ShopifyProvider, useShopifyContext } from '@shopify/context/ShopifyProvider';
|
|
3
|
+
export * from '@shopify/fetchers';
|
|
4
|
+
export * from '@shopify/hooks';
|
|
5
|
+
export * from '@shopify/queries';
|
|
6
|
+
export * from '@shopify/fragments';
|
|
7
|
+
export type { Cart, LineItem, Product, ProductVariant, ProductImage, ProductMedia, ProductPrice, VariantCoupon, Discount, } from '@shopify/types';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export*from"./components/index";import{ShopifyProvider as e,useShopifyContext as p}from"
|
|
1
|
+
export*from"./components/index";import{ShopifyProvider as e,useShopifyContext as p}from"@shopify/context/ShopifyProvider";export*from"@shopify/fetchers";export*from"@shopify/hooks";export*from"@shopify/queries";export*from"@shopify/fragments";export{e as ShopifyProvider,p as useShopifyContext};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './components/index'\n\n// \u5BFC\u51FA Shopify Context \u76F8\u5173\u6A21\u5757\nexport { ShopifyProvider, useShopifyContext } from '
|
|
5
|
-
"mappings": "AAAA,WAAc,qBAGd,OAAS,mBAAAA,EAAiB,qBAAAC,MAAyB,
|
|
4
|
+
"sourcesContent": ["export * from './components/index'\n\n// \u5BFC\u51FA Shopify Context \u76F8\u5173\u6A21\u5757\nexport { ShopifyProvider, useShopifyContext } from '@shopify/context/ShopifyProvider'\n\n// \u5BFC\u51FA Shopify \u6838\u5FC3\u6A21\u5757\nexport * from '@shopify/fetchers'\nexport * from '@shopify/hooks'\nexport * from '@shopify/queries'\nexport * from '@shopify/fragments'\n\n// \u5BFC\u51FA Shopify \u6838\u5FC3\u7C7B\u578B\uFF08\u6392\u9664\u6709\u51B2\u7A81\u7684 Brand \u7C7B\u578B\uFF09\nexport type {\n Cart,\n LineItem,\n Product,\n ProductVariant,\n ProductImage,\n ProductMedia,\n ProductPrice,\n VariantCoupon,\n Discount,\n} from '@shopify/types'\n"],
|
|
5
|
+
"mappings": "AAAA,WAAc,qBAGd,OAAS,mBAAAA,EAAiB,qBAAAC,MAAyB,mCAGnD,WAAc,oBACd,WAAc,iBACd,WAAc,mBACd,WAAc",
|
|
6
6
|
"names": ["ShopifyProvider", "useShopifyContext"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { ShopifyConfig, SiteConfig, ShopifyContextValue } from '
|
|
2
|
+
import { ShopifyConfig, SiteConfig, ShopifyContextValue } from '@shopify/types/config';
|
|
3
3
|
interface ShopifyProviderProps {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
shopifyConfig: ShopifyConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { GetProductsMetafieldQueryRoot } from '../fetchers/get-products-by-handles';
|
|
2
|
-
import { ShopifyHookOptions } from '
|
|
2
|
+
import { ShopifyHookOptions } from '@shopify/types/fetcher';
|
|
3
3
|
import { GetProductsByHandlesReq } from '../fetchers/get-products-by-handles';
|
|
4
4
|
export declare function useProductsByHandles({ handles, metafieldIdentifiers, }: ShopifyHookOptions<GetProductsByHandlesReq, GetProductsMetafieldQueryRoot>): import("swr").SWRResponse<import("src").Product[], any, any>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProductVariant, Product } from '../types/product';
|
|
2
|
-
import { Cart as ShopifyCart } from '
|
|
2
|
+
import { Cart as ShopifyCart } from '@shopify/gql';
|
|
3
3
|
import { Discount } from './common';
|
|
4
4
|
import { CustomerAddress } from './customer';
|
|
5
5
|
export type Attributes = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HasMetafieldsIdentifier } from '../gql';
|
|
2
2
|
import { PartialRecord } from './type-helper';
|
|
3
3
|
import { SWRMutationResponse } from 'swr/mutation';
|
|
4
|
-
import { ShopifyConfig } from '
|
|
4
|
+
import { ShopifyConfig } from '@shopify/types/config';
|
|
5
5
|
type RequestBasicParams = {
|
|
6
6
|
query?: string;
|
|
7
7
|
config: ShopifyConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ShopifyConfig, SiteConfig } from '
|
|
1
|
+
import { ShopifyConfig, SiteConfig } from '@shopify/types/config';
|
|
2
2
|
export declare const SHOPIFY_COOKIE_EXPIRE = 30;
|
|
3
3
|
export declare const SHOPIFY_CART_COOKIE_EXPIRE = 14;
|
|
4
4
|
export declare const getCookieName: (type: string, domain: string, locale: string) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CartLine as ShopifyCartLine } from '
|
|
2
|
-
import type { Cart, LineItem } from '
|
|
3
|
-
import type { Cart as ShopifyCart } from '
|
|
1
|
+
import { CartLine as ShopifyCartLine } from '@shopify/gql';
|
|
2
|
+
import type { Cart, LineItem } from '@shopify/types/cart';
|
|
3
|
+
import type { Cart as ShopifyCart } from '@shopify/gql';
|
|
4
4
|
export declare function normalizeCart(cart: ShopifyCart, metafieldNamespacePrefix?: string): Cart;
|
|
5
5
|
export declare function normalizeLineItem({ node: { id, merchandise: variant, quantity, discountAllocations, attributes, cost }, }: {
|
|
6
6
|
node: ShopifyCartLine;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useState } from 'react'
|
|
|
3
3
|
import { useAlpcMutation } from './useAlpcFetch'
|
|
4
4
|
import type { CreditLogResponse } from '../response'
|
|
5
5
|
import { useCreditsContext } from '../provider'
|
|
6
|
-
import { useShopifyContext } from '
|
|
6
|
+
import { useShopifyContext } from '@shopify/context/ShopifyProvider'
|
|
7
7
|
|
|
8
8
|
function useActivities({ page, pageSize, options = {} }: { page: number; pageSize: number; options?: any }) {
|
|
9
9
|
const { profile, isLoadingProfile } = useCreditsContext()
|
|
@@ -4,7 +4,7 @@ import { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'
|
|
|
4
4
|
import { useAlpcMutation } from './useAlpcFetch'
|
|
5
5
|
import type { RedeemLogResponse } from '../response'
|
|
6
6
|
import { useCreditsContext } from '../provider'
|
|
7
|
-
import { useShopifyContext } from '
|
|
7
|
+
import { useShopifyContext } from '@shopify/context/ShopifyProvider'
|
|
8
8
|
|
|
9
9
|
function useMyRewards({
|
|
10
10
|
page,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import useSWRMutation from 'swr/mutation'
|
|
2
2
|
import { useRedeemCoupon } from './useRedeemCoupon'
|
|
3
|
-
import { useCreateCartMutation } from '
|
|
4
|
-
import type { ProductVariant } from '
|
|
3
|
+
import { useCreateCartMutation } from '@shopify/hooks/useCreateCart'
|
|
4
|
+
import type { ProductVariant } from '@shopify/types/product'
|
|
5
5
|
import { useCreditsContext } from '../provider'
|
|
6
6
|
|
|
7
7
|
export const useRedeemAndBuy = () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ALPC_COUNTRY_MAP } from '../const'
|
|
2
2
|
import { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'
|
|
3
|
-
import { useShopifyContext } from '
|
|
3
|
+
import { useShopifyContext } from '@shopify/context/ShopifyProvider'
|
|
4
4
|
|
|
5
5
|
type RedeemCouponResponse = {
|
|
6
6
|
code: number
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ALPC_COUNTRY_MAP } from '../const'
|
|
2
2
|
import { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'
|
|
3
|
-
import { useShopifyContext } from '
|
|
3
|
+
import { useShopifyContext } from '@shopify/context/ShopifyProvider'
|
|
4
4
|
|
|
5
5
|
type RedeemProductResponse = {
|
|
6
6
|
code: number
|
|
@@ -4,7 +4,7 @@ import { useAlpcMutation } from './useAlpcFetch'
|
|
|
4
4
|
import { ALPC_COUNTRY_MAP } from '../const'
|
|
5
5
|
import { useCreditsContext } from '../provider'
|
|
6
6
|
import type { ConsumeCreditRuleResponse } from '../response'
|
|
7
|
-
import { useShopifyContext } from '
|
|
7
|
+
import { useShopifyContext } from '@shopify/context/ShopifyProvider'
|
|
8
8
|
|
|
9
9
|
function useRedeemableList() {
|
|
10
10
|
let locale = '' as string
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fetcher from '../../../../helpers/fetcher'
|
|
2
2
|
import useSWRMutation from 'swr/mutation'
|
|
3
3
|
import { useCreditsContext } from '../provider'
|
|
4
|
-
import { useShopifyContext } from '
|
|
4
|
+
import { useShopifyContext } from '@shopify/context/ShopifyProvider'
|
|
5
5
|
|
|
6
6
|
export function useSendEmailValidation() {
|
|
7
7
|
const { profile } = useCreditsContext()
|
|
@@ -4,7 +4,7 @@ import { TaskSubType } from '../const'
|
|
|
4
4
|
import useActivities from './useActivities'
|
|
5
5
|
import useSubscriptions from './useSubscriptions'
|
|
6
6
|
import { useCreditsContext } from '../provider'
|
|
7
|
-
import { useShopifyContext } from '
|
|
7
|
+
import { useShopifyContext } from '@shopify/context/ShopifyProvider'
|
|
8
8
|
|
|
9
9
|
export const useSubscribed = () => {
|
|
10
10
|
const { profile } = useCreditsContext()
|
|
@@ -5,9 +5,9 @@ import RedeemableItem from './RedeemableItem'
|
|
|
5
5
|
import useRedeemableList from '../context/hooks/useRedeemableList'
|
|
6
6
|
import { cn } from '../../../helpers'
|
|
7
7
|
import RulesModal from '../modal/rulesModal'
|
|
8
|
-
import { useProductsByHandles } from '
|
|
8
|
+
import { useProductsByHandles } from '@shopify/hooks/useProductsByHandles'
|
|
9
9
|
import { CreditsCashCopy, RedeemItem } from './type'
|
|
10
|
-
import { Product } from '
|
|
10
|
+
import { Product } from '@shopify/types'
|
|
11
11
|
|
|
12
12
|
export const CreditsCash = ({
|
|
13
13
|
copy,
|
|
@@ -7,7 +7,7 @@ import { Input } from './Input'
|
|
|
7
7
|
import { StateSelect } from './StateSelect'
|
|
8
8
|
import { ALPC_COUNTRY_MAP } from '../../context/const'
|
|
9
9
|
import { useCreditsContext } from '../../context/provider'
|
|
10
|
-
import { useShopifyContext } from '
|
|
10
|
+
import { useShopifyContext } from '@shopify/context/ShopifyProvider'
|
|
11
11
|
import { AddressFormProps } from './type'
|
|
12
12
|
|
|
13
13
|
export const AddressForm = ({ countries, countriesLoading, form, validate, errors, onChange }: AddressFormProps) => {
|
|
@@ -9,7 +9,7 @@ import { AlpcErrorCode } from '../context/const'
|
|
|
9
9
|
import { CreditsModalContainer } from '../modal/modalContainer'
|
|
10
10
|
import { numberFormat } from '../context/utils'
|
|
11
11
|
import type { RedeemableItem as RedeemableItemType } from '../type'
|
|
12
|
-
import { useShopifyContext } from '
|
|
12
|
+
import { useShopifyContext } from '@shopify/context/ShopifyProvider'
|
|
13
13
|
import { CreditsRedeemListCopy } from './type'
|
|
14
14
|
|
|
15
15
|
function RedeemCouponModal({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Button, Text } from '@anker-in/headless-ui'
|
|
2
2
|
import classNames from 'classnames'
|
|
3
3
|
import { AddressForm } from '../AddressForm'
|
|
4
|
-
import { useShopifyContext } from '
|
|
4
|
+
import { useShopifyContext } from '@shopify/context/ShopifyProvider'
|
|
5
5
|
import type { RedeemableItem as RedeemableItemType } from '../../type'
|
|
6
6
|
import { CreditsRedeemListCopy } from '../type'
|
|
7
7
|
import { ProductInfo } from './ProductInfo'
|
|
@@ -2,7 +2,7 @@ import { Picture } from '@anker-in/headless-ui'
|
|
|
2
2
|
import { formatPrice } from '../../context/utils'
|
|
3
3
|
import type { RedeemableItem as RedeemableItemType } from '../../type'
|
|
4
4
|
import { CreditsRedeemListCopy } from '../type'
|
|
5
|
-
import { useShopifyContext } from '
|
|
5
|
+
import { useShopifyContext } from '@shopify/context/ShopifyProvider'
|
|
6
6
|
|
|
7
7
|
type ProductInfoProps = {
|
|
8
8
|
item: RedeemableItemType
|
|
@@ -8,7 +8,7 @@ import { useRedeemProduct } from '../../context/hooks/useRedeemProduct'
|
|
|
8
8
|
import type { ModalContainerProps } from '../../modal/modalContainer'
|
|
9
9
|
import { CreditsModalContainer } from '../../modal/modalContainer'
|
|
10
10
|
import type { RedeemableItem as RedeemableItemType } from '../../type'
|
|
11
|
-
import { useShopifyContext } from '
|
|
11
|
+
import { useShopifyContext } from '@shopify/context/ShopifyProvider'
|
|
12
12
|
import { CreditsRedeemListCopy } from '../type'
|
|
13
13
|
import { Error } from './Error'
|
|
14
14
|
import { Success } from './Success'
|
|
@@ -7,7 +7,7 @@ import RedeemProductModal from './RedeemProductModal'
|
|
|
7
7
|
import { useCreditsContext } from '../context/provider'
|
|
8
8
|
import useRedeemableList from '../context/hooks/useRedeemableList'
|
|
9
9
|
import { AlpcConsumeType, AlpcErrorCode } from '../context/const'
|
|
10
|
-
import { useProductsByHandles } from '
|
|
10
|
+
import { useProductsByHandles } from '@shopify/hooks/useProductsByHandles'
|
|
11
11
|
import type { RedeemableItem as RedeemableItemType } from '../type'
|
|
12
12
|
import { RedeemableItem } from './RedeemableItem'
|
|
13
13
|
import RulesModal from '../modal/rulesModal'
|
|
@@ -5,7 +5,7 @@ import useReceiptUploaded from '../context/hooks/useReceiptUploaded'
|
|
|
5
5
|
import { useFirstPurchaseFinished } from '../context/hooks/useFirstPurchaseFinished'
|
|
6
6
|
import { useSubscribed } from '../context/hooks/useSubscribed'
|
|
7
7
|
import type { CreditsWaysToGetCreditsProps } from './type'
|
|
8
|
-
import { useShopifyContext } from '
|
|
8
|
+
import { useShopifyContext } from '@shopify/context/ShopifyProvider'
|
|
9
9
|
import { gaTrack } from '../../../helpers/track'
|
|
10
10
|
|
|
11
11
|
export const useActions = ({
|
package/src/index.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export * from './components/index'
|
|
2
2
|
|
|
3
3
|
// 导出 Shopify Context 相关模块
|
|
4
|
-
export { ShopifyProvider, useShopifyContext } from '
|
|
4
|
+
export { ShopifyProvider, useShopifyContext } from '@shopify/context/ShopifyProvider'
|
|
5
5
|
|
|
6
6
|
// 导出 Shopify 核心模块
|
|
7
|
-
export * from '
|
|
8
|
-
export * from '
|
|
9
|
-
export * from '
|
|
10
|
-
export * from '
|
|
7
|
+
export * from '@shopify/fetchers'
|
|
8
|
+
export * from '@shopify/hooks'
|
|
9
|
+
export * from '@shopify/queries'
|
|
10
|
+
export * from '@shopify/fragments'
|
|
11
11
|
|
|
12
12
|
// 导出 Shopify 核心类型(排除有冲突的 Brand 类型)
|
|
13
13
|
export type {
|
|
@@ -20,4 +20,4 @@ export type {
|
|
|
20
20
|
ProductPrice,
|
|
21
21
|
VariantCoupon,
|
|
22
22
|
Discount,
|
|
23
|
-
} from '
|
|
23
|
+
} from '@shopify/types'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { createContext, useContext, useMemo, ReactNode } from 'react'
|
|
2
2
|
|
|
3
|
-
import { ShopifyConfig, SiteConfig, ShopifyContextValue } from '
|
|
3
|
+
import { ShopifyConfig, SiteConfig, ShopifyContextValue } from '@shopify/types/config'
|
|
4
4
|
|
|
5
5
|
const ShopifyContext = createContext<ShopifyContextValue | null>(null)
|
|
6
6
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CartCreatePayload, CartInput } from '../gql'
|
|
2
2
|
import { createCartMutation } from '../mutations/create-cart'
|
|
3
3
|
import type { Cart } from '../types/cart'
|
|
4
|
-
import { ShopifyFetcher } from '
|
|
4
|
+
import { ShopifyFetcher } from '@shopify/types/fetcher'
|
|
5
5
|
import { fetchGraphqlApi } from '../utils/fetch-graphql-api'
|
|
6
6
|
import { normalizeCart } from '../utils/normalize'
|
|
7
|
-
import { ShopifyConfig } from '
|
|
7
|
+
import { ShopifyConfig } from '@shopify/types/config'
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Creates a cart using the Shopify API.
|
|
@@ -2,8 +2,8 @@ import { getProductsByHandlesQuery } from '../queries/get-product-by-handles'
|
|
|
2
2
|
import { fetchGraphqlApi } from '../utils/fetch-graphql-api'
|
|
3
3
|
import { constructMetafieldIdentifiersQueryParams } from '../utils/helper'
|
|
4
4
|
import { normalizeProduct } from '../utils/normalize/product'
|
|
5
|
-
import { Product as ShopifyProduct } from '
|
|
6
|
-
import { HasMetafieldQueryRoot, ShopifyFetcher, ShopifyFetcherVariables } from '
|
|
5
|
+
import { Product as ShopifyProduct } from '@shopify/gql'
|
|
6
|
+
import { HasMetafieldQueryRoot, ShopifyFetcher, ShopifyFetcherVariables } from '@shopify/types/fetcher'
|
|
7
7
|
import { Product } from '../types/product'
|
|
8
8
|
|
|
9
9
|
export type GetProductsByHandlesReq = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CartInput } from '../gql'
|
|
2
2
|
import { createCart } from '../fetchers/create-cart'
|
|
3
3
|
import useSWRMutation from 'swr/mutation'
|
|
4
|
-
import { useShopifyContext } from '
|
|
4
|
+
import { useShopifyContext } from '@shopify/context/ShopifyProvider'
|
|
5
5
|
import { setCartCookies } from '../utils/cookie'
|
|
6
6
|
|
|
7
7
|
export function useCreateCartMutation() {
|
|
@@ -2,8 +2,8 @@ import useSWR from 'swr'
|
|
|
2
2
|
|
|
3
3
|
import { getProductsByHandles, GetProductsMetafieldQueryRoot } from '../fetchers/get-products-by-handles'
|
|
4
4
|
|
|
5
|
-
import { useShopifyContext } from '
|
|
6
|
-
import { ShopifyHookOptions } from '
|
|
5
|
+
import { useShopifyContext } from '@shopify/context/ShopifyProvider'
|
|
6
|
+
import { ShopifyHookOptions } from '@shopify/types/fetcher'
|
|
7
7
|
import { GetProductsByHandlesReq } from '../fetchers/get-products-by-handles'
|
|
8
8
|
|
|
9
9
|
export function useProductsByHandles({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HasMetafieldsIdentifier } from '../gql'
|
|
2
2
|
import { PartialRecord } from './type-helper'
|
|
3
3
|
import { SWRMutationResponse } from 'swr/mutation'
|
|
4
|
-
import { ShopifyConfig } from '
|
|
4
|
+
import { ShopifyConfig } from '@shopify/types/config'
|
|
5
5
|
|
|
6
6
|
type RequestBasicParams = {
|
|
7
7
|
query?: string
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ProductVariant as ShopifyProductVariant, CartLine as ShopifyCartLine } from '
|
|
2
|
-
import type { Cart, LineItem } from '
|
|
3
|
-
import type { Cart as ShopifyCart } from '
|
|
1
|
+
import { ProductVariant as ShopifyProductVariant, CartLine as ShopifyCartLine } from '@shopify/gql'
|
|
2
|
+
import type { Cart, LineItem } from '@shopify/types/cart'
|
|
3
|
+
import type { Cart as ShopifyCart } from '@shopify/gql'
|
|
4
4
|
|
|
5
5
|
import { normalizeMetafields } from './metafield'
|
|
6
6
|
|