@miden-npm/react 2.0.4 → 2.0.5
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/index.cjs +39 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +39 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2977,13 +2977,12 @@ function PayByCard({
|
|
|
2977
2977
|
setIsMakingPayment(false);
|
|
2978
2978
|
return;
|
|
2979
2979
|
}
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
});
|
|
2980
|
+
if (response && response.message) {
|
|
2981
|
+
setMessage(response.message);
|
|
2982
|
+
onError?.({
|
|
2983
|
+
errorMessage: response.message
|
|
2984
|
+
});
|
|
2985
|
+
}
|
|
2987
2986
|
setIsMakingPayment(false);
|
|
2988
2987
|
} catch (err) {
|
|
2989
2988
|
let friendly = "Payment failed";
|
|
@@ -3067,6 +3066,9 @@ function PayByCard({
|
|
|
3067
3066
|
setLoadingCountries(false);
|
|
3068
3067
|
}
|
|
3069
3068
|
};
|
|
3069
|
+
const goBack = () => {
|
|
3070
|
+
setFormIndex(formIndex > 0 ? formIndex - 1 : 0);
|
|
3071
|
+
};
|
|
3070
3072
|
const getStates = async (countryIso2) => {
|
|
3071
3073
|
const country = rawCountries.find((c) => c.iso2 === countryIso2);
|
|
3072
3074
|
if (!country) return;
|
|
@@ -3156,7 +3158,9 @@ function PayByCard({
|
|
|
3156
3158
|
(c) => c.code.toLowerCase() === e.toLowerCase()
|
|
3157
3159
|
)[0];
|
|
3158
3160
|
if (selectedCountry) {
|
|
3159
|
-
setDefaultCountryCode(
|
|
3161
|
+
setDefaultCountryCode(
|
|
3162
|
+
`${selectedCountry.phoneCode}-${selectedCountry.code}`
|
|
3163
|
+
);
|
|
3160
3164
|
}
|
|
3161
3165
|
if (billingErrors.country) {
|
|
3162
3166
|
setBillingErrors((er) => ({ ...er, country: "" }));
|
|
@@ -3212,7 +3216,7 @@ function PayByCard({
|
|
|
3212
3216
|
validationError: billingErrors.postalCode ?? ""
|
|
3213
3217
|
}
|
|
3214
3218
|
),
|
|
3215
|
-
/* @__PURE__ */ jsx36(
|
|
3219
|
+
/* @__PURE__ */ jsx36("div", { className: "col-span-2", children: /* @__PURE__ */ jsx36(
|
|
3216
3220
|
BaseInput,
|
|
3217
3221
|
{
|
|
3218
3222
|
label: "Email",
|
|
@@ -3226,12 +3230,13 @@ function PayByCard({
|
|
|
3226
3230
|
},
|
|
3227
3231
|
validationError: billingErrors.emailAddress ?? ""
|
|
3228
3232
|
}
|
|
3229
|
-
),
|
|
3233
|
+
) }),
|
|
3230
3234
|
/* @__PURE__ */ jsx36("div", { className: "col-span-2", children: /* @__PURE__ */ jsx36(
|
|
3231
3235
|
BasePhoneNumberInput,
|
|
3232
3236
|
{
|
|
3233
3237
|
label: "Phone Number",
|
|
3234
3238
|
required: true,
|
|
3239
|
+
preventPaste: true,
|
|
3235
3240
|
value: billingForm.phoneNumber,
|
|
3236
3241
|
phoneCodeOptions,
|
|
3237
3242
|
defaultCountryCode,
|
|
@@ -3343,18 +3348,30 @@ function PayByCard({
|
|
|
3343
3348
|
]
|
|
3344
3349
|
}
|
|
3345
3350
|
),
|
|
3346
|
-
/* @__PURE__ */
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3351
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between gap-4 mt-6", children: [
|
|
3352
|
+
formIndex > 0 && /* @__PURE__ */ jsx36(
|
|
3353
|
+
BaseButton,
|
|
3354
|
+
{
|
|
3355
|
+
label: "Previous",
|
|
3356
|
+
type: "secondary",
|
|
3357
|
+
customClass: "w-1/2",
|
|
3358
|
+
caller,
|
|
3359
|
+
onClick: goBack
|
|
3360
|
+
}
|
|
3361
|
+
),
|
|
3362
|
+
/* @__PURE__ */ jsx36(
|
|
3363
|
+
BaseButton,
|
|
3364
|
+
{
|
|
3365
|
+
label: formIndex === 0 ? "Proceed" : `Pay ${formatAmountHandler}`,
|
|
3366
|
+
type: "primary",
|
|
3367
|
+
customClass: `${formIndex > 0 ? "w-1/2" : "w-full"}`,
|
|
3368
|
+
caller,
|
|
3369
|
+
loading: isMakingPayment,
|
|
3370
|
+
onClick: proceedHandler,
|
|
3371
|
+
disabled: isMakingPayment
|
|
3372
|
+
}
|
|
3373
|
+
)
|
|
3374
|
+
] })
|
|
3358
3375
|
] });
|
|
3359
3376
|
}
|
|
3360
3377
|
|