@betterstore/react 0.3.15 → 0.3.16
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/CHANGELOG.md +6 -0
- package/dist/index.cjs.js +8 -2
- package/dist/index.mjs +8 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -35241,7 +35241,13 @@ var PaymentElement$1 = React.memo(PaymentElement);
|
|
|
35241
35241
|
|
|
35242
35242
|
function PaymentForm({ paymentSecret, onSuccess, onError, onBack, onDoubleBack, contactEmail, shippingAddress, shippingName, shippingPrice, checkoutAppearance, fonts, locale, publicKey, }) {
|
|
35243
35243
|
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
35244
|
+
const [key, setKey] = React.useState(0);
|
|
35244
35245
|
const { t } = useTranslation();
|
|
35246
|
+
React.useEffect(() => {
|
|
35247
|
+
if (paymentSecret) {
|
|
35248
|
+
setKey((prev) => prev + 1);
|
|
35249
|
+
}
|
|
35250
|
+
}, [paymentSecret]);
|
|
35245
35251
|
return (React.createElement("div", { className: "space-y-6" },
|
|
35246
35252
|
React.createElement("div", null,
|
|
35247
35253
|
React.createElement("h2", { className: "mb-2" }, t("CheckoutEmbed.Payment.title")),
|
|
@@ -35268,7 +35274,7 @@ function PaymentForm({ paymentSecret, onSuccess, onError, onBack, onDoubleBack,
|
|
|
35268
35274
|
" \u00B7 ",
|
|
35269
35275
|
shippingPrice)),
|
|
35270
35276
|
React.createElement(Button, { variant: "link", size: "link", onClick: onBack }, t("CheckoutEmbed.Shipping.change")))),
|
|
35271
|
-
React.createElement("div", { className: "mt-8" }, paymentSecret && (React.createElement(PaymentElement$1, { fonts: fonts, checkoutAppearance: convertCheckoutAppearanceToStripeAppearance(checkoutAppearance, fonts), locale: locale, paymentSecret: paymentSecret, onSuccess: onSuccess, onError: onError, setSubmitting: setIsSubmitting, publicKey: publicKey },
|
|
35277
|
+
React.createElement("div", { className: "mt-8" }, paymentSecret && (React.createElement(PaymentElement$1, { key: key, fonts: fonts, checkoutAppearance: convertCheckoutAppearanceToStripeAppearance(checkoutAppearance, fonts), locale: locale, paymentSecret: paymentSecret, onSuccess: onSuccess, onError: onError, setSubmitting: setIsSubmitting, publicKey: publicKey },
|
|
35272
35278
|
React.createElement("div", { className: "flex justify-between items-center pt-8" },
|
|
35273
35279
|
React.createElement(Button, { type: "button", variant: "ghost", onClick: onBack },
|
|
35274
35280
|
React.createElement(ChevronLeft, null),
|
|
@@ -35607,7 +35613,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
|
|
|
35607
35613
|
};
|
|
35608
35614
|
React.useEffect(() => {
|
|
35609
35615
|
const asyncFunc = () => __awaiter(this, void 0, void 0, function* () {
|
|
35610
|
-
const
|
|
35616
|
+
const { paymentSecret, publicKey, checkoutSession: newCheckout, } = yield storeClient.generateCheckoutPaymentSecret(clientSecret, checkoutId);
|
|
35611
35617
|
setPaymentSecret(paymentSecret);
|
|
35612
35618
|
setPublicKey(publicKey);
|
|
35613
35619
|
setCheckout(newCheckout);
|
package/dist/index.mjs
CHANGED
|
@@ -35218,7 +35218,13 @@ var PaymentElement$1 = memo$1(PaymentElement);
|
|
|
35218
35218
|
|
|
35219
35219
|
function PaymentForm({ paymentSecret, onSuccess, onError, onBack, onDoubleBack, contactEmail, shippingAddress, shippingName, shippingPrice, checkoutAppearance, fonts, locale, publicKey, }) {
|
|
35220
35220
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
35221
|
+
const [key, setKey] = useState(0);
|
|
35221
35222
|
const { t } = useTranslation();
|
|
35223
|
+
useEffect(() => {
|
|
35224
|
+
if (paymentSecret) {
|
|
35225
|
+
setKey((prev) => prev + 1);
|
|
35226
|
+
}
|
|
35227
|
+
}, [paymentSecret]);
|
|
35222
35228
|
return (React__default.createElement("div", { className: "space-y-6" },
|
|
35223
35229
|
React__default.createElement("div", null,
|
|
35224
35230
|
React__default.createElement("h2", { className: "mb-2" }, t("CheckoutEmbed.Payment.title")),
|
|
@@ -35245,7 +35251,7 @@ function PaymentForm({ paymentSecret, onSuccess, onError, onBack, onDoubleBack,
|
|
|
35245
35251
|
" \u00B7 ",
|
|
35246
35252
|
shippingPrice)),
|
|
35247
35253
|
React__default.createElement(Button, { variant: "link", size: "link", onClick: onBack }, t("CheckoutEmbed.Shipping.change")))),
|
|
35248
|
-
React__default.createElement("div", { className: "mt-8" }, paymentSecret && (React__default.createElement(PaymentElement$1, { fonts: fonts, checkoutAppearance: convertCheckoutAppearanceToStripeAppearance(checkoutAppearance, fonts), locale: locale, paymentSecret: paymentSecret, onSuccess: onSuccess, onError: onError, setSubmitting: setIsSubmitting, publicKey: publicKey },
|
|
35254
|
+
React__default.createElement("div", { className: "mt-8" }, paymentSecret && (React__default.createElement(PaymentElement$1, { key: key, fonts: fonts, checkoutAppearance: convertCheckoutAppearanceToStripeAppearance(checkoutAppearance, fonts), locale: locale, paymentSecret: paymentSecret, onSuccess: onSuccess, onError: onError, setSubmitting: setIsSubmitting, publicKey: publicKey },
|
|
35249
35255
|
React__default.createElement("div", { className: "flex justify-between items-center pt-8" },
|
|
35250
35256
|
React__default.createElement(Button, { type: "button", variant: "ghost", onClick: onBack },
|
|
35251
35257
|
React__default.createElement(ChevronLeft, null),
|
|
@@ -35584,7 +35590,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
|
|
|
35584
35590
|
};
|
|
35585
35591
|
useEffect(() => {
|
|
35586
35592
|
const asyncFunc = () => __awaiter(this, void 0, void 0, function* () {
|
|
35587
|
-
const
|
|
35593
|
+
const { paymentSecret, publicKey, checkoutSession: newCheckout, } = yield storeClient.generateCheckoutPaymentSecret(clientSecret, checkoutId);
|
|
35588
35594
|
setPaymentSecret(paymentSecret);
|
|
35589
35595
|
setPublicKey(publicKey);
|
|
35590
35596
|
setCheckout(newCheckout);
|