flowrix 1.0.1-beta.82 → 1.0.1-beta.83

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "flowrix",
3
3
  "configKey": "flowrix",
4
- "version": "1.0.1-beta.82",
4
+ "version": "1.0.1-beta.83",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -14,17 +14,15 @@ const module$1 = defineNuxtModule({
14
14
  runtimeConfig.FLOWRIX_API_ORIGIN ||= env.FLOWRIX_API_ORIGIN || "";
15
15
  runtimeConfig.FLOWRIX_API_BASE ||= env.FLOWRIX_API_BASE || "";
16
16
  runtimeConfig.FLOWRIX_API_BASE_V2 ||= env.FLOWRIX_API_BASE_V2 || "";
17
+ runtimeConfig.FLOWRIX_CACHE ||= env.FLOWRIX_CACHE || "";
17
18
  Object.assign(runtimeConfig.public, {
18
19
  ...runtimeConfig.public,
19
20
  FLOWRIX_API_KEY: runtimeConfig.public.FLOWRIX_API_KEY || env.FLOWRIX_API_KEY || "",
20
21
  FLOWRIX_API_SECRET: runtimeConfig.public.FLOWRIX_API_SECRET || env.FLOWRIX_API_SECRET || "",
21
22
  FLOWRIX_API_ORIGIN: runtimeConfig.public.FLOWRIX_API_ORIGIN || env.FLOWRIX_API_ORIGIN || "",
22
23
  FLOWRIX_API_BASE: runtimeConfig.public.FLOWRIX_API_BASE || env.FLOWRIX_API_BASE || "",
23
- FLOWRIX_API_BASE_V2: runtimeConfig.public.FLOWRIX_API_BASE_V2 || env.FLOWRIX_API_BASE_V2 || ""
24
- });
25
- console.info("\u2705 Flowrix runtime config loaded:", {
26
- apiKey: runtimeConfig.public.FLOWRIX_API_KEY,
27
- apiBase: runtimeConfig.public.FLOWRIX_API_BASE
24
+ FLOWRIX_API_BASE_V2: runtimeConfig.public.FLOWRIX_API_BASE_V2 || env.FLOWRIX_API_BASE_V2 || "",
25
+ FLOWRIX_CACHE: runtimeConfig.public.FLOWRIX_CACHE || env.FLOWRIX_CACHE || ""
28
26
  });
29
27
  const resolver = createResolver(import.meta.url);
30
28
  await installModule("@pinia/nuxt");
@@ -330,6 +328,10 @@ const module$1 = defineNuxtModule({
330
328
  route: "/api/cache/**",
331
329
  handler: resolver.resolve("./runtime/server/api/cache/[...slug].delete")
332
330
  });
331
+ addServerHandler({
332
+ route: "/sitemap/**",
333
+ handler: resolver.resolve("./runtime/server/api/generate/sitemap.get")
334
+ });
333
335
  }
334
336
  });
335
337
 
@@ -1,19 +1,43 @@
1
1
  export default function (inputData: any): {
2
2
  checkoutStore: import("pinia").Store<"checkout", import("../../stores/Checkout.js").CheckoutState, {}, {}>;
3
- passwordShow: import("vue").Ref<string, string>;
4
- password: import("vue").Ref<string, string>;
5
- password_confirmationShow: import("vue").Ref<string, string>;
6
- updateBillingAddress: (billingfield: any) => void;
7
- UserAccount: import("vue").Ref<boolean, boolean>;
8
- CheckUserAccount: (billingDetails: any, userEmail: string) => Promise<void>;
9
- CheckingUserAccount: import("vue").Ref<boolean, boolean>;
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
- UpdateStripe: (inputData: any) => Promise<void>;
16
3
  Countries: import("vue").Ref<never[], never[]>;
17
4
  ChangeCountry: (billingfield: any) => Promise<void>;
18
5
  States: import("vue").Ref<never[], never[]>;
6
+ getUserBillingAddresses: import("vue").ComputedRef<{
7
+ id: number;
8
+ fullname: string | null;
9
+ firstname: string;
10
+ middlename: string | null;
11
+ lastname: string;
12
+ address: string;
13
+ suburb: string;
14
+ state: string | null;
15
+ state_id: number | null;
16
+ country: string;
17
+ country_id: number;
18
+ postcode: string;
19
+ mobile: string;
20
+ shipping: number;
21
+ billing: number;
22
+ }[]>;
23
+ getPrimaryBillingAddress: import("vue").ComputedRef<{
24
+ id: number;
25
+ fullname: string | null;
26
+ firstname: string;
27
+ middlename: string | null;
28
+ lastname: string;
29
+ address: string;
30
+ suburb: string;
31
+ state: string | null;
32
+ state_id: number | null;
33
+ country: string;
34
+ country_id: number;
35
+ postcode: string;
36
+ mobile: string;
37
+ shipping: number;
38
+ billing: number;
39
+ } | null>;
40
+ fillBillingAddressFields: (billingAddress: any) => void;
41
+ handleBillingAddressSelect: (event: Event) => void;
42
+ updateBillingAddress: (billingfield: any) => void;
19
43
  };
