flowrix 1.0.1-beta.3 → 1.0.1-beta.31

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 (33) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +33 -20
  3. package/dist/runtime/composables/Cart/useCartDetail.d.ts +15 -5
  4. package/dist/runtime/composables/Cart/useCartDetail.js +3 -0
  5. package/dist/runtime/composables/Checkout/useBillingAddress.d.ts +14 -6
  6. package/dist/runtime/composables/Checkout/useBillingAddress.js +6 -1
  7. package/dist/runtime/composables/Checkout/useCheckout.d.ts +93 -74
  8. package/dist/runtime/composables/Checkout/useCheckout.js +6 -0
  9. package/dist/runtime/composables/Checkout/useCreateAccount.d.ts +14 -6
  10. package/dist/runtime/composables/Checkout/useCreateAccount.js +2 -0
  11. package/dist/runtime/composables/Checkout/useDeliveryMethod.d.ts +9 -1
  12. package/dist/runtime/composables/Checkout/useDeliveryMethod.js +3 -2
  13. package/dist/runtime/composables/Checkout/useShippingAddress.d.ts +9 -1
  14. package/dist/runtime/composables/Checkout/useShippingAddress.js +5 -1
  15. package/dist/runtime/composables/Customer/useRegister.d.ts +2 -2
  16. package/dist/runtime/composables/Customer/useRegister.js +2 -0
  17. package/dist/runtime/composables/Extras/useCountry.d.ts +6 -6
  18. package/dist/runtime/composables/Extras/useCountry.js +7 -9
  19. package/dist/runtime/composables/Header/useHeader.d.ts +1 -1
  20. package/dist/runtime/composables/useAddToCart.js +1 -0
  21. package/dist/runtime/composables/useSearch.js +1 -1
  22. package/dist/runtime/middleware/flowrix.d.ts +1 -0
  23. package/dist/runtime/middleware/flowrix.js +20 -5
  24. package/dist/runtime/server/api/cache/[...slug].delete.d.ts +2 -0
  25. package/dist/runtime/server/api/cache/[...slug].delete.js +40 -0
  26. package/dist/runtime/server/api/cache/clean.get.d.ts +5 -0
  27. package/dist/runtime/server/api/cache/clean.get.js +16 -0
  28. package/dist/runtime/stores/Cart.js +2 -4
  29. package/dist/runtime/stores/Checkout.d.ts +8 -6
  30. package/dist/runtime/stores/Search.d.ts +5 -0
  31. package/dist/runtime/utils/htmlCache.d.ts +5 -0
  32. package/dist/runtime/utils/htmlCache.js +54 -0
  33. package/package.json +20 -19
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.3",
4
+ "version": "1.0.1-beta.31",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { defineNuxtModule, createResolver, installModule, addImportsDir, addPlugin, addImports, addServerHandler } from '@nuxt/kit';
1
+ import { defineNuxtModule, createResolver, installModule, addServerHandler, addImportsDir, addPlugin, addImports } from '@nuxt/kit';
2
2
 
