@astropay/payments-lib 2.0.8 → 2.0.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/dist/astropay-payments-lib.es.js +1 -1
- package/dist/astropay-payments-lib.umd.js +21 -13
- package/dist/{main-QOFSdpoZ.js → main-OhXOviRS.js} +165 -132
- package/dist/{profiler-Cq4Jvt9c.js → profiler-D3cW_-YH.js} +1 -1
- package/dist/{startRecording-CKBjDVQr.js → startRecording-D2fB2eZp.js} +1 -1
- package/dist/types/index.d.ts +57 -122
- package/package.json +1 -1
|
@@ -472,7 +472,7 @@ ${te}` : ""}`;
|
|
|
472
472
|
function validateValue(ee, re, te) {
|
|
473
473
|
return re.includes(ee) ? ee : te;
|
|
474
474
|
}
|
|
475
|
-
const toCamelCase$1 = (ee) => ee.toLowerCase().replace(
|
|
475
|
+
const NON_BREAKING_SPACE = " ", toCamelCase$1 = (ee) => ee.toLowerCase().replace(
|
|
476
476
|
/(?:^|[^a-zA-Z0-9]+)([a-zA-Z0-9])/g,
|
|
477
477
|
(re, te, ne) => ne === 0 ? te.toLowerCase() : te.toUpperCase()
|
|
478
478
|
), toSnakeCase = (ee) => ee.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[^a-zA-Z0-9]+/g, "_").toLowerCase(), encodeData = (ee) => {
|
|
@@ -5285,7 +5285,7 @@ class LoadingSuccess extends Component {
|
|
|
5285
5285
|
const RUNTIME_CONFIG = {
|
|
5286
5286
|
test: {
|
|
5287
5287
|
NAME: "@astropay/payments-lib",
|
|
5288
|
-
VERSION: "2.0.
|
|
5288
|
+
VERSION: "2.0.9",
|
|
5289
5289
|
MODE: "test",
|
|
5290
5290
|
API_BASE_URL: "https://partners-api-tst.astropay.com/api",
|
|
5291
5291
|
RESOURCES_BUCKET: "https://rs-tst.astropay.com",
|
|
@@ -5295,7 +5295,7 @@ const RUNTIME_CONFIG = {
|
|
|
5295
5295
|
},
|
|
5296
5296
|
sandbox: {
|
|
5297
5297
|
NAME: "@astropay/payments-lib",
|
|
5298
|
-
VERSION: "2.0.
|
|
5298
|
+
VERSION: "2.0.9",
|
|
5299
5299
|
MODE: "staging",
|
|
5300
5300
|
API_BASE_URL: "https://partners-api-sandbox.astropay.com/api",
|
|
5301
5301
|
RESOURCES_BUCKET: "https://rs-tst.astropay.com",
|
|
@@ -5305,7 +5305,7 @@ const RUNTIME_CONFIG = {
|
|
|
5305
5305
|
},
|
|
5306
5306
|
production: {
|
|
5307
5307
|
NAME: "@astropay/payments-lib",
|
|
5308
|
-
VERSION: "2.0.
|
|
5308
|
+
VERSION: "2.0.9",
|
|
5309
5309
|
MODE: "production",
|
|
5310
5310
|
API_BASE_URL: "https://partners-api.astropay.com/api",
|
|
5311
5311
|
RESOURCES_BUCKET: "https://rs.astropay.com",
|
|
@@ -11584,7 +11584,7 @@ async function lazyLoadRecorder(ee = importRecorder) {
|
|
|
11584
11584
|
async function importRecorder() {
|
|
11585
11585
|
return (await import(
|
|
11586
11586
|
/* webpackChunkName: "recorder" */
|
|
11587
|
-
"./startRecording-
|
|
11587
|
+
"./startRecording-D2fB2eZp.js"
|
|
11588
11588
|
)).startRecording;
|
|
11589
11589
|
}
|
|
11590
11590
|
function isProfilingSupported() {
|
|
@@ -11604,7 +11604,7 @@ async function lazyLoadProfiler(ee = importProfiler) {
|
|
|
11604
11604
|
async function importProfiler() {
|
|
11605
11605
|
return (await import(
|
|
11606
11606
|
/* webpackChunkName: "profiler" */
|
|
11607
|
-
"./profiler-
|
|
11607
|
+
"./profiler-D3cW_-YH.js"
|
|
11608
11608
|
)).createRumProfiler;
|
|
11609
11609
|
}
|
|
11610
11610
|
function makeProfilerApi() {
|
|
@@ -11644,7 +11644,7 @@ const Vi = class Vi {
|
|
|
11644
11644
|
env: AstroPayConfig.getRuntimeConfig().MODE,
|
|
11645
11645
|
version: AstroPayConfig.getRuntimeConfig().VERSION,
|
|
11646
11646
|
sessionSampleRate: 50,
|
|
11647
|
-
sessionReplaySampleRate:
|
|
11647
|
+
sessionReplaySampleRate: 100,
|
|
11648
11648
|
defaultPrivacyLevel: "mask-user-input",
|
|
11649
11649
|
trackViewsManually: !0,
|
|
11650
11650
|
trackResources: !1,
|
|
@@ -28911,6 +28911,7 @@ class InputSelect extends Component {
|
|
|
28911
28911
|
this.helperTextElement ? (this.helperTextElement.textContent = te, this.helperTextElement.style.color = ne.helperText.color) : (this.helperTextElement = new Typography({
|
|
28912
28912
|
text: te,
|
|
28913
28913
|
size: ne.helperText.size,
|
|
28914
|
+
lineHeight: ne.helperText.size,
|
|
28914
28915
|
weight: ne.helperText.weight,
|
|
28915
28916
|
color: ne.helperText.color
|
|
28916
28917
|
}).element, this.element.append(this.helperTextElement));
|
|
@@ -29188,6 +29189,7 @@ class InputText extends Component {
|
|
|
29188
29189
|
this.helperTextElement ? (this.helperTextElement.textContent = te, this.helperTextElement.style.color = ne.helperText.color) : (this.helperTextElement = new Typography({
|
|
29189
29190
|
text: te,
|
|
29190
29191
|
size: ne.helperText.size,
|
|
29192
|
+
lineHeight: ne.helperText.size,
|
|
29191
29193
|
weight: ne.helperText.weight,
|
|
29192
29194
|
color: ne.helperText.color
|
|
29193
29195
|
}).element, this.element.append(this.helperTextElement));
|
|
@@ -30150,7 +30152,7 @@ var EBreakpoints = /* @__PURE__ */ ((ee) => (ee.MOBILE = "480px", ee.TABLET = "7
|
|
|
30150
30152
|
const getFormTemplateStyles = () => css`
|
|
30151
30153
|
display: flex;
|
|
30152
30154
|
flex-direction: column;
|
|
30153
|
-
gap:
|
|
30155
|
+
gap: 8px;
|
|
30154
30156
|
|
|
30155
30157
|
.row-container {
|
|
30156
30158
|
display: flex;
|
|
@@ -30212,14 +30214,16 @@ class FormTemplate extends Component {
|
|
|
30212
30214
|
label: te.label,
|
|
30213
30215
|
placeholder: te.placeholder,
|
|
30214
30216
|
options: mountSelectOptions(te.values),
|
|
30215
|
-
validateOn: "onChange"
|
|
30217
|
+
validateOn: "onChange",
|
|
30218
|
+
helperText: NON_BREAKING_SPACE
|
|
30216
30219
|
}) : this.createTextInput({
|
|
30217
30220
|
name: te.field,
|
|
30218
30221
|
label: te.label,
|
|
30219
30222
|
placeholder: te.placeholder,
|
|
30220
30223
|
type: "text",
|
|
30221
30224
|
validationRegex: parseRegex(te.regex),
|
|
30222
|
-
validateOn: "onChange"
|
|
30225
|
+
validateOn: "onChange",
|
|
30226
|
+
helperText: NON_BREAKING_SPACE
|
|
30223
30227
|
});
|
|
30224
30228
|
}
|
|
30225
30229
|
createSelectInput(te) {
|
|
@@ -31985,17 +31989,17 @@ class CardApService {
|
|
|
31985
31989
|
return this.form.accessToken = ie, await new Promise((oe) => {
|
|
31986
31990
|
this.form.submit(
|
|
31987
31991
|
(se) => {
|
|
31988
|
-
var le, de, fe, he, pe;
|
|
31992
|
+
var le, de, fe, he, pe, ge;
|
|
31989
31993
|
const ae = (le = se.card_number) == null ? void 0 : le.details, ue = ae == null ? void 0 : ae.bin;
|
|
31990
31994
|
if (!ue) {
|
|
31991
31995
|
ne(new Error(AstroPayI18n.translate("card_tokenization_error")));
|
|
31992
31996
|
return;
|
|
31993
31997
|
}
|
|
31994
31998
|
const ce = {
|
|
31995
|
-
cardNumberTkn: ((de = se.card_number) == null ? void 0 : de.value) || "",
|
|
31996
|
-
cvvToken: ((
|
|
31997
|
-
holderName: (
|
|
31998
|
-
expirationDate: formatCardExpiryDate((
|
|
31999
|
+
cardNumberTkn: ((fe = (de = se.card_number) == null ? void 0 : de.value) == null ? void 0 : fe.trim()) || "",
|
|
32000
|
+
cvvToken: ((he = se.card_cvc) == null ? void 0 : he.value) || "",
|
|
32001
|
+
holderName: (pe = se.card_holder) == null ? void 0 : pe.value,
|
|
32002
|
+
expirationDate: formatCardExpiryDate((ge = se.card_exp) == null ? void 0 : ge.value),
|
|
31999
32003
|
firstSixDigits: ue ? ue.substring(0, 6) : "",
|
|
32000
32004
|
lastFourDigits: (ae == null ? void 0 : ae.lastFour) || "",
|
|
32001
32005
|
brand: (ae == null ? void 0 : ae.brand) || "unknown"
|
|
@@ -32043,7 +32047,7 @@ const CARD_STYLES = (ee, re) => ({
|
|
|
32043
32047
|
}), getCardPaymentMethodStyles = (ee, { error: re = !1, disabled: te = !1 }) => css`
|
|
32044
32048
|
display: flex;
|
|
32045
32049
|
flex-direction: column;
|
|
32046
|
-
gap:
|
|
32050
|
+
gap: 8px;
|
|
32047
32051
|
|
|
32048
32052
|
.loading-wrapper {
|
|
32049
32053
|
display: flex;
|
|
@@ -32069,6 +32073,14 @@ const CARD_STYLES = (ee, re) => ({
|
|
|
32069
32073
|
width: 100%;
|
|
32070
32074
|
}
|
|
32071
32075
|
|
|
32076
|
+
.row-container .input-container {
|
|
32077
|
+
height: 100%;
|
|
32078
|
+
}
|
|
32079
|
+
|
|
32080
|
+
.row-container .input-container > *:first-child {
|
|
32081
|
+
flex: 1;
|
|
32082
|
+
}
|
|
32083
|
+
|
|
32072
32084
|
.center-row {
|
|
32073
32085
|
display: flex;
|
|
32074
32086
|
justify-content: center;
|
|
@@ -32131,21 +32143,17 @@ class CardField extends Component {
|
|
|
32131
32143
|
}).element, ue.append(this.labelTextElement), ue.htmlFor = te, this.inputContainer.append(this.labelTextElement);
|
|
32132
32144
|
}
|
|
32133
32145
|
const ae = document.createElement("div");
|
|
32134
|
-
ae.id = te, ae.classList.add("form-field"), this.inputContainer.append(ae),
|
|
32135
|
-
text: ie,
|
|
32146
|
+
ae.id = te, ae.classList.add("form-field"), this.inputContainer.append(ae), this.helperTextElement = new Typography({
|
|
32147
|
+
text: ie || NON_BREAKING_SPACE,
|
|
32136
32148
|
size: se.helperText.size,
|
|
32149
|
+
lineHeight: se.helperText.size,
|
|
32137
32150
|
weight: se.helperText.weight,
|
|
32138
32151
|
color: se.helperText.color
|
|
32139
|
-
}).element, this.inputContainer.append(this.helperTextElement)
|
|
32152
|
+
}).element, this.inputContainer.append(this.helperTextElement), this.element.append(this.inputContainer);
|
|
32140
32153
|
}
|
|
32141
32154
|
setHelperText(te, ne = !0) {
|
|
32142
32155
|
const ie = inputStyle(!ne);
|
|
32143
|
-
this.helperTextElement ||
|
|
32144
|
-
text: te,
|
|
32145
|
-
size: ie.helperText.size,
|
|
32146
|
-
weight: ie.helperText.weight,
|
|
32147
|
-
color: ie.helperText.color
|
|
32148
|
-
}).element, this.inputContainer.append(this.helperTextElement)), this.helperTextElement.textContent = te, this.helperTextElement.style.color = ie.helperText.color;
|
|
32156
|
+
this.helperTextElement.textContent = te || NON_BREAKING_SPACE, this.helperTextElement.style.color = ie.helperText.color;
|
|
32149
32157
|
}
|
|
32150
32158
|
setValid(te) {
|
|
32151
32159
|
if (this.labelTextElement) {
|
|
@@ -33045,11 +33053,17 @@ class AstroPayCardPayment extends Component {
|
|
|
33045
33053
|
xe(this, "loadingWrapper");
|
|
33046
33054
|
xe(this, "componentProps");
|
|
33047
33055
|
xe(this, "methodCode");
|
|
33048
|
-
this.
|
|
33049
|
-
|
|
33050
|
-
|
|
33051
|
-
|
|
33052
|
-
|
|
33056
|
+
if (this.methodCode = ECheckoutPaymentMethod.CARD, te.paymentExternalId)
|
|
33057
|
+
this.componentProps = te;
|
|
33058
|
+
else {
|
|
33059
|
+
const ie = te;
|
|
33060
|
+
this.componentProps = {
|
|
33061
|
+
...ie,
|
|
33062
|
+
country: ie.country.trim().toUpperCase(),
|
|
33063
|
+
currency: ie.currency.trim().toUpperCase()
|
|
33064
|
+
};
|
|
33065
|
+
}
|
|
33066
|
+
AstroPayCore.registerComponent(this), AmplitudeAnalytics$1.astroPayPaymentImpression("AstroPayCardPayment"), this.loadingWrapper = document.createElement("div"), this.loadingWrapper.classList.add("loading-wrapper");
|
|
33053
33067
|
const ne = new Loading({
|
|
33054
33068
|
size: 100,
|
|
33055
33069
|
variant: "fetching",
|
|
@@ -33060,21 +33074,20 @@ class AstroPayCardPayment extends Component {
|
|
|
33060
33074
|
async createPayment() {
|
|
33061
33075
|
var te, ne;
|
|
33062
33076
|
try {
|
|
33063
|
-
|
|
33064
|
-
|
|
33065
|
-
|
|
33066
|
-
|
|
33067
|
-
|
|
33068
|
-
|
|
33069
|
-
country:
|
|
33070
|
-
currency:
|
|
33071
|
-
amount:
|
|
33072
|
-
order:
|
|
33077
|
+
let ie;
|
|
33078
|
+
this.componentProps.paymentExternalId ? ie = await PaymentService.getPaymentDetails(
|
|
33079
|
+
this.componentProps.paymentExternalId,
|
|
33080
|
+
"card_payment"
|
|
33081
|
+
) : ie = await PaymentService.postCreatePayment(
|
|
33082
|
+
{
|
|
33083
|
+
country: this.componentProps.country,
|
|
33084
|
+
currency: this.componentProps.currency,
|
|
33085
|
+
amount: this.componentProps.amount,
|
|
33086
|
+
order: this.componentProps.order,
|
|
33073
33087
|
methodCode: this.methodCode
|
|
33074
|
-
}
|
|
33075
|
-
|
|
33076
|
-
|
|
33077
|
-
this.renderAstroPayCardMethod(ce);
|
|
33088
|
+
},
|
|
33089
|
+
"card_payment"
|
|
33090
|
+
), this.renderAstroPayCardMethod(ie);
|
|
33078
33091
|
} catch (ie) {
|
|
33079
33092
|
const oe = ie;
|
|
33080
33093
|
(ne = (te = this.componentProps) == null ? void 0 : te.onError) == null || ne.call(te), this.showErrorMessage(oe.description ?? oe.message);
|
|
@@ -33083,7 +33096,7 @@ class AstroPayCardPayment extends Component {
|
|
|
33083
33096
|
}
|
|
33084
33097
|
}
|
|
33085
33098
|
renderAstroPayCardMethod(te) {
|
|
33086
|
-
var
|
|
33099
|
+
var ye, ve, be, _e, Ce, Te;
|
|
33087
33100
|
const {
|
|
33088
33101
|
paymentExternalId: ne,
|
|
33089
33102
|
user: ie,
|
|
@@ -33096,36 +33109,41 @@ class AstroPayCardPayment extends Component {
|
|
|
33096
33109
|
} = te;
|
|
33097
33110
|
this.element.innerHTML = "";
|
|
33098
33111
|
const de = (oe == null ? void 0 : oe.filter(
|
|
33099
|
-
(
|
|
33112
|
+
(Se) => Se.enabled && CARDS_METHOD.includes(Se.code)
|
|
33100
33113
|
)) ?? [];
|
|
33101
33114
|
if (de.length === 0) {
|
|
33102
|
-
(
|
|
33115
|
+
(ve = (ye = this.componentProps) == null ? void 0 : ye.onError) == null || ve.call(ye), this.showErrorMessage(AstroPayI18n.translate("generic_error"));
|
|
33116
|
+
return;
|
|
33117
|
+
}
|
|
33118
|
+
const fe = (ce == null ? void 0 : ce.amount) ?? this.componentProps.amount, he = (ce == null ? void 0 : ce.currency) ?? this.componentProps.currency, pe = le ?? this.componentProps.country;
|
|
33119
|
+
if (fe === void 0 || he === void 0 || pe === void 0) {
|
|
33120
|
+
(_e = (be = this.componentProps) == null ? void 0 : be.onError) == null || _e.call(be), this.showErrorMessage(AstroPayI18n.translate("generic_error"));
|
|
33103
33121
|
return;
|
|
33104
33122
|
}
|
|
33105
|
-
const
|
|
33123
|
+
const ge = mountPaymentMethodItems({
|
|
33106
33124
|
paymentMethods: de,
|
|
33107
33125
|
paymentExternalId: ne,
|
|
33108
|
-
amount:
|
|
33109
|
-
currency:
|
|
33110
|
-
country:
|
|
33126
|
+
amount: fe,
|
|
33127
|
+
currency: he,
|
|
33128
|
+
country: pe,
|
|
33111
33129
|
user: ie,
|
|
33112
33130
|
countries: se,
|
|
33113
33131
|
benefits: ae,
|
|
33114
33132
|
actionLabel: ue == null ? void 0 : ue.actionLabel,
|
|
33115
|
-
onSuccess: (
|
|
33133
|
+
onSuccess: (Se) => this.showResultScreen(Se, {
|
|
33116
33134
|
type: "success",
|
|
33117
33135
|
onSuccess: this.componentProps.onSuccess
|
|
33118
33136
|
}),
|
|
33119
|
-
onError: (
|
|
33137
|
+
onError: (Se) => this.showResultScreen(Se, {
|
|
33120
33138
|
type: "error",
|
|
33121
33139
|
onError: this.componentProps.onError
|
|
33122
33140
|
}),
|
|
33123
33141
|
cardConfig: {
|
|
33124
|
-
showPaymentSummary: (
|
|
33125
|
-
expirationDateFormat: (
|
|
33142
|
+
showPaymentSummary: (Ce = this.componentProps) == null ? void 0 : Ce.showPaymentSummary,
|
|
33143
|
+
expirationDateFormat: (Te = this.componentProps) == null ? void 0 : Te.expirationDateFormat
|
|
33126
33144
|
}
|
|
33127
|
-
}),
|
|
33128
|
-
this.element.append(
|
|
33145
|
+
}), me = new Accordion({ items: ge, defaultActiveItem: 0 });
|
|
33146
|
+
this.element.append(me.element);
|
|
33129
33147
|
}
|
|
33130
33148
|
showErrorMessage(te) {
|
|
33131
33149
|
this.element.innerHTML = "";
|
|
@@ -33211,13 +33229,24 @@ class AstroPayFullCheckout extends Component {
|
|
|
33211
33229
|
xe(this, "loadingWrapper");
|
|
33212
33230
|
xe(this, "componentProps");
|
|
33213
33231
|
xe(this, "accPaymentMethods");
|
|
33214
|
-
|
|
33215
|
-
|
|
33216
|
-
|
|
33217
|
-
|
|
33218
|
-
|
|
33219
|
-
|
|
33220
|
-
|
|
33232
|
+
if (te.paymentExternalId) {
|
|
33233
|
+
const ie = te;
|
|
33234
|
+
this.componentProps = {
|
|
33235
|
+
...ie,
|
|
33236
|
+
showTitle: ie.showTitle ?? !0,
|
|
33237
|
+
showDescription: ie.showDescription ?? !0
|
|
33238
|
+
};
|
|
33239
|
+
} else {
|
|
33240
|
+
const ie = te;
|
|
33241
|
+
this.componentProps = {
|
|
33242
|
+
...ie,
|
|
33243
|
+
showTitle: ie.showTitle ?? !0,
|
|
33244
|
+
showDescription: ie.showDescription ?? !0,
|
|
33245
|
+
country: ie.country.trim().toUpperCase(),
|
|
33246
|
+
currency: ie.currency.trim().toUpperCase()
|
|
33247
|
+
};
|
|
33248
|
+
}
|
|
33249
|
+
AstroPayCore.registerComponent(this), AmplitudeAnalytics$1.astroPayPaymentImpression("AstroPayFullCheckout"), this.loadingWrapper = document.createElement("div"), this.loadingWrapper.classList.add("loading-wrapper");
|
|
33221
33250
|
const ne = new Loading({
|
|
33222
33251
|
size: 100,
|
|
33223
33252
|
variant: "fetching",
|
|
@@ -33228,32 +33257,28 @@ class AstroPayFullCheckout extends Component {
|
|
|
33228
33257
|
async createPayment() {
|
|
33229
33258
|
var te, ne;
|
|
33230
33259
|
try {
|
|
33231
|
-
|
|
33232
|
-
|
|
33233
|
-
|
|
33234
|
-
|
|
33235
|
-
|
|
33236
|
-
|
|
33237
|
-
paymentExternalId: ce,
|
|
33238
|
-
description: le,
|
|
33239
|
-
paymentLink: de
|
|
33240
|
-
} = this.componentProps;
|
|
33241
|
-
let fe;
|
|
33242
|
-
if (ce)
|
|
33243
|
-
fe = await PaymentService.getPaymentDetails(ce, "full_checkout");
|
|
33260
|
+
let ie;
|
|
33261
|
+
if (this.componentProps.paymentExternalId)
|
|
33262
|
+
ie = await PaymentService.getPaymentDetails(
|
|
33263
|
+
this.componentProps.paymentExternalId,
|
|
33264
|
+
"full_checkout"
|
|
33265
|
+
);
|
|
33244
33266
|
else {
|
|
33245
|
-
const
|
|
33246
|
-
|
|
33247
|
-
|
|
33248
|
-
|
|
33249
|
-
|
|
33250
|
-
|
|
33251
|
-
|
|
33252
|
-
|
|
33253
|
-
|
|
33254
|
-
|
|
33267
|
+
const { description: oe, paymentLink: se } = this.componentProps;
|
|
33268
|
+
ie = await PaymentService.postCreatePayment(
|
|
33269
|
+
{
|
|
33270
|
+
country: this.componentProps.country,
|
|
33271
|
+
currency: this.componentProps.currency,
|
|
33272
|
+
amount: this.componentProps.amount,
|
|
33273
|
+
user: this.componentProps.user,
|
|
33274
|
+
order: this.componentProps.order,
|
|
33275
|
+
description: oe,
|
|
33276
|
+
paymentLink: se
|
|
33277
|
+
},
|
|
33278
|
+
"full_checkout"
|
|
33279
|
+
);
|
|
33255
33280
|
}
|
|
33256
|
-
this.renderPaymentMethods(
|
|
33281
|
+
this.renderPaymentMethods(ie);
|
|
33257
33282
|
} catch (ie) {
|
|
33258
33283
|
const oe = ie;
|
|
33259
33284
|
(ne = (te = this.componentProps) == null ? void 0 : te.onError) == null || ne.call(te);
|
|
@@ -33268,7 +33293,7 @@ class AstroPayFullCheckout extends Component {
|
|
|
33268
33293
|
}
|
|
33269
33294
|
}
|
|
33270
33295
|
renderPaymentMethods(te) {
|
|
33271
|
-
var
|
|
33296
|
+
var ye, ve, be;
|
|
33272
33297
|
const {
|
|
33273
33298
|
paymentExternalId: ne,
|
|
33274
33299
|
user: ie,
|
|
@@ -33281,50 +33306,53 @@ class AstroPayFullCheckout extends Component {
|
|
|
33281
33306
|
paymentCountry: de
|
|
33282
33307
|
} = te;
|
|
33283
33308
|
if (this.element.innerHTML = "", this.componentProps.showTitle) {
|
|
33284
|
-
const
|
|
33309
|
+
const _e = new Typography({
|
|
33285
33310
|
text: AstroPayI18n.translate("checkout_method"),
|
|
33286
33311
|
variant: "div",
|
|
33287
33312
|
size: "large",
|
|
33288
33313
|
weight: 600
|
|
33289
33314
|
}).element;
|
|
33290
|
-
this.element.append(
|
|
33315
|
+
this.element.append(_e);
|
|
33291
33316
|
}
|
|
33292
33317
|
if (this.componentProps.showDescription && ae) {
|
|
33293
|
-
const
|
|
33318
|
+
const _e = new Typography({
|
|
33294
33319
|
text: ae,
|
|
33295
33320
|
size: "small",
|
|
33296
33321
|
color: ThemeManager.getStyles().textSecondaryColor,
|
|
33297
33322
|
weight: 400
|
|
33298
33323
|
}).element;
|
|
33299
|
-
this.element.append(
|
|
33324
|
+
this.element.append(_e);
|
|
33300
33325
|
}
|
|
33301
33326
|
const fe = {
|
|
33302
33327
|
code: EPaymentCode.AP,
|
|
33303
|
-
label: ((
|
|
33304
|
-
description: (
|
|
33328
|
+
label: ((ye = te == null ? void 0 : te.metadata) == null ? void 0 : ye.title) || AstroPayI18n.translate("astro_express_checkout"),
|
|
33329
|
+
description: (ve = te == null ? void 0 : te.metadata) == null ? void 0 : ve.description,
|
|
33305
33330
|
enabled: !0
|
|
33306
|
-
}, he =
|
|
33331
|
+
}, he = (le == null ? void 0 : le.amount) ?? this.componentProps.amount, pe = (le == null ? void 0 : le.currency) ?? this.componentProps.currency, ge = de ?? this.componentProps.country;
|
|
33332
|
+
if (he === void 0 || pe === void 0 || ge === void 0)
|
|
33333
|
+
throw new Error(AstroPayI18n.translate("generic_error"));
|
|
33334
|
+
const me = mountPaymentMethodItems({
|
|
33307
33335
|
paymentMethods: [fe, ...oe ?? []],
|
|
33308
33336
|
paymentExternalId: ne,
|
|
33309
|
-
amount:
|
|
33310
|
-
currency:
|
|
33311
|
-
country:
|
|
33337
|
+
amount: he,
|
|
33338
|
+
currency: pe,
|
|
33339
|
+
country: ge,
|
|
33312
33340
|
user: ie,
|
|
33313
33341
|
countries: se,
|
|
33314
33342
|
benefits: ue,
|
|
33315
33343
|
actionLabel: ce == null ? void 0 : ce.actionLabel,
|
|
33316
|
-
onSuccess: (
|
|
33344
|
+
onSuccess: (_e) => this.showResultScreen(_e, {
|
|
33317
33345
|
type: "success",
|
|
33318
33346
|
onSuccess: this.componentProps.onSuccess
|
|
33319
33347
|
}),
|
|
33320
|
-
onError: (
|
|
33348
|
+
onError: (_e) => this.showResultScreen(_e, {
|
|
33321
33349
|
type: "error",
|
|
33322
33350
|
onError: this.componentProps.onError
|
|
33323
33351
|
}),
|
|
33324
|
-
cardConfig: (
|
|
33352
|
+
cardConfig: (be = this.componentProps) == null ? void 0 : be.cardConfig
|
|
33325
33353
|
});
|
|
33326
|
-
|
|
33327
|
-
items:
|
|
33354
|
+
me.length > 0 && (this.accPaymentMethods = new Accordion({
|
|
33355
|
+
items: me,
|
|
33328
33356
|
defaultActiveItem: 0
|
|
33329
33357
|
}), this.element.append(this.accPaymentMethods.element));
|
|
33330
33358
|
}
|
|
@@ -33402,11 +33430,17 @@ class AstroPayPayment extends Component {
|
|
|
33402
33430
|
xe(this, "loadingWrapper");
|
|
33403
33431
|
xe(this, "componentProps");
|
|
33404
33432
|
xe(this, "methodCode");
|
|
33405
|
-
this.
|
|
33406
|
-
|
|
33407
|
-
|
|
33408
|
-
|
|
33409
|
-
|
|
33433
|
+
if (this.methodCode = ECheckoutPaymentMethod.ASTRO_PAY, te.paymentExternalId)
|
|
33434
|
+
this.componentProps = te;
|
|
33435
|
+
else {
|
|
33436
|
+
const ie = te;
|
|
33437
|
+
this.componentProps = {
|
|
33438
|
+
...ie,
|
|
33439
|
+
country: ie.country.trim().toUpperCase(),
|
|
33440
|
+
currency: ie.currency.trim().toUpperCase()
|
|
33441
|
+
};
|
|
33442
|
+
}
|
|
33443
|
+
AstroPayCore.registerComponent(this), AmplitudeAnalytics$1.astroPayPaymentImpression("AstroPayPayment"), this.loadingWrapper = document.createElement("div"), this.loadingWrapper.classList.add("loading-wrapper");
|
|
33410
33444
|
const ne = new Loading({
|
|
33411
33445
|
size: 100,
|
|
33412
33446
|
variant: "fetching",
|
|
@@ -33417,22 +33451,21 @@ class AstroPayPayment extends Component {
|
|
|
33417
33451
|
async createPayment() {
|
|
33418
33452
|
var te, ne;
|
|
33419
33453
|
try {
|
|
33420
|
-
|
|
33421
|
-
|
|
33422
|
-
|
|
33423
|
-
|
|
33424
|
-
|
|
33425
|
-
|
|
33426
|
-
country:
|
|
33427
|
-
currency:
|
|
33428
|
-
amount:
|
|
33429
|
-
user:
|
|
33430
|
-
order:
|
|
33454
|
+
let ie;
|
|
33455
|
+
this.componentProps.paymentExternalId ? ie = await PaymentService.getPaymentDetails(
|
|
33456
|
+
this.componentProps.paymentExternalId,
|
|
33457
|
+
"astropay_payment"
|
|
33458
|
+
) : ie = await PaymentService.postCreatePayment(
|
|
33459
|
+
{
|
|
33460
|
+
country: this.componentProps.country,
|
|
33461
|
+
currency: this.componentProps.currency,
|
|
33462
|
+
amount: this.componentProps.amount,
|
|
33463
|
+
user: this.componentProps.user,
|
|
33464
|
+
order: this.componentProps.order,
|
|
33431
33465
|
methodCode: this.methodCode
|
|
33432
|
-
}
|
|
33433
|
-
|
|
33434
|
-
|
|
33435
|
-
this.renderAstroPayMethod(le);
|
|
33466
|
+
},
|
|
33467
|
+
"astropay_payment"
|
|
33468
|
+
), this.renderAstroPayMethod(ie);
|
|
33436
33469
|
} catch (ie) {
|
|
33437
33470
|
const oe = ie;
|
|
33438
33471
|
(ne = (te = this.componentProps) == null ? void 0 : te.onError) == null || ne.call(te);
|
|
@@ -33449,26 +33482,26 @@ class AstroPayPayment extends Component {
|
|
|
33449
33482
|
renderAstroPayMethod(te) {
|
|
33450
33483
|
const { paymentExternalId: ne, user: ie, countries: oe, benefits: se, metadata: ae, paymentAmount: ue } = te;
|
|
33451
33484
|
this.element.innerHTML = "";
|
|
33452
|
-
const ce =
|
|
33453
|
-
|
|
33454
|
-
|
|
33455
|
-
|
|
33485
|
+
const ce = (ue == null ? void 0 : ue.amount) ?? this.componentProps.amount, le = (ue == null ? void 0 : ue.currency) ?? this.componentProps.currency;
|
|
33486
|
+
if (ce === void 0 || le === void 0)
|
|
33487
|
+
throw new Error(AstroPayI18n.translate("generic_error"));
|
|
33488
|
+
const de = { amount: ce, currency: le }, fe = new AstroPayPaymentMethod({
|
|
33456
33489
|
paymentExternalId: ne,
|
|
33457
33490
|
user: ie,
|
|
33458
33491
|
countries: oe,
|
|
33459
33492
|
benefits: se,
|
|
33460
|
-
paymentAmount:
|
|
33493
|
+
paymentAmount: de,
|
|
33461
33494
|
actionLabel: ae == null ? void 0 : ae.actionLabel,
|
|
33462
|
-
onSuccess: (
|
|
33495
|
+
onSuccess: (he) => this.showResultScreen(he, {
|
|
33463
33496
|
type: "success",
|
|
33464
33497
|
onSuccess: this.componentProps.onSuccess
|
|
33465
33498
|
}),
|
|
33466
|
-
onError: (
|
|
33499
|
+
onError: (he) => this.showResultScreen(he, {
|
|
33467
33500
|
type: "error",
|
|
33468
33501
|
onError: this.componentProps.onError
|
|
33469
33502
|
})
|
|
33470
33503
|
}).element;
|
|
33471
|
-
this.element.append(
|
|
33504
|
+
this.element.append(fe);
|
|
33472
33505
|
}
|
|
33473
33506
|
showResultScreen(te, ne) {
|
|
33474
33507
|
this.element.innerHTML = "";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as A, C, b as ft, i as Y, g as V, N as h, P as X, S as pt, a as B, c as ht, d as mt, e as St, f as q, r as gt, h as Et, j as yt, k as Tt, l as j, m as J, t as _, n as x, o as M, p as K, q as N, u as Q, v as Z, w as Nt, x as vt, y as b, z as D, A as R, B as wt, D as Mt, E as It, F as Rt, G as Ct, H as bt, I as _t, J as Lt, K as Dt, L as xt, M as Ot, O as At, Q as Vt, R as Pt, T as kt, U as zt } from "./main-
|
|
1
|
+
import { s as A, C, b as ft, i as Y, g as V, N as h, P as X, S as pt, a as B, c as ht, d as mt, e as St, f as q, r as gt, h as Et, j as yt, k as Tt, l as j, m as J, t as _, n as x, o as M, p as K, q as N, u as Q, v as Z, w as Nt, x as vt, y as b, z as D, A as R, B as wt, D as Mt, E as It, F as Rt, G as Ct, H as bt, I as _t, J as Lt, K as Dt, L as xt, M as Ot, O as At, Q as Vt, R as Pt, T as kt, U as zt } from "./main-OhXOviRS.js";
|
|
2
2
|
const P = /* @__PURE__ */ new WeakMap();
|
|
3
3
|
function T(t) {
|
|
4
4
|
return P.has(t);
|