1import { a as G, d as U, u as L, j as e, aA as q, aB as Z, f as J, p as P, aC as Q, aD as ee, x as v, P as T, n as K, z as ce, c as de, b as le, R as pe, o as ue, e as me, v as W } from "./index.umd-D8l6E7SS.js"; 2import { useState as y, useRef as te, useEffect as j } from "react"; 3import { M as fe } from "./MethodContainer-mWMa6Bl_.js"; 4import { c as Ce, P as Ie } from "./PmaSelector-DEuwhwKU.js"; 5import { L as he } from "./LoadingSpinner-V9gC4jEe.js"; 6import { c as se, S as O, P as Ee, A as _e } from "./FormElements-yj35iE4p.js"; 7import { M as ge } from "./MethodImportantInfo-CzsKfYfu.js"; 8import b from "styled-components"; 9import { g as Y } from "./providers-8129QDEn.js"; 10import { useIntl as re, FormattedMessage as S } from "react-intl"; 11import { A as xe } from "./AmountArea-D1E1tkly.js"; 12import { A as Ae } from "./AmountTaxFields-CYSNjiEk.js"; 13import { P as De } from "./PaymentButton-BUVQU21p.js"; 14import { B as Re } from "./BonusArea-A7jWBL8n.js"; 15import { theme as k } from "ui-component-library"; 16import { B as Se } from "./BaseButton-C3Vx9qLH.js"; 17const M = b.div` 18 display: flex; 19 20 & div:first-child{ 21 width: 100% !important; 22 } 23`, ne = b.div` 24 display: flex; 25 justify-content: flex-start; 26 gap: 10px; 27`, oe = b(M)` 28 flex: 1; 29`, ie = { 30 body: { 31 padding: 0 32 }, 33 container: { 34 display: "flex", 35 width: "100%" 36 }, 37 invalid: { 38 border: `1px solid ${k.colors.error[400]}` 39 }, 40 focus: { 41 border: "1px solid #0077ff", 42 outline: "none" 43 }, 44 input: { 45 width: "100%", 46 height: "35px", 47 border: `1px solid ${k.colors.neutral[300]}`, 48 borderRadius: "5px", 49 paddingLeft: "10px" 50 } 51}, Ke = b.div(["width:235px;margin:auto;margin-bottom:16px;"]), { 52 CVV_ID: N 53} = q, { 54 CVV: Pe 55} = Z, X = "sandbox3DSModalOverrideStyle", z = (t) => { 56 if (t.querySelector(`#${X}`)) 57 return; 58 const s = document.createElement("style"); 59 s.id = X, s.textContent = ` 60 #sandbox3DSModal .ksh .modal { 61 z-index: 10000; 62 } 63 #sandbox3DSModal .ksh .modal .overlay { 64 background: transparent; 65 } 66 `, t.appendChild(s); 67}, Te = () => { 68 const t = document.getElementById("sandbox3DSModal"); 69 if (t) 70 return z(t), () => { 71 }; 72 const s = new MutationObserver(() => { 73 const r = document.getElementById("sandbox3DSModal"); 74 r && (z(r), s.disconnect()); 75 }); 76 return s.observe(document.body, { 77 childList: !0, 78 subtree: !0 79 }), () => s.disconnect(); 80}, ye = (t) => ({ 81 styles: ie, 82 fields: { 83 cvv: { 84 selector: N, 85 fieldType: Pe, 86 placeholder: t.formatMessage({ 87 id: "INPUT_PLACEHOLDER_CVV" 88 }) 89 } 90 } 91}); 92function be({ 93 method: t, 94 txType: s, 95 iKushki: r, 96 setShowSpinner: u, 97 setErrorLoading: c, 98 currency: n 99}) { 100 const i = "[KUSHKI-HF-DEPOSIT]", { 101 logger: a 102 } = G(), I = U(), g = re(), [D, x] = y(null), R = te(!1), h = L((o) => o.paymentAccounts.selectedPaymentAccount), m = Ce(t, s, h), f = L((o) => o.paymentAccounts.selectedPaymentAccount?.formData?.subscriptionId), d = L((o) => o.paymentAccounts.selectedPaymentAccount?.pmCode); 103 j(() => { 104 let o = !0; 105 return x(null), u(!0), r && (f ? (async () => { 106 try { 107 const l = ye(g), C = await window.initSecureDeviceToken(r, l); 108 x(C), u(!1); 109 } catch (l) { 110 if (o) { 111 const { 112 code: C, 113 message: A 114 } = l; 115 !C && l instanceof TypeError ? a.warn(`${i} â TypeError building Card Instance: ${l.stack}`) : a.error(`${i} Error building Card Instance: ${C} - ${A}`), c(!0); 116 } 117 } 118 })() : (a.error(`${i} Error fetching pma info for deposit CardInstance`), c(!0))), () => { 119 o = !1; 120 }; 121 }, [r, f, g, c, u, a]); 122 const p = async (o) => { 123 R.current = !0; 124 const _ = Te(); 125 I(J()), I(P(!0, "LOADER_KUSHKI")); 126 let l; 127 try { 128 const C = { 129 subscriptionId: f, 130 currency: n, 131 amount: { 132 subtotalIva: 0, 133 subtotalIva0: o, 134 iva: 0 135 } 136 }; 137 l = await D?.requestDeviceToken(C); 138 } catch (C) { 139 const { 140 code: A, 141 message: H 142 } = C, $ = Q(A), ae = !!R.current && A === ee.E002; 143 $ || ae ? a.warn(`${i} Warning in Deposit: ${A} - ${H}`) : a.error(`${i} Error in Deposit: ${A} - ${H}`), I(P(!1)), I(v({ 144 contentKey: "DEPOSIT_ERROR_KUSHKI_FORM_VALIDATION", 145 titleKey: "TITLE_DEPOSIT_ERROR", 146 pmCode: K.CC, 147 pspCode: T.KUSHKI 148 })); 149 } finally { 150 R.current = !1, _(); 151 } 152 if (l) { 153 const C = { 154 pm: d ?? K.CC, 155 psp: T.KUSHKI, 156 amount: o, 157 formData: { 158 deviceToken: l.token 159 } 160 }; 161 I(ce(C)); 162 } 163 }, E = D !== null; 164 return /* @__PURE__ */ e.jsxs(se, { children: [
165 /* @__PURE__ */ e.jsx(Ke, { children: /* @__PURE__ */ e.jsxs("div", { children: [ 166 E && /* @__PURE__ */ e.jsx(O, { margin: "0", children: /* @__PURE__ */ e.jsx(S, { id: "INPUT_LABEL_CVV" }) }), 167 /* @__PURE__ */ e.jsxs(ne, { children: [ 168 /* @__PURE__ */ e.jsx(oe, { id: N, "data-testid": N }), 169 E && /* @__PURE__ */ e.jsx("img", { src: "https://micro-frontends.rushstreetcontent.com/rsi-cashier/1.686.0/img/blue_cc.svg", alt: "credit card icon" }) 170 ] }) 171 ] }) }), 172 E && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [ 173 /* @__PURE__ */ e.jsx(xe, { method: t, txType: s }), 174 /* @__PURE__ */ e.jsx(Re, { method: t }), 175 /* @__PURE__ */ e.jsx(Ae, { txType: s }), 176 m && /* @__PURE__ */ e.jsx(Ee, { children: /* @__PURE__ */ e.jsx(S, { id: "PMA_DISABLED_ERROR_MESSAGE" }) }), 177 /* @__PURE__ */ e.jsx(De, { txType: s, pmCode: t.pmCode, onClick: p, disabled: m }) 178 ] }) 179 ] }); 180} 181const Oe = b.div(["margin-bottom:16px;display:grid;grid-template-columns:1fr;@media(min-width:", "px){grid-template-columns:repeat(2,1fr);column-gap:10px;& > :nth-last-child(n+3){grid-column:span 2;}}"], le["screen-xs"]), { 182 CARD_HOLDER_NAME_ID: V, 183 CARD_NUMBER_ID: w, 184 EXPIRATION_DATE_ID: F, 185 CVV_ID: B 186} = q, { 187 CARDHOLDER_NAME: je, 188 CARD_NUMER: He, 189 EXPIRATION_DATE: Le, 190 CVV: Me 191} = Z, ve = (t, s, r) => ({ 192 isSubscription: !0, 193 fullResponse: !0, 194 currency: s, 195 styles: ie, 196 fields: { 197 cardholderName: { 198 selector: V, 199 fieldType: je, 200 placeholder: t.formatMessage({ 201 id: "INPUT_PLACEHOLDER_CARDHOLDER_NAME" 202 }) 203 }, 204 cardNumber: { 205 selector: w, 206 fieldType: He, 207 placeholder: t.formatMessage({ 208 id: "INPUT_PLACEHOLDER_CARD_NUMBER" 209 }) 210 }, 211 expirationDate: { 212 selector: F, 213 fieldType: Le, 214 placeholder: t.formatMessage({ 215 id: "INPUT_PLACEHOLDER_EXPIRY_DATE" 216 }) 217 }, 218 ...r && { 219 cvv: { 220 selector: B, 221 fieldType: Me, 222 placeholder: t.formatMessage({ 223 id: "INPUT_PLACEHOLDER_CVV" 224 }) 225 } 226 } 227 } 228}); 229function Ue({ 230 iKushki: t, 231 setShowSpinner: s, 232 setErrorLoading: r, 233 requireCvv: u, 234 currency: c 235}) { 236 const n = "[KUSHKI-HF-REGISTER-PMA]", { 237 logger: i 238 } = G(), a = U(), I = re(), [g, D] = y(null), x = te(!1); 239 j(() => { 240 let m = !0; 241 return D(null), s(!0), t && c && (u === void 0 ? (i.error(`${n} Error fetching cms/bo configs for registration CardInstance`), r(!0)) : (async () => { 242 try { 243 const d = ve(I, c, u), p = await window.initCardToken(t, d); 244 D(p), s(!1); 245 } catch (d) { 246 if (m) { 247 const { 248 code: p, 249 message: E 250 } = d; 251 i.error(`${n} Error building Card Instance: ${p} - ${E}`), r(!0); 252 } 253 } 254 })()), () => { 255 m = !1; 256 }; 257 }, [t, c, u, I, s, r, i]); 258 const R = async () => { 259 x.current = !0, a(J()), a(P(!0, "LOADER_KUSHKI")); 260 let m; 261 try { 262 m = await g?.requestToken(); 263 } catch (f) { 264 const { 265 code: d, 266 message: p 267 } = f, E = Q(d), o = !!x.current && d === ee.E002; 268 E || o ? i.warn(`${n} Warning in RegisterPma: ${d} - ${p}`) : i.error(`${n} Error in RegisterPma: ${d} - ${p}`), a(P(!1)), a(v({ 269 contentKey: "DEPOSIT_ERROR_KUSHKI_FORM_VALIDATION", 270 titleKey: "TITLE_DEPOSIT_ERROR", 271 pmCode: K.CC, 272 pspCode: T.KUSHKI 273 })); 274 } finally { 275 x.current = !1; 276 } 277 if (m) { 278 const f = m.cardInfo?.brand?.toUpperCase(); 279 if ([K.VISA, K.MASTERCARD].includes(f)) { 280 const { 281 token: d, 282 cardInfo: p 283 } = m, { 284 expirationDate: E, 285 bin: o, 286 lastFourDigits: _ 287 } = p, [l, C] = E.split("/"), A = { 288 token: d, 289 expireMonth: l, 290 expireYear: `20${C}`, 291 bin: o, 292 lastFour: _, 293 cardType: f 294 }, H = { 295 pmCode: f, 296 pspCode: T.KUSHKI, 297 registerTrigger: pe.DEPOSIT_PAGE, 298 formData: A 299 }; 300 try { 301 await a(ue(H)), a(P(!1)); 302 } catch ($) { 303 i.warn(`${n} Error registering Kushki card`, $); 304 } 305 } else 306 i.error(`${n} Error: Card type not supported.`), a(P(!1)), a(v({ 307 contentKey: "KUSHKI_TOKENIZATION_ERROR_CARD_TYPE", 308 titleKey: "TITLE_ERROR_LOADING_KUSHKI_HF", 309 pmCode: K.CC, 310 pspCode: T.KUSHKI 311 })); 312 } 313 }, h = g !== null; 314 return /* @__PURE__ */ e.jsxs(se, { children: [
315 /* @__PURE__ */ e.jsxs(Oe, { children: [ 316 /* @__PURE__ */ e.jsxs("div", { children: [ 317 h && /* @__PURE__ */ e.jsx(O, { margin: "0", children: /* @__PURE__ */ e.jsx(S, { id: "INPUT_LABEL_CARDHOLDER_NAME" }) }), 318 /* @__PURE__ */ e.jsx(M, { id: V, "data-testid": V }) 319 ] }), 320 /* @__PURE__ */ e.jsxs("div", { children: [ 321 h && /* @__PURE__ */ e.jsx(O, { margin: "0", children: /* @__PURE__ */ e.jsx(S, { id: "INPUT_LABEL_CARD_NUMBER" }) }), 322 /* @__PURE__ */ e.jsx(M, { id: w, "data-testid": w }) 323 ] }), 324 /* @__PURE__ */ e.jsxs("div", { children: [ 325 h && /* @__PURE__ */ e.jsx(O, { margin: "0", children: /* @__PURE__ */ e.jsx(S, { id: "INPUT_LABEL_EXPIRY_DATE" }) }), 326 /* @__PURE__ */ e.jsx(M, { id: F, "data-testid": F }) 327 ] }), 328 u && /* @__PURE__ */ e.jsxs("div", { children: [ 329 h && /* @__PURE__ */ e.jsx(O, { margin: "0", children: /* @__PURE__ */ e.jsx(S, { id: "INPUT_LABEL_CVV" }) }), 330 /* @__PURE__ */ e.jsxs(ne, { children: [
331 /* @__PURE__ */ e.jsx(oe, { id: B, "data-testid": B }), 332 h && /* @__PURE__ */ e.jsx("img", { src: "https://micro-frontends.rushstreetcontent.com/rsi-cashier/1.686.0/img/blue_cc.svg", alt: "credit card icon" }) 333 ] }) 334 ] }) 335 ] }), 336 h && /* @__PURE__ */ e.jsx(Se, { color: k.colors.neutral[50], fontSize: "16px", shadow: `0px 2px 5px 0px ${de.shadow}`, width: "100%", "data-testid": "kushki-register-card-button", onClick: R, children: /* @__PURE__ */ e.jsx(S, { id: "BUTTON_REGISTER_CARD" }) }) 337 ] }); 338} 339const $e = b.div(["min-height:205px;"]); 340function ke({ 341 method: t, 342 txType: s, 343 setErrorLoading: r, 344 setShowSpinner: u 345}) { 346 const c = "[KUSHKI-HF]", { 347 logger: n 348 } = G(), i = U(), [a, I] = y(!1), [g, D] = y(null), x = L((o) => !!o.paymentAccounts.selectedPaymentAccount), { 349 cageInfo: R 350 } = me(), h = R?.currency || "", { 351 v2ScriptPath: m, 352 cardScriptUrl: f, 353 merchantId: d, 354 testMode: p 355 } = t.pspCmsConf || { 356 v2ScriptPath: "", 357 cardScriptUrl: "", 358 merchantId: "", 359 testMode: !1 360 }, { 361 requireCvvPmaHostedFields: E 362 } = t.pspApiConf; 363 return j(() => { 364 t.pspCmsConf || n.warn(`${c} Missing Kushki configuration`), m && f ? (async () => { 365 try { 366 await Promise.all([i(Y(m, W.KUSHKI_V2)), i(Y(f, W.KUSHKI_CARD))]), I(!0); 367 } catch (_) { 368 const l = _; 369 n.error(`${c} Error fetching kushki scripts`, l.target?.src), I(!1), r(!0); 370 } 371 })() : (n.error(`${c} Error fetching scripts URLs from cms`), r(!0)); 372 }, []), j(() => { 373 a && (d && p !== void 0 ? (async () => { 374 try { 375 const _ = { 376 publicCredentialId: d, 377 inTest: p 378 }, l = await window.init(_); 379 D(l); 380 } catch (_) { 381 n.error(`${c} Error building KushkiInstance: ${_}`), r(!0); 382 } 383 })() : (n.error(`${c} Error fetching cms configs for KushkiInstance`), r(!0))); 384 }, [a, d, p, r, n]), /* @__PURE__ */ e.jsx($e, { "data-testid": "kushki-hf-container", children: g !== null && (x ? /* @__PURE__ */ e.jsx(be, { method: t, txType: s, iKushki: g, setShowSpinner: u, setErrorLoading: r, currency: h }) : /* @__PURE__ */ e.jsx(Ue, { iKushki: g, setShowSpinner: u, setErrorLoading: r, requireCvv: E, currency: h })) }); 385} 386function st({ 387 method: t, 388 txType: s 389}) { 390 const r = U(), [u, c] = y(!0), [n, i] = y(!1); 391 return j(() => { 392 n && (c(!1), r(v({ 393 titleKey: "TITLE_ERROR_LOADING_KUSHKI_HF", 394 contentKey: "ERROR_LOADING_KUSHKI_HF", 395 pmCode: K.CC, 396 pspCode: T.KUSHKI 397 }))); 398 }, [n, r]), n ? null : /* @__PURE__ */ e.jsxs(fe, { children: [ 399 /* @__PURE__ */ e.jsx(ge, { pmCode: t.pmCode, txType: s }), 400 /* @__PURE__ */ e.jsx(Ie, { method: t, txType: s }), 401 u && /* @__PURE__ */ e.jsx(he, {}), 402 /* @__PURE__ */ e.jsx(_e, { titleKey: "KUSHKI_CC_DEPOSIT_ACCOUNT_HOLDER_TITLE", messageKey: "KUSHKI_CC_DEPOSIT_ACCOUNT_HOLDER_MESSAGE", boldName: !0, classicLabel: !0 }), 403 /* @__PURE__ */ e.jsx(ke, { method: t, txType: s, setErrorLoading: i, setShowSpinner: c }) 404 ] }); 405} 406export { 407 st as default 408};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.