@anker-in/campaign-ui 0.5.2 → 0.5.3-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.
Files changed (65) hide show
  1. package/dist/cjs/components/credits/context/const.js +1 -1
  2. package/dist/cjs/components/credits/context/const.js.map +2 -2
  3. package/dist/cjs/components/credits/context/utils.d.ts +1 -1
  4. package/dist/cjs/components/credits/context/utils.js +1 -1
  5. package/dist/cjs/components/credits/context/utils.js.map +3 -3
  6. package/dist/cjs/components/credits/creditsCash/RedeemableItem.js +1 -1
  7. package/dist/cjs/components/credits/creditsCash/RedeemableItem.js.map +2 -2
  8. package/dist/cjs/components/credits/creditsInfoCard/index.js +1 -1
  9. package/dist/cjs/components/credits/creditsInfoCard/index.js.map +3 -3
  10. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
  11. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
  12. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js +1 -1
  13. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js.map +3 -3
  14. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js +1 -1
  15. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +3 -3
  16. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js +1 -1
  17. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js.map +3 -3
  18. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  19. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
  20. package/dist/cjs/components/credits/modal/ModalContainer.js +1 -1
  21. package/dist/cjs/components/credits/modal/ModalContainer.js.map +2 -2
  22. package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfileModal.d.ts +10 -0
  23. package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js +2 -0
  24. package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js.map +7 -0
  25. package/dist/esm/components/credits/context/const.js +1 -1
  26. package/dist/esm/components/credits/context/const.js.map +2 -2
  27. package/dist/esm/components/credits/context/utils.d.ts +1 -1
  28. package/dist/esm/components/credits/context/utils.js +1 -1
  29. package/dist/esm/components/credits/context/utils.js.map +3 -3
  30. package/dist/esm/components/credits/creditsCash/RedeemableItem.js +1 -1
  31. package/dist/esm/components/credits/creditsCash/RedeemableItem.js.map +2 -2
  32. package/dist/esm/components/credits/creditsInfoCard/index.js +1 -1
  33. package/dist/esm/components/credits/creditsInfoCard/index.js.map +3 -3
  34. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
  35. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
  36. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js +1 -1
  37. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js.map +3 -3
  38. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js +1 -1
  39. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +3 -3
  40. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js +1 -1
  41. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js.map +3 -3
  42. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  43. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
  44. package/dist/esm/components/credits/modal/ModalContainer.js +1 -1
  45. package/dist/esm/components/credits/modal/ModalContainer.js.map +2 -2
  46. package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfileModal.d.ts +10 -0
  47. package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js +2 -0
  48. package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js.map +7 -0
  49. package/package.json +1 -1
  50. package/src/components/credits/context/const.ts +3 -0
  51. package/src/components/credits/context/utils.ts +15 -2
  52. package/src/components/credits/creditsCash/RedeemableItem.tsx +1 -1
  53. package/src/components/credits/creditsInfoCard/index.tsx +3 -3
  54. package/src/components/credits/creditsRedeemList/CreditsRedeemList.tsx +2 -2
  55. package/src/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.tsx +3 -1
  56. package/src/components/credits/creditsRedeemList/RedeemProductModal/Init.tsx +3 -1
  57. package/src/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.tsx +3 -1
  58. package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +1 -1
  59. package/src/components/credits/modal/ModalContainer.tsx +1 -1
  60. package/dist/cjs/stories/CartCard.stories.d.ts +0 -33
  61. package/dist/cjs/stories/CartCard.stories.js +0 -21
  62. package/dist/cjs/stories/CartCard.stories.js.map +0 -7
  63. package/dist/esm/stories/CartCard.stories.d.ts +0 -33
  64. package/dist/esm/stories/CartCard.stories.js +0 -21
  65. package/dist/esm/stories/CartCard.stories.js.map +0 -7
