@anker-in/campaign-ui 0.2.11-beta.2 → 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 (249) 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/context/utils.d.ts +4 -0
  23. package/dist/cjs/components/credits/context/utils.js +1 -1
  24. package/dist/cjs/components/credits/context/utils.js.map +3 -3
  25. package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js +1 -1
  26. package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js.map +3 -3
  27. package/dist/cjs/components/credits/creditsBanner/index.d.ts +2 -0
  28. package/dist/cjs/components/credits/creditsBanner/index.js +12 -1
  29. package/dist/cjs/components/credits/creditsBanner/index.js.map +3 -3
  30. package/dist/cjs/components/credits/creditsBenefits/BenefitItem.js +1 -1
  31. package/dist/cjs/components/credits/creditsBenefits/BenefitItem.js.map +3 -3
  32. package/dist/cjs/components/credits/creditsBenefits/IconInfo.js +1 -1
  33. package/dist/cjs/components/credits/creditsBenefits/IconInfo.js.map +1 -1
  34. package/dist/cjs/components/credits/creditsBenefits/index.js +3 -3
  35. package/dist/cjs/components/credits/creditsBenefits/index.js.map +2 -2
  36. package/dist/cjs/components/credits/creditsCash/CreditsCash.js +1 -1
  37. package/dist/cjs/components/credits/creditsCash/CreditsCash.js.map +2 -2
  38. package/dist/cjs/components/credits/creditsCash/RedeemableItem.js +1 -1
  39. package/dist/cjs/components/credits/creditsCash/RedeemableItem.js.map +3 -3
  40. package/dist/cjs/components/credits/creditsCash/type.d.ts +1 -0
  41. package/dist/cjs/components/credits/creditsCash/type.js +1 -1
  42. package/dist/cjs/components/credits/creditsCash/type.js.map +1 -1
  43. package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.js +1 -1
  44. package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.js.map +3 -3
  45. package/dist/cjs/components/credits/creditsFaq/index.js +1 -1
  46. package/dist/cjs/components/credits/creditsFaq/index.js.map +3 -3
  47. package/dist/cjs/components/credits/creditsInfoCard/index.js +1 -1
  48. package/dist/cjs/components/credits/creditsInfoCard/index.js.map +3 -3
  49. package/dist/cjs/components/credits/creditsMemberPrice/CreditsMemberPrice.js +1 -1
  50. package/dist/cjs/components/credits/creditsMemberPrice/CreditsMemberPrice.js.map +3 -3
  51. package/dist/cjs/components/credits/creditsMemberPrice/MemberPriceItem.js +1 -1
  52. package/dist/cjs/components/credits/creditsMemberPrice/MemberPriceItem.js.map +3 -3
  53. package/dist/cjs/components/credits/creditsMemberPrice/Pagination.d.ts +7 -0
  54. package/dist/cjs/components/credits/creditsMemberPrice/Pagination.js +2 -0
  55. package/dist/cjs/components/credits/creditsMemberPrice/Pagination.js.map +7 -0
  56. package/dist/cjs/components/credits/creditsMemberPrice/type.d.ts +3 -5
  57. package/dist/cjs/components/credits/creditsMemberPrice/type.js +1 -1
  58. package/dist/cjs/components/credits/creditsMemberPrice/type.js.map +1 -1
  59. package/dist/cjs/components/credits/creditsNavigation/CreditsNavigation.js +1 -1
  60. package/dist/cjs/components/credits/creditsNavigation/CreditsNavigation.js.map +2 -2
  61. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +1 -1
  62. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +3 -3
  63. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js +1 -1
  64. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +3 -3
  65. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
  66. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js.map +3 -3
  67. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
  68. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
  69. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
  70. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +3 -3
  71. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
  72. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +3 -3
  73. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  74. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js.map +3 -3
  75. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
  76. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +3 -3
  77. package/dist/cjs/components/credits/modal/MyRewardsModal.js +1 -1
  78. package/dist/cjs/components/credits/modal/MyRewardsModal.js.map +3 -3
  79. package/dist/cjs/components/credits/modal/activitiesModal.js +1 -1
  80. package/dist/cjs/components/credits/modal/activitiesModal.js.map +3 -3
  81. package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js +1 -1
  82. package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js.map +3 -3
  83. package/dist/cjs/components/credits/modal/modalContainer.js +1 -1
  84. package/dist/cjs/components/credits/modal/modalContainer.js.map +3 -3
  85. package/dist/cjs/components/credits/modal/subscribeModal.js +1 -1
  86. package/dist/cjs/components/credits/modal/subscribeModal.js.map +3 -3
  87. package/dist/cjs/components/credits/modal/tip.js +1 -1
  88. package/dist/cjs/components/credits/modal/tip.js.map +3 -3
  89. package/dist/cjs/components/index.d.ts +2 -2
  90. package/dist/cjs/components/index.js +1 -1
  91. package/dist/cjs/components/index.js.map +2 -2
  92. package/dist/cjs/components/registration/authCodeActivate/index.js +1 -1
  93. package/dist/cjs/components/registration/authCodeActivate/index.js.map +3 -3
  94. package/dist/cjs/components/registration/modalContainer.js +1 -1
  95. package/dist/cjs/components/registration/modalContainer.js.map +3 -3
  96. package/dist/cjs/constants.d.ts +1 -0
  97. package/dist/cjs/constants.js +2 -0
  98. package/dist/cjs/constants.js.map +7 -0
  99. package/dist/cjs/index.d.ts +3 -2
  100. package/dist/cjs/index.js +1 -1
  101. package/dist/cjs/index.js.map +2 -2
  102. package/dist/cjs/templates/Credits.d.ts +15 -1
  103. package/dist/cjs/templates/Credits.js +1 -1
  104. package/dist/cjs/templates/Credits.js.map +3 -3
  105. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.d.ts +2 -2
  106. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js +1 -1
  107. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js.map +2 -2
  108. package/dist/esm/components/credits/context/memberPriceConst.d.ts +0 -5
  109. package/dist/esm/components/credits/context/memberPriceConst.js +1 -1
  110. package/dist/esm/components/credits/context/memberPriceConst.js.map +3 -3
  111. package/dist/esm/components/credits/context/memberPriceTypes.d.ts +1 -22
  112. package/dist/esm/components/credits/context/provider.d.ts +15 -1
  113. package/dist/esm/components/credits/context/provider.js +1 -1
  114. package/dist/esm/components/credits/context/provider.js.map +3 -3
  115. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.d.ts +2 -2
  116. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js +1 -1
  117. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js.map +1 -1
  118. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.d.ts +2 -2
  119. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js +1 -1
  120. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js.map +1 -1
  121. package/dist/esm/components/credits/context/utils/variantGetCoupon.d.ts +2 -2
  122. package/dist/esm/components/credits/context/utils/variantGetCoupon.js +1 -1
  123. package/dist/esm/components/credits/context/utils/variantGetCoupon.js.map +1 -1
  124. package/dist/esm/components/credits/context/utils.d.ts +4 -0
  125. package/dist/esm/components/credits/context/utils.js +1 -1
  126. package/dist/esm/components/credits/context/utils.js.map +3 -3
  127. package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js +1 -1
  128. package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js.map +3 -3
  129. package/dist/esm/components/credits/creditsBanner/index.d.ts +2 -0
  130. package/dist/esm/components/credits/creditsBanner/index.js +12 -1
  131. package/dist/esm/components/credits/creditsBanner/index.js.map +3 -3
  132. package/dist/esm/components/credits/creditsBenefits/BenefitItem.js +1 -1
  133. package/dist/esm/components/credits/creditsBenefits/BenefitItem.js.map +3 -3
  134. package/dist/esm/components/credits/creditsBenefits/IconInfo.js +1 -1
  135. package/dist/esm/components/credits/creditsBenefits/IconInfo.js.map +1 -1
  136. package/dist/esm/components/credits/creditsBenefits/index.js +3 -3
  137. package/dist/esm/components/credits/creditsBenefits/index.js.map +2 -2
  138. package/dist/esm/components/credits/creditsCash/CreditsCash.js +1 -1
  139. package/dist/esm/components/credits/creditsCash/CreditsCash.js.map +2 -2
  140. package/dist/esm/components/credits/creditsCash/RedeemableItem.js +1 -1
  141. package/dist/esm/components/credits/creditsCash/RedeemableItem.js.map +3 -3
  142. package/dist/esm/components/credits/creditsCash/type.d.ts +1 -0
  143. package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js +1 -1
  144. package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js.map +3 -3
  145. package/dist/esm/components/credits/creditsFaq/index.js +1 -1
  146. package/dist/esm/components/credits/creditsFaq/index.js.map +3 -3
  147. package/dist/esm/components/credits/creditsInfoCard/index.js +1 -1
  148. package/dist/esm/components/credits/creditsInfoCard/index.js.map +2 -2
  149. package/dist/esm/components/credits/creditsMemberPrice/CreditsMemberPrice.js +1 -1
  150. package/dist/esm/components/credits/creditsMemberPrice/CreditsMemberPrice.js.map +3 -3
  151. package/dist/esm/components/credits/creditsMemberPrice/MemberPriceItem.js +1 -1
  152. package/dist/esm/components/credits/creditsMemberPrice/MemberPriceItem.js.map +3 -3
  153. package/dist/esm/components/credits/creditsMemberPrice/Pagination.d.ts +7 -0
  154. package/dist/esm/components/credits/creditsMemberPrice/Pagination.js +2 -0
  155. package/dist/esm/components/credits/creditsMemberPrice/Pagination.js.map +7 -0
  156. package/dist/esm/components/credits/creditsMemberPrice/type.d.ts +3 -5
  157. package/dist/esm/components/credits/creditsNavigation/CreditsNavigation.js +1 -1
  158. package/dist/esm/components/credits/creditsNavigation/CreditsNavigation.js.map +2 -2
  159. package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +1 -1
  160. package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +2 -2
  161. package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js +1 -1
  162. package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +2 -2
  163. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
  164. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js.map +2 -2
  165. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
  166. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
  167. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
  168. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +3 -3
  169. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
  170. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +2 -2
  171. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  172. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +3 -3
  173. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
  174. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +3 -3
  175. package/dist/esm/components/credits/modal/MyRewardsModal.js +1 -1
  176. package/dist/esm/components/credits/modal/MyRewardsModal.js.map +2 -2
  177. package/dist/esm/components/credits/modal/activitiesModal.js +1 -1
  178. package/dist/esm/components/credits/modal/activitiesModal.js.map +3 -3
  179. package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js +1 -1
  180. package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js.map +3 -3
  181. package/dist/esm/components/credits/modal/modalContainer.js +1 -1
  182. package/dist/esm/components/credits/modal/modalContainer.js.map +3 -3
  183. package/dist/esm/components/credits/modal/subscribeModal.js +1 -1
  184. package/dist/esm/components/credits/modal/subscribeModal.js.map +3 -3
  185. package/dist/esm/components/credits/modal/tip.js +1 -1
  186. package/dist/esm/components/credits/modal/tip.js.map +3 -3
  187. package/dist/esm/components/index.d.ts +2 -2
  188. package/dist/esm/components/index.js +1 -1
  189. package/dist/esm/components/index.js.map +2 -2
  190. package/dist/esm/components/registration/authCodeActivate/index.js +1 -1
  191. package/dist/esm/components/registration/authCodeActivate/index.js.map +3 -3
  192. package/dist/esm/components/registration/modalContainer.js +1 -1
  193. package/dist/esm/components/registration/modalContainer.js.map +3 -3
  194. package/dist/esm/constants.d.ts +1 -0
  195. package/dist/esm/constants.js +2 -0
  196. package/dist/esm/constants.js.map +7 -0
  197. package/dist/esm/index.d.ts +3 -2
  198. package/dist/esm/index.js +1 -1
  199. package/dist/esm/index.js.map +2 -2
  200. package/dist/esm/templates/Credits.d.ts +15 -1
  201. package/dist/esm/templates/Credits.js +1 -1
  202. package/dist/esm/templates/Credits.js.map +3 -3
  203. package/package.json +3 -3
  204. package/src/components/credits/context/memberPriceConst.ts +0 -7
  205. package/src/components/credits/context/memberPriceTypes.ts +1 -26
  206. package/src/components/credits/context/provider.tsx +14 -0
  207. package/src/components/credits/context/utils.ts +9 -0
  208. package/src/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.tsx +43 -40
  209. package/src/components/credits/creditsBanner/index.tsx +31 -2
  210. package/src/components/credits/creditsBenefits/BenefitItem.tsx +13 -5
  211. package/src/components/credits/creditsBenefits/IconInfo.tsx +1 -1
  212. package/src/components/credits/creditsBenefits/index.tsx +1 -1
  213. package/src/components/credits/creditsCash/CreditsCash.tsx +1 -1
  214. package/src/components/credits/creditsCash/RedeemableItem.tsx +25 -7
  215. package/src/components/credits/creditsCash/type.ts +1 -0
  216. package/src/components/credits/creditsFaq/faqItem/FaqItem.tsx +25 -23
  217. package/src/components/credits/creditsFaq/index.tsx +2 -1
  218. package/src/components/credits/creditsInfoCard/index.tsx +3 -2
  219. package/src/components/credits/creditsMemberPrice/CreditsMemberPrice.tsx +94 -117
  220. package/src/components/credits/creditsMemberPrice/MemberPriceItem.tsx +127 -27
  221. package/src/components/credits/creditsMemberPrice/Pagination.tsx +113 -0
  222. package/src/components/credits/creditsMemberPrice/type.ts +3 -5
  223. package/src/components/credits/creditsNavigation/CreditsNavigation.tsx +3 -3
  224. package/src/components/credits/creditsRedeemList/AddressForm/CountrySelect.tsx +2 -1
  225. package/src/components/credits/creditsRedeemList/AddressForm/StateSelect.tsx +2 -1
  226. package/src/components/credits/creditsRedeemList/AddressForm/index.tsx +2 -1
  227. package/src/components/credits/creditsRedeemList/CreditsRedeemList.tsx +27 -13
  228. package/src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx +2 -1
  229. package/src/components/credits/creditsRedeemList/RedeemProductModal/Success.tsx +2 -1
  230. package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +3 -2
  231. package/src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx +34 -20
  232. package/src/components/credits/modal/MyRewardsModal.tsx +2 -1
  233. package/src/components/credits/modal/activitiesModal.tsx +2 -1
  234. package/src/components/credits/modal/creditsUploadReceiptModal.tsx +2 -1
  235. package/src/components/credits/modal/modalContainer.tsx +2 -1
  236. package/src/components/credits/modal/subscribeModal.tsx +2 -1
  237. package/src/components/credits/modal/tip.tsx +2 -1
  238. package/src/components/index.ts +2 -2
  239. package/src/components/registration/authCodeActivate/index.tsx +1 -1
  240. package/src/components/registration/modalContainer.tsx +2 -1
  241. package/src/constants.ts +1 -0
  242. package/src/index.ts +3 -2
  243. package/src/templates/Credits.tsx +26 -9
  244. package/src/components/credits/context/hooks/useFunctionMemberPrice.ts +0 -33
  245. package/src/components/credits/context/utils/atobID.ts +0 -8
  246. package/src/components/credits/context/utils/functionDiscountCalculate.ts +0 -57
  247. package/src/components/credits/context/utils/getFunctionMemberPrice.ts +0 -135
  248. package/src/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.ts +0 -51
  249. package/src/components/credits/context/utils/variantGetCoupon.ts +0 -34
