@anker-in/campaign-ui 0.2.11-beta.3 → 0.2.11-beta.4

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 (193) hide show
  1. package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.d.ts +2 -2
  2. package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.js +1 -1
  3. package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.js.map +2 -2
  4. package/dist/cjs/components/credits/context/memberPriceConst.d.ts +0 -5
  5. package/dist/cjs/components/credits/context/memberPriceConst.js +1 -1
  6. package/dist/cjs/components/credits/context/memberPriceConst.js.map +3 -3
  7. package/dist/cjs/components/credits/context/memberPriceTypes.d.ts +1 -22
  8. package/dist/cjs/components/credits/context/memberPriceTypes.js +1 -1
  9. package/dist/cjs/components/credits/context/memberPriceTypes.js.map +1 -1
  10. package/dist/cjs/components/credits/context/provider.d.ts +15 -1
  11. package/dist/cjs/components/credits/context/provider.js +1 -1
  12. package/dist/cjs/components/credits/context/provider.js.map +3 -3
  13. package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.d.ts +2 -2
  14. package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.js +1 -1
  15. package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.js.map +1 -1
  16. package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.d.ts +2 -2
  17. package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js +1 -1
  18. package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js.map +1 -1
  19. package/dist/cjs/components/credits/context/utils/variantGetCoupon.d.ts +2 -2
  20. package/dist/cjs/components/credits/context/utils/variantGetCoupon.js +1 -1
  21. package/dist/cjs/components/credits/context/utils/variantGetCoupon.js.map +1 -1
  22. package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js +1 -1
  23. package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js.map +3 -3
  24. package/dist/cjs/components/credits/creditsBanner/index.d.ts +2 -0
  25. package/dist/cjs/components/credits/creditsBanner/index.js +12 -1
  26. package/dist/cjs/components/credits/creditsBanner/index.js.map +3 -3
  27. package/dist/cjs/components/credits/creditsBenefits/BenefitItem.js +2 -0
  28. package/dist/cjs/components/credits/creditsBenefits/BenefitItem.js.map +7 -0
  29. package/dist/cjs/components/credits/creditsBenefits/{iconInfo.js → IconInfo.js} +1 -1
  30. package/dist/cjs/components/credits/creditsBenefits/{iconInfo.js.map → IconInfo.js.map} +1 -1
  31. package/dist/cjs/components/credits/creditsCash/CreditsCash.js +1 -1
  32. package/dist/cjs/components/credits/creditsCash/CreditsCash.js.map +2 -2
  33. package/dist/cjs/components/credits/creditsCash/RedeemableItem.js +1 -1
  34. package/dist/cjs/components/credits/creditsCash/RedeemableItem.js.map +2 -2
  35. package/dist/cjs/components/credits/creditsCash/type.d.ts +1 -0
  36. package/dist/cjs/components/credits/creditsCash/type.js +1 -1
  37. package/dist/cjs/components/credits/creditsCash/type.js.map +1 -1
  38. package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.js +1 -1
  39. package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.js.map +3 -3
  40. package/dist/cjs/components/credits/creditsInfoCard/index.js +1 -1
  41. package/dist/cjs/components/credits/creditsInfoCard/index.js.map +2 -2
  42. package/dist/cjs/components/credits/creditsMemberPrice/CreditsMemberPrice.js +1 -1
  43. package/dist/cjs/components/credits/creditsMemberPrice/CreditsMemberPrice.js.map +3 -3
  44. package/dist/cjs/components/credits/creditsMemberPrice/MemberPriceItem.js +1 -1
  45. package/dist/cjs/components/credits/creditsMemberPrice/MemberPriceItem.js.map +3 -3
  46. package/dist/cjs/components/credits/creditsMemberPrice/type.d.ts +3 -5
  47. package/dist/cjs/components/credits/creditsMemberPrice/type.js +1 -1
  48. package/dist/cjs/components/credits/creditsMemberPrice/type.js.map +1 -1
  49. package/dist/cjs/components/credits/creditsNavigation/CreditsNavigation.js +1 -1
  50. package/dist/cjs/components/credits/creditsNavigation/CreditsNavigation.js.map +2 -2
  51. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
  52. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
  53. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  54. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
  55. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
  56. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +3 -3
  57. package/dist/cjs/templates/{credits.d.ts → Credits.d.ts} +15 -1
  58. package/dist/cjs/templates/Credits.js +2 -0
  59. package/dist/cjs/templates/Credits.js.map +7 -0
  60. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.d.ts +2 -2
  61. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js +1 -1
  62. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js.map +2 -2
  63. package/dist/esm/components/credits/context/memberPriceConst.d.ts +0 -5
  64. package/dist/esm/components/credits/context/memberPriceConst.js +1 -1
  65. package/dist/esm/components/credits/context/memberPriceConst.js.map +3 -3
  66. package/dist/esm/components/credits/context/memberPriceTypes.d.ts +1 -22
  67. package/dist/esm/components/credits/context/provider.d.ts +15 -1
  68. package/dist/esm/components/credits/context/provider.js +1 -1
  69. package/dist/esm/components/credits/context/provider.js.map +3 -3
  70. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.d.ts +2 -2
  71. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js +1 -1
  72. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js.map +1 -1
  73. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.d.ts +2 -2
  74. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js +1 -1
  75. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js.map +1 -1
  76. package/dist/esm/components/credits/context/utils/variantGetCoupon.d.ts +2 -2
  77. package/dist/esm/components/credits/context/utils/variantGetCoupon.js +1 -1
  78. package/dist/esm/components/credits/context/utils/variantGetCoupon.js.map +1 -1
  79. package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js +1 -1
  80. package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js.map +3 -3
  81. package/dist/esm/components/credits/creditsBanner/index.d.ts +2 -0
  82. package/dist/esm/components/credits/creditsBanner/index.js +12 -1
  83. package/dist/esm/components/credits/creditsBanner/index.js.map +3 -3
  84. package/dist/esm/components/credits/creditsBenefits/BenefitItem.js +2 -0
  85. package/dist/esm/components/credits/creditsBenefits/BenefitItem.js.map +7 -0
  86. package/dist/esm/components/credits/creditsBenefits/{iconInfo.js → IconInfo.js} +1 -1
  87. package/dist/esm/components/credits/creditsBenefits/{iconInfo.js.map → IconInfo.js.map} +1 -1
  88. package/dist/esm/components/credits/creditsCash/CreditsCash.js +1 -1
  89. package/dist/esm/components/credits/creditsCash/CreditsCash.js.map +2 -2
  90. package/dist/esm/components/credits/creditsCash/RedeemableItem.js +1 -1
  91. package/dist/esm/components/credits/creditsCash/RedeemableItem.js.map +3 -3
  92. package/dist/esm/components/credits/creditsCash/type.d.ts +1 -0
  93. package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js +1 -1
  94. package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js.map +3 -3
  95. package/dist/esm/components/credits/creditsInfoCard/index.js +1 -1
  96. package/dist/esm/components/credits/creditsInfoCard/index.js.map +2 -2
  97. package/dist/esm/components/credits/creditsMemberPrice/CreditsMemberPrice.js +1 -1
  98. package/dist/esm/components/credits/creditsMemberPrice/CreditsMemberPrice.js.map +3 -3
  99. package/dist/esm/components/credits/creditsMemberPrice/MemberPriceItem.js +1 -1
  100. package/dist/esm/components/credits/creditsMemberPrice/MemberPriceItem.js.map +3 -3
  101. package/dist/esm/components/credits/creditsMemberPrice/type.d.ts +3 -5
  102. package/dist/esm/components/credits/creditsNavigation/CreditsNavigation.js +1 -1
  103. package/dist/esm/components/credits/creditsNavigation/CreditsNavigation.js.map +2 -2
  104. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
  105. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
  106. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  107. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
  108. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
  109. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +3 -3
  110. package/dist/esm/templates/{credits.d.ts → Credits.d.ts} +15 -1
  111. package/dist/esm/templates/Credits.js +2 -0
  112. package/dist/esm/templates/Credits.js.map +7 -0
  113. package/package.json +1 -1
  114. package/src/components/credits/context/memberPriceConst.ts +0 -7
  115. package/src/components/credits/context/memberPriceTypes.ts +1 -26
  116. package/src/components/credits/context/provider.tsx +14 -0
  117. package/src/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.tsx +25 -25
  118. package/src/components/credits/creditsBanner/index.tsx +31 -2
  119. package/src/components/credits/creditsBenefits/BenefitItem.tsx +11 -4
  120. package/src/components/credits/creditsBenefits/IconInfo.tsx +1 -1
  121. package/src/components/credits/creditsCash/CreditsCash.tsx +1 -1
  122. package/src/components/credits/creditsCash/RedeemableItem.tsx +17 -4
  123. package/src/components/credits/creditsCash/type.ts +1 -0
  124. package/src/components/credits/creditsFaq/faqItem/FaqItem.tsx +25 -23
  125. package/src/components/credits/creditsInfoCard/index.tsx +1 -1
  126. package/src/components/credits/creditsMemberPrice/CreditsMemberPrice.tsx +57 -5
  127. package/src/components/credits/creditsMemberPrice/MemberPriceItem.tsx +102 -25
  128. package/src/components/credits/creditsMemberPrice/type.ts +3 -5
  129. package/src/components/credits/creditsNavigation/CreditsNavigation.tsx +3 -3
  130. package/src/components/credits/creditsRedeemList/CreditsRedeemList.tsx +26 -13
  131. package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +1 -1
  132. package/src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx +20 -17
  133. package/src/templates/Credits.tsx +26 -9
  134. package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.d.ts +0 -1
  135. package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.js +0 -2
  136. package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.js.map +0 -7
  137. package/dist/cjs/components/credits/context/hooks/useSubscriptions.d.ts +0 -9
  138. package/dist/cjs/components/credits/context/hooks/useSubscriptions.js +0 -2
  139. package/dist/cjs/components/credits/context/hooks/useSubscriptions.js.map +0 -7
  140. package/dist/cjs/components/credits/creditsBenefits/benefitItem.js +0 -2
  141. package/dist/cjs/components/credits/creditsBenefits/benefitItem.js.map +0 -7
  142. package/dist/cjs/helpers/fetchResponse.d.ts +0 -14
  143. package/dist/cjs/helpers/fetchResponse.js +0 -2
  144. package/dist/cjs/helpers/fetchResponse.js.map +0 -7
  145. package/dist/cjs/helpers/fetcher.d.ts +0 -2
  146. package/dist/cjs/helpers/fetcher.js +0 -2
  147. package/dist/cjs/helpers/fetcher.js.map +0 -7
  148. package/dist/cjs/helpers/index.d.ts +0 -2
  149. package/dist/cjs/helpers/index.js +0 -2
  150. package/dist/cjs/helpers/index.js.map +0 -7
  151. package/dist/cjs/helpers/track.d.ts +0 -19
  152. package/dist/cjs/helpers/track.js +0 -2
  153. package/dist/cjs/helpers/track.js.map +0 -7
  154. package/dist/cjs/helpers/utils.d.ts +0 -3
  155. package/dist/cjs/helpers/utils.js +0 -2
  156. package/dist/cjs/helpers/utils.js.map +0 -7
  157. package/dist/cjs/templates/credits.js +0 -2
  158. package/dist/cjs/templates/credits.js.map +0 -7
  159. package/dist/esm/components/credits/context/hooks/useSendEmailValidation.d.ts +0 -1
  160. package/dist/esm/components/credits/context/hooks/useSendEmailValidation.js +0 -2
  161. package/dist/esm/components/credits/context/hooks/useSendEmailValidation.js.map +0 -7
  162. package/dist/esm/components/credits/context/hooks/useSubscriptions.d.ts +0 -9
  163. package/dist/esm/components/credits/context/hooks/useSubscriptions.js +0 -2
  164. package/dist/esm/components/credits/context/hooks/useSubscriptions.js.map +0 -7
  165. package/dist/esm/components/credits/creditsBenefits/benefitItem.js +0 -2
  166. package/dist/esm/components/credits/creditsBenefits/benefitItem.js.map +0 -7
  167. package/dist/esm/helpers/fetchResponse.d.ts +0 -14
  168. package/dist/esm/helpers/fetchResponse.js +0 -2
  169. package/dist/esm/helpers/fetchResponse.js.map +0 -7
  170. package/dist/esm/helpers/fetcher.d.ts +0 -2
  171. package/dist/esm/helpers/fetcher.js +0 -2
  172. package/dist/esm/helpers/fetcher.js.map +0 -7
  173. package/dist/esm/helpers/index.d.ts +0 -2
  174. package/dist/esm/helpers/index.js +0 -2
  175. package/dist/esm/helpers/index.js.map +0 -7
  176. package/dist/esm/helpers/track.d.ts +0 -19
  177. package/dist/esm/helpers/track.js +0 -2
  178. package/dist/esm/helpers/track.js.map +0 -7
  179. package/dist/esm/helpers/utils.d.ts +0 -3
  180. package/dist/esm/helpers/utils.js +0 -2
  181. package/dist/esm/helpers/utils.js.map +0 -7
  182. package/dist/esm/templates/credits.js +0 -2
  183. package/dist/esm/templates/credits.js.map +0 -7
  184. package/src/components/credits/context/hooks/useFunctionMemberPrice.ts +0 -33
  185. package/src/components/credits/context/utils/atobID.ts +0 -8
  186. package/src/components/credits/context/utils/functionDiscountCalculate.ts +0 -57
  187. package/src/components/credits/context/utils/getFunctionMemberPrice.ts +0 -135
  188. package/src/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.ts +0 -51
  189. package/src/components/credits/context/utils/variantGetCoupon.ts +0 -34
  190. /package/dist/cjs/components/credits/creditsBenefits/{benefitItem.d.ts → BenefitItem.d.ts} +0 -0
  191. /package/dist/cjs/components/credits/creditsBenefits/{iconInfo.d.ts → IconInfo.d.ts} +0 -0
  192. /package/dist/esm/components/credits/creditsBenefits/{benefitItem.d.ts → BenefitItem.d.ts} +0 -0
  193. /package/dist/esm/components/credits/creditsBenefits/{iconInfo.d.ts → IconInfo.d.ts} +0 -0
@@ -1,7 +1,7 @@
1
- import { ProductVariant } from '@anker-in/lib';
1
+ import { NormalizedProductVariant } from '@anker-in/shopify-react';
2
2
  import { FunctionMemberPriceResult } from '../memberPriceTypes';
3
3
  export declare const useFunctionMemberPrice: ({ variant }: {
4
- variant?: ProductVariant;
4
+ variant?: NormalizedProductVariant;
5
5
  }) => FunctionMemberPriceResult | (Partial<FunctionMemberPriceResult> & {
6
6
  hasMemberPrice: false;
7
7
  });
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var l=(r,e)=>{for(var o in e)i(r,o,{get:e[o],enumerable:!0})},f=(r,e,o,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of b(e))!a.call(r,t)&&t!==o&&i(r,t,{get:()=>e[t],enumerable:!(c=P(e,t))||c.enumerable});return r};var M=r=>f(i({},"__esModule",{value:!0}),r);var d={};l(d,{useFunctionMemberPrice:()=>p});module.exports=M(d);var m=require("../utils/getFunctionMemberPrice"),n=require("react"),s=require("../provider"),u=require("@anker-in/lib");const p=({variant:r})=>{const{memberPriceDiscount:e}=(0,s.useCreditsContext)(),{locale:o=""}=(0,u.useHeadlessContext)();return(0,n.useMemo)(()=>{const t=(0,m.getFunctionMemberPrice)({memberPriceDiscount:e,currencyCode:r?.price.currencyCode,variant:r,locale:o});return t||{hasMemberPrice:!1}},[o,e,r])};
1
+ "use strict";var i=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var b=(r,e)=>{for(var o in e)i(r,o,{get:e[o],enumerable:!0})},f=(r,e,o,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of a(e))!l.call(r,t)&&t!==o&&i(r,t,{get:()=>e[t],enumerable:!(c=P(e,t))||c.enumerable});return r};var M=r=>f(i({},"__esModule",{value:!0}),r);var p={};b(p,{useFunctionMemberPrice:()=>d});module.exports=M(p);var m=require("../utils/getFunctionMemberPrice"),n=require("react"),s=require("../provider"),u=require("@anker-in/lib");const d=({variant:r})=>{const{memberPriceDiscount:e}=(0,s.useCreditsContext)(),{locale:o=""}=(0,u.useHeadlessContext)();return(0,n.useMemo)(()=>{const t=(0,m.getFunctionMemberPrice)({memberPriceDiscount:e,currencyCode:r?.price.currencyCode,variant:r,locale:o});return t||{hasMemberPrice:!1}},[o,e,r])};
2
2
  //# sourceMappingURL=useFunctionMemberPrice.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/context/hooks/useFunctionMemberPrice.ts"],
