@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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @betterstore/sdk
2
2
 
3
+ ## 0.3.16
4
+
5
+ ### Patch Changes
6
+
7
+ - bug fix
8
+
3
9
  ## 0.3.15
4
10
 
5
11
  ### Patch Changes
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 _a = yield storeClient.generateCheckoutPaymentSecret(clientSecret, checkoutId), { paymentSecret, publicKey, checkoutSession: newCheckout } = _a; __rest(_a, ["paymentSecret", "publicKey", "checkoutSession"]);
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 _a = yield storeClient.generateCheckoutPaymentSecret(clientSecret, checkoutId), { paymentSecret, publicKey, checkoutSession: newCheckout } = _a; __rest(_a, ["paymentSecret", "publicKey", "checkoutSession"]);
35593
+ const { paymentSecret, publicKey, checkoutSession: newCheckout, } = yield storeClient.generateCheckoutPaymentSecret(clientSecret, checkoutId);
35588
35594
  setPaymentSecret(paymentSecret);
35589
35595
  setPublicKey(publicKey);
35590
35596
  setCheckout(newCheckout);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/react",
3
- "version": "0.3.15",
3
+ "version": "0.3.16",
4
4
  "description": "E-commerce for Developers",
5
5
  "private": false,
6
6
  "publishConfig": {