flowrix 1.0.1-beta.9 → 1.0.1-beta.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.d.mts +1 -6
- package/dist/module.json +1 -1
- package/dist/module.mjs +103 -34
- package/dist/runtime/composables/Blog/useBlogIndex.d.ts +2 -5
- package/dist/runtime/composables/Brand/brand.js +2 -0
- package/dist/runtime/composables/Cart/useCart.d.ts +40 -0
- package/dist/runtime/composables/Cart/useCart.js +10 -0
- package/dist/runtime/composables/Cart/useCartDetail.d.ts +15 -5
- package/dist/runtime/composables/Cart/useCartDetail.js +3 -0
- package/dist/runtime/composables/Checkout/PaymentMethods/useFlowrixpay.d.ts +40 -1
- package/dist/runtime/composables/Checkout/PaymentMethods/useFlowrixpay.js +2 -2
- package/dist/runtime/composables/Checkout/PaymentMethods/useOpayo.d.ts +40 -1
- package/dist/runtime/composables/Checkout/PaymentMethods/useOpayo.js +2 -2
- package/dist/runtime/composables/Checkout/PaymentMethods/usePaymentMethods.js +3 -14
- package/dist/runtime/composables/Checkout/PaymentMethods/useStripe.d.ts +2 -2
- package/dist/runtime/composables/Checkout/useCheckout.d.ts +84 -73
- package/dist/runtime/composables/Checkout/useCheckout.js +81 -34
- package/dist/runtime/composables/Checkout/useCheckoutBillingAddress.d.ts +43 -0
- package/dist/runtime/composables/Checkout/useCheckoutBillingAddress.js +84 -0
- package/dist/runtime/composables/Checkout/useCheckoutShippingAddress.d.ts +55 -0
- package/dist/runtime/composables/Checkout/useCheckoutShippingAddress.js +196 -0
- package/dist/runtime/composables/Checkout/useCreateAccount.d.ts +7 -7
- package/dist/runtime/composables/Checkout/useCreateAccount.js +3 -1
- package/dist/runtime/composables/Checkout/useDeliveryMethod.d.ts +2 -2
- package/dist/runtime/composables/Checkout/useDeliveryMethod.js +8 -7
- package/dist/runtime/composables/Customer/useBillingAddress.d.ts +112 -0
- package/dist/runtime/composables/Customer/useBillingAddress.js +93 -0
- package/dist/runtime/composables/Customer/useLogin.d.ts +9 -0
- package/dist/runtime/composables/Customer/useLogin.js +34 -0
- package/dist/runtime/composables/Customer/useOrders.d.ts +29 -0
- package/dist/runtime/composables/Customer/useOrders.js +56 -0
- package/dist/runtime/composables/Customer/usePasswordReset.d.ts +26 -0
- package/dist/runtime/composables/Customer/usePasswordReset.js +258 -0
- package/dist/runtime/composables/Customer/useProfile.d.ts +75 -0
- package/dist/runtime/composables/Customer/useProfile.js +106 -0
- package/dist/runtime/composables/Customer/useQuotations.d.ts +32 -0
- package/dist/runtime/composables/Customer/useQuotations.js +40 -0
- package/dist/runtime/composables/Customer/useRegister.d.ts +120 -11
- package/dist/runtime/composables/Customer/useRegister.js +311 -34
- package/dist/runtime/composables/Customer/useShippingAddress.d.ts +121 -0
- package/dist/runtime/composables/Customer/useShippingAddress.js +145 -0
- package/dist/runtime/composables/Customer/useUpdatePassword.d.ts +21 -0
- package/dist/runtime/composables/Customer/useUpdatePassword.js +94 -0
- package/dist/runtime/composables/Customer/useUserCards.d.ts +22 -0
- package/dist/runtime/composables/Customer/useUserCards.js +65 -0
- package/dist/runtime/composables/{useWishlists.d.ts → Customer/useWishlists.d.ts} +6 -19
- package/dist/runtime/composables/{useWishlists.js → Customer/useWishlists.js} +21 -29
- package/dist/runtime/composables/Extras/useCountry.d.ts +11 -6
- package/dist/runtime/composables/Extras/useCountry.js +5 -4
- package/dist/runtime/composables/Header/useHeader.d.ts +6 -20
- package/dist/runtime/composables/Header/useHeader.js +3 -2
- package/dist/runtime/composables/Product/CustomProduct/useCustomeScript.js +4 -4
- package/dist/runtime/composables/Product/CustomProduct/useSteps.d.ts +1 -1
- package/dist/runtime/composables/Product/useProductComponent.js +2 -0
- package/dist/runtime/composables/Product/useProductSlug.d.ts +8 -1
- package/dist/runtime/composables/Product/useQuickView.d.ts +8 -0
- package/dist/runtime/composables/Product/useQuickView.js +27 -0
- package/dist/runtime/composables/Product/useService.d.ts +1 -1
- package/dist/runtime/composables/Product/useService.js +0 -3
- package/dist/runtime/composables/SideBar/Filters/useFilters.d.ts +2 -2
- package/dist/runtime/composables/SideBar/Filters/useSorting.d.ts +2 -2
- package/dist/runtime/composables/index.d.ts +16 -12
- package/dist/runtime/composables/index.js +16 -12
- package/dist/runtime/composables/useAddresses.js +6 -6
- package/dist/runtime/composables/useCards.js +2 -2
- package/dist/runtime/composables/useDataLayer.js +2 -1
- package/dist/runtime/composables/useLocation.d.ts +2 -12
- package/dist/runtime/composables/useQuotationCheckout.d.ts +78 -0
- package/dist/runtime/composables/useQuotationCheckout.js +138 -0
- package/dist/runtime/middleware/flowrix.d.ts +5 -4
- package/dist/runtime/middleware/flowrix.js +41 -21
- package/dist/runtime/pages/flowrix-default.d.vue.ts +3 -0
- package/dist/runtime/pages/flowrix-default.vue +34 -0
- package/dist/runtime/pages/flowrix-default.vue.d.ts +3 -0
- package/dist/runtime/plugin.d.ts +1 -1
- package/dist/runtime/server/api/albums.d.ts +1 -0
- package/dist/runtime/server/api/albums.js +38 -12
- package/dist/runtime/server/api/auth/forgot.js +1 -1
- package/dist/runtime/server/api/auth/login.js +5 -6
- package/dist/runtime/server/api/auth/logout.js +1 -1
- package/dist/runtime/server/api/auth/register.js +1 -1
- package/dist/runtime/server/api/auth/session.get.js +1 -1
- package/dist/runtime/server/api/auth/user/reset-password.js +1 -1
- package/dist/runtime/server/api/auth/user/session.js +1 -1
- package/dist/runtime/server/api/auth/user/verify-token.js +1 -1
- package/dist/runtime/server/api/banners.js +15 -12
- package/dist/runtime/server/api/brand/[...slug].js +55 -0
- package/dist/runtime/server/api/brand/index.d.ts +3 -0
- package/dist/runtime/server/api/brand/index.js +49 -0
- package/dist/runtime/server/api/cache/[...slug].delete.d.ts +2 -0
- package/dist/runtime/server/api/cache/[...slug].delete.js +40 -0
- package/dist/runtime/server/api/cache/clean.get.d.ts +5 -0
- package/dist/runtime/server/api/cache/clean.get.js +16 -0
- package/dist/runtime/server/api/cart/[slug]/add.d.ts +1 -1
- package/dist/runtime/server/api/cart/[slug]/add.js +11 -11
- package/dist/runtime/server/api/cart/[slug]/update.d.ts +1 -1
- package/dist/runtime/server/api/cart/[slug]/update.js +11 -11
- package/dist/runtime/server/api/{blog/blog.d.ts → cart/related.d.ts} +0 -1
- package/dist/runtime/server/api/cart/related.js +21 -0
- package/dist/runtime/server/api/cart/remove.js +1 -1
- package/dist/runtime/server/api/cart/service/[slug]/add.d.ts +1 -1
- package/dist/runtime/server/api/cart/service/[slug]/add.js +12 -12
- package/dist/runtime/server/api/catalog/brands.d.ts +3 -0
- package/dist/runtime/server/api/catalog/brands.js +49 -0
- package/dist/runtime/server/api/catalog/categories.js +22 -16
- package/dist/runtime/server/api/catalog/categoriesall.d.ts +3 -0
- package/dist/runtime/server/api/catalog/categoriesall.js +49 -0
- package/dist/runtime/server/api/catalog/featured.js +22 -14
- package/dist/runtime/server/api/catalog/posts.d.ts +3 -0
- package/dist/runtime/server/api/catalog/posts.js +49 -0
- package/dist/runtime/server/api/catalog/samples.js +22 -16
- package/dist/runtime/server/api/catalog/search.js +21 -15
- package/dist/runtime/server/api/category/[...slug].js +22 -16
- package/dist/runtime/server/api/checkout/applyCoupon.d.ts +1 -1
- package/dist/runtime/server/api/checkout/applyCoupon.js +13 -13
- package/dist/runtime/server/api/checkout/configs.d.ts +1 -1
- package/dist/runtime/server/api/checkout/configs.js +11 -11
- package/dist/runtime/server/api/checkout/countries.d.ts +1 -1
- package/dist/runtime/server/api/checkout/countries.js +5 -9
- package/dist/runtime/server/api/checkout/paymentmethod.d.ts +1 -1
- package/dist/runtime/server/api/checkout/paymentmethod.js +16 -11
- package/dist/runtime/server/api/checkout/quotation/[slug].d.ts +2 -0
- package/dist/runtime/server/api/checkout/quotation/[slug].js +21 -0
- package/dist/runtime/server/api/checkout/quotation/guest/[slug].d.ts +2 -0
- package/dist/runtime/server/api/checkout/quotation/guest/[slug].js +37 -0
- package/dist/runtime/server/api/checkout/quotation/guest/customer.d.ts +2 -0
- package/dist/runtime/server/api/checkout/quotation/guest/customer.js +21 -0
- package/dist/runtime/server/api/checkout/quotation/submit/[slug].d.ts +2 -0
- package/dist/runtime/server/api/checkout/quotation/submit/[slug].js +23 -0
- package/dist/runtime/server/api/{blog/[slug].js → cmspost/[...slug].js} +19 -18
- package/dist/runtime/server/api/cmspost/all.d.ts +3 -0
- package/dist/runtime/server/api/cmspost/all.js +49 -0
- package/dist/runtime/server/api/company/profile.d.ts +1 -1
- package/dist/runtime/server/api/company/profile.js +9 -9
- package/dist/runtime/server/api/contact-center/webforms/[id]/details.d.ts +1 -1
- package/dist/runtime/server/api/contact-center/webforms/[id]/details.js +48 -15
- package/dist/runtime/server/api/contact-center/webforms/create.d.ts +1 -1
- package/dist/runtime/server/api/contact-center/webforms/create.js +10 -10
- package/dist/runtime/server/api/countries.d.ts +2 -0
- package/dist/runtime/server/api/countries.js +42 -0
- package/dist/runtime/server/api/customer/address/add.js +1 -1
- package/dist/runtime/server/api/customer/address/delete.js +2 -2
- package/dist/runtime/server/api/customer/address/setshipping.js +1 -1
- package/dist/runtime/server/api/customer/address/update.js +1 -1
- package/dist/runtime/server/api/customer/cards/delete.js +2 -2
- package/dist/runtime/server/api/customer/cards/get.js +2 -2
- package/dist/runtime/server/api/customer/change-password.js +2 -2
- package/dist/runtime/server/api/customer/checkout.js +1 -1
- package/dist/runtime/server/api/customer/orders.js +2 -2
- package/dist/runtime/server/api/customer/profile/update.js +1 -1
- package/dist/runtime/server/api/customer/quotations.js +2 -2
- package/dist/runtime/server/api/customer/search.js +1 -1
- package/dist/runtime/server/api/customer/tax-invoice.js +1 -1
- package/dist/runtime/server/api/customer/wishlist/add.js +1 -1
- package/dist/runtime/server/api/customer/wishlist/createWishList.js +1 -1
- package/dist/runtime/server/api/customer/wishlist/deleteFromWishList.js +1 -1
- package/dist/runtime/server/api/customer/wishlist/deleteWishList.js +1 -1
- package/dist/runtime/server/api/customer/wishlist/get.js +2 -2
- package/dist/runtime/server/api/customer/wishlist/getWishListItems.js +1 -1
- package/dist/runtime/server/api/customer/wishlist/updateWishList.js +2 -2
- package/dist/runtime/server/api/featured.d.ts +3 -0
- package/dist/runtime/server/api/featured.js +49 -0
- package/dist/runtime/server/api/generate/robots.get.d.ts +2 -0
- package/dist/runtime/server/api/generate/robots.get.js +20 -0
- package/dist/runtime/server/api/generate/sitemap.get.d.ts +2 -0
- package/dist/runtime/server/api/generate/sitemap.get.js +32 -0
- package/dist/runtime/server/api/location.d.ts +1 -1
- package/dist/runtime/server/api/location.js +20 -12
- package/dist/runtime/server/api/nav/[id]/links.d.ts +1 -0
- package/dist/runtime/server/api/nav/[id]/links.js +48 -14
- package/dist/runtime/server/api/page/{[slug].js → [...slug].js} +18 -17
- package/dist/runtime/server/api/product/[...slug].js +23 -9
- package/dist/runtime/server/api/{v2/[...slug].d.ts → quickview/[slug].d.ts} +0 -1
- package/dist/runtime/server/api/quickview/[slug].js +17 -0
- package/dist/runtime/server/api/reviews.d.ts +2 -0
- package/dist/runtime/server/api/reviews.js +18 -0
- package/dist/runtime/server/api/samples.d.ts +3 -0
- package/dist/runtime/server/api/samples.js +50 -0
- package/dist/runtime/server/api/search.d.ts +3 -0
- package/dist/runtime/server/api/search.js +50 -0
- package/dist/runtime/server/api/service/[slug].js +17 -13
- package/dist/runtime/server/api/service/availability.d.ts +1 -1
- package/dist/runtime/server/api/service/availability.js +11 -13
- package/dist/runtime/server/api/service/getall.d.ts +3 -0
- package/dist/runtime/server/api/service/getall.js +55 -0
- package/dist/runtime/server/api/shop.d.ts +3 -0
- package/dist/runtime/server/api/shop.js +50 -0
- package/dist/runtime/server/api/subscribe.d.ts +1 -1
- package/dist/runtime/server/api/subscribe.js +19 -14
- package/dist/runtime/server/api/v2/[...slug].get.d.ts +2 -0
- package/dist/runtime/server/api/v2/[...slug].get.js +16 -0
- package/dist/runtime/server/api/webform.d.ts +3 -0
- package/dist/runtime/server/api/webform.js +52 -0
- package/dist/runtime/server/tsconfig.json +3 -3
- package/dist/runtime/stores/Cart.d.ts +12 -0
- package/dist/runtime/stores/Cart.js +56 -19
- package/dist/runtime/stores/Checkout.d.ts +9 -15
- package/dist/runtime/stores/Checkout.js +19 -24
- package/dist/runtime/stores/Search.d.ts +1 -1
- package/dist/runtime/stores/Services.js +2 -2
- package/dist/runtime/stores/auth.d.ts +8 -11
- package/dist/runtime/stores/auth.js +390 -8
- package/dist/runtime/stores/countries.d.ts +1 -3
- package/dist/runtime/stores/countries.js +4 -8
- package/dist/runtime/stores/product/slug.d.ts +1 -17
- package/dist/runtime/stores/wishlists.d.ts +114 -6
- package/dist/runtime/stores/wishlists.js +209 -9
- package/dist/runtime/utils/api.js +9 -13
- package/dist/runtime/utils/htmlCache.d.ts +2 -2
- package/dist/runtime/utils/htmlCache.js +23 -13
- package/dist/types.d.mts +6 -2
- package/package.json +30 -20
- package/dist/runtime/composables/Checkout/useBillingAddress.d.ts +0 -19
- package/dist/runtime/composables/Checkout/useBillingAddress.js +0 -82
- package/dist/runtime/composables/Checkout/useShippingAddress.d.ts +0 -9
- package/dist/runtime/composables/Checkout/useShippingAddress.js +0 -121
- package/dist/runtime/composables/useAuth.d.ts +0 -45
- package/dist/runtime/composables/useAuth.js +0 -180
- package/dist/runtime/composables/useCountries.d.ts +0 -12
- package/dist/runtime/composables/useCountries.js +0 -50
- package/dist/runtime/composables/useOrders.d.ts +0 -21
- package/dist/runtime/composables/useOrders.js +0 -82
- package/dist/runtime/composables/useQuotations.d.ts +0 -14
- package/dist/runtime/composables/useQuotations.js +0 -50
- package/dist/runtime/plugins/fullReload.client.d.ts +0 -2
- package/dist/runtime/plugins/fullReload.client.js +0 -10
- package/dist/runtime/server/api/blog/blog.js +0 -17
- package/dist/runtime/server/api/brand/[slug].js +0 -58
- package/dist/runtime/server/api/v2/[...slug].js +0 -9
- /package/dist/runtime/server/api/brand/{[slug].d.ts → [...slug].d.ts} +0 -0
- /package/dist/runtime/server/api/{blog/[slug].d.ts → cmspost/[...slug].d.ts} +0 -0
- /package/dist/runtime/server/api/page/{[slug].d.ts → [...slug].d.ts} +0 -0
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { defineStore } from "pinia";
|
|
2
|
+
import { flowrixApi } from "../middleware/flowrix.js";
|
|
3
|
+
import { useRuntimeConfig } from "#imports";
|
|
2
4
|
export const useWishlistsStore = defineStore("wishlists", {
|
|
3
5
|
state: () => ({
|
|
4
6
|
wishlists: [],
|
|
@@ -7,11 +9,17 @@ export const useWishlistsStore = defineStore("wishlists", {
|
|
|
7
9
|
error: null
|
|
8
10
|
}),
|
|
9
11
|
actions: {
|
|
12
|
+
setLoading(loading) {
|
|
13
|
+
this.loading = loading;
|
|
14
|
+
},
|
|
15
|
+
setError(error) {
|
|
16
|
+
this.error = error;
|
|
17
|
+
},
|
|
10
18
|
setWishlists(wishlists) {
|
|
11
19
|
this.wishlists = wishlists;
|
|
12
20
|
},
|
|
13
21
|
addWishlist(wishlist) {
|
|
14
|
-
this.wishlists.
|
|
22
|
+
this.wishlists.push(wishlist);
|
|
15
23
|
},
|
|
16
24
|
updateWishlist(updatedWishlist) {
|
|
17
25
|
const index = this.wishlists.findIndex((w) => w.id === updatedWishlist.id);
|
|
@@ -19,8 +27,8 @@ export const useWishlistsStore = defineStore("wishlists", {
|
|
|
19
27
|
this.wishlists[index] = updatedWishlist;
|
|
20
28
|
}
|
|
21
29
|
},
|
|
22
|
-
removeWishlist(
|
|
23
|
-
this.wishlists = this.wishlists.filter((w) => w.id !==
|
|
30
|
+
removeWishlist(wishlistId) {
|
|
31
|
+
this.wishlists = this.wishlists.filter((w) => w.id !== wishlistId);
|
|
24
32
|
},
|
|
25
33
|
setWishlistProducts(listId, products) {
|
|
26
34
|
this.wishlistProducts[listId] = products;
|
|
@@ -29,21 +37,213 @@ export const useWishlistsStore = defineStore("wishlists", {
|
|
|
29
37
|
if (!this.wishlistProducts[listId]) {
|
|
30
38
|
this.wishlistProducts[listId] = [];
|
|
31
39
|
}
|
|
32
|
-
this.wishlistProducts[listId].
|
|
40
|
+
this.wishlistProducts[listId].push(product);
|
|
33
41
|
},
|
|
34
42
|
removeWishlistProduct(listId, productSlug) {
|
|
35
43
|
if (this.wishlistProducts[listId]) {
|
|
36
|
-
this.wishlistProducts[listId] = this.wishlistProducts[listId].filter(
|
|
44
|
+
this.wishlistProducts[listId] = this.wishlistProducts[listId].filter(
|
|
45
|
+
(product) => product.slug !== productSlug
|
|
46
|
+
// Changed from productSlug to slug
|
|
47
|
+
);
|
|
37
48
|
}
|
|
38
49
|
},
|
|
39
50
|
clearWishlistProducts(listId) {
|
|
40
51
|
delete this.wishlistProducts[listId];
|
|
41
52
|
},
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
// Fetch all wishlists - Added force param for cache bypass
|
|
54
|
+
async fetchWishlists(force = false) {
|
|
55
|
+
if (!force && this.wishlists.length > 0) {
|
|
56
|
+
return {
|
|
57
|
+
status: "Success",
|
|
58
|
+
data: this.wishlists,
|
|
59
|
+
message: null
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
const config = useRuntimeConfig();
|
|
64
|
+
let rawCookies = "";
|
|
65
|
+
if (process.client) {
|
|
66
|
+
rawCookies = document.cookie || "";
|
|
67
|
+
}
|
|
68
|
+
const apiConfig = {
|
|
69
|
+
...config,
|
|
70
|
+
cookies: rawCookies
|
|
71
|
+
};
|
|
72
|
+
const apiUrl = "mystore/customer/wishlist";
|
|
73
|
+
const response = await flowrixApi.get(apiUrl, apiConfig, {});
|
|
74
|
+
if (response.status === "Success") {
|
|
75
|
+
this.wishlists = response.data || [];
|
|
76
|
+
return response;
|
|
77
|
+
} else {
|
|
78
|
+
return response;
|
|
79
|
+
}
|
|
80
|
+
} catch (error) {
|
|
81
|
+
return error.data;
|
|
82
|
+
}
|
|
44
83
|
},
|
|
45
|
-
|
|
46
|
-
|
|
84
|
+
// Fetch products for a specific wishlist
|
|
85
|
+
async fetchWishlistProducts(listId) {
|
|
86
|
+
try {
|
|
87
|
+
const config = useRuntimeConfig();
|
|
88
|
+
let rawCookies = "";
|
|
89
|
+
if (process.client) {
|
|
90
|
+
rawCookies = document.cookie || "";
|
|
91
|
+
}
|
|
92
|
+
const apiConfig = {
|
|
93
|
+
...config,
|
|
94
|
+
cookies: rawCookies
|
|
95
|
+
};
|
|
96
|
+
const apiUrl = `mystore/customer/wishlist/${listId}/products`;
|
|
97
|
+
const response = await flowrixApi.get(apiUrl, apiConfig, {});
|
|
98
|
+
if (response.status === "Success" && response.data) {
|
|
99
|
+
const products = response.data.products || [];
|
|
100
|
+
this.setWishlistProducts(listId, products);
|
|
101
|
+
return response;
|
|
102
|
+
} else {
|
|
103
|
+
return response;
|
|
104
|
+
}
|
|
105
|
+
} catch (error) {
|
|
106
|
+
return error.data;
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
// Create a new wishlist
|
|
110
|
+
async createWishlist(data) {
|
|
111
|
+
try {
|
|
112
|
+
const config = useRuntimeConfig();
|
|
113
|
+
let rawCookies = "";
|
|
114
|
+
if (process.client) {
|
|
115
|
+
rawCookies = document.cookie || "";
|
|
116
|
+
}
|
|
117
|
+
const apiConfig = {
|
|
118
|
+
...config,
|
|
119
|
+
cookies: rawCookies
|
|
120
|
+
};
|
|
121
|
+
const apiUrl = "mystore/customer/wishlist/add";
|
|
122
|
+
const response = await flowrixApi.post(apiUrl, apiConfig, {
|
|
123
|
+
body: data
|
|
124
|
+
});
|
|
125
|
+
if (response.status === "Success") {
|
|
126
|
+
await this.fetchWishlists(true);
|
|
127
|
+
return response;
|
|
128
|
+
} else {
|
|
129
|
+
return response;
|
|
130
|
+
}
|
|
131
|
+
} catch (error) {
|
|
132
|
+
return error.data;
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
// Add product to wishlist
|
|
136
|
+
async addToWishlist(listId, productSlug, data = {}) {
|
|
137
|
+
try {
|
|
138
|
+
const config = useRuntimeConfig();
|
|
139
|
+
let rawCookies = "";
|
|
140
|
+
if (process.client) {
|
|
141
|
+
rawCookies = document.cookie || "";
|
|
142
|
+
}
|
|
143
|
+
const apiConfig = {
|
|
144
|
+
...config,
|
|
145
|
+
cookies: rawCookies
|
|
146
|
+
};
|
|
147
|
+
const apiUrl = `mystore/customer/wishlist/${listId}/${productSlug}/add`;
|
|
148
|
+
const response = await flowrixApi.post(apiUrl, apiConfig, {
|
|
149
|
+
body: data
|
|
150
|
+
});
|
|
151
|
+
if (response.status === "Success" && response.data) {
|
|
152
|
+
this.addWishlistProduct(listId, response.data);
|
|
153
|
+
return response;
|
|
154
|
+
} else {
|
|
155
|
+
return response;
|
|
156
|
+
}
|
|
157
|
+
} catch (error) {
|
|
158
|
+
return error.data;
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
// Remove product from wishlist
|
|
162
|
+
async removeFromWishlist(listId, productSlug) {
|
|
163
|
+
try {
|
|
164
|
+
const config = useRuntimeConfig();
|
|
165
|
+
let rawCookies = "";
|
|
166
|
+
if (process.client) {
|
|
167
|
+
rawCookies = document.cookie || "";
|
|
168
|
+
}
|
|
169
|
+
const apiConfig = {
|
|
170
|
+
...config,
|
|
171
|
+
cookies: rawCookies
|
|
172
|
+
};
|
|
173
|
+
const apiUrl = `mystore/customer/wishlist/${listId}/item/delete`;
|
|
174
|
+
const response = await flowrixApi.post(apiUrl, apiConfig, {
|
|
175
|
+
body: { ids: { productSlug } }
|
|
176
|
+
// Assuming API expects this format
|
|
177
|
+
});
|
|
178
|
+
if (response.status === "Success") {
|
|
179
|
+
this.removeWishlistProduct(listId, productSlug);
|
|
180
|
+
await this.fetchWishlistProducts(listId);
|
|
181
|
+
return response;
|
|
182
|
+
} else {
|
|
183
|
+
return response;
|
|
184
|
+
}
|
|
185
|
+
} catch (error) {
|
|
186
|
+
return error.data;
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
// Update wishlist
|
|
190
|
+
async updateWishlist(id, data) {
|
|
191
|
+
try {
|
|
192
|
+
const config = useRuntimeConfig();
|
|
193
|
+
let rawCookies = "";
|
|
194
|
+
if (process.client) {
|
|
195
|
+
rawCookies = document.cookie || "";
|
|
196
|
+
}
|
|
197
|
+
const apiConfig = {
|
|
198
|
+
...config,
|
|
199
|
+
cookies: rawCookies
|
|
200
|
+
};
|
|
201
|
+
const apiUrl = `mystore/customer/wishlist/${id}/update`;
|
|
202
|
+
const response = await flowrixApi.post(apiUrl, apiConfig, {
|
|
203
|
+
body: data
|
|
204
|
+
});
|
|
205
|
+
if (response.status === "Success" && response.data) {
|
|
206
|
+
this.updateWishlist(response.data);
|
|
207
|
+
return response;
|
|
208
|
+
} else {
|
|
209
|
+
return response;
|
|
210
|
+
}
|
|
211
|
+
} catch (error) {
|
|
212
|
+
return error.data;
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
// Delete wishlist
|
|
216
|
+
async deleteWishlist(id) {
|
|
217
|
+
try {
|
|
218
|
+
const config = useRuntimeConfig();
|
|
219
|
+
let rawCookies = "";
|
|
220
|
+
if (process.client) {
|
|
221
|
+
rawCookies = document.cookie || "";
|
|
222
|
+
}
|
|
223
|
+
const apiConfig = {
|
|
224
|
+
...config,
|
|
225
|
+
cookies: rawCookies
|
|
226
|
+
};
|
|
227
|
+
const apiUrl = `mystore/customer/wishlist/${id}/delete`;
|
|
228
|
+
const response = await flowrixApi.post(apiUrl, apiConfig, {
|
|
229
|
+
body: {}
|
|
230
|
+
});
|
|
231
|
+
if (response.status === "Success") {
|
|
232
|
+
this.removeWishlist(id);
|
|
233
|
+
this.clearWishlistProducts(id);
|
|
234
|
+
return response;
|
|
235
|
+
} else {
|
|
236
|
+
return response;
|
|
237
|
+
}
|
|
238
|
+
} catch (error) {
|
|
239
|
+
return error.data;
|
|
240
|
+
}
|
|
47
241
|
}
|
|
242
|
+
},
|
|
243
|
+
getters: {
|
|
244
|
+
getWishlists: (state) => state.wishlists,
|
|
245
|
+
getWishlistProducts: (state) => (listId) => state.wishlistProducts[listId] || [],
|
|
246
|
+
isLoading: (state) => state.loading,
|
|
247
|
+
getError: (state) => state.error
|
|
48
248
|
}
|
|
49
249
|
});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { useRuntimeConfig } from "nuxt/app";
|
|
2
|
+
import { useCookie } from "nuxt/app";
|
|
1
3
|
import { useAuthStore } from "../stores/auth.js";
|
|
2
4
|
function getLocationHeaders() {
|
|
3
5
|
const headers = {};
|
|
@@ -32,26 +34,20 @@ function getLocationHeaders() {
|
|
|
32
34
|
}
|
|
33
35
|
return headers;
|
|
34
36
|
}
|
|
35
|
-
function getEnv(key) {
|
|
36
|
-
if (typeof useRuntimeConfig === "function") {
|
|
37
|
-
const config = useRuntimeConfig();
|
|
38
|
-
return config.public?.[key] || config[key];
|
|
39
|
-
}
|
|
40
|
-
return process.env[key];
|
|
41
|
-
}
|
|
42
37
|
export function useApi() {
|
|
43
38
|
const authStore = useAuthStore();
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
39
|
+
const config = useRuntimeConfig();
|
|
40
|
+
const FLOWRIX_API_KEY = config.public.FLOWRIX_API_KEY;
|
|
41
|
+
const FLOWRIX_API_SECRET = config.public.FLOWRIX_API_SECRET;
|
|
42
|
+
const FLOWRIX_API_ORIGIN = config.public.FLOWRIX_API_ORIGIN;
|
|
43
|
+
const FLOWRIX_API_BASE = config.public.FLOWRIX_API_BASE;
|
|
48
44
|
const baseURL = FLOWRIX_API_BASE || "";
|
|
49
45
|
async function request(method, url, data = null, options = {}, extraHeaders = {}) {
|
|
50
46
|
const locationHeaders = getLocationHeaders();
|
|
51
47
|
const headers = {
|
|
52
48
|
"Content-Type": "application/json",
|
|
53
|
-
"
|
|
54
|
-
"
|
|
49
|
+
"x-public-key": FLOWRIX_API_KEY,
|
|
50
|
+
"x-api-secret": FLOWRIX_API_SECRET,
|
|
55
51
|
// Add location headers from cookies
|
|
56
52
|
...locationHeaders,
|
|
57
53
|
// Add extra headers
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare function readCache(
|
|
2
|
-
export declare function writeCache(
|
|
1
|
+
export declare function readCache(url: URL, customerType: number): Promise<string | null>;
|
|
2
|
+
export declare function writeCache(url: URL, html: string, customerType: number): Promise<void>;
|
|
3
3
|
export declare function clearCache(): Promise<void>;
|
|
4
4
|
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<string | undefined>>;
|
|
5
5
|
export default _default;
|
|
@@ -1,27 +1,34 @@
|
|
|
1
1
|
import { promises as fs } from "fs";
|
|
2
2
|
import { join } from "path";
|
|
3
|
-
import { getRequestURL } from "h3";
|
|
4
|
-
import {
|
|
5
|
-
const cacheDir = join(
|
|
3
|
+
import { getRequestURL, defineEventHandler, getCookie } from "h3";
|
|
4
|
+
import { useRuntimeConfig } from "#imports";
|
|
5
|
+
const cacheDir = join("/tmp", ".cache", "html");
|
|
6
6
|
async function ensureDir() {
|
|
7
7
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
8
8
|
}
|
|
9
|
-
function getCacheFilePath(
|
|
10
|
-
const
|
|
11
|
-
|
|
9
|
+
function getCacheFilePath(url, customerType) {
|
|
10
|
+
const { pathname, searchParams } = url;
|
|
11
|
+
const queryObj = {};
|
|
12
|
+
for (const [key, value] of searchParams.entries()) {
|
|
13
|
+
queryObj[key] = value;
|
|
14
|
+
}
|
|
15
|
+
const queryString = Object.keys(queryObj).length ? `_${JSON.stringify(queryObj)}` : "";
|
|
16
|
+
const cacheKey = `${pathname}${queryString}`;
|
|
17
|
+
const safeName = cacheKey.replace(/[^a-zA-Z0-9-_]/g, "_") || "index";
|
|
18
|
+
return join(cacheDir, `${safeName}-__-${customerType}.html`);
|
|
12
19
|
}
|
|
13
|
-
export async function readCache(
|
|
20
|
+
export async function readCache(url, customerType) {
|
|
14
21
|
try {
|
|
15
|
-
const filePath = getCacheFilePath(
|
|
22
|
+
const filePath = getCacheFilePath(url, customerType);
|
|
16
23
|
const html = await fs.readFile(filePath, "utf8");
|
|
17
24
|
return html;
|
|
18
25
|
} catch {
|
|
19
26
|
return null;
|
|
20
27
|
}
|
|
21
28
|
}
|
|
22
|
-
export async function writeCache(
|
|
29
|
+
export async function writeCache(url, html, customerType) {
|
|
23
30
|
await ensureDir();
|
|
24
|
-
const filePath = getCacheFilePath(
|
|
31
|
+
const filePath = getCacheFilePath(url, customerType);
|
|
25
32
|
await fs.writeFile(filePath, html, "utf8");
|
|
26
33
|
}
|
|
27
34
|
export async function clearCache() {
|
|
@@ -33,9 +40,10 @@ export async function clearCache() {
|
|
|
33
40
|
}
|
|
34
41
|
export default defineEventHandler(async (event) => {
|
|
35
42
|
const url = getRequestURL(event);
|
|
36
|
-
const
|
|
43
|
+
const config = useRuntimeConfig();
|
|
44
|
+
const customerType = getCookie(event, "customertype") || 1;
|
|
37
45
|
if (event.method !== "GET" || !event.headers.get("accept")?.includes("text/html")) return;
|
|
38
|
-
const cached = await readCache(
|
|
46
|
+
const cached = await readCache(url, customerType);
|
|
39
47
|
if (cached) {
|
|
40
48
|
event.node.res.setHeader("x-cache", "HIT");
|
|
41
49
|
return cached;
|
|
@@ -46,7 +54,9 @@ export default defineEventHandler(async (event) => {
|
|
|
46
54
|
if (chunk) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
47
55
|
const html = Buffer.concat(chunks).toString("utf-8");
|
|
48
56
|
if (event.node.res.statusCode === 200 && html.includes("<!DOCTYPE html>")) {
|
|
49
|
-
|
|
57
|
+
if (config.public.FLOWRIX_CACHE == true) {
|
|
58
|
+
writeCache(url, html, customerType);
|
|
59
|
+
}
|
|
50
60
|
}
|
|
51
61
|
return originalEnd.apply(this, arguments);
|
|
52
62
|
};
|
package/dist/types.d.mts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import type { NuxtModule } from '@nuxt/schema'
|
|
2
|
+
|
|
3
|
+
import type { default as Module } from './module.mjs'
|
|
2
4
|
|
|
3
|
-
export
|
|
5
|
+
export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
|
|
6
|
+
|
|
7
|
+
export { default } from './module.mjs'
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowrix",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.1-beta.92",
|
|
4
|
+
"description": "Plug-and-play Nuxt eCommerce cart powered by FLOWRiX. Subscription required.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"types": "./dist/types.d.mts",
|
|
10
10
|
"import": "./dist/module.mjs"
|
|
11
|
+
},
|
|
12
|
+
"./composables": {
|
|
13
|
+
"types": "./dist/runtime/composables/index.d.ts",
|
|
14
|
+
"import": "./dist/runtime/composables/index.js"
|
|
11
15
|
}
|
|
12
16
|
},
|
|
13
17
|
"main": "./dist/module.mjs",
|
|
@@ -15,12 +19,14 @@
|
|
|
15
19
|
"*": {
|
|
16
20
|
".": [
|
|
17
21
|
"./dist/types.d.mts"
|
|
22
|
+
],
|
|
23
|
+
"composables": [
|
|
24
|
+
"./dist/runtime/composables/index.d.ts"
|
|
18
25
|
]
|
|
19
26
|
}
|
|
20
27
|
},
|
|
21
28
|
"files": [
|
|
22
|
-
"dist"
|
|
23
|
-
"runtime/stores"
|
|
29
|
+
"dist"
|
|
24
30
|
],
|
|
25
31
|
"scripts": {
|
|
26
32
|
"prepack": "nuxt-module-build build",
|
|
@@ -34,24 +40,28 @@
|
|
|
34
40
|
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
35
41
|
},
|
|
36
42
|
"dependencies": {
|
|
37
|
-
"@nuxt/kit": "
|
|
38
|
-
"@pinia/nuxt": "
|
|
39
|
-
"@stripe/stripe-js": "
|
|
40
|
-
"
|
|
41
|
-
"
|
|
43
|
+
"@nuxt/kit": "4.2.0",
|
|
44
|
+
"@pinia/nuxt": "0.7.0",
|
|
45
|
+
"@stripe/stripe-js": "8.2.0",
|
|
46
|
+
"@vueuse/nuxt": "14.0.0",
|
|
47
|
+
"nuxt-swiper": "2.0.1",
|
|
48
|
+
"nuxt-toast": "1.4.0",
|
|
49
|
+
"pinia": "2.3.1",
|
|
50
|
+
"pinia-plugin-persistedstate": "3.2.3"
|
|
42
51
|
},
|
|
43
52
|
"devDependencies": {
|
|
44
|
-
"@nuxt/devtools": "
|
|
45
|
-
"@nuxt/eslint-config": "
|
|
53
|
+
"@nuxt/devtools": "2.6.5",
|
|
54
|
+
"@nuxt/eslint-config": "1.9.0",
|
|
46
55
|
"@nuxt/module-builder": "^1.0.2",
|
|
47
|
-
"@nuxt/schema": "
|
|
48
|
-
"@nuxt/test-utils": "
|
|
49
|
-
"@types/node": "
|
|
50
|
-
"changelogen": "
|
|
51
|
-
"eslint": "
|
|
52
|
-
"nuxt": "
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
+
"@nuxt/schema": "4.2.0",
|
|
57
|
+
"@nuxt/test-utils": "3.19.2",
|
|
58
|
+
"@types/node": "24.9.1",
|
|
59
|
+
"changelogen": "0.6.2",
|
|
60
|
+
"eslint": "9.38.0",
|
|
61
|
+
"nuxt": "4.2.0",
|
|
62
|
+
"sass": "^1.94.2",
|
|
63
|
+
"typescript": "5.9.3",
|
|
64
|
+
"vitest": "3.2.4",
|
|
65
|
+
"vue-tsc": "3.1.1"
|
|
56
66
|
}
|
|
57
67
|
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export default function (inputData: any): {
|
|
2
|
-
checkoutStore: any;
|
|
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: any;
|
|
11
|
-
passwordStrengthClass: any;
|
|
12
|
-
passwordStrengthValue: any;
|
|
13
|
-
passwordStrengthWidth: any;
|
|
14
|
-
passwordStrengthTextColor: any;
|
|
15
|
-
UpdateStripe: (inputData: any) => Promise<void>;
|
|
16
|
-
Countries: import("vue").Ref<never[], never[]>;
|
|
17
|
-
ChangeCountry: (billingfield: any) => Promise<void>;
|
|
18
|
-
States: import("vue").Ref<never[], never[]>;
|
|
19
|
-
};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { ref, computed, onMounted } from "vue";
|
|
2
|
-
export default function(inputData) {
|
|
3
|
-
const checkoutStore = useCheckoutStore();
|
|
4
|
-
const passwordShow = ref("password");
|
|
5
|
-
const password = ref("");
|
|
6
|
-
const password_confirmationShow = ref("password");
|
|
7
|
-
const CountryData = useCountry().data;
|
|
8
|
-
const States = ref([]);
|
|
9
|
-
const Countries = ref([]);
|
|
10
|
-
const GetStates = async (countryID) => {
|
|
11
|
-
};
|
|
12
|
-
onMounted(() => {
|
|
13
|
-
GetStates(inputData.billing_country);
|
|
14
|
-
});
|
|
15
|
-
const ChangeCountry = async (billingfield) => {
|
|
16
|
-
if (billingfield.billing_country == void 0) {
|
|
17
|
-
billingfield.billing_country = useCompanyProfile().profile.country_id;
|
|
18
|
-
}
|
|
19
|
-
let newstates = await GetStates(billingfield.billing_country);
|
|
20
|
-
checkoutStore.saveToCheckoutSession(billingfield);
|
|
21
|
-
};
|
|
22
|
-
const updateBillingAddress = ((billingfield) => {
|
|
23
|
-
if (billingfield.register == false) {
|
|
24
|
-
billingfield.password = "";
|
|
25
|
-
billingfield.password_confirmation = "";
|
|
26
|
-
}
|
|
27
|
-
checkoutStore.saveToCheckoutSession(billingfield);
|
|
28
|
-
});
|
|
29
|
-
const { passwordStrength, passwordStrengthClass, passwordStrengthValue, passwordStrengthWidth, passwordStrengthTextColor } = usePasswordFormatter(password, inputData);
|
|
30
|
-
const UserAccount = ref(true);
|
|
31
|
-
const timeout = ref("");
|
|
32
|
-
const CheckingUserAccount = ref(false);
|
|
33
|
-
const CheckUserAccount = (async (billingDetails, userEmail) => {
|
|
34
|
-
if (timeout.value) {
|
|
35
|
-
clearTimeout(timeout.value);
|
|
36
|
-
}
|
|
37
|
-
timeout.value = setTimeout(async () => {
|
|
38
|
-
billingDetails.register = false;
|
|
39
|
-
billingDetails.password = "";
|
|
40
|
-
billingDetails.password_confirmation = "";
|
|
41
|
-
if (userEmail != "") {
|
|
42
|
-
CheckingUserAccount.value = true;
|
|
43
|
-
await checkoutStore.CheckUserAccount(userEmail);
|
|
44
|
-
if (checkoutStore.checkCustomer.status == "Error") {
|
|
45
|
-
UserAccount.value = true;
|
|
46
|
-
} else {
|
|
47
|
-
UserAccount.value = false;
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
UserAccount.value = true;
|
|
51
|
-
}
|
|
52
|
-
CheckingUserAccount.value = false;
|
|
53
|
-
}, 1e3);
|
|
54
|
-
});
|
|
55
|
-
const UpdateStripe = (async (inputData2) => {
|
|
56
|
-
await checkoutStore.saveToCheckoutSession(inputData2);
|
|
57
|
-
const { getpaymentMethod } = StripeScript.setup();
|
|
58
|
-
const totalPrice = computed(() => {
|
|
59
|
-
return checkoutStore.config ? checkoutStore.config.calculations.total : checkoutStore.config.total;
|
|
60
|
-
});
|
|
61
|
-
getpaymentMethod("web-stripe", inputData2, totalPrice.value);
|
|
62
|
-
});
|
|
63
|
-
return {
|
|
64
|
-
checkoutStore,
|
|
65
|
-
passwordShow,
|
|
66
|
-
password,
|
|
67
|
-
password_confirmationShow,
|
|
68
|
-
updateBillingAddress,
|
|
69
|
-
UserAccount,
|
|
70
|
-
CheckUserAccount,
|
|
71
|
-
CheckingUserAccount,
|
|
72
|
-
passwordStrength,
|
|
73
|
-
passwordStrengthClass,
|
|
74
|
-
passwordStrengthValue,
|
|
75
|
-
passwordStrengthWidth,
|
|
76
|
-
passwordStrengthTextColor,
|
|
77
|
-
UpdateStripe,
|
|
78
|
-
Countries,
|
|
79
|
-
ChangeCountry,
|
|
80
|
-
States
|
|
81
|
-
};
|
|
82
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export default function (inputData: any): {
|
|
2
|
-
checkoutStore: any;
|
|
3
|
-
updateShippingAddress: (shippingfield: any) => void;
|
|
4
|
-
sameAsBilling: (sameasbilling: boolean | undefined, inputData: any) => Promise<void>;
|
|
5
|
-
UpdateStripe: (inputData: any) => Promise<void>;
|
|
6
|
-
Countries: import("vue").ComputedRef<any>;
|
|
7
|
-
ChangeCountry: (shippingfield: any) => Promise<void>;
|
|
8
|
-
States: import("vue").Ref<never[], never[]>;
|
|
9
|
-
};
|