{"version":3,"file":"PaymentMethods.js","names":["defineDs","m","Button","Api","LoginCache","MembershipPaymentCard","PaymentMethods","controller","args","userData","prop","getUserObj","customerInfo","initiatedDelete","initiatedChange","setInitiatedDelete","id","setInitiatedChange","resetInitation","addPaymentMethod","data","first_name","firstName","last_name","lastName","accept_url","window","location","href","cancel_url","then","response","url","deletePaymentMethod","fetchData","catch","changePaymentMethod","payment_method_id","subscriptionData","handle","view","ctrl","_ref","_paymentCardsData","_paymentCardsData2","_paymentCardsData$oth","_paymentCardsData$oth2","isLoading","paymentCardsData","goBack","className","xmlns","fill","viewBox","cx","cy","r","stroke","d","active","length","map","_data$card","_data$card2","classNames","icon","card","types","cardNumber","masked_card","other","_data$card3","_data$card4","alternative","concat","variant","onClick"],"sources":["DanskeSpil/Domain/Feature.LoyaltyClub/Components/MembershipFlow/PaymentMethods.js"],"sourcesContent":["/* eslint-disable camelcase */\r\ndefineDs('DanskeSpil/Domain/Feature.LoyaltyClub/Components/MembershipFlow/PaymentMethods', [\r\n 'Shared/Framework/Mithril/Scripts/Core/Mithril',\r\n 'DanskeSpil/Domain/Feature.LoyaltyClub/Components/Button/Button',\r\n 'DanskeSpil/Domain/Feature.LoyaltyClub/Helpers/Api',\r\n 'DanskeSpil/Domain/Authentification/Scripts/LoginCache',\r\n 'DanskeSpil/Domain/Feature.LoyaltyClub/Components/MembershipPaymentCard/MembershipPaymentCard',\r\n],\r\nfunction (m, Button, Api, LoginCache, MembershipPaymentCard) {\r\n const PaymentMethods = {\r\n controller: function (args) {\r\n const userData = m.prop(LoginCache.getUserObj().customerInfo);\r\n const initiatedDelete = m.prop(false);\r\n const initiatedChange = m.prop(false);\r\n\r\n const setInitiatedDelete = (id) => {\r\n initiatedChange(false);\r\n initiatedDelete(id);\r\n };\r\n\r\n const setInitiatedChange = (id) => {\r\n initiatedDelete(false);\r\n initiatedChange(id);\r\n };\r\n\r\n const resetInitation = () => {\r\n initiatedDelete(false);\r\n initiatedChange(false);\r\n };\r\n\r\n const addPaymentMethod = () => {\r\n const data = {\r\n first_name: userData().firstName,\r\n last_name: userData().lastName,\r\n accept_url: window.location.href,\r\n cancel_url: window.location.href,\r\n };\r\n Api.addPaymentMethod(data)\r\n .then((response) => {\r\n window.location.href = response.url;\r\n });\r\n };\r\n\r\n const deletePaymentMethod = (id) => {\r\n Api.deletePaymentMethod(id)\r\n .then(() => {\r\n resetInitation();\r\n args.fetchData();\r\n }).catch(() => {\r\n resetInitation();\r\n });\r\n };\r\n\r\n const changePaymentMethod = (id) => {\r\n const data = {\r\n payment_method_id: id\r\n };\r\n Api.changePaymentMethod(args.subscriptionData().handle, data)\r\n .then(() => {\r\n resetInitation();\r\n args.fetchData();\r\n }).catch(() => {\r\n resetInitation();\r\n });\r\n };\r\n\r\n return { addPaymentMethod, deletePaymentMethod, changePaymentMethod, initiatedDelete, initiatedChange, resetInitation, setInitiatedDelete, setInitiatedChange };\r\n },\r\n view: function (ctrl, { isLoading, paymentCardsData, goBack }) {\r\n if (isLoading()) {\r\n return (\r\n
\r\n \r\n \r\n \r\n \r\n
\r\n );\r\n }\r\n return (\r\n
\r\n
\r\n

Valgt betalingsmetode

\r\n { paymentCardsData()?.active?.length > 0 ?\r\n paymentCardsData()?.active?.map((data) =>\r\n \r\n )\r\n :

Ingen valgt betalingsmetode

}\r\n
\r\n
\r\n

Andre betalingsmetoder

\r\n { paymentCardsData().other?.length > 0 ?\r\n paymentCardsData().other?.map((data) =>\r\n \r\n { ctrl.initiatedChange() === data.id || ctrl.initiatedDelete() === data.id ?\r\n
\r\n ctrl.resetInitation() }>\r\n Fortryd\r\n \r\n
\r\n ctrl.changePaymentMethod(data.id) : () => ctrl.deletePaymentMethod(data.id) }>\r\n { ctrl.initiatedDelete() ? 'Slet kort' : 'Vælg kort' }\r\n \r\n
:\r\n
\r\n ctrl.setInitiatedDelete(data.id) }>\r\n Slet\r\n \r\n
\r\n ctrl.setInitiatedChange(data.id) }>\r\n Vælg\r\n \r\n
\r\n }\r\n \r\n ) :