@@ -1,2 +1,2 @@
1
- import{jsx as n,jsxs as d}from"react/jsx-runtime";import{classNames as o,useHeadlessContext as b}from"@anker-in/lib";import{useEffect as w,useState as N}from"react";import y from"react-modal";import{ROUNDED_BRANDS as M}from"../../../constants";const k=({isOpen:l,title:i,className:m="",overlayClassName:c="",scrollClassName:p="",onClose:s,onScrollEnd:a,children:x,useAnimation:r,animationClassName:C,titleClassName:f="",...v})=>{const[u,h]=N(!1);w(()=>{r&&requestAnimationFrame(()=>{h(l??!1)})},[l,r]);const{brand:L}=b(),g=M.includes(L);return d(y,{isOpen:l,overlayClassName:o("fixed inset-0 z-[999] flex items-center justify-center bg-black/70 leading-[1.2] md:items-end",c),className:o("min-md:max-h-[calc(100vh-96px)] relative flex min-h-[200px] flex-col overflow-hidden rounded-[16px] bg-white outline-none transition-all duration-300 md:h-[88.27vh] md:w-full md:rounded-b-none",!g&&"rounded-none",u?"":C,m),onRequestClose:s,...v,children:[d("div",{className:o("flex w-full shrink-0 items-center justify-between",i?"min-l:px-[32px] h-[70px] border-b border-[#e2e2e2] px-[24px]":"h-[48px] px-[16px]",f),children:[n("div",{className:"text-[18px] font-bold",children:i}),n("div",{className:"size-[22px] cursor-pointer",onClick:s,onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),s?.())},role:"button",tabIndex:0,children:n("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:n("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.8525 5.31015C16.4558 4.91337 15.8125 4.91338 15.4157 5.31015L11.1268 9.5991L6.83815 5.31049C6.44138 4.91372 5.79808 4.91372 5.40131 5.31049C5.00454 5.70726 5.00455 6.35055 5.40131 6.74732L9.68993 11.0359L5.40105 15.3248C5.00428 15.7216 5.00428 16.3649 5.40105 16.7616C5.79782 17.1584 6.44111 17.1584 6.83788 16.7616L11.1268 12.4728L15.416 16.762C15.8128 17.1588 16.456 17.1588 16.8528 16.762C17.2496 16.3652 17.2496 15.7219 16.8528 15.3252L12.5636 11.0359L16.8525 6.74698C17.2493 6.35021 17.2493 5.70692 16.8525 5.31015ZM16.921 6.02856C16.921 6.22992 16.8441 6.43127 16.6905 6.5849L14.465 8.8104L12.2395 11.0359L12.2395 11.0359L16.6905 6.58493C16.8441 6.43129 16.921 6.22993 16.921 6.02856ZM5.34966 6.19087C5.37992 6.3354 5.45115 6.47307 5.56336 6.58528L10.014 11.0359L10.014 11.0359L5.56336 6.58524C5.45116 6.47304 5.37992 6.33539 5.34966 6.19087ZM5.35087 16.2121C5.38193 16.3541 5.45267 16.4891 5.56309 16.5996C5.87037 16.9068 6.36856 16.9068 6.67583 16.5996L11.1268 12.1486L15.578 16.5999C15.8853 16.9072 16.3835 16.9072 16.6908 16.5999C16.8498 16.4409 16.9265 16.2307 16.9209 16.0223C16.9265 16.2307 16.8498 16.4409 16.6908 16.5999C16.3835 16.9072 15.8853 16.9072 15.578 16.5999L11.1268 12.1487L6.67583 16.5996C6.36856 16.9069 5.87037 16.9069 5.56309 16.5996C5.45267 16.4892 5.38192 16.3541 5.35087 16.2121Z",fill:"#333333"})})})]}),n("div",{className:o("my-[32px] flex-1 overflow-auto overscroll-contain px-[24px] md:mb-[48px]",!i&&"mt-0","min-l:px-[32px]",p),onScroll:e=>{const t=e.target;t.scrollHeight<=t.clientHeight||t.scrollTop+t.clientHeight>=t.scrollHeight-50&&a&&a(e)},children:x})]})};export{k as CreditsModalContainer};
1
+ import{jsx as n,jsxs as d}from"react/jsx-runtime";import{classNames as o,useHeadlessContext as b}from"@anker-in/lib";import{useEffect as w,useState as N}from"react";import y from"react-modal";import{ROUNDED_BRANDS as M}from"../../../constants";const k=({isOpen:l,title:i,className:m="",overlayClassName:c="",scrollClassName:p="",onClose:s,onScrollEnd:a,children:x,useAnimation:r,animationClassName:f,titleClassName:C="",...v})=>{const[u,h]=N(!1);w(()=>{r&&requestAnimationFrame(()=>{h(l??!1)})},[l,r]);const{brand:L}=b(),g=M.includes(L);return d(y,{isOpen:l,overlayClassName:o("fixed inset-0 z-[999] flex items-center justify-center bg-black/70 leading-[1.2] md:items-end",c),className:o("min-md:max-h-[calc(100vh-96px)] relative flex min-h-[200px] flex-col overflow-hidden rounded-[16px] bg-white outline-none transition-all duration-300 md:h-[88.27vh] md:w-full md:rounded-b-none",!g&&"rounded-none",u?"":f,m),onRequestClose:s,...v,children:[d("div",{className:o("flex w-full shrink-0 items-center justify-between",i?"min-l:px-[32px] h-[70px] border-b border-[#e2e2e2] px-[24px]":"h-[48px] px-[16px]",C),children:[n("div",{className:"text-[18px] font-bold",children:i}),n("div",{className:"size-[22px] cursor-pointer",onClick:s,onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),s?.())},role:"button",tabIndex:0,children:n("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:n("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.8525 5.31015C16.4558 4.91337 15.8125 4.91338 15.4157 5.31015L11.1268 9.5991L6.83815 5.31049C6.44138 4.91372 5.79808 4.91372 5.40131 5.31049C5.00454 5.70726 5.00455 6.35055 5.40131 6.74732L9.68993 11.0359L5.40105 15.3248C5.00428 15.7216 5.00428 16.3649 5.40105 16.7616C5.79782 17.1584 6.44111 17.1584 6.83788 16.7616L11.1268 12.4728L15.416 16.762C15.8128 17.1588 16.456 17.1588 16.8528 16.762C17.2496 16.3652 17.2496 15.7219 16.8528 15.3252L12.5636 11.0359L16.8525 6.74698C17.2493 6.35021 17.2493 5.70692 16.8525 5.31015ZM16.921 6.02856C16.921 6.22992 16.8441 6.43127 16.6905 6.5849L14.465 8.8104L12.2395 11.0359L12.2395 11.0359L16.6905 6.58493C16.8441 6.43129 16.921 6.22993 16.921 6.02856ZM5.34966 6.19087C5.37992 6.3354 5.45115 6.47307 5.56336 6.58528L10.014 11.0359L10.014 11.0359L5.56336 6.58524C5.45116 6.47304 5.37992 6.33539 5.34966 6.19087ZM5.35087 16.2121C5.38193 16.3541 5.45267 16.4891 5.56309 16.5996C5.87037 16.9068 6.36856 16.9068 6.67583 16.5996L11.1268 12.1486L15.578 16.5999C15.8853 16.9072 16.3835 16.9072 16.6908 16.5999C16.8498 16.4409 16.9265 16.2307 16.9209 16.0223C16.9265 16.2307 16.8498 16.4409 16.6908 16.5999C16.3835 16.9072 15.8853 16.9072 15.578 16.5999L11.1268 12.1487L6.67583 16.5996C6.36856 16.9069 5.87037 16.9069 5.56309 16.5996C5.45267 16.4892 5.38192 16.3541 5.35087 16.2121Z",fill:"#333333"})})})]}),n("div",{className:o("my-[32px] flex-1 flex flex-col overflow-auto overscroll-contain px-[24px] md:mb-[48px]",!i&&"mt-0","min-l:px-[32px]",p),onScroll:e=>{const t=e.target;t.scrollHeight<=t.clientHeight||t.scrollTop+t.clientHeight>=t.scrollHeight-50&&a&&a(e)},children:x})]})};export{k as CreditsModalContainer};
2
2
  //# sourceMappingURL=ModalContainer.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/modal/ModalContainer.tsx"],
4
- "sourcesContent": ["import { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useEffect, useState, type UIEvent } from 'react'\nimport ReactModal from 'react-modal'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nexport type ModalContainerProps = {\n overlayClassName?: string\n className?: string\n scrollClassName?: string\n title?: string\n titleClassName?: string\n useAnimation?: boolean // \u4F7F\u7528\u52A8\u753B\u5C55\u793A\n animationClassName?: string // \u52A8\u753B\u5C55\u793A\u63A7\u5236\u7684classname\n isOpen: boolean\n children?: any\n onClose: () => void\n onScrollEnd?: (event: UIEvent<HTMLDivElement>) => void\n}\n\nexport const CreditsModalContainer = ({\n isOpen,\n title,\n className = '',\n overlayClassName = '',\n scrollClassName = '',\n onClose,\n onScrollEnd,\n children,\n useAnimation,\n animationClassName,\n titleClassName = '',\n ...props\n}: ModalContainerProps): React.ReactElement => {\n const [animationShow, setAnimationShow] = useState(false)\n\n useEffect(() => {\n if (!useAnimation) {\n return\n }\n requestAnimationFrame(() => {\n setAnimationShow(isOpen ?? false)\n })\n }, [isOpen, useAnimation])\n\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n return (\n <ReactModal\n isOpen={isOpen}\n overlayClassName={cn(\n 'fixed inset-0 z-[999] flex items-center justify-center bg-black/70 leading-[1.2] md:items-end',\n overlayClassName\n )}\n className={cn(\n 'min-md:max-h-[calc(100vh-96px)] relative flex min-h-[200px] flex-col overflow-hidden rounded-[16px] bg-white outline-none transition-all duration-300 md:h-[88.27vh] md:w-full md:rounded-b-none',\n !rounded && 'rounded-none',\n animationShow ? '' : animationClassName,\n className\n )}\n onRequestClose={onClose}\n {...props}\n >\n <div\n className={cn(\n 'flex w-full shrink-0 items-center justify-between',\n title ? 'min-l:px-[32px] h-[70px] border-b border-[#e2e2e2] px-[24px]' : 'h-[48px] px-[16px]',\n titleClassName\n )}\n >\n <div className=\"text-[18px] font-bold\">{title}</div>\n <div\n className=\"size-[22px] cursor-pointer\"\n onClick={onClose}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n onClose?.()\n }\n }}\n role=\"button\"\n tabIndex={0}\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"22\" viewBox=\"0 0 22 22\" fill=\"none\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M16.8525 5.31015C16.4558 4.91337 15.8125 4.91338 15.4157 5.31015L11.1268 9.5991L6.83815 5.31049C6.44138 4.91372 5.79808 4.91372 5.40131 5.31049C5.00454 5.70726 5.00455 6.35055 5.40131 6.74732L9.68993 11.0359L5.40105 15.3248C5.00428 15.7216 5.00428 16.3649 5.40105 16.7616C5.79782 17.1584 6.44111 17.1584 6.83788 16.7616L11.1268 12.4728L15.416 16.762C15.8128 17.1588 16.456 17.1588 16.8528 16.762C17.2496 16.3652 17.2496 15.7219 16.8528 15.3252L12.5636 11.0359L16.8525 6.74698C17.2493 6.35021 17.2493 5.70692 16.8525 5.31015ZM16.921 6.02856C16.921 6.22992 16.8441 6.43127 16.6905 6.5849L14.465 8.8104L12.2395 11.0359L12.2395 11.0359L16.6905 6.58493C16.8441 6.43129 16.921 6.22993 16.921 6.02856ZM5.34966 6.19087C5.37992 6.3354 5.45115 6.47307 5.56336 6.58528L10.014 11.0359L10.014 11.0359L5.56336 6.58524C5.45116 6.47304 5.37992 6.33539 5.34966 6.19087ZM5.35087 16.2121C5.38193 16.3541 5.45267 16.4891 5.56309 16.5996C5.87037 16.9068 6.36856 16.9068 6.67583 16.5996L11.1268 12.1486L15.578 16.5999C15.8853 16.9072 16.3835 16.9072 16.6908 16.5999C16.8498 16.4409 16.9265 16.2307 16.9209 16.0223C16.9265 16.2307 16.8498 16.4409 16.6908 16.5999C16.3835 16.9072 15.8853 16.9072 15.578 16.5999L11.1268 12.1487L6.67583 16.5996C6.36856 16.9069 5.87037 16.9069 5.56309 16.5996C5.45267 16.4892 5.38192 16.3541 5.35087 16.2121Z\"\n fill=\"#333333\"\n />\n </svg>\n </div>\n </div>\n <div\n className={cn(\n 'my-[32px] flex-1 overflow-auto overscroll-contain px-[24px] md:mb-[48px]',\n !title && 'mt-0',\n 'min-l:px-[32px]',\n scrollClassName\n )}\n onScroll={event => {\n const targetElement = event.target as HTMLDivElement\n\n if (targetElement.scrollHeight <= targetElement.clientHeight) {\n return\n }\n\n if (targetElement.scrollTop + targetElement.clientHeight >= targetElement.scrollHeight - 50) {\n onScrollEnd && onScrollEnd(event)\n }\n }}\n >\n {children}\n </div>\n </ReactModal>\n )\n}\n"],
5
- "mappings": "AA+DM,OAOE,OAAAA,EAPF,QAAAC,MAAA,oBA/DN,OAAS,cAAcC,EAAI,sBAAAC,MAA0B,gBACrD,OAAS,aAAAC,EAAW,YAAAC,MAA8B,QAClD,OAAOC,MAAgB,cACvB,OAAS,kBAAAC,MAAsB,qBAgBxB,MAAMC,EAAwB,CAAC,CACpC,OAAAC,EACA,MAAAC,EACA,UAAAC,EAAY,GACZ,iBAAAC,EAAmB,GACnB,gBAAAC,EAAkB,GAClB,QAAAC,EACA,YAAAC,EACA,SAAAC,EACA,aAAAC,EACA,mBAAAC,EACA,eAAAC,EAAiB,GACjB,GAAGC,CACL,IAA+C,CAC7C,KAAM,CAACC,EAAeC,CAAgB,EAAIjB,EAAS,EAAK,EAExDD,EAAU,IAAM,CACTa,GAGL,sBAAsB,IAAM,CAC1BK,EAAiBb,GAAU,EAAK,CAClC,CAAC,CACH,EAAG,CAACA,EAAQQ,CAAY,CAAC,EAEzB,KAAM,CAAE,MAAAM,CAAM,EAAIpB,EAAmB,EAC/BqB,EAAUjB,EAAe,SAASgB,CAAK,EAE7C,OACEtB,EAACK,EAAA,CACC,OAAQG,EACR,iBAAkBP,EAChB,gGACAU,CACF,EACA,UAAWV,EACT,mMACA,CAACsB,GAAW,eACZH,EAAgB,GAAKH,EACrBP,CACF,EACA,eAAgBG,EACf,GAAGM,EAEJ,UAAAnB,EAAC,OACC,UAAWC,EACT,oDACAQ,EAAQ,+DAAiE,qBACzES,CACF,EAEA,UAAAnB,EAAC,OAAI,UAAU,wBAAyB,SAAAU,EAAM,EAC9CV,EAAC,OACC,UAAU,6BACV,QAASc,EACT,UAAW,GAAK,EACV,EAAE,MAAQ,SAAW,EAAE,MAAQ,OACjC,EAAE,eAAe,EACjBA,IAAU,EAEd,EACA,KAAK,SACL,SAAU,EAEV,SAAAd,EAAC,OAAI,MAAM,6BAA6B,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OACtF,SAAAA,EAAC,QACC,SAAS,UACT,SAAS,UACT,EAAE,syCACF,KAAK,UACP,EACF,EACF,GACF,EACAA,EAAC,OACC,UAAWE,EACT,2EACA,CAACQ,GAAS,OACV,kBACAG,CACF,EACA,SAAUY,GAAS,CACjB,MAAMC,EAAgBD,EAAM,OAExBC,EAAc,cAAgBA,EAAc,cAI5CA,EAAc,UAAYA,EAAc,cAAgBA,EAAc,aAAe,IACvFX,GAAeA,EAAYU,CAAK,CAEpC,EAEC,SAAAT,EACH,GACF,CAEJ",
4
+ "sourcesContent": ["import { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useEffect, useState, type UIEvent } from 'react'\nimport ReactModal from 'react-modal'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nexport type ModalContainerProps = {\n overlayClassName?: string\n className?: string\n scrollClassName?: string\n title?: string\n titleClassName?: string\n useAnimation?: boolean // \u4F7F\u7528\u52A8\u753B\u5C55\u793A\n animationClassName?: string // \u52A8\u753B\u5C55\u793A\u63A7\u5236\u7684classname\n isOpen: boolean\n children?: any\n onClose: () => void\n onScrollEnd?: (event: UIEvent<HTMLDivElement>) => void\n}\n\nexport const CreditsModalContainer = ({\n isOpen,\n title,\n className = '',\n overlayClassName = '',\n scrollClassName = '',\n onClose,\n onScrollEnd,\n children,\n useAnimation,\n animationClassName,\n titleClassName = '',\n ...props\n}: ModalContainerProps): React.ReactElement => {\n const [animationShow, setAnimationShow] = useState(false)\n\n useEffect(() => {\n if (!useAnimation) {\n return\n }\n requestAnimationFrame(() => {\n setAnimationShow(isOpen ?? false)\n })\n }, [isOpen, useAnimation])\n\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n return (\n <ReactModal\n isOpen={isOpen}\n overlayClassName={cn(\n 'fixed inset-0 z-[999] flex items-center justify-center bg-black/70 leading-[1.2] md:items-end',\n overlayClassName\n )}\n className={cn(\n 'min-md:max-h-[calc(100vh-96px)] relative flex min-h-[200px] flex-col overflow-hidden rounded-[16px] bg-white outline-none transition-all duration-300 md:h-[88.27vh] md:w-full md:rounded-b-none',\n !rounded && 'rounded-none',\n animationShow ? '' : animationClassName,\n className\n )}\n onRequestClose={onClose}\n {...props}\n >\n <div\n className={cn(\n 'flex w-full shrink-0 items-center justify-between',\n title ? 'min-l:px-[32px] h-[70px] border-b border-[#e2e2e2] px-[24px]' : 'h-[48px] px-[16px]',\n titleClassName\n )}\n >\n <div className=\"text-[18px] font-bold\">{title}</div>\n <div\n className=\"size-[22px] cursor-pointer\"\n onClick={onClose}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n onClose?.()\n }\n }}\n role=\"button\"\n tabIndex={0}\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"22\" viewBox=\"0 0 22 22\" fill=\"none\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M16.8525 5.31015C16.4558 4.91337 15.8125 4.91338 15.4157 5.31015L11.1268 9.5991L6.83815 5.31049C6.44138 4.91372 5.79808 4.91372 5.40131 5.31049C5.00454 5.70726 5.00455 6.35055 5.40131 6.74732L9.68993 11.0359L5.40105 15.3248C5.00428 15.7216 5.00428 16.3649 5.40105 16.7616C5.79782 17.1584 6.44111 17.1584 6.83788 16.7616L11.1268 12.4728L15.416 16.762C15.8128 17.1588 16.456 17.1588 16.8528 16.762C17.2496 16.3652 17.2496 15.7219 16.8528 15.3252L12.5636 11.0359L16.8525 6.74698C17.2493 6.35021 17.2493 5.70692 16.8525 5.31015ZM16.921 6.02856C16.921 6.22992 16.8441 6.43127 16.6905 6.5849L14.465 8.8104L12.2395 11.0359L12.2395 11.0359L16.6905 6.58493C16.8441 6.43129 16.921 6.22993 16.921 6.02856ZM5.34966 6.19087C5.37992 6.3354 5.45115 6.47307 5.56336 6.58528L10.014 11.0359L10.014 11.0359L5.56336 6.58524C5.45116 6.47304 5.37992 6.33539 5.34966 6.19087ZM5.35087 16.2121C5.38193 16.3541 5.45267 16.4891 5.56309 16.5996C5.87037 16.9068 6.36856 16.9068 6.67583 16.5996L11.1268 12.1486L15.578 16.5999C15.8853 16.9072 16.3835 16.9072 16.6908 16.5999C16.8498 16.4409 16.9265 16.2307 16.9209 16.0223C16.9265 16.2307 16.8498 16.4409 16.6908 16.5999C16.3835 16.9072 15.8853 16.9072 15.578 16.5999L11.1268 12.1487L6.67583 16.5996C6.36856 16.9069 5.87037 16.9069 5.56309 16.5996C5.45267 16.4892 5.38192 16.3541 5.35087 16.2121Z\"\n fill=\"#333333\"\n />\n </svg>\n </div>\n </div>\n <div\n className={cn(\n 'my-[32px] flex-1 flex flex-col overflow-auto overscroll-contain px-[24px] md:mb-[48px]',\n !title && 'mt-0',\n 'min-l:px-[32px]',\n scrollClassName\n )}\n onScroll={event => {\n const targetElement = event.target as HTMLDivElement\n\n if (targetElement.scrollHeight <= targetElement.clientHeight) {\n return\n }\n\n if (targetElement.scrollTop + targetElement.clientHeight >= targetElement.scrollHeight - 50) {\n onScrollEnd && onScrollEnd(event)\n }\n }}\n >\n {children}\n </div>\n </ReactModal>\n )\n}\n"],
5
+ "mappings": "AA+DM,OAOE,OAAAA,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P,EACF,EACF,GACF,EACAA,EAAC,OACC,UAAWE,EACT,yFACA,CAACQ,GAAS,OACV,kBACAG,CACF,EACA,SAAUY,GAAS,CACjB,MAAMC,EAAgBD,EAAM,OAExBC,EAAc,cAAgBA,EAAc,cAI5CA,EAAc,UAAYA,EAAc,cAAgBA,EAAc,aAAe,IACvFX,GAAeA,EAAYU,CAAK,CAEpC,EAEC,SAAAT,EACH,GACF,CAEJ",
6
6
  "names": ["jsx", "jsxs", "cn", "useHeadlessContext", "useEffect", "useState", "ReactModal", "ROUNDED_BRANDS", "CreditsModalContainer", "isOpen", "title", "className", "overlayClassName", "scrollClassName", "onClose", "onScrollEnd", "children", "useAnimation", "animationClassName", "titleClassName", "props", "animationShow", "setAnimationShow", "brand", "rounded", "event", "targetElement"]
7
7
  }
@@ -0,0 +1,10 @@
1
+ import type { CompleteProfileCopy } from '../../type';
2
+ type Props = {
3
+ isOpen: boolean;
4
+ onClose: () => void;
5
+ onSuccess?: () => void;
6
+ copy: CompleteProfileCopy;
7
+ shopifyStoreDomain?: string;
8
+ };
9
+ export declare function CompleteProfileModal({ isOpen, onClose, onSuccess, copy, shopifyStoreDomain }: Props): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,2 @@
1
+ import{jsx as e,jsxs as s}from"react/jsx-runtime";import{useCallback as M,useEffect as q,useState as o}from"react";import{Button as D,Text as v}from"@anker-in/headless-ui";import{classNames as L}from"@anker-in/lib";import{CreditsModalContainer as A}from"../../../credits/modal/ModalContainer";import{useUpdateProfile as I}from"./hooks/useUpdateProfile";import T from"../../../credits/context/hooks/useCountries";import{useMemberPopupContext as U}from"../../context/provider";function W({isOpen:S,onClose:i,onSuccess:h,copy:a,shopifyStoreDomain:z=""}){const{profile:l,fetchCreditInfo:C,alpcConfig:g}=U(),{locale:F}=g,[r,k]=o(""),[d,P]=o(""),[p,w]=o(""),[x,y]=o(""),[n,f]=o(""),[u,b]=o(""),[c,N]=o(""),{updateProfile:_,isLoading:E}=I({locale:F,appName:g.appName}),{countries:m}=T({shopifyStoreDomain:z});q(()=>{l&&(k(l.first_name??""),P(l.last_name??""),w(l.phone_number??""),y(l.dob??""),f(l.country?.id??""))},[l]),q(()=>{m.length>0&&!n&&f(m[0].id)},[m]);const B=M(()=>{let t=!1;return r.trim()?b(""):(b(a.required),t=!0),d.trim()?N(""):(N(a.required),t=!0),t},[r,d,a.required]),O=M(async()=>{if(B())return;await _({first_name:r.trim(),last_name:d.trim(),phone_number:p,country:n,dob:x})&&(C(l?.user_id),h?.(),i())},[B,_,r,d,p,n,x,C,l,h,i]);return e(A,{isOpen:S,onClose:i,title:a.title,titleClassName:"!h-auto !border-b-0 !pb-0",className:"w-[540px] md:h-auto",useAnimation:!0,animationClassName:"md:translate-y-[100vh]",children:s("div",{className:"flex flex-col gap-[20px]",children:[a.subtitle&&e(v,{className:"text-[14px] text-[#1d1d1f]",html:a.subtitle}),s("div",{children:[e("label",{className:"block text-[14px] font-semibold text-[#1d1d1f]",children:a.email}),e("input",{className:"mt-[8px] h-[46px] w-full rounded-[4px] border border-[#d8d8d8] bg-[#f5f5f5] px-[12px] text-[14px] text-[#999]",value:l?.email??"",disabled:!0})]}),s("div",{children:[s("label",{className:"block text-[14px] font-semibold text-[#1d1d1f]",children:[a.firstName," ",e("span",{className:"text-[#f84d4f]",children:"*"})]}),e("input",{className:L("mt-[8px] h-[46px] w-full rounded-[4px] border px-[12px] text-[14px] outline-none",u?"border-[#f84d4f]":"border-[#d8d8d8]"),value:r,onChange:t=>{k(t.target.value),b("")}}),u&&e(v,{className:"mt-[4px] text-[12px] text-[#f84d4f]",html:u})]}),s("div",{children:[s("label",{className:"block text-[14px] font-semibold text-[#1d1d1f]",children:[a.lastName," ",e("span",{className:"text-[#f84d4f]",children:"*"})]}),e("input",{className:L("mt-[8px] h-[46px] w-full rounded-[4px] border px-[12px] text-[14px] outline-none",c?"border-[#f84d4f]":"border-[#d8d8d8]"),value:d,onChange:t=>{P(t.target.value),N("")}}),c&&e(v,{className:"mt-[4px] text-[12px] text-[#f84d4f]",html:c})]}),s("div",{children:[e("label",{className:"block text-[14px] font-semibold text-[#1d1d1f]",children:a.birthday}),e("input",{className:"mt-[8px] h-[46px] w-full rounded-[4px] border border-[#d8d8d8] px-[12px] text-[14px] outline-none",type:"date",value:x,onChange:t=>y(t.target.value)})]}),s("div",{children:[e("label",{className:"block text-[14px] font-semibold text-[#1d1d1f]",children:a.phone}),e("input",{className:"mt-[8px] h-[46px] w-full rounded-[4px] border border-[#d8d8d8] px-[12px] text-[14px] outline-none",value:p,onChange:t=>w(t.target.value)})]}),s("div",{children:[e("label",{className:"block text-[14px] font-semibold text-[#1d1d1f]",children:a.country}),e("select",{className:"mt-[8px] h-[46px] w-full rounded-[4px] border border-[#d8d8d8] px-[12px] text-[14px] outline-none",value:n,onChange:t=>f(t.target.value),children:m.map(t=>e("option",{value:t.id,children:t.name},t.id))})]}),s("div",{className:"flex gap-[12px]",children:[e(D,{variant:"secondary",size:"lg",className:"flex-1",onClick:i,disabled:E,children:a.cancel}),e(D,{variant:"primary",size:"lg",className:"flex-1",loading:E,onClick:O,children:a.save})]})]})})}export{W as CompleteProfileModal};
2
+ //# sourceMappingURL=CompleteProfileModal.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/memberPopup/panels/EarnCredits/CompleteProfileModal.tsx"],
4
+ "sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\nimport { Button, Text } from '@anker-in/headless-ui'\nimport { classNames as cn } from '@anker-in/lib'\nimport { CreditsModalContainer } from '../../../credits/modal/ModalContainer'\nimport type { CompleteProfileCopy } from '../../type'\nimport { useUpdateProfile } from './hooks/useUpdateProfile'\nimport useCountries from '../../../credits/context/hooks/useCountries'\nimport { useMemberPopupContext } from '../../context/provider'\n\ntype Props = {\n isOpen: boolean\n onClose: () => void\n onSuccess?: () => void\n copy: CompleteProfileCopy\n shopifyStoreDomain?: string\n}\n\nexport function CompleteProfileModal({ isOpen, onClose, onSuccess, copy, shopifyStoreDomain = '' }: Props) {\n const { profile, fetchCreditInfo, alpcConfig } = useMemberPopupContext()\n const { locale } = alpcConfig\n\n const [firstName, setFirstName] = useState('')\n const [lastName, setLastName] = useState('')\n const [phone, setPhone] = useState('')\n const [birthDay, setBirthDay] = useState('')\n const [country, setCountry] = useState('')\n const [firstNameError, setFirstNameError] = useState('')\n const [lastNameError, setLastNameError] = useState('')\n\n const { updateProfile, isLoading } = useUpdateProfile({ locale, appName: alpcConfig.appName })\n const { countries } = useCountries({ shopifyStoreDomain })\n\n useEffect(() => {\n if (profile) {\n setFirstName(profile.first_name ?? '')\n setLastName(profile.last_name ?? '')\n setPhone(profile.phone_number ?? '')\n setBirthDay(profile.dob ?? '')\n setCountry(profile.country?.id ?? '')\n }\n }, [profile])\n\n useEffect(() => {\n if (countries.length > 0 && !country) {\n setCountry(countries[0].id)\n }\n }, [countries])\n\n const validate = useCallback(() => {\n let hasError = false\n if (!firstName.trim()) {\n setFirstNameError(copy.required)\n hasError = true\n } else {\n setFirstNameError('')\n }\n if (!lastName.trim()) {\n setLastNameError(copy.required)\n hasError = true\n } else {\n setLastNameError('')\n }\n return hasError\n }, [firstName, lastName, copy.required])\n\n const handleSubmit = useCallback(async () => {\n if (validate()) return\n const success = await updateProfile({\n first_name: firstName.trim(),\n last_name: lastName.trim(),\n phone_number: phone,\n country,\n dob: birthDay,\n })\n if (success) {\n fetchCreditInfo(profile?.user_id)\n onSuccess?.()\n onClose()\n }\n }, [validate, updateProfile, firstName, lastName, phone, country, birthDay, fetchCreditInfo, profile, onSuccess, onClose])\n\n return (\n <CreditsModalContainer\n isOpen={isOpen}\n onClose={onClose}\n title={copy.title}\n titleClassName=\"!h-auto !border-b-0 !pb-0\"\n className=\"w-[540px] md:h-auto\"\n useAnimation\n animationClassName=\"md:translate-y-[100vh]\"\n >\n <div className=\"flex flex-col gap-[20px]\">\n {copy.subtitle && (\n <Text className=\"text-[14px] text-[#1d1d1f]\" html={copy.subtitle} />\n )}\n\n <div>\n <label className=\"block text-[14px] font-semibold text-[#1d1d1f]\">{copy.email}</label>\n <input\n className=\"mt-[8px] h-[46px] w-full rounded-[4px] border border-[#d8d8d8] bg-[#f5f5f5] px-[12px] text-[14px] text-[#999]\"\n value={profile?.email ?? ''}\n disabled\n />\n </div>\n\n <div>\n <label className=\"block text-[14px] font-semibold text-[#1d1d1f]\">\n {copy.firstName} <span className=\"text-[#f84d4f]\">*</span>\n </label>\n <input\n className={cn(\n 'mt-[8px] h-[46px] w-full rounded-[4px] border px-[12px] text-[14px] outline-none',\n firstNameError ? 'border-[#f84d4f]' : 'border-[#d8d8d8]'\n )}\n value={firstName}\n onChange={e => { setFirstName(e.target.value); setFirstNameError('') }}\n />\n {firstNameError && <Text className=\"mt-[4px] text-[12px] text-[#f84d4f]\" html={firstNameError} />}\n </div>\n\n <div>\n <label className=\"block text-[14px] font-semibold text-[#1d1d1f]\">\n {copy.lastName} <span className=\"text-[#f84d4f]\">*</span>\n </label>\n <input\n className={cn(\n 'mt-[8px] h-[46px] w-full rounded-[4px] border px-[12px] text-[14px] outline-none',\n lastNameError ? 'border-[#f84d4f]' : 'border-[#d8d8d8]'\n )}\n value={lastName}\n onChange={e => { setLastName(e.target.value); setLastNameError('') }}\n />\n {lastNameError && <Text className=\"mt-[4px] text-[12px] text-[#f84d4f]\" html={lastNameError} />}\n </div>\n\n <div>\n <label className=\"block text-[14px] font-semibold text-[#1d1d1f]\">{copy.birthday}</label>\n <input\n className=\"mt-[8px] h-[46px] w-full rounded-[4px] border border-[#d8d8d8] px-[12px] text-[14px] outline-none\"\n type=\"date\"\n value={birthDay}\n onChange={e => setBirthDay(e.target.value)}\n />\n </div>\n\n <div>\n <label className=\"block text-[14px] font-semibold text-[#1d1d1f]\">{copy.phone}</label>\n <input\n className=\"mt-[8px] h-[46px] w-full rounded-[4px] border border-[#d8d8d8] px-[12px] text-[14px] outline-none\"\n value={phone}\n onChange={e => setPhone(e.target.value)}\n />\n </div>\n\n <div>\n <label className=\"block text-[14px] font-semibold text-[#1d1d1f]\">{copy.country}</label>\n <select\n className=\"mt-[8px] h-[46px] w-full rounded-[4px] border border-[#d8d8d8] px-[12px] text-[14px] outline-none\"\n value={country}\n onChange={e => setCountry(e.target.value)}\n >\n {countries.map((c: { id: string; name: string }) => (\n <option key={c.id} value={c.id}>{c.name}</option>\n ))}\n </select>\n </div>\n\n <div className=\"flex gap-[12px]\">\n <Button\n variant=\"secondary\"\n size=\"lg\"\n className=\"flex-1\"\n onClick={onClose}\n disabled={isLoading}\n >\n {copy.cancel}\n </Button>\n <Button\n variant=\"primary\"\n size=\"lg\"\n className=\"flex-1\"\n loading={isLoading}\n onClick={handleSubmit}\n >\n {copy.save}\n </Button>\n </div>\n </div>\n </CreditsModalContainer>\n )\n}\n"],
5
+ "mappings": "AA6FU,cAAAA,EAGF,QAAAC,MAHE,oBA7FV,OAAS,eAAAC,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QACjD,OAAS,UAAAC,EAAQ,QAAAC,MAAY,wBAC7B,OAAS,cAAcC,MAAU,gBACjC,OAAS,yBAAAC,MAA6B,wCAEtC,OAAS,oBAAAC,MAAwB,2BACjC,OAAOC,MAAkB,8CACzB,OAAS,yBAAAC,MAA6B,yBAU/B,SAASC,EAAqB,CAAE,OAAAC,EAAQ,QAAAC,EAAS,UAAAC,EAAW,KAAAC,EAAM,mBAAAC,EAAqB,EAAG,EAAU,CACzG,KAAM,CAAE,QAAAC,EAAS,gBAAAC,EAAiB,WAAAC,CAAW,EAAIT,EAAsB,EACjE,CAAE,OAAAU,CAAO,EAAID,EAEb,CAACE,EAAWC,CAAY,EAAInB,EAAS,EAAE,EACvC,CAACoB,EAAUC,CAAW,EAAIrB,EAAS,EAAE,EACrC,CAACsB,EAAOC,CAAQ,EAAIvB,EAAS,EAAE,EAC/B,CAACwB,EAAUC,CAAW,EAAIzB,EAAS,EAAE,EACrC,CAAC0B,EAASC,CAAU,EAAI3B,EAAS,EAAE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Ya,EAAE,OAAO,KAAK,EAC3C,GACF,EAEAzC,EAAC,OACC,UAAAD,EAAC,SAAM,UAAU,iDAAkD,SAAAgB,EAAK,MAAM,EAC9EhB,EAAC,SACC,UAAU,oGACV,MAAO0B,EACP,SAAUgB,GAAKf,EAASe,EAAE,OAAO,KAAK,EACxC,GACF,EAEAzC,EAAC,OACC,UAAAD,EAAC,SAAM,UAAU,iDAAkD,SAAAgB,EAAK,QAAQ,EAChFhB,EAAC,UACC,UAAU,oGACV,MAAO8B,EACP,SAAUY,GAAKX,EAAWW,EAAE,OAAO,KAAK,EAEvC,SAAAJ,EAAU,IAAKK,GACd3C,EAAC,UAAkB,MAAO2C,EAAE,GAAK,SAAAA,EAAE,MAAtBA,EAAE,EAAyB,CACzC,EACH,GACF,EAEA1C,EAAC,OAAI,UAAU,kBACb,UAAAD,EAACK,EAAA,CACC,QAAQ,YACR,KAAK,KACL,UAAU,SACV,QAASS,EACT,SAAUuB,EAET,SAAArB,EAAK,OACR,EACAhB,EAACK,EAAA,CACC,QAAQ,UACR,KAAK,KACL,UAAU,SACV,QAASgC,EACT,QAASI,EAER,SAAAzB,EAAK,KACR,GACF,GACF,EACF,CAEJ",
6
+ "names": ["jsx", "jsxs", "useCallback", "useEffect", "useState", "Button", "Text", "cn", "CreditsModalContainer", "useUpdateProfile", "useCountries", "useMemberPopupContext", "CompleteProfileModal", "isOpen", "onClose", "onSuccess", "copy", "shopifyStoreDomain", "profile", "fetchCreditInfo", "alpcConfig", "locale", "firstName", "setFirstName", "lastName", "setLastName", "phone", "setPhone", "birthDay", "setBirthDay", "country", "setCountry", "firstNameError", "setFirstNameError", "lastNameError", "setLastNameError", "updateProfile", "isLoading", "countries", "validate", "hasError", "handleSubmit", "e", "c"]
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anker-in/campaign-ui",
3
- "version": "0.5.2",
3
+ "version": "0.5.3-beta.02",
4
4
  "description": "Campaign UI components and utilities for Anker projects",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -88,6 +88,9 @@ export const ALPC_COUNTRY_MAP = new Map<string, string>([
88
88
  ['eu-en', 'eu'],
89
89
  ['eu-de', 'de'],
90
90
  ['eu-fr', 'fr'],
91
+ ['eu-es', 'es'],
92
+ ['eu-it', 'it'],
93
+ ['sg-en', 'sg'],
91
94
  ])
92
95
 
93
96
  export enum ApprovalStatus {
@@ -27,12 +27,18 @@ export function getAlpcPath(locale = '', apiBaseUrl?: string) {
27
27
  return '/api/multipass/alpc'
28
28
  }
29
29
 
30
- export function numberFormat(num: number = 0) {
30
+ export function numberFormat(num: number = 0, locale?: string) {
31
31
  if (typeof Intl === 'undefined') {
32
32
  return num
33
33
  }
34
34
 
35
- return new Intl.NumberFormat().format(num)
35
+ const formatted = new Intl.NumberFormat(languageTerritory(locale || '') || locale).format(num)
36
+
37
+ if (locale && ['fr', 'eu-fr', 'fra'].includes(locale)) {
38
+ return formatted.replace(/[\u202f\u00a0]/g, ' ')
39
+ }
40
+
41
+ return formatted
36
42
  }
37
43
 
38
44
  export const emailValidate = (email: any) => {
@@ -52,6 +58,8 @@ export const languageTerritory = (locale: string) =>
52
58
  eu: 'en-eu',
53
59
  pl: 'pl-pl',
54
60
  fr: 'fr-fr',
61
+ 'eu-fr': 'fr-fr',
62
+ fra: 'fr-fr',
55
63
  de: 'de-de',
56
64
  vn: 'vi-vn',
57
65
  sg: 'en-sg',
@@ -95,6 +103,11 @@ export function formatPrice({
95
103
  formattedValue = formattedValue?.toString()?.replace(/[\s]/g, '')
96
104
  }
97
105
 
106
+ if (['fr', 'eu-fr', 'fra'].includes(locale)) {
107
+ // Intl 输出的千位分隔符是窄不换行空格(U+202F)/不换行空格(U+00A0),统一替换为普通空格
108
+ formattedValue = formattedValue?.toString()?.replace(/[\u202f\u00a0]/g, ' ')
109
+ }
110
+
98
111
  if (removeTrailingZeros) {
99
112
  // Adjust the regex to match comma as decimal separator
100
113
  formattedValue = formattedValue
@@ -195,7 +195,7 @@ function RedeemableItem({
195
195
  source="https://cdn.shopify.com/s/files/1/0511/6346/3874/files/icon_hire_purchase.png?v=1757496783"
196
196
  />
197
197
  <Text
198
- html={`${numberFormat(itemData?.alpcData?.consumeCredits)} + ${formatPrice({
198
+ html={`${numberFormat(itemData?.alpcData?.consumeCredits, locale)} + ${formatPrice({
199
199
  amount: Number(itemData?.config?.price),
200
200
  currencyCode: itemData?.productVariant?.price.currencyCode || 'USD',
201
201
  locale: locale,
@@ -20,7 +20,7 @@ export type CreditsInfoCardCopy = {
20
20
  export function CreditsInfoCard({ copy, id }: { copy: CreditsInfoCardCopy; id?: string }) {
21
21
  const [hover, setHover] = useState<boolean>(false)
22
22
  const { creditInfo, pageCommon, setOpenMyRewardsModal, setOpenActivitiesModal } = useCreditsContext()
23
- const { brand } = useHeadlessContext()
23
+ const { brand, locale } = useHeadlessContext()
24
24
  const rounded = ROUNDED_BRANDS.includes(brand)
25
25
 
26
26
  const handleButtonClick = useCallback((buttonConfig: ButtonConfig) => {
@@ -75,7 +75,7 @@ export function CreditsInfoCard({ copy, id }: { copy: CreditsInfoCardCopy; id?:
75
75
  'min-xl:text-[56px]'
76
76
  )}
77
77
  >
78
- {creditInfo ? numberFormat(creditInfo.available_credit) : 0}
78
+ {creditInfo ? numberFormat(creditInfo.available_credit, locale) : 0}
79
79
  </div>
80
80
  <div className="text-[16px]">{pageCommon?.pointUnit}</div>
81
81
  </div>
@@ -126,7 +126,7 @@ export function CreditsInfoCard({ copy, id }: { copy: CreditsInfoCardCopy; id?:
126
126
  </div>
127
127
  <div className="flex items-baseline ">
128
128
  <div className={cn('mr-[8px] text-[36px] font-extrabold', 'min-l:text-[44px]', 'min-xl:text-[56px]')}>
129
- {creditInfo ? numberFormat(creditInfo.pending_credit) : 0}
129
+ {creditInfo ? numberFormat(creditInfo.pending_credit, locale) : 0}
130
130
  </div>
131
131
  <div className="text-[16px]">{pageCommon?.pointUnit}</div>
132
132
  </div>
@@ -27,7 +27,7 @@ export const CreditsRedeemList = ({ copy, id }: { copy: CreditsRedeemListCopy; i
27
27
  creditInfo,
28
28
  } = useCreditsContext()
29
29
  const { authCodeActivate } = useRegistration()
30
- const { brand } = useHeadlessContext()
30
+ const { brand, locale } = useHeadlessContext()
31
31
  const rounded = ROUNDED_BRANDS.includes(brand)
32
32
 
33
33
  const isLogin = Object.keys(profile || {}).length > 0
@@ -128,7 +128,7 @@ export const CreditsRedeemList = ({ copy, id }: { copy: CreditsRedeemListCopy; i
128
128
  'bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-[43%] to-[#00db84] bg-clip-text text-transparent'
129
129
  )}
130
130
  >
131
- {numberFormat(creditInfo?.available_credit || 0).toString()}
131
+ {numberFormat(creditInfo?.available_credit || 0, locale).toString()}
132
132
  </span>
133
133
  {copy.availableCredits.split('$credits')[1] || ''}
134
134
  </>
@@ -4,6 +4,7 @@ import { numberFormat } from '../../context/utils'
4
4
  import type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../../type'
5
5
  import { NoneProductValue } from '../RedeemProductModal/NonProductValue'
6
6
  import { useCreditsContext } from '../../context/provider'
7
+ import { useHeadlessContext } from '@anker-in/lib'
7
8
 
8
9
  type CouponInitProps = {
9
10
  item: RedeemableItemType
@@ -15,6 +16,7 @@ type CouponInitProps = {
15
16
 
16
17
  export const CouponInit = ({ item, copy, loading, disabled, onConfirm }: CouponInitProps) => {
17
18
  const { pageCommon } = useCreditsContext()
19
+ const { locale } = useHeadlessContext()
18
20
 
19
21
  return (
20
22
  <>
@@ -41,7 +43,7 @@ export const CouponInit = ({ item, copy, loading, disabled, onConfirm }: CouponI
41
43
  'mt-[30px] text-center text-[24px] font-bold leading-[1.2] md:mt-[18px] md:text-[20px] md:leading-[1.2]'
42
44
  )}
43
45
  >
44
- {numberFormat(item.alpc?.consumeCredits)} {pageCommon?.pointUnit}
46
+ {numberFormat(item.alpc?.consumeCredits, locale)} {pageCommon?.pointUnit}
45
47
  </Text>
46
48
  {item.config?.rules?.length > 0 && (
47
49
  <div className="mt-[18px] w-full text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px] md:text-[14px]">
@@ -6,6 +6,7 @@ import type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '..
6
6
  import { ConsumeType } from '../../context/const'
7
7
  import { NoneProductValue } from './NonProductValue'
8
8
  import { useCreditsContext } from '../../context/provider'
9
+ import { useHeadlessContext } from '@anker-in/lib'
9
10
 
10
11
  type InitProps = {
11
12
  copy: RedeemModalCommon
@@ -17,6 +18,7 @@ type InitProps = {
17
18
 
18
19
  export const Init = ({ copy, item, loading, disabled, setStatus }: InitProps) => {
19
20
  const { pageCommon } = useCreditsContext()
21
+ const { locale } = useHeadlessContext()
20
22
  const rules = useMemo(() => {
21
23
  if (item.config.rules?.length) {
22
24
  return item.config.rules
@@ -61,7 +63,7 @@ export const Init = ({ copy, item, loading, disabled, setStatus }: InitProps) =>
61
63
  as="p"
62
64
  className={classNames(' text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]')}
63
65
  >
64
- {numberFormat(item.alpc?.consumeCredits)} {pageCommon?.pointUnit}
66
+ {numberFormat(item.alpc?.consumeCredits, locale)} {pageCommon?.pointUnit}
65
67
  </Text>
66
68
  </div>
67
69
  <div className="mt-[16px] w-full text-[14px] font-semibold text-[#777] md:mt-[12px]">
@@ -5,6 +5,7 @@ import { numberFormat } from '../../context/utils'
5
5
  import type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../../type'
6
6
  import { NoneProductValue } from '../RedeemProductModal/NonProductValue'
7
7
  import { useCreditsContext } from '../../context/provider'
8
+ import { useHeadlessContext } from '@anker-in/lib'
8
9
 
9
10
  type VirtualProductInitProps = {
10
11
  item: RedeemableItemType
@@ -16,6 +17,7 @@ type VirtualProductInitProps = {
16
17
 
17
18
  export const VirtualProductInit = ({ item, copy, loading, disabled, onConfirm }: VirtualProductInitProps) => {
18
19
  const { pageCommon } = useCreditsContext()
20
+ const { locale } = useHeadlessContext()
19
21
 
20
22
  return (
21
23
  <>
@@ -42,7 +44,7 @@ export const VirtualProductInit = ({ item, copy, loading, disabled, onConfirm }:
42
44
  'mt-[30px] text-center text-[24px] font-bold leading-[1.2] md:mt-[18px] md:text-[20px] md:leading-[1.2]'
43
45
  )}
44
46
  >
45
- {numberFormat(item.alpc?.consumeCredits)} {pageCommon?.pointUnit}
47
+ {numberFormat(item.alpc?.consumeCredits, locale)} {pageCommon?.pointUnit}
46
48
  </Text>
47
49
  {copy?.virtualProduct?.steps && copy.virtualProduct.steps.length > 0 && (
48
50
  <div className="mt-[16px] w-full text-[14px] font-semibold text-[#777] md:mt-[12px]">
@@ -166,7 +166,7 @@ export function RedeemableItem({
166
166
  source="https://cdn.shopify.com/s/files/1/0511/6346/3874/files/icon_hire_purchase.png?v=1757496783"
167
167
  />
168
168
  <Text
169
- html={`${numberFormat(item.alpc?.consumeCredits)}`}
169
+ html={`${numberFormat(item.alpc?.consumeCredits, locale)}`}
170
170
  size={2}
171
171
  as="p"
172
172
  className="ml-[4px] text-[24px] font-bold mt-[4px] leading-none l-xxl:text-[20px] l:text-[16px] "
@@ -93,7 +93,7 @@ export const CreditsModalContainer = ({
93
93
  </div>
94
94
  <div
95
95
  className={cn(
96
- 'my-[32px] flex-1 overflow-auto overscroll-contain px-[24px] md:mb-[48px]',
96
+ 'my-[32px] flex-1 flex flex-col overflow-auto overscroll-contain px-[24px] md:mb-[48px]',
97
97
  !title && 'mt-0',
98
98
  'min-l:px-[32px]',
99
99
  scrollClassName
@@ -1,33 +0,0 @@
1
- /**
2
- * CartCard Storybook Stories
3
- * 展示购物车卡片组件的各种状态
4
- */
5
- import type { Meta, StoryObj } from '@storybook/react';
6
- import React from 'react';
7
- import type { CartContent } from '../components/LiveChatWidget/types';
8
- declare const CartCardWrapper: React.FC<{
9
- content: CartContent;
10
- }>;
11
- declare const meta: Meta<typeof CartCardWrapper>;
12
- export default meta;
13
- type Story = StoryObj<typeof CartCardWrapper>;
14
- /**
15
- * 空购物车状态
16
- */
17
- export declare const Empty: Story;
18
- /**
19
- * 单件商品
20
- */
21
- export declare const SingleItem: Story;
22
- /**
23
- * 多件商品
24
- */
25
- export declare const MultipleItems: Story;
26
- /**
27
- * 有折扣码的购物车
28
- */
29
- export declare const WithDiscount: Story;
30
- /**
31
- * 多个折扣码(部分失效)
32
- */
33
- export declare const WithMultipleDiscounts: Story;
@@ -1,21 +0,0 @@
1
- "use strict";var c=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var p=(t,e)=>{for(var a in e)c(t,a,{get:e[a],enumerable:!0})},m=(t,e,a,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of d(e))!s.call(t,o)&&o!==a&&c(t,o,{get:()=>e[o],enumerable:!(n=i(e,o))||n.enumerable});return t};var y=t=>m(c({},"__esModule",{value:!0}),t);var A={};p(A,{Empty:()=>S,MultipleItems:()=>g,SingleItem:()=>f,WithDiscount:()=>U,WithMultipleDiscounts:()=>D,default:()=>C});module.exports=y(A);var r=require("react/jsx-runtime"),u=require("../components/LiveChatWidget/components/MessageContent/CartCard.js");const l=({content:t})=>(0,r.jsx)("div",{className:"flex min-h-screen items-center justify-center bg-gray-100 p-4",children:(0,r.jsx)("div",{className:"w-full max-w-md",children:u.CartCard.render(t,!1,!1)})}),h={title:"Campaign/LiveChatWidget/MessageContent/CartCard",component:l,parameters:{layout:"fullscreen",docs:{description:{component:`
2
- # \u8D2D\u7269\u8F66\u5361\u7247\u7EC4\u4EF6
3
-
4
- \u663E\u793A\u7528\u6237\u8D2D\u7269\u8F66\u5185\u5BB9\uFF0C\u5305\u62EC\u5546\u54C1\u5217\u8868\u3001\u4EF7\u683C\u6C47\u603B\u548C\u7ED3\u8D26\u6309\u94AE\u3002
5
-
6
- ## \u529F\u80FD\u7279\u6027
7
-
8
- - \u{1F4E6} **\u5546\u54C1\u5217\u8868**: \u5C55\u793A\u8D2D\u7269\u8F66\u4E2D\u7684\u6240\u6709\u5546\u54C1
9
- - \u{1F4B0} **\u4EF7\u683C\u6C47\u603B**: \u663E\u793A\u5C0F\u8BA1\u3001\u6298\u6263\u548C\u603B\u8BA1
10
- - \u{1F39F}\uFE0F **\u6298\u6263\u7801**: \u663E\u793A\u5DF2\u5E94\u7528\u7684\u6298\u6263\u7801\u53CA\u5176\u72B6\u6001
11
- - \u{1F6D2} **\u7ED3\u8D26\u6309\u94AE**: \u4E00\u952E\u8DF3\u8F6C\u5230 Shopify \u7ED3\u8D26\u9875\u9762
12
- - \u{1F233} **\u7A7A\u72B6\u6001**: \u4F18\u96C5\u7684\u7A7A\u8D2D\u7269\u8F66\u63D0\u793A
13
-
14
- ## \u4F7F\u7528\u573A\u666F
15
-
16
- - \u7528\u6237\u6DFB\u52A0\u5546\u54C1\u5230\u8D2D\u7269\u8F66\u540E (add_to_cart)
17
- - \u7528\u6237\u67E5\u8BE2\u8D2D\u7269\u8F66\u5185\u5BB9 (get_cart)
18
- - \u7528\u6237\u4FEE\u6539\u8D2D\u7269\u8F66\u6570\u91CF (update_cart_item)
19
- - \u7528\u6237\u5E94\u7528\u6298\u6263\u7801 (update_discount_codes)
20
- `}}},tags:["autodocs"]};var C=h;const S={args:{content:{type:"cart",data:{isEmpty:!0,cartId:"gid://shopify/Cart/empty",totalQuantity:0,lines:[],cost:{totalAmount:{amount:"0.00",currencyCode:"USD"},subtotalAmount:{amount:"0.00",currencyCode:"USD"}}}}}},f={args:{content:{type:"cart",data:{isEmpty:!1,cartId:"gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH",totalQuantity:1,lines:[{id:"gid://shopify/CartLine/12345",quantity:1,cost:{totalAmount:{amount:"99.99",currencyCode:"USD"},amountPerQuantity:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"99.99",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567890",title:"Black",price:{amount:"99.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop",altText:"Soundcore Space One"},product:{id:"gid://shopify/Product/8179159826618",title:"Soundcore Space One",handle:"soundcore-space-one"}}}],cost:{totalAmount:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"99.99",currencyCode:"USD"}},checkoutUrl:"https://checkout.shopify.com/example"}}}},g={args:{content:{type:"cart",data:{isEmpty:!1,cartId:"gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH",totalQuantity:5,lines:[{id:"gid://shopify/CartLine/12345",quantity:2,cost:{totalAmount:{amount:"199.98",currencyCode:"USD"},amountPerQuantity:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"199.98",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567890",title:"Black",price:{amount:"99.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop",altText:"Soundcore Space One"},product:{id:"gid://shopify/Product/8179159826618",title:"Soundcore Space One",handle:"soundcore-space-one"}}},{id:"gid://shopify/CartLine/12346",quantity:1,cost:{totalAmount:{amount:"129.99",currencyCode:"USD"},amountPerQuantity:{amount:"129.99",currencyCode:"USD"},subtotalAmount:{amount:"129.99",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567891",title:"White",price:{amount:"129.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1484704849700-f032a568e944?w=400&h=400&fit=crop",altText:"eufy Security Camera"},product:{id:"gid://shopify/Product/8179159826619",title:"eufy Security Camera",handle:"eufy-security-camera"}}},{id:"gid://shopify/CartLine/12347",quantity:2,cost:{totalAmount:{amount:"79.98",currencyCode:"USD"},amountPerQuantity:{amount:"39.99",currencyCode:"USD"},subtotalAmount:{amount:"79.98",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567892",title:"USB-C Cable",price:{amount:"39.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1583863788434-e58a36330cf0?w=400&h=400&fit=crop",altText:"Anker USB-C Cable"},product:{id:"gid://shopify/Product/8179159826620",title:"Anker USB-C Cable 6ft",handle:"anker-usb-c-cable"}}}],cost:{totalAmount:{amount:"409.95",currencyCode:"USD"},subtotalAmount:{amount:"409.95",currencyCode:"USD"}},checkoutUrl:"https://checkout.shopify.com/example"}}}},U={args:{content:{type:"cart",data:{isEmpty:!1,cartId:"gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH",totalQuantity:3,lines:[{id:"gid://shopify/CartLine/12345",quantity:2,cost:{totalAmount:{amount:"199.98",currencyCode:"USD"},amountPerQuantity:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"199.98",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567890",title:"Black",price:{amount:"99.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop",altText:"Soundcore Space One"},product:{id:"gid://shopify/Product/8179159826618",title:"Soundcore Space One",handle:"soundcore-space-one"}}},{id:"gid://shopify/CartLine/12346",quantity:1,cost:{totalAmount:{amount:"129.99",currencyCode:"USD"},amountPerQuantity:{amount:"129.99",currencyCode:"USD"},subtotalAmount:{amount:"129.99",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567891",title:"White",price:{amount:"129.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1484704849700-f032a568e944?w=400&h=400&fit=crop",altText:"eufy Security Camera"},product:{id:"gid://shopify/Product/8179159826619",title:"eufy Security Camera",handle:"eufy-security-camera"}}}],cost:{totalAmount:{amount:"296.97",currencyCode:"USD"},subtotalAmount:{amount:"329.97",currencyCode:"USD"}},discountCodes:[{code:"SPRING20",applicable:!0}],checkoutUrl:"https://checkout.shopify.com/example"}}}},D={args:{content:{type:"cart",data:{isEmpty:!1,cartId:"gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH",totalQuantity:2,lines:[{id:"gid://shopify/CartLine/12345",quantity:2,cost:{totalAmount:{amount:"199.98",currencyCode:"USD"},amountPerQuantity:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"199.98",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567890",title:"Black",price:{amount:"99.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop",altText:"Soundcore Space One"},product:{id:"gid://shopify/Product/8179159826618",title:"Soundcore Space One",handle:"soundcore-space-one"}}}],cost:{totalAmount:{amount:"179.98",currencyCode:"USD"},subtotalAmount:{amount:"199.98",currencyCode:"USD"}},discountCodes:[{code:"WELCOME10",applicable:!0},{code:"EXPIRED20",applicable:!1}],checkoutUrl:"https://checkout.shopify.com/example"}}}};
21
- //# sourceMappingURL=CartCard.stories.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/stories/CartCard.stories.tsx"],
4
- "sourcesContent": ["/**\n * CartCard Storybook Stories\n * \u5C55\u793A\u8D2D\u7269\u8F66\u5361\u7247\u7EC4\u4EF6\u7684\u5404\u79CD\u72B6\u6001\n */\n\nimport type { Meta, StoryObj } from '@storybook/react'\nimport React from 'react'\nimport { CartCard } from '../components/LiveChatWidget/components/MessageContent/CartCard.js'\nimport type { CartContent } from '../components/LiveChatWidget/types'\n\n// Story \u5305\u88C5\u7EC4\u4EF6\nconst CartCardWrapper: React.FC<{ content: CartContent }> = ({ content }) => {\n return (\n <div className=\"flex min-h-screen items-center justify-center bg-gray-100 p-4\">\n <div className=\"w-full max-w-md\">{CartCard.render(content, false, false)}</div>\n </div>\n )\n}\n\nconst meta: Meta<typeof CartCardWrapper> = {\n title: 'Campaign/LiveChatWidget/MessageContent/CartCard',\n component: CartCardWrapper,\n parameters: {\n layout: 'fullscreen',\n docs: {\n description: {\n component: `\n# \u8D2D\u7269\u8F66\u5361\u7247\u7EC4\u4EF6\n\n\u663E\u793A\u7528\u6237\u8D2D\u7269\u8F66\u5185\u5BB9\uFF0C\u5305\u62EC\u5546\u54C1\u5217\u8868\u3001\u4EF7\u683C\u6C47\u603B\u548C\u7ED3\u8D26\u6309\u94AE\u3002\n\n## \u529F\u80FD\u7279\u6027\n\n- \uD83D\uDCE6 **\u5546\u54C1\u5217\u8868**: \u5C55\u793A\u8D2D\u7269\u8F66\u4E2D\u7684\u6240\u6709\u5546\u54C1\n- \uD83D\uDCB0 **\u4EF7\u683C\u6C47\u603B**: \u663E\u793A\u5C0F\u8BA1\u3001\u6298\u6263\u548C\u603B\u8BA1\n- \uD83C\uDF9F\uFE0F **\u6298\u6263\u7801**: \u663E\u793A\u5DF2\u5E94\u7528\u7684\u6298\u6263\u7801\u53CA\u5176\u72B6\u6001\n- \uD83D\uDED2 **\u7ED3\u8D26\u6309\u94AE**: \u4E00\u952E\u8DF3\u8F6C\u5230 Shopify \u7ED3\u8D26\u9875\u9762\n- \uD83C\uDE33 **\u7A7A\u72B6\u6001**: \u4F18\u96C5\u7684\u7A7A\u8D2D\u7269\u8F66\u63D0\u793A\n\n## \u4F7F\u7528\u573A\u666F\n\n- \u7528\u6237\u6DFB\u52A0\u5546\u54C1\u5230\u8D2D\u7269\u8F66\u540E (add_to_cart)\n- \u7528\u6237\u67E5\u8BE2\u8D2D\u7269\u8F66\u5185\u5BB9 (get_cart)\n- \u7528\u6237\u4FEE\u6539\u8D2D\u7269\u8F66\u6570\u91CF (update_cart_item)\n- \u7528\u6237\u5E94\u7528\u6298\u6263\u7801 (update_discount_codes)\n `,\n },\n },\n },\n tags: ['autodocs'],\n}\n\nexport default meta\n\ntype Story = StoryObj<typeof CartCardWrapper>\n\n/**\n * \u7A7A\u8D2D\u7269\u8F66\u72B6\u6001\n */\nexport const Empty: Story = {\n args: {\n content: {\n type: 'cart',\n data: {\n isEmpty: true,\n cartId: 'gid://shopify/Cart/empty',\n totalQuantity: 0,\n lines: [],\n cost: {\n totalAmount: {\n amount: '0.00',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '0.00',\n currencyCode: 'USD',\n },\n },\n },\n },\n },\n}\n\n/**\n * \u5355\u4EF6\u5546\u54C1\n */\nexport const SingleItem: Story = {\n args: {\n content: {\n type: 'cart',\n data: {\n isEmpty: false,\n cartId: 'gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH',\n totalQuantity: 1,\n lines: [\n {\n id: 'gid://shopify/CartLine/12345',\n quantity: 1,\n cost: {\n totalAmount: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567890',\n title: 'Black',\n price: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop',\n altText: 'Soundcore Space One',\n },\n product: {\n id: 'gid://shopify/Product/8179159826618',\n title: 'Soundcore Space One',\n handle: 'soundcore-space-one',\n },\n },\n },\n ],\n cost: {\n totalAmount: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n },\n checkoutUrl: 'https://checkout.shopify.com/example',\n },\n },\n },\n}\n\n/**\n * \u591A\u4EF6\u5546\u54C1\n */\nexport const MultipleItems: Story = {\n args: {\n content: {\n type: 'cart',\n data: {\n isEmpty: false,\n cartId: 'gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH',\n totalQuantity: 5,\n lines: [\n {\n id: 'gid://shopify/CartLine/12345',\n quantity: 2,\n cost: {\n totalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567890',\n title: 'Black',\n price: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop',\n altText: 'Soundcore Space One',\n },\n product: {\n id: 'gid://shopify/Product/8179159826618',\n title: 'Soundcore Space One',\n handle: 'soundcore-space-one',\n },\n },\n },\n {\n id: 'gid://shopify/CartLine/12346',\n quantity: 1,\n cost: {\n totalAmount: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567891',\n title: 'White',\n price: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1484704849700-f032a568e944?w=400&h=400&fit=crop',\n altText: 'eufy Security Camera',\n },\n product: {\n id: 'gid://shopify/Product/8179159826619',\n title: 'eufy Security Camera',\n handle: 'eufy-security-camera',\n },\n },\n },\n {\n id: 'gid://shopify/CartLine/12347',\n quantity: 2,\n cost: {\n totalAmount: {\n amount: '79.98',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '39.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '79.98',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567892',\n title: 'USB-C Cable',\n price: {\n amount: '39.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1583863788434-e58a36330cf0?w=400&h=400&fit=crop',\n altText: 'Anker USB-C Cable',\n },\n product: {\n id: 'gid://shopify/Product/8179159826620',\n title: 'Anker USB-C Cable 6ft',\n handle: 'anker-usb-c-cable',\n },\n },\n },\n ],\n cost: {\n totalAmount: {\n amount: '409.95',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '409.95',\n currencyCode: 'USD',\n },\n },\n checkoutUrl: 'https://checkout.shopify.com/example',\n },\n },\n },\n}\n\n/**\n * \u6709\u6298\u6263\u7801\u7684\u8D2D\u7269\u8F66\n */\nexport const WithDiscount: Story = {\n args: {\n content: {\n type: 'cart',\n data: {\n isEmpty: false,\n cartId: 'gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH',\n totalQuantity: 3,\n lines: [\n {\n id: 'gid://shopify/CartLine/12345',\n quantity: 2,\n cost: {\n totalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567890',\n title: 'Black',\n price: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop',\n altText: 'Soundcore Space One',\n },\n product: {\n id: 'gid://shopify/Product/8179159826618',\n title: 'Soundcore Space One',\n handle: 'soundcore-space-one',\n },\n },\n },\n {\n id: 'gid://shopify/CartLine/12346',\n quantity: 1,\n cost: {\n totalAmount: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567891',\n title: 'White',\n price: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1484704849700-f032a568e944?w=400&h=400&fit=crop',\n altText: 'eufy Security Camera',\n },\n product: {\n id: 'gid://shopify/Product/8179159826619',\n title: 'eufy Security Camera',\n handle: 'eufy-security-camera',\n },\n },\n },\n ],\n cost: {\n totalAmount: {\n amount: '296.97',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '329.97',\n currencyCode: 'USD',\n },\n },\n discountCodes: [\n {\n code: 'SPRING20',\n applicable: true,\n },\n ],\n checkoutUrl: 'https://checkout.shopify.com/example',\n },\n },\n },\n}\n\n/**\n * \u591A\u4E2A\u6298\u6263\u7801\uFF08\u90E8\u5206\u5931\u6548\uFF09\n */\nexport const WithMultipleDiscounts: Story = {\n args: {\n content: {\n type: 'cart',\n data: {\n isEmpty: false,\n cartId: 'gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH',\n totalQuantity: 2,\n lines: [\n {\n id: 'gid://shopify/CartLine/12345',\n quantity: 2,\n cost: {\n totalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567890',\n title: 'Black',\n price: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop',\n altText: 'Soundcore Space One',\n },\n product: {\n id: 'gid://shopify/Product/8179159826618',\n title: 'Soundcore Space One',\n handle: 'soundcore-space-one',\n },\n },\n },\n ],\n cost: {\n totalAmount: {\n amount: '179.98',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n },\n discountCodes: [\n {\n code: 'WELCOME10',\n applicable: true,\n },\n {\n code: 'EXPIRED20',\n applicable: false,\n },\n ],\n checkoutUrl: 'https://checkout.shopify.com/example',\n },\n },\n },\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAA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AM,CACJ,QAAS,CACP,KAAM,OACN,KAAM,CACJ,QAAS,GACT,OAAQ,0EACR,cAAe,EACf,MAAO,CACL,CACE,GAAI,+BACJ,SAAU,EACV,KAAM,CACJ,YAAa,CACX,OAAQ,SACR,aAAc,KAChB,EACA,kBAAmB,CACjB,OAAQ,QACR,aAAc,KAChB,EACA,eAAgB,CACd,OAAQ,SACR,aAAc,KAChB,CACF,EACA,YAAa,CACX,GAAI,2CACJ,MAAO,QACP,MAAO,CACL,OAAQ,QACR,aAAc,KAChB,EACA,MAAO,CACL,IAAK,oFACL,QAAS,qBACX,EACA,QAAS,CACP,GAAI,sCACJ,MAAO,sBACP,OAAQ,qBACV,CACF,CACF,CACF,EACA,KAAM,CACJ,YAAa,CACX,OAAQ,SACR,aAAc,KAChB,EACA,eAAgB,CACd,OAAQ,SACR,aAAc,KAChB,CACF,EACA,cAAe,CACb,CACE,KAAM,YACN,WAAY,EACd,EACA,CACE,KAAM,YACN,WAAY,EACd,CACF,EACA,YAAa,sCACf,CACF,CACF,CACF",
6
- "names": ["CartCard_stories_exports", "__export", "Empty", "MultipleItems", "SingleItem", "WithDiscount", "WithMultipleDiscounts", "CartCard_stories_default", "__toCommonJS", "import_jsx_runtime", "import_CartCard", "CartCardWrapper", "content", "meta"]
7
- }
@@ -1,33 +0,0 @@
1
- /**
2
- * CartCard Storybook Stories
3
- * 展示购物车卡片组件的各种状态
4
- */
5
- import type { Meta, StoryObj } from '@storybook/react';
6
- import React from 'react';
7
- import type { CartContent } from '../components/LiveChatWidget/types';
8
- declare const CartCardWrapper: React.FC<{
9
- content: CartContent;
10
- }>;
11
- declare const meta: Meta<typeof CartCardWrapper>;
12
- export default meta;
13
- type Story = StoryObj<typeof CartCardWrapper>;
14
- /**
15
- * 空购物车状态
16
- */
17
- export declare const Empty: Story;
18
- /**
19
- * 单件商品
20
- */
21
- export declare const SingleItem: Story;
22
- /**
23
- * 多件商品
24
- */
25
- export declare const MultipleItems: Story;
26
- /**
27
- * 有折扣码的购物车
28
- */
29
- export declare const WithDiscount: Story;
30
- /**
31
- * 多个折扣码(部分失效)
32
- */
33
- export declare const WithMultipleDiscounts: Story;
@@ -1,21 +0,0 @@
1
- import{jsx as t}from"react/jsx-runtime";import{CartCard as o}from"../components/LiveChatWidget/components/MessageContent/CartCard.js";const a=({content:e})=>t("div",{className:"flex min-h-screen items-center justify-center bg-gray-100 p-4",children:t("div",{className:"w-full max-w-md",children:o.render(e,!1,!1)})}),c={title:"Campaign/LiveChatWidget/MessageContent/CartCard",component:a,parameters:{layout:"fullscreen",docs:{description:{component:`
2
- # \u8D2D\u7269\u8F66\u5361\u7247\u7EC4\u4EF6
3
-
4
- \u663E\u793A\u7528\u6237\u8D2D\u7269\u8F66\u5185\u5BB9\uFF0C\u5305\u62EC\u5546\u54C1\u5217\u8868\u3001\u4EF7\u683C\u6C47\u603B\u548C\u7ED3\u8D26\u6309\u94AE\u3002
5
-
6
- ## \u529F\u80FD\u7279\u6027
7
-
8
- - \u{1F4E6} **\u5546\u54C1\u5217\u8868**: \u5C55\u793A\u8D2D\u7269\u8F66\u4E2D\u7684\u6240\u6709\u5546\u54C1
9
- - \u{1F4B0} **\u4EF7\u683C\u6C47\u603B**: \u663E\u793A\u5C0F\u8BA1\u3001\u6298\u6263\u548C\u603B\u8BA1
10
- - \u{1F39F}\uFE0F **\u6298\u6263\u7801**: \u663E\u793A\u5DF2\u5E94\u7528\u7684\u6298\u6263\u7801\u53CA\u5176\u72B6\u6001
11
- - \u{1F6D2} **\u7ED3\u8D26\u6309\u94AE**: \u4E00\u952E\u8DF3\u8F6C\u5230 Shopify \u7ED3\u8D26\u9875\u9762
12
- - \u{1F233} **\u7A7A\u72B6\u6001**: \u4F18\u96C5\u7684\u7A7A\u8D2D\u7269\u8F66\u63D0\u793A
13
-
14
- ## \u4F7F\u7528\u573A\u666F
15
-
16
- - \u7528\u6237\u6DFB\u52A0\u5546\u54C1\u5230\u8D2D\u7269\u8F66\u540E (add_to_cart)
17
- - \u7528\u6237\u67E5\u8BE2\u8D2D\u7269\u8F66\u5185\u5BB9 (get_cart)
18
- - \u7528\u6237\u4FEE\u6539\u8D2D\u7269\u8F66\u6570\u91CF (update_cart_item)
19
- - \u7528\u6237\u5E94\u7528\u6298\u6263\u7801 (update_discount_codes)
20
- `}}},tags:["autodocs"]};var i=c;const d={args:{content:{type:"cart",data:{isEmpty:!0,cartId:"gid://shopify/Cart/empty",totalQuantity:0,lines:[],cost:{totalAmount:{amount:"0.00",currencyCode:"USD"},subtotalAmount:{amount:"0.00",currencyCode:"USD"}}}}}},s={args:{content:{type:"cart",data:{isEmpty:!1,cartId:"gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH",totalQuantity:1,lines:[{id:"gid://shopify/CartLine/12345",quantity:1,cost:{totalAmount:{amount:"99.99",currencyCode:"USD"},amountPerQuantity:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"99.99",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567890",title:"Black",price:{amount:"99.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop",altText:"Soundcore Space One"},product:{id:"gid://shopify/Product/8179159826618",title:"Soundcore Space One",handle:"soundcore-space-one"}}}],cost:{totalAmount:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"99.99",currencyCode:"USD"}},checkoutUrl:"https://checkout.shopify.com/example"}}}},p={args:{content:{type:"cart",data:{isEmpty:!1,cartId:"gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH",totalQuantity:5,lines:[{id:"gid://shopify/CartLine/12345",quantity:2,cost:{totalAmount:{amount:"199.98",currencyCode:"USD"},amountPerQuantity:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"199.98",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567890",title:"Black",price:{amount:"99.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop",altText:"Soundcore Space One"},product:{id:"gid://shopify/Product/8179159826618",title:"Soundcore Space One",handle:"soundcore-space-one"}}},{id:"gid://shopify/CartLine/12346",quantity:1,cost:{totalAmount:{amount:"129.99",currencyCode:"USD"},amountPerQuantity:{amount:"129.99",currencyCode:"USD"},subtotalAmount:{amount:"129.99",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567891",title:"White",price:{amount:"129.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1484704849700-f032a568e944?w=400&h=400&fit=crop",altText:"eufy Security Camera"},product:{id:"gid://shopify/Product/8179159826619",title:"eufy Security Camera",handle:"eufy-security-camera"}}},{id:"gid://shopify/CartLine/12347",quantity:2,cost:{totalAmount:{amount:"79.98",currencyCode:"USD"},amountPerQuantity:{amount:"39.99",currencyCode:"USD"},subtotalAmount:{amount:"79.98",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567892",title:"USB-C Cable",price:{amount:"39.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1583863788434-e58a36330cf0?w=400&h=400&fit=crop",altText:"Anker USB-C Cable"},product:{id:"gid://shopify/Product/8179159826620",title:"Anker USB-C Cable 6ft",handle:"anker-usb-c-cable"}}}],cost:{totalAmount:{amount:"409.95",currencyCode:"USD"},subtotalAmount:{amount:"409.95",currencyCode:"USD"}},checkoutUrl:"https://checkout.shopify.com/example"}}}},m={args:{content:{type:"cart",data:{isEmpty:!1,cartId:"gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH",totalQuantity:3,lines:[{id:"gid://shopify/CartLine/12345",quantity:2,cost:{totalAmount:{amount:"199.98",currencyCode:"USD"},amountPerQuantity:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"199.98",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567890",title:"Black",price:{amount:"99.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop",altText:"Soundcore Space One"},product:{id:"gid://shopify/Product/8179159826618",title:"Soundcore Space One",handle:"soundcore-space-one"}}},{id:"gid://shopify/CartLine/12346",quantity:1,cost:{totalAmount:{amount:"129.99",currencyCode:"USD"},amountPerQuantity:{amount:"129.99",currencyCode:"USD"},subtotalAmount:{amount:"129.99",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567891",title:"White",price:{amount:"129.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1484704849700-f032a568e944?w=400&h=400&fit=crop",altText:"eufy Security Camera"},product:{id:"gid://shopify/Product/8179159826619",title:"eufy Security Camera",handle:"eufy-security-camera"}}}],cost:{totalAmount:{amount:"296.97",currencyCode:"USD"},subtotalAmount:{amount:"329.97",currencyCode:"USD"}},discountCodes:[{code:"SPRING20",applicable:!0}],checkoutUrl:"https://checkout.shopify.com/example"}}}},y={args:{content:{type:"cart",data:{isEmpty:!1,cartId:"gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH",totalQuantity:2,lines:[{id:"gid://shopify/CartLine/12345",quantity:2,cost:{totalAmount:{amount:"199.98",currencyCode:"USD"},amountPerQuantity:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"199.98",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567890",title:"Black",price:{amount:"99.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop",altText:"Soundcore Space One"},product:{id:"gid://shopify/Product/8179159826618",title:"Soundcore Space One",handle:"soundcore-space-one"}}}],cost:{totalAmount:{amount:"179.98",currencyCode:"USD"},subtotalAmount:{amount:"199.98",currencyCode:"USD"}},discountCodes:[{code:"WELCOME10",applicable:!0},{code:"EXPIRED20",applicable:!1}],checkoutUrl:"https://checkout.shopify.com/example"}}}};export{d as Empty,p as MultipleItems,s as SingleItem,m as WithDiscount,y as WithMultipleDiscounts,i as default};
21
- //# sourceMappingURL=CartCard.stories.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/stories/CartCard.stories.tsx"],
4
- "sourcesContent": ["/**\n * CartCard Storybook Stories\n * \u5C55\u793A\u8D2D\u7269\u8F66\u5361\u7247\u7EC4\u4EF6\u7684\u5404\u79CD\u72B6\u6001\n */\n\nimport type { Meta, StoryObj } from '@storybook/react'\nimport React from 'react'\nimport { CartCard } from '../components/LiveChatWidget/components/MessageContent/CartCard.js'\nimport type { CartContent } from '../components/LiveChatWidget/types'\n\n// Story \u5305\u88C5\u7EC4\u4EF6\nconst CartCardWrapper: React.FC<{ content: CartContent }> = ({ content }) => {\n return (\n <div className=\"flex min-h-screen items-center justify-center bg-gray-100 p-4\">\n <div className=\"w-full max-w-md\">{CartCard.render(content, false, false)}</div>\n </div>\n )\n}\n\nconst meta: Meta<typeof CartCardWrapper> = {\n title: 'Campaign/LiveChatWidget/MessageContent/CartCard',\n component: CartCardWrapper,\n parameters: {\n layout: 'fullscreen',\n docs: {\n description: {\n component: `\n# \u8D2D\u7269\u8F66\u5361\u7247\u7EC4\u4EF6\n\n\u663E\u793A\u7528\u6237\u8D2D\u7269\u8F66\u5185\u5BB9\uFF0C\u5305\u62EC\u5546\u54C1\u5217\u8868\u3001\u4EF7\u683C\u6C47\u603B\u548C\u7ED3\u8D26\u6309\u94AE\u3002\n\n## \u529F\u80FD\u7279\u6027\n\n- \uD83D\uDCE6 **\u5546\u54C1\u5217\u8868**: \u5C55\u793A\u8D2D\u7269\u8F66\u4E2D\u7684\u6240\u6709\u5546\u54C1\n- \uD83D\uDCB0 **\u4EF7\u683C\u6C47\u603B**: \u663E\u793A\u5C0F\u8BA1\u3001\u6298\u6263\u548C\u603B\u8BA1\n- \uD83C\uDF9F\uFE0F **\u6298\u6263\u7801**: \u663E\u793A\u5DF2\u5E94\u7528\u7684\u6298\u6263\u7801\u53CA\u5176\u72B6\u6001\n- \uD83D\uDED2 **\u7ED3\u8D26\u6309\u94AE**: \u4E00\u952E\u8DF3\u8F6C\u5230 Shopify \u7ED3\u8D26\u9875\u9762\n- \uD83C\uDE33 **\u7A7A\u72B6\u6001**: \u4F18\u96C5\u7684\u7A7A\u8D2D\u7269\u8F66\u63D0\u793A\n\n## \u4F7F\u7528\u573A\u666F\n\n- \u7528\u6237\u6DFB\u52A0\u5546\u54C1\u5230\u8D2D\u7269\u8F66\u540E (add_to_cart)\n- \u7528\u6237\u67E5\u8BE2\u8D2D\u7269\u8F66\u5185\u5BB9 (get_cart)\n- \u7528\u6237\u4FEE\u6539\u8D2D\u7269\u8F66\u6570\u91CF (update_cart_item)\n- \u7528\u6237\u5E94\u7528\u6298\u6263\u7801 (update_discount_codes)\n `,\n },\n },\n },\n tags: ['autodocs'],\n}\n\nexport default meta\n\ntype Story = StoryObj<typeof CartCardWrapper>\n\n/**\n * \u7A7A\u8D2D\u7269\u8F66\u72B6\u6001\n */\nexport const Empty: Story = {\n args: {\n content: {\n type: 'cart',\n data: {\n isEmpty: true,\n cartId: 'gid://shopify/Cart/empty',\n totalQuantity: 0,\n lines: [],\n cost: {\n totalAmount: {\n amount: '0.00',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '0.00',\n currencyCode: 'USD',\n },\n },\n },\n },\n },\n}\n\n/**\n * \u5355\u4EF6\u5546\u54C1\n */\nexport const SingleItem: Story = {\n args: {\n content: {\n type: 'cart',\n data: {\n isEmpty: false,\n cartId: 'gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH',\n totalQuantity: 1,\n lines: [\n {\n id: 'gid://shopify/CartLine/12345',\n quantity: 1,\n cost: {\n totalAmount: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567890',\n title: 'Black',\n price: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop',\n altText: 'Soundcore Space One',\n },\n product: {\n id: 'gid://shopify/Product/8179159826618',\n title: 'Soundcore Space One',\n handle: 'soundcore-space-one',\n },\n },\n },\n ],\n cost: {\n totalAmount: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n },\n checkoutUrl: 'https://checkout.shopify.com/example',\n },\n },\n },\n}\n\n/**\n * \u591A\u4EF6\u5546\u54C1\n */\nexport const MultipleItems: Story = {\n args: {\n content: {\n type: 'cart',\n data: {\n isEmpty: false,\n cartId: 'gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH',\n totalQuantity: 5,\n lines: [\n {\n id: 'gid://shopify/CartLine/12345',\n quantity: 2,\n cost: {\n totalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567890',\n title: 'Black',\n price: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop',\n altText: 'Soundcore Space One',\n },\n product: {\n id: 'gid://shopify/Product/8179159826618',\n title: 'Soundcore Space One',\n handle: 'soundcore-space-one',\n },\n },\n },\n {\n id: 'gid://shopify/CartLine/12346',\n quantity: 1,\n cost: {\n totalAmount: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567891',\n title: 'White',\n price: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1484704849700-f032a568e944?w=400&h=400&fit=crop',\n altText: 'eufy Security Camera',\n },\n product: {\n id: 'gid://shopify/Product/8179159826619',\n title: 'eufy Security Camera',\n handle: 'eufy-security-camera',\n },\n },\n },\n {\n id: 'gid://shopify/CartLine/12347',\n quantity: 2,\n cost: {\n totalAmount: {\n amount: '79.98',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '39.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '79.98',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567892',\n title: 'USB-C Cable',\n price: {\n amount: '39.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1583863788434-e58a36330cf0?w=400&h=400&fit=crop',\n altText: 'Anker USB-C Cable',\n },\n product: {\n id: 'gid://shopify/Product/8179159826620',\n title: 'Anker USB-C Cable 6ft',\n handle: 'anker-usb-c-cable',\n },\n },\n },\n ],\n cost: {\n totalAmount: {\n amount: '409.95',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '409.95',\n currencyCode: 'USD',\n },\n },\n checkoutUrl: 'https://checkout.shopify.com/example',\n },\n },\n },\n}\n\n/**\n * \u6709\u6298\u6263\u7801\u7684\u8D2D\u7269\u8F66\n */\nexport const WithDiscount: Story = {\n args: {\n content: {\n type: 'cart',\n data: {\n isEmpty: false,\n cartId: 'gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH',\n totalQuantity: 3,\n lines: [\n {\n id: 'gid://shopify/CartLine/12345',\n quantity: 2,\n cost: {\n totalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567890',\n title: 'Black',\n price: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop',\n altText: 'Soundcore Space One',\n },\n product: {\n id: 'gid://shopify/Product/8179159826618',\n title: 'Soundcore Space One',\n handle: 'soundcore-space-one',\n },\n },\n },\n {\n id: 'gid://shopify/CartLine/12346',\n quantity: 1,\n cost: {\n totalAmount: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567891',\n title: 'White',\n price: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1484704849700-f032a568e944?w=400&h=400&fit=crop',\n altText: 'eufy Security Camera',\n },\n product: {\n id: 'gid://shopify/Product/8179159826619',\n title: 'eufy Security Camera',\n handle: 'eufy-security-camera',\n },\n },\n },\n ],\n cost: {\n totalAmount: {\n amount: '296.97',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '329.97',\n currencyCode: 'USD',\n },\n },\n discountCodes: [\n {\n code: 'SPRING20',\n applicable: true,\n },\n ],\n checkoutUrl: 'https://checkout.shopify.com/example',\n },\n },\n },\n}\n\n/**\n * \u591A\u4E2A\u6298\u6263\u7801\uFF08\u90E8\u5206\u5931\u6548\uFF09\n */\nexport const WithMultipleDiscounts: Story = {\n args: {\n content: {\n type: 'cart',\n data: {\n isEmpty: false,\n cartId: 'gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH',\n totalQuantity: 2,\n lines: [\n {\n id: 'gid://shopify/CartLine/12345',\n quantity: 2,\n cost: {\n totalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567890',\n title: 'Black',\n price: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop',\n altText: 'Soundcore Space One',\n },\n product: {\n id: 'gid://shopify/Product/8179159826618',\n title: 'Soundcore Space One',\n handle: 'soundcore-space-one',\n },\n },\n },\n ],\n cost: {\n totalAmount: {\n amount: '179.98',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n },\n discountCodes: [\n {\n code: 'WELCOME10',\n applicable: true,\n },\n {\n code: 'EXPIRED20',\n applicable: false,\n },\n ],\n checkoutUrl: 'https://checkout.shopify.com/example',\n },\n },\n },\n}\n"],
5
- "mappings": "AAcM,cAAAA,MAAA,oBAPN,OAAS,YAAAC,MAAgB,qEAIzB,MAAMC,EAAsD,CAAC,CAAE,QAAAC,CAAQ,IAEnEH,EAAC,OAAI,UAAU,gEACb,SAAAA,EAAC,OAAI,UAAU,kBAAmB,SAAAC,EAAS,OAAOE,EAAS,GAAO,EAAK,EAAE,EAC3E,EAIEC,EAAqC,CACzC,MAAO,kDACP,UAAWF,EACX,WAAY,CACV,OAAQ,aACR,KAAM,CACJ,YAAa,CACX,UAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAoBb,CACF,CACF,EACA,KAAM,CAAC,UAAU,CACnB,EAEA,IAAOG,EAAQD,EAOR,MAAME,EAAe,CAC1B,KAAM,CACJ,QAAS,C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ACf,CACF,CACF,CACF",
6
- "names": ["jsx", "CartCard", "CartCardWrapper", "content", "meta", "CartCard_stories_default", "Empty", "SingleItem", "MultipleItems", "WithDiscount", "WithMultipleDiscounts"]
7
- }