4
- "sourcesContent": ["import { ProductVariant } from '@anker-in/lib'\nimport { FunctionMemberPriceResult } from '../memberPriceTypes'\nimport { getFunctionMemberPrice } from '../utils/getFunctionMemberPrice'\nimport { useMemo } from 'react'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext } from '@anker-in/lib'\n\n// \u8BA1\u7B97\u5355\u4EF6\u5546\u54C1\u7684\u4F1A\u5458\u4EF7\nexport const useFunctionMemberPrice = ({ variant }: { variant?: ProductVariant }) => {\n const { memberPriceDiscount } = useCreditsContext()\n const { locale = '' } = useHeadlessContext()\n\n const memberPrice:\n | FunctionMemberPriceResult\n | (Partial<FunctionMemberPriceResult> & {\n hasMemberPrice: false\n }) = useMemo(() => {\n const result = getFunctionMemberPrice({\n memberPriceDiscount: memberPriceDiscount,\n currencyCode: variant?.price.currencyCode,\n variant,\n locale,\n })\n\n if (result) {\n return result as FunctionMemberPriceResult\n }\n\n return { hasMemberPrice: false }\n }, [locale, memberPriceDiscount, variant])\n\n return memberPrice\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAEA,IAAAI,EAAuC,2CACvCC,EAAwB,iBACxBC,EAAkC,uBAClCC,EAAmC,yBAG5B,MAAML,EAAyB,CAAC,CAAE,QAAAM,CAAQ,IAAoC,CACnF,KAAM,CAAE,oBAAAC,CAAoB,KAAI,qBAAkB,EAC5C,CAAE,OAAAC,EAAS,EAAG,KAAI,sBAAmB,EAqB3C,SAfS,WAAQ,IAAM,CACrB,MAAMC,KAAS,0BAAuB,CACpC,oBAAqBF,EACrB,aAAcD,GAAS,MAAM,aAC7B,QAAAA,EACA,OAAAE,CACF,CAAC,EAED,OAAIC,GAIG,CAAE,eAAgB,EAAM,CACjC,EAAG,CAACD,EAAQD,EAAqBD,CAAO,CAAC,CAG3C",
4
+ "sourcesContent": ["import { NormalizedProductVariant } from '@anker-in/shopify-react'\nimport { FunctionMemberPriceResult } from '../memberPriceTypes'\nimport { getFunctionMemberPrice } from '../utils/getFunctionMemberPrice'\nimport { useMemo } from 'react'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext } from '@anker-in/lib'\n\n// \u8BA1\u7B97\u5355\u4EF6\u5546\u54C1\u7684\u4F1A\u5458\u4EF7\nexport const useFunctionMemberPrice = ({ variant }: { variant?: NormalizedProductVariant }) => {\n const { memberPriceDiscount } = useCreditsContext()\n const { locale = '' } = useHeadlessContext()\n\n const memberPrice:\n | FunctionMemberPriceResult\n | (Partial<FunctionMemberPriceResult> & {\n hasMemberPrice: false\n }) = useMemo(() => {\n const result = getFunctionMemberPrice({\n memberPriceDiscount: memberPriceDiscount,\n currencyCode: variant?.price.currencyCode,\n variant,\n locale,\n })\n\n if (result) {\n return result as FunctionMemberPriceResult\n }\n\n return { hasMemberPrice: false }\n }, [locale, memberPriceDiscount, variant])\n\n return memberPrice\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAEA,IAAAI,EAAuC,2CACvCC,EAAwB,iBACxBC,EAAkC,uBAClCC,EAAmC,yBAG5B,MAAML,EAAyB,CAAC,CAAE,QAAAM,CAAQ,IAA8C,CAC7F,KAAM,CAAE,oBAAAC,CAAoB,KAAI,qBAAkB,EAC5C,CAAE,OAAAC,EAAS,EAAG,KAAI,sBAAmB,EAqB3C,SAfS,WAAQ,IAAM,CACrB,MAAMC,KAAS,0BAAuB,CACpC,oBAAqBF,EACrB,aAAcD,GAAS,MAAM,aAC7B,QAAAA,EACA,OAAAE,CACF,CAAC,EAED,OAAIC,GAIG,CAAE,eAAgB,EAAM,CACjC,EAAG,CAACD,EAAQD,EAAqBD,CAAO,CAAC,CAG3C",
6
6
  "names": ["useFunctionMemberPrice_exports", "__export", "useFunctionMemberPrice", "__toCommonJS", "import_getFunctionMemberPrice", "import_react", "import_provider", "import_lib", "variant", "memberPriceDiscount", "locale", "result"]
7
7
  }
@@ -3,8 +3,3 @@ export declare enum FunctionDiscountType {
3
3
  FixedAmount = 2,
4
4
  FixedPrice = 3
5
5
  }
6
- export declare enum RoundSelected {
7
- RoundHighest = "round_highest",
8
- RoundLowest = "round_lowest",
9
- RoundNearest = "round_nearest"
10
- }
@@ -1,2 +1,2 @@
1
- "use strict";var h=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var A=(a,x)=>{for(var g in x)h(a,g,{get:x[g],enumerable:!0})},H=(a,x,g,r)=>{if(x&&typeof x=="object"||typeof x=="function")for(let e of w(x))!P.call(a,e)&&e!==g&&h(a,e,{get:()=>x[e],enumerable:!(r=d(x,e))||r.enumerable});return a};var L=a=>H(h({},"__esModule",{value:!0}),a);var N={};A(N,{FunctionDiscountType:()=>m,RoundSelected:()=>_});module.exports=L(N);var m=(r=>(r[r.Percentage=1]="Percentage",r[r.FixedAmount=2]="FixedAmount",r[r.FixedPrice=3]="FixedPrice",r))(m||{}),_=(r=>(r.RoundHighest="round_highest",r.RoundLowest="round_lowest",r.RoundNearest="round_nearest",r))(_||{});
1
+ "use strict";var P=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var f=(d,r)=>{for(var m in r)P(d,m,{get:r[m],enumerable:!0})},h=(d,r,m,x)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of A(r))!b.call(d,e)&&e!==m&&P(d,e,{get:()=>r[e],enumerable:!(x=g(r,e))||x.enumerable});return d};var j=d=>h(P({},"__esModule",{value:!0}),d);var k={};f(k,{FunctionDiscountType:()=>a});module.exports=j(k);var a=(x=>(x[x.Percentage=1]="Percentage",x[x.FixedAmount=2]="FixedAmount",x[x.FixedPrice=3]="FixedPrice",x))(a||{});
2
2
  //# sourceMappingURL=memberPriceConst.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/context/memberPriceConst.ts"],
4
- "sourcesContent": ["// Function \u6298\u6263\u7C7B\u578B\nexport enum FunctionDiscountType {\n Percentage = 1,\n FixedAmount,\n FixedPrice,\n}\n\n// \u5C0F\u6570\u4F4D\u53D6\u820D\u65B9\u5F0F\nexport enum RoundSelected {\n RoundHighest = 'round_highest',\n RoundLowest = 'round_lowest',\n RoundNearest = 'round_nearest',\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,EAAA,kBAAAC,IAAA,eAAAC,EAAAJ,GACO,IAAKE,OACVA,IAAA,WAAa,GAAb,aACAA,IAAA,6BACAA,IAAA,2BAHUA,OAAA,IAOAC,OACVA,EAAA,aAAe,gBACfA,EAAA,YAAc,eACdA,EAAA,aAAe,gBAHLA,OAAA",
6
- "names": ["memberPriceConst_exports", "__export", "FunctionDiscountType", "RoundSelected", "__toCommonJS"]
4
+ "sourcesContent": ["// Function \u6298\u6263\u7C7B\u578B\nexport enum FunctionDiscountType {\n Percentage = 1,\n FixedAmount,\n FixedPrice,\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GACO,IAAKE,OACVA,IAAA,WAAa,GAAb,aACAA,IAAA,6BACAA,IAAA,2BAHUA,OAAA",
6
+ "names": ["memberPriceConst_exports", "__export", "FunctionDiscountType", "__toCommonJS"]
7
7
  }
@@ -1,14 +1,7 @@
1
- import { FunctionDiscountType, RoundSelected } from './memberPriceConst';
2
- export type PriceEndingConf = {
3
- apply_price_ending: boolean;
4
- one_decimal_place: string;
5
- two_decimal_place: string;
6
- round_selected: RoundSelected;
7
- };
1
+ import { FunctionDiscountType } from './memberPriceConst';
8
2
  export type DiscountConfig = {
9
3
  discount_type: FunctionDiscountType;
10
4
  discount_value: number;
11
- price_ending_conf?: PriceEndingConf;
12
5
  };
13
6
  export type FunctionMemberPriceConfig = {
14
7
  rule_id: string;
@@ -30,17 +23,3 @@ export type FunctionMemberPriceConfig = {
30
23
  other_product_discounts: boolean;
31
24
  };
32
25
  };
33
- export type FunctionMemberPriceResult = {
34
- hasMemberPrice: boolean;
35
- useCoupon: boolean;
36
- originalPrice: number;
37
- originalPriceWithCurrency: string;
38
- salePrice: number;
39
- salePriceWithCurrency: string;
40
- salePriceWithoutCoupon: number;
41
- salePriceWithoutCouponWithCurrency: string;
42
- savePrice: number;
43
- savePriceWithCurrency: string;
44
- savePriceWithoutCoupon: number;
45
- savePriceWithoutCouponWithCurrency: string;
46
- };
@@ -1,2 +1,2 @@
1
- "use strict";var t=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var a=(n,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of u(e))!s.call(n,i)&&i!==o&&t(n,i,{get:()=>e[i],enumerable:!(r=c(e,i))||r.enumerable});return n};var l=n=>a(t({},"__esModule",{value:!0}),n);var d={};module.exports=l(d);
1
+ "use strict";var e=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var a=(t,n,r,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of u(n))!c.call(t,i)&&i!==r&&e(t,i,{get:()=>n[i],enumerable:!(o=s(n,i))||o.enumerable});return t};var _=t=>a(e({},"__esModule",{value:!0}),t);var d={};module.exports=_(d);
2
2
  //# sourceMappingURL=memberPriceTypes.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/context/memberPriceTypes.ts"],
4
- "sourcesContent": ["import { FunctionDiscountType, RoundSelected } from './memberPriceConst'\n\n// \u4EF7\u683C\u7ED3\u5C3E\u914D\u7F6E\nexport type PriceEndingConf = {\n apply_price_ending: boolean\n one_decimal_place: string\n two_decimal_place: string\n round_selected: RoundSelected\n}\n\n// \u6298\u6263\u914D\u7F6E\nexport type DiscountConfig = {\n discount_type: FunctionDiscountType\n discount_value: number\n price_ending_conf?: PriceEndingConf\n}\n\n// \u4F1A\u5458\u4EF7\u914D\u7F6E\u7C7B\u578B\nexport type FunctionMemberPriceConfig = {\n rule_id: string\n result_detail: {\n member_discounts?: {\n user_identity: number // \u7528\u6237\u8EAB\u4EFD\uFF1A1-\u666E\u901A\u4F1A\u5458\uFF0C2-\u9AD8\u7EA7\u4F1A\u5458\u7B49\n main_products: {\n all_store_variant: boolean\n variants: {\n variant_id: string\n sku: string\n handle: string\n }[]\n }\n discount_conf: DiscountConfig\n }[]\n }\n discount_combinations: {\n other_product_discounts: boolean\n }\n}\n\n// \u4F1A\u5458\u4EF7\u8BA1\u7B97\u7ED3\u679C\nexport type FunctionMemberPriceResult = {\n hasMemberPrice: boolean\n useCoupon: boolean\n originalPrice: number\n originalPriceWithCurrency: string\n salePrice: number\n salePriceWithCurrency: string\n salePriceWithoutCoupon: number\n salePriceWithoutCouponWithCurrency: string\n savePrice: number\n savePriceWithCurrency: string\n savePriceWithoutCoupon: number\n savePriceWithoutCouponWithCurrency: string\n}\n"],
4
+ "sourcesContent": ["import { FunctionDiscountType } from './memberPriceConst'\n\n// \u6298\u6263\u914D\u7F6E\nexport type DiscountConfig = {\n discount_type: FunctionDiscountType\n discount_value: number\n}\n\n// \u4F1A\u5458\u4EF7\u914D\u7F6E\u7C7B\u578B\nexport type FunctionMemberPriceConfig = {\n rule_id: string\n result_detail: {\n member_discounts?: {\n user_identity: number // \u7528\u6237\u8EAB\u4EFD\uFF1A1-\u666E\u901A\u4F1A\u5458\uFF0C2-\u9AD8\u7EA7\u4F1A\u5458\u7B49\n main_products: {\n all_store_variant: boolean\n variants: {\n variant_id: string\n sku: string\n handle: string\n }[]\n }\n discount_conf: DiscountConfig\n }[]\n }\n discount_combinations: {\n other_product_discounts: boolean\n }\n}\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["memberPriceTypes_exports", "__toCommonJS"]
7
7
  }
@@ -20,8 +20,22 @@ type Context = {
20
20
  pageCommon: CreditsPageCommon;
21
21
  memberPriceDiscount?: FunctionMemberPriceConfig[];
22
22
  alpcBrand?: string;
23
+ cartConfig?: {
24
+ addToCart: (params: {
25
+ variantList: Array<{
26
+ variant: any;
27
+ quantity: number;
28
+ attributes?: Array<{
29
+ key: string;
30
+ value: string;
31
+ }>;
32
+ }>;
33
+ cartAttributes?: Record<string, string>;
34
+ discountCodes?: string[];
35
+ }) => void | Promise<any>;
36
+ };
23
37
  };
24
38
  export declare const CreditsContext: import("react").Context<Context>;
25
- export declare function CreditsProvider({ children, profile, removeProfile, isLoadingProfile, openSignInPopup, openSignUpPopup, taskIdToTypeMapping, creditInfo, customer, customerLoading, fetchCreditInfo, gtm, pageCommon, memberPriceDiscount, alpcBrand, }: PropsWithChildren<Context>): import("react/jsx-runtime").JSX.Element;
39
+ export declare function CreditsProvider({ children, profile, removeProfile, isLoadingProfile, openSignInPopup, openSignUpPopup, taskIdToTypeMapping, creditInfo, customer, customerLoading, fetchCreditInfo, gtm, pageCommon, memberPriceDiscount, alpcBrand, cartConfig, }: PropsWithChildren<Context>): import("react/jsx-runtime").JSX.Element;
26
40
  export declare function useCreditsContext(): Context;
27
41
  export {};
@@ -1,2 +1,2 @@
1
- "use strict";var p=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var h=(e,o)=>{for(var n in o)p(e,n,{get:o[n],enumerable:!0})},b=(e,o,n,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of I(o))!T.call(e,r)&&r!==n&&p(e,r,{get:()=>o[r],enumerable:!(t=v(o,r))||t.enumerable});return e};var y=e=>b(p({},"__esModule",{value:!0}),e);var D={};h(D,{CreditsContext:()=>d,CreditsProvider:()=>S,useCreditsContext:()=>_});module.exports=y(D);var s=require("react/jsx-runtime"),i=require("react");const d=(0,i.createContext)({profile:null,isLoadingProfile:!1,taskIdToTypeMapping:{},removeProfile:()=>{},openSignInPopup:()=>{},openSignUpPopup:()=>{},creditInfo:void 0,customerLoading:!1,fetchCreditInfo:e=>{},gtm:{pageGroup:""},pageCommon:{},memberPriceDiscount:void 0,alpcBrand:void 0});function S({children:e,profile:o,removeProfile:n,isLoadingProfile:t,openSignInPopup:r,openSignUpPopup:m,taskIdToTypeMapping:C,creditInfo:f,customer:u,customerLoading:a,fetchCreditInfo:g,gtm:c,pageCommon:P,memberPriceDiscount:l,alpcBrand:x}){return(0,s.jsx)(d.Provider,{value:{profile:o,isLoadingProfile:t,removeProfile:n,openSignInPopup:r,openSignUpPopup:m,taskIdToTypeMapping:C,creditInfo:f,fetchCreditInfo:g,customer:u,customerLoading:a,gtm:c,pageCommon:P,memberPriceDiscount:l,alpcBrand:x},children:e})}function _(){const e=(0,i.useContext)(d);if(!e)throw new Error("useCreditsContext must be used within a CreditsProvider");return e}
1
+ "use strict";var s=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var I=(e,o)=>{for(var t in o)s(e,t,{get:o[t],enumerable:!0})},h=(e,o,t,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of T(o))!b.call(e,r)&&r!==t&&s(e,r,{get:()=>o[r],enumerable:!(n=x(o,r))||n.enumerable});return e};var S=e=>h(s({},"__esModule",{value:!0}),e);var L={};I(L,{CreditsContext:()=>d,CreditsProvider:()=>_,useCreditsContext:()=>A});module.exports=S(L);var p=require("react/jsx-runtime"),i=require("react");const d=(0,i.createContext)({profile:null,isLoadingProfile:!1,taskIdToTypeMapping:{},removeProfile:()=>{},openSignInPopup:()=>{},openSignUpPopup:()=>{},creditInfo:void 0,customerLoading:!1,fetchCreditInfo:e=>{},gtm:{pageGroup:""},pageCommon:{},memberPriceDiscount:void 0,alpcBrand:void 0,cartConfig:void 0});function _({children:e,profile:o,removeProfile:t,isLoadingProfile:n,openSignInPopup:r,openSignUpPopup:a,taskIdToTypeMapping:u,creditInfo:C,customer:m,customerLoading:f,fetchCreditInfo:g,gtm:c,pageCommon:P,memberPriceDiscount:l,alpcBrand:v,cartConfig:y}){return(0,p.jsx)(d.Provider,{value:{profile:o,isLoadingProfile:n,removeProfile:t,openSignInPopup:r,openSignUpPopup:a,taskIdToTypeMapping:u,creditInfo:C,fetchCreditInfo:g,customer:m,customerLoading:f,gtm:c,pageCommon:P,memberPriceDiscount:l,alpcBrand:v,cartConfig:y},children:e})}function A(){const e=(0,i.useContext)(d);if(!e)throw new Error("useCreditsContext must be used within a CreditsProvider");return e}
2
2
  //# sourceMappingURL=provider.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/context/provider.tsx"],
