1import { theme as R, InlineNotificationVariant as u } from "ui-component-library"; 2import { C as I, v as c, n as l, j as P } from "./index.umd-D8l6E7SS.js"; 3import { g as E } from "./providers-8129QDEn.js"; 4import { FormattedMessage as D } from "react-intl"; 5import { A as f } from "./Alert-Bcm6CAd4.js"; 6import { H as S } from "./HtmlRenderer-B2w6Rxq0.js"; 7import "react-redux"; 8import "react"; 9import { u as d } from "./useFormatMessageAsString-D5YRNJ3T.js"; 10import { B as N } from "./BaseButton-C3Vx9qLH.js"; 11import { e as L } from "./commonStyles-CrYujrG0.js"; 12var _ = /* @__PURE__ */ ((e) => (e.GET_BRAINTREE_TOKEN_REQUEST = "braintree/GET_BRAINTREE_TOKEN_REQUEST", e.GET_BRAINTREE_TOKEN_SUCCESS = "braintree/GET_BRAINTREE_TOKEN_SUCCESS", e.GET_BRAINTREE_TOKEN_FAILURE = "braintree/GET_BRAINTREE_TOKEN_FAILURE", e.DEFAULT = "braintree/DEFAULT", e))(_ || {}); 13const W = (e) => async (t) => I(t, { 14 type: _.GET_BRAINTREE_TOKEN_REQUEST, 15 useApi: (i) => i.get("/service/payment/braintree/token", { 16 params: { 17 paymentOption: e 18 } 19 }) 20}), Z = (e) => async (t, i, { 21 logger: a 22}) => { 23 try { 24 return await t(E(e.pspCmsConf?.scriptUrlClient || "", c.BRAINTREE_CLIENT, l.PAYPAL)), await t(E(e.pspCmsConf?.scriptUrlPaypal || "", c.PAYPAL, l.PAYPAL)), await t(E(e.pspCmsConf?.scriptUrlCollector || "", c.BRAINTREE_COLLECTOR, l.PAYPAL)), !0; 25 } catch (r) { 26 return a.warn("[Braintree][PayPal] Get scripts error", r), !1; 27 } 28}, q = (e) => async (t, i, { 29 logger: a 30}) => { 31 try { 32 return await t(E(e.pspCmsConf?.scriptUrlClient || "", c.BRAINTREE_CLIENT, l.CC)), await t(E(e.pspCmsConf?.scriptUrlFields || "", c.BRAINTREE_FIELDS, l.CC)), await t(E(e.pspCmsConf?.scriptUrlCollector || "", c.BRAINTREE_COLLECTOR, l.CC)), !0; 33 } catch (r) { 34 return a.warn("[Braintree][CC] Get scripts error", r), !1; 35 } 36}, ee = (e) => async (t, i, { 37 logger: a 38}) => { 39 try { 40 return await t(E(e.pspCmsConf?.scriptUrlClient || "", c.BRAINTREE_CLIENT, l.VENMO)), await t(E(e.pspCmsConf?.scriptUrlVenmo || "", c.BRAINTREE_VENMO, l.VENMO)), await t(E(e.pspCmsConf?.scriptUrlCollector || "", c.BRAINTREE_COLLECTOR, l.VENMO)), !0; 41 } catch (r) { 42 return a.warn("[Braintree][Venmo] Get scripts error", r), !1; 43 } 44}, te = (e) => async (t, i, { 45 logger: a 46}) => { 47 try { 48 return await t(E(e.pspCmsConf?.scriptUrlClient || "", c.BRAINTREE_CLIENT, l.APPLE_PAY)), await t(E(e.pspCmsConf?.scriptUrlApplePay || "", c.BRAINTREE_APPLE_PAY, l.APPLE_PAY)), await t(E(e.pspCmsConf?.scriptUrlCollector || "", c.BRAINTREE_COLLECTOR, l.APPLE_PAY)), !0; 49 } catch (r) { 50 return a.warn("[Braintree][ApplePay] Get scripts error", r), !1; 51 } 52}, A = (e) => (t, i, { 53 logger: a 54}) => new Promise((r, s) => { 55 window.braintree.client.create({ 56 authorization: e 57 }, (n, o) => { 58 n && (a.warn("[Braintree] Failed to initialise Braintree client", n), s(n)), r(o); 59 }); 60}), ae = (e) => (t, i, { 61 logger: a 62}) => new Promise((r, s) => { 63 e.tokenize((n, o) => { 64 n ? (a.warn("[Braintree][CC] Failed to tokenize Braintree CC", n), s(n)) : o.nonce && o.details?.cardType && r(o); 65 }); 66}), re = (e) => () => new Promise((t, i) => { 67 e.tokenize((a, r) => { 68 a ? i(a) : r.nonce && r.details && t(r); 69 }); 70}), B = (e, t) => (i, a, { 71 logger: r 72}) => new Promise((s, n) => { 73 window.braintree.hostedFields.create({ 74 client: e, 75 fields: t, 76 styles: { 77 input: { 78 "font-size": "14px" 79 }, 80 "input.invalid": { 81 color: R.colors.error[300] 82 }, 83 "input.valid": { 84 color: R.colors.success[400] 85 } 86 } 87 }, (o, p) => { 88 o && (r.warn("[Braintree][CC] Failed to initialise Braintree hosted fields", o), n(o)), s(p); 89 }); 90}), v = (e) => (t, i, { 91 logger: a 92}) => new Promise((r, s) => { 93 window.braintree.venmo.create(e, (n, o) => { 94 n && (a.warn("[Braintree][Venmo] Failed to initialise Braintree Venmo", n), s(n)), r(o); 95 }); 96}), y = (e) => (t, i, { 97 logger: a 98}) => new Promise((r, s) => { 99 window.braintree.applePay.create({ 100 client: e 101 }, (n, o) => { 102 n && (a.warn("[Braintree][ApplePay] Failed to initialise Braintree ApplePay", n), s(n)), r(o); 103 }); 104}), O = (e, t) => new Promise((i, a) => { 105 window.braintree.dataCollector.create({ 106 client: e 107 }, (r, s) => { 108 if (r) { 109 t.warn("[Braintree] Failed to initialise Braintree dataCollector", r), a(r); 110 return; 111 } 112 if (!s) { 113 t.warn("[Braintree] No DataCollector instance returned for deviceData", s), a(new Error("DataCollector missing instance")); 114 return; 115 } 116 const { 117 deviceData: n 118 } = s; 119 if (!n) { 120 t.warn("[Braintree] DataCollector missing deviceData:", n), window.setTimeout(() => { 121 t.warn("[Braintree] DataCollector instance deviceData after timeout", s.deviceData); 122 }, 3e3), a(new Error("DataCollector missing deviceData")); 123 return; 124 } 125 t.info("[Braintree] dataCollector deviceData received", n), i(n); 126 }); 127}), m = (e) => (t, i, { 128 logger: a 129}) => I(t, { 130 type: _.DEFAULT, 131 useApi: async () => ({ 132 data: await O(e, a) 133 }) 134}), F = (e, t, i) => { 135 const a = t; 136 return a.client = e, i.profileId && (a.profileId = i.profileId), a; 137}, V = async (e, t) => { 138 const i = await window.braintree.paypalCheckout.create({ 139 client: e 140 }); 141 return new Promise((a, r) => { 142 i.loadPayPalSDK({ 143 vault: !0, 144 dataAttributes: { 145 "csp-nonce": window.rsiScriptNonce 146 } 147 }, (s, n) => { 148 if (s) { 149 t.warn("[Braintree] Failed to initialise Braintree PayPal", s), r(s); 150 return; 151 } 152 a(n); 153 }); 154 }); 155}, g = (e) => (t, i, { 156 logger: a 157}) => I(t, { 158 type: _.DEFAULT, 159 useApi: async () => ({ 160 data: await V(e, a) 161 }) 162}), U = (e, t, i) => { 163 const a = { 164 cvv: { 165 container: `#pm-input-BRAINTREE-CVV-${i}`, 166 placeholder: t.formatMessage({ 167 id: "INPUT_PLACEHOLDER_CVV" 168 }) 169 } 170 }; 171 return e || (a.number = { 172 container: `#pm-input-BRAINTREE-CCNUM-${i}`, 173 placeholder: "XXXX XXXX XXXX XXXX" 174 }, a.expirationDate = { 175 container: `#pm-input-BRAINTREE-EXPIRY-${i}`, 176 placeholder: t.formatMessage({ 177 id: "INPUT_PLACEHOLDER_EXPIRY_DATE" 178 }) 179 }), a; 180}, ie = (e, t) => async (i, a, { 181 logger: r 182}) => { 183 try { 184 const s = await i(A(e.token)), n = i(m(s)), o = t ? i(g(s)) : Promise.resolve(void 0), [p, C] = await Promise.all([n, o]); 185 return { 186 deviceData: p, 187 paypalInstance: C 188 }; 189 } catch (s) { 190 throw r.warn("[PayPal] Setup failed", s), s; 191 } 192}, ne = (e, t, i, a) => async (r, s, { 193 logger: n 194}) => { 195 try { 196 const o = await r(A(e.token)), p = r(B(o, U(t, i, a))), C = r(m(o)), [w, T] = await Promise.all([p, C]); 197 return { 198 deviceData: T, 199 hostedFieldsInstance: w 200 }; 201 } catch (o) { 202 throw n.warn("[Braintree][CC] Setup hosted fields failed", o), o; 203 } 204}, se = (e, t, i) => async (a, r, { 205 logger: s 206}) => { 207 try { 208 const n = await a(A(e.token)), o = t ? a(v(F(n, i, e))) : Promise.resolve(void 0), p = a(m(n)), [C, w] = await Promise.all([o, p]); 209 return { 210 deviceData: w, 211 venmoInstance: C 212 }; 213 } catch (n) { 214 throw s.warn("[Venmo] Setup failed", n), n; 215 } 216}, oe = (e) => async (t, i, { 217 logger: a 218}) => { 219 try { 220 const r = await t(A(e.token)), s = t(y(r)), n = t(m(r)), [o, p] = await Promise.all([s, n]); 221 return { 222 deviceData: p, 223 applePayInstance: o 224 }; 225 } catch (r) { 226 throw a.warn("[ApplePay] Setup failed", r), r; 227 } 228}; 229var X = /* @__PURE__ */ ((e) => (e.CC = "CREDIT_CARD", e.PAYPAL = "PAYPAL", e.VENMO = "VENMO", e.APPLE_PAY = "APPLE_PAY", e))(X || {}), Y = /* @__PURE__ */ ((e) => (e.HOSTED_FIELDS_FIELDS_EMPTY = "HOSTED_FIELDS_FIELDS_EMPTY", e.HOSTED_FIELDS_FIELDS_INVALID = "HOSTED_FIELDS_FIELDS_INVALID", e))(Y || {}), b = /* @__PURE__ */ ((e) => (e.AM_EXPRESS = "American Express", e.DISCOVER = "Discover", e.MASTERCARD = "MasterCard", e.VISA = "Visa", e))(b || {}), M = /* @__PURE__ */ ((e) => (e.PREPAID = "PREPAID", e.CREDIT = "CREDIT", e.DEBIT = "DEBIT", e))(M || {}); 230function ce({ 231 title: e = void 0, 232 content: t = void 0, 233 retryCallback: i 234}) { 235 const a = d(); 236 return /* @__PURE__ */ P.jsxs(f, { type: u.Error, titleKey: e || "TITLE_BRAINTREE_ERROR", children: [
237 /* @__PURE__ */ P.jsx("p", { children: /* @__PURE__ */ P.jsx(S, { content: a({ 238 id: t || "CASHIER_ERROR_PROVIDER_BRAINTREE" 239 }) }) }), 240 /* @__PURE__ */ P.jsx(L, { children: /* @__PURE__ */ P.jsx(N, { onClick: i, small: !0, backgroundColor: R.colors.primary[100], color: R.colors.info[350], children: /* @__PURE__ */ P.jsx(D, { id: "BRAINTREE_ALERT_BTN_RETRY" }) }) }) 241 ] }); 242} 243export { 244 X as B, 245 Z as a, 246 ce as b, 247 ne as c, 248 q as d, 249 Y as e, 250 b as f, 251 W as g, 252 re as h, 253 se as i, 254 ee as j, 255 te as k, 256 oe as l, 257 M as m, 258 ie as s, 259 ae as t 260};
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.