@betterstore/react 0.3.13 → 0.3.14
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
|
@@ -19,4 +19,4 @@ export declare const useFormStore: import("zustand").UseBoundStore<Omit<import("
|
|
|
19
19
|
getOptions: () => Partial<import("zustand/middleware").PersistOptions<FormStore, FormStore>>;
|
|
20
20
|
};
|
|
21
21
|
}>;
|
|
22
|
-
export declare const resetFormStore: () => void;
|
|
22
|
+
export declare const resetFormStore: (formData: Partial<CheckoutFormData>) => void;
|
package/dist/index.cjs.js
CHANGED
|
@@ -35440,9 +35440,9 @@ const useFormStore = create()(persist((set) => ({
|
|
|
35440
35440
|
checkoutId: "",
|
|
35441
35441
|
setCheckoutId: (checkoutId) => set({ checkoutId }),
|
|
35442
35442
|
}), { name: `checkout` }));
|
|
35443
|
-
const resetFormStore = () => {
|
|
35443
|
+
const resetFormStore = (formData) => {
|
|
35444
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:
|
|
35445
|
+
localStorage.setItem("checkout", JSON.stringify(Object.assign(Object.assign({}, currentState), { state: Object.assign(Object.assign({}, currentState.state), { step: "customer", formData: { customer: formData.customer } }) })));
|
|
35446
35446
|
};
|
|
35447
35447
|
|
|
35448
35448
|
const motionSettings = {
|
|
@@ -35883,13 +35883,13 @@ function CheckoutEmbed({ checkoutId, config }) {
|
|
|
35883
35883
|
};
|
|
35884
35884
|
}, [checkoutId]); // Only re-run if checkoutId changes
|
|
35885
35885
|
const onSuccess = () => {
|
|
35886
|
-
resetFormStore();
|
|
35886
|
+
resetFormStore(formData);
|
|
35887
35887
|
if (successUrl) {
|
|
35888
35888
|
window.location.href = successUrl;
|
|
35889
35889
|
}
|
|
35890
35890
|
};
|
|
35891
35891
|
const onCancel = () => {
|
|
35892
|
-
resetFormStore();
|
|
35892
|
+
resetFormStore(formData);
|
|
35893
35893
|
if (cancelUrl) {
|
|
35894
35894
|
window.location.href = cancelUrl;
|
|
35895
35895
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -35417,9 +35417,9 @@ const useFormStore = create()(persist((set) => ({
|
|
|
35417
35417
|
checkoutId: "",
|
|
35418
35418
|
setCheckoutId: (checkoutId) => set({ checkoutId }),
|
|
35419
35419
|
}), { name: `checkout` }));
|
|
35420
|
-
const resetFormStore = () => {
|
|
35420
|
+
const resetFormStore = (formData) => {
|
|
35421
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:
|
|
35422
|
+
localStorage.setItem("checkout", JSON.stringify(Object.assign(Object.assign({}, currentState), { state: Object.assign(Object.assign({}, currentState.state), { step: "customer", formData: { customer: formData.customer } }) })));
|
|
35423
35423
|
};
|
|
35424
35424
|
|
|
35425
35425
|
const motionSettings = {
|
|
@@ -35860,13 +35860,13 @@ function CheckoutEmbed({ checkoutId, config }) {
|
|
|
35860
35860
|
};
|
|
35861
35861
|
}, [checkoutId]); // Only re-run if checkoutId changes
|
|
35862
35862
|
const onSuccess = () => {
|
|
35863
|
-
resetFormStore();
|
|
35863
|
+
resetFormStore(formData);
|
|
35864
35864
|
if (successUrl) {
|
|
35865
35865
|
window.location.href = successUrl;
|
|
35866
35866
|
}
|
|
35867
35867
|
};
|
|
35868
35868
|
const onCancel = () => {
|
|
35869
|
-
resetFormStore();
|
|
35869
|
+
resetFormStore(formData);
|
|
35870
35870
|
if (cancelUrl) {
|
|
35871
35871
|
window.location.href = cancelUrl;
|
|
35872
35872
|
}
|