flowrix 1.0.1-beta.126 → 1.0.1-beta.128

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.126",
4
+ "version": "1.0.1-beta.128",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -38,7 +38,7 @@ export const useCategoryIndex = (props, ProductTypes = []) => {
38
38
  };
39
39
  });
40
40
  useHead(() => ({
41
- title: `${meta.value.title} -- ${meta.value.robots}`,
41
+ title: `${meta.value.title}`,
42
42
  meta: [
43
43
  { name: "robots", content: meta.value.robots },
44
44
  { name: "description", content: meta.value.description }
@@ -10,7 +10,7 @@ export declare function useWishlists(): {
10
10
  }>>;
11
11
  createWishlist: (data: CreateWishlistData) => Promise<ApiResponse<Wishlist>>;
12
12
  addToWishlist: (listId: number, productSlug: string, data?: AddToWishlistData) => Promise<ApiResponse<WishlistProduct>>;
13
- removeFromWishlist: (listId: number, productSlug: string) => Promise<ApiResponse<void>>;
13
+ removeFromWishlist: (listId: number, itemId: string) => Promise<ApiResponse<void>>;
14
14
  updateWishlist: (id: number, data: UpdateWishlistData) => Promise<ApiResponse<Wishlist>>;
15
15
  deleteWishlist: (id: number) => Promise<ApiResponse<void>>;
16
16
  wishlists: import("vue").ComputedRef<{
@@ -19,7 +19,7 @@ export declare function useWishlists(): {
19
19
  default: boolean;
20
20
  created_at: string;
21
21
  }[]>;
22
- wishlistProducts: (listId: number) => WishlistProduct[];
22
+ wishlistProducts: (listId: number) => import("vue").ComputedRef<WishlistProduct[]>;
23
23
  loading: import("vue").ComputedRef<boolean>;
24
24
  error: import("vue").ComputedRef<string | null>;
25
25
  };
@@ -103,11 +103,11 @@ export function useWishlists() {
103
103
  store.setLoading(false);
104
104
  }
105
105
  }
106
- async function removeFromWishlist(listId, productSlug) {
106
+ async function removeFromWishlist(listId, itemId) {
107
107
  store.setLoading(true);
108
108
  store.setError(null);
109
109
  try {
110
- const response = await store.removeFromWishlist(listId, productSlug);
110
+ const response = await store.removeFromWishlist(listId, itemId);
111
111
  if (response.status === "Success") {
112
112
  return response;
113
113
  } else {
@@ -175,8 +175,7 @@ export function useWishlists() {
175
175
  updateWishlist,
176
176
  deleteWishlist,
177
177
  wishlists: computed(() => store.getWishlists),
178
- // Fixed: Remove extra computed wrapper - direct getter for reactivity
179
- wishlistProducts: (listId) => store.getWishlistProducts(listId),
178
+ wishlistProducts: (listId) => computed(() => store.getWishlistProducts(listId)),
180
179
  loading: computed(() => store.isLoading),
181
180
  error: computed(() => store.getError)
182
181
  };
@@ -4,9 +4,12 @@ import { useCompanyProfile } from "../stores/useCompanyProfile.js";
4
4
  export const useApp = () => {
5
5
  const route = useRoute();
6
6
  const companyProfile = useCompanyProfile();
7
- const gtmId = companyProfile.profile?.data?.integrations["google-tag-manager"]["script"] || "";
8
- const tiktok = companyProfile.profile?.data?.integrations["tiktok"]["script"] || "";
9
- const facebookMeta = companyProfile.profile?.data?.integrations["meta"]["script"] || "";
7
+ let gtmId = companyProfile.profile?.data?.integrations["google-tag-manager"];
8
+ gtmId = gtmId ? gtmId["script"] : "";
9
+ let tiktok = companyProfile.profile?.data?.integrations["tiktok"];
10
+ tiktok = tiktok ? tiktok["script"] : "";
11
+ let facebookMeta = companyProfile.profile?.data?.integrations["meta"] || "";
12
+ facebookMeta = facebookMeta ? facebookMeta["script"] : "";
10
13
  const sitename = companyProfile.profile?.data?.name || "";
11
14
  const meta_title = companyProfile.profile?.data?.meta_title || "";
12
15
  const meta_description = companyProfile.profile?.data?.meta_description || "";
@@ -1,7 +1,6 @@
1
1
  import { useCartStore } from "./Cart.js";
2
2
  import { defineStore } from "pinia";
3
3
  import { flowrixApi } from "../middleware/flowrix.js";
4
- import { useApi } from "../utils/api.js";
5
4
  import { useRuntimeConfig } from "#imports";
6
5
  export const useCheckoutStore = defineStore("checkout", {
7
6
  state: () => ({
@@ -64,7 +63,6 @@ export const useCheckoutStore = defineStore("checkout", {
64
63
  },
65
64
  async getConfig() {
66
65
  try {
67
- const { post } = useApi();
68
66
  const formData = this.checkoutSession.fields || this.checkoutSession;
69
67
  if (formData.cart && Object.keys(formData.cart).length > 0) {
70
68
  const samples = Object.keys(formData.cart).filter(
@@ -84,9 +82,14 @@ export const useCheckoutStore = defineStore("checkout", {
84
82
  formData.abndToken = useCartStore().cart.abndToken;
85
83
  const apiUrl = `checkout/configs`;
86
84
  const config = useRuntimeConfig();
85
+ const rawCookies = document.cookie;
86
+ const apiConfig = {
87
+ ...config,
88
+ cookies: rawCookies
89
+ };
87
90
  const response = await flowrixApi.post(
88
91
  apiUrl,
89
- config,
92
+ apiConfig,
90
93
  {
91
94
  body: formData
92
95
  }
@@ -113,12 +116,14 @@ export const useCheckoutStore = defineStore("checkout", {
113
116
  deliverymethod: deliveryMethod.id
114
117
  };
115
118
  }
116
- const cart = {
119
+ let cart = {
117
120
  items: response.data.cart,
118
- totals: response.data.calculations
121
+ totals: response.data.calculations,
122
+ quote_items: response.data.quote_items || []
119
123
  };
120
124
  useCartStore().cart.items = cart.items;
121
125
  useCartStore().cart.totals = cart.totals;
126
+ useCartStore().cart.quote_items = cart.quote_items;
122
127
  this.config.totals = response.data.calculations;
123
128
  this.checkoutSession.calculations = response.data.calculations;
124
129
  }
@@ -7,6 +7,7 @@ export interface Wishlist {
7
7
  export interface WishlistProduct {
8
8
  id: number;
9
9
  slug: string;
10
+ item_id: string;
10
11
  name: string;
11
12
  image: string;
12
13
  price: string;
@@ -15,6 +16,7 @@ export interface WishlistProduct {
15
16
  rpfloat: number;
16
17
  type: string;
17
18
  brandimage: string;
19
+ options?: any;
18
20
  }
19
21
  export interface WishlistProducts {
20
22
  [listId: number]: WishlistProduct[];
@@ -39,6 +41,7 @@ export declare const useWishlistsStore: import("pinia").StoreDefinition<"wishlis
39
41
  wishlistProducts: WishlistProducts;
40
42
  loading: boolean;
41
43
  error: string | null;
44
+ productVersions: Record<number, number>;
42
45
  }, {
43
46
  getWishlists: (state: {
44
47
  wishlists: {
@@ -50,11 +53,13 @@ export declare const useWishlistsStore: import("pinia").StoreDefinition<"wishlis
50
53
  wishlistProducts: WishlistProducts;
51
54
  loading: boolean;
52
55
  error: string | null;
56
+ productVersions: Record<number, number>;
53
57
  } & import("pinia").PiniaCustomStateProperties<{
54
58
  wishlists: Wishlist[];
55
59
  wishlistProducts: WishlistProducts;
56
60
  loading: boolean;
57
61
  error: string | null;
62
+ productVersions: Record<number, number>;
58
63
  }>) => {
59
64
  id: number;
60
65
  title: string;
@@ -71,11 +76,13 @@ export declare const useWishlistsStore: import("pinia").StoreDefinition<"wishlis
71
76
  wishlistProducts: WishlistProducts;
72
77
  loading: boolean;
73
78
  error: string | null;
79
+ productVersions: Record<number, number>;
74
80
  } & import("pinia").PiniaCustomStateProperties<{
75
81
  wishlists: Wishlist[];
76
82
  wishlistProducts: WishlistProducts;
77
83
  loading: boolean;
78
84
  error: string | null;
85
+ productVersions: Record<number, number>;
79
86
  }>) => (listId: number) => WishlistProduct[];
80
87
  isLoading: (state: {
81
88
  wishlists: {
@@ -87,11 +94,13 @@ export declare const useWishlistsStore: import("pinia").StoreDefinition<"wishlis
87
94
  wishlistProducts: WishlistProducts;
88
95
  loading: boolean;
89
96
  error: string | null;
97
+ productVersions: Record<number, number>;
90
98
  } & import("pinia").PiniaCustomStateProperties<{
91
99
  wishlists: Wishlist[];
92
100
  wishlistProducts: WishlistProducts;
93
101
  loading: boolean;
94
102
  error: string | null;
103
+ productVersions: Record<number, number>;
95
104
  }>) => boolean;
96
105
  getError: (state: {
97
106
  wishlists: {
@@ -103,11 +112,13 @@ export declare const useWishlistsStore: import("pinia").StoreDefinition<"wishlis
103
112
  wishlistProducts: WishlistProducts;
104
113
  loading: boolean;
105
114
  error: string | null;
115
+ productVersions: Record<number, number>;
106
116
  } & import("pinia").PiniaCustomStateProperties<{
107
117
  wishlists: Wishlist[];
108
118
  wishlistProducts: WishlistProducts;
109
119
  loading: boolean;
110
120
  error: string | null;
121
+ productVersions: Record<number, number>;
111
122
  }>) => string | null;
112
123
  }, {
113
124
  setLoading(loading: boolean): void;
@@ -117,7 +128,6 @@ export declare const useWishlistsStore: import("pinia").StoreDefinition<"wishlis
117
128
  removeWishlist(wishlistId: number): void;
118
129
  setWishlistProducts(listId: number, products: WishlistProduct[]): void;
119
130
  addWishlistProduct(listId: number, product: WishlistProduct): void;
120
- removeWishlistProduct(listId: number, productSlug: string): void;
121
131
  clearWishlistProducts(listId: number): void;
122
132
  fetchWishlists(force?: boolean): Promise<ApiResponse<Wishlist[]>>;
123
133
  fetchWishlistProducts(listId: number): Promise<ApiResponse<{
@@ -129,7 +139,7 @@ export declare const useWishlistsStore: import("pinia").StoreDefinition<"wishlis
129
139
  }>>;
130
140
  createWishlist(data: CreateWishlistData): Promise<ApiResponse<Wishlist>>;
131
141
  addToWishlist(listId: number, productSlug: string, data?: AddToWishlistData): Promise<ApiResponse<WishlistProduct>>;
132
- removeFromWishlist(listId: number, productSlug: string): Promise<ApiResponse<void>>;
142
+ removeFromWishlist(listId: number, itemId: string): Promise<ApiResponse<void>>;
133
143
  updateWishlist(id: number, data: UpdateWishlistData): Promise<ApiResponse<Wishlist>>;
134
144
  deleteWishlist(id: number): Promise<ApiResponse<void>>;
135
145
  }>;
@@ -6,7 +6,8 @@ export const useWishlistsStore = defineStore("wishlists", {
6
6
  wishlists: [],
7
7
  wishlistProducts: {},
8
8
  loading: false,
9
- error: null
9
+ error: null,
10
+ productVersions: {}
10
11
  }),
11
12
  actions: {
12
13
  setLoading(loading) {
@@ -23,28 +24,24 @@ export const useWishlistsStore = defineStore("wishlists", {
23
24
  },
24
25
  removeWishlist(wishlistId) {
25
26
  this.wishlists = this.wishlists.filter((w) => w.id !== wishlistId);
27
+ delete this.productVersions[wishlistId];
26
28
  },
27
29
  setWishlistProducts(listId, products) {
28
30
  this.wishlistProducts[listId] = products;
31
+ this.productVersions[listId] = (this.productVersions[listId] || 0) + 1;
29
32
  },
30
33
  addWishlistProduct(listId, product) {
31
34
  if (!this.wishlistProducts[listId]) {
32
35
  this.wishlistProducts[listId] = [];
33
36
  }
34
37
  this.wishlistProducts[listId].push(product);
35
- },
36
- removeWishlistProduct(listId, productSlug) {
37
- if (this.wishlistProducts[listId]) {
38
- this.wishlistProducts[listId] = this.wishlistProducts[listId].filter(
39
- (product) => product.slug !== productSlug
40
- // Changed from productSlug to slug
41
- );
42
- }
38
+ this.productVersions[listId] = (this.productVersions[listId] || 0) + 1;
43
39
  },
44
40
  clearWishlistProducts(listId) {
45
41
  delete this.wishlistProducts[listId];
42
+ delete this.productVersions[listId];
46
43
  },
47
- // Fetch all wishlists - Added force param for cache bypass
44
+ // Fetch all wishlists
48
45
  async fetchWishlists(force = false) {
49
46
  if (!force && this.wishlists.length > 0) {
50
47
  return {
@@ -66,7 +63,7 @@ export const useWishlistsStore = defineStore("wishlists", {
66
63
  const apiUrl = "mystore/customer/wishlist";
67
64
  const response = await flowrixApi.get(apiUrl, apiConfig, {});
68
65
  if (response.status === "Success") {
69
- this.wishlists = response.data || [];
66
+ this.setWishlists(response.data || []);
70
67
  return response;
71
68
  } else {
72
69
  return response;
@@ -75,7 +72,6 @@ export const useWishlistsStore = defineStore("wishlists", {
75
72
  return error.data;
76
73
  }
77
74
  },
78
- // Fetch products for a specific wishlist
79
75
  async fetchWishlistProducts(listId) {
80
76
  try {
81
77
  const config = useRuntimeConfig();
@@ -97,6 +93,7 @@ export const useWishlistsStore = defineStore("wishlists", {
97
93
  return response;
98
94
  }
99
95
  } catch (error) {
96
+ console.error("[Store] Error fetching wishlist products:", error);
100
97
  return error.data;
101
98
  }
102
99
  },
@@ -152,8 +149,7 @@ export const useWishlistsStore = defineStore("wishlists", {
152
149
  return error.data;
153
150
  }
154
151
  },
155
- // Remove product from wishlist
156
- async removeFromWishlist(listId, productSlug) {
152
+ async removeFromWishlist(listId, itemId) {
157
153
  try {
158
154
  const config = useRuntimeConfig();
159
155
  let rawCookies = "";
@@ -166,17 +162,16 @@ export const useWishlistsStore = defineStore("wishlists", {
166
162
  };
167
163
  const apiUrl = `mystore/customer/wishlist/${listId}/item/delete`;
168
164
  const response = await flowrixApi.post(apiUrl, apiConfig, {
169
- body: { ids: { productSlug } }
170
- // Assuming API expects this format
165
+ body: { ids: { productSlug: itemId } }
171
166
  });
167
+ console.log("[Store] Remove API response:", response.status);
172
168
  if (response.status === "Success") {
173
- this.removeWishlistProduct(listId, productSlug);
174
- await this.fetchWishlistProducts(listId);
175
169
  return response;
176
170
  } else {
177
171
  return response;
178
172
  }
179
173
  } catch (error) {
174
+ console.error("[Store] Error in removeFromWishlist:", error);
180
175
  return error.data;
181
176
  }
182
177
  },
@@ -196,8 +191,8 @@ export const useWishlistsStore = defineStore("wishlists", {
196
191
  const response = await flowrixApi.post(apiUrl, apiConfig, {
197
192
  body: data
198
193
  });
199
- if (response.status === "Success" && response.data) {
200
- this.updateWishlist(response.data);
194
+ if (response.status === "Success") {
195
+ await this.fetchWishlists(true);
201
196
  return response;
202
197
  } else {
203
198
  return response;
@@ -236,7 +231,10 @@ export const useWishlistsStore = defineStore("wishlists", {
236
231
  },
237
232
  getters: {
238
233
  getWishlists: (state) => state.wishlists,
239
- getWishlistProducts: (state) => (listId) => state.wishlistProducts[listId] || [],
234
+ getWishlistProducts: (state) => (listId) => {
235
+ const version = state.productVersions[listId] || 0;
236
+ return state.wishlistProducts[listId] || [];
237
+ },
240
238
  isLoading: (state) => state.loading,
241
239
  getError: (state) => state.error
242
240
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowrix",
3
- "version": "1.0.1-beta.126",
3
+ "version": "1.0.1-beta.128",
4
4
  "description": "Plug-and-play Nuxt eCommerce cart powered by FLOWRiX. Subscription required.",
5
5
  "license": "MIT",
6
6
  "type": "module",