@anker-in/campaign-ui 0.5.1-beta.3 → 0.5.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.
- package/dist/cjs/components/credits/context/const.js +1 -1
- package/dist/cjs/components/credits/context/const.js.map +2 -2
- package/dist/cjs/components/credits/context/hooks/useMyRewards.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useMyRewards.js.map +3 -3
- package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js.map +3 -3
- package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.js.map +3 -3
- package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js.map +3 -3
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.js.map +3 -3
- package/dist/cjs/components/credits/context/hooks/useSubscribed.js.map +2 -2
- package/dist/cjs/components/credits/context/provider.d.ts +2 -1
- package/dist/cjs/components/credits/context/provider.js +1 -1
- package/dist/cjs/components/credits/context/provider.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js.map +3 -3
- package/dist/cjs/components/index.d.ts +2 -2
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/components/index.js.map +2 -2
- package/dist/cjs/components/memberPopup/MemberPopup.js +1 -1
- package/dist/cjs/components/memberPopup/MemberPopup.js.map +3 -3
- package/dist/cjs/components/memberPopup/type.d.ts +6 -0
- package/dist/cjs/components/memberPopup/type.js +1 -1
- package/dist/cjs/components/memberPopup/type.js.map +1 -1
- package/dist/cjs/templates/Credits.js +1 -1
- package/dist/cjs/templates/Credits.js.map +2 -2
- package/dist/cjs/templates/Credits.types.d.ts +1 -0
- package/dist/cjs/templates/Credits.types.js.map +1 -1
- package/dist/esm/components/credits/context/const.js +1 -1
- package/dist/esm/components/credits/context/const.js.map +2 -2
- package/dist/esm/components/credits/context/hooks/useMyRewards.js +1 -1
- package/dist/esm/components/credits/context/hooks/useMyRewards.js.map +3 -3
- package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js +1 -1
- package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js.map +3 -3
- package/dist/esm/components/credits/context/hooks/useRedeemGoGift.js +1 -1
- package/dist/esm/components/credits/context/hooks/useRedeemGoGift.js.map +3 -3
- package/dist/esm/components/credits/context/hooks/useRedeemProduct.js +1 -1
- package/dist/esm/components/credits/context/hooks/useRedeemProduct.js.map +3 -3
- package/dist/esm/components/credits/context/hooks/useRedeemableList.js +1 -1
- package/dist/esm/components/credits/context/hooks/useRedeemableList.js.map +3 -3
- package/dist/esm/components/credits/context/hooks/useSubscribed.js.map +2 -2
- package/dist/esm/components/credits/context/provider.d.ts +2 -1
- package/dist/esm/components/credits/context/provider.js +1 -1
- package/dist/esm/components/credits/context/provider.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js.map +3 -3
- package/dist/esm/components/index.d.ts +2 -2
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/index.js.map +2 -2
- package/dist/esm/components/memberPopup/MemberPopup.js +1 -1
- package/dist/esm/components/memberPopup/MemberPopup.js.map +3 -3
- package/dist/esm/components/memberPopup/type.d.ts +6 -0
- package/dist/esm/components/memberPopup/type.js.map +1 -1
- package/dist/esm/templates/Credits.js +1 -1
- package/dist/esm/templates/Credits.js.map +2 -2
- package/dist/esm/templates/Credits.types.d.ts +1 -0
- package/dist/esm/templates/Credits.types.js.map +1 -1
- package/package.json +1 -2
- package/src/components/credits/context/const.ts +1 -0
- package/src/components/credits/context/hooks/useMyRewards.ts +2 -2
- package/src/components/credits/context/hooks/useRedeemCoupon.ts +2 -2
- package/src/components/credits/context/hooks/useRedeemGoGift.ts +2 -2
- package/src/components/credits/context/hooks/useRedeemProduct.ts +2 -2
- package/src/components/credits/context/hooks/useRedeemableList.ts +2 -2
- package/src/components/credits/context/hooks/useSubscribed.ts +0 -1
- package/src/components/credits/context/provider.tsx +4 -0
- package/src/components/credits/creditsRedeemList/AddressForm/index.tsx +3 -3
- package/src/components/index.ts +2 -2
- package/src/components/memberPopup/MemberPopup.tsx +14 -3
- package/src/components/memberPopup/type.ts +6 -0
- package/src/templates/Credits.tsx +1 -0
- package/src/templates/Credits.types.ts +1 -0
- package/src/stories/CartCard.stories.tsx +0 -459
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
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"};
|
|
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])\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,KAAT,SACAA,IAAA,kBAAoB,KAApB,oBARUA,OAAA,IAWAL,OACVA,EAAA,WAAa,eACbA,EAAA,QAAU,UAFAA,OAAA,IAKAI,OACVA,IAAA,SAAW,GAAX,WACAA,IAAA,QAAU,GAAV,UACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,YAAc,GAAd,cACAA,IAAA,YAAc,GAAd,cACAA,IAAA,UAAY,GAAZ,YACAA,IAAA,OAAS,GAAT,SACAA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,oBAAsB,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,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])\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,KAAT,SACAA,IAAA,kBAAoB,KAApB,oBARUA,OAAA,IAWAL,OACVA,EAAA,WAAa,eACbA,EAAA,QAAU,UAFAA,OAAA,IAKAI,OACVA,IAAA,SAAW,GAAX,WACAA,IAAA,QAAU,GAAV,UACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,YAAc,GAAd,cACAA,IAAA,YAAc,GAAd,cACAA,IAAA,UAAY,GAAZ,YACAA,IAAA,OAAS,GAAT,SACAA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,oBAAsB,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",
|
|
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,2 +1,2 @@
|
|
|
1
|
-
"use strict";var i=Object.defineProperty;var
|
|
1
|
+
"use strict";var i=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var N=(t,e)=>{for(var o in e)i(t,o,{get:e[o],enumerable:!0})},h=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of T(e))!x.call(t,r)&&r!==o&&i(t,r,{get:()=>e[r],enumerable:!(s=L(e,r))||s.enumerable});return t};var z=t=>h(i({},"__esModule",{value:!0}),t);var S={};N(S,{default:()=>P});module.exports=z(S);var n=require("react"),a=require("../const"),_=require("./useAlpcFetch"),f=require("../provider"),y=require("@anker-in/lib");function B({page:t,pageSize:e,consumeType:o}){const{profile:s,alpcBrand:r,alpcCountry:C}=(0,f.useCreditsContext)(),{brand:R,locale:m,appName:b}=(0,y.useHeadlessContext)(),u=r||R,[d,A]=(0,n.useState)([]),[c,M]=(0,n.useState)(0),{isMutating:l,trigger:w}=(0,_.useAlpcMutation)({url:"/v1/credit/log/coupon",initData:{brand:u,country:C||a.ALPC_COUNTRY_MAP.get(m)||m,app_name:b}}),p=(0,n.useCallback)(async()=>{s?.user_id&&await w({consume_type:o||a.AlpcConsumeType.Coupon,page:t,page_size:e,user_id:s?.user_id},{onSuccess(g){M(g?.data?.total),A(g?.data?.redeem_logs||[])}})},[o,t,e,s?.user_id]);return(0,n.useEffect)(()=>{!u||!s?.user_id||p()},[p,u]),{myRewards:d,isLoading:l,total:c,getMyRewards:p,canNext:c>d.length&&!l}}var P=B;
|
|
2
2
|
//# sourceMappingURL=useMyRewards.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useMyRewards.ts"],
|
|
4
|
-
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'\nimport { useAlpcMutation } from './useAlpcFetch'\nimport type { RedeemLogResponse } from '../response'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useMyRewards({\n page,\n pageSize,\n consumeType,\n}: {\n page: number\n pageSize: number\n consumeType?: AlpcConsumeType\n}) {\n const { profile, alpcBrand } = useCreditsContext()\n const { brand: headlessBrand, locale, appName } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n const [myRewards, setMyRewards] = useState<RedeemLogResponse[]>([])\n const [total, setTotal] = useState(0)\n\n const { isMutating: isLoading, trigger } = useAlpcMutation<\n { data: { redeem_logs: RedeemLogResponse[]; total: number } },\n {\n page: number\n page_size: number\n consume_type: AlpcConsumeType\n user_id: string\n }\n >({\n url: `/v1/credit/log/coupon`,\n initData: {\n brand: brand,\n country: ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n })\n\n const getMyRewards = useCallback(async () => {\n if (!profile?.user_id) {\n return\n }\n await trigger(\n {\n consume_type: consumeType || AlpcConsumeType.Coupon,\n page,\n page_size: pageSize,\n user_id: profile?.user_id,\n },\n {\n onSuccess(responseData) {\n setTotal(responseData?.data?.total)\n setMyRewards(responseData?.data?.redeem_logs || [])\n },\n }\n )\n }, [consumeType, page, pageSize, profile?.user_id])\n\n useEffect(() => {\n if (!brand || !profile?.user_id) {\n return\n }\n getMyRewards()\n }, [getMyRewards, brand])\n\n return {\n myRewards,\n isLoading,\n total,\n getMyRewards,\n canNext: total > myRewards.length && !isLoading,\n }\n}\n\nexport default useMyRewards\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiD,iBAEjDC,EAAkD,oBAClDC,EAAgC,0BAEhCC,EAAkC,uBAClCC,EAAmC,yBAEnC,SAASC,EAAa,CACpB,KAAAC,EACA,SAAAC,EACA,YAAAC,CACF,EAIG,CACD,KAAM,CAAE,QAAAC,EAAS,UAAAC,
|
|
6
|
-
"names": ["useMyRewards_exports", "__export", "useMyRewards_default", "__toCommonJS", "import_react", "import_const", "import_useAlpcFetch", "import_provider", "import_lib", "useMyRewards", "page", "pageSize", "consumeType", "profile", "alpcBrand", "headlessBrand", "locale", "appName", "brand", "myRewards", "setMyRewards", "total", "setTotal", "isLoading", "trigger", "getMyRewards", "responseData"]
|
|
4
|
+
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'\nimport { useAlpcMutation } from './useAlpcFetch'\nimport type { RedeemLogResponse } from '../response'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useMyRewards({\n page,\n pageSize,\n consumeType,\n}: {\n page: number\n pageSize: number\n consumeType?: AlpcConsumeType\n}) {\n const { profile, alpcBrand, alpcCountry } = useCreditsContext()\n const { brand: headlessBrand, locale, appName } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n const [myRewards, setMyRewards] = useState<RedeemLogResponse[]>([])\n const [total, setTotal] = useState(0)\n\n const { isMutating: isLoading, trigger } = useAlpcMutation<\n { data: { redeem_logs: RedeemLogResponse[]; total: number } },\n {\n page: number\n page_size: number\n consume_type: AlpcConsumeType\n user_id: string\n }\n >({\n url: `/v1/credit/log/coupon`,\n initData: {\n brand: brand,\n country: alpcCountry || ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n })\n\n const getMyRewards = useCallback(async () => {\n if (!profile?.user_id) {\n return\n }\n await trigger(\n {\n consume_type: consumeType || AlpcConsumeType.Coupon,\n page,\n page_size: pageSize,\n user_id: profile?.user_id,\n },\n {\n onSuccess(responseData) {\n setTotal(responseData?.data?.total)\n setMyRewards(responseData?.data?.redeem_logs || [])\n },\n }\n )\n }, [consumeType, page, pageSize, profile?.user_id])\n\n useEffect(() => {\n if (!brand || !profile?.user_id) {\n return\n }\n getMyRewards()\n }, [getMyRewards, brand])\n\n return {\n myRewards,\n isLoading,\n total,\n getMyRewards,\n canNext: total > myRewards.length && !isLoading,\n }\n}\n\nexport default useMyRewards\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiD,iBAEjDC,EAAkD,oBAClDC,EAAgC,0BAEhCC,EAAkC,uBAClCC,EAAmC,yBAEnC,SAASC,EAAa,CACpB,KAAAC,EACA,SAAAC,EACA,YAAAC,CACF,EAIG,CACD,KAAM,CAAE,QAAAC,EAAS,UAAAC,EAAW,YAAAC,CAAY,KAAI,qBAAkB,EACxD,CAAE,MAAOC,EAAe,OAAAC,EAAQ,QAAAC,CAAQ,KAAI,sBAAmB,EAC/DC,EAAQL,GAAaE,EAErB,CAACI,EAAWC,CAAY,KAAI,YAA8B,CAAC,CAAC,EAC5D,CAACC,EAAOC,CAAQ,KAAI,YAAS,CAAC,EAE9B,CAAE,WAAYC,EAAW,QAAAC,CAAQ,KAAI,mBAQzC,CACA,IAAK,wBACL,SAAU,CACR,MAAON,EACP,QAASJ,GAAe,mBAAiB,IAAIE,CAAM,GAAKA,EACxD,SAAUC,CACZ,CACF,CAAC,EAEKQ,KAAe,eAAY,SAAY,CACtCb,GAAS,SAGd,MAAMY,EACJ,CACE,aAAcb,GAAe,kBAAgB,OAC7C,KAAAF,EACA,UAAWC,EACX,QAASE,GAAS,OACpB,EACA,CACE,UAAUc,EAAc,CACtBJ,EAASI,GAAc,MAAM,KAAK,EAClCN,EAAaM,GAAc,MAAM,aAAe,CAAC,CAAC,CACpD,CACF,CACF,CACF,EAAG,CAACf,EAAaF,EAAMC,EAAUE,GAAS,OAAO,CAAC,EAElD,sBAAU,IAAM,CACV,CAACM,GAAS,CAACN,GAAS,SAGxBa,EAAa,CACf,EAAG,CAACA,EAAcP,CAAK,CAAC,EAEjB,CACL,UAAAC,EACA,UAAAI,EACA,MAAAF,EACA,aAAAI,EACA,QAASJ,EAAQF,EAAU,QAAU,CAACI,CACxC,CACF,CAEA,IAAOtB,EAAQO",
|
|
6
|
+
"names": ["useMyRewards_exports", "__export", "useMyRewards_default", "__toCommonJS", "import_react", "import_const", "import_useAlpcFetch", "import_provider", "import_lib", "useMyRewards", "page", "pageSize", "consumeType", "profile", "alpcBrand", "alpcCountry", "headlessBrand", "locale", "appName", "brand", "myRewards", "setMyRewards", "total", "setTotal", "isLoading", "trigger", "getMyRewards", "responseData"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var s=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var l=(o,e)=>{for(var t in e)s(o,t,{get:e[t],enumerable:!0})},R=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of c(e))!C.call(o,n)&&n!==t&&s(o,n,{get:()=>e[n],enumerable:!(r=m(e,n))||r.enumerable});return o};var g=o=>R(s({},"__esModule",{value:!0}),o);var f={};l(f,{useRedeemCoupon:()=>b});module.exports=g(f);var p=require("../const"),a=require("./useAlpcFetch"),u=require("@anker-in/lib"),d=require("../provider");const b=(o={})=>{const{alpcBrand:e,alpcCountry:t}=(0,d.useCreditsContext)(),{locale:r,appName:n,brand:i}=(0,u.useHeadlessContext)();return(0,a.useAlpcMutation)({url:"/v1/credit/redeem/coupon",initData:{brand:e||i,country:t||p.ALPC_COUNTRY_MAP.get(r)||r,app_name:n}},o)};
|
|
2
2
|
//# sourceMappingURL=useRedeemCoupon.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useRedeemCoupon.ts"],
|
|
4
|
-
"sourcesContent": ["import { ALPC_COUNTRY_MAP } from '../const'\nimport { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../provider'\n\ntype RedeemCouponResponse = {\n data: {\n success: boolean\n coupon_code: string\n }\n msg: string // \u62A5\u9519\u4FE1\u606F\n code: number // \u62A5\u9519\u7801\n}\n\nexport const useRedeemCoupon = (mutationOptions: UseMutationConfig<RedeemCouponResponse> = {}) => {\n const { alpcBrand } = useCreditsContext()\n const { locale, appName, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n return useAlpcMutation<\n RedeemCouponResponse,\n {\n user_id?: string\n rule_id: number\n }\n >(\n {\n url: `/v1/credit/redeem/coupon`,\n initData: {\n brand,\n country: ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n },\n mutationOptions\n )\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiC,oBACjCC,EAAwD,0BACxDC,EAAmC,yBACnCC,EAAkC,uBAW3B,MAAML,EAAkB,CAACM,EAA2D,CAAC,IAAM,CAChG,KAAM,CAAE,UAAAC,
|
|
6
|
-
"names": ["useRedeemCoupon_exports", "__export", "useRedeemCoupon", "__toCommonJS", "import_const", "import_useAlpcFetch", "import_lib", "import_provider", "mutationOptions", "alpcBrand", "locale", "appName", "headlessBrand"]
|
|
4
|
+
"sourcesContent": ["import { ALPC_COUNTRY_MAP } from '../const'\nimport { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../provider'\n\ntype RedeemCouponResponse = {\n data: {\n success: boolean\n coupon_code: string\n }\n msg: string // \u62A5\u9519\u4FE1\u606F\n code: number // \u62A5\u9519\u7801\n}\n\nexport const useRedeemCoupon = (mutationOptions: UseMutationConfig<RedeemCouponResponse> = {}) => {\n const { alpcBrand, alpcCountry } = useCreditsContext()\n const { locale, appName, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n return useAlpcMutation<\n RedeemCouponResponse,\n {\n user_id?: string\n rule_id: number\n }\n >(\n {\n url: `/v1/credit/redeem/coupon`,\n initData: {\n brand,\n country: alpcCountry || ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n },\n mutationOptions\n )\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiC,oBACjCC,EAAwD,0BACxDC,EAAmC,yBACnCC,EAAkC,uBAW3B,MAAML,EAAkB,CAACM,EAA2D,CAAC,IAAM,CAChG,KAAM,CAAE,UAAAC,EAAW,YAAAC,CAAY,KAAI,qBAAkB,EAC/C,CAAE,OAAAC,EAAQ,QAAAC,EAAS,MAAOC,CAAc,KAAI,sBAAmB,EAGrE,SAAO,mBAOL,CACE,IAAK,2BACL,SAAU,CACR,MAZQJ,GAAaI,EAarB,QAASH,GAAe,mBAAiB,IAAIC,CAAM,GAAKA,EACxD,SAAUC,CACZ,CACF,EACAJ,CACF,CACF",
|
|
6
|
+
"names": ["useRedeemCoupon_exports", "__export", "useRedeemCoupon", "__toCommonJS", "import_const", "import_useAlpcFetch", "import_lib", "import_provider", "mutationOptions", "alpcBrand", "alpcCountry", "locale", "appName", "headlessBrand"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var s=Object.defineProperty;var
|
|
1
|
+
"use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var g=(t,e)=>{for(var n in e)s(t,n,{get:e[n],enumerable:!0})},l=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of c(e))!f.call(t,o)&&o!==n&&s(t,o,{get:()=>e[o],enumerable:!(r=u(e,o))||r.enumerable});return t};var C=t=>l(s({},"__esModule",{value:!0}),t);var R={};g(R,{useRedeemGoGift:()=>G});module.exports=C(R);var i=require("../const"),a=require("./useAlpcFetch"),d=require("@anker-in/lib"),m=require("../provider");const G=(t={})=>{const{alpcBrand:e,alpcCountry:n}=(0,m.useCreditsContext)(),{locale:r,appName:o,brand:p}=(0,d.useHeadlessContext)();return(0,a.useAlpcMutation)({url:"/v1/credit/redeem/gogift",initData:{brand:e||p,country:n||i.ALPC_COUNTRY_MAP.get(r)||r,app_name:o}},t)};
|
|
2
2
|
//# sourceMappingURL=useRedeemGoGift.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useRedeemGoGift.ts"],
|
|
4
|
-
"sourcesContent": ["import { ALPC_COUNTRY_MAP } from '../const'\nimport { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../provider'\n\ntype RedeemGoGiftResponse = {\n data: {\n id: string\n }\n msg: string // \u62A5\u9519\u4FE1\u606F\n code: number // \u62A5\u9519\u7801\n}\n\nexport const useRedeemGoGift = (mutationOptions: UseMutationConfig<RedeemGoGiftResponse> = {}) => {\n const { alpcBrand } = useCreditsContext()\n const { locale, appName, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n return useAlpcMutation<\n RedeemGoGiftResponse,\n {\n user_id?: string\n rule_id: number\n }\n >(\n {\n url: `/v1/credit/redeem/gogift`,\n initData: {\n brand,\n country: ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n },\n mutationOptions\n )\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiC,oBACjCC,EAAwD,0BACxDC,EAAmC,yBACnCC,EAAkC,uBAU3B,MAAML,EAAkB,CAACM,EAA2D,CAAC,IAAM,CAChG,KAAM,CAAE,UAAAC,
|
|
6
|
-
"names": ["useRedeemGoGift_exports", "__export", "useRedeemGoGift", "__toCommonJS", "import_const", "import_useAlpcFetch", "import_lib", "import_provider", "mutationOptions", "alpcBrand", "locale", "appName", "headlessBrand"]
|
|
4
|
+
"sourcesContent": ["import { ALPC_COUNTRY_MAP } from '../const'\nimport { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../provider'\n\ntype RedeemGoGiftResponse = {\n data: {\n id: string\n }\n msg: string // \u62A5\u9519\u4FE1\u606F\n code: number // \u62A5\u9519\u7801\n}\n\nexport const useRedeemGoGift = (mutationOptions: UseMutationConfig<RedeemGoGiftResponse> = {}) => {\n const { alpcBrand, alpcCountry } = useCreditsContext()\n const { locale, appName, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n return useAlpcMutation<\n RedeemGoGiftResponse,\n {\n user_id?: string\n rule_id: number\n }\n >(\n {\n url: `/v1/credit/redeem/gogift`,\n initData: {\n brand,\n country: alpcCountry || ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n },\n mutationOptions\n )\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiC,oBACjCC,EAAwD,0BACxDC,EAAmC,yBACnCC,EAAkC,uBAU3B,MAAML,EAAkB,CAACM,EAA2D,CAAC,IAAM,CAChG,KAAM,CAAE,UAAAC,EAAW,YAAAC,CAAY,KAAI,qBAAkB,EAC/C,CAAE,OAAAC,EAAQ,QAAAC,EAAS,MAAOC,CAAc,KAAI,sBAAmB,EAGrE,SAAO,mBAOL,CACE,IAAK,2BACL,SAAU,CACR,MAZQJ,GAAaI,EAarB,QAASH,GAAe,mBAAiB,IAAIC,CAAM,GAAKA,EACxD,SAAUC,CACZ,CACF,EACAJ,CACF,CACF",
|
|
6
|
+
"names": ["useRedeemGoGift_exports", "__export", "useRedeemGoGift", "__toCommonJS", "import_const", "import_useAlpcFetch", "import_lib", "import_provider", "mutationOptions", "alpcBrand", "alpcCountry", "locale", "appName", "headlessBrand"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var s=Object.defineProperty;var
|
|
1
|
+
"use strict";var s=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var R=(o,e)=>{for(var n in e)s(o,n,{get:e[n],enumerable:!0})},b=(o,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of l(e))!C.call(o,t)&&t!==n&&s(o,t,{get:()=>e[t],enumerable:!(r=m(e,t))||r.enumerable});return o};var f=o=>b(s({},"__esModule",{value:!0}),o);var P={};R(P,{useRedeemProduct:()=>g});module.exports=f(P);var a=require("../const"),d=require("./useAlpcFetch"),u=require("@anker-in/lib"),p=require("../provider");const g=(o={})=>{const{alpcBrand:e,alpcCountry:n}=(0,p.useCreditsContext)(),{storeDomain:r,locale:t,appName:c,brand:i}=(0,u.useHeadlessContext)();return(0,d.useAlpcMutation)({url:"/v1/credit/exchange/goods",initData:{quantity:1,brand:e||i,country:(n||a.ALPC_COUNTRY_MAP.get(t||"")||t)?.toUpperCase(),domain:r,app_name:c}},o)};
|
|
2
2
|
//# sourceMappingURL=useRedeemProduct.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useRedeemProduct.ts"],
|
|
4
|
-
"sourcesContent": ["import { ALPC_COUNTRY_MAP } from '../const'\nimport { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../provider'\n\ntype RedeemProductResponse = {\n code: number\n data: {\n success: boolean\n }\n}\n\nexport const useRedeemProduct = (mutationOptions: UseMutationConfig<RedeemProductResponse> = {}) => {\n const { alpcBrand } = useCreditsContext()\n const { storeDomain, locale, appName, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n return useAlpcMutation<\n RedeemProductResponse,\n {\n rule_id: number\n address: string\n }\n >(\n {\n url: `/v1/credit/exchange/goods`,\n initData: {\n quantity: 1,\n brand,\n country: (ALPC_COUNTRY_MAP.get(locale || '') || locale)?.toUpperCase(),\n domain: storeDomain,\n app_name: appName,\n },\n },\n mutationOptions\n )\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiC,oBACjCC,EAAwD,0BACxDC,EAAmC,yBACnCC,EAAkC,uBAS3B,MAAML,EAAmB,CAACM,EAA4D,CAAC,IAAM,CAClG,KAAM,CAAE,UAAAC,
|
|
6
|
-
"names": ["useRedeemProduct_exports", "__export", "useRedeemProduct", "__toCommonJS", "import_const", "import_useAlpcFetch", "import_lib", "import_provider", "mutationOptions", "alpcBrand", "storeDomain", "locale", "appName", "headlessBrand"]
|
|
4
|
+
"sourcesContent": ["import { ALPC_COUNTRY_MAP } from '../const'\nimport { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../provider'\n\ntype RedeemProductResponse = {\n code: number\n data: {\n success: boolean\n }\n}\n\nexport const useRedeemProduct = (mutationOptions: UseMutationConfig<RedeemProductResponse> = {}) => {\n const { alpcBrand, alpcCountry } = useCreditsContext()\n const { storeDomain, locale, appName, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n return useAlpcMutation<\n RedeemProductResponse,\n {\n rule_id: number\n address: string\n }\n >(\n {\n url: `/v1/credit/exchange/goods`,\n initData: {\n quantity: 1,\n brand,\n country: (alpcCountry || ALPC_COUNTRY_MAP.get(locale || '') || locale)?.toUpperCase(),\n domain: storeDomain,\n app_name: appName,\n },\n },\n mutationOptions\n )\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiC,oBACjCC,EAAwD,0BACxDC,EAAmC,yBACnCC,EAAkC,uBAS3B,MAAML,EAAmB,CAACM,EAA4D,CAAC,IAAM,CAClG,KAAM,CAAE,UAAAC,EAAW,YAAAC,CAAY,KAAI,qBAAkB,EAC/C,CAAE,YAAAC,EAAa,OAAAC,EAAQ,QAAAC,EAAS,MAAOC,CAAc,KAAI,sBAAmB,EAGlF,SAAO,mBAOL,CACE,IAAK,4BACL,SAAU,CACR,SAAU,EACV,MAbQL,GAAaK,EAcrB,SAAUJ,GAAe,mBAAiB,IAAIE,GAAU,EAAE,GAAKA,IAAS,YAAY,EACpF,OAAQD,EACR,SAAUE,CACZ,CACF,EACAL,CACF,CACF",
|
|
6
|
+
"names": ["useRedeemProduct_exports", "__export", "useRedeemProduct", "__toCommonJS", "import_const", "import_useAlpcFetch", "import_lib", "import_provider", "mutationOptions", "alpcBrand", "alpcCountry", "storeDomain", "locale", "appName", "headlessBrand"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var c=Object.defineProperty;var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var P=(s,e)=>{for(var t in e)c(s,t,{get:e[t],enumerable:!0})},B=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of x(e))!M.call(s,o)&&o!==t&&c(s,o,{get:()=>e[o],enumerable:!(r=A(e,o))||r.enumerable});return s};var S=s=>B(c({},"__esModule",{value:!0}),s);var k={};P(k,{default:()=>h});module.exports=S(k);var n=require("react"),d=require("./useAlpcFetch"),C=require("../const"),y=require("../provider"),f=require("@anker-in/lib");function U(s){let e="";const{profile:t,isLoadingProfile:r,alpcBrand:o,alpcCountry:_}=(0,y.useCreditsContext)(),{locale:l,brand:g}=(0,f.useHeadlessContext)(),u=o||g;l==="pl"?e="eu":e=l;const[T,R]=(0,n.useState)([]),{isMutating:L,trigger:p}=(0,d.useAlpcMutation)({url:"/v1/credit/consume_credit_rules",initData:{brand:u,page:1,page_size:999,country:(_||C.ALPC_COUNTRY_MAP.get(e)||e)?.toUpperCase()}}),i=(0,n.useCallback)(m=>{p({user_id:t?.user_id,...m?.consumeType&&{consume_type:m.consumeType}},{onSuccess(a){console.log("responseData",a);let b=a?.data?.consume_credit_rules||[];R(b)}})},[t,p,e]);return(0,n.useEffect)(()=>{!u||r||i({consumeType:s?.consumeType})},[i,r,u]),{listLoading:L,redeemableList:T,getRedeemableList:i}}var h=U;
|
|
2
2
|
//# sourceMappingURL=useRedeemableList.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useRedeemableList.ts"],
|
|
4
|
-
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { useAlpcMutation } from './useAlpcFetch'\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'\nimport { useCreditsContext } from '../provider'\nimport type { ConsumeCreditRuleResponse } from '../response'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useRedeemableList(props?: { consumeType: AlpcConsumeType }) {\n let locale = '' as string\n const { profile, isLoadingProfile, alpcBrand } = useCreditsContext()\n const { locale: contextLocale, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n if (contextLocale === 'pl') {\n locale = 'eu'\n } else {\n locale = contextLocale\n }\n\n const [redeemableList, setRedeemableList] = useState<ConsumeCreditRuleResponse[]>([])\n const { isMutating: listLoading, trigger } = useAlpcMutation<\n {\n data: { consume_credit_rules: ConsumeCreditRuleResponse[] }\n },\n { consume_type?: AlpcConsumeType; user_id?: string }\n >({\n url: `/v1/credit/consume_credit_rules`,\n initData: {\n brand,\n page: 1,\n page_size: 999,\n country: (ALPC_COUNTRY_MAP.get(locale) || locale)?.toUpperCase(),\n },\n })\n\n const getRedeemableList = useCallback(\n (props?: { consumeType?: AlpcConsumeType }) => {\n trigger(\n {\n user_id: profile?.user_id,\n ...(props?.consumeType && { consume_type: props.consumeType }),\n },\n {\n onSuccess(responseData) {\n console.log('responseData', responseData)\n let list = responseData?.data?.consume_credit_rules || []\n setRedeemableList(list)\n },\n }\n )\n },\n [profile, trigger, locale]\n )\n\n useEffect(() => {\n if (!brand || isLoadingProfile) {\n return\n }\n getRedeemableList({ consumeType: props?.consumeType })\n }, [getRedeemableList, isLoadingProfile, brand])\n\n return {\n listLoading,\n redeemableList,\n getRedeemableList,\n }\n}\n\nexport default useRedeemableList\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiD,iBAEjDC,EAAgC,0BAChCC,EAAkD,oBAClDC,EAAkC,uBAElCC,EAAmC,yBAEnC,SAASC,EAAkBC,EAA0C,CACnE,IAAIC,EAAS,GACb,KAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,UAAAC,
|
|
6
|
-
"names": ["useRedeemableList_exports", "__export", "useRedeemableList_default", "__toCommonJS", "import_react", "import_useAlpcFetch", "import_const", "import_provider", "import_lib", "useRedeemableList", "props", "locale", "profile", "isLoadingProfile", "alpcBrand", "contextLocale", "headlessBrand", "brand", "redeemableList", "setRedeemableList", "listLoading", "trigger", "getRedeemableList", "responseData", "list"]
|
|
4
|
+
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { useAlpcMutation } from './useAlpcFetch'\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'\nimport { useCreditsContext } from '../provider'\nimport type { ConsumeCreditRuleResponse } from '../response'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useRedeemableList(props?: { consumeType: AlpcConsumeType }) {\n let locale = '' as string\n const { profile, isLoadingProfile, alpcBrand, alpcCountry } = useCreditsContext()\n const { locale: contextLocale, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n if (contextLocale === 'pl') {\n locale = 'eu'\n } else {\n locale = contextLocale\n }\n\n const [redeemableList, setRedeemableList] = useState<ConsumeCreditRuleResponse[]>([])\n const { isMutating: listLoading, trigger } = useAlpcMutation<\n {\n data: { consume_credit_rules: ConsumeCreditRuleResponse[] }\n },\n { consume_type?: AlpcConsumeType; user_id?: string }\n >({\n url: `/v1/credit/consume_credit_rules`,\n initData: {\n brand,\n page: 1,\n page_size: 999,\n country: (alpcCountry || ALPC_COUNTRY_MAP.get(locale) || locale)?.toUpperCase(),\n },\n })\n\n const getRedeemableList = useCallback(\n (props?: { consumeType?: AlpcConsumeType }) => {\n trigger(\n {\n user_id: profile?.user_id,\n ...(props?.consumeType && { consume_type: props.consumeType }),\n },\n {\n onSuccess(responseData) {\n console.log('responseData', responseData)\n let list = responseData?.data?.consume_credit_rules || []\n setRedeemableList(list)\n },\n }\n )\n },\n [profile, trigger, locale]\n )\n\n useEffect(() => {\n if (!brand || isLoadingProfile) {\n return\n }\n getRedeemableList({ consumeType: props?.consumeType })\n }, [getRedeemableList, isLoadingProfile, brand])\n\n return {\n listLoading,\n redeemableList,\n getRedeemableList,\n }\n}\n\nexport default useRedeemableList\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiD,iBAEjDC,EAAgC,0BAChCC,EAAkD,oBAClDC,EAAkC,uBAElCC,EAAmC,yBAEnC,SAASC,EAAkBC,EAA0C,CACnE,IAAIC,EAAS,GACb,KAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,UAAAC,EAAW,YAAAC,CAAY,KAAI,qBAAkB,EAC1E,CAAE,OAAQC,EAAe,MAAOC,CAAc,KAAI,sBAAmB,EACrEC,EAAQJ,GAAaG,EAEvBD,IAAkB,KACpBL,EAAS,KAETA,EAASK,EAGX,KAAM,CAACG,EAAgBC,CAAiB,KAAI,YAAsC,CAAC,CAAC,EAC9E,CAAE,WAAYC,EAAa,QAAAC,CAAQ,KAAI,mBAK3C,CACA,IAAK,kCACL,SAAU,CACR,MAAAJ,EACA,KAAM,EACN,UAAW,IACX,SAAUH,GAAe,mBAAiB,IAAIJ,CAAM,GAAKA,IAAS,YAAY,CAChF,CACF,CAAC,EAEKY,KAAoB,eACvBb,GAA8C,CAC7CY,EACE,CACE,QAASV,GAAS,QAClB,GAAIF,GAAO,aAAe,CAAE,aAAcA,EAAM,WAAY,CAC9D,EACA,CACE,UAAUc,EAAc,CACtB,QAAQ,IAAI,eAAgBA,CAAY,EACxC,IAAIC,EAAOD,GAAc,MAAM,sBAAwB,CAAC,EACxDJ,EAAkBK,CAAI,CACxB,CACF,CACF,CACF,EACA,CAACb,EAASU,EAASX,CAAM,CAC3B,EAEA,sBAAU,IAAM,CACV,CAACO,GAASL,GAGdU,EAAkB,CAAE,YAAab,GAAO,WAAY,CAAC,CACvD,EAAG,CAACa,EAAmBV,EAAkBK,CAAK,CAAC,EAExC,CACL,YAAAG,EACA,eAAAF,EACA,kBAAAI,CACF,CACF,CAEA,IAAOrB,EAAQO",
|
|
6
|
+
"names": ["useRedeemableList_exports", "__export", "useRedeemableList_default", "__toCommonJS", "import_react", "import_useAlpcFetch", "import_const", "import_provider", "import_lib", "useRedeemableList", "props", "locale", "profile", "isLoadingProfile", "alpcBrand", "alpcCountry", "contextLocale", "headlessBrand", "brand", "redeemableList", "setRedeemableList", "listLoading", "trigger", "getRedeemableList", "responseData", "list"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useSubscribed.ts"],
|
|
4
|
-
"sourcesContent": ["import { useMemo } from 'react'\n\nimport { TaskSubType } from '../const'\nimport useActivities from './useActivities'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext, useSubscriptions } from '@anker-in/lib'\n\nexport const useSubscribed = () => {\n const { profile } = useCreditsContext()\n const { brand } = useHeadlessContext()\n\n const activitiesOptions = useMemo(() => ({ page: 1, pageSize: 50 }), [])\n\n const { activities } = useActivities(activitiesOptions)\n const { data: subscription } = useSubscriptions({ email: profile?.email })\n
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAwB,iBAExBC,EAA4B,oBAC5BC,EAA0B,8BAC1BC,EAAkC,uBAClCC,EAAqD,yBAE9C,MAAMN,EAAgB,IAAM,CACjC,KAAM,CAAE,QAAAO,CAAQ,KAAI,qBAAkB,EAChC,CAAE,MAAAC,CAAM,KAAI,sBAAmB,EAE/BC,KAAoB,WAAQ,KAAO,CAAE,KAAM,EAAG,SAAU,EAAG,GAAI,CAAC,CAAC,EAEjE,CAAE,WAAAC,CAAW,KAAI,EAAAC,SAAcF,CAAiB,EAChD,CAAE,KAAMG,CAAa,KAAI,oBAAiB,CAAE,MAAOL,GAAS,KAAM,CAAC,
|
|
4
|
+
"sourcesContent": ["import { useMemo } from 'react'\n\nimport { TaskSubType } from '../const'\nimport useActivities from './useActivities'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext, useSubscriptions } from '@anker-in/lib'\n\nexport const useSubscribed = () => {\n const { profile } = useCreditsContext()\n const { brand } = useHeadlessContext()\n\n const activitiesOptions = useMemo(() => ({ page: 1, pageSize: 50 }), [])\n\n const { activities } = useActivities(activitiesOptions)\n const { data: subscription } = useSubscriptions({ email: profile?.email })\n const subscriptionData = subscription?.data || subscription\n\n const isSubscribed = useMemo(() => {\n if (!subscriptionData?.preference) {\n return false\n }\n\n const subscribeResult = subscriptionData.preference.some((item: any) => {\n return item.brand === brand && item.subscribe\n })\n\n if (subscribeResult) {\n return true\n }\n\n return activities?.some(item => {\n return item.task_sub_type === TaskSubType.Subscription\n })\n }, [subscriptionData?.preference, activities])\n\n return isSubscribed\n}\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAwB,iBAExBC,EAA4B,oBAC5BC,EAA0B,8BAC1BC,EAAkC,uBAClCC,EAAqD,yBAE9C,MAAMN,EAAgB,IAAM,CACjC,KAAM,CAAE,QAAAO,CAAQ,KAAI,qBAAkB,EAChC,CAAE,MAAAC,CAAM,KAAI,sBAAmB,EAE/BC,KAAoB,WAAQ,KAAO,CAAE,KAAM,EAAG,SAAU,EAAG,GAAI,CAAC,CAAC,EAEjE,CAAE,WAAAC,CAAW,KAAI,EAAAC,SAAcF,CAAiB,EAChD,CAAE,KAAMG,CAAa,KAAI,oBAAiB,CAAE,MAAOL,GAAS,KAAM,CAAC,EACnEM,EAAmBD,GAAc,MAAQA,EAoB/C,SAlBqB,WAAQ,IACtBC,GAAkB,WAICA,EAAiB,WAAW,KAAMC,GACjDA,EAAK,QAAUN,GAASM,EAAK,SACrC,EAGQ,GAGFJ,GAAY,KAAKI,GACfA,EAAK,gBAAkB,cAAY,YAC3C,EAbQ,GAcR,CAACD,GAAkB,WAAYH,CAAU,CAAC,CAG/C",
|
|
6
6
|
"names": ["useSubscribed_exports", "__export", "useSubscribed", "__toCommonJS", "import_react", "import_const", "import_useActivities", "import_provider", "import_lib", "profile", "brand", "activitiesOptions", "activities", "useActivities", "subscription", "subscriptionData", "item"]
|
|
7
7
|
}
|
|
@@ -21,6 +21,7 @@ type Context = {
|
|
|
21
21
|
pageCommon: CreditsPageCommon;
|
|
22
22
|
memberPriceDiscount?: FunctionMemberPriceConfig[];
|
|
23
23
|
alpcBrand?: string;
|
|
24
|
+
alpcCountry?: string;
|
|
24
25
|
cartConfig?: {
|
|
25
26
|
addToCart: (params: {
|
|
26
27
|
variantList: Array<{
|
|
@@ -42,6 +43,6 @@ type Context = {
|
|
|
42
43
|
apiBaseUrl?: string;
|
|
43
44
|
};
|
|
44
45
|
export declare const CreditsContext: import("react").Context<Context>;
|
|
45
|
-
export declare function CreditsProvider({ children, profile, removeProfile, isLoadingProfile, openSignInPopup, openSignUpPopup, taskIdToTypeMapping, creditInfo, customer, customerLoading, fetchCreditInfo, gtm, pageCommon, memberPriceDiscount, alpcBrand, cartConfig, apiBaseUrl, }: PropsWithChildren<Omit<Context, 'openMyRewardsModal' | 'setOpenMyRewardsModal' | 'openActivitiesModal' | 'setOpenActivitiesModal'>>): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export declare function CreditsProvider({ children, profile, removeProfile, isLoadingProfile, openSignInPopup, openSignUpPopup, taskIdToTypeMapping, creditInfo, customer, customerLoading, fetchCreditInfo, gtm, pageCommon, memberPriceDiscount, alpcBrand, alpcCountry, cartConfig, apiBaseUrl, }: PropsWithChildren<Omit<Context, 'openMyRewardsModal' | 'setOpenMyRewardsModal' | 'openActivitiesModal' | 'setOpenActivitiesModal'>>): import("react/jsx-runtime").JSX.Element;
|
|
46
47
|
export declare function useCreditsContext(): Context;
|
|
47
48
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var s=Object.defineProperty;var
|
|
1
|
+
"use strict";var s=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var h=(e,o)=>{for(var i in o)s(e,i,{get:o[i],enumerable:!0})},S=(e,o,i,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of I(o))!O.call(e,t)&&t!==i&&s(e,t,{get:()=>o[t],enumerable:!(r=T(o,t))||r.enumerable});return e};var _=e=>S(s({},"__esModule",{value:!0}),e);var D={};h(D,{CreditsContext:()=>a,CreditsProvider:()=>L,useCreditsContext:()=>B});module.exports=_(D);var d=require("react/jsx-runtime"),n=require("react");const a=(0,n.createContext)({profile:null,isLoadingProfile:!1,taskIdToTypeMapping:{},removeProfile:()=>{},openSignInPopup:()=>{},openSignUpPopup:()=>{},creditInfo:void 0,customerLoading:!1,fetchCreditInfo:e=>{},gtm:{pageGroup:"",pageHandle:""},pageCommon:{},memberPriceDiscount:void 0,alpcBrand:void 0,alpcCountry:void 0,cartConfig:void 0,openMyRewardsModal:!1,setOpenMyRewardsModal:()=>{},openActivitiesModal:!1,setOpenActivitiesModal:()=>{},apiBaseUrl:void 0});function L({children:e,profile:o,removeProfile:i,isLoadingProfile:r,openSignInPopup:t,openSignUpPopup:p,taskIdToTypeMapping:l,creditInfo:c,customer:u,customerLoading:f,fetchCreditInfo:g,gtm:C,pageCommon:m,memberPriceDiscount:M,alpcBrand:v,alpcCountry:y,cartConfig:P,apiBaseUrl:b}){const[A,x]=(0,n.useState)(!1),[R,w]=(0,n.useState)(!1);return(0,d.jsx)(a.Provider,{value:{profile:o,isLoadingProfile:r,removeProfile:i,openSignInPopup:t,openSignUpPopup:p,taskIdToTypeMapping:l,creditInfo:c,fetchCreditInfo:g,customer:u,customerLoading:f,gtm:C,pageCommon:m,memberPriceDiscount:M,alpcBrand:v,alpcCountry:y,cartConfig:P,apiBaseUrl:b,openMyRewardsModal:A,setOpenMyRewardsModal:x,openActivitiesModal:R,setOpenActivitiesModal:w},children:e})}function B(){const e=(0,n.useContext)(a);if(!e)throw new Error("useCreditsContext must be used within a CreditsProvider");return e}
|
|
2
2
|
//# sourceMappingURL=provider.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/context/provider.tsx"],
|
|
4
|
-
"sourcesContent": ["import { createContext, PropsWithChildren, useContext, useState } from 'react'\nimport type { DTC_TASK_TYPE } from './const'\nimport type { CreditInfoResponse } from './response'\nimport { CreditsPageCommon } from '../type'\nimport { FunctionMemberPriceConfig } from './memberPriceTypes'\n\ntype Context = {\n profile: any\n isLoadingProfile: boolean\n removeProfile: () => void\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n openSignInPopup: () => void\n openSignUpPopup: () => void\n creditInfo?: CreditInfoResponse\n customer?: any\n customerLoading: boolean\n fetchCreditInfo: (user_id: string) => void\n gtm: {\n pageGroup: string\n pageHandle?: string\n }\n pageCommon: CreditsPageCommon\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n alpcBrand?: string\n cartConfig?: {\n addToCart: (params: {\n variantList: Array<{\n variant: any\n quantity: number\n attributes?: Array<{ key: string; value: string }>\n }>\n cartAttributes?: Record<string, string>\n discountCodes?: string[]\n }) => void | Promise<any>\n }\n openMyRewardsModal: boolean\n setOpenMyRewardsModal: (open: boolean) => void\n openActivitiesModal: boolean\n setOpenActivitiesModal: (open: boolean) => void\n apiBaseUrl?: string\n}\n\nexport const CreditsContext = createContext<Context>({\n profile: null,\n isLoadingProfile: false,\n taskIdToTypeMapping: {},\n removeProfile: () => {},\n openSignInPopup: () => {},\n openSignUpPopup: () => {},\n creditInfo: undefined,\n customerLoading: false,\n fetchCreditInfo: (user_id: string) => {},\n gtm: {\n pageGroup: '',\n pageHandle: '',\n },\n pageCommon: {},\n memberPriceDiscount: undefined,\n alpcBrand: undefined,\n cartConfig: undefined,\n openMyRewardsModal: false,\n setOpenMyRewardsModal: () => {},\n openActivitiesModal: false,\n setOpenActivitiesModal: () => {},\n apiBaseUrl: undefined,\n})\n\nexport function CreditsProvider({\n children,\n profile,\n removeProfile,\n isLoadingProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n customer,\n customerLoading,\n fetchCreditInfo,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n cartConfig,\n apiBaseUrl,\n}: PropsWithChildren<Omit<Context, 'openMyRewardsModal' | 'setOpenMyRewardsModal' | 'openActivitiesModal' | 'setOpenActivitiesModal'>>) {\n const [openMyRewardsModal, setOpenMyRewardsModal] = useState(false)\n const [openActivitiesModal, setOpenActivitiesModal] = useState(false)\n\n return (\n <CreditsContext.Provider\n value={{\n profile,\n isLoadingProfile,\n removeProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n fetchCreditInfo,\n customer,\n customerLoading,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n cartConfig,\n apiBaseUrl,\n openMyRewardsModal,\n setOpenMyRewardsModal,\n openActivitiesModal,\n setOpenActivitiesModal,\n }}\n >\n {children}\n </CreditsContext.Provider>\n )\n}\n\nexport function useCreditsContext() {\n const context = useContext(CreditsContext)\n if (!context) {\n throw new Error('useCreditsContext must be used within a CreditsProvider')\n }\n return context\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,oBAAAC,EAAA,sBAAAC,IAAA,eAAAC,EAAAL,
|
|
6
|
-
"names": ["provider_exports", "__export", "CreditsContext", "CreditsProvider", "useCreditsContext", "__toCommonJS", "import_jsx_runtime", "import_react", "user_id", "children", "profile", "removeProfile", "isLoadingProfile", "openSignInPopup", "openSignUpPopup", "taskIdToTypeMapping", "creditInfo", "customer", "customerLoading", "fetchCreditInfo", "gtm", "pageCommon", "memberPriceDiscount", "alpcBrand", "cartConfig", "apiBaseUrl", "openMyRewardsModal", "setOpenMyRewardsModal", "openActivitiesModal", "setOpenActivitiesModal", "context"]
|
|
4
|
+
"sourcesContent": ["import { createContext, PropsWithChildren, useContext, useState } from 'react'\nimport type { DTC_TASK_TYPE } from './const'\nimport type { CreditInfoResponse } from './response'\nimport { CreditsPageCommon } from '../type'\nimport { FunctionMemberPriceConfig } from './memberPriceTypes'\n\ntype Context = {\n profile: any\n isLoadingProfile: boolean\n removeProfile: () => void\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n openSignInPopup: () => void\n openSignUpPopup: () => void\n creditInfo?: CreditInfoResponse\n customer?: any\n customerLoading: boolean\n fetchCreditInfo: (user_id: string) => void\n gtm: {\n pageGroup: string\n pageHandle?: string\n }\n pageCommon: CreditsPageCommon\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n alpcBrand?: string\n alpcCountry?: string\n cartConfig?: {\n addToCart: (params: {\n variantList: Array<{\n variant: any\n quantity: number\n attributes?: Array<{ key: string; value: string }>\n }>\n cartAttributes?: Record<string, string>\n discountCodes?: string[]\n }) => void | Promise<any>\n }\n openMyRewardsModal: boolean\n setOpenMyRewardsModal: (open: boolean) => void\n openActivitiesModal: boolean\n setOpenActivitiesModal: (open: boolean) => void\n apiBaseUrl?: string\n}\n\nexport const CreditsContext = createContext<Context>({\n profile: null,\n isLoadingProfile: false,\n taskIdToTypeMapping: {},\n removeProfile: () => {},\n openSignInPopup: () => {},\n openSignUpPopup: () => {},\n creditInfo: undefined,\n customerLoading: false,\n fetchCreditInfo: (user_id: string) => {},\n gtm: {\n pageGroup: '',\n pageHandle: '',\n },\n pageCommon: {},\n memberPriceDiscount: undefined,\n alpcBrand: undefined,\n alpcCountry: undefined,\n cartConfig: undefined,\n openMyRewardsModal: false,\n setOpenMyRewardsModal: () => {},\n openActivitiesModal: false,\n setOpenActivitiesModal: () => {},\n apiBaseUrl: undefined,\n})\n\nexport function CreditsProvider({\n children,\n profile,\n removeProfile,\n isLoadingProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n customer,\n customerLoading,\n fetchCreditInfo,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n alpcCountry,\n cartConfig,\n apiBaseUrl,\n}: PropsWithChildren<Omit<Context, 'openMyRewardsModal' | 'setOpenMyRewardsModal' | 'openActivitiesModal' | 'setOpenActivitiesModal'>>) {\n const [openMyRewardsModal, setOpenMyRewardsModal] = useState(false)\n const [openActivitiesModal, setOpenActivitiesModal] = useState(false)\n\n return (\n <CreditsContext.Provider\n value={{\n profile,\n isLoadingProfile,\n removeProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n fetchCreditInfo,\n customer,\n customerLoading,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n alpcCountry,\n cartConfig,\n apiBaseUrl,\n openMyRewardsModal,\n setOpenMyRewardsModal,\n openActivitiesModal,\n setOpenActivitiesModal,\n }}\n >\n {children}\n </CreditsContext.Provider>\n )\n}\n\nexport function useCreditsContext() {\n const context = useContext(CreditsContext)\n if (!context) {\n throw new Error('useCreditsContext must be used within a CreditsProvider')\n }\n return context\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,oBAAAC,EAAA,sBAAAC,IAAA,eAAAC,EAAAL,GA6FI,IAAAM,EAAA,6BA7FJC,EAAuE,iBA2ChE,MAAML,KAAiB,iBAAuB,CACnD,QAAS,KACT,iBAAkB,GAClB,oBAAqB,CAAC,EACtB,cAAe,IAAM,CAAC,EACtB,gBAAiB,IAAM,CAAC,EACxB,gBAAiB,IAAM,CAAC,EACxB,WAAY,OACZ,gBAAiB,GACjB,gBAAkBM,GAAoB,CAAC,EACvC,IAAK,CACH,UAAW,GACX,WAAY,EACd,EACA,WAAY,CAAC,EACb,oBAAqB,OACrB,UAAW,OACX,YAAa,OACb,WAAY,OACZ,mBAAoB,GACpB,sBAAuB,IAAM,CAAC,EAC9B,oBAAqB,GACrB,uBAAwB,IAAM,CAAC,EAC/B,WAAY,MACd,CAAC,EAEM,SAASL,EAAgB,CAC9B,SAAAM,EACA,QAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,SAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,IAAAC,EACA,WAAAC,EACA,oBAAAC,EACA,UAAAC,EACA,YAAAC,EACA,WAAAC,EACA,WAAAC,CACF,EAAwI,CACtI,KAAM,CAACC,EAAoBC,CAAqB,KAAI,YAAS,EAAK,EAC5D,CAACC,EAAqBC,CAAsB,KAAI,YAAS,EAAK,EAEpE,SACE,OAAC5B,EAAe,SAAf,CACC,MAAO,CACL,QAAAQ,EACA,iBAAAE,EACA,cAAAD,EACA,gBAAAE,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,gBAAAG,EACA,SAAAF,EACA,gBAAAC,EACA,IAAAE,EACA,WAAAC,EACA,oBAAAC,EACA,UAAAC,EACA,YAAAC,EACA,WAAAC,EACA,WAAAC,EACA,mBAAAC,EACA,sBAAAC,EACA,oBAAAC,EACA,uBAAAC,CACF,EAEC,SAAArB,EACH,CAEJ,CAEO,SAASL,GAAoB,CAClC,MAAM2B,KAAU,cAAW7B,CAAc,EACzC,GAAI,CAAC6B,EACH,MAAM,IAAI,MAAM,yDAAyD,EAE3E,OAAOA,CACT",
|
|
6
|
+
"names": ["provider_exports", "__export", "CreditsContext", "CreditsProvider", "useCreditsContext", "__toCommonJS", "import_jsx_runtime", "import_react", "user_id", "children", "profile", "removeProfile", "isLoadingProfile", "openSignInPopup", "openSignUpPopup", "taskIdToTypeMapping", "creditInfo", "customer", "customerLoading", "fetchCreditInfo", "gtm", "pageCommon", "memberPriceDiscount", "alpcBrand", "alpcCountry", "cartConfig", "apiBaseUrl", "openMyRewardsModal", "setOpenMyRewardsModal", "openActivitiesModal", "setOpenActivitiesModal", "context"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var z=Object.create;var y=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var H=(r,s)=>{for(var d in s)y(r,d,{get:s[d],enumerable:!0})},_=(r,s,d,m)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of M(s))!G.call(r,c)&&c!==d&&y(r,c,{get:()=>s[c],enumerable:!(m=L(s,c))||m.enumerable});return r};var T=(r,s,d)=>(d=r!=null?z(O(r)):{},_(s||!r||!r.__esModule?y(d,"default",{value:r,enumerable:!0}):d,r)),V=r=>_(y({},"__esModule",{value:!0}),r);var J={};H(J,{AddressForm:()=>Y});module.exports=V(J);var n=require("react/jsx-runtime"),C=T(require("classnames")),l=require("react"),S=require("./CountrySelect"),w=require("./FormItem"),I=require("./Input"),D=require("./StateSelect"),q=require("../../context/const"),P=require("../../context/provider"),R=require("@anker-in/lib"),U=require("../../../../constants");const Y=({countries:r,countriesLoading:s,form:d,validate:m,errors:c,onChange:p})=>{const{profile:b,customer:t,alpcCountry:h}=(0,P.useCreditsContext)(),{locale:v,brand:B}=(0,R.useHeadlessContext)(),E=U.ROUNDED_BRANDS.includes(B),[e,f]=(0,l.useState)(),A=(0,l.useMemo)(()=>r.find(u=>u.code===e?.country)?.provinces||[],[e,r]),k=(0,l.useMemo)(()=>d?.flat().find(u=>u.type==="state")?.key,[d]),F=(0,l.useCallback)(()=>{if(t?.defaultAddress)return{name:(t?.defaultAddress.firstName||"")+" "+(t?.defaultAddress.lastName||""),first_name:t?.defaultAddress.firstName,last_name:t?.defaultAddress.lastName,address1:t?.defaultAddress.address1,address2:t?.defaultAddress.address2,city:t?.defaultAddress.city,phone:t?.defaultAddress.phone,country:t?.defaultAddress.countryCodeV2,province:t?.defaultAddress.province,province_code:t?.defaultAddress.provinceCode,email:t?.email||b?.email,zip:t?.defaultAddress.zip};{let a=h||q.ALPC_COUNTRY_MAP.get(v)||v;return a==="UK"&&(a="GB"),a==="EU"&&(a="NL"),{email:b?.email,country:a}}},[t,b?.email,v,h]);return(0,l.useEffect)(()=>{const a=F();f(a),p(a)},[F]),e?(0,n.jsx)("div",{className:"grid gap-[20px]",children:d&&d.map((a,u)=>(0,n.jsx)("div",{className:"item-center -mx-[6px] flex",children:a.map((o,K)=>{const N=c.find(i=>i.key===o.key)?.message,x=(0,C.default)("h-full w-full appearance-none rounded-[2px] border bg-white px-[14px] py-[17px] leading-[1] outline-none placeholder:text-[#999] autofill:shadow-white focus:border-brand disabled:pointer-events-none disabled:text-[#999] disabled:bg-[#F7F8F9] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",N?"!border-[#F84D4F]":"border-[#d8d8d8]",!E&&"rounded-none");return o.type==="state"&&!A.length?null:(0,n.jsx)("div",{className:(0,C.default)("mx-[6px] flex-1"),children:(0,n.jsxs)(w.FormItem,{error:N,required:o.required,label:o.label,children:[o.type==="country"&&(0,n.jsx)(S.CountrySelect,{className:x,countries:r,loading:s,value:e.country,onChange:i=>{e.country!==i&&(e.province="",e.province_code=""),e.country=i,f({...e}),p(e)}}),o.type==="state"&&(0,n.jsx)(D.StateSelect,{className:x,states:A,stateCode:e.province_code,stateName:e.province,onChange:(i,g)=>{e.province_code=i,e.province=g,f({...e}),p(e)}}),o.type!=="state"&&o.type!=="country"&&(0,n.jsx)(I.Input,{placeholder:o.label,className:x,error:N,value:e[o.key],required:o.required,disabled:o.type==="email",onChange:i=>{const g=i.target.value;e[o.key]=g,f({...e}),p(e)},onBlur:()=>{m({ignoreKeys:A.length&&k?[k]:[]})}})]})},K)})},u))}):null};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/creditsRedeemList/AddressForm/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import classNames from 'classnames'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { CountrySelect } from './CountrySelect'\nimport { FormItem } from './FormItem'\nimport { Input } from './Input'\nimport { StateSelect } from './StateSelect'\nimport { ALPC_COUNTRY_MAP } from '../../context/const'\nimport { useCreditsContext } from '../../context/provider'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { AddressFormProps } from './type'\nimport { ROUNDED_BRANDS } from '../../../../constants'\n\nexport const AddressForm = ({ countries, countriesLoading, form, validate, errors, onChange }: AddressFormProps) => {\n const { profile, customer } = useCreditsContext()\n const { locale, brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const [address, setAddress] = useState<Record<string, any>>()\n\n const states = useMemo(() => {\n const currentCountry = countries.find(item => item.code === address?.country)\n\n return currentCountry?.provinces || []\n }, [address, countries])\n\n const stateInputKey = useMemo(() => {\n const stateInput = form?.flat().find(item => item.type === 'state')\n return stateInput?.key\n }, [form])\n\n const getDefaultAddress = useCallback(() => {\n if (customer?.defaultAddress) {\n return {\n name: (customer?.defaultAddress.firstName || '') + ' ' + (customer?.defaultAddress.lastName || ''),\n first_name: customer?.defaultAddress.firstName,\n last_name: customer?.defaultAddress.lastName,\n address1: customer?.defaultAddress.address1,\n address2: customer?.defaultAddress.address2,\n city: customer?.defaultAddress.city,\n phone: customer?.defaultAddress.phone,\n country: customer?.defaultAddress.countryCodeV2,\n province: customer?.defaultAddress.province,\n province_code: customer?.defaultAddress.provinceCode,\n email: customer?.email || profile?.email,\n zip: customer?.defaultAddress.zip,\n }\n } else {\n let defaultCountry = ALPC_COUNTRY_MAP.get(locale) || locale\n if (defaultCountry === 'UK') {\n defaultCountry = 'GB'\n }\n if (defaultCountry === 'EU') {\n defaultCountry = 'NL'\n }\n return {\n email: profile?.email,\n country: defaultCountry,\n }\n }\n }, [customer, profile?.email, locale])\n\n useEffect(() => {\n const defaultAddress = getDefaultAddress()\n setAddress(defaultAddress)\n onChange(defaultAddress)\n }, [getDefaultAddress])\n\n if (!address) {\n return null\n }\n\n return (\n <div className=\"grid gap-[20px]\">\n {form &&\n form.map((row, rowIndex: number) => (\n <div key={rowIndex} className=\"item-center -mx-[6px] flex\">\n {row.map((input, inputIndex: number) => {\n const error = errors.find(item => item.key === input.key)?.message\n const inputClassName = classNames(\n 'h-full w-full appearance-none rounded-[2px] border bg-white px-[14px] py-[17px] leading-[1] outline-none placeholder:text-[#999] autofill:shadow-white focus:border-brand disabled:pointer-events-none disabled:text-[#999] disabled:bg-[#F7F8F9] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none',\n error ? '!border-[#F84D4F]' : 'border-[#d8d8d8]',\n !rounded && 'rounded-none'\n )\n\n if (input.type === 'state') {\n if (!states.length) {\n return null\n }\n }\n\n return (\n <div key={inputIndex} className={classNames('mx-[6px] flex-1')}>\n <FormItem error={error} required={input.required} label={input.label}>\n {input.type === 'country' && (\n <CountrySelect\n className={inputClassName}\n countries={countries}\n loading={countriesLoading}\n value={address.country}\n onChange={selectedCountryCode => {\n if (address.country !== selectedCountryCode) {\n address.province = ''\n address.province_code = ''\n }\n address.country = selectedCountryCode\n setAddress({ ...address })\n onChange(address)\n }}\n ></CountrySelect>\n )}\n {input.type === 'state' && (\n <StateSelect\n className={inputClassName}\n states={states}\n stateCode={address.province_code}\n stateName={address.province}\n onChange={(provinceCode, provinceName) => {\n address.province_code = provinceCode\n address.province = provinceName\n setAddress({ ...address })\n onChange(address)\n }}\n ></StateSelect>\n )}\n\n {input.type !== 'state' && input.type !== 'country' && (\n <Input\n placeholder={input.label}\n className={inputClassName}\n error={error}\n value={address[input.key]}\n required={input.required}\n disabled={input.type === 'email'}\n onChange={event => {\n const value = event.target.value\n address[input.key] = value\n setAddress({ ...address })\n onChange(address)\n }}\n onBlur={() => {\n validate({\n ignoreKeys: states.length && stateInputKey ? [stateInputKey] : [],\n })\n }}\n />\n )}\n </FormItem>\n </div>\n )\n })}\n </div>\n ))}\n </div>\n )\n}\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,IAAA,eAAAC,EAAAH,GA4FkB,IAAAI,EAAA,6BA5FlBC,EAAuB,yBACvBC,EAA0D,iBAE1DC,EAA8B,2BAC9BC,EAAyB,sBACzBC,EAAsB,mBACtBC,EAA4B,yBAC5BC,EAAiC,+BACjCC,EAAkC,kCAClCC,EAAmC,yBAEnCC,EAA+B,iCAExB,MAAMZ,EAAc,CAAC,CAAE,UAAAa,EAAW,iBAAAC,EAAkB,KAAAC,EAAM,SAAAC,EAAU,OAAAC,EAAQ,SAAAC,CAAS,IAAwB,CAClH,KAAM,CAAE,QAAAC,EAAS,SAAAC,
|
|
6
|
-
"names": ["AddressForm_exports", "__export", "AddressForm", "__toCommonJS", "import_jsx_runtime", "import_classnames", "import_react", "import_CountrySelect", "import_FormItem", "import_Input", "import_StateSelect", "import_const", "import_provider", "import_lib", "import_constants", "countries", "countriesLoading", "form", "validate", "errors", "onChange", "profile", "customer", "locale", "brand", "rounded", "address", "setAddress", "states", "item", "stateInputKey", "getDefaultAddress", "defaultCountry", "defaultAddress", "row", "rowIndex", "input", "inputIndex", "error", "inputClassName", "classNames", "selectedCountryCode", "provinceCode", "provinceName", "event", "value"]
|
|
4
|
+
"sourcesContent": ["import classNames from 'classnames'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { CountrySelect } from './CountrySelect'\nimport { FormItem } from './FormItem'\nimport { Input } from './Input'\nimport { StateSelect } from './StateSelect'\nimport { ALPC_COUNTRY_MAP } from '../../context/const'\nimport { useCreditsContext } from '../../context/provider'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { AddressFormProps } from './type'\nimport { ROUNDED_BRANDS } from '../../../../constants'\n\nexport const AddressForm = ({ countries, countriesLoading, form, validate, errors, onChange }: AddressFormProps) => {\n const { profile, customer, alpcCountry } = useCreditsContext()\n const { locale, brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const [address, setAddress] = useState<Record<string, any>>()\n\n const states = useMemo(() => {\n const currentCountry = countries.find(item => item.code === address?.country)\n\n return currentCountry?.provinces || []\n }, [address, countries])\n\n const stateInputKey = useMemo(() => {\n const stateInput = form?.flat().find(item => item.type === 'state')\n return stateInput?.key\n }, [form])\n\n const getDefaultAddress = useCallback(() => {\n if (customer?.defaultAddress) {\n return {\n name: (customer?.defaultAddress.firstName || '') + ' ' + (customer?.defaultAddress.lastName || ''),\n first_name: customer?.defaultAddress.firstName,\n last_name: customer?.defaultAddress.lastName,\n address1: customer?.defaultAddress.address1,\n address2: customer?.defaultAddress.address2,\n city: customer?.defaultAddress.city,\n phone: customer?.defaultAddress.phone,\n country: customer?.defaultAddress.countryCodeV2,\n province: customer?.defaultAddress.province,\n province_code: customer?.defaultAddress.provinceCode,\n email: customer?.email || profile?.email,\n zip: customer?.defaultAddress.zip,\n }\n } else {\n let defaultCountry = alpcCountry || ALPC_COUNTRY_MAP.get(locale) || locale\n if (defaultCountry === 'UK') {\n defaultCountry = 'GB'\n }\n if (defaultCountry === 'EU') {\n defaultCountry = 'NL'\n }\n return {\n email: profile?.email,\n country: defaultCountry,\n }\n }\n }, [customer, profile?.email, locale, alpcCountry])\n\n useEffect(() => {\n const defaultAddress = getDefaultAddress()\n setAddress(defaultAddress)\n onChange(defaultAddress)\n }, [getDefaultAddress])\n\n if (!address) {\n return null\n }\n\n return (\n <div className=\"grid gap-[20px]\">\n {form &&\n form.map((row, rowIndex: number) => (\n <div key={rowIndex} className=\"item-center -mx-[6px] flex\">\n {row.map((input, inputIndex: number) => {\n const error = errors.find(item => item.key === input.key)?.message\n const inputClassName = classNames(\n 'h-full w-full appearance-none rounded-[2px] border bg-white px-[14px] py-[17px] leading-[1] outline-none placeholder:text-[#999] autofill:shadow-white focus:border-brand disabled:pointer-events-none disabled:text-[#999] disabled:bg-[#F7F8F9] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none',\n error ? '!border-[#F84D4F]' : 'border-[#d8d8d8]',\n !rounded && 'rounded-none'\n )\n\n if (input.type === 'state') {\n if (!states.length) {\n return null\n }\n }\n\n return (\n <div key={inputIndex} className={classNames('mx-[6px] flex-1')}>\n <FormItem error={error} required={input.required} label={input.label}>\n {input.type === 'country' && (\n <CountrySelect\n className={inputClassName}\n countries={countries}\n loading={countriesLoading}\n value={address.country}\n onChange={selectedCountryCode => {\n if (address.country !== selectedCountryCode) {\n address.province = ''\n address.province_code = ''\n }\n address.country = selectedCountryCode\n setAddress({ ...address })\n onChange(address)\n }}\n ></CountrySelect>\n )}\n {input.type === 'state' && (\n <StateSelect\n className={inputClassName}\n states={states}\n stateCode={address.province_code}\n stateName={address.province}\n onChange={(provinceCode, provinceName) => {\n address.province_code = provinceCode\n address.province = provinceName\n setAddress({ ...address })\n onChange(address)\n }}\n ></StateSelect>\n )}\n\n {input.type !== 'state' && input.type !== 'country' && (\n <Input\n placeholder={input.label}\n className={inputClassName}\n error={error}\n value={address[input.key]}\n required={input.required}\n disabled={input.type === 'email'}\n onChange={event => {\n const value = event.target.value\n address[input.key] = value\n setAddress({ ...address })\n onChange(address)\n }}\n onBlur={() => {\n validate({\n ignoreKeys: states.length && stateInputKey ? [stateInputKey] : [],\n })\n }}\n />\n )}\n </FormItem>\n </div>\n )\n })}\n </div>\n ))}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,IAAA,eAAAC,EAAAH,GA4FkB,IAAAI,EAAA,6BA5FlBC,EAAuB,yBACvBC,EAA0D,iBAE1DC,EAA8B,2BAC9BC,EAAyB,sBACzBC,EAAsB,mBACtBC,EAA4B,yBAC5BC,EAAiC,+BACjCC,EAAkC,kCAClCC,EAAmC,yBAEnCC,EAA+B,iCAExB,MAAMZ,EAAc,CAAC,CAAE,UAAAa,EAAW,iBAAAC,EAAkB,KAAAC,EAAM,SAAAC,EAAU,OAAAC,EAAQ,SAAAC,CAAS,IAAwB,CAClH,KAAM,CAAE,QAAAC,EAAS,SAAAC,EAAU,YAAAC,CAAY,KAAI,qBAAkB,EACvD,CAAE,OAAAC,EAAQ,MAAAC,CAAM,KAAI,sBAAmB,EACvCC,EAAU,iBAAe,SAASD,CAAK,EACvC,CAACE,EAASC,CAAU,KAAI,YAA8B,EAEtDC,KAAS,WAAQ,IACEd,EAAU,KAAKe,GAAQA,EAAK,OAASH,GAAS,OAAO,GAErD,WAAa,CAAC,EACpC,CAACA,EAASZ,CAAS,CAAC,EAEjBgB,KAAgB,WAAQ,IACTd,GAAM,KAAK,EAAE,KAAKa,GAAQA,EAAK,OAAS,OAAO,GAC/C,IAClB,CAACb,CAAI,CAAC,EAEHe,KAAoB,eAAY,IAAM,CAC1C,GAAIV,GAAU,eACZ,MAAO,CACL,MAAOA,GAAU,eAAe,WAAa,IAAM,KAAOA,GAAU,eAAe,UAAY,IAC/F,WAAYA,GAAU,eAAe,UACrC,UAAWA,GAAU,eAAe,SACpC,SAAUA,GAAU,eAAe,SACnC,SAAUA,GAAU,eAAe,SACnC,KAAMA,GAAU,eAAe,KAC/B,MAAOA,GAAU,eAAe,MAChC,QAASA,GAAU,eAAe,cAClC,SAAUA,GAAU,eAAe,SACnC,cAAeA,GAAU,eAAe,aACxC,MAAOA,GAAU,OAASD,GAAS,MACnC,IAAKC,GAAU,eAAe,GAChC,EACK,CACL,IAAIW,EAAiBV,GAAe,mBAAiB,IAAIC,CAAM,GAAKA,EACpE,OAAIS,IAAmB,OACrBA,EAAiB,MAEfA,IAAmB,OACrBA,EAAiB,MAEZ,CACL,MAAOZ,GAAS,MAChB,QAASY,CACX,CACF,CACF,EAAG,CAACX,EAAUD,GAAS,MAAOG,EAAQD,CAAW,CAAC,EAQlD,SANA,aAAU,IAAM,CACd,MAAMW,EAAiBF,EAAkB,EACzCJ,EAAWM,CAAc,EACzBd,EAASc,CAAc,CACzB,EAAG,CAACF,CAAiB,CAAC,EAEjBL,KAKH,OAAC,OAAI,UAAU,kBACZ,SAAAV,GACCA,EAAK,IAAI,CAACkB,EAAKC,OACb,OAAC,OAAmB,UAAU,6BAC3B,SAAAD,EAAI,IAAI,CAACE,EAAOC,IAAuB,CACtC,MAAMC,EAAQpB,EAAO,KAAKW,GAAQA,EAAK,MAAQO,EAAM,GAAG,GAAG,QACrDG,KAAiB,EAAAC,SACrB,kVACAF,EAAQ,oBAAsB,mBAC9B,CAACb,GAAW,cACd,EAEA,OAAIW,EAAM,OAAS,SACb,CAACR,EAAO,OACH,QAKT,OAAC,OAAqB,aAAW,EAAAY,SAAW,iBAAiB,EAC3D,oBAAC,YAAS,MAAOF,EAAO,SAAUF,EAAM,SAAU,MAAOA,EAAM,MAC5D,UAAAA,EAAM,OAAS,cACd,OAAC,iBACC,UAAWG,EACX,UAAWzB,EACX,QAASC,EACT,MAAOW,EAAQ,QACf,SAAUe,GAAuB,CAC3Bf,EAAQ,UAAYe,IACtBf,EAAQ,SAAW,GACnBA,EAAQ,cAAgB,IAE1BA,EAAQ,QAAUe,EAClBd,EAAW,CAAE,GAAGD,CAAQ,CAAC,EACzBP,EAASO,CAAO,CAClB,EACD,EAEFU,EAAM,OAAS,YACd,OAAC,eACC,UAAWG,EACX,OAAQX,EACR,UAAWF,EAAQ,cACnB,UAAWA,EAAQ,SACnB,SAAU,CAACgB,EAAcC,IAAiB,CACxCjB,EAAQ,cAAgBgB,EACxBhB,EAAQ,SAAWiB,EACnBhB,EAAW,CAAE,GAAGD,CAAQ,CAAC,EACzBP,EAASO,CAAO,CAClB,EACD,EAGFU,EAAM,OAAS,SAAWA,EAAM,OAAS,cACxC,OAAC,SACC,YAAaA,EAAM,MACnB,UAAWG,EACX,MAAOD,EACP,MAAOZ,EAAQU,EAAM,GAAG,EACxB,SAAUA,EAAM,SAChB,SAAUA,EAAM,OAAS,QACzB,SAAUQ,GAAS,CACjB,MAAMC,EAAQD,EAAM,OAAO,MAC3BlB,EAAQU,EAAM,GAAG,EAAIS,EACrBlB,EAAW,CAAE,GAAGD,CAAQ,CAAC,EACzBP,EAASO,CAAO,CAClB,EACA,OAAQ,IAAM,CACZT,EAAS,CACP,WAAYW,EAAO,QAAUE,EAAgB,CAACA,CAAa,EAAI,CAAC,CAClE,CAAC,CACH,EACF,GAEJ,GAvDQO,CAwDV,CAEJ,CAAC,GA1EOF,CA2EV,CACD,EACL,EApFO,IAsFX",
|
|
6
|
+
"names": ["AddressForm_exports", "__export", "AddressForm", "__toCommonJS", "import_jsx_runtime", "import_classnames", "import_react", "import_CountrySelect", "import_FormItem", "import_Input", "import_StateSelect", "import_const", "import_provider", "import_lib", "import_constants", "countries", "countriesLoading", "form", "validate", "errors", "onChange", "profile", "customer", "alpcCountry", "locale", "brand", "rounded", "address", "setAddress", "states", "item", "stateInputKey", "getDefaultAddress", "defaultCountry", "defaultAddress", "row", "rowIndex", "input", "inputIndex", "error", "inputClassName", "classNames", "selectedCountryCode", "provinceCode", "provinceName", "event", "value"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { default as Chat } from './chat/index
|
|
2
|
-
export { Role, ActionExecutionMessage, TextMessage, useCopilotChat, useCopilotAction, useCopilotReadable, } from './chat/utils
|
|
1
|
+
export { default as Chat } from './chat/index';
|
|
2
|
+
export { Role, ActionExecutionMessage, TextMessage, useCopilotChat, useCopilotAction, useCopilotReadable, } from './chat/utils';
|
|
3
3
|
export * from './credits/index.js';
|
|
4
4
|
export * from './registration/index.js';
|
|
5
5
|
export * from './memberPopup/index.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var l=Object.create;var C=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var f=(e,t)=>{for(var s in t)C(e,s,{get:t[s],enumerable:!0})},i=(e,t,s,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of x(t))!c.call(e,a)&&a!==s&&C(e,a,{get:()=>t[a],enumerable:!(p=u(t,a))||p.enumerable});return e},r=(e,t,s)=>(i(e,t,"default"),s&&i(s,t,"default")),m=(e,t,s)=>(s=e!=null?l(M(e)):{},i(t||!e||!e.__esModule?C(s,"default",{value:e,enumerable:!0}):s,e)),h=e=>i(C({},"__esModule",{value:!0}),e);var n={};f(n,{ActionExecutionMessage:()=>o.ActionExecutionMessage,Chat:()=>g.default,LiveChatWidget:()=>d.LiveChatWidget,Role:()=>o.Role,TextMessage:()=>o.TextMessage,useCopilotAction:()=>o.useCopilotAction,useCopilotChat:()=>o.useCopilotChat,useCopilotReadable:()=>o.useCopilotReadable});module.exports=h(n);var g=m(require("./chat/index
|
|
1
|
+
"use strict";var l=Object.create;var C=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var f=(e,t)=>{for(var s in t)C(e,s,{get:t[s],enumerable:!0})},i=(e,t,s,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of x(t))!c.call(e,a)&&a!==s&&C(e,a,{get:()=>t[a],enumerable:!(p=u(t,a))||p.enumerable});return e},r=(e,t,s)=>(i(e,t,"default"),s&&i(s,t,"default")),m=(e,t,s)=>(s=e!=null?l(M(e)):{},i(t||!e||!e.__esModule?C(s,"default",{value:e,enumerable:!0}):s,e)),h=e=>i(C({},"__esModule",{value:!0}),e);var n={};f(n,{ActionExecutionMessage:()=>o.ActionExecutionMessage,Chat:()=>g.default,LiveChatWidget:()=>d.LiveChatWidget,Role:()=>o.Role,TextMessage:()=>o.TextMessage,useCopilotAction:()=>o.useCopilotAction,useCopilotChat:()=>o.useCopilotChat,useCopilotReadable:()=>o.useCopilotReadable});module.exports=h(n);var g=m(require("./chat/index")),o=require("./chat/utils");r(n,require("./credits/index.js"),module.exports);r(n,require("./registration/index.js"),module.exports);r(n,require("./memberPopup/index.js"),module.exports);var d=require("./LiveChatWidget/index.js");
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { default as Chat } from './chat/index
|
|
5
|
-
"mappings": "wmBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mSAAAE,EAAAF,GAAA,IAAAG,EAAgC,
|
|
4
|
+
"sourcesContent": ["export { default as Chat } from './chat/index'\n\nexport {\n Role,\n ActionExecutionMessage,\n TextMessage,\n useCopilotChat,\n useCopilotAction,\n useCopilotReadable,\n} from './chat/utils'\n\nexport * from './credits/index.js'\n\nexport * from './registration/index.js'\n\nexport * from './memberPopup/index.js'\n\n\n\n// LiveChatWidget \u5BFC\u51FA\nexport { LiveChatWidget } from './LiveChatWidget/index.js'\nexport type {\n LiveChatWidgetProps,\n Message,\n MessageContent,\n MessageRole,\n MessageContentType,\n MessageMetadata,\n MessageRenderer,\n QuickReply,\n ProductCardContent,\n ProductListContent,\n PolicyContent,\n QuickRepliesContent,\n ThinkingContent,\n ErrorContent,\n SSEEvent,\n ChatStreamRequest,\n} from './LiveChatWidget/index.js'\n"],
|
|
5
|
+
"mappings": "wmBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mSAAAE,EAAAF,GAAA,IAAAG,EAAgC,2BAEhCC,EAOO,wBAEPC,EAAAL,EAAc,8BAXd,gBAaAK,EAAAL,EAAc,mCAbd,gBAeAK,EAAAL,EAAc,kCAfd,gBAoBA,IAAAM,EAA+B",
|
|
6
6
|
"names": ["components_exports", "__export", "__toCommonJS", "import_chat", "import_utils", "__reExport", "import_LiveChatWidget"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var V=Object.create;var h=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var B=(e,n)=>{for(var i in n)h(e,i,{get:n[i],enumerable:!0})},S=(e,n,i,d)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of H(n))!j.call(e,s)&&s!==i&&h(e,s,{get:()=>n[s],enumerable:!(d=R(n,s))||d.enumerable});return e};var u=(e,n,i)=>(i=e!=null?V(T(e)):{},S(n||!e||!e.__esModule?h(i,"default",{value:e,enumerable:!0}):i,e)),L=e=>S(h({},"__esModule",{value:!0}),e);var Z={};B(Z,{MemberPopup:()=>Q});module.exports=L(Z);var t=require("react/jsx-runtime"),r=require("react"),M=require("@anker-in/headless-ui"),b=require("@anker-in/lib"),o=require("./type"),I=require("./context/provider"),O=require("./context/provider"),z=require("./context/viewStack"),p=require("./icons"),_=require("../../constants");const D=(0,r.lazy)(()=>import("./panels/EarnCredits")),U=(0,r.lazy)(()=>import("./panels/ConsumeCredits")),F=(0,r.lazy)(()=>import("./panels/Referral")),W=(0,r.lazy)(()=>import("./panels/EarnCredits/CompleteProfilePanel")),q=(0,r.lazy)(()=>import("./panels/ActivitiesSubscribePanel")),G=(0,r.lazy)(()=>import("./panels/EarnCredits/SubscribeEmailPanel")),J=(0,r.lazy)(()=>import("./panels/EarnCredits/ActivatePanel")),K=(0,r.lazy)(()=>import("./panels/ConsumeCredits/RedeemCouponPanel"));function Q({copy:e,bottomOffset:n="24px",...i}){const[d,s]=(0,r.useState)(!1),x=e.bottomOffset??n;return(0,r.useEffect)(()=>{const m=e.pageConfig;if(!m){s(!0);return}const N=window.location.pathname,C=m.pages.some(v=>N===v||N.startsWith(v+"/"));switch(m.scope){case o.MemberPopupPageScope.Include:s(C);break;case o.MemberPopupPageScope.Exclude:s(!C);break;default:s(!0)}},[e.pageConfig]),d?(0,t.jsx)(I.MemberPopupProvider,{...i,earnCreditsCopy:e.earnCredits,children:(0,t.jsx)(X,{copy:e,bottomOffset:x})}):null}function X({copy:e,bottomOffset:n}){const{profile:i,openSignInPopup:d,openSignUpPopup:s}=(0,O.useMemberPopupContext)(),{brand:x}=(0,b.useHeadlessContext)(),m=_.ROUNDED_BRANDS.includes(x),N=!!i,[C,v]=(0,r.useState)(!1),[y,w]=(0,r.useState)([]),l=y[y.length-1]??null,P=(0,r.useCallback)(a=>{w(c=>[...c,a])},[]),f=(0,r.useCallback)(()=>{w(a=>a.slice(0,-1))},[]),A="Member Floating Window";function g(a,c){(0,b.gaTrack)({event:"ga4Event",event_name:"lp_button",event_parameters:{position:a,button_name:c,info:A}})}function E(a,c){switch(a){case o.MemberPopupActionType.ExternalLink:c&&window.open(c,"_blank","noopener,noreferrer");break;case o.MemberPopupActionType.OpenEarnCredits:g("home","earn_credits"),P({type:o.MemberPopupPanelType.EarnCredits});break;case o.MemberPopupActionType.OpenConsumeCredits:g("home","consume_credits"),P({type:o.MemberPopupPanelType.ConsumeCredits});break;case o.MemberPopupActionType.OpenReferral:g("home","referral"),P({type:o.MemberPopupPanelType.Referral});break;case o.MemberPopupActionType.OpenSubscribe:g("home","subscribe"),P({type:o.MemberPopupPanelType.Subscribe});break}}function k(){v(!1),w([])}return(0,t.jsxs)(z.ViewStackContext.Provider,{value:{pushView:P,popView:f},children:[C&&(0,t.jsx)("div",{className:"fixed inset-0 z-[998]",onClick:k}),(0,t.jsxs)("div",{className:"fixed right-0 z-[999] flex flex-row items-end pr-[20px] md:flex-col md:items-end md:right-0 md:w-screen md:pr-0 md:pl-0",style:{bottom:n},children:[C&&(0,t.jsxs)("div",{className:"relative mr-[12px] md:mr-[12px] md:mb-[12px]",onClick:a=>a.stopPropagation(),children:[(0,t.jsx)("div",{className:"absolute right-[-7px] bottom-[24px] size-0 border-y-8 border-l-8 border-r-0 border-y-transparent border-l-white md:bottom-[-8px] md:right-[25px] md:top-auto md:border-y-0 md:border-l-8 md:border-r-8 md:border-t-8 md:border-l-transparent md:border-r-transparent md:border-t-white"}),(0,t.jsxs)("div",{className:(0,b.classNames)("flex w-[420px] max-w-[calc(100vw-32px)] min-h-[500px] flex-col overflow-hidden bg-white shadow-[0_8px_32px_rgba(0,0,0,0.16)] md:w-[calc(100vw-32px)] md:max-w-[400px]",m?"rounded-[12px]":"rounded-none"),style:{maxHeight:"min(80vh, 606px)"},children:[(0,t.jsxs)("div",{className:"flex items-center justify-end pl-[10px] pr-[16px] pb-[8px] pt-[16px]",children:[l!==null&&(0,t.jsx)("button",{className:"mr-auto flex size-[24px] cursor-pointer items-center justify-center",onClick:f,"aria-label":"Back",children:(0,t.jsx)(p.IconSwitch,{})}),(0,t.jsx)("button",{className:"flex size-[24px] cursor-pointer items-center justify-center",onClick:()=>{g("floating_button","close"),k()},"aria-label":"Close",children:(0,t.jsx)(p.IconClose,{})})]}),(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-[12px] overflow-y-auto p-[16px]",children:[l===null&&(0,t.jsxs)(t.Fragment,{children:[(e.title||e.subtitle)&&(0,t.jsxs)("div",{className:"flex flex-col gap-[4px]",children:[e.title&&(0,t.jsx)("h2",{className:"text-[24px] font-[700] leading-[1.2] text-[#080a0f]",children:e.title}),e.subtitle&&(0,t.jsx)("p",{className:"text-[16px] font-[700] leading-snug text-[#4a4c56]",children:e.subtitle})]}),e.list.map((a,c)=>(0,t.jsx)(Y,{item:a,onAction:E,rounded:m},c))]}),l!==null&&(0,t.jsxs)(r.Suspense,{fallback:(0,t.jsx)("div",{className:"flex items-center justify-center py-[32px]",children:(0,t.jsx)("div",{className:"size-[32px] animate-spin rounded-full border-[3px] border-[#080a0f] border-t-transparent"})}),children:[l.type===o.MemberPopupPanelType.EarnCredits&&e.earnCredits&&(0,t.jsx)(D,{copy:e.earnCredits}),l.type===o.MemberPopupPanelType.ConsumeCredits&&e.consumeCredits&&(0,t.jsx)(U,{copy:e.consumeCredits}),l.type===o.MemberPopupPanelType.Referral&&e.referral&&(0,t.jsx)(F,{copy:e.referral,onClose:f}),l.type===o.MemberPopupPanelType.CompleteProfile&&e.earnCredits&&(0,t.jsx)(W,{copy:e.earnCredits.completeProfile,onClose:f}),l.type===o.MemberPopupPanelType.Subscribe&&e.activitiesSubscribe&&(0,t.jsx)(q,{copy:e.activitiesSubscribe,email:i?.email}),l.type===o.MemberPopupPanelType.SubscribeEmail&&e.earnCredits&&(0,t.jsx)(G,{copy:e.earnCredits.subscribe,email:i?.email,onClose:f}),l.type===o.MemberPopupPanelType.Activate&&e.earnCredits&&(0,t.jsx)(J,{copy:e.earnCredits.authCodeActivate,onClose:f}),l.type===o.MemberPopupPanelType.RedeemCoupon&&l.props&&e.consumeCredits&&(0,t.jsx)(K,{item:l.props,copy:e.consumeCredits,onClose:f})]})]}),e.footer&&!N&&(0,t.jsx)("div",{className:"border-t border-[#dadce0] p-[16px]",children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-[16px]",children:[(0,t.jsxs)("div",{className:"inline gap-[4px]",children:[(0,t.jsx)("span",{className:"text-[14px] font-[700] text-[#080a0f]",children:e.footer.loginHint}),(0,t.jsx)("button",{className:"cursor-pointer ml-[4px] text-[14px] font-bold text-[#080a0f] underline",onClick:d,children:e.footer.loginLabel})]}),(0,t.jsx)("div",{className:"flex shrink-0 items-center gap-[8px]",children:(0,t.jsx)("button",{className:(0,b.classNames)("cursor-pointer border-[1.6px] border-[#080a0f] px-[20px] pb-[10px] pt-[11px] text-[14px] font-[700] leading-[1.2] text-[#080a0f]",m?"rounded-[4px]":"rounded-none"),onClick:s,children:e.footer.joinLabel})})]})})]})]}),(0,t.jsx)("button",{className:"flex cursor-pointer items-center justify-center rounded-full bg-white shadow-lg md:ml-auto md:mr-[16px]",onClick:()=>{const a=!C;g("floating_button",a?"open":"close"),v(a)},"aria-label":e.triggerImg.alt??"Open member popup",children:(0,t.jsx)("div",{className:"size-[var(--member-popup-pc-icon-size)] md:size-[var(--member-popup-mobile-icon-size)]",style:{"--member-popup-pc-icon-size":e.pcIconSize??"58px","--member-popup-mobile-icon-size":e.mobileIconSize??e.pcIconSize??"58px"},children:(0,t.jsx)(M.Picture,{source:e.triggerImg.url,alt:e.triggerImg.alt??"",className:"size-full"})})})]})]})}function Y({item:e,onAction:n,rounded:i}){const d={[o.MemberPopupActionType.OpenEarnCredits]:p.IconCredit,[o.MemberPopupActionType.OpenConsumeCredits]:p.IconBag,[o.MemberPopupActionType.OpenReferral]:p.IconReferral,[o.MemberPopupActionType.OpenSubscribe]:p.IconSubscription};return(0,t.jsxs)("div",{className:(0,b.classNames)("flex flex-col gap-[16px] bg-[#f5f6f7] p-[16px]",i?"rounded-[8px]":"rounded-none"),children:[(0,t.jsxs)("div",{className:"flex flex-col gap-[4px]",children:[(0,t.jsx)("h3",{className:"text-[20px] font-[700] leading-[1.2] text-[#1e2024]",children:e.title}),e.description&&(0,t.jsx)("p",{className:"text-[14px] font-[700] leading-[1.43] text-[#1e2024]",children:e.description})]}),(0,t.jsx)("div",{className:"flex flex-col gap-[16px]",children:e.links.map((s,x)=>{const m=d[s.type];return(0,t.jsxs)("div",{children:[x>0&&(0,t.jsx)("div",{className:"mb-[16px] h-px bg-[#dadce0]"}),(0,t.jsxs)("button",{className:"flex w-full cursor-pointer items-center gap-[12px]",onClick:()=>n(s.type,s.url),children:[m&&(0,t.jsx)(m,{className:"size-[24px] shrink-0"}),(0,t.jsx)("span",{className:"flex-1 text-left text-[14px] font-[700] text-[#1e2024]",children:s.label}),(0,t.jsx)(p.IconArrow,{className:"size-[16px] shrink-0"})]})]},x)})})]})}
|
|
2
2
|
//# sourceMappingURL=MemberPopup.js.map
|