4
- "sourcesContent": ["import { createContext, PropsWithChildren, useContext } from 'react'\nimport type { DTC_TASK_TYPE } from './const'\nimport type { CreditInfoResponse } from './response'\nimport { CreditsPageCommon } from '../type'\nimport { FunctionMemberPriceConfig } from './memberPriceTypes'\n\ntype Context = {\n profile: any\n isLoadingProfile: boolean\n removeProfile: () => void\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n openSignInPopup: () => void\n openSignUpPopup: () => void\n creditInfo?: CreditInfoResponse\n customer?: any\n customerLoading: boolean\n fetchCreditInfo: (user_id: string) => void\n gtm: {\n pageGroup: string\n }\n pageCommon: CreditsPageCommon\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n alpcBrand?: string\n}\n\nexport const CreditsContext = createContext<Context>({\n profile: null,\n isLoadingProfile: false,\n taskIdToTypeMapping: {},\n removeProfile: () => {},\n openSignInPopup: () => {},\n openSignUpPopup: () => {},\n creditInfo: undefined,\n customerLoading: false,\n fetchCreditInfo: (user_id: string) => {},\n gtm: {\n pageGroup: '',\n },\n pageCommon: {},\n memberPriceDiscount: undefined,\n alpcBrand: undefined,\n})\n\nexport function CreditsProvider({\n children,\n profile,\n removeProfile,\n isLoadingProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n customer,\n customerLoading,\n fetchCreditInfo,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n}: PropsWithChildren<Context>) {\n return (\n <CreditsContext.Provider\n value={{\n profile,\n isLoadingProfile,\n removeProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n fetchCreditInfo,\n customer,\n customerLoading,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n }}\n >\n {children}\n </CreditsContext.Provider>\n )\n}\n\nexport function useCreditsContext() {\n const context = useContext(CreditsContext)\n if (!context) {\n throw new Error('useCreditsContext must be used within a CreditsProvider')\n }\n return context\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,oBAAAC,EAAA,sBAAAC,IAAA,eAAAC,EAAAL,GA6DI,IAAAM,EAAA,6BA7DJC,EAA6D,iBAyBtD,MAAML,KAAiB,iBAAuB,CACnD,QAAS,KACT,iBAAkB,GAClB,oBAAqB,CAAC,EACtB,cAAe,IAAM,CAAC,EACtB,gBAAiB,IAAM,CAAC,EACxB,gBAAiB,IAAM,CAAC,EACxB,WAAY,OACZ,gBAAiB,GACjB,gBAAkBM,GAAoB,CAAC,EACvC,IAAK,CACH,UAAW,EACb,EACA,WAAY,CAAC,EACb,oBAAqB,OACrB,UAAW,MACb,CAAC,EAEM,SAASL,EAAgB,CAC9B,SAAAM,EACA,QAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,SAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,IAAAC,EACA,WAAAC,EACA,oBAAAC,EACA,UAAAC,CACF,EAA+B,CAC7B,SACE,OAACrB,EAAe,SAAf,CACC,MAAO,CACL,QAAAQ,EACA,iBAAAE,EACA,cAAAD,EACA,gBAAAE,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,gBAAAG,EACA,SAAAF,EACA,gBAAAC,EACA,IAAAE,EACA,WAAAC,EACA,oBAAAC,EACA,UAAAC,CACF,EAEC,SAAAd,EACH,CAEJ,CAEO,SAASL,GAAoB,CAClC,MAAMoB,KAAU,cAAWtB,CAAc,EACzC,GAAI,CAACsB,EACH,MAAM,IAAI,MAAM,yDAAyD,EAE3E,OAAOA,CACT",
6
- "names": ["provider_exports", "__export", "CreditsContext", "CreditsProvider", "useCreditsContext", "__toCommonJS", "import_jsx_runtime", "import_react", "user_id", "children", "profile", "removeProfile", "isLoadingProfile", "openSignInPopup", "openSignUpPopup", "taskIdToTypeMapping", "creditInfo", "customer", "customerLoading", "fetchCreditInfo", "gtm", "pageCommon", "memberPriceDiscount", "alpcBrand", "context"]
4
+ "sourcesContent": ["import { createContext, PropsWithChildren, useContext } from 'react'\nimport type { DTC_TASK_TYPE } from './const'\nimport type { CreditInfoResponse } from './response'\nimport { CreditsPageCommon } from '../type'\nimport { FunctionMemberPriceConfig } from './memberPriceTypes'\n\ntype Context = {\n profile: any\n isLoadingProfile: boolean\n removeProfile: () => void\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n openSignInPopup: () => void\n openSignUpPopup: () => void\n creditInfo?: CreditInfoResponse\n customer?: any\n customerLoading: boolean\n fetchCreditInfo: (user_id: string) => void\n gtm: {\n pageGroup: string\n }\n pageCommon: CreditsPageCommon\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n alpcBrand?: string\n cartConfig?: {\n addToCart: (params: {\n variantList: Array<{\n variant: any\n quantity: number\n attributes?: Array<{ key: string; value: string }>\n }>\n cartAttributes?: Record<string, string>\n discountCodes?: string[]\n }) => void | Promise<any>\n }\n}\n\nexport const CreditsContext = createContext<Context>({\n profile: null,\n isLoadingProfile: false,\n taskIdToTypeMapping: {},\n removeProfile: () => {},\n openSignInPopup: () => {},\n openSignUpPopup: () => {},\n creditInfo: undefined,\n customerLoading: false,\n fetchCreditInfo: (user_id: string) => {},\n gtm: {\n pageGroup: '',\n },\n pageCommon: {},\n memberPriceDiscount: undefined,\n alpcBrand: undefined,\n cartConfig: undefined,\n})\n\nexport function CreditsProvider({\n children,\n profile,\n removeProfile,\n isLoadingProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n customer,\n customerLoading,\n fetchCreditInfo,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n cartConfig,\n}: PropsWithChildren<Context>) {\n return (\n <CreditsContext.Provider\n value={{\n profile,\n isLoadingProfile,\n removeProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n fetchCreditInfo,\n customer,\n customerLoading,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n cartConfig,\n }}\n >\n {children}\n </CreditsContext.Provider>\n )\n}\n\nexport function useCreditsContext() {\n const context = useContext(CreditsContext)\n if (!context) {\n throw new Error('useCreditsContext must be used within a CreditsProvider')\n }\n return context\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,oBAAAC,EAAA,sBAAAC,IAAA,eAAAC,EAAAL,GA0EI,IAAAM,EAAA,6BA1EJC,EAA6D,iBAoCtD,MAAML,KAAiB,iBAAuB,CACnD,QAAS,KACT,iBAAkB,GAClB,oBAAqB,CAAC,EACtB,cAAe,IAAM,CAAC,EACtB,gBAAiB,IAAM,CAAC,EACxB,gBAAiB,IAAM,CAAC,EACxB,WAAY,OACZ,gBAAiB,GACjB,gBAAkBM,GAAoB,CAAC,EACvC,IAAK,CACH,UAAW,EACb,EACA,WAAY,CAAC,EACb,oBAAqB,OACrB,UAAW,OACX,WAAY,MACd,CAAC,EAEM,SAASL,EAAgB,CAC9B,SAAAM,EACA,QAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,SAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,IAAAC,EACA,WAAAC,EACA,oBAAAC,EACA,UAAAC,EACA,WAAAC,CACF,EAA+B,CAC7B,SACE,OAACtB,EAAe,SAAf,CACC,MAAO,CACL,QAAAQ,EACA,iBAAAE,EACA,cAAAD,EACA,gBAAAE,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,gBAAAG,EACA,SAAAF,EACA,gBAAAC,EACA,IAAAE,EACA,WAAAC,EACA,oBAAAC,EACA,UAAAC,EACA,WAAAC,CACF,EAEC,SAAAf,EACH,CAEJ,CAEO,SAASL,GAAoB,CAClC,MAAMqB,KAAU,cAAWvB,CAAc,EACzC,GAAI,CAACuB,EACH,MAAM,IAAI,MAAM,yDAAyD,EAE3E,OAAOA,CACT",
6
+ "names": ["provider_exports", "__export", "CreditsContext", "CreditsProvider", "useCreditsContext", "__toCommonJS", "import_jsx_runtime", "import_react", "user_id", "children", "profile", "removeProfile", "isLoadingProfile", "openSignInPopup", "openSignUpPopup", "taskIdToTypeMapping", "creditInfo", "customer", "customerLoading", "fetchCreditInfo", "gtm", "pageCommon", "memberPriceDiscount", "alpcBrand", "cartConfig", "context"]
7
7
  }
@@ -1,8 +1,8 @@
1
1
  import { FunctionMemberPriceConfig, FunctionMemberPriceResult } from '../memberPriceTypes';
2
- import { ProductVariant } from '@anker-in/lib';
2
+ import { NormalizedProductVariant } from '@anker-in/shopify-react';
3
3
  export declare const getFunctionMemberPrice: ({ memberPriceDiscount, currencyCode, variant, locale, }: {
4
4
  memberPriceDiscount?: FunctionMemberPriceConfig[];
5
5
  currencyCode?: string;
6
- variant?: ProductVariant;
6
+ variant?: NormalizedProductVariant;
7
7
  locale: string;
8
8
  }) => false | FunctionMemberPriceResult;
@@ -1,2 +1,2 @@
1
- "use strict";var M=Object.create;var a=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var _=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty;var N=(i,r)=>{for(var e in r)a(i,e,{get:r[e],enumerable:!0})},b=(i,r,e,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of A(r))!U.call(i,t)&&t!==e&&a(i,t,{get:()=>r[t],enumerable:!(o=S(r,t))||o.enumerable});return i};var D=(i,r,e)=>(e=i!=null?M(_(i)):{},b(r||!i||!i.__esModule?a(e,"default",{value:i,enumerable:!0}):e,i)),x=i=>b(a({},"__esModule",{value:!0}),i);var V={};N(V,{getFunctionMemberPrice:()=>R});module.exports=x(V);var n=require("../utils"),d=require("./functionDiscountCalculate"),c=D(require("decimal.js")),v=require("./getFunctionMemberPriceDiscountConfig"),w=D(require("./variantGetCoupon"));const R=({memberPriceDiscount:i,currencyCode:r,variant:e,locale:o})=>{const t=(0,w.default)({variant:e}),{memberPriceDiscountConfig:m,activeMemberPriceConfig:F}=(0,v.getFunctionMemberPriceDiscountConfig)({config:i,variant:e}),p=!!F?.discount_combinations.other_product_discounts;if(!m)return!1;const s={amount:e?.price.amount||0,priceWithCurrency:(0,n.formatPrice)({amount:e?.price.amount||0,currencyCode:r||"USD",locale:o})},u=m?(0,d.functionDiscountCalculate)({config:m,price:e?.price.amount||0}):e?.price.amount||0,C={amount:u,priceWithCurrency:(0,n.formatPrice)({amount:u,currencyCode:r||"USD",locale:o})};let P=u;if(t?.variant_price4wscode&&e&&p)if(p){const f=new c.default(e.price.amount).minus(t.variant_price4wscode);P=new c.default(u).minus(f).toNumber()}else{const f=new c.default(e.price.amount).minus(t.variant_price4wscode);if(u>f.toNumber())return!1}const h={amount:P,priceWithCurrency:(0,n.formatPrice)({amount:P,currencyCode:r||"USD",locale:o})},W=new c.default(s.amount).minus(h.amount).toNumber(),g={amount:W,priceWithCurrency:(0,n.formatPrice)({amount:W,currencyCode:r||"USD",locale:o,maximumFractionDigits:2})},l=new c.default(s.amount).minus(C.amount).toNumber(),y={amount:l,priceWithCurrency:(0,n.formatPrice)({amount:l,currencyCode:r||"USD",locale:o,maximumFractionDigits:2})};return{hasMemberPrice:!!m,useCoupon:p,originalPrice:s.amount,originalPriceWithCurrency:s.priceWithCurrency,salePrice:h.amount,salePriceWithCurrency:h.priceWithCurrency,salePriceWithoutCoupon:C.amount,salePriceWithoutCouponWithCurrency:C.priceWithCurrency,savePrice:g.amount,savePriceWithCurrency:g.priceWithCurrency,savePriceWithoutCoupon:y.amount,savePriceWithoutCouponWithCurrency:y.priceWithCurrency}};
1
+ "use strict";var M=Object.create;var a=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty;var U=(i,r)=>{for(var e in r)a(i,e,{get:r[e],enumerable:!0})},b=(i,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of A(r))!_.call(i,o)&&o!==e&&a(i,o,{get:()=>r[o],enumerable:!(t=S(r,o))||t.enumerable});return i};var D=(i,r,e)=>(e=i!=null?M(N(i)):{},b(r||!i||!i.__esModule?a(e,"default",{value:i,enumerable:!0}):e,i)),x=i=>b(a({},"__esModule",{value:!0}),i);var R={};U(R,{getFunctionMemberPrice:()=>z});module.exports=x(R);var n=require("../utils"),d=require("./functionDiscountCalculate"),c=D(require("decimal.js")),v=require("./getFunctionMemberPriceDiscountConfig"),w=D(require("./variantGetCoupon"));const z=({memberPriceDiscount:i,currencyCode:r,variant:e,locale:t})=>{const o=(0,w.default)({variant:e}),{memberPriceDiscountConfig:m,activeMemberPriceConfig:F}=(0,v.getFunctionMemberPriceDiscountConfig)({config:i,variant:e}),p=!!F?.discount_combinations.other_product_discounts;if(!m)return!1;const s={amount:e?.price.amount||0,priceWithCurrency:(0,n.formatPrice)({amount:e?.price.amount||0,currencyCode:r||"USD",locale:t})},u=m?(0,d.functionDiscountCalculate)({config:m,price:e?.price.amount||0}):e?.price.amount||0,C={amount:u,priceWithCurrency:(0,n.formatPrice)({amount:u,currencyCode:r||"USD",locale:t})};let P=u;if(o?.variant_price4wscode&&e&&p)if(p){const f=new c.default(e.price.amount).minus(o.variant_price4wscode);P=new c.default(u).minus(f).toNumber()}else{const f=new c.default(e.price.amount).minus(o.variant_price4wscode);if(u>f.toNumber())return!1}const h={amount:P,priceWithCurrency:(0,n.formatPrice)({amount:P,currencyCode:r||"USD",locale:t})},W=new c.default(s.amount).minus(h.amount).toNumber(),l={amount:W,priceWithCurrency:(0,n.formatPrice)({amount:W,currencyCode:r||"USD",locale:t,maximumFractionDigits:2})},g=new c.default(s.amount).minus(C.amount).toNumber(),y={amount:g,priceWithCurrency:(0,n.formatPrice)({amount:g,currencyCode:r||"USD",locale:t,maximumFractionDigits:2})};return{hasMemberPrice:!!m,useCoupon:p,originalPrice:s.amount,originalPriceWithCurrency:s.priceWithCurrency,salePrice:h.amount,salePriceWithCurrency:h.priceWithCurrency,salePriceWithoutCoupon:C.amount,salePriceWithoutCouponWithCurrency:C.priceWithCurrency,savePrice:l.amount,savePriceWithCurrency:l.priceWithCurrency,savePriceWithoutCoupon:y.amount,savePriceWithoutCouponWithCurrency:y.priceWithCurrency}};
2
2
  //# sourceMappingURL=getFunctionMemberPrice.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/context/utils/getFunctionMemberPrice.ts"],
