@anker-in/campaign-ui 0.5.2 → 0.5.3-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/cjs/components/credits/context/const.js +1 -1
  2. package/dist/cjs/components/credits/context/const.js.map +2 -2
  3. package/dist/cjs/components/credits/context/utils.d.ts +1 -1
  4. package/dist/cjs/components/credits/context/utils.js +1 -1
  5. package/dist/cjs/components/credits/context/utils.js.map +3 -3
  6. package/dist/cjs/components/credits/creditsCash/RedeemableItem.js +1 -1
  7. package/dist/cjs/components/credits/creditsCash/RedeemableItem.js.map +2 -2
  8. package/dist/cjs/components/credits/creditsInfoCard/index.js +1 -1
  9. package/dist/cjs/components/credits/creditsInfoCard/index.js.map +3 -3
  10. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
  11. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
  12. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js +1 -1
  13. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js.map +3 -3
  14. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js +1 -1
  15. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +3 -3
  16. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js +1 -1
  17. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js.map +3 -3
  18. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  19. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
  20. package/dist/cjs/components/credits/modal/ModalContainer.js +1 -1
  21. package/dist/cjs/components/credits/modal/ModalContainer.js.map +2 -2
  22. package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfileModal.d.ts +10 -0
  23. package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js +2 -0
  24. package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js.map +7 -0
  25. package/dist/esm/components/credits/context/const.js +1 -1
  26. package/dist/esm/components/credits/context/const.js.map +2 -2
  27. package/dist/esm/components/credits/context/utils.d.ts +1 -1
  28. package/dist/esm/components/credits/context/utils.js +1 -1
  29. package/dist/esm/components/credits/context/utils.js.map +3 -3
  30. package/dist/esm/components/credits/creditsCash/RedeemableItem.js +1 -1
  31. package/dist/esm/components/credits/creditsCash/RedeemableItem.js.map +2 -2
  32. package/dist/esm/components/credits/creditsInfoCard/index.js +1 -1
  33. package/dist/esm/components/credits/creditsInfoCard/index.js.map +3 -3
  34. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
  35. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
  36. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js +1 -1
  37. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js.map +3 -3
  38. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js +1 -1
  39. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +3 -3
  40. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js +1 -1
  41. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js.map +3 -3
  42. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  43. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
  44. package/dist/esm/components/credits/modal/ModalContainer.js +1 -1
  45. package/dist/esm/components/credits/modal/ModalContainer.js.map +2 -2
  46. package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfileModal.d.ts +10 -0
  47. package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js +2 -0
  48. package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js.map +7 -0
  49. package/package.json +1 -1
  50. package/src/components/credits/context/const.ts +3 -0
  51. package/src/components/credits/context/utils.ts +15 -2
  52. package/src/components/credits/creditsCash/RedeemableItem.tsx +1 -1
  53. package/src/components/credits/creditsInfoCard/index.tsx +3 -3
  54. package/src/components/credits/creditsRedeemList/CreditsRedeemList.tsx +2 -2
  55. package/src/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.tsx +3 -1
  56. package/src/components/credits/creditsRedeemList/RedeemProductModal/Init.tsx +3 -1
  57. package/src/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.tsx +3 -1
  58. package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +1 -1
  59. package/src/components/credits/modal/ModalContainer.tsx +1 -1
  60. package/dist/cjs/stories/CartCard.stories.d.ts +0 -33
  61. package/dist/cjs/stories/CartCard.stories.js +0 -21
  62. package/dist/cjs/stories/CartCard.stories.js.map +0 -7
  63. package/dist/esm/stories/CartCard.stories.d.ts +0 -33
  64. package/dist/esm/stories/CartCard.stories.js +0 -21
  65. package/dist/esm/stories/CartCard.stories.js.map +0 -7
@@ -1,2 +1,2 @@
1
- "use strict";var P=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var z=(x,f)=>{for(var c in f)P(x,c,{get:f[c],enumerable:!0})},d=(x,f,c,t)=>{if(f&&typeof f=="object"||typeof f=="function")for(let i of I(f))!j.call(x,i)&&i!==c&&P(x,i,{get:()=>f[i],enumerable:!(t=B(f,i))||t.enumerable});return x};var q=x=>d(P({},"__esModule",{value:!0}),x);var H={};z(H,{ALPC_COUNTRY_MAP:()=>v,AlpcConsumeType:()=>L,AlpcErrorCode:()=>$,ApprovalStatus:()=>O,ConsumeType:()=>G,CouponType:()=>N,CreditType:()=>h,DTC_TASK_TYPE:()=>m,PRICE_SYMBOL:()=>D,RewardType:()=>M,TaskSubType:()=>F,TaskType:()=>U});module.exports=q(H);var h=(i=>(i[i.All=0]="All",i[i.Earned=1]="Earned",i[i.Deducted=2]="Deducted",i[i.Expired=3]="Expired",i))(h||{}),G=(u=>(u.Coupon="coupon",u.GiftCard="giftCard",u.GoGift="goGift",u.Product="product",u.ShippingCoupon="shippingCoupon",u))(G||{}),L=(t=>(t[t.Coupon=1]="Coupon",t[t.Product=2]="Product",t[t.ExternalProduct=5]="ExternalProduct",t))(L||{}),U=(t=>(t[t.Program=1]="Program",t[t.Operation=2]="Operation",t[t.Redeem=3]="Redeem",t))(U||{}),m=(t=>(t.FirstPurchase="firstPurchase",t.UploadReceipt="uploadReceipt",t.Shopping="shopping",t))(m||{}),F=(o=>(o[o.Activation=1]="Activation",o[o.UpdateName=2]="UpdateName",o[o.UpdatePhone=3]="UpdatePhone",o[o.UpdateBirthday=4]="UpdateBirthday",o[o.Subscription=5]="Subscription",o[o.UpadteAppName=7]="UpadteAppName",o[o.Refund=3e3]="Refund",o[o.ProductUnApproved=5e3]="ProductUnApproved",o))(F||{}),N=(c=>(c.FixedMount="fixed_amount",c.Percent="percent",c))(N||{}),M=(n=>(n[n.Received=0]="Received",n[n.Pending=1]="Pending",n[n.ApproveSuccess=2]="ApproveSuccess",n[n.ApproveFail=3]="ApproveFail",n[n.Unfulfilled=4]="Unfulfilled",n[n.Fulfilled=5]="Fulfilled",n[n.Failed=6]="Failed",n[n.GogiftPending=7]="GogiftPending",n[n.GogiftApproved=8]="GogiftApproved",n[n.GogiftSecondConfirm=9]="GogiftSecondConfirm",n[n.GogiftRejected=10]="GogiftRejected",n[n.GogiftCallbackPending=11]="GogiftCallbackPending",n[n.GogiftCallbackSuccess=12]="GogiftCallbackSuccess",n[n.GogiftCallbackTimeout=13]="GogiftCallbackTimeout",n))(M||{}),$=(g=>(g[g.CodeLpcRedeemFailed=180001]="CodeLpcRedeemFailed",g[g.CodeLpcUserNotFound=180002]="CodeLpcUserNotFound",g[g.CodeLpcCreditRuleNotFound=180003]="CodeLpcCreditRuleNotFound",g[g.CodeLpcUnknownError=180004]="CodeLpcUnknownError",g[g.CodeLpcNotEnoughCredits=180005]="CodeLpcNotEnoughCredits",g[g.CodeLpcUserMigrate=180006]="CodeLpcUserMigrate",g[g.CodeLpcRuleInventoryNotEnough=180007]="CodeLpcRuleInventoryNotEnough",g[g.CodeLpcShopifyCouponRuleRedeemLimit=180009]="CodeLpcShopifyCouponRuleRedeemLimit",g[g.CodeCrossSiteError=180011]="CodeCrossSiteError",g))($||{});const v=new Map([["eu-en","eu"],["eu-de","de"],["eu-fr","fr"]]);var O=(i=>(i[i.Pending=0]="Pending",i[i.Success=1]="Success",i[i.Failed=2]="Failed",i[i.DoubleConfirm=3]="DoubleConfirm",i))(O||{});const D={us:"$",uk:"\xA3",ca:"$",eu:"\u20AC",pl:"z\u0142",fr:"\u20AC",de:"\u20AC",vn:"\u20AB",cl:"$",sg:"$",ae:"AED",es:"\u20AC"};
1
+ "use strict";var P=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var z=(x,f)=>{for(var c in f)P(x,c,{get:f[c],enumerable:!0})},d=(x,f,c,t)=>{if(f&&typeof f=="object"||typeof f=="function")for(let i of I(f))!j.call(x,i)&&i!==c&&P(x,i,{get:()=>f[i],enumerable:!(t=B(f,i))||t.enumerable});return x};var q=x=>d(P({},"__esModule",{value:!0}),x);var H={};z(H,{ALPC_COUNTRY_MAP:()=>v,AlpcConsumeType:()=>L,AlpcErrorCode:()=>$,ApprovalStatus:()=>O,ConsumeType:()=>G,CouponType:()=>N,CreditType:()=>h,DTC_TASK_TYPE:()=>m,PRICE_SYMBOL:()=>D,RewardType:()=>M,TaskSubType:()=>F,TaskType:()=>U});module.exports=q(H);var h=(i=>(i[i.All=0]="All",i[i.Earned=1]="Earned",i[i.Deducted=2]="Deducted",i[i.Expired=3]="Expired",i))(h||{}),G=(u=>(u.Coupon="coupon",u.GiftCard="giftCard",u.GoGift="goGift",u.Product="product",u.ShippingCoupon="shippingCoupon",u))(G||{}),L=(t=>(t[t.Coupon=1]="Coupon",t[t.Product=2]="Product",t[t.ExternalProduct=5]="ExternalProduct",t))(L||{}),U=(t=>(t[t.Program=1]="Program",t[t.Operation=2]="Operation",t[t.Redeem=3]="Redeem",t))(U||{}),m=(t=>(t.FirstPurchase="firstPurchase",t.UploadReceipt="uploadReceipt",t.Shopping="shopping",t))(m||{}),F=(o=>(o[o.Activation=1]="Activation",o[o.UpdateName=2]="UpdateName",o[o.UpdatePhone=3]="UpdatePhone",o[o.UpdateBirthday=4]="UpdateBirthday",o[o.Subscription=5]="Subscription",o[o.UpadteAppName=7]="UpadteAppName",o[o.Refund=3e3]="Refund",o[o.ProductUnApproved=5e3]="ProductUnApproved",o))(F||{}),N=(c=>(c.FixedMount="fixed_amount",c.Percent="percent",c))(N||{}),M=(n=>(n[n.Received=0]="Received",n[n.Pending=1]="Pending",n[n.ApproveSuccess=2]="ApproveSuccess",n[n.ApproveFail=3]="ApproveFail",n[n.Unfulfilled=4]="Unfulfilled",n[n.Fulfilled=5]="Fulfilled",n[n.Failed=6]="Failed",n[n.GogiftPending=7]="GogiftPending",n[n.GogiftApproved=8]="GogiftApproved",n[n.GogiftSecondConfirm=9]="GogiftSecondConfirm",n[n.GogiftRejected=10]="GogiftRejected",n[n.GogiftCallbackPending=11]="GogiftCallbackPending",n[n.GogiftCallbackSuccess=12]="GogiftCallbackSuccess",n[n.GogiftCallbackTimeout=13]="GogiftCallbackTimeout",n))(M||{}),$=(g=>(g[g.CodeLpcRedeemFailed=180001]="CodeLpcRedeemFailed",g[g.CodeLpcUserNotFound=180002]="CodeLpcUserNotFound",g[g.CodeLpcCreditRuleNotFound=180003]="CodeLpcCreditRuleNotFound",g[g.CodeLpcUnknownError=180004]="CodeLpcUnknownError",g[g.CodeLpcNotEnoughCredits=180005]="CodeLpcNotEnoughCredits",g[g.CodeLpcUserMigrate=180006]="CodeLpcUserMigrate",g[g.CodeLpcRuleInventoryNotEnough=180007]="CodeLpcRuleInventoryNotEnough",g[g.CodeLpcShopifyCouponRuleRedeemLimit=180009]="CodeLpcShopifyCouponRuleRedeemLimit",g[g.CodeCrossSiteError=180011]="CodeCrossSiteError",g))($||{});const v=new Map([["eu-en","eu"],["eu-de","de"],["eu-fr","fr"],["eu-es","es"],["eu-it","it"],["sg-en","sg"]]);var O=(i=>(i[i.Pending=0]="Pending",i[i.Success=1]="Success",i[i.Failed=2]="Failed",i[i.DoubleConfirm=3]="DoubleConfirm",i))(O||{});const D={us:"$",uk:"\xA3",ca:"$",eu:"\u20AC",pl:"z\u0142",fr:"\u20AC",de:"\u20AC",vn:"\u20AB",cl:"$",sg:"$",ae:"AED",es:"\u20AC"};
2
2
  //# sourceMappingURL=const.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/context/const.ts"],
