flowrix 1.0.1-beta.103 → 1.0.1-beta.105
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/dist/module.json +1 -1
- package/dist/runtime/composables/Cart/useCartComponent.js +5 -4
- package/dist/runtime/composables/Checkout/PaymentMethods/useDirectDeposit.js +8 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useEway.js +8 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useFlowrixpay.js +8 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useOpayo.js +8 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/usePaypal.js +8 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useStripe.js +8 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useZippay.js +8 -0
- package/dist/runtime/composables/Customer/useRegister.d.ts +2 -3
- package/dist/runtime/composables/Customer/useRegister.js +23 -23
- package/dist/runtime/composables/Customer/useUpdatePassword.js +56 -20
- package/dist/runtime/composables/useWebforms.d.ts +38 -9
- package/dist/runtime/composables/useWebforms.js +93 -60
- package/dist/runtime/server/api/cart/related.d.ts +1 -1
- package/dist/runtime/server/api/cart/related.js +1 -0
- package/dist/runtime/server/api/cart/remove.d.ts +1 -1
- package/dist/runtime/server/api/cart/remove.js +1 -0
- package/dist/runtime/stores/auth.js +16 -21
- package/dist/runtime/stores/webforms.d.ts +24 -9
- package/dist/runtime/stores/webforms.js +105 -5
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { useCartStore } from "../../stores/Cart.js";
|
|
1
2
|
import { GTM_view_cart } from "../useDataLayer.js";
|
|
2
3
|
import { META_view_cart } from "../useMetaLayer.js";
|
|
3
4
|
import { TikTok_view_cart } from "../useTikTokDatalayer.js";
|
|
4
5
|
export const useCartComponent = async () => {
|
|
5
6
|
const cartStore = useCartStore();
|
|
6
|
-
const
|
|
7
|
-
GTM_view_cart(
|
|
8
|
-
META_view_cart(
|
|
9
|
-
TikTok_view_cart(
|
|
7
|
+
const cart = cartStore.cart;
|
|
8
|
+
GTM_view_cart(cart);
|
|
9
|
+
META_view_cart(cart);
|
|
10
|
+
TikTok_view_cart(cart);
|
|
10
11
|
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { useCheckoutStore } from "../../../stores/Checkout.js";
|
|
2
|
+
import { useCartStore } from "../../../stores/Cart.js";
|
|
3
|
+
import { GTM_add_payment_info } from "../../useDataLayer.js";
|
|
4
|
+
import { META_add_payment_info } from "../../useMetaLayer.js";
|
|
5
|
+
import { TikTok_add_payment_info } from "../../useTikTokDatalayer.js";
|
|
2
6
|
export default function() {
|
|
3
7
|
const checkoutStore = useCheckoutStore();
|
|
4
8
|
const getpaymentMethod = async (paymentMethod, inputData, totalPrice) => {
|
|
@@ -12,6 +16,10 @@ export default function() {
|
|
|
12
16
|
});
|
|
13
17
|
}
|
|
14
18
|
checkoutStore.saveToCheckoutSession(inputData);
|
|
19
|
+
const cartData = useCartStore().cart;
|
|
20
|
+
GTM_add_payment_info(cartData, "Direct Deposit");
|
|
21
|
+
META_add_payment_info(cartData, "Direct Deposit");
|
|
22
|
+
TikTok_add_payment_info(cartData, "Direct Deposit");
|
|
15
23
|
} catch (error) {
|
|
16
24
|
console.log("Error", error);
|
|
17
25
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { useCheckoutStore } from "../../../stores/Checkout.js";
|
|
2
|
+
import { useCartStore } from "../../../stores/Cart.js";
|
|
3
|
+
import { GTM_add_payment_info } from "../../useDataLayer.js";
|
|
4
|
+
import { META_add_payment_info } from "../../useMetaLayer.js";
|
|
5
|
+
import { TikTok_add_payment_info } from "../../useTikTokDatalayer.js";
|
|
2
6
|
export default function() {
|
|
3
7
|
const checkoutStore = useCheckoutStore();
|
|
4
8
|
const getpaymentMethod = async (paymentMethod, inputData, totalPrice) => {
|
|
@@ -13,6 +17,10 @@ export default function() {
|
|
|
13
17
|
inputData.ewayKey = checkoutStore.publishableKey.key;
|
|
14
18
|
}
|
|
15
19
|
checkoutStore.saveToCheckoutSession(inputData);
|
|
20
|
+
const cartData = useCartStore().cart;
|
|
21
|
+
GTM_add_payment_info(cartData, "Eway");
|
|
22
|
+
META_add_payment_info(cartData, "Eway");
|
|
23
|
+
TikTok_add_payment_info(cartData, "Eway");
|
|
16
24
|
} catch (error) {
|
|
17
25
|
console.log("Error", error);
|
|
18
26
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { useCheckoutStore } from "../../../stores/Checkout.js";
|
|
2
2
|
import { useAuthStore } from "../../../stores/auth.js";
|
|
3
|
+
import { useCartStore } from "../../../stores/Cart.js";
|
|
4
|
+
import { GTM_add_payment_info } from "../../useDataLayer.js";
|
|
5
|
+
import { META_add_payment_info } from "../../useMetaLayer.js";
|
|
6
|
+
import { TikTok_add_payment_info } from "../../useTikTokDatalayer.js";
|
|
3
7
|
export default function() {
|
|
4
8
|
const checkoutStore = useCheckoutStore();
|
|
5
9
|
const { user } = useAuthStore();
|
|
@@ -113,6 +117,10 @@ export default function() {
|
|
|
113
117
|
});
|
|
114
118
|
}
|
|
115
119
|
checkoutStore.saveToCheckoutSession(inputData);
|
|
120
|
+
const cartData = useCartStore().cart;
|
|
121
|
+
GTM_add_payment_info(cartData, "Flowrix Pay");
|
|
122
|
+
META_add_payment_info(cartData, "Flowrix Pay");
|
|
123
|
+
TikTok_add_payment_info(cartData, "Flowrix Pay");
|
|
116
124
|
} catch (error) {
|
|
117
125
|
console.log("Error", error);
|
|
118
126
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { useCheckoutStore } from "../../../stores/Checkout.js";
|
|
2
2
|
import { useAuthStore } from "../../../stores/auth.js";
|
|
3
|
+
import { useCartStore } from "../../../stores/Cart.js";
|
|
4
|
+
import { GTM_add_payment_info } from "../../useDataLayer.js";
|
|
5
|
+
import { META_add_payment_info } from "../../useMetaLayer.js";
|
|
6
|
+
import { TikTok_add_payment_info } from "../../useTikTokDatalayer.js";
|
|
3
7
|
export default function() {
|
|
4
8
|
const checkoutStore = useCheckoutStore();
|
|
5
9
|
const { user } = useAuthStore();
|
|
@@ -15,6 +19,10 @@ export default function() {
|
|
|
15
19
|
inputData.opayoKey = checkoutStore.publishableKey.key;
|
|
16
20
|
}
|
|
17
21
|
checkoutStore.saveToCheckoutSession(inputData);
|
|
22
|
+
const cartData = useCartStore().cart;
|
|
23
|
+
GTM_add_payment_info(cartData, "Opayo");
|
|
24
|
+
META_add_payment_info(cartData, "Opayo");
|
|
25
|
+
TikTok_add_payment_info(cartData, "Opayo");
|
|
18
26
|
} catch (error) {
|
|
19
27
|
console.log("Error", error);
|
|
20
28
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { useCheckoutStore } from "../../../stores/Checkout.js";
|
|
2
|
+
import { useCartStore } from "../../../stores/Cart.js";
|
|
3
|
+
import { GTM_add_payment_info } from "../../useDataLayer.js";
|
|
4
|
+
import { META_add_payment_info } from "../../useMetaLayer.js";
|
|
5
|
+
import { TikTok_add_payment_info } from "../../useTikTokDatalayer.js";
|
|
2
6
|
export default function() {
|
|
3
7
|
const checkoutStore = useCheckoutStore();
|
|
4
8
|
const getpaymentMethod = async (paymentMethod, inputData, totalPrice) => {
|
|
@@ -12,6 +16,10 @@ export default function() {
|
|
|
12
16
|
});
|
|
13
17
|
}
|
|
14
18
|
checkoutStore.saveToCheckoutSession(inputData);
|
|
19
|
+
const cartData = useCartStore().cart;
|
|
20
|
+
GTM_add_payment_info(cartData, "Paypal");
|
|
21
|
+
META_add_payment_info(cartData, "Paypal");
|
|
22
|
+
TikTok_add_payment_info(cartData, "Paypal");
|
|
15
23
|
} catch (error) {
|
|
16
24
|
console.log("Error", error);
|
|
17
25
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { loadStripe } from "@stripe/stripe-js";
|
|
2
2
|
import { useCheckoutStore } from "../../../stores/Checkout.js";
|
|
3
|
+
import { useCartStore } from "../../../stores/Cart.js";
|
|
4
|
+
import { GTM_add_payment_info } from "../../useDataLayer.js";
|
|
5
|
+
import { META_add_payment_info } from "../../useMetaLayer.js";
|
|
6
|
+
import { TikTok_add_payment_info } from "../../useTikTokDatalayer.js";
|
|
3
7
|
let stripe = null;
|
|
4
8
|
let elements = null;
|
|
5
9
|
export default function() {
|
|
@@ -26,6 +30,10 @@ export default function() {
|
|
|
26
30
|
cardElement.mount("#card-element");
|
|
27
31
|
}
|
|
28
32
|
checkoutStore.saveToCheckoutSession(inputData);
|
|
33
|
+
const cartData = useCartStore().cart;
|
|
34
|
+
GTM_add_payment_info(cartData, "Stripe");
|
|
35
|
+
META_add_payment_info(cartData, "Stripe");
|
|
36
|
+
TikTok_add_payment_info(cartData, "Stripe");
|
|
29
37
|
} catch (error) {
|
|
30
38
|
console.log("Error", error);
|
|
31
39
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { useCheckoutStore } from "../../../stores/Checkout.js";
|
|
2
|
+
import { useCartStore } from "../../../stores/Cart.js";
|
|
3
|
+
import { GTM_add_payment_info } from "../../useDataLayer.js";
|
|
4
|
+
import { META_add_payment_info } from "../../useMetaLayer.js";
|
|
5
|
+
import { TikTok_add_payment_info } from "../../useTikTokDatalayer.js";
|
|
2
6
|
export default function() {
|
|
3
7
|
const checkoutStore = useCheckoutStore();
|
|
4
8
|
const getpaymentMethod = async (paymentMethod, inputData, totalPrice) => {
|
|
@@ -12,6 +16,10 @@ export default function() {
|
|
|
12
16
|
});
|
|
13
17
|
}
|
|
14
18
|
checkoutStore.saveToCheckoutSession(inputData);
|
|
19
|
+
const cartData = useCartStore().cart;
|
|
20
|
+
GTM_add_payment_info(cartData, "Zippay");
|
|
21
|
+
META_add_payment_info(cartData, "Zippay");
|
|
22
|
+
TikTok_add_payment_info(cartData, "Zippay");
|
|
15
23
|
} catch (error) {
|
|
16
24
|
console.log("Error", error);
|
|
17
25
|
}
|
|
@@ -101,7 +101,6 @@ export default function (countries: any): {
|
|
|
101
101
|
shipping_mobile: string;
|
|
102
102
|
subscribe: boolean;
|
|
103
103
|
}>;
|
|
104
|
-
CustomerRegister: (registerFields: any) => Promise<void>;
|
|
105
104
|
regResponse: import("vue").Ref<null, null>;
|
|
106
105
|
isBusinessAccount: import("vue").Ref<boolean, boolean>;
|
|
107
106
|
companyName: import("vue").Ref<string, string>;
|
|
@@ -117,9 +116,9 @@ export default function (countries: any): {
|
|
|
117
116
|
toggleConfirmPassword: () => void;
|
|
118
117
|
handleSameAsCustomerDetails: () => void;
|
|
119
118
|
alertMessage: import("vue").Ref<string, string>;
|
|
120
|
-
alertType: import("vue").Ref<
|
|
119
|
+
alertType: import("vue").Ref<string, string>;
|
|
121
120
|
showAlert: import("vue").Ref<boolean, boolean>;
|
|
122
|
-
displayAlert: (message:
|
|
121
|
+
displayAlert: (message: any, type: any) => void;
|
|
123
122
|
dismissAlert: () => void;
|
|
124
123
|
handleSignup: () => Promise<void>;
|
|
125
124
|
initializeShippingData: () => void;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ref, watch } from "vue";
|
|
2
2
|
import { useRouter, useRoute } from "#vue-router";
|
|
3
3
|
import { useAuthStore } from "../../stores/auth.js";
|
|
4
|
-
import useLogin from "./useLogin.js";
|
|
5
4
|
export default function(countries) {
|
|
6
5
|
const router = useRouter();
|
|
7
6
|
const route = useRoute();
|
|
8
|
-
const
|
|
7
|
+
const authStore = useAuthStore();
|
|
9
8
|
const inputData = ref({
|
|
10
9
|
abn: "",
|
|
11
10
|
addresses: [],
|
|
@@ -41,9 +40,6 @@ export default function(countries) {
|
|
|
41
40
|
subscribe: false
|
|
42
41
|
});
|
|
43
42
|
const regResponse = ref(null);
|
|
44
|
-
const CustomerRegister = (async (registerFields) => {
|
|
45
|
-
regResponse.value = await useAuthStore().signUp(registerFields);
|
|
46
|
-
});
|
|
47
43
|
const isBusinessAccount = ref(false);
|
|
48
44
|
const companyName = ref("");
|
|
49
45
|
const abn = ref("");
|
|
@@ -148,10 +144,15 @@ export default function(countries) {
|
|
|
148
144
|
}
|
|
149
145
|
});
|
|
150
146
|
watch(() => inputData.value.address, (newAddress) => {
|
|
151
|
-
if (sameAsCustomerDetails.value && newAddress) {
|
|
147
|
+
if (sameAsCustomerDetails.value && newAddress && !isBusinessAccount.value) {
|
|
152
148
|
inputData.value.shipping_address = newAddress;
|
|
153
149
|
}
|
|
154
150
|
});
|
|
151
|
+
watch(() => address.value, (newBusinessAddress) => {
|
|
152
|
+
if (sameAsCustomerDetails.value && newBusinessAddress && isBusinessAccount.value) {
|
|
153
|
+
inputData.value.shipping_address = newBusinessAddress;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
155
156
|
watch(() => inputData.value.mobile, (newMobile) => {
|
|
156
157
|
if (sameAsCustomerDetails.value && newMobile) {
|
|
157
158
|
inputData.value.shipping_mobile = newMobile;
|
|
@@ -167,18 +168,14 @@ export default function(countries) {
|
|
|
167
168
|
inputData.value.shipping_state = newState;
|
|
168
169
|
}
|
|
169
170
|
});
|
|
170
|
-
watch(isBusinessAccount, (
|
|
171
|
+
watch(isBusinessAccount, () => {
|
|
171
172
|
if (sameAsCustomerDetails.value) {
|
|
172
173
|
handleSameAsCustomerDetails();
|
|
173
174
|
}
|
|
174
175
|
});
|
|
175
|
-
watch(logResponse, (newres) => {
|
|
176
|
-
if (newres?.status == "Success") {
|
|
177
|
-
router.push({ name: "dashboard-profile" });
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
176
|
const handleSignup = async () => {
|
|
181
177
|
isLoading.value = true;
|
|
178
|
+
dismissAlert();
|
|
182
179
|
inputData.value.billing_mobile = inputData.value.mobile;
|
|
183
180
|
inputData.value.billing_address = inputData.value.address;
|
|
184
181
|
inputData.value.billing_firstname = inputData.value.firstname;
|
|
@@ -210,14 +207,16 @@ export default function(countries) {
|
|
|
210
207
|
inputData.value.shipping_town = inputData.value.shipping_suburb;
|
|
211
208
|
}
|
|
212
209
|
}
|
|
213
|
-
await
|
|
210
|
+
regResponse.value = await authStore.signUp(inputData.value);
|
|
214
211
|
if (!regResponse.value || regResponse.value.status !== "Success") {
|
|
215
212
|
let errorMsg = "Registration failed. Please try again.";
|
|
216
213
|
if (regResponse.value?.message) {
|
|
217
214
|
if (typeof regResponse.value.message === "string") {
|
|
218
215
|
errorMsg = regResponse.value.message;
|
|
219
216
|
} else if (typeof regResponse.value.message === "object") {
|
|
220
|
-
const fieldErrors = Object.entries(regResponse.value.message).flatMap(
|
|
217
|
+
const fieldErrors = Object.entries(regResponse.value.message).flatMap(
|
|
218
|
+
([field, errors]) => (errors || []).map((err) => `${field.charAt(0).toUpperCase() + field.slice(1)}: ${err}`)
|
|
219
|
+
);
|
|
221
220
|
errorMsg = fieldErrors.length > 0 ? fieldErrors.join("\n") : errorMsg;
|
|
222
221
|
}
|
|
223
222
|
} else if (!regResponse.value) {
|
|
@@ -231,10 +230,13 @@ export default function(countries) {
|
|
|
231
230
|
email: inputData.value.email,
|
|
232
231
|
password: inputData.value.password
|
|
233
232
|
};
|
|
234
|
-
|
|
235
|
-
if (!
|
|
236
|
-
const errorMsg =
|
|
237
|
-
displayAlert(
|
|
233
|
+
const loginResult = await authStore.userLogin(loginCredentials);
|
|
234
|
+
if (!loginResult || loginResult.status !== "Success") {
|
|
235
|
+
const errorMsg = loginResult?.message ? typeof loginResult.message === "string" ? loginResult.message : "Auto-login failed." : "Auto-login failed. Please login manually.";
|
|
236
|
+
displayAlert(`Registration successful! However, ${errorMsg} Redirecting to login page...`, "danger");
|
|
237
|
+
setTimeout(() => {
|
|
238
|
+
router.push({ name: "customer-account-login" });
|
|
239
|
+
}, 3e3);
|
|
238
240
|
isLoading.value = false;
|
|
239
241
|
return;
|
|
240
242
|
}
|
|
@@ -242,11 +244,11 @@ export default function(countries) {
|
|
|
242
244
|
displayAlert(successMsg, "success");
|
|
243
245
|
resetForm();
|
|
244
246
|
setTimeout(() => {
|
|
245
|
-
router.push("
|
|
246
|
-
},
|
|
247
|
+
router.push({ name: "dashboard-profile" });
|
|
248
|
+
}, 1500);
|
|
247
249
|
} catch (error) {
|
|
248
250
|
console.error("Registration Error:", error);
|
|
249
|
-
const errorMsg = error
|
|
251
|
+
const errorMsg = error?.message || error?.data?.message || "An unexpected error occurred. Please try again.";
|
|
250
252
|
displayAlert(errorMsg, "danger");
|
|
251
253
|
} finally {
|
|
252
254
|
isLoading.value = false;
|
|
@@ -297,7 +299,6 @@ export default function(countries) {
|
|
|
297
299
|
router,
|
|
298
300
|
route,
|
|
299
301
|
inputData,
|
|
300
|
-
CustomerRegister,
|
|
301
302
|
regResponse,
|
|
302
303
|
isBusinessAccount,
|
|
303
304
|
companyName,
|
|
@@ -319,7 +320,6 @@ export default function(countries) {
|
|
|
319
320
|
dismissAlert,
|
|
320
321
|
handleSignup,
|
|
321
322
|
initializeShippingData,
|
|
322
|
-
// Make sure this is returned
|
|
323
323
|
resetForm
|
|
324
324
|
};
|
|
325
325
|
}
|
|
@@ -22,23 +22,57 @@ export function useUpdatePassword() {
|
|
|
22
22
|
};
|
|
23
23
|
clearMessages();
|
|
24
24
|
};
|
|
25
|
+
const formatApiError = (message) => {
|
|
26
|
+
if (typeof message === "string") {
|
|
27
|
+
return message;
|
|
28
|
+
}
|
|
29
|
+
if (typeof message === "object" && message !== null) {
|
|
30
|
+
const errors = [];
|
|
31
|
+
Object.entries(message).forEach(([field, fieldErrors]) => {
|
|
32
|
+
const fieldName = field.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
|
|
33
|
+
if (Array.isArray(fieldErrors)) {
|
|
34
|
+
fieldErrors.forEach((error) => {
|
|
35
|
+
errors.push(`${fieldName}: ${error}`);
|
|
36
|
+
});
|
|
37
|
+
} else {
|
|
38
|
+
errors.push(`${fieldName}: ${fieldErrors}`);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return errors.join("\n");
|
|
42
|
+
}
|
|
43
|
+
return "An error occurred";
|
|
44
|
+
};
|
|
25
45
|
const validateForm = () => {
|
|
26
|
-
|
|
27
|
-
|
|
46
|
+
clearMessages();
|
|
47
|
+
if (!form.value.currentPassword?.trim()) {
|
|
48
|
+
errorMessage.value = "Current password is required!";
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
if (!form.value.newPassword?.trim()) {
|
|
52
|
+
errorMessage.value = "New password is required!";
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
if (!form.value.confirmPassword?.trim()) {
|
|
56
|
+
errorMessage.value = "Please confirm your new password!";
|
|
28
57
|
return false;
|
|
29
58
|
}
|
|
30
59
|
if (form.value.newPassword !== form.value.confirmPassword) {
|
|
31
60
|
errorMessage.value = "New password and confirm password do not match!";
|
|
32
61
|
return false;
|
|
33
62
|
}
|
|
34
|
-
if (form.value.newPassword.length <
|
|
35
|
-
errorMessage.value = "New password must be at least
|
|
63
|
+
if (form.value.newPassword.length < 6) {
|
|
64
|
+
errorMessage.value = "New password must be at least 6 characters long!";
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
if (form.value.currentPassword === form.value.newPassword) {
|
|
68
|
+
errorMessage.value = "New password must be different from current password!";
|
|
36
69
|
return false;
|
|
37
70
|
}
|
|
38
71
|
return true;
|
|
39
72
|
};
|
|
40
73
|
const updatePassword = async () => {
|
|
41
74
|
if (!validateForm()) {
|
|
75
|
+
console.log("Validation failed:", errorMessage.value);
|
|
42
76
|
return false;
|
|
43
77
|
}
|
|
44
78
|
loading.value = true;
|
|
@@ -50,34 +84,36 @@ export function useUpdatePassword() {
|
|
|
50
84
|
password_confirmation: form.value.confirmPassword.trim()
|
|
51
85
|
};
|
|
52
86
|
const response = await authStore.changePassword(requestBody);
|
|
53
|
-
if (response
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return
|
|
87
|
+
if (!response) {
|
|
88
|
+
console.log("No response received");
|
|
89
|
+
errorMessage.value = "No response received from server. Please try again.";
|
|
90
|
+
return false;
|
|
57
91
|
}
|
|
58
|
-
if (response) {
|
|
92
|
+
if (response.status === "Success") {
|
|
59
93
|
successMessage.value = response.message || "Password updated successfully!";
|
|
60
|
-
|
|
94
|
+
setTimeout(() => {
|
|
95
|
+
resetForm();
|
|
96
|
+
}, 7e3);
|
|
97
|
+
setTimeout(() => {
|
|
98
|
+
successMessage.value = "";
|
|
99
|
+
}, 2e3);
|
|
61
100
|
return true;
|
|
62
|
-
} else if (response
|
|
63
|
-
|
|
101
|
+
} else if (response.status === "Error") {
|
|
102
|
+
console.log("Error response:", response.message);
|
|
103
|
+
errorMessage.value = formatApiError(response.message);
|
|
64
104
|
return false;
|
|
65
105
|
} else {
|
|
106
|
+
console.log("Unexpected response format:", response);
|
|
66
107
|
errorMessage.value = "Unexpected response from server. Please try again.";
|
|
67
108
|
return false;
|
|
68
109
|
}
|
|
69
110
|
} catch (err) {
|
|
70
|
-
console.error("
|
|
71
|
-
|
|
72
|
-
errorMessage.value = err.data.message || "Failed to update password. Please try again.";
|
|
73
|
-
} else if (err.message) {
|
|
74
|
-
errorMessage.value = err.message;
|
|
75
|
-
} else {
|
|
76
|
-
errorMessage.value = "An unexpected error occurred while updating your password.";
|
|
77
|
-
}
|
|
111
|
+
console.error("Caught error:", err);
|
|
112
|
+
errorMessage.value = "An unexpected error occurred. Please try again.";
|
|
78
113
|
return false;
|
|
79
114
|
} finally {
|
|
80
115
|
loading.value = false;
|
|
116
|
+
console.log("Final state - Error:", errorMessage.value, "Success:", successMessage.value);
|
|
81
117
|
}
|
|
82
118
|
};
|
|
83
119
|
return {
|
|
@@ -1,16 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface ApiResponse<T> {
|
|
3
|
-
status: string;
|
|
4
|
-
message: string | Record<string, string[]> | null;
|
|
5
|
-
data: T | null;
|
|
6
|
-
}
|
|
1
|
+
import type { WebForm, WebFormSubmission, WebFormResponse } from '../stores/webforms.js';
|
|
7
2
|
export declare function useWebforms(): {
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
showSuccessModal: import("vue").Ref<boolean, boolean>;
|
|
4
|
+
currentFormData: import("vue").Ref<{
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
recaptcha: string;
|
|
7
|
+
} | null, WebFormSubmission | {
|
|
8
|
+
[x: string]: any;
|
|
9
|
+
recaptcha: string;
|
|
10
|
+
} | null>;
|
|
11
|
+
recaptchaToken: import("vue").Ref<string, string>;
|
|
12
|
+
formLoading: import("vue").Ref<boolean, boolean>;
|
|
10
13
|
webform: import("vue").ComputedRef<{
|
|
11
14
|
id: number;
|
|
15
|
+
title: string;
|
|
16
|
+
description?: string | undefined;
|
|
17
|
+
fields: {
|
|
18
|
+
id: number;
|
|
19
|
+
name: string;
|
|
20
|
+
label: string;
|
|
21
|
+
type: string;
|
|
22
|
+
required: boolean;
|
|
23
|
+
options?: string[] | undefined;
|
|
24
|
+
validation?: string | undefined;
|
|
25
|
+
placeholder?: string | undefined;
|
|
26
|
+
}[];
|
|
27
|
+
success_message?: string | undefined;
|
|
28
|
+
} | null>;
|
|
29
|
+
webFormReturn: import("vue").ComputedRef<{
|
|
30
|
+
status: string;
|
|
31
|
+
message: string;
|
|
32
|
+
data: any | null;
|
|
12
33
|
} | null>;
|
|
13
|
-
webFormReturn: import("vue").ComputedRef<any>;
|
|
14
34
|
loading: import("vue").ComputedRef<boolean>;
|
|
15
35
|
error: import("vue").ComputedRef<string | null>;
|
|
36
|
+
clearMessages: () => void;
|
|
37
|
+
fetchWebform: (id: number) => Promise<WebForm | null>;
|
|
38
|
+
initFormSubmission: (formData: WebFormSubmission) => void;
|
|
39
|
+
submitInquiry: (formData: WebFormSubmission) => Promise<WebFormResponse>;
|
|
40
|
+
setRecaptchaToken: (token: string) => void;
|
|
41
|
+
closeSuccessModal: () => void;
|
|
42
|
+
resetForm: () => void;
|
|
43
|
+
autoClearMessages: () => void;
|
|
44
|
+
isFormValid: (formData: WebFormSubmission) => boolean;
|
|
16
45
|
};
|
|
@@ -1,75 +1,108 @@
|
|
|
1
|
-
import { computed } from "vue";
|
|
1
|
+
import { ref, computed } from "vue";
|
|
2
2
|
import { useWebformsStore } from "../stores/webforms.js";
|
|
3
|
-
import { useApi } from "../utils/api.js";
|
|
4
|
-
function formatErrorMessage(message) {
|
|
5
|
-
if (!message) return "An error occurred";
|
|
6
|
-
if (typeof message === "string") {
|
|
7
|
-
return message;
|
|
8
|
-
}
|
|
9
|
-
const errorMessages = [];
|
|
10
|
-
for (const [field, errors] of Object.entries(message)) {
|
|
11
|
-
if (Array.isArray(errors)) {
|
|
12
|
-
errorMessages.push(...errors);
|
|
13
|
-
} else {
|
|
14
|
-
errorMessages.push(String(errors));
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return errorMessages.join(", ");
|
|
18
|
-
}
|
|
19
3
|
export function useWebforms() {
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
4
|
+
const webformsStore = useWebformsStore();
|
|
5
|
+
const showSuccessModal = ref(false);
|
|
6
|
+
const currentFormData = ref(null);
|
|
7
|
+
const recaptchaToken = ref("");
|
|
8
|
+
const formLoading = ref(false);
|
|
9
|
+
const webform = computed(() => webformsStore.webform);
|
|
10
|
+
const webFormReturn = computed(() => webformsStore.webFormReturn);
|
|
11
|
+
const loading = computed(() => webformsStore.loading);
|
|
12
|
+
const error = computed(() => webformsStore.error);
|
|
13
|
+
const clearMessages = () => {
|
|
14
|
+
webformsStore.clearWebFormReturn();
|
|
15
|
+
webformsStore.clearError();
|
|
16
|
+
};
|
|
17
|
+
const fetchWebform = async (id) => {
|
|
18
|
+
clearMessages();
|
|
19
|
+
formLoading.value = true;
|
|
25
20
|
try {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
store.setWebform(response.data);
|
|
29
|
-
return response;
|
|
30
|
-
} else {
|
|
31
|
-
const errorMessage = formatErrorMessage(response.message);
|
|
32
|
-
store.setError(errorMessage);
|
|
33
|
-
throw new Error(errorMessage);
|
|
34
|
-
}
|
|
35
|
-
} catch (error) {
|
|
36
|
-
console.error("Fetch webform error:", error);
|
|
37
|
-
const errorMessage = error.data ? formatErrorMessage(error.data.message) : error.message || "Failed to fetch webform";
|
|
38
|
-
store.setError(errorMessage);
|
|
39
|
-
throw new Error(errorMessage);
|
|
21
|
+
const result = await webformsStore.fetchWebform(id);
|
|
22
|
+
return result;
|
|
40
23
|
} finally {
|
|
41
|
-
|
|
24
|
+
formLoading.value = false;
|
|
42
25
|
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
26
|
+
};
|
|
27
|
+
const initFormSubmission = (formData) => {
|
|
28
|
+
clearMessages();
|
|
29
|
+
currentFormData.value = formData;
|
|
30
|
+
showSuccessModal.value = false;
|
|
31
|
+
};
|
|
32
|
+
const submitInquiry = async (formData) => {
|
|
33
|
+
formLoading.value = true;
|
|
34
|
+
clearMessages();
|
|
47
35
|
try {
|
|
48
|
-
const
|
|
49
|
-
|
|
36
|
+
const submissionData = {
|
|
37
|
+
...formData,
|
|
38
|
+
recaptcha: recaptchaToken.value || formData.recaptcha
|
|
39
|
+
};
|
|
40
|
+
const response = await webformsStore.submitInquiry(submissionData);
|
|
50
41
|
if (response.status === "Success") {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const errorMessage = formatErrorMessage(response.message);
|
|
55
|
-
store.setError(errorMessage);
|
|
56
|
-
throw new Error(errorMessage);
|
|
42
|
+
showSuccessModal.value = true;
|
|
43
|
+
currentFormData.value = null;
|
|
44
|
+
recaptchaToken.value = "";
|
|
57
45
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
46
|
+
return response;
|
|
47
|
+
} catch (error2) {
|
|
48
|
+
console.error("Submit inquiry error:", error2);
|
|
49
|
+
return {
|
|
50
|
+
status: "Error",
|
|
51
|
+
message: error2.message || "Submission failed",
|
|
52
|
+
data: null
|
|
53
|
+
};
|
|
63
54
|
} finally {
|
|
64
|
-
|
|
55
|
+
formLoading.value = false;
|
|
65
56
|
}
|
|
66
|
-
}
|
|
57
|
+
};
|
|
58
|
+
const setRecaptchaToken = (token) => {
|
|
59
|
+
recaptchaToken.value = token;
|
|
60
|
+
};
|
|
61
|
+
const closeSuccessModal = () => {
|
|
62
|
+
showSuccessModal.value = false;
|
|
63
|
+
clearMessages();
|
|
64
|
+
};
|
|
65
|
+
const resetForm = () => {
|
|
66
|
+
currentFormData.value = null;
|
|
67
|
+
recaptchaToken.value = "";
|
|
68
|
+
clearMessages();
|
|
69
|
+
showSuccessModal.value = false;
|
|
70
|
+
};
|
|
71
|
+
const autoClearMessages = () => {
|
|
72
|
+
if (webFormReturn.value?.status !== void 0 || error.value) {
|
|
73
|
+
setTimeout(() => {
|
|
74
|
+
clearMessages();
|
|
75
|
+
}, 5e3);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const isFormValid = (formData) => {
|
|
79
|
+
if (!webform.value) return false;
|
|
80
|
+
const requiredFields = webform.value.fields.filter((field) => field.required);
|
|
81
|
+
return requiredFields.every((field) => {
|
|
82
|
+
const value = formData[field.name];
|
|
83
|
+
return value !== void 0 && value !== null && value !== "";
|
|
84
|
+
});
|
|
85
|
+
};
|
|
67
86
|
return {
|
|
87
|
+
// State
|
|
88
|
+
showSuccessModal,
|
|
89
|
+
currentFormData,
|
|
90
|
+
recaptchaToken,
|
|
91
|
+
formLoading,
|
|
92
|
+
// Computed
|
|
93
|
+
webform,
|
|
94
|
+
webFormReturn,
|
|
95
|
+
loading,
|
|
96
|
+
error,
|
|
97
|
+
// Methods
|
|
98
|
+
clearMessages,
|
|
68
99
|
fetchWebform,
|
|
100
|
+
initFormSubmission,
|
|
69
101
|
submitInquiry,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
102
|
+
setRecaptchaToken,
|
|
103
|
+
closeSuccessModal,
|
|
104
|
+
resetForm,
|
|
105
|
+
autoClearMessages,
|
|
106
|
+
isFormValid
|
|
74
107
|
};
|
|
75
108
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<
|
|
1
|
+
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<unknown>>;
|
|
2
2
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useRuntimeConfig } from "#imports";
|
|
2
2
|
import { defineEventHandler, getRouterParam, setResponseStatus, readBody } from "h3";
|
|
3
|
+
import { flowrixApi } from "../../../middleware/flowrix.js";
|
|
3
4
|
export default defineEventHandler(async (event) => {
|
|
4
5
|
const slug = getRouterParam(event, "slug");
|
|
5
6
|
const body = await readBody(event);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<
|
|
1
|
+
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<unknown>>;
|
|
2
2
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useRuntimeConfig } from "#imports";
|
|
2
2
|
import { defineEventHandler, getRouterParam, setResponseStatus, readBody } from "h3";
|
|
3
|
+
import { flowrixApi } from "../../../middleware/flowrix.js";
|
|
3
4
|
export default defineEventHandler(async (event) => {
|
|
4
5
|
const slug = getRouterParam(event, "slug");
|
|
5
6
|
const body = await readBody(event);
|
|
@@ -46,7 +46,11 @@ export const useAuthStore = defineStore("auth", {
|
|
|
46
46
|
}
|
|
47
47
|
return response;
|
|
48
48
|
} catch (error) {
|
|
49
|
-
|
|
49
|
+
console.error("Login error:", error);
|
|
50
|
+
return error.data || {
|
|
51
|
+
status: "Error",
|
|
52
|
+
message: "Login failed. Please try again."
|
|
53
|
+
};
|
|
50
54
|
}
|
|
51
55
|
},
|
|
52
56
|
async signUp(userFields) {
|
|
@@ -66,20 +70,15 @@ export const useAuthStore = defineStore("auth", {
|
|
|
66
70
|
body: userFields
|
|
67
71
|
});
|
|
68
72
|
if (response.status == "Success") {
|
|
69
|
-
|
|
70
|
-
sameSite: "none",
|
|
71
|
-
// cross-site requests
|
|
72
|
-
secure: true,
|
|
73
|
-
// must be https
|
|
74
|
-
path: "/",
|
|
75
|
-
expires: /* @__PURE__ */ new Date("2099-12-31")
|
|
76
|
-
});
|
|
77
|
-
authTokenCookie.value = response.data.access_token;
|
|
78
|
-
this.user = response.data.user;
|
|
73
|
+
return response;
|
|
79
74
|
}
|
|
80
75
|
return response;
|
|
81
76
|
} catch (error) {
|
|
82
|
-
|
|
77
|
+
console.error("Signup error:", error);
|
|
78
|
+
return error.data || {
|
|
79
|
+
status: "Error",
|
|
80
|
+
message: "Registration failed. Please try again."
|
|
81
|
+
};
|
|
83
82
|
}
|
|
84
83
|
},
|
|
85
84
|
async fetchProfile() {
|
|
@@ -169,14 +168,10 @@ export const useAuthStore = defineStore("auth", {
|
|
|
169
168
|
const response = await flowrixApi.post(apiUrl, apiConfig, {
|
|
170
169
|
body: userData
|
|
171
170
|
});
|
|
172
|
-
|
|
173
|
-
return { status: response.status, message: response.message || "Password Update Successfully" };
|
|
174
|
-
} else {
|
|
175
|
-
const errorMessage = response.message;
|
|
176
|
-
throw new Error(errorMessage);
|
|
177
|
-
}
|
|
171
|
+
return response;
|
|
178
172
|
} catch (error) {
|
|
179
|
-
|
|
173
|
+
console.error("Change password error:", error);
|
|
174
|
+
return error.data || error;
|
|
180
175
|
}
|
|
181
176
|
},
|
|
182
177
|
async deleteCard(cardId) {
|
|
@@ -250,7 +245,6 @@ export const useAuthStore = defineStore("auth", {
|
|
|
250
245
|
} catch (err) {
|
|
251
246
|
console.error("Download invoice error:", err);
|
|
252
247
|
return err.data;
|
|
253
|
-
} finally {
|
|
254
248
|
}
|
|
255
249
|
},
|
|
256
250
|
async fetchQuotations() {
|
|
@@ -314,7 +308,6 @@ export const useAuthStore = defineStore("auth", {
|
|
|
314
308
|
return error.data;
|
|
315
309
|
}
|
|
316
310
|
},
|
|
317
|
-
// Password Reset APIs
|
|
318
311
|
async verifyEmail(email) {
|
|
319
312
|
try {
|
|
320
313
|
const config = useRuntimeConfig();
|
|
@@ -421,6 +414,8 @@ export const useAuthStore = defineStore("auth", {
|
|
|
421
414
|
if (process.client) {
|
|
422
415
|
localStorage.removeItem("auth_token");
|
|
423
416
|
localStorage.removeItem("auth_user");
|
|
417
|
+
document.cookie = "authToken=; path=/; expires=Thu, 01 Jan 1970 00:00:00 UTC; SameSite=None; Secure";
|
|
418
|
+
document.cookie = "customertype=; path=/; expires=Thu, 01 Jan 1970 00:00:00 UTC; SameSite=None; Secure";
|
|
424
419
|
}
|
|
425
420
|
},
|
|
426
421
|
setHydrated() {
|
|
@@ -1,18 +1,33 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface WebFormField {
|
|
2
2
|
id: number;
|
|
3
|
+
name: string;
|
|
4
|
+
label: string;
|
|
5
|
+
type: string;
|
|
6
|
+
required: boolean;
|
|
7
|
+
options?: string[];
|
|
8
|
+
validation?: string;
|
|
9
|
+
placeholder?: string;
|
|
3
10
|
}
|
|
4
|
-
export interface
|
|
11
|
+
export interface WebForm {
|
|
5
12
|
id: number;
|
|
13
|
+
title: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
fields: WebFormField[];
|
|
16
|
+
success_message?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface WebFormSubmission {
|
|
19
|
+
[key: string]: any;
|
|
6
20
|
recaptcha: string;
|
|
7
21
|
}
|
|
22
|
+
export interface WebFormResponse {
|
|
23
|
+
status: string;
|
|
24
|
+
message: string;
|
|
25
|
+
data: any | null;
|
|
26
|
+
}
|
|
8
27
|
export declare const useWebformsStore: import("pinia").StoreDefinition<"webforms", {
|
|
9
28
|
webform: WebForm | null;
|
|
10
|
-
webFormReturn:
|
|
29
|
+
webFormReturn: WebFormResponse | null;
|
|
11
30
|
loading: boolean;
|
|
12
31
|
error: string | null;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
setWebFormReturn(returnValue: any): void;
|
|
16
|
-
setLoading(loading: boolean): void;
|
|
17
|
-
setError(error: string | null): void;
|
|
18
|
-
}>;
|
|
32
|
+
_hydrated: boolean;
|
|
33
|
+
}, {}, {}>;
|
|
@@ -1,23 +1,123 @@
|
|
|
1
1
|
import { defineStore } from "pinia";
|
|
2
|
+
import { flowrixApi } from "../middleware/flowrix.js";
|
|
3
|
+
import { useRuntimeConfig } from "#imports";
|
|
4
|
+
function formatErrorMessage(message) {
|
|
5
|
+
if (typeof message === "string") {
|
|
6
|
+
return message;
|
|
7
|
+
}
|
|
8
|
+
if (Array.isArray(message)) {
|
|
9
|
+
return message.join(", ");
|
|
10
|
+
}
|
|
11
|
+
const errorMessages = [];
|
|
12
|
+
for (const [field, errors] of Object.entries(message)) {
|
|
13
|
+
if (Array.isArray(errors)) {
|
|
14
|
+
errorMessages.push(...errors);
|
|
15
|
+
} else {
|
|
16
|
+
errorMessages.push(String(errors));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return errorMessages.join(", ");
|
|
20
|
+
}
|
|
2
21
|
export const useWebformsStore = defineStore("webforms", {
|
|
3
22
|
state: () => ({
|
|
4
23
|
webform: null,
|
|
5
24
|
webFormReturn: null,
|
|
6
25
|
loading: false,
|
|
7
|
-
error: null
|
|
26
|
+
error: null,
|
|
27
|
+
_hydrated: false
|
|
8
28
|
}),
|
|
9
29
|
actions: {
|
|
30
|
+
async fetchWebform(id) {
|
|
31
|
+
try {
|
|
32
|
+
this.loading = true;
|
|
33
|
+
this.error = null;
|
|
34
|
+
const config = useRuntimeConfig();
|
|
35
|
+
let rawCookies = "";
|
|
36
|
+
if (process.client) {
|
|
37
|
+
rawCookies = document.cookie || "";
|
|
38
|
+
}
|
|
39
|
+
const apiConfig = {
|
|
40
|
+
...config,
|
|
41
|
+
cookies: rawCookies
|
|
42
|
+
};
|
|
43
|
+
const apiUrl = `contact-center/webforms/${id}/details`;
|
|
44
|
+
const response = await flowrixApi.get(apiUrl, apiConfig);
|
|
45
|
+
if (response.status === "Success" && response.data) {
|
|
46
|
+
this.webform = response.data;
|
|
47
|
+
return response.data;
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error("Fetch webform failed:", error);
|
|
52
|
+
this.error = error.data ? formatErrorMessage(error.data.message) : error.message || "Failed to fetch webform";
|
|
53
|
+
return null;
|
|
54
|
+
} finally {
|
|
55
|
+
this.loading = false;
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
async submitInquiry(formData) {
|
|
59
|
+
try {
|
|
60
|
+
this.loading = true;
|
|
61
|
+
this.error = null;
|
|
62
|
+
const config = useRuntimeConfig();
|
|
63
|
+
let rawCookies = "";
|
|
64
|
+
if (process.client) {
|
|
65
|
+
rawCookies = document.cookie || "";
|
|
66
|
+
}
|
|
67
|
+
const apiConfig = {
|
|
68
|
+
...config,
|
|
69
|
+
cookies: rawCookies
|
|
70
|
+
};
|
|
71
|
+
const apiUrl = "contact-center/webforms/create";
|
|
72
|
+
const response = await flowrixApi.post(apiUrl, apiConfig, {
|
|
73
|
+
body: formData
|
|
74
|
+
});
|
|
75
|
+
if (response.status === "Success") {
|
|
76
|
+
this.webFormReturn = response;
|
|
77
|
+
return response;
|
|
78
|
+
} else {
|
|
79
|
+
const errorMessage = response.message || "Failed to submit inquiry";
|
|
80
|
+
throw new Error(errorMessage);
|
|
81
|
+
}
|
|
82
|
+
} catch (error) {
|
|
83
|
+
console.error("Submit inquiry error:", error);
|
|
84
|
+
const message = error.data ? formatErrorMessage(error.data.message) : error.message || "Submission failed";
|
|
85
|
+
this.error = message;
|
|
86
|
+
return {
|
|
87
|
+
status: "Error",
|
|
88
|
+
message,
|
|
89
|
+
data: null
|
|
90
|
+
};
|
|
91
|
+
} finally {
|
|
92
|
+
this.loading = false;
|
|
93
|
+
}
|
|
94
|
+
},
|
|
10
95
|
setWebform(webform) {
|
|
11
96
|
this.webform = webform;
|
|
12
97
|
},
|
|
13
98
|
setWebFormReturn(returnValue) {
|
|
14
99
|
this.webFormReturn = returnValue;
|
|
15
100
|
},
|
|
16
|
-
|
|
17
|
-
this.
|
|
101
|
+
clearError() {
|
|
102
|
+
this.error = null;
|
|
103
|
+
},
|
|
104
|
+
clearWebFormReturn() {
|
|
105
|
+
this.webFormReturn = null;
|
|
18
106
|
},
|
|
19
|
-
|
|
20
|
-
this.
|
|
107
|
+
setHydrated() {
|
|
108
|
+
this._hydrated = true;
|
|
21
109
|
}
|
|
110
|
+
},
|
|
111
|
+
getters: {
|
|
112
|
+
getWebform: (state) => state.webform,
|
|
113
|
+
getWebFormReturn: (state) => state.webFormReturn,
|
|
114
|
+
getLoading: (state) => state.loading,
|
|
115
|
+
getError: (state) => state.error,
|
|
116
|
+
isHydrated: (state) => state._hydrated
|
|
117
|
+
},
|
|
118
|
+
persist: {
|
|
119
|
+
enabled: true,
|
|
120
|
+
key: "webforms",
|
|
121
|
+
storage: typeof window !== "undefined" ? localStorage : void 0
|
|
22
122
|
}
|
|
23
123
|
});
|