4
- "sourcesContent": ["import { formatPrice } from '../utils'\nimport { FunctionMemberPriceConfig, FunctionMemberPriceResult } from '../memberPriceTypes'\nimport { ProductVariant } from '@anker-in/lib'\nimport { functionDiscountCalculate } from './functionDiscountCalculate'\nimport Decimal from 'decimal.js'\nimport { getFunctionMemberPriceDiscountConfig } from './getFunctionMemberPriceDiscountConfig'\nimport variantGetCoupon from './variantGetCoupon'\n\n// \u8BA1\u7B97\u5355\u4EF6\u5546\u54C1\u7684\u4F1A\u5458\u4EF7\nexport const getFunctionMemberPrice = ({\n memberPriceDiscount,\n currencyCode,\n variant,\n locale,\n}: {\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n currencyCode?: string\n variant?: ProductVariant\n locale: string\n}) => {\n const couponData = variantGetCoupon({ variant })\n\n // variant\u5BF9\u5E94\u7684\u4F1A\u5458\u4EF7\u6298\u6263\u914D\u7F6E\n const { memberPriceDiscountConfig, activeMemberPriceConfig } = getFunctionMemberPriceDiscountConfig({\n config: memberPriceDiscount,\n variant,\n })\n\n const useCoupon = !!activeMemberPriceConfig?.discount_combinations.other_product_discounts\n\n if (!memberPriceDiscountConfig) {\n return false as false\n }\n\n const originalPrice = {\n amount: variant?.price.amount || 0,\n priceWithCurrency: formatPrice({\n amount: variant?.price.amount || 0,\n currencyCode: currencyCode || 'USD',\n locale,\n }),\n }\n\n const salePriceWithoutCouponAmount = memberPriceDiscountConfig\n ? functionDiscountCalculate({\n config: memberPriceDiscountConfig,\n price: variant?.price.amount || 0,\n })\n : variant?.price.amount || 0\n const salePriceWithoutCoupon = {\n amount: salePriceWithoutCouponAmount,\n priceWithCurrency: formatPrice({\n amount: salePriceWithoutCouponAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n }),\n }\n\n // function \u4F1A\u5458\u4EF7\u662F\u5728\u539F\u4EF7\u7684\u57FA\u7840\u4E0A\u8FDB\u884C\u8BA1\u7B97\uFF0C\u6682\u4E0D\u652F\u6301\u6298\u540E\u4EF7\n let salePriceAmount = salePriceWithoutCouponAmount\n\n // \u51CF\u53BBcode\u7684\u4F18\u60E0\n if (couponData?.variant_price4wscode && variant && useCoupon) {\n if (useCoupon) {\n // code\u7684\u4F18\u60E0\u91D1\u989D\n const codeSaveAmountDecimal = new Decimal(variant.price.amount).minus(couponData.variant_price4wscode)\n salePriceAmount = new Decimal(salePriceWithoutCouponAmount).minus(codeSaveAmountDecimal).toNumber()\n } else {\n // \u4E0D\u80FD\u4E0E code \u540C\u65F6\u4F7F\u7528\uFF0C\u9700\u8981\u5224\u65AD\u4F1A\u5458\u4EF7\u662F\u5426\u5C0F\u4E8E code \u7684\u4F18\u60E0\u91D1\u989D\uFF0C\u5982\u679C\u5C0F\u4E8E\u5219\u5F53\u505A\u6CA1\u6709\u4F1A\u5458\u4EF7\n const codeSaveAmountDecimal = new Decimal(variant.price.amount).minus(couponData.variant_price4wscode)\n if (salePriceWithoutCouponAmount > codeSaveAmountDecimal.toNumber()) {\n return false as false\n }\n }\n }\n\n const salePrice = {\n amount: salePriceAmount,\n priceWithCurrency: formatPrice({\n amount: salePriceAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n }),\n }\n\n const savePriceAmount = new Decimal(originalPrice.amount).minus(salePrice.amount).toNumber()\n const savePrice = {\n amount: savePriceAmount,\n priceWithCurrency: formatPrice({\n amount: savePriceAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n maximumFractionDigits: 2,\n }),\n }\n\n const savePriceWithoutCouponAmount = new Decimal(originalPrice.amount)\n .minus(salePriceWithoutCoupon.amount)\n .toNumber()\n const savePriceWithoutCoupon = {\n amount: savePriceWithoutCouponAmount,\n priceWithCurrency: formatPrice({\n amount: savePriceWithoutCouponAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n maximumFractionDigits: 2,\n }),\n }\n\n const result: FunctionMemberPriceResult = {\n // \u662F\u5426\u5B58\u5728\u4F1A\u5458\u4EF7\n hasMemberPrice: !!memberPriceDiscountConfig,\n useCoupon,\n // \u539F\u4EF7\n originalPrice: originalPrice.amount,\n originalPriceWithCurrency: originalPrice.priceWithCurrency as string,\n // \u4F7F\u7528\u5238\u540E\u7684\u6298\u540E\u4EF7\n salePrice: salePrice.amount,\n salePriceWithCurrency: salePrice.priceWithCurrency as string,\n\n // \u4E0D\u4F7F\u7528\u5238\u7684\u6298\u540E\u4EF7\n salePriceWithoutCoupon: salePriceWithoutCoupon.amount,\n salePriceWithoutCouponWithCurrency: salePriceWithoutCoupon.priceWithCurrency as string,\n\n // \u5305\u542B\u4F7F\u7528\u5238\u7684\u8282\u7701\u91D1\u989D\n savePrice: savePrice.amount,\n savePriceWithCurrency: savePrice.priceWithCurrency as string,\n\n // \u4E0D\u4F7F\u7528\u5238\u7684\u8282\u7701\u91D1\u989D\n savePriceWithoutCoupon: savePriceWithoutCoupon.amount,\n savePriceWithoutCouponWithCurrency: savePriceWithoutCoupon.priceWithCurrency as string,\n }\n\n return result\n}\n"],
4
+ "sourcesContent": ["import { formatPrice } from '../utils'\nimport { FunctionMemberPriceConfig, FunctionMemberPriceResult } from '../memberPriceTypes'\nimport { NormalizedProductVariant } from '@anker-in/shopify-react'\nimport { functionDiscountCalculate } from './functionDiscountCalculate'\nimport Decimal from 'decimal.js'\nimport { getFunctionMemberPriceDiscountConfig } from './getFunctionMemberPriceDiscountConfig'\nimport variantGetCoupon from './variantGetCoupon'\n\n// \u8BA1\u7B97\u5355\u4EF6\u5546\u54C1\u7684\u4F1A\u5458\u4EF7\nexport const getFunctionMemberPrice = ({\n memberPriceDiscount,\n currencyCode,\n variant,\n locale,\n}: {\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n currencyCode?: string\n variant?: NormalizedProductVariant\n locale: string\n}) => {\n const couponData = variantGetCoupon({ variant })\n\n // variant\u5BF9\u5E94\u7684\u4F1A\u5458\u4EF7\u6298\u6263\u914D\u7F6E\n const { memberPriceDiscountConfig, activeMemberPriceConfig } = getFunctionMemberPriceDiscountConfig({\n config: memberPriceDiscount,\n variant,\n })\n\n const useCoupon = !!activeMemberPriceConfig?.discount_combinations.other_product_discounts\n\n if (!memberPriceDiscountConfig) {\n return false as false\n }\n\n const originalPrice = {\n amount: variant?.price.amount || 0,\n priceWithCurrency: formatPrice({\n amount: variant?.price.amount || 0,\n currencyCode: currencyCode || 'USD',\n locale,\n }),\n }\n\n const salePriceWithoutCouponAmount = memberPriceDiscountConfig\n ? functionDiscountCalculate({\n config: memberPriceDiscountConfig,\n price: variant?.price.amount || 0,\n })\n : variant?.price.amount || 0\n const salePriceWithoutCoupon = {\n amount: salePriceWithoutCouponAmount,\n priceWithCurrency: formatPrice({\n amount: salePriceWithoutCouponAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n }),\n }\n\n // function \u4F1A\u5458\u4EF7\u662F\u5728\u539F\u4EF7\u7684\u57FA\u7840\u4E0A\u8FDB\u884C\u8BA1\u7B97\uFF0C\u6682\u4E0D\u652F\u6301\u6298\u540E\u4EF7\n let salePriceAmount = salePriceWithoutCouponAmount\n\n // \u51CF\u53BBcode\u7684\u4F18\u60E0\n if (couponData?.variant_price4wscode && variant && useCoupon) {\n if (useCoupon) {\n // code\u7684\u4F18\u60E0\u91D1\u989D\n const codeSaveAmountDecimal = new Decimal(variant.price.amount).minus(couponData.variant_price4wscode)\n salePriceAmount = new Decimal(salePriceWithoutCouponAmount).minus(codeSaveAmountDecimal).toNumber()\n } else {\n // \u4E0D\u80FD\u4E0E code \u540C\u65F6\u4F7F\u7528\uFF0C\u9700\u8981\u5224\u65AD\u4F1A\u5458\u4EF7\u662F\u5426\u5C0F\u4E8E code \u7684\u4F18\u60E0\u91D1\u989D\uFF0C\u5982\u679C\u5C0F\u4E8E\u5219\u5F53\u505A\u6CA1\u6709\u4F1A\u5458\u4EF7\n const codeSaveAmountDecimal = new Decimal(variant.price.amount).minus(couponData.variant_price4wscode)\n if (salePriceWithoutCouponAmount > codeSaveAmountDecimal.toNumber()) {\n return false as false\n }\n }\n }\n\n const salePrice = {\n amount: salePriceAmount,\n priceWithCurrency: formatPrice({\n amount: salePriceAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n }),\n }\n\n const savePriceAmount = new Decimal(originalPrice.amount).minus(salePrice.amount).toNumber()\n const savePrice = {\n amount: savePriceAmount,\n priceWithCurrency: formatPrice({\n amount: savePriceAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n maximumFractionDigits: 2,\n }),\n }\n\n const savePriceWithoutCouponAmount = new Decimal(originalPrice.amount)\n .minus(salePriceWithoutCoupon.amount)\n .toNumber()\n const savePriceWithoutCoupon = {\n amount: savePriceWithoutCouponAmount,\n priceWithCurrency: formatPrice({\n amount: savePriceWithoutCouponAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n maximumFractionDigits: 2,\n }),\n }\n\n const result: FunctionMemberPriceResult = {\n // \u662F\u5426\u5B58\u5728\u4F1A\u5458\u4EF7\n hasMemberPrice: !!memberPriceDiscountConfig,\n useCoupon,\n // \u539F\u4EF7\n originalPrice: originalPrice.amount,\n originalPriceWithCurrency: originalPrice.priceWithCurrency as string,\n // \u4F7F\u7528\u5238\u540E\u7684\u6298\u540E\u4EF7\n salePrice: salePrice.amount,\n salePriceWithCurrency: salePrice.priceWithCurrency as string,\n\n // \u4E0D\u4F7F\u7528\u5238\u7684\u6298\u540E\u4EF7\n salePriceWithoutCoupon: salePriceWithoutCoupon.amount,\n salePriceWithoutCouponWithCurrency: salePriceWithoutCoupon.priceWithCurrency as string,\n\n // \u5305\u542B\u4F7F\u7528\u5238\u7684\u8282\u7701\u91D1\u989D\n savePrice: savePrice.amount,\n savePriceWithCurrency: savePrice.priceWithCurrency as string,\n\n // \u4E0D\u4F7F\u7528\u5238\u7684\u8282\u7701\u91D1\u989D\n savePriceWithoutCoupon: savePriceWithoutCoupon.amount,\n savePriceWithoutCouponWithCurrency: savePriceWithoutCoupon.priceWithCurrency as string,\n }\n\n return result\n}\n"],
5
5
  "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA4B,oBAG5BC,EAA0C,uCAC1CC,EAAoB,yBACpBC,EAAqD,kDACrDC,EAA6B,iCAGtB,MAAMN,EAAyB,CAAC,CACrC,oBAAAO,EACA,aAAAC,EACA,QAAAC,EACA,OAAAC,CACF,IAKM,CACJ,MAAMC,KAAa,EAAAC,SAAiB,CAAE,QAAAH,CAAQ,CAAC,EAGzC,CAAE,0BAAAI,EAA2B,wBAAAC,CAAwB,KAAI,wCAAqC,CAClG,OAAQP,EACR,QAAAE,CACF,CAAC,EAEKM,EAAY,CAAC,CAACD,GAAyB,sBAAsB,wBAEnE,GAAI,CAACD,EACH,MAAO,GAGT,MAAMG,EAAgB,CACpB,OAAQP,GAAS,MAAM,QAAU,EACjC,qBAAmB,eAAY,CAC7B,OAAQA,GAAS,MAAM,QAAU,EACjC,aAAcD,GAAgB,MAC9B,OAAAE,CACF,CAAC,CACH,EAEMO,EAA+BJ,KACjC,6BAA0B,CACxB,OAAQA,EACR,MAAOJ,GAAS,MAAM,QAAU,CAClC,CAAC,EACDA,GAAS,MAAM,QAAU,EACvBS,EAAyB,CAC7B,OAAQD,EACR,qBAAmB,eAAY,CAC7B,OAAQA,EACR,aAAcT,GAAgB,MAC9B,OAAAE,CACF,CAAC,CACH,EAGA,IAAIS,EAAkBF,EAGtB,GAAIN,GAAY,sBAAwBF,GAAWM,EACjD,GAAIA,EAAW,CAEb,MAAMK,EAAwB,IAAI,EAAAC,QAAQZ,EAAQ,MAAM,MAAM,EAAE,MAAME,EAAW,oBAAoB,EACrGQ,EAAkB,IAAI,EAAAE,QAAQJ,CAA4B,EAAE,MAAMG,CAAqB,EAAE,SAAS,CACpG,KAAO,CAEL,MAAMA,EAAwB,IAAI,EAAAC,QAAQZ,EAAQ,MAAM,MAAM,EAAE,MAAME,EAAW,oBAAoB,EACrG,GAAIM,EAA+BG,EAAsB,SAAS,EAChE,MAAO,EAEX,CAGF,MAAME,EAAY,CAChB,OAAQH,EACR,qBAAmB,eAAY,CAC7B,OAAQA,EACR,aAAcX,GAAgB,MAC9B,OAAAE,CACF,CAAC,CACH,EAEMa,EAAkB,IAAI,EAAAF,QAAQL,EAAc,MAAM,EAAE,MAAMM,EAAU,MAAM,EAAE,SAAS,EACrFE,EAAY,CAChB,OAAQD,EACR,qBAAmB,eAAY,CAC7B,OAAQA,EACR,aAAcf,GAAgB,MAC9B,OAAAE,EACA,sBAAuB,CACzB,CAAC,CACH,EAEMe,EAA+B,IAAI,EAAAJ,QAAQL,EAAc,MAAM,EAClE,MAAME,EAAuB,MAAM,EACnC,SAAS,EACNQ,EAAyB,CAC7B,OAAQD,EACR,qBAAmB,eAAY,CAC7B,OAAQA,EACR,aAAcjB,GAAgB,MAC9B,OAAAE,EACA,sBAAuB,CACzB,CAAC,CACH,EA0BA,MAxB0C,CAExC,eAAgB,CAAC,CAACG,EAClB,UAAAE,EAEA,cAAeC,EAAc,OAC7B,0BAA2BA,EAAc,kBAEzC,UAAWM,EAAU,OACrB,sBAAuBA,EAAU,kBAGjC,uBAAwBJ,EAAuB,OAC/C,mCAAoCA,EAAuB,kBAG3D,UAAWM,EAAU,OACrB,sBAAuBA,EAAU,kBAGjC,uBAAwBE,EAAuB,OAC/C,mCAAoCA,EAAuB,iBAC7D,CAGF",
6
6
  "names": ["getFunctionMemberPrice_exports", "__export", "getFunctionMemberPrice", "__toCommonJS", "import_utils", "import_functionDiscountCalculate", "import_decimal", "import_getFunctionMemberPriceDiscountConfig", "import_variantGetCoupon", "memberPriceDiscount", "currencyCode", "variant", "locale", "couponData", "variantGetCoupon", "memberPriceDiscountConfig", "activeMemberPriceConfig", "useCoupon", "originalPrice", "salePriceWithoutCouponAmount", "salePriceWithoutCoupon", "salePriceAmount", "codeSaveAmountDecimal", "Decimal", "salePrice", "savePriceAmount", "savePrice", "savePriceWithoutCouponAmount", "savePriceWithoutCoupon"]
7
7
  }
@@ -1,8 +1,8 @@
1
1
  import { DiscountConfig, FunctionMemberPriceConfig } from '../memberPriceTypes';
2
- import { ProductVariant } from '@anker-in/lib';
2
+ import { NormalizedProductVariant } from '@anker-in/shopify-react';
3
3
  export declare const getFunctionMemberPriceDiscountConfig: ({ config, variant, }: {
4
4
  config?: FunctionMemberPriceConfig[];
5
- variant?: ProductVariant;
5
+ variant?: NormalizedProductVariant;
6
6
  }) => {
7
7
  memberPriceDiscountConfig: DiscountConfig | undefined;
8
8
  activeMemberPriceConfig: FunctionMemberPriceConfig | undefined;
@@ -1,2 +1,2 @@
1
- "use strict";var c=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var d=(n,i)=>{for(var r in i)c(n,r,{get:i[r],enumerable:!0})},g=(n,i,r,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let e of m(i))!s.call(n,e)&&e!==r&&c(n,e,{get:()=>i[e],enumerable:!(t=a(i,e))||t.enumerable});return n};var b=n=>g(c({},"__esModule",{value:!0}),n);var P={};d(P,{getFunctionMemberPriceDiscountConfig:()=>C});module.exports=b(P);var f=require("./atobID");const C=({config:n,variant:i})=>{let r,t;if(!n||!i)return{memberPriceDiscountConfig:r,activeMemberPriceConfig:t};for(const e of n)if(r=e.result_detail.member_discounts?.find(o=>o.main_products.all_store_variant?o:o.main_products.variants.find(u=>String(u.variant_id)===(0,f.atobID)(i.id)))?.discount_conf,r){t=e;break}return r?{memberPriceDiscountConfig:r,activeMemberPriceConfig:t}:{memberPriceDiscountConfig:r,activeMemberPriceConfig:t}};
1
+ "use strict";var c=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var s=(n,i)=>{for(var r in i)c(n,r,{get:i[r],enumerable:!0})},g=(n,i,r,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let e of m(i))!d.call(n,e)&&e!==r&&c(n,e,{get:()=>i[e],enumerable:!(o=u(i,e))||o.enumerable});return n};var b=n=>g(c({},"__esModule",{value:!0}),n);var C={};s(C,{getFunctionMemberPriceDiscountConfig:()=>l});module.exports=b(C);var f=require("./atobID");const l=({config:n,variant:i})=>{let r,o;if(!n||!i)return{memberPriceDiscountConfig:r,activeMemberPriceConfig:o};for(const e of n)if(r=e.result_detail.member_discounts?.find(t=>t.main_products.all_store_variant?t:t.main_products.variants.find(a=>String(a.variant_id)===(0,f.atobID)(i.id)))?.discount_conf,r){o=e;break}return r?{memberPriceDiscountConfig:r,activeMemberPriceConfig:o}:{memberPriceDiscountConfig:r,activeMemberPriceConfig:o}};
2
2
  //# sourceMappingURL=getFunctionMemberPriceDiscountConfig.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.ts"],