4
- "sourcesContent": ["export enum CreditType {\n All = 0,\n Earned = 1,\n Deducted = 2,\n Expired = 3,\n}\n\nexport enum ConsumeType {\n Coupon = 'coupon',\n GiftCard = 'giftCard',\n GoGift = 'goGift',\n Product = 'product',\n ShippingCoupon = 'shippingCoupon',\n}\n\nexport enum AlpcConsumeType {\n Coupon = 1,\n Product = 2,\n ExternalProduct = 5,\n}\n\nexport enum TaskType {\n Program = 1,\n Operation = 2,\n Redeem = 3,\n}\n\nexport enum DTC_TASK_TYPE {\n FirstPurchase = 'firstPurchase',\n UploadReceipt = 'uploadReceipt',\n Shopping = 'shopping',\n}\n\nexport enum TaskSubType {\n Activation = 1, // \u6FC0\u6D3B\u4E8B\u4EF6\n UpdateName = 2, // \u5B8C\u5584\u59D3\u540D\n UpdatePhone = 3, // \u66F4\u65B0\u624B\u673A\u53F7\n UpdateBirthday = 4, // \u66F4\u65B0\u751F\u65E5\n Subscription = 5, // \u8BA2\u9605\n UpadteAppName = 7, // \u5B8C\u5584APP\u59D3\u540D\n Refund = 3000, // \u8D2D\u7269\u9001\u79EF\u5206\u4EFB\u52A1\u9000\u6B3E\n ProductUnApproved = 5000, // \u5151\u6362\u5546\u54C1\u5BA1\u6838\u4E0D\u901A\u8FC7\n}\n\nexport enum CouponType {\n FixedMount = 'fixed_amount',\n Percent = 'percent',\n}\n\nexport enum RewardType {\n Received = 0,\n Pending = 1,\n ApproveSuccess = 2,\n ApproveFail = 3,\n Unfulfilled = 4,\n Fulfilled = 5,\n Failed = 6,\n GogiftPending = 7,\n GogiftApproved = 8,\n GogiftSecondConfirm = 9,\n GogiftRejected = 10,\n GogiftCallbackPending = 11,\n GogiftCallbackSuccess = 12,\n GogiftCallbackTimeout = 13,\n}\n\nexport enum AlpcErrorCode {\n CodeLpcRedeemFailed = 180001,\n //user not found\n CodeLpcUserNotFound = 180002,\n //credit rule not found\n CodeLpcCreditRuleNotFound = 180003,\n //unknown error\n CodeLpcUnknownError = 180004,\n // not enough credits\n CodeLpcNotEnoughCredits = 180005,\n // user migrate\n CodeLpcUserMigrate = 180006,\n // \u5E93\u5B58\u4E0D\u8DB3\n CodeLpcRuleInventoryNotEnough = 180007,\n // \u5151\u6362\u6B21\u6570\u9650\u5236\n CodeLpcShopifyCouponRuleRedeemLimit = 180009,\n // \u8DE8\u533A\u5151\u6362\u9519\u8BEF\uFF08\u975E\u6B27\u5151\u6362\u6B27\u6D32\u7684\uFF09\n CodeCrossSiteError = 180011,\n}\n\nexport const ALPC_COUNTRY_MAP = new Map<string, string>([\n ['eu-en', 'eu'],\n ['eu-de', 'de'],\n ['eu-fr', 'fr'],\n])\n\nexport enum ApprovalStatus {\n Pending = 0,\n Success = 1,\n Failed = 2,\n DoubleConfirm = 3,\n}\n\nexport const PRICE_SYMBOL = {\n us: '$',\n uk: '\u00A3',\n ca: '$',\n eu: '\u20AC',\n pl: 'z\u0142',\n fr: '\u20AC',\n de: '\u20AC',\n vn: '\u20AB',\n cl: '$',\n sg: '$',\n ae: 'AED',\n es: '\u20AC',\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAA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AAsB,GAAtB,sBACAA,IAAA,eAAiB,IAAjB,iBACAA,IAAA,sBAAwB,IAAxB,wBACAA,IAAA,sBAAwB,IAAxB,wBACAA,IAAA,sBAAwB,IAAxB,wBAdUA,OAAA,IAiBAP,OACVA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,0BAA4B,QAA5B,4BAEAA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,wBAA0B,QAA1B,0BAEAA,IAAA,mBAAqB,QAArB,qBAEAA,IAAA,8BAAgC,QAAhC,gCAEAA,IAAA,oCAAsC,QAAtC,sCAEAA,IAAA,mBAAqB,QAArB,qBAjBUA,OAAA,IAoBL,MAAMF,EAAmB,IAAI,IAAoB,CACtD,CAAC,QAAS,IAAI,EACd,CAAC,QAAS,IAAI,EACd,CAAC,QAAS,IAAI,CAChB,CAAC,EAEM,IAAKG,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,QAAU,GAAV,UACAA,IAAA,OAAS,GAAT,SACAA,IAAA,cAAgB,GAAhB,gBAJUA,OAAA,IAOL,MAAMK,EAAe,CAC1B,GAAI,IACJ,GAAI,OACJ,GAAI,IACJ,GAAI,SACJ,GAAI,UACJ,GAAI,SACJ,GAAI,SACJ,GAAI,SACJ,GAAI,IACJ,GAAI,IACJ,GAAI,MACJ,GAAI,QACN",
4
+ "sourcesContent": ["export enum CreditType {\n All = 0,\n Earned = 1,\n Deducted = 2,\n Expired = 3,\n}\n\nexport enum ConsumeType {\n Coupon = 'coupon',\n GiftCard = 'giftCard',\n GoGift = 'goGift',\n Product = 'product',\n ShippingCoupon = 'shippingCoupon',\n}\n\nexport enum AlpcConsumeType {\n Coupon = 1,\n Product = 2,\n ExternalProduct = 5,\n}\n\nexport enum TaskType {\n Program = 1,\n Operation = 2,\n Redeem = 3,\n}\n\nexport enum DTC_TASK_TYPE {\n FirstPurchase = 'firstPurchase',\n UploadReceipt = 'uploadReceipt',\n Shopping = 'shopping',\n}\n\nexport enum TaskSubType {\n Activation = 1, // \u6FC0\u6D3B\u4E8B\u4EF6\n UpdateName = 2, // \u5B8C\u5584\u59D3\u540D\n UpdatePhone = 3, // \u66F4\u65B0\u624B\u673A\u53F7\n UpdateBirthday = 4, // \u66F4\u65B0\u751F\u65E5\n Subscription = 5, // \u8BA2\u9605\n UpadteAppName = 7, // \u5B8C\u5584APP\u59D3\u540D\n Refund = 3000, // \u8D2D\u7269\u9001\u79EF\u5206\u4EFB\u52A1\u9000\u6B3E\n ProductUnApproved = 5000, // \u5151\u6362\u5546\u54C1\u5BA1\u6838\u4E0D\u901A\u8FC7\n}\n\nexport enum CouponType {\n FixedMount = 'fixed_amount',\n Percent = 'percent',\n}\n\nexport enum RewardType {\n Received = 0,\n Pending = 1,\n ApproveSuccess = 2,\n ApproveFail = 3,\n Unfulfilled = 4,\n Fulfilled = 5,\n Failed = 6,\n GogiftPending = 7,\n GogiftApproved = 8,\n GogiftSecondConfirm = 9,\n GogiftRejected = 10,\n GogiftCallbackPending = 11,\n GogiftCallbackSuccess = 12,\n GogiftCallbackTimeout = 13,\n}\n\nexport enum AlpcErrorCode {\n CodeLpcRedeemFailed = 180001,\n //user not found\n CodeLpcUserNotFound = 180002,\n //credit rule not found\n CodeLpcCreditRuleNotFound = 180003,\n //unknown error\n CodeLpcUnknownError = 180004,\n // not enough credits\n CodeLpcNotEnoughCredits = 180005,\n // user migrate\n CodeLpcUserMigrate = 180006,\n // \u5E93\u5B58\u4E0D\u8DB3\n CodeLpcRuleInventoryNotEnough = 180007,\n // \u5151\u6362\u6B21\u6570\u9650\u5236\n CodeLpcShopifyCouponRuleRedeemLimit = 180009,\n // \u8DE8\u533A\u5151\u6362\u9519\u8BEF\uFF08\u975E\u6B27\u5151\u6362\u6B27\u6D32\u7684\uFF09\n CodeCrossSiteError = 180011,\n}\n\nexport const ALPC_COUNTRY_MAP = new Map<string, string>([\n ['eu-en', 'eu'],\n ['eu-de', 'de'],\n ['eu-fr', 'fr'],\n ['eu-es', 'es'],\n ['eu-it', 'it'],\n ['sg-en', 'sg'],\n])\n\nexport enum ApprovalStatus {\n Pending = 0,\n Success = 1,\n Failed = 2,\n DoubleConfirm = 3,\n}\n\nexport const PRICE_SYMBOL = {\n us: '$',\n uk: '\u00A3',\n ca: '$',\n eu: '\u20AC',\n pl: 'z\u0142',\n fr: '\u20AC',\n de: '\u20AC',\n vn: '\u20AB',\n cl: '$',\n sg: '$',\n ae: 'AED',\n es: '\u20AC',\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,EAAA,oBAAAC,EAAA,kBAAAC,EAAA,mBAAAC,EAAA,gBAAAC,EAAA,eAAAC,EAAA,eAAAC,EAAA,kBAAAC,EAAA,iBAAAC,EAAA,eAAAC,EAAA,gBAAAC,EAAA,aAAAC,IAAA,eAAAC,EAAAd,GAAO,IAAKQ,OACVA,IAAA,IAAM,GAAN,MACAA,IAAA,OAAS,GAAT,SACAA,IAAA,SAAW,GAAX,WACAA,IAAA,QAAU,GAAV,UAJUA,OAAA,IAOAF,OACVA,EAAA,OAAS,SACTA,EAAA,SAAW,WACXA,EAAA,OAAS,SACTA,EAAA,QAAU,UACVA,EAAA,eAAiB,iBALPA,OAAA,IAQAH,OACVA,IAAA,OAAS,GAAT,SACAA,IAAA,QAAU,GAAV,UACAA,IAAA,gBAAkB,GAAlB,kBAHUA,OAAA,IAMAU,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,UAAY,GAAZ,YACAA,IAAA,OAAS,GAAT,SAHUA,OAAA,IAMAJ,OACVA,EAAA,cAAgB,gBAChBA,EAAA,cAAgB,gBAChBA,EAAA,SAAW,WAHDA,OAAA,IAMAG,OACVA,IAAA,WAAa,GAAb,aACAA,IAAA,WAAa,GAAb,aACAA,IAAA,YAAc,GAAd,cACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,aAAe,GAAf,eACAA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,OAAS,KAA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,IACJ,GAAI,MACJ,GAAI,QACN",
6
6
  "names": ["const_exports", "__export", "ALPC_COUNTRY_MAP", "AlpcConsumeType", "AlpcErrorCode", "ApprovalStatus", "ConsumeType", "CouponType", "CreditType", "DTC_TASK_TYPE", "PRICE_SYMBOL", "RewardType", "TaskSubType", "TaskType", "__toCommonJS"]
7
7
  }
@@ -1,5 +1,5 @@
1
1
  export declare function getAlpcPath(locale?: string, apiBaseUrl?: string): string;
2
- export declare function numberFormat(num?: number): string | number;
2
+ export declare function numberFormat(num?: number, locale?: string): string | number;
3
3
  export declare const emailValidate: (email: any) => boolean;
4
4
  export declare const languageTerritory: (locale: string) => string;
5
5
  export declare function formatPrice({ amount, currencyCode, locale, maximumFractionDigits, minimumFractionDigits, removeTrailingZeros, }: {
@@ -1,2 +1,2 @@
1
- "use strict";var $=Object.create;var o=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var C=(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 P(n))!x.call(e,i)&&i!==r&&o(e,i,{get:()=>n[i],enumerable:!(t=I(n,i))||t.enumerable});return e};var E=(e,n,r)=>(r=e!=null?$(k(e)):{},p(n||!e||!e.__esModule?o(r,"default",{value:e,enumerable:!0}):r,e)),S=e=>p(o({},"__esModule",{value:!0}),e);var L={};C(L,{emailValidate:()=>V,extractVariantId:()=>z,formatPrice:()=>m,formatVariantPrice:()=>v,getAlpcPath:()=>F,languageTerritory:()=>f,numberFormat:()=>D});module.exports=S(L);var l=E(require("js-cookie")),s=require("./const");function F(e="",n){let r=!1;const t=l.default.get("alpcEU");return t===void 0||t===""?["de","eu-de","eu","eu-en","uk","fr","fra"].includes(e)&&(r=!0):Number(t)&&(r=!0),n?r?`${n}/api/multipass/alpc-eu`:`${n}/api/multipass/alpc`:r?"/api/multipass/alpc-eu":"/api/multipass/alpc"}function D(e=0){return typeof Intl>"u"?e:new Intl.NumberFormat().format(e)}const V=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 z(e){return e?(typeof e=="number"?e.toString():e).replace("gid://shopify/ProductVariant/",""):null}
1
+ "use strict";var $=Object.create;var f=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var x=(e,r)=>{for(var n in r)f(e,n,{get:r[n],enumerable:!0})},m=(e,r,n,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of P(r))!k.call(e,i)&&i!==n&&f(e,i,{get:()=>r[i],enumerable:!(t=I(r,i))||t.enumerable});return e};var C=(e,r,n)=>(n=e!=null?$(S(e)):{},m(r||!e||!e.__esModule?f(n,"default",{value:e,enumerable:!0}):n,e)),E=e=>m(f({},"__esModule",{value:!0}),e);var L={};x(L,{emailValidate:()=>V,extractVariantId:()=>z,formatPrice:()=>p,formatVariantPrice:()=>v,getAlpcPath:()=>F,languageTerritory:()=>a,numberFormat:()=>D});module.exports=E(L);var l=C(require("js-cookie")),s=require("./const");function F(e="",r){let n=!1;const t=l.default.get("alpcEU");return t===void 0||t===""?["de","eu-de","eu","eu-en","uk","fr","fra"].includes(e)&&(n=!0):Number(t)&&(n=!0),r?n?`${r}/api/multipass/alpc-eu`:`${r}/api/multipass/alpc`:n?"/api/multipass/alpc-eu":"/api/multipass/alpc"}function D(e=0,r){if(typeof Intl>"u")return e;const n=new Intl.NumberFormat(a(r||"")||r).format(e);return r&&["fr","eu-fr","fra"].includes(r)?n.replace(/[\u202f\u00a0]/g," "):n}const V=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),a=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","eu-fr":"fr-fr",fra:"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 p({amount:e,currencyCode:r,locale:n,maximumFractionDigits:t,minimumFractionDigits:i,removeTrailingZeros:o=!1}){let u=new Intl.NumberFormat(a(n)||n,{style:"currency",currency:r||"USD",minimumFractionDigits:t===0?0:i,maximumFractionDigits:t}).format(e);return["eu-de","eu-en","de","eu"].includes(n)&&(u=u?.toString()?.replace(/[\s]/g,"")),["fr","eu-fr","fra"].includes(n)&&(u=u?.toString()?.replace(/[\u202f\u00a0]/g," ")),o&&(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:r,currencyCode:n,locale:t,maximumFractionDigits:i,minimumFractionDigits:o,removeTrailingZeros:c}){if(typeof Intl>"u")return{price:`${s.PRICE_SYMBOL[t]}${e}`,basePrice:`${s.PRICE_SYMBOL[t]}${r}`,discount:`${s.PRICE_SYMBOL[t]}${r-e||0}`};const u=r>e,d=new Intl.NumberFormat(a(t),{style:"percent"}),g=u?d.format((r-e)/r):null,b=p({amount:e,currencyCode:n,locale:t,removeTrailingZeros:c}),y=u?p({amount:r,currencyCode:n,locale:t,maximumFractionDigits:i,minimumFractionDigits:o,removeTrailingZeros:c}):void 0;return{price:b,basePrice:y,discount:g}}function z(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 = '', apiBaseUrl?: string) {\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 // \u5982\u679C\u63D0\u4F9B\u4E86\u81EA\u5B9A\u4E49\u7684 apiBaseUrl\uFF0C\u62FC\u63A5\u5BF9\u5E94\u7684\u8DEF\u5F84\n if (apiBaseUrl) {\n return isEU ? `${apiBaseUrl}/api/multipass/alpc-eu` : `${apiBaseUrl}/api/multipass/alpc`\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,GAAIC,EAAqB,CAC5D,IAAIC,EAAO,GACX,MAAMC,EAAe,EAAAC,QAAQ,IAAI,QAAQ,EAazC,OAZID,IAAiB,QAAaA,IAAiB,GAC7C,CAAC,KAAM,QAAS,KAAM,QAAS,KAAM,KAAM,KAAK,EAAE,SAASH,CAAM,IACnEE,EAAO,IAGI,OAAOC,CAAY,IAE9BD,EAAO,IAKPD,EACKC,EAAO,GAAGD,CAAU,yBAA2B,GAAGA,CAAU,sBAGjEC,EACK,yBAGF,qBACT,CAEO,SAASN,EAAaS,EAAc,EAAG,CAC5C,OAAI,OAAO,KAAS,IACXA,EAGF,IAAI,KAAK,aAAa,EAAE,OAAOA,CAAG,CAC3C,CAEO,MAAMf,EAAiBgB,GACrB,yJAAyJ,KAC9JA,CACF,EAGWX,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,QAEJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,OACN,GAAGA,CAAM,GAAK,GAET,SAASR,EAAY,CAC1B,OAAAe,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ACD,OAEJ,MAAO,CAAE,MAAAM,EAAO,UAAAC,EAAW,SAAAF,CAAS,CACtC,CAKO,SAASzB,EAAiB4B,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", "apiBaseUrl", "isEU", "alpcEUCookie", "Cookies", "num", "email", "amount", "currencyCode", "maximumFractionDigits", "minimumFractionDigits", "removeTrailingZeros", "formattedValue", "baseAmount", "hasDiscount", "formatDiscount", "discount", "price", "basePrice", "id"]
4
+ "sourcesContent": ["import Cookies from 'js-cookie'\nimport { PRICE_SYMBOL } from './const'\n\nexport function getAlpcPath(locale = '', apiBaseUrl?: string) {\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 // \u5982\u679C\u63D0\u4F9B\u4E86\u81EA\u5B9A\u4E49\u7684 apiBaseUrl\uFF0C\u62FC\u63A5\u5BF9\u5E94\u7684\u8DEF\u5F84\n if (apiBaseUrl) {\n return isEU ? `${apiBaseUrl}/api/multipass/alpc-eu` : `${apiBaseUrl}/api/multipass/alpc`\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, locale?: string) {\n if (typeof Intl === 'undefined') {\n return num\n }\n\n const formatted = new Intl.NumberFormat(languageTerritory(locale || '') || locale).format(num)\n\n if (locale && ['fr', 'eu-fr', 'fra'].includes(locale)) {\n return formatted.replace(/[\\u202f\\u00a0]/g, ' ')\n }\n\n return formatted\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 'eu-fr': 'fr-fr',\n fra: '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 (['fr', 'eu-fr', 'fra'].includes(locale)) {\n // Intl \u8F93\u51FA\u7684\u5343\u4F4D\u5206\u9694\u7B26\u662F\u7A84\u4E0D\u6362\u884C\u7A7A\u683C(U+202F)/\u4E0D\u6362\u884C\u7A7A\u683C(U+00A0)\uFF0C\u7EDF\u4E00\u66FF\u6362\u4E3A\u666E\u901A\u7A7A\u683C\n formattedValue = formattedValue?.toString()?.replace(/[\\u202f\\u00a0]/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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,aAAAC,EAAc,OAAAT,EAAQ,oBAAAY,CAAoB,CAAC,EACzEO,EAAYJ,EACdvB,EAAY,CACV,OAAQsB,EACR,aAAAL,EACA,OAAAT,EACA,sBAAAU,EACA,sBAAAC,EACA,oBAAAC,CACF,CAAC,EACD,OAEJ,MAAO,CAAE,MAAAM,EAAO,UAAAC,EAAW,SAAAF,CAAS,CACtC,CAKO,SAAS1B,EAAiB6B,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", "apiBaseUrl", "isEU", "alpcEUCookie", "Cookies", "num", "formatted", "email", "amount", "currencyCode", "maximumFractionDigits", "minimumFractionDigits", "removeTrailingZeros", "formattedValue", "baseAmount", "hasDiscount", "formatDiscount", "discount", "price", "basePrice", "id"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var h=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var U=(r,e)=>{for(var d in e)h(r,d,{get:e[d],enumerable:!0})},O=(r,e,d,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of B(e))!P.call(r,n)&&n!==d&&h(r,n,{get:()=>e[n],enumerable:!(m=L(e,n))||m.enumerable});return r};var T=r=>O(h({},"__esModule",{value:!0}),r);var G={};U(G,{default:()=>M});module.exports=T(G);var t=require("react/jsx-runtime"),l=require("@anker-in/headless-ui"),i=require("react"),V=require("../context/provider"),w=require("../context/hooks/useRedeemAndBuy"),p=require("../context/utils"),a=require("@anker-in/lib"),y=require("../../../components/registration"),R=require("../../../constants");function H({copy:r,itemData:e,setRules:d,className:m}){const{creditInfo:n,profile:s,openSignUpPopup:z,pageCommon:f,gtm:{pageGroup:C,pageHandle:c}}=(0,V.useCreditsContext)(),{authCodeActivate:b}=(0,y.useRegistration)(),{brand:$,locale:u}=(0,a.useHeadlessContext)(),N=R.ROUNDED_BRANDS.includes($),[_,S]=(0,i.useState)(null),{trigger:I,isMutating:k}=(0,w.useRedeemAndBuy)({},{onError:o=>{S(o.message)}}),x=(0,i.useMemo)(()=>!!s,[s?.activated]),g=(0,i.useMemo)(()=>x&&s?.activated&&e.alpcData?.consumeCredits>Number(n?.available_credit||0),[x,s?.activated,e.alpcData?.consumeCredits,n?.available_credit]),E=(0,i.useMemo)(()=>!!(e.alpcData?.remainingInventory<=0&&e.alpcData?.isLimited||!e.productVariant?.availableForSale||g),[e.alpcData?.remainingInventory,e.alpcData?.isLimited,e.productVariant?.availableForSale,g]),F=()=>{S(null),x?!s?.activated&&!b.isActivateSuccess?(b.setAutoSendEmail(!0),b.open()):(I({productVariant:e?.productVariant,redeemId:e?.config?.redeemId}),(0,a.gaTrack)({event:"ga4Event",event_name:"lp_button",member_active_status:s?.activated?"active":"not active",event_parameters:{page_group:C,position:r.title,button_name:v,info:e?.alpcData?.id?.toString()}})):z()},v=(0,i.useMemo)(()=>e.productVariant?.availableForSale?x?r.btnRedeem:r.unlockRewards:r?.soldOut||"Sold Out",[x,e.productVariant?.availableForSale,r.btnRedeem,r.unlockRewards,r?.soldOut]),A=(0,i.useMemo)(()=>{const o=u==="us"?"":`/${u}`;return(0,p.extractVariantId)(e.productVariant?.id)?`${o}/products/${e.product.handle}?variant=${(0,p.extractVariantId)(e.productVariant?.id)}${c?`&ref=${c}`:""}`:`${o}/products/${e.product.handle}${c?`?ref=${c}`:""}`},[e.productVariant?.id,e.product.handle,c,u]);return(0,t.jsxs)("div",{className:(0,a.classNames)("relative flex flex-col items-center rounded-[16px] bg-[#EAEAEC] md:rounded-[12px] px-[24px] pb-[24px] l:px-[8px] l:pb-[8px] md-xl:px-[16px] md-xl:pb-[16px]",!N&&"rounded-none md:rounded-none",r.badgeLabel?"pt-[48px] l:pt-[44px]":"pt-[24px] md-xl:pt-[16px] l:pt-[8px]",m),children:[r.badgeLabel&&(0,t.jsx)(l.Badge,{className:"absolute left-[24px] l:left-[16px] !bg-gradient-brand top-[16px] z-10",size:"lg",variant:"promotional",promotionalType:"regular-member",children:r.badgeLabel}),(0,t.jsx)("a",{href:A,className:(0,a.classNames)("relative mx-auto h-[196px] w-fit md:h-[120px] md-xxl:h-[138px]"),children:(0,t.jsx)(l.Picture,{className:"mx-auto h-full w-auto",imgClassName:"h-full object-contain",source:e?.config?.image?.url||e?.productVariant?.metafields?.global?.transparentImg||e?.productVariant?.image?.url})}),(0,t.jsxs)("div",{className:(0,a.classNames)("mt-[10px] w-full xl:mt-[8px]"),children:[(0,t.jsx)(l.Text,{html:e?.product?.title,title:e.config?.title||e.alpcData?.title||e.product?.title,size:2,className:"line-clamp-2 h-[58px] text-[24px] l-xxl:text-[20px] l:text-[16px] leading-[1.2] l:h-[38px] l-xxl:h-[48px]"}),e?.config?.rules?.split("<br>")?.length>0&&(0,t.jsx)("button",{type:"button",onClick:()=>{d(e?.config?.rules?.split("<br>")),(0,a.gaTrack)({event:"ga4Event",event_name:"lp_button",member_active_status:s?.activated?"active":"not active",event_parameters:{page_group:C,position:r.title,button_name:f?.ruleLabel,info:e?.alpcData?.id?.toString()}})},className:"mt-[8px] text-[16px] font-bold underline xxl:text-[14px]",tabIndex:0,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&o.preventDefault()},children:f?.ruleLabel}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center l:mt-[12px] md:min-h-[46px] laptop:text-[16px] lg-desktop:text-[18px]",children:[(0,t.jsx)(l.Picture,{className:"size-[24px] l-xxl:size-[22px] md-l:size-[18px] md:size-[16px]",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/icon_hire_purchase.png?v=1757496783"}),(0,t.jsx)(l.Text,{html:`${(0,p.numberFormat)(e?.alpcData?.consumeCredits)} + ${(0,p.formatPrice)({amount:Number(e?.config?.price),currencyCode:e?.productVariant?.price.currencyCode||"USD",locale:u})}`,size:2,as:"p",className:"ml-[4px] mt-[4px] font-bold leading-none text-[24px] l-xxl:text-[20px] l:text-[16px]"}),(0,t.jsx)(l.Text,{html:(0,p.formatPrice)({amount:e?.productVariant?.price.amount,currencyCode:e?.productVariant?.price.currencyCode||"USD",locale:u}),className:"l-xxl:text-[20px] mt-[4px] l:text-[16px] ml-[4px] font-bold leading-[1.2] tracking-[-0.8px] text-[#4A4C56] line-through",as:"p"})]}),(0,t.jsxs)("div",{className:"group relative w-full mt-[8px]",children:[(0,t.jsx)(l.Button,{disabled:E,variant:"primary",size:"lg",className:"mt-[8px] md:px-[10px] l:w-full",loading:k,onClick:()=>{F()},title:g?f.insufficientCredits:v,children:v}),(0,t.jsx)("div",{className:(0,a.classNames)("absolute -bottom-[20px] left-0 z-10 w-[300px] translate-y-full opacity-0 transition-opacity group-hover:opacity-100 md:-bottom-[14px] md:w-[160px]",g?"block":"hidden"),children:(0,t.jsxs)("div",{className:(0,a.classNames)("relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow md:px-[10px] md:py-[8px]",!N&&"rounded-none"),children:[(0,t.jsx)(l.Text,{as:"p",size:"2",html:f?.insufficientCredits,className:"text-[14px]"}),(0,t.jsx)("div",{className:"absolute -top-[10px] left-[48px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]"})]})})]})]}),_&&(0,t.jsx)("div",{className:"mt-[8px] text-[14px] text-[#FF0000]",children:_})]})}var M=H;
1
+ "use strict";var h=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var U=(r,e)=>{for(var d in e)h(r,d,{get:e[d],enumerable:!0})},O=(r,e,d,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of B(e))!P.call(r,n)&&n!==d&&h(r,n,{get:()=>e[n],enumerable:!(m=L(e,n))||m.enumerable});return r};var T=r=>O(h({},"__esModule",{value:!0}),r);var G={};U(G,{default:()=>M});module.exports=T(G);var t=require("react/jsx-runtime"),l=require("@anker-in/headless-ui"),i=require("react"),V=require("../context/provider"),w=require("../context/hooks/useRedeemAndBuy"),p=require("../context/utils"),a=require("@anker-in/lib"),y=require("../../../components/registration"),R=require("../../../constants");function H({copy:r,itemData:e,setRules:d,className:m}){const{creditInfo:n,profile:s,openSignUpPopup:z,pageCommon:f,gtm:{pageGroup:C,pageHandle:u}}=(0,V.useCreditsContext)(),{authCodeActivate:b}=(0,y.useRegistration)(),{brand:$,locale:c}=(0,a.useHeadlessContext)(),N=R.ROUNDED_BRANDS.includes($),[_,S]=(0,i.useState)(null),{trigger:I,isMutating:k}=(0,w.useRedeemAndBuy)({},{onError:o=>{S(o.message)}}),x=(0,i.useMemo)(()=>!!s,[s?.activated]),g=(0,i.useMemo)(()=>x&&s?.activated&&e.alpcData?.consumeCredits>Number(n?.available_credit||0),[x,s?.activated,e.alpcData?.consumeCredits,n?.available_credit]),E=(0,i.useMemo)(()=>!!(e.alpcData?.remainingInventory<=0&&e.alpcData?.isLimited||!e.productVariant?.availableForSale||g),[e.alpcData?.remainingInventory,e.alpcData?.isLimited,e.productVariant?.availableForSale,g]),F=()=>{S(null),x?!s?.activated&&!b.isActivateSuccess?(b.setAutoSendEmail(!0),b.open()):(I({productVariant:e?.productVariant,redeemId:e?.config?.redeemId}),(0,a.gaTrack)({event:"ga4Event",event_name:"lp_button",member_active_status:s?.activated?"active":"not active",event_parameters:{page_group:C,position:r.title,button_name:v,info:e?.alpcData?.id?.toString()}})):z()},v=(0,i.useMemo)(()=>e.productVariant?.availableForSale?x?r.btnRedeem:r.unlockRewards:r?.soldOut||"Sold Out",[x,e.productVariant?.availableForSale,r.btnRedeem,r.unlockRewards,r?.soldOut]),A=(0,i.useMemo)(()=>{const o=c==="us"?"":`/${c}`;return(0,p.extractVariantId)(e.productVariant?.id)?`${o}/products/${e.product.handle}?variant=${(0,p.extractVariantId)(e.productVariant?.id)}${u?`&ref=${u}`:""}`:`${o}/products/${e.product.handle}${u?`?ref=${u}`:""}`},[e.productVariant?.id,e.product.handle,u,c]);return(0,t.jsxs)("div",{className:(0,a.classNames)("relative flex flex-col items-center rounded-[16px] bg-[#EAEAEC] md:rounded-[12px] px-[24px] pb-[24px] l:px-[8px] l:pb-[8px] md-xl:px-[16px] md-xl:pb-[16px]",!N&&"rounded-none md:rounded-none",r.badgeLabel?"pt-[48px] l:pt-[44px]":"pt-[24px] md-xl:pt-[16px] l:pt-[8px]",m),children:[r.badgeLabel&&(0,t.jsx)(l.Badge,{className:"absolute left-[24px] l:left-[16px] !bg-gradient-brand top-[16px] z-10",size:"lg",variant:"promotional",promotionalType:"regular-member",children:r.badgeLabel}),(0,t.jsx)("a",{href:A,className:(0,a.classNames)("relative mx-auto h-[196px] w-fit md:h-[120px] md-xxl:h-[138px]"),children:(0,t.jsx)(l.Picture,{className:"mx-auto h-full w-auto",imgClassName:"h-full object-contain",source:e?.config?.image?.url||e?.productVariant?.metafields?.global?.transparentImg||e?.productVariant?.image?.url})}),(0,t.jsxs)("div",{className:(0,a.classNames)("mt-[10px] w-full xl:mt-[8px]"),children:[(0,t.jsx)(l.Text,{html:e?.product?.title,title:e.config?.title||e.alpcData?.title||e.product?.title,size:2,className:"line-clamp-2 h-[58px] text-[24px] l-xxl:text-[20px] l:text-[16px] leading-[1.2] l:h-[38px] l-xxl:h-[48px]"}),e?.config?.rules?.split("<br>")?.length>0&&(0,t.jsx)("button",{type:"button",onClick:()=>{d(e?.config?.rules?.split("<br>")),(0,a.gaTrack)({event:"ga4Event",event_name:"lp_button",member_active_status:s?.activated?"active":"not active",event_parameters:{page_group:C,position:r.title,button_name:f?.ruleLabel,info:e?.alpcData?.id?.toString()}})},className:"mt-[8px] text-[16px] font-bold underline xxl:text-[14px]",tabIndex:0,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&o.preventDefault()},children:f?.ruleLabel}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center l:mt-[12px] md:min-h-[46px] laptop:text-[16px] lg-desktop:text-[18px]",children:[(0,t.jsx)(l.Picture,{className:"size-[24px] l-xxl:size-[22px] md-l:size-[18px] md:size-[16px]",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/icon_hire_purchase.png?v=1757496783"}),(0,t.jsx)(l.Text,{html:`${(0,p.numberFormat)(e?.alpcData?.consumeCredits,c)} + ${(0,p.formatPrice)({amount:Number(e?.config?.price),currencyCode:e?.productVariant?.price.currencyCode||"USD",locale:c})}`,size:2,as:"p",className:"ml-[4px] mt-[4px] font-bold leading-none text-[24px] l-xxl:text-[20px] l:text-[16px]"}),(0,t.jsx)(l.Text,{html:(0,p.formatPrice)({amount:e?.productVariant?.price.amount,currencyCode:e?.productVariant?.price.currencyCode||"USD",locale:c}),className:"l-xxl:text-[20px] mt-[4px] l:text-[16px] ml-[4px] font-bold leading-[1.2] tracking-[-0.8px] text-[#4A4C56] line-through",as:"p"})]}),(0,t.jsxs)("div",{className:"group relative w-full mt-[8px]",children:[(0,t.jsx)(l.Button,{disabled:E,variant:"primary",size:"lg",className:"mt-[8px] md:px-[10px] l:w-full",loading:k,onClick:()=>{F()},title:g?f.insufficientCredits:v,children:v}),(0,t.jsx)("div",{className:(0,a.classNames)("absolute -bottom-[20px] left-0 z-10 w-[300px] translate-y-full opacity-0 transition-opacity group-hover:opacity-100 md:-bottom-[14px] md:w-[160px]",g?"block":"hidden"),children:(0,t.jsxs)("div",{className:(0,a.classNames)("relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow md:px-[10px] md:py-[8px]",!N&&"rounded-none"),children:[(0,t.jsx)(l.Text,{as:"p",size:"2",html:f?.insufficientCredits,className:"text-[14px]"}),(0,t.jsx)("div",{className:"absolute -top-[10px] left-[48px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]"})]})})]})]}),_&&(0,t.jsx)("div",{className:"mt-[8px] text-[14px] text-[#FF0000]",children:_})]})}var M=H;
2
2
  //# sourceMappingURL=RedeemableItem.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/creditsCash/RedeemableItem.tsx"],
