flowrix 1.0.1-beta.14 → 1.0.1-beta.141

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.
Files changed (275) hide show
  1. package/dist/module.d.mts +1 -6
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +169 -30
  4. package/dist/runtime/composables/Blog/useBlogIndex.d.ts +2 -5
  5. package/dist/runtime/composables/Blog/useBlogSingle.js +2 -4
  6. package/dist/runtime/composables/Brand/brand.d.ts +1 -1
  7. package/dist/runtime/composables/Brand/brand.js +30 -2
  8. package/dist/runtime/composables/Cart/useCart.d.ts +40 -0
  9. package/dist/runtime/composables/Cart/useCart.js +10 -0
  10. package/dist/runtime/composables/Cart/useCartComponent.d.ts +1 -0
  11. package/dist/runtime/composables/Cart/useCartComponent.js +11 -0
  12. package/dist/runtime/composables/Cart/useCartDetail.d.ts +15 -5
  13. package/dist/runtime/composables/Cart/useCartDetail.js +3 -0
  14. package/dist/runtime/composables/Category/useCategoryIndex.d.ts +25 -32
  15. package/dist/runtime/composables/Category/useCategoryIndex.js +63 -44
  16. package/dist/runtime/composables/Checkout/PaymentMethods/useDirectDeposit.js +8 -0
  17. package/dist/runtime/composables/Checkout/PaymentMethods/useEway.js +16 -6
  18. package/dist/runtime/composables/Checkout/PaymentMethods/useFlowrixpay.d.ts +40 -1
  19. package/dist/runtime/composables/Checkout/PaymentMethods/useFlowrixpay.js +10 -2
  20. package/dist/runtime/composables/Checkout/PaymentMethods/useOpayo.d.ts +40 -1
  21. package/dist/runtime/composables/Checkout/PaymentMethods/useOpayo.js +10 -2
  22. package/dist/runtime/composables/Checkout/PaymentMethods/usePaymentMethods.js +3 -14
  23. package/dist/runtime/composables/Checkout/PaymentMethods/usePaypal.js +8 -0
  24. package/dist/runtime/composables/Checkout/PaymentMethods/useStripe.d.ts +2 -2
  25. package/dist/runtime/composables/Checkout/PaymentMethods/useStripe.js +8 -0
  26. package/dist/runtime/composables/Checkout/PaymentMethods/useZippay.js +8 -0
  27. package/dist/runtime/composables/Checkout/useCheckout.d.ts +85 -73
  28. package/dist/runtime/composables/Checkout/useCheckout.js +84 -53
  29. package/dist/runtime/composables/Checkout/useCheckoutBillingAddress.d.ts +43 -0
  30. package/dist/runtime/composables/Checkout/useCheckoutBillingAddress.js +84 -0
  31. package/dist/runtime/composables/Checkout/useCheckoutShippingAddress.d.ts +55 -0
  32. package/dist/runtime/composables/Checkout/useCheckoutShippingAddress.js +196 -0
  33. package/dist/runtime/composables/Checkout/useCreateAccount.d.ts +7 -7
  34. package/dist/runtime/composables/Checkout/useCreateAccount.js +3 -1
  35. package/dist/runtime/composables/Checkout/useDeliveryMethod.d.ts +2 -2
  36. package/dist/runtime/composables/Checkout/useDeliveryMethod.js +18 -11
  37. package/dist/runtime/composables/Customer/useBillingAddress.d.ts +112 -0
  38. package/dist/runtime/composables/Customer/useBillingAddress.js +93 -0
  39. package/dist/runtime/composables/Customer/useLogin.d.ts +9 -0
  40. package/dist/runtime/composables/Customer/useLogin.js +34 -0
  41. package/dist/runtime/composables/Customer/useOrders.d.ts +29 -0
  42. package/dist/runtime/composables/Customer/useOrders.js +56 -0
  43. package/dist/runtime/composables/Customer/usePasswordReset.d.ts +26 -0
  44. package/dist/runtime/composables/Customer/usePasswordReset.js +258 -0
  45. package/dist/runtime/composables/Customer/useProfile.d.ts +75 -0
  46. package/dist/runtime/composables/Customer/useProfile.js +106 -0
  47. package/dist/runtime/composables/Customer/useQuotations.d.ts +32 -0
  48. package/dist/runtime/composables/Customer/useQuotations.js +40 -0
  49. package/dist/runtime/composables/Customer/useRegister.d.ts +121 -13
  50. package/dist/runtime/composables/Customer/useRegister.js +310 -35
  51. package/dist/runtime/composables/Customer/useShippingAddress.d.ts +121 -0
  52. package/dist/runtime/composables/Customer/useShippingAddress.js +145 -0
  53. package/dist/runtime/composables/Customer/useUpdatePassword.d.ts +21 -0
  54. package/dist/runtime/composables/Customer/useUpdatePassword.js +130 -0
  55. package/dist/runtime/composables/Customer/useUserCards.d.ts +22 -0
  56. package/dist/runtime/composables/Customer/useUserCards.js +65 -0
  57. package/dist/runtime/composables/{useWishlists.d.ts → Customer/useWishlists.d.ts} +7 -20
  58. package/dist/runtime/composables/{useWishlists.js → Customer/useWishlists.js} +21 -30
  59. package/dist/runtime/composables/Extras/useCountry.d.ts +11 -6
  60. package/dist/runtime/composables/Extras/useCountry.js +5 -4
  61. package/dist/runtime/composables/Footer/useFooter.d.ts +4 -4
  62. package/dist/runtime/composables/Footer/useFooter.js +12 -8
  63. package/dist/runtime/composables/Header/useHeader.d.ts +6 -20
  64. package/dist/runtime/composables/Header/useHeader.js +3 -2
  65. package/dist/runtime/composables/Product/CustomProduct/useCustomeScript.js +4 -5
  66. package/dist/runtime/composables/Product/CustomProduct/useSteps.d.ts +1 -1
  67. package/dist/runtime/composables/Product/useProductComponent.js +110 -0
  68. package/dist/runtime/composables/Product/useProductSlug.d.ts +8 -1
  69. package/dist/runtime/composables/Product/useQuickView.d.ts +8 -0
  70. package/dist/runtime/composables/Product/useQuickView.js +27 -0
  71. package/dist/runtime/composables/Product/useService.d.ts +42 -15
  72. package/dist/runtime/composables/Product/useService.js +137 -48
  73. package/dist/runtime/composables/Samples/useSamples.d.ts +5 -6
  74. package/dist/runtime/composables/Samples/useSamples.js +19 -15
  75. package/dist/runtime/composables/SideBar/Filters/useFilters.d.ts +2 -2
  76. package/dist/runtime/composables/SideBar/Filters/useSorting.d.ts +2 -2
  77. package/dist/runtime/composables/index.d.ts +18 -12
  78. package/dist/runtime/composables/index.js +18 -12
  79. package/dist/runtime/composables/useAddresses.js +6 -6
  80. package/dist/runtime/composables/useApp.d.ts +1 -0
  81. package/dist/runtime/composables/useApp.js +88 -0
  82. package/dist/runtime/composables/useCards.js +2 -2
  83. package/dist/runtime/composables/useDataLayer.js +1 -1
  84. package/dist/runtime/composables/useDotDigital.d.ts +3 -0
  85. package/dist/runtime/composables/useDotDigital.js +122 -0
  86. package/dist/runtime/composables/useLocation.d.ts +61 -19
  87. package/dist/runtime/composables/useLocation.js +353 -25
  88. package/dist/runtime/composables/useMetaLayer.js +11 -11
  89. package/dist/runtime/composables/useQuotationCheckout.d.ts +78 -0
  90. package/dist/runtime/composables/useQuotationCheckout.js +137 -0
  91. package/dist/runtime/composables/useSubscriptions.d.ts +17 -10
  92. package/dist/runtime/composables/useSubscriptions.js +68 -33
  93. package/dist/runtime/composables/useTikTokDatalayer.js +7 -7
  94. package/dist/runtime/composables/useWebforms.d.ts +38 -9
  95. package/dist/runtime/composables/useWebforms.js +93 -60
  96. package/dist/runtime/middleware/flowrix.d.ts +5 -4
  97. package/dist/runtime/middleware/flowrix.js +40 -22
  98. package/dist/runtime/pages/404.d.vue.ts +3 -0
  99. package/dist/runtime/pages/404.vue +6 -0
  100. package/dist/runtime/pages/404.vue.d.ts +3 -0
  101. package/dist/runtime/pages/flowrix-default.d.vue.ts +3 -0
  102. package/dist/runtime/pages/flowrix-default.vue +42 -0
  103. package/dist/runtime/pages/flowrix-default.vue.d.ts +3 -0
  104. package/dist/runtime/plugin.d.ts +1 -1
  105. package/dist/runtime/plugins/router.d.ts +2 -0
  106. package/dist/runtime/plugins/router.js +11 -0
  107. package/dist/runtime/server/api/albums.d.ts +1 -0
  108. package/dist/runtime/server/api/albums.js +35 -7
  109. package/dist/runtime/server/api/auth/forgot.js +1 -2
  110. package/dist/runtime/server/api/auth/login.d.ts +7 -0
  111. package/dist/runtime/server/api/auth/login.js +4 -16
  112. package/dist/runtime/server/api/auth/logout.js +1 -2
  113. package/dist/runtime/server/api/auth/register.js +1 -2
  114. package/dist/runtime/server/api/auth/session.get.js +1 -3
  115. package/dist/runtime/server/api/auth/user/reset-password.js +1 -2
  116. package/dist/runtime/server/api/auth/user/session.js +1 -2
  117. package/dist/runtime/server/api/auth/user/verify-token.js +1 -2
  118. package/dist/runtime/server/api/banners.js +20 -15
  119. package/dist/runtime/server/api/brand/[...slug].js +55 -0
  120. package/dist/runtime/server/api/brand/index.d.ts +3 -0
  121. package/dist/runtime/server/api/brand/index.js +46 -0
  122. package/dist/runtime/server/api/cache/[...slug].delete.d.ts +4 -1
  123. package/dist/runtime/server/api/cache/[...slug].delete.js +4 -7
  124. package/dist/runtime/server/api/cache/clean.get.d.ts +5 -0
  125. package/dist/runtime/server/api/cache/clean.get.js +4 -7
  126. package/dist/runtime/server/api/cart/[slug]/add.d.ts +1 -1
  127. package/dist/runtime/server/api/cart/[slug]/add.js +11 -11
  128. package/dist/runtime/server/api/cart/[slug]/update.d.ts +1 -1
  129. package/dist/runtime/server/api/cart/[slug]/update.js +11 -11
  130. package/dist/runtime/server/api/{v2/[...slug].d.ts → cart/related.d.ts} +0 -1
  131. package/dist/runtime/server/api/cart/related.js +21 -0
  132. package/dist/runtime/server/api/cart/remove.d.ts +1 -1
  133. package/dist/runtime/server/api/cart/remove.js +10 -10
  134. package/dist/runtime/server/api/cart/service/[slug]/add.d.ts +1 -1
  135. package/dist/runtime/server/api/cart/service/[slug]/add.js +12 -12
  136. package/dist/runtime/server/api/catalog/brands.d.ts +3 -0
  137. package/dist/runtime/server/api/catalog/brands.js +52 -0
  138. package/dist/runtime/server/api/catalog/categories.js +28 -19
  139. package/dist/runtime/server/api/catalog/categoriesall.d.ts +3 -0
  140. package/dist/runtime/server/api/catalog/categoriesall.js +52 -0
  141. package/dist/runtime/server/api/catalog/featured.js +28 -17
  142. package/dist/runtime/server/api/catalog/posts.d.ts +3 -0
  143. package/dist/runtime/server/api/catalog/posts.js +52 -0
  144. package/dist/runtime/server/api/catalog/samples.js +28 -19
  145. package/dist/runtime/server/api/catalog/search.js +28 -19
  146. package/dist/runtime/server/api/category/[...slug].js +31 -20
  147. package/dist/runtime/server/api/check-404.d.ts +4 -0
  148. package/dist/runtime/server/api/check-404.js +8 -0
  149. package/dist/runtime/server/api/checkout/applyCoupon.d.ts +1 -1
  150. package/dist/runtime/server/api/checkout/applyCoupon.js +13 -13
  151. package/dist/runtime/server/api/checkout/configs.d.ts +1 -1
  152. package/dist/runtime/server/api/checkout/configs.js +11 -11
  153. package/dist/runtime/server/api/checkout/countries.d.ts +1 -1
  154. package/dist/runtime/server/api/checkout/countries.js +5 -9
  155. package/dist/runtime/server/api/checkout/paymentmethod.d.ts +1 -1
  156. package/dist/runtime/server/api/checkout/paymentmethod.js +16 -11
  157. package/dist/runtime/server/api/{blog/blog.d.ts → checkout/quotation/[slug].d.ts} +0 -1
  158. package/dist/runtime/server/api/checkout/quotation/[slug].js +20 -0
  159. package/dist/runtime/server/api/checkout/quotation/guest/[slug].d.ts +2 -0
  160. package/dist/runtime/server/api/checkout/quotation/guest/[slug].js +35 -0
  161. package/dist/runtime/server/api/checkout/quotation/guest/customer.d.ts +2 -0
  162. package/dist/runtime/server/api/checkout/quotation/guest/customer.js +20 -0
  163. package/dist/runtime/server/api/checkout/quotation/submit/[slug].d.ts +2 -0
  164. package/dist/runtime/server/api/checkout/quotation/submit/[slug].js +22 -0
  165. package/dist/runtime/server/api/checkvariables.d.ts +3 -0
  166. package/dist/runtime/server/api/checkvariables.js +37 -0
  167. package/dist/runtime/server/api/cmspost/[...slug].js +54 -0
  168. package/dist/runtime/server/api/cmspost/all.d.ts +3 -0
  169. package/dist/runtime/server/api/cmspost/all.js +52 -0
  170. package/dist/runtime/server/api/company/profile.d.ts +1 -1
  171. package/dist/runtime/server/api/company/profile.js +12 -7
  172. package/dist/runtime/server/api/contact-center/webforms/[id]/details.d.ts +1 -1
  173. package/dist/runtime/server/api/contact-center/webforms/[id]/details.js +50 -15
  174. package/dist/runtime/server/api/contact-center/webforms/create.d.ts +1 -1
  175. package/dist/runtime/server/api/contact-center/webforms/create.js +13 -9
  176. package/dist/runtime/server/api/countries.d.ts +2 -0
  177. package/dist/runtime/server/api/countries.js +44 -0
  178. package/dist/runtime/server/api/customer/address/add.js +1 -2
  179. package/dist/runtime/server/api/customer/address/delete.js +2 -3
  180. package/dist/runtime/server/api/customer/address/setshipping.js +1 -2
  181. package/dist/runtime/server/api/customer/address/update.js +1 -2
  182. package/dist/runtime/server/api/customer/cards/delete.js +2 -3
  183. package/dist/runtime/server/api/customer/cards/get.js +2 -3
  184. package/dist/runtime/server/api/customer/change-password.js +2 -3
  185. package/dist/runtime/server/api/customer/checkout.js +1 -2
  186. package/dist/runtime/server/api/customer/orders.js +2 -3
  187. package/dist/runtime/server/api/customer/profile/update.js +1 -2
  188. package/dist/runtime/server/api/customer/quotations.js +2 -3
  189. package/dist/runtime/server/api/customer/search.js +1 -2
  190. package/dist/runtime/server/api/customer/tax-invoice.js +1 -2
  191. package/dist/runtime/server/api/customer/wishlist/add.js +1 -2
  192. package/dist/runtime/server/api/customer/wishlist/createWishList.js +1 -2
  193. package/dist/runtime/server/api/customer/wishlist/deleteFromWishList.js +1 -2
  194. package/dist/runtime/server/api/customer/wishlist/deleteWishList.js +1 -2
  195. package/dist/runtime/server/api/customer/wishlist/get.js +2 -3
  196. package/dist/runtime/server/api/customer/wishlist/getWishListItems.js +1 -2
  197. package/dist/runtime/server/api/customer/wishlist/updateWishList.js +2 -3
  198. package/dist/runtime/server/api/featured.d.ts +3 -0
  199. package/dist/runtime/server/api/featured.js +52 -0
  200. package/dist/runtime/server/api/generate/robots.get.d.ts +2 -0
  201. package/dist/runtime/server/api/generate/robots.get.js +20 -0
  202. package/dist/runtime/server/api/generate/sitemap.get.d.ts +2 -0
  203. package/dist/runtime/server/api/generate/sitemap.get.js +32 -0
  204. package/dist/runtime/server/api/location.d.ts +1 -1
  205. package/dist/runtime/server/api/location.js +24 -12
  206. package/dist/runtime/server/api/nav/[id]/links.d.ts +1 -0
  207. package/dist/runtime/server/api/nav/[id]/links.js +46 -10
  208. package/dist/runtime/server/api/page/[...slug].js +54 -0
  209. package/dist/runtime/server/api/product/[...slug].js +28 -13
  210. package/dist/runtime/server/api/quickview/[slug].d.ts +2 -0
  211. package/dist/runtime/server/api/quickview/[slug].js +21 -0
  212. package/dist/runtime/server/api/reviews.d.ts +2 -0
  213. package/dist/runtime/server/api/reviews.js +23 -0
  214. package/dist/runtime/server/api/samples.d.ts +3 -0
  215. package/dist/runtime/server/api/samples.js +53 -0
  216. package/dist/runtime/server/api/search.d.ts +3 -0
  217. package/dist/runtime/server/api/search.js +53 -0
  218. package/dist/runtime/server/api/service/[slug].js +22 -16
  219. package/dist/runtime/server/api/service/availability.d.ts +1 -1
  220. package/dist/runtime/server/api/service/availability.js +14 -12
  221. package/dist/runtime/server/api/service/getall.d.ts +3 -0
  222. package/dist/runtime/server/api/service/getall.js +57 -0
  223. package/dist/runtime/server/api/shop.d.ts +3 -0
  224. package/dist/runtime/server/api/shop.js +53 -0
  225. package/dist/runtime/server/api/subscribe.d.ts +1 -1
  226. package/dist/runtime/server/api/subscribe.js +23 -14
  227. package/dist/runtime/server/api/v2/[...slug].get.d.ts +2 -0
  228. package/dist/runtime/server/api/v2/[...slug].get.js +32 -0
  229. package/dist/runtime/server/api/webform.d.ts +3 -0
  230. package/dist/runtime/server/api/webform.js +54 -0
  231. package/dist/runtime/server/tsconfig.json +3 -3
  232. package/dist/runtime/stores/Cart.d.ts +12 -0
  233. package/dist/runtime/stores/Cart.js +62 -17
  234. package/dist/runtime/stores/Checkout.d.ts +9 -15
  235. package/dist/runtime/stores/Checkout.js +38 -45
  236. package/dist/runtime/stores/IpLocation.d.ts +95 -4
  237. package/dist/runtime/stores/IpLocation.js +93 -15
  238. package/dist/runtime/stores/Search.d.ts +1 -1
  239. package/dist/runtime/stores/Services.d.ts +5 -0
  240. package/dist/runtime/stores/Services.js +59 -8
  241. package/dist/runtime/stores/auth.d.ts +8 -11
  242. package/dist/runtime/stores/auth.js +385 -8
  243. package/dist/runtime/stores/countries.d.ts +1 -3
  244. package/dist/runtime/stores/countries.js +4 -8
  245. package/dist/runtime/stores/product/README.md +6 -6
  246. package/dist/runtime/stores/product/slug.d.ts +1 -17
  247. package/dist/runtime/stores/webforms.d.ts +24 -9
  248. package/dist/runtime/stores/webforms.js +105 -5
  249. package/dist/runtime/stores/wishlists.d.ts +125 -8
  250. package/dist/runtime/stores/wishlists.js +212 -20
  251. package/dist/runtime/utils/api.js +7 -13
  252. package/dist/runtime/utils/htmlCache.d.ts +2 -2
  253. package/dist/runtime/utils/htmlCache.js +23 -13
  254. package/dist/types.d.mts +6 -2
  255. package/package.json +16 -5
  256. package/dist/runtime/composables/Checkout/useBillingAddress.d.ts +0 -19
  257. package/dist/runtime/composables/Checkout/useBillingAddress.js +0 -82
  258. package/dist/runtime/composables/Checkout/useShippingAddress.d.ts +0 -9
  259. package/dist/runtime/composables/Checkout/useShippingAddress.js +0 -121
  260. package/dist/runtime/composables/useAuth.d.ts +0 -45
  261. package/dist/runtime/composables/useAuth.js +0 -180
  262. package/dist/runtime/composables/useCountries.d.ts +0 -12
  263. package/dist/runtime/composables/useCountries.js +0 -50
  264. package/dist/runtime/composables/useOrders.d.ts +0 -21
  265. package/dist/runtime/composables/useOrders.js +0 -82
  266. package/dist/runtime/composables/useQuotations.d.ts +0 -14
  267. package/dist/runtime/composables/useQuotations.js +0 -50
  268. package/dist/runtime/server/api/blog/[slug].js +0 -51
  269. package/dist/runtime/server/api/blog/blog.js +0 -17
  270. package/dist/runtime/server/api/brand/[slug].js +0 -58
  271. package/dist/runtime/server/api/page/[slug].js +0 -51
  272. package/dist/runtime/server/api/v2/[...slug].js +0 -9
  273. /package/dist/runtime/server/api/brand/{[slug].d.ts → [...slug].d.ts} +0 -0
  274. /package/dist/runtime/server/api/{blog/[slug].d.ts → cmspost/[...slug].d.ts} +0 -0
  275. /package/dist/runtime/server/api/page/{[slug].d.ts → [...slug].d.ts} +0 -0