4
- "sourcesContent": ["import { DiscountConfig, FunctionMemberPriceConfig } from '../memberPriceTypes'\nimport { ProductVariant } from '@anker-in/lib'\nimport { atobID } from './atobID'\n\n// \u83B7\u53D6\u4F1A\u5458\u4EF7\u6298\u6263\u914D\u7F6E\nexport const getFunctionMemberPriceDiscountConfig = ({\n config,\n variant,\n}: {\n config?: FunctionMemberPriceConfig[]\n variant?: ProductVariant\n}) => {\n let memberPriceDiscountConfig: DiscountConfig | undefined\n let activeMemberPriceConfig: FunctionMemberPriceConfig | undefined\n\n if (!config || !variant) {\n return {\n memberPriceDiscountConfig,\n activeMemberPriceConfig,\n }\n }\n\n for (const configItem of config) {\n memberPriceDiscountConfig = configItem.result_detail.member_discounts?.find(discountItem => {\n if (discountItem.main_products.all_store_variant) {\n return discountItem\n }\n\n return discountItem.main_products.variants.find(\n variantConfig => String(variantConfig.variant_id) === atobID(variant.id as string)\n )\n })?.discount_conf\n\n if (memberPriceDiscountConfig) {\n activeMemberPriceConfig = configItem\n break\n }\n }\n\n if (!memberPriceDiscountConfig) {\n return {\n memberPriceDiscountConfig,\n activeMemberPriceConfig,\n }\n }\n\n return {\n memberPriceDiscountConfig,\n activeMemberPriceConfig,\n }\n}\n"],
4
+ "sourcesContent": ["import { DiscountConfig, FunctionMemberPriceConfig } from '../memberPriceTypes'\nimport { NormalizedProductVariant } from '@anker-in/shopify-react'\nimport { atobID } from './atobID'\n\n// \u83B7\u53D6\u4F1A\u5458\u4EF7\u6298\u6263\u914D\u7F6E\nexport const getFunctionMemberPriceDiscountConfig = ({\n config,\n variant,\n}: {\n config?: FunctionMemberPriceConfig[]\n variant?: NormalizedProductVariant\n}) => {\n let memberPriceDiscountConfig: DiscountConfig | undefined\n let activeMemberPriceConfig: FunctionMemberPriceConfig | undefined\n\n if (!config || !variant) {\n return {\n memberPriceDiscountConfig,\n activeMemberPriceConfig,\n }\n }\n\n for (const configItem of config) {\n memberPriceDiscountConfig = configItem.result_detail.member_discounts?.find(discountItem => {\n if (discountItem.main_products.all_store_variant) {\n return discountItem\n }\n\n return discountItem.main_products.variants.find(\n variantConfig => String(variantConfig.variant_id) === atobID(variant.id as string)\n )\n })?.discount_conf\n\n if (memberPriceDiscountConfig) {\n activeMemberPriceConfig = configItem\n break\n }\n }\n\n if (!memberPriceDiscountConfig) {\n return {\n memberPriceDiscountConfig,\n activeMemberPriceConfig,\n }\n }\n\n return {\n memberPriceDiscountConfig,\n activeMemberPriceConfig,\n }\n}\n"],
5
5
  "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0CAAAE,IAAA,eAAAC,EAAAH,GAEA,IAAAI,EAAuB,oBAGhB,MAAMF,EAAuC,CAAC,CACnD,OAAAG,EACA,QAAAC,CACF,IAGM,CACJ,IAAIC,EACAC,EAEJ,GAAI,CAACH,GAAU,CAACC,EACd,MAAO,CACL,0BAAAC,EACA,wBAAAC,CACF,EAGF,UAAWC,KAAcJ,EAWvB,GAVAE,EAA4BE,EAAW,cAAc,kBAAkB,KAAKC,GACtEA,EAAa,cAAc,kBACtBA,EAGFA,EAAa,cAAc,SAAS,KACzCC,GAAiB,OAAOA,EAAc,UAAU,OAAM,UAAOL,EAAQ,EAAY,CACnF,CACD,GAAG,cAEAC,EAA2B,CAC7BC,EAA0BC,EAC1B,KACF,CAGF,OAAKF,EAOE,CACL,0BAAAA,EACA,wBAAAC,CACF,EATS,CACL,0BAAAD,EACA,wBAAAC,CACF,CAOJ",
6
6
  "names": ["getFunctionMemberPriceDiscountConfig_exports", "__export", "getFunctionMemberPriceDiscountConfig", "__toCommonJS", "import_atobID", "config", "variant", "memberPriceDiscountConfig", "activeMemberPriceConfig", "configItem", "discountItem", "variantConfig"]
7
7
  }
@@ -1,6 +1,6 @@
1
- import { ProductVariant } from '@anker-in/lib';
1
+ import { NormalizedProductVariant } from '@anker-in/shopify-react';
2
2
  declare const variantGetCoupon: ({ variant, channel, }: {
3
- variant?: ProductVariant;
3
+ variant?: NormalizedProductVariant;
4
4
  channel?: string;
5
5
  }) => any;
6
6
  export default variantGetCoupon;
@@ -1,2 +1,2 @@
1
- "use strict";var r=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var m=(e,t)=>{for(var i in t)r(e,i,{get:t[i],enumerable:!0})},f=(e,t,i,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of l(t))!u.call(e,s)&&s!==i&&r(e,s,{get:()=>t[s],enumerable:!(a=c(t,s))||a.enumerable});return e};var w=e=>f(r({},"__esModule",{value:!0}),e);var p={};m(p,{default:()=>g});module.exports=w(p);var d=require("./atobID");const C=({variant:e,channel:t=""})=>{if(!e)return;const i="wsch";return(e?.metafields?.discountCodeApp||[])?.filter(n=>{const o=(0,d.atobID)(e.id);return(!n?.ends_at||new Date(n?.ends_at).getTime()>new Date().getTime())&&new Date(n?.starts_at).getTime()<=new Date().getTime()&&n.variant_shopify_id===+(o||"")&&(t?n?.title?.toLocaleLowerCase().includes(t):!n?.title?.toLocaleLowerCase().includes(i))})?.[0]};var g=C;
1
+ "use strict";var r=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var u=(e,t)=>{for(var i in t)r(e,i,{get:t[i],enumerable:!0})},f=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of c(t))!m.call(e,s)&&s!==i&&r(e,s,{get:()=>t[s],enumerable:!(n=l(t,s))||n.enumerable});return e};var w=e=>f(r({},"__esModule",{value:!0}),e);var p={};u(p,{default:()=>g});module.exports=w(p);var d=require("./atobID");const C=({variant:e,channel:t=""})=>{if(!e)return;const i="wsch";return(e?.metafields?.discountCodeApp||[])?.filter(a=>{const o=(0,d.atobID)(e.id);return(!a?.ends_at||new Date(a?.ends_at).getTime()>new Date().getTime())&&new Date(a?.starts_at).getTime()<=new Date().getTime()&&a.variant_shopify_id===+(o||"")&&(t?a?.title?.toLocaleLowerCase().includes(t):!a?.title?.toLocaleLowerCase().includes(i))})?.[0]};var g=C;
2
2
  //# sourceMappingURL=variantGetCoupon.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/context/utils/variantGetCoupon.ts"],
4
- "sourcesContent": ["import { ProductVariant } from '@anker-in/lib'\nimport { atobID } from './atobID'\n\nconst variantGetCoupon = ({\n variant,\n channel = '',\n}: {\n variant?: ProductVariant\n channel?: string\n}) => {\n if (!variant) return undefined\n\n const hideChannel = 'wsch'\n const discountCodeApp = variant?.metafields?.discountCodeApp || []\n\n const results = discountCodeApp?.filter((coupon: any) => {\n const variantId = atobID(variant.id as string)\n const isActive =\n (!coupon?.ends_at || new Date(coupon?.ends_at).getTime() > new Date().getTime()) &&\n new Date(coupon?.starts_at).getTime() <= new Date().getTime() &&\n coupon.variant_shopify_id === +(variantId || '')\n\n return (\n isActive &&\n (channel\n ? coupon?.title?.toLocaleLowerCase().includes(channel)\n : !coupon?.title?.toLocaleLowerCase().includes(hideChannel))\n )\n })\n\n return results?.[0]\n}\n\nexport default variantGetCoupon\n"],
4
+ "sourcesContent": ["import { NormalizedProductVariant } from '@anker-in/shopify-react'\nimport { atobID } from './atobID'\n\nconst variantGetCoupon = ({\n variant,\n channel = '',\n}: {\n variant?: NormalizedProductVariant\n channel?: string\n}) => {\n if (!variant) return undefined\n\n const hideChannel = 'wsch'\n const discountCodeApp = variant?.metafields?.discountCodeApp || []\n\n const results = discountCodeApp?.filter((coupon: any) => {\n const variantId = atobID(variant.id as string)\n const isActive =\n (!coupon?.ends_at || new Date(coupon?.ends_at).getTime() > new Date().getTime()) &&\n new Date(coupon?.starts_at).getTime() <= new Date().getTime() &&\n coupon.variant_shopify_id === +(variantId || '')\n\n return (\n isActive &&\n (channel\n ? coupon?.title?.toLocaleLowerCase().includes(channel)\n : !coupon?.title?.toLocaleLowerCase().includes(hideChannel))\n )\n })\n\n return results?.[0]\n}\n\nexport default variantGetCoupon\n"],
5
5
  "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAuB,oBAEvB,MAAMC,EAAmB,CAAC,CACxB,QAAAC,EACA,QAAAC,EAAU,EACZ,IAGM,CACJ,GAAI,CAACD,EAAS,OAEd,MAAME,EAAc,OAkBpB,OAjBwBF,GAAS,YAAY,iBAAmB,CAAC,IAEhC,OAAQG,GAAgB,CACvD,MAAMC,KAAY,UAAOJ,EAAQ,EAAY,EAM7C,OAJG,CAACG,GAAQ,SAAW,IAAI,KAAKA,GAAQ,OAAO,EAAE,QAAQ,EAAI,IAAI,KAAK,EAAE,QAAQ,IAC9E,IAAI,KAAKA,GAAQ,SAAS,EAAE,QAAQ,GAAK,IAAI,KAAK,EAAE,QAAQ,GAC5DA,EAAO,qBAAuB,EAAEC,GAAa,MAI5CH,EACGE,GAAQ,OAAO,kBAAkB,EAAE,SAASF,CAAO,EACnD,CAACE,GAAQ,OAAO,kBAAkB,EAAE,SAASD,CAAW,EAEhE,CAAC,IAEgB,CAAC,CACpB,EAEA,IAAON,EAAQG",
