@betterstore/react 0.3.11 → 0.3.13
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
package/dist/index.cjs.js
CHANGED
|
@@ -3286,7 +3286,8 @@ const CheckoutEmbed$2 = {
|
|
|
3286
3286
|
title: "Přeprava",
|
|
3287
3287
|
description: {
|
|
3288
3288
|
other: "Váš balíček bude doručen kurýrem.",
|
|
3289
|
-
zasilkovna: "Váš balíček bude doručen do bodu vyzvednutí."
|
|
3289
|
+
zasilkovna: "Váš balíček bude doručen do bodu vyzvednutí.",
|
|
3290
|
+
shippedTo: "Doručeno do:"
|
|
3290
3291
|
}
|
|
3291
3292
|
}
|
|
3292
3293
|
};
|
|
@@ -35439,6 +35440,10 @@ const useFormStore = create()(persist((set) => ({
|
|
|
35439
35440
|
checkoutId: "",
|
|
35440
35441
|
setCheckoutId: (checkoutId) => set({ checkoutId }),
|
|
35441
35442
|
}), { name: `checkout` }));
|
|
35443
|
+
const resetFormStore = () => {
|
|
35444
|
+
const currentState = JSON.parse(localStorage.getItem("checkout") || "{}");
|
|
35445
|
+
localStorage.setItem("checkout", JSON.stringify(Object.assign(Object.assign({}, currentState), { state: Object.assign(Object.assign({}, currentState.state), { step: "customer", formData: { customer: currentState.customer } }) })));
|
|
35446
|
+
};
|
|
35442
35447
|
|
|
35443
35448
|
const motionSettings = {
|
|
35444
35449
|
initial: { opacity: 0 },
|
|
@@ -35878,15 +35883,13 @@ function CheckoutEmbed({ checkoutId, config }) {
|
|
|
35878
35883
|
};
|
|
35879
35884
|
}, [checkoutId]); // Only re-run if checkoutId changes
|
|
35880
35885
|
const onSuccess = () => {
|
|
35881
|
-
|
|
35882
|
-
setFormData({ customer: formData.customer });
|
|
35886
|
+
resetFormStore();
|
|
35883
35887
|
if (successUrl) {
|
|
35884
35888
|
window.location.href = successUrl;
|
|
35885
35889
|
}
|
|
35886
35890
|
};
|
|
35887
35891
|
const onCancel = () => {
|
|
35888
|
-
|
|
35889
|
-
setFormData({ customer: formData.customer });
|
|
35892
|
+
resetFormStore();
|
|
35890
35893
|
if (cancelUrl) {
|
|
35891
35894
|
window.location.href = cancelUrl;
|
|
35892
35895
|
}
|
|
@@ -35909,7 +35912,6 @@ function CheckoutEmbed({ checkoutId, config }) {
|
|
|
35909
35912
|
setCheckout(newCheckout);
|
|
35910
35913
|
});
|
|
35911
35914
|
const removeDiscount = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
35912
|
-
console.log("storeclient method", storeClient);
|
|
35913
35915
|
const newCheckout = yield storeClient.removeDiscount(clientSecret, checkoutId, id);
|
|
35914
35916
|
setCheckout(newCheckout);
|
|
35915
35917
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -3263,7 +3263,8 @@ const CheckoutEmbed$2 = {
|
|
|
3263
3263
|
title: "Přeprava",
|
|
3264
3264
|
description: {
|
|
3265
3265
|
other: "Váš balíček bude doručen kurýrem.",
|
|
3266
|
-
zasilkovna: "Váš balíček bude doručen do bodu vyzvednutí."
|
|
3266
|
+
zasilkovna: "Váš balíček bude doručen do bodu vyzvednutí.",
|
|
3267
|
+
shippedTo: "Doručeno do:"
|
|
3267
3268
|
}
|
|
3268
3269
|
}
|
|
3269
3270
|
};
|
|
@@ -35416,6 +35417,10 @@ const useFormStore = create()(persist((set) => ({
|
|
|
35416
35417
|
checkoutId: "",
|
|
35417
35418
|
setCheckoutId: (checkoutId) => set({ checkoutId }),
|
|
35418
35419
|
}), { name: `checkout` }));
|
|
35420
|
+
const resetFormStore = () => {
|
|
35421
|
+
const currentState = JSON.parse(localStorage.getItem("checkout") || "{}");
|
|
35422
|
+
localStorage.setItem("checkout", JSON.stringify(Object.assign(Object.assign({}, currentState), { state: Object.assign(Object.assign({}, currentState.state), { step: "customer", formData: { customer: currentState.customer } }) })));
|
|
35423
|
+
};
|
|
35419
35424
|
|
|
35420
35425
|
const motionSettings = {
|
|
35421
35426
|
initial: { opacity: 0 },
|
|
@@ -35855,15 +35860,13 @@ function CheckoutEmbed({ checkoutId, config }) {
|
|
|
35855
35860
|
};
|
|
35856
35861
|
}, [checkoutId]); // Only re-run if checkoutId changes
|
|
35857
35862
|
const onSuccess = () => {
|
|
35858
|
-
|
|
35859
|
-
setFormData({ customer: formData.customer });
|
|
35863
|
+
resetFormStore();
|
|
35860
35864
|
if (successUrl) {
|
|
35861
35865
|
window.location.href = successUrl;
|
|
35862
35866
|
}
|
|
35863
35867
|
};
|
|
35864
35868
|
const onCancel = () => {
|
|
35865
|
-
|
|
35866
|
-
setFormData({ customer: formData.customer });
|
|
35869
|
+
resetFormStore();
|
|
35867
35870
|
if (cancelUrl) {
|
|
35868
35871
|
window.location.href = cancelUrl;
|
|
35869
35872
|
}
|
|
@@ -35886,7 +35889,6 @@ function CheckoutEmbed({ checkoutId, config }) {
|
|
|
35886
35889
|
setCheckout(newCheckout);
|
|
35887
35890
|
});
|
|
35888
35891
|
const removeDiscount = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
35889
|
-
console.log("storeclient method", storeClient);
|
|
35890
35892
|
const newCheckout = yield storeClient.removeDiscount(clientSecret, checkoutId, id);
|
|
35891
35893
|
setCheckout(newCheckout);
|
|
35892
35894
|
});
|