Ingen andre betalingsmetoder

}\r\n
\r\n ctrl.addPaymentMethod() }>\r\n Tilføj betalingsmetode\r\n \r\n goBack() }>\r\n Tilbage\r\n \r\n
\r\n );\r\n }\r\n };\r\n return PaymentMethods;\r\n});\r\n"],"mappings":"AAAA;AACAA,QAAQ,CAAC,gFAAgF,EAAE,CACzF,+CAA+C,EAC/C,gEAAgE,EAChE,mDAAmD,EACnD,uDAAuD,EACvD,8FAA8F,CAC/F,EACD,UAAUC,CAAC,EAAEC,MAAM,EAAEC,GAAG,EAAEC,UAAU,EAAEC,qBAAqB,EAAE;EAC3D,IAAMC,cAAc,GAAG;IACrBC,UAAU,EAAE,SAAAA,CAAUC,IAAI,EAAE;MAC1B,IAAMC,QAAQ,GAAGR,CAAC,CAACS,IAAI,CAACN,UAAU,CAACO,UAAU,CAAC,CAAC,CAACC,YAAY,CAAC;MAC7D,IAAMC,eAAe,GAAGZ,CAAC,CAACS,IAAI,CAAC,KAAK,CAAC;MACrC,IAAMI,eAAe,GAAGb,CAAC,CAACS,IAAI,CAAC,KAAK,CAAC;MAErC,IAAMK,kBAAkB,GAAIC,EAAE,IAAK;QACjCF,eAAe,CAAC,KAAK,CAAC;QACtBD,eAAe,CAACG,EAAE,CAAC;MACrB,CAAC;MAED,IAAMC,kBAAkB,GAAID,EAAE,IAAK;QACjCH,eAAe,CAAC,KAAK,CAAC;QACtBC,eAAe,CAACE,EAAE,CAAC;MACrB,CAAC;MAED,IAAME,cAAc,GAAGA,CAAA,KAAM;QAC3BL,eAAe,CAAC,KAAK,CAAC;QACtBC,eAAe,CAAC,KAAK,CAAC;MACxB,CAAC;MAED,IAAMK,gBAAgB,GAAGA,CAAA,KAAM;QAC7B,IAAMC,IAAI,GAAG;UACXC,UAAU,EAAEZ,QAAQ,CAAC,CAAC,CAACa,SAAS;UAChCC,SAAS,EAAEd,QAAQ,CAAC,CAAC,CAACe,QAAQ;UAC9BC,UAAU,EAAEC,MAAM,CAACC,QAAQ,CAACC,IAAI;UAChCC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