6
6
  "names": ["variantGetCoupon_exports", "__export", "variantGetCoupon_default", "__toCommonJS", "import_atobID", "variantGetCoupon", "variant", "channel", "hideChannel", "coupon", "variantId"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var F=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var J=Object.prototype.hasOwnProperty;var K=(t,n)=>{for(var d in n)F(t,d,{get:n[d],enumerable:!0})},Q=(t,n,d,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of G(n))!J.call(t,o)&&o!==d&&F(t,o,{get:()=>n[o],enumerable:!(l=V(n,o))||l.enumerable});return t};var W=t=>Q(F({},"__esModule",{value:!0}),t);var Y={};K(Y,{CreditsAnkersolixTask:()=>X});module.exports=W(Y);var e=require("react/jsx-runtime"),i=require("@anker-in/headless-ui"),b=require("@heroicons/react/24/outline"),A=require("framer-motion"),a=require("react"),f=require("./type"),M=require("../creditsWaysToGetCredits/useActions"),R=require("../context/provider"),c=require("@anker-in/lib"),L=require("../../registration"),T=require("../modal/creditsUploadReceiptModal"),U=require("../modal/subscribeModal"),O=require("../../../constants");const X=({copy:t,classNames:n,id:d})=>{const[l,o]=(0,a.useState)(!1),{profile:B}=(0,R.useCreditsContext)(),{authCodeActivate:D}=(0,L.useRegistration)(),{brand:P}=(0,c.useHeadlessContext)(),h=O.ROUNDED_BRANDS.includes(P),g=!!B,[j,N]=(0,a.useState)(!1),[_,v]=(0,a.useState)(!1),[w,E]=(0,a.useState)(!1),[S,H]=(0,a.useState)(!1),{actions:k}=(0,M.useActions)({copy:t,subscribe:{openSubscribePopup:()=>v(!0),isSuccess:w},uploadReceipt:{openUploadReceiptPopup:()=>N(!0),isSuccess:S}}),I=(0,a.useMemo)(()=>{const s=t.list.map(r=>{if(!k[r.id])return;const{finished:x,notLogin:y,notFinished:C,completed:q}=k[r.id];let u="",m,z;return g?x?(u=q.buttonLabel,m=void 0):(u=C.buttonLabel,m=C.handleClick,z=C.link):(u=y.buttonLabel,m=y.handleClick),{...r,buttonLabel:u,handleClick:m,finished:x,link:z}}).filter(Boolean);return g?s.sort((r,x)=>r?.finished&&!x?.finished?1:!r?.finished&&x?.finished?-1:0):s},[k,t.list,g]),p=I.length>3;return(0,e.jsxs)(i.Container,{id:d,className:"bg-[#F5F5F7]",children:[(0,e.jsx)(i.Heading,{as:"h2",size:"4",html:t.title}),(0,e.jsxs)("div",{className:(0,c.classNames)("mt-[24px] p-[32px] md-l:p-[32px] md:p-[16px] relative overflow-hidden",h?"rounded-[8px]":"",!h&&"l:rounded-none"),style:{background:"linear-gradient(180deg, rgba(255, 241, 214, 0) 39.51%, #F4CA81 119.53%)"},children:[(0,e.jsx)("div",{className:"absolute inset-0 pointer-events-none -z-10",style:{background:"radial-gradient(ellipse 130% 205% at 45% -20%, #FFF6EA 0%, #FFFFFF 73%, #FFF1D6 100%)"}}),(0,e.jsxs)("div",{className:"flex items-center justify-between xl-xxl:h-[448px] l-xl:h-[336px] h-[560px] l:h-auto md:flex-col md:items-start l:h-auto l:mb-[16px] l:flex-col-reverse l:items-start",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-[8px] l:mt-[8px]",children:[(0,e.jsx)(i.Heading,{as:"h3",size:4,html:t?.subtitle,className:"text-[32px] font-bold text-[#080a0f] tracking-[-1.28px] leading-[1.2] xl:text-[24px]"}),(0,e.jsx)("div",{className:"flex items-center gap-[8px]",children:(0,e.jsx)("p",{className:"text-[48px] font-bold tracking-[-1.92px] leading-none bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-43% to-[#00db84] bg-clip-text text-transparent xl-xxl:text-[40px] l-xl:text-[32px] l:text-[24px]",dangerouslySetInnerHTML:{__html:t.equalCredits}})})]}),t.mainImage?.url&&(0,e.jsx)(i.Picture,{className:"h-full object-contain l:mx-auto md:h-auto md:w-full md-l:h-[302px]",imgClassName:"!h-full !object-contain",source:t.mainImage.url})]}),(0,e.jsxs)("div",{className:"relative mt-[24px]",children:[(0,e.jsxs)(A.motion.div,{className:(0,c.classNames)("grid grid-cols-3 gap-[16px] overflow-hidden md:grid-cols-1 md-l:grid-cols-2 min-md:!h-auto"),initial:{height:p?512:"auto"},animate:{height:l||!p?"auto":512},transition:{duration:.3},onAnimationComplete:()=>{if(!l&&p&&window.screen.width<768){const s=document.getElementById(d||"ankersolix-task");s&&s.scrollIntoView({behavior:"smooth",block:"end"})}},children:[I.map(s=>(0,e.jsxs)("div",{className:(0,c.classNames)("flex min-h-[241px] xl-xxl:min-h-[192px] l:min-h-[160px] l-xl:min-h-[170px] flex-col justify-between bg-white p-[32px] xl:p-[16px]",h?"rounded-[16px]":""),children:[(0,e.jsxs)("div",{children:[(0,e.jsx)(i.Text,{as:"p",html:s.title,size:2,className:"text-pretty text-[24px] font-bold xxl:text-[20px]"}),(0,e.jsxs)("div",{className:"mt-[8px] l:mt-[4px] flex items-center",children:[(0,e.jsx)(i.Picture,{className:"size-[24px] xxl:size-[18px] [&_path]:size-full",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450"}),(0,e.jsx)(i.Text,{as:"p",html:s.credits,size:2,className:"ml-[4px] mt-[6px] text-[18px] xxl:text-[14px]"})]})]}),s.handleClick&&!(s.id===f.TaskType.UploadReceipt&&S)&&!(s.id===f.TaskType.Activate&&D.isActivateSuccess)&&!(s.id===f.TaskType.Subscribe&&w)?(0,e.jsx)(i.Button,{as:s.link?"a":"button",...s.link&&{href:s.link},...s.handleClick&&{onClick:s.handleClick},variant:"primary",size:"lg",className:"mt-[24px] w-fit bg-[#080a0f] text-white text-[16px] font-bold tracking-[-0.64px] leading-[1.2]",children:s.buttonLabel}):(0,e.jsx)(i.Button,{variant:"primary",size:"lg",className:"mt-[24px] w-fit bg-[#080a0f] text-white text-[16px] font-bold tracking-[-0.64px] leading-[1.2]",disabled:!0,children:s.buttonLabel})]},s.id)),!l&&p&&(0,e.jsx)("div",{className:"absolute inset-0 pointer-events-none min-md:hidden",style:{background:"linear-gradient(180deg, rgba(244, 202, 129, 0) 66.37%, #f4ca81 100%)"}})]}),p&&(0,e.jsx)(e.Fragment,{children:l?(0,e.jsx)("button",{className:"mx-auto mt-[12px] block w-fit min-md:hidden",onClick:()=>{o(!1)},children:(0,e.jsx)(b.ChevronUpIcon,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})}):(0,e.jsx)(e.Fragment,{children:(0,e.jsx)("div",{className:"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden",children:(0,e.jsx)("button",{className:"w-fit",onClick:()=>o(!l),children:(0,e.jsx)(b.ChevronDownIcon,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})})})})})]})]}),t.receipt&&(0,e.jsx)(T.CreditsUploadReceiptModal,{isOpen:j,onClose:()=>{N(!1)},copy:t.receipt,onSuccess:()=>{H(!0)}}),t.subscribe&&(0,e.jsx)(U.CreditsSubscribeModal,{copy:t.subscribe,onSuccess:()=>{E(!0),setTimeout(()=>{v(!1)},3e3)},isOpen:_,onClose:()=>{v(!1)}})]})};
1
+ "use strict";var F=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var J=(t,l)=>{for(var r in l)F(t,r,{get:l[r],enumerable:!0})},K=(t,l,r,o)=>{if(l&&typeof l=="object"||typeof l=="function")for(let d of V(l))!G.call(t,d)&&d!==r&&F(t,d,{get:()=>l[d],enumerable:!(o=q(l,d))||o.enumerable});return t};var Q=t=>K(F({},"__esModule",{value:!0}),t);var X={};J(X,{CreditsAnkersolixTask:()=>W});module.exports=Q(X);var e=require("react/jsx-runtime"),i=require("@anker-in/headless-ui"),b=require("@heroicons/react/24/outline"),n=require("react"),f=require("./type"),z=require("../creditsWaysToGetCredits/useActions"),R=require("../context/provider"),c=require("@anker-in/lib"),T=require("../../registration"),M=require("../modal/creditsUploadReceiptModal"),A=require("../modal/subscribeModal"),L=require("../../../constants");const W=({copy:t,classNames:l,id:r})=>{const[o,d]=(0,n.useState)(!1),{profile:U}=(0,R.useCreditsContext)(),{authCodeActivate:O}=(0,T.useRegistration)(),{brand:B}=(0,c.useHeadlessContext)(),h=L.ROUNDED_BRANDS.includes(B),g=!!U,[D,N]=(0,n.useState)(!1),[P,v]=(0,n.useState)(!1),[S,j]=(0,n.useState)(!1),[w,E]=(0,n.useState)(!1),{actions:k}=(0,z.useActions)({copy:t,subscribe:{openSubscribePopup:()=>v(!0),isSuccess:S},uploadReceipt:{openUploadReceiptPopup:()=>N(!0),isSuccess:w}}),p=(t?.list||[]).length>3;(0,n.useEffect)(()=>{if(!o&&p&&window.screen.width<768){const s=setTimeout(()=>{const a=document.getElementById(r||"ankersolix-task");a&&a.scrollIntoView({behavior:"smooth",block:"end"})},300);return()=>clearTimeout(s)}},[o,p,r]);const _=(0,n.useMemo)(()=>{const s=t.list.map(a=>{if(!k[a.id])return;const{finished:u,notLogin:I,notFinished:C,completed:H}=k[a.id];let x="",m,y;return g?u?(x=H.buttonLabel,m=void 0):(x=C.buttonLabel,m=C.handleClick,y=C.link):(x=I.buttonLabel,m=I.handleClick),{...a,buttonLabel:x,handleClick:m,finished:u,link:y}}).filter(Boolean);return g?s.sort((a,u)=>a?.finished&&!u?.finished?1:!a?.finished&&u?.finished?-1:0):s},[k,t.list,g]);return(0,e.jsxs)(i.Container,{id:r,className:"bg-[#F5F5F7]",children:[(0,e.jsx)(i.Heading,{as:"h2",size:"4",html:t.title}),(0,e.jsxs)("div",{className:(0,c.classNames)("mt-[24px] p-[32px] md-l:p-[32px] md:p-[16px] relative overflow-hidden",h?"rounded-[8px]":"",!h&&"l:rounded-none"),style:{background:"linear-gradient(180deg, rgba(255, 241, 214, 0) 39.51%, #F4CA81 119.53%)"},children:[(0,e.jsx)("div",{className:"absolute inset-0 pointer-events-none -z-10",style:{background:"radial-gradient(ellipse 130% 205% at 45% -20%, #FFF6EA 0%, #FFFFFF 73%, #FFF1D6 100%)"}}),(0,e.jsxs)("div",{className:"flex items-center justify-between xl-xxl:h-[448px] l-xl:h-[336px] h-[560px] l:h-auto md:flex-col md:items-start l:h-auto l:mb-[16px] l:flex-col-reverse l:items-start",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-[8px] l:mt-[8px]",children:[(0,e.jsx)(i.Heading,{as:"h3",size:4,html:t?.subtitle,className:"text-[32px] font-bold text-[#080a0f] tracking-[-1.28px] leading-[1.2] xl:text-[24px]"}),(0,e.jsx)("div",{className:"flex items-center gap-[8px]",children:(0,e.jsx)("p",{className:"text-[48px] font-bold tracking-[-1.92px] leading-none bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-43% to-[#00db84] bg-clip-text text-transparent xl-xxl:text-[40px] l-xl:text-[32px] l:text-[24px]",dangerouslySetInnerHTML:{__html:t.equalCredits}})})]}),t.mainImage?.url&&(0,e.jsx)(i.Picture,{className:"h-full object-contain l:mx-auto md:h-auto md:w-full md-l:h-[302px]",imgClassName:"!h-full !object-contain",source:t.mainImage.url})]}),(0,e.jsxs)("div",{className:"relative mt-[24px]",children:[(0,e.jsxs)("div",{className:(0,c.classNames)("grid grid-cols-3 gap-[16px] overflow-hidden md:grid-cols-1 md-l:grid-cols-2 min-md:!h-auto transition-all duration-300 ease-in-out"),style:{height:o||!p?"auto":"512px"},children:[_.map(s=>(0,e.jsxs)("div",{className:(0,c.classNames)("flex min-h-[241px] xl-xxl:min-h-[192px] l:min-h-[160px] l-xl:min-h-[170px] flex-col justify-between bg-white p-[32px] xl:p-[16px]",h?"rounded-[16px]":""),children:[(0,e.jsxs)("div",{children:[(0,e.jsx)(i.Text,{as:"p",html:s.title,size:2,className:"text-pretty text-[24px] font-bold xxl:text-[20px]"}),(0,e.jsxs)("div",{className:"mt-[8px] l:mt-[4px] flex items-center",children:[(0,e.jsx)(i.Picture,{className:"size-[24px] xxl:size-[18px] [&_path]:size-full",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450"}),(0,e.jsx)(i.Text,{as:"p",html:s.credits,size:2,className:"ml-[4px] mt-[6px] text-[18px] xxl:text-[14px]"})]})]}),s.handleClick&&!(s.id===f.TaskType.UploadReceipt&&w)&&!(s.id===f.TaskType.Activate&&O.isActivateSuccess)&&!(s.id===f.TaskType.Subscribe&&S)?(0,e.jsx)(i.Button,{as:s.link?"a":"button",...s.link&&{href:s.link},...s.handleClick&&{onClick:s.handleClick},variant:"primary",size:"lg",className:"mt-[24px] w-fit",children:s.buttonLabel}):(0,e.jsx)(i.Button,{variant:"primary",size:"lg",className:"mt-[24px] w-fit",disabled:!0,children:s.buttonLabel})]},s.id)),!o&&p&&(0,e.jsx)("div",{className:"absolute inset-0 pointer-events-none min-md:hidden",style:{background:"linear-gradient(180deg, rgba(244, 202, 129, 0) 66.37%, #f4ca81 100%)"}})]}),p&&(0,e.jsx)(e.Fragment,{children:o?(0,e.jsx)("button",{className:"mx-auto mt-[12px] block w-fit min-md:hidden",onClick:()=>{d(!1)},children:(0,e.jsx)(b.ChevronUpIcon,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})}):(0,e.jsx)(e.Fragment,{children:(0,e.jsx)("div",{className:"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden",children:(0,e.jsx)("button",{className:"w-fit",onClick:()=>d(!o),children:(0,e.jsx)(b.ChevronDownIcon,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})})})})})]})]}),t.receipt&&(0,e.jsx)(M.CreditsUploadReceiptModal,{isOpen:D,onClose:()=>{N(!1)},copy:t.receipt,onSuccess:()=>{E(!0)}}),t.subscribe&&(0,e.jsx)(A.CreditsSubscribeModal,{copy:t.subscribe,onSuccess:()=>{j(!0),setTimeout(()=>{v(!1)},3e3)},isOpen:P,onClose:()=>{v(!1)}})]})};
2
2
  //# sourceMappingURL=CreditsAnkersolixTask.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.tsx"],
4
- "sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline'\nimport { motion } from 'framer-motion'\nimport { useMemo, useState } from 'react'\n\nimport { TaskType, type CreditsAnkersolixTaskProps } from './type'\nimport { useActions } from '../creditsWaysToGetCredits/useActions'\nimport { useCreditsContext } from '../context/provider'\nimport { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useRegistration } from '../../registration'\nimport { CreditsUploadReceiptModal } from '../modal/creditsUploadReceiptModal'\nimport { CreditsSubscribeModal } from '../modal/subscribeModal'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nexport const CreditsAnkersolixTask = ({ copy, classNames, id }: CreditsAnkersolixTaskProps & { id?: string }) => {\n const [showMore, setShowMore] = useState(false)\n const { profile } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const isLogin = !!profile\n\n const [isUploadReceiptModalOpen, setIsUploadReceiptModalOpen] = useState(false)\n const [isSubscribeModalOpen, setIsSubscribeModalOpen] = useState(false)\n const [isSubscribeSuccess, setIsSubscribeSuccess] = useState(false)\n const [isUploadReceiptSuccess, setIsUploadReceiptSuccess] = useState(false)\n\n const { actions } = useActions({\n copy,\n subscribe: {\n openSubscribePopup: () => setIsSubscribeModalOpen(true),\n isSuccess: isSubscribeSuccess,\n },\n uploadReceipt: {\n openUploadReceiptPopup: () => setIsUploadReceiptModalOpen(true),\n isSuccess: isUploadReceiptSuccess,\n },\n })\n const list = useMemo(() => {\n const list = copy.list\n .map(item => {\n if (!actions[item.id as keyof typeof actions]) {\n return undefined\n }\n const { finished, notLogin, notFinished, completed } = actions[item.id as keyof typeof actions]\n let buttonLabel = ''\n let handleClick = undefined\n let link = undefined\n if (!isLogin) {\n buttonLabel = notLogin.buttonLabel\n handleClick = notLogin.handleClick\n } else if (finished) {\n buttonLabel = completed.buttonLabel\n handleClick = undefined\n } else {\n buttonLabel = notFinished.buttonLabel\n handleClick = notFinished.handleClick\n link = (notFinished as { link: string }).link\n }\n return {\n ...item,\n buttonLabel,\n handleClick,\n finished,\n link,\n }\n })\n .filter(Boolean) as {\n title: string\n credits: string\n id: TaskType\n buttonLabel: string\n finished: boolean\n link: string\n handleClick: (() => void) | undefined\n }[]\n\n // \u767B\u5F55\u540E\uFF0C\u4FDD\u7559\u539F\u987A\u5E8F\uFF0C\u5C06\u5DF2\u5B8C\u6210\u7684\u4EFB\u52A1\u653E\u5728\u6700\u540E\n if (isLogin) {\n return list.sort((a, b) => {\n if (a?.finished && !b?.finished) {\n return 1 // a\u5DF2\u5B8C\u6210\uFF0Cb\u672A\u5B8C\u6210\uFF0Ca\u6392\u5728\u540E\u9762\n }\n if (!a?.finished && b?.finished) {\n return -1 // a\u672A\u5B8C\u6210\uFF0Cb\u5DF2\u5B8C\u6210\uFF0Ca\u6392\u5728\u524D\u9762\n }\n return 0 // \u90FD\u5DF2\u5B8C\u6210\u6216\u90FD\u672A\u5B8C\u6210\uFF0C\u4FDD\u6301\u539F\u987A\u5E8F\n })\n } else {\n return list\n }\n }, [actions, copy.list, isLogin])\n\n // \u53EA\u6709\u5927\u4E8E3\u4E2A\u4EFB\u52A1\u65F6\u624D\u663E\u793A\u8499\u5C42\n const shouldShowMask = list.length > 3\n\n return (\n <Container id={id} className=\"bg-[#F5F5F7]\">\n <Heading as=\"h2\" size=\"4\" html={copy.title} />\n <div\n className={cn(\n 'mt-[24px] p-[32px] md-l:p-[32px] md:p-[16px] relative overflow-hidden',\n rounded ? 'rounded-[8px]' : '',\n !rounded && 'l:rounded-none'\n )}\n style={{\n background: 'linear-gradient(180deg, rgba(255, 241, 214, 0) 39.51%, #F4CA81 119.53%)',\n }}\n >\n {/* \u5F84\u5411\u6E10\u53D8\u80CC\u666F\u5C42 - \u4F7F\u7528\u4F2A\u5143\u7D20\u6A21\u62DF */}\n <div\n className=\"absolute inset-0 pointer-events-none -z-10\"\n style={{\n background: 'radial-gradient(ellipse 130% 205% at 45% -20%, #FFF6EA 0%, #FFFFFF 73%, #FFF1D6 100%)',\n }}\n />\n {/* \u526F\u6807\u9898\u548C\u88C5\u9970\u56FE\u90E8\u5206 */}\n <div className=\"flex items-center justify-between xl-xxl:h-[448px] l-xl:h-[336px] h-[560px] l:h-auto md:flex-col md:items-start l:h-auto l:mb-[16px] l:flex-col-reverse l:items-start\">\n <div className=\"flex flex-col gap-[8px] l:mt-[8px]\">\n <Heading\n as=\"h3\"\n size={4}\n html={copy?.subtitle}\n className=\"text-[32px] font-bold text-[#080a0f] tracking-[-1.28px] leading-[1.2] xl:text-[24px]\"\n />\n <div className=\"flex items-center gap-[8px]\">\n <p\n className=\"text-[48px] font-bold tracking-[-1.92px] leading-none bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-43% to-[#00db84] bg-clip-text text-transparent xl-xxl:text-[40px] l-xl:text-[32px] l:text-[24px]\"\n dangerouslySetInnerHTML={{ __html: copy.equalCredits }}\n />\n </div>\n </div>\n {copy.mainImage?.url && (\n <Picture\n className=\"h-full object-contain l:mx-auto md:h-auto md:w-full md-l:h-[302px]\"\n imgClassName=\"!h-full !object-contain\"\n source={copy.mainImage.url}\n />\n )}\n </div>\n\n {/* \u5361\u7247\u5217\u8868 */}\n <div className=\"relative mt-[24px]\">\n <motion.div\n className={cn('grid grid-cols-3 gap-[16px] overflow-hidden md:grid-cols-1 md-l:grid-cols-2 min-md:!h-auto')}\n initial={{ height: shouldShowMask ? 512 : 'auto' }}\n animate={{ height: showMore || !shouldShowMask ? 'auto' : 512 }}\n transition={{ duration: 0.3 }}\n onAnimationComplete={() => {\n if (!showMore && shouldShowMask && window.screen.width < 768) {\n const section = document.getElementById(id || 'ankersolix-task')\n if (section) {\n section.scrollIntoView({ behavior: 'smooth', block: 'end' })\n }\n }\n }}\n >\n {list.map(item => (\n <div\n key={item.id}\n className={cn(\n 'flex min-h-[241px] xl-xxl:min-h-[192px] l:min-h-[160px] l-xl:min-h-[170px] flex-col justify-between bg-white p-[32px] xl:p-[16px]',\n rounded ? 'rounded-[16px]' : ''\n )}\n >\n <div>\n <Text\n as=\"p\"\n html={item.title}\n size={2}\n className=\"text-pretty text-[24px] font-bold xxl:text-[20px]\"\n />\n <div className=\"mt-[8px] l:mt-[4px] flex items-center\">\n <Picture\n className=\"size-[24px] xxl:size-[18px] [&_path]:size-full\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450\"\n />\n <Text\n as=\"p\"\n html={item.credits}\n size={2}\n className=\"ml-[4px] mt-[6px] text-[18px] xxl:text-[14px]\"\n />\n </div>\n </div>\n\n {item.handleClick &&\n !(item.id === TaskType.UploadReceipt && isUploadReceiptSuccess) &&\n !(item.id === TaskType.Activate && authCodeActivate.isActivateSuccess) &&\n !(item.id === TaskType.Subscribe && isSubscribeSuccess) ? (\n <Button\n as={item.link ? 'a' : 'button'}\n {...(item.link && { href: item.link })}\n {...(item.handleClick && { onClick: item.handleClick })}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[24px] w-fit bg-[#080a0f] text-white text-[16px] font-bold tracking-[-0.64px] leading-[1.2]\"\n >\n {item.buttonLabel}\n </Button>\n ) : (\n <Button\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[24px] w-fit bg-[#080a0f] text-white text-[16px] font-bold tracking-[-0.64px] leading-[1.2]\"\n disabled\n >\n {item.buttonLabel}\n </Button>\n )}\n </div>\n ))}\n {!showMore && shouldShowMask && (\n <div\n className=\"absolute inset-0 pointer-events-none min-md:hidden\"\n style={{ background: 'linear-gradient(180deg, rgba(244, 202, 129, 0) 66.37%, #f4ca81 100%)' }}\n ></div>\n )}\n </motion.div>\n {shouldShowMask && (\n <>\n {showMore ? (\n <button\n className=\"mx-auto mt-[12px] block w-fit min-md:hidden\"\n onClick={() => {\n setShowMore(false)\n }}\n >\n <ChevronUpIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronUpIcon>\n </button>\n ) : (\n <>\n <div className=\"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden\">\n <button className=\"w-fit\" onClick={() => setShowMore(!showMore)}>\n <ChevronDownIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronDownIcon>\n </button>\n </div>\n </>\n )}\n </>\n )}\n </div>\n </div>\n {copy.receipt && (\n <CreditsUploadReceiptModal\n isOpen={isUploadReceiptModalOpen}\n onClose={() => {\n setIsUploadReceiptModalOpen(false)\n }}\n copy={copy.receipt}\n onSuccess={() => {\n setIsUploadReceiptSuccess(true)\n }}\n />\n )}\n {copy.subscribe && (\n <CreditsSubscribeModal\n copy={copy.subscribe}\n onSuccess={() => {\n setIsSubscribeSuccess(true)\n setTimeout(() => {\n setIsSubscribeModalOpen(false)\n }, 3000)\n }}\n isOpen={isSubscribeModalOpen}\n onClose={() => {\n setIsSubscribeModalOpen(false)\n }}\n />\n )}\n </Container>\n )\n}\n"],
5
- "mappings": "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",
6
- "names": ["CreditsAnkersolixTask_exports", "__export", "CreditsAnkersolixTask", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_outline", "import_framer_motion", "import_react", "import_type", "import_useActions", "import_provider", "import_lib", "import_registration", "import_creditsUploadReceiptModal", "import_subscribeModal", "import_constants", "copy", "classNames", "id", "showMore", "setShowMore", "profile", "authCodeActivate", "brand", "rounded", "isLogin", "isUploadReceiptModalOpen", "setIsUploadReceiptModalOpen", "isSubscribeModalOpen", "setIsSubscribeModalOpen", "isSubscribeSuccess", "setIsSubscribeSuccess", "isUploadReceiptSuccess", "setIsUploadReceiptSuccess", "actions", "list", "item", "finished", "notLogin", "notFinished", "completed", "buttonLabel", "handleClick", "link", "a", "b", "shouldShowMask", "cn", "section"]
4
+ "sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline'\nimport { useMemo, useState, useRef, useEffect } from 'react'\n\nimport { TaskType, type CreditsAnkersolixTaskProps } from './type'\nimport { useActions } from '../creditsWaysToGetCredits/useActions'\nimport { useCreditsContext } from '../context/provider'\nimport { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useRegistration } from '../../registration'\nimport { CreditsUploadReceiptModal } from '../modal/creditsUploadReceiptModal'\nimport { CreditsSubscribeModal } from '../modal/subscribeModal'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nexport const CreditsAnkersolixTask = ({ copy, classNames, id }: CreditsAnkersolixTaskProps & { id?: string }) => {\n const [showMore, setShowMore] = useState(false)\n const { profile } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const isLogin = !!profile\n\n const [isUploadReceiptModalOpen, setIsUploadReceiptModalOpen] = useState(false)\n const [isSubscribeModalOpen, setIsSubscribeModalOpen] = useState(false)\n const [isSubscribeSuccess, setIsSubscribeSuccess] = useState(false)\n const [isUploadReceiptSuccess, setIsUploadReceiptSuccess] = useState(false)\n\n const { actions } = useActions({\n copy,\n subscribe: {\n openSubscribePopup: () => setIsSubscribeModalOpen(true),\n isSuccess: isSubscribeSuccess,\n },\n uploadReceipt: {\n openUploadReceiptPopup: () => setIsUploadReceiptModalOpen(true),\n isSuccess: isUploadReceiptSuccess,\n },\n })\n\n const shouldShowMask = (copy?.list || []).length > 3\n\n // Handle scroll after collapse animation\n useEffect(() => {\n if (!showMore && shouldShowMask && window.screen.width < 768) {\n const timer = setTimeout(() => {\n const section = document.getElementById(id || 'ankersolix-task')\n if (section) {\n section.scrollIntoView({ behavior: 'smooth', block: 'end' })\n }\n }, 300) // Match transition duration\n return () => clearTimeout(timer)\n }\n }, [showMore, shouldShowMask, id])\n const list = useMemo(() => {\n const list = copy.list\n .map(item => {\n if (!actions[item.id as keyof typeof actions]) {\n return undefined\n }\n const { finished, notLogin, notFinished, completed } = actions[item.id as keyof typeof actions]\n let buttonLabel = ''\n let handleClick = undefined\n let link = undefined\n if (!isLogin) {\n buttonLabel = notLogin.buttonLabel\n handleClick = notLogin.handleClick\n } else if (finished) {\n buttonLabel = completed.buttonLabel\n handleClick = undefined\n } else {\n buttonLabel = notFinished.buttonLabel\n handleClick = notFinished.handleClick\n link = (notFinished as { link: string }).link\n }\n return {\n ...item,\n buttonLabel,\n handleClick,\n finished,\n link,\n }\n })\n .filter(Boolean) as {\n title: string\n credits: string\n id: TaskType\n buttonLabel: string\n finished: boolean\n link: string\n handleClick: (() => void) | undefined\n }[]\n\n // \u767B\u5F55\u540E\uFF0C\u4FDD\u7559\u539F\u987A\u5E8F\uFF0C\u5C06\u5DF2\u5B8C\u6210\u7684\u4EFB\u52A1\u653E\u5728\u6700\u540E\n if (isLogin) {\n return list.sort((a, b) => {\n if (a?.finished && !b?.finished) {\n return 1 // a\u5DF2\u5B8C\u6210\uFF0Cb\u672A\u5B8C\u6210\uFF0Ca\u6392\u5728\u540E\u9762\n }\n if (!a?.finished && b?.finished) {\n return -1 // a\u672A\u5B8C\u6210\uFF0Cb\u5DF2\u5B8C\u6210\uFF0Ca\u6392\u5728\u524D\u9762\n }\n return 0 // \u90FD\u5DF2\u5B8C\u6210\u6216\u90FD\u672A\u5B8C\u6210\uFF0C\u4FDD\u6301\u539F\u987A\u5E8F\n })\n } else {\n return list\n }\n }, [actions, copy.list, isLogin])\n\n return (\n <Container id={id} className=\"bg-[#F5F5F7]\">\n <Heading as=\"h2\" size=\"4\" html={copy.title} />\n <div\n className={cn(\n 'mt-[24px] p-[32px] md-l:p-[32px] md:p-[16px] relative overflow-hidden',\n rounded ? 'rounded-[8px]' : '',\n !rounded && 'l:rounded-none'\n )}\n style={{\n background: 'linear-gradient(180deg, rgba(255, 241, 214, 0) 39.51%, #F4CA81 119.53%)',\n }}\n >\n {/* \u5F84\u5411\u6E10\u53D8\u80CC\u666F\u5C42 - \u4F7F\u7528\u4F2A\u5143\u7D20\u6A21\u62DF */}\n <div\n className=\"absolute inset-0 pointer-events-none -z-10\"\n style={{\n background: 'radial-gradient(ellipse 130% 205% at 45% -20%, #FFF6EA 0%, #FFFFFF 73%, #FFF1D6 100%)',\n }}\n />\n {/* \u526F\u6807\u9898\u548C\u88C5\u9970\u56FE\u90E8\u5206 */}\n <div className=\"flex items-center justify-between xl-xxl:h-[448px] l-xl:h-[336px] h-[560px] l:h-auto md:flex-col md:items-start l:h-auto l:mb-[16px] l:flex-col-reverse l:items-start\">\n <div className=\"flex flex-col gap-[8px] l:mt-[8px]\">\n <Heading\n as=\"h3\"\n size={4}\n html={copy?.subtitle}\n className=\"text-[32px] font-bold text-[#080a0f] tracking-[-1.28px] leading-[1.2] xl:text-[24px]\"\n />\n <div className=\"flex items-center gap-[8px]\">\n <p\n className=\"text-[48px] font-bold tracking-[-1.92px] leading-none bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-43% to-[#00db84] bg-clip-text text-transparent xl-xxl:text-[40px] l-xl:text-[32px] l:text-[24px]\"\n dangerouslySetInnerHTML={{ __html: copy.equalCredits }}\n />\n </div>\n </div>\n {copy.mainImage?.url && (\n <Picture\n className=\"h-full object-contain l:mx-auto md:h-auto md:w-full md-l:h-[302px]\"\n imgClassName=\"!h-full !object-contain\"\n source={copy.mainImage.url}\n />\n )}\n </div>\n\n {/* \u5361\u7247\u5217\u8868 */}\n <div className=\"relative mt-[24px]\">\n <div\n className={cn(\n 'grid grid-cols-3 gap-[16px] overflow-hidden md:grid-cols-1 md-l:grid-cols-2 min-md:!h-auto transition-all duration-300 ease-in-out'\n )}\n style={{\n height: showMore || !shouldShowMask ? 'auto' : '512px',\n }}\n >\n {list.map(item => (\n <div\n key={item.id}\n className={cn(\n 'flex min-h-[241px] xl-xxl:min-h-[192px] l:min-h-[160px] l-xl:min-h-[170px] flex-col justify-between bg-white p-[32px] xl:p-[16px]',\n rounded ? 'rounded-[16px]' : ''\n )}\n >\n <div>\n <Text\n as=\"p\"\n html={item.title}\n size={2}\n className=\"text-pretty text-[24px] font-bold xxl:text-[20px]\"\n />\n <div className=\"mt-[8px] l:mt-[4px] flex items-center\">\n <Picture\n className=\"size-[24px] xxl:size-[18px] [&_path]:size-full\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450\"\n />\n <Text\n as=\"p\"\n html={item.credits}\n size={2}\n className=\"ml-[4px] mt-[6px] text-[18px] xxl:text-[14px]\"\n />\n </div>\n </div>\n\n {item.handleClick &&\n !(item.id === TaskType.UploadReceipt && isUploadReceiptSuccess) &&\n !(item.id === TaskType.Activate && authCodeActivate.isActivateSuccess) &&\n !(item.id === TaskType.Subscribe && isSubscribeSuccess) ? (\n <Button\n as={item.link ? 'a' : 'button'}\n {...(item.link && { href: item.link })}\n {...(item.handleClick && { onClick: item.handleClick })}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[24px] w-fit\"\n >\n {item.buttonLabel}\n </Button>\n ) : (\n <Button variant=\"primary\" size=\"lg\" className=\"mt-[24px] w-fit\" disabled>\n {item.buttonLabel}\n </Button>\n )}\n </div>\n ))}\n {!showMore && shouldShowMask && (\n <div\n className=\"absolute inset-0 pointer-events-none min-md:hidden\"\n style={{ background: 'linear-gradient(180deg, rgba(244, 202, 129, 0) 66.37%, #f4ca81 100%)' }}\n ></div>\n )}\n </div>\n {shouldShowMask && (\n <>\n {showMore ? (\n <button\n className=\"mx-auto mt-[12px] block w-fit min-md:hidden\"\n onClick={() => {\n setShowMore(false)\n }}\n >\n <ChevronUpIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronUpIcon>\n </button>\n ) : (\n <>\n <div className=\"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden\">\n <button className=\"w-fit\" onClick={() => setShowMore(!showMore)}>\n <ChevronDownIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronDownIcon>\n </button>\n </div>\n </>\n )}\n </>\n )}\n </div>\n </div>\n {copy.receipt && (\n <CreditsUploadReceiptModal\n isOpen={isUploadReceiptModalOpen}\n onClose={() => {\n setIsUploadReceiptModalOpen(false)\n }}\n copy={copy.receipt}\n onSuccess={() => {\n setIsUploadReceiptSuccess(true)\n }}\n />\n )}\n {copy.subscribe && (\n <CreditsSubscribeModal\n copy={copy.subscribe}\n onSuccess={() => {\n setIsSubscribeSuccess(true)\n setTimeout(() => {\n setIsSubscribeModalOpen(false)\n }, 3000)\n }}\n isOpen={isSubscribeModalOpen}\n onClose={() => {\n setIsSubscribeModalOpen(false)\n }}\n />\n )}\n </Container>\n )\n}\n"],
5
+ "mappings": "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",
6
+ "names": ["CreditsAnkersolixTask_exports", "__export", "CreditsAnkersolixTask", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_outline", "import_react", "import_type", "import_useActions", "import_provider", "import_lib", "import_registration", "import_creditsUploadReceiptModal", "import_subscribeModal", "import_constants", "copy", "classNames", "id", "showMore", "setShowMore", "profile", "authCodeActivate", "brand", "rounded", "isLogin", "isUploadReceiptModalOpen", "setIsUploadReceiptModalOpen", "isSubscribeModalOpen", "setIsSubscribeModalOpen", "isSubscribeSuccess", "setIsSubscribeSuccess", "isUploadReceiptSuccess", "setIsUploadReceiptSuccess", "actions", "shouldShowMask", "timer", "section", "list", "item", "finished", "notLogin", "notFinished", "completed", "buttonLabel", "handleClick", "link", "b", "cn"]
7
7
  }
@@ -1,6 +1,8 @@
1
1
  type Img = {
2
2
  url: string;
3
3
  alt: string;
4
+ width?: number;
5
+ height?: number;
4
6
  };
5
7
  export type CreditsBannerCopy = {
6
8
  pcImg: Img;
@@ -1,2 +1,13 @@
1
- "use strict";var x=Object.create;var o=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var C=(t,n)=>{for(var e in n)o(t,e,{get:n[e],enumerable:!0})},m=(t,n,e,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of I(n))!v.call(t,a)&&a!==e&&o(t,a,{get:()=>n[a],enumerable:!(r=f(n,a))||r.enumerable});return t};var N=(t,n,e)=>(e=t!=null?x(h(t)):{},m(n||!t||!t.__esModule?o(e,"default",{value:t,enumerable:!0}):e,t)),w=t=>m(o({},"__esModule",{value:!0}),t);var b={};C(b,{CreditsBanner:()=>y});module.exports=w(b);var i=require("react/jsx-runtime"),l=require("@anker-in/headless-ui"),p=N(require("classnames")),d=require("../context/provider");function y({copy:t,id:n}){const{profile:e,openSignInPopup:r,openSignUpPopup:a}=(0,d.useCreditsContext)(),s=e?Object.keys(e).length!==0:!1,c=e?.first_name?e?.first_name+" "+e?.last_name:e?.email?.split("@")[0],g=u=>{u==="primary"?a():r()};return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{id:n,className:" relative w-full",children:[(0,i.jsx)(l.Picture,{className:"aspect-h-[804] aspect-w-[1920] md:aspect-h-[660] md:aspect-w-[390] md-l:aspect-h-[660] md-l:aspect-w-[768]",source:`${t.pcImg?.url}, ${t.laptopImg?.url} 1024, ${t.mobileImg?.url} 768`,alt:t.pcImg?.alt,loading:"eager"}),s&&(0,i.jsx)("div",{className:"absolute inset-0 ",style:{background:"linear-gradient(180deg, rgba(245, 245, 247, 0) 70.31%, #F5F5F7 100%)"}}),(0,i.jsx)(l.Container,{className:"l:h-auto !absolute inset-0 mx-auto grid h-full",asChild:!0,children:(0,i.jsx)("div",{className:"grid grid-cols-12",children:(0,i.jsxs)("div",{className:"l:col-span-12 l:justify-start l:truncate l:pt-[64px] col-span-5 flex h-full flex-col justify-center text-[#1F2021]",children:[(0,i.jsx)(l.Heading,{as:"h1",size:"5",html:s?t.login.title?.replace("$name",c||""):t.unLogin.title}),(0,i.jsx)(l.Text,{size:"3",className:"l:mt-[4px] l-xxl:text-[14px] mt-[16px]",html:s?t.login.description:t.unLogin.description}),!s&&(0,i.jsxs)("div",{className:(0,p.default)("mt-[32px] grid w-fit grid-flow-col gap-[12px] l:mt-[24px]",s&&"hidden"),children:[(0,i.jsx)(l.Button,{variant:"secondary",size:"lg",onClick:()=>{g("primary")},children:t.joinNow}),(0,i.jsx)(l.Button,{variant:"primary",size:"lg",onClick:()=>{g("secondary")},children:t.loginIn})]})]})})})]})})}
1
+ "use strict";var f=Object.create;var m=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var N=(t,a)=>{for(var e in a)m(t,e,{get:a[e],enumerable:!0})},o=(t,a,e,r)=>{if(a&&typeof a=="object"||typeof a=="function")for(let n of w(a))!C.call(t,n)&&n!==e&&m(t,n,{get:()=>a[n],enumerable:!(r=b(a,n))||r.enumerable});return t};var $=(t,a,e)=>(e=t!=null?f(v(t)):{},o(a||!t||!t.__esModule?m(e,"default",{value:t,enumerable:!0}):e,t)),B=t=>o(m({},"__esModule",{value:!0}),t);var k={};N(k,{CreditsBanner:()=>j});module.exports=B(k);var i=require("react/jsx-runtime"),l=require("@anker-in/headless-ui"),d=$(require("classnames")),p=require("../context/provider");function j({copy:t,id:a}){const{profile:e,openSignInPopup:r,openSignUpPopup:n}=(0,p.useCreditsContext)(),s=e?Object.keys(e).length!==0:!1,c=e?.first_name?e?.first_name+" "+e?.last_name:e?.email?.split("@")[0],g=I=>{I==="primary"?n():r()},h=t.pcImg?.width&&t.pcImg?.height?`${t.pcImg.width} / ${t.pcImg.height}`:"1920 / 804",u=t.laptopImg?.width&&t.laptopImg?.height?`${t.laptopImg.width} / ${t.laptopImg.height}`:"768 / 660",x=t.mobileImg?.width&&t.mobileImg?.height?`${t.mobileImg.width} / ${t.mobileImg.height}`:"390 / 660";return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{id:a,className:" relative w-full",children:[(0,i.jsx)(l.Picture,{className:"credits-banner-image w-full",style:{aspectRatio:h},imgClassName:"object-cover w-full h-full",source:`${t.pcImg?.url}, ${t.laptopImg?.url} 1024, ${t.mobileImg?.url} 768`,alt:t.pcImg?.alt,loading:"eager"}),(0,i.jsx)("style",{children:`
2
+ @media (max-width: 1024px) and (min-width: 768px) {
3
+ .credits-banner-image {
4
+ aspect-ratio: ${u} !important;
5
+ }
6
+ }
7
+ @media (max-width: 767px) {
8
+ .credits-banner-image {
9
+ aspect-ratio: ${x} !important;
10
+ }
11
+ }
12
+ `}),s&&(0,i.jsx)("div",{className:"absolute inset-0 ",style:{background:"linear-gradient(180deg, rgba(245, 245, 247, 0) 70.31%, #F5F5F7 100%)"}}),(0,i.jsx)(l.Container,{className:"l:h-auto !absolute inset-0 mx-auto grid h-full",asChild:!0,children:(0,i.jsx)("div",{className:"grid grid-cols-12",children:(0,i.jsxs)("div",{className:"l:col-span-12 l:justify-start l:truncate l:pt-[32px] col-span-5 flex h-full flex-col justify-center text-[#1F2021]",children:[(0,i.jsx)(l.Heading,{as:"h1",size:"5",className:"text-[48px] xl-xxl:text-[40px] l:text-[32px]",html:s?t.login.title?.replace("$name",c||""):t.unLogin.title}),(0,i.jsx)(l.Text,{size:"3",className:"l:mt-[4px] l-xxl:text-[14px] mt-[16px]",html:s?t.login.description:t.unLogin.description}),!s&&(0,i.jsxs)("div",{className:(0,d.default)("mt-[32px] grid w-fit grid-flow-col gap-[12px] l:mt-[24px]",s&&"hidden"),children:[(0,i.jsx)(l.Button,{variant:"secondary",size:"lg",onClick:()=>{g("primary")},children:t.joinNow}),(0,i.jsx)(l.Button,{variant:"primary",size:"lg",onClick:()=>{g("secondary")},children:t.loginIn})]})]})})})]})})}
2
13
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/creditsBanner/index.tsx"],
4
- "sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCreditsContext } from '../context/provider'\n\ntype Img = {\n url: string\n alt: string\n}\nexport type CreditsBannerCopy = {\n pcImg: Img\n laptopImg: Img\n mobileImg: Img\n joinNow: string\n loginIn: string\n login: {\n title: string\n description: string\n }\n unLogin: {\n title: string\n description: string\n }\n}\n\nexport function CreditsBanner({ copy, id }: { copy: CreditsBannerCopy; id?: string }) {\n const { profile, openSignInPopup, openSignUpPopup } = useCreditsContext()\n const isLogin = profile ? Object.keys(profile).length !== 0 : false\n\n const displayName = profile?.first_name\n ? profile?.first_name + ' ' + profile?.last_name\n : profile?.email?.split('@')[0]\n\n const handleButtonClick = (buttonType: 'primary' | 'secondary') => {\n buttonType === 'primary' ? openSignUpPopup() : openSignInPopup()\n }\n\n return (\n <>\n <div id={id} className=\" relative w-full\">\n <Picture\n className=\"aspect-h-[804] aspect-w-[1920] md:aspect-h-[660] md:aspect-w-[390] md-l:aspect-h-[660] md-l:aspect-w-[768]\"\n source={`${copy.pcImg?.url}, ${copy.laptopImg?.url} 1024, ${copy.mobileImg?.url} 768`}\n alt={copy.pcImg?.alt}\n loading=\"eager\"\n ></Picture>\n {isLogin && (\n <div\n className=\"absolute inset-0 \"\n style={{\n background: 'linear-gradient(180deg, rgba(245, 245, 247, 0) 70.31%, #F5F5F7 100%)',\n }}\n ></div>\n )}\n\n <Container className=\"l:h-auto !absolute inset-0 mx-auto grid h-full\" asChild>\n <div className=\"grid grid-cols-12\">\n <div className=\"l:col-span-12 l:justify-start l:truncate l:pt-[64px] col-span-5 flex h-full flex-col justify-center text-[#1F2021]\">\n <Heading\n as=\"h1\"\n size=\"5\"\n html={isLogin ? copy.login.title?.replace('$name', displayName || '') : copy.unLogin.title}\n ></Heading>\n\n <Text\n size=\"3\"\n className=\"l:mt-[4px] l-xxl:text-[14px] mt-[16px]\"\n html={isLogin ? copy.login.description : copy.unLogin.description}\n ></Text>\n\n {!isLogin && (\n <div\n className={classNames(\n 'mt-[32px] grid w-fit grid-flow-col gap-[12px] l:mt-[24px]',\n isLogin && 'hidden'\n )}\n >\n <Button\n variant=\"secondary\"\n size=\"lg\"\n onClick={() => {\n handleButtonClick('primary')\n }}\n >\n {copy.joinNow}\n </Button>\n <Button\n variant=\"primary\"\n size=\"lg\"\n onClick={() => {\n handleButtonClick('secondary')\n }}\n >\n {copy.loginIn}\n </Button>\n </div>\n )}\n </div>\n </div>\n </Container>\n </div>\n </>\n )\n}\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAqCI,IAAAI,EAAA,6BArCJC,EAA0D,iCAC1DC,EAAuB,yBACvBC,EAAkC,+BAsB3B,SAASL,EAAc,CAAE,KAAAM,EAAM,GAAAC,CAAG,EAA6C,CACpF,KAAM,CAAE,QAAAC,EAAS,gBAAAC,EAAiB,gBAAAC,CAAgB,KAAI,qBAAkB,EAClEC,EAAUH,EAAU,OAAO,KAAKA,CAAO,EAAE,SAAW,EAAI,GAExDI,EAAcJ,GAAS,WACzBA,GAAS,WAAa,IAAMA,GAAS,UACrCA,GAAS,OAAO,MAAM,GAAG,EAAE,CAAC,EAE1BK,EAAqBC,GAAwC,CACjEA,IAAe,UAAYJ,EAAgB,EAAID,EAAgB,CACjE,EAEA,SACE,mBACE,oBAAC,OAAI,GAAIF,EAAI,UAAU,mBACrB,oBAAC,WACC,UAAU,6GACV,OAAQ,GAAGD,EAAK,OAAO,GAAG,KAAKA,EAAK,WAAW,GAAG,UAAUA,EAAK,WAAW,GAAG,OAC/E,IAAKA,EAAK,OAAO,IACjB,QAAQ,QACT,EACAK,MACC,OAAC,OACC,UAAU,oBACV,MAAO,CACL,WAAY,sEACd,EACD,KAGH,OAAC,aAAU,UAAU,iDAAiD,QAAO,GAC3E,mBAAC,OAAI,UAAU,oBACb,oBAAC,OAAI,UAAU,qHACb,oBAAC,WACC,GAAG,KACH,KAAK,IACL,KAAMA,EAAUL,EAAK,MAAM,OAAO,QAAQ,QAASM,GAAe,EAAE,EAAIN,EAAK,QAAQ,MACtF,KAED,OAAC,QACC,KAAK,IACL,UAAU,yCACV,KAAMK,EAAUL,EAAK,MAAM,YAAcA,EAAK,QAAQ,YACvD,EAEA,CAACK,MACA,QAAC,OACC,aAAW,EAAAI,SACT,4DACAJ,GAAW,QACb,EAEA,oBAAC,UACC,QAAQ,YACR,KAAK,KACL,QAAS,IAAM,CACbE,EAAkB,SAAS,CAC7B,EAEC,SAAAP,EAAK,QACR,KACA,OAAC,UACC,QAAQ,UACR,KAAK,KACL,QAAS,IAAM,CACbO,EAAkB,WAAW,CAC/B,EAEC,SAAAP,EAAK,QACR,GACF,GAEJ,EACF,EACF,GACF,EACF,CAEJ",
6
- "names": ["creditsBanner_exports", "__export", "CreditsBanner", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_classnames", "import_provider", "copy", "id", "profile", "openSignInPopup", "openSignUpPopup", "isLogin", "displayName", "handleButtonClick", "buttonType", "classNames"]
4
+ "sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCreditsContext } from '../context/provider'\n\ntype Img = {\n url: string\n alt: string\n width?: number\n height?: number\n}\nexport type CreditsBannerCopy = {\n pcImg: Img\n laptopImg: Img\n mobileImg: Img\n joinNow: string\n loginIn: string\n login: {\n title: string\n description: string\n }\n unLogin: {\n title: string\n description: string\n }\n}\n\nexport function CreditsBanner({ copy, id }: { copy: CreditsBannerCopy; id?: string }) {\n const { profile, openSignInPopup, openSignUpPopup } = useCreditsContext()\n const isLogin = profile ? Object.keys(profile).length !== 0 : false\n\n const displayName = profile?.first_name\n ? profile?.first_name + ' ' + profile?.last_name\n : profile?.email?.split('@')[0]\n\n const handleButtonClick = (buttonType: 'primary' | 'secondary') => {\n buttonType === 'primary' ? openSignUpPopup() : openSignInPopup()\n }\n\n // \u8BA1\u7B97\u56FE\u7247\u6BD4\u4F8B\uFF0C\u5982\u679C\u6CA1\u6709\u914D\u7F6E\u5219\u4F7F\u7528\u9ED8\u8BA4\u503C\n const pcAspectRatio =\n copy.pcImg?.width && copy.pcImg?.height ? `${copy.pcImg.width} / ${copy.pcImg.height}` : '1920 / 804'\n const laptopAspectRatio =\n copy.laptopImg?.width && copy.laptopImg?.height ? `${copy.laptopImg.width} / ${copy.laptopImg.height}` : '768 / 660'\n const mobileAspectRatio =\n copy.mobileImg?.width && copy.mobileImg?.height ? `${copy.mobileImg.width} / ${copy.mobileImg.height}` : '390 / 660'\n\n return (\n <>\n <div id={id} className=\" relative w-full\">\n <Picture\n className=\"credits-banner-image w-full\"\n style={{\n aspectRatio: pcAspectRatio,\n }}\n imgClassName=\"object-cover w-full h-full\"\n source={`${copy.pcImg?.url}, ${copy.laptopImg?.url} 1024, ${copy.mobileImg?.url} 768`}\n alt={copy.pcImg?.alt}\n loading=\"eager\"\n ></Picture>\n <style>\n {`\n @media (max-width: 1024px) and (min-width: 768px) {\n .credits-banner-image {\n aspect-ratio: ${laptopAspectRatio} !important;\n }\n }\n @media (max-width: 767px) {\n .credits-banner-image {\n aspect-ratio: ${mobileAspectRatio} !important;\n }\n }\n `}\n </style>\n {isLogin && (\n <div\n className=\"absolute inset-0 \"\n style={{\n background: 'linear-gradient(180deg, rgba(245, 245, 247, 0) 70.31%, #F5F5F7 100%)',\n }}\n ></div>\n )}\n\n <Container className=\"l:h-auto !absolute inset-0 mx-auto grid h-full\" asChild>\n <div className=\"grid grid-cols-12\">\n <div className=\"l:col-span-12 l:justify-start l:truncate l:pt-[32px] col-span-5 flex h-full flex-col justify-center text-[#1F2021]\">\n <Heading\n as=\"h1\"\n size=\"5\"\n className=\"text-[48px] xl-xxl:text-[40px] l:text-[32px]\"\n html={isLogin ? copy.login.title?.replace('$name', displayName || '') : copy.unLogin.title}\n ></Heading>\n\n <Text\n size=\"3\"\n className=\"l:mt-[4px] l-xxl:text-[14px] mt-[16px]\"\n html={isLogin ? copy.login.description : copy.unLogin.description}\n ></Text>\n\n {!isLogin && (\n <div\n className={classNames(\n 'mt-[32px] grid w-fit grid-flow-col gap-[12px] l:mt-[24px]',\n isLogin && 'hidden'\n )}\n >\n <Button\n variant=\"secondary\"\n size=\"lg\"\n onClick={() => {\n handleButtonClick('primary')\n }}\n >\n {copy.joinNow}\n </Button>\n <Button\n variant=\"primary\"\n size=\"lg\"\n onClick={() => {\n handleButtonClick('secondary')\n }}\n >\n {copy.loginIn}\n </Button>\n </div>\n )}\n </div>\n </div>\n </Container>\n </div>\n </>\n )\n}\n"],
5
+ "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GA+CI,IAAAI,EAAA,6BA/CJC,EAA0D,iCAC1DC,EAAuB,yBACvBC,EAAkC,+BAwB3B,SAASL,EAAc,CAAE,KAAAM,EAAM,GAAAC,CAAG,EAA6C,CACpF,KAAM,CAAE,QAAAC,EAAS,gBAAAC,EAAiB,gBAAAC,CAAgB,KAAI,qBAAkB,EAClEC,EAAUH,EAAU,OAAO,KAAKA,CAAO,EAAE,SAAW,EAAI,GAExDI,EAAcJ,GAAS,WACzBA,GAAS,WAAa,IAAMA,GAAS,UACrCA,GAAS,OAAO,MAAM,GAAG,EAAE,CAAC,EAE1BK,EAAqBC,GAAwC,CACjEA,IAAe,UAAYJ,EAAgB,EAAID,EAAgB,CACjE,EAGMM,EACJT,EAAK,OAAO,OAASA,EAAK,OAAO,OAAS,GAAGA,EAAK,MAAM,KAAK,MAAMA,EAAK,MAAM,MAAM,GAAK,aACrFU,EACJV,EAAK,WAAW,OAASA,EAAK,WAAW,OAAS,GAAGA,EAAK,UAAU,KAAK,MAAMA,EAAK,UAAU,MAAM,GAAK,YACrGW,EACJX,EAAK,WAAW,OAASA,EAAK,WAAW,OAAS,GAAGA,EAAK,UAAU,KAAK,MAAMA,EAAK,UAAU,MAAM,GAAK,YAE3G,SACE,mBACE,oBAAC,OAAI,GAAIC,EAAI,UAAU,mBACrB,oBAAC,WACC,UAAU,8BACV,MAAO,CACL,YAAaQ,CACf,EACA,aAAa,6BACb,OAAQ,GAAGT,EAAK,OAAO,GAAG,KAAKA,EAAK,WAAW,GAAG,UAAUA,EAAK,WAAW,GAAG,OAC/E,IAAKA,EAAK,OAAO,IACjB,QAAQ,QACT,KACD,OAAC,SACE;AAAA;AAAA;AAAA,gCAGqBU,CAAiB;AAAA;AAAA;AAAA;AAAA;AAAA,gCAKjBC,CAAiB;AAAA;AAAA;AAAA,YAIzC,EACCN,MACC,OAAC,OACC,UAAU,oBACV,MAAO,CACL,WAAY,sEACd,EACD,KAGH,OAAC,aAAU,UAAU,iDAAiD,QAAO,GAC3E,mBAAC,OAAI,UAAU,oBACb,oBAAC,OAAI,UAAU,qHACb,oBAAC,WACC,GAAG,KACH,KAAK,IACL,UAAU,+CACV,KAAMA,EAAUL,EAAK,MAAM,OAAO,QAAQ,QAASM,GAAe,EAAE,EAAIN,EAAK,QAAQ,MACtF,KAED,OAAC,QACC,KAAK,IACL,UAAU,yCACV,KAAMK,EAAUL,EAAK,MAAM,YAAcA,EAAK,QAAQ,YACvD,EAEA,CAACK,MACA,QAAC,OACC,aAAW,EAAAO,SACT,4DACAP,GAAW,QACb,EAEA,oBAAC,UACC,QAAQ,YACR,KAAK,KACL,QAAS,IAAM,CACbE,EAAkB,SAAS,CAC7B,EAEC,SAAAP,EAAK,QACR,KACA,OAAC,UACC,QAAQ,UACR,KAAK,KACL,QAAS,IAAM,CACbO,EAAkB,WAAW,CAC/B,EAEC,SAAAP,EAAK,QACR,GACF,GAEJ,EACF,EACF,GACF,EACF,CAEJ",
6
+ "names": ["creditsBanner_exports", "__export", "CreditsBanner", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_classnames", "import_provider", "copy", "id", "profile", "openSignInPopup", "openSignUpPopup", "isLogin", "displayName", "handleButtonClick", "buttonType", "pcAspectRatio", "laptopAspectRatio", "mobileAspectRatio", "classNames"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var h=Object.create;var a=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var z=(e,o)=>{for(var n in o)a(e,n,{get:o[n],enumerable:!0})},b=(e,o,n,d)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of k(o))!y.call(e,i)&&i!==n&&a(e,i,{get:()=>o[i],enumerable:!(d=D(o,i))||d.enumerable});return e};var I=(e,o,n)=>(n=e!=null?h(C(e)):{},b(o||!e||!e.__esModule?a(n,"default",{value:e,enumerable:!0}):n,e)),w=e=>b(a({},"__esModule",{value:!0}),e);var S={};z(S,{default:()=>A});module.exports=w(S);var t=require("react/jsx-runtime"),s=require("@anker-in/headless-ui"),l=require("@anker-in/lib"),f=I(require("./IconInfo")),u=require("../../../constants");const B=({item:e,handleClick:o,isNoteActive:n,index:d,bigIcon:i,cardBgColor:x,cardBorderColor:c})=>{const{brand:g,locale:v}=(0,l.useHeadlessContext)(),m=u.ROUNDED_BRANDS.includes(g),F=["de","eu-de","fr","eu-fr"].includes(v),N=i?"mb-[16px] size-[64px] xl-xxl:size-[56px] xl:size-[48px] md:absolute md:bottom-[16px] md:right-[16px] md:mb-0":"mb-[16px] size-[31px] md:absolute md:bottom-[16px] md:right-[16px] md:mb-0";console.log("cardBgColor in BenefitItem",x);const r={};return x?r.background=x:r.background="linear-gradient(119.61deg, #FAFAFA 38.58%, #FFFFFF 63.73%, #F9FCFF 89.37%)",c&&(r.borderColor=c),(0,t.jsx)("div",{className:(0,l.classNames)("relative flex-1 flex flex-col rounded-[16px] border border-white px-[24px] pb-[26px] pt-[24px] md:min-h-[180px] md:p-[16px]",!m&&"rounded-none"),style:r,children:(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)(s.Picture,{className:N,alt:e.icon?.alt,source:e.icon?.url}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(s.Heading,{html:e.text,size:"2",className:(0,l.classNames)("md-l:line-clamp-3",F&&"break-words")}),e.note&&(0,t.jsxs)("div",{role:"button",tabIndex:0,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&p.preventDefault()},className:"relative mb-1 ml-[4px]",onClick:()=>o({item:e,index:d}),children:[(0,t.jsx)(f.default,{}),(0,t.jsx)("div",{className:(0,l.classNames)("absolute -bottom-[12px] left-[32px] z-10 w-[356px] -translate-x-full translate-y-full md:w-[276px]",n?"block":"hidden"),children:(0,t.jsxs)("div",{className:(0,l.classNames)("relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow",!m&&"rounded-none"),children:[(0,t.jsx)(s.Text,{as:"p",size:"2",html:e.note,className:"desktop:text-[18px]"}),(0,t.jsx)("div",{className:(0,l.classNames)("absolute -top-[10px] right-[9px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]",!m&&"rounded-none")})]})})]})]}),e.tag&&(0,t.jsx)(s.Text,{as:"div",html:e.tag,className:"mt-[2px] text-[16px] font-bold text-[#6D6D6F]"})]})})};var A=B;
2
+ //# sourceMappingURL=BenefitItem.js.map