@@ -2,20 +2,40 @@ import { ref, computed, onMounted } from "vue";
2
2
  import { useCheckoutStore } from "../../stores/Checkout.js";
3
3
  import { useCountry } from "../Extras/useCountry.js";
4
4
  import { useCompanyProfile } from "../../stores/useCompanyProfile.js";
5
- import useStripe from "./PaymentMethods/useStripe.js";
6
- import { usePasswordFormatter } from "../Extras/usePasswordFormatter.js";
5
+ import { useAuthStore } from "../../stores/auth.js";
7
6
  export default function(inputData) {
8
7
  const checkoutStore = useCheckoutStore();
9
- const passwordShow = ref("password");
10
- const password = ref("");
11
- const password_confirmationShow = ref("password");
8
+ const authStore = useAuthStore();
12
9
  const CountryData = useCountry().data;
13
10
  const States = ref([]);
14
11
  const Countries = ref([]);
12
+ const getUserBillingAddresses = computed(() => {
13
+ if (!authStore.user || !authStore.user.addresses) return [];
14
+ return authStore.user.addresses.filter((address) => address.billing === 1);
15
+ });
16
+ const getPrimaryBillingAddress = computed(() => {
17
+ const billingAddresses = getUserBillingAddresses.value;
18
+ return billingAddresses.length > 0 ? billingAddresses[0] : null;
19
+ });
15
20
  const GetStates = async (countryID) => {
21
+ return States.value;
16
22
  };
17
23
  onMounted(() => {
18
24
  GetStates(inputData.billing_country);
25
+ if (authStore.isAuthenticated && getPrimaryBillingAddress.value) {
26
+ const billingAddr = getPrimaryBillingAddress.value;
27
+ inputData.billing_firstname = billingAddr.firstname || "";
28
+ inputData.billing_lastname = billingAddr.lastname || "";
29
+ inputData.billing_fullname = billingAddr.fullname || "";
30
+ inputData.billing_address = billingAddr.address || "";
31
+ inputData.billing_suburb = billingAddr.suburb || "";
32
+ inputData.billing_state = billingAddr.state_id || "";
33
+ inputData.billing_country = billingAddr.country_id || "";
34
+ inputData.billing_postcode = billingAddr.postcode || "";
35
+ inputData.billing_mobile = billingAddr.mobile || "";
36
+ inputData.billing_address_id = billingAddr.id || "";
37
+ updateBillingAddress(inputData);
38
+ }
19
39
  });
20
40
  const ChangeCountry = async (billingfield) => {
21
41
  if (billingfield.billing_country == void 0) {
@@ -24,64 +44,41 @@ export default function(inputData) {
24
44
  let newstates = await GetStates(billingfield.billing_country);
25
45
  checkoutStore.saveToCheckoutSession(billingfield);
26
46
  };
47
+ const fillBillingAddressFields = (billingAddress) => {
48
+ if (!billingAddress) return;
49
+ inputData.billing_firstname = billingAddress.firstname || "";
50
+ inputData.billing_lastname = billingAddress.lastname || "";
51
+ inputData.billing_fullname = billingAddress.fullname || "";
52
+ inputData.billing_address = billingAddress.address || "";
53
+ inputData.billing_suburb = billingAddress.suburb || "";
54
+ inputData.billing_state = billingAddress.state_id || "";
55
+ inputData.billing_country = billingAddress.country_id || "";
56
+ inputData.billing_postcode = billingAddress.postcode || "";
57
+ inputData.billing_mobile = billingAddress.mobile || "";
58
+ inputData.billing_address_id = billingAddress.id || "";
59
+ updateBillingAddress(inputData);
60
+ };
27
61
  const updateBillingAddress = ((billingfield) => {
28
- if (billingfield.register == false) {
29
- billingfield.password = "";
30
- billingfield.password_confirmation = "";
31
- }
32
62
  checkoutStore.saveToCheckoutSession(billingfield);
33
63
  });
34
- const { passwordStrength, passwordStrengthClass, passwordStrengthValue, passwordStrengthWidth, passwordStrengthTextColor } = usePasswordFormatter(password, inputData);
35
- const UserAccount = ref(true);
36
- const timeout = ref("");
37
- const CheckingUserAccount = ref(false);
38
- const CheckUserAccount = (async (billingDetails, userEmail) => {
39
- if (timeout.value) {
40
- clearTimeout(timeout.value);
41
- }
42
- timeout.value = setTimeout(async () => {
43
- billingDetails.register = false;
44
- billingDetails.password = "";
45
- billingDetails.password_confirmation = "";
46
- if (userEmail != "") {
47
- CheckingUserAccount.value = true;
48
- await checkoutStore.CheckUserAccount(userEmail);
49
- if (checkoutStore.checkCustomer.status == "Error") {
50
- UserAccount.value = true;
51
- } else {
52
- UserAccount.value = false;
53
- }
54
- } else {
55
- UserAccount.value = true;
64
+ const handleBillingAddressSelect = (event) => {
65
+ const selectedAddressId = event.target.value;
66
+ if (selectedAddressId) {
67
+ const selectedAddress = getUserBillingAddresses.value.find((addr) => addr.id == parseInt(selectedAddressId));
68
+ if (selectedAddress) {
69
+ fillBillingAddressFields(selectedAddress);
56
70
  }
57
- CheckingUserAccount.value = false;
58
- }, 1e3);
59
- });
60
- const UpdateStripe = (async (inputData2) => {
61
- await checkoutStore.saveToCheckoutSession(inputData2);
62
- const { getpaymentMethod } = useStripe();
63
- const totalPrice = computed(() => {
64
- return checkoutStore.config ? checkoutStore.config.calculations.total : checkoutStore.config.total;
65
- });
66
- getpaymentMethod("web-stripe", inputData2, totalPrice.value);
67
- });
71
+ }
72
+ };
68
73
  return {
69
74
  checkoutStore,
70
- passwordShow,
71
- password,
72
- password_confirmationShow,
73
- updateBillingAddress,
74
- UserAccount,
75
- CheckUserAccount,
76
- CheckingUserAccount,
77
- passwordStrength,
78
- passwordStrengthClass,
79
- passwordStrengthValue,
80
- passwordStrengthWidth,
81
- passwordStrengthTextColor,
82
- UpdateStripe,
83
75
  Countries,
84
76
  ChangeCountry,
85
- States
77
+ States,
78
+ getUserBillingAddresses,
79
+ getPrimaryBillingAddress,
80
+ fillBillingAddressFields,
81
+ handleBillingAddressSelect,
82
+ updateBillingAddress
86
83
  };
87
84
  }
@@ -6,4 +6,50 @@ export default function (inputData: any): {
6
6
  Countries: import("vue").ComputedRef<any>;
7
7
  ChangeCountry: (shippingfield: any) => Promise<void>;
8
8
  States: import("vue").Ref<never[], never[]>;
9
+ getUserShippingAddresses: import("vue").ComputedRef<{
10
+ id: number;
11
+ fullname: string | null;
12
+ firstname: string;
13
+ middlename: string | null;
14
+ lastname: string;
15
+ address: string;
16
+ suburb: string;
17
+ state: string | null;
18
+ state_id: number | null;
19
+ country: string;
20
+ country_id: number;
21
+ postcode: string;
22
+ mobile: string;
23
+ shipping: number;
24
+ billing: number;
25
+ }[]>;
26
+ getPrimaryShippingAddress: import("vue").ComputedRef<{
27
+ id: number;
28
+ fullname: string | null;
29
+ firstname: string;
30
+ middlename: string | null;
31
+ lastname: string;
32
+ address: string;
33
+ suburb: string;
34
+ state: string | null;
35
+ state_id: number | null;
36
+ country: string;
37
+ country_id: number;
38
+ postcode: string;
39
+ mobile: string;
40
+ shipping: number;
41
+ billing: number;
42
+ } | null>;
43
+ passwordShow: import("vue").Ref<string, string>;
44
+ password: import("vue").Ref<string, string>;
45
+ password_confirmationShow: import("vue").Ref<string, string>;
46
+ updateBillingAddress: (billingfield: any) => void;
47
+ UserAccount: import("vue").Ref<boolean, boolean>;
48
+ CheckUserAccount: (billingDetails: any, userEmail: string) => Promise<void>;
49
+ CheckingUserAccount: import("vue").Ref<boolean, boolean>;
50
+ passwordStrength: import("vue").ComputedRef<"Password must be 8 characters" | "Strong" | "Medium" | "Weak">;
51
+ passwordStrengthClass: import("vue").ComputedRef<"bg-danger" | "bg-success" | "bg-warning">;
52
+ passwordStrengthValue: import("vue").ComputedRef<number>;
53
+ passwordStrengthWidth: import("vue").ComputedRef<string>;
54
+ passwordStrengthTextColor: import("vue").ComputedRef<"text-danger" | "text-success" | "text-black">;
9
55
  };
@@ -4,29 +4,55 @@ import { useCountry } from "../Extras/useCountry.js";
4
4
  import { useCompanyProfile } from "../../stores/useCompanyProfile.js";
5
5
  import useStripe from "./PaymentMethods/useStripe.js";
6
6
  import { useAuthStore } from "../../stores/auth.js";
7
+ import { usePasswordFormatter } from "../Extras/usePasswordFormatter.js";
7
8
  export default function(inputData) {
8
- const {
9
- status,
10
- data,
11
- lastRefreshedAt,
12
- token,
13
- refreshToken,
14
- getSession,
15
- signUp,
16
- signIn,
17
- signOut,
18
- refresh
19
- } = useAuthStore();
20
- const AuthStore = ref();
9
+ const authStore = useAuthStore();
21
10
  const checkoutStore = useCheckoutStore();
22
11
  const CountryData = useCountry().data;
23
12
  const Countries = computed(() => CountryData.countries);
24
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
+ });
25
37
  const GetStates = async (countryID) => {
26
38
  return States.value;
27
39
  };
28
40
  onMounted(() => {
29
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
+ }
30
56
  });
31
57
  const ChangeCountry = async (shippingfield) => {
32
58
  if (shippingfield.shipping_country == void 0) {
@@ -38,34 +64,73 @@ export default function(inputData) {
38
64
  const updateShippingAddress = ((shippingfield) => {
39
65
  checkoutStore.saveToCheckoutSession(shippingfield);
40
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
+ });
41
96
  const sameAsBilling = (async (sameasbilling = false, inputData2) => {
42
- const LoggedInUser = status;
43
- if (AuthStore.isAuthenticated) {
44
- const billingAddres = UserData.addresses.filter((address) => address.billing == 1)[0];
45
- const shippingAddres = UserData.addresses.filter((address) => address.shipping == 1)[0];
46
- inputData2.billing_firstname = LoggedInUser.firstname;
47
- inputData2.billing_lastname = LoggedInUser.lastname;
48
- inputData2.email = LoggedInUser.email;
49
- inputData2.billing_mobile = LoggedInUser.mobile;
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 || "";
50
105
  if (sameasbilling == true) {
51
- inputData2.billing_firstname = inputData2.shipping_firstname ? inputData2.shipping_firstname : billingAddres.firstname;
52
- inputData2.billing_lastname = inputData2.shipping_lastname ? inputData2.shipping_lastname : billingAddres.lastname;
53
- inputData2.billing_address = inputData2.shipping_address ? inputData2.shipping_address : billingAddres.address;
54
- inputData2.billing_postcode = inputData2.shipping_postcode ? inputData2.shipping_postcode : billingAddres.postcode;
55
- inputData2.billing_state = inputData2.shipping_state ? inputData2.shipping_state : billingAddres.state_id;
56
- inputData2.billing_suburb = inputData2.shipping_suburb ? inputData2.shipping_suburb : billingAddres.suburb;
57
- inputData2.billing_mobile = inputData2.shipping_mobile ? inputData2.shipping_mobile : billingAddres.mobile;
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 || "";
58
113
  } else {
59
- if (billingAddres.length != void 0) {
60
- inputData2.billing_firstname = inputData2.billing_firstname ? inputData2.billing_firstname : billingAddres.firstname;
61
- inputData2.billing_lastname = inputData2.billing_lastname ? inputData2.billing_lastname : billingAddres.lastname;
62
- inputData2.billing_address = inputData2.billing_address ? inputData2.billing_address : billingAddres.address;
63
- inputData2.billing_postcode = inputData2.billing_postcode ? inputData2.billing_postcode : billingAddres.postcode;
64
- inputData2.billing_state = inputData2.billing_state ? inputData2.billing_state : billingAddres.state_id;
65
- inputData2.billing_suburb = inputData2.billing_suburb ? inputData2.billing_suburb : billingAddres.suburb;
66
- inputData2.billing_mobile = inputData2.billing_mobile ? inputData2.billing_mobile : billingAddres.mobile;
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 || "";
67
122
  }
68
- if (shippingAddres != void 0) {
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 {
69
134
  inputData2.shipping_fullname = "";
70
135
  inputData2.shipping_firstname = "";
71
136
  inputData2.shipping_lastname = "";
@@ -74,25 +139,16 @@ export default function(inputData) {
74
139
  inputData2.shipping_state = "";
75
140
  inputData2.shipping_suburb = "";
76
141
  inputData2.shipping_mobile = "";
77
- inputData2.shipping_fullname = shippingAddres.fullname;
78
- inputData2.shipping_firstname = shippingAddres.firstname;
79
- inputData2.shipping_lastname = shippingAddres.lastname;
80
- inputData2.shipping_address = shippingAddres.address;
81
- inputData2.shipping_postcode = shippingAddres.postcode;
82
- inputData2.shipping_state = shippingAddres.state_id;
83
- inputData2.shipping_suburb = shippingAddres.suburb;
84
- inputData2.shipping_mobile = shippingAddres.mobile;
85
- inputData2.shipping_address_id = shippingAddres.id;
86
142
  }
87
143
  }
88
- } else if (!AuthStore.isAuthenticated && sameasbilling == true) {
89
- inputData2.shipping_firstname = inputData2.billing_firstname ? inputData2.billing_firstname : "";
90
- inputData2.shipping_lastname = inputData2.billing_lastname ? inputData2.billing_lastname : "";
91
- inputData2.shipping_address = inputData2.billing_address ? inputData2.billing_address : "";
92
- inputData2.shipping_postcode = inputData2.billing_postcode ? inputData2.billing_postcode : "";
93
- inputData2.shipping_state = inputData2.billing_state ? inputData2.billing_state : "";
94
- inputData2.shipping_suburb = inputData2.billing_suburb ? inputData2.billing_suburb : "";
95
- inputData2.shipping_mobile = inputData2.billing_mobile ? inputData2.billing_mobile : "";
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 || "";
96
152
  } else {
97
153
  inputData2.shipping_fullname = "";
98
154
  inputData2.shipping_firstname = "";
@@ -121,6 +177,20 @@ export default function(inputData) {
121
177
  UpdateStripe,
122
178
  Countries,
123
179
  ChangeCountry,
124
- States
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
125
195
  };
126
196
  }
@@ -1,4 +1,5 @@
1
1
  import { defineAsyncComponent } from "vue";
2
+ import { GTM_view_item } from "../useDataLayer.js";
2
3
  export function useProductComponent(product) {
3
4
  const templateName = "Template-" + product.template;
4
5
  const components = import.meta.glob(
@@ -15,6 +16,7 @@ export function useProductComponent(product) {
15
16
  }
16
17
  }
17
18
  });
19
+ GTM_view_item(product, product.rrpfloat, product.rpfloat);
18
20
  return {
19
21
  Template
20
22
  };
@@ -68,6 +68,7 @@ export { useSendQuickValues } from './Product/useQuickView.js';
68
68
  export { useAddToCart } from './useAddToCart.js';
69
69
  export { useCards } from './useCards.js';
70
70
  export { useClientApi } from './useClientApi.js';
71
+ export { GTM_page_view, GTM_view_item, GTM_view_item_list, GTM_view_cart, GTM_add_to_cart, GTM_remove_from_cart, GTM_begin_checkout, GTM_add_shipping_info, GTM_add_payment_info, GTM_purchase, GTM_select_item_color, GTM_select_item_collection, GTM_Attribute_Content } from './useDataLayer.js';
71
72
  export { useDynamicHtmlRenderer } from './useDynamicHtmlRenderer.js';
72
73
  export { useLocation } from './useLocation.js';
73
74
  export { useLocations } from './useLocations.js';
@@ -68,6 +68,7 @@ export { useSendQuickValues } from "./Product/useQuickView.js";
68
68
  export { useAddToCart } from "./useAddToCart.js";
69
69
  export { useCards } from "./useCards.js";
70
70
  export { useClientApi } from "./useClientApi.js";
71
+ export { GTM_page_view, GTM_view_item, GTM_view_item_list, GTM_view_cart, GTM_add_to_cart, GTM_remove_from_cart, GTM_begin_checkout, GTM_add_shipping_info, GTM_add_payment_info, GTM_purchase, GTM_select_item_color, GTM_select_item_collection, GTM_Attribute_Content } from "./useDataLayer.js";
71
72
  export { useDynamicHtmlRenderer } from "./useDynamicHtmlRenderer.js";
72
73
  export { useLocation } from "./useLocation.js";
73
74
  export { useLocations } from "./useLocations.js";
@@ -9,7 +9,7 @@ const getDataLayer = () => {
9
9
  };
10
10
  const getCurrencyCode = () => {
11
11
  const companyProfile = useCompanyProfile();
12
- return companyProfile.profile?.currencyCode || "USD";
12
+ return companyProfile.profile?.data?.currencyCode || "USD";
13
13
  };
14
14
  export function GTM_page_view(to) {
15
15
  const dataLayer = getDataLayer();
@@ -112,6 +112,7 @@ export function GTM_view_cart(cart = null) {
112
112
  });
113
113
  }
114
114
  export function GTM_add_to_cart(lastitem = null) {
115
+ console.log(lastitem);
115
116
  const dataLayer = getDataLayer();
116
117
  if (!dataLayer || !lastitem) return;
117
118
  let price = lastitem.pricefloat;
@@ -24,6 +24,7 @@ export default defineEventHandler(async (event) => {
24
24
  const cacheKey = `${slug}-${JSON.stringify(query)}`;
25
25
  const fileName = cacheKey.replace(/[^a-zA-Z0-9-_]/g, "_");
26
26
  const filePath = join(CACHE_DIR, `${fileName}-${customerType}.json`);
27
+ console.log("CACHE_DIR", filePath);
27
28
  try {
28
29
  const fileContent = await readFile(filePath, "utf-8");
29
30
  const category = JSON.parse(fileContent);
@@ -42,8 +43,10 @@ export default defineEventHandler(async (event) => {
42
43
  "scope[withchildren]": "true"
43
44
  };
44
45
  const category = await flowrixApi.get(`categories/${slug}`, apiConfig, { query });
45
- await ensureCacheDir();
46
- await writeFile(filePath, JSON.stringify(category, null, 2), "utf-8");
46
+ if (config.public.FLOWRIX_CACHE == true) {
47
+ await ensureCacheDir();
48
+ await writeFile(filePath, JSON.stringify(category, null, 2), "utf-8");
49
+ }
47
50
  return category;
48
51
  } catch (error) {
49
52
  throw createError({
@@ -0,0 +1,5 @@
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<"site map" | {
2
+ success: boolean;
3
+ message: string;
4
+ }>>;
5
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import {
2
+ defineEventHandler,
3
+ setResponseStatus
4
+ } from "h3";
5
+ export default defineEventHandler(async (event) => {
6
+ try {
7
+ return "site map";
8
+ } catch (error) {
9
+ console.error("File save error:", error);
10
+ setResponseStatus(event, 500);
11
+ return { success: false, message: "Failed to download or save files" };
12
+ }
13
+ });
@@ -2,6 +2,7 @@ import { defineStore } from "pinia";
2
2
  import { flowrixApi } from "../middleware/flowrix.js";
3
3
  import { useCheckoutStore } from "./Checkout.js";
4
4
  import { useRuntimeConfig } from "#imports";
5
+ import { GTM_add_to_cart } from "../composables/useDataLayer.js";
5
6
  export const useCartStore = defineStore("cart", {
6
7
  state: () => ({
7
8
  cart: {},
@@ -79,7 +80,9 @@ export const useCartStore = defineStore("cart", {
79
80
  ["totals"]: response?.data.calculations,
80
81
  ["abndToken"]: response?.data.abndToken
81
82
  };
82
- this.lastitem = response?.data.lastItem;
83
+ this.lastitem = response?.data.lastitem;
84
+ GTM_add_to_cart(response?.data.lastitem);
85
+ GTM_remove_from_cart(response?.data.lastitem);
83
86
  useCheckoutStore().saveToCheckoutSession({
84
87
  cart: response?.data,
85
88
  calculations: response?.data.calculations,
@@ -136,7 +139,8 @@ export const useCartStore = defineStore("cart", {
136
139
  ["totals"]: response?.data.calculations,
137
140
  ["abndToken"]: response?.data.abndToken
138
141
  };
139
- this.lastitem = response?.data.lastItem;
142
+ this.lastitem = response?.data.lastitem;
143
+ GTM_remove_from_cart(response?.data.lastitem);
140
144
  useCheckoutStore().saveToCheckoutSession({
141
145
  cart: response.cart.items,
142
146
  calculations: response.cart.calculations,
@@ -175,7 +179,7 @@ export const useCartStore = defineStore("cart", {
175
179
  ["totals"]: response?.data.calculations,
176
180
  ["abndToken"]: response?.data.abndToken
177
181
  };
178
- this.lastitem = response?.data.lastItem;
182
+ this.lastitem = response?.data.lastitem;
179
183
  if (qty < product.qty) {
180
184
  GTM_remove_from_cart(this.lastitem);
181
185
  META_remove_from_cart(this.lastitem);
@@ -230,7 +234,7 @@ export const useCartStore = defineStore("cart", {
230
234
  ["totals"]: response?.data.calculations,
231
235
  ["abndToken"]: response?.data.abndToken
232
236
  };
233
- this.lastitem = response?.data.lastItem;
237
+ this.lastitem = response?.data.lastitem;
234
238
  useCheckoutStore().saveToCheckoutSession({
235
239
  cart: response?.data,
236
240
  calculations: response?.data.calculations,
@@ -1,6 +1,7 @@
1
1
  import { promises as fs } from "fs";
2
2
  import { join } from "path";
3
3
  import { getRequestURL, defineEventHandler, getCookie } from "h3";
4
+ import { useRuntimeConfig } from "#imports";
4
5
  const cacheDir = join("/tmp", ".cache", "html");
5
6
  async function ensureDir() {
6
7
  await fs.mkdir(cacheDir, { recursive: true });
@@ -39,7 +40,8 @@ export async function clearCache() {
39
40
  }
40
41
  export default defineEventHandler(async (event) => {
41
42
  const url = getRequestURL(event);
42
- const customerType = getCookie(event, "customertype") || "";
43
+ const config = useRuntimeConfig();
44
+ const customerType = getCookie(event, "customertype") || 1;
43
45
  if (event.method !== "GET" || !event.headers.get("accept")?.includes("text/html")) return;
44
46
  const cached = await readCache(url, customerType);
45
47
  if (cached) {
@@ -52,7 +54,9 @@ export default defineEventHandler(async (event) => {
52
54
  if (chunk) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
53
55
  const html = Buffer.concat(chunks).toString("utf-8");
54
56
  if (event.node.res.statusCode === 200 && html.includes("<!DOCTYPE html>")) {
55
- writeCache(url, html, customerType);
57
+ if (config.public.FLOWRIX_CACHE == true) {
58
+ writeCache(url, html, customerType);
59
+ }
56
60
  }
57
61
  return originalEnd.apply(this, arguments);
58
62
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowrix",
3
- "version": "1.0.1-beta.82",
3
+ "version": "1.0.1-beta.83",
4
4
  "description": "Plug-and-play Nuxt eCommerce cart powered by FLOWRiX. Subscription required.",
5
5
  "license": "MIT",
6
6
  "type": "module",