4
- "sourcesContent": ["import { Button, Text, Picture, Badge } from '@anker-in/headless-ui'\nimport { useMemo, useState } from 'react'\n\nimport { CreditsCashCopy, RedeemItem } from './type'\nimport { useCreditsContext } from '../context/provider'\nimport { useRedeemAndBuy } from '../context/hooks/useRedeemAndBuy'\nimport { formatPrice, numberFormat, extractVariantId } from '../context/utils'\nimport { gaTrack, classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useRegistration } from '../../../components/registration'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nfunction RedeemableItem({\n copy,\n itemData,\n setRules,\n className,\n}: {\n copy: CreditsCashCopy\n itemData: RedeemItem\n className?: string\n setRules: (rules: string[]) => void\n currencyCode: string\n}) {\n const {\n creditInfo,\n profile,\n openSignUpPopup,\n pageCommon,\n gtm: { pageGroup, pageHandle },\n } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand, locale } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const [error, setError] = useState<string | null>(null)\n const { trigger, isMutating } = useRedeemAndBuy(\n {},\n {\n onError: error => {\n setError(error.message)\n },\n }\n )\n\n const isLogin = useMemo(() => {\n return !!profile\n }, [profile?.activated])\n\n const inSufficientCredit = useMemo(() => {\n return (\n isLogin && profile?.activated && itemData.alpcData?.consumeCredits > Number(creditInfo?.available_credit || 0)\n )\n }, [isLogin, profile?.activated, itemData.alpcData?.consumeCredits, creditInfo?.available_credit])\n\n const isDisabled = useMemo(() => {\n // \u5151\u6362\u9650\u5236\n if (itemData.alpcData?.remainingInventory <= 0 && itemData.alpcData?.isLimited) {\n return true\n }\n\n // \u5546\u54C1\u5E93\u5B58\u9650\u5236\n if (!itemData.productVariant?.availableForSale) {\n return true\n }\n\n // \u79EF\u5206\u4E0D\u8DB3\n if (inSufficientCredit) {\n return true\n }\n return false\n }, [\n itemData.alpcData?.remainingInventory,\n itemData.alpcData?.isLimited,\n itemData.productVariant?.availableForSale,\n inSufficientCredit,\n ])\n\n const handleRedeem = () => {\n setError(null)\n if (!isLogin) {\n openSignUpPopup()\n } else if (!profile?.activated && !authCodeActivate.isActivateSuccess) {\n authCodeActivate.setAutoSendEmail(true)\n authCodeActivate.open()\n } else {\n trigger({\n productVariant: itemData?.productVariant,\n redeemId: itemData?.config?.redeemId,\n })\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n member_active_status: profile?.activated ? 'active' : 'not active',\n event_parameters: {\n page_group: pageGroup,\n position: copy.title,\n button_name: redeemButtonText,\n info: itemData?.alpcData?.id?.toString(),\n },\n })\n }\n }\n\n const redeemButtonText = useMemo(() => {\n // \u7F3A\u8D27\u6587\u6848\n if (!itemData.productVariant?.availableForSale) {\n return copy?.soldOut || 'Sold Out'\n } else if (!isLogin) {\n return copy.unlockRewards\n } else {\n return copy.btnRedeem\n }\n }, [isLogin, itemData.productVariant?.availableForSale, copy.btnRedeem, copy.unlockRewards, copy?.soldOut])\n\n const productUrl = useMemo(() => {\n const localePrefix = locale === 'us' ? '' : `/${locale}`\n return extractVariantId(itemData.productVariant?.id)\n ? `${localePrefix}/products/${itemData.product.handle}?variant=${extractVariantId(itemData.productVariant?.id)}${pageHandle ? `&ref=${pageHandle}` : ''}`\n : `${localePrefix}/products/${itemData.product.handle}${pageHandle ? `?ref=${pageHandle}` : ''}`\n }, [itemData.productVariant?.id, itemData.product.handle, pageHandle, locale])\n\n return (\n <div\n className={cn(\n 'relative flex flex-col items-center rounded-[16px] bg-[#EAEAEC] md:rounded-[12px] px-[24px] pb-[24px] l:px-[8px] l:pb-[8px] md-xl:px-[16px] md-xl:pb-[16px]',\n !rounded && 'rounded-none md:rounded-none',\n copy.badgeLabel ? 'pt-[48px] l:pt-[44px]' : 'pt-[24px] md-xl:pt-[16px] l:pt-[8px]',\n className\n )}\n >\n {/* Redeem \u6807\u7B7E Badge */}\n {copy.badgeLabel && (\n <Badge\n className=\"absolute left-[24px] l:left-[16px] !bg-gradient-brand top-[16px] z-10\"\n size=\"lg\"\n variant=\"promotional\"\n promotionalType=\"regular-member\"\n >\n {copy.badgeLabel}\n </Badge>\n )}\n\n <a\n href={productUrl}\n className={cn('relative mx-auto h-[196px] w-fit md:h-[120px] md-xxl:h-[138px]')}\n >\n <Picture\n className=\"mx-auto h-full w-auto\"\n imgClassName=\"h-full object-contain\"\n source={\n itemData?.config?.image?.url ||\n itemData?.productVariant?.metafields?.global?.transparentImg ||\n itemData?.productVariant?.image?.url\n }\n ></Picture>\n </a>\n <div className={cn('mt-[10px] w-full xl:mt-[8px]')}>\n <Text\n html={itemData?.product?.title}\n title={itemData.config?.title || itemData.alpcData?.title || itemData.product?.title}\n size={2}\n className=\"line-clamp-2 h-[58px] text-[24px] l-xxl:text-[20px] l:text-[16px] leading-[1.2] l:h-[38px] l-xxl:h-[48px]\"\n />\n {itemData?.config?.rules?.split('<br>')?.length > 0 && (\n <button\n type=\"button\"\n onClick={() => {\n setRules(itemData?.config?.rules?.split('<br>'))\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n member_active_status: profile?.activated ? 'active' : 'not active',\n event_parameters: {\n page_group: pageGroup,\n position: copy.title,\n button_name: pageCommon?.ruleLabel,\n info: itemData?.alpcData?.id?.toString(),\n },\n })\n }}\n className=\"mt-[8px] text-[16px] font-bold underline xxl:text-[14px]\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {pageCommon?.ruleLabel}\n </button>\n )}\n\n <div className=\"flex flex-wrap items-center l:mt-[12px] md:min-h-[46px] laptop:text-[16px] lg-desktop:text-[18px]\">\n <Picture\n className=\"size-[24px] l-xxl:size-[22px] md-l:size-[18px] md:size-[16px]\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/icon_hire_purchase.png?v=1757496783\"\n />\n <Text\n html={`${numberFormat(itemData?.alpcData?.consumeCredits)} + ${formatPrice({\n amount: Number(itemData?.config?.price),\n currencyCode: itemData?.productVariant?.price.currencyCode || 'USD',\n locale: locale,\n })}`}\n size={2}\n as=\"p\"\n className=\"ml-[4px] mt-[4px] font-bold leading-none text-[24px] l-xxl:text-[20px] l:text-[16px]\"\n />\n <Text\n html={formatPrice({\n amount: itemData?.productVariant?.price.amount,\n currencyCode: itemData?.productVariant?.price.currencyCode || 'USD',\n locale: locale,\n })}\n className=\"l-xxl:text-[20px] mt-[4px] l:text-[16px] ml-[4px] font-bold leading-[1.2] tracking-[-0.8px] text-[#4A4C56] line-through\"\n as=\"p\"\n />\n </div>\n\n <div className=\"group relative w-full mt-[8px]\">\n <Button\n disabled={isDisabled}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[8px] md:px-[10px] l:w-full\"\n loading={isMutating}\n onClick={() => {\n handleRedeem()\n }}\n title={inSufficientCredit ? pageCommon.insufficientCredits : redeemButtonText}\n >\n {redeemButtonText}\n </Button>\n <div\n className={cn(\n 'absolute -bottom-[20px] left-0 z-10 w-[300px] translate-y-full opacity-0 transition-opacity group-hover:opacity-100 md:-bottom-[14px] md:w-[160px]',\n inSufficientCredit ? 'block' : 'hidden'\n )}\n >\n <div\n className={cn(\n 'relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow md:px-[10px] md:py-[8px]',\n !rounded && 'rounded-none'\n )}\n >\n <Text as=\"p\" size=\"2\" html={pageCommon?.insufficientCredits} className=\"text-[14px]\" />\n <div className=\"absolute -top-[10px] left-[48px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]\" />\n </div>\n </div>\n </div>\n </div>\n {error && <div className=\"mt-[8px] text-[14px] text-[#FF0000]\">{error}</div>}\n </div>\n )\n}\n\nexport default RedeemableItem\n"],
5
- "mappings": "yaAAA,IAAAA,EAA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AI,UAAU,iCACb,oBAAC,UACC,SAAUQ,EACV,QAAQ,UACR,KAAK,KACL,UAAU,iCACV,QAASH,EACT,QAAS,IAAM,CACbI,EAAa,CACf,EACA,MAAOF,EAAqBZ,EAAW,oBAAsBe,EAE5D,SAAAA,EACH,KACA,OAAC,OACC,aAAW,EAAAG,YACT,qJACAN,EAAqB,QAAU,QACjC,EAEA,oBAAC,OACC,aAAW,EAAAM,YACT,mHACA,CAACZ,GAAW,cACd,EAEA,oBAAC,QAAK,GAAG,IAAI,KAAK,IAAI,KAAMN,GAAY,oBAAqB,UAAU,cAAc,KACrF,OAAC,OAAI,UAAU,mHAAmH,GACpI,EACF,GACF,GACF,EACCO,MAAS,OAAC,OAAI,UAAU,sCAAuC,SAAAA,EAAM,GACxE,CAEJ,CAEA,IAAO1B,EAAQW",
4
+ "sourcesContent": ["import { Button, Text, Picture, Badge } from '@anker-in/headless-ui'\nimport { useMemo, useState } from 'react'\n\nimport { CreditsCashCopy, RedeemItem } from './type'\nimport { useCreditsContext } from '../context/provider'\nimport { useRedeemAndBuy } from '../context/hooks/useRedeemAndBuy'\nimport { formatPrice, numberFormat, extractVariantId } from '../context/utils'\nimport { gaTrack, classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useRegistration } from '../../../components/registration'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nfunction RedeemableItem({\n copy,\n itemData,\n setRules,\n className,\n}: {\n copy: CreditsCashCopy\n itemData: RedeemItem\n className?: string\n setRules: (rules: string[]) => void\n currencyCode: string\n}) {\n const {\n creditInfo,\n profile,\n openSignUpPopup,\n pageCommon,\n gtm: { pageGroup, pageHandle },\n } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand, locale } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const [error, setError] = useState<string | null>(null)\n const { trigger, isMutating } = useRedeemAndBuy(\n {},\n {\n onError: error => {\n setError(error.message)\n },\n }\n )\n\n const isLogin = useMemo(() => {\n return !!profile\n }, [profile?.activated])\n\n const inSufficientCredit = useMemo(() => {\n return (\n isLogin && profile?.activated && itemData.alpcData?.consumeCredits > Number(creditInfo?.available_credit || 0)\n )\n }, [isLogin, profile?.activated, itemData.alpcData?.consumeCredits, creditInfo?.available_credit])\n\n const isDisabled = useMemo(() => {\n // \u5151\u6362\u9650\u5236\n if (itemData.alpcData?.remainingInventory <= 0 && itemData.alpcData?.isLimited) {\n return true\n }\n\n // \u5546\u54C1\u5E93\u5B58\u9650\u5236\n if (!itemData.productVariant?.availableForSale) {\n return true\n }\n\n // \u79EF\u5206\u4E0D\u8DB3\n if (inSufficientCredit) {\n return true\n }\n return false\n }, [\n itemData.alpcData?.remainingInventory,\n itemData.alpcData?.isLimited,\n itemData.productVariant?.availableForSale,\n inSufficientCredit,\n ])\n\n const handleRedeem = () => {\n setError(null)\n if (!isLogin) {\n openSignUpPopup()\n } else if (!profile?.activated && !authCodeActivate.isActivateSuccess) {\n authCodeActivate.setAutoSendEmail(true)\n authCodeActivate.open()\n } else {\n trigger({\n productVariant: itemData?.productVariant,\n redeemId: itemData?.config?.redeemId,\n })\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n member_active_status: profile?.activated ? 'active' : 'not active',\n event_parameters: {\n page_group: pageGroup,\n position: copy.title,\n button_name: redeemButtonText,\n info: itemData?.alpcData?.id?.toString(),\n },\n })\n }\n }\n\n const redeemButtonText = useMemo(() => {\n // \u7F3A\u8D27\u6587\u6848\n if (!itemData.productVariant?.availableForSale) {\n return copy?.soldOut || 'Sold Out'\n } else if (!isLogin) {\n return copy.unlockRewards\n } else {\n return copy.btnRedeem\n }\n }, [isLogin, itemData.productVariant?.availableForSale, copy.btnRedeem, copy.unlockRewards, copy?.soldOut])\n\n const productUrl = useMemo(() => {\n const localePrefix = locale === 'us' ? '' : `/${locale}`\n return extractVariantId(itemData.productVariant?.id)\n ? `${localePrefix}/products/${itemData.product.handle}?variant=${extractVariantId(itemData.productVariant?.id)}${pageHandle ? `&ref=${pageHandle}` : ''}`\n : `${localePrefix}/products/${itemData.product.handle}${pageHandle ? `?ref=${pageHandle}` : ''}`\n }, [itemData.productVariant?.id, itemData.product.handle, pageHandle, locale])\n\n return (\n <div\n className={cn(\n 'relative flex flex-col items-center rounded-[16px] bg-[#EAEAEC] md:rounded-[12px] px-[24px] pb-[24px] l:px-[8px] l:pb-[8px] md-xl:px-[16px] md-xl:pb-[16px]',\n !rounded && 'rounded-none md:rounded-none',\n copy.badgeLabel ? 'pt-[48px] l:pt-[44px]' : 'pt-[24px] md-xl:pt-[16px] l:pt-[8px]',\n className\n )}\n >\n {/* Redeem \u6807\u7B7E Badge */}\n {copy.badgeLabel && (\n <Badge\n className=\"absolute left-[24px] l:left-[16px] !bg-gradient-brand top-[16px] z-10\"\n size=\"lg\"\n variant=\"promotional\"\n promotionalType=\"regular-member\"\n >\n {copy.badgeLabel}\n </Badge>\n )}\n\n <a\n href={productUrl}\n className={cn('relative mx-auto h-[196px] w-fit md:h-[120px] md-xxl:h-[138px]')}\n >\n <Picture\n className=\"mx-auto h-full w-auto\"\n imgClassName=\"h-full object-contain\"\n source={\n itemData?.config?.image?.url ||\n itemData?.productVariant?.metafields?.global?.transparentImg ||\n itemData?.productVariant?.image?.url\n }\n ></Picture>\n </a>\n <div className={cn('mt-[10px] w-full xl:mt-[8px]')}>\n <Text\n html={itemData?.product?.title}\n title={itemData.config?.title || itemData.alpcData?.title || itemData.product?.title}\n size={2}\n className=\"line-clamp-2 h-[58px] text-[24px] l-xxl:text-[20px] l:text-[16px] leading-[1.2] l:h-[38px] l-xxl:h-[48px]\"\n />\n {itemData?.config?.rules?.split('<br>')?.length > 0 && (\n <button\n type=\"button\"\n onClick={() => {\n setRules(itemData?.config?.rules?.split('<br>'))\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n member_active_status: profile?.activated ? 'active' : 'not active',\n event_parameters: {\n page_group: pageGroup,\n position: copy.title,\n button_name: pageCommon?.ruleLabel,\n info: itemData?.alpcData?.id?.toString(),\n },\n })\n }}\n className=\"mt-[8px] text-[16px] font-bold underline xxl:text-[14px]\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {pageCommon?.ruleLabel}\n </button>\n )}\n\n <div className=\"flex flex-wrap items-center l:mt-[12px] md:min-h-[46px] laptop:text-[16px] lg-desktop:text-[18px]\">\n <Picture\n className=\"size-[24px] l-xxl:size-[22px] md-l:size-[18px] md:size-[16px]\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/icon_hire_purchase.png?v=1757496783\"\n />\n <Text\n html={`${numberFormat(itemData?.alpcData?.consumeCredits, locale)} + ${formatPrice({\n amount: Number(itemData?.config?.price),\n currencyCode: itemData?.productVariant?.price.currencyCode || 'USD',\n locale: locale,\n })}`}\n size={2}\n as=\"p\"\n className=\"ml-[4px] mt-[4px] font-bold leading-none text-[24px] l-xxl:text-[20px] l:text-[16px]\"\n />\n <Text\n html={formatPrice({\n amount: itemData?.productVariant?.price.amount,\n currencyCode: itemData?.productVariant?.price.currencyCode || 'USD',\n locale: locale,\n })}\n className=\"l-xxl:text-[20px] mt-[4px] l:text-[16px] ml-[4px] font-bold leading-[1.2] tracking-[-0.8px] text-[#4A4C56] line-through\"\n as=\"p\"\n />\n </div>\n\n <div className=\"group relative w-full mt-[8px]\">\n <Button\n disabled={isDisabled}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[8px] md:px-[10px] l:w-full\"\n loading={isMutating}\n onClick={() => {\n handleRedeem()\n }}\n title={inSufficientCredit ? pageCommon.insufficientCredits : redeemButtonText}\n >\n {redeemButtonText}\n </Button>\n <div\n className={cn(\n 'absolute -bottom-[20px] left-0 z-10 w-[300px] translate-y-full opacity-0 transition-opacity group-hover:opacity-100 md:-bottom-[14px] md:w-[160px]',\n inSufficientCredit ? 'block' : 'hidden'\n )}\n >\n <div\n className={cn(\n 'relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow md:px-[10px] md:py-[8px]',\n !rounded && 'rounded-none'\n )}\n >\n <Text as=\"p\" size=\"2\" html={pageCommon?.insufficientCredits} className=\"text-[14px]\" />\n <div className=\"absolute -top-[10px] left-[48px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]\" />\n </div>\n </div>\n </div>\n </div>\n {error && <div className=\"mt-[8px] text-[14px] text-[#FF0000]\">{error}</div>}\n </div>\n )\n}\n\nexport default RedeemableItem\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAmIQ,IAAAI,EAAA,6BAnIRC,EAA6C,iCAC7CC,EAAkC,iBAGlCC,EAAkC,+BAClCC,EAAgC,4CAChCC,EAA4D,4BAC5DC,EAA8D,yBAC9DC,EAAgC,4CAChCC,EAA+B,8BAE/B,SAASC,EAAe,CACtB,KAAAC,EACA,SAAAC,EACA,SAAAC,EACA,UAAAC,CACF,EAMG,CACD,KAAM,CACJ,WAAAC,EACA,QAAAC,EACA,gBAAAC,EACA,WAAAC,EACA,IAAK,CAAE,UAAAC,EAAW,WAAAC,CAAW,CAC/B,KAAI,qBAAkB,EAChB,CAAE,iBAAAC,CAAiB,KAAI,mBAAgB,EACvC,CAAE,MAAAC,EAAO,OAAAC,CAAO,KAAI,sBAAmB,EACvCC,EAAU,iBAAe,SAASF,CAAK,EACvC,CAACG,EAAOC,CAAQ,KAAI,YAAwB,IAAI,EAChD,CAAE,QAAAC,EAAS,WAAAC,CAAW,KAAI,mBAC9B,CAAC,EACD,CACE,QAASH,GAAS,CAChBC,EAASD,EAAM,OAAO,CACxB,CACF,CACF,EAEMI,KAAU,WAAQ,IACf,CAAC,CAACb,EACR,CAACA,GAAS,SAAS,CAAC,EAEjBc,KAAqB,WAAQ,IAE/BD,GAAWb,GAAS,WAAaJ,EAAS,UAAU,eAAiB,OAAOG,GAAY,kBAAoB,CAAC,EAE9G,C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U,eAAgBW,CAAM,CAAC,SAAM,eAAY,CACnF,OAAQ,OAAOX,GAAU,QAAQ,KAAK,EACtC,aAAcA,GAAU,gBAAgB,MAAM,cAAgB,MAC9D,OAAQW,CACV,CAAC,CAAC,GACF,KAAM,EACN,GAAG,IACH,UAAU,uFACZ,KACA,OAAC,QACC,QAAM,eAAY,CAChB,OAAQX,GAAU,gBAAgB,MAAM,OACxC,aAAcA,GAAU,gBAAgB,MAAM,cAAgB,MAC9D,OAAQW,CACV,CAAC,EACD,UAAU,0HACV,GAAG,IACL,GACF,KAEA,QAAC,OAAI,UAAU,iCACb,oBAAC,UACC,SAAUQ,EACV,QAAQ,UACR,KAAK,KACL,UAAU,iCACV,QAASH,EACT,QAAS,IAAM,CACbI,EAAa,CACf,EACA,MAAOF,EAAqBZ,EAAW,oBAAsBe,EAE5D,SAAAA,EACH,KACA,OAAC,OACC,aAAW,EAAAG,YACT,qJACAN,EAAqB,QAAU,QACjC,EAEA,oBAAC,OACC,aAAW,EAAAM,YACT,mHACA,CAACZ,GAAW,cACd,EAEA,oBAAC,QAAK,GAAG,IAAI,KAAK,IAAI,KAAMN,GAAY,oBAAqB,UAAU,cAAc,KACrF,OAAC,OAAI,UAAU,mHAAmH,GACpI,EACF,GACF,GACF,EACCO,MAAS,OAAC,OAAI,UAAU,sCAAuC,SAAAA,EAAM,GACxE,CAEJ,CAEA,IAAO1B,EAAQW",
6
6
  "names": ["RedeemableItem_exports", "__export", "RedeemableItem_default", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_react", "import_provider", "import_useRedeemAndBuy", "import_utils", "import_lib", "import_registration", "import_constants", "RedeemableItem", "copy", "itemData", "setRules", "className", "creditInfo", "profile", "openSignUpPopup", "pageCommon", "pageGroup", "pageHandle", "authCodeActivate", "brand", "locale", "rounded", "error", "setError", "trigger", "isMutating", "isLogin", "inSufficientCredit", "isDisabled", "handleRedeem", "redeemButtonText", "productUrl", "localePrefix", "cn", "e"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var m=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var h=(i,a)=>{for(var s in a)m(i,s,{get:a[s],enumerable:!0})},D=(i,a,s,o)=>{if(a&&typeof a=="object"||typeof a=="function")for(let l of y(a))!k.call(i,l)&&l!==s&&m(i,l,{get:()=>a[l],enumerable:!(o=w(a,l))||o.enumerable});return i};var z=i=>D(m({},"__esModule",{value:!0}),i);var S={};h(S,{CreditsInfoCard:()=>B});module.exports=z(S);var e=require("react/jsx-runtime"),d=require("@anker-in/headless-ui"),x=require("react"),u=require("../context/provider"),c=require("../context/utils"),t=require("@anker-in/lib"),g=require("../../../constants");function B({copy:i,id:a}){const[s,o]=(0,x.useState)(!1),{creditInfo:l,pageCommon:r,setOpenMyRewardsModal:b,setOpenActivitiesModal:f}=(0,u.useCreditsContext)(),{brand:N}=(0,t.useHeadlessContext)(),p=g.ROUNDED_BRANDS.includes(N),C=(0,x.useCallback)(n=>{if((0,t.gaNormalClick)({position:"info_card",label:n.text}),n.type)switch(n.type){case"activities":f(!0);break;case"rewards":b(!0);break}},[f,b]);return(0,e.jsxs)(d.Container,{asChild:!0,id:a,className:"-mb-[86px] -translate-y-[86px] x:-mb-[30px] x:-translate-y-[30px]",children:[(0,e.jsxs)("div",{className:(0,t.classNames)("mx-auto flex justify-between items-center rounded-[12px] border border-white px-[24px] py-[40px]","l:flex-col l:items-start","min-l:px-[48px]","min-xl:px-[100px]",!p&&"rounded-none"),style:{background:"linear-gradient(119.61deg, rgba(250, 250, 250, 0.6) 38.58%, rgba(255, 255, 255, 0.6) 63.73%, rgba(249, 252, 255, 0.6) 89.37%)",backdropFilter:"blur(8px)"},children:[(0,e.jsxs)("div",{className:(0,t.classNames)("grid grid-cols-2 gap-[24px] font-bold l:w-full md:grid-cols-1 md:flex-col md:gap-[16px] min-md:items-center"),children:[(0,e.jsxs)("div",{className:"mr-[80px] md:mr-[0] md:flex-1 md-xl:mr-[64px]",children:[(0,e.jsx)("div",{className:(0,t.classNames)("mb-[24px] text-[14px] font-bold l:mb-[6px] xl:text-[16px] min-md:text-[18px] l-xl:mb-[16px]"),children:i.balanceLabel}),(0,e.jsxs)("div",{className:"flex items-baseline",children:[(0,e.jsx)("div",{className:(0,t.classNames)("mr-[8px] text-[36px] font-extrabold text-brand-color-1","min-md:text-[44px]","min-xl:text-[56px]"),children:l?(0,c.numberFormat)(l.available_credit):0}),(0,e.jsx)("div",{className:"text-[16px]",children:r?.pointUnit})]})]}),(0,e.jsxs)("div",{className:"w-fit md:flex-1",children:[(0,e.jsxs)("div",{className:(0,t.classNames)("mb-[24px] flex text-[18px] l:mb-[6px] l:text-[14px] l-xl:mb-[16px]"),children:[(0,e.jsx)(d.Text,{className:"text-[14px] font-bold xl:text-[16px] min-md:text-[18px]",html:i.comingSoonLabel}),i.comingSoonTips&&(0,e.jsxs)("div",{className:"group relative ml-[4px] flex cursor-pointer items-start",children:[(0,e.jsx)(d.Text,{as:"div",html:r?.infoIcon,className:"size-[18px] cursor-pointer [&_svg]:size-full",onClick:()=>{s?o(!1):(o(!0),setTimeout(()=>{o(!1)},5e3))}}),(0,e.jsx)("div",{className:(0,t.classNames)("absolute -bottom-[12px] -left-[32px] z-10 w-[356px] translate-y-full md:w-[276px]",s?"block":"hidden"),children:(0,e.jsxs)("div",{className:(0,t.classNames)("relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow",!p&&"rounded-none"),children:[(0,e.jsx)(d.Text,{size:"2",html:i.comingSoonTips,className:"desktop:text-[18px]"}),(0,e.jsx)("div",{className:(0,t.classNames)("absolute -top-[10px] left-[40px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]",!p&&"rounded-none")})]})})]})]}),(0,e.jsxs)("div",{className:"flex items-baseline ",children:[(0,e.jsx)("div",{className:(0,t.classNames)("mr-[8px] text-[36px] font-extrabold","min-l:text-[44px]","min-xl:text-[56px]"),children:l?(0,c.numberFormat)(l.pending_credit):0}),(0,e.jsx)("div",{className:"text-[16px]",children:r?.pointUnit})]})]})]}),(0,e.jsx)("div",{className:(0,t.classNames)("grid w-fit md:w-full l:mt-[32px] l:gap-[12px] gap-[16px] l:pl-0 pl-[48px] md-l:grid-cols-2"),children:i.buttons?.map((n,v)=>(0,e.jsx)(d.Button,{variant:v===0?"secondary":"primary",size:"lg",className:"min-w-[156px] laptop:min-w-[189px]",onClick:()=>{C(n)},children:n.text},v))})]}),s&&(0,e.jsx)("div",{role:"button",tabIndex:0,className:"fixed inset-0 z-10",onClick:()=>o(!1),onKeyDown:n=>n.key==="Escape"&&o(!1)})]})}
1
+ "use strict";var m=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var D=(i,a)=>{for(var s in a)m(i,s,{get:a[s],enumerable:!0})},z=(i,a,s,o)=>{if(a&&typeof a=="object"||typeof a=="function")for(let l of k(a))!h.call(i,l)&&l!==s&&m(i,l,{get:()=>a[l],enumerable:!(o=y(a,l))||o.enumerable});return i};var B=i=>z(m({},"__esModule",{value:!0}),i);var I={};D(I,{CreditsInfoCard:()=>S});module.exports=B(I);var e=require("react/jsx-runtime"),d=require("@anker-in/headless-ui"),x=require("react"),g=require("../context/provider"),c=require("../context/utils"),t=require("@anker-in/lib"),N=require("../../../constants");function S({copy:i,id:a}){const[s,o]=(0,x.useState)(!1),{creditInfo:l,pageCommon:r,setOpenMyRewardsModal:b,setOpenActivitiesModal:f}=(0,g.useCreditsContext)(),{brand:C,locale:v}=(0,t.useHeadlessContext)(),p=N.ROUNDED_BRANDS.includes(C),w=(0,x.useCallback)(n=>{if((0,t.gaNormalClick)({position:"info_card",label:n.text}),n.type)switch(n.type){case"activities":f(!0);break;case"rewards":b(!0);break}},[f,b]);return(0,e.jsxs)(d.Container,{asChild:!0,id:a,className:"-mb-[86px] -translate-y-[86px] x:-mb-[30px] x:-translate-y-[30px]",children:[(0,e.jsxs)("div",{className:(0,t.classNames)("mx-auto flex justify-between items-center rounded-[12px] border border-white px-[24px] py-[40px]","l:flex-col l:items-start","min-l:px-[48px]","min-xl:px-[100px]",!p&&"rounded-none"),style:{background:"linear-gradient(119.61deg, rgba(250, 250, 250, 0.6) 38.58%, rgba(255, 255, 255, 0.6) 63.73%, rgba(249, 252, 255, 0.6) 89.37%)",backdropFilter:"blur(8px)"},children:[(0,e.jsxs)("div",{className:(0,t.classNames)("grid grid-cols-2 gap-[24px] font-bold l:w-full md:grid-cols-1 md:flex-col md:gap-[16px] min-md:items-center"),children:[(0,e.jsxs)("div",{className:"mr-[80px] md:mr-[0] md:flex-1 md-xl:mr-[64px]",children:[(0,e.jsx)("div",{className:(0,t.classNames)("mb-[24px] text-[14px] font-bold l:mb-[6px] xl:text-[16px] min-md:text-[18px] l-xl:mb-[16px]"),children:i.balanceLabel}),(0,e.jsxs)("div",{className:"flex items-baseline",children:[(0,e.jsx)("div",{className:(0,t.classNames)("mr-[8px] text-[36px] font-extrabold text-brand-color-1","min-md:text-[44px]","min-xl:text-[56px]"),children:l?(0,c.numberFormat)(l.available_credit,v):0}),(0,e.jsx)("div",{className:"text-[16px]",children:r?.pointUnit})]})]}),(0,e.jsxs)("div",{className:"w-fit md:flex-1",children:[(0,e.jsxs)("div",{className:(0,t.classNames)("mb-[24px] flex text-[18px] l:mb-[6px] l:text-[14px] l-xl:mb-[16px]"),children:[(0,e.jsx)(d.Text,{className:"text-[14px] font-bold xl:text-[16px] min-md:text-[18px]",html:i.comingSoonLabel}),i.comingSoonTips&&(0,e.jsxs)("div",{className:"group relative ml-[4px] flex cursor-pointer items-start",children:[(0,e.jsx)(d.Text,{as:"div",html:r?.infoIcon,className:"size-[18px] cursor-pointer [&_svg]:size-full",onClick:()=>{s?o(!1):(o(!0),setTimeout(()=>{o(!1)},5e3))}}),(0,e.jsx)("div",{className:(0,t.classNames)("absolute -bottom-[12px] -left-[32px] z-10 w-[356px] translate-y-full md:w-[276px]",s?"block":"hidden"),children:(0,e.jsxs)("div",{className:(0,t.classNames)("relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow",!p&&"rounded-none"),children:[(0,e.jsx)(d.Text,{size:"2",html:i.comingSoonTips,className:"desktop:text-[18px]"}),(0,e.jsx)("div",{className:(0,t.classNames)("absolute -top-[10px] left-[40px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]",!p&&"rounded-none")})]})})]})]}),(0,e.jsxs)("div",{className:"flex items-baseline ",children:[(0,e.jsx)("div",{className:(0,t.classNames)("mr-[8px] text-[36px] font-extrabold","min-l:text-[44px]","min-xl:text-[56px]"),children:l?(0,c.numberFormat)(l.pending_credit,v):0}),(0,e.jsx)("div",{className:"text-[16px]",children:r?.pointUnit})]})]})]}),(0,e.jsx)("div",{className:(0,t.classNames)("grid w-fit md:w-full l:mt-[32px] l:gap-[12px] gap-[16px] l:pl-0 pl-[48px] md-l:grid-cols-2"),children:i.buttons?.map((n,u)=>(0,e.jsx)(d.Button,{variant:u===0?"secondary":"primary",size:"lg",className:"min-w-[156px] laptop:min-w-[189px]",onClick:()=>{w(n)},children:n.text},u))})]}),s&&(0,e.jsx)("div",{role:"button",tabIndex:0,className:"fixed inset-0 z-10",onClick:()=>o(!1),onKeyDown:n=>n.key==="Escape"&&o(!1)})]})}
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/creditsInfoCard/index.tsx"],
4
- "sourcesContent": ["import { Button, Container, Text } from '@anker-in/headless-ui'\n\nimport { useCallback, useState } from 'react'\nimport { useCreditsContext } from '../context/provider'\nimport { numberFormat } from '../context/utils'\nimport { gaNormalClick, classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\ntype ButtonConfig = {\n text: string\n type: 'activities' | 'rewards'\n}\nexport type CreditsInfoCardCopy = {\n balanceLabel: string\n comingSoonLabel: string\n comingSoonTips: string\n buttons: ButtonConfig[]\n}\n\nexport function CreditsInfoCard({ copy, id }: { copy: CreditsInfoCardCopy; id?: string }) {\n const [hover, setHover] = useState<boolean>(false)\n const { creditInfo, pageCommon, setOpenMyRewardsModal, setOpenActivitiesModal } = useCreditsContext()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const handleButtonClick = useCallback((buttonConfig: ButtonConfig) => {\n gaNormalClick({ position: 'info_card', label: buttonConfig.text })\n\n if (buttonConfig.type) {\n switch (buttonConfig.type) {\n case 'activities':\n setOpenActivitiesModal(true)\n break\n case 'rewards':\n setOpenMyRewardsModal(true)\n break\n }\n }\n }, [setOpenActivitiesModal, setOpenMyRewardsModal])\n\n return (\n <Container asChild id={id} className=\"-mb-[86px] -translate-y-[86px] x:-mb-[30px] x:-translate-y-[30px]\">\n <div\n className={cn(\n 'mx-auto flex justify-between items-center rounded-[12px] border border-white px-[24px] py-[40px]',\n 'l:flex-col l:items-start',\n 'min-l:px-[48px]',\n 'min-xl:px-[100px]',\n !rounded && 'rounded-none'\n )}\n style={{\n background:\n 'linear-gradient(119.61deg, rgba(250, 250, 250, 0.6) 38.58%, rgba(255, 255, 255, 0.6) 63.73%, rgba(249, 252, 255, 0.6) 89.37%)',\n backdropFilter: 'blur(8px)',\n }}\n >\n <div\n className={cn(\n 'grid grid-cols-2 gap-[24px] font-bold l:w-full md:grid-cols-1 md:flex-col md:gap-[16px] min-md:items-center'\n )}\n >\n <div className=\"mr-[80px] md:mr-[0] md:flex-1 md-xl:mr-[64px]\">\n <div\n className={cn(\n 'mb-[24px] text-[14px] font-bold l:mb-[6px] xl:text-[16px] min-md:text-[18px] l-xl:mb-[16px]'\n )}\n >\n {copy.balanceLabel}\n </div>\n <div className=\"flex items-baseline\">\n <div\n className={cn(\n 'mr-[8px] text-[36px] font-extrabold text-brand-color-1',\n 'min-md:text-[44px]',\n 'min-xl:text-[56px]'\n )}\n >\n {creditInfo ? numberFormat(creditInfo.available_credit) : 0}\n </div>\n <div className=\"text-[16px]\">{pageCommon?.pointUnit}</div>\n </div>\n </div>\n <div className=\"w-fit md:flex-1\">\n <div className={cn('mb-[24px] flex text-[18px] l:mb-[6px] l:text-[14px] l-xl:mb-[16px]')}>\n <Text className=\"text-[14px] font-bold xl:text-[16px] min-md:text-[18px]\" html={copy.comingSoonLabel} />\n {copy.comingSoonTips && (\n <div className=\"group relative ml-[4px] flex cursor-pointer items-start\">\n <Text\n as=\"div\"\n html={pageCommon?.infoIcon}\n className=\"size-[18px] cursor-pointer [&_svg]:size-full\"\n onClick={() => {\n if (hover) {\n setHover(false)\n } else {\n setHover(true)\n setTimeout(() => {\n setHover(false)\n }, 5000)\n }\n }}\n />\n <div\n className={cn(\n 'absolute -bottom-[12px] -left-[32px] z-10 w-[356px] translate-y-full md:w-[276px]',\n hover ? 'block' : 'hidden'\n )}\n >\n <div\n className={cn(\n 'relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow',\n !rounded && 'rounded-none'\n )}\n >\n <Text size=\"2\" html={copy.comingSoonTips} className=\"desktop:text-[18px]\" />\n <div\n className={cn(\n 'absolute -top-[10px] left-[40px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]',\n !rounded && 'rounded-none'\n )}\n />\n </div>\n </div>\n </div>\n )}\n </div>\n <div className=\"flex items-baseline \">\n <div className={cn('mr-[8px] text-[36px] font-extrabold', 'min-l:text-[44px]', 'min-xl:text-[56px]')}>\n {creditInfo ? numberFormat(creditInfo.pending_credit) : 0}\n </div>\n <div className=\"text-[16px]\">{pageCommon?.pointUnit}</div>\n </div>\n </div>\n </div>\n <div\n className={cn(\n 'grid w-fit md:w-full l:mt-[32px] l:gap-[12px] gap-[16px] l:pl-0 pl-[48px] md-l:grid-cols-2'\n )}\n >\n {copy.buttons?.map((item, index) => (\n <Button\n key={index}\n variant={index === 0 ? 'secondary' : 'primary'}\n size=\"lg\"\n className=\"min-w-[156px] laptop:min-w-[189px]\"\n onClick={() => {\n handleButtonClick(item)\n }}\n >\n {item.text}\n </Button>\n ))}\n </div>\n </div>\n {hover && (\n <div\n role=\"button\"\n tabIndex={0}\n className=\"fixed inset-0 z-10\"\n onClick={() => setHover(false)}\n onKeyDown={e => e.key === 'Escape' && setHover(false)}\n />\n )}\n </Container>\n )\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GA8DY,IAAAI,EAAA,6BA9DZC,EAAwC,iCAExCC,EAAsC,iBACtCC,EAAkC,+BAClCC,EAA6B,4BAC7BC,EAAoE,yBACpEC,EAA+B,8BAaxB,SAASR,EAAgB,CAAE,KAAAS,EAAM,GAAAC,CAAG,EAA+C,CACxF,KAAM,CAACC,EAAOC,CAAQ,KAAI,YAAkB,EAAK,EAC3C,CAAE,WAAAC,EAAY,WAAAC,EAAY,sBAAAC,EAAuB,uBAAAC,CAAuB,KAAI,qBAAkB,EAC9F,CAAE,MAAAC,CAAM,KAAI,sBAAmB,EAC/BC,EAAU,iBAAe,SAASD,CAAK,EAEvCE,KAAoB,eAAaC,GAA+B,CAGpE,MAFA,iBAAc,CAAE,SAAU,YAAa,MAAOA,EAAa,IAAK,CAAC,EAE7DA,EAAa,KACf,OAAQA,EAAa,KAAM,CACzB,IAAK,aACHJ,EAAuB,EAAI,EAC3B,MACF,IAAK,UACHD,EAAsB,EAAI,EAC1B,KACJ,CAEJ,EAAG,CAACC,EAAwBD,CAAqB,CAAC,EAElD,SACE,QAAC,aAAU,QAAO,GAAC,GAAIL,EAAI,UAAU,oEACnC,qBAAC,OACC,aAAW,EAAAW,YACT,mGACA,2BACA,kBACA,oBACA,CAACH,GAAW,cACd,EACA,MAAO,CACL,WACE,gIACF,eAAgB,WAClB,EAEA,qBAAC,OACC,aAAW,EAAAG,YACT,6GACF,EAEA,qBAAC,OAAI,UAAU,gDAC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AS,IAAM,CACbJ,EAAkBG,CAAI,CACxB,EAEC,SAAAA,EAAK,MARDC,CASP,CACD,EACH,GACF,EACCZ,MACC,OAAC,OACC,KAAK,SACL,SAAU,EACV,UAAU,qBACV,QAAS,IAAMC,EAAS,EAAK,EAC7B,UAAWY,GAAKA,EAAE,MAAQ,UAAYZ,EAAS,EAAK,EACtD,GAEJ,CAEJ",
6
- "names": ["creditsInfoCard_exports", "__export", "CreditsInfoCard", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_react", "import_provider", "import_utils", "import_lib", "import_constants", "copy", "id", "hover", "setHover", "creditInfo", "pageCommon", "setOpenMyRewardsModal", "setOpenActivitiesModal", "brand", "rounded", "handleButtonClick", "buttonConfig", "cn", "item", "index", "e"]
4
+ "sourcesContent": ["import { Button, Container, Text } from '@anker-in/headless-ui'\n\nimport { useCallback, useState } from 'react'\nimport { useCreditsContext } from '../context/provider'\nimport { numberFormat } from '../context/utils'\nimport { gaNormalClick, classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\ntype ButtonConfig = {\n text: string\n type: 'activities' | 'rewards'\n}\nexport type CreditsInfoCardCopy = {\n balanceLabel: string\n comingSoonLabel: string\n comingSoonTips: string\n buttons: ButtonConfig[]\n}\n\nexport function CreditsInfoCard({ copy, id }: { copy: CreditsInfoCardCopy; id?: string }) {\n const [hover, setHover] = useState<boolean>(false)\n const { creditInfo, pageCommon, setOpenMyRewardsModal, setOpenActivitiesModal } = useCreditsContext()\n const { brand, locale } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const handleButtonClick = useCallback((buttonConfig: ButtonConfig) => {\n gaNormalClick({ position: 'info_card', label: buttonConfig.text })\n\n if (buttonConfig.type) {\n switch (buttonConfig.type) {\n case 'activities':\n setOpenActivitiesModal(true)\n break\n case 'rewards':\n setOpenMyRewardsModal(true)\n break\n }\n }\n }, [setOpenActivitiesModal, setOpenMyRewardsModal])\n\n return (\n <Container asChild id={id} className=\"-mb-[86px] -translate-y-[86px] x:-mb-[30px] x:-translate-y-[30px]\">\n <div\n className={cn(\n 'mx-auto flex justify-between items-center rounded-[12px] border border-white px-[24px] py-[40px]',\n 'l:flex-col l:items-start',\n 'min-l:px-[48px]',\n 'min-xl:px-[100px]',\n !rounded && 'rounded-none'\n )}\n style={{\n background:\n 'linear-gradient(119.61deg, rgba(250, 250, 250, 0.6) 38.58%, rgba(255, 255, 255, 0.6) 63.73%, rgba(249, 252, 255, 0.6) 89.37%)',\n backdropFilter: 'blur(8px)',\n }}\n >\n <div\n className={cn(\n 'grid grid-cols-2 gap-[24px] font-bold l:w-full md:grid-cols-1 md:flex-col md:gap-[16px] min-md:items-center'\n )}\n >\n <div className=\"mr-[80px] md:mr-[0] md:flex-1 md-xl:mr-[64px]\">\n <div\n className={cn(\n 'mb-[24px] text-[14px] font-bold l:mb-[6px] xl:text-[16px] min-md:text-[18px] l-xl:mb-[16px]'\n )}\n >\n {copy.balanceLabel}\n </div>\n <div className=\"flex items-baseline\">\n <div\n className={cn(\n 'mr-[8px] text-[36px] font-extrabold text-brand-color-1',\n 'min-md:text-[44px]',\n 'min-xl:text-[56px]'\n )}\n >\n {creditInfo ? numberFormat(creditInfo.available_credit, locale) : 0}\n </div>\n <div className=\"text-[16px]\">{pageCommon?.pointUnit}</div>\n </div>\n </div>\n <div className=\"w-fit md:flex-1\">\n <div className={cn('mb-[24px] flex text-[18px] l:mb-[6px] l:text-[14px] l-xl:mb-[16px]')}>\n <Text className=\"text-[14px] font-bold xl:text-[16px] min-md:text-[18px]\" html={copy.comingSoonLabel} />\n {copy.comingSoonTips && (\n <div className=\"group relative ml-[4px] flex cursor-pointer items-start\">\n <Text\n as=\"div\"\n html={pageCommon?.infoIcon}\n className=\"size-[18px] cursor-pointer [&_svg]:size-full\"\n onClick={() => {\n if (hover) {\n setHover(false)\n } else {\n setHover(true)\n setTimeout(() => {\n setHover(false)\n }, 5000)\n }\n }}\n />\n <div\n className={cn(\n 'absolute -bottom-[12px] -left-[32px] z-10 w-[356px] translate-y-full md:w-[276px]',\n hover ? 'block' : 'hidden'\n )}\n >\n <div\n className={cn(\n 'relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow',\n !rounded && 'rounded-none'\n )}\n >\n <Text size=\"2\" html={copy.comingSoonTips} className=\"desktop:text-[18px]\" />\n <div\n className={cn(\n 'absolute -top-[10px] left-[40px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]',\n !rounded && 'rounded-none'\n )}\n />\n </div>\n </div>\n </div>\n )}\n </div>\n <div className=\"flex items-baseline \">\n <div className={cn('mr-[8px] text-[36px] font-extrabold', 'min-l:text-[44px]', 'min-xl:text-[56px]')}>\n {creditInfo ? numberFormat(creditInfo.pending_credit, locale) : 0}\n </div>\n <div className=\"text-[16px]\">{pageCommon?.pointUnit}</div>\n </div>\n </div>\n </div>\n <div\n className={cn(\n 'grid w-fit md:w-full l:mt-[32px] l:gap-[12px] gap-[16px] l:pl-0 pl-[48px] md-l:grid-cols-2'\n )}\n >\n {copy.buttons?.map((item, index) => (\n <Button\n key={index}\n variant={index === 0 ? 'secondary' : 'primary'}\n size=\"lg\"\n className=\"min-w-[156px] laptop:min-w-[189px]\"\n onClick={() => {\n handleButtonClick(item)\n }}\n >\n {item.text}\n </Button>\n ))}\n </div>\n </div>\n {hover && (\n <div\n role=\"button\"\n tabIndex={0}\n className=\"fixed inset-0 z-10\"\n onClick={() => setHover(false)}\n onKeyDown={e => e.key === 'Escape' && setHover(false)}\n />\n )}\n </Container>\n )\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GA8DY,IAAAI,EAAA,6BA9DZC,EAAwC,iCAExCC,EAAsC,iBACtCC,EAAkC,+BAClCC,EAA6B,4BAC7BC,EAAoE,yBACpEC,EAA+B,8BAaxB,SAASR,EAAgB,CAAE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AAU,+CACV,QAAS,IAAM,CACTH,EACFC,EAAS,EAAK,GAEdA,EAAS,EAAI,EACb,WAAW,IAAM,CACfA,EAAS,EAAK,CAChB,EAAG,GAAI,EAEX,EACF,KACA,OAAC,OACC,aAAW,EAAAU,YACT,oFACAX,EAAQ,QAAU,QACpB,EAEA,oBAAC,OACC,aAAW,EAAAW,YACT,0FACA,CAACH,GAAW,cACd,EAEA,oBAAC,QAAK,KAAK,IAAI,KAAMV,EAAK,eAAgB,UAAU,sBAAsB,KAC1E,OAAC,OACC,aAAW,EAAAa,YACT,mHACA,CAACH,GAAW,cACd,EACF,GACF,EACF,GACF,GAEJ,KACA,QAAC,OAAI,UAAU,uBACb,oBAAC,OAAI,aAAW,EAAAG,YAAG,sCAAuC,oBAAqB,oBAAoB,EAChG,SAAAT,KAAa,gBAAaA,EAAW,eAAgBK,CAAM,EAAI,EAClE,KACA,OAAC,OAAI,UAAU,cAAe,SAAAJ,GAAY,UAAU,GACtD,GACF,GACF,KACA,OAAC,OACC,aAAW,EAAAQ,YACT,4FACF,EAEC,SAAAb,EAAK,SAAS,IAAI,CAACc,EAAMC,OACxB,OAAC,UAEC,QAASA,IAAU,EAAI,YAAc,UACrC,KAAK,KACL,UAAU,qCACV,QAAS,IAAM,CACbJ,EAAkBG,CAAI,CACxB,EAEC,SAAAA,EAAK,MARDC,CASP,CACD,EACH,GACF,EACCb,MACC,OAAC,OACC,KAAK,SACL,SAAU,EACV,UAAU,qBACV,QAAS,IAAMC,EAAS,EAAK,EAC7B,UAAWa,GAAKA,EAAE,MAAQ,UAAYb,EAAS,EAAK,EACtD,GAEJ,CAEJ",
6
+ "names": ["creditsInfoCard_exports", "__export", "CreditsInfoCard", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_react", "import_provider", "import_utils", "import_lib", "import_constants", "copy", "id", "hover", "setHover", "creditInfo", "pageCommon", "setOpenMyRewardsModal", "setOpenActivitiesModal", "brand", "locale", "rounded", "handleButtonClick", "buttonConfig", "cn", "item", "index", "e"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var ee=Object.create;var y=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var ae=(e,o)=>{for(var i in o)y(e,i,{get:o[i],enumerable:!0})},F=(e,o,i,C)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of re(o))!ne.call(e,c)&&c!==i&&y(e,c,{get:()=>o[c],enumerable:!(C=te(o,c))||C.enumerable});return e};var g=(e,o,i)=>(i=e!=null?ee(oe(e)):{},F(o||!e||!e.__esModule?y(i,"default",{value:e,enumerable:!0}):i,e)),ie=e=>F(y({},"__esModule",{value:!0}),e);var de={};ae(de,{CreditsRedeemList:()=>se});module.exports=ie(de);var r=require("react/jsx-runtime"),l=require("@anker-in/headless-ui"),R=g(require("classnames")),d=require("react"),O=g(require("./RedeemCouponModal")),w=g(require("./RedeemProductModal")),H=g(require("./RedeemVirtualProductModal")),$=require("../context/provider"),z=g(require("../context/hooks/useRedeemableList")),a=require("../context/const"),p=require("@anker-in/lib"),B=require("./RedeemableItem"),U=require("../../../constants"),V=g(require("../modal/RulesModal")),j=require("../../../components/registration"),q=require("../context/utils"),J=g(require("../context/hooks/useMyRewards"));const se=({copy:e,id:o})=>{const{profile:i,openSignUpPopup:C,gtm:{pageGroup:c},pageCommon:h,creditInfo:K}=(0,$.useCreditsContext)(),{authCodeActivate:T}=(0,j.useRegistration)(),{brand:k}=(0,p.useHeadlessContext)(),I=U.ROUNDED_BRANDS.includes(k),v=Object.keys(i||{}).length>0,[L,Q]=(0,d.useState)(e.list?.[0]?.label||""),[s,x]=(0,d.useState)(void 0),[N,E]=(0,d.useState)(),{listLoading:W,redeemableList:M,getRedeemableList:A}=(0,z.default)(),{myRewards:P}=(0,J.default)({page:1,pageSize:100,consumeType:a.AlpcConsumeType.ExternalProduct}),f=(0,d.useMemo)(()=>({...h?.redeemModal||{},...e.redeemModal||{}}),[e.redeemModal,h?.redeemModal]),b=(0,d.useMemo)(()=>M.map(t=>({id:t.id.toString(),title:t.name,consumeCredits:t.consume_credits,remainingInventory:t.remaining_inventory,isLimited:!!t.is_limited,consumeType:t.consume_type,handle:t.sku_handle,sku:t.goods_sku,image:t.goods_url})),[e.list,L,M]),X=b.map(t=>t.handle),{data:G}=(0,p.useProductsByHandles)({handles:X}),Y=(0,d.useMemo)(()=>(e.list?.find(n=>n.label===L)?.list||[]).filter(n=>b.some(u=>String(u.id)===String(n.id))).map(n=>{const u=b.find(m=>String(m.id)===String(n.id)),_=G?.find(m=>m.handle===u?.handle),D=_?.variants.find(m=>m.sku===u?.sku);if(u?.isLimited&&(!u?.remainingInventory||u.remainingInventory<=0)||u?.consumeType===a.AlpcConsumeType.Product&&(!_||!D))return null;const Z=n.type===a.ConsumeType.GoGift&&v&&P.some(m=>m.rule_id===Number(n.id));return{alpc:b.find(m=>String(m.id)===String(n.id)),config:n,product:_,variant:D,hasRedeemed:Z}}).filter(n=>n!==null),[b,G,v,P]),S=(0,d.useCallback)(t=>{t===a.AlpcErrorCode.CodeLpcRuleInventoryNotEnough&&A()},[A]);return(0,r.jsxs)(l.Container,{id:o,className:(0,R.default)("relative bg-[#F5F5F7]"),children:[(0,r.jsx)(l.Heading,{as:"h2",size:"4",html:e.title}),v&&e.availableCredits&&(0,r.jsx)("p",{className:"mt-[12px] text-[20px] l-xxl:text-[18px] l:text-[16px] font-bold text-[#4A4C56]",children:e.availableCredits.includes("$credits")?(0,r.jsxs)(r.Fragment,{children:[e.availableCredits.split("$credits")[0],(0,r.jsx)("span",{className:(0,p.classNames)("text-brand-color-0",k==="ankersolix"&&"bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-[43%] to-[#00db84] bg-clip-text text-transparent"),children:(0,q.numberFormat)(K?.available_credit||0).toString()}),e.availableCredits.split("$credits")[1]||""]}):e.availableCredits}),(0,r.jsx)(l.Tabs,{shape:I?"rounded":"square",align:"left",className:(0,R.default)("py-[24px] md:justify-center"),value:L.toString(),onValueChange:t=>{Q(t),(0,p.gaTrack)({event:"ga4Event",event_name:"lp_navigation",event_parameters:{navigation:t,page_group:c}})},children:(0,r.jsx)(l.TabsList,{children:(e.list||[]).map(t=>(0,r.jsx)(l.TabsTrigger,{value:t.label,children:t.label},t.label))})}),!!b?.length&&!W&&(0,r.jsx)("div",{className:(0,R.default)("relative grid grid-cols-4 gap-[16px] md:grid-cols-2 md:gap-[12px] md-xl:grid-cols-3"),children:Y?.map(t=>(0,r.jsx)(B.RedeemableItem,{copy:e,item:t,onRedeem:n=>{v?!i?.activated&&!T.isActivateSuccess?(T.setAutoSendEmail(!0),T.open()):x(n):C()},onRulesOpen:E},t?.alpc?.id))}),(s?.config?.type===a.ConsumeType.Coupon||s?.config?.type===a.ConsumeType.ShippingCoupon)&&f?.coupon&&s&&(0,r.jsx)(O.default,{item:s,copy:f,onError:S,onClose:()=>{x(void 0)}}),s?.config?.type===a.ConsumeType.Product&&f?.product&&s&&(0,r.jsx)(w.default,{item:s,copy:f,onError:S,onClose:()=>{x(void 0)}}),(s?.config?.type===a.ConsumeType.GiftCard||s?.config?.type===a.ConsumeType.GoGift)&&f?.virtualProduct&&s&&(0,r.jsx)(H.default,{item:s,copy:f,onError:S,onClose:()=>{x(void 0)}}),N&&(0,r.jsx)(V.default,{overlayClassName:"md:px-[16px] md:items-center",className:(0,p.classNames)("md:h-fit md:rounded-b-[16px]",!I&&"md:rounded-none"),isOpen:N.length>0,onClose:()=>E([]),titleClassName:"border-b-transparent h-[56px]",rules:N,scrollClassName:"md:mt-[8px] md:mb-[24px] md:pt-0",title:h?.ruleLabel,ruleClassName:"text-[#1d1d1f] font-bold"})]})};
1
+ "use strict";var te=Object.create;var y=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty;var ie=(e,o)=>{for(var i in o)y(e,i,{get:o[i],enumerable:!0})},F=(e,o,i,C)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of oe(o))!ae.call(e,c)&&c!==i&&y(e,c,{get:()=>o[c],enumerable:!(C=re(o,c))||C.enumerable});return e};var g=(e,o,i)=>(i=e!=null?te(ne(e)):{},F(o||!e||!e.__esModule?y(i,"default",{value:e,enumerable:!0}):i,e)),se=e=>F(y({},"__esModule",{value:!0}),e);var le={};ie(le,{CreditsRedeemList:()=>de});module.exports=se(le);var r=require("react/jsx-runtime"),l=require("@anker-in/headless-ui"),R=g(require("classnames")),d=require("react"),O=g(require("./RedeemCouponModal")),w=g(require("./RedeemProductModal")),H=g(require("./RedeemVirtualProductModal")),$=require("../context/provider"),z=g(require("../context/hooks/useRedeemableList")),a=require("../context/const"),p=require("@anker-in/lib"),B=require("./RedeemableItem"),U=require("../../../constants"),V=g(require("../modal/RulesModal")),j=require("../../../components/registration"),q=require("../context/utils"),J=g(require("../context/hooks/useMyRewards"));const de=({copy:e,id:o})=>{const{profile:i,openSignUpPopup:C,gtm:{pageGroup:c},pageCommon:h,creditInfo:K}=(0,$.useCreditsContext)(),{authCodeActivate:T}=(0,j.useRegistration)(),{brand:k,locale:Q}=(0,p.useHeadlessContext)(),I=U.ROUNDED_BRANDS.includes(k),v=Object.keys(i||{}).length>0,[L,W]=(0,d.useState)(e.list?.[0]?.label||""),[s,x]=(0,d.useState)(void 0),[N,E]=(0,d.useState)(),{listLoading:X,redeemableList:M,getRedeemableList:A}=(0,z.default)(),{myRewards:P}=(0,J.default)({page:1,pageSize:100,consumeType:a.AlpcConsumeType.ExternalProduct}),f=(0,d.useMemo)(()=>({...h?.redeemModal||{},...e.redeemModal||{}}),[e.redeemModal,h?.redeemModal]),b=(0,d.useMemo)(()=>M.map(t=>({id:t.id.toString(),title:t.name,consumeCredits:t.consume_credits,remainingInventory:t.remaining_inventory,isLimited:!!t.is_limited,consumeType:t.consume_type,handle:t.sku_handle,sku:t.goods_sku,image:t.goods_url})),[e.list,L,M]),Y=b.map(t=>t.handle),{data:G}=(0,p.useProductsByHandles)({handles:Y}),Z=(0,d.useMemo)(()=>(e.list?.find(n=>n.label===L)?.list||[]).filter(n=>b.some(u=>String(u.id)===String(n.id))).map(n=>{const u=b.find(m=>String(m.id)===String(n.id)),_=G?.find(m=>m.handle===u?.handle),D=_?.variants.find(m=>m.sku===u?.sku);if(u?.isLimited&&(!u?.remainingInventory||u.remainingInventory<=0)||u?.consumeType===a.AlpcConsumeType.Product&&(!_||!D))return null;const ee=n.type===a.ConsumeType.GoGift&&v&&P.some(m=>m.rule_id===Number(n.id));return{alpc:b.find(m=>String(m.id)===String(n.id)),config:n,product:_,variant:D,hasRedeemed:ee}}).filter(n=>n!==null),[b,G,v,P]),S=(0,d.useCallback)(t=>{t===a.AlpcErrorCode.CodeLpcRuleInventoryNotEnough&&A()},[A]);return(0,r.jsxs)(l.Container,{id:o,className:(0,R.default)("relative bg-[#F5F5F7]"),children:[(0,r.jsx)(l.Heading,{as:"h2",size:"4",html:e.title}),v&&e.availableCredits&&(0,r.jsx)("p",{className:"mt-[12px] text-[20px] l-xxl:text-[18px] l:text-[16px] font-bold text-[#4A4C56]",children:e.availableCredits.includes("$credits")?(0,r.jsxs)(r.Fragment,{children:[e.availableCredits.split("$credits")[0],(0,r.jsx)("span",{className:(0,p.classNames)("text-brand-color-0",k==="ankersolix"&&"bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-[43%] to-[#00db84] bg-clip-text text-transparent"),children:(0,q.numberFormat)(K?.available_credit||0,Q).toString()}),e.availableCredits.split("$credits")[1]||""]}):e.availableCredits}),(0,r.jsx)(l.Tabs,{shape:I?"rounded":"square",align:"left",className:(0,R.default)("py-[24px] md:justify-center"),value:L.toString(),onValueChange:t=>{W(t),(0,p.gaTrack)({event:"ga4Event",event_name:"lp_navigation",event_parameters:{navigation:t,page_group:c}})},children:(0,r.jsx)(l.TabsList,{children:(e.list||[]).map(t=>(0,r.jsx)(l.TabsTrigger,{value:t.label,children:t.label},t.label))})}),!!b?.length&&!X&&(0,r.jsx)("div",{className:(0,R.default)("relative grid grid-cols-4 gap-[16px] md:grid-cols-2 md:gap-[12px] md-xl:grid-cols-3"),children:Z?.map(t=>(0,r.jsx)(B.RedeemableItem,{copy:e,item:t,onRedeem:n=>{v?!i?.activated&&!T.isActivateSuccess?(T.setAutoSendEmail(!0),T.open()):x(n):C()},onRulesOpen:E},t?.alpc?.id))}),(s?.config?.type===a.ConsumeType.Coupon||s?.config?.type===a.ConsumeType.ShippingCoupon)&&f?.coupon&&s&&(0,r.jsx)(O.default,{item:s,copy:f,onError:S,onClose:()=>{x(void 0)}}),s?.config?.type===a.ConsumeType.Product&&f?.product&&s&&(0,r.jsx)(w.default,{item:s,copy:f,onError:S,onClose:()=>{x(void 0)}}),(s?.config?.type===a.ConsumeType.GiftCard||s?.config?.type===a.ConsumeType.GoGift)&&f?.virtualProduct&&s&&(0,r.jsx)(H.default,{item:s,copy:f,onError:S,onClose:()=>{x(void 0)}}),N&&(0,r.jsx)(V.default,{overlayClassName:"md:px-[16px] md:items-center",className:(0,p.classNames)("md:h-fit md:rounded-b-[16px]",!I&&"md:rounded-none"),isOpen:N.length>0,onClose:()=>E([]),titleClassName:"border-b-transparent h-[56px]",rules:N,scrollClassName:"md:mt-[8px] md:mb-[24px] md:pt-0",title:h?.ruleLabel,ruleClassName:"text-[#1d1d1f] font-bold"})]})};
2
2
  //# sourceMappingURL=CreditsRedeemList.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/creditsRedeemList/CreditsRedeemList.tsx"],
4
- "sourcesContent": ["import { Container, Heading, Tabs, TabsList, TabsTrigger } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCallback, useMemo, useState } from 'react'\n\nimport RedeemCouponModal from './RedeemCouponModal'\nimport RedeemProductModal from './RedeemProductModal'\nimport RedeemVirtualProductModal from './RedeemVirtualProductModal'\nimport { useCreditsContext } from '../context/provider'\nimport useRedeemableList from '../context/hooks/useRedeemableList'\nimport { AlpcConsumeType, AlpcErrorCode, ConsumeType } from '../context/const'\nimport { useHeadlessContext, useProductsByHandles, gaTrack, classNames as cn } from '@anker-in/lib'\nimport type { RedeemableItem as RedeemableItemType } from '../type'\nimport { RedeemableItem } from './RedeemableItem'\nimport { ROUNDED_BRANDS } from '../../../constants'\nimport RulesModal from '../modal/RulesModal'\nimport { CreditsRedeemListCopy } from './type'\nimport { useRegistration } from '../../../components/registration'\nimport { numberFormat } from '../context/utils'\nimport useMyRewards from '../context/hooks/useMyRewards'\n\nexport const CreditsRedeemList = ({ copy, id }: { copy: CreditsRedeemListCopy; id?: string }) => {\n const {\n profile,\n openSignUpPopup,\n gtm: { pageGroup },\n pageCommon,\n creditInfo,\n } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const isLogin = Object.keys(profile || {}).length > 0\n\n const [activeTab, setActiveTab] = useState<string>(copy.list?.[0]?.label || '')\n\n const [popRedeemData, setPopRedeemData] = useState<RedeemableItemType | undefined>(undefined)\n\n const [rules, setRules] = useState<string | string[]>()\n\n const { listLoading, redeemableList, getRedeemableList } = useRedeemableList()\n\n // \u83B7\u53D6\u7528\u6237\u7684 ExternalProduct \u5151\u6362\u8BB0\u5F55\n const { myRewards } = useMyRewards({\n page: 1,\n pageSize: 100,\n consumeType: AlpcConsumeType.ExternalProduct,\n })\n\n // \u5408\u5E76 redeemModal \u6587\u6848\uFF0C\u4F18\u5148\u4F7F\u7528 copy.redeemModal\uFF0Cfallback \u5230 pageCommon.redeemModal\n const redeemModalCopy = useMemo(() => {\n return {\n ...(pageCommon?.redeemModal || {}),\n ...(copy.redeemModal || {}),\n }\n }, [copy.redeemModal, pageCommon?.redeemModal])\n\n const alpcList = useMemo(() => {\n return redeemableList.map(item => {\n return {\n id: item.id.toString(),\n title: item.name,\n consumeCredits: item.consume_credits,\n remainingInventory: item.remaining_inventory,\n isLimited: !!item.is_limited,\n consumeType: item.consume_type,\n handle: item.sku_handle,\n sku: item.goods_sku,\n image: item.goods_url,\n }\n })\n }, [copy.list, activeTab, redeemableList])\n\n const handles = alpcList.map(item => item.handle)\n const { data: products } = useProductsByHandles({ handles })\n\n const list = useMemo(() => {\n const currentList = copy.list?.find(item => item.label === activeTab)\n return (currentList?.list || [])\n .filter(item => alpcList.some(alpcItem => String(alpcItem.id) === String(item.id)))\n .map(item => {\n const alpcItem = alpcList.find(alpcItem => String(alpcItem.id) === String(item.id))\n const product = products?.find(product => product.handle === alpcItem?.handle)\n const variant = product?.variants.find(variant => variant.sku === alpcItem?.sku)\n // \u8FC7\u6EE4\u6389\u5E93\u5B58\u4E0D\u8DB3\u7684\u5546\u54C1\n if (alpcItem?.isLimited && (!alpcItem?.remainingInventory || alpcItem.remainingInventory <= 0)) return null\n if (alpcItem?.consumeType === AlpcConsumeType.Product && (!product || !variant)) return null\n\n // \u68C0\u67E5 GoGift \u662F\u5426\u5DF2\u7ECF\u5151\u6362\u8FC7\uFF08\u53EA\u6709 GoGift \u9650\u5236\u5151\u6362\u4E00\u6B21\uFF09\n const hasRedeemed = item.type === ConsumeType.GoGift &&\n isLogin &&\n myRewards.some(reward => reward.rule_id === Number(item.id))\n\n return {\n alpc: alpcList.find(alpcItem => String(alpcItem.id) === String(item.id)),\n config: item,\n product,\n variant,\n hasRedeemed,\n }\n })\n .filter(item => item !== null) as unknown as RedeemableItemType[]\n }, [alpcList, products, isLogin, myRewards])\n\n const handleRedeemError = useCallback(\n (errorCode: AlpcErrorCode) => {\n if (errorCode === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n getRedeemableList()\n }\n },\n [getRedeemableList]\n )\n\n return (\n <Container id={id} className={classNames('relative bg-[#F5F5F7]')}>\n <Heading as=\"h2\" size=\"4\" html={copy.title} />\n\n {/* \u53EF\u7528\u79EF\u5206\u5C55\u793A */}\n {isLogin && copy.availableCredits && (\n <p className=\"mt-[12px] text-[20px] l-xxl:text-[18px] l:text-[16px] font-bold text-[#4A4C56]\">\n {copy.availableCredits.includes('$credits') ? (\n <>\n {copy.availableCredits.split('$credits')[0]}\n <span\n className={cn(\n 'text-brand-color-0',\n brand === 'ankersolix' &&\n 'bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-[43%] to-[#00db84] bg-clip-text text-transparent'\n )}\n >\n {numberFormat(creditInfo?.available_credit || 0).toString()}\n </span>\n {copy.availableCredits.split('$credits')[1] || ''}\n </>\n ) : (\n copy.availableCredits\n )}\n </p>\n )}\n\n <Tabs\n shape={rounded ? 'rounded' : 'square'}\n align=\"left\"\n className={classNames('py-[24px] md:justify-center')}\n value={activeTab.toString()}\n onValueChange={value => {\n setActiveTab(value)\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_navigation',\n event_parameters: {\n navigation: value,\n page_group: pageGroup,\n },\n })\n }}\n >\n <TabsList>\n {(copy.list || []).map(item => (\n <TabsTrigger key={item.label} value={item.label}>\n {item.label}\n </TabsTrigger>\n ))}\n </TabsList>\n </Tabs>\n {/* PC\u7AEF */}\n {!!alpcList?.length && !listLoading && (\n <div\n className={classNames('relative grid grid-cols-4 gap-[16px] md:grid-cols-2 md:gap-[12px] md-xl:grid-cols-3')}\n >\n {list?.map(item => (\n <RedeemableItem\n key={item?.alpc?.id}\n copy={copy}\n item={item}\n onRedeem={(item: RedeemableItemType) => {\n if (!isLogin) {\n openSignUpPopup()\n } else if (!profile?.activated && !authCodeActivate.isActivateSuccess) {\n authCodeActivate.setAutoSendEmail(true)\n authCodeActivate.open()\n } else {\n setPopRedeemData(item)\n }\n }}\n onRulesOpen={setRules}\n />\n ))}\n </div>\n )}\n\n {(popRedeemData?.config?.type === ConsumeType.Coupon ||\n popRedeemData?.config?.type === ConsumeType.ShippingCoupon) &&\n redeemModalCopy?.coupon &&\n popRedeemData && (\n <RedeemCouponModal\n item={popRedeemData}\n copy={redeemModalCopy}\n onError={handleRedeemError}\n onClose={() => {\n setPopRedeemData(undefined)\n }}\n />\n )}\n {popRedeemData?.config?.type === ConsumeType.Product && redeemModalCopy?.product && popRedeemData && (\n <RedeemProductModal\n item={popRedeemData}\n copy={redeemModalCopy}\n onError={handleRedeemError}\n onClose={() => {\n setPopRedeemData(undefined)\n }}\n />\n )}\n {(popRedeemData?.config?.type === ConsumeType.GiftCard || popRedeemData?.config?.type === ConsumeType.GoGift) &&\n redeemModalCopy?.virtualProduct &&\n popRedeemData && (\n <RedeemVirtualProductModal\n item={popRedeemData}\n copy={redeemModalCopy}\n onError={handleRedeemError}\n onClose={() => {\n setPopRedeemData(undefined)\n }}\n />\n )}\n {rules && (\n <RulesModal\n overlayClassName=\"md:px-[16px] md:items-center\"\n className={cn('md:h-fit md:rounded-b-[16px]', !rounded && 'md:rounded-none')}\n isOpen={rules.length > 0}\n onClose={() => setRules([])}\n titleClassName=\"border-b-transparent h-[56px]\"\n rules={rules}\n scrollClassName=\"md:mt-[8px] md:mb-[24px] md:pt-0\"\n title={pageCommon?.ruleLabel}\n ruleClassName=\"text-[#1d1d1f] font-bold\"\n />\n )}\n </Container>\n )\n}\n"],
5
- "mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,uBAAAE,KAAA,eAAAC,GAAAH,IAmHM,IAAAI,EAAA,6BAnHNC,EAAgE,iCAChEC,EAAuB,yBACvBC,EAA+C,iBAE/CC,EAA8B,kCAC9BC,EAA+B,mCAC/BC,EAAsC,0CACtCC,EAAkC,+BAClCC,EAA8B,iDAC9BC,EAA4D,4BAC5DC,EAAoF,yBAEpFC,EAA+B,4BAC/BC,EAA+B,8BAC/BC,EAAuB,kCAEvBC,EAAgC,4CAChCC,EAA6B,4BAC7BC,EAAyB,4CAElB,MAAMlB,GAAoB,CAAC,CAAE,KAAAmB,EAAM,GAAAC,CAAG,IAAoD,CAC/F,KAAM,CACJ,QAAAC,EACA,gBAAAC,EACA,IAAK,CAAE,UAAAC,CAAU,EACjB,WAAAC,EACA,WAAAC,CACF,KAAI,qBAAkB,EAChB,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cAAY,UAAYA,GAAe,QAAQ,OAAS,cAAY,SACpGU,GAAiB,gBACjBV,MACE,OAAC,EAAA4B,QAAA,CACC,KAAM5B,EACN,KAAMU,EACN,QAASW,EACT,QAAS,IAAM,CACbpB,EAAiB,MAAS,CAC5B,EACF,EAEHC,MACC,OAAC,EAAA2B,QAAA,CACC,iBAAiB,+BACjB,aAAW,EAAAL,YAAG,+BAAgC,CAAC5B,GAAW,iBAAiB,EAC3E,OAAQM,EAAM,OAAS,EACvB,QAAS,IAAMC,EAAS,CAAC,CAAC,EAC1B,eAAe,gCACf,MAAOD,EACP,gBAAgB,mCAChB,MAAOV,GAAY,UACnB,cAAc,2BAChB,GAEJ,CAEJ",
6
- "names": ["CreditsRedeemList_exports", "__export", "CreditsRedeemList", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_classnames", "import_react", "import_RedeemCouponModal", "import_RedeemProductModal", "import_RedeemVirtualProductModal", "import_provider", "import_useRedeemableList", "import_const", "import_lib", "import_RedeemableItem", "import_constants", "import_RulesModal", "import_registration", "import_utils", "import_useMyRewards", "copy", "id", "profile", "openSignUpPopup", "pageGroup", "pageCommon", "creditInfo", "authCodeActivate", "brand", "rounded", "isLogin", "activeTab", "setActiveTab", "popRedeemData", "setPopRedeemData", "rules", "setRules", "listLoading", "redeemableList", "getRedeemableList", "useRedeemableList", "myRewards", "useMyRewards", "redeemModalCopy", "alpcList", "item", "handles", "products", "list", "alpcItem", "product", "variant", "hasRedeemed", "reward", "handleRedeemError", "errorCode", "classNames", "cn", "value", "RedeemCouponModal", "RedeemProductModal", "RedeemVirtualProductModal", "RulesModal"]
4
+ "sourcesContent": ["import { Container, Heading, Tabs, TabsList, TabsTrigger } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCallback, useMemo, useState } from 'react'\n\nimport RedeemCouponModal from './RedeemCouponModal'\nimport RedeemProductModal from './RedeemProductModal'\nimport RedeemVirtualProductModal from './RedeemVirtualProductModal'\nimport { useCreditsContext } from '../context/provider'\nimport useRedeemableList from '../context/hooks/useRedeemableList'\nimport { AlpcConsumeType, AlpcErrorCode, ConsumeType } from '../context/const'\nimport { useHeadlessContext, useProductsByHandles, gaTrack, classNames as cn } from '@anker-in/lib'\nimport type { RedeemableItem as RedeemableItemType } from '../type'\nimport { RedeemableItem } from './RedeemableItem'\nimport { ROUNDED_BRANDS } from '../../../constants'\nimport RulesModal from '../modal/RulesModal'\nimport { CreditsRedeemListCopy } from './type'\nimport { useRegistration } from '../../../components/registration'\nimport { numberFormat } from '../context/utils'\nimport useMyRewards from '../context/hooks/useMyRewards'\n\nexport const CreditsRedeemList = ({ copy, id }: { copy: CreditsRedeemListCopy; id?: string }) => {\n const {\n profile,\n openSignUpPopup,\n gtm: { pageGroup },\n pageCommon,\n creditInfo,\n } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand, locale } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const isLogin = Object.keys(profile || {}).length > 0\n\n const [activeTab, setActiveTab] = useState<string>(copy.list?.[0]?.label || '')\n\n const [popRedeemData, setPopRedeemData] = useState<RedeemableItemType | undefined>(undefined)\n\n const [rules, setRules] = useState<string | string[]>()\n\n const { listLoading, redeemableList, getRedeemableList } = useRedeemableList()\n\n // \u83B7\u53D6\u7528\u6237\u7684 ExternalProduct \u5151\u6362\u8BB0\u5F55\n const { myRewards } = useMyRewards({\n page: 1,\n pageSize: 100,\n consumeType: AlpcConsumeType.ExternalProduct,\n })\n\n // \u5408\u5E76 redeemModal \u6587\u6848\uFF0C\u4F18\u5148\u4F7F\u7528 copy.redeemModal\uFF0Cfallback \u5230 pageCommon.redeemModal\n const redeemModalCopy = useMemo(() => {\n return {\n ...(pageCommon?.redeemModal || {}),\n ...(copy.redeemModal || {}),\n }\n }, [copy.redeemModal, pageCommon?.redeemModal])\n\n const alpcList = useMemo(() => {\n return redeemableList.map(item => {\n return {\n id: item.id.toString(),\n title: item.name,\n consumeCredits: item.consume_credits,\n remainingInventory: item.remaining_inventory,\n isLimited: !!item.is_limited,\n consumeType: item.consume_type,\n handle: item.sku_handle,\n sku: item.goods_sku,\n image: item.goods_url,\n }\n })\n }, [copy.list, activeTab, redeemableList])\n\n const handles = alpcList.map(item => item.handle)\n const { data: products } = useProductsByHandles({ handles })\n\n const list = useMemo(() => {\n const currentList = copy.list?.find(item => item.label === activeTab)\n return (currentList?.list || [])\n .filter(item => alpcList.some(alpcItem => String(alpcItem.id) === String(item.id)))\n .map(item => {\n const alpcItem = alpcList.find(alpcItem => String(alpcItem.id) === String(item.id))\n const product = products?.find(product => product.handle === alpcItem?.handle)\n const variant = product?.variants.find(variant => variant.sku === alpcItem?.sku)\n // \u8FC7\u6EE4\u6389\u5E93\u5B58\u4E0D\u8DB3\u7684\u5546\u54C1\n if (alpcItem?.isLimited && (!alpcItem?.remainingInventory || alpcItem.remainingInventory <= 0)) return null\n if (alpcItem?.consumeType === AlpcConsumeType.Product && (!product || !variant)) return null\n\n // \u68C0\u67E5 GoGift \u662F\u5426\u5DF2\u7ECF\u5151\u6362\u8FC7\uFF08\u53EA\u6709 GoGift \u9650\u5236\u5151\u6362\u4E00\u6B21\uFF09\n const hasRedeemed = item.type === ConsumeType.GoGift &&\n isLogin &&\n myRewards.some(reward => reward.rule_id === Number(item.id))\n\n return {\n alpc: alpcList.find(alpcItem => String(alpcItem.id) === String(item.id)),\n config: item,\n product,\n variant,\n hasRedeemed,\n }\n })\n .filter(item => item !== null) as unknown as RedeemableItemType[]\n }, [alpcList, products, isLogin, myRewards])\n\n const handleRedeemError = useCallback(\n (errorCode: AlpcErrorCode) => {\n if (errorCode === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n getRedeemableList()\n }\n },\n [getRedeemableList]\n )\n\n return (\n <Container id={id} className={classNames('relative bg-[#F5F5F7]')}>\n <Heading as=\"h2\" size=\"4\" html={copy.title} />\n\n {/* \u53EF\u7528\u79EF\u5206\u5C55\u793A */}\n {isLogin && copy.availableCredits && (\n <p className=\"mt-[12px] text-[20px] l-xxl:text-[18px] l:text-[16px] font-bold text-[#4A4C56]\">\n {copy.availableCredits.includes('$credits') ? (\n <>\n {copy.availableCredits.split('$credits')[0]}\n <span\n className={cn(\n 'text-brand-color-0',\n brand === 'ankersolix' &&\n 'bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-[43%] to-[#00db84] bg-clip-text text-transparent'\n )}\n >\n {numberFormat(creditInfo?.available_credit || 0, locale).toString()}\n </span>\n {copy.availableCredits.split('$credits')[1] || ''}\n </>\n ) : (\n copy.availableCredits\n )}\n </p>\n )}\n\n <Tabs\n shape={rounded ? 'rounded' : 'square'}\n align=\"left\"\n className={classNames('py-[24px] md:justify-center')}\n value={activeTab.toString()}\n onValueChange={value => {\n setActiveTab(value)\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_navigation',\n event_parameters: {\n navigation: value,\n page_group: pageGroup,\n },\n })\n }}\n >\n <TabsList>\n {(copy.list || []).map(item => (\n <TabsTrigger key={item.label} value={item.label}>\n {item.label}\n </TabsTrigger>\n ))}\n </TabsList>\n </Tabs>\n {/* PC\u7AEF */}\n {!!alpcList?.length && !listLoading && (\n <div\n className={classNames('relative grid grid-cols-4 gap-[16px] md:grid-cols-2 md:gap-[12px] md-xl:grid-cols-3')}\n >\n {list?.map(item => (\n <RedeemableItem\n key={item?.alpc?.id}\n copy={copy}\n item={item}\n onRedeem={(item: RedeemableItemType) => {\n if (!isLogin) {\n openSignUpPopup()\n } else if (!profile?.activated && !authCodeActivate.isActivateSuccess) {\n authCodeActivate.setAutoSendEmail(true)\n authCodeActivate.open()\n } else {\n setPopRedeemData(item)\n }\n }}\n onRulesOpen={setRules}\n />\n ))}\n </div>\n )}\n\n {(popRedeemData?.config?.type === ConsumeType.Coupon ||\n popRedeemData?.config?.type === ConsumeType.ShippingCoupon) &&\n redeemModalCopy?.coupon &&\n popRedeemData && (\n <RedeemCouponModal\n item={popRedeemData}\n copy={redeemModalCopy}\n onError={handleRedeemError}\n onClose={() => {\n setPopRedeemData(undefined)\n }}\n />\n )}\n {popRedeemData?.config?.type === ConsumeType.Product && redeemModalCopy?.product && popRedeemData && (\n <RedeemProductModal\n item={popRedeemData}\n copy={redeemModalCopy}\n onError={handleRedeemError}\n onClose={() => {\n setPopRedeemData(undefined)\n }}\n />\n )}\n {(popRedeemData?.config?.type === ConsumeType.GiftCard || popRedeemData?.config?.type === ConsumeType.GoGift) &&\n redeemModalCopy?.virtualProduct &&\n popRedeemData && (\n <RedeemVirtualProductModal\n item={popRedeemData}\n copy={redeemModalCopy}\n onError={handleRedeemError}\n onClose={() => {\n setPopRedeemData(undefined)\n }}\n />\n )}\n {rules && (\n <RulesModal\n overlayClassName=\"md:px-[16px] md:items-center\"\n className={cn('md:h-fit md:rounded-b-[16px]', !rounded && 'md:rounded-none')}\n isOpen={rules.length > 0}\n onClose={() => setRules([])}\n titleClassName=\"border-b-transparent h-[56px]\"\n rules={rules}\n scrollClassName=\"md:mt-[8px] md:mb-[24px] md:pt-0\"\n title={pageCommon?.ruleLabel}\n ruleClassName=\"text-[#1d1d1f] font-bold\"\n />\n )}\n </Container>\n )\n}\n"],
5
+ "mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,uBAAAE,KAAA,eAAAC,GAAAH,IAmHM,IAAAI,EAAA,6BAnHNC,EAAgE,iCAChEC,EAAuB,yBACvBC,EAA+C,iBAE/CC,EAA8B,kCAC9BC,EAA+B,mCAC/BC,EAAsC,0CACtCC,EAAkC,+BAClCC,EAA8B,iDAC9BC,EAA4D,4BAC5DC,EAAoF,yBAEpFC,EAA+B,4BAC/BC,EAA+B,8BAC/BC,EAAuB,kCAEvBC,EAAgC,4CAChCC,EAA6B,4BAC7BC,EAAyB,4CAElB,MAAMlB,GAAoB,CAAC,CAAE,KAAAmB,EAAM,GAAAC,CAAG,IAAoD,CAC/F,KAAM,CACJ,QAAAC,EACA,gBAAAC,EACA,IAAK,CAAE,UAAAC,CAAU,EACjB,WAAAC,EACA,WA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,MAAS,CAC5B,EACF,GAEAD,GAAe,QAAQ,OAAS,cAAY,UAAYA,GAAe,QAAQ,OAAS,cAAY,SACpGU,GAAiB,gBACjBV,MACE,OAAC,EAAA4B,QAAA,CACC,KAAM5B,EACN,KAAMU,EACN,QAASW,EACT,QAAS,IAAM,CACbpB,EAAiB,MAAS,CAC5B,EACF,EAEHC,MACC,OAAC,EAAA2B,QAAA,CACC,iBAAiB,+BACjB,aAAW,EAAAL,YAAG,+BAAgC,CAAC5B,GAAW,iBAAiB,EAC3E,OAAQM,EAAM,OAAS,EACvB,QAAS,IAAMC,EAAS,CAAC,CAAC,EAC1B,eAAe,gCACf,MAAOD,EACP,gBAAgB,mCAChB,MAAOX,GAAY,UACnB,cAAc,2BAChB,GAEJ,CAEJ",
6
+ "names": ["CreditsRedeemList_exports", "__export", "CreditsRedeemList", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_classnames", "import_react", "import_RedeemCouponModal", "import_RedeemProductModal", "import_RedeemVirtualProductModal", "import_provider", "import_useRedeemableList", "import_const", "import_lib", "import_RedeemableItem", "import_constants", "import_RulesModal", "import_registration", "import_utils", "import_useMyRewards", "copy", "id", "profile", "openSignUpPopup", "pageGroup", "pageCommon", "creditInfo", "authCodeActivate", "brand", "locale", "rounded", "isLogin", "activeTab", "setActiveTab", "popRedeemData", "setPopRedeemData", "rules", "setRules", "listLoading", "redeemableList", "getRedeemableList", "useRedeemableList", "myRewards", "useMyRewards", "redeemModalCopy", "alpcList", "item", "handles", "products", "list", "alpcItem", "product", "variant", "hasRedeemed", "reward", "handleRedeemError", "errorCode", "classNames", "cn", "value", "RedeemCouponModal", "RedeemProductModal", "RedeemVirtualProductModal", "RulesModal"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var g=Object.create;var d=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var C=(e,o)=>{for(var l in o)d(e,l,{get:o[l],enumerable:!0})},x=(e,o,l,p)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of v(o))!h.call(e,a)&&a!==l&&d(e,a,{get:()=>o[a],enumerable:!(p=b(o,a))||p.enumerable});return e};var y=(e,o,l)=>(l=e!=null?g(N(e)):{},x(o||!e||!e.__esModule?d(l,"default",{value:e,enumerable:!0}):l,e)),w=e=>x(d({},"__esModule",{value:!0}),e);var T={};C(T,{CouponInit:()=>I});module.exports=w(T);var t=require("react/jsx-runtime"),m=require("@anker-in/headless-ui"),n=y(require("classnames")),s=require("../../context/utils"),r=require("../RedeemProductModal/NonProductValue"),c=require("../../context/provider");const I=({item:e,copy:o,loading:l,disabled:p,onConfirm:a})=>{const{pageCommon:i}=(0,c.useCreditsContext)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:(0,n.default)("max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:[(0,t.jsxs)("div",{className:"relative mx-auto h-[164px] w-[324px]",children:[i?.imageMapping?.[e.config?.type]?.url&&(0,t.jsx)(m.Picture,{source:i.imageMapping[e.config.type].url,className:"h-full [&_img]:h-full"}),(0,t.jsx)("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white",children:e.config.value?(0,t.jsx)(r.NoneProductValue,{item:e}):(0,t.jsx)(m.Text,{size:3,html:e.alpc?.title})})]}),(0,t.jsxs)(m.Text,{as:"p",className:(0,n.default)("mt-[30px] text-center text-[24px] font-bold leading-[1.2] md:mt-[18px] md:text-[20px] md:leading-[1.2]"),children:[(0,s.numberFormat)(e.alpc?.consumeCredits)," ",i?.pointUnit]}),e.config?.rules?.length>0&&(0,t.jsxs)("div",{className:"mt-[18px] w-full text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px] md:text-[14px]",children:[(0,t.jsxs)("div",{className:"mb-[4px]",children:[i?.ruleLabel,":"]}),(0,t.jsx)("ul",{className:"ml-4 grid grid-flow-row gap-[4px]",children:e.config?.rules?.map((u,f)=>(0,t.jsx)("li",{className:"list-disc",children:(0,t.jsx)(m.Text,{html:u})},f))})]})]}),(0,t.jsxs)("div",{className:"bg-white px-[48px] pt-[24px] text-center md:px-[16px]",children:[(0,t.jsx)(m.Text,{className:"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]",html:o.confirmTitle}),(0,t.jsx)(m.Button,{loading:l,variant:"primary",size:"lg",className:"mt-[16px] w-full",onClick:a,disabled:p,children:o.confirmButton})]})]})};
1
+ "use strict";var v=Object.create;var d=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var w=(e,o)=>{for(var l in o)d(e,l,{get:o[l],enumerable:!0})},s=(e,o,l,p)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of C(o))!y.call(e,a)&&a!==l&&d(e,a,{get:()=>o[a],enumerable:!(p=N(o,a))||p.enumerable});return e};var I=(e,o,l)=>(l=e!=null?v(h(e)):{},s(o||!e||!e.__esModule?d(l,"default",{value:e,enumerable:!0}):l,e)),T=e=>s(d({},"__esModule",{value:!0}),e);var R={};w(R,{CouponInit:()=>F});module.exports=T(R);var t=require("react/jsx-runtime"),m=require("@anker-in/headless-ui"),n=I(require("classnames")),x=require("../../context/utils"),r=require("../RedeemProductModal/NonProductValue"),c=require("../../context/provider"),u=require("@anker-in/lib");const F=({item:e,copy:o,loading:l,disabled:p,onConfirm:a})=>{const{pageCommon:i}=(0,c.useCreditsContext)(),{locale:f}=(0,u.useHeadlessContext)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:(0,n.default)("max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:[(0,t.jsxs)("div",{className:"relative mx-auto h-[164px] w-[324px]",children:[i?.imageMapping?.[e.config?.type]?.url&&(0,t.jsx)(m.Picture,{source:i.imageMapping[e.config.type].url,className:"h-full [&_img]:h-full"}),(0,t.jsx)("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white",children:e.config.value?(0,t.jsx)(r.NoneProductValue,{item:e}):(0,t.jsx)(m.Text,{size:3,html:e.alpc?.title})})]}),(0,t.jsxs)(m.Text,{as:"p",className:(0,n.default)("mt-[30px] text-center text-[24px] font-bold leading-[1.2] md:mt-[18px] md:text-[20px] md:leading-[1.2]"),children:[(0,x.numberFormat)(e.alpc?.consumeCredits,f)," ",i?.pointUnit]}),e.config?.rules?.length>0&&(0,t.jsxs)("div",{className:"mt-[18px] w-full text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px] md:text-[14px]",children:[(0,t.jsxs)("div",{className:"mb-[4px]",children:[i?.ruleLabel,":"]}),(0,t.jsx)("ul",{className:"ml-4 grid grid-flow-row gap-[4px]",children:e.config?.rules?.map((g,b)=>(0,t.jsx)("li",{className:"list-disc",children:(0,t.jsx)(m.Text,{html:g})},b))})]})]}),(0,t.jsxs)("div",{className:"bg-white px-[48px] pt-[24px] text-center md:px-[16px]",children:[(0,t.jsx)(m.Text,{className:"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]",html:o.confirmTitle}),(0,t.jsx)(m.Button,{loading:l,variant:"primary",size:"lg",className:"mt-[16px] w-full",onClick:a,disabled:p,children:o.confirmButton})]})]})};
2
2
  //# sourceMappingURL=CouponInit.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.tsx"],