3
3
  const module = defineNuxtModule({
4
4
  meta: {
@@ -7,28 +7,33 @@ const module = defineNuxtModule({
7
7
  },
8
8
  defaults: {},
9
9
  async setup(_options, nuxt) {
10
- nuxt.options.runtimeConfig = {
11
- ...nuxt.options.runtimeConfig,
12
- // Server-only key
13
- FLOWRIX_API_KEY: nuxt.options.runtimeConfig.FLOWRIX_API_KEY || process.env.FLOWRIX_API_KEY || "",
14
- FLOWRIX_API_SECRET: nuxt.options.runtimeConfig.FLOWRIX_API_SECRET || process.env.FLOWRIX_API_SECRET || "",
15
- FLOWRIX_API_ORIGIN: nuxt.options.runtimeConfig.FLOWRIX_API_ORIGIN || process.env.FLOWRIX_API_ORIGIN || "",
16
- FLOWRIX_API_BASE: nuxt.options.runtimeConfig.FLOWRIX_API_BASE || process.env.FLOWRIX_API_BASE || "",
17
- FLOWRIX_API_BASE_V2: nuxt.options.runtimeConfig.FLOWRIX_API_BASE_V2 || process.env.FLOWRIX_API_BASE_V2 || "",
18
- public: {
19
- ...nuxt.options.runtimeConfig.public,
20
- // Client-exposed key
21
- FLOWRIX_API_KEY: nuxt.options.runtimeConfig.public?.FLOWRIX_API_KEY || process.env.FLOWRIX_API_KEY || "",
22
- FLOWRIX_API_SECRET: nuxt.options.runtimeConfig.public?.FLOWRIX_API_SECRET || process.env.FLOWRIX_API_SECRET || "",
23
- FLOWRIX_API_ORIGIN: nuxt.options.runtimeConfig.public?.FLOWRIX_API_ORIGIN || process.env.FLOWRIX_API_ORIGIN || "",
24
- FLOWRIX_API_BASE: nuxt.options.runtimeConfig.public?.FLOWRIX_API_BASE || process.env.FLOWRIX_API_BASE || "",
25
- FLOWRIX_API_BASE_V2: nuxt.options.runtimeConfig.public?.FLOWRIX_API_BASE_V2 || process.env.FLOWRIX_API_BASE_V2 || ""
26
- }
27
- };
10
+ const env = process.env;
11
+ const runtimeConfig = nuxt.options.runtimeConfig;
12
+ runtimeConfig.FLOWRIX_API_KEY ||= env.FLOWRIX_API_KEY || "";
13
+ runtimeConfig.FLOWRIX_API_SECRET ||= env.FLOWRIX_API_SECRET || "";
14
+ runtimeConfig.FLOWRIX_API_ORIGIN ||= env.FLOWRIX_API_ORIGIN || "";
15
+ runtimeConfig.FLOWRIX_API_BASE ||= env.FLOWRIX_API_BASE || "";
16
+ runtimeConfig.FLOWRIX_API_BASE_V2 ||= env.FLOWRIX_API_BASE_V2 || "";
17
+ Object.assign(runtimeConfig.public, {
18
+ ...runtimeConfig.public,
19
+ FLOWRIX_API_KEY: runtimeConfig.public.FLOWRIX_API_KEY || env.FLOWRIX_API_KEY || "",
20
+ FLOWRIX_API_SECRET: runtimeConfig.public.FLOWRIX_API_SECRET || env.FLOWRIX_API_SECRET || "",
21
+ FLOWRIX_API_ORIGIN: runtimeConfig.public.FLOWRIX_API_ORIGIN || env.FLOWRIX_API_ORIGIN || "",
22
+ 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
28
+ });
28
29
  const resolver = createResolver(import.meta.url);
29
30
  await installModule("@pinia/nuxt");
30
- addImportsDir(resolver.resolve("./runtime/composables"));
31
+ addServerHandler({
32
+ middleware: true,
33
+ handler: resolver.resolve("./runtime/utils/htmlCache")
34
+ });
31
35
  addImportsDir(resolver.resolve("./runtime/stores"));
36
+ addImportsDir(resolver.resolve("./runtime/composables"));
32
37
  addPlugin({
33
38
  src: resolver.resolve("./runtime/plugin"),
34
39
  mode: "all"
@@ -265,6 +270,14 @@ const module = defineNuxtModule({
265
270
  route: "/api/v2/**",
266
271
  handler: resolver.resolve("./runtime/server/api/v2/[...slug]")
267
272
  });
273
+ addServerHandler({
274
+ route: "/api/cache/clean",
275
+ handler: resolver.resolve("./runtime/server/api/cache/clean.get")
276
+ });
277
+ addServerHandler({
278
+ route: "/api/cache/**",
279
+ handler: resolver.resolve("./runtime/server/api/cache/[...slug].delete")
280
+ });
268
281
  }
269
282
  });
270
283
 
@@ -1,4 +1,4 @@
1
- interface Product {
1
+ export interface Product {
2
2
  name: string;
3
3
  height?: number;
4
4
  width?: number;
@@ -32,18 +32,28 @@ interface Product {
32
32
  per_order_pricing: number;
33
33
  };
34
34
  }
35
- interface CartDetailProps {
35
+ export interface CartDetailProps {
36
36
  items: Record<string, Product>;
37
37
  }
38
38
  export declare const useCartDetail: (props: CartDetailProps) => {
39
39
  productAccordionStates: import("vue").Ref<Record<string, boolean>, Record<string, boolean>>;
40
40
  cartItems: import("vue").ComputedRef<Record<string, Product>>;
41
- companyProfile: any;
42
- checkoutData: import("vue").ComputedRef<any>;
41
+ companyProfile: null;
42
+ checkoutData: import("vue").ComputedRef<{
43
+ [x: string]: any;
44
+ preferences?: Record<string, any>[] | undefined;
45
+ outlets?: Record<string, any>[] | undefined;
46
+ deliverytype?: string | undefined;
47
+ order_no?: string | undefined;
48
+ publishableKey?: any;
49
+ calculations?: any;
50
+ shippingmethods?: any;
51
+ cart?: Record<string, import("../../stores/Checkout.js").CartItem> | undefined;
52
+ totals?: Record<string, any> | undefined;
53
+ }>;
43
54
  removeFromCartMiddleware: (productId: string, product: Product) => Promise<void>;
44
55
  updateQuantityMiddleware: (product: Product, qty: number) => Promise<void>;
45
56
  toggleAccordion: (rowId: string) => void;
46
57
  dvidedsummary: (sammarydata: any[]) => any[][];
47
58
  swatchimagesSrcset: (swatchImage: string) => string;
48
59
  };
49
- export {};
@@ -1,4 +1,7 @@
1
1
  import { onMounted, ref, computed } from "vue";
2
+ import { useCartStore } from "../../stores/Cart.js";
3
+ import { useCompanyProfile } from "../../stores/useCompanyProfile.js";
4
+ import { useCheckoutStore } from "../../stores/Checkout.js";
2
5
  export const useCartDetail = (props) => {
3
6
  const cartStore = useCartStore();
4
7
  const { profile: companyProfile } = useCompanyProfile();
@@ -1,5 +1,13 @@
1
1
  export default function (inputData: any): {
2
- checkoutStore: any;
2
+ checkoutStore: import("pinia").Store<"checkout", import("../../stores/index.js").CheckoutState, {}, {
3
+ resetState(): void;
4
+ paymentMethods(formData: any): Promise<any>;
5
+ getConfig(): Promise<void>;
6
+ submitCheckout(): Promise<any>;
7
+ confirmPayment(checkoutId: string): Promise<void>;
8
+ CheckUserAccount(email: string): Promise<any>;
9
+ saveToCheckoutSession(fieldsData: import("../../stores/index.js").FieldData): Promise<void>;
10
+ }>;
3
11
  passwordShow: import("vue").Ref<string, string>;
4
12
  password: import("vue").Ref<string, string>;
5
13
  password_confirmationShow: import("vue").Ref<string, string>;
@@ -7,11 +15,11 @@ export default function (inputData: any): {
7
15
  UserAccount: import("vue").Ref<boolean, boolean>;
8
16
  CheckUserAccount: (billingDetails: any, userEmail: string) => Promise<void>;
9
17
  CheckingUserAccount: import("vue").Ref<boolean, boolean>;
10
- passwordStrength: any;
11
- passwordStrengthClass: any;
12
- passwordStrengthValue: any;
13
- passwordStrengthWidth: any;
14
- passwordStrengthTextColor: any;
18
+ passwordStrength: import("vue").ComputedRef<"Password must be 8 characters" | "Strong" | "Medium" | "Weak">;
19
+ passwordStrengthClass: import("vue").ComputedRef<"bg-danger" | "bg-success" | "bg-warning">;
20
+ passwordStrengthValue: import("vue").ComputedRef<number>;
21
+ passwordStrengthWidth: import("vue").ComputedRef<string>;
22
+ passwordStrengthTextColor: import("vue").ComputedRef<"text-danger" | "text-success" | "text-black">;
15
23
  UpdateStripe: (inputData: any) => Promise<void>;
16
24
  Countries: import("vue").Ref<never[], never[]>;
17
25
  ChangeCountry: (billingfield: any) => Promise<void>;
@@ -1,4 +1,9 @@
1
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 { usePasswordFormatter } from "../Extras/usePasswordFormatter.js";
2
7
  export default function(inputData) {
3
8
  const checkoutStore = useCheckoutStore();
4
9
  const passwordShow = ref("password");
@@ -54,7 +59,7 @@ export default function(inputData) {
54
59
  });
55
60
  const UpdateStripe = (async (inputData2) => {
56
61
  await checkoutStore.saveToCheckoutSession(inputData2);
57
- const { getpaymentMethod } = StripeScript.setup();
62
+ const { getpaymentMethod } = useStripe();
58
63
  const totalPrice = computed(() => {
59
64
  return checkoutStore.config ? checkoutStore.config.calculations.total : checkoutStore.config.total;
60
65
  });
@@ -1,39 +1,39 @@
1
1
  export default function (): {
2
- router: any;
3
- route: any;
2
+ router: import("vue-router").Router;
3
+ route: import("vue-router").RouteLocationNormalizedLoadedGeneric;
4
4
  inputData: import("vue").Ref<{
5
- deliverymethod: any;
6
- billing_address: any;
5
+ deliverymethod: string | number | undefined;
6
+ billing_address: string | number | undefined;
7
7
  billing_country: any;
8
8
  shippingasbilling: boolean;
9
9
  isCustomer: boolean;
10
- billing_state: any;
11
- billing_suburb: any;
10
+ billing_state: string | number | undefined;
11
+ billing_suburb: string | undefined;
12
12
  clientsceret: any;
13
- billing_postcode: any;
14
- billing_mobile: any;
15
- billing_firstname: any;
16
- firstname: any;
17
- billing_middlename: any;
18
- billing_lastname: any;
19
- lastname: any;
20
- shipping_address: any;
21
- shippingmethod: any;
13
+ billing_postcode: number | undefined;
14
+ billing_mobile: string | number | undefined;
15
+ billing_firstname: string | number | undefined;
16
+ firstname: string | number | undefined;
17
+ billing_middlename: string | undefined;
18
+ billing_lastname: string | number | undefined;
19
+ lastname: string | number | undefined;
20
+ shipping_address: string | undefined;
21
+ shippingmethod: string | number | undefined;
22
22
  shipping_country: any;
23
- shipping_state: any;
24
- shipping_suburb: any;
25
- shipping_postcode: any;
26
- shipping_mobile: any;
27
- shipping_firstname: any;
28
- shipping_middlename: any;
29
- shipping_lastname: any;
23
+ shipping_state: string | number | undefined;
24
+ shipping_suburb: string | undefined;
25
+ shipping_postcode: number | undefined;
26
+ shipping_mobile: string | undefined;
27
+ shipping_firstname: string | undefined;
28
+ shipping_middlename: string | undefined;
29
+ shipping_lastname: string | undefined;
30
30
  vouchercode: any;
31
31
  paymentmethod: string;
32
32
  cart: any;
33
- abndToken: any;
33
+ abndToken: string | undefined;
34
34
  customertoken: string;
35
- email: any;
36
- mobile: any;
35
+ email: string | number | undefined;
36
+ mobile: string | number | undefined;
37
37
  authoritytoleave: undefined;
38
38
  register: string;
39
39
  password: string;
@@ -53,38 +53,38 @@ export default function (): {
53
53
  till_expiryyear: string;
54
54
  save_card_details: number;
55
55
  }, {
56
- deliverymethod: any;
57
- billing_address: any;
56
+ deliverymethod: string | number | undefined;
57
+ billing_address: string | number | undefined;
58
58
  billing_country: any;
59
59
  shippingasbilling: boolean;
60
60
  isCustomer: boolean;
61
- billing_state: any;
62
- billing_suburb: any;
61
+ billing_state: string | number | undefined;
62
+ billing_suburb: string | undefined;
63
63
  clientsceret: any;
64
- billing_postcode: any;
65
- billing_mobile: any;
66
- billing_firstname: any;
67
- firstname: any;
68
- billing_middlename: any;
69
- billing_lastname: any;
70
- lastname: any;
71
- shipping_address: any;
72
- shippingmethod: any;
64
+ billing_postcode: number | undefined;
65
+ billing_mobile: string | number | undefined;
66
+ billing_firstname: string | number | undefined;
67
+ firstname: string | number | undefined;
68
+ billing_middlename: string | undefined;
69
+ billing_lastname: string | number | undefined;
70
+ lastname: string | number | undefined;
71
+ shipping_address: string | undefined;
72
+ shippingmethod: string | number | undefined;
73
73
  shipping_country: any;
74
- shipping_state: any;
75
- shipping_suburb: any;
76
- shipping_postcode: any;
77
- shipping_mobile: any;
78
- shipping_firstname: any;
79
- shipping_middlename: any;
80
- shipping_lastname: any;
74
+ shipping_state: string | number | undefined;
75
+ shipping_suburb: string | undefined;
76
+ shipping_postcode: number | undefined;
77
+ shipping_mobile: string | undefined;
78
+ shipping_firstname: string | undefined;
79
+ shipping_middlename: string | undefined;
80
+ shipping_lastname: string | undefined;
81
81
  vouchercode: any;
82
82
  paymentmethod: string;
83
83
  cart: any;
84
- abndToken: any;
84
+ abndToken: string | undefined;
85
85
  customertoken: string;
86
- email: any;
87
- mobile: any;
86
+ email: string | number | undefined;
87
+ mobile: string | number | undefined;
88
88
  authoritytoleave: undefined;
89
89
  register: string;
90
90
  password: string;
@@ -104,38 +104,38 @@ export default function (): {
104
104
  till_expiryyear: string;
105
105
  save_card_details: number;
106
106
  } | {
107
- deliverymethod: any;
108
- billing_address: any;
107
+ deliverymethod: string | number | undefined;
108
+ billing_address: string | number | undefined;
109
109
  billing_country: any;
110
110
  shippingasbilling: boolean;
111
111
  isCustomer: boolean;
112
- billing_state: any;
113
- billing_suburb: any;
112
+ billing_state: string | number | undefined;
113
+ billing_suburb: string | undefined;
114
114
  clientsceret: any;
115
- billing_postcode: any;
116
- billing_mobile: any;
117
- billing_firstname: any;
118
- firstname: any;
119
- billing_middlename: any;
120
- billing_lastname: any;
121
- lastname: any;
122
- shipping_address: any;
123
- shippingmethod: any;
115
+ billing_postcode: number | undefined;
116
+ billing_mobile: string | number | undefined;
117
+ billing_firstname: string | number | undefined;
118
+ firstname: string | number | undefined;
119
+ billing_middlename: string | undefined;
120
+ billing_lastname: string | number | undefined;
121
+ lastname: string | number | undefined;
122
+ shipping_address: string | undefined;
123
+ shippingmethod: string | number | undefined;
124
124
  shipping_country: any;
125
- shipping_state: any;
126
- shipping_suburb: any;
127
- shipping_postcode: any;
128
- shipping_mobile: any;
129
- shipping_firstname: any;
130
- shipping_middlename: any;
131
- shipping_lastname: any;
125
+ shipping_state: string | number | undefined;
126
+ shipping_suburb: string | undefined;
127
+ shipping_postcode: number | undefined;
128
+ shipping_mobile: string | undefined;
129
+ shipping_firstname: string | undefined;
130
+ shipping_middlename: string | undefined;
131
+ shipping_lastname: string | undefined;
132
132
  vouchercode: any;
133
133
  paymentmethod: string;
134
134
  cart: any;
135
- abndToken: any;
135
+ abndToken: string | undefined;
136
136
  customertoken: string;
137
- email: any;
138
- mobile: any;
137
+ email: string | number | undefined;
138
+ mobile: string | number | undefined;
139
139
  authoritytoleave: undefined;
140
140
  register: string;
141
141
  password: string;
@@ -155,10 +155,29 @@ export default function (): {
155
155
  till_expiryyear: string;
156
156
  save_card_details: number;
157
157
  }>;
158
- cartData: import("vue").ComputedRef<any>;
158
+ cartData: import("vue").ComputedRef<{
159
+ [x: string]: any;
160
+ preferences?: Record<string, any>[] | undefined;
161
+ outlets?: Record<string, any>[] | undefined;
162
+ deliverytype?: string | undefined;
163
+ order_no?: string | undefined;
164
+ publishableKey?: any;
165
+ calculations?: any;
166
+ shippingmethods?: any;
167
+ cart?: Record<string, import("../../stores/Checkout.js").CartItem> | undefined;
168
+ totals?: Record<string, any> | undefined;
169
+ }>;
159
170
  AuthStore: import("vue").Ref<any, any>;
160
- checkoutStore: any;
161
- countries: any;
171
+ checkoutStore: import("pinia").Store<"checkout", import("../../stores/index.js").CheckoutState, {}, {
172
+ resetState(): void;
173
+ paymentMethods(formData: any): Promise<any>;
174
+ getConfig(): Promise<void>;
175
+ submitCheckout(): Promise<any>;
176
+ confirmPayment(checkoutId: string): Promise<void>;
177
+ CheckUserAccount(email: string): Promise<any>;
178
+ saveToCheckoutSession(fieldsData: import("../../stores/index.js").FieldData): Promise<void>;
179
+ }>;
180
+ countries: import("vue").Ref<any, any>;
162
181
  BillingDetailsForm: any;
163
182
  DeliveryMethodForm: any;
164
183
  ShippingDetailsForm: any;
@@ -1,4 +1,10 @@
1
1
  import { ref, computed, watch, onMounted, defineAsyncComponent } from "vue";
2
+ import { useCompanyProfile } from "../../stores/useCompanyProfile.js";
3
+ import { useCartStore } from "../../stores/Cart.js";
4
+ import { useCheckoutStore } from "../../stores/Checkout.js";
5
+ import { useCountry } from "../Extras/useCountry.js";
6
+ import { useRouter, useRoute } from "vue-router";
7
+ import { useAuth } from "../useAuth.js";
2
8
  export default function() {
3
9
  const router = useRouter();
4
10
  const route = useRoute();
@@ -1,5 +1,13 @@
1
1
  export default function (): {
2
- checkoutStore: any;
2
+ checkoutStore: import("pinia").Store<"checkout", import("../../stores/index.js").CheckoutState, {}, {
3
+ resetState(): void;
4
+ paymentMethods(formData: any): Promise<any>;
5
+ getConfig(): Promise<void>;
6
+ submitCheckout(): Promise<any>;
7
+ confirmPayment(checkoutId: string): Promise<void>;
8
+ CheckUserAccount(email: string): Promise<any>;
9
+ saveToCheckoutSession(fieldsData: import("../../stores/index.js").FieldData): Promise<void>;
10
+ }>;
3
11
  passwordShow: import("vue").Ref<string, string>;
4
12
  password: import("vue").Ref<string, string>;
5
13
  password_confirmationShow: import("vue").Ref<string, string>;
@@ -7,9 +15,9 @@ export default function (): {
7
15
  UserAccount: import("vue").Ref<boolean, boolean>;
8
16
  CheckUserAccount: (billingDetails: any, userEmail: string) => Promise<void>;
9
17
  CheckingUserAccount: import("vue").Ref<boolean, boolean>;
10
- passwordStrength: any;
11
- passwordStrengthClass: any;
12
- passwordStrengthValue: any;
13
- passwordStrengthWidth: any;
14
- passwordStrengthTextColor: any;
18
+ passwordStrength: import("vue").ComputedRef<"Password must be 8 characters" | "Strong" | "Medium" | "Weak">;
19
+ passwordStrengthClass: import("vue").ComputedRef<"bg-danger" | "bg-success" | "bg-warning">;
20
+ passwordStrengthValue: import("vue").ComputedRef<number>;
21
+ passwordStrengthWidth: import("vue").ComputedRef<string>;
22
+ passwordStrengthTextColor: import("vue").ComputedRef<"text-danger" | "text-success" | "text-black">;
15
23
  };
@@ -1,4 +1,6 @@
1
1
  import { ref } from "vue";
2
+ import { useCheckoutStore } from "../../stores/Checkout.js";
3
+ import { usePasswordFormatter } from "../Extras/usePasswordFormatter.js";
2
4
  export default function() {
3
5
  const checkoutStore = useCheckoutStore();
4
6
  const passwordShow = ref("password");
@@ -1,4 +1,12 @@
1
1
  export default function (): {
2
- checkoutStore: any;
2
+ checkoutStore: import("pinia").Store<"checkout", import("../../stores/index.js").CheckoutState, {}, {
3
+ resetState(): void;
4
+ paymentMethods(formData: any): Promise<any>;
5
+ getConfig(): Promise<void>;
6
+ submitCheckout(): Promise<any>;
7
+ confirmPayment(checkoutId: string): Promise<void>;
8
+ CheckUserAccount(email: string): Promise<any>;
9
+ saveToCheckoutSession(fieldsData: import("../../stores/index.js").FieldData): Promise<void>;
10
+ }>;
3
11
  updateDeliveryMethod: (inputData: any) => Promise<void>;
4
12
  };
@@ -1,9 +1,10 @@
1
- import StripeScript from "./PaymentMethods/useStripe.js";
1
+ import { useCheckoutStore } from "../../stores/Checkout.js";
2
+ import useStripe from "./PaymentMethods/useStripe.js";
2
3
  export default function() {
3
4
  const checkoutStore = useCheckoutStore();
4
5
  const updateDeliveryMethod = (async (inputData) => {
5
6
  await checkoutStore.saveToCheckoutSession(inputData);
6
- const { getpaymentMethod } = StripeScript.setup();
7
+ const { getpaymentMethod } = useStripe();
7
8
  const totalPrice = checkoutStore.config ? checkoutStore.config.calculations.total : checkoutStore.config.total;
8
9
  if (inputData.paymentmethod && inputData.paymentmethod == "web-stripe") {
9
10
  getpaymentMethod("web-stripe", inputData, totalPrice);
@@ -1,5 +1,13 @@
1
1
  export default function (inputData: any): {
2
- checkoutStore: any;
2
+ checkoutStore: import("pinia").Store<"checkout", import("../../stores/index.js").CheckoutState, {}, {
3
+ resetState(): void;
4
+ paymentMethods(formData: any): Promise<any>;
5
+ getConfig(): Promise<void>;
6
+ submitCheckout(): Promise<any>;
7
+ confirmPayment(checkoutId: string): Promise<void>;
8
+ CheckUserAccount(email: string): Promise<any>;
9
+ saveToCheckoutSession(fieldsData: import("../../stores/index.js").FieldData): Promise<void>;
10
+ }>;
3
11
  updateShippingAddress: (shippingfield: any) => void;
4
12
  sameAsBilling: (sameasbilling: boolean | undefined, inputData: any) => Promise<void>;
5
13
  UpdateStripe: (inputData: any) => Promise<void>;
@@ -1,4 +1,8 @@
1
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";
2
6
  export default function(inputData) {
3
7
  const {
4
8
  status,
@@ -103,7 +107,7 @@ export default function(inputData) {
103
107
  });
104
108
  const UpdateStripe = (async (inputData2) => {
105
109
  await checkoutStore.saveToCheckoutSession(inputData2);
106
- const { getpaymentMethod } = StripeScript.setup();
110
+ const { getpaymentMethod } = useStripe();
107
111
  const totalPrice = computed(() => {
108
112
  return checkoutStore.config ? checkoutStore.config.calculations.total : checkoutStore.config.total;
109
113
  });
@@ -1,6 +1,6 @@
1
1
  export default function (): {
2
- router: any;
3
- route: any;
2
+ router: import("vue-router").Router;
3
+ route: import("vue-router").RouteLocationNormalizedLoadedGeneric;
4
4
  form_error: import("vue").Ref<string, string>;
5
5
  inputData: import("vue").Ref<{
6
6
  passwordStrengthValue: number;
@@ -1,4 +1,6 @@
1
1
  import { ref } from "vue";
2
+ import { useRouter, useRoute } from "#vue-router";
3
+ import { useAuth } from "../useAuth.js";
2
4
  export default function() {
3
5
  const router = useRouter();
4
6
  const route = useRoute();
@@ -1,6 +1,6 @@
1
- export declare const useCountry: () => {
2
- data: any;
3
- error: any;
4
- refresh: any;
5
- execute: any;
6
- };
1
+ export interface Country {
2
+ code: string;
3
+ name: string;
4
+ }
5
+ import { AsyncData } from '#app';
6
+ export declare const useCountry: () => AsyncData<any, any>;
@@ -1,11 +1,9 @@
1
+ import { useAsyncData } from "#app";
1
2
  export const useCountry = () => {
2
- const { data, error, refresh, execute } = useAsyncData("countries", () => $fetch("/api/checkout/countries"), {
3
- server: true
4
- });
5
- return {
6
- data,
7
- error,
8
- refresh,
9
- execute
10
- };
3
+ const { data, error, refresh, execute } = useAsyncData(
4
+ "countries",
5
+ () => $fetch("/api/checkout/countries"),
6
+ { server: true }
7
+ );
8
+ return { data, error, refresh, execute };
11
9
  };
@@ -1,5 +1,5 @@
1
1
  export default function (): {
2
- NavMenu: import("pinia").Store<"NavMenu", import("../../stores/index.js").NavMenuState, {}, {
2
+ NavMenu: import("pinia").Store<"NavMenu", import("#imports").NavMenuState, {}, {
3
3
  navMenu(id: number, location?: string): Promise<void>;
4
4
  }>;
5
5
  companyProfile: import("vue").ComputedRef<null>;
@@ -1,5 +1,6 @@
1
1
  import { ref } from "vue";
2
2
  import { useRoute } from "#imports";
3
+ import { useCartStore } from "../stores/Cart.js";
3
4
  export const useAddToCart = () => {
4
5
  const showError = ref(false);
5
6
  const ErrorMessage = ref("");
@@ -1,6 +1,6 @@
1
1
  import { ref, computed, watch, onMounted } from "vue";
2
2
  import { useRoute } from "#imports";
3
- import { useSearchStore } from "../stores/search";
3
+ import { useSearchStore } from "../stores/Search.js";
4
4
  export function useSearch() {
5
5
  const route = useRoute();
6
6
  const searchStore = useSearchStore();
@@ -1,3 +1,4 @@
1
+ export declare function getEnv(key: any): Promise<any>;
1
2
  export declare const flowrixApi: {
2
3
  get: (endpoint: any, options?: {}, apiversion?: string) => Promise<unknown>;
3
4
  post: (endpoint: any, options?: {}, apiversion?: string) => Promise<unknown>;
@@ -1,12 +1,27 @@
1
1
  const isServer = typeof process !== "undefined" && process.server;
2
- function getEnv(key) {
3
- if (typeof useRuntimeConfig === "function") {
4
- const config = useRuntimeConfig();
5
- return config.public?.[key] || config[key];
2
+ export async function getEnv(key) {
3
+ try {
4
+ const isClient = typeof process !== "undefined" && process.client || typeof window !== "undefined";
5
+ if (isClient) {
6
+ const { useRuntimeConfig: useRuntimeConfig2 } = await import("nuxt/app");
7
+ const config = useRuntimeConfig2();
8
+ if (config) return config.public?.[key] ?? config[key];
9
+ } else if (typeof useRuntimeConfig === "function") {
10
+ const config = useRuntimeConfig();
11
+ if (config) return config[key] ?? config.public?.[key];
12
+ }
13
+ if (!isClient && typeof useRuntimeConfig === "function") {
14
+ const config = useRuntimeConfig();
15
+ if (config)
16
+ return config[key] ?? config.public?.[key];
17
+ }
18
+ } catch (e) {
19
+ console.log("Silently ignore if outside Nuxt");
6
20
  }
7
- return process.env[key];
21
+ return process?.env?.[key];
8
22
  }
9
23
  async function request(method, endpoint, options = {}, apiversion) {
24
+ console.log("checkt useRuntimeConfig", typeof useRuntimeConfig === "function");
10
25
  const FLOWRIX_API_KEY = getEnv("FLOWRIX_API_KEY");
11
26
  const FLOWRIX_API_SECRET = getEnv("FLOWRIX_API_SECRET");
12
27
  const FLOWRIX_API_ORIGIN = getEnv("FLOWRIX_API_ORIGIN");
@@ -0,0 +1,2 @@
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<string[]>>;
2
+ export default _default;
@@ -0,0 +1,40 @@
1
+ import { defineEventHandler, getQuery, createError } from "h3";
2
+ import { join } from "path";
3
+ import fs from "fs";
4
+ import path from "path";
5
+ const CACHE_DIR = join(process.cwd(), ".nuxt", "cache");
6
+ export default defineEventHandler(async (event) => {
7
+ const slug = event.context.params._;
8
+ try {
9
+ let deleteMatchingFiles = function(dir) {
10
+ const files = fs.readdirSync(dir);
11
+ for (const file of files) {
12
+ const filePath = path.join(dir, file);
13
+ const stat = fs.statSync(filePath);
14
+ if (stat.isDirectory()) {
15
+ deleteMatchingFiles(filePath);
16
+ } else if (file.startsWith(prefix)) {
17
+ fs.unlinkSync(filePath);
18
+ deletedFiles.push(filePath);
19
+ } else if (file.startsWith(`_${prefix}`)) {
20
+ fs.unlinkSync(filePath);
21
+ deletedFiles.push(filePath);
22
+ }
23
+ }
24
+ };
25
+ const query = getQuery(event);
26
+ const cacheKey = `${slug}-${JSON.stringify(query)}`;
27
+ const prefix = cacheKey.replace(/[^a-zA-Z0-9-_]/g, "_");
28
+ const deletedFiles = [];
29
+ if (fs.existsSync(CACHE_DIR)) {
30
+ deleteMatchingFiles(CACHE_DIR);
31
+ }
32
+ return deletedFiles;
33
+ } catch (error) {
34
+ throw createError({
35
+ statusCode: 500,
36
+ statusMessage: `Cache not clear for slug: ${slug}`,
37
+ data: error.message
38
+ });
39
+ }
40
+ });
@@ -0,0 +1,5 @@
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
2
+ success: boolean;
3
+ message: string;
4
+ }>>;
5
+ export default _default;
@@ -0,0 +1,16 @@
1
+ import { defineEventHandler, createError } from "h3";
2
+ import { join } from "path";
3
+ import { rm } from "fs/promises";
4
+ const CACHE_DIR = join(process.cwd(), ".nuxt", "cache");
5
+ export default defineEventHandler(async (event) => {
6
+ try {
7
+ await rm(CACHE_DIR, { recursive: true, force: true });
8
+ return { success: true, message: "Cache deleted successfully" };
9
+ } catch (error) {
10
+ throw createError({
11
+ statusCode: 500,
12
+ statusMessage: `Cache not cleared`,
13
+ data: error.message
14
+ });
15
+ }
16
+ });
@@ -31,7 +31,6 @@ export const useCartStore = defineStore("cart", {
31
31
  return { attribute_id, fraction };
32
32
  },
33
33
  async addToCart(product, qty, data, productId = "", service = []) {
34
- const { post } = useApi();
35
34
  const checkoutSession = useCheckoutStore().checkoutSession;
36
35
  let formData = {
37
36
  cart: void 0,
@@ -65,9 +64,8 @@ export const useCartStore = defineStore("cart", {
65
64
  apiUrl = `cart/service/${service.slug}/add`;
66
65
  }
67
66
  try {
68
- const response = await flowrixApi.post(apiUrl, {
69
- body: formData
70
- });
67
+ console.log(apiUrl);
68
+ const response = await flowrixApi.post(apiUrl, { body: formData });
71
69
  if (response?.status == "Success") {
72
70
  this.addedResponse = "success";
73
71
  this.cart = {
@@ -1,18 +1,21 @@
1
- interface PreferenceData {
1
+ export interface PreferenceData {
2
2
  fields?: Record<string, any>;
3
3
  deliverytype?: string;
4
4
  order_no?: string;
5
5
  publishableKey?: any;
6
6
  [key: string]: any;
7
7
  }
8
- interface CartItem {
8
+ export interface CartItem {
9
9
  fields?: Record<string, any>;
10
10
  deliverytype?: string;
11
11
  order_no?: string;
12
12
  publishableKey?: any;
13
13
  [key: string]: any;
14
14
  }
15
- interface ConfigData {
15
+ export interface Country {
16
+ id: number | string;
17
+ }
18
+ export interface ConfigData {
16
19
  preferences?: Record<string, any>[];
17
20
  outlets?: Record<string, any>[];
18
21
  deliverytype?: string;
@@ -24,7 +27,7 @@ interface ConfigData {
24
27
  totals?: Record<string, any>;
25
28
  [key: string]: any;
26
29
  }
27
- interface FieldData {
30
+ export interface FieldData {
28
31
  billing_state?: number | string;
29
32
  billing_firstname?: string | number;
30
33
  firstname?: string | number;
@@ -58,7 +61,7 @@ interface FieldData {
58
61
  quotation_no?: string;
59
62
  [key: string]: any;
60
63
  }
61
- interface CheckoutState {
64
+ export interface CheckoutState {
62
65
  publishableKey: Record<string, any>;
63
66
  responseData: any[];
64
67
  config: ConfigData;
@@ -82,4 +85,3 @@ export declare const useCheckoutStore: import("pinia").StoreDefinition<"checkout
82
85
  CheckUserAccount(email: string): Promise<any>;
83
86
  saveToCheckoutSession(fieldsData: FieldData): Promise<void>;
84
87
  }>;
85
- export {};
@@ -0,0 +1,5 @@
1
+ export declare const useSearchStore: import("pinia").StoreDefinition<"SearchStore", {
2
+ data: any[];
3
+ }, {}, {
4
+ fetchSearchData(query: string): Promise<any[]>;
5
+ }>;
@@ -0,0 +1,5 @@
1
+ export declare function readCache(pathname: string): Promise<string | null>;
2
+ export declare function writeCache(pathname: string, html: string): Promise<void>;
3
+ export declare function clearCache(): Promise<void>;
4
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<string | undefined>>;
5
+ export default _default;
@@ -0,0 +1,54 @@
1
+ import { promises as fs } from "fs";
2
+ import { join } from "path";
3
+ import { getRequestURL } from "h3";
4
+ import { defineEventHandler } from "h3";
5
+ const cacheDir = join(process.cwd(), ".nuxt", "cache", "html");
6
+ async function ensureDir() {
7
+ await fs.mkdir(cacheDir, { recursive: true });
8
+ }
9
+ function getCacheFilePath(pathname) {
10
+ const safeName = pathname.replace(/[^a-zA-Z0-9-_]/g, "_") || "index";
11
+ return join(cacheDir, `${safeName}-__.html`);
12
+ }
13
+ export async function readCache(pathname) {
14
+ try {
15
+ const filePath = getCacheFilePath(pathname);
16
+ const html = await fs.readFile(filePath, "utf8");
17
+ return html;
18
+ } catch {
19
+ return null;
20
+ }
21
+ }
22
+ export async function writeCache(pathname, html) {
23
+ await ensureDir();
24
+ const filePath = getCacheFilePath(pathname);
25
+ await fs.writeFile(filePath, html, "utf8");
26
+ }
27
+ export async function clearCache() {
28
+ try {
29
+ await fs.rm(cacheDir, { recursive: true, force: true });
30
+ await ensureDir();
31
+ } catch {
32
+ }
33
+ }
34
+ export default defineEventHandler(async (event) => {
35
+ const url = getRequestURL(event);
36
+ const pathname = url.pathname;
37
+ if (event.method !== "GET" || !event.headers.get("accept")?.includes("text/html")) return;
38
+ const cached = await readCache(pathname);
39
+ if (cached) {
40
+ event.node.res.setHeader("x-cache", "HIT");
41
+ return cached;
42
+ }
43
+ const originalEnd = event.node.res.end;
44
+ let chunks = [];
45
+ event.node.res.end = function(chunk) {
46
+ if (chunk) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
47
+ const html = Buffer.concat(chunks).toString("utf-8");
48
+ if (event.node.res.statusCode === 200 && html.includes("<!DOCTYPE html>")) {
49
+ writeCache(pathname, html);
50
+ }
51
+ return originalEnd.apply(this, arguments);
52
+ };
53
+ return;
54
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowrix",
3
- "version": "1.0.1-beta.3",
3
+ "version": "1.0.1-beta.31",
4
4
  "description": "lug-and-play Nuxt eCommerce cart powered by FLOWRiX. Subscription required.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -19,7 +19,8 @@
19
19
  }
20
20
  },
21
21
  "files": [
22
- "dist"
22
+ "dist",
23
+ "runtime/stores"
23
24
  ],
24
25
  "scripts": {
25
26
  "prepack": "nuxt-module-build build",
@@ -33,24 +34,24 @@
33
34
  "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
34
35
  },
35
36
  "dependencies": {
36
- "@nuxt/kit": "^4.1.3",
37
- "@pinia/nuxt": "^0.7.0",
38
- "@stripe/stripe-js": "^8.2.0",
39
- "pinia": "^2.1.7",
40
- "pinia-plugin-persistedstate": "^3.2.0"
37
+ "@nuxt/kit": "4.2.0",
38
+ "@pinia/nuxt": "0.7.0",
39
+ "@stripe/stripe-js": "8.2.0",
40
+ "pinia": "2.3.1",
41
+ "pinia-plugin-persistedstate": "3.2.3"
41
42
  },
42
43
  "devDependencies": {
43
- "@nuxt/devtools": "^2.6.5",
44
- "@nuxt/eslint-config": "^1.9.0",
45
- "@nuxt/module-builder": "^1.0.2",
46
- "@nuxt/schema": "^4.1.3",
47
- "@nuxt/test-utils": "^3.19.2",
48
- "@types/node": "latest",
49
- "changelogen": "^0.6.2",
50
- "eslint": "^9.38.0",
51
- "nuxt": "^4.1.3",
52
- "typescript": "~5.9.3",
53
- "vitest": "^3.2.4",
54
- "vue-tsc": "^3.1.1"
44
+ "@nuxt/devtools": "2.6.5",
45
+ "@nuxt/eslint-config": "1.9.0",
46
+ "@nuxt/module-builder": "1.0.2",
47
+ "@nuxt/schema": "4.2.0",
48
+ "@nuxt/test-utils": "3.19.2",
49
+ "@types/node": "24.9.1",
50
+ "changelogen": "0.6.2",
51
+ "eslint": "9.38.0",
52
+ "nuxt": "4.2.0",
53
+ "typescript": "5.9.3",
54
+ "vitest": "3.2.4",
55
+ "vue-tsc": "3.1.1"
55
56
  }
56
57
  }