@betterstore/react 0.3.10 → 0.3.12

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,17 @@
1
1
  # @betterstore/sdk
2
2
 
3
+ ## 0.3.12
4
+
5
+ ### Patch Changes
6
+
7
+ - bug fix
8
+
9
+ ## 0.3.11
10
+
11
+ ### Patch Changes
12
+
13
+ - bug fix
14
+
3
15
  ## 0.3.10
4
16
 
5
17
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -35604,7 +35604,9 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
35604
35604
  };
35605
35605
  React.useEffect(() => {
35606
35606
  const asyncFunc = () => __awaiter(this, void 0, void 0, function* () {
35607
- const { paymentSecret, publicKey, checkoutSession: newCheckout, } = yield storeClient.generateCheckoutPaymentSecret(clientSecret, checkoutId);
35607
+ const _a = yield storeClient.generateCheckoutPaymentSecret(clientSecret, checkoutId), { paymentSecret, publicKey, checkoutSession: newCheckout } = _a, rest = __rest(_a, ["paymentSecret", "publicKey", "checkoutSession"]);
35608
+ console.log("newCheckout", newCheckout);
35609
+ console.log("rest", rest);
35608
35610
  setPaymentSecret(paymentSecret);
35609
35611
  setPublicKey(publicKey);
35610
35612
  setCheckout(newCheckout);
@@ -35701,7 +35703,7 @@ function CheckoutSummary({ appliedDiscounts, lineItems, shipping, tax, currency,
35701
35703
  return currentCombinations;
35702
35704
  return intersection.filter((combination) => currentCombinations.some((currentCombination) => JSON.stringify(currentCombination) === JSON.stringify(combination)));
35703
35705
  }, []);
35704
- const canCombine = sharedCombinations.length > 0;
35706
+ const canCombine = appliedDiscounts.length === 0 || sharedCombinations.length > 0;
35705
35707
  return (React.createElement("div", { className: "grid gap-5" },
35706
35708
  React.createElement("div", { className: "flex justify-between items-center" },
35707
35709
  React.createElement("div", { onClick: () => setIsOpen(!isOpen), className: "flex items-center gap-2 cursor-pointer" },
@@ -35876,15 +35878,17 @@ function CheckoutEmbed({ checkoutId, config }) {
35876
35878
  };
35877
35879
  }, [checkoutId]); // Only re-run if checkoutId changes
35878
35880
  const onSuccess = () => {
35879
- setStep("customer");
35880
- setFormData({ customer: formData.customer });
35881
+ // Update store state directly without triggering UI updates
35882
+ useFormStore.getState().setStep("customer");
35883
+ useFormStore.getState().setFormData({ customer: formData.customer });
35881
35884
  if (successUrl) {
35882
35885
  window.location.href = successUrl;
35883
35886
  }
35884
35887
  };
35885
35888
  const onCancel = () => {
35886
- setStep("customer");
35887
- setFormData({ customer: formData.customer });
35889
+ // Update store state directly without triggering UI updates
35890
+ useFormStore.getState().setStep("customer");
35891
+ useFormStore.getState().setFormData({ customer: formData.customer });
35888
35892
  if (cancelUrl) {
35889
35893
  window.location.href = cancelUrl;
35890
35894
  }
@@ -35907,7 +35911,6 @@ function CheckoutEmbed({ checkoutId, config }) {
35907
35911
  setCheckout(newCheckout);
35908
35912
  });
35909
35913
  const removeDiscount = (id) => __awaiter(this, void 0, void 0, function* () {
35910
- console.log("storeclient method", storeClient);
35911
35914
  const newCheckout = yield storeClient.removeDiscount(clientSecret, checkoutId, id);
35912
35915
  setCheckout(newCheckout);
35913
35916
  });
package/dist/index.mjs CHANGED
@@ -35581,7 +35581,9 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
35581
35581
  };
35582
35582
  useEffect(() => {
35583
35583
  const asyncFunc = () => __awaiter(this, void 0, void 0, function* () {
35584
- const { paymentSecret, publicKey, checkoutSession: newCheckout, } = yield storeClient.generateCheckoutPaymentSecret(clientSecret, checkoutId);
35584
+ const _a = yield storeClient.generateCheckoutPaymentSecret(clientSecret, checkoutId), { paymentSecret, publicKey, checkoutSession: newCheckout } = _a, rest = __rest(_a, ["paymentSecret", "publicKey", "checkoutSession"]);
35585
+ console.log("newCheckout", newCheckout);
35586
+ console.log("rest", rest);
35585
35587
  setPaymentSecret(paymentSecret);
35586
35588
  setPublicKey(publicKey);
35587
35589
  setCheckout(newCheckout);
@@ -35678,7 +35680,7 @@ function CheckoutSummary({ appliedDiscounts, lineItems, shipping, tax, currency,
35678
35680
  return currentCombinations;
35679
35681
  return intersection.filter((combination) => currentCombinations.some((currentCombination) => JSON.stringify(currentCombination) === JSON.stringify(combination)));
35680
35682
  }, []);
35681
- const canCombine = sharedCombinations.length > 0;
35683
+ const canCombine = appliedDiscounts.length === 0 || sharedCombinations.length > 0;
35682
35684
  return (React__default.createElement("div", { className: "grid gap-5" },
35683
35685
  React__default.createElement("div", { className: "flex justify-between items-center" },
35684
35686
  React__default.createElement("div", { onClick: () => setIsOpen(!isOpen), className: "flex items-center gap-2 cursor-pointer" },
@@ -35853,15 +35855,17 @@ function CheckoutEmbed({ checkoutId, config }) {
35853
35855
  };
35854
35856
  }, [checkoutId]); // Only re-run if checkoutId changes
35855
35857
  const onSuccess = () => {
35856
- setStep("customer");
35857
- setFormData({ customer: formData.customer });
35858
+ // Update store state directly without triggering UI updates
35859
+ useFormStore.getState().setStep("customer");
35860
+ useFormStore.getState().setFormData({ customer: formData.customer });
35858
35861
  if (successUrl) {
35859
35862
  window.location.href = successUrl;
35860
35863
  }
35861
35864
  };
35862
35865
  const onCancel = () => {
35863
- setStep("customer");
35864
- setFormData({ customer: formData.customer });
35866
+ // Update store state directly without triggering UI updates
35867
+ useFormStore.getState().setStep("customer");
35868
+ useFormStore.getState().setFormData({ customer: formData.customer });
35865
35869
  if (cancelUrl) {
35866
35870
  window.location.href = cancelUrl;
35867
35871
  }
@@ -35884,7 +35888,6 @@ function CheckoutEmbed({ checkoutId, config }) {
35884
35888
  setCheckout(newCheckout);
35885
35889
  });
35886
35890
  const removeDiscount = (id) => __awaiter(this, void 0, void 0, function* () {
35887
- console.log("storeclient method", storeClient);
35888
35891
  const newCheckout = yield storeClient.removeDiscount(clientSecret, checkoutId, id);
35889
35892
  setCheckout(newCheckout);
35890
35893
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/react",
3
- "version": "0.3.10",
3
+ "version": "0.3.12",
4
4
  "description": "E-commerce for Developers",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -19,7 +19,7 @@
19
19
  "author": "Better Store",
20
20
  "license": "MIT",
21
21
  "devDependencies": {
22
- "@betterstore/sdk": "^0.3.61",
22
+ "@betterstore/sdk": "^0.3.62",
23
23
  "@changesets/cli": "^2.28.1",
24
24
  "@rollup/plugin-commonjs": "^28.0.3",
25
25
  "@rollup/plugin-json": "^6.1.0",