react-native-hyperswitch-dev-sdk 0.4.7 → 0.4.9
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/android/src/main/assets/hyperswitch.bundle +2 -2
- package/ios/hyperswitchSDK/Core/Resources/hyperswitch.bundle +1 -1
- package/lib/commonjs/index.bundle.js +1 -1
- package/lib/commonjs/index.bundle.js.map +1 -1
- package/lib/module/index.bundle.js +1 -1
- package/lib/module/index.bundle.js.map +1 -1
- package/package.json +1 -1
- package/src/context/PaymentSession.ts +2 -1
- package/src/views/CVCElement.tsx +3 -3
- package/src/views/PaymentElement.tsx +3 -3
|
@@ -1504,7 +1504,7 @@ __d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0})
|
|
|
1504
1504
|
__d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.usePayButton=function(){var s=e.useContext(u.nativePropContext)[0],l=i.useThemeBasedStyle(),p=l.googlePayButtonColor,f=l.applePayButtonColor,b=l.buttonBorderRadius,y=t.useWebKit(),k=y.launchGPay,h=y.launchApplePay,v=n.useScript("https://pay.google.com/gp/p/js/pay.js"),_=n.useScript("https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js"),O=e.useState(function(){}),S=O[1],w=O[0],P=e.useState(function(){}),C=P[1],B=P[0];return e.useEffect(function(){if("ready"===v&&void 0!==w){var e,t=o.getGpayToken(w,s.hyperswitchConfig.environment),n=new google.payments.api.PaymentsClient(t.environment);switch(s.configuration.walletButtons.googlePay.buttonType){case"BUY":e="buy";break;case"BOOK":e="book";break;case"CHECKOUT":e="checkout";break;case"DONATE":e="donate";break;case"ORDER":e="order";break;case"PAY":e="pay";break;case"SUBSCRIBE":e="subscribe";break;case"PLAIN":e="plain"}var r={onClick:function(){k(o.getGpayTokenStringified(w,s.hyperswitchConfig.environment))},buttonType:e,buttonSizeMode:"fill",buttonColor:"light"===p?"white":"black",buttonRadius:b},i=n.createButton(r),u=document.querySelector("#google-wallet-button-container");null!=u&&(u.innerHTML="",u.appendChild(i))}},[v,w]),e.useEffect(function(){if("ready"===_&&void 0!==B){var e=document.querySelector("apple-pay-button");if(null!=e){e.removeAttribute("hidden"),e.removeAttribute("aria-hidden"),e.removeAttribute("disabled"),e.setAttribute("buttonstyle","whiteOutline"===f?"white-outline":"black"===f?"black":"white");var t=s.configuration.walletButtons.applePay.buttonType;e.setAttribute("type","plain"===t?"plain":"setUp"===t?"setUp":"buy"===t?"buy":"subscribe"===t?"subscribe":"inStore"===t?"inStore":"checkout"===t?"checkout":"donate"===t?"donate":"book"),e.setAttribute("locale","en-US"),e.onclick=function(){try{return h(JSON.stringify(Object.fromEntries([["session_token_data",B.session_token_data],["payment_request_data",B.payment_request_data]])))}catch(t){var e=c.internalToOCamlException(t);return void alert(r.getOr(JSON.stringify(c.as_js_exn(e)),"failed"))}}}}},[_,B]),[function(e,t){C(function(t){return e})},function(e){S(function(t){return e})}]};var e=s(_r(d[0])),t=s(_r(d[1])),n=s(_r(d[2])),o=s(_r(d[3])),r=s(_r(d[4])),i=s(_r(d[5])),u=s(_r(d[6])),c=s(_r(d[7]));function s(e,t){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(s=function(e,t){if(!t&&e&&e.__esModule)return e;var r,i,u={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return u;if(r=t?o:n){if(r.has(e))return r.get(e);r.set(e,u)}for(var c in e)"default"!==c&&{}.hasOwnProperty.call(e,c)&&((i=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,c))&&(i.get||i.set)?r(u,c,i):u[c]=e[c]);return u})(e,t)}},1454,[120,501,1312,528,505,1314,534,515]);
|
|
1505
1505
|
__d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.make=void 0;var e=B(_r(d[0])),t=B(_r(d[1])),n=B(_r(d[2])),i=B(_r(d[3])),o=B(_r(d[4])),r=B(_r(d[5])),s=B(_r(d[6])),u=B(_r(d[7])),c=B(_r(d[8])),l=B(_r(d[9])),p=B(_r(d[10])),_=B(_r(d[11])),y=B(_r(d[12])),f=B(_r(d[13])),v=B(_r(d[14])),h=B(_r(d[15])),P=B(_r(d[16])),E=B(_r(d[17])),S=B(_r(d[18])),C=B(_r(d[19])),A=B(_r(d[20])),O=B(_r(d[21])),b=B(_r(d[22])),T=B(_r(d[23])),k=B(_r(d[24])),F=B(_r(d[25])),L=B(_r(d[26])),x=B(_r(d[27])),D=B(_r(d[28])),w=B(_r(d[29])),R=B(_r(d[30])),M=B(_r(d[31])),N=B(_r(d[32])),j=B(_r(d[33])),G=B(_r(d[34])),I=B(_r(d[35])),Y=B(_r(d[36]));function B(e,t){if("function"==typeof WeakMap)var n=new WeakMap,i=new WeakMap;return(B=function(e,t){if(!t&&e&&e.__esModule)return e;var o,r,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(o=t?i:n){if(o.has(e))return o.get(e);o.set(e,s)}for(var u in e)"default"!==u&&{}.hasOwnProperty.call(e,u)&&((r=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,u))&&(r.get||r.set)?o(s,u,r):s[u]=e[u]);return s})(e,t)}_e.make=function(B){var V=B.style,W=B.animated,U=B.setIsScreenFocus,q=B.isScreenFocus,H=B.setConfirmButtonData,z=B.customerPaymentMethods,J=void 0===q||q,K=void 0!==U?U:function(e){},Q=void 0===W||W,X=void 0!==V?v.valFromOption(V):R.empty,Z=n.useContext(D.nativePropContext)[0],$=Z.configuration.paymentMethodLayout.savedMethodCustomization.groupingBehavior.displayInSeparateScreen,ee=n.useContext(j.allApiDataContext),te=ee[2],ne=ee[1],ie=ee[0],oe=n.useContext(I.dynamicFieldsContext),ae=oe.nickname,re=oe.getRequiredFieldsForButton,se=n.useContext(T.loadingContext)[1],de=n.useContext(L.viewPortContext)[0],ue=s.useAlerts(),ce=p.useLoggerHook(),le=k.useRedirectHook(),me=u.useGetLocalObj(),pe=k.useHandleSuccessFailure(),ye=c.useProcessPayButtonResult(),fe=i.useWebKit(),ve=fe.launchGPay,ge=fe.launchApplePay,he=x.useNotifyValidationFailure(),Pe=Y.useWalletConfirmCallback(),Ee=n.useState(function(){}),Se=Ee[1],Ce=Ee[0],Ae=n.useState(function(){return!1}),Oe=Ae[1],be=Ae[0],Te=n.useCallback(function(e){e&&Se(function(e){}),Oe(function(t){return e})},[Oe]),ke=n.useState(function(){}),Fe=ke[1],Le=ke[0],xe=n.useState(function(){return z[0]}),De=xe[1],we=xe[0],Re=n.useCallback(function(e){De(function(t){return e})},[De]);n.useEffect(function(){Re(z[0]),Fe(function(e){}),Te(!1)},[z]);var Me=b.usePaymentEventEmitter(),Ne=n.useRef(void 0),je=F.useThemeBasedStyle(),Ge=je.component,Ie=_.useGetShadowStyle(je.shadowConfig,void 0),Ye=function(e){se("ProcessingPayments");var n="WALLET"===e.payment_method?S.generateWalletConfirmBody(Z,e.payment_token,e.payment_method_type,E.getOr(E.map(ie,function(e){return e.payment_type_str}),void 0)):S.generateSavedCardConfirmBody(Z,e.payment_method_str,e.payment_token,Le,E.getOr(E.map(ie,function(e){return e.payment_type_str}),void 0),de.screenHeight,de.screenWidth,v.some(e.billing));le(t.getStringFromRecord(n),Z.hyperswitchConfig.publishableKey,Z.paymentSessionConfig.clientSecret,function(e,t,n){t||se("FillingDetails"),pe(e,t,void 0,void 0)},e.payment_method_str,void 0,function(e,t){if("PaymentSuccess"!==e)return pe(t,void 0,void 0,void 0);se("PaymentSuccess"),setTimeout(function(){pe(t,void 0,void 0,void 0)},300)},void 0,void 0)},Be=function(e,t,n,i){var o=re(e,t,n,i,!1,void 0),r=o[1];if(o[0])return se("FillingDetails");var s=t,u=E.mapOr(r.email,void 0,l.Decode.string);se("ProcessingPayments");var c,p=e.payment_method;c="CARD"===p?void 0!==ae?Object.fromEntries([["payment_method_data",Object.fromEntries([[e.payment_method_str,Object.fromEntries([["nick_name",ae]])]])]]):{}:Object.fromEntries([["payment_method_data",Object.fromEntries([[e.payment_method_str,Object.fromEntries([[e.payment_method_type+("PAY_LATER"===p||"PAYPAL"===e.payment_method_type_wallet?"_redirect":""),E.getOr(s,{})]])]])]]);var _=S.generateCardConfirmBody(Z,e.payment_method_str,e.payment_method_type,h.mergeDict(c,r).payment_method_data,E.getOr(E.map(ie,function(e){return e.payment_type}),"NORMAL"),E.getOr(E.map(ie,function(e){return e.payment_type_str}),void 0),E.map(ie,function(e){return e.redirect_url}),!1,void 0,"CARD"===e.payment_method&&Z.configuration.displaySavedPaymentMethodsCheckbox,E.getOr(E.map(ne,function(e){return e.is_guest_customer}),!0),u,de.screenHeight,de.screenWidth,void 0);le(E.getOr(JSON.stringify(_),""),Z.hyperswitchConfig.publishableKey,Z.paymentSessionConfig.clientSecret,function(e,t,n){t||se("FillingDetails"),pe(e,t,void 0,void 0)},e.payment_method_type,e.payment_experience,function(e,t){if("PaymentSuccess"!==e)return pe(t,void 0,void 0,void 0);se("PaymentSuccess"),setTimeout(function(){pe(t,void 0,void 0,void 0)},300)},"CARD"===e.payment_method,void 0)},Ve=function(e){if(void 0!==ie){var t=ie.payment_methods.find(function(e){return"GOOGLE_PAY"===e.payment_method_type_wallet});if(void 0!==t){var n=ye("GOOGLE_PAY",e);if("object"==typeof n){if("Success"===n.TAG)return Be(t,n._0,n._1,n._2);var i=n._0;return se("FillingDetails"),he(v.some(i)),ue("error",i)}return se("FillingDetails"),he("Payment was Cancelled"),ue("warning","Payment was Cancelled")}return se("FillingDetails"),he("Technical Error"),ue("error","Technical Error")}se("FillingDetails"),ue("error","Technical Error")},We=function(e){if(void 0!==ie){var t=ie.payment_methods.find(function(e){return"APPLE_PAY"===e.payment_method_type_wallet});if(void 0!==t){ce("DEBUG",t.payment_method_type,"USER_EVENT",t.payment_method_type,t.payment_experience,void 0,void 0,"APPLE_PAY_CALLBACK_FROM_NATIVE",void 0,void 0);var n=ye("APPLE_PAY",e);if("object"!=typeof n)return"Cancelled"===n?(se("FillingDetails"),he("Cancelled"),ue("warning","Cancelled")):void setTimeout(function(){se("FillingDetails"),he("Apple Pay is not supported in Simulated Environment"),ue("warning","Apple Pay is not supported in Simulated Environment")},2e3);if("Success"===n.TAG)return Be(t,n._0,n._1,n._2);var i=n._0;return se("FillingDetails"),he(v.some(i)),ue("error",i)}return se("FillingDetails"),he("Technical Error"),ue("error","Technical Error")}return se("FillingDetails"),he("Technical Error"),ue("error","Technical Error")};n.useEffect(function(){var e=E.map(we,function(e){return e.payment_method_type_wallet});if(void 0!==e)switch(e){case"GOOGLE_PAY":o.registerEventListener("googlePayData",Ve);break;case"APPLE_PAY":o.registerEventListener("applePayData",We)}},[we]);var Ue="NORMAL"!==E.getOr(E.map(ie,function(e){return e.payment_type}),"NORMAL"),qe=function(){se("FillingDetails")},He=function(e){var t=!Ue||Ue&&(be||E.isNone(Le));if(void 0!==we&&t)switch(we.payment_method){case"WALLET":switch(we.payment_method_type_wallet){case"GOOGLE_PAY":var n=void 0!==te?E.getOr(te.find(function(e){return"GOOGLE_PAY"===e.wallet_name}),C.defaultToken):C.defaultToken;return void Pe("google_pay",function(){return"android"===i.platform?P.launchGPay(f.getGpayTokenStringified(n,Z.hyperswitchConfig.environment),Ve):ve(f.getGpayTokenStringified(n,Z.hyperswitchConfig.environment))},qe);case"APPLE_PAY":var o=void 0!==te?E.getOr(te.find(function(e){return"APPLE_PAY"===e.wallet_name}),C.defaultToken):C.defaultToken;if(null===o.session_token_data||null===o.payment_request_data)return se("FillingDetails"),ue("warning","Waiting for Sessions API");ce("DEBUG","apple_pay","USER_EVENT","apple_pay",void 0,void 0,void 0,"APPLE_PAY_STARTED_FROM_JS",void 0,void 0);return void Pe("apple_pay",function(){var e=setTimeout(function(){se("FillingDetails"),ue("warning","Apple Pay Error, Please try again"),ce("DEBUG","apple_pay","USER_EVENT","apple_pay",void 0,void 0,void 0,"APPLE_PAY_PRESENT_FAIL_FROM_NATIVE",void 0,void 0)},5e3);return"ios"===i.platform?P.launchApplePay(JSON.stringify(Object.fromEntries([["session_token_data",o.session_token_data],["payment_request_data",o.payment_request_data]])),We,function(e){ce("DEBUG","apple_pay","USER_EVENT","apple_pay",void 0,void 0,void 0,"APPLE_PAY_BRIDGE_SUCCESS",void 0,void 0)},function(t){clearTimeout(e)}):ge(JSON.stringify(Object.fromEntries([["session_token_data",o.session_token_data],["payment_request_data",o.payment_request_data]])))},qe);case"PAYPAL":return void Pe("paypal",function(){Ye(we)},qe);case"SAMSUNG_PAY":return void Pe("samsung_pay",function(){Ye(we)},qe);case"NONE":return void Pe("wallet",function(){Ye(we)},qe)}case"CARD":return!we.requires_cvv||!E.isNone(Le)&&y.cvcNumberInRange(E.getOr(Le,""),E.getOr(E.map(we.card,function(e){return e.card_network}),""))?Ye(we):(E.isNone(Le)&&Fe(function(e){return""}),se("FillingDetails"),he("Please enter a valid CVV"));default:return Ye(we)}se("FillingDetails"),Ue&&!be&&Se(function(e){return"Please accept the terms and conditions to continue."}),he("Please accept the terms and conditions to continue.")};return n.useEffect(function(){if(void 0!==we){var e=b.buildPaymentMethodStatusEvent(we.payment_method_str,we.payment_method_type,!0,void 0);Me.emitPaymentMethodStatus(e)}},[we]),n.useEffect(function(){if(void 0!==we){var e,t=(e="CARD"!==we.payment_method||!we.requires_cvv||void 0!==Le&&(Le.length>0&&y.cvcNumberInRange(Le,E.getOr(E.map(we.card,function(e){return e.card_network}),""))))?"Complete":"Filling",n=w.formStatusValueToString(t);if(Ne.current!==n){Ne.current=n;var i=b.buildFormStatusEvent(t);Me.emitFormStatus(i)}var o=we.card;if(void 0!==o){var r=b.buildCardInfoFromSavedCard(o.card_isin,o.last4_digits,o.card_network,o.expiry_month,o.expiry_year,e);Me.emitCardInfo(r)}}},[we,Le]),n.useEffect(function(){if(J){var e=E.getOr(E.map(we,function(e){return e.payment_method_type}),"Saved Payment"),t=E.map(we,function(e){return e.payment_experience});H({loading:!1,visible:!0,handlePress:He,payment_method_type:e,customer_payment_experience:t,errorText:Ce})}},[ie,z,te,H,we,Le,Ce,be,J]),M.jsxs(O.make,{children:[M.jsx(r.RenderIf.make,{condition:$,children:M.jsx(e.make,{})}),M.jsx(A.View,{style:[$||"Tabs"===Z.configuration.paymentMethodLayout.layoutType&&!Z.configuration.paymentMethodLayout.savedMethodCustomization.groupingBehavior.displayInSeparateSection?{borderColor:Ge.borderColor,borderRadius:je.borderRadius,borderWidth:je.borderWidth}:R.empty,je.bgColor,"Tabs"!==Z.configuration.paymentMethodLayout.layoutType||Z.configuration.paymentMethodLayout.savedMethodCustomization.groupingBehavior.displayInSeparateSection?R.empty:Ie,{backgroundColor:$?Ge.background:void 0,flexShrink:1},X],children:v.some(M.jsx(N.make,{customerPaymentMethods:z,selectedToken:we,setSelectedToken:Re,savedCardCvv:Le,setSavedCardCvv:Fe,isScreenFocus:J,animated:Q,maxVisibleItems:B.maxVisibleItems,setIsScreenFocus:K}))}),Ue&&E.isSome(Le)?M.jsxs(A.View,{style:{paddingHorizontal:2},children:[M.jsx(G.make,{initialIconName:"checkboxClicked",updateIconName:"checkboxNotClicked",text:me.cardTermsPart1+B.merchantName+me.cardTermsPart2,isSelected:be,setIsSelected:Te,textType:"ModalText",disabled:!1}),M.jsx(e.make,{})]}):M.jsx(e.make,{height:4})],level:"Screen",rootTag:Z.rootTag})}},1455,[1309,500,120,501,1312,1317,1344,1329,1440,514,1002,1319,1335,528,504,1386,535,505,1010,1011,3,1027,1338,1324,1345,1314,1325,1437,534,522,1308,252,1456,1349,1427,1407,1453]);
|
|
1506
1506
|
__d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.make=_e.PaymentMethodListView=_e.PMWithNickNameComponent=_e.MoreButton=_e.CVVComponent=void 0;var e=_(_r(d[0])),t=_(_r(d[1])),o=_(_r(d[2])),n=_(_r(d[3])),i=_(_r(d[4])),r=_(_r(d[5])),s=_(_r(d[6])),l=_(_r(d[7])),c=_(_r(d[8])),u=_(_r(d[9])),h=_(_r(d[10])),y=_(_r(d[11])),v=_(_r(d[12])),p=_(_r(d[13])),f=_(_r(d[14])),C=_(_r(d[15])),x=_(_r(d[16])),k=_(_r(d[17])),S=_(_r(d[18])),j=_(_r(d[19])),w=_(_r(d[20])),M=_(_r(d[21]));function _(e,t){if("function"==typeof WeakMap)var o=new WeakMap,n=new WeakMap;return(_=function(e,t){if(!t&&e&&e.__esModule)return e;var i,r,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(i=t?n:o){if(i.has(e))return i.get(e);i.set(e,s)}for(var l in e)"default"!==l&&{}.hasOwnProperty.call(e,l)&&((r=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,l))&&(r.get||r.set)?i(s,l,r):s[l]=e[l]);return s})(e,t)}function V(t){var n=t.hideCvcIcon,c=t.hideCVCError,u=t.hideCardExpiry,f=t.cardScheme,C=t.setSavedCardCvv,k=t.savedCardCvv,S=x.useThemeBasedStyle(),M=o.useState(function(){return!1}),_=M[1],V=!(!M[0]&&!v.isNone(k))||v.getOr(k,"").length>0&&s.cvcNumberInRange(v.getOr(k,""),f),b=r.useGetLocalObj(),T=V?void 0:b.inCompleteCVCErrorText;return w.jsxs(p.View,{style:{alignItems:u?"flex-end":"flex-start",display:"flex",flexDirection:"column",marginHorizontal:l.some(u?7.5:47.5)},children:[w.jsxs(p.View,{style:{alignItems:"center",display:"flex",flex:1,flexDirection:"row",marginTop:l.some(u?v.isSome(T)&&!c?2:0:10),width:u?void 0:l.some(j.pct(100))},children:[u?null:w.jsx(p.View,{style:{width:50},children:l.some(w.jsx(y.make,{text:"CVC:",textType:"ModalText"}))}),w.jsx(h.make,{state:v.getOr(k,""),setState:function(e){C(function(t){return s.formatCVCNumber(e,f)})},placeholder:u?v.getOr(t.placeholderCVC,b.cvcTextLabel):"123",width:l.some(n?72:100),secureTextEntry:!0,keyboardType:"number-pad",iconRight:n?void 0:{TAG:"CustomIcon",_0:s.checkCardCVC(v.getOr(k,""),f)?w.jsx(e.make,{name:"cvvfilled",width:35,height:35,fill:"black"}):w.jsx(e.make,{name:"cvvempty",width:35,height:35,fill:"black"})},enableCrossIcon:!1,isValid:V,onFocus:function(){_(function(e){return!0})},onBlur:function(){_(function(e){return!1})},textColor:V?S.component.color:S.dangerColor,animateLabel:"CVC"})]}),v.isSome(T)&&!c?w.jsx(i.make,{text:l.some(T)}):null]})}_e.CVVComponent={make:V};function b(n){var i,r=n.isPaymentMethodSelected,s=n.savedPaymentMethod,c=o.useContext(S.nativePropContext)[0],h=x.useThemeBasedStyle(),f=h.primaryColor,C=h.iconColor,k=c.configuration.paymentMethodLayout.savedMethodCustomization.groupingBehavior.displayInSeparateSection?h.logoConfig:void 0,j=s.card,M=void 0!==j?j.nick_name:void 0,_=s.default_payment_method_set,V=v.isNone(k);if(void 0!==k){var b,T=s.card;if(void 0!==T){var I=T.card_network;b=""===I?""===T.scheme?u.getDisplayName(s.payment_method_type):T.scheme:I}else b=u.getDisplayName(s.payment_method_type);var P=r&&c.configuration.paymentMethodLayout.showCheckedIconForSelection,D=v.getOr(k.checkedIconForSelection,x.defaultCheckedIconForSelection);i=w.jsxs(p.View,{style:{backgroundColor:k.colors.backgroundColor,borderRadius:k.borderRadius,padding:10,position:"relative"},children:[w.jsx(e.make,{name:b,width:18,height:18,fill:r?f:C}),P?w.jsx(e.make,{name:"selected",width:D.size,height:D.size,fill:D.color,stroke:v.getOr(D.stroke,h.component.background),style:{bottom:l.some(D.bottom),position:"absolute",right:l.some(D.right)}}):null]})}else{var L,E=s.card;if(void 0!==E){var N=E.card_network;L=""===N?""===E.scheme?u.getDisplayName(s.payment_method_type):E.scheme:N}else L=u.getDisplayName(s.payment_method_type);i=w.jsx(e.make,{name:L,width:26,height:26,fill:r?f:C})}var z=v.isNone(k),B=s.card,O=s.card;return w.jsxs(p.View,{style:{display:"flex",flexDirection:"column"},children:[void 0!==M&&V&&""!==M?w.jsxs(p.View,{style:{alignItems:"center",display:"flex",flexDirection:"row"},children:[w.jsx(y.make,{text:M.length>15?M.slice(0,13).concat(".."):M,textType:"CardTextBold"}),w.jsx(t.make,{height:5}),c.configuration.displayDefaultSavedPaymentIcon&&_?w.jsx(e.make,{name:"defaultTick",width:14,height:14,fill:"black"}):null]}):null,w.jsxs(p.View,{style:{alignItems:"center",display:"flex",flexDirection:"row"},children:[i,w.jsx(t.make,{width:8}),w.jsxs(p.View,{style:{flexDirection:"column"},children:[void 0===M||z||""===M?null:w.jsxs(p.View,{style:{alignItems:"center",display:"flex",flexDirection:"row"},children:[w.jsx(y.make,{text:M.length>15?M.slice(0,13).concat(".."):M,textType:"CardTextBold"}),w.jsx(t.make,{height:5}),c.configuration.displayDefaultSavedPaymentIcon&&_?w.jsx(e.make,{name:"defaultTick",width:14,height:14,fill:"black"}):null]}),w.jsx(y.make,{text:void 0!==B?"\u25cf\u25cf\u25cf\u25cf ".concat(B.last4_digits):u.getDisplayName(s.payment_method_type),textType:void 0!==O?"CardText":"CardTextBold"})]})]})]})}_e.PMWithNickNameComponent={make:b};function T(e){var o=e.handleMoreToggle,n=x.useThemeBasedStyle();return w.jsx(p.View,{style:{alignItems:"center",flex:1,justifyContent:"center"},children:l.some(w.jsxs(C.make,{onPress:function(e){o()},children:[w.jsx(c.make,{width:12,height:12,fill:n.linkColor}),w.jsx(t.make,{height:5}),w.jsx(y.make,{text:"Show More",textType:"LinkText"})],style:[{borderColor:n.component.borderColor,borderRadius:n.borderRadius,alignItems:"center",flexDirection:"row",justifyContent:"flex-start",minWidth:115,paddingHorizontal:14,paddingVertical:20,width:l.some(j.pct(100))}]}))})}_e.MoreButton={make:T};function I(e){var n=e.setIsScreenFocus,i=e.setSelectedToken,s=e.isPaymentMethodSelected,c=e.setSavedCardCvv,u=e.savedCardCvv,h=e.savedPaymentMethod,M=o.useContext(S.nativePropContext)[0],_=M.configuration.paymentMethodLayout.savedMethodCustomization.hideCardExpiry,T=r.useGetLocalObj(),I=x.useThemeBasedStyle(),P=M.configuration.paymentMethodLayout.savedMethodCustomization.groupingBehavior.displayInSeparateSection?I.logoConfig:void 0,D=f.usePaymentEventEmitter(),L=h.card;return w.jsxs(C.make,{onPress:function(e){s||c(function(e){}),i(h),n(!0);var t=f.buildPaymentMethodStatusEvent(h.payment_method_str,h.payment_method_type,!0,void 0);D.emitPaymentMethodStatus(t)},children:[w.jsxs(p.View,{style:{alignItems:"center",flex:1,flexDirection:"row",flexWrap:"wrap",gap:8,justifyContent:"space-between",paddingLeft:12},children:[w.jsxs(p.View,{style:{alignItems:"center",flex:1,flexDirection:"row",height:l.some(j.pct(100))},children:[v.isNone(P)?w.jsx(k.make,{size:20.5,selected:s,color:I.primaryColor}):null,v.isNone(P)?w.jsx(t.make,{}):null,w.jsx(b,{savedPaymentMethod:h,isPaymentMethodSelected:s})]}),_?s&&"CARD"===h.payment_method&&h.requires_cvv?w.jsx(V,{savedCardCvv:u,setSavedCardCvv:c,cardScheme:v.getOr(v.map(h.card,function(e){return e.card_network}),""),hideCardExpiry:_,hideCVCError:M.configuration.paymentMethodLayout.savedMethodCustomization.hideCVCError,hideCvcIcon:"Hidden"===M.configuration.paymentMethodLayout.savedMethodCustomization.cvcIcon,placeholderCVC:M.configuration.placeholder.cvv}):null:void 0!==L?w.jsx(y.make,{text:T.cardExpiresText+" "+L.expiry_month+"/"+L.expiry_year.slice(-2),textType:"ModalTextLight",overrideStyle:l.some({marginLeft:"auto"})}):null]}),s&&"CARD"===h.payment_method&&h.requires_cvv&&!_?w.jsx(V,{savedCardCvv:u,setSavedCardCvv:c,cardScheme:v.getOr(v.map(h.card,function(e){return e.card_network}),""),hideCardExpiry:_,hideCVCError:M.configuration.paymentMethodLayout.savedMethodCustomization.hideCVCError,hideCvcIcon:"Hidden"===M.configuration.paymentMethodLayout.savedMethodCustomization.cvcIcon,placeholderCVC:M.configuration.placeholder.cvv}):null],style:{borderBottomColor:I.component.borderColor,justifyContent:"center",minHeight:60,paddingVertical:l.some(_?5:16)}})}_e.PaymentMethodListView={make:I};_e.make=function(e){var t=e.setIsScreenFocus,i=e.maxVisibleItems,r=e.animated,s=e.setSavedCardCvv,c=e.savedCardCvv,u=e.setSelectedToken,h=e.selectedToken,y=e.customerPaymentMethods,f=void 0!==i?i:3,C=o.useContext(S.nativePropContext)[0],x=o.useState(function(){return!r}),k=x[1],_=x[0],V=C.configuration.paymentMethodLayout.savedMethodCustomization.groupingBehavior.displayInSeparateScreen,b=y.length>f&&_?y.slice(0,f):y,P=b.map(function(e,o){return w.jsx(I,{savedPaymentMethod:e,isButtomBorder:(b.length-1|0)!==o||y.length>f&&_,savedCardCvv:c,setSavedCardCvv:s,isPaymentMethodSelected:v.getOr(v.map(h,function(t){return t.payment_method_id===e.payment_method_id}),0===o),setSelectedToken:u,setIsScreenFocus:t},e.payment_method_id)}),D=w.jsxs(w.Fragment,{children:[P,w.jsx(n.RenderIf.make,{condition:y.length>f&&_,children:w.jsx(T,{handleMoreToggle:function(){t(!0),k(function(e){return!1})}})})]}),L=o.useRef(new p.Animated.Value(1)),E=o.useRef(new p.Animated.Value(0)),N=o.useState(function(){return!1}),z=N[1],B=N[0];return o.useEffect(function(){if(B){var e=p.Animated.loop(p.Animated.sequence([M.timing(E.current,{toValue:6,useNativeDriver:!0,easing:p.Easing.ease,duration:1e3}),M.timing(E.current,{toValue:0,useNativeDriver:!0,duration:1e3})]));return M.start(e,function(e){}),function(){M.stop(e)}}},[B]),r?w.jsxs(p.View,{style:l.some(j.empty),children:[w.jsx(p.ScrollView,{style:{maxHeight:V?void 0:240},children:l.some(D),scrollEventThrottle:16,nestedScrollEnabled:!0,contentContainerStyle:{paddingHorizontal:V||"Tabs"===C.configuration.paymentMethodLayout.layoutType?16:void 0},keyboardShouldPersistTaps:"handled",onContentSizeChange:function(e,t){z(function(e){return t>(V?600:240)})},onScroll:function(e){var t=e.nativeEvent.contentOffset.y,o=e.nativeEvent.contentSize.height,n=e.nativeEvent.layoutMeasurement.height;return t>50||n+t>=o-20?M.start(M.timing(L.current,{toValue:0,useNativeDriver:!0,duration:300}),function(e){}):M.start(M.timing(L.current,{toValue:1,useNativeDriver:!0,duration:300}),function(e){})},showsVerticalScrollIndicator:!1}),B?w.jsx(p.Animated.Text,{style:{color:"#aaa",fontSize:12,opacity:L.current,transform:[{translateY:E.current}],alignSelf:"center",bottom:l.some(C.configuration.paymentMethodLayout.savedMethodCustomization.groupingBehavior.displayInSeparateScreen?10:C.configuration.paymentMethodLayout.savedMethodCustomization.groupingBehavior.displayInSeparateSection?8:"Tabs"===C.configuration.paymentMethodLayout.layoutType?10:-2),position:"absolute"},children:"Scroll for more \u2193"}):null]}):D}},1456,[1029,1309,120,1317,1397,1329,1335,504,1389,1386,1337,1310,505,3,1338,1322,1314,1457,534,1308,252,1323]);
|
|
1507
|
-
__d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.make=void 0;var e=o(_r(d[0])),t=o(_r(d[1])),r=o(_r(d[2]));function o(e,t){if("function"==typeof WeakMap)var r=new WeakMap,n=new WeakMap;return(o=function(e,t){if(!t&&e&&e.__esModule)return e;var o,i,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,s)}for(var u in e)"default"!==u&&{}.hasOwnProperty.call(e,u)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,u))&&(i.get||i.set)?o(s,u,i):s[u]=e[u]);return s})(e,t)}_e.make=function(o){var n=o.color,i=o.selected,s=o.size,u=void 0!==s?s:18,f=void 0!==n?n:"#006DF9";return r.jsx(t.View,{style:{borderColor:i?f:"lightgray",borderRadius:u
|
|
1507
|
+
__d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.make=void 0;var e=o(_r(d[0])),t=o(_r(d[1])),r=o(_r(d[2]));function o(e,t){if("function"==typeof WeakMap)var r=new WeakMap,n=new WeakMap;return(o=function(e,t){if(!t&&e&&e.__esModule)return e;var o,i,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,s)}for(var u in e)"default"!==u&&{}.hasOwnProperty.call(e,u)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,u))&&(i.get||i.set)?o(s,u,i):s[u]=e[u]);return s})(e,t)}_e.make=function(o){var n=o.color,i=o.selected,s=o.size,u=void 0!==s?s:18,f=void 0!==n?n:"#006DF9";return r.jsx(t.View,{style:{borderColor:i?f:"lightgray",borderRadius:u,alignItems:"center",borderWidth:1,height:e.some(u),justifyContent:"center",width:e.some(u)},children:e.some(r.jsx(t.View,{style:{backgroundColor:i?f:"transparent",borderRadius:u,height:e.some(u-8),width:e.some(u-8)}}))})}},1457,[504,3,252]);
|
|
1508
1508
|
__d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.make=void 0;var e=f(_r(d[0])),t=f(_r(d[1])),n=f(_r(d[2])),o=f(_r(d[3])),i=f(_r(d[4])),r=f(_r(d[5])),u=f(_r(d[6])),c=f(_r(d[7])),s=f(_r(d[8])),l=f(_r(d[9]));function f(e,t){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(f=function(e,t){if(!t&&e&&e.__esModule)return e;var i,r,u={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return u;if(i=t?o:n){if(i.has(e))return i.get(e);i.set(e,u)}for(var c in e)"default"!==c&&{}.hasOwnProperty.call(e,c)&&((r=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,c))&&(r.get||r.set)?i(u,c,r):u[c]=e[c]);return u})(e,t)}_e.make=function(f){var p=f.savedCardMethods,y=f.paymentMethodData,h=f.setConfirmButtonData,x=f.isScreenFocus,k=t.useContext(r.nativePropContext)[0],j=t.useContext(s.allApiDataContext),M=n.useGetLocalObj(),v=p.length>0,C=t.useState(function(){return v}),_=C[1],D=C[0],S=t.useCallback(function(e){_(function(t){return e})},[_]),T=o.getOr(o.map(j[0],function(e){return e.merchant_name}),k.configuration.merchantDisplayName);return v?D?c.jsxs(c.Fragment,{children:[c.jsx(u.make,{customerPaymentMethods:p,setConfirmButtonData:h,merchantName:T,isScreenFocus:x,animated:!0}),"Tabs"===k.configuration.paymentMethodLayout.layoutType?c.jsx(e.make,{}):null,c.jsx(l.make,{initialIconName:"addwithcircle",updateIconName:"cardv1",text:M.addPaymentMethodLabel,isSelected:D,setIsSelected:S,textType:"LinkTextBold",size:24}),"Accordion"===k.configuration.paymentMethodLayout.layoutType?c.jsx(e.make,{height:20}):null]}):c.jsxs(c.Fragment,{children:[c.jsx(i.make,{paymentMethodData:y,isScreenFocus:x,setConfirmButtonData:h}),"Tabs"===k.configuration.paymentMethodLayout.layoutType?c.jsx(e.make,{}):null,c.jsx(l.make,{initialIconName:"cardv1",updateIconName:"addwithcircle",text:M.useExisitingSavedCards,isSelected:!D,setIsSelected:function(e){S(!e)},textType:"LinkTextBold",size:24}),"Accordion"===k.configuration.paymentMethodLayout.layoutType?c.jsx(e.make,{height:20}):null]}):c.jsx(i.make,{paymentMethodData:y,isScreenFocus:x,setConfirmButtonData:h})}},1458,[1309,120,1329,505,1435,534,1455,252,1349,1427]);
|
|
1509
1509
|
__d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.make=_e.SectionHeader=_e.MoreButton=void 0;var e=M(_r(d[0])),t=M(_r(d[1])),o=M(_r(d[2])),n=M(_r(d[3])),i=M(_r(d[4])),r=M(_r(d[5])),s=M(_r(d[6])),l=M(_r(d[7])),c=M(_r(d[8])),u=M(_r(d[9])),f=M(_r(d[10])),h=M(_r(d[11])),p=M(_r(d[12])),x=M(_r(d[13])),v=M(_r(d[14])),y=M(_r(d[15])),k=M(_r(d[16])),j=M(_r(d[17])),C=M(_r(d[18])),w=M(_r(d[19])),S=M(_r(d[20])),b=M(_r(d[21]));function M(e,t){if("function"==typeof WeakMap)var o=new WeakMap,n=new WeakMap;return(M=function(e,t){if(!t&&e&&e.__esModule)return e;var i,r,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(i=t?n:o){if(i.has(e))return i.get(e);i.set(e,s)}for(var l in e)"default"!==l&&{}.hasOwnProperty.call(e,l)&&((r=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,l))&&(r.get||r.set)?i(s,l,r):s[l]=e[l]);return s})(e,t)}function I(o){var i,r=o.isExpanded,l=o.section,p=y.useThemeBasedStyle(),x=p.logoConfig,v=p.primaryColor,j=p.iconColor;if("loading"===l.title)i=w.jsx(f.make,{height:"18",width:"18"});else if(void 0!==x){var S=r&&o.showCheckedIconForSelection,b=u.getOr(x.checkedIconForSelection,y.defaultCheckedIconForSelection);i=w.jsxs(h.View,{style:{backgroundColor:x.colors.backgroundColor,borderRadius:x.borderRadius,padding:10,position:"relative"},children:[w.jsx(e.make,{name:l.title,width:18,height:18,fill:r?u.getOr(x.colors.selected,v):u.getOr(x.colors.unselected,j)}),S?w.jsx(e.make,{name:"selected",width:b.size,height:b.size,fill:b.color,stroke:u.getOr(b.stroke,p.component.background),style:{bottom:s.some(b.bottom),position:"absolute",right:s.some(b.right)}}):null]})}else i=w.jsx(e.make,{name:l.title,width:18,height:18,fill:r?v:j});return w.jsx(h.View,{style:{alignItems:"center",justifyContent:"center"},children:s.some(w.jsxs(h.View,{style:[{alignItems:"center",flexDirection:"row",minWidth:115,paddingHorizontal:20,paddingVertical:s.some("loading"!==l.title&&u.isNone(x)?20:10),width:s.some(C.pct(100))}],children:[w.jsxs(n.RenderIf.make,{condition:o.showRadios,children:[w.jsx(k.make,{size:20.5,selected:r,color:v}),w.jsx(t.make,{height:5})]}),i,w.jsx(t.make,{height:5}),"loading"===l.title?w.jsx(f.make,{height:"40",width:"40",radius:40}):w.jsx(c.make,{text:l.title,textType:"CardTextBold"})]}))})}_e.SectionHeader={make:I};function _(e){var o=e.handleMoreToggle,n=y.useThemeBasedStyle(),i=r.useGetShadowStyle(n.shadowConfig,void 0);return w.jsx(h.View,{style:{alignItems:"center",justifyContent:"center",paddingTop:10},children:s.some(w.jsxs(v.make,{onPress:function(e){o()},children:[w.jsx(l.make,{width:12,height:12,fill:"grey"}),w.jsx(t.make,{height:5}),w.jsx(c.make,{text:"More",textType:"CardTextBold"})],style:[n.bgColor,i,{borderColor:n.component.borderColor,borderRadius:n.borderRadius,alignItems:"center",borderWidth:n.borderWidth,flexDirection:"row",justifyContent:"flex-start",minWidth:115,padding:20,width:s.some(C.pct(100))}]}))})}_e.MoreButton={make:_};_e.make=function(e){var r=e.onAllCollapsed,s=e.allowMultipleExpanded,l=e.setConfirmButtonData,c=e.hocComponentArr,f=void 0!==c?c:[],h=void 0!==s&&s,v=void 0!==r?r:function(e){},y=o.useContext(j.nativePropContext)[0],k=o.useContext(b.allApiDataContext),C=k[1],M=k[0],E=y.configuration.paymentMethodLayout,O=E.defaultCollapsed,T=E.maxAccordionItems,B=E.radios,H=o.useState(function(){return[]}),P=H[1],R=H[0],z=o.useState(function(){return!0}),W=z[1],A=z[0];o.useEffect(function(){if((u.isSome(M)||u.getOr(u.map(C,function(e){return e.customer_payment_methods.length>0}),!1))&&0===R.length){var e;if(E.savedMethodCustomization.defaultCollapsed)e=void 0;else{var t=f.findIndex(function(e){return"Saved"===e.name});e=-1!==t?t:void 0}var o=void 0!==e?[e]:O?[]:[0],n=i.obj_dup(S.defaultConfirmButtonData);l((n.visible=0!==o.length||u.getOr(u.map(C,function(e){return e.customer_payment_methods.length>0}),!1)&&E.savedMethodCustomization.groupingBehavior.displayInSeparateSection,n.loading=!1,n)),P(function(e){return o})}},[M,C,f]);var D=x.usePaymentEventEmitter();o.useEffect(function(){v(0===R.length)},[R]);var F=f.map(function(e,t){return{key:t,title:e.name,isExpanded:R.includes(t),componentHoc:e.componentHoc}}),V=F.length>T&&A?F.slice(0,T):F;return o.useEffect(function(){var e=R[0];if(void 0!==e){var t=f[e];if(void 0!==t&&"loading"!==t.name){var o=x.buildPaymentMethodStatusEvent(t.name,t.paymentMethodType,!1,void 0);D.emitPaymentMethodStatus(o)}}},[R,f]),w.jsxs(n.RenderIf.make,{condition:f.length>0,children:[w.jsx(t.make,{}),w.jsx(p.make,{sections:V,expandedSections:R,onSectionToggle:function(e){P(function(t){return h?t.includes(e)?t.filter(function(t){return t!==e}):t.concat([e]):t.includes(e)?[]:[e]})},renderSectionHeader:function(e,t){return w.jsx(I,{section:e,isExpanded:t,showRadios:B,showCheckedIconForSelection:y.configuration.paymentMethodLayout.showCheckedIconForSelection})},renderSectionContent:function(e){var t=R.includes(e.key);return e.componentHoc(t,l)},style:{marginHorizontal:-10},sectionStyle:{marginHorizontal:10},allowMultipleExpanded:h,spacedAccordionItems:E.spacedAccordionItems}),w.jsx(n.RenderIf.make,{condition:F.length>T&&A&&u.isSome(M),children:w.jsx(_,{handleMoreToggle:function(){W(function(e){return!1})}})}),w.jsx(t.make,{})]})}},1459,[1029,1309,120,1317,525,1319,504,1389,1310,505,1360,3,1460,1338,1322,1314,1457,534,1308,252,1461,1349]);
|
|
1510
1510
|
__d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.make=void 0;var e=u(_r(d[0])),t=u(_r(d[1])),r=u(_r(d[2])),o=u(_r(d[3])),n=u(_r(d[4])),i=u(_r(d[5])),s=u(_r(d[6])),l=u(_r(d[7])),c=u(_r(d[8]));function u(e,t){if("function"==typeof WeakMap)var r=new WeakMap,o=new WeakMap;return(u=function(e,t){if(!t&&e&&e.__esModule)return e;var n,i,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(n=t?o:r){if(n.has(e))return n.get(e);n.set(e,s)}for(var l in e)"default"!==l&&{}.hasOwnProperty.call(e,l)&&((i=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,l))&&(i.get||i.set)?n(s,l,i):s[l]=e[l]);return s})(e,t)}_e.make=function(u){var b=u.spacedAccordionItems,f=u.contentStyle,y=u.headerStyle,p=u.sectionStyle,h=u.renderSectionContent,k=u.renderSectionHeader,S=u.onSectionToggle,v=u.expandedSections,O=u.sections,_=void 0!==b&&b,j=s.useThemeBasedStyle(),w=j.component,R=j.borderWidth,C=j.borderRadius,W=j.bgColor,x=t.useGetShadowStyle(j.shadowConfig,void 0);return c.jsx(n.View,{style:u.style,children:r.some(O.map(function(t){var s=v.includes(t.key),u=0===t.key,b=t.key===(O.length-1|0);return c.jsxs(n.View,{style:[W,x,_?{borderColor:s?w.selected.borderColor:w.borderColor,borderRadius:C,borderWidth:R,marginBottom:10}:{borderBottomLeftRadius:b?C:0,borderBottomRightRadius:b?C:0,borderColor:w.borderColor,borderTopLeftRadius:u?C:0,borderTopRightRadius:u?C:0,borderBottomWidth:b?R:R/2,borderTopWidth:u?R:R/2,borderWidth:R},o.getOr(p,l.empty)],children:[c.jsx(i.make,{onPress:function(e){S(t.key)},children:r.some(k(t,s)),style:y,accessibilityLabel:o.getOr(t.accessibilityLabel,""),testID:o.getOr(t.testID,""),focusable:o.getOr(t.accessible,!0)}),c.jsx(e.RenderIf.make,{condition:s,children:c.jsx(n.View,{style:[{paddingHorizontal:24},o.getOr(f,l.empty)],children:r.some(h(t))})})]},t.key.toString())}))})}},1460,[1317,1319,504,505,3,1322,1314,1308,252]);
|
|
@@ -1532,4 +1532,4 @@ __d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0})
|
|
|
1532
1532
|
__d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.make=_e.PaymentMethodTitle=_e.AddPaymentMethodButton=void 0;var e=f(_r(d[0])),t=f(_r(d[1])),n=f(_r(d[2])),r=f(_r(d[3])),o=f(_r(d[4])),i=f(_r(d[5])),l=f(_r(d[6])),s=f(_r(d[7])),c=f(_r(d[8])),p=f(_r(d[9])),x=f(_r(d[10]));function f(e,t){if("function"==typeof WeakMap)var n=new WeakMap,r=new WeakMap;return(f=function(e,t){if(!t&&e&&e.__esModule)return e;var o,i,l={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return l;if(o=t?r:n){if(o.has(e))return o.get(e);o.set(e,l)}for(var s in e)"default"!==s&&{}.hasOwnProperty.call(e,s)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,s))&&(i.get||i.set)?o(l,s,i):l[s]=e[s]);return l})(e,t)}_e.AddPaymentMethodButton={make:function(l){var f=p.useThemeBasedStyle(),u=n.useGetLocalObj();return x.jsx(c.make,{onPress:function(e){o.hyperModule.onAddPaymentMethod("")},children:r.some(x.jsxs(s.View,{style:{alignItems:"center",flex:1,flexDirection:"row",flexWrap:"nowrap"},children:[x.jsx(e.make,{name:"addwithcircle",width:16,height:16,style:{marginEnd:20,marginStart:5,marginVertical:10}}),x.jsx(t.make,{}),x.jsx(i.make,{text:u.addPaymentMethodLabel,textType:"LinkText"})]})),style:{borderBottomColor:f.component.borderColor,borderBottomWidth:.8,flexDirection:"row",flexWrap:"nowrap",paddingHorizontal:24,paddingVertical:16}})}};function u(e){var n,r,o=e.pmDetails,c=o.card,p=void 0!==c?c.nick_name:void 0;switch(o.payment_method){case"WALLET":n=o.payment_method_type;break;case"CARD":n=l.getOr(l.map(o.card,function(e){return"\u25cf\u25cf\u25cf\u25cf ".concat(e.last4_digits)}),"");break;default:n=""}return r="WALLET"===o.payment_method?"CardTextBold":"CardText",x.jsxs(s.View,{style:{flex:1},children:[void 0!==p&&""!==p?x.jsxs(x.Fragment,{children:[x.jsx(i.make,{text:p,textType:"CardTextBold",ellipsizeMode:"tail",numberOfLines:1}),x.jsx(t.make,{height:5})]}):null,x.jsx(i.make,{text:n,textType:r})]})}_e.PaymentMethodTitle={make:u};_e.make=function(o){var f,h=o.handleDelete,y=o.pmDetails,k=p.useThemeBasedStyle(),w=n.useGetLocalObj(),j=y.payment_method_id;switch(y.payment_method){case"WALLET":f=y.payment_method_type;break;case"CARD":f=l.getOr(l.map(y.card,function(e){return e.card_network}),"");break;default:f=""}return x.jsxs(c.make,{onPress:function(e){h(j)},children:[x.jsxs(s.View,{style:{alignItems:"center",flex:4,flexDirection:"row",flexWrap:"nowrap"},children:[x.jsx(e.make,{name:f,width:36,height:36,style:{marginEnd:5}}),x.jsx(t.make,{}),x.jsx(u,{pmDetails:y})]}),x.jsx(s.View,{style:{alignItems:"center",flex:1,flexDirection:"row-reverse",flexWrap:"nowrap"},children:r.some(x.jsx(i.make,{text:w.deletePaymentMethod,textType:"LinkText"}))})],style:{borderBottomColor:k.component.borderColor,alignItems:"center",borderBottomWidth:.8,flex:1,flexDirection:"row",flexWrap:"nowrap",justifyContent:"space-between",padding:16}})}},1482,[1029,1309,1329,504,535,1310,505,3,1322,1314,252]);
|
|
1533
1533
|
__d(function(e,s,a,h,p,d,i){p.exports={name:"hyperSwitch",displayName:"hyperswitch",headless:"HyperHeadless"}},1483,[]);
|
|
1534
1534
|
__r(63);
|
|
1535
|
-
__r(0);
|
|
1535
|
+
__r(0);
|
|
@@ -1500,7 +1500,7 @@ __d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0})
|
|
|
1500
1500
|
__d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.usePayButton=function(){var s=e.useContext(u.nativePropContext)[0],l=i.useThemeBasedStyle(),p=l.googlePayButtonColor,f=l.applePayButtonColor,b=l.buttonBorderRadius,y=t.useWebKit(),k=y.launchGPay,h=y.launchApplePay,v=n.useScript("https://pay.google.com/gp/p/js/pay.js"),_=n.useScript("https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js"),O=e.useState(function(){}),S=O[1],w=O[0],P=e.useState(function(){}),C=P[1],B=P[0];return e.useEffect(function(){if("ready"===v&&void 0!==w){var e,t=o.getGpayToken(w,s.hyperswitchConfig.environment),n=new google.payments.api.PaymentsClient(t.environment);switch(s.configuration.walletButtons.googlePay.buttonType){case"BUY":e="buy";break;case"BOOK":e="book";break;case"CHECKOUT":e="checkout";break;case"DONATE":e="donate";break;case"ORDER":e="order";break;case"PAY":e="pay";break;case"SUBSCRIBE":e="subscribe";break;case"PLAIN":e="plain"}var r={onClick:function(){k(o.getGpayTokenStringified(w,s.hyperswitchConfig.environment))},buttonType:e,buttonSizeMode:"fill",buttonColor:"light"===p?"white":"black",buttonRadius:b},i=n.createButton(r),u=document.querySelector("#google-wallet-button-container");null!=u&&(u.innerHTML="",u.appendChild(i))}},[v,w]),e.useEffect(function(){if("ready"===_&&void 0!==B){var e=document.querySelector("apple-pay-button");if(null!=e){e.removeAttribute("hidden"),e.removeAttribute("aria-hidden"),e.removeAttribute("disabled"),e.setAttribute("buttonstyle","whiteOutline"===f?"white-outline":"black"===f?"black":"white");var t=s.configuration.walletButtons.applePay.buttonType;e.setAttribute("type","plain"===t?"plain":"setUp"===t?"setUp":"buy"===t?"buy":"subscribe"===t?"subscribe":"inStore"===t?"inStore":"checkout"===t?"checkout":"donate"===t?"donate":"book"),e.setAttribute("locale","en-US"),e.onclick=function(){try{return h(JSON.stringify(Object.fromEntries([["session_token_data",B.session_token_data],["payment_request_data",B.payment_request_data]])))}catch(t){var e=c.internalToOCamlException(t);return void alert(r.getOr(JSON.stringify(c.as_js_exn(e)),"failed"))}}}}},[_,B]),[function(e,t){C(function(t){return e})},function(e){S(function(t){return e})}]};var e=s(_r(d[0])),t=s(_r(d[1])),n=s(_r(d[2])),o=s(_r(d[3])),r=s(_r(d[4])),i=s(_r(d[5])),u=s(_r(d[6])),c=s(_r(d[7]));function s(e,t){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(s=function(e,t){if(!t&&e&&e.__esModule)return e;var r,i,u={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return u;if(r=t?o:n){if(r.has(e))return r.get(e);r.set(e,u)}for(var c in e)"default"!==c&&{}.hasOwnProperty.call(e,c)&&((i=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,c))&&(i.get||i.set)?r(u,c,i):u[c]=e[c]);return u})(e,t)}},1450,[120,497,1308,524,501,1310,530,511]);
|
|
1501
1501
|
__d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.make=void 0;var e=B(_r(d[0])),t=B(_r(d[1])),n=B(_r(d[2])),i=B(_r(d[3])),o=B(_r(d[4])),r=B(_r(d[5])),s=B(_r(d[6])),u=B(_r(d[7])),c=B(_r(d[8])),l=B(_r(d[9])),p=B(_r(d[10])),_=B(_r(d[11])),y=B(_r(d[12])),f=B(_r(d[13])),v=B(_r(d[14])),h=B(_r(d[15])),P=B(_r(d[16])),E=B(_r(d[17])),S=B(_r(d[18])),C=B(_r(d[19])),A=B(_r(d[20])),O=B(_r(d[21])),b=B(_r(d[22])),T=B(_r(d[23])),k=B(_r(d[24])),F=B(_r(d[25])),L=B(_r(d[26])),x=B(_r(d[27])),D=B(_r(d[28])),w=B(_r(d[29])),R=B(_r(d[30])),M=B(_r(d[31])),N=B(_r(d[32])),j=B(_r(d[33])),G=B(_r(d[34])),I=B(_r(d[35])),Y=B(_r(d[36]));function B(e,t){if("function"==typeof WeakMap)var n=new WeakMap,i=new WeakMap;return(B=function(e,t){if(!t&&e&&e.__esModule)return e;var o,r,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(o=t?i:n){if(o.has(e))return o.get(e);o.set(e,s)}for(var u in e)"default"!==u&&{}.hasOwnProperty.call(e,u)&&((r=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,u))&&(r.get||r.set)?o(s,u,r):s[u]=e[u]);return s})(e,t)}_e.make=function(B){var V=B.style,W=B.animated,U=B.setIsScreenFocus,q=B.isScreenFocus,H=B.setConfirmButtonData,z=B.customerPaymentMethods,J=void 0===q||q,K=void 0!==U?U:function(e){},Q=void 0===W||W,X=void 0!==V?v.valFromOption(V):R.empty,Z=n.useContext(D.nativePropContext)[0],$=Z.configuration.paymentMethodLayout.savedMethodCustomization.groupingBehavior.displayInSeparateScreen,ee=n.useContext(j.allApiDataContext),te=ee[2],ne=ee[1],ie=ee[0],oe=n.useContext(I.dynamicFieldsContext),ae=oe.nickname,re=oe.getRequiredFieldsForButton,se=n.useContext(T.loadingContext)[1],de=n.useContext(L.viewPortContext)[0],ue=s.useAlerts(),ce=p.useLoggerHook(),le=k.useRedirectHook(),me=u.useGetLocalObj(),pe=k.useHandleSuccessFailure(),ye=c.useProcessPayButtonResult(),fe=i.useWebKit(),ve=fe.launchGPay,ge=fe.launchApplePay,he=x.useNotifyValidationFailure(),Pe=Y.useWalletConfirmCallback(),Ee=n.useState(function(){}),Se=Ee[1],Ce=Ee[0],Ae=n.useState(function(){return!1}),Oe=Ae[1],be=Ae[0],Te=n.useCallback(function(e){e&&Se(function(e){}),Oe(function(t){return e})},[Oe]),ke=n.useState(function(){}),Fe=ke[1],Le=ke[0],xe=n.useState(function(){return z[0]}),De=xe[1],we=xe[0],Re=n.useCallback(function(e){De(function(t){return e})},[De]);n.useEffect(function(){Re(z[0]),Fe(function(e){}),Te(!1)},[z]);var Me=b.usePaymentEventEmitter(),Ne=n.useRef(void 0),je=F.useThemeBasedStyle(),Ge=je.component,Ie=_.useGetShadowStyle(je.shadowConfig,void 0),Ye=function(e){se("ProcessingPayments");var n="WALLET"===e.payment_method?S.generateWalletConfirmBody(Z,e.payment_token,e.payment_method_type,E.getOr(E.map(ie,function(e){return e.payment_type_str}),void 0)):S.generateSavedCardConfirmBody(Z,e.payment_method_str,e.payment_token,Le,E.getOr(E.map(ie,function(e){return e.payment_type_str}),void 0),de.screenHeight,de.screenWidth,v.some(e.billing));le(t.getStringFromRecord(n),Z.hyperswitchConfig.publishableKey,Z.paymentSessionConfig.clientSecret,function(e,t,n){t||se("FillingDetails"),pe(e,t,void 0,void 0)},e.payment_method_str,void 0,function(e,t){if("PaymentSuccess"!==e)return pe(t,void 0,void 0,void 0);se("PaymentSuccess"),setTimeout(function(){pe(t,void 0,void 0,void 0)},300)},void 0,void 0)},Be=function(e,t,n,i){var o=re(e,t,n,i,!1,void 0),r=o[1];if(o[0])return se("FillingDetails");var s=t,u=E.mapOr(r.email,void 0,l.Decode.string);se("ProcessingPayments");var c,p=e.payment_method;c="CARD"===p?void 0!==ae?Object.fromEntries([["payment_method_data",Object.fromEntries([[e.payment_method_str,Object.fromEntries([["nick_name",ae]])]])]]):{}:Object.fromEntries([["payment_method_data",Object.fromEntries([[e.payment_method_str,Object.fromEntries([[e.payment_method_type+("PAY_LATER"===p||"PAYPAL"===e.payment_method_type_wallet?"_redirect":""),E.getOr(s,{})]])]])]]);var _=S.generateCardConfirmBody(Z,e.payment_method_str,e.payment_method_type,h.mergeDict(c,r).payment_method_data,E.getOr(E.map(ie,function(e){return e.payment_type}),"NORMAL"),E.getOr(E.map(ie,function(e){return e.payment_type_str}),void 0),E.map(ie,function(e){return e.redirect_url}),!1,void 0,"CARD"===e.payment_method&&Z.configuration.displaySavedPaymentMethodsCheckbox,E.getOr(E.map(ne,function(e){return e.is_guest_customer}),!0),u,de.screenHeight,de.screenWidth,void 0);le(E.getOr(JSON.stringify(_),""),Z.hyperswitchConfig.publishableKey,Z.paymentSessionConfig.clientSecret,function(e,t,n){t||se("FillingDetails"),pe(e,t,void 0,void 0)},e.payment_method_type,e.payment_experience,function(e,t){if("PaymentSuccess"!==e)return pe(t,void 0,void 0,void 0);se("PaymentSuccess"),setTimeout(function(){pe(t,void 0,void 0,void 0)},300)},"CARD"===e.payment_method,void 0)},Ve=function(e){if(void 0!==ie){var t=ie.payment_methods.find(function(e){return"GOOGLE_PAY"===e.payment_method_type_wallet});if(void 0!==t){var n=ye("GOOGLE_PAY",e);if("object"==typeof n){if("Success"===n.TAG)return Be(t,n._0,n._1,n._2);var i=n._0;return se("FillingDetails"),he(v.some(i)),ue("error",i)}return se("FillingDetails"),he("Payment was Cancelled"),ue("warning","Payment was Cancelled")}return se("FillingDetails"),he("Technical Error"),ue("error","Technical Error")}se("FillingDetails"),ue("error","Technical Error")},We=function(e){if(void 0!==ie){var t=ie.payment_methods.find(function(e){return"APPLE_PAY"===e.payment_method_type_wallet});if(void 0!==t){ce("DEBUG",t.payment_method_type,"USER_EVENT",t.payment_method_type,t.payment_experience,void 0,void 0,"APPLE_PAY_CALLBACK_FROM_NATIVE",void 0,void 0);var n=ye("APPLE_PAY",e);if("object"!=typeof n)return"Cancelled"===n?(se("FillingDetails"),he("Cancelled"),ue("warning","Cancelled")):void setTimeout(function(){se("FillingDetails"),he("Apple Pay is not supported in Simulated Environment"),ue("warning","Apple Pay is not supported in Simulated Environment")},2e3);if("Success"===n.TAG)return Be(t,n._0,n._1,n._2);var i=n._0;return se("FillingDetails"),he(v.some(i)),ue("error",i)}return se("FillingDetails"),he("Technical Error"),ue("error","Technical Error")}return se("FillingDetails"),he("Technical Error"),ue("error","Technical Error")};n.useEffect(function(){var e=E.map(we,function(e){return e.payment_method_type_wallet});if(void 0!==e)switch(e){case"GOOGLE_PAY":o.registerEventListener("googlePayData",Ve);break;case"APPLE_PAY":o.registerEventListener("applePayData",We)}},[we]);var Ue="NORMAL"!==E.getOr(E.map(ie,function(e){return e.payment_type}),"NORMAL"),qe=function(){se("FillingDetails")},He=function(e){var t=!Ue||Ue&&(be||E.isNone(Le));if(void 0!==we&&t)switch(we.payment_method){case"WALLET":switch(we.payment_method_type_wallet){case"GOOGLE_PAY":var n=void 0!==te?E.getOr(te.find(function(e){return"GOOGLE_PAY"===e.wallet_name}),C.defaultToken):C.defaultToken;return void Pe("google_pay",function(){return"android"===i.platform?P.launchGPay(f.getGpayTokenStringified(n,Z.hyperswitchConfig.environment),Ve):ve(f.getGpayTokenStringified(n,Z.hyperswitchConfig.environment))},qe);case"APPLE_PAY":var o=void 0!==te?E.getOr(te.find(function(e){return"APPLE_PAY"===e.wallet_name}),C.defaultToken):C.defaultToken;if(null===o.session_token_data||null===o.payment_request_data)return se("FillingDetails"),ue("warning","Waiting for Sessions API");ce("DEBUG","apple_pay","USER_EVENT","apple_pay",void 0,void 0,void 0,"APPLE_PAY_STARTED_FROM_JS",void 0,void 0);return void Pe("apple_pay",function(){var e=setTimeout(function(){se("FillingDetails"),ue("warning","Apple Pay Error, Please try again"),ce("DEBUG","apple_pay","USER_EVENT","apple_pay",void 0,void 0,void 0,"APPLE_PAY_PRESENT_FAIL_FROM_NATIVE",void 0,void 0)},5e3);return"ios"===i.platform?P.launchApplePay(JSON.stringify(Object.fromEntries([["session_token_data",o.session_token_data],["payment_request_data",o.payment_request_data]])),We,function(e){ce("DEBUG","apple_pay","USER_EVENT","apple_pay",void 0,void 0,void 0,"APPLE_PAY_BRIDGE_SUCCESS",void 0,void 0)},function(t){clearTimeout(e)}):ge(JSON.stringify(Object.fromEntries([["session_token_data",o.session_token_data],["payment_request_data",o.payment_request_data]])))},qe);case"PAYPAL":return void Pe("paypal",function(){Ye(we)},qe);case"SAMSUNG_PAY":return void Pe("samsung_pay",function(){Ye(we)},qe);case"NONE":return void Pe("wallet",function(){Ye(we)},qe)}case"CARD":return!we.requires_cvv||!E.isNone(Le)&&y.cvcNumberInRange(E.getOr(Le,""),E.getOr(E.map(we.card,function(e){return e.card_network}),""))?Ye(we):(E.isNone(Le)&&Fe(function(e){return""}),se("FillingDetails"),he("Please enter a valid CVV"));default:return Ye(we)}se("FillingDetails"),Ue&&!be&&Se(function(e){return"Please accept the terms and conditions to continue."}),he("Please accept the terms and conditions to continue.")};return n.useEffect(function(){if(void 0!==we){var e=b.buildPaymentMethodStatusEvent(we.payment_method_str,we.payment_method_type,!0,void 0);Me.emitPaymentMethodStatus(e)}},[we]),n.useEffect(function(){if(void 0!==we){var e,t=(e="CARD"!==we.payment_method||!we.requires_cvv||void 0!==Le&&(Le.length>0&&y.cvcNumberInRange(Le,E.getOr(E.map(we.card,function(e){return e.card_network}),""))))?"Complete":"Filling",n=w.formStatusValueToString(t);if(Ne.current!==n){Ne.current=n;var i=b.buildFormStatusEvent(t);Me.emitFormStatus(i)}var o=we.card;if(void 0!==o){var r=b.buildCardInfoFromSavedCard(o.card_isin,o.last4_digits,o.card_network,o.expiry_month,o.expiry_year,e);Me.emitCardInfo(r)}}},[we,Le]),n.useEffect(function(){if(J){var e=E.getOr(E.map(we,function(e){return e.payment_method_type}),"Saved Payment"),t=E.map(we,function(e){return e.payment_experience});H({loading:!1,visible:!0,handlePress:He,payment_method_type:e,customer_payment_experience:t,errorText:Ce})}},[ie,z,te,H,we,Le,Ce,be,J]),M.jsxs(O.make,{children:[M.jsx(r.RenderIf.make,{condition:$,children:M.jsx(e.make,{})}),M.jsx(A.View,{style:[$||"Tabs"===Z.configuration.paymentMethodLayout.layoutType&&!Z.configuration.paymentMethodLayout.savedMethodCustomization.groupingBehavior.displayInSeparateSection?{borderColor:Ge.borderColor,borderRadius:je.borderRadius,borderWidth:je.borderWidth}:R.empty,je.bgColor,"Tabs"!==Z.configuration.paymentMethodLayout.layoutType||Z.configuration.paymentMethodLayout.savedMethodCustomization.groupingBehavior.displayInSeparateSection?R.empty:Ie,{backgroundColor:$?Ge.background:void 0,flexShrink:1},X],children:v.some(M.jsx(N.make,{customerPaymentMethods:z,selectedToken:we,setSelectedToken:Re,savedCardCvv:Le,setSavedCardCvv:Fe,isScreenFocus:J,animated:Q,maxVisibleItems:B.maxVisibleItems,setIsScreenFocus:K}))}),Ue&&E.isSome(Le)?M.jsxs(A.View,{style:{paddingHorizontal:2},children:[M.jsx(G.make,{initialIconName:"checkboxClicked",updateIconName:"checkboxNotClicked",text:me.cardTermsPart1+B.merchantName+me.cardTermsPart2,isSelected:be,setIsSelected:Te,textType:"ModalText",disabled:!1}),M.jsx(e.make,{})]}):M.jsx(e.make,{height:4})],level:"Screen",rootTag:Z.rootTag})}},1451,[1305,496,120,497,1308,1313,1340,1325,1436,510,998,1315,1331,524,500,1382,531,501,1006,1007,3,1023,1334,1320,1341,1310,1321,1433,530,518,1304,255,1452,1345,1423,1403,1449]);
|
|
1502
1502
|
__d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.make=_e.PaymentMethodListView=_e.PMWithNickNameComponent=_e.MoreButton=_e.CVVComponent=void 0;var e=_(_r(d[0])),t=_(_r(d[1])),o=_(_r(d[2])),n=_(_r(d[3])),i=_(_r(d[4])),r=_(_r(d[5])),s=_(_r(d[6])),l=_(_r(d[7])),c=_(_r(d[8])),u=_(_r(d[9])),h=_(_r(d[10])),y=_(_r(d[11])),v=_(_r(d[12])),p=_(_r(d[13])),f=_(_r(d[14])),C=_(_r(d[15])),x=_(_r(d[16])),k=_(_r(d[17])),S=_(_r(d[18])),j=_(_r(d[19])),w=_(_r(d[20])),M=_(_r(d[21]));function _(e,t){if("function"==typeof WeakMap)var o=new WeakMap,n=new WeakMap;return(_=function(e,t){if(!t&&e&&e.__esModule)return e;var i,r,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(i=t?n:o){if(i.has(e))return i.get(e);i.set(e,s)}for(var l in e)"default"!==l&&{}.hasOwnProperty.call(e,l)&&((r=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,l))&&(r.get||r.set)?i(s,l,r):s[l]=e[l]);return s})(e,t)}function V(t){var n=t.hideCvcIcon,c=t.hideCVCError,u=t.hideCardExpiry,f=t.cardScheme,C=t.setSavedCardCvv,k=t.savedCardCvv,S=x.useThemeBasedStyle(),M=o.useState(function(){return!1}),_=M[1],V=!(!M[0]&&!v.isNone(k))||v.getOr(k,"").length>0&&s.cvcNumberInRange(v.getOr(k,""),f),b=r.useGetLocalObj(),T=V?void 0:b.inCompleteCVCErrorText;return w.jsxs(p.View,{style:{alignItems:u?"flex-end":"flex-start",display:"flex",flexDirection:"column",marginHorizontal:l.some(u?7.5:47.5)},children:[w.jsxs(p.View,{style:{alignItems:"center",display:"flex",flex:1,flexDirection:"row",marginTop:l.some(u?v.isSome(T)&&!c?2:0:10),width:u?void 0:l.some(j.pct(100))},children:[u?null:w.jsx(p.View,{style:{width:50},children:l.some(w.jsx(y.make,{text:"CVC:",textType:"ModalText"}))}),w.jsx(h.make,{state:v.getOr(k,""),setState:function(e){C(function(t){return s.formatCVCNumber(e,f)})},placeholder:u?v.getOr(t.placeholderCVC,b.cvcTextLabel):"123",width:l.some(n?72:100),secureTextEntry:!0,keyboardType:"number-pad",iconRight:n?void 0:{TAG:"CustomIcon",_0:s.checkCardCVC(v.getOr(k,""),f)?w.jsx(e.make,{name:"cvvfilled",width:35,height:35,fill:"black"}):w.jsx(e.make,{name:"cvvempty",width:35,height:35,fill:"black"})},enableCrossIcon:!1,isValid:V,onFocus:function(){_(function(e){return!0})},onBlur:function(){_(function(e){return!1})},textColor:V?S.component.color:S.dangerColor,animateLabel:"CVC"})]}),v.isSome(T)&&!c?w.jsx(i.make,{text:l.some(T)}):null]})}_e.CVVComponent={make:V};function b(n){var i,r=n.isPaymentMethodSelected,s=n.savedPaymentMethod,c=o.useContext(S.nativePropContext)[0],h=x.useThemeBasedStyle(),f=h.primaryColor,C=h.iconColor,k=c.configuration.paymentMethodLayout.savedMethodCustomization.groupingBehavior.displayInSeparateSection?h.logoConfig:void 0,j=s.card,M=void 0!==j?j.nick_name:void 0,_=s.default_payment_method_set,V=v.isNone(k);if(void 0!==k){var b,T=s.card;if(void 0!==T){var I=T.card_network;b=""===I?""===T.scheme?u.getDisplayName(s.payment_method_type):T.scheme:I}else b=u.getDisplayName(s.payment_method_type);var P=r&&c.configuration.paymentMethodLayout.showCheckedIconForSelection,D=v.getOr(k.checkedIconForSelection,x.defaultCheckedIconForSelection);i=w.jsxs(p.View,{style:{backgroundColor:k.colors.backgroundColor,borderRadius:k.borderRadius,padding:10,position:"relative"},children:[w.jsx(e.make,{name:b,width:18,height:18,fill:r?f:C}),P?w.jsx(e.make,{name:"selected",width:D.size,height:D.size,fill:D.color,stroke:v.getOr(D.stroke,h.component.background),style:{bottom:l.some(D.bottom),position:"absolute",right:l.some(D.right)}}):null]})}else{var L,E=s.card;if(void 0!==E){var N=E.card_network;L=""===N?""===E.scheme?u.getDisplayName(s.payment_method_type):E.scheme:N}else L=u.getDisplayName(s.payment_method_type);i=w.jsx(e.make,{name:L,width:26,height:26,fill:r?f:C})}var z=v.isNone(k),B=s.card,O=s.card;return w.jsxs(p.View,{style:{display:"flex",flexDirection:"column"},children:[void 0!==M&&V&&""!==M?w.jsxs(p.View,{style:{alignItems:"center",display:"flex",flexDirection:"row"},children:[w.jsx(y.make,{text:M.length>15?M.slice(0,13).concat(".."):M,textType:"CardTextBold"}),w.jsx(t.make,{height:5}),c.configuration.displayDefaultSavedPaymentIcon&&_?w.jsx(e.make,{name:"defaultTick",width:14,height:14,fill:"black"}):null]}):null,w.jsxs(p.View,{style:{alignItems:"center",display:"flex",flexDirection:"row"},children:[i,w.jsx(t.make,{width:8}),w.jsxs(p.View,{style:{flexDirection:"column"},children:[void 0===M||z||""===M?null:w.jsxs(p.View,{style:{alignItems:"center",display:"flex",flexDirection:"row"},children:[w.jsx(y.make,{text:M.length>15?M.slice(0,13).concat(".."):M,textType:"CardTextBold"}),w.jsx(t.make,{height:5}),c.configuration.displayDefaultSavedPaymentIcon&&_?w.jsx(e.make,{name:"defaultTick",width:14,height:14,fill:"black"}):null]}),w.jsx(y.make,{text:void 0!==B?"\u25cf\u25cf\u25cf\u25cf ".concat(B.last4_digits):u.getDisplayName(s.payment_method_type),textType:void 0!==O?"CardText":"CardTextBold"})]})]})]})}_e.PMWithNickNameComponent={make:b};function T(e){var o=e.handleMoreToggle,n=x.useThemeBasedStyle();return w.jsx(p.View,{style:{alignItems:"center",flex:1,justifyContent:"center"},children:l.some(w.jsxs(C.make,{onPress:function(e){o()},children:[w.jsx(c.make,{width:12,height:12,fill:n.linkColor}),w.jsx(t.make,{height:5}),w.jsx(y.make,{text:"Show More",textType:"LinkText"})],style:[{borderColor:n.component.borderColor,borderRadius:n.borderRadius,alignItems:"center",flexDirection:"row",justifyContent:"flex-start",minWidth:115,paddingHorizontal:14,paddingVertical:20,width:l.some(j.pct(100))}]}))})}_e.MoreButton={make:T};function I(e){var n=e.setIsScreenFocus,i=e.setSelectedToken,s=e.isPaymentMethodSelected,c=e.setSavedCardCvv,u=e.savedCardCvv,h=e.savedPaymentMethod,M=o.useContext(S.nativePropContext)[0],_=M.configuration.paymentMethodLayout.savedMethodCustomization.hideCardExpiry,T=r.useGetLocalObj(),I=x.useThemeBasedStyle(),P=M.configuration.paymentMethodLayout.savedMethodCustomization.groupingBehavior.displayInSeparateSection?I.logoConfig:void 0,D=f.usePaymentEventEmitter(),L=h.card;return w.jsxs(C.make,{onPress:function(e){s||c(function(e){}),i(h),n(!0);var t=f.buildPaymentMethodStatusEvent(h.payment_method_str,h.payment_method_type,!0,void 0);D.emitPaymentMethodStatus(t)},children:[w.jsxs(p.View,{style:{alignItems:"center",flex:1,flexDirection:"row",flexWrap:"wrap",gap:8,justifyContent:"space-between",paddingLeft:12},children:[w.jsxs(p.View,{style:{alignItems:"center",flex:1,flexDirection:"row",height:l.some(j.pct(100))},children:[v.isNone(P)?w.jsx(k.make,{size:20.5,selected:s,color:I.primaryColor}):null,v.isNone(P)?w.jsx(t.make,{}):null,w.jsx(b,{savedPaymentMethod:h,isPaymentMethodSelected:s})]}),_?s&&"CARD"===h.payment_method&&h.requires_cvv?w.jsx(V,{savedCardCvv:u,setSavedCardCvv:c,cardScheme:v.getOr(v.map(h.card,function(e){return e.card_network}),""),hideCardExpiry:_,hideCVCError:M.configuration.paymentMethodLayout.savedMethodCustomization.hideCVCError,hideCvcIcon:"Hidden"===M.configuration.paymentMethodLayout.savedMethodCustomization.cvcIcon,placeholderCVC:M.configuration.placeholder.cvv}):null:void 0!==L?w.jsx(y.make,{text:T.cardExpiresText+" "+L.expiry_month+"/"+L.expiry_year.slice(-2),textType:"ModalTextLight",overrideStyle:l.some({marginLeft:"auto"})}):null]}),s&&"CARD"===h.payment_method&&h.requires_cvv&&!_?w.jsx(V,{savedCardCvv:u,setSavedCardCvv:c,cardScheme:v.getOr(v.map(h.card,function(e){return e.card_network}),""),hideCardExpiry:_,hideCVCError:M.configuration.paymentMethodLayout.savedMethodCustomization.hideCVCError,hideCvcIcon:"Hidden"===M.configuration.paymentMethodLayout.savedMethodCustomization.cvcIcon,placeholderCVC:M.configuration.placeholder.cvv}):null],style:{borderBottomColor:I.component.borderColor,justifyContent:"center",minHeight:60,paddingVertical:l.some(_?5:16)}})}_e.PaymentMethodListView={make:I};_e.make=function(e){var t=e.setIsScreenFocus,i=e.maxVisibleItems,r=e.animated,s=e.setSavedCardCvv,c=e.savedCardCvv,u=e.setSelectedToken,h=e.selectedToken,y=e.customerPaymentMethods,f=void 0!==i?i:3,C=o.useContext(S.nativePropContext)[0],x=o.useState(function(){return!r}),k=x[1],_=x[0],V=C.configuration.paymentMethodLayout.savedMethodCustomization.groupingBehavior.displayInSeparateScreen,b=y.length>f&&_?y.slice(0,f):y,P=b.map(function(e,o){return w.jsx(I,{savedPaymentMethod:e,isButtomBorder:(b.length-1|0)!==o||y.length>f&&_,savedCardCvv:c,setSavedCardCvv:s,isPaymentMethodSelected:v.getOr(v.map(h,function(t){return t.payment_method_id===e.payment_method_id}),0===o),setSelectedToken:u,setIsScreenFocus:t},e.payment_method_id)}),D=w.jsxs(w.Fragment,{children:[P,w.jsx(n.RenderIf.make,{condition:y.length>f&&_,children:w.jsx(T,{handleMoreToggle:function(){t(!0),k(function(e){return!1})}})})]}),L=o.useRef(new p.Animated.Value(1)),E=o.useRef(new p.Animated.Value(0)),N=o.useState(function(){return!1}),z=N[1],B=N[0];return o.useEffect(function(){if(B){var e=p.Animated.loop(p.Animated.sequence([M.timing(E.current,{toValue:6,useNativeDriver:!0,easing:p.Easing.ease,duration:1e3}),M.timing(E.current,{toValue:0,useNativeDriver:!0,duration:1e3})]));return M.start(e,function(e){}),function(){M.stop(e)}}},[B]),r?w.jsxs(p.View,{style:l.some(j.empty),children:[w.jsx(p.ScrollView,{style:{maxHeight:V?void 0:240},children:l.some(D),scrollEventThrottle:16,nestedScrollEnabled:!0,contentContainerStyle:{paddingHorizontal:V||"Tabs"===C.configuration.paymentMethodLayout.layoutType?16:void 0},keyboardShouldPersistTaps:"handled",onContentSizeChange:function(e,t){z(function(e){return t>(V?600:240)})},onScroll:function(e){var t=e.nativeEvent.contentOffset.y,o=e.nativeEvent.contentSize.height,n=e.nativeEvent.layoutMeasurement.height;return t>50||n+t>=o-20?M.start(M.timing(L.current,{toValue:0,useNativeDriver:!0,duration:300}),function(e){}):M.start(M.timing(L.current,{toValue:1,useNativeDriver:!0,duration:300}),function(e){})},showsVerticalScrollIndicator:!1}),B?w.jsx(p.Animated.Text,{style:{color:"#aaa",fontSize:12,opacity:L.current,transform:[{translateY:E.current}],alignSelf:"center",bottom:l.some(C.configuration.paymentMethodLayout.savedMethodCustomization.groupingBehavior.displayInSeparateScreen?10:C.configuration.paymentMethodLayout.savedMethodCustomization.groupingBehavior.displayInSeparateSection?8:"Tabs"===C.configuration.paymentMethodLayout.layoutType?10:-2),position:"absolute"},children:"Scroll for more \u2193"}):null]}):D}},1452,[1025,1305,120,1313,1393,1325,1331,500,1385,1382,1333,1306,501,3,1334,1318,1310,1453,530,1304,255,1319]);
|
|
1503
|
-
__d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.make=void 0;var e=o(_r(d[0])),t=o(_r(d[1])),r=o(_r(d[2]));function o(e,t){if("function"==typeof WeakMap)var r=new WeakMap,n=new WeakMap;return(o=function(e,t){if(!t&&e&&e.__esModule)return e;var o,i,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,s)}for(var u in e)"default"!==u&&{}.hasOwnProperty.call(e,u)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,u))&&(i.get||i.set)?o(s,u,i):s[u]=e[u]);return s})(e,t)}_e.make=function(o){var n=o.color,i=o.selected,s=o.size,u=void 0!==s?s:18,f=void 0!==n?n:"#006DF9";return r.jsx(t.View,{style:{borderColor:i?f:"lightgray",borderRadius:u
|
|
1503
|
+
__d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.make=void 0;var e=o(_r(d[0])),t=o(_r(d[1])),r=o(_r(d[2]));function o(e,t){if("function"==typeof WeakMap)var r=new WeakMap,n=new WeakMap;return(o=function(e,t){if(!t&&e&&e.__esModule)return e;var o,i,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,s)}for(var u in e)"default"!==u&&{}.hasOwnProperty.call(e,u)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,u))&&(i.get||i.set)?o(s,u,i):s[u]=e[u]);return s})(e,t)}_e.make=function(o){var n=o.color,i=o.selected,s=o.size,u=void 0!==s?s:18,f=void 0!==n?n:"#006DF9";return r.jsx(t.View,{style:{borderColor:i?f:"lightgray",borderRadius:u,alignItems:"center",borderWidth:1,height:e.some(u),justifyContent:"center",width:e.some(u)},children:e.some(r.jsx(t.View,{style:{backgroundColor:i?f:"transparent",borderRadius:u,height:e.some(u-8),width:e.some(u-8)}}))})}},1453,[500,3,255]);
|
|
1504
1504
|
__d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.make=void 0;var e=f(_r(d[0])),t=f(_r(d[1])),n=f(_r(d[2])),o=f(_r(d[3])),i=f(_r(d[4])),r=f(_r(d[5])),u=f(_r(d[6])),c=f(_r(d[7])),s=f(_r(d[8])),l=f(_r(d[9]));function f(e,t){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(f=function(e,t){if(!t&&e&&e.__esModule)return e;var i,r,u={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return u;if(i=t?o:n){if(i.has(e))return i.get(e);i.set(e,u)}for(var c in e)"default"!==c&&{}.hasOwnProperty.call(e,c)&&((r=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,c))&&(r.get||r.set)?i(u,c,r):u[c]=e[c]);return u})(e,t)}_e.make=function(f){var p=f.savedCardMethods,y=f.paymentMethodData,h=f.setConfirmButtonData,x=f.isScreenFocus,k=t.useContext(r.nativePropContext)[0],j=t.useContext(s.allApiDataContext),M=n.useGetLocalObj(),v=p.length>0,C=t.useState(function(){return v}),_=C[1],D=C[0],S=t.useCallback(function(e){_(function(t){return e})},[_]),T=o.getOr(o.map(j[0],function(e){return e.merchant_name}),k.configuration.merchantDisplayName);return v?D?c.jsxs(c.Fragment,{children:[c.jsx(u.make,{customerPaymentMethods:p,setConfirmButtonData:h,merchantName:T,isScreenFocus:x,animated:!0}),"Tabs"===k.configuration.paymentMethodLayout.layoutType?c.jsx(e.make,{}):null,c.jsx(l.make,{initialIconName:"addwithcircle",updateIconName:"cardv1",text:M.addPaymentMethodLabel,isSelected:D,setIsSelected:S,textType:"LinkTextBold",size:24}),"Accordion"===k.configuration.paymentMethodLayout.layoutType?c.jsx(e.make,{height:20}):null]}):c.jsxs(c.Fragment,{children:[c.jsx(i.make,{paymentMethodData:y,isScreenFocus:x,setConfirmButtonData:h}),"Tabs"===k.configuration.paymentMethodLayout.layoutType?c.jsx(e.make,{}):null,c.jsx(l.make,{initialIconName:"cardv1",updateIconName:"addwithcircle",text:M.useExisitingSavedCards,isSelected:!D,setIsSelected:function(e){S(!e)},textType:"LinkTextBold",size:24}),"Accordion"===k.configuration.paymentMethodLayout.layoutType?c.jsx(e.make,{height:20}):null]}):c.jsx(i.make,{paymentMethodData:y,isScreenFocus:x,setConfirmButtonData:h})}},1454,[1305,120,1325,501,1431,530,1451,255,1345,1423]);
|
|
1505
1505
|
__d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.make=_e.SectionHeader=_e.MoreButton=void 0;var e=M(_r(d[0])),t=M(_r(d[1])),o=M(_r(d[2])),n=M(_r(d[3])),i=M(_r(d[4])),r=M(_r(d[5])),s=M(_r(d[6])),l=M(_r(d[7])),c=M(_r(d[8])),u=M(_r(d[9])),f=M(_r(d[10])),h=M(_r(d[11])),p=M(_r(d[12])),x=M(_r(d[13])),v=M(_r(d[14])),y=M(_r(d[15])),k=M(_r(d[16])),j=M(_r(d[17])),C=M(_r(d[18])),w=M(_r(d[19])),S=M(_r(d[20])),b=M(_r(d[21]));function M(e,t){if("function"==typeof WeakMap)var o=new WeakMap,n=new WeakMap;return(M=function(e,t){if(!t&&e&&e.__esModule)return e;var i,r,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(i=t?n:o){if(i.has(e))return i.get(e);i.set(e,s)}for(var l in e)"default"!==l&&{}.hasOwnProperty.call(e,l)&&((r=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,l))&&(r.get||r.set)?i(s,l,r):s[l]=e[l]);return s})(e,t)}function I(o){var i,r=o.isExpanded,l=o.section,p=y.useThemeBasedStyle(),x=p.logoConfig,v=p.primaryColor,j=p.iconColor;if("loading"===l.title)i=w.jsx(f.make,{height:"18",width:"18"});else if(void 0!==x){var S=r&&o.showCheckedIconForSelection,b=u.getOr(x.checkedIconForSelection,y.defaultCheckedIconForSelection);i=w.jsxs(h.View,{style:{backgroundColor:x.colors.backgroundColor,borderRadius:x.borderRadius,padding:10,position:"relative"},children:[w.jsx(e.make,{name:l.title,width:18,height:18,fill:r?u.getOr(x.colors.selected,v):u.getOr(x.colors.unselected,j)}),S?w.jsx(e.make,{name:"selected",width:b.size,height:b.size,fill:b.color,stroke:u.getOr(b.stroke,p.component.background),style:{bottom:s.some(b.bottom),position:"absolute",right:s.some(b.right)}}):null]})}else i=w.jsx(e.make,{name:l.title,width:18,height:18,fill:r?v:j});return w.jsx(h.View,{style:{alignItems:"center",justifyContent:"center"},children:s.some(w.jsxs(h.View,{style:[{alignItems:"center",flexDirection:"row",minWidth:115,paddingHorizontal:20,paddingVertical:s.some("loading"!==l.title&&u.isNone(x)?20:10),width:s.some(C.pct(100))}],children:[w.jsxs(n.RenderIf.make,{condition:o.showRadios,children:[w.jsx(k.make,{size:20.5,selected:r,color:v}),w.jsx(t.make,{height:5})]}),i,w.jsx(t.make,{height:5}),"loading"===l.title?w.jsx(f.make,{height:"40",width:"40",radius:40}):w.jsx(c.make,{text:l.title,textType:"CardTextBold"})]}))})}_e.SectionHeader={make:I};function _(e){var o=e.handleMoreToggle,n=y.useThemeBasedStyle(),i=r.useGetShadowStyle(n.shadowConfig,void 0);return w.jsx(h.View,{style:{alignItems:"center",justifyContent:"center",paddingTop:10},children:s.some(w.jsxs(v.make,{onPress:function(e){o()},children:[w.jsx(l.make,{width:12,height:12,fill:"grey"}),w.jsx(t.make,{height:5}),w.jsx(c.make,{text:"More",textType:"CardTextBold"})],style:[n.bgColor,i,{borderColor:n.component.borderColor,borderRadius:n.borderRadius,alignItems:"center",borderWidth:n.borderWidth,flexDirection:"row",justifyContent:"flex-start",minWidth:115,padding:20,width:s.some(C.pct(100))}]}))})}_e.MoreButton={make:_};_e.make=function(e){var r=e.onAllCollapsed,s=e.allowMultipleExpanded,l=e.setConfirmButtonData,c=e.hocComponentArr,f=void 0!==c?c:[],h=void 0!==s&&s,v=void 0!==r?r:function(e){},y=o.useContext(j.nativePropContext)[0],k=o.useContext(b.allApiDataContext),C=k[1],M=k[0],E=y.configuration.paymentMethodLayout,O=E.defaultCollapsed,T=E.maxAccordionItems,B=E.radios,H=o.useState(function(){return[]}),P=H[1],R=H[0],z=o.useState(function(){return!0}),W=z[1],A=z[0];o.useEffect(function(){if((u.isSome(M)||u.getOr(u.map(C,function(e){return e.customer_payment_methods.length>0}),!1))&&0===R.length){var e;if(E.savedMethodCustomization.defaultCollapsed)e=void 0;else{var t=f.findIndex(function(e){return"Saved"===e.name});e=-1!==t?t:void 0}var o=void 0!==e?[e]:O?[]:[0],n=i.obj_dup(S.defaultConfirmButtonData);l((n.visible=0!==o.length||u.getOr(u.map(C,function(e){return e.customer_payment_methods.length>0}),!1)&&E.savedMethodCustomization.groupingBehavior.displayInSeparateSection,n.loading=!1,n)),P(function(e){return o})}},[M,C,f]);var D=x.usePaymentEventEmitter();o.useEffect(function(){v(0===R.length)},[R]);var F=f.map(function(e,t){return{key:t,title:e.name,isExpanded:R.includes(t),componentHoc:e.componentHoc}}),V=F.length>T&&A?F.slice(0,T):F;return o.useEffect(function(){var e=R[0];if(void 0!==e){var t=f[e];if(void 0!==t&&"loading"!==t.name){var o=x.buildPaymentMethodStatusEvent(t.name,t.paymentMethodType,!1,void 0);D.emitPaymentMethodStatus(o)}}},[R,f]),w.jsxs(n.RenderIf.make,{condition:f.length>0,children:[w.jsx(t.make,{}),w.jsx(p.make,{sections:V,expandedSections:R,onSectionToggle:function(e){P(function(t){return h?t.includes(e)?t.filter(function(t){return t!==e}):t.concat([e]):t.includes(e)?[]:[e]})},renderSectionHeader:function(e,t){return w.jsx(I,{section:e,isExpanded:t,showRadios:B,showCheckedIconForSelection:y.configuration.paymentMethodLayout.showCheckedIconForSelection})},renderSectionContent:function(e){var t=R.includes(e.key);return e.componentHoc(t,l)},style:{marginHorizontal:-10},sectionStyle:{marginHorizontal:10},allowMultipleExpanded:h,spacedAccordionItems:E.spacedAccordionItems}),w.jsx(n.RenderIf.make,{condition:F.length>T&&A&&u.isSome(M),children:w.jsx(_,{handleMoreToggle:function(){W(function(e){return!1})}})}),w.jsx(t.make,{})]})}},1455,[1025,1305,120,1313,521,1315,500,1385,1306,501,1356,3,1456,1334,1318,1310,1453,530,1304,255,1457,1345]);
|
|
1506
1506
|
__d(function(g,_r,_i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.make=void 0;var e=u(_r(d[0])),t=u(_r(d[1])),r=u(_r(d[2])),o=u(_r(d[3])),n=u(_r(d[4])),i=u(_r(d[5])),s=u(_r(d[6])),l=u(_r(d[7])),c=u(_r(d[8]));function u(e,t){if("function"==typeof WeakMap)var r=new WeakMap,o=new WeakMap;return(u=function(e,t){if(!t&&e&&e.__esModule)return e;var n,i,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(n=t?o:r){if(n.has(e))return n.get(e);n.set(e,s)}for(var l in e)"default"!==l&&{}.hasOwnProperty.call(e,l)&&((i=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,l))&&(i.get||i.set)?n(s,l,i):s[l]=e[l]);return s})(e,t)}_e.make=function(u){var b=u.spacedAccordionItems,f=u.contentStyle,y=u.headerStyle,p=u.sectionStyle,h=u.renderSectionContent,k=u.renderSectionHeader,S=u.onSectionToggle,v=u.expandedSections,O=u.sections,_=void 0!==b&&b,j=s.useThemeBasedStyle(),w=j.component,R=j.borderWidth,C=j.borderRadius,W=j.bgColor,x=t.useGetShadowStyle(j.shadowConfig,void 0);return c.jsx(n.View,{style:u.style,children:r.some(O.map(function(t){var s=v.includes(t.key),u=0===t.key,b=t.key===(O.length-1|0);return c.jsxs(n.View,{style:[W,x,_?{borderColor:s?w.selected.borderColor:w.borderColor,borderRadius:C,borderWidth:R,marginBottom:10}:{borderBottomLeftRadius:b?C:0,borderBottomRightRadius:b?C:0,borderColor:w.borderColor,borderTopLeftRadius:u?C:0,borderTopRightRadius:u?C:0,borderBottomWidth:b?R:R/2,borderTopWidth:u?R:R/2,borderWidth:R},o.getOr(p,l.empty)],children:[c.jsx(i.make,{onPress:function(e){S(t.key)},children:r.some(k(t,s)),style:y,accessibilityLabel:o.getOr(t.accessibilityLabel,""),testID:o.getOr(t.testID,""),focusable:o.getOr(t.accessible,!0)}),c.jsx(e.RenderIf.make,{condition:s,children:c.jsx(n.View,{style:[{paddingHorizontal:24},o.getOr(f,l.empty)],children:r.some(h(t))})})]},t.key.toString())}))})}},1456,[1313,1315,500,501,3,1318,1310,1304,255]);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react-native");const t=e.TurboModuleRegistry.get("NativeHyperswitchModule")??e.NativeModules.NativeHyperswitchModule;function n(e,t,n={}){const{platformPublishableKey:a,...s}=e;return{hyperswitchConfig:s,paymentSessionConfig:t,configuration:n}}function a(e){const t=JSON.parse(e);if(t.billing&&"string"==typeof t.billing)try{t.billing=JSON.parse(t.billing)}catch{t.billing=null}return t}async function s(e,s,i){const r=n(e,s,i);return await t.getCustomerSavedPaymentMethods(r),{getCustomerLastUsedPaymentMethodData:async()=>a(await t.getCustomerLastUsedPaymentMethodData()),getCustomerDefaultSavedPaymentMethodData:async()=>a(await t.getCustomerDefaultSavedPaymentMethodData()),getCustomerSavedPaymentMethodData:async()=>a(await t.getCustomerSavedPaymentMethodData()),async confirmWithCustomerLastUsedPaymentMethod(e){await t.confirmWithCustomerLastUsedPaymentMethod()},async confirmWithCustomerDefaultPaymentMethod(e){await t.confirmWithCustomerDefaultPaymentMethod()}}}console.log("NativeHyperswitchModule",t);let i=!1;function r(e){i=e}let o=!1;function c(e){o=e}function u(e){switch(e){case"succeeded":case"completed":case"success":return"completed";case"cancelled":case"canceled":return"canceled";default:return"failed"}}function l(e){const t=function(e){if("object"==typeof e&&null!==e)return e;try{return JSON.parse(e)}catch{return{status:"failed",message:String(e)}}}(e);return{status:u(t.status),type:t.type??t.
|
|
1
|
+
"use strict";var e=require("react-native");const t=e.TurboModuleRegistry.get("NativeHyperswitchModule")??e.NativeModules.NativeHyperswitchModule;function n(e,t,n={}){const{platformPublishableKey:a,...s}=e;return{hyperswitchConfig:s,paymentSessionConfig:t,configuration:n}}function a(e){const t=JSON.parse(e);if(t.billing&&"string"==typeof t.billing)try{t.billing=JSON.parse(t.billing)}catch{t.billing=null}return t}async function s(e,s,i){const r=n(e,s,i);return await t.getCustomerSavedPaymentMethods(r),{getCustomerLastUsedPaymentMethodData:async()=>a(await t.getCustomerLastUsedPaymentMethodData()),getCustomerDefaultSavedPaymentMethodData:async()=>a(await t.getCustomerDefaultSavedPaymentMethodData()),getCustomerSavedPaymentMethodData:async()=>a(await t.getCustomerSavedPaymentMethodData()),async confirmWithCustomerLastUsedPaymentMethod(e){await t.confirmWithCustomerLastUsedPaymentMethod()},async confirmWithCustomerDefaultPaymentMethod(e){await t.confirmWithCustomerDefaultPaymentMethod()}}}console.log("NativeHyperswitchModule",t);let i=!1;function r(e){i=e}let o=!1;function c(e){o=e}function u(e){switch(e){case"succeeded":case"completed":case"requires_capture":case"success":return"completed";case"cancelled":case"canceled":return"canceled";default:return"failed"}}function l(e){const t=function(e){if("object"==typeof e&&null!==e)return e;try{return JSON.parse(e)}catch{return{status:"failed",message:String(e)}}}(e);return{status:u(t.status),type:t.type??t.code??t.status??"",message:t.message??t.status??t.code??""}}async function y(e){if(i)return{status:"failed",type:"initialization_in_progress",message:"SDK is reloading. Please wait for initialisation to complete before presenting the payment sheet."};if(o)return{status:"canceled",type:"sheet_already_presented",message:"A payment sheet is already presented."};c(!0);try{return l(await t.presentPaymentSheet({hyperswitchConfig:e.hyperswitchConfig,paymentSessionConfig:e.paymentSessionConfig,configuration:e.configuration}))}finally{c(!1)}}async function m(e){}function d(e,t){return{presentPaymentSheet:async a=>y(n(e,t,a)),async confirmPayment(e,t){},getCustomerSavedPaymentMethods:async n=>s(e,t,n),updateIntent:m}}function f(e){return r(!0),t.initialise(e.publishableKey,e.platformPublishableKey??"",e.profileId??"",e.environment??"PROD",e.customEndpoints??{}).then(()=>(r(!1),{publishableKey:e.publishableKey,async initPaymentSession(t){return a=e,i=t,{presentPaymentSheet:async e=>y(n(a,i,e)),getCustomerSavedPaymentMethods:async e=>s(a,i,e),updateIntent:m};var a,i},elements:async t=>({...d(e,t)})})).catch(e=>{throw r(!1),console.error("Error initializing Hyperswitch SDK:",e),e})}const h={init:f};exports.Hyperswitch=h,exports.loadHyper=f;
|
|
2
2
|
//# sourceMappingURL=index.bundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.bundle.js","sources":["../../../../src/specs/NativeHyperswitchModule.ts","../../../../src/utils/LaunchOptions.ts","../../../../src/context/SavedPaymentMethods.ts","../../../../src/utils/InitializationState.ts","../../../../src/context/PaymentSession.ts","../../../../src/context/Elements.ts","../../../../src/index.ts"],"sourcesContent":["import type { TurboModule } from 'react-native';\nimport { NativeModules, TurboModuleRegistry } from 'react-native';\n\nexport type CustomEndpoints = Object;\n\nexport interface SessionData {\n hyperswitchConfig: Object;\n paymentSessionConfig: { sdkAuthorization: string };\n configuration: Object;\n}\n\nexport interface SavedPaymentMethodsConfiguration {\n hiddenPaymentMethods?: string[];\n}\n\nexport interface Spec extends TurboModule {\n initialise(\n publishableKey: string,\n platformPublishableKey: string,\n profileId: string,\n environment: string,\n customEndpoints: CustomEndpoints\n ): Promise<string>;\n\n presentPaymentSheet(params: Object): Promise<string>;\n\n getCustomerSavedPaymentMethods(params?: Object): Promise<string>;\n\n getCustomerLastUsedPaymentMethodData(): Promise<string>;\n\n getCustomerDefaultSavedPaymentMethodData(): Promise<string>;\n\n getCustomerSavedPaymentMethodData(): Promise<string>;\n\n confirmWithCustomerLastUsedPaymentMethod(reactTag: number): Promise<string>;\n\n confirmWithCustomerDefaultPaymentMethod(reactTag: number): Promise<string>;\n\n confirmWithCustomerPaymentToken(reactTag: number, token: string): Promise<string>;\n}\n\n/**\n * Use `TurboModuleRegistry.get` first for new-arch TurboModules, and fall back\n * to `NativeModules` for legacy/old-arch support.\n */\nconst NativeHyperswitchModule =\n TurboModuleRegistry.get<Spec>('NativeHyperswitchModule') ??\n NativeModules.NativeHyperswitchModule;\nconsole.log('NativeHyperswitchModule', NativeHyperswitchModule);\nexport default NativeHyperswitchModule as Spec;\nexport { NativeHyperswitchModule };\n","import type {\n HyperswitchConfiguration,\n NativePaymentSheetPayload,\n} from '../types/definitions';\nimport type { PaymentSessionConfiguration } from '../types/definitions';\nimport { PaymentResult } from '../types/paymentresult';\n\nfunction buildPresentPaymentSheetPayload(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration,\n configuration: Record<string, unknown> = {},\n): NativePaymentSheetPayload {\n // platformPublishableKey is internal to the RN bridge; it is not part of the\n // merchant-facing hyperswitchConfig payload.\n const { platformPublishableKey: _platformPublishableKey, ...restConfig } =\n hyperswitchConfig;\n\n return {\n hyperswitchConfig: restConfig as Record<string, unknown>,\n paymentSessionConfig: paymentSessionConfig,\n configuration,\n };\n}\n\nfunction mapStatus(status: string): PaymentResult['type'] {\n switch (status) {\n case 'succeeded':\n case 'completed':\n case 'success':\n return 'completed';\n case 'cancelled':\n case 'canceled':\n return 'canceled';\n case 'failed':\n case 'error':\n default:\n return 'failed';\n }\n}\n\nexport { buildPresentPaymentSheetPayload, mapStatus };\n","import NativeHyperswitchModule from '../specs/NativeHyperswitchModule';\nimport {\n HyperswitchConfiguration,\n PaymentSessionConfiguration,\n} from '../types/definitions';\nimport {\n CustomerSavedPaymentMethodsSession,\n CustomerLastUsedPaymentMethod,\n} from '../types/savedPaymentMethods';\nimport { buildPresentPaymentSheetPayload } from '../utils/LaunchOptions';\n\nfunction parsePaymentMethod(raw: string): CustomerLastUsedPaymentMethod {\n const parsed = JSON.parse(raw) as CustomerLastUsedPaymentMethod & {\n billing?: string | object | null;\n };\n if (parsed.billing && typeof parsed.billing === 'string') {\n try {\n parsed.billing = JSON.parse(parsed.billing);\n } catch {\n parsed.billing = null;\n }\n }\n return parsed as CustomerLastUsedPaymentMethod;\n}\n\nexport function createCustomerSavedPaymentMethodsSession(): CustomerSavedPaymentMethodsSession {\n return {\n async getCustomerLastUsedPaymentMethodData(): Promise<CustomerLastUsedPaymentMethod | null> {\n const raw =\n await NativeHyperswitchModule.getCustomerLastUsedPaymentMethodData();\n return parsePaymentMethod(raw);\n },\n\n async getCustomerDefaultSavedPaymentMethodData(): Promise<CustomerLastUsedPaymentMethod | null> {\n const raw =\n await NativeHyperswitchModule.getCustomerDefaultSavedPaymentMethodData();\n return parsePaymentMethod(raw);\n },\n\n async getCustomerSavedPaymentMethodData(): Promise<CustomerLastUsedPaymentMethod | null> {\n const raw =\n await NativeHyperswitchModule.getCustomerSavedPaymentMethodData();\n return parsePaymentMethod(raw);\n },\n\n async confirmWithCustomerLastUsedPaymentMethod(args?: {\n id?: string;\n }): Promise<any> {\n const raw = await NativeHyperswitchModule\n .confirmWithCustomerLastUsedPaymentMethod\n // args?.id\n ();\n // return mapNativeResponseToPaymentResult(raw);\n },\n\n async confirmWithCustomerDefaultPaymentMethod(args?: {\n id?: string;\n }): Promise<any> {\n const raw = await NativeHyperswitchModule\n .confirmWithCustomerDefaultPaymentMethod\n // args?.id\n ();\n // return mapNativeResponseToPaymentResult(raw);\n },\n };\n}\n\nexport async function getCustomerSavedPaymentMethods(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration,\n configuration?: Record<string, unknown>\n): Promise<CustomerSavedPaymentMethodsSession> {\n const payload = buildPresentPaymentSheetPayload(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n await NativeHyperswitchModule.getCustomerSavedPaymentMethods(payload);\n return createCustomerSavedPaymentMethodsSession();\n}\n","/**\n * Tracks whether the Hyperswitch SDK is currently initialising (or re-initialising\n * after a reload). presentPaymentSheet should be blocked while this flag is true\n * so the native SDK is not asked to open a sheet before it is ready.\n *\n * Also tracks whether a payment sheet is currently presented so that a hot-reload\n * (or any other code path) cannot stack a second sheet on top of an open one.\n */\n\nlet _isInitializing = false;\n\nexport function setInitializing(value: boolean): void {\n _isInitializing = value;\n}\n\nexport function isInitializing(): boolean {\n return _isInitializing;\n}\n\nlet _isSheetPresented = false;\n\nexport function setSheetPresented(value: boolean): void {\n _isSheetPresented = value;\n}\n\nexport function isSheetPresented(): boolean {\n return _isSheetPresented;\n}\n","import NativeHyperswitchModule from '../specs/NativeHyperswitchModule';\nimport type {\n HyperswitchConfiguration,\n NativePaymentSheetPayload,\n PaymentSession,\n PaymentSessionConfiguration,\n} from '../types/definitions';\nimport { buildPresentPaymentSheetPayload } from '../utils/LaunchOptions';\nimport { getCustomerSavedPaymentMethods } from './SavedPaymentMethods';\nimport type { PaymentResult } from '../types/paymentresult';\nimport type { CustomerSavedPaymentMethodsSession } from '../types/savedPaymentMethods';\nimport { isInitializing, isSheetPresented, setSheetPresented } from '../utils/InitializationState';\n\ninterface NativeResponse {\n status: string;\n message: string;\n code?: string;\n type?: string;\n data?: any;\n}\n\nexport function parseNativeResponse(\n raw: string | NativeResponse\n): NativeResponse {\n if (typeof raw === 'object' && raw !== null) {\n return raw as NativeResponse;\n }\n try {\n return JSON.parse(raw as string) as NativeResponse;\n } catch {\n return { status: 'failed', message: String(raw) };\n }\n}\n\nexport function mapStatus(status: string): PaymentResult['status'] {\n switch (status) {\n case 'succeeded':\n case 'completed':\n case 'success':\n return 'completed';\n case 'cancelled':\n case 'canceled':\n return 'canceled';\n case 'failed':\n case 'error':\n default:\n return 'failed';\n }\n}\n\nexport function mapNativeResponseToPaymentResult(\n raw: string | NativeResponse\n): PaymentResult {\n const parsed = parseNativeResponse(raw);\n return {\n status: mapStatus(parsed.status),\n type: parsed.type ?? parsed.status ?? parsed.code ?? \"\",\n message: parsed.message ?? parsed.status ?? parsed.code ?? \"\",\n };\n}\n\nexport async function presentPaymentSheetWithPayload(\n payload: NativePaymentSheetPayload\n): Promise<PaymentResult> {\n if (isInitializing()) {\n return {\n status: 'failed',\n type: 'initialization_in_progress',\n message: 'SDK is reloading. Please wait for initialisation to complete before presenting the payment sheet.',\n };\n }\n if (isSheetPresented()) {\n // A sheet is already open (e.g. a hot-reload fired while the sheet was visible).\n // Silently skip so the existing sheet is not covered by a new one.\n return {\n status: 'canceled',\n type: 'sheet_already_presented',\n message: 'A payment sheet is already presented.',\n };\n }\n setSheetPresented(true);\n try {\n const raw = await NativeHyperswitchModule.presentPaymentSheet({\n hyperswitchConfig: payload.hyperswitchConfig,\n paymentSessionConfig: payload.paymentSessionConfig,\n configuration: payload.configuration,\n });\n return mapNativeResponseToPaymentResult(raw);\n } finally {\n setSheetPresented(false);\n }\n}\n\nexport async function updateIntent(\n _intentResolver: () => Promise<PaymentSessionConfiguration>\n): Promise<void> {\n}\n\nexport function createPaymentSession(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration\n): PaymentSession {\n return {\n async presentPaymentSheet(\n configuration?: Record<string, unknown>\n ): Promise<PaymentResult> {\n const payload = buildPresentPaymentSheetPayload(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n return presentPaymentSheetWithPayload(payload);\n },\n\n async getCustomerSavedPaymentMethods(\n configuration?: Record<string, unknown>\n ): Promise<CustomerSavedPaymentMethodsSession> {\n return getCustomerSavedPaymentMethods(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n },\n updateIntent,\n };\n}\n","import type {\n HyperswitchConfiguration,\n PaymentElementHandle,\n PaymentSessionConfiguration,\n} from '../types/definitions';\nimport { buildPresentPaymentSheetPayload } from '../utils/LaunchOptions';\nimport {\n presentPaymentSheetWithPayload,\n updateIntent,\n} from '../context/PaymentSession';\nimport type { PaymentResult } from '../types/paymentresult';\nimport type { CustomerSavedPaymentMethodsSession } from '../types/savedPaymentMethods';\n\nimport { getCustomerSavedPaymentMethods } from './SavedPaymentMethods';\nimport { Elements } from '../types/elements';\n\ntype ElementsNativeActions = Pick<\n Elements,\n | 'confirmPayment'\n | 'presentPaymentSheet'\n | 'getCustomerSavedPaymentMethods'\n | 'updateIntent'\n>;\n\nexport function createElementsNativeActions(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration\n): ElementsNativeActions {\n return {\n async presentPaymentSheet(\n configuration?: Record<string, unknown>\n ): Promise<PaymentResult> {\n const payload = buildPresentPaymentSheetPayload(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n return presentPaymentSheetWithPayload(payload);\n },\n\n async confirmPayment(\n paymentElementRef: { current: PaymentElementHandle | null } | string,\n _confirmOptions?: { confirmParams?: Record<string, any> }\n ): Promise<any> {\n // if (typeof paymentElementRef === 'string') {\n // const result = await widgetConfirm(paymentElementRef);\n // return {\n // type: mapStatus(result.status),\n // message: result.message,\n // };\n // }\n // const ref = paymentElementRef.current;\n // if (!ref) {\n // throw new Error('PaymentElement reference is not mounted');\n // }\n // return ref.confirmPayment(_confirmOptions);\n },\n\n async getCustomerSavedPaymentMethods(\n configuration?: Record<string, unknown>\n ): Promise<CustomerSavedPaymentMethodsSession> {\n return getCustomerSavedPaymentMethods(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n },\n\n updateIntent: updateIntent,\n };\n}\n\nexport function createElements(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration\n): Elements {\n return {\n ...createElementsNativeActions(hyperswitchConfig, paymentSessionConfig),\n };\n}\n","import type {\n HyperswitchConfiguration,\n PaymentSession,\n PaymentSessionConfiguration,\n HyperswitchSession\n} from './types/definitions';\n\nexport type * from './types/definitions';\nexport type * from './types/elements';\nexport type * from './types/NativeModuleTypes';\nexport type * from './types/PaymentSheetConfiguration'\n\nimport NativeHyperswitchModule from './specs/NativeHyperswitchModule';\nimport { createPaymentSession } from './context/PaymentSession';\nimport { Elements } from './types/elements';\nimport { createElements } from './context/Elements';\nimport { setInitializing } from './utils/InitializationState';\n\nexport function loadHyper(\n config: HyperswitchConfiguration\n): Promise<HyperswitchSession> {\n setInitializing(true);\n return NativeHyperswitchModule.initialise(\n config.publishableKey,\n config.platformPublishableKey ?? '',\n config.profileId ?? '',\n config.environment ?? 'PROD',\n config.customEndpoints ?? {}\n ).then(() => {\n setInitializing(false);\n return {\n publishableKey: config.publishableKey,\n async initPaymentSession(\n options: PaymentSessionConfiguration\n ): Promise<PaymentSession> {\n return createPaymentSession(config, options);\n },\n async elements(options: PaymentSessionConfiguration): Promise<Elements> {\n return createElements(config, options);\n },\n }\n }).catch((error) => {\n setInitializing(false);\n console.error('Error initializing Hyperswitch SDK:', error);\n throw error;\n });\n\n}\n\n\nexport const Hyperswitch = {\n init: loadHyper,\n};"],"names":["NativeHyperswitchModule","TurboModuleRegistry","get","NativeModules","buildPresentPaymentSheetPayload","hyperswitchConfig","paymentSessionConfig","configuration","platformPublishableKey","_platformPublishableKey","restConfig","parsePaymentMethod","raw","parsed","JSON","parse","billing","async","getCustomerSavedPaymentMethods","payload","getCustomerLastUsedPaymentMethodData","getCustomerDefaultSavedPaymentMethodData","getCustomerSavedPaymentMethodData","confirmWithCustomerLastUsedPaymentMethod","args","confirmWithCustomerDefaultPaymentMethod","console","log","_isInitializing","setInitializing","value","_isSheetPresented","setSheetPresented","mapStatus","status","mapNativeResponseToPaymentResult","message","String","parseNativeResponse","type","code","presentPaymentSheetWithPayload","presentPaymentSheet","updateIntent","_intentResolver","createElementsNativeActions","confirmPayment","paymentElementRef","_confirmOptions","loadHyper","config","initialise","publishableKey","profileId","environment","customEndpoints","then","initPaymentSession","options","catch","error","Hyperswitch","init"],"mappings":"2CA6CA,MAAMA,EACJC,EAAAA,oBAAoBC,IAAU,4BAC9BC,EAAAA,cAAcH,wBCxChB,SAASI,EACPC,EACAC,EACAC,EAAyC,CAAA,GAIzC,MAAQC,uBAAwBC,KAA4BC,GAC1DL,EAEF,MAAO,CACLA,kBAAmBK,EACnBJ,qBAAsBA,EACtBC,gBAEJ,CCXA,SAASI,EAAmBC,GAC1B,MAAMC,EAASC,KAAKC,MAAMH,GAG1B,GAAIC,EAAOG,SAAqC,iBAAnBH,EAAOG,QAClC,IACEH,EAAOG,QAAUF,KAAKC,MAAMF,EAAOG,QACrC,CAAE,MACAH,EAAOG,QAAU,IACnB,CAEF,OAAOH,CACT,CA4COI,eAAeC,EACpBb,EACAC,EACAC,GAEA,MAAMY,EAAUf,EACdC,EACAC,EACAC,GAGF,aADMP,EAAwBkB,+BAA+BC,GAnDtD,CACLF,qCAA0C,SAGjCN,QADCX,EAAwBoB,wCAIlCH,yCAA8C,SAGrCN,QADCX,EAAwBqB,4CAIlCJ,kCAAuC,SAG9BN,QADCX,EAAwBsB,qCAIlC,8CAAMC,CAAyCC,SAG3BxB,EACfuB,0CAIL,EAEA,6CAAME,CAAwCD,SAG1BxB,EACfyB,yCAIL,EAgBJ,CF/BAC,QAAQC,IAAI,0BAA2B3B,GGvCvC,IAAI4B,GAAkB,EAEhB,SAAUC,EAAgBC,GAC9BF,EAAkBE,CACpB,CAMA,IAAIC,GAAoB,EAElB,SAAUC,EAAkBF,GAChCC,EAAoBD,CACtB,CCWM,SAAUG,EAAUC,GACxB,OAAQA,GACN,IAAK,YACL,IAAK,YACL,IAAK,UACH,MAAO,YACT,IAAK,YACL,IAAK,WACH,MAAO,WAGT,QACE,MAAO,SAEb,CAEM,SAAUC,EACdvB,GAEA,MAAMC,EAhCF,SACJD,GAEA,GAAmB,iBAARA,GAA4B,OAARA,EAC7B,OAAOA,EAET,IACE,OAAOE,KAAKC,MAAMH,EACpB,CAAE,MACA,MAAO,CAAEsB,OAAQ,SAAUE,QAASC,OAAOzB,GAC7C,CACF,CAqBiB0B,CAAoB1B,GACnC,MAAO,CACLsB,OAAQD,EAAUpB,EAAOqB,QACzBK,KAAM1B,EAAO0B,MAAQ1B,EAAOqB,QAAUrB,EAAO2B,MAAQ,GACrDJ,QAASvB,EAAOuB,SAAWvB,EAAOqB,QAAUrB,EAAO2B,MAAQ,GAE/D,CAEOvB,eAAewB,EACpBtB,GAEA,GDhDOS,ECiDL,MAAO,CACLM,OAAQ,SACRK,KAAM,6BACNH,QAAS,qGAGb,GD7COL,ECgDL,MAAO,CACLG,OAAQ,WACRK,KAAM,0BACNH,QAAS,yCAGbJ,GAAkB,GAClB,IAME,OAAOG,QALWnC,EAAwB0C,oBAAoB,CAC5DrC,kBAAmBc,EAAQd,kBAC3BC,qBAAsBa,EAAQb,qBAC9BC,cAAeY,EAAQZ,gBAG3B,SACEyB,GAAkB,EACpB,CACF,CAEOf,eAAe0B,EACpBC,GAEF,CCxEM,SAAUC,EACdxC,EACAC,GAEA,MAAO,CACLW,oBAAyB,MACvBV,GAOOkC,EALSrC,EACdC,EACAC,EACAC,IAKJ,oBAAMuC,CACJC,EACAC,GAcF,EAEA/B,+BAAoC,MAClCV,GAEOW,EACLb,EACAC,EACAC,GAIJoC,aAAcA,EAElB,CCpDM,SAAUM,EACdC,GAGA,OADArB,GAAgB,GACT7B,EAAwBmD,WAC7BD,EAAOE,eACPF,EAAO1C,wBAA0B,GACjC0C,EAAOG,WAAa,GACpBH,EAAOI,aAAe,OACtBJ,EAAOK,iBAAmB,CAAA,GAC1BC,KAAK,KACL3B,GAAgB,GACT,CACLuB,eAAgBF,EAAOE,eACvB,wBAAMK,CACJC,GAEA,OFgENrD,EEhEkC6C,EFiElC5C,EEjE0CoD,EFmEnC,CACLzC,oBAAyB,MACvBV,GAOOkC,EALSrC,EACdC,EACAC,EACAC,IAKJU,+BAAoC,MAClCV,GAEOW,EACLb,EACAC,EACAC,GAGJoC,gBAzBE,IACJtC,EACAC,CEhEI,EACAW,SAAc,MAACyC,IDuCZ,IACFb,ECvCuBK,EAAQQ,QAGjCC,MAAOC,IAGR,MAFA/B,GAAgB,GAChBH,QAAQkC,MAAM,sCAAuCA,GAC/CA,GAGV,CAGO,MAAMC,EAAc,CACzBC,KAAMb"}
|
|
1
|
+
{"version":3,"file":"index.bundle.js","sources":["../../../../src/specs/NativeHyperswitchModule.ts","../../../../src/utils/LaunchOptions.ts","../../../../src/context/SavedPaymentMethods.ts","../../../../src/utils/InitializationState.ts","../../../../src/context/PaymentSession.ts","../../../../src/context/Elements.ts","../../../../src/index.ts"],"sourcesContent":["import type { TurboModule } from 'react-native';\nimport { NativeModules, TurboModuleRegistry } from 'react-native';\n\nexport type CustomEndpoints = Object;\n\nexport interface SessionData {\n hyperswitchConfig: Object;\n paymentSessionConfig: { sdkAuthorization: string };\n configuration: Object;\n}\n\nexport interface SavedPaymentMethodsConfiguration {\n hiddenPaymentMethods?: string[];\n}\n\nexport interface Spec extends TurboModule {\n initialise(\n publishableKey: string,\n platformPublishableKey: string,\n profileId: string,\n environment: string,\n customEndpoints: CustomEndpoints\n ): Promise<string>;\n\n presentPaymentSheet(params: Object): Promise<string>;\n\n getCustomerSavedPaymentMethods(params?: Object): Promise<string>;\n\n getCustomerLastUsedPaymentMethodData(): Promise<string>;\n\n getCustomerDefaultSavedPaymentMethodData(): Promise<string>;\n\n getCustomerSavedPaymentMethodData(): Promise<string>;\n\n confirmWithCustomerLastUsedPaymentMethod(reactTag: number): Promise<string>;\n\n confirmWithCustomerDefaultPaymentMethod(reactTag: number): Promise<string>;\n\n confirmWithCustomerPaymentToken(reactTag: number, token: string): Promise<string>;\n}\n\n/**\n * Use `TurboModuleRegistry.get` first for new-arch TurboModules, and fall back\n * to `NativeModules` for legacy/old-arch support.\n */\nconst NativeHyperswitchModule =\n TurboModuleRegistry.get<Spec>('NativeHyperswitchModule') ??\n NativeModules.NativeHyperswitchModule;\nconsole.log('NativeHyperswitchModule', NativeHyperswitchModule);\nexport default NativeHyperswitchModule as Spec;\nexport { NativeHyperswitchModule };\n","import type {\n HyperswitchConfiguration,\n NativePaymentSheetPayload,\n} from '../types/definitions';\nimport type { PaymentSessionConfiguration } from '../types/definitions';\nimport { PaymentResult } from '../types/paymentresult';\n\nfunction buildPresentPaymentSheetPayload(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration,\n configuration: Record<string, unknown> = {},\n): NativePaymentSheetPayload {\n // platformPublishableKey is internal to the RN bridge; it is not part of the\n // merchant-facing hyperswitchConfig payload.\n const { platformPublishableKey: _platformPublishableKey, ...restConfig } =\n hyperswitchConfig;\n\n return {\n hyperswitchConfig: restConfig as Record<string, unknown>,\n paymentSessionConfig: paymentSessionConfig,\n configuration,\n };\n}\n\nfunction mapStatus(status: string): PaymentResult['type'] {\n switch (status) {\n case 'succeeded':\n case 'completed':\n case 'success':\n return 'completed';\n case 'cancelled':\n case 'canceled':\n return 'canceled';\n case 'failed':\n case 'error':\n default:\n return 'failed';\n }\n}\n\nexport { buildPresentPaymentSheetPayload, mapStatus };\n","import NativeHyperswitchModule from '../specs/NativeHyperswitchModule';\nimport {\n HyperswitchConfiguration,\n PaymentSessionConfiguration,\n} from '../types/definitions';\nimport {\n CustomerSavedPaymentMethodsSession,\n CustomerLastUsedPaymentMethod,\n} from '../types/savedPaymentMethods';\nimport { buildPresentPaymentSheetPayload } from '../utils/LaunchOptions';\n\nfunction parsePaymentMethod(raw: string): CustomerLastUsedPaymentMethod {\n const parsed = JSON.parse(raw) as CustomerLastUsedPaymentMethod & {\n billing?: string | object | null;\n };\n if (parsed.billing && typeof parsed.billing === 'string') {\n try {\n parsed.billing = JSON.parse(parsed.billing);\n } catch {\n parsed.billing = null;\n }\n }\n return parsed as CustomerLastUsedPaymentMethod;\n}\n\nexport function createCustomerSavedPaymentMethodsSession(): CustomerSavedPaymentMethodsSession {\n return {\n async getCustomerLastUsedPaymentMethodData(): Promise<CustomerLastUsedPaymentMethod | null> {\n const raw =\n await NativeHyperswitchModule.getCustomerLastUsedPaymentMethodData();\n return parsePaymentMethod(raw);\n },\n\n async getCustomerDefaultSavedPaymentMethodData(): Promise<CustomerLastUsedPaymentMethod | null> {\n const raw =\n await NativeHyperswitchModule.getCustomerDefaultSavedPaymentMethodData();\n return parsePaymentMethod(raw);\n },\n\n async getCustomerSavedPaymentMethodData(): Promise<CustomerLastUsedPaymentMethod | null> {\n const raw =\n await NativeHyperswitchModule.getCustomerSavedPaymentMethodData();\n return parsePaymentMethod(raw);\n },\n\n async confirmWithCustomerLastUsedPaymentMethod(args?: {\n id?: string;\n }): Promise<any> {\n const raw = await NativeHyperswitchModule\n .confirmWithCustomerLastUsedPaymentMethod\n // args?.id\n ();\n // return mapNativeResponseToPaymentResult(raw);\n },\n\n async confirmWithCustomerDefaultPaymentMethod(args?: {\n id?: string;\n }): Promise<any> {\n const raw = await NativeHyperswitchModule\n .confirmWithCustomerDefaultPaymentMethod\n // args?.id\n ();\n // return mapNativeResponseToPaymentResult(raw);\n },\n };\n}\n\nexport async function getCustomerSavedPaymentMethods(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration,\n configuration?: Record<string, unknown>\n): Promise<CustomerSavedPaymentMethodsSession> {\n const payload = buildPresentPaymentSheetPayload(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n await NativeHyperswitchModule.getCustomerSavedPaymentMethods(payload);\n return createCustomerSavedPaymentMethodsSession();\n}\n","/**\n * Tracks whether the Hyperswitch SDK is currently initialising (or re-initialising\n * after a reload). presentPaymentSheet should be blocked while this flag is true\n * so the native SDK is not asked to open a sheet before it is ready.\n *\n * Also tracks whether a payment sheet is currently presented so that a hot-reload\n * (or any other code path) cannot stack a second sheet on top of an open one.\n */\n\nlet _isInitializing = false;\n\nexport function setInitializing(value: boolean): void {\n _isInitializing = value;\n}\n\nexport function isInitializing(): boolean {\n return _isInitializing;\n}\n\nlet _isSheetPresented = false;\n\nexport function setSheetPresented(value: boolean): void {\n _isSheetPresented = value;\n}\n\nexport function isSheetPresented(): boolean {\n return _isSheetPresented;\n}\n","import NativeHyperswitchModule from '../specs/NativeHyperswitchModule';\nimport type {\n HyperswitchConfiguration,\n NativePaymentSheetPayload,\n PaymentSession,\n PaymentSessionConfiguration,\n} from '../types/definitions';\nimport { buildPresentPaymentSheetPayload } from '../utils/LaunchOptions';\nimport { getCustomerSavedPaymentMethods } from './SavedPaymentMethods';\nimport type { PaymentResult } from '../types/paymentresult';\nimport type { CustomerSavedPaymentMethodsSession } from '../types/savedPaymentMethods';\nimport { isInitializing, isSheetPresented, setSheetPresented } from '../utils/InitializationState';\n\ninterface NativeResponse {\n status: string;\n message: string;\n code?: string;\n type?: string;\n data?: any;\n}\n\nexport function parseNativeResponse(\n raw: string | NativeResponse\n): NativeResponse {\n if (typeof raw === 'object' && raw !== null) {\n return raw as NativeResponse;\n }\n try {\n return JSON.parse(raw as string) as NativeResponse;\n } catch {\n return { status: 'failed', message: String(raw) };\n }\n}\n\nexport function mapStatus(status: string): PaymentResult['status'] {\n switch (status) {\n case 'succeeded':\n case 'completed':\n case 'requires_capture':\n case 'success':\n return 'completed';\n case 'cancelled':\n case 'canceled':\n return 'canceled';\n case 'failed':\n case 'error':\n default:\n return 'failed';\n }\n}\n\nexport function mapNativeResponseToPaymentResult(\n raw: string | NativeResponse\n): PaymentResult {\n const parsed = parseNativeResponse(raw);\n return {\n status: mapStatus(parsed.status),\n type: parsed.type ?? parsed.code ?? parsed.status ?? \"\",\n message: parsed.message ?? parsed.status ?? parsed.code ?? \"\",\n };\n}\n\nexport async function presentPaymentSheetWithPayload(\n payload: NativePaymentSheetPayload\n): Promise<PaymentResult> {\n if (isInitializing()) {\n return {\n status: 'failed',\n type: 'initialization_in_progress',\n message: 'SDK is reloading. Please wait for initialisation to complete before presenting the payment sheet.',\n };\n }\n if (isSheetPresented()) {\n // A sheet is already open (e.g. a hot-reload fired while the sheet was visible).\n // Silently skip so the existing sheet is not covered by a new one.\n return {\n status: 'canceled',\n type: 'sheet_already_presented',\n message: 'A payment sheet is already presented.',\n };\n }\n setSheetPresented(true);\n try {\n const raw = await NativeHyperswitchModule.presentPaymentSheet({\n hyperswitchConfig: payload.hyperswitchConfig,\n paymentSessionConfig: payload.paymentSessionConfig,\n configuration: payload.configuration,\n });\n return mapNativeResponseToPaymentResult(raw);\n } finally {\n setSheetPresented(false);\n }\n}\n\nexport async function updateIntent(\n _intentResolver: () => Promise<PaymentSessionConfiguration>\n): Promise<void> {\n}\n\nexport function createPaymentSession(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration\n): PaymentSession {\n return {\n async presentPaymentSheet(\n configuration?: Record<string, unknown>\n ): Promise<PaymentResult> {\n const payload = buildPresentPaymentSheetPayload(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n return presentPaymentSheetWithPayload(payload);\n },\n\n async getCustomerSavedPaymentMethods(\n configuration?: Record<string, unknown>\n ): Promise<CustomerSavedPaymentMethodsSession> {\n return getCustomerSavedPaymentMethods(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n },\n updateIntent,\n };\n}\n","import type {\n HyperswitchConfiguration,\n PaymentElementHandle,\n PaymentSessionConfiguration,\n} from '../types/definitions';\nimport { buildPresentPaymentSheetPayload } from '../utils/LaunchOptions';\nimport {\n presentPaymentSheetWithPayload,\n updateIntent,\n} from '../context/PaymentSession';\nimport type { PaymentResult } from '../types/paymentresult';\nimport type { CustomerSavedPaymentMethodsSession } from '../types/savedPaymentMethods';\n\nimport { getCustomerSavedPaymentMethods } from './SavedPaymentMethods';\nimport { Elements } from '../types/elements';\n\ntype ElementsNativeActions = Pick<\n Elements,\n | 'confirmPayment'\n | 'presentPaymentSheet'\n | 'getCustomerSavedPaymentMethods'\n | 'updateIntent'\n>;\n\nexport function createElementsNativeActions(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration\n): ElementsNativeActions {\n return {\n async presentPaymentSheet(\n configuration?: Record<string, unknown>\n ): Promise<PaymentResult> {\n const payload = buildPresentPaymentSheetPayload(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n return presentPaymentSheetWithPayload(payload);\n },\n\n async confirmPayment(\n paymentElementRef: { current: PaymentElementHandle | null } | string,\n _confirmOptions?: { confirmParams?: Record<string, any> }\n ): Promise<any> {\n // if (typeof paymentElementRef === 'string') {\n // const result = await widgetConfirm(paymentElementRef);\n // return {\n // type: mapStatus(result.status),\n // message: result.message,\n // };\n // }\n // const ref = paymentElementRef.current;\n // if (!ref) {\n // throw new Error('PaymentElement reference is not mounted');\n // }\n // return ref.confirmPayment(_confirmOptions);\n },\n\n async getCustomerSavedPaymentMethods(\n configuration?: Record<string, unknown>\n ): Promise<CustomerSavedPaymentMethodsSession> {\n return getCustomerSavedPaymentMethods(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n },\n\n updateIntent: updateIntent,\n };\n}\n\nexport function createElements(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration\n): Elements {\n return {\n ...createElementsNativeActions(hyperswitchConfig, paymentSessionConfig),\n };\n}\n","import type {\n HyperswitchConfiguration,\n PaymentSession,\n PaymentSessionConfiguration,\n HyperswitchSession\n} from './types/definitions';\n\nexport type * from './types/definitions';\nexport type * from './types/elements';\nexport type * from './types/NativeModuleTypes';\nexport type * from './types/PaymentSheetConfiguration'\n\nimport NativeHyperswitchModule from './specs/NativeHyperswitchModule';\nimport { createPaymentSession } from './context/PaymentSession';\nimport { Elements } from './types/elements';\nimport { createElements } from './context/Elements';\nimport { setInitializing } from './utils/InitializationState';\n\nexport function loadHyper(\n config: HyperswitchConfiguration\n): Promise<HyperswitchSession> {\n setInitializing(true);\n return NativeHyperswitchModule.initialise(\n config.publishableKey,\n config.platformPublishableKey ?? '',\n config.profileId ?? '',\n config.environment ?? 'PROD',\n config.customEndpoints ?? {}\n ).then(() => {\n setInitializing(false);\n return {\n publishableKey: config.publishableKey,\n async initPaymentSession(\n options: PaymentSessionConfiguration\n ): Promise<PaymentSession> {\n return createPaymentSession(config, options);\n },\n async elements(options: PaymentSessionConfiguration): Promise<Elements> {\n return createElements(config, options);\n },\n }\n }).catch((error) => {\n setInitializing(false);\n console.error('Error initializing Hyperswitch SDK:', error);\n throw error;\n });\n\n}\n\n\nexport const Hyperswitch = {\n init: loadHyper,\n};"],"names":["NativeHyperswitchModule","TurboModuleRegistry","get","NativeModules","buildPresentPaymentSheetPayload","hyperswitchConfig","paymentSessionConfig","configuration","platformPublishableKey","_platformPublishableKey","restConfig","parsePaymentMethod","raw","parsed","JSON","parse","billing","async","getCustomerSavedPaymentMethods","payload","getCustomerLastUsedPaymentMethodData","getCustomerDefaultSavedPaymentMethodData","getCustomerSavedPaymentMethodData","confirmWithCustomerLastUsedPaymentMethod","args","confirmWithCustomerDefaultPaymentMethod","console","log","_isInitializing","setInitializing","value","_isSheetPresented","setSheetPresented","mapStatus","status","mapNativeResponseToPaymentResult","message","String","parseNativeResponse","type","code","presentPaymentSheetWithPayload","presentPaymentSheet","updateIntent","_intentResolver","createElementsNativeActions","confirmPayment","paymentElementRef","_confirmOptions","loadHyper","config","initialise","publishableKey","profileId","environment","customEndpoints","then","initPaymentSession","options","catch","error","Hyperswitch","init"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{TurboModuleRegistry as e,NativeModules as t}from"react-native";const n=e.get("NativeHyperswitchModule")??t.NativeHyperswitchModule;function a(e,t,n={}){const{platformPublishableKey:a,...s}=e;return{hyperswitchConfig:s,paymentSessionConfig:t,configuration:n}}function s(e){const t=JSON.parse(e);if(t.billing&&"string"==typeof t.billing)try{t.billing=JSON.parse(t.billing)}catch{t.billing=null}return t}async function i(e,t,i){const o=a(e,t,i);return await n.getCustomerSavedPaymentMethods(o),{getCustomerLastUsedPaymentMethodData:async()=>s(await n.getCustomerLastUsedPaymentMethodData()),getCustomerDefaultSavedPaymentMethodData:async()=>s(await n.getCustomerDefaultSavedPaymentMethodData()),getCustomerSavedPaymentMethodData:async()=>s(await n.getCustomerSavedPaymentMethodData()),async confirmWithCustomerLastUsedPaymentMethod(e){await n.confirmWithCustomerLastUsedPaymentMethod()},async confirmWithCustomerDefaultPaymentMethod(e){await n.confirmWithCustomerDefaultPaymentMethod()}}}console.log("NativeHyperswitchModule",n);let o=!1;function r(e){o=e}let c=!1;function u(e){c=e}function l(e){switch(e){case"succeeded":case"completed":case"success":return"completed";case"cancelled":case"canceled":return"canceled";default:return"failed"}}function y(e){const t=function(e){if("object"==typeof e&&null!==e)return e;try{return JSON.parse(e)}catch{return{status:"failed",message:String(e)}}}(e);return{status:l(t.status),type:t.type??t.
|
|
1
|
+
import{TurboModuleRegistry as e,NativeModules as t}from"react-native";const n=e.get("NativeHyperswitchModule")??t.NativeHyperswitchModule;function a(e,t,n={}){const{platformPublishableKey:a,...s}=e;return{hyperswitchConfig:s,paymentSessionConfig:t,configuration:n}}function s(e){const t=JSON.parse(e);if(t.billing&&"string"==typeof t.billing)try{t.billing=JSON.parse(t.billing)}catch{t.billing=null}return t}async function i(e,t,i){const o=a(e,t,i);return await n.getCustomerSavedPaymentMethods(o),{getCustomerLastUsedPaymentMethodData:async()=>s(await n.getCustomerLastUsedPaymentMethodData()),getCustomerDefaultSavedPaymentMethodData:async()=>s(await n.getCustomerDefaultSavedPaymentMethodData()),getCustomerSavedPaymentMethodData:async()=>s(await n.getCustomerSavedPaymentMethodData()),async confirmWithCustomerLastUsedPaymentMethod(e){await n.confirmWithCustomerLastUsedPaymentMethod()},async confirmWithCustomerDefaultPaymentMethod(e){await n.confirmWithCustomerDefaultPaymentMethod()}}}console.log("NativeHyperswitchModule",n);let o=!1;function r(e){o=e}let c=!1;function u(e){c=e}function l(e){switch(e){case"succeeded":case"completed":case"requires_capture":case"success":return"completed";case"cancelled":case"canceled":return"canceled";default:return"failed"}}function y(e){const t=function(e){if("object"==typeof e&&null!==e)return e;try{return JSON.parse(e)}catch{return{status:"failed",message:String(e)}}}(e);return{status:l(t.status),type:t.type??t.code??t.status??"",message:t.message??t.status??t.code??""}}async function m(e){if(o)return{status:"failed",type:"initialization_in_progress",message:"SDK is reloading. Please wait for initialisation to complete before presenting the payment sheet."};if(c)return{status:"canceled",type:"sheet_already_presented",message:"A payment sheet is already presented."};u(!0);try{return y(await n.presentPaymentSheet({hyperswitchConfig:e.hyperswitchConfig,paymentSessionConfig:e.paymentSessionConfig,configuration:e.configuration}))}finally{u(!1)}}async function d(e){}function f(e,t){return{presentPaymentSheet:async n=>m(a(e,t,n)),async confirmPayment(e,t){},getCustomerSavedPaymentMethods:async n=>i(e,t,n),updateIntent:d}}function h(e){return r(!0),n.initialise(e.publishableKey,e.platformPublishableKey??"",e.profileId??"",e.environment??"PROD",e.customEndpoints??{}).then(()=>(r(!1),{publishableKey:e.publishableKey,async initPaymentSession(t){return n=e,s=t,{presentPaymentSheet:async e=>m(a(n,s,e)),getCustomerSavedPaymentMethods:async e=>i(n,s,e),updateIntent:d};var n,s},elements:async t=>({...f(e,t)})})).catch(e=>{throw r(!1),console.error("Error initializing Hyperswitch SDK:",e),e})}const p={init:h};export{p as Hyperswitch,h as loadHyper};
|
|
2
2
|
//# sourceMappingURL=index.bundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.bundle.js","sources":["../../../../src/specs/NativeHyperswitchModule.ts","../../../../src/utils/LaunchOptions.ts","../../../../src/context/SavedPaymentMethods.ts","../../../../src/utils/InitializationState.ts","../../../../src/context/PaymentSession.ts","../../../../src/context/Elements.ts","../../../../src/index.ts"],"sourcesContent":["import type { TurboModule } from 'react-native';\nimport { NativeModules, TurboModuleRegistry } from 'react-native';\n\nexport type CustomEndpoints = Object;\n\nexport interface SessionData {\n hyperswitchConfig: Object;\n paymentSessionConfig: { sdkAuthorization: string };\n configuration: Object;\n}\n\nexport interface SavedPaymentMethodsConfiguration {\n hiddenPaymentMethods?: string[];\n}\n\nexport interface Spec extends TurboModule {\n initialise(\n publishableKey: string,\n platformPublishableKey: string,\n profileId: string,\n environment: string,\n customEndpoints: CustomEndpoints\n ): Promise<string>;\n\n presentPaymentSheet(params: Object): Promise<string>;\n\n getCustomerSavedPaymentMethods(params?: Object): Promise<string>;\n\n getCustomerLastUsedPaymentMethodData(): Promise<string>;\n\n getCustomerDefaultSavedPaymentMethodData(): Promise<string>;\n\n getCustomerSavedPaymentMethodData(): Promise<string>;\n\n confirmWithCustomerLastUsedPaymentMethod(reactTag: number): Promise<string>;\n\n confirmWithCustomerDefaultPaymentMethod(reactTag: number): Promise<string>;\n\n confirmWithCustomerPaymentToken(reactTag: number, token: string): Promise<string>;\n}\n\n/**\n * Use `TurboModuleRegistry.get` first for new-arch TurboModules, and fall back\n * to `NativeModules` for legacy/old-arch support.\n */\nconst NativeHyperswitchModule =\n TurboModuleRegistry.get<Spec>('NativeHyperswitchModule') ??\n NativeModules.NativeHyperswitchModule;\nconsole.log('NativeHyperswitchModule', NativeHyperswitchModule);\nexport default NativeHyperswitchModule as Spec;\nexport { NativeHyperswitchModule };\n","import type {\n HyperswitchConfiguration,\n NativePaymentSheetPayload,\n} from '../types/definitions';\nimport type { PaymentSessionConfiguration } from '../types/definitions';\nimport { PaymentResult } from '../types/paymentresult';\n\nfunction buildPresentPaymentSheetPayload(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration,\n configuration: Record<string, unknown> = {},\n): NativePaymentSheetPayload {\n // platformPublishableKey is internal to the RN bridge; it is not part of the\n // merchant-facing hyperswitchConfig payload.\n const { platformPublishableKey: _platformPublishableKey, ...restConfig } =\n hyperswitchConfig;\n\n return {\n hyperswitchConfig: restConfig as Record<string, unknown>,\n paymentSessionConfig: paymentSessionConfig,\n configuration,\n };\n}\n\nfunction mapStatus(status: string): PaymentResult['type'] {\n switch (status) {\n case 'succeeded':\n case 'completed':\n case 'success':\n return 'completed';\n case 'cancelled':\n case 'canceled':\n return 'canceled';\n case 'failed':\n case 'error':\n default:\n return 'failed';\n }\n}\n\nexport { buildPresentPaymentSheetPayload, mapStatus };\n","import NativeHyperswitchModule from '../specs/NativeHyperswitchModule';\nimport {\n HyperswitchConfiguration,\n PaymentSessionConfiguration,\n} from '../types/definitions';\nimport {\n CustomerSavedPaymentMethodsSession,\n CustomerLastUsedPaymentMethod,\n} from '../types/savedPaymentMethods';\nimport { buildPresentPaymentSheetPayload } from '../utils/LaunchOptions';\n\nfunction parsePaymentMethod(raw: string): CustomerLastUsedPaymentMethod {\n const parsed = JSON.parse(raw) as CustomerLastUsedPaymentMethod & {\n billing?: string | object | null;\n };\n if (parsed.billing && typeof parsed.billing === 'string') {\n try {\n parsed.billing = JSON.parse(parsed.billing);\n } catch {\n parsed.billing = null;\n }\n }\n return parsed as CustomerLastUsedPaymentMethod;\n}\n\nexport function createCustomerSavedPaymentMethodsSession(): CustomerSavedPaymentMethodsSession {\n return {\n async getCustomerLastUsedPaymentMethodData(): Promise<CustomerLastUsedPaymentMethod | null> {\n const raw =\n await NativeHyperswitchModule.getCustomerLastUsedPaymentMethodData();\n return parsePaymentMethod(raw);\n },\n\n async getCustomerDefaultSavedPaymentMethodData(): Promise<CustomerLastUsedPaymentMethod | null> {\n const raw =\n await NativeHyperswitchModule.getCustomerDefaultSavedPaymentMethodData();\n return parsePaymentMethod(raw);\n },\n\n async getCustomerSavedPaymentMethodData(): Promise<CustomerLastUsedPaymentMethod | null> {\n const raw =\n await NativeHyperswitchModule.getCustomerSavedPaymentMethodData();\n return parsePaymentMethod(raw);\n },\n\n async confirmWithCustomerLastUsedPaymentMethod(args?: {\n id?: string;\n }): Promise<any> {\n const raw = await NativeHyperswitchModule\n .confirmWithCustomerLastUsedPaymentMethod\n // args?.id\n ();\n // return mapNativeResponseToPaymentResult(raw);\n },\n\n async confirmWithCustomerDefaultPaymentMethod(args?: {\n id?: string;\n }): Promise<any> {\n const raw = await NativeHyperswitchModule\n .confirmWithCustomerDefaultPaymentMethod\n // args?.id\n ();\n // return mapNativeResponseToPaymentResult(raw);\n },\n };\n}\n\nexport async function getCustomerSavedPaymentMethods(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration,\n configuration?: Record<string, unknown>\n): Promise<CustomerSavedPaymentMethodsSession> {\n const payload = buildPresentPaymentSheetPayload(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n await NativeHyperswitchModule.getCustomerSavedPaymentMethods(payload);\n return createCustomerSavedPaymentMethodsSession();\n}\n","/**\n * Tracks whether the Hyperswitch SDK is currently initialising (or re-initialising\n * after a reload). presentPaymentSheet should be blocked while this flag is true\n * so the native SDK is not asked to open a sheet before it is ready.\n *\n * Also tracks whether a payment sheet is currently presented so that a hot-reload\n * (or any other code path) cannot stack a second sheet on top of an open one.\n */\n\nlet _isInitializing = false;\n\nexport function setInitializing(value: boolean): void {\n _isInitializing = value;\n}\n\nexport function isInitializing(): boolean {\n return _isInitializing;\n}\n\nlet _isSheetPresented = false;\n\nexport function setSheetPresented(value: boolean): void {\n _isSheetPresented = value;\n}\n\nexport function isSheetPresented(): boolean {\n return _isSheetPresented;\n}\n","import NativeHyperswitchModule from '../specs/NativeHyperswitchModule';\nimport type {\n HyperswitchConfiguration,\n NativePaymentSheetPayload,\n PaymentSession,\n PaymentSessionConfiguration,\n} from '../types/definitions';\nimport { buildPresentPaymentSheetPayload } from '../utils/LaunchOptions';\nimport { getCustomerSavedPaymentMethods } from './SavedPaymentMethods';\nimport type { PaymentResult } from '../types/paymentresult';\nimport type { CustomerSavedPaymentMethodsSession } from '../types/savedPaymentMethods';\nimport { isInitializing, isSheetPresented, setSheetPresented } from '../utils/InitializationState';\n\ninterface NativeResponse {\n status: string;\n message: string;\n code?: string;\n type?: string;\n data?: any;\n}\n\nexport function parseNativeResponse(\n raw: string | NativeResponse\n): NativeResponse {\n if (typeof raw === 'object' && raw !== null) {\n return raw as NativeResponse;\n }\n try {\n return JSON.parse(raw as string) as NativeResponse;\n } catch {\n return { status: 'failed', message: String(raw) };\n }\n}\n\nexport function mapStatus(status: string): PaymentResult['status'] {\n switch (status) {\n case 'succeeded':\n case 'completed':\n case 'success':\n return 'completed';\n case 'cancelled':\n case 'canceled':\n return 'canceled';\n case 'failed':\n case 'error':\n default:\n return 'failed';\n }\n}\n\nexport function mapNativeResponseToPaymentResult(\n raw: string | NativeResponse\n): PaymentResult {\n const parsed = parseNativeResponse(raw);\n return {\n status: mapStatus(parsed.status),\n type: parsed.type ?? parsed.status ?? parsed.code ?? \"\",\n message: parsed.message ?? parsed.status ?? parsed.code ?? \"\",\n };\n}\n\nexport async function presentPaymentSheetWithPayload(\n payload: NativePaymentSheetPayload\n): Promise<PaymentResult> {\n if (isInitializing()) {\n return {\n status: 'failed',\n type: 'initialization_in_progress',\n message: 'SDK is reloading. Please wait for initialisation to complete before presenting the payment sheet.',\n };\n }\n if (isSheetPresented()) {\n // A sheet is already open (e.g. a hot-reload fired while the sheet was visible).\n // Silently skip so the existing sheet is not covered by a new one.\n return {\n status: 'canceled',\n type: 'sheet_already_presented',\n message: 'A payment sheet is already presented.',\n };\n }\n setSheetPresented(true);\n try {\n const raw = await NativeHyperswitchModule.presentPaymentSheet({\n hyperswitchConfig: payload.hyperswitchConfig,\n paymentSessionConfig: payload.paymentSessionConfig,\n configuration: payload.configuration,\n });\n return mapNativeResponseToPaymentResult(raw);\n } finally {\n setSheetPresented(false);\n }\n}\n\nexport async function updateIntent(\n _intentResolver: () => Promise<PaymentSessionConfiguration>\n): Promise<void> {\n}\n\nexport function createPaymentSession(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration\n): PaymentSession {\n return {\n async presentPaymentSheet(\n configuration?: Record<string, unknown>\n ): Promise<PaymentResult> {\n const payload = buildPresentPaymentSheetPayload(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n return presentPaymentSheetWithPayload(payload);\n },\n\n async getCustomerSavedPaymentMethods(\n configuration?: Record<string, unknown>\n ): Promise<CustomerSavedPaymentMethodsSession> {\n return getCustomerSavedPaymentMethods(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n },\n updateIntent,\n };\n}\n","import type {\n HyperswitchConfiguration,\n PaymentElementHandle,\n PaymentSessionConfiguration,\n} from '../types/definitions';\nimport { buildPresentPaymentSheetPayload } from '../utils/LaunchOptions';\nimport {\n presentPaymentSheetWithPayload,\n updateIntent,\n} from '../context/PaymentSession';\nimport type { PaymentResult } from '../types/paymentresult';\nimport type { CustomerSavedPaymentMethodsSession } from '../types/savedPaymentMethods';\n\nimport { getCustomerSavedPaymentMethods } from './SavedPaymentMethods';\nimport { Elements } from '../types/elements';\n\ntype ElementsNativeActions = Pick<\n Elements,\n | 'confirmPayment'\n | 'presentPaymentSheet'\n | 'getCustomerSavedPaymentMethods'\n | 'updateIntent'\n>;\n\nexport function createElementsNativeActions(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration\n): ElementsNativeActions {\n return {\n async presentPaymentSheet(\n configuration?: Record<string, unknown>\n ): Promise<PaymentResult> {\n const payload = buildPresentPaymentSheetPayload(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n return presentPaymentSheetWithPayload(payload);\n },\n\n async confirmPayment(\n paymentElementRef: { current: PaymentElementHandle | null } | string,\n _confirmOptions?: { confirmParams?: Record<string, any> }\n ): Promise<any> {\n // if (typeof paymentElementRef === 'string') {\n // const result = await widgetConfirm(paymentElementRef);\n // return {\n // type: mapStatus(result.status),\n // message: result.message,\n // };\n // }\n // const ref = paymentElementRef.current;\n // if (!ref) {\n // throw new Error('PaymentElement reference is not mounted');\n // }\n // return ref.confirmPayment(_confirmOptions);\n },\n\n async getCustomerSavedPaymentMethods(\n configuration?: Record<string, unknown>\n ): Promise<CustomerSavedPaymentMethodsSession> {\n return getCustomerSavedPaymentMethods(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n },\n\n updateIntent: updateIntent,\n };\n}\n\nexport function createElements(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration\n): Elements {\n return {\n ...createElementsNativeActions(hyperswitchConfig, paymentSessionConfig),\n };\n}\n","import type {\n HyperswitchConfiguration,\n PaymentSession,\n PaymentSessionConfiguration,\n HyperswitchSession\n} from './types/definitions';\n\nexport type * from './types/definitions';\nexport type * from './types/elements';\nexport type * from './types/NativeModuleTypes';\nexport type * from './types/PaymentSheetConfiguration'\n\nimport NativeHyperswitchModule from './specs/NativeHyperswitchModule';\nimport { createPaymentSession } from './context/PaymentSession';\nimport { Elements } from './types/elements';\nimport { createElements } from './context/Elements';\nimport { setInitializing } from './utils/InitializationState';\n\nexport function loadHyper(\n config: HyperswitchConfiguration\n): Promise<HyperswitchSession> {\n setInitializing(true);\n return NativeHyperswitchModule.initialise(\n config.publishableKey,\n config.platformPublishableKey ?? '',\n config.profileId ?? '',\n config.environment ?? 'PROD',\n config.customEndpoints ?? {}\n ).then(() => {\n setInitializing(false);\n return {\n publishableKey: config.publishableKey,\n async initPaymentSession(\n options: PaymentSessionConfiguration\n ): Promise<PaymentSession> {\n return createPaymentSession(config, options);\n },\n async elements(options: PaymentSessionConfiguration): Promise<Elements> {\n return createElements(config, options);\n },\n }\n }).catch((error) => {\n setInitializing(false);\n console.error('Error initializing Hyperswitch SDK:', error);\n throw error;\n });\n\n}\n\n\nexport const Hyperswitch = {\n init: loadHyper,\n};"],"names":["NativeHyperswitchModule","TurboModuleRegistry","get","NativeModules","buildPresentPaymentSheetPayload","hyperswitchConfig","paymentSessionConfig","configuration","platformPublishableKey","_platformPublishableKey","restConfig","parsePaymentMethod","raw","parsed","JSON","parse","billing","async","getCustomerSavedPaymentMethods","payload","getCustomerLastUsedPaymentMethodData","getCustomerDefaultSavedPaymentMethodData","getCustomerSavedPaymentMethodData","confirmWithCustomerLastUsedPaymentMethod","args","confirmWithCustomerDefaultPaymentMethod","console","log","_isInitializing","setInitializing","value","_isSheetPresented","setSheetPresented","mapStatus","status","mapNativeResponseToPaymentResult","message","String","parseNativeResponse","type","code","presentPaymentSheetWithPayload","presentPaymentSheet","updateIntent","_intentResolver","createElementsNativeActions","confirmPayment","paymentElementRef","_confirmOptions","loadHyper","config","initialise","publishableKey","profileId","environment","customEndpoints","then","initPaymentSession","options","catch","error","Hyperswitch","init"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"index.bundle.js","sources":["../../../../src/specs/NativeHyperswitchModule.ts","../../../../src/utils/LaunchOptions.ts","../../../../src/context/SavedPaymentMethods.ts","../../../../src/utils/InitializationState.ts","../../../../src/context/PaymentSession.ts","../../../../src/context/Elements.ts","../../../../src/index.ts"],"sourcesContent":["import type { TurboModule } from 'react-native';\nimport { NativeModules, TurboModuleRegistry } from 'react-native';\n\nexport type CustomEndpoints = Object;\n\nexport interface SessionData {\n hyperswitchConfig: Object;\n paymentSessionConfig: { sdkAuthorization: string };\n configuration: Object;\n}\n\nexport interface SavedPaymentMethodsConfiguration {\n hiddenPaymentMethods?: string[];\n}\n\nexport interface Spec extends TurboModule {\n initialise(\n publishableKey: string,\n platformPublishableKey: string,\n profileId: string,\n environment: string,\n customEndpoints: CustomEndpoints\n ): Promise<string>;\n\n presentPaymentSheet(params: Object): Promise<string>;\n\n getCustomerSavedPaymentMethods(params?: Object): Promise<string>;\n\n getCustomerLastUsedPaymentMethodData(): Promise<string>;\n\n getCustomerDefaultSavedPaymentMethodData(): Promise<string>;\n\n getCustomerSavedPaymentMethodData(): Promise<string>;\n\n confirmWithCustomerLastUsedPaymentMethod(reactTag: number): Promise<string>;\n\n confirmWithCustomerDefaultPaymentMethod(reactTag: number): Promise<string>;\n\n confirmWithCustomerPaymentToken(reactTag: number, token: string): Promise<string>;\n}\n\n/**\n * Use `TurboModuleRegistry.get` first for new-arch TurboModules, and fall back\n * to `NativeModules` for legacy/old-arch support.\n */\nconst NativeHyperswitchModule =\n TurboModuleRegistry.get<Spec>('NativeHyperswitchModule') ??\n NativeModules.NativeHyperswitchModule;\nconsole.log('NativeHyperswitchModule', NativeHyperswitchModule);\nexport default NativeHyperswitchModule as Spec;\nexport { NativeHyperswitchModule };\n","import type {\n HyperswitchConfiguration,\n NativePaymentSheetPayload,\n} from '../types/definitions';\nimport type { PaymentSessionConfiguration } from '../types/definitions';\nimport { PaymentResult } from '../types/paymentresult';\n\nfunction buildPresentPaymentSheetPayload(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration,\n configuration: Record<string, unknown> = {},\n): NativePaymentSheetPayload {\n // platformPublishableKey is internal to the RN bridge; it is not part of the\n // merchant-facing hyperswitchConfig payload.\n const { platformPublishableKey: _platformPublishableKey, ...restConfig } =\n hyperswitchConfig;\n\n return {\n hyperswitchConfig: restConfig as Record<string, unknown>,\n paymentSessionConfig: paymentSessionConfig,\n configuration,\n };\n}\n\nfunction mapStatus(status: string): PaymentResult['type'] {\n switch (status) {\n case 'succeeded':\n case 'completed':\n case 'success':\n return 'completed';\n case 'cancelled':\n case 'canceled':\n return 'canceled';\n case 'failed':\n case 'error':\n default:\n return 'failed';\n }\n}\n\nexport { buildPresentPaymentSheetPayload, mapStatus };\n","import NativeHyperswitchModule from '../specs/NativeHyperswitchModule';\nimport {\n HyperswitchConfiguration,\n PaymentSessionConfiguration,\n} from '../types/definitions';\nimport {\n CustomerSavedPaymentMethodsSession,\n CustomerLastUsedPaymentMethod,\n} from '../types/savedPaymentMethods';\nimport { buildPresentPaymentSheetPayload } from '../utils/LaunchOptions';\n\nfunction parsePaymentMethod(raw: string): CustomerLastUsedPaymentMethod {\n const parsed = JSON.parse(raw) as CustomerLastUsedPaymentMethod & {\n billing?: string | object | null;\n };\n if (parsed.billing && typeof parsed.billing === 'string') {\n try {\n parsed.billing = JSON.parse(parsed.billing);\n } catch {\n parsed.billing = null;\n }\n }\n return parsed as CustomerLastUsedPaymentMethod;\n}\n\nexport function createCustomerSavedPaymentMethodsSession(): CustomerSavedPaymentMethodsSession {\n return {\n async getCustomerLastUsedPaymentMethodData(): Promise<CustomerLastUsedPaymentMethod | null> {\n const raw =\n await NativeHyperswitchModule.getCustomerLastUsedPaymentMethodData();\n return parsePaymentMethod(raw);\n },\n\n async getCustomerDefaultSavedPaymentMethodData(): Promise<CustomerLastUsedPaymentMethod | null> {\n const raw =\n await NativeHyperswitchModule.getCustomerDefaultSavedPaymentMethodData();\n return parsePaymentMethod(raw);\n },\n\n async getCustomerSavedPaymentMethodData(): Promise<CustomerLastUsedPaymentMethod | null> {\n const raw =\n await NativeHyperswitchModule.getCustomerSavedPaymentMethodData();\n return parsePaymentMethod(raw);\n },\n\n async confirmWithCustomerLastUsedPaymentMethod(args?: {\n id?: string;\n }): Promise<any> {\n const raw = await NativeHyperswitchModule\n .confirmWithCustomerLastUsedPaymentMethod\n // args?.id\n ();\n // return mapNativeResponseToPaymentResult(raw);\n },\n\n async confirmWithCustomerDefaultPaymentMethod(args?: {\n id?: string;\n }): Promise<any> {\n const raw = await NativeHyperswitchModule\n .confirmWithCustomerDefaultPaymentMethod\n // args?.id\n ();\n // return mapNativeResponseToPaymentResult(raw);\n },\n };\n}\n\nexport async function getCustomerSavedPaymentMethods(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration,\n configuration?: Record<string, unknown>\n): Promise<CustomerSavedPaymentMethodsSession> {\n const payload = buildPresentPaymentSheetPayload(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n await NativeHyperswitchModule.getCustomerSavedPaymentMethods(payload);\n return createCustomerSavedPaymentMethodsSession();\n}\n","/**\n * Tracks whether the Hyperswitch SDK is currently initialising (or re-initialising\n * after a reload). presentPaymentSheet should be blocked while this flag is true\n * so the native SDK is not asked to open a sheet before it is ready.\n *\n * Also tracks whether a payment sheet is currently presented so that a hot-reload\n * (or any other code path) cannot stack a second sheet on top of an open one.\n */\n\nlet _isInitializing = false;\n\nexport function setInitializing(value: boolean): void {\n _isInitializing = value;\n}\n\nexport function isInitializing(): boolean {\n return _isInitializing;\n}\n\nlet _isSheetPresented = false;\n\nexport function setSheetPresented(value: boolean): void {\n _isSheetPresented = value;\n}\n\nexport function isSheetPresented(): boolean {\n return _isSheetPresented;\n}\n","import NativeHyperswitchModule from '../specs/NativeHyperswitchModule';\nimport type {\n HyperswitchConfiguration,\n NativePaymentSheetPayload,\n PaymentSession,\n PaymentSessionConfiguration,\n} from '../types/definitions';\nimport { buildPresentPaymentSheetPayload } from '../utils/LaunchOptions';\nimport { getCustomerSavedPaymentMethods } from './SavedPaymentMethods';\nimport type { PaymentResult } from '../types/paymentresult';\nimport type { CustomerSavedPaymentMethodsSession } from '../types/savedPaymentMethods';\nimport { isInitializing, isSheetPresented, setSheetPresented } from '../utils/InitializationState';\n\ninterface NativeResponse {\n status: string;\n message: string;\n code?: string;\n type?: string;\n data?: any;\n}\n\nexport function parseNativeResponse(\n raw: string | NativeResponse\n): NativeResponse {\n if (typeof raw === 'object' && raw !== null) {\n return raw as NativeResponse;\n }\n try {\n return JSON.parse(raw as string) as NativeResponse;\n } catch {\n return { status: 'failed', message: String(raw) };\n }\n}\n\nexport function mapStatus(status: string): PaymentResult['status'] {\n switch (status) {\n case 'succeeded':\n case 'completed':\n case 'requires_capture':\n case 'success':\n return 'completed';\n case 'cancelled':\n case 'canceled':\n return 'canceled';\n case 'failed':\n case 'error':\n default:\n return 'failed';\n }\n}\n\nexport function mapNativeResponseToPaymentResult(\n raw: string | NativeResponse\n): PaymentResult {\n const parsed = parseNativeResponse(raw);\n return {\n status: mapStatus(parsed.status),\n type: parsed.type ?? parsed.code ?? parsed.status ?? \"\",\n message: parsed.message ?? parsed.status ?? parsed.code ?? \"\",\n };\n}\n\nexport async function presentPaymentSheetWithPayload(\n payload: NativePaymentSheetPayload\n): Promise<PaymentResult> {\n if (isInitializing()) {\n return {\n status: 'failed',\n type: 'initialization_in_progress',\n message: 'SDK is reloading. Please wait for initialisation to complete before presenting the payment sheet.',\n };\n }\n if (isSheetPresented()) {\n // A sheet is already open (e.g. a hot-reload fired while the sheet was visible).\n // Silently skip so the existing sheet is not covered by a new one.\n return {\n status: 'canceled',\n type: 'sheet_already_presented',\n message: 'A payment sheet is already presented.',\n };\n }\n setSheetPresented(true);\n try {\n const raw = await NativeHyperswitchModule.presentPaymentSheet({\n hyperswitchConfig: payload.hyperswitchConfig,\n paymentSessionConfig: payload.paymentSessionConfig,\n configuration: payload.configuration,\n });\n return mapNativeResponseToPaymentResult(raw);\n } finally {\n setSheetPresented(false);\n }\n}\n\nexport async function updateIntent(\n _intentResolver: () => Promise<PaymentSessionConfiguration>\n): Promise<void> {\n}\n\nexport function createPaymentSession(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration\n): PaymentSession {\n return {\n async presentPaymentSheet(\n configuration?: Record<string, unknown>\n ): Promise<PaymentResult> {\n const payload = buildPresentPaymentSheetPayload(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n return presentPaymentSheetWithPayload(payload);\n },\n\n async getCustomerSavedPaymentMethods(\n configuration?: Record<string, unknown>\n ): Promise<CustomerSavedPaymentMethodsSession> {\n return getCustomerSavedPaymentMethods(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n },\n updateIntent,\n };\n}\n","import type {\n HyperswitchConfiguration,\n PaymentElementHandle,\n PaymentSessionConfiguration,\n} from '../types/definitions';\nimport { buildPresentPaymentSheetPayload } from '../utils/LaunchOptions';\nimport {\n presentPaymentSheetWithPayload,\n updateIntent,\n} from '../context/PaymentSession';\nimport type { PaymentResult } from '../types/paymentresult';\nimport type { CustomerSavedPaymentMethodsSession } from '../types/savedPaymentMethods';\n\nimport { getCustomerSavedPaymentMethods } from './SavedPaymentMethods';\nimport { Elements } from '../types/elements';\n\ntype ElementsNativeActions = Pick<\n Elements,\n | 'confirmPayment'\n | 'presentPaymentSheet'\n | 'getCustomerSavedPaymentMethods'\n | 'updateIntent'\n>;\n\nexport function createElementsNativeActions(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration\n): ElementsNativeActions {\n return {\n async presentPaymentSheet(\n configuration?: Record<string, unknown>\n ): Promise<PaymentResult> {\n const payload = buildPresentPaymentSheetPayload(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n return presentPaymentSheetWithPayload(payload);\n },\n\n async confirmPayment(\n paymentElementRef: { current: PaymentElementHandle | null } | string,\n _confirmOptions?: { confirmParams?: Record<string, any> }\n ): Promise<any> {\n // if (typeof paymentElementRef === 'string') {\n // const result = await widgetConfirm(paymentElementRef);\n // return {\n // type: mapStatus(result.status),\n // message: result.message,\n // };\n // }\n // const ref = paymentElementRef.current;\n // if (!ref) {\n // throw new Error('PaymentElement reference is not mounted');\n // }\n // return ref.confirmPayment(_confirmOptions);\n },\n\n async getCustomerSavedPaymentMethods(\n configuration?: Record<string, unknown>\n ): Promise<CustomerSavedPaymentMethodsSession> {\n return getCustomerSavedPaymentMethods(\n hyperswitchConfig,\n paymentSessionConfig,\n configuration\n );\n },\n\n updateIntent: updateIntent,\n };\n}\n\nexport function createElements(\n hyperswitchConfig: HyperswitchConfiguration,\n paymentSessionConfig: PaymentSessionConfiguration\n): Elements {\n return {\n ...createElementsNativeActions(hyperswitchConfig, paymentSessionConfig),\n };\n}\n","import type {\n HyperswitchConfiguration,\n PaymentSession,\n PaymentSessionConfiguration,\n HyperswitchSession\n} from './types/definitions';\n\nexport type * from './types/definitions';\nexport type * from './types/elements';\nexport type * from './types/NativeModuleTypes';\nexport type * from './types/PaymentSheetConfiguration'\n\nimport NativeHyperswitchModule from './specs/NativeHyperswitchModule';\nimport { createPaymentSession } from './context/PaymentSession';\nimport { Elements } from './types/elements';\nimport { createElements } from './context/Elements';\nimport { setInitializing } from './utils/InitializationState';\n\nexport function loadHyper(\n config: HyperswitchConfiguration\n): Promise<HyperswitchSession> {\n setInitializing(true);\n return NativeHyperswitchModule.initialise(\n config.publishableKey,\n config.platformPublishableKey ?? '',\n config.profileId ?? '',\n config.environment ?? 'PROD',\n config.customEndpoints ?? {}\n ).then(() => {\n setInitializing(false);\n return {\n publishableKey: config.publishableKey,\n async initPaymentSession(\n options: PaymentSessionConfiguration\n ): Promise<PaymentSession> {\n return createPaymentSession(config, options);\n },\n async elements(options: PaymentSessionConfiguration): Promise<Elements> {\n return createElements(config, options);\n },\n }\n }).catch((error) => {\n setInitializing(false);\n console.error('Error initializing Hyperswitch SDK:', error);\n throw error;\n });\n\n}\n\n\nexport const Hyperswitch = {\n init: loadHyper,\n};"],"names":["NativeHyperswitchModule","TurboModuleRegistry","get","NativeModules","buildPresentPaymentSheetPayload","hyperswitchConfig","paymentSessionConfig","configuration","platformPublishableKey","_platformPublishableKey","restConfig","parsePaymentMethod","raw","parsed","JSON","parse","billing","async","getCustomerSavedPaymentMethods","payload","getCustomerLastUsedPaymentMethodData","getCustomerDefaultSavedPaymentMethodData","getCustomerSavedPaymentMethodData","confirmWithCustomerLastUsedPaymentMethod","args","confirmWithCustomerDefaultPaymentMethod","console","log","_isInitializing","setInitializing","value","_isSheetPresented","setSheetPresented","mapStatus","status","mapNativeResponseToPaymentResult","message","String","parseNativeResponse","type","code","presentPaymentSheetWithPayload","presentPaymentSheet","updateIntent","_intentResolver","createElementsNativeActions","confirmPayment","paymentElementRef","_confirmOptions","loadHyper","config","initialise","publishableKey","profileId","environment","customEndpoints","then","initPaymentSession","options","catch","error","Hyperswitch","init"],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -36,6 +36,7 @@ export function mapStatus(status: string): PaymentResult['status'] {
|
|
|
36
36
|
switch (status) {
|
|
37
37
|
case 'succeeded':
|
|
38
38
|
case 'completed':
|
|
39
|
+
case 'requires_capture':
|
|
39
40
|
case 'success':
|
|
40
41
|
return 'completed';
|
|
41
42
|
case 'cancelled':
|
|
@@ -54,7 +55,7 @@ export function mapNativeResponseToPaymentResult(
|
|
|
54
55
|
const parsed = parseNativeResponse(raw);
|
|
55
56
|
return {
|
|
56
57
|
status: mapStatus(parsed.status),
|
|
57
|
-
type: parsed.type ?? parsed.
|
|
58
|
+
type: parsed.type ?? parsed.code ?? parsed.status ?? "",
|
|
58
59
|
message: parsed.message ?? parsed.status ?? parsed.code ?? "",
|
|
59
60
|
};
|
|
60
61
|
}
|
package/src/views/CVCElement.tsx
CHANGED
|
@@ -107,12 +107,12 @@ export const CVCElementView = forwardRef<unknown, CVCElementProps>(
|
|
|
107
107
|
<NativePaymentWidgetImpl
|
|
108
108
|
ref={viewRef}
|
|
109
109
|
widgetType="widgetPaymentSheet"
|
|
110
|
-
sdkAuthorization={paymentSessionConfig?.sdkAuthorization ?? ''}
|
|
110
|
+
// sdkAuthorization={paymentSessionConfig?.sdkAuthorization ?? ''}
|
|
111
111
|
onPaymentEvent={onPaymentEventInternal}
|
|
112
112
|
onPaymentResult={onPaymentResultInternal}
|
|
113
113
|
options={{
|
|
114
|
-
hyperswitchConfig,
|
|
115
|
-
paymentSessionConfig,
|
|
114
|
+
// hyperswitchConfig,
|
|
115
|
+
// paymentSessionConfig,
|
|
116
116
|
configuration: options,
|
|
117
117
|
}}
|
|
118
118
|
style={style}
|
|
@@ -174,13 +174,13 @@ export const PaymentElementView = forwardRef<
|
|
|
174
174
|
return (
|
|
175
175
|
<NativePaymentWidgetImpl
|
|
176
176
|
ref={viewRef}
|
|
177
|
-
sdkAuthorization={paymentSessionConfig?.sdkAuthorization ?? ''}
|
|
177
|
+
// sdkAuthorization={paymentSessionConfig?.sdkAuthorization ?? ''}
|
|
178
178
|
widgetType="widgetPaymentSheet"
|
|
179
179
|
onPaymentEvent={onPaymentEventInternal}
|
|
180
180
|
onPaymentResult={onPaymentResultInternal}
|
|
181
181
|
options={{
|
|
182
|
-
hyperswitchConfig,
|
|
183
|
-
paymentSessionConfig,
|
|
182
|
+
// hyperswitchConfig,
|
|
183
|
+
// paymentSessionConfig,
|
|
184
184
|
configuration: options,
|
|
185
185
|
}}
|
|
186
186
|
style={style}
|