@@ -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,EAAq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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
  }
@@ -23,3 +23,7 @@ export declare function formatVariantPrice({ amount, baseAmount, currencyCode, l
23
23
  basePrice: string | undefined;
24
24
  discount: string | null;
25
25
  };
26
+ /**
27
+ * 提取 variant id,去掉 gid://shopify/ProductVariant/ 前缀
28
+ */
29
+ export declare function extractVariantId(id: string | number | undefined): string | null;
@@ -1,2 +1,2 @@
1
- "use strict";var k=Object.create;var o=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var $=(e,n)=>{for(var r in n)o(e,r,{get:n[r],enumerable:!0})},p=(e,n,r,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of E(n))!P.call(e,i)&&i!==r&&o(e,i,{get:()=>n[i],enumerable:!(t=C(n,i))||t.enumerable});return e};var F=(e,n,r)=>(r=e!=null?k(I(e)):{},p(n||!e||!e.__esModule?o(r,"default",{value:e,enumerable:!0}):r,e)),x=e=>p(o({},"__esModule",{value:!0}),e);var z={};$(z,{emailValidate:()=>U,formatPrice:()=>m,formatVariantPrice:()=>v,getAlpcPath:()=>D,languageTerritory:()=>f,numberFormat:()=>S});module.exports=x(z);var l=F(require("js-cookie")),s=require("./const");function D(e=""){let n=!1;const r=l.default.get("alpcEU");return r===void 0||r===""?["de","eu-de","eu","eu-en","uk","fr","fra"].includes(e)&&(n=!0):Number(r)&&(n=!0),n?"/api/multipass/alpc-eu":"/api/multipass/alpc"}function S(e=0){return typeof Intl>"u"?e:new Intl.NumberFormat().format(e)}const U=e=>/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e),f=e=>({us:"en-us",uk:"en-gb",ca:"en-ca",au:"en-au",nz:"en-nz",eu:"en-eu",pl:"pl-pl",fr:"fr-fr",de:"de-de",vn:"vi-vn",sg:"en-sg","ae-en":"en-ae",plus:"en-us",cl:"es-cl",es:"es-es",se:"en-se",dk:"en-dk",is:"en-is",no:"en-no",fi:"en-fi"})[e]||"";function m({amount:e,currencyCode:n,locale:r,maximumFractionDigits:t,minimumFractionDigits:i,removeTrailingZeros:a=!1}){let u=new Intl.NumberFormat(f(r)||r,{style:"currency",currency:n||"USD",minimumFractionDigits:t===0?0:i,maximumFractionDigits:t}).format(e);return["eu-de","eu-en","de","eu"].includes(r)&&(u=u?.toString()?.replace(/[\s]/g,"")),a&&(u=u.replace(/(\.\d*?[1-9])0+\b/,"$1").replace(/\.0+\b/,"").replace(/(\,\d*?[1-9])0+\b/,"$1").replace(/\,0+\b/,"")),u}function v({amount:e,baseAmount:n,currencyCode:r,locale:t,maximumFractionDigits:i,minimumFractionDigits:a,removeTrailingZeros:c}){if(typeof Intl>"u")return{price:`${s.PRICE_SYMBOL[t]}${e}`,basePrice:`${s.PRICE_SYMBOL[t]}${n}`,discount:`${s.PRICE_SYMBOL[t]}${n-e||0}`};const u=n>e,d=new Intl.NumberFormat(f(t),{style:"percent"}),g=u?d.format((n-e)/n):null,b=m({amount:e,currencyCode:r,locale:t,removeTrailingZeros:c}),y=u?m({amount:n,currencyCode:r,locale:t,maximumFractionDigits:i,minimumFractionDigits:a,removeTrailingZeros:c}):void 0;return{price:b,basePrice:y,discount:g}}
1
+ "use strict";var I=Object.create;var o=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var E=(e,n)=>{for(var r in n)o(e,r,{get:n[r],enumerable:!0})},p=(e,n,r,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of k(n))!C.call(e,i)&&i!==r&&o(e,i,{get:()=>n[i],enumerable:!(t=P(n,i))||t.enumerable});return e};var S=(e,n,r)=>(r=e!=null?I(x(e)):{},p(n||!e||!e.__esModule?o(r,"default",{value:e,enumerable:!0}):r,e)),$=e=>p(o({},"__esModule",{value:!0}),e);var z={};E(z,{emailValidate:()=>U,extractVariantId:()=>v,formatPrice:()=>m,formatVariantPrice:()=>V,getAlpcPath:()=>F,languageTerritory:()=>f,numberFormat:()=>D});module.exports=$(z);var l=S(require("js-cookie")),s=require("./const");function F(e=""){let n=!1;const r=l.default.get("alpcEU");return r===void 0||r===""?["de","eu-de","eu","eu-en","uk","fr","fra"].includes(e)&&(n=!0):Number(r)&&(n=!0),n?"/api/multipass/alpc-eu":"/api/multipass/alpc"}function D(e=0){return typeof Intl>"u"?e:new Intl.NumberFormat().format(e)}const U=e=>/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e),f=e=>({us:"en-us",uk:"en-gb",ca:"en-ca",au:"en-au",nz:"en-nz",eu:"en-eu",pl:"pl-pl",fr:"fr-fr",de:"de-de",vn:"vi-vn",sg:"en-sg","ae-en":"en-ae",plus:"en-us",cl:"es-cl",es:"es-es",se:"en-se",dk:"en-dk",is:"en-is",no:"en-no",fi:"en-fi"})[e]||"";function m({amount:e,currencyCode:n,locale:r,maximumFractionDigits:t,minimumFractionDigits:i,removeTrailingZeros:a=!1}){let u=new Intl.NumberFormat(f(r)||r,{style:"currency",currency:n||"USD",minimumFractionDigits:t===0?0:i,maximumFractionDigits:t}).format(e);return["eu-de","eu-en","de","eu"].includes(r)&&(u=u?.toString()?.replace(/[\s]/g,"")),a&&(u=u.replace(/(\.\d*?[1-9])0+\b/,"$1").replace(/\.0+\b/,"").replace(/(\,\d*?[1-9])0+\b/,"$1").replace(/\,0+\b/,"")),u}function V({amount:e,baseAmount:n,currencyCode:r,locale:t,maximumFractionDigits:i,minimumFractionDigits:a,removeTrailingZeros:c}){if(typeof Intl>"u")return{price:`${s.PRICE_SYMBOL[t]}${e}`,basePrice:`${s.PRICE_SYMBOL[t]}${n}`,discount:`${s.PRICE_SYMBOL[t]}${n-e||0}`};const u=n>e,d=new Intl.NumberFormat(f(t),{style:"percent"}),g=u?d.format((n-e)/n):null,b=m({amount:e,currencyCode:r,locale:t,removeTrailingZeros:c}),y=u?m({amount:n,currencyCode:r,locale:t,maximumFractionDigits:i,minimumFractionDigits:a,removeTrailingZeros:c}):void 0;return{price:b,basePrice:y,discount:g}}function v(e){return e?(typeof e=="number"?e.toString():e).replace("gid://shopify/ProductVariant/",""):null}
2
2
  //# sourceMappingURL=utils.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/context/utils.ts"],
