@anker-in/campaign-ui 0.2.10-beta.6 → 0.2.10-beta.8

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 (93) hide show
  1. package/dist/cjs/index.js +726 -1
  2. package/dist/cjs/index.js.map +4 -4
  3. package/dist/esm/components/chat/chatContext.js +2 -0
  4. package/dist/esm/components/chat/chatContext.js.map +7 -0
  5. package/dist/esm/components/credits/context/hooks/useActivities.js +1 -1
  6. package/dist/esm/components/credits/context/hooks/useActivities.js.map +2 -2
  7. package/dist/esm/components/credits/context/hooks/useAddressValidate.js +1 -1
  8. package/dist/esm/components/credits/context/hooks/useAddressValidate.js.map +3 -3
  9. package/dist/esm/components/credits/context/hooks/useAlpcFetch.js +1 -1
  10. package/dist/esm/components/credits/context/hooks/useAlpcFetch.js.map +3 -3
  11. package/dist/esm/components/credits/context/hooks/useCountries.js +1 -1
  12. package/dist/esm/components/credits/context/hooks/useCountries.js.map +3 -3
  13. package/dist/esm/components/credits/context/hooks/useMyRewards.js +1 -1
  14. package/dist/esm/components/credits/context/hooks/useMyRewards.js.map +2 -2
  15. package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.js +1 -1
  16. package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.js.map +2 -2
  17. package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js +1 -1
  18. package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js.map +2 -2
  19. package/dist/esm/components/credits/context/hooks/useRedeemProduct.js +1 -1
  20. package/dist/esm/components/credits/context/hooks/useRedeemProduct.js.map +2 -2
  21. package/dist/esm/components/credits/context/hooks/useRedeemableList.js +1 -1
  22. package/dist/esm/components/credits/context/hooks/useRedeemableList.js.map +2 -2
  23. package/dist/esm/components/credits/context/hooks/useSendEmailValidation.js +1 -1
  24. package/dist/esm/components/credits/context/hooks/useSendEmailValidation.js.map +2 -2
  25. package/dist/esm/components/credits/context/hooks/useSubscribed.js +1 -1
  26. package/dist/esm/components/credits/context/hooks/useSubscribed.js.map +2 -2
  27. package/dist/esm/components/credits/context/hooks/useSubscriptions.js +1 -1
  28. package/dist/esm/components/credits/context/hooks/useSubscriptions.js.map +3 -3
  29. package/dist/esm/components/credits/creditsBanner/index.js +2 -0
  30. package/dist/esm/components/credits/creditsBanner/index.js.map +7 -0
  31. package/dist/esm/components/credits/creditsBenefits/benefitItem.js +2 -0
  32. package/dist/esm/components/credits/creditsBenefits/benefitItem.js.map +7 -0
  33. package/dist/esm/components/credits/creditsBenefits/iconInfo.js +2 -0
  34. package/dist/esm/components/credits/creditsBenefits/iconInfo.js.map +7 -0
  35. package/dist/esm/components/credits/creditsBenefits/index.js +4 -0
  36. package/dist/esm/components/credits/creditsBenefits/index.js.map +7 -0
  37. package/dist/esm/components/credits/creditsCash/RedeemableItem.js +2 -0
  38. package/dist/esm/components/credits/creditsCash/RedeemableItem.js.map +7 -0
  39. package/dist/esm/components/credits/creditsCash/index.js +2 -0
  40. package/dist/esm/components/credits/creditsCash/index.js.map +7 -0
  41. package/dist/esm/components/credits/creditsCash/type.js +1 -0
  42. package/dist/esm/components/credits/creditsCash/type.js.map +7 -0
  43. package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js +2 -0
  44. package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js.map +7 -0
  45. package/dist/esm/components/credits/creditsFaq/index.js +2 -0
  46. package/dist/esm/components/credits/creditsFaq/index.js.map +7 -0
  47. package/dist/esm/components/credits/creditsInfoCard/index.js +2 -0
  48. package/dist/esm/components/credits/creditsInfoCard/index.js.map +7 -0
  49. package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +2 -0
  50. package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +7 -0
  51. package/dist/esm/components/credits/creditsRedeemList/AddressForm/FormItem.js +2 -0
  52. package/dist/esm/components/credits/creditsRedeemList/AddressForm/FormItem.js.map +7 -0
  53. package/dist/esm/components/credits/creditsRedeemList/AddressForm/Input.js +2 -0
  54. package/dist/esm/components/credits/creditsRedeemList/AddressForm/Input.js.map +7 -0
  55. package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js +2 -0
  56. package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +7 -0
  57. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js +2 -0
  58. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js.map +7 -0
  59. package/dist/esm/components/credits/creditsRedeemList/AddressForm/type.js +1 -0
  60. package/dist/esm/components/credits/creditsRedeemList/AddressForm/type.js.map +7 -0
  61. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js +2 -0
  62. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js.map +7 -0
  63. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js +2 -0
  64. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +7 -0
  65. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Error.js +2 -0
  66. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Error.js.map +7 -0
  67. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js +2 -0
  68. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +7 -0
  69. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +2 -0
  70. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +7 -0
  71. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js +2 -0
  72. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +7 -0
  73. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js +2 -0
  74. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +7 -0
  75. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +2 -0
  76. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +7 -0
  77. package/dist/esm/components/credits/creditsRedeemList/index.js +2 -0
  78. package/dist/esm/components/credits/creditsRedeemList/index.js.map +7 -0
  79. package/dist/esm/components/credits/creditsRedeemList/type.js +1 -0
  80. package/dist/esm/components/credits/creditsRedeemList/type.js.map +7 -0
  81. package/dist/esm/components/credits/creditsWaysToGetCredits/index.js +2 -0
  82. package/dist/esm/components/credits/creditsWaysToGetCredits/index.js.map +7 -0
  83. package/dist/esm/components/credits/creditsWaysToGetCredits/type.js +2 -0
  84. package/dist/esm/components/credits/creditsWaysToGetCredits/type.js.map +7 -0
  85. package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js +2 -0
  86. package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js.map +7 -0
  87. package/dist/esm/components/credits/modal/loadingDots.js +1 -1
  88. package/dist/esm/components/credits/modal/loadingDots.js.map +2 -2
  89. package/dist/esm/debug-env.js +2 -0
  90. package/dist/esm/debug-env.js.map +7 -0
  91. package/dist/esm/stories/chat.stories.js +2 -0
  92. package/dist/esm/stories/chat.stories.js.map +7 -0
  93. package/package.json +3 -1
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/components/credits/creditsBenefits/benefitItem.tsx"],
4
+ "sourcesContent": ["import { Heading, Picture, Text } from '@anker-in/headless-ui'\nimport { cn } from '../../../helpers/utils'\nimport IconInfo from './iconInfo'\n\nexport interface BenefitItemCopy {\n icon: {\n alt: string\n url: string\n }\n text: string\n note?: string\n tag?: string\n}\nconst BenefitItem = ({\n item,\n handleClick,\n isNoteActive,\n index,\n}: {\n item: BenefitItemCopy\n handleClick: ({ item, index }: { item: BenefitItemCopy; index: number }) => void\n isNoteActive: boolean\n index: number\n}) => {\n return (\n <div\n className=\"relative h-full rounded-[16px] border border-white px-[24px] pb-[26px] pt-[24px] md:min-h-[180px] md:p-[16px]\"\n style={{\n background: 'linear-gradient(119.61deg, #FAFAFA 38.58%, #FFFFFF 63.73%, #F9FCFF 89.37%)',\n }}\n >\n <div className=\"flex flex-col\">\n <Picture\n className=\"mb-[16px] size-[31px] md:absolute md:bottom-[16px] md:right-[16px] md:mb-0\"\n alt={item.icon?.alt}\n source={item.icon?.url}\n />\n <div className=\"flex items-center\">\n <Heading html={item.text} size=\"2\" className=\"break-all\" />\n {item.note && (\n <div\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n className=\"relative mb-1 ml-[4px]\"\n onClick={() => handleClick({ item, index })}\n >\n <IconInfo />\n <div\n className={cn(\n 'absolute -bottom-[12px] left-[32px] z-10 w-[356px] -translate-x-full translate-y-full md:w-[276px]',\n isNoteActive ? 'block' : 'hidden'\n )}\n >\n <div className=\"relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow\">\n <Text as=\"p\" size=\"2\" html={item.note} className=\"desktop:text-[18px]\" />\n <div className=\"absolute -top-[10px] right-[9px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]\" />\n </div>\n </div>\n </div>\n )}\n </div>\n {item.tag && <Text as=\"div\" html={item.tag} className=\"mt-[2px] text-[16px] font-bold text-[#6D6D6F]\" />}\n </div>\n </div>\n )\n}\n\nexport default BenefitItem\n"],
5
+ "mappings": "AAgCQ,cAAAA,EA0BQ,QAAAC,MA1BR,oBAhCR,OAAS,WAAAC,EAAS,WAAAC,EAAS,QAAAC,MAAY,wBACvC,OAAS,MAAAC,MAAU,yBACnB,OAAOC,MAAc,aAWrB,MAAMC,EAAc,CAAC,CACnB,KAAAC,EACA,YAAAC,EACA,aAAAC,EACA,MAAAC,CACF,IAOIX,EAAC,OACC,UAAU,gHACV,MAAO,CACL,WAAY,4EACd,EAEA,SAAAC,EAAC,OAAI,UAAU,gBACb,UAAAD,EAACG,EAAA,CACC,UAAU,6EACV,IAAKK,EAAK,MAAM,IAChB,OAAQA,EAAK,MAAM,IACrB,EACAP,EAAC,OAAI,UAAU,oBACb,UAAAD,EAACE,EAAA,CAAQ,KAAMM,EAAK,KAAM,KAAK,IAAI,UAAU,YAAY,EACxDA,EAAK,MACJP,EAAC,OACC,KAAK,SACL,SAAU,EACV,UAAWW,GAAK,EACVA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,MACjCA,EAAE,eAAe,CAErB,EACA,UAAU,yBACV,QAAS,IAAMH,EAAY,CAAE,KAAAD,EAAM,MAAAG,CAAM,CAAC,EAE1C,UAAAX,EAACM,EAAA,EAAS,EACVN,EAAC,OACC,UAAWK,EACT,qGACAK,EAAe,QAAU,QAC3B,EAEA,SAAAT,EAAC,OAAI,UAAU,0FACb,UAAAD,EAACI,EAAA,CAAK,GAAG,IAAI,KAAK,IAAI,KAAMI,EAAK,KAAM,UAAU,sBAAsB,EACvER,EAAC,OAAI,UAAU,mHAAmH,GACpI,EACF,GACF,GAEJ,EACCQ,EAAK,KAAOR,EAACI,EAAA,CAAK,GAAG,MAAM,KAAMI,EAAK,IAAK,UAAU,gDAAgD,GACxG,EACF,EAIJ,IAAOK,EAAQN",
6
+ "names": ["jsx", "jsxs", "Heading", "Picture", "Text", "cn", "IconInfo", "BenefitItem", "item", "handleClick", "isNoteActive", "index", "e", "benefitItem_default"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{jsx as C,jsxs as o}from"react/jsx-runtime";const l=()=>o("svg",{xmlns:"http://www.w3.org/2000/svg",className:"size-[18px] cursor-pointer [&_svg]:size-full",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[C("path",{d:"M9 1.125C11.1744 1.125 13.1441 2.00737 14.5684 3.43164C15.9926 4.85593 16.875 6.8256 16.875 9C16.875 11.1744 15.9926 13.1441 14.5684 14.5684C13.1441 15.9926 11.1744 16.875 9 16.875C6.8256 16.875 4.85593 15.9926 3.43164 14.5684C2.00737 13.1441 1.125 11.1744 1.125 9C1.125 6.8256 2.00738 4.85593 3.43164 3.43164C4.85593 2.00738 6.8256 1.125 9 1.125ZM9 2.625C7.23941 2.625 5.64668 3.33772 4.49219 4.49219C3.33772 5.64668 2.625 7.23941 2.625 9C2.625 10.7606 3.33772 12.3533 4.49219 13.5078C5.64668 14.6623 7.23941 15.375 9 15.375C10.7606 15.375 12.3533 14.6623 13.5078 13.5078C14.6623 12.3533 15.375 10.7606 15.375 9C15.375 7.23941 14.6623 5.64668 13.5078 4.49219C12.3533 3.33772 10.7606 2.625 9 2.625Z",fill:"#6D6D6F"}),C("path",{d:"M9 11.583C9.51777 11.583 9.9375 12.0027 9.9375 12.5205V12.5596C9.93718 13.0771 9.51757 13.4971 9 13.4971C8.48243 13.4971 8.06282 13.0771 8.0625 12.5596V12.5205C8.0625 12.0027 8.48223 11.583 9 11.583ZM8.99902 4.5C9.51671 4.49959 9.93696 4.91886 9.9375 5.43652L9.94043 9.37109C9.94084 9.88884 9.52165 10.3091 9.00391 10.3096C8.48616 10.31 8.06587 9.89079 8.06543 9.37305L8.0625 5.43848C8.06209 4.92079 8.48136 4.50054 8.99902 4.5Z",fill:"#6D6D6F"})]});var s=l;export{l as IconInfo,s as default};
2
+ //# sourceMappingURL=iconInfo.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/components/credits/creditsBenefits/iconInfo.tsx"],
4
+ "sourcesContent": ["export const IconInfo = () => {\n return (\n <svg\n xmlns='http://www.w3.org/2000/svg'\n className='size-[18px] cursor-pointer [&_svg]:size-full'\n width='18'\n height='18'\n viewBox='0 0 18 18'\n fill='none'\n >\n <path\n d='M9 1.125C11.1744 1.125 13.1441 2.00737 14.5684 3.43164C15.9926 4.85593 16.875 6.8256 16.875 9C16.875 11.1744 15.9926 13.1441 14.5684 14.5684C13.1441 15.9926 11.1744 16.875 9 16.875C6.8256 16.875 4.85593 15.9926 3.43164 14.5684C2.00737 13.1441 1.125 11.1744 1.125 9C1.125 6.8256 2.00738 4.85593 3.43164 3.43164C4.85593 2.00738 6.8256 1.125 9 1.125ZM9 2.625C7.23941 2.625 5.64668 3.33772 4.49219 4.49219C3.33772 5.64668 2.625 7.23941 2.625 9C2.625 10.7606 3.33772 12.3533 4.49219 13.5078C5.64668 14.6623 7.23941 15.375 9 15.375C10.7606 15.375 12.3533 14.6623 13.5078 13.5078C14.6623 12.3533 15.375 10.7606 15.375 9C15.375 7.23941 14.6623 5.64668 13.5078 4.49219C12.3533 3.33772 10.7606 2.625 9 2.625Z'\n fill='#6D6D6F'\n />\n <path\n d='M9 11.583C9.51777 11.583 9.9375 12.0027 9.9375 12.5205V12.5596C9.93718 13.0771 9.51757 13.4971 9 13.4971C8.48243 13.4971 8.06282 13.0771 8.0625 12.5596V12.5205C8.0625 12.0027 8.48223 11.583 9 11.583ZM8.99902 4.5C9.51671 4.49959 9.93696 4.91886 9.9375 5.43652L9.94043 9.37109C9.94084 9.88884 9.52165 10.3091 9.00391 10.3096C8.48616 10.31 8.06587 9.89079 8.06543 9.37305L8.0625 5.43848C8.06209 4.92079 8.48136 4.50054 8.99902 4.5Z'\n fill='#6D6D6F'\n />\n </svg>\n )\n}\n\nexport default IconInfo\n"],
5
+ "mappings": "AAEI,OAQE,OAAAA,EARF,QAAAC,MAAA,oBAFG,MAAMC,EAAW,IAEpBD,EAAC,OACC,MAAM,6BACN,UAAU,+CACV,MAAM,KACN,OAAO,KACP,QAAQ,YACR,KAAK,OAEL,UAAAD,EAAC,QACC,EAAE,6rBACF,KAAK,UACP,EACAA,EAAC,QACC,EAAE,+aACF,KAAK,UACP,GACF,EAIJ,IAAOG,EAAQD",
6
+ "names": ["jsx", "jsxs", "IconInfo", "iconInfo_default"]
7
+ }
@@ -0,0 +1,4 @@
1
+ import{jsx as t,jsxs as a}from"react/jsx-runtime";import"swiper/css";import"swiper/css/grid";import"swiper/css/pagination";import{Container as d,Heading as c}from"@anker-in/headless-ui";import{useState as u}from"react";import{Grid as f,Pagination as g}from"swiper/modules";import{Swiper as v,SwiperSlide as b}from"swiper/react";import l from"./benefitItem";import{useCreditsContext as w}from"../context/provider";import{gaTrack as C}from"../../../helpers/track";import{cn as x}from"../../../helpers/utils";const G=({copy:o})=>{const[n,r]=u(null),{profile:p,gtm:m}=w(),s=({item:i,index:e})=>{C({event:"ga4Event",event_name:"lp_button",member_active_status:p?.activated?"active":"not active",event_parameters:{page_group:m.pageGroup,position:o.title,button_name:i.text,info:""}}),n===e?r(null):(r(e),setTimeout(()=>{r(null)},5e3))};return a(d,{id:"benefits",className:"!z-[30] bg-[#F5F5F7]",children:[t(c,{as:"h2",size:"4",html:o?.title}),t("div",{className:"mt-[24px] grid grid-cols-2 gap-[16px] l:hidden min-md:grid-cols-3 min-xl:grid-cols-4",children:o.benefits.map((i,e)=>t(l,{item:i,handleClick:s,isNoteActive:n===e,index:e},e))}),a("div",{className:"mt-[24px] hidden l:block",children:[t(v,{spaceBetween:16,slidesPerView:2,slidesPerGroup:2,grid:{rows:2,fill:"row"},breakpoints:{768:{slidesPerView:3,slidesPerGroup:3}},wrapperClass:"items-stretch",modules:[f,g],pagination:{clickable:!0,el:"#benefits-pagination",renderBullet(i,e){return`<div class='${e} !flex justify-center size-[8px] rounded-full bg-[#D9D9D9] cursor-pointer items-center'>
2
+ </div>`}},children:o.benefits.map((i,e)=>t(b,{className:x("!h-auto",n===e&&"!z-[100]"),children:t(l,{item:i,handleClick:s,isNoteActive:n===e,index:e})},e))}),t("div",{id:"benefits-pagination",className:`mx-auto mt-[12px] grid !w-fit grid-flow-col [&_.swiper-pagination-bullet-active>div]:!bg-[#151515]
3
+ [&_.swiper-pagination-bullet]:cursor-pointer [&_.swiper-pagination-bullet]:rounded-full`})]}),n&&t("div",{role:"button",tabIndex:0,className:"fixed inset-0 z-10",onClick:()=>r(null),onKeyDown:i=>i.key==="Escape"&&r(null)})]})};export{G as CreditsBenefits};
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/components/credits/creditsBenefits/index.tsx"],
4
+ "sourcesContent": ["import 'swiper/css'\nimport 'swiper/css/grid'\nimport 'swiper/css/pagination'\n\nimport { Container, Heading } from '@anker-in/headless-ui'\nimport { useState } from 'react'\nimport { Grid, Pagination } from 'swiper/modules'\nimport { Swiper, SwiperSlide } from 'swiper/react'\n\nimport BenefitItem, { type BenefitItemCopy } from './benefitItem'\nimport { useCreditsContext } from '../context/provider'\nimport { gaTrack } from '../../../helpers/track'\nimport { cn } from '../../../helpers/utils'\n\ninterface CreditsBenefitsProps {\n copy: {\n title: string\n benefits: BenefitItemCopy[]\n }\n}\n\nexport const CreditsBenefits = ({ copy }: CreditsBenefitsProps) => {\n const [activeNoteIndex, setActiveNoteIndex] = useState<number | null>(null)\n const { profile, gtm } = useCreditsContext()\n\n const handleClick = ({ item, index }: { item: BenefitItemCopy; index: number }) => {\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: copy.title,\n button_name: item.text,\n info: '',\n },\n })\n if (activeNoteIndex === index) {\n setActiveNoteIndex(null)\n } else {\n setActiveNoteIndex(index)\n setTimeout(() => {\n setActiveNoteIndex(null)\n }, 5000)\n }\n }\n\n return (\n <Container id=\"benefits\" className=\"!z-[30] bg-[#F5F5F7]\">\n <Heading as=\"h2\" size=\"4\" html={copy?.title} />\n <div className=\"mt-[24px] grid grid-cols-2 gap-[16px] l:hidden min-md:grid-cols-3 min-xl:grid-cols-4\">\n {copy.benefits.map((item, index) => (\n <BenefitItem\n key={index}\n item={item}\n handleClick={handleClick}\n isNoteActive={activeNoteIndex === index}\n index={index}\n />\n ))}\n </div>\n <div className=\"mt-[24px] hidden l:block\">\n <Swiper\n spaceBetween={16}\n slidesPerView={2}\n slidesPerGroup={2}\n grid={{\n rows: 2,\n fill: 'row',\n }}\n breakpoints={{\n 768: {\n slidesPerView: 3,\n slidesPerGroup: 3,\n },\n }}\n wrapperClass=\"items-stretch\"\n modules={[Grid, Pagination]}\n pagination={{\n clickable: true,\n el: '#benefits-pagination',\n renderBullet(index, className) {\n return `<div class='${className} !flex justify-center size-[8px] rounded-full bg-[#D9D9D9] cursor-pointer items-center'>\n </div>`\n },\n }}\n >\n {copy.benefits.map((item, index) => (\n <SwiperSlide key={index} className={cn('!h-auto', activeNoteIndex === index && '!z-[100]')}>\n <BenefitItem\n item={item}\n handleClick={handleClick}\n isNoteActive={activeNoteIndex === index}\n index={index}\n />\n </SwiperSlide>\n ))}\n </Swiper>\n <div\n id=\"benefits-pagination\"\n className=\"mx-auto mt-[12px] grid !w-fit grid-flow-col [&_.swiper-pagination-bullet-active>div]:!bg-[#151515] \n [&_.swiper-pagination-bullet]:cursor-pointer [&_.swiper-pagination-bullet]:rounded-full\"\n ></div>\n </div>\n\n {activeNoteIndex && (\n <div\n role=\"button\"\n tabIndex={0}\n className=\"fixed inset-0 z-10\"\n onClick={() => setActiveNoteIndex(null)}\n onKeyDown={e => e.key === 'Escape' && setActiveNoteIndex(null)}\n />\n )}\n </Container>\n )\n}\n"],
5
+ "mappings": "AAiDM,cAAAA,EAYA,QAAAC,MAZA,oBAjDN,MAAO,aACP,MAAO,kBACP,MAAO,wBAEP,OAAS,aAAAC,EAAW,WAAAC,MAAe,wBACnC,OAAS,YAAAC,MAAgB,QACzB,OAAS,QAAAC,EAAM,cAAAC,MAAkB,iBACjC,OAAS,UAAAC,EAAQ,eAAAC,MAAmB,eAEpC,OAAOC,MAA2C,gBAClD,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,WAAAC,MAAe,yBACxB,OAAS,MAAAC,MAAU,yBASZ,MAAMC,EAAkB,CAAC,CAAE,KAAAC,CAAK,IAA4B,CACjE,KAAM,CAACC,EAAiBC,CAAkB,EAAIZ,EAAwB,IAAI,EACpE,CAAE,QAAAa,EAAS,IAAAC,CAAI,EAAIR,EAAkB,EAErCS,EAAc,CAAC,CAAE,KAAAC,EAAM,MAAAC,CAAM,IAAgD,CACjFV,EAAQ,CACN,MAAO,WACP,WAAY,YACZ,qBAAsBM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EACtC,UAAWO,GAAKA,EAAE,MAAQ,UAAYP,EAAmB,IAAI,EAC/D,GAEJ,CAEJ",
6
+ "names": ["jsx", "jsxs", "Container", "Heading", "useState", "Grid", "Pagination", "Swiper", "SwiperSlide", "BenefitItem", "useCreditsContext", "gaTrack", "cn", "CreditsBenefits", "copy", "activeNoteIndex", "setActiveNoteIndex", "profile", "gtm", "handleClick", "item", "index", "className", "e"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{jsx as i,jsxs as a}from"react/jsx-runtime";import{Button as y,Text as u,Picture as v}from"@anker-in/headless-ui";import{useMemo as p}from"react";import{cn as d}from"../../../helpers";import{useCreditsContext as k}from"../context/provider";import{useRedeemAndBuy as R}from"../context/hooks/useRedeemAndBuy";import{numberFormat as V}from"../context/utils";import{gaTrack as g}from"../../../helpers/track";function F({copy:t,itemData:e,setRules:b,className:h,authCodeActivate:o}){const{creditInfo:m,profile:r,openSignUpPopup:_,gtm:{pageGroup:x}}=k(),{trigger:f,isMutating:C}=R(),n=p(()=>!!r,[r?.activated]),s=p(()=>n&&r?.activated&&e.alpcData?.consumeCredits>Number(m?.available_credit||0),[n,r?.activated,e.alpcData?.consumeCredits,m?.available_credit]),N=p(()=>!!(e.alpcData?.remainingInventory<=0&&e.alpcData?.isLimited||!e.productVariant?.availableForSale||s),[e.alpcData?.remainingInventory,e.alpcData?.isLimited,e.productVariant?.availableForSale,s]),w=()=>{if(!n)_();else if(!r?.activated&&!(o.isSendingActivateEmail||o.isSuccess))o.openAuthCodePopup(),o.setOnSuccess(async()=>{const{success:l,url:S,error:I}=await f({productVariant:e?.productVariant,redeemId:e?.config?.redeemId});l?window.open(S,"_blank"):console.error(I)});else{try{f({productVariant:e?.productVariant,redeemId:e?.config?.redeemId})}catch{}g({event:"ga4Event",event_name:"lp_button",member_active_status:r?.activated?"active":"not active",event_parameters:{page_group:x,position:t.title,button_name:c,info:e?.alpcData?.id?.toString()}})}},c=p(()=>e.productVariant?.availableForSale?n?t.btnRedeem:t.unlockRewards:t?.soldOut||"Sold Out",[n,e.productVariant?.availableForSale,t.btnRedeem,t.unlockRewards,t?.soldOut]);return a("div",{className:d("flex flex-col items-center rounded-[16px] bg-[#EAEAEC] p-[24px] md:rounded-[12px] md:px-[8px] xl:py-[16px] md-xl:px-[16px]",h),children:[i("div",{className:d("relative mx-auto h-[224px] w-fit l:h-[120px] l-xxl:h-[138px]"),children:i(v,{className:"mx-auto h-full w-auto",imgClassName:"h-full object-contain",source:e?.config?.image?.url||e?.productVariant?.metafields?.global?.transparentImg||e?.productVariant?.image?.url})}),a("div",{className:d("mt-[22px] w-full l:mt-[8px]"),children:[i(u,{html:e?.product?.title,title:e.config?.title||e.alpcData?.title||e.product?.title,size:2,className:"line-clamp-2 h-[58px] text-[24px] leading-[1.2] l:line-clamp-3 l:h-[56px] l:text-[16px] l-xxl:h-[48px] l-xxl:text-[20px]"}),e?.config?.rules?.split("<br>")?.length>0&&i("button",{type:"button",onClick:()=>{b(e?.config?.rules?.split("<br>")),g({event:"ga4Event",event_name:"lp_button",member_active_status:r?.activated?"active":"not active",event_parameters:{page_group:x,position:t.title,button_name:t?.ruleLabel,info:e?.alpcData?.id?.toString()}})},className:"mt-[8px] text-[16px] font-bold underline xxl:text-[14px]",tabIndex:0,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&l.preventDefault()},children:t?.ruleLabel}),a("div",{className:"mt-[24px] flex items-center l:mt-[12px] laptop:text-[16px] lg-desktop:text-[18px]",children:[i(v,{className:"size-[20px]",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/icon_hire_purchase.png?v=1757496783"}),i(u,{html:`${V(e?.alpcData?.consumeCredits)} + ${e?.config?.price}`,size:2,as:"p",className:"ml-[4px] text-[28px] font-bold leading-[1.2] md:text-[18px] l-xxl:text-[24px] md-l:text-[20px] "})]}),a("div",{className:"group relative w-full",children:[i(y,{disabled:N,variant:"primary",size:"lg",className:"mt-[8px] md:px-[10px] l:w-full",loading:C,onClick:()=>{w()},title:s?"Insufficient credit":c,children:c}),i("div",{className:d("absolute -bottom-[20px] left-0 z-10 w-[300px] translate-y-full opacity-0 transition-opacity group-hover:opacity-100 md:-bottom-[14px] md:w-[160px]",s?"block":"hidden"),children:a("div",{className:"relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow md:px-[10px] md:py-[8px]",children:[i(u,{as:"p",size:"2",html:t?.insufficientCredits,className:"text-[14px]"}),i("div",{className:"absolute -top-[10px] left-[48px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]"})]})})]})]})]})}var G=F;export{G as default};
2
+ //# sourceMappingURL=RedeemableItem.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/components/credits/creditsCash/RedeemableItem.tsx"],
4
+ "sourcesContent": ["import { Button, Text, Picture } from '@anker-in/headless-ui'\nimport { useMemo } from 'react'\nimport { cn } from '../../../helpers'\n\nimport { CreditsCashCopy, RedeemItem } from './type'\nimport { useCreditsContext } from '../context/provider'\nimport { useRedeemAndBuy } from '../context/hooks/useRedeemAndBuy'\nimport { numberFormat } from '../context/utils'\nimport { gaTrack } from '../../../helpers/track'\n\nfunction RedeemableItem({\n copy,\n itemData,\n setRules,\n className,\n authCodeActivate,\n}: {\n copy: CreditsCashCopy\n itemData: RedeemItem\n className?: string\n setRules: (rules: string[]) => void\n currencyCode: string\n authCodeActivate: {\n openAuthCodePopup: Function\n isSuccess: boolean\n setOnSuccess: (arg: Function) => void\n isSendingActivateEmail: boolean\n }\n}) {\n const {\n creditInfo,\n profile,\n openSignUpPopup,\n gtm: { pageGroup },\n } = useCreditsContext()\n const { trigger, isMutating } = useRedeemAndBuy()\n\n const isLogin = useMemo(() => {\n return !!profile\n }, [profile?.activated])\n\n const inSufficientCredit = useMemo(() => {\n return (\n isLogin && profile?.activated && itemData.alpcData?.consumeCredits > Number(creditInfo?.available_credit || 0)\n )\n }, [isLogin, profile?.activated, itemData.alpcData?.consumeCredits, creditInfo?.available_credit])\n\n const isDisabled = useMemo(() => {\n // \u5151\u6362\u9650\u5236\n if (itemData.alpcData?.remainingInventory <= 0 && itemData.alpcData?.isLimited) {\n return true\n }\n\n // \u5546\u54C1\u5E93\u5B58\u9650\u5236\n if (!itemData.productVariant?.availableForSale) {\n return true\n }\n\n // \u79EF\u5206\u4E0D\u8DB3\n if (inSufficientCredit) {\n return true\n }\n return false\n }, [\n itemData.alpcData?.remainingInventory,\n itemData.alpcData?.isLimited,\n itemData.productVariant?.availableForSale,\n inSufficientCredit,\n ])\n\n const handleRedeem = () => {\n if (!isLogin) {\n openSignUpPopup()\n } else if (!profile?.activated && !(authCodeActivate.isSendingActivateEmail || authCodeActivate.isSuccess)) {\n authCodeActivate.openAuthCodePopup()\n authCodeActivate.setOnSuccess(async () => {\n const { success, url, error } = await trigger({\n productVariant: itemData?.productVariant,\n redeemId: itemData?.config?.redeemId,\n })\n if (success) {\n window.open(url, '_blank')\n } else {\n console.error(error)\n }\n })\n } else {\n try {\n trigger({\n productVariant: itemData?.productVariant,\n redeemId: itemData?.config?.redeemId,\n })\n } catch (error) {}\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: pageGroup,\n position: copy.title,\n button_name: redeemButtonText,\n info: itemData?.alpcData?.id?.toString(),\n },\n })\n }\n }\n\n const redeemButtonText = useMemo(() => {\n // \u7F3A\u8D27\u6587\u6848\n if (!itemData.productVariant?.availableForSale) {\n return copy?.soldOut || 'Sold Out'\n } else if (!isLogin) {\n return copy.unlockRewards\n } else {\n return copy.btnRedeem\n }\n }, [isLogin, itemData.productVariant?.availableForSale, copy.btnRedeem, copy.unlockRewards, copy?.soldOut])\n\n return (\n <div\n className={cn(\n 'flex flex-col items-center rounded-[16px] bg-[#EAEAEC] p-[24px] md:rounded-[12px] md:px-[8px] xl:py-[16px] md-xl:px-[16px]',\n className\n )}\n >\n <div className={cn('relative mx-auto h-[224px] w-fit l:h-[120px] l-xxl:h-[138px]')}>\n <Picture\n className=\"mx-auto h-full w-auto\"\n imgClassName=\"h-full object-contain\"\n source={\n itemData?.config?.image?.url ||\n itemData?.productVariant?.metafields?.global?.transparentImg ||\n itemData?.productVariant?.image?.url\n }\n ></Picture>\n </div>\n <div className={cn('mt-[22px] w-full l:mt-[8px]')}>\n <Text\n html={itemData?.product?.title}\n title={itemData.config?.title || itemData.alpcData?.title || itemData.product?.title}\n size={2}\n className=\"line-clamp-2 h-[58px] text-[24px] leading-[1.2] l:line-clamp-3 l:h-[56px] l:text-[16px] l-xxl:h-[48px] l-xxl:text-[20px]\"\n />\n {itemData?.config?.rules?.split('<br>')?.length > 0 && (\n <button\n type=\"button\"\n onClick={() => {\n setRules(itemData?.config?.rules?.split('<br>'))\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: pageGroup,\n position: copy.title,\n button_name: copy?.ruleLabel,\n info: itemData?.alpcData?.id?.toString(),\n },\n })\n }}\n className=\"mt-[8px] text-[16px] font-bold underline xxl:text-[14px]\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {copy?.ruleLabel}\n </button>\n )}\n <div className=\"mt-[24px] flex items-center l:mt-[12px] laptop:text-[16px] lg-desktop:text-[18px]\">\n <Picture\n className=\"size-[20px]\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/icon_hire_purchase.png?v=1757496783\"\n />\n <Text\n html={`${numberFormat(itemData?.alpcData?.consumeCredits)} + ${itemData?.config?.price}`}\n size={2}\n as=\"p\"\n className=\"ml-[4px] text-[28px] font-bold leading-[1.2] md:text-[18px] l-xxl:text-[24px] md-l:text-[20px] \"\n />\n </div>\n\n <div className=\"group relative w-full\">\n <Button\n disabled={isDisabled}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[8px] md:px-[10px] l:w-full\"\n loading={isMutating}\n onClick={() => {\n handleRedeem()\n }}\n title={inSufficientCredit ? 'Insufficient credit' : redeemButtonText}\n >\n {redeemButtonText}\n </Button>\n <div\n className={cn(\n 'absolute -bottom-[20px] left-0 z-10 w-[300px] translate-y-full opacity-0 transition-opacity group-hover:opacity-100 md:-bottom-[14px] md:w-[160px]',\n inSufficientCredit ? 'block' : 'hidden'\n )}\n >\n <div className=\"relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow md:px-[10px] md:py-[8px]\">\n <Text as=\"p\" size=\"2\" html={copy?.insufficientCredits} className=\"text-[14px]\" />\n <div className=\"absolute -top-[10px] left-[48px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n )\n}\n\nexport default RedeemableItem\n"],
5
+ "mappings": "AA8HQ,cAAAA,EA6CA,QAAAC,MA7CA,oBA9HR,OAAS,UAAAC,EAAQ,QAAAC,EAAM,WAAAC,MAAe,wBACtC,OAAS,WAAAC,MAAe,QACxB,OAAS,MAAAC,MAAU,mBAGnB,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,mBAAAC,MAAuB,mCAChC,OAAS,gBAAAC,MAAoB,mBAC7B,OAAS,WAAAC,MAAe,yBAExB,SAASC,EAAe,CACtB,KAAAC,EACA,SAAAC,EACA,SAAAC,EACA,UAAAC,EACA,iBAAAC,CACF,EAYG,CACD,KAAM,CACJ,WAAAC,EACA,QAAAC,EACA,gBAAAC,EACA,IAAK,CAAE,UAAAC,CAAU,CACnB,EAAIb,EAAkB,EAChB,CAAE,QAAAc,EAAS,WAAAC,CAAW,EAAId,EAAgB,EAE1Ce,EAAUlB,EAAQ,IACf,CAAC,CAACa,EACR,CAACA,GAAS,SAAS,CAAC,EAEjBM,EAAqBnB,EAAQ,IAE/BkB,GAAWL,GAAS,WAAaL,EAAS,UAAU,eAAiB,OAAOI,GAAY,kBAAoB,C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ACA9B,EAAC,OACC,UAAWM,EACT,qJACAkB,EAAqB,QAAU,QACjC,EAEA,SAAAvB,EAAC,OAAI,UAAU,mHACb,UAAAD,EAACG,EAAA,CAAK,GAAG,IAAI,KAAK,IAAI,KAAMS,GAAM,oBAAqB,UAAU,cAAc,EAC/EZ,EAAC,OAAI,UAAU,mHAAmH,GACpI,EACF,GACF,GACF,GACF,CAEJ,CAEA,IAAOgC,EAAQrB",
6
+ "names": ["jsx", "jsxs", "Button", "Text", "Picture", "useMemo", "cn", "useCreditsContext", "useRedeemAndBuy", "numberFormat", "gaTrack", "RedeemableItem", "copy", "itemData", "setRules", "className", "authCodeActivate", "creditInfo", "profile", "openSignUpPopup", "pageGroup", "trigger", "isMutating", "isLogin", "inSufficientCredit", "isDisabled", "handleRedeem", "success", "url", "error", "redeemButtonText", "e", "RedeemableItem_default"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{jsx as n,jsxs as F}from"react/jsx-runtime";import{Container as h,Heading as b}from"@anker-in/headless-ui";import{useMemo as v,useState as y}from"react";import x from"./RedeemableItem";import N from"../context/hooks/useRedeemableList";import{cn as I}from"../../../helpers";import R from"../modal/rulesModal";import{useProductsByHandles as S}from"@anker-in/shopify";const z=({copy:s,className:c="",hideTitle:u=!1,cardClassName:p,authCodeActivate:C})=>{const[r,d]=y(),{redeemableList:m}=N(),f="us",g=[],{data:o}=S({locale:f,handles:s?.list?.map(e=>e.products?.[0]?.handle)||[],metafieldIdentifiers:{variant:g}}),l=v(()=>o?.map(e=>{const a=s.list.find(i=>i.products?.[0]?.handle===e.handle),t=m.find(i=>i.id?.toString()===a?.redeemId?.toString());return{product:e,productVariant:e.variants?.find(i=>i.sku===a?.products?.[0]?.sku)||e.variants?.[0],alpcData:{id:t?.id,consumeCredits:t?.consume_credits,remainingInventory:t?.remaining_inventory,isLimited:t?.is_limited,consumeType:t?.consume_type,title:t?.name,desc:t?.note},config:a}}),[o,s.list,m]);return console.log("list",l),F(h,{className:I("bg-[#F5F5F5]",c),children:[!u&&n(b,{as:"h2",size:"4",html:s.title}),n("div",{className:"relative mt-[24px] grid grid-cols-4 gap-[16px] md:grid-cols-2 md-xl:grid-cols-3",children:l?.map((e,a)=>n(x,{copy:s,itemData:e,setRules:d,className:p,currencyCode:o?.[0]?.price.currencyCode||"USD",authCodeActivate:C},a))}),r&&n(R,{overlayClassName:"md:px-[16px] md:items-center",className:"md:h-fit md:rounded-b-[16px]",isOpen:r.length>0,onClose:()=>d([]),titleClassName:"border-b-transparent h-[56px]",rules:r,scrollClassName:"md:mt-[8px] md:mb-[24px] md:pt-0",title:s?.ruleLabel,ruleClassName:"text-[#1d1d1f] font-bold"})]})};export{z as CreditsCash};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/components/credits/creditsCash/index.tsx"],
4
+ "sourcesContent": ["import { Container, Heading } from '@anker-in/headless-ui'\nimport { useMemo, useState } from 'react'\n\nimport RedeemableItem from './RedeemableItem'\nimport useRedeemableList from '../context/hooks/useRedeemableList'\nimport { cn } from '../../../helpers'\nimport RulesModal from '../modal/rulesModal'\nimport { useProductsByHandles } from '@anker-in/shopify'\nimport { CreditsCashCopy, RedeemItem } from './type'\nimport { Product } from '@anker-in/shopify'\n\nexport const CreditsCash = ({\n copy,\n className = '',\n hideTitle = false,\n cardClassName,\n authCodeActivate,\n}: {\n copy: CreditsCashCopy\n className?: string\n hideTitle?: boolean\n cardClassName?: string\n authCodeActivate: {\n openAuthCodePopup: Function\n isSuccess: boolean\n setOnSuccess: (arg: Function) => void\n isSendingActivateEmail: boolean\n }\n}) => {\n const [rules, setRules] = useState<string | string[]>()\n const { redeemableList } = useRedeemableList()\n\n // Temporary variables until proper configuration\n const locale = 'us'\n const variantMetafieldIdentifiers: any[] = []\n\n const { data: productByHandles } = useProductsByHandles({\n locale,\n handles: copy?.list?.map(item => item.products?.[0]?.handle) || [],\n metafieldIdentifiers: {\n variant: variantMetafieldIdentifiers,\n },\n })\n\n const list = useMemo(() => {\n return productByHandles?.map((product: Product) => {\n const config = copy.list.find(item => item.products?.[0]?.handle === product.handle)\n const alpcData = redeemableList.find(item => item.id?.toString() === config?.redeemId?.toString())\n\n return {\n product,\n productVariant:\n product.variants?.find((variant: any) => variant.sku === config?.products?.[0]?.sku) || product.variants?.[0],\n alpcData: {\n id: alpcData?.id,\n consumeCredits: alpcData?.consume_credits,\n remainingInventory: alpcData?.remaining_inventory,\n isLimited: alpcData?.is_limited,\n consumeType: alpcData?.consume_type,\n title: alpcData?.name,\n desc: alpcData?.note,\n },\n config,\n }\n }) as unknown as RedeemItem[]\n }, [productByHandles, copy.list, redeemableList])\n\n console.log('list', list)\n\n return (\n <Container className={cn('bg-[#F5F5F5]', className)}>\n {!hideTitle && <Heading as=\"h2\" size=\"4\" html={copy.title} />}\n <div className=\"relative mt-[24px] grid grid-cols-4 gap-[16px] md:grid-cols-2 md-xl:grid-cols-3\">\n {list?.map((item, index: number) => (\n <RedeemableItem\n key={index}\n copy={copy}\n itemData={item}\n setRules={setRules}\n className={cardClassName}\n currencyCode={productByHandles?.[0]?.price.currencyCode || 'USD'}\n authCodeActivate={authCodeActivate}\n />\n ))}\n </div>\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": "AAsEI,OACiB,OAAAA,EADjB,QAAAC,MAAA,oBAtEJ,OAAS,aAAAC,EAAW,WAAAC,MAAe,wBACnC,OAAS,WAAAC,EAAS,YAAAC,MAAgB,QAElC,OAAOC,MAAoB,mBAC3B,OAAOC,MAAuB,qCAC9B,OAAS,MAA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S,EAAK,MAAO,EAC3DZ,EAAC,OAAI,UAAU,kFACZ,SAAAwB,GAAM,IAAI,CAACD,EAAMM,IAChB7B,EAACM,EAAA,CAEC,KAAMM,EACN,SAAUW,EACV,SAAUL,EACV,UAAWH,EACX,aAAcO,IAAmB,CAAC,GAAG,MAAM,cAAgB,MAC3D,iBAAkBN,GANba,CAOP,CACD,EACH,EAECZ,GACCjB,EAACS,EAAA,CACC,iBAAiB,+BACjB,UAAU,+BACV,OAAQQ,EAAM,OAAS,EACvB,QAAS,IAAMC,EAAS,CAAC,CAAC,EAC1B,eAAe,gCACf,MAAOD,EACP,gBAAgB,mCAChB,MAAOL,GAAM,UACb,cAAc,2BAChB,GAEJ,CAEJ",
6
+ "names": ["jsx", "jsxs", "Container", "Heading", "useMemo", "useState", "RedeemableItem", "useRedeemableList", "cn", "RulesModal", "useProductsByHandles", "CreditsCash", "copy", "className", "hideTitle", "cardClassName", "authCodeActivate", "rules", "setRules", "redeemableList", "locale", "variantMetafieldIdentifiers", "productByHandles", "item", "list", "product", "config", "alpcData", "variant", "index"]
7
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ import{jsx as t,jsxs as x}from"react/jsx-runtime";import{Heading as f,Text as l}from"@anker-in/headless-ui";import{ChevronDownIcon as b}from"@heroicons/react/24/outline";import{cn as e}from"../../../../helpers/index";import{motion as c}from"framer-motion";import{useEffect as u,useState as v}from"react";const k=({index:a,question:n,answer:o,showDots:s,itemRightIconRender:p,defaultExpended:m=!1})=>{const[r,d]=v(m);return u(()=>{a==0&&d(!0),n||d(!0)},[a,n]),x("div",{className:e("relative mx-0 border-b-[1px] border-[#e4e5e6] py-[24px] l:py-[16px]"),children:[x("div",{className:"relative flex items-center",onClick:()=>{d(!r)},role:"button",tabIndex:0,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&i.preventDefault()},children:[t(f,{html:n,as:"h3",className:e(s?'before:absolute before:left-[-15px] before:top-[8px] before:h-[6px] before:w-[6px] before:rounded-[50%] before:bg-[#000] before:content-[""]':"","relative block flex-1 cursor-pointer pr-[10px] text-[18px] font-bold text-[#1D1D1F] l:text-[16px]")}),p?p({expanded:r}):t(b,{className:e("size-[16px] shrink-0 cursor-pointer stroke-[2.5px] transition-all",r?"rotate-180":"")})]}),t(c.div,{initial:!1,animate:{height:r?"auto":0},className:"overflow-hidden [&_td]:border [&_td]:border-[#333] [&_td]:px-[8px] [&_td]:py-[4px]",children:o?.toString()?.includes("https://www.youtube.com")?t(l,{as:"div",className:e("mt-[8px]"),"data-ratio":"16:9","data-content":o,html:o?.toString()}):t(l,{as:"div",html:o?.toString(),className:e("mt-[8px] text-[16px] font-bold leading-[1.5] text-[#3D3D3F] l:text-[14px] [&_a]:text-brand [&_a]:underline")})})]},a)};export{k as FaqItem};
2
+ //# sourceMappingURL=FaqItem.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/creditsFaq/faqItem/FaqItem.tsx"],
4
+ "sourcesContent": ["import { Heading, Text } from '@anker-in/headless-ui'\nimport { ChevronDownIcon } from '@heroicons/react/24/outline'\nimport { cn } from '../../../../helpers/index'\nimport { motion } from 'framer-motion'\nimport { type ReactNode, useEffect, useState } from 'react'\n\ntype FaqItemProps = {\n index: number\n question?: string\n answer?: string | number\n showDots: boolean\n itemRightIconRender?: ({ expanded }: { expanded: boolean }) => ReactNode\n defaultExpended?: boolean\n}\n\nexport const FaqItem = ({\n index,\n question,\n answer,\n showDots,\n itemRightIconRender,\n defaultExpended = false,\n}: FaqItemProps) => {\n const [expanded, setExpanded] = useState(defaultExpended)\n useEffect(() => {\n if (index == 0) {\n setExpanded(true)\n }\n if (!question) {\n setExpanded(true)\n }\n }, [index, question])\n\n return (\n <div key={index} className={cn('relative mx-0 border-b-[1px] border-[#e4e5e6] py-[24px] l:py-[16px]')}>\n <div\n className='relative flex items-center'\n onClick={() => {\n setExpanded(!expanded)\n }}\n role='button'\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n <Heading\n html={question}\n as='h3'\n className={cn(\n showDots\n ? 'before:absolute before:left-[-15px] before:top-[8px] before:h-[6px] before:w-[6px] before:rounded-[50%] before:bg-[#000] before:content-[\"\"]'\n : '',\n 'relative block flex-1 cursor-pointer pr-[10px] text-[18px] font-bold text-[#1D1D1F] l:text-[16px]',\n )}\n ></Heading>\n {itemRightIconRender ? (\n itemRightIconRender({ expanded })\n ) : (\n <ChevronDownIcon\n className={cn(\n 'size-[16px] shrink-0 cursor-pointer stroke-[2.5px] transition-all',\n expanded ? 'rotate-180' : '',\n )}\n />\n )}\n </div>\n <motion.div\n initial={false}\n animate={{ height: !expanded ? 0 : 'auto' }}\n className='overflow-hidden [&_td]:border [&_td]:border-[#333] [&_td]:px-[8px] [&_td]:py-[4px]'\n >\n {answer?.toString()?.includes('https://www.youtube.com') ? (\n <Text\n as='div'\n className={cn('mt-[8px]')}\n data-ratio='16:9'\n data-content={answer}\n html={answer?.toString()}\n ></Text>\n ) : (\n <Text\n as='div'\n html={answer?.toString()}\n className={cn(\n 'mt-[8px] text-[16px] font-bold leading-[1.5] text-[#3D3D3F] l:text-[14px] [&_a]:text-brand [&_a]:underline',\n )}\n ></Text>\n )}\n </motion.div>\n </div>\n )\n}\n"],
5
+ "mappings": "AAmCM,OAaE,OAAAA,EAbF,QAAAC,MAAA,oBAnCN,OAAS,WAAAC,EAAS,QAAAC,MAAY,wBAC9B,OAAS,mBAAAC,MAAuB,8BAChC,OAAS,MAAAC,MAAU,4BACnB,OAAS,UAAAC,MAAc,gBACvB,OAAyB,aAAAC,EAAW,YAAAC,MAAgB,QAW7C,MAAMC,EAAU,CAAC,CACtB,MAAAC,EACA,SAAAC,EACA,OAAAC,EACA,SAAAC,EACA,oBAAAC,EACA,gBAAAC,EAAkB,EACpB,IAAoB,CAClB,KAAM,CAACC,EAAUC,CAAW,EAAIT,EAASO,CAAe,EACxD,OAAAR,EAAU,IAAM,CACVG,GAAS,GACXO,EAAY,EAAI,EAEbN,GACHM,EAAY,EAAI,CAEpB,EAAG,CAACP,EAAOC,CAAQ,CAAC,EAGlBV,EAAC,OAAgB,UAAWI,EAAG,sEAAsE,EACnG,UAAAJ,EAAC,OACC,UAAU,6BACV,QAAS,IAAM,CACbgB,EAAY,CAACD,CAAQ,CACvB,EACA,KAAK,SACL,SAAU,EACV,UAAYE,GAAM,EACZA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,MACjCA,EAAE,eAAe,CAErB,EAEA,UAAAlB,EAACE,EAAA,CACC,KAAMS,EACN,GAAG,KACH,UAAWN,EACTQ,EACI,+IACA,GACJ,mGACF,EACD,EACAC,EACCA,EAAoB,CAAE,SAAAE,CAAS,CAAC,EAEhChB,EAACI,EAAA,CACC,UAAWC,EACT,oEACAW,EAAW,aAAe,EAC5B,EACF,GAEJ,EACAhB,EAACM,EAAO,IAAP,CACC,QAAS,GACT,QAAS,CAAE,OAASU,EAAe,OAAJ,CAAW,EAC1C,UAAU,qFAET,SAAAJ,GAAQ,SAAS,GAAG,SAAS,yBAAyB,EACrDZ,EAACG,EAAA,CACC,GAAG,MACH,UAAWE,EAAG,UAAU,EACxB,aAAW,OACX,eAAcO,EACd,KAAMA,GAAQ,SAAS,EACxB,EAEDZ,EAACG,EAAA,CACC,GAAG,MACH,KAAMS,GAAQ,SAAS,EACvB,UAAWP,EACT,4GACF,EACD,EAEL,IAzDQK,CA0DV,CAEJ",
6
+ "names": ["jsx", "jsxs", "Heading", "Text", "ChevronDownIcon", "cn", "motion", "useEffect", "useState", "FaqItem", "index", "question", "answer", "showDots", "itemRightIconRender", "defaultExpended", "expanded", "setExpanded", "e"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{jsx as t,jsxs as v}from"react/jsx-runtime";import{Container as u,Heading as b,Tabs as p,TabsList as x,TabsTrigger as c,Text as d}from"@anker-in/headless-ui";import{cn as T}from"../../../helpers/index";import{useMemo as o,useState as h}from"react";import{FaqItem as q}from"./faqItem/FaqItem";const C=({copy:a})=>{const{title:m,items:r,subTitle:i=""}=a||{},n=o(()=>Array.from(new Set(r?.map?.(e=>e.category_name).filter(e=>!!e))),[r]),[l,g]=h(n[0]?.toString()||""),f=o(()=>r?n.length?r.filter(e=>e?.category_name===l):r:[],[r,n.length,l]);return v(u,{className:"bg-[#F5F5F7]",id:"faq",children:[m&&t(b,{as:"h2",size:"4",html:a?.title}),i&&t("div",{className:"mt-[8px] flex flex-row",children:t(d,{size:"4",as:"p",html:i,className:"flex-1"})}),t(p,{align:"left",shape:"rounded",className:"mt-[24px]",value:l.toString(),onValueChange:e=>{g(e)},children:t(x,{children:n.map((e,s)=>t(c,{value:e?.toString()||"",children:e},s))})}),t("div",{className:T("mt-[24px] flex flex-col overflow-auto pt-0"),children:f?.map((e,s)=>t(q,{index:s,defaultExpended:r.length===1,question:e.question,answer:e.answer,showDots:!1},s))}),a.learnMore?.link&&a.learnMore?.label&&t("a",{href:a.learnMore?.link,target:"_blank",className:"mt-[64px] block w-full text-center text-[18px] font-bold text-brand hover:underline l:text-[16px]",children:a.learnMore?.label})]})};export{C as CreditsFaq};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/components/credits/creditsFaq/index.tsx"],
4
+ "sourcesContent": ["import { Container, Heading, Tabs, TabsList, TabsTrigger, Text } from '@anker-in/headless-ui'\nimport { cn } from '../../../helpers/index'\nimport { useMemo, useState } from 'react'\n\nimport { FaqItem } from './faqItem/FaqItem'\n\nexport type FaqCopy = {\n title: string\n subTitle: string\n learnMore: {\n link: string\n label: string\n }\n items: {\n category_name: string\n question: string\n answer: string\n }[]\n}\nexport const CreditsFaq = ({ copy }: { copy: FaqCopy }) => {\n const { title, items: faqList, subTitle = '' } = copy || {}\n const categoryList = useMemo(() => {\n return Array.from(new Set(faqList?.map?.(faq => faq.category_name).filter(item => !!item)))\n }, [faqList])\n const [activeTab, setActiveTab] = useState<string>(categoryList[0]?.toString() || '')\n\n const currentList = useMemo(() => {\n if (!faqList) return []\n if (categoryList.length) {\n return faqList.filter(item => item?.category_name === activeTab)\n }\n return faqList\n }, [faqList, categoryList.length, activeTab])\n\n return (\n <Container className=\"bg-[#F5F5F7]\" id=\"faq\">\n {title && <Heading as=\"h2\" size=\"4\" html={copy?.title} />}\n {subTitle && (\n <div className=\"mt-[8px] flex flex-row\">\n <Text size=\"4\" as=\"p\" html={subTitle} className=\"flex-1\" />\n </div>\n )}\n {/* faq-nav */}\n <Tabs\n align=\"left\"\n shape=\"rounded\"\n className=\"mt-[24px]\"\n value={activeTab.toString()}\n onValueChange={value => {\n setActiveTab(value)\n }}\n >\n <TabsList>\n {categoryList.map((item, index) => (\n <TabsTrigger key={index} value={item?.toString() || ''}>\n {item}\n </TabsTrigger>\n ))}\n </TabsList>\n </Tabs>\n <div className={cn('mt-[24px] flex flex-col overflow-auto pt-0')}>\n {currentList?.map((item, index) => {\n return (\n <FaqItem\n key={index}\n index={index}\n defaultExpended={faqList.length === 1}\n question={item.question}\n answer={item.answer}\n showDots={false}\n ></FaqItem>\n )\n })}\n </div>\n {copy.learnMore?.link && copy.learnMore?.label && (\n <a\n href={copy.learnMore?.link}\n target=\"_blank\"\n className=\"mt-[64px] block w-full text-center text-[18px] font-bold text-brand hover:underline l:text-[16px]\"\n >\n {copy.learnMore?.label}\n </a>\n )}\n </Container>\n )\n}\n"],
5
+ "mappings": "AAmCI,OACY,OAAAA,EADZ,QAAAC,MAAA,oBAnCJ,OAAS,aAAAC,EAAW,WAAAC,EAAS,QAAAC,EAAM,YAAAC,EAAU,eAAAC,EAAa,QAAAC,MAAY,wBACtE,OAAS,MAAAC,MAAU,yBACnB,OAAS,WAAAC,EAAS,YAAAC,M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SAAW,EACpC,SAAUI,EAAK,SACf,OAAQA,EAAK,OACb,SAAU,IALLK,CAMN,CAEJ,EACH,EACCX,EAAK,WAAW,MAAQA,EAAK,WAAW,OACvCb,EAAC,KACC,KAAMa,EAAK,WAAW,KACtB,OAAO,SACP,UAAU,oGAET,SAAAA,EAAK,WAAW,MACnB,GAEJ,CAEJ",
6
+ "names": ["jsx", "jsxs", "Container", "Heading", "Tabs", "TabsList", "TabsTrigger", "Text", "cn", "useMemo", "useState", "FaqItem", "CreditsFaq", "copy", "title", "faqList", "subTitle", "categoryList", "faq", "item", "activeTab", "setActiveTab", "currentList", "value", "index"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{jsx as e,jsxs as i}from"react/jsx-runtime";import{Button as g,Container as u,Text as r}from"@anker-in/headless-ui";import{useCallback as y,useState as p}from"react";import{useCreditsContext as w}from"../context/provider";import{cn as s}from"../../../helpers";import{numberFormat as c}from"../context/utils";import N from"../modal/activitiesModal";import C from"../modal/MyRewardsModal";function S({data:t}){const[f,m]=p(!1),[v,x]=p(!1),[n,o]=p(!1),b=y(l=>{if(l.type)switch(l.type){case"activities":m(!0);break;case"rewards":x(!0);break}},[]),{creditInfo:a}=w();return i(u,{asChild:!0,id:"infoCard",className:"-mb-[86px] -translate-y-[86px] x:-mb-[30px] x:-translate-y-[30px]",children:[i("div",{className:s("mx-auto flex justify-between items-center rounded-[12px] border border-white px-[24px] py-[40px]","l:flex-col","min-l:px-[48px]","min-xl:px-[100px]"),style:{background:"linear-gradient(119.61deg, rgba(250, 250, 250, 0.6) 38.58%, rgba(255, 255, 255, 0.6) 63.73%, rgba(249, 252, 255, 0.6) 89.37%)",backdropFilter:"blur(8px)"},children:[i("div",{className:s("grid grid-cols-2 gap-[24px] font-bold md:grid-cols-1 md:flex-col md:gap-[16px] min-md:items-center"),children:[i("div",{className:"mr-[80px] md:mr-[0] md:flex-1 md-xl:mr-[64px]",children:[e("div",{className:s("mb-[24px] text-[14px] font-bold l:mb-[6px] xl:text-[16px] min-md:text-[18px] l-xl:mb-[16px]"),children:t.balanceLabel}),i("div",{className:"flex items-baseline",children:[e("div",{className:s("mr-[8px] text-[36px] font-extrabold","min-md:text-[44px]","min-xl:text-[56px]"),children:a?c(a.available_credit):0}),e("div",{className:"text-[16px]",children:t?.pointUnit})]})]}),i("div",{className:"w-fit md:flex-1",children:[i("div",{className:s("mb-[24px] flex text-[18px] l:mb-[6px] l:text-[14px] l-xl:mb-[16px]"),children:[e(r,{className:"text-[14px] font-bold xl:text-[16px] min-md:text-[18px]",html:t.comingSoonLabel}),t.comingSoonTips&&i("div",{className:"group relative ml-[4px] flex cursor-pointer items-start",children:[e(r,{as:"div",html:t?.infoIcon,className:"size-[18px] cursor-pointer [&_svg]:size-full",onClick:()=>{n?o(!1):(o(!0),setTimeout(()=>{o(!1)},5e3))}}),e("div",{className:s("absolute -bottom-[12px] -left-[32px] z-10 w-[356px] translate-y-full md:w-[276px]",n?"block":"hidden"),children:i("div",{className:"relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow",children:[e(r,{size:"2",html:t.comingSoonTips,className:"desktop:text-[18px]"}),e("div",{className:"absolute -top-[10px] left-[40px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]"})]})})]})]}),i("div",{className:"flex items-baseline ",children:[e("div",{className:s("mr-[8px] text-[36px] font-extrabold","min-l:text-[44px]","min-xl:text-[56px]"),children:a?c(a.pending_credit):0}),e("div",{className:"text-[16px]",children:t?.pointUnit})]})]})]}),e("div",{className:s("grid w-fit md:w-full l:mt-[32px] l:gap-[12px] min-l:gap-[16px] min-l:pl-[48px] md-l:grid-cols-2"),children:t.buttons?.map((l,d)=>e(g,{variant:d===0?"secondary":"primary",size:"lg",className:"min-w-[156px] laptop:min-w-[189px]",onClick:()=>{b(l)},children:l.text},d))}),t?.myActivities&&e(N,{isOpen:f,data:t?.myActivities,onClose:()=>{m(!1)}}),t?.myRewards&&e(C,{isOpen:v,data:t?.myRewards,onClose:()=>{x(!1)}})]}),n&&e("div",{role:"button",tabIndex:0,className:"fixed inset-0 z-10",onClick:()=>o(!1),onKeyDown:l=>l.key==="Escape"&&o(!1)})]})}export{S as CreditsInfoCard};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/components/credits/creditsInfoCard/index.tsx"],
4
+ "sourcesContent": ["import { Button, Container, Text } from '@anker-in/headless-ui'\n\nimport { useCallback, useState } from 'react'\nimport { useCreditsContext } from '../context/provider'\nimport { cn } from '../../../helpers'\nimport { numberFormat } from '../context/utils'\nimport ActivitiesModal from '../modal/activitiesModal'\nimport MyRewardsModal, { type MyRewardsMetafields } from '../modal/MyRewardsModal'\nimport { type MyActivitiesMetafields } from '../modal/activitiesModal'\n\ntype ButtonConfig = {\n text: string\n type: 'activities' | 'rewards'\n}\nexport interface InfoCardProps {\n data: {\n balanceLabel: string\n comingSoonLabel: string\n comingSoonTips: string\n buttons: ButtonConfig[]\n pointUnit: string\n infoIcon: string\n myActivities: MyActivitiesMetafields\n myRewards: MyRewardsMetafields\n }\n}\nexport function CreditsInfoCard({ data }: InfoCardProps) {\n const [openActivities, setOpenActivities] = useState(false)\n const [openRewards, setOpenRewards] = useState(false)\n const [hover, setHover] = useState<boolean>(false)\n\n const handleButtonClick = useCallback((buttonConfig: ButtonConfig) => {\n // gaNormalClick({ position: 'info_card', label: buttonConfig.text })\n\n if (buttonConfig.type) {\n switch (buttonConfig.type) {\n case 'activities':\n setOpenActivities(true)\n break\n case 'rewards':\n setOpenRewards(true)\n break\n }\n }\n }, [])\n\n const { creditInfo } = useCreditsContext()\n\n return (\n <Container asChild id=\"infoCard\" className=\"-mb-[86px] -translate-y-[86px] x:-mb-[30px] x:-translate-y-[30px]\">\n <div\n className={cn(\n 'mx-auto flex justify-between items-center rounded-[12px] border border-white px-[24px] py-[40px]',\n 'l:flex-col',\n 'min-l:px-[48px]',\n 'min-xl:px-[100px]'\n )}\n style={{\n background:\n 'linear-gradient(119.61deg, rgba(250, 250, 250, 0.6) 38.58%, rgba(255, 255, 255, 0.6) 63.73%, rgba(249, 252, 255, 0.6) 89.37%)',\n backdropFilter: 'blur(8px)',\n }}\n >\n <div\n className={cn(\n 'grid grid-cols-2 gap-[24px] font-bold md:grid-cols-1 md:flex-col md:gap-[16px] min-md:items-center'\n )}\n >\n <div className=\"mr-[80px] md:mr-[0] md:flex-1 md-xl:mr-[64px]\">\n <div\n className={cn(\n 'mb-[24px] text-[14px] font-bold l:mb-[6px] xl:text-[16px] min-md:text-[18px] l-xl:mb-[16px]'\n )}\n >\n {data.balanceLabel}\n </div>\n <div className=\"flex items-baseline\">\n <div className={cn('mr-[8px] text-[36px] font-extrabold', 'min-md:text-[44px]', 'min-xl:text-[56px]')}>\n {creditInfo ? numberFormat(creditInfo.available_credit) : 0}\n </div>\n <div className=\"text-[16px]\">{data?.pointUnit}</div>\n </div>\n </div>\n <div className=\"w-fit md:flex-1\">\n <div className={cn('mb-[24px] flex text-[18px] l:mb-[6px] l:text-[14px] l-xl:mb-[16px]')}>\n <Text className=\"text-[14px] font-bold xl:text-[16px] min-md:text-[18px]\" html={data.comingSoonLabel} />\n {data.comingSoonTips && (\n <div className=\"group relative ml-[4px] flex cursor-pointer items-start\">\n <Text\n as=\"div\"\n html={data?.infoIcon}\n className=\"size-[18px] cursor-pointer [&_svg]:size-full\"\n onClick={() => {\n if (hover) {\n setHover(false)\n } else {\n setHover(true)\n setTimeout(() => {\n setHover(false)\n }, 5000)\n }\n }}\n />\n <div\n className={cn(\n 'absolute -bottom-[12px] -left-[32px] z-10 w-[356px] translate-y-full md:w-[276px]',\n hover ? 'block' : 'hidden'\n )}\n >\n <div className=\"relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow\">\n <Text size=\"2\" html={data.comingSoonTips} className=\"desktop:text-[18px]\" />\n <div className=\"absolute -top-[10px] left-[40px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]\" />\n </div>\n </div>\n </div>\n )}\n </div>\n <div className=\"flex items-baseline \">\n <div className={cn('mr-[8px] text-[36px] font-extrabold', 'min-l:text-[44px]', 'min-xl:text-[56px]')}>\n {creditInfo ? numberFormat(creditInfo.pending_credit) : 0}\n </div>\n <div className=\"text-[16px]\">{data?.pointUnit}</div>\n </div>\n </div>\n </div>\n <div\n className={cn(\n 'grid w-fit md:w-full l:mt-[32px] l:gap-[12px] min-l:gap-[16px] min-l:pl-[48px] md-l:grid-cols-2'\n )}\n >\n {data.buttons?.map((item, index) => (\n <Button\n key={index}\n variant={index === 0 ? 'secondary' : 'primary'}\n size=\"lg\"\n className=\"min-w-[156px] laptop:min-w-[189px]\"\n onClick={() => {\n handleButtonClick(item)\n }}\n >\n {item.text}\n </Button>\n ))}\n </div>\n\n {data?.myActivities && (\n <ActivitiesModal\n isOpen={openActivities}\n data={data?.myActivities}\n onClose={() => {\n setOpenActivities(false)\n }}\n />\n )}\n {data?.myRewards && (\n <MyRewardsModal\n isOpen={openRewards}\n data={data?.myRewards}\n onClose={() => {\n setOpenRewards(false)\n }}\n ></MyRewardsModal>\n )}\n </div>\n {hover && (\n <div\n role=\"button\"\n tabIndex={0}\n className=\"fixed inset-0 z-10\"\n onClick={() => setHover(false)}\n onKeyDown={e => e.key === 'Escape' && setHover(false)}\n />\n )}\n </Container>\n )\n}\n"],
5
+ "mappings": "AAqEY,cAAAA,EAOA,QAAAC,MAPA,oBArEZ,OAAS,UAAAC,EAAQ,aAAAC,EAAW,QAAAC,MAAY,wBAExC,OAAS,eAAAC,EAAa,YAAAC,MAAgB,QACtC,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,MAAAC,MAAU,mBACnB,OAAS,gBAAAC,MAAoB,mBAC7B,OAAOC,MAAqB,2BAC5B,OAAOC,MAAkD,0BAmBlD,SAASC,EAAgB,CAAE,KAAAC,CAAK,EAAkB,CACvD,KAAM,CAACC,EAAgBC,CA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,UAAWQ,EACT,oFACAU,EAAQ,QAAU,QACpB,EAEA,SAAAjB,EAAC,OAAI,UAAU,0FACb,UAAAD,EAACI,EAAA,CAAK,KAAK,IAAI,KAAMS,EAAK,eAAgB,UAAU,sBAAsB,EAC1Eb,EAAC,OAAI,UAAU,mHAAmH,GACpI,EACF,GACF,GAEJ,EACAC,EAAC,OAAI,UAAU,uBACb,UAAAD,EAAC,OAAI,UAAWQ,EAAG,sCAAuC,oBAAqB,oBAAoB,EAChG,SAAAc,EAAab,EAAaa,EAAW,cAAc,EAAI,EAC1D,EACAtB,EAAC,OAAI,UAAU,cAAe,SAAAa,GAAM,UAAU,GAChD,GACF,GACF,EACAb,EAAC,OACC,UAAWQ,EACT,iGACF,EAEC,SAAAK,EAAK,SAAS,IAAI,CAACU,EAAMC,IACxBxB,EAACE,EAAA,CAEC,QAASsB,IAAU,EAAI,YAAc,UACrC,KAAK,KACL,UAAU,qCACV,QAAS,IAAM,CACbJ,EAAkBG,CAAI,CACxB,EAEC,SAAAA,EAAK,MARDC,CASP,CACD,EACH,EAECX,GAAM,cACLb,EAACU,EAAA,CACC,OAAQI,EACR,KAAMD,GAAM,aACZ,QAAS,IAAM,CACbE,EAAkB,EAAK,CACzB,EACF,EAEDF,GAAM,WACLb,EAACW,EAAA,CACC,OAAQK,EACR,KAAMH,GAAM,UACZ,QAAS,IAAM,CACbI,EAAe,EAAK,CACtB,EACD,GAEL,EACCC,GACClB,EAAC,OACC,KAAK,SACL,SAAU,EACV,UAAU,qBACV,QAAS,IAAMmB,EAAS,EAAK,EAC7B,UAAWM,GAAKA,EAAE,MAAQ,UAAYN,EAAS,EAAK,EACtD,GAEJ,CAEJ",
6
+ "names": ["jsx", "jsxs", "Button", "Container", "Text", "useCallback", "useState", "useCreditsContext", "cn", "numberFormat", "ActivitiesModal", "MyRewardsModal", "CreditsInfoCard", "data", "openActivities", "setOpenActivities", "openRewards", "setOpenRewards", "hover", "setHover", "handleButtonClick", "buttonConfig", "creditInfo", "item", "index", "e"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{jsx as o,jsxs as c}from"react/jsx-runtime";import{Picture as x}from"@anker-in/headless-ui";import b from"../../context/hooks/useClickOutside";import s from"classnames";import{useEffect as v,useState as p}from"react";function w({countries:t,loading:d,className:r,value:n,onChange:i}){const[u,l]=p(!1),[f,a]=p(""),g=b(()=>{l(!1)});return v(()=>{const e=t.filter(m=>m.code===n);e.length&&a(e[0].name)},[a,t,n]),c("div",{className:"relative",children:[o("select",{className:s("!h-[50px] pr-[45px] min-l:hidden",r),style:{WebkitTextFillColor:"black"},disabled:d,value:n,onChange:e=>{i(e.target.value)},children:t.map(e=>o("option",{value:e.code,children:e.name},e.code))}),o("div",{className:s("absolute left-0 top-0 hidden !h-[50px] rounded-[2px] pr-[45px] text-[16px] font-bold focus:!border-[#6D6D6F] min-l:!block",r),onClick:()=>{l(!0)},role:"button",tabIndex:0,onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&e.preventDefault()},children:f}),o(x,{source:"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/country-select.png?v=1692202500",imgClassName:"pointer-events-none absolute right-0 top-0 bottom-0 !w-[45px] object-cover",alt:"arrow"}),o("div",{ref:g,className:s("absolute left-0 top-[58px] z-30 max-h-[334px] w-full cursor-pointer overflow-auto rounded-[4px] bg-white shadow-[0px_1px_12px_0px_rgba(0,0,0,0.12)]",{"!hidden":!u}),children:o("ul",{className:"py-[6px]",children:t.map(e=>c("li",{value:e.code,className:s("relative px-[14px] py-[17px] text-[16px] font-bold leading-[1] transition hover:bg-[#EAEAEC]",{"!bg-[#EAEAEC]":e.code===n}),children:[o("button",{className:"absolute left-0 top-0 z-1 size-full opacity-0",value:e.code,onClick:()=>{a(e.name),l(!1),i(e.code)}}),e.name]},e.code))})})]})}export{w as CountrySelect};
2
+ //# sourceMappingURL=CountrySelect.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/creditsRedeemList/AddressForm/CountrySelect.tsx"],
4
+ "sourcesContent": ["import { Picture } from '@anker-in/headless-ui'\nimport useClickOutside from '../../context/hooks/useClickOutside'\nimport classNames from 'classnames'\nimport { useEffect, useState } from 'react'\n\ninterface Country {\n id: string\n code: string\n name: string\n}\n\ninterface CountrySelectProps {\n countries: Country[]\n loading?: boolean\n className?: string\n value?: string\n onChange: (code: string) => void\n}\n\nexport function CountrySelect({ countries, loading, className, value, onChange }: CountrySelectProps) {\n const [show, setShow] = useState(false)\n const [display, setDisplay] = useState<any>('')\n\n const dorpdown = useClickOutside<HTMLDivElement>(() => {\n setShow(false)\n })\n\n useEffect(() => {\n const target = countries.filter(item => item.code === value)\n if (target.length) setDisplay(target[0].name)\n }, [setDisplay, countries, value])\n\n return (\n <div className=\"relative\">\n <select\n className={classNames('!h-[50px] pr-[45px] min-l:hidden', className)}\n style={{\n WebkitTextFillColor: 'black',\n }}\n disabled={loading}\n value={value}\n onChange={event => {\n onChange(event.target.value)\n }}\n >\n {countries.map((item: { id: string; name: string; code: string }) => (\n <option key={item.code} value={item.code}>\n {item.name}\n </option>\n ))}\n </select>\n\n <div\n className={classNames(\n 'absolute left-0 top-0 hidden !h-[50px] rounded-[2px] pr-[45px] text-[16px] font-bold focus:!border-[#6D6D6F] min-l:!block',\n className\n )}\n onClick={() => {\n setShow(true)\n }}\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {display}\n </div>\n\n <Picture\n source=\"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/country-select.png?v=1692202500\"\n imgClassName=\"pointer-events-none absolute right-0 top-0 bottom-0 !w-[45px] object-cover\"\n alt=\"arrow\"\n />\n\n <div\n ref={dorpdown}\n className={classNames(\n 'absolute left-0 top-[58px] z-30 max-h-[334px] w-full cursor-pointer overflow-auto rounded-[4px] bg-white shadow-[0px_1px_12px_0px_rgba(0,0,0,0.12)]',\n { '!hidden': !show }\n )}\n >\n <ul className=\"py-[6px]\">\n {countries.map((item: { id: string; name: string; code: string }) => (\n <li\n key={item.code}\n value={item.code}\n className={classNames(\n 'relative px-[14px] py-[17px] text-[16px] font-bold leading-[1] transition hover:bg-[#EAEAEC]',\n { '!bg-[#EAEAEC]': item.code === value }\n )}\n >\n <button\n className=\"absolute left-0 top-0 z-1 size-full opacity-0\"\n value={item.code}\n onClick={() => {\n setDisplay(item.name)\n setShow(false)\n onChange(item.code)\n }}\n />\n {item.name}\n </li>\n ))}\n </ul>\n </div>\n </div>\n )\n}\n"],
5
+ "mappings": "AA8CU,cAAAA,EAwCE,QAAAC,MAxCF,oBA9CV,OAAS,WAAAC,MAAe,wBACxB,OAAOC,MAAqB,sCAC5B,OAAOC,MAAgB,aACvB,OAAS,aAAAC,EAAW,YAAAC,MAAgB,QAgB7B,SAASC,EAAc,CAAE,UAAAC,EAAW,QAAAC,EAAS,UAAAC,EAAW,MAAAC,EAAO,SAAAC,CAAS,EAAuB,CACpG,KAAM,CAACC,EAAMC,CAAO,EAAIR,EAAS,EAAK,EAChC,CAACS,EAASC,CAAU,EAAIV,EAAc,EAAE,EAExCW,EAAWd,EAAgC,IAAM,CACrDW,EAAQ,EAAK,CACf,CAAC,EAED,OAAAT,EAAU,IAAM,CACd,MAAMa,EAASV,EAAU,OAAOW,GAAQA,EAAK,OAASR,CAAK,EACvDO,EAAO,QAAQF,EAAWE,EAAO,CAAC,EAAE,IAAI,CAC9C,EAAG,CAACF,EAAYR,EAAWG,CAAK,CAAC,EAG/BV,EAAC,OAAI,UAAU,WACb,UAAAD,EAAC,UACC,UAAWI,EAAW,mCAAoCM,CAAS,EACnE,MAAO,CACL,oBAAqB,OACvB,EACA,SAAUD,EACV,MAAOE,EACP,SAAUS,GAAS,CACjBR,EAASQ,EAAM,OAAO,KAAK,CAC7B,EAEC,SAAAZ,EAAU,IAAKW,GACdnB,EAAC,UAAuB,MAAOmB,EAAK,KACjC,SAAAA,EAAK,MADKA,EAAK,IAElB,CACD,EACH,EAEAnB,EAAC,OACC,UAAWI,EACT,4HACAM,CACF,EACA,QAAS,IAAM,CACbI,EAAQ,EAAI,CACd,EACA,KAAK,SACL,SAAU,EACV,UAAW,GAAK,EACV,EAAE,MAAQ,SAAW,EAAE,MAAQ,MACjC,EAAE,eAAe,CAErB,EAEC,SAAAC,EACH,EAEAf,EAACE,EAAA,CACC,OAAO,yFACP,aAAa,6EACb,IAAI,QACN,EAEAF,EAAC,OACC,IAAKiB,EACL,UAAWb,EACT,sJACA,CAAE,UAAW,CAACS,CAAK,CACrB,EAEA,SAAAb,EAAC,MAAG,UAAU,WACX,SAAAQ,EAAU,IAAKW,GACdlB,EAAC,MAEC,MAAOkB,EAAK,KACZ,UAAWf,EACT,+FACA,CAAE,gBAAiBe,EAAK,OAASR,CAAM,CACzC,EAEA,UAAAX,EAAC,UACC,UAAU,gDACV,MAAOmB,EAAK,KACZ,QAAS,IAAM,CACbH,EAAWG,EAAK,IAAI,EACpBL,EAAQ,EAAK,EACbF,EAASO,EAAK,IAAI,CACpB,EACF,EACCA,EAAK,OAhBDA,EAAK,IAiBZ,CACD,EACH,EACF,GACF,CAEJ",
6
+ "names": ["jsx", "jsxs", "Picture", "useClickOutside", "classNames", "useEffect", "useState", "CountrySelect", "countries", "loading", "className", "value", "onChange", "show", "setShow", "display", "setDisplay", "dorpdown", "target", "item", "event"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{jsx as e,jsxs as s}from"react/jsx-runtime";import{Text as i}from"@anker-in/headless-ui";const d=({error:t,children:m,label:o,required:p})=>s("div",{children:[o&&e(i,{html:p?`${o} *`:o,className:"text-[16px] font-bold"}),e("div",{className:"mt-[8px] h-[50px] w-full text-[14px] font-semibold",children:m}),t&&typeof t=="string"&&e(i,{as:"div",html:t,className:"mt-[8px] text-[16px] font-bold text-[#FF4D4D]"})]});export{d as FormItem};
2
+ //# sourceMappingURL=FormItem.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/creditsRedeemList/AddressForm/FormItem.tsx"],
4
+ "sourcesContent": ["import { Text } from '@anker-in/headless-ui'\nimport { type PropsWithChildren } from 'react'\n\nexport const FormItem = ({\n error,\n children,\n label,\n required,\n}: PropsWithChildren<{\n label?: string\n required: boolean\n error?: string\n}>) => {\n return (\n <div>\n {label && <Text html={required ? `${label} *` : label} className=\"text-[16px] font-bold\"></Text>}\n <div className=\"mt-[8px] h-[50px] w-full text-[14px] font-semibold\">{children}</div>\n {error && typeof error === 'string' && (\n <Text as=\"div\" html={error} className=\"mt-[8px] text-[16px] font-bold text-[#FF4D4D]\" />\n )}\n </div>\n )\n}\n"],
5
+ "mappings": "AAcI,OACY,OAAAA,EADZ,QAAAC,MAAA,oBAdJ,OAAS,QAAAC,MAAY,wBAGd,MAAMC,EAAW,CAAC,CACvB,MAAAC,EACA,SAAAC,EACA,MAAAC,EACA,SAAAC,CACF,IAMIN,EAAC,OACE,UAAAK,GAASN,EAACE,EAAA,CAAK,KAAMK,EAAW,GAAGD,CAAK,KAAOA,EAAO,UAAU,wBAAwB,EACzFN,EAAC,OAAI,UAAU,qDAAsD,SAAAK,EAAS,EAC7ED,GAAS,OAAOA,GAAU,UACzBJ,EAACE,EAAA,CAAK,GAAG,MAAM,KAAME,EAAO,UAAU,gDAAgD,GAE1F",
6
+ "names": ["jsx", "jsxs", "Text", "FormItem", "error", "children", "label", "required"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{jsx as m}from"react/jsx-runtime";import h from"classnames";import{useCallback as r,useEffect as g,useState as b}from"react";function C({className:s,error:u,value:t,placeholder:c,disabled:p,onChange:a,onBlur:o}){const[v,e]=b(!1);g(()=>{t&&e(!0)},[t]);const d=r(n=>{const l=n.currentTarget.value;l&&e(!!l),a(n)},[a]),i=r(n=>{e(!!n.currentTarget.value),o&&o()},[o]),f=r(()=>{e(!0)},[]);return m("input",{className:h("w-full rounded-[2px] border border-[#6D6D6F] p-[14px] text-[16px] font-bold placeholder:text-[16px] placeholder:font-bold placeholder:text-[#6D6D6F] focus:outline-none focus:ring-0",s,u&&"border-[#FF4D4D]"),value:t,placeholder:c,disabled:p,onChange:d,onBlur:i,onFocus:f})}export{C as Input};
2
+ //# sourceMappingURL=Input.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/creditsRedeemList/AddressForm/Input.tsx"],
4
+ "sourcesContent": ["import classNames from 'classnames'\nimport React, { useCallback, useEffect, useState } from 'react'\n\ninterface InputProps {\n className?: string\n value: string\n error?: string | boolean\n placeholder: string\n required?: boolean\n disabled?: boolean\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => void\n onBlur?: () => void\n}\n\nexport function Input({ className, error, value, placeholder, disabled, onChange, onBlur }: InputProps) {\n const [focus, setFocus] = useState(false)\n\n useEffect(() => {\n if (value) setFocus(true)\n }, [value])\n\n const handleOnChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const val = event.currentTarget.value\n if (val) setFocus(!!val)\n onChange(event)\n },\n [onChange],\n )\n\n const handleOnBlur = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setFocus(!!event.currentTarget.value)\n onBlur && onBlur()\n },\n [onBlur],\n )\n\n const handleOnFocus = useCallback(() => {\n setFocus(true)\n }, [])\n\n return (\n <input\n className={classNames(\n 'w-full rounded-[2px] border border-[#6D6D6F] p-[14px] text-[16px] font-bold placeholder:text-[16px] placeholder:font-bold placeholder:text-[#6D6D6F] focus:outline-none focus:ring-0',\n className,\n error && 'border-[#FF4D4D]',\n )}\n value={value}\n placeholder={placeholder}\n disabled={disabled}\n onChange={handleOnChange}\n onBlur={handleOnBlur}\n onFocus={handleOnFocus}\n ></input>\n )\n}\n"],
5
+ "mappings": "AA2CI,cAAAA,MAAA,oBA3CJ,OAAOC,MAAgB,aACvB,OAAgB,eAAAC,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAajD,SAASC,EAAM,CAAE,UAAAC,EAAW,MAAAC,EAAO,MAAAC,EAAO,YAAAC,EAAa,SAAAC,EAAU,SAAAC,EAAU,OAAAC,CAAO,EAAe,CACtG,KAAM,CAACC,EAAOC,CAAQ,EAAIV,EAAS,EAAK,EAExCD,EAAU,IAAM,CACVK,GAAOM,EAAS,EAAI,CAC1B,EAAG,CAACN,CAAK,CAAC,EAEV,MAAMO,EAAiBb,EACpBc,GAA+C,CAC9C,MAAMC,EAAMD,EAAM,cAAc,MAC5BC,GAAKH,EAAS,CAAC,CAACG,CAAG,EACvBN,EAASK,CAAK,CAChB,EACA,CAACL,CAAQ,CACX,EAEMO,EAAehB,EAClBc,GAA+C,CAC9CF,EAAS,CAAC,CAACE,EAAM,cAAc,KAAK,EACpCJ,GAAUA,EAAO,CACnB,EACA,CAACA,CAAM,CACT,EAEMO,EAAgBjB,EAAY,IAAM,CACtCY,EAAS,EAAI,CACf,EAAG,CAAC,CAAC,EAEL,OACEd,EAAC,SACC,UAAWC,EACT,uLACAK,EACAC,GAAS,kBACX,EACA,MAAOC,EACP,YAAaC,EACb,SAAUC,EACV,SAAUK,EACV,OAAQG,EACR,QAASC,EACV,CAEL",
6
+ "names": ["jsx", "classNames", "useCallback", "useEffect", "useState", "Input", "className", "error", "value", "placeholder", "disabled", "onChange", "onBlur", "focus", "setFocus", "handleOnChange", "event", "val", "handleOnBlur", "handleOnFocus"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{Fragment as w,jsx as n,jsxs as f}from"react/jsx-runtime";import a from"classnames";import{Picture as h}from"@anker-in/headless-ui";import{useEffect as b,useMemo as y,useState as u}from"react";import k from"../../context/hooks/useClickOutside";function F({states:t,stateName:i="",stateCode:s="",className:r="",onChange:c}){const[g,d]=u(!1),[v,p]=u(""),x=k(()=>{d(!1)}),l=y(()=>{const e=t.find(o=>s?o.code===s:o.name===i);return e?[e?.id,e?.name,e?.code].join(","):""},[t,s,i]);return b(()=>{const e=t.filter(o=>[o.id,o.name,o.code].join(",")===l);e.length&&p(e[0].name)},[p,t,l]),n("div",{className:"relative h-full",children:t.length?f(w,{children:[n("select",{className:a("h-[52px] pr-[45px] min-l:hidden",r),value:l,style:{WebkitTextFillColor:l?"black":"#666"},onChange:e=>{const[,o,m]=e.target.value.split(",");c(m,o)},children:t.map(e=>n("option",{value:[e.id,e.name,e.code].join(","),children:e.name},e.id))}),n("div",{className:a("absolute left-0 top-0 hidden h-[52px] pr-[45px] min-l:!block",r),onClick:()=>{d(!0)},role:"button",tabIndex:0,onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&e.preventDefault()},children:v}),n(h,{source:"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/country-select.png?v=1692202500",className:"pointer-events-none absolute right-0 top-1/2 h-[45px] !w-[45px] -translate-y-1/2 object-cover",alt:"arrow"}),n("div",{ref:x,className:a("absolute left-0 top-[58px] z-30 max-h-[334px] w-full cursor-pointer overflow-auto rounded-[4px] bg-white shadow-[0px_1px_12px_0px_rgba(0,0,0,0.12)]",{"!hidden":!g}),children:n("ul",{className:"py-[6px]",children:t.map(e=>f("li",{value:[e.id,e.name,e.code].join(","),className:a("relative px-[14px] py-[17px] text-[16px] font-semibold leading-[1] transition hover:bg-[#F7F8F9]",{"!bg-[#e8e8e8]":[e.id,e.name,e.code].join(",")===l}),children:[n("button",{className:"absolute left-0 top-0 z-1 size-full opacity-0",value:[e.id,e.name,e.code].join(","),onClick:()=>{p(e.name),d(!1),c(e.code,e.name)}}),e.name]},e.id))})})]}):n("input",{className:r,value:i,style:{WebkitTextFillColor:"black"},onChange:e=>{c("",e.target.value)}})})}export{F as StateSelect};
2
+ //# sourceMappingURL=StateSelect.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/creditsRedeemList/AddressForm/StateSelect.tsx"],
4
+ "sourcesContent": ["import classNames from 'classnames'\nimport { Picture } from '@anker-in/headless-ui'\nimport { useEffect, useMemo, useState } from 'react'\nimport useClickOutside from '../../context/hooks/useClickOutside'\n\ninterface StateSelectProps {\n states: { code: string; id: string; name: string }[]\n className?: string\n countryId?: string\n defaultCode?: string\n stateName?: string\n stateCode?: string\n onChange: (code: string, name: string) => void\n}\n\nexport function StateSelect({ states, stateName = '', stateCode = '', className = '', onChange }: StateSelectProps) {\n const [show, setShow] = useState(false)\n const [display, setDisplay] = useState<any>('')\n\n const dropdown = useClickOutside<HTMLDivElement>(() => {\n setShow(false)\n })\n\n const value = useMemo(() => {\n const currentState = states.find(item => (stateCode ? item.code === stateCode : item.name === stateName))\n\n return currentState ? [currentState?.id, currentState?.name, currentState?.code].join(',') : ''\n }, [states, stateCode, stateName])\n\n useEffect(() => {\n const target = states.filter(item => [item.id, item.name, item.code].join(',') === value)\n if (target.length) setDisplay(target[0].name)\n }, [setDisplay, states, value])\n\n return (\n <div className=\"relative h-full\">\n {states.length ? (\n <>\n <select\n className={classNames('h-[52px] pr-[45px] min-l:hidden', className)}\n value={value}\n style={{\n WebkitTextFillColor: value ? 'black' : '#666',\n }}\n onChange={event => {\n const [, name, code] = event.target.value.split(',')\n onChange(code, name)\n }}\n >\n {states.map((item: { id: string; name: string; code: string }) => (\n <option key={item.id} value={[item.id, item.name, item.code].join(',')}>\n {item.name}\n </option>\n ))}\n </select>\n <div\n className={classNames('absolute left-0 top-0 hidden h-[52px] pr-[45px] min-l:!block', className)}\n onClick={() => {\n setShow(true)\n }}\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {display}\n </div>\n\n <Picture\n source=\"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/country-select.png?v=1692202500\"\n className=\"pointer-events-none absolute right-0 top-1/2 h-[45px] !w-[45px] -translate-y-1/2 object-cover\"\n alt=\"arrow\"\n />\n\n <div\n ref={dropdown}\n className={classNames(\n 'absolute left-0 top-[58px] z-30 max-h-[334px] w-full cursor-pointer overflow-auto rounded-[4px] bg-white shadow-[0px_1px_12px_0px_rgba(0,0,0,0.12)]',\n { '!hidden': !show }\n )}\n >\n <ul className=\"py-[6px]\">\n {states.map((item: { id: string; name: string; code: string }) => (\n <li\n key={item.id}\n value={[item.id, item.name, item.code].join(',')}\n className={classNames(\n 'relative px-[14px] py-[17px] text-[16px] font-semibold leading-[1] transition hover:bg-[#F7F8F9]',\n {\n '!bg-[#e8e8e8]': [item.id, item.name, item.code].join(',') === value,\n }\n )}\n >\n <button\n className=\"absolute left-0 top-0 z-1 size-full opacity-0\"\n value={[item.id, item.name, item.code].join(',')}\n onClick={() => {\n setDisplay(item.name)\n setShow(false)\n onChange(item.code, item.name)\n }}\n />\n {item.name}\n </li>\n ))}\n </ul>\n </div>\n </>\n ) : (\n <input\n className={className}\n value={stateName}\n style={{\n WebkitTextFillColor: 'black',\n }}\n onChange={event => {\n onChange('', event.target.value)\n }}\n ></input>\n )}\n </div>\n )\n}\n"],
5
+ "mappings": "AAqCQ,mBAAAA,EAaM,OAAAC,EAoCE,QAAAC,MAjDR,oBArCR,OAAOC,MAAgB,aACvB,OAAS,WAAAC,MAAe,wBACxB,OAAS,aAAAC,EAAW,WAAAC,EAAS,YAAAC,MAAgB,QAC7C,OAAOC,MAAqB,sCAYrB,SAASC,EAAY,CAAE,OAAAC,EAAQ,UAAAC,EAAY,GAAI,UAAAC,EAAY,GAAI,UAAAC,EAAY,GAAI,SAAAC,CAAS,EAAqB,CAClH,KAAM,CAACC,EAAMC,CAAO,EAAIT,EAAS,EAAK,EAChC,CAACU,EAASC,CAAU,EAAIX,EAAc,EAAE,EAExCY,EAAWX,EAAgC,IAAM,CACrDQ,EAAQ,EAAK,CACf,CAAC,EAEKI,EAAQd,EAAQ,IAAM,CAC1B,MAAMe,EAAeX,EAAO,KAAKY,GAASV,EAAYU,EAAK,OAASV,EAAYU,EAAK,OAASX,CAAU,EAExG,OAAOU,EAAe,CAACA,GAAc,GAAIA,GAAc,KAAMA,GAAc,IAAI,EAAE,KAAK,GAAG,EAAI,EAC/F,EAAG,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EAC/C,UAAWnB,EACT,mGACA,CACE,gBAAiB,CAACmB,EAAK,GAAIA,EAAK,KAAMA,EAAK,IAAI,EAAE,KAAK,GAAG,IAAMF,CACjE,CACF,EAEA,UAAAnB,EAAC,UACC,UAAU,gDACV,MAAO,CAACqB,EAAK,GAAIA,EAAK,KAAMA,EAAK,IAAI,EAAE,KAAK,GAAG,EAC/C,QAAS,IAAM,CACbJ,EAAWI,EAAK,IAAI,EACpBN,EAAQ,EAAK,EACbF,EAASQ,EAAK,KAAMA,EAAK,IAAI,CAC/B,EACF,EACCA,EAAK,OAlBDA,EAAK,EAmBZ,CACD,EACH,EACF,GACF,EAEArB,EAAC,SACC,UAAWY,EACX,MAAOF,EACP,MAAO,CACL,oBAAqB,OACvB,EACA,SAAUa,GAAS,CACjBV,EAAS,GAAIU,EAAM,OAAO,KAAK,CACjC,EACD,EAEL,CAEJ",
6
+ "names": ["Fragment", "jsx", "jsxs", "classNames", "Picture", "useEffect", "useMemo", "useState", "useClickOutside", "StateSelect", "states", "stateName", "stateCode", "className", "onChange", "show", "setShow", "display", "setDisplay", "dropdown", "value", "currentState", "item", "target", "event", "name", "code"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{jsx as o,jsxs as B}from"react/jsx-runtime";import g from"classnames";import{useCallback as F,useEffect as S,useMemo as x,useState as _}from"react";import{CountrySelect as w}from"./CountrySelect";import{FormItem as I}from"./FormItem";import{Input as q}from"./Input";import{StateSelect as P}from"./StateSelect";import{ALPC_COUNTRY_MAP as K}from"../../context/const";import{useCreditsContext as U}from"../../context/provider";import{useShopifyContext as z}from"@anker-in/shopify";const J=({countries:c,countriesLoading:N,form:n,validate:C,errors:h,onChange:l})=>{const{profile:u,customer:r}=U(),{locale:m}=z(),[e,i]=_(),p=x(()=>c.find(a=>a.code===e?.country)?.provinces||[],[e,c]),b=x(()=>n?.flat().find(a=>a.type==="state")?.key,[n]),A=F(()=>{if(r?.defaultAddress)return{name:(r?.defaultAddress.firstName||"")+" "+(r?.defaultAddress.lastName||""),first_name:r?.defaultAddress.firstName,last_name:r?.defaultAddress.lastName,address1:r?.defaultAddress.address1,address2:r?.defaultAddress.address2,city:r?.defaultAddress.city,phone:r?.defaultAddress.phone,country:r?.defaultAddress.countryCodeV2,province:r?.defaultAddress.province,province_code:r?.defaultAddress.provinceCode,email:r?.email||u?.email,zip:r?.defaultAddress.zip};{let s=K.get(m)||m;return s==="UK"&&(s="GB"),s==="EU"&&(s="NL"),{email:u?.email,country:s}}},[r,u?.email,m]);return console.log("customer",r),S(()=>{if(r){const s=A();i(s),l(s)}},[r,A]),e?o("div",{className:"grid gap-[20px]",children:n&&n.map((s,a)=>o("div",{className:"item-center -mx-[6px] flex",children:s.map((t,k)=>{const f=h.find(d=>d.key===t.key)?.message,y=g("h-full w-full appearance-none rounded-[2px] border bg-white px-[14px] py-[17px] leading-[1] outline-none placeholder:text-[#999] autofill:shadow-white focus:border-brand disabled:pointer-events-none disabled:text-[#999] disabled:bg-[#F7F8F9] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",f?"!border-[#F84D4F]":"border-[#d8d8d8]");return t.type==="state"&&!p.length?null:o("div",{className:g("mx-[6px] flex-1"),children:B(I,{error:f,required:t.required,label:t.label,children:[t.type==="country"&&o(w,{className:y,countries:c,loading:N,value:e.country,onChange:d=>{e.country!==d&&(e.province="",e.province_code=""),e.country=d,i({...e}),l(e)}}),t.type==="state"&&o(P,{className:y,states:p,stateCode:e.province_code,stateName:e.province,onChange:(d,v)=>{e.province_code=d,e.province=v,i({...e}),l(e)}}),t.type!=="state"&&t.type!=="country"&&o(q,{placeholder:t.label,className:y,error:f,value:e[t.key],required:t.required,disabled:t.type==="email",onChange:d=>{const v=d.target.value;e[t.key]=v,i({...e}),l(e)},onBlur:()=>{C({ignoreKeys:p.length&&b?[b]:[]})}})]})},k)})},a))}):null};export{J as AddressForm};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/creditsRedeemList/AddressForm/index.tsx"],
4
+ "sourcesContent": ["import classNames from 'classnames'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { CountrySelect } from './CountrySelect'\nimport { FormItem } from './FormItem'\nimport { Input } from './Input'\nimport { StateSelect } from './StateSelect'\nimport { ALPC_COUNTRY_MAP } from '../../context/const'\nimport { useCreditsContext } from '../../context/provider'\nimport { useShopifyContext } from '@anker-in/shopify'\nimport { AddressFormProps } from './type'\n\nexport const AddressForm = ({ countries, countriesLoading, form, validate, errors, onChange }: AddressFormProps) => {\n const { profile, customer } = useCreditsContext()\n const { locale } = useShopifyContext()\n\n const [address, setAddress] = useState<Record<string, any>>()\n\n const states = useMemo(() => {\n const currentCountry = countries.find(item => item.code === address?.country)\n\n return currentCountry?.provinces || []\n }, [address, countries])\n\n const stateInputKey = useMemo(() => {\n const stateInput = form?.flat().find(item => item.type === 'state')\n return stateInput?.key\n }, [form])\n\n const getDefaultAddress = useCallback(() => {\n if (customer?.defaultAddress) {\n return {\n name: (customer?.defaultAddress.firstName || '') + ' ' + (customer?.defaultAddress.lastName || ''),\n first_name: customer?.defaultAddress.firstName,\n last_name: customer?.defaultAddress.lastName,\n address1: customer?.defaultAddress.address1,\n address2: customer?.defaultAddress.address2,\n city: customer?.defaultAddress.city,\n phone: customer?.defaultAddress.phone,\n country: customer?.defaultAddress.countryCodeV2,\n province: customer?.defaultAddress.province,\n province_code: customer?.defaultAddress.provinceCode,\n email: customer?.email || profile?.email,\n zip: customer?.defaultAddress.zip,\n }\n } else {\n let defaultCountry = ALPC_COUNTRY_MAP.get(locale) || locale\n if (defaultCountry === 'UK') {\n defaultCountry = 'GB'\n }\n if (defaultCountry === 'EU') {\n defaultCountry = 'NL'\n }\n return {\n email: profile?.email,\n country: defaultCountry,\n }\n }\n }, [customer, profile?.email, locale])\n\n console.log('customer', customer)\n useEffect(() => {\n if (customer) {\n const defaultAddress = getDefaultAddress()\n setAddress(defaultAddress)\n onChange(defaultAddress)\n }\n }, [customer, getDefaultAddress])\n\n if (!address) {\n return null\n }\n\n return (\n <div className=\"grid gap-[20px]\">\n {form &&\n form.map((row, rowIndex: number) => (\n <div key={rowIndex} className=\"item-center -mx-[6px] flex\">\n {row.map((input, inputIndex: number) => {\n const error = errors.find(item => item.key === input.key)?.message\n const inputClassName = classNames(\n 'h-full w-full appearance-none rounded-[2px] border bg-white px-[14px] py-[17px] leading-[1] outline-none placeholder:text-[#999] autofill:shadow-white focus:border-brand disabled:pointer-events-none disabled:text-[#999] disabled:bg-[#F7F8F9] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none',\n error ? '!border-[#F84D4F]' : 'border-[#d8d8d8]'\n )\n\n if (input.type === 'state') {\n if (!states.length) {\n return null\n }\n }\n\n return (\n <div key={inputIndex} className={classNames('mx-[6px] flex-1')}>\n <FormItem error={error} required={input.required} label={input.label}>\n {input.type === 'country' && (\n <CountrySelect\n className={inputClassName}\n countries={countries}\n loading={countriesLoading}\n value={address.country}\n onChange={selectedCountryCode => {\n if (address.country !== selectedCountryCode) {\n address.province = ''\n address.province_code = ''\n }\n address.country = selectedCountryCode\n setAddress({ ...address })\n onChange(address)\n }}\n ></CountrySelect>\n )}\n {input.type === 'state' && (\n <StateSelect\n className={inputClassName}\n states={states}\n stateCode={address.province_code}\n stateName={address.province}\n onChange={(provinceCode, provinceName) => {\n address.province_code = provinceCode\n address.province = provinceName\n setAddress({ ...address })\n onChange(address)\n }}\n ></StateSelect>\n )}\n\n {input.type !== 'state' && input.type !== 'country' && (\n <Input\n placeholder={input.label}\n className={inputClassName}\n error={error}\n value={address[input.key]}\n required={input.required}\n disabled={input.type === 'email'}\n onChange={event => {\n const value = event.target.value\n address[input.key] = value\n setAddress({ ...address })\n onChange(address)\n }}\n onBlur={() => {\n validate({\n ignoreKeys: states.length && stateInputKey ? [stateInputKey] : [],\n })\n }}\n />\n )}\n </FormItem>\n </div>\n )\n })}\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AAA,CACC,UAAW2B,EACX,OAAQX,EACR,UAAWF,EAAQ,cACnB,UAAWA,EAAQ,SACnB,SAAU,CAACe,EAAcC,IAAiB,CACxChB,EAAQ,cAAgBe,EACxBf,EAAQ,SAAWgB,EACnBf,EAAW,CAAE,GAAGD,CAAQ,CAAC,EACzBJ,EAASI,CAAO,CAClB,EACD,EAGFU,EAAM,OAAS,SAAWA,EAAM,OAAS,WACxClC,EAACS,EAAA,CACC,YAAayB,EAAM,MACnB,UAAWG,EACX,MAAOD,EACP,MAAOZ,EAAQU,EAAM,GAAG,EACxB,SAAUA,EAAM,SAChB,SAAUA,EAAM,OAAS,QACzB,SAAUO,GAAS,CACjB,MAAMC,EAAQD,EAAM,OAAO,MAC3BjB,EAAQU,EAAM,GAAG,EAAIQ,EACrBjB,EAAW,CAAE,GAAGD,CAAQ,CAAC,EACzBJ,EAASI,CAAO,CAClB,EACA,OAAQ,IAAM,CACZN,EAAS,CACP,WAAYQ,EAAO,QAAUE,EAAgB,CAACA,CAAa,EAAI,CAAC,CAClE,CAAC,CACH,EACF,GAEJ,GAvDQO,CAwDV,CAEJ,CAAC,GAzEOF,CA0EV,CACD,EACL,EAnFO,IAqFX",
6
+ "names": ["jsx", "jsxs", "classNames", "useCallback", "useEffect", "useMemo", "useState", "CountrySelect", "FormItem", "Input", "StateSelect", "ALPC_COUNTRY_MAP", "useCreditsContext", "useShopifyContext", "AddressForm", "countries", "countriesLoading", "form", "validate", "errors", "onChange", "profile", "customer", "locale", "address", "setAddress", "states", "item", "stateInputKey", "getDefaultAddress", "defaultCountry", "defaultAddress", "row", "rowIndex", "input", "inputIndex", "error", "inputClassName", "selectedCountryCode", "provinceCode", "provinceName", "event", "value"]
7
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ import{Fragment as E,jsx as t,jsxs as l}from"react/jsx-runtime";import{Button as M,Picture as k,Text as d}from"@anker-in/headless-ui";import c from"classnames";import{useCallback as I,useEffect as L,useState as u}from"react";import S from"../context/hooks/useCopy";import{useCreditsContext as y}from"../context/provider";import{useRedeemCoupon as _}from"../context/hooks/useRedeemCoupon";import{AlpcErrorCode as p}from"../context/const";import{CreditsModalContainer as B}from"../modal/modalContainer";import{numberFormat as z}from"../context/utils";import{useShopifyContext as P}from"@anker-in/shopify";function O({item:i,copy:e,onError:f,...r}){const{locale:w}=P(),[a,F]=u(),[g,s]=u(),[C,n]=u(!1),{copy:R,copied:b}=S(),{profile:x,fetchCreditInfo:v}=y(),{isMutating:N,trigger:h}=_({onSuccess(o){if(!o){s(e.redeemModal.commonError);return}if(o?.data?.success)F(o.data.coupon_code),v(x?.user_id);else{let m;o.code===p.CodeLpcShopifyCouponRuleRedeemLimit?(m=e.redeemModal.redeemLimitError,n(!0)):o.code===p.CodeLpcRuleInventoryNotEnough?(m=e.redeemModal.inventoryNotEnough,n(!0)):o.code===p.CodeLpcNotEnoughCredits?(m=e.redeemModal.creditsNotEnough,n(!0),v(x?.user_id)):o.code===p.CodeCrossSiteError&&(m=e.redeemModal.crossSiteError,n(!0)),s(m||e.redeemModal.commonError||""),f&&f(o.code)}},onError(o){s(o.message||e.redeemModal.commonError)}}),T=I(async()=>{s(""),h({user_id:x?.user_id,rule_id:Number(i.alpc?.id)})},[i,x,h]);return L(()=>{r.isOpen||(n(!1),s(""))},[r.isOpen]),l(B,{...r,className:"w-[540px] md:h-auto",scrollClassName:"mb-[40px] min-l:px-0 md:mb-[24px] px-0",titleClassName:"h-[56px] bg-[#F5F5F7]",children:[l("div",{className:c("max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:[l("div",{className:"relative mx-auto h-[164px] w-[324px]",children:[e?.imageMapping?.coupon?.url&&t(k,{source:e?.imageMapping?.coupon?.url,className:"h-full [&_img]:h-full"}),t("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white",children:i.config.value?l("div",{className:"flex items-end gap-[4px]",children:[t(d,{className:"text-[64px] font-bold leading-none",html:i.config.value.toString()}),t(d,{className:"text-[24px] font-bold leading-[2]",html:e?.off})]}):t(d,{size:3,html:i.alpc?.title})})]}),a?l("div",{className:"mt-[30px] flex items-center justify-center md:mt-[18px]",children:[t("div",{className:"mr-[10px] text-[24px] font-bold leading-[1.4] md:leading-[1.2]",children:a}),t("div",{className:c("cursor-pointer text-[16px] font-bold leading-[1.2] underline md:text-[14px]",b?"pointer-events-none":"pointer-events-auto"),onClick:()=>{R(a)},role:"button",tabIndex:0,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&o.preventDefault()},children:b?e?.copied:e?.copy})]}):l(d,{as:"p",className:c("mt-[30px] text-center text-[24px] font-bold leading-[1.2] md:mt-[18px] md:text-[20px] md:leading-[1.2]"),children:[z(i.alpc?.consumeCredits)," ",e?.pointUnit]}),!a&&i.config?.rules?.length>0&&l("div",{className:"mt-[18px] w-full text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px] md:text-[14px]",children:[l("div",{className:"mb-[4px]",children:[e?.ruleLabel,":"]}),t("ul",{className:"ml-4 grid grid-flow-row gap-[4px]",children:i.config?.rules?.map((o,m)=>t("li",{className:"list-disc",children:t(d,{html:o})},m))})]})]}),l("div",{className:"bg-white px-[48px] pt-[24px] text-center md:px-[16px]",children:[a&&!N?l(E,{children:[l("div",{className:"flex flex-col",children:[t(d,{className:"mb-[4px] text-[24px] font-bold leading-[1.2] md:text-[20px]",html:e.redeemModal.coupon.successTitle}),t(d,{className:"text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:text-[14px]",html:e.redeemModal.coupon.successDesc})]}),t(M,{variant:"primary",size:"lg",className:"mt-[16px] w-full",onClick:()=>{window.location.href=e.redeemModal.coupon.successButtonUrl||`/${w}`,r.onClose&&r.onClose()},disabled:C,children:e.redeemModal.coupon.successButton})]}):l(E,{children:[t(d,{className:"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]",html:e.redeemModal.confirmTitle}),t(M,{loading:N,variant:"primary",size:"lg",className:"mt-[16px] w-full",onClick:T,disabled:C,children:e.redeemModal.confirmButton})]}),g&&t("div",{className:"mx-auto max-w-full py-[12px] text-center",children:t(d,{className:"text-[14px] font-semibold text-[#1F2021]",html:g})})]})]})}var W=O;export{W as default};
2
+ //# sourceMappingURL=RedeemCouponModal.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/components/credits/creditsRedeemList/RedeemCouponModal.tsx"],
4
+ "sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCallback, useEffect, useState } from 'react'\nimport type { ModalContainerProps } from '../modal/modalContainer'\nimport useCopy from '../context/hooks/useCopy'\nimport { useCreditsContext } from '../context/provider'\nimport { useRedeemCoupon } from '../context/hooks/useRedeemCoupon'\nimport { AlpcErrorCode } from '../context/const'\nimport { CreditsModalContainer } from '../modal/modalContainer'\nimport { numberFormat } from '../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../type'\nimport { useShopifyContext } from '@anker-in/shopify'\nimport { CreditsRedeemListCopy } from './type'\n\nfunction RedeemCouponModal({\n item,\n copy,\n onError,\n ...props\n}: ModalContainerProps & {\n item: RedeemableItemType\n copy: CreditsRedeemListCopy\n onError: (code: number) => void\n}) {\n const { locale } = useShopifyContext()\n const [couponCode, setCouponCode] = useState<string>()\n const [errorInfo, setErrorInfo] = useState<string>()\n\n const [disabled, setDisabled] = useState(false)\n const { copy: copyText, copied: copiedStatus } = useCopy()\n\n const { profile, fetchCreditInfo } = useCreditsContext()\n\n const { isMutating: loading, trigger } = useRedeemCoupon({\n onSuccess(responseData) {\n if (!responseData) {\n setErrorInfo(copy.redeemModal.commonError)\n return\n }\n\n if (responseData?.data?.success) {\n setCouponCode(responseData.data.coupon_code)\n fetchCreditInfo(profile?.user_id)\n } else {\n let errorMsg\n if (responseData.code === AlpcErrorCode.CodeLpcShopifyCouponRuleRedeemLimit) {\n errorMsg = copy.redeemModal.redeemLimitError\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n errorMsg = copy.redeemModal.inventoryNotEnough\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcNotEnoughCredits) {\n errorMsg = copy.redeemModal.creditsNotEnough\n setDisabled(true)\n fetchCreditInfo(profile?.user_id)\n } else if (responseData.code === AlpcErrorCode.CodeCrossSiteError) {\n errorMsg = copy.redeemModal.crossSiteError\n setDisabled(true)\n }\n\n setErrorInfo(errorMsg || copy.redeemModal.commonError || '')\n onError && onError(responseData.code)\n }\n },\n onError(error) {\n setErrorInfo(error.message || copy.redeemModal.commonError)\n },\n })\n\n const handleConfirm = useCallback(async () => {\n setErrorInfo('')\n trigger({\n user_id: profile?.user_id,\n rule_id: Number(item.alpc?.id),\n })\n }, [item, profile, trigger])\n\n useEffect(() => {\n if (!props.isOpen) {\n setDisabled(false)\n setErrorInfo('')\n }\n }, [props.isOpen])\n\n return (\n <CreditsModalContainer\n {...props}\n className=\"w-[540px] md:h-auto\"\n scrollClassName=\"mb-[40px] min-l:px-0 md:mb-[24px] px-0\"\n titleClassName=\"h-[56px] bg-[#F5F5F7]\"\n >\n <div\n className={classNames(\n 'max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]'\n )}\n >\n <div className=\"relative mx-auto h-[164px] w-[324px]\">\n {copy?.imageMapping?.coupon?.url && (\n <Picture source={copy?.imageMapping?.coupon?.url} className=\"h-full [&_img]:h-full\" />\n )}\n <div className=\"absolute bottom-[8px] left-[16px] font-extrabold text-white\">\n {item.config.value ? (\n <div className=\"flex items-end gap-[4px]\">\n <Text className=\"text-[64px] font-bold leading-none\" html={item.config.value.toString()} />\n <Text className=\"text-[24px] font-bold leading-[2]\" html={copy?.off} />\n </div>\n ) : (\n <Text size={3} html={item.alpc?.title} />\n )}\n </div>\n </div>\n {couponCode ? (\n <div className=\"mt-[30px] flex items-center justify-center md:mt-[18px]\">\n <div className=\"mr-[10px] text-[24px] font-bold leading-[1.4] md:leading-[1.2]\">{couponCode}</div>\n <div\n className={classNames(\n 'cursor-pointer text-[16px] font-bold leading-[1.2] underline md:text-[14px]',\n copiedStatus ? 'pointer-events-none' : 'pointer-events-auto'\n )}\n onClick={() => {\n copyText(couponCode)\n }}\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {copiedStatus ? copy?.copied : copy?.copy}\n </div>\n </div>\n ) : (\n <Text\n as=\"p\"\n className={classNames(\n 'mt-[30px] text-center text-[24px] font-bold leading-[1.2] md:mt-[18px] md:text-[20px] md:leading-[1.2]'\n )}\n >\n {numberFormat(item.alpc?.consumeCredits)} {copy?.pointUnit}\n </Text>\n )}\n {!couponCode && item.config?.rules?.length > 0 && (\n <div className=\"mt-[18px] w-full text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px] md:text-[14px]\">\n <div className=\"mb-[4px]\">{copy?.ruleLabel}:</div>\n <ul className=\"ml-4 grid grid-flow-row gap-[4px]\">\n {item.config?.rules?.map((text, index) => (\n <li className=\"list-disc\" key={index}>\n <Text html={text} />\n </li>\n ))}\n </ul>\n </div>\n )}\n </div>\n <div className=\"bg-white px-[48px] pt-[24px] text-center md:px-[16px]\">\n {couponCode && !loading ? (\n <>\n <div className=\"flex flex-col\">\n <Text\n className=\"mb-[4px] text-[24px] font-bold leading-[1.2] md:text-[20px]\"\n html={copy.redeemModal.coupon.successTitle}\n ></Text>\n <Text\n className=\"text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:text-[14px]\"\n html={copy.redeemModal.coupon.successDesc}\n ></Text>\n </div>\n <Button\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full\"\n onClick={() => {\n window.location.href = copy.redeemModal.coupon.successButtonUrl || `/${locale}`\n if (props.onClose) {\n props.onClose()\n }\n }}\n disabled={disabled}\n >\n {copy.redeemModal.coupon.successButton}\n </Button>\n </>\n ) : (\n <>\n <Text\n className=\"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]\"\n html={copy.redeemModal.confirmTitle}\n ></Text>\n <Button\n loading={loading}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full\"\n onClick={handleConfirm}\n disabled={disabled}\n >\n {copy.redeemModal.confirmButton}\n </Button>\n </>\n )}\n {errorInfo && (\n <div className=\"mx-auto max-w-full py-[12px] text-center\">\n <Text className=\"text-[14px] font-semibold text-[#1F2021]\" html={errorInfo} />\n </div>\n )}\n </div>\n </CreditsModalContainer>\n )\n}\n\nexport default RedeemCouponModal\n"],
5
+ "mappings": "AAkGY,OA4DF,YAAAA,EA5DE,OAAAC,EAIE,QAAAC,MAJF,oBAlGZ,OAAS,UAAAC,EAAQ,WAAAC,EAAS,QAAAC,MAAY,wBACtC,OAAOC,MAAgB,aACvB,OAAS,eAAAC,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAOC,MAAa,2BACpB,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,mBAAAC,MAAuB,mCAChC,OAAS,iBAAAC,MAAqB,mBAC9B,OAAS,yBAAAC,MAA6B,0BACtC,OAAS,gBAAAC,MAAoB,mBAE7B,OAAS,qBAAAC,MAAyB,oBAGlC,SAASC,EAAkB,CACzB,KAAAC,EACA,KAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EAIG,CACD,KAAM,CAAE,OAAAC,CAAO,EAAIN,EAAkB,EAC/B,CAACO,EAAYC,CAAa,EAAIf,EAAiB,EAC/C,CAACgB,EAAWC,CAAY,EAAIjB,EAAiB,EAE7C,CAACkB,EAAUC,CAAW,EAAInB,EAAS,EAAK,EACxC,CAAE,KAAMoB,EAAU,OA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,CAE/B,CACD,EACH,GACF,GAEJ,EACAvC,EAAC,OAAI,UAAU,wDACZ,UAAAqB,GAAc,CAACU,EACd/B,EAAAF,EAAA,CACE,UAAAE,EAAC,OAAI,UAAU,gBACb,UAAAD,EAACI,EAAA,CACC,UAAU,8DACV,KAAMc,EAAK,YAAY,OAAO,aAC/B,EACDlB,EAACI,EAAA,CACC,UAAU,oEACV,KAAMc,EAAK,YAAY,OAAO,YAC/B,GACH,EACAlB,EAACE,EAAA,CACC,QAAQ,UACR,KAAK,KACL,UAAU,mBACV,QAAS,IAAM,CACb,OAAO,SAAS,KAAOgB,EAAK,YAAY,OAAO,kBAAoB,IAAIG,CAAM,GACzED,EAAM,SACRA,EAAM,QAAQ,CAElB,EACA,SAAUM,EAET,SAAAR,EAAK,YAAY,OAAO,cAC3B,GACF,EAEAjB,EAAAF,EAAA,CACE,UAAAC,EAACI,EAAA,CACC,UAAU,4EACV,KAAMc,EAAK,YAAY,aACxB,EACDlB,EAACE,EAAA,CACC,QAAS8B,EACT,QAAQ,UACR,KAAK,KACL,UAAU,mBACV,QAASK,EACT,SAAUX,EAET,SAAAR,EAAK,YAAY,cACpB,GACF,EAEDM,GACCxB,EAAC,OAAI,UAAU,2CACb,SAAAA,EAACI,EAAA,CAAK,UAAU,2CAA2C,KAAMoB,EAAW,EAC9E,GAEJ,GACF,CAEJ,CAEA,IAAOiB,EAAQzB",
6
+ "names": ["Fragment", "jsx", "jsxs", "Button", "Picture", "Text", "classNames", "useCallback", "useEffect", "useState", "useCopy", "useCreditsContext", "useRedeemCoupon", "AlpcErrorCode", "CreditsModalContainer", "numberFormat", "useShopifyContext", "RedeemCouponModal", "item", "copy", "onError", "props", "locale", "couponCode", "setCouponCode", "errorInfo", "setErrorInfo", "disabled", "setDisabled", "copyText", "copiedStatus", "profile", "fetchCreditInfo", "loading", "trigger", "responseData", "errorMsg", "error", "handleConfirm", "e", "text", "index", "RedeemCouponModal_default"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Button as v,Text as r}from"@anker-in/headless-ui";import b from"classnames";import{AddressForm as g}from"../AddressForm";import{useShopifyContext as h}from"@anker-in/shopify";import{ProductInfo as C}from"./ProductInfo";import N from"../../context/hooks/useCountries";const k=({copy:t,shippingAddress:s,setAddress:i,validateAddress:m,validateErrors:a,shippingProduct:d,loading:n,address:p,disabled:l,handlePayment:x,item:c})=>{const{storeDomain:f}=h(),{countries:u=[],isLoading:y}=N({shopifyStoreDomain:f});return o("div",{className:"relative",children:[e("div",{className:b("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:o("div",{children:[s&&e(r,{className:"mb-5 text-[16px] font-bold",html:s}),e(g,{onChange:i,validate:m,errors:a,form:t.redeemModal.product.addressForm,countries:u,countriesLoading:y})]})}),o("div",{className:"sticky bottom-0 flex flex-col items-center justify-center bg-white px-[48px] py-[24px] l:px-[16px]",children:[o("div",{className:"flex w-full items-center rounded-[16px] bg-[#F5F5F7] p-[16px]",children:[d&&e(r,{className:"mb-5 text-[16px] font-bold",html:d}),e(C,{item:c,copy:t})]}),e(v,{loading:n||!p,variant:"primary",className:"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full",onClick:x,disabled:l,children:t.redeemModal.product.paymentButton})]})]})};export{k as Address};
2
+ //# sourceMappingURL=Address.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx"],
4
+ "sourcesContent": ["import { Button, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { AddressForm } from '../AddressForm'\nimport { useShopifyContext } from '@anker-in/shopify'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ProductInfo } from './ProductInfo'\nimport useCountries from '../../context/hooks/useCountries'\n\ntype AddressProps = {\n copy: CreditsRedeemListCopy\n shippingAddress: string\n setAddress: (address: Record<string, any>) => void\n validateAddress: (address: Record<string, any>) => boolean\n validateErrors: { key: string; message: string }[]\n item: RedeemableItemType\n loading: boolean\n address: Record<string, any> | undefined\n disabled: boolean\n handlePayment: () => void\n shippingProduct: string\n}\n\nexport const Address = ({\n copy,\n shippingAddress,\n setAddress,\n validateAddress,\n validateErrors,\n shippingProduct,\n loading,\n address,\n disabled,\n handlePayment,\n item,\n}: AddressProps) => {\n const { storeDomain } = useShopifyContext()\n const { countries = [], isLoading: countriesLoading } = useCountries({ shopifyStoreDomain: storeDomain })\n\n return (\n <div className=\"relative\">\n <div className={classNames('max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]')}>\n <div>\n {shippingAddress && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingAddress}></Text>}\n <AddressForm\n onChange={setAddress}\n validate={validateAddress}\n errors={validateErrors}\n form={copy.redeemModal.product.addressForm}\n countries={countries}\n countriesLoading={countriesLoading}\n ></AddressForm>\n </div>\n </div>\n <div className=\"sticky bottom-0 flex flex-col items-center justify-center bg-white px-[48px] py-[24px] l:px-[16px]\">\n <div className=\"flex w-full items-center rounded-[16px] bg-[#F5F5F7] p-[16px]\">\n {shippingProduct && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingProduct}></Text>}\n <ProductInfo item={item} copy={copy} />\n </div>\n <Button\n loading={loading || !address}\n variant=\"primary\"\n className=\"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full\"\n onClick={handlePayment}\n disabled={disabled}\n >\n {copy.redeemModal.product.paymentButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
5
+ "mappings": "AA0CQ,OACsB,OAAAA,EADtB,QAAAC,MAAA,oBA1CR,OAAS,UAAAC,EAAQ,QAAAC,MAAY,wBAC7B,OAAOC,MAAgB,aACvB,OAAS,eAAAC,MAAmB,iBAC5B,OAAS,qBAAAC,MAAyB,oBAGlC,OAAS,eAAAC,MAAmB,gBAC5B,OAAOC,MAAkB,mCAgBlB,MAAMC,EAAU,CAAC,CACtB,KAAAC,EACA,gBAAAC,EACA,WAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,gBAAAC,EACA,QAAAC,EACA,QAAAC,EACA,SAAAC,EACA,cAAAC,EACA,KAAAC,CACF,IAAoB,CAClB,KAAM,CAAE,YAAAC,CAAY,EAAIf,EAAkB,EACpC,CAAE,UAAAgB,EAAY,CAAC,EAAG,UAAWC,CAAiB,EAAIf,EAAa,CAAE,mBAAoBa,CAAY,CAAC,EAExG,OACEpB,EAAC,OAAI,UAAU,WACb,UAAAD,EAAC,OAAI,UAAWI,EAAW,iFAAiF,EAC1G,SAAAH,EAAC,OACE,UAAAU,GAAmBX,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMQ,EAAiB,EACxFX,EAACK,EAAA,CACC,SAAUO,EACV,SAAUC,EACV,OAAQC,EACR,KAAMJ,EAAK,YAAY,QAAQ,YAC/B,UAAWY,EACX,iBAAkBC,EACnB,GACH,EACF,EACAtB,EAAC,OAAI,UAAU,qGACb,UAAAA,EAAC,OAAI,UAAU,gEACZ,UAAAc,GAAmBf,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMY,EAAiB,EACxFf,EAACO,EAAA,CAAY,KAAMa,EAAM,KAAMV,EAAM,GACvC,EACAV,EAACE,EAAA,CACC,QAASc,GAAW,CAACC,EACrB,QAAQ,UACR,UAAU,qDACV,QAASE,EACT,SAAUD,EAET,SAAAR,EAAK,YAAY,QAAQ,cAC5B,GACF,GACF,CAEJ",
6
+ "names": ["jsx", "jsxs", "Button", "Text", "classNames", "AddressForm", "useShopifyContext", "ProductInfo", "useCountries", "Address", "copy", "shippingAddress", "setAddress", "validateAddress", "validateErrors", "shippingProduct", "loading", "address", "disabled", "handlePayment", "item", "storeDomain", "countries", "countriesLoading"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{jsx as e,jsxs as a}from"react/jsx-runtime";import{Picture as t,Text as s}from"@anker-in/headless-ui";const x=({errorInfo:r})=>a("div",{className:"mx-auto max-w-[404px] text-[16px] text-black/40",children:[e(t,{className:"mx-auto mb-[12px] h-[140px] w-[220px]",source:r.imageUrl}),e(s,{as:"div",className:"mt-[16px] text-center",html:r.message})]});export{x as Error};
2
+ //# sourceMappingURL=Error.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/Error.tsx"],
4
+ "sourcesContent": ["import { Picture, Text } from '@anker-in/headless-ui'\n\ntype ErrorProps = {\n errorInfo: { imageUrl: string; message: string }\n}\n\nexport const Error = ({ errorInfo }: ErrorProps) => {\n return (\n <div className=\"mx-auto max-w-[404px] text-[16px] text-black/40\">\n <Picture className=\"mx-auto mb-[12px] h-[140px] w-[220px]\" source={errorInfo.imageUrl} />\n <Text as=\"div\" className=\"mt-[16px] text-center\" html={errorInfo.message} />\n </div>\n )\n}\n"],
5
+ "mappings": "AAQI,OACE,OAAAA,EADF,QAAAC,MAAA,oBARJ,OAAS,WAAAC,EAAS,QAAAC,MAAY,wBAMvB,MAAMC,EAAQ,CAAC,CAAE,UAAAC,CAAU,IAE9BJ,EAAC,OAAI,UAAU,kDACb,UAAAD,EAACE,EAAA,CAAQ,UAAU,wCAAwC,OAAQG,EAAU,SAAU,EACvFL,EAACG,EAAA,CAAK,GAAG,MAAM,UAAU,wBAAwB,KAAME,EAAU,QAAS,GAC5E",
6
+ "names": ["jsx", "jsxs", "Picture", "Text", "Error", "errorInfo"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{Fragment as b,jsx as e,jsxs as s}from"react/jsx-runtime";import{Button as f,Picture as i,Text as a}from"@anker-in/headless-ui";import m from"classnames";import{Fragment as u,useMemo as g}from"react";import{numberFormat as v}from"../../context/utils";import{ConsumeType as r}from"../../context/const";const F=({copy:l,item:t,loading:x,disabled:n,setStatus:c})=>{const p=g(()=>t.config.rules?.length?t.config.rules:[...t.config.desc?.split("<br>")||[],...l.redeemModal.product.rules||[]],[t.config.rules,t.config.desc,l.redeemModal.product.rules]);return console.log("item",t),s("div",{className:"flex flex-col",children:[e("div",{className:m("max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:s(b,{children:[s("div",{className:"relative mx-auto h-[164px] w-fit",children:[e(i,{source:t.config?.type===r.Product?t.product.images[0]?.url:l?.imageMapping[t.config.type]?.url||t.config.image?.url,className:"h-full w-auto [&_img]:h-full [&_img]:w-auto [&_img]:object-contain"}),e("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white",children:t.config.value&&s("div",{className:"flex items-end gap-[4px]",children:[e(a,{className:"text-[64px] font-bold leading-none",html:t.config.value.toString()}),e(a,{className:"text-[24px] font-bold leading-[2]",html:t.config.type===r.Coupon?l?.off:l?.giftCardLabel})]})})]}),s("div",{className:"mt-[30px] md:mt-[18px]",children:[t.config.type==="product"&&e("div",{className:m("mb-[4px] text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]"),children:t.config.title}),s(a,{as:"p",className:m(" text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]"),children:[v(t.alpc?.consumeCredits)," ",l?.pointUnit]})]}),s("div",{className:"mt-[16px] w-full text-[14px] font-semibold text-[#777] md:mt-[12px]",children:[e("div",{className:"text-[16px] font-bold leading-[1.4]",children:l.redeemModal.product.stepTitle}),e("div",{className:"mt-[4px] flex items-center justify-center",children:l.redeemModal.product.steps?.map((d,o)=>s(u,{children:[s("div",{className:"flex w-[76px] flex-col items-center text-center md:h-[94px] min-l:w-[130px]",children:[e(i,{source:d.imageUrl,className:"mb-[4px] h-[58px] w-[58px]"}),e("div",{className:"min-h-[34px] text-[14px] font-bold text-[#777] md:min-h-[28px] md:text-[12px]",children:d.title})]}),o!==l.redeemModal.product.steps.length-1&&e(i,{source:"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/step-arrow.png?v=1690458150",className:"mb-[20px] h-[10px] w-[20px] md:mb-[30px] md:h-[5px] md:w-[12px]"})]},o))}),e("div",{className:"overflow-auto",children:p?.length&&e("ul",{className:"ml-[18px] mt-[16px] grid grid-flow-row gap-[4px] text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px]",children:p.map((d,o)=>e("li",{className:"list-disc",children:e(a,{as:"div",html:d,className:"font-bold"})},o))})})]})]})}),s("div",{className:"flex-1 bg-white px-[48px] py-[24px] text-center md:px-[16px]",children:[e(a,{as:"p",className:"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]",html:l.redeemModal.confirmTitle}),e(f,{loading:x,disabled:n,variant:"primary",size:"lg",className:"mt-[16px] w-full md:mt-[12px]",onClick:()=>{c("address")},children:l.redeemModal.confirmButton})]})]})};export{F as Init};
2
+ //# sourceMappingURL=Init.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/Init.tsx"],
4
+ "sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { Fragment, useMemo } from 'react'\nimport { numberFormat } from '../../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ConsumeType } from '../../context/const'\n\ntype InitProps = {\n copy: CreditsRedeemListCopy\n item: RedeemableItemType\n loading: boolean\n disabled: boolean\n setStatus: (status: 'address' | 'init' | 'success' | 'error') => void\n}\n\nexport const Init = ({ copy, item, loading, disabled, setStatus }: InitProps) => {\n const rules = useMemo(() => {\n if (item.config.rules?.length) {\n return item.config.rules\n }\n const descriptions = item.config.desc?.split('<br>') || []\n return [...descriptions, ...(copy.redeemModal.product.rules || [])]\n }, [item.config.rules, item.config.desc, copy.redeemModal.product.rules])\n\n console.log('item', item)\n return (\n <div className=\"flex flex-col\">\n <div\n className={classNames(\n 'max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]'\n )}\n >\n <>\n <div className=\"relative mx-auto h-[164px] w-fit\">\n <Picture\n source={\n item.config?.type === ConsumeType.Product\n ? item.product.images[0]?.url\n : copy?.imageMapping[item.config.type]?.url || item.config.image?.url\n }\n className=\"h-full w-auto [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n ></Picture>\n {/* \u793C\u54C1\u5361\u5C55\u793A */}\n <div className=\"absolute bottom-[8px] left-[16px] font-extrabold text-white\">\n {item.config.value && (\n <div className=\"flex items-end gap-[4px]\">\n <Text className=\"text-[64px] font-bold leading-none\" html={item.config.value.toString()} />\n <Text\n className=\"text-[24px] font-bold leading-[2]\"\n html={item.config.type === ConsumeType.Coupon ? copy?.off : copy?.giftCardLabel}\n />\n </div>\n )}\n </div>\n </div>\n <div className=\"mt-[30px] md:mt-[18px]\">\n {item.config.type === 'product' && (\n <div\n className={classNames(\n 'mb-[4px] text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]'\n )}\n >\n {item.config.title}\n </div>\n )}\n <Text\n as=\"p\"\n className={classNames(' text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]')}\n >\n {numberFormat(item.alpc?.consumeCredits)} {copy?.pointUnit}\n </Text>\n </div>\n <div className=\"mt-[16px] w-full text-[14px] font-semibold text-[#777] md:mt-[12px]\">\n <div className=\"text-[16px] font-bold leading-[1.4]\">{copy.redeemModal.product.stepTitle}</div>\n <div className=\"mt-[4px] flex items-center justify-center\">\n {copy.redeemModal.product.steps?.map((item, index) => (\n <Fragment key={index}>\n <div className=\"flex w-[76px] flex-col items-center text-center md:h-[94px] min-l:w-[130px]\">\n <Picture source={item.imageUrl} className=\"mb-[4px] h-[58px] w-[58px]\"></Picture>\n <div className=\"min-h-[34px] text-[14px] font-bold text-[#777] md:min-h-[28px] md:text-[12px]\">\n {item.title}\n </div>\n </div>\n {index !== copy.redeemModal.product.steps.length - 1 && (\n <Picture\n source=\"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/step-arrow.png?v=1690458150\"\n className=\"mb-[20px] h-[10px] w-[20px] md:mb-[30px] md:h-[5px] md:w-[12px]\"\n ></Picture>\n )}\n </Fragment>\n ))}\n </div>\n <div className=\"overflow-auto\">\n {rules?.length && (\n <ul className=\"ml-[18px] mt-[16px] grid grid-flow-row gap-[4px] text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px]\">\n {rules.map((text, index) => (\n <li className=\"list-disc\" key={index}>\n <Text as=\"div\" html={text} className=\"font-bold\" />\n </li>\n ))}\n </ul>\n )}\n </div>\n </div>\n </>\n </div>\n <div className=\"flex-1 bg-white px-[48px] py-[24px] text-center md:px-[16px]\">\n <Text\n as=\"p\"\n className=\"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]\"\n html={copy.redeemModal.confirmTitle}\n ></Text>\n <Button\n loading={loading}\n disabled={disabled}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full md:mt-[12px]\"\n onClick={() => {\n setStatus('address')\n }}\n >\n {copy.redeemModal.confirmButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
5
+ "mappings": "AAiCQ,mBAAAA,EAEI,OAAAC,EAWI,QAAAC,MAbR,oBAjCR,OAAS,UAAAC,EAAQ,WAAAC,EAAS,QAAAC,MAAY,wBACtC,OAAOC,MAAgB,aACvB,OAAS,YAAAN,EAAU,WAAAO,MAAe,QAClC,OAAS,gBAAAC,MAAoB,sBAG7B,OAAS,eAAAC,MAAmB,sBAUrB,MAAMC,EAAO,CAAC,CAAE,KAAAC,EAAM,KAAAC,EAAM,QAAAC,EAAS,SAAAC,EAAU,UAAAC,CAAU,IAAiB,CAC/E,MAAMC,EAAQT,EAAQ,IAChBK,EAAK,OAAO,OAAO,OACdA,EAAK,OAAO,MAGd,CAAC,GADaA,EAAK,OAAO,MAAM,MAAM,MAAM,GAAK,CAAC,EAChC,GAAID,EAAK,YAAY,QAAQ,OAAS,CAAC,CAA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AK,SAAU,UAAU,6BAA6B,EACvEX,EAAC,OAAI,UAAU,gFACZ,SAAAW,EAAK,MACR,GACF,EACCK,IAAUN,EAAK,YAAY,QAAQ,MAAM,OAAS,GACjDV,EAACG,EAAA,CACC,OAAO,qFACP,UAAU,kEACX,IAXUa,CAaf,CACD,EACH,EACAhB,EAAC,OAAI,UAAU,gBACZ,SAAAe,GAAO,QACNf,EAAC,MAAG,UAAU,mHACX,SAAAe,EAAM,IAAI,CAACE,EAAMD,IAChBhB,EAAC,MAAG,UAAU,YACZ,SAAAA,EAACI,EAAA,CAAK,GAAG,MAAM,KAAMa,EAAM,UAAU,YAAY,GADpBD,CAE/B,CACD,EACH,EAEJ,GACF,GACF,EACF,EACAf,EAAC,OAAI,UAAU,+DACb,UAAAD,EAACI,EAAA,CACC,GAAG,IACH,UAAU,4EACV,KAAMM,EAAK,YAAY,aACxB,EACDV,EAACE,EAAA,CACC,QAASU,EACT,SAAUC,EACV,QAAQ,UACR,KAAK,KACL,UAAU,gCACV,QAAS,IAAM,CACbC,EAAU,SAAS,CACrB,EAEC,SAAAJ,EAAK,YAAY,cACpB,GACF,GACF,CAEJ",
6
+ "names": ["Fragment", "jsx", "jsxs", "Button", "Picture", "Text", "classNames", "useMemo", "numberFormat", "ConsumeType", "Init", "copy", "item", "loading", "disabled", "setStatus", "rules", "index", "text"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{jsx as a,jsxs as e}from"react/jsx-runtime";import{Picture as m}from"@anker-in/headless-ui";import{formatPrice as l}from"../../context/utils";import{useShopifyContext as i}from"@anker-in/shopify";const x=({item:t,copy:d})=>{const{locale:s}=i();return e("div",{className:"flex w-full items-center justify-center md:items-start md:justify-start",children:[a(m,{className:"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:hidden md:size-[44px] [&_img]:h-full [&_img]:w-auto [&_img]:object-contain",source:t.variant.image?.url||t.product?.images[0]?.url,alt:t.product.title}),e("div",{className:"md:flex md:flex-col",children:[e("div",{className:"md:flex md:items-center",children:[a(m,{className:"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:size-[44px] min-md:hidden [&_img]:h-full [&_img]:w-auto [&_img]:object-contain",source:t.variant.image?.url||t.product?.images[0]?.url,alt:t.product.title}),a("div",{className:"flex-1 text-[16px] font-bold leading-[1.4] min-l:!hidden",title:t.product.title,children:t.product.title})]}),e("div",{className:"mt-[16px] md:mt-[12px]",children:[a("div",{className:"mb-[12px] line-clamp-1 text-[16px] font-bold l:!hidden",title:t.product.title,children:t.product.title}),e("div",{className:"flex font-semibold leading-[1.4] md:flex-col",children:[e("div",{className:"mr-[40px] text-[15px] font-bold text-[#777] md:mr-0 md:text-[12px]",children:[e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[d.redeemModal.product.variantLabel,": "]}),a("span",{className:"ml-1",children:t.variant.title||""})]}),e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[d.redeemModal.product.shippingFeeLabel,": "]}),a("span",{className:"ml-1",children:l({amount:0,currencyCode:t.product.price?.currencyCode,locale:s||"us"})})]})]}),e("div",{className:"text-[15px] font-bold text-[#777] md:text-[12px]",children:[e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[d.redeemModal.product.quantityLabel,": "]}),a("span",{className:"ml-1",children:"1"})]}),e("div",{className:"l:flex l:items-center l:justify-between",children:[e("span",{children:[d.redeemModal.product.totalPriceLabel,": "]}),e("span",{className:"ml-1",children:[t.alpc?.consumeCredits," ",d?.pointUnit]})]})]})]})]})]})]})};export{x as ProductInfo};
2
+ //# sourceMappingURL=ProductInfo.js.map