4
- "sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { numberFormat } from '../../context/utils'\nimport type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../../type'\nimport { NoneProductValue } from '../RedeemProductModal/NonProductValue'\nimport { useCreditsContext } from '../../context/provider'\n\ntype CouponInitProps = {\n item: RedeemableItemType\n copy: RedeemModalCommon\n loading: boolean\n disabled: boolean\n onConfirm: () => void\n}\n\nexport const CouponInit = ({ item, copy, loading, disabled, onConfirm }: CouponInitProps) => {\n const { pageCommon } = useCreditsContext()\n\n return (\n <>\n <div\n className={classNames(\n 'max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]'\n )}\n >\n <div className=\"relative mx-auto h-[164px] w-[324px]\">\n {pageCommon?.imageMapping?.[item.config?.type]?.url && (\n <Picture source={pageCommon.imageMapping[item.config.type].url} className=\"h-full [&_img]:h-full\" />\n )}\n <div className=\"absolute bottom-[8px] left-[16px] font-extrabold text-white\">\n {item.config.value ? (\n <NoneProductValue item={item} />\n ) : (\n <Text size={3} html={item.alpc?.title} />\n )}\n </div>\n </div>\n <Text\n as=\"p\"\n className={classNames(\n 'mt-[30px] text-center text-[24px] font-bold leading-[1.2] md:mt-[18px] md:text-[20px] md:leading-[1.2]'\n )}\n >\n {numberFormat(item.alpc?.consumeCredits)} {pageCommon?.pointUnit}\n </Text>\n {item.config?.rules?.length > 0 && (\n <div className=\"mt-[18px] w-full text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px] md:text-[14px]\">\n <div className=\"mb-[4px]\">{pageCommon?.ruleLabel}:</div>\n <ul className=\"ml-4 grid grid-flow-row gap-[4px]\">\n {item.config?.rules?.map((text, index) => (\n <li className=\"list-disc\" key={index}>\n <Text html={text} />\n </li>\n ))}\n </ul>\n </div>\n )}\n </div>\n <div className=\"bg-white px-[48px] pt-[24px] text-center md:px-[16px]\">\n <Text\n className=\"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]\"\n html={copy.confirmTitle}\n ></Text>\n <Button\n loading={loading}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full\"\n onClick={onConfirm}\n disabled={disabled}\n >\n {copy.confirmButton}\n </Button>\n </div>\n </>\n )\n}\n"],
5
- "mappings": "0jBAAA,IAA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SAAAF,EAAK,cACR,GACF,GACF,CAEJ",
6
- "names": ["CouponInit_exports", "__export", "CouponInit", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_classnames", "import_utils", "import_NonProductValue", "import_provider", "item", "copy", "loading", "disabled", "onConfirm", "pageCommon", "classNames", "text", "index"]
4
+ "sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { numberFormat } from '../../context/utils'\nimport type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../../type'\nimport { NoneProductValue } from '../RedeemProductModal/NonProductValue'\nimport { useCreditsContext } from '../../context/provider'\nimport { useHeadlessContext } from '@anker-in/lib'\n\ntype CouponInitProps = {\n item: RedeemableItemType\n copy: RedeemModalCommon\n loading: boolean\n disabled: boolean\n onConfirm: () => void\n}\n\nexport const CouponInit = ({ item, copy, loading, disabled, onConfirm }: CouponInitProps) => {\n const { pageCommon } = useCreditsContext()\n const { locale } = useHeadlessContext()\n\n return (\n <>\n <div\n className={classNames(\n 'max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]'\n )}\n >\n <div className=\"relative mx-auto h-[164px] w-[324px]\">\n {pageCommon?.imageMapping?.[item.config?.type]?.url && (\n <Picture source={pageCommon.imageMapping[item.config.type].url} className=\"h-full [&_img]:h-full\" />\n )}\n <div className=\"absolute bottom-[8px] left-[16px] font-extrabold text-white\">\n {item.config.value ? (\n <NoneProductValue item={item} />\n ) : (\n <Text size={3} html={item.alpc?.title} />\n )}\n </div>\n </div>\n <Text\n as=\"p\"\n className={classNames(\n 'mt-[30px] text-center text-[24px] font-bold leading-[1.2] md:mt-[18px] md:text-[20px] md:leading-[1.2]'\n )}\n >\n {numberFormat(item.alpc?.consumeCredits, locale)} {pageCommon?.pointUnit}\n </Text>\n {item.config?.rules?.length > 0 && (\n <div className=\"mt-[18px] w-full text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px] md:text-[14px]\">\n <div className=\"mb-[4px]\">{pageCommon?.ruleLabel}:</div>\n <ul className=\"ml-4 grid grid-flow-row gap-[4px]\">\n {item.config?.rules?.map((text, index) => (\n <li className=\"list-disc\" key={index}>\n <Text html={text} />\n </li>\n ))}\n </ul>\n </div>\n )}\n </div>\n <div className=\"bg-white px-[48px] pt-[24px] text-center md:px-[16px]\">\n <Text\n className=\"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]\"\n html={copy.confirmTitle}\n ></Text>\n <Button\n loading={loading}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full\"\n onClick={onConfirm}\n disabled={disabled}\n >\n {copy.confirmButton}\n </Button>\n </div>\n </>\n )\n}\n"],
5
+ "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAqBI,IAAAI,EAAA,6BArBJC,EAAsC,iCACtCC,EAAuB,yBACvBC,EAA6B,+BAE7BC,EAAiC,iDACjCC,EAAkC,kCAClCC,EAAmC,yBAU5B,MAAMR,EAAa,CAAC,CAAE,KAAAS,EAAM,KAAAC,EAAM,QAAAC,EAAS,SAAAC,EAAU,UAAAC,CAAU,IAAuB,CAC3F,KAAM,CAAE,WAAAC,CAAW,KAAI,qBAAkB,EACnC,CAAE,OAAAC,CAAO,KAAI,sBAAmB,EAEtC,SACE,oBACE,qBAAC,OACC,aAAW,EAAAC,SACT,8FACF,EAEA,qBAAC,OAAI,UAAU,uCACZ,UAAAF,GAAY,eAAeL,EAAK,QAAQ,IAAI,GAAG,QAC9C,OAAC,WAAQ,OAAQK,EAAW,aAAaL,EAAK,OAAO,IAAI,EAAE,IAAK,UAAU,wBAAwB,KAEpG,OAAC,OAAI,UAAU,8DACZ,SAAAA,EAAK,OAAO,SACX,OAAC,oBAAiB,KAAMA,EAAM,KAE9B,OAAC,QAAK,KAAM,EAAG,KAAMA,EAAK,MAAM,MAAO,EAE3C,GACF,KACA,QAAC,QACC,GAAG,IACH,aAAW,EAAAO,SACT,wGACF,EAEC,6BAAaP,EAAK,MAAM,eAAgBM,CAAM,EAAE,IAAED,GAAY,WACjE,EACCL,EAAK,QAAQ,OAAO,OAAS,MAC5B,QAAC,OAAI,UAAU,kGACb,qBAAC,OAAI,UAAU,WAAY,UAAAK,GAAY,UAAU,KAAC,KAClD,OAAC,MAAG,UAAU,oCACX,SAAAL,EAAK,QAAQ,OAAO,IAAI,CAACQ,EAAMC,OAC9B,OAAC,MAAG,UAAU,YACZ,mBAAC,QAAK,KAAMD,EAAM,GADWC,CAE/B,CACD,EACH,GACF,GAEJ,KACA,QAAC,OAAI,UAAU,wDACb,oBAAC,QACC,UAAU,4EACV,KAAMR,EAAK,aACZ,KACD,OAAC,UACC,QAASC,EACT,QAAQ,UACR,KAAK,KACL,UAAU,mBACV,QAASE,EACT,SAAUD,EAET,SAAAF,EAAK,cACR,GACF,GACF,CAEJ",
6
+ "names": ["CouponInit_exports", "__export", "CouponInit", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_classnames", "import_utils", "import_NonProductValue", "import_provider", "import_lib", "item", "copy", "loading", "disabled", "onConfirm", "pageCommon", "locale", "classNames", "text", "index"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var N=Object.create;var p=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var P=(o,t)=>{for(var s in t)p(o,s,{get:t[s],enumerable:!0})},u=(o,t,s,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let m of w(t))!C.call(o,m)&&m!==s&&p(o,m,{get:()=>t[m],enumerable:!(a=h(t,m))||a.enumerable});return o};var T=(o,t,s)=>(s=o!=null?N(y(o)):{},u(t||!o||!o.__esModule?p(s,"default",{value:o,enumerable:!0}):s,o)),F=o=>u(p({},"__esModule",{value:!0}),o);var R={};P(R,{Init:()=>I});module.exports=F(R);var e=require("react/jsx-runtime"),l=require("@anker-in/headless-ui"),r=T(require("classnames")),x=require("react"),f=require("../../context/utils"),g=require("../../context/const"),v=require("./NonProductValue"),b=require("../../context/provider");const I=({copy:o,item:t,loading:s,disabled:a,setStatus:m})=>{const{pageCommon:n}=(0,b.useCreditsContext)(),c=(0,x.useMemo)(()=>t.config.rules?.length?t.config.rules:[...t.config.desc?.split("<br>")||[],...o.product.rules||[]],[t.config.rules,t.config.desc,o.product.rules]);return(0,e.jsxs)("div",{className:"flex flex-col",children:[(0,e.jsx)("div",{className:(0,r.default)("max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"relative mx-auto h-[164px] w-fit",children:[(0,e.jsx)(l.Picture,{source:t.config?.type===g.ConsumeType.Product?t.product?.images[0]?.url:n?.imageMapping?.[t.config.type]?.url||t.config.image?.url,className:"h-full w-auto [&_img]:h-full [&_img]:w-auto [&_img]:object-contain"}),(0,e.jsx)("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white",children:t.config.value&&(0,e.jsx)(v.NoneProductValue,{item:t})})]}),(0,e.jsxs)("div",{className:"mt-[30px] md:mt-[18px]",children:[t.config.type==="product"&&(0,e.jsx)("div",{className:(0,r.default)("mb-[4px] text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]"),children:t.config.title}),(0,e.jsxs)(l.Text,{as:"p",className:(0,r.default)(" text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]"),children:[(0,f.numberFormat)(t.alpc?.consumeCredits)," ",n?.pointUnit]})]}),(0,e.jsxs)("div",{className:"mt-[16px] w-full text-[14px] font-semibold text-[#777] md:mt-[12px]",children:[(0,e.jsx)("div",{className:"text-[16px] font-bold leading-[1.4]",children:o.product.stepTitle}),(0,e.jsx)("div",{className:"mt-[4px] flex items-center justify-center",children:o.product.steps?.map((i,d)=>(0,e.jsxs)(x.Fragment,{children:[(0,e.jsxs)("div",{className:"flex w-[76px] flex-col items-center text-center md:h-[94px] min-l:w-[130px]",children:[(0,e.jsx)(l.Picture,{source:i.imageUrl,className:"mb-[4px] h-[58px] w-[58px]"}),(0,e.jsx)("div",{className:"min-h-[34px] text-[14px] font-bold text-[#777] md:min-h-[28px] md:text-[12px]",children:i.title})]}),d!==o.product.steps.length-1&&(0,e.jsx)(l.Picture,{source:"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/step-arrow.png?v=1690458150",className:"mb-[20px] h-[10px] w-[20px] md:mb-[30px] md:h-[5px] md:w-[12px]"})]},d))}),(0,e.jsx)("div",{className:"overflow-auto",children:c?.length&&(0,e.jsx)("ul",{className:"ml-[18px] mt-[16px] grid grid-flow-row gap-[4px] text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px]",children:c.map((i,d)=>(0,e.jsx)("li",{className:"list-disc",children:(0,e.jsx)(l.Text,{as:"div",html:i,className:"font-bold"})},d))})})]})]})}),(0,e.jsxs)("div",{className:"flex-1 bg-white px-[48px] py-[24px] text-center md:px-[16px]",children:[(0,e.jsx)(l.Text,{as:"p",className:"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]",html:o.confirmTitle}),(0,e.jsx)(l.Button,{loading:s,disabled:a,variant:"primary",size:"lg",className:"mt-[16px] w-full md:mt-[12px]",onClick:()=>{m("address")},children:o.confirmButton})]})]})};
1
+ "use strict";var w=Object.create;var p=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty;var F=(o,t)=>{for(var s in t)p(o,s,{get:t[s],enumerable:!0})},u=(o,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let m of C(t))!T.call(o,m)&&m!==s&&p(o,m,{get:()=>t[m],enumerable:!(i=y(t,m))||i.enumerable});return o};var I=(o,t,s)=>(s=o!=null?w(P(o)):{},u(t||!o||!o.__esModule?p(s,"default",{value:o,enumerable:!0}):s,o)),R=o=>u(p({},"__esModule",{value:!0}),o);var M={};F(M,{Init:()=>k});module.exports=R(M);var e=require("react/jsx-runtime"),l=require("@anker-in/headless-ui"),r=I(require("classnames")),x=require("react"),f=require("../../context/utils"),g=require("../../context/const"),v=require("./NonProductValue"),b=require("../../context/provider"),N=require("@anker-in/lib");const k=({copy:o,item:t,loading:s,disabled:i,setStatus:m})=>{const{pageCommon:n}=(0,b.useCreditsContext)(),{locale:h}=(0,N.useHeadlessContext)(),c=(0,x.useMemo)(()=>t.config.rules?.length?t.config.rules:[...t.config.desc?.split("<br>")||[],...o.product.rules||[]],[t.config.rules,t.config.desc,o.product.rules]);return(0,e.jsxs)("div",{className:"flex flex-col",children:[(0,e.jsx)("div",{className:(0,r.default)("max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"relative mx-auto h-[164px] w-fit",children:[(0,e.jsx)(l.Picture,{source:t.config?.type===g.ConsumeType.Product?t.product?.images[0]?.url:n?.imageMapping?.[t.config.type]?.url||t.config.image?.url,className:"h-full w-auto [&_img]:h-full [&_img]:w-auto [&_img]:object-contain"}),(0,e.jsx)("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white",children:t.config.value&&(0,e.jsx)(v.NoneProductValue,{item:t})})]}),(0,e.jsxs)("div",{className:"mt-[30px] md:mt-[18px]",children:[t.config.type==="product"&&(0,e.jsx)("div",{className:(0,r.default)("mb-[4px] text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]"),children:t.config.title}),(0,e.jsxs)(l.Text,{as:"p",className:(0,r.default)(" text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]"),children:[(0,f.numberFormat)(t.alpc?.consumeCredits,h)," ",n?.pointUnit]})]}),(0,e.jsxs)("div",{className:"mt-[16px] w-full text-[14px] font-semibold text-[#777] md:mt-[12px]",children:[(0,e.jsx)("div",{className:"text-[16px] font-bold leading-[1.4]",children:o.product.stepTitle}),(0,e.jsx)("div",{className:"mt-[4px] flex items-center justify-center",children:o.product.steps?.map((a,d)=>(0,e.jsxs)(x.Fragment,{children:[(0,e.jsxs)("div",{className:"flex w-[76px] flex-col items-center text-center md:h-[94px] min-l:w-[130px]",children:[(0,e.jsx)(l.Picture,{source:a.imageUrl,className:"mb-[4px] h-[58px] w-[58px]"}),(0,e.jsx)("div",{className:"min-h-[34px] text-[14px] font-bold text-[#777] md:min-h-[28px] md:text-[12px]",children:a.title})]}),d!==o.product.steps.length-1&&(0,e.jsx)(l.Picture,{source:"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/step-arrow.png?v=1690458150",className:"mb-[20px] h-[10px] w-[20px] md:mb-[30px] md:h-[5px] md:w-[12px]"})]},d))}),(0,e.jsx)("div",{className:"overflow-auto",children:c?.length&&(0,e.jsx)("ul",{className:"ml-[18px] mt-[16px] grid grid-flow-row gap-[4px] text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px]",children:c.map((a,d)=>(0,e.jsx)("li",{className:"list-disc",children:(0,e.jsx)(l.Text,{as:"div",html:a,className:"font-bold"})},d))})})]})]})}),(0,e.jsxs)("div",{className:"flex-1 bg-white px-[48px] py-[24px] text-center md:px-[16px]",children:[(0,e.jsx)(l.Text,{as:"p",className:"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]",html:o.confirmTitle}),(0,e.jsx)(l.Button,{loading:s,disabled:i,variant:"primary",size:"lg",className:"mt-[16px] w-full md:mt-[12px]",onClick:()=>{m("address")},children:o.confirmButton})]})]})};
2
2
  //# sourceMappingURL=Init.js.map