4
- "sourcesContent": ["import Cookies from 'js-cookie'\nimport { PRICE_SYMBOL } from './const'\n\nexport function getAlpcPath(locale = '') {\n let isEU = false\n const alpcEUCookie = Cookies.get('alpcEU')\n if (alpcEUCookie === undefined || alpcEUCookie === '') {\n if (['de', 'eu-de', 'eu', 'eu-en', 'uk', 'fr', 'fra'].includes(locale)) {\n isEU = true\n }\n } else {\n let alpcEU = Number(alpcEUCookie)\n if (alpcEU) {\n isEU = true\n }\n }\n\n if (isEU) {\n return '/api/multipass/alpc-eu'\n }\n\n return '/api/multipass/alpc'\n}\n\nexport function numberFormat(num: number = 0) {\n if (typeof Intl === 'undefined') {\n return num\n }\n\n return new Intl.NumberFormat().format(num)\n}\n\nexport const emailValidate = (email: any) => {\n return /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/.test(\n email\n )\n}\n\nexport const languageTerritory = (locale: string) =>\n // https://unicode-org.github.io/cldr-staging/charts/37/supplemental/language_territory_information.html\n ({\n us: 'en-us',\n uk: 'en-gb',\n ca: 'en-ca',\n au: 'en-au',\n nz: 'en-nz',\n eu: 'en-eu',\n pl: 'pl-pl',\n fr: 'fr-fr',\n de: 'de-de',\n vn: 'vi-vn',\n sg: 'en-sg',\n 'ae-en': 'en-ae',\n plus: 'en-us',\n cl: 'es-cl',\n es: 'es-es',\n // Nordic countries\n se: 'en-se',\n dk: 'en-dk',\n is: 'en-is',\n no: 'en-no',\n fi: 'en-fi',\n })[locale] || ''\n\nexport function formatPrice({\n amount,\n currencyCode,\n locale,\n maximumFractionDigits,\n minimumFractionDigits,\n removeTrailingZeros = false,\n}: {\n amount: number\n currencyCode: string\n locale: string\n maximumFractionDigits?: number\n minimumFractionDigits?: number\n removeTrailingZeros?: boolean\n}) {\n const formatCurrency = new Intl.NumberFormat(languageTerritory(locale) || locale, {\n style: 'currency',\n currency: currencyCode || 'USD',\n minimumFractionDigits: maximumFractionDigits === 0 ? 0 : minimumFractionDigits,\n maximumFractionDigits,\n })\n\n let formattedValue = formatCurrency.format(amount)\n\n if (['eu-de', 'eu-en', 'de', 'eu'].includes(locale)) {\n formattedValue = formattedValue?.toString()?.replace(/[\\s]/g, '')\n }\n\n if (removeTrailingZeros) {\n // Adjust the regex to match comma as decimal separator\n formattedValue = formattedValue\n .replace(/(\\.\\d*?[1-9])0+\\b/, '$1')\n .replace(/\\.0+\\b/, '')\n .replace(/(\\,\\d*?[1-9])0+\\b/, '$1')\n .replace(/\\,0+\\b/, '')\n }\n\n return formattedValue\n}\n\nexport function formatVariantPrice({\n amount,\n baseAmount,\n currencyCode,\n locale,\n maximumFractionDigits,\n minimumFractionDigits,\n removeTrailingZeros,\n}: {\n baseAmount: number\n amount: number\n currencyCode: string\n locale: string\n maximumFractionDigits?: number\n minimumFractionDigits?: number\n removeTrailingZeros?: boolean\n}) {\n if (typeof Intl === 'undefined') {\n return {\n price: `${PRICE_SYMBOL[locale as keyof typeof PRICE_SYMBOL]}${amount}`,\n basePrice: `${PRICE_SYMBOL[locale as keyof typeof PRICE_SYMBOL]}${baseAmount}`,\n discount: `${PRICE_SYMBOL[locale as keyof typeof PRICE_SYMBOL]}${baseAmount - amount || 0}`,\n }\n }\n\n const hasDiscount = baseAmount > amount\n const formatDiscount = new Intl.NumberFormat(languageTerritory(locale), {\n style: 'percent',\n })\n const discount = hasDiscount ? formatDiscount.format((baseAmount - amount) / baseAmount) : null\n\n const price = formatPrice({ amount, currencyCode, locale, removeTrailingZeros })\n const basePrice = hasDiscount\n ? formatPrice({\n amount: baseAmount,\n currencyCode,\n locale,\n maximumFractionDigits,\n minimumFractionDigits,\n removeTrailingZeros,\n })\n : undefined\n\n return { price, basePrice, discount }\n}\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,EAAA,gBAAAC,EAAA,uBAAAC,EAAA,gBAAAC,EAAA,sBAAAC,EAAA,iBAAAC,IAAA,eAAAC,EAAAR,GAAA,IAAAS,EAAoB,wBACpBC,EAA6B,mBAEtB,SAASL,EAAYM,EAAS,GAAI,CACvC,IAAIC,EAAO,GACX,MAAMC,EAAe,EAAAC,QAAQ,IAAI,QAAQ,EAYzC,OAXID,IAAiB,QAAaA,IAAiB,GAC7C,CAAC,KAAM,QAAS,KAAM,QAAS,KAAM,KAAM,KAAK,EAAE,SAASF,CAAM,IACnEC,EAAO,IAGI,OAAOC,CAAY,IAE9BD,EAAO,IAIPA,EACK,yBAGF,qBACT,CAEO,SAASL,EAAaQ,EAAc,EAAG,CAC5C,OAAI,OAAO,KAAS,IACXA,EAGF,IAAI,KAAK,aAAa,EAAE,OAAOA,CAAG,CAC3C,CAEO,MAAMb,EAAiBc,GACrB,yJAAyJ,KAC9JA,CACF,EAGWV,EAAqBK,IAE/B,CACC,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,QAAS,QACT,KAAM,QACN,GAAI,QACJ,GAAI,Q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EACzEO,EAAYJ,EACdrB,EAAY,CACV,OAAQoB,EACR,aAAAL,EACA,OAAAP,EACA,sBAAAQ,EACA,sBAAAC,EACA,oBAAAC,CACF,CAAC,EACD,OAEJ,MAAO,CAAE,MAAAM,EAAO,UAAAC,EAAW,SAAAF,CAAS,CACtC",
6
- "names": ["utils_exports", "__export", "emailValidate", "formatPrice", "formatVariantPrice", "getAlpcPath", "languageTerritory", "numberFormat", "__toCommonJS", "import_js_cookie", "import_const", "locale", "isEU", "alpcEUCookie", "Cookies", "num", "email", "amount", "currencyCode", "maximumFractionDigits", "minimumFractionDigits", "removeTrailingZeros", "formattedValue", "baseAmount", "hasDiscount", "formatDiscount", "discount", "price", "basePrice"]
4
+ "sourcesContent": ["import Cookies from 'js-cookie'\nimport { PRICE_SYMBOL } from './const'\n\nexport function getAlpcPath(locale = '') {\n let isEU = false\n const alpcEUCookie = Cookies.get('alpcEU')\n if (alpcEUCookie === undefined || alpcEUCookie === '') {\n if (['de', 'eu-de', 'eu', 'eu-en', 'uk', 'fr', 'fra'].includes(locale)) {\n isEU = true\n }\n } else {\n let alpcEU = Number(alpcEUCookie)\n if (alpcEU) {\n isEU = true\n }\n }\n\n if (isEU) {\n return '/api/multipass/alpc-eu'\n }\n\n return '/api/multipass/alpc'\n}\n\nexport function numberFormat(num: number = 0) {\n if (typeof Intl === 'undefined') {\n return num\n }\n\n return new Intl.NumberFormat().format(num)\n}\n\nexport const emailValidate = (email: any) => {\n return /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/.test(\n email\n )\n}\n\nexport const languageTerritory = (locale: string) =>\n // https://unicode-org.github.io/cldr-staging/charts/37/supplemental/language_territory_information.html\n ({\n us: 'en-us',\n uk: 'en-gb',\n ca: 'en-ca',\n au: 'en-au',\n nz: 'en-nz',\n eu: 'en-eu',\n pl: 'pl-pl',\n fr: 'fr-fr',\n de: 'de-de',\n vn: 'vi-vn',\n sg: 'en-sg',\n 'ae-en': 'en-ae',\n plus: 'en-us',\n cl: 'es-cl',\n es: 'es-es',\n // Nordic countries\n se: 'en-se',\n dk: 'en-dk',\n is: 'en-is',\n no: 'en-no',\n fi: 'en-fi',\n })[locale] || ''\n\nexport function formatPrice({\n amount,\n currencyCode,\n locale,\n maximumFractionDigits,\n minimumFractionDigits,\n removeTrailingZeros = false,\n}: {\n amount: number\n currencyCode: string\n locale: string\n maximumFractionDigits?: number\n minimumFractionDigits?: number\n removeTrailingZeros?: boolean\n}) {\n const formatCurrency = new Intl.NumberFormat(languageTerritory(locale) || locale, {\n style: 'currency',\n currency: currencyCode || 'USD',\n minimumFractionDigits: maximumFractionDigits === 0 ? 0 : minimumFractionDigits,\n maximumFractionDigits,\n })\n\n let formattedValue = formatCurrency.format(amount)\n\n if (['eu-de', 'eu-en', 'de', 'eu'].includes(locale)) {\n formattedValue = formattedValue?.toString()?.replace(/[\\s]/g, '')\n }\n\n if (removeTrailingZeros) {\n // Adjust the regex to match comma as decimal separator\n formattedValue = formattedValue\n .replace(/(\\.\\d*?[1-9])0+\\b/, '$1')\n .replace(/\\.0+\\b/, '')\n .replace(/(\\,\\d*?[1-9])0+\\b/, '$1')\n .replace(/\\,0+\\b/, '')\n }\n\n return formattedValue\n}\n\nexport function formatVariantPrice({\n amount,\n baseAmount,\n currencyCode,\n locale,\n maximumFractionDigits,\n minimumFractionDigits,\n removeTrailingZeros,\n}: {\n baseAmount: number\n amount: number\n currencyCode: string\n locale: string\n maximumFractionDigits?: number\n minimumFractionDigits?: number\n removeTrailingZeros?: boolean\n}) {\n if (typeof Intl === 'undefined') {\n return {\n price: `${PRICE_SYMBOL[locale as keyof typeof PRICE_SYMBOL]}${amount}`,\n basePrice: `${PRICE_SYMBOL[locale as keyof typeof PRICE_SYMBOL]}${baseAmount}`,\n discount: `${PRICE_SYMBOL[locale as keyof typeof PRICE_SYMBOL]}${baseAmount - amount || 0}`,\n }\n }\n\n const hasDiscount = baseAmount > amount\n const formatDiscount = new Intl.NumberFormat(languageTerritory(locale), {\n style: 'percent',\n })\n const discount = hasDiscount ? formatDiscount.format((baseAmount - amount) / baseAmount) : null\n\n const price = formatPrice({ amount, currencyCode, locale, removeTrailingZeros })\n const basePrice = hasDiscount\n ? formatPrice({\n amount: baseAmount,\n currencyCode,\n locale,\n maximumFractionDigits,\n minimumFractionDigits,\n removeTrailingZeros,\n })\n : undefined\n\n return { price, basePrice, discount }\n}\n\n/**\n * \u63D0\u53D6 variant id\uFF0C\u53BB\u6389 gid://shopify/ProductVariant/ \u524D\u7F00\n */\nexport function extractVariantId(id: string | number | undefined): string | null {\n if (!id) return null\n const idStr = typeof id === 'number' ? id.toString() : id\n return idStr.replace('gid://shopify/ProductVariant/', '')\n}\n"],
5
+ "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,EAAA,qBAAAC,EAAA,gBAAAC,EAAA,uBAAAC,EAAA,gBAAAC,EAAA,sBAAAC,EAAA,iBAAAC,IAAA,eAAAC,EAAAT,GAAA,IAAAU,EAAoB,wBACpBC,EAA6B,mBAEtB,SAASL,EAAYM,EAAS,GAAI,CACvC,IAAIC,EAAO,GACX,MAAMC,EAAe,EAAAC,QAAQ,IAAI,QAAQ,EAYzC,OAXID,IAAiB,QAAaA,IAAiB,GAC7C,CAAC,KAAM,QAAS,KAAM,QAAS,KAAM,KAAM,KAAK,EAAE,SAASF,CAAM,IACnEC,EAAO,IAGI,OAAOC,CAAY,IAE9BD,EAAO,IAIPA,EACK,yBAGF,qBACT,CAEO,SAASL,EAAaQ,EAAc,EAAG,CAC5C,OAAI,OAAO,KAAS,IACXA,EAGF,IAAI,KAAK,aAAa,EAAE,OAAOA,CAAG,CAC3C,CAEO,MAAMd,EAAiBe,GACrB,yJAAyJ,KAC9JA,CAC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,aAAanB,EAAkBK,CAAM,EAAG,CACtE,MAAO,SACT,CAAC,EACKe,EAAWF,EAAcC,EAAe,QAAQF,EAAaN,GAAUM,CAAU,EAAI,KAErFI,EAAQxB,EAAY,CAAE,OAAAc,EAAQ,aAAAC,EAAc,OAAAP,EAAQ,oBAAAU,CAAoB,CAAC,EACzEO,EAAYJ,EACdrB,EAAY,CACV,OAAQoB,EACR,aAAAL,EACA,OAAAP,EACA,sBAAAQ,EACA,sBAAAC,EACA,oBAAAC,CACF,CAAC,EACD,OAEJ,MAAO,CAAE,MAAAM,EAAO,UAAAC,EAAW,SAAAF,CAAS,CACtC,CAKO,SAASxB,EAAiB2B,EAAgD,CAC/E,OAAKA,GACS,OAAOA,GAAO,SAAWA,EAAG,SAAS,EAAIA,GAC1C,QAAQ,gCAAiC,EAAE,EAFxC,IAGlB",
6
+ "names": ["utils_exports", "__export", "emailValidate", "extractVariantId", "formatPrice", "formatVariantPrice", "getAlpcPath", "languageTerritory", "numberFormat", "__toCommonJS", "import_js_cookie", "import_const", "locale", "isEU", "alpcEUCookie", "Cookies", "num", "email", "amount", "currencyCode", "maximumFractionDigits", "minimumFractionDigits", "removeTrailingZeros", "formattedValue", "baseAmount", "hasDiscount", "formatDiscount", "discount", "price", "basePrice", "id"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var F=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var J=(t,n)=>{for(var r in n)F(t,r,{get:n[r],enumerable:!0})},K=(t,n,r,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of V(n))!G.call(t,a)&&a!==r&&F(t,a,{get:()=>n[a],enumerable:!(l=q(n,a))||l.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"),A=require("framer-motion"),o=require("react"),f=require("./type"),M=require("../creditsWaysToGetCredits/useActions"),R=require("../context/provider"),d=require("@anker-in/lib"),L=require("../../registration"),T=require("../modal/creditsUploadReceiptModal"),U=require("../modal/subscribeModal");const W=({copy:t,classNames:n,id:r})=>{const[l,a]=(0,o.useState)(!1),{profile:O}=(0,R.useCreditsContext)(),{authCodeActivate:B}=(0,L.useRegistration)(),{brand:D}=(0,d.useHeadlessContext)(),g=d.ROUNDED_BRANDS.includes(D),h=!!O,[P,N]=(0,o.useState)(!1),[_,v]=(0,o.useState)(!1),[w,E]=(0,o.useState)(!1),[S,H]=(0,o.useState)(!1),{actions:k}=(0,M.useActions)({copy:t,subscribe:{openSubscribePopup:()=>v(!0),isSuccess:w},uploadReceipt:{openUploadReceiptPopup:()=>N(!0),isSuccess:S}}),I=(0,o.useMemo)(()=>{const s=t.list.map(c=>{if(!k[c.id])return;const{finished:m,notLogin:y,notFinished:C,completed:j}=k[c.id];let x="",u,z;return h?m?(x=j.buttonLabel,u=void 0):(x=C.buttonLabel,u=C.handleClick,z=C.link):(x=y.buttonLabel,u=y.handleClick),{...c,buttonLabel:x,handleClick:u,finished:m,link:z}}).filter(Boolean);return h?s.sort((c,m)=>c?.finished&&!m?.finished?1:!c?.finished&&m?.finished?-1:0):s},[k,t.list,h]),p=I.length>3;return(0,e.jsxs)(i.Container,{id:r,className:"[&>div]:l:!px-0 bg-[#F5F5F7]",children:[(0,e.jsx)(i.Heading,{as:"h2",size:"4",html:t.title,className:"md:px-[16px]"}),(0,e.jsxs)("div",{className:(0,d.classNames)("mt-[24px] p-[32px] md-l:p-[32px] md:p-[16px] relative overflow-hidden",g?"rounded-[8px]":"",!g&&"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 h-[560px] md: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]",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:"w-full max-w-[50%] md:max-w-full md:mt-[24px] l:max-w-full l:mt-[24px]",source:t.mainImage.url})]}),(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsxs)(A.motion.div,{className:(0,d.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(r||"ankersolix-task");s&&s.scrollIntoView({behavior:"smooth",block:"end"})}},children:[I.map(s=>(0,e.jsxs)("div",{className:(0,d.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] md:p-[16px] l:p-[24px]",""),children:[(0,e.jsxs)("div",{children:[(0,e.jsx)(i.Heading,{as:"h4",html:s.title,size:2,className:"text-[24px] font-bold text-[#080a0f] tracking-[-0.96px] leading-[1.2] text-pretty md:text-[18px] l:text-[20px]"}),(0,e.jsxs)("div",{className:"mt-[8px] flex items-center gap-[4px]",children:[(0,e.jsx)(i.Picture,{className:"size-[24px] [&_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:"text-[18px] font-bold text-[#080a0f] tracking-[-0.36px] leading-[1.4] md:text-[16px]"})]})]}),s.handleClick&&!(s.id===f.TaskType.UploadReceipt&&S)&&!(s.id===f.TaskType.Activate&&B.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:()=>{a(!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:()=>a(!l),children:(0,e.jsx)(b.ChevronDownIcon,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})})})})})]})]}),t.receipt&&(0,e.jsx)(T.CreditsUploadReceiptModal,{isOpen:P,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, ROUNDED_BRANDS } from '@anker-in/lib'\nimport { useRegistration } from '../../registration'\nimport { CreditsUploadReceiptModal } from '../modal/creditsUploadReceiptModal'\nimport { CreditsSubscribeModal } from '../modal/subscribeModal'\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=\"[&>div]:l:!px-0 bg-[#F5F5F7]\">\n <Heading as=\"h2\" size=\"4\" html={copy.title} className='md:px-[16px]'/>\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 h-[560px] md: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]\">\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 className=\"w-full max-w-[50%] md:max-w-full md:mt-[24px] l:max-w-full l:mt-[24px]\" source={copy.mainImage.url} />\n )}\n </div>\n\n {/* \u5361\u7247\u5217\u8868 */}\n <div className=\"relative\">\n <motion.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'\n )}\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] md:p-[16px] l:p-[24px]',\n rounded ? '' : ''\n )}\n >\n <div>\n <Heading\n as=\"h4\"\n html={item.title}\n size={2}\n className=\"text-[24px] font-bold text-[#080a0f] tracking-[-0.96px] leading-[1.2] text-pretty md:text-[18px] l:text-[20px]\"\n />\n <div className=\"mt-[8px] flex items-center gap-[4px]\">\n <Picture\n className=\"size-[24px] [&_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=\"text-[18px] font-bold text-[#080a0f] tracking-[-0.36px] leading-[1.4] md:text-[16px]\"\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={isSubscribeMod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CACbC,EAAY,EAAK,CACnB,EAEA,mBAAC,iBAAc,UAAU,kDAAkD,EAC7E,KAEA,mBACE,mBAAC,OAAI,UAAU,6EACb,mBAAC,UAAO,UAAU,QAAQ,QAAS,IAAMA,EAAY,CAACD,CAAQ,EAC5D,mBAAC,mBAAgB,UAAU,kDAAkD,EAC/E,EACF,EACF,EAEJ,GAEJ,GACF,EACCH,EAAK,YACJ,OAAC,6BACC,OAAQU,EACR,QAAS,IAAM,CACbC,EAA4B,EAAK,CACnC,EACA,KAAMX,EAAK,QACX,UAAW,IAAM,CACfiB,EAA0B,EAAI,CAChC,EACF,EAEDjB,EAAK,cACJ,OAAC,yBACC,KAAMA,EAAK,UACX,UAAW,IAAM,CACfe,EAAsB,EAAI,EAC1B,WAAW,IAAM,CACfF,EAAwB,EAAK,CAC/B,EAAG,GAAI,CACT,EACA,OAAQD,EACR,QAAS,IAAM,CACbC,EAAwB,EAAK,CAC/B,EACF,GAEJ,CAEJ",
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", "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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,IAAA,eAAAC,EAAAH,GA6GM,IAAAI,EAAA,6BA7GNC,EAA0D,iCAC1DC,EAA+C,uCAC/CC,EAAqD,iBAErDC,EAA0D,kBAC1DC,EAA2B,iDAC3BC,EAAkC,+BAClCC,EAAqD,yBACrDC,EAAgC,8BAChCC,EAA0C,8CAC1CC,EAAsC,mCACtCC,EAA+B,8BAExB,MAAMb,EAAwB,CAAC,CAAE,KAAAc,EAAM,WAAAC,EAAY,GAAAC,CAAG,IAAoD,CAC/G,KAAM,CAACC,EAAUC,CAAW,KAAI,YAAS,EAAK,EACxC,CAAE,QAAAC,CAAQ,KAAI,qBAAkB,EAChC,CAAE,iBAAAC,CAAiB,KAAI,mBAAgB,EACvC,CAAE,MAAAC,CAAM,KAAI,sBAAmB,EAC/BC,EAAU,iBAAe,SAASD,CAAK,EACvCE,EAAU,CAAC,CAACJ,EAEZ,CAACK,EAA0BC,CAA2B,KAAI,YAAS,EAAK,EACxE,CAACC,EAAsBC,CAAuB,KAAI,YAAS,EAAK,EAChE,CAACC,EAAoBC,CAAqB,KAAI,YAAS,EAAK,EAC5D,CAACC,EAAwBC,CAAyB,KAAI,YAAS,EAAK,EAEpE,CAAE,QAAAC,CAAQ,KAAI,cAAW,CAC7B,KAAAlB,EACA,UAAW,CACT,mBAAoB,IAAMa,EAAwB,EAAI,EACtD,UAAWC,CACb,EACA,cAAe,CACb,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AAQ,UACR,KAAK,KACL,UAAU,kBAET,SAAAA,EAAK,YACR,KAEA,OAAC,UAAO,QAAQ,UAAU,KAAK,KAAK,UAAU,kBAAkB,SAAQ,GACrE,SAAAA,EAAK,YACR,IA5CGA,EAAK,EA8CZ,CACD,EACA,CAACpB,GAAYgB,MACZ,OAAC,OACC,UAAU,qDACV,MAAO,CAAE,WAAY,sEAAuE,EAC7F,GAEL,EACCA,MACC,mBACG,SAAAhB,KACC,OAAC,UACC,UAAU,8CACV,QAAS,IAAM,CACbC,EAAY,EAAK,CACnB,EAEA,mBAAC,iBAAc,UAAU,kDAAkD,EAC7E,KAEA,mBACE,mBAAC,OAAI,UAAU,6EACb,mBAAC,UAAO,UAAU,QAAQ,QAAS,IAAMA,EAAY,CAACD,CAAQ,EAC5D,mBAAC,mBAAgB,UAAU,kDAAkD,EAC/E,EACF,EACF,EAEJ,GAEJ,GACF,EACCH,EAAK,YACJ,OAAC,6BACC,OAAQU,EACR,QAAS,IAAM,CACbC,EAA4B,EAAK,CACnC,EACA,KAAMX,EAAK,QACX,UAAW,IAAM,CACfiB,EAA0B,EAAI,CAChC,EACF,EAEDjB,EAAK,cACJ,OAAC,yBACC,KAAMA,EAAK,UACX,UAAW,IAAM,CACfe,EAAsB,EAAI,EAC1B,WAAW,IAAM,CACfF,EAAwB,EAAK,CAC/B,EAAG,GAAI,CACT,EACA,OAAQD,EACR,QAAS,IAAM,CACbC,EAAwB,EAAK,CAC/B,EACF,GAEJ,CAEJ",
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;