@@ -1,50 +1,325 @@
1
- import { ref } from "vue";
1
+ import { ref, watch } from "vue";
2
2
  import { useRouter, useRoute } from "#vue-router";
3
- import { useAuth } from "../useAuth.js";
4
- export default function() {
3
+ import { useAuthStore } from "../../stores/auth.js";
4
+ export default function(countries) {
5
5
  const router = useRouter();
6
6
  const route = useRoute();
7
- const { signUp } = useAuth();
8
- const form_error = ref("");
9
- const inputData = ref({ passwordStrengthValue: 0 });
10
- const { showPassword, togglePassword } = useTogglePassword();
11
- const {
12
- passwordStrength,
13
- passwordStrengthClass,
14
- passwordStrengthTextColor,
15
- passwordStrengthWidth
16
- } = usePasswordFormatter(inputData.value.password, inputData.value);
17
- const { inputValue: mobile, errorMessage, handleInput } = useNumberOnly();
18
- const signupFunction = async () => {
19
- if (!inputData.value.firstname || !inputData.value.lastname || !inputData.value.email || !inputData.value.password || !inputData.value.password_confirmation) {
20
- console.error("All fields are required");
21
- form_error.value = "All fields are required";
7
+ const authStore = useAuthStore();
8
+ const inputData = ref({
9
+ abn: "",
10
+ addresses: [],
11
+ address: "",
12
+ postCode: "",
13
+ suburb: "",
14
+ billing_address: "",
15
+ businessAddress: "",
16
+ billing_country: "",
17
+ billing_firstname: "",
18
+ billing_lastname: "",
19
+ billing_mobile: "",
20
+ billing_postcode: "",
21
+ billing_state: "",
22
+ billing_suburb: "",
23
+ company_name: "",
24
+ email: "",
25
+ email_confirmation: "",
26
+ firstname: "",
27
+ lastname: "",
28
+ mobile: "",
29
+ newsletterSignup: false,
30
+ password: "",
31
+ password_confirmation: "",
32
+ recaptcha: "",
33
+ shipping_address: "",
34
+ shipping_country: "",
35
+ shipping_postcode: "",
36
+ shipping_state: "",
37
+ shipping_suburb: "",
38
+ shipping_town: "",
39
+ shipping_mobile: "",
40
+ subscribe: false
41
+ });
42
+ const regResponse = ref(null);
43
+ const isBusinessAccount = ref(false);
44
+ const companyName = ref("");
45
+ const abn = ref("");
46
+ const address = ref("");
47
+ const sameAsCustomerDetails = ref(true);
48
+ const showPassword = ref(false);
49
+ const showConfirmPassword = ref(false);
50
+ const isLoading = ref(false);
51
+ const alertMessage = ref("");
52
+ const alertType = ref("danger");
53
+ const showAlert = ref(false);
54
+ const getStates = (countryId) => {
55
+ const activeCountry = countries.data.find((country) => country.id == countryId);
56
+ return activeCountry ? activeCountry.states : [];
57
+ };
58
+ const validateEmail = (email) => {
59
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
60
+ };
61
+ const validateForm = () => {
62
+ if (!inputData.value.firstname.trim()) return "First Name is required";
63
+ if (!inputData.value.lastname.trim()) return "Last Name is required";
64
+ if (!inputData.value.address.trim()) return "Address is required";
65
+ if (!String(inputData.value.billing_country).trim()) return "Country is required";
66
+ if (!String(inputData.value.billing_state).trim()) return "State is required";
67
+ if (!inputData.value.billing_postcode.trim()) return "Post Code is required";
68
+ if (!inputData.value.billing_suburb.trim()) return "Suburb is required";
69
+ if (!validateEmail(inputData.value.email)) return "Please enter a valid email address";
70
+ if (inputData.value.email !== inputData.value.email_confirmation) return "Email addresses do not match";
71
+ if (inputData.value.password.length < 6) return "Password must be at least 6 characters";
72
+ if (inputData.value.password !== inputData.value.password_confirmation) return "Passwords do not match";
73
+ if (!inputData.value.mobile.trim()) return "Mobile Number is required";
74
+ if (isBusinessAccount.value) {
75
+ if (!companyName.value.trim()) return "Company Name is required";
76
+ if (!abn.value.trim()) return "ABN is required";
77
+ if (!address.value.trim()) return "Business Address is required";
78
+ }
79
+ if (!sameAsCustomerDetails.value) {
80
+ if (!inputData.value.shipping_address.trim()) return "Shipping Address is required";
81
+ if (!String(inputData.value.shipping_country).trim()) return "Shipping country is required.";
82
+ if (!inputData.value.shipping_town.trim()) return "Shipping Town is required";
83
+ if (!String(inputData.value.shipping_state).trim()) return "Shipping State is required";
84
+ if (!inputData.value.shipping_postcode.trim()) return "Shipping Post Code is required";
85
+ if (!inputData.value.shipping_mobile.trim()) return "Shipping Mobile is required";
86
+ }
87
+ return true;
88
+ };
89
+ const togglePassword = () => {
90
+ showPassword.value = !showPassword.value;
91
+ };
92
+ const toggleConfirmPassword = () => {
93
+ showConfirmPassword.value = !showConfirmPassword.value;
94
+ };
95
+ const handleSameAsCustomerDetails = () => {
96
+ if (sameAsCustomerDetails.value) {
97
+ const billingAddr = isBusinessAccount.value ? address.value : inputData.value.address;
98
+ const billingSuburb = inputData.value.billing_suburb;
99
+ const billingPostcode = inputData.value.billing_postcode;
100
+ const billingMobile = inputData.value.mobile;
101
+ inputData.value.shipping_address = billingAddr;
102
+ inputData.value.shipping_country = inputData.value.billing_country;
103
+ inputData.value.shipping_state = inputData.value.billing_state;
104
+ inputData.value.shipping_town = billingSuburb;
105
+ inputData.value.shipping_suburb = billingSuburb;
106
+ inputData.value.shipping_postcode = billingPostcode;
107
+ inputData.value.shipping_mobile = billingMobile;
108
+ } else {
109
+ inputData.value.shipping_address = "";
110
+ inputData.value.shipping_town = "";
111
+ inputData.value.shipping_suburb = "";
112
+ inputData.value.shipping_postcode = "";
113
+ inputData.value.shipping_mobile = "";
114
+ }
115
+ };
116
+ const initializeShippingData = () => {
117
+ if (sameAsCustomerDetails.value) {
118
+ handleSameAsCustomerDetails();
119
+ }
120
+ };
121
+ const dismissAlert = () => {
122
+ showAlert.value = false;
123
+ alertMessage.value = "";
124
+ };
125
+ const displayAlert = (message, type) => {
126
+ alertMessage.value = message;
127
+ alertType.value = type;
128
+ showAlert.value = true;
129
+ if (type === "success") {
130
+ setTimeout(() => {
131
+ dismissAlert();
132
+ }, 5e3);
133
+ }
134
+ };
135
+ watch(() => inputData.value.billing_postcode, (newPostcode) => {
136
+ if (sameAsCustomerDetails.value && newPostcode) {
137
+ inputData.value.shipping_postcode = newPostcode;
138
+ }
139
+ });
140
+ watch(() => inputData.value.billing_suburb, (newSuburb) => {
141
+ if (sameAsCustomerDetails.value && newSuburb) {
142
+ inputData.value.shipping_suburb = newSuburb;
143
+ inputData.value.shipping_town = newSuburb;
144
+ }
145
+ });
146
+ watch(() => inputData.value.address, (newAddress) => {
147
+ if (sameAsCustomerDetails.value && newAddress && !isBusinessAccount.value) {
148
+ inputData.value.shipping_address = newAddress;
149
+ }
150
+ });
151
+ watch(() => address.value, (newBusinessAddress) => {
152
+ if (sameAsCustomerDetails.value && newBusinessAddress && isBusinessAccount.value) {
153
+ inputData.value.shipping_address = newBusinessAddress;
154
+ }
155
+ });
156
+ watch(() => inputData.value.mobile, (newMobile) => {
157
+ if (sameAsCustomerDetails.value && newMobile) {
158
+ inputData.value.shipping_mobile = newMobile;
159
+ }
160
+ });
161
+ watch(() => inputData.value.billing_country, (newCountry) => {
162
+ if (sameAsCustomerDetails.value && newCountry) {
163
+ inputData.value.shipping_country = newCountry;
164
+ }
165
+ });
166
+ watch(() => inputData.value.billing_state, (newState) => {
167
+ if (sameAsCustomerDetails.value && newState) {
168
+ inputData.value.shipping_state = newState;
169
+ }
170
+ });
171
+ watch(isBusinessAccount, () => {
172
+ if (sameAsCustomerDetails.value) {
173
+ handleSameAsCustomerDetails();
174
+ }
175
+ });
176
+ const handleSignup = async () => {
177
+ isLoading.value = true;
178
+ dismissAlert();
179
+ inputData.value.billing_mobile = inputData.value.mobile;
180
+ inputData.value.billing_address = inputData.value.address;
181
+ inputData.value.billing_firstname = inputData.value.firstname;
182
+ inputData.value.billing_lastname = inputData.value.lastname;
183
+ inputData.value.suburb = inputData.value.billing_suburb;
184
+ inputData.value.postCode = inputData.value.billing_postcode;
185
+ const validationError = validateForm();
186
+ if (validationError !== true) {
187
+ displayAlert(validationError, "danger");
188
+ isLoading.value = false;
22
189
  return;
23
190
  }
24
191
  try {
25
- inputData.value.email_confirmation = inputData.value.email;
26
- await signUp(inputData.value, { callbackUrl: "/customer/account", redirect: true });
27
- } catch (error) {
28
- console.error("Signup Error:", error);
29
- let errorMessage2 = "An unexpected error occurred.";
30
- if (error.data?.message) {
31
- errorMessage2 = error.data.message;
32
- } else if (error.message) {
33
- errorMessage2 = error.message;
192
+ if (isBusinessAccount.value) {
193
+ inputData.value.company_name = companyName.value;
194
+ inputData.value.abn = abn.value;
195
+ inputData.value.businessAddress = address.value;
196
+ if (address.value) {
197
+ inputData.value.billing_address = address.value;
198
+ }
199
+ }
200
+ if (sameAsCustomerDetails.value) {
201
+ handleSameAsCustomerDetails();
202
+ } else {
203
+ if (inputData.value.shipping_town && !inputData.value.shipping_suburb) {
204
+ inputData.value.shipping_suburb = inputData.value.shipping_town;
205
+ }
206
+ if (inputData.value.shipping_suburb && !inputData.value.shipping_town) {
207
+ inputData.value.shipping_town = inputData.value.shipping_suburb;
208
+ }
209
+ }
210
+ regResponse.value = await authStore.signUp(inputData.value);
211
+ if (!regResponse.value || regResponse.value.status !== "Success") {
212
+ let errorMsg = "Registration failed. Please try again.";
213
+ if (regResponse.value?.message) {
214
+ if (typeof regResponse.value.message === "string") {
215
+ errorMsg = regResponse.value.message;
216
+ } else if (typeof regResponse.value.message === "object") {
217
+ const fieldErrors = Object.entries(regResponse.value.message).flatMap(
218
+ ([field, errors]) => (errors || []).map((err) => `${field.charAt(0).toUpperCase() + field.slice(1)}: ${err}`)
219
+ );
220
+ errorMsg = fieldErrors.length > 0 ? fieldErrors.join("\n") : errorMsg;
221
+ }
222
+ } else if (!regResponse.value) {
223
+ errorMsg = "No response received from server. Please try again.";
224
+ }
225
+ displayAlert(errorMsg, "danger");
226
+ isLoading.value = false;
227
+ return;
34
228
  }
35
- form_error.value = errorMessage2;
229
+ const loginCredentials = {
230
+ email: inputData.value.email,
231
+ password: inputData.value.password
232
+ };
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);
240
+ isLoading.value = false;
241
+ return;
242
+ }
243
+ const successMsg = typeof regResponse.value.message === "string" ? regResponse.value.message : "Registration successful! Welcome aboard.";
244
+ displayAlert(successMsg, "success");
245
+ resetForm();
246
+ setTimeout(() => {
247
+ router.push({ name: "dashboard-profile" });
248
+ }, 1500);
249
+ } catch (error) {
250
+ console.error("Registration Error:", error);
251
+ const errorMsg = error?.message || error?.data?.message || "An unexpected error occurred. Please try again.";
252
+ displayAlert(errorMsg, "danger");
253
+ } finally {
254
+ isLoading.value = false;
36
255
  }
37
256
  };
257
+ const resetForm = () => {
258
+ inputData.value = {
259
+ abn: "",
260
+ addresses: [],
261
+ address: "",
262
+ postCode: "",
263
+ suburb: "",
264
+ billing_address: "",
265
+ businessAddress: "",
266
+ billing_country: "",
267
+ billing_firstname: "",
268
+ billing_lastname: "",
269
+ billing_mobile: "",
270
+ billing_postcode: "",
271
+ billing_state: "",
272
+ billing_suburb: "",
273
+ company_name: "",
274
+ email: "",
275
+ email_confirmation: "",
276
+ firstname: "",
277
+ lastname: "",
278
+ mobile: "",
279
+ newsletterSignup: false,
280
+ password: "",
281
+ password_confirmation: "",
282
+ recaptcha: "",
283
+ shipping_address: "",
284
+ shipping_country: "",
285
+ shipping_postcode: "",
286
+ shipping_state: "",
287
+ shipping_suburb: "",
288
+ shipping_town: "",
289
+ shipping_mobile: "",
290
+ subscribe: false
291
+ };
292
+ isBusinessAccount.value = false;
293
+ companyName.value = "";
294
+ abn.value = "";
295
+ address.value = "";
296
+ sameAsCustomerDetails.value = true;
297
+ };
38
298
  return {
39
299
  router,
40
300
  route,
41
- form_error,
42
301
  inputData,
43
- passwordStrength,
44
- passwordStrengthClass,
45
- passwordStrengthTextColor,
46
- passwordStrengthWidth,
47
- errorMessage,
48
- signupFunction
302
+ regResponse,
303
+ isBusinessAccount,
304
+ companyName,
305
+ abn,
306
+ address,
307
+ sameAsCustomerDetails,
308
+ showPassword,
309
+ showConfirmPassword,
310
+ isLoading,
311
+ getStates,
312
+ validateForm,
313
+ togglePassword,
314
+ toggleConfirmPassword,
315
+ handleSameAsCustomerDetails,
316
+ alertMessage,
317
+ alertType,
318
+ showAlert,
319
+ displayAlert,
320
+ dismissAlert,
321
+ handleSignup,
322
+ initializeShippingData,
323
+ resetForm
49
324
  };
50
325
  }
@@ -0,0 +1,121 @@
1
+ export interface ShippingAddress {
2
+ id: string | number | null;
3
+ firstname: string;
4
+ lastname: string;
5
+ address: string;
6
+ saddress?: string;
7
+ suburb: string;
8
+ state: string;
9
+ state_id: string | number | null;
10
+ country: string;
11
+ country_id: string | number;
12
+ postcode: string;
13
+ mobile: string;
14
+ shipping: number;
15
+ billing: number;
16
+ }
17
+ export declare function useShippingAddress(): {
18
+ showModal: import("vue").Ref<boolean, boolean>;
19
+ isEditMode: import("vue").Ref<boolean, boolean>;
20
+ showDeleteModal: import("vue").Ref<boolean, boolean>;
21
+ currentAddress: import("vue").Ref<{
22
+ id: string | number | null;
23
+ firstname: string;
24
+ lastname: string;
25
+ address: string;
26
+ saddress?: string | undefined;
27
+ suburb: string;
28
+ state: string;
29
+ state_id: string | number | null;
30
+ country: string;
31
+ country_id: string | number;
32
+ postcode: string;
33
+ mobile: string;
34
+ shipping: number;
35
+ billing: number;
36
+ } | null, ShippingAddress | {
37
+ id: string | number | null;
38
+ firstname: string;
39
+ lastname: string;
40
+ address: string;
41
+ saddress?: string | undefined;
42
+ suburb: string;
43
+ state: string;
44
+ state_id: string | number | null;
45
+ country: string;
46
+ country_id: string | number;
47
+ postcode: string;
48
+ mobile: string;
49
+ shipping: number;
50
+ billing: number;
51
+ } | null>;
52
+ submitAddressReturn: import("vue").Ref<any, any>;
53
+ loading: import("vue").Ref<boolean, boolean>;
54
+ user: import("vue").ComputedRef<{
55
+ id: number;
56
+ fullname: string;
57
+ firstname: string;
58
+ lastname: string;
59
+ email: string;
60
+ avatar: string;
61
+ country_id: number | null;
62
+ country: {
63
+ id: number;
64
+ name: string;
65
+ emoji: string;
66
+ } | null;
67
+ state_id: number | null;
68
+ state: string | null;
69
+ suburb: string | null;
70
+ dob: string | null;
71
+ phone: string | null;
72
+ address: string | null;
73
+ mobile: string | null;
74
+ company: string | null;
75
+ addresses: {
76
+ id: number;
77
+ fullname: string | null;
78
+ firstname: string;
79
+ middlename: string | null;
80
+ lastname: string;
81
+ address: string;
82
+ suburb: string;
83
+ state: string | null;
84
+ state_id: number | null;
85
+ country: string;
86
+ country_id: number;
87
+ postcode: string;
88
+ mobile: string;
89
+ shipping: number;
90
+ billing: number;
91
+ }[];
92
+ created_at: string;
93
+ } | null>;
94
+ shippingAddresses: import("vue").ComputedRef<{
95
+ id: number;
96
+ fullname: string | null;
97
+ firstname: string;
98
+ middlename: string | null;
99
+ lastname: string;
100
+ address: string;
101
+ suburb: string;
102
+ state: string | null;
103
+ state_id: number | null;
104
+ country: string;
105
+ country_id: number;
106
+ postcode: string;
107
+ mobile: string;
108
+ shipping: number;
109
+ billing: number;
110
+ }[]>;
111
+ clearMessages: () => void;
112
+ openAddModal: () => void;
113
+ openEditModal: (address: any) => void;
114
+ closeModal: () => void;
115
+ openDeleteModal: (address: any) => void;
116
+ closeDeleteModal: () => void;
117
+ submitAddress: () => Promise<void>;
118
+ setShipping: (address: any) => Promise<void>;
119
+ deleteAddress: () => Promise<void>;
120
+ autoClearMessages: () => void;
121
+ };
@@ -0,0 +1,145 @@
1
+ import { ref, computed } from "vue";
2
+ import { useAuthStore } from "../../stores/auth.js";
3
+ export function useShippingAddress() {
4
+ const authStore = useAuthStore();
5
+ const user = computed(() => authStore.user);
6
+ const shippingAddresses = computed(() => {
7
+ return user.value?.addresses?.filter((a) => a.billing == 0) ?? [];
8
+ });
9
+ const showModal = ref(false);
10
+ const isEditMode = ref(false);
11
+ const showDeleteModal = ref(false);
12
+ const currentAddress = ref(null);
13
+ const submitAddressReturn = ref(null);
14
+ const loading = ref(false);
15
+ const clearMessages = () => {
16
+ submitAddressReturn.value = null;
17
+ };
18
+ const openAddModal = () => {
19
+ clearMessages();
20
+ isEditMode.value = false;
21
+ currentAddress.value = {
22
+ id: null,
23
+ firstname: "",
24
+ lastname: "",
25
+ address: "",
26
+ suburb: "",
27
+ state: "",
28
+ state_id: null,
29
+ country: "Australia",
30
+ country_id: "",
31
+ postcode: "",
32
+ mobile: "",
33
+ shipping: 1,
34
+ billing: 0
35
+ };
36
+ showModal.value = true;
37
+ };
38
+ const openEditModal = (address) => {
39
+ clearMessages();
40
+ isEditMode.value = true;
41
+ currentAddress.value = {
42
+ ...address,
43
+ saddress: address.address
44
+ };
45
+ showModal.value = true;
46
+ };
47
+ const closeModal = () => {
48
+ clearMessages();
49
+ showModal.value = false;
50
+ currentAddress.value = null;
51
+ };
52
+ const openDeleteModal = (address) => {
53
+ clearMessages();
54
+ currentAddress.value = address;
55
+ showDeleteModal.value = true;
56
+ };
57
+ const closeDeleteModal = () => {
58
+ clearMessages();
59
+ showDeleteModal.value = false;
60
+ currentAddress.value = null;
61
+ };
62
+ const submitAddress = async () => {
63
+ if (!currentAddress.value) return;
64
+ loading.value = true;
65
+ clearMessages();
66
+ try {
67
+ const method = currentAddress.value.id ? "update" : "add";
68
+ submitAddressReturn.value = await authStore.setAddress(currentAddress.value, method);
69
+ if (submitAddressReturn.value.status === "Success") {
70
+ await authStore.fetchProfile();
71
+ if (method === "update") {
72
+ submitAddressReturn.value.message = "Address Updated Successfully";
73
+ } else {
74
+ submitAddressReturn.value.message = "Address Created Successfully";
75
+ }
76
+ showModal.value = false;
77
+ }
78
+ } catch (error) {
79
+ console.error("Address submission error:", error);
80
+ } finally {
81
+ loading.value = false;
82
+ }
83
+ };
84
+ const setShipping = async (address) => {
85
+ loading.value = true;
86
+ clearMessages();
87
+ try {
88
+ submitAddressReturn.value = await authStore.setAddress(address, "setshipping");
89
+ if (submitAddressReturn.value.status === "Success") {
90
+ await authStore.fetchProfile();
91
+ submitAddressReturn.value.message = "Shipping Address Updated Successfully";
92
+ }
93
+ } catch (error) {
94
+ console.error("Set shipping error:", error);
95
+ } finally {
96
+ loading.value = false;
97
+ }
98
+ };
99
+ const deleteAddress = async () => {
100
+ if (!currentAddress.value) return;
101
+ loading.value = true;
102
+ clearMessages();
103
+ try {
104
+ submitAddressReturn.value = await authStore.setAddress(currentAddress.value, "delete");
105
+ if (submitAddressReturn.value.status === "Success") {
106
+ await authStore.fetchProfile();
107
+ showDeleteModal.value = false;
108
+ }
109
+ } catch (error) {
110
+ console.error("Delete address error:", error);
111
+ } finally {
112
+ loading.value = false;
113
+ }
114
+ };
115
+ const autoClearMessages = () => {
116
+ if (submitAddressReturn.value?.status !== void 0) {
117
+ setTimeout(() => {
118
+ submitAddressReturn.value = null;
119
+ }, 5e3);
120
+ }
121
+ };
122
+ return {
123
+ // State
124
+ showModal,
125
+ isEditMode,
126
+ showDeleteModal,
127
+ currentAddress,
128
+ submitAddressReturn,
129
+ loading,
130
+ // Computed
131
+ user,
132
+ shippingAddresses,
133
+ // Methods
134
+ clearMessages,
135
+ openAddModal,
136
+ openEditModal,
137
+ closeModal,
138
+ openDeleteModal,
139
+ closeDeleteModal,
140
+ submitAddress,
141
+ setShipping,
142
+ deleteAddress,
143
+ autoClearMessages
144
+ };
145
+ }
@@ -0,0 +1,21 @@
1
+ export declare function useUpdatePassword(): {
2
+ form: import("vue").Ref<{
3
+ currentPassword: string;
4
+ newPassword: string;
5
+ confirmPassword: string;
6
+ }, {
7
+ currentPassword: string;
8
+ newPassword: string;
9
+ confirmPassword: string;
10
+ } | {
11
+ currentPassword: string;
12
+ newPassword: string;
13
+ confirmPassword: string;
14
+ }>;
15
+ loading: import("vue").Ref<boolean, boolean>;
16
+ errorMessage: import("vue").Ref<string, string>;
17
+ successMessage: import("vue").Ref<string, string>;
18
+ updatePassword: () => Promise<boolean>;
19
+ clearMessages: () => void;
20
+ resetForm: () => void;
21
+ };