flowrix 1.0.1-beta.9 → 1.0.1-beta.92
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.d.mts +1 -6
- package/dist/module.json +1 -1
- package/dist/module.mjs +103 -34
- package/dist/runtime/composables/Blog/useBlogIndex.d.ts +2 -5
- package/dist/runtime/composables/Brand/brand.js +2 -0
- package/dist/runtime/composables/Cart/useCart.d.ts +40 -0
- package/dist/runtime/composables/Cart/useCart.js +10 -0
- package/dist/runtime/composables/Cart/useCartDetail.d.ts +15 -5
- package/dist/runtime/composables/Cart/useCartDetail.js +3 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useFlowrixpay.d.ts +40 -1
- package/dist/runtime/composables/Checkout/PaymentMethods/useFlowrixpay.js +2 -2
- package/dist/runtime/composables/Checkout/PaymentMethods/useOpayo.d.ts +40 -1
- package/dist/runtime/composables/Checkout/PaymentMethods/useOpayo.js +2 -2
- package/dist/runtime/composables/Checkout/PaymentMethods/usePaymentMethods.js +3 -14
- package/dist/runtime/composables/Checkout/PaymentMethods/useStripe.d.ts +2 -2
- package/dist/runtime/composables/Checkout/useCheckout.d.ts +84 -73
- package/dist/runtime/composables/Checkout/useCheckout.js +81 -34
- package/dist/runtime/composables/Checkout/useCheckoutBillingAddress.d.ts +43 -0
- package/dist/runtime/composables/Checkout/useCheckoutBillingAddress.js +84 -0
- package/dist/runtime/composables/Checkout/useCheckoutShippingAddress.d.ts +55 -0
- package/dist/runtime/composables/Checkout/useCheckoutShippingAddress.js +196 -0
- package/dist/runtime/composables/Checkout/useCreateAccount.d.ts +7 -7
- package/dist/runtime/composables/Checkout/useCreateAccount.js +3 -1
- package/dist/runtime/composables/Checkout/useDeliveryMethod.d.ts +2 -2
- package/dist/runtime/composables/Checkout/useDeliveryMethod.js +8 -7
- package/dist/runtime/composables/Customer/useBillingAddress.d.ts +112 -0
- package/dist/runtime/composables/Customer/useBillingAddress.js +93 -0
- package/dist/runtime/composables/Customer/useLogin.d.ts +9 -0
- package/dist/runtime/composables/Customer/useLogin.js +34 -0
- package/dist/runtime/composables/Customer/useOrders.d.ts +29 -0
- package/dist/runtime/composables/Customer/useOrders.js +56 -0
- package/dist/runtime/composables/Customer/usePasswordReset.d.ts +26 -0
- package/dist/runtime/composables/Customer/usePasswordReset.js +258 -0
- package/dist/runtime/composables/Customer/useProfile.d.ts +75 -0
- package/dist/runtime/composables/Customer/useProfile.js +106 -0
- package/dist/runtime/composables/Customer/useQuotations.d.ts +32 -0
- package/dist/runtime/composables/Customer/useQuotations.js +40 -0
- package/dist/runtime/composables/Customer/useRegister.d.ts +120 -11
- package/dist/runtime/composables/Customer/useRegister.js +311 -34
- package/dist/runtime/composables/Customer/useShippingAddress.d.ts +121 -0
- package/dist/runtime/composables/Customer/useShippingAddress.js +145 -0
- package/dist/runtime/composables/Customer/useUpdatePassword.d.ts +21 -0
- package/dist/runtime/composables/Customer/useUpdatePassword.js +94 -0
- package/dist/runtime/composables/Customer/useUserCards.d.ts +22 -0
- package/dist/runtime/composables/Customer/useUserCards.js +65 -0
- package/dist/runtime/composables/{useWishlists.d.ts → Customer/useWishlists.d.ts} +6 -19
- package/dist/runtime/composables/{useWishlists.js → Customer/useWishlists.js} +21 -29
- package/dist/runtime/composables/Extras/useCountry.d.ts +11 -6
- package/dist/runtime/composables/Extras/useCountry.js +5 -4
- package/dist/runtime/composables/Header/useHeader.d.ts +6 -20
- package/dist/runtime/composables/Header/useHeader.js +3 -2
- package/dist/runtime/composables/Product/CustomProduct/useCustomeScript.js +4 -4
- package/dist/runtime/composables/Product/CustomProduct/useSteps.d.ts +1 -1
- package/dist/runtime/composables/Product/useProductComponent.js +2 -0
- package/dist/runtime/composables/Product/useProductSlug.d.ts +8 -1
- package/dist/runtime/composables/Product/useQuickView.d.ts +8 -0
- package/dist/runtime/composables/Product/useQuickView.js +27 -0
- package/dist/runtime/composables/Product/useService.d.ts +1 -1
- package/dist/runtime/composables/Product/useService.js +0 -3
- package/dist/runtime/composables/SideBar/Filters/useFilters.d.ts +2 -2
- package/dist/runtime/composables/SideBar/Filters/useSorting.d.ts +2 -2
- package/dist/runtime/composables/index.d.ts +16 -12
- package/dist/runtime/composables/index.js +16 -12
- package/dist/runtime/composables/useAddresses.js +6 -6
- package/dist/runtime/composables/useCards.js +2 -2
- package/dist/runtime/composables/useDataLayer.js +2 -1
- package/dist/runtime/composables/useLocation.d.ts +2 -12
- package/dist/runtime/composables/useQuotationCheckout.d.ts +78 -0
- package/dist/runtime/composables/useQuotationCheckout.js +138 -0
- package/dist/runtime/middleware/flowrix.d.ts +5 -4
- package/dist/runtime/middleware/flowrix.js +41 -21
- package/dist/runtime/pages/flowrix-default.d.vue.ts +3 -0
- package/dist/runtime/pages/flowrix-default.vue +34 -0
- package/dist/runtime/pages/flowrix-default.vue.d.ts +3 -0
- package/dist/runtime/plugin.d.ts +1 -1
- package/dist/runtime/server/api/albums.d.ts +1 -0
- package/dist/runtime/server/api/albums.js +38 -12
- package/dist/runtime/server/api/auth/forgot.js +1 -1
- package/dist/runtime/server/api/auth/login.js +5 -6
- package/dist/runtime/server/api/auth/logout.js +1 -1
- package/dist/runtime/server/api/auth/register.js +1 -1
- package/dist/runtime/server/api/auth/session.get.js +1 -1
- package/dist/runtime/server/api/auth/user/reset-password.js +1 -1
- package/dist/runtime/server/api/auth/user/session.js +1 -1
- package/dist/runtime/server/api/auth/user/verify-token.js +1 -1
- package/dist/runtime/server/api/banners.js +15 -12
- package/dist/runtime/server/api/brand/[...slug].js +55 -0
- package/dist/runtime/server/api/brand/index.d.ts +3 -0
- package/dist/runtime/server/api/brand/index.js +49 -0
- package/dist/runtime/server/api/cache/[...slug].delete.d.ts +2 -0
- package/dist/runtime/server/api/cache/[...slug].delete.js +40 -0
- package/dist/runtime/server/api/cache/clean.get.d.ts +5 -0
- package/dist/runtime/server/api/cache/clean.get.js +16 -0
- package/dist/runtime/server/api/cart/[slug]/add.d.ts +1 -1
- package/dist/runtime/server/api/cart/[slug]/add.js +11 -11
- package/dist/runtime/server/api/cart/[slug]/update.d.ts +1 -1
- package/dist/runtime/server/api/cart/[slug]/update.js +11 -11
- package/dist/runtime/server/api/{blog/blog.d.ts → cart/related.d.ts} +0 -1
- package/dist/runtime/server/api/cart/related.js +21 -0
- package/dist/runtime/server/api/cart/remove.js +1 -1
- package/dist/runtime/server/api/cart/service/[slug]/add.d.ts +1 -1
- package/dist/runtime/server/api/cart/service/[slug]/add.js +12 -12
- package/dist/runtime/server/api/catalog/brands.d.ts +3 -0
- package/dist/runtime/server/api/catalog/brands.js +49 -0
- package/dist/runtime/server/api/catalog/categories.js +22 -16
- package/dist/runtime/server/api/catalog/categoriesall.d.ts +3 -0
- package/dist/runtime/server/api/catalog/categoriesall.js +49 -0
- package/dist/runtime/server/api/catalog/featured.js +22 -14
- package/dist/runtime/server/api/catalog/posts.d.ts +3 -0
- package/dist/runtime/server/api/catalog/posts.js +49 -0
- package/dist/runtime/server/api/catalog/samples.js +22 -16
- package/dist/runtime/server/api/catalog/search.js +21 -15
- package/dist/runtime/server/api/category/[...slug].js +22 -16
- package/dist/runtime/server/api/checkout/applyCoupon.d.ts +1 -1
- package/dist/runtime/server/api/checkout/applyCoupon.js +13 -13
- package/dist/runtime/server/api/checkout/configs.d.ts +1 -1
- package/dist/runtime/server/api/checkout/configs.js +11 -11
- package/dist/runtime/server/api/checkout/countries.d.ts +1 -1
- package/dist/runtime/server/api/checkout/countries.js +5 -9
- package/dist/runtime/server/api/checkout/paymentmethod.d.ts +1 -1
- package/dist/runtime/server/api/checkout/paymentmethod.js +16 -11
- package/dist/runtime/server/api/checkout/quotation/[slug].d.ts +2 -0
- package/dist/runtime/server/api/checkout/quotation/[slug].js +21 -0
- package/dist/runtime/server/api/checkout/quotation/guest/[slug].d.ts +2 -0
- package/dist/runtime/server/api/checkout/quotation/guest/[slug].js +37 -0
- package/dist/runtime/server/api/checkout/quotation/guest/customer.d.ts +2 -0
- package/dist/runtime/server/api/checkout/quotation/guest/customer.js +21 -0
- package/dist/runtime/server/api/checkout/quotation/submit/[slug].d.ts +2 -0
- package/dist/runtime/server/api/checkout/quotation/submit/[slug].js +23 -0
- package/dist/runtime/server/api/{blog/[slug].js → cmspost/[...slug].js} +19 -18
- package/dist/runtime/server/api/cmspost/all.d.ts +3 -0
- package/dist/runtime/server/api/cmspost/all.js +49 -0
- package/dist/runtime/server/api/company/profile.d.ts +1 -1
- package/dist/runtime/server/api/company/profile.js +9 -9
- package/dist/runtime/server/api/contact-center/webforms/[id]/details.d.ts +1 -1
- package/dist/runtime/server/api/contact-center/webforms/[id]/details.js +48 -15
- package/dist/runtime/server/api/contact-center/webforms/create.d.ts +1 -1
- package/dist/runtime/server/api/contact-center/webforms/create.js +10 -10
- package/dist/runtime/server/api/countries.d.ts +2 -0
- package/dist/runtime/server/api/countries.js +42 -0
- package/dist/runtime/server/api/customer/address/add.js +1 -1
- package/dist/runtime/server/api/customer/address/delete.js +2 -2
- package/dist/runtime/server/api/customer/address/setshipping.js +1 -1
- package/dist/runtime/server/api/customer/address/update.js +1 -1
- package/dist/runtime/server/api/customer/cards/delete.js +2 -2
- package/dist/runtime/server/api/customer/cards/get.js +2 -2
- package/dist/runtime/server/api/customer/change-password.js +2 -2
- package/dist/runtime/server/api/customer/checkout.js +1 -1
- package/dist/runtime/server/api/customer/orders.js +2 -2
- package/dist/runtime/server/api/customer/profile/update.js +1 -1
- package/dist/runtime/server/api/customer/quotations.js +2 -2
- package/dist/runtime/server/api/customer/search.js +1 -1
- package/dist/runtime/server/api/customer/tax-invoice.js +1 -1
- package/dist/runtime/server/api/customer/wishlist/add.js +1 -1
- package/dist/runtime/server/api/customer/wishlist/createWishList.js +1 -1
- package/dist/runtime/server/api/customer/wishlist/deleteFromWishList.js +1 -1
- package/dist/runtime/server/api/customer/wishlist/deleteWishList.js +1 -1
- package/dist/runtime/server/api/customer/wishlist/get.js +2 -2
- package/dist/runtime/server/api/customer/wishlist/getWishListItems.js +1 -1
- package/dist/runtime/server/api/customer/wishlist/updateWishList.js +2 -2
- package/dist/runtime/server/api/featured.d.ts +3 -0
- package/dist/runtime/server/api/featured.js +49 -0
- package/dist/runtime/server/api/generate/robots.get.d.ts +2 -0
- package/dist/runtime/server/api/generate/robots.get.js +20 -0
- package/dist/runtime/server/api/generate/sitemap.get.d.ts +2 -0
- package/dist/runtime/server/api/generate/sitemap.get.js +32 -0
- package/dist/runtime/server/api/location.d.ts +1 -1
- package/dist/runtime/server/api/location.js +20 -12
- package/dist/runtime/server/api/nav/[id]/links.d.ts +1 -0
- package/dist/runtime/server/api/nav/[id]/links.js +48 -14
- package/dist/runtime/server/api/page/{[slug].js → [...slug].js} +18 -17
- package/dist/runtime/server/api/product/[...slug].js +23 -9
- package/dist/runtime/server/api/{v2/[...slug].d.ts → quickview/[slug].d.ts} +0 -1
- package/dist/runtime/server/api/quickview/[slug].js +17 -0
- package/dist/runtime/server/api/reviews.d.ts +2 -0
- package/dist/runtime/server/api/reviews.js +18 -0
- package/dist/runtime/server/api/samples.d.ts +3 -0
- package/dist/runtime/server/api/samples.js +50 -0
- package/dist/runtime/server/api/search.d.ts +3 -0
- package/dist/runtime/server/api/search.js +50 -0
- package/dist/runtime/server/api/service/[slug].js +17 -13
- package/dist/runtime/server/api/service/availability.d.ts +1 -1
- package/dist/runtime/server/api/service/availability.js +11 -13
- package/dist/runtime/server/api/service/getall.d.ts +3 -0
- package/dist/runtime/server/api/service/getall.js +55 -0
- package/dist/runtime/server/api/shop.d.ts +3 -0
- package/dist/runtime/server/api/shop.js +50 -0
- package/dist/runtime/server/api/subscribe.d.ts +1 -1
- package/dist/runtime/server/api/subscribe.js +19 -14
- package/dist/runtime/server/api/v2/[...slug].get.d.ts +2 -0
- package/dist/runtime/server/api/v2/[...slug].get.js +16 -0
- package/dist/runtime/server/api/webform.d.ts +3 -0
- package/dist/runtime/server/api/webform.js +52 -0
- package/dist/runtime/server/tsconfig.json +3 -3
- package/dist/runtime/stores/Cart.d.ts +12 -0
- package/dist/runtime/stores/Cart.js +56 -19
- package/dist/runtime/stores/Checkout.d.ts +9 -15
- package/dist/runtime/stores/Checkout.js +19 -24
- package/dist/runtime/stores/Search.d.ts +1 -1
- package/dist/runtime/stores/Services.js +2 -2
- package/dist/runtime/stores/auth.d.ts +8 -11
- package/dist/runtime/stores/auth.js +390 -8
- package/dist/runtime/stores/countries.d.ts +1 -3
- package/dist/runtime/stores/countries.js +4 -8
- package/dist/runtime/stores/product/slug.d.ts +1 -17
- package/dist/runtime/stores/wishlists.d.ts +114 -6
- package/dist/runtime/stores/wishlists.js +209 -9
- package/dist/runtime/utils/api.js +9 -13
- package/dist/runtime/utils/htmlCache.d.ts +2 -2
- package/dist/runtime/utils/htmlCache.js +23 -13
- package/dist/types.d.mts +6 -2
- package/package.json +30 -20
- package/dist/runtime/composables/Checkout/useBillingAddress.d.ts +0 -19
- package/dist/runtime/composables/Checkout/useBillingAddress.js +0 -82
- package/dist/runtime/composables/Checkout/useShippingAddress.d.ts +0 -9
- package/dist/runtime/composables/Checkout/useShippingAddress.js +0 -121
- package/dist/runtime/composables/useAuth.d.ts +0 -45
- package/dist/runtime/composables/useAuth.js +0 -180
- package/dist/runtime/composables/useCountries.d.ts +0 -12
- package/dist/runtime/composables/useCountries.js +0 -50
- package/dist/runtime/composables/useOrders.d.ts +0 -21
- package/dist/runtime/composables/useOrders.js +0 -82
- package/dist/runtime/composables/useQuotations.d.ts +0 -14
- package/dist/runtime/composables/useQuotations.js +0 -50
- package/dist/runtime/plugins/fullReload.client.d.ts +0 -2
- package/dist/runtime/plugins/fullReload.client.js +0 -10
- package/dist/runtime/server/api/blog/blog.js +0 -17
- package/dist/runtime/server/api/brand/[slug].js +0 -58
- package/dist/runtime/server/api/v2/[...slug].js +0 -9
- /package/dist/runtime/server/api/brand/{[slug].d.ts → [...slug].d.ts} +0 -0
- /package/dist/runtime/server/api/{blog/[slug].d.ts → cmspost/[...slug].d.ts} +0 -0
- /package/dist/runtime/server/api/page/{[slug].d.ts → [...slug].d.ts} +0 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { ref, computed, onMounted } from "vue";
|
|
2
|
+
import { useCheckoutStore } from "../../stores/Checkout.js";
|
|
3
|
+
import { useCountry } from "../Extras/useCountry.js";
|
|
4
|
+
import { useCompanyProfile } from "../../stores/useCompanyProfile.js";
|
|
5
|
+
import useStripe from "./PaymentMethods/useStripe.js";
|
|
6
|
+
import { useAuthStore } from "../../stores/auth.js";
|
|
7
|
+
import { usePasswordFormatter } from "../Extras/usePasswordFormatter.js";
|
|
8
|
+
export default function(inputData) {
|
|
9
|
+
const authStore = useAuthStore();
|
|
10
|
+
const checkoutStore = useCheckoutStore();
|
|
11
|
+
const CountryData = useCountry().data;
|
|
12
|
+
const Countries = computed(() => CountryData.countries);
|
|
13
|
+
const States = ref([]);
|
|
14
|
+
const passwordShow = ref("password");
|
|
15
|
+
const password = ref("");
|
|
16
|
+
const password_confirmationShow = ref("password");
|
|
17
|
+
const UserAccount = ref(true);
|
|
18
|
+
const timeout = ref("");
|
|
19
|
+
const CheckingUserAccount = ref(false);
|
|
20
|
+
const { passwordStrength, passwordStrengthClass, passwordStrengthValue, passwordStrengthWidth, passwordStrengthTextColor } = usePasswordFormatter(password, inputData);
|
|
21
|
+
const getUserShippingAddresses = computed(() => {
|
|
22
|
+
if (!authStore.user || !authStore.user.addresses) return [];
|
|
23
|
+
return authStore.user.addresses.filter(
|
|
24
|
+
(address) => address.shipping === 1 || address.shipping === 1 && address.billing === 1
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
const getPrimaryShippingAddress = computed(() => {
|
|
28
|
+
const shippingAddresses = getUserShippingAddresses.value;
|
|
29
|
+
return shippingAddresses.length > 0 ? shippingAddresses[0] : null;
|
|
30
|
+
});
|
|
31
|
+
const getUserBillingAddress = computed(() => {
|
|
32
|
+
if (!authStore.user || !authStore.user.addresses) return null;
|
|
33
|
+
const billingAddress = authStore.user.addresses.find((address) => address.billing === 1);
|
|
34
|
+
if (billingAddress) return billingAddress;
|
|
35
|
+
return authStore.user.addresses[0] || null;
|
|
36
|
+
});
|
|
37
|
+
const GetStates = async (countryID) => {
|
|
38
|
+
return States.value;
|
|
39
|
+
};
|
|
40
|
+
onMounted(() => {
|
|
41
|
+
GetStates(inputData.shipping_country);
|
|
42
|
+
if (authStore.isAuthenticated && getPrimaryShippingAddress.value) {
|
|
43
|
+
const shippingAddr = getPrimaryShippingAddress.value;
|
|
44
|
+
inputData.shipping_fullname = shippingAddr.fullname || "";
|
|
45
|
+
inputData.shipping_firstname = shippingAddr.firstname || "";
|
|
46
|
+
inputData.shipping_lastname = shippingAddr.lastname || "";
|
|
47
|
+
inputData.shipping_address = shippingAddr.address || "";
|
|
48
|
+
inputData.shipping_suburb = shippingAddr.suburb || "";
|
|
49
|
+
inputData.shipping_state = shippingAddr.state_id || "";
|
|
50
|
+
inputData.shipping_country = shippingAddr.country_id || "";
|
|
51
|
+
inputData.shipping_postcode = shippingAddr.postcode || "";
|
|
52
|
+
inputData.shipping_mobile = shippingAddr.mobile || "";
|
|
53
|
+
inputData.shipping_address_id = shippingAddr.id || "";
|
|
54
|
+
updateShippingAddress(inputData);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const ChangeCountry = async (shippingfield) => {
|
|
58
|
+
if (shippingfield.shipping_country == void 0) {
|
|
59
|
+
shippingfield.shipping_country = useCompanyProfile().profile.country_id;
|
|
60
|
+
}
|
|
61
|
+
let newstates = await GetStates(shippingfield.shipping_country);
|
|
62
|
+
checkoutStore.saveToCheckoutSession(shippingfield);
|
|
63
|
+
};
|
|
64
|
+
const updateShippingAddress = ((shippingfield) => {
|
|
65
|
+
checkoutStore.saveToCheckoutSession(shippingfield);
|
|
66
|
+
});
|
|
67
|
+
const CheckUserAccount = (async (billingDetails, userEmail) => {
|
|
68
|
+
if (timeout.value) {
|
|
69
|
+
clearTimeout(timeout.value);
|
|
70
|
+
}
|
|
71
|
+
timeout.value = setTimeout(async () => {
|
|
72
|
+
billingDetails.register = false;
|
|
73
|
+
billingDetails.password = "";
|
|
74
|
+
billingDetails.password_confirmation = "";
|
|
75
|
+
if (userEmail != "") {
|
|
76
|
+
CheckingUserAccount.value = true;
|
|
77
|
+
await checkoutStore.CheckUserAccount(userEmail);
|
|
78
|
+
if (checkoutStore.checkCustomer.status == "Error") {
|
|
79
|
+
UserAccount.value = true;
|
|
80
|
+
} else {
|
|
81
|
+
UserAccount.value = false;
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
UserAccount.value = true;
|
|
85
|
+
}
|
|
86
|
+
CheckingUserAccount.value = false;
|
|
87
|
+
}, 1e3);
|
|
88
|
+
});
|
|
89
|
+
const updateBillingAddress = ((billingfield) => {
|
|
90
|
+
if (billingfield.register == false) {
|
|
91
|
+
billingfield.password = "";
|
|
92
|
+
billingfield.password_confirmation = "";
|
|
93
|
+
}
|
|
94
|
+
checkoutStore.saveToCheckoutSession(billingfield);
|
|
95
|
+
});
|
|
96
|
+
const sameAsBilling = (async (sameasbilling = false, inputData2) => {
|
|
97
|
+
const isAuthenticated = authStore.isAuthenticated;
|
|
98
|
+
if (isAuthenticated) {
|
|
99
|
+
const billingAddress = getUserBillingAddress.value;
|
|
100
|
+
const shippingAddress = getPrimaryShippingAddress.value;
|
|
101
|
+
inputData2.billing_firstname = authStore.user?.firstname || "";
|
|
102
|
+
inputData2.billing_lastname = authStore.user?.lastname || "";
|
|
103
|
+
inputData2.email = authStore.user?.email || "";
|
|
104
|
+
inputData2.billing_mobile = authStore.user?.mobile || "";
|
|
105
|
+
if (sameasbilling == true) {
|
|
106
|
+
inputData2.billing_firstname = inputData2.shipping_firstname || billingAddress?.firstname || "";
|
|
107
|
+
inputData2.billing_lastname = inputData2.shipping_lastname || billingAddress?.lastname || "";
|
|
108
|
+
inputData2.billing_address = inputData2.shipping_address || billingAddress?.address || "";
|
|
109
|
+
inputData2.billing_postcode = inputData2.shipping_postcode || billingAddress?.postcode || "";
|
|
110
|
+
inputData2.billing_state = inputData2.shipping_state || billingAddress?.state_id || "";
|
|
111
|
+
inputData2.billing_suburb = inputData2.shipping_suburb || billingAddress?.suburb || "";
|
|
112
|
+
inputData2.billing_mobile = inputData2.shipping_mobile || billingAddress?.mobile || "";
|
|
113
|
+
} else {
|
|
114
|
+
if (billingAddress) {
|
|
115
|
+
inputData2.billing_firstname = inputData2.billing_firstname || billingAddress.firstname || "";
|
|
116
|
+
inputData2.billing_lastname = inputData2.billing_lastname || billingAddress.lastname || "";
|
|
117
|
+
inputData2.billing_address = inputData2.billing_address || billingAddress.address || "";
|
|
118
|
+
inputData2.billing_postcode = inputData2.billing_postcode || billingAddress.postcode || "";
|
|
119
|
+
inputData2.billing_state = inputData2.billing_state || billingAddress.state_id || "";
|
|
120
|
+
inputData2.billing_suburb = inputData2.billing_suburb || billingAddress.suburb || "";
|
|
121
|
+
inputData2.billing_mobile = inputData2.billing_mobile || billingAddress.mobile || "";
|
|
122
|
+
}
|
|
123
|
+
if (shippingAddress) {
|
|
124
|
+
inputData2.shipping_fullname = shippingAddress.fullname || "";
|
|
125
|
+
inputData2.shipping_firstname = shippingAddress.firstname || "";
|
|
126
|
+
inputData2.shipping_lastname = shippingAddress.lastname || "";
|
|
127
|
+
inputData2.shipping_address = shippingAddress.address || "";
|
|
128
|
+
inputData2.shipping_postcode = shippingAddress.postcode || "";
|
|
129
|
+
inputData2.shipping_state = shippingAddress.state_id || "";
|
|
130
|
+
inputData2.shipping_suburb = shippingAddress.suburb || "";
|
|
131
|
+
inputData2.shipping_mobile = shippingAddress.mobile || "";
|
|
132
|
+
inputData2.shipping_address_id = shippingAddress.id || "";
|
|
133
|
+
} else {
|
|
134
|
+
inputData2.shipping_fullname = "";
|
|
135
|
+
inputData2.shipping_firstname = "";
|
|
136
|
+
inputData2.shipping_lastname = "";
|
|
137
|
+
inputData2.shipping_address = "";
|
|
138
|
+
inputData2.shipping_postcode = "";
|
|
139
|
+
inputData2.shipping_state = "";
|
|
140
|
+
inputData2.shipping_suburb = "";
|
|
141
|
+
inputData2.shipping_mobile = "";
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
} else if (!isAuthenticated && sameasbilling == true) {
|
|
145
|
+
inputData2.shipping_firstname = inputData2.billing_firstname || "";
|
|
146
|
+
inputData2.shipping_lastname = inputData2.billing_lastname || "";
|
|
147
|
+
inputData2.shipping_address = inputData2.billing_address || "";
|
|
148
|
+
inputData2.shipping_postcode = inputData2.billing_postcode || "";
|
|
149
|
+
inputData2.shipping_state = inputData2.billing_state || "";
|
|
150
|
+
inputData2.shipping_suburb = inputData2.billing_suburb || "";
|
|
151
|
+
inputData2.shipping_mobile = inputData2.billing_mobile || "";
|
|
152
|
+
} else {
|
|
153
|
+
inputData2.shipping_fullname = "";
|
|
154
|
+
inputData2.shipping_firstname = "";
|
|
155
|
+
inputData2.shipping_lastname = "";
|
|
156
|
+
inputData2.shipping_address = "";
|
|
157
|
+
inputData2.shipping_postcode = "";
|
|
158
|
+
inputData2.shipping_state = "";
|
|
159
|
+
inputData2.shipping_suburb = "";
|
|
160
|
+
inputData2.shipping_mobile = "";
|
|
161
|
+
}
|
|
162
|
+
UpdateStripe(inputData2);
|
|
163
|
+
updateShippingAddress(inputData2);
|
|
164
|
+
});
|
|
165
|
+
const UpdateStripe = (async (inputData2) => {
|
|
166
|
+
await checkoutStore.saveToCheckoutSession(inputData2);
|
|
167
|
+
const { getpaymentMethod } = useStripe();
|
|
168
|
+
const totalPrice = computed(() => {
|
|
169
|
+
return checkoutStore.config ? checkoutStore.config.calculations.total : checkoutStore.config.total;
|
|
170
|
+
});
|
|
171
|
+
getpaymentMethod("web-stripe", inputData2, totalPrice.value);
|
|
172
|
+
});
|
|
173
|
+
return {
|
|
174
|
+
checkoutStore,
|
|
175
|
+
updateShippingAddress,
|
|
176
|
+
sameAsBilling,
|
|
177
|
+
UpdateStripe,
|
|
178
|
+
Countries,
|
|
179
|
+
ChangeCountry,
|
|
180
|
+
States,
|
|
181
|
+
getUserShippingAddresses,
|
|
182
|
+
getPrimaryShippingAddress,
|
|
183
|
+
passwordShow,
|
|
184
|
+
password,
|
|
185
|
+
password_confirmationShow,
|
|
186
|
+
updateBillingAddress,
|
|
187
|
+
UserAccount,
|
|
188
|
+
CheckUserAccount,
|
|
189
|
+
CheckingUserAccount,
|
|
190
|
+
passwordStrength,
|
|
191
|
+
passwordStrengthClass,
|
|
192
|
+
passwordStrengthValue,
|
|
193
|
+
passwordStrengthWidth,
|
|
194
|
+
passwordStrengthTextColor
|
|
195
|
+
};
|
|
196
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export default function (): {
|
|
2
|
-
checkoutStore:
|
|
1
|
+
export default function (inputData: any): {
|
|
2
|
+
checkoutStore: import("pinia").Store<"checkout", import("../../stores/Checkout.js").CheckoutState, {}, {}>;
|
|
3
3
|
passwordShow: import("vue").Ref<string, string>;
|
|
4
4
|
password: import("vue").Ref<string, string>;
|
|
5
5
|
password_confirmationShow: import("vue").Ref<string, string>;
|
|
@@ -7,9 +7,9 @@ export default function (): {
|
|
|
7
7
|
UserAccount: import("vue").Ref<boolean, boolean>;
|
|
8
8
|
CheckUserAccount: (billingDetails: any, userEmail: string) => Promise<void>;
|
|
9
9
|
CheckingUserAccount: import("vue").Ref<boolean, boolean>;
|
|
10
|
-
passwordStrength:
|
|
11
|
-
passwordStrengthClass:
|
|
12
|
-
passwordStrengthValue:
|
|
13
|
-
passwordStrengthWidth:
|
|
14
|
-
passwordStrengthTextColor:
|
|
10
|
+
passwordStrength: import("vue").ComputedRef<"Password must be 8 characters" | "Strong" | "Medium" | "Weak">;
|
|
11
|
+
passwordStrengthClass: import("vue").ComputedRef<"bg-danger" | "bg-success" | "bg-warning">;
|
|
12
|
+
passwordStrengthValue: import("vue").ComputedRef<number>;
|
|
13
|
+
passwordStrengthWidth: import("vue").ComputedRef<string>;
|
|
14
|
+
passwordStrengthTextColor: import("vue").ComputedRef<"text-danger" | "text-success" | "text-black">;
|
|
15
15
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ref } from "vue";
|
|
2
|
-
|
|
2
|
+
import { useCheckoutStore } from "../../stores/Checkout.js";
|
|
3
|
+
import { usePasswordFormatter } from "../Extras/usePasswordFormatter.js";
|
|
4
|
+
export default function(inputData) {
|
|
3
5
|
const checkoutStore = useCheckoutStore();
|
|
4
6
|
const passwordShow = ref("password");
|
|
5
7
|
const password = ref("");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default function (): {
|
|
2
|
-
checkoutStore:
|
|
1
|
+
export default function (inputData: any): {
|
|
2
|
+
checkoutStore: import("pinia").Store<"checkout", import("../../stores/Checkout.js").CheckoutState, {}, {}>;
|
|
3
3
|
updateDeliveryMethod: (inputData: any) => Promise<void>;
|
|
4
4
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { useCheckoutStore } from "../../stores/Checkout.js";
|
|
2
|
+
import useStripe from "./PaymentMethods/useStripe.js";
|
|
3
|
+
export default function(inputData) {
|
|
3
4
|
const checkoutStore = useCheckoutStore();
|
|
4
|
-
const updateDeliveryMethod = (async (
|
|
5
|
-
await checkoutStore.saveToCheckoutSession(
|
|
6
|
-
const { getpaymentMethod } =
|
|
5
|
+
const updateDeliveryMethod = (async (inputData2) => {
|
|
6
|
+
await checkoutStore.saveToCheckoutSession(inputData2);
|
|
7
|
+
const { getpaymentMethod } = useStripe();
|
|
7
8
|
const totalPrice = checkoutStore.config ? checkoutStore.config.calculations.total : checkoutStore.config.total;
|
|
8
|
-
if (
|
|
9
|
-
getpaymentMethod("web-stripe",
|
|
9
|
+
if (inputData2.paymentmethod && inputData2.paymentmethod == "web-stripe") {
|
|
10
|
+
getpaymentMethod("web-stripe", inputData2, totalPrice);
|
|
10
11
|
}
|
|
11
12
|
const cart = [];
|
|
12
13
|
cart.items = checkoutStore.config.cart;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
export interface BillingForm {
|
|
2
|
+
id: string | number;
|
|
3
|
+
firstname: string;
|
|
4
|
+
lastname: string;
|
|
5
|
+
saddress: string;
|
|
6
|
+
suburb: string;
|
|
7
|
+
state: string;
|
|
8
|
+
state_id: string | number;
|
|
9
|
+
country: string;
|
|
10
|
+
country_id: string | number;
|
|
11
|
+
postcode: string;
|
|
12
|
+
mobile: string;
|
|
13
|
+
shipping: string | number;
|
|
14
|
+
billing: string | number;
|
|
15
|
+
}
|
|
16
|
+
export declare function useBillingAddress(): {
|
|
17
|
+
billingForm: import("vue").Ref<{
|
|
18
|
+
id: string | number;
|
|
19
|
+
firstname: string;
|
|
20
|
+
lastname: string;
|
|
21
|
+
saddress: string;
|
|
22
|
+
suburb: string;
|
|
23
|
+
state: string;
|
|
24
|
+
state_id: string | number;
|
|
25
|
+
country: string;
|
|
26
|
+
country_id: string | number;
|
|
27
|
+
postcode: string;
|
|
28
|
+
mobile: string;
|
|
29
|
+
shipping: string | number;
|
|
30
|
+
billing: string | number;
|
|
31
|
+
}, BillingForm | {
|
|
32
|
+
id: string | number;
|
|
33
|
+
firstname: string;
|
|
34
|
+
lastname: string;
|
|
35
|
+
saddress: string;
|
|
36
|
+
suburb: string;
|
|
37
|
+
state: string;
|
|
38
|
+
state_id: string | number;
|
|
39
|
+
country: string;
|
|
40
|
+
country_id: string | number;
|
|
41
|
+
postcode: string;
|
|
42
|
+
mobile: string;
|
|
43
|
+
shipping: string | number;
|
|
44
|
+
billing: string | number;
|
|
45
|
+
}>;
|
|
46
|
+
successMessage: import("vue").Ref<string, string>;
|
|
47
|
+
errorMessage: import("vue").Ref<string, string>;
|
|
48
|
+
isEditing: import("vue").Ref<boolean, boolean>;
|
|
49
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
50
|
+
submitAddressReturn: import("vue").Ref<any, any>;
|
|
51
|
+
user: import("vue").ComputedRef<{
|
|
52
|
+
id: number;
|
|
53
|
+
fullname: string;
|
|
54
|
+
firstname: string;
|
|
55
|
+
lastname: string;
|
|
56
|
+
email: string;
|
|
57
|
+
avatar: string;
|
|
58
|
+
country_id: number | null;
|
|
59
|
+
country: {
|
|
60
|
+
id: number;
|
|
61
|
+
name: string;
|
|
62
|
+
emoji: string;
|
|
63
|
+
} | null;
|
|
64
|
+
state_id: number | null;
|
|
65
|
+
state: string | null;
|
|
66
|
+
suburb: string | null;
|
|
67
|
+
dob: string | null;
|
|
68
|
+
phone: string | null;
|
|
69
|
+
address: string | null;
|
|
70
|
+
mobile: string | null;
|
|
71
|
+
company: string | null;
|
|
72
|
+
addresses: {
|
|
73
|
+
id: number;
|
|
74
|
+
fullname: string | null;
|
|
75
|
+
firstname: string;
|
|
76
|
+
middlename: string | null;
|
|
77
|
+
lastname: string;
|
|
78
|
+
address: string;
|
|
79
|
+
suburb: string;
|
|
80
|
+
state: string | null;
|
|
81
|
+
state_id: number | null;
|
|
82
|
+
country: string;
|
|
83
|
+
country_id: number;
|
|
84
|
+
postcode: string;
|
|
85
|
+
mobile: string;
|
|
86
|
+
shipping: number;
|
|
87
|
+
billing: number;
|
|
88
|
+
}[];
|
|
89
|
+
created_at: string;
|
|
90
|
+
} | null>;
|
|
91
|
+
userBillingAddress: import("vue").ComputedRef<{
|
|
92
|
+
id: number;
|
|
93
|
+
fullname: string | null;
|
|
94
|
+
firstname: string;
|
|
95
|
+
middlename: string | null;
|
|
96
|
+
lastname: string;
|
|
97
|
+
address: string;
|
|
98
|
+
suburb: string;
|
|
99
|
+
state: string | null;
|
|
100
|
+
state_id: number | null;
|
|
101
|
+
country: string;
|
|
102
|
+
country_id: number;
|
|
103
|
+
postcode: string;
|
|
104
|
+
mobile: string;
|
|
105
|
+
shipping: number;
|
|
106
|
+
billing: number;
|
|
107
|
+
} | undefined>;
|
|
108
|
+
clearMessages: () => void;
|
|
109
|
+
cancelEdit: () => void;
|
|
110
|
+
submitAddress: () => Promise<void>;
|
|
111
|
+
resetForm: () => void;
|
|
112
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ref, computed } from "vue";
|
|
2
|
+
import { useAuthStore } from "../../stores/auth.js";
|
|
3
|
+
export function useBillingAddress() {
|
|
4
|
+
const authStore = useAuthStore();
|
|
5
|
+
const user = computed(() => authStore.user);
|
|
6
|
+
const userBillingAddress = computed(
|
|
7
|
+
() => user.value?.addresses?.find((address) => address.billing == 1)
|
|
8
|
+
);
|
|
9
|
+
const billingForm = ref({
|
|
10
|
+
id: userBillingAddress.value?.id || "",
|
|
11
|
+
firstname: userBillingAddress.value?.firstname || "",
|
|
12
|
+
lastname: userBillingAddress.value?.lastname || "",
|
|
13
|
+
saddress: userBillingAddress.value?.address || "",
|
|
14
|
+
suburb: userBillingAddress.value?.suburb || "",
|
|
15
|
+
state: userBillingAddress.value?.state || "",
|
|
16
|
+
state_id: userBillingAddress.value?.state_id || "",
|
|
17
|
+
country: userBillingAddress.value?.country || "",
|
|
18
|
+
country_id: userBillingAddress.value?.country_id || "",
|
|
19
|
+
postcode: userBillingAddress.value?.postcode || "",
|
|
20
|
+
mobile: userBillingAddress.value?.mobile || "",
|
|
21
|
+
shipping: userBillingAddress.value?.shipping || "",
|
|
22
|
+
billing: userBillingAddress.value?.billing || 1
|
|
23
|
+
});
|
|
24
|
+
const successMessage = ref("");
|
|
25
|
+
const errorMessage = ref("");
|
|
26
|
+
const isEditing = ref(false);
|
|
27
|
+
const loading = ref(false);
|
|
28
|
+
const submitAddressReturn = ref(null);
|
|
29
|
+
const clearMessages = () => {
|
|
30
|
+
successMessage.value = "";
|
|
31
|
+
errorMessage.value = "";
|
|
32
|
+
submitAddressReturn.value = null;
|
|
33
|
+
};
|
|
34
|
+
const resetForm = () => {
|
|
35
|
+
billingForm.value = {
|
|
36
|
+
id: userBillingAddress.value?.id || "",
|
|
37
|
+
firstname: userBillingAddress.value?.firstname || "",
|
|
38
|
+
lastname: userBillingAddress.value?.lastname || "",
|
|
39
|
+
saddress: userBillingAddress.value?.address || "",
|
|
40
|
+
suburb: userBillingAddress.value?.suburb || "",
|
|
41
|
+
state: userBillingAddress.value?.state || "",
|
|
42
|
+
state_id: userBillingAddress.value?.state_id || "",
|
|
43
|
+
country: userBillingAddress.value?.country || "",
|
|
44
|
+
country_id: userBillingAddress.value?.country_id || "",
|
|
45
|
+
postcode: userBillingAddress.value?.postcode || "",
|
|
46
|
+
mobile: userBillingAddress.value?.mobile || "",
|
|
47
|
+
shipping: userBillingAddress.value?.shipping || "",
|
|
48
|
+
billing: userBillingAddress.value?.billing || 1
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
const cancelEdit = () => {
|
|
52
|
+
resetForm();
|
|
53
|
+
isEditing.value = false;
|
|
54
|
+
clearMessages();
|
|
55
|
+
};
|
|
56
|
+
const submitAddress = async () => {
|
|
57
|
+
loading.value = true;
|
|
58
|
+
clearMessages();
|
|
59
|
+
try {
|
|
60
|
+
const method = billingForm.value.id ? "update" : "add";
|
|
61
|
+
submitAddressReturn.value = await authStore.setAddress(billingForm.value, method);
|
|
62
|
+
if (submitAddressReturn.value?.status === "Success") {
|
|
63
|
+
await authStore.fetchProfile();
|
|
64
|
+
isEditing.value = false;
|
|
65
|
+
successMessage.value = billingForm.value.id ? "Billing Address updated successfully" : "Billing Address created successfully";
|
|
66
|
+
} else {
|
|
67
|
+
errorMessage.value = submitAddressReturn.value?.message || "Failed to save address";
|
|
68
|
+
}
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error("Address submission error:", error);
|
|
71
|
+
errorMessage.value = error.message || "Failed to save address. Please try again.";
|
|
72
|
+
} finally {
|
|
73
|
+
loading.value = false;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
// State
|
|
78
|
+
billingForm,
|
|
79
|
+
successMessage,
|
|
80
|
+
errorMessage,
|
|
81
|
+
isEditing,
|
|
82
|
+
loading,
|
|
83
|
+
submitAddressReturn,
|
|
84
|
+
// Computed
|
|
85
|
+
user,
|
|
86
|
+
userBillingAddress,
|
|
87
|
+
// Methods
|
|
88
|
+
clearMessages,
|
|
89
|
+
cancelEdit,
|
|
90
|
+
submitAddress,
|
|
91
|
+
resetForm
|
|
92
|
+
};
|
|
93
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default function (): {
|
|
2
|
+
router: any;
|
|
3
|
+
route: any;
|
|
4
|
+
email: import("vue").Ref<string, string>;
|
|
5
|
+
password: import("vue").Ref<string, string>;
|
|
6
|
+
CustomerLogin: () => Promise<void>;
|
|
7
|
+
logResponse: import("vue").Ref<any, any>;
|
|
8
|
+
isLoading: import("vue").Ref<boolean, boolean>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import { useRouter, useRoute } from "#vue-router";
|
|
3
|
+
import { useAuthStore } from "../../stores/auth.js";
|
|
4
|
+
export default function() {
|
|
5
|
+
const router = useRouter();
|
|
6
|
+
const route = useRoute();
|
|
7
|
+
const email = ref("");
|
|
8
|
+
const password = ref("");
|
|
9
|
+
const logResponse = ref(null);
|
|
10
|
+
const isLoading = ref(false);
|
|
11
|
+
const CustomerLogin = async () => {
|
|
12
|
+
isLoading.value = true;
|
|
13
|
+
try {
|
|
14
|
+
const loginFields = {
|
|
15
|
+
email: email.value,
|
|
16
|
+
password: password.value
|
|
17
|
+
};
|
|
18
|
+
logResponse.value = await useAuthStore().userLogin(loginFields);
|
|
19
|
+
} catch (error) {
|
|
20
|
+
logResponse.value = { status: "Error", message: "Login failed" };
|
|
21
|
+
} finally {
|
|
22
|
+
isLoading.value = false;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
router,
|
|
27
|
+
route,
|
|
28
|
+
email,
|
|
29
|
+
password,
|
|
30
|
+
CustomerLogin,
|
|
31
|
+
logResponse,
|
|
32
|
+
isLoading
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface Order {
|
|
2
|
+
order_no: string;
|
|
3
|
+
order_status: string;
|
|
4
|
+
payment_method: string;
|
|
5
|
+
grandtotal: number;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
export declare function useOrders(): {
|
|
9
|
+
orders: import("vue").Ref<{
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
order_no: string;
|
|
12
|
+
order_status: string;
|
|
13
|
+
payment_method: string;
|
|
14
|
+
grandtotal: number;
|
|
15
|
+
}[], Order[] | {
|
|
16
|
+
[x: string]: any;
|
|
17
|
+
order_no: string;
|
|
18
|
+
order_status: string;
|
|
19
|
+
payment_method: string;
|
|
20
|
+
grandtotal: number;
|
|
21
|
+
}[]>;
|
|
22
|
+
pending: import("vue").Ref<boolean, boolean>;
|
|
23
|
+
loadingInvoice: import("vue").Ref<string, string>;
|
|
24
|
+
downloadError: import("vue").Ref<string, string>;
|
|
25
|
+
loadOrders: () => Promise<void>;
|
|
26
|
+
generateInvoice: (invoiceNumber: string) => Promise<void>;
|
|
27
|
+
clearError: () => void;
|
|
28
|
+
hasOrders: () => boolean;
|
|
29
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import { useAuthStore } from "../../stores/auth.js";
|
|
3
|
+
export function useOrders() {
|
|
4
|
+
const authStore = useAuthStore();
|
|
5
|
+
const orders = ref([]);
|
|
6
|
+
const pending = ref(true);
|
|
7
|
+
const loadingInvoice = ref("");
|
|
8
|
+
const downloadError = ref("");
|
|
9
|
+
const loadOrders = async () => {
|
|
10
|
+
pending.value = true;
|
|
11
|
+
downloadError.value = "";
|
|
12
|
+
try {
|
|
13
|
+
const ordersData = await authStore.fetchOrders();
|
|
14
|
+
orders.value = Array.isArray(ordersData) ? ordersData : [];
|
|
15
|
+
} catch (error) {
|
|
16
|
+
console.error("Failed to load orders:", error);
|
|
17
|
+
orders.value = [];
|
|
18
|
+
downloadError.value = "Failed to load orders. Please try again.";
|
|
19
|
+
} finally {
|
|
20
|
+
pending.value = false;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const generateInvoice = async (invoiceNumber) => {
|
|
24
|
+
loadingInvoice.value = invoiceNumber;
|
|
25
|
+
downloadError.value = "";
|
|
26
|
+
try {
|
|
27
|
+
const response = await authStore.downloadInvoice(invoiceNumber);
|
|
28
|
+
if (response && response.type === void 0) {
|
|
29
|
+
downloadError.value = "Invoice cannot be downloaded. Please try again...";
|
|
30
|
+
}
|
|
31
|
+
} catch (error) {
|
|
32
|
+
console.error("Invoice download error:", error);
|
|
33
|
+
downloadError.value = error.message || "Invoice cannot be downloaded. Please try again...";
|
|
34
|
+
} finally {
|
|
35
|
+
loadingInvoice.value = "";
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const clearError = () => {
|
|
39
|
+
downloadError.value = "";
|
|
40
|
+
};
|
|
41
|
+
const hasOrders = () => {
|
|
42
|
+
return orders.value && orders.value.length > 0;
|
|
43
|
+
};
|
|
44
|
+
return {
|
|
45
|
+
// State
|
|
46
|
+
orders,
|
|
47
|
+
pending,
|
|
48
|
+
loadingInvoice,
|
|
49
|
+
downloadError,
|
|
50
|
+
// Methods
|
|
51
|
+
loadOrders,
|
|
52
|
+
generateInvoice,
|
|
53
|
+
clearError,
|
|
54
|
+
hasOrders
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default function (timerDuration?: number): {
|
|
2
|
+
email: import("vue").Ref<string, string>;
|
|
3
|
+
resetCode: import("vue").Ref<string, string>;
|
|
4
|
+
newPassword: import("vue").Ref<string, string>;
|
|
5
|
+
confirmPassword: import("vue").Ref<string, string>;
|
|
6
|
+
showPassword: import("vue").Ref<boolean, boolean>;
|
|
7
|
+
showConfirmPassword: import("vue").Ref<boolean, boolean>;
|
|
8
|
+
isLoading: import("vue").Ref<boolean, boolean>;
|
|
9
|
+
errorMessage: import("vue").Ref<string, string>;
|
|
10
|
+
successMessage: import("vue").Ref<string, string>;
|
|
11
|
+
isCodeSent: import("vue").Ref<boolean, boolean>;
|
|
12
|
+
isCodeVerified: import("vue").Ref<boolean, boolean>;
|
|
13
|
+
currentStep: import("vue").Ref<number, number>;
|
|
14
|
+
timerCount: import("vue").Ref<number, number>;
|
|
15
|
+
isTimerActive: import("vue").Ref<boolean, boolean>;
|
|
16
|
+
formatTime: (seconds: number) => string;
|
|
17
|
+
togglePassword: (field: "newPassword" | "confirmPassword") => void;
|
|
18
|
+
handleSubmit: () => Promise<void>;
|
|
19
|
+
resetForm: () => void;
|
|
20
|
+
resendCode: () => Promise<void>;
|
|
21
|
+
startTimer: (duration?: number) => void;
|
|
22
|
+
stopTimer: () => void;
|
|
23
|
+
resetTimer: (duration?: number) => void;
|
|
24
|
+
cleanup: () => void;
|
|
25
|
+
router: any;
|
|
26
|
+
};
|