flowrix 1.0.1-beta.155 → 1.0.1-beta.157
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 +1 -1
- package/dist/module.mjs +23 -192
- package/dist/runtime/components/Types/page/index.d.vue.ts +5 -4
- package/dist/runtime/components/Types/page/index.vue +7 -11
- package/dist/runtime/components/Types/page/index.vue.d.ts +5 -4
- package/dist/runtime/composables/Blog/useBlogSingle.js +4 -5
- package/dist/runtime/composables/Category/useCategoryIndex.js +5 -5
- package/dist/runtime/composables/Checkout/useCheckout.d.ts +4 -0
- package/dist/runtime/composables/Checkout/useCheckout.js +15 -3
- package/dist/runtime/composables/Customer/useBillingAddress.d.ts +3 -0
- package/dist/runtime/composables/Customer/useBillingAddress.js +2 -0
- package/dist/runtime/composables/Customer/useShippingAddress.d.ts +3 -0
- package/dist/runtime/composables/Customer/useShippingAddress.js +2 -1
- package/dist/runtime/composables/Customer/useWishlists.d.ts +1 -1
- package/dist/runtime/composables/Product/CustomProduct/useCustomeScript.d.ts +4 -0
- package/dist/runtime/composables/Product/CustomProduct/useCustomeScript.js +5 -11
- package/dist/runtime/composables/Product/useProductCard.d.ts +90 -9
- package/dist/runtime/composables/Product/useProductCard.js +257 -55
- package/dist/runtime/composables/Product/useProductComponent.js +3 -10
- package/dist/runtime/composables/Product/useQuickView.d.ts +1 -1
- package/dist/runtime/composables/Product/useService.d.ts +1 -12
- package/dist/runtime/composables/Product/useService.js +2 -2
- package/dist/runtime/composables/index.d.ts +1 -1
- package/dist/runtime/composables/index.js +1 -1
- package/dist/runtime/composables/useAddresses.js +27 -6
- package/dist/runtime/composables/useApp.js +3 -4
- package/dist/runtime/composables/useCards.js +0 -1
- package/dist/runtime/composables/useClientApi.d.ts +8 -8
- package/dist/runtime/composables/useClientApi.js +74 -30
- package/dist/runtime/composables/useLocation.d.ts +3 -15
- package/dist/runtime/composables/useLocation.js +6 -27
- package/dist/runtime/composables/usePriceCalculation.d.ts +33 -0
- package/dist/runtime/composables/usePriceCalculation.js +107 -0
- package/dist/runtime/composables/useQuotationCheckout.d.ts +1 -1
- package/dist/runtime/middleware/flowrix.d.ts +5 -5
- package/dist/runtime/middleware/flowrix.js +2 -2
- package/dist/runtime/middleware/flowrixs3.d.ts +3 -0
- package/dist/runtime/middleware/flowrixs3.js +65 -0
- package/dist/runtime/pages/flowrix-default.vue +62 -15
- package/dist/runtime/plugins/full-reload.client.d.ts +2 -0
- package/dist/runtime/plugins/full-reload.client.js +28 -0
- package/dist/runtime/server/api/albums.d.ts +0 -1
- package/dist/runtime/server/api/albums.js +13 -40
- package/dist/runtime/server/api/auth/login.d.ts +0 -18
- package/dist/runtime/server/api/auth/login.js +0 -57
- package/dist/runtime/server/api/banners.d.ts +0 -1
- package/dist/runtime/server/api/banners.js +13 -40
- package/dist/runtime/server/api/brand/[...slug].d.ts +0 -1
- package/dist/runtime/server/api/brand/[...slug].js +14 -43
- package/dist/runtime/server/api/brand/index.d.ts +0 -1
- package/dist/runtime/server/api/brand/index.js +13 -39
- package/dist/runtime/server/api/cache/[...slug].delete.js +1 -2
- package/dist/runtime/server/api/cache/clean.get.js +1 -2
- package/dist/runtime/server/api/cart/[slug]/add.d.ts +0 -2
- package/dist/runtime/server/api/cart/[slug]/add.js +0 -21
- package/dist/runtime/server/api/cart/[slug]/update.d.ts +0 -2
- package/dist/runtime/server/api/cart/[slug]/update.js +0 -21
- package/dist/runtime/server/api/cart/related.d.ts +0 -2
- package/dist/runtime/server/api/cart/related.js +0 -34
- package/dist/runtime/server/api/cart/remove.d.ts +0 -2
- package/dist/runtime/server/api/cart/remove.js +0 -21
- package/dist/runtime/server/api/catalog/brands.d.ts +0 -1
- package/dist/runtime/server/api/catalog/brands.js +13 -45
- package/dist/runtime/server/api/catalog/categories.d.ts +0 -1
- package/dist/runtime/server/api/catalog/categories.js +13 -45
- package/dist/runtime/server/api/catalog/categoriesall.d.ts +0 -1
- package/dist/runtime/server/api/catalog/categoriesall.js +13 -45
- package/dist/runtime/server/api/catalog/featured.d.ts +0 -1
- package/dist/runtime/server/api/catalog/featured.js +13 -45
- package/dist/runtime/server/api/catalog/posts.d.ts +0 -1
- package/dist/runtime/server/api/catalog/posts.js +13 -45
- package/dist/runtime/server/api/catalog/samples.d.ts +0 -1
- package/dist/runtime/server/api/catalog/samples.js +13 -46
- package/dist/runtime/server/api/catalog/search.d.ts +0 -1
- package/dist/runtime/server/api/catalog/search.js +13 -46
- package/dist/runtime/server/api/category/[...slug].d.ts +1 -2
- package/dist/runtime/server/api/category/[...slug].js +34 -49
- package/dist/runtime/server/api/checkout/applyCoupon.d.ts +0 -2
- package/dist/runtime/server/api/checkout/applyCoupon.js +0 -20
- package/dist/runtime/server/api/checkout/configs.d.ts +0 -2
- package/dist/runtime/server/api/checkout/configs.js +0 -20
- package/dist/runtime/server/api/checkout/countries.d.ts +0 -2
- package/dist/runtime/server/api/checkout/countries.js +0 -13
- package/dist/runtime/server/api/checkout/paymentmethod.d.ts +0 -2
- package/dist/runtime/server/api/checkout/paymentmethod.js +0 -25
- package/dist/runtime/server/api/checkout/quotation/guest/customer.d.ts +0 -2
- package/dist/runtime/server/api/checkout/quotation/guest/customer.js +0 -20
- package/dist/runtime/server/api/checkvariables.js +1 -2
- package/dist/runtime/server/api/cmspost/[...slug].d.ts +0 -1
- package/dist/runtime/server/api/cmspost/[...slug].js +14 -44
- package/dist/runtime/server/api/cmspost/all.js +1 -2
- package/dist/runtime/server/api/company/profile.d.ts +1 -1
- package/dist/runtime/server/api/company/profile.js +13 -17
- package/dist/runtime/server/api/contact-center/webforms/[id]/details.d.ts +0 -3
- package/dist/runtime/server/api/contact-center/webforms/[id]/details.js +0 -54
- package/dist/runtime/server/api/countries.js +13 -38
- package/dist/runtime/server/api/customer/wishlist/deleteFromWishList.d.ts +0 -2
- package/dist/runtime/server/api/customer/wishlist/deleteFromWishList.js +0 -45
- package/dist/runtime/server/api/featured.d.ts +0 -3
- package/dist/runtime/server/api/featured.js +0 -52
- package/dist/runtime/server/api/generate/robots.get.js +0 -2
- package/dist/runtime/server/api/generate/sitemap.get.d.ts +1 -1
- package/dist/runtime/server/api/generate/sitemap.get.js +8 -12
- package/dist/runtime/server/api/global/[...slug].js +20 -0
- package/dist/runtime/server/api/location.d.ts +0 -2
- package/dist/runtime/server/api/location.js +0 -25
- package/dist/runtime/server/api/nav/[id]/links.d.ts +0 -1
- package/dist/runtime/server/api/nav/[id]/links.js +13 -43
- package/dist/runtime/server/api/page/[...slug].d.ts +0 -1
- package/dist/runtime/server/api/page/[...slug].js +14 -44
- package/dist/runtime/server/api/permalink/[...slug].get.js +31 -0
- package/dist/runtime/server/api/product/[...slug].d.ts +0 -1
- package/dist/runtime/server/api/product/[...slug].js +14 -49
- package/dist/runtime/server/api/quickview/[slug].d.ts +1 -1
- package/dist/runtime/server/api/quickview/[slug].js +15 -16
- package/dist/runtime/server/api/reviews.d.ts +1 -1
- package/dist/runtime/server/api/reviews.js +1 -2
- package/dist/runtime/server/api/reviews3.js +19 -0
- package/dist/runtime/server/api/samples.d.ts +0 -1
- package/dist/runtime/server/api/samples.js +13 -46
- package/dist/runtime/server/api/search.d.ts +0 -1
- package/dist/runtime/server/api/search.js +13 -46
- package/dist/runtime/server/api/service/[slug].d.ts +0 -1
- package/dist/runtime/server/api/service/[slug].js +13 -44
- package/dist/runtime/server/api/service/availability.d.ts +1 -1
- package/dist/runtime/server/api/service/getall.d.ts +0 -1
- package/dist/runtime/server/api/service/getall.js +13 -51
- package/dist/runtime/server/api/shop.d.ts +0 -1
- package/dist/runtime/server/api/shop.js +13 -46
- package/dist/runtime/server/api/subscribe.d.ts +0 -2
- package/dist/runtime/server/api/subscribe.js +0 -25
- package/dist/runtime/server/api/webform.d.ts +0 -3
- package/dist/runtime/server/api/webform.js +0 -54
- package/dist/runtime/server/middleware/powertools.d.ts +9 -0
- package/dist/runtime/server/middleware/powertools.js +30 -0
- package/dist/runtime/stores/Booking.js +23 -7
- package/dist/runtime/stores/Cart.js +18 -3
- package/dist/runtime/stores/Checkout.js +14 -3
- package/dist/runtime/stores/NavMenu.js +2 -4
- package/dist/runtime/stores/Search.js +9 -3
- package/dist/runtime/stores/auth.d.ts +28 -1
- package/dist/runtime/stores/auth.js +0 -5
- package/dist/runtime/stores/countries.js +1 -1
- package/dist/runtime/stores/index.d.ts +0 -1
- package/dist/runtime/stores/index.js +0 -1
- package/dist/runtime/stores/locations.d.ts +1 -5
- package/dist/runtime/stores/locations.js +8 -5
- package/dist/runtime/stores/product.js +9 -3
- package/dist/runtime/stores/promotions.d.ts +51 -0
- package/dist/runtime/stores/promotions.js +65 -0
- package/dist/runtime/stores/useCompanyProfile.js +5 -2
- package/dist/runtime/stores/wishlists.d.ts +1 -1
- package/dist/runtime/stores/wishlists.js +1 -1
- package/package.json +11 -3
- package/dist/runtime/composables/useLocations.d.ts +0 -12
- package/dist/runtime/composables/useLocations.js +0 -53
- package/dist/runtime/server/api/auth/forgot.d.ts +0 -5
- package/dist/runtime/server/api/auth/forgot.js +0 -43
- package/dist/runtime/server/api/auth/logout.d.ts +0 -5
- package/dist/runtime/server/api/auth/logout.js +0 -22
- package/dist/runtime/server/api/auth/register.js +0 -50
- package/dist/runtime/server/api/auth/session.get.js +0 -44
- package/dist/runtime/server/api/auth/user/reset-password.d.ts +0 -5
- package/dist/runtime/server/api/auth/user/reset-password.js +0 -39
- package/dist/runtime/server/api/auth/user/session.js +0 -42
- package/dist/runtime/server/api/auth/user/verify-token.d.ts +0 -6
- package/dist/runtime/server/api/auth/user/verify-token.js +0 -49
- package/dist/runtime/server/api/cart/service/[slug]/add.d.ts +0 -2
- package/dist/runtime/server/api/cart/service/[slug]/add.js +0 -16
- package/dist/runtime/server/api/check-404.d.ts +0 -4
- package/dist/runtime/server/api/check-404.js +0 -8
- package/dist/runtime/server/api/checkout/quotation/[slug].d.ts +0 -2
- package/dist/runtime/server/api/checkout/quotation/[slug].js +0 -20
- package/dist/runtime/server/api/checkout/quotation/guest/[slug].d.ts +0 -2
- package/dist/runtime/server/api/checkout/quotation/guest/[slug].js +0 -35
- package/dist/runtime/server/api/checkout/quotation/submit/[slug].d.ts +0 -2
- package/dist/runtime/server/api/checkout/quotation/submit/[slug].js +0 -22
- package/dist/runtime/server/api/contact-center/webforms/create.d.ts +0 -2
- package/dist/runtime/server/api/contact-center/webforms/create.js +0 -20
- package/dist/runtime/server/api/customer/address/add.d.ts +0 -14
- package/dist/runtime/server/api/customer/address/add.js +0 -32
- package/dist/runtime/server/api/customer/address/delete.d.ts +0 -20
- package/dist/runtime/server/api/customer/address/delete.js +0 -36
- package/dist/runtime/server/api/customer/address/setshipping.d.ts +0 -20
- package/dist/runtime/server/api/customer/address/setshipping.js +0 -40
- package/dist/runtime/server/api/customer/address/update.d.ts +0 -20
- package/dist/runtime/server/api/customer/address/update.js +0 -41
- package/dist/runtime/server/api/customer/cards/delete.d.ts +0 -2
- package/dist/runtime/server/api/customer/cards/delete.js +0 -22
- package/dist/runtime/server/api/customer/cards/get.d.ts +0 -2
- package/dist/runtime/server/api/customer/cards/get.js +0 -16
- package/dist/runtime/server/api/customer/change-password.d.ts +0 -14
- package/dist/runtime/server/api/customer/change-password.js +0 -33
- package/dist/runtime/server/api/customer/checkout.d.ts +0 -2
- package/dist/runtime/server/api/customer/checkout.js +0 -19
- package/dist/runtime/server/api/customer/orders.d.ts +0 -2
- package/dist/runtime/server/api/customer/orders.js +0 -16
- package/dist/runtime/server/api/customer/profile/update.d.ts +0 -14
- package/dist/runtime/server/api/customer/profile/update.js +0 -33
- package/dist/runtime/server/api/customer/quotations.d.ts +0 -2
- package/dist/runtime/server/api/customer/quotations.js +0 -16
- package/dist/runtime/server/api/customer/search.d.ts +0 -2
- package/dist/runtime/server/api/customer/search.js +0 -14
- package/dist/runtime/server/api/customer/tax-invoice.d.ts +0 -8
- package/dist/runtime/server/api/customer/tax-invoice.js +0 -35
- package/dist/runtime/server/api/customer/wishlist/add.d.ts +0 -2
- package/dist/runtime/server/api/customer/wishlist/add.js +0 -29
- package/dist/runtime/server/api/customer/wishlist/createWishList.d.ts +0 -2
- package/dist/runtime/server/api/customer/wishlist/createWishList.js +0 -28
- package/dist/runtime/server/api/customer/wishlist/deleteWishList.d.ts +0 -2
- package/dist/runtime/server/api/customer/wishlist/deleteWishList.js +0 -29
- package/dist/runtime/server/api/customer/wishlist/get.d.ts +0 -2
- package/dist/runtime/server/api/customer/wishlist/get.js +0 -16
- package/dist/runtime/server/api/customer/wishlist/getWishListItems.d.ts +0 -2
- package/dist/runtime/server/api/customer/wishlist/getWishListItems.js +0 -20
- package/dist/runtime/server/api/customer/wishlist/updateWishList.d.ts +0 -2
- package/dist/runtime/server/api/customer/wishlist/updateWishList.js +0 -29
- package/dist/runtime/server/api/v2/[...slug].get.d.ts +0 -2
- package/dist/runtime/server/api/v2/[...slug].get.js +0 -34
- package/dist/runtime/stores/IpLocation.d.ts +0 -109
- package/dist/runtime/stores/IpLocation.js +0 -107
- package/dist/runtime/utils/api.d.ts +0 -13
- package/dist/runtime/utils/api.js +0 -96
- /package/dist/runtime/server/api/{auth/register.d.ts → global/[...slug].d.ts} +0 -0
- /package/dist/runtime/server/api/{auth/session.get.d.ts → permalink/[...slug].get.d.ts} +0 -0
- /package/dist/runtime/server/api/{auth/user/session.d.ts → reviews3.d.ts} +0 -0
|
@@ -5,19 +5,19 @@ export declare const useClientApi: () => {
|
|
|
5
5
|
put: <T>(url: string, data: any, options?: FetchOptions, extraHeaders?: Record<string, string>) => Promise<T>;
|
|
6
6
|
delete: <T>(url: string, options?: FetchOptions, extraHeaders?: Record<string, string>) => Promise<T>;
|
|
7
7
|
withShippingCountry: (country: string) => {
|
|
8
|
-
get: <T>(url: string, options?: FetchOptions) => Promise<
|
|
9
|
-
post: <T>(url: string, data: any, options?: FetchOptions) => Promise<
|
|
10
|
-
put: <T>(url: string, data: any, options?: FetchOptions) => Promise<
|
|
11
|
-
delete: <T>(url: string, options?: FetchOptions) => Promise<
|
|
8
|
+
get: <T>(url: string, options?: FetchOptions) => Promise<any>;
|
|
9
|
+
post: <T>(url: string, data: any, options?: FetchOptions) => Promise<any>;
|
|
10
|
+
put: <T>(url: string, data: any, options?: FetchOptions) => Promise<any>;
|
|
11
|
+
delete: <T>(url: string, options?: FetchOptions) => Promise<any>;
|
|
12
12
|
};
|
|
13
13
|
withLocation: (location: {
|
|
14
14
|
country?: string;
|
|
15
15
|
region?: string;
|
|
16
16
|
zipcode?: string;
|
|
17
17
|
}) => {
|
|
18
|
-
get: <T>(url: string, options?: FetchOptions) => Promise<
|
|
19
|
-
post: <T>(url: string, data: any, options?: FetchOptions) => Promise<
|
|
20
|
-
put: <T>(url: string, data: any, options?: FetchOptions) => Promise<
|
|
21
|
-
delete: <T>(url: string, options?: FetchOptions) => Promise<
|
|
18
|
+
get: <T>(url: string, options?: FetchOptions) => Promise<any>;
|
|
19
|
+
post: <T>(url: string, data: any, options?: FetchOptions) => Promise<any>;
|
|
20
|
+
put: <T>(url: string, data: any, options?: FetchOptions) => Promise<any>;
|
|
21
|
+
delete: <T>(url: string, options?: FetchOptions) => Promise<any>;
|
|
22
22
|
};
|
|
23
23
|
};
|
|
@@ -1,52 +1,96 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { flowrixApi } from "../middleware/flowrix.js";
|
|
2
|
+
import { useRuntimeConfig } from "#imports";
|
|
2
3
|
export const useClientApi = () => {
|
|
3
|
-
const
|
|
4
|
+
const config = useRuntimeConfig();
|
|
5
|
+
const getApiConfig = () => {
|
|
6
|
+
let rawCookies = "";
|
|
7
|
+
if (process.client) {
|
|
8
|
+
rawCookies = document.cookie || "";
|
|
9
|
+
}
|
|
10
|
+
return { ...config, cookies: rawCookies };
|
|
11
|
+
};
|
|
4
12
|
const clientApi = {
|
|
5
13
|
// GET request with automatic location headers
|
|
6
14
|
get: async (url, options = {}, extraHeaders = {}) => {
|
|
7
|
-
|
|
15
|
+
const apiConfig = getApiConfig();
|
|
16
|
+
const mergedOptions = { ...options, headers: { ...options.headers, ...extraHeaders } };
|
|
17
|
+
return await flowrixApi.get(url, apiConfig, mergedOptions);
|
|
8
18
|
},
|
|
9
19
|
// POST request with automatic location headers
|
|
10
20
|
post: async (url, data, options = {}, extraHeaders = {}) => {
|
|
11
|
-
|
|
21
|
+
const apiConfig = getApiConfig();
|
|
22
|
+
const mergedOptions = { body: data, ...options, headers: { ...options.headers, ...extraHeaders } };
|
|
23
|
+
return await flowrixApi.post(url, apiConfig, mergedOptions);
|
|
12
24
|
},
|
|
13
25
|
// PUT request with automatic location headers
|
|
14
26
|
put: async (url, data, options = {}, extraHeaders = {}) => {
|
|
15
|
-
|
|
27
|
+
const apiConfig = getApiConfig();
|
|
28
|
+
const mergedOptions = { body: data, ...options, headers: { ...options.headers, ...extraHeaders } };
|
|
29
|
+
return await flowrixApi.put(url, apiConfig, mergedOptions);
|
|
16
30
|
},
|
|
17
31
|
// DELETE request with automatic location headers
|
|
18
32
|
delete: async (url, options = {}, extraHeaders = {}) => {
|
|
19
|
-
|
|
33
|
+
const apiConfig = getApiConfig();
|
|
34
|
+
const mergedOptions = { ...options, headers: { ...options.headers, ...extraHeaders } };
|
|
35
|
+
return await flowrixApi.delete(url, apiConfig, mergedOptions);
|
|
20
36
|
},
|
|
21
37
|
// Convenience method for requests with custom shipping country
|
|
22
38
|
withShippingCountry: (country) => ({
|
|
23
|
-
get: (url, options = {}) =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
39
|
+
get: (url, options = {}) => {
|
|
40
|
+
const apiConfig = getApiConfig();
|
|
41
|
+
return flowrixApi.get(url, apiConfig, { ...options, headers: { ...options.headers, "shipping-country": country } });
|
|
42
|
+
},
|
|
43
|
+
post: (url, data, options = {}) => {
|
|
44
|
+
const apiConfig = getApiConfig();
|
|
45
|
+
return flowrixApi.post(url, apiConfig, { body: data, ...options, headers: { ...options.headers, "shipping-country": country } });
|
|
46
|
+
},
|
|
47
|
+
put: (url, data, options = {}) => {
|
|
48
|
+
const apiConfig = getApiConfig();
|
|
49
|
+
return flowrixApi.put(url, apiConfig, { body: data, ...options, headers: { ...options.headers, "shipping-country": country } });
|
|
50
|
+
},
|
|
51
|
+
delete: (url, options = {}) => {
|
|
52
|
+
const apiConfig = getApiConfig();
|
|
53
|
+
return flowrixApi.delete(url, apiConfig, { ...options, headers: { ...options.headers, "shipping-country": country } });
|
|
54
|
+
}
|
|
27
55
|
}),
|
|
28
56
|
// Convenience method for requests with custom location
|
|
29
57
|
withLocation: (location) => ({
|
|
30
|
-
get: (url, options = {}) =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
58
|
+
get: (url, options = {}) => {
|
|
59
|
+
const apiConfig = getApiConfig();
|
|
60
|
+
const locationHeaders = {
|
|
61
|
+
...location.country && { "shipping-country": location.country },
|
|
62
|
+
...location.region && { "shipping-region": location.region },
|
|
63
|
+
...location.zipcode && { "shipping-zipcode": location.zipcode }
|
|
64
|
+
};
|
|
65
|
+
return flowrixApi.get(url, apiConfig, { ...options, headers: { ...options.headers, ...locationHeaders } });
|
|
66
|
+
},
|
|
67
|
+
post: (url, data, options = {}) => {
|
|
68
|
+
const apiConfig = getApiConfig();
|
|
69
|
+
const locationHeaders = {
|
|
70
|
+
...location.country && { "shipping-country": location.country },
|
|
71
|
+
...location.region && { "shipping-region": location.region },
|
|
72
|
+
...location.zipcode && { "shipping-zipcode": location.zipcode }
|
|
73
|
+
};
|
|
74
|
+
return flowrixApi.post(url, apiConfig, { body: data, ...options, headers: { ...options.headers, ...locationHeaders } });
|
|
75
|
+
},
|
|
76
|
+
put: (url, data, options = {}) => {
|
|
77
|
+
const apiConfig = getApiConfig();
|
|
78
|
+
const locationHeaders = {
|
|
79
|
+
...location.country && { "shipping-country": location.country },
|
|
80
|
+
...location.region && { "shipping-region": location.region },
|
|
81
|
+
...location.zipcode && { "shipping-zipcode": location.zipcode }
|
|
82
|
+
};
|
|
83
|
+
return flowrixApi.put(url, apiConfig, { body: data, ...options, headers: { ...options.headers, ...locationHeaders } });
|
|
84
|
+
},
|
|
85
|
+
delete: (url, options = {}) => {
|
|
86
|
+
const apiConfig = getApiConfig();
|
|
87
|
+
const locationHeaders = {
|
|
88
|
+
...location.country && { "shipping-country": location.country },
|
|
89
|
+
...location.region && { "shipping-region": location.region },
|
|
90
|
+
...location.zipcode && { "shipping-zipcode": location.zipcode }
|
|
91
|
+
};
|
|
92
|
+
return flowrixApi.delete(url, apiConfig, { ...options, headers: { ...options.headers, ...locationHeaders } });
|
|
93
|
+
}
|
|
50
94
|
})
|
|
51
95
|
};
|
|
52
96
|
return clientApi;
|
|
@@ -17,7 +17,7 @@ interface LocationData {
|
|
|
17
17
|
region_id?: number;
|
|
18
18
|
zip_code?: string;
|
|
19
19
|
}
|
|
20
|
-
export declare function useLocation(): {
|
|
20
|
+
export declare function useLocation(defaultLocation: any): {
|
|
21
21
|
states: import("vue").Ref<never[], never[]>;
|
|
22
22
|
manualLocationHeading: import("vue").Ref<string | null, string | null>;
|
|
23
23
|
locationInputs: import("vue").Ref<{
|
|
@@ -33,22 +33,10 @@ export declare function useLocation(): {
|
|
|
33
33
|
region: string;
|
|
34
34
|
region_id: string | number | null;
|
|
35
35
|
}>;
|
|
36
|
-
location: import("vue").ComputedRef<
|
|
37
|
-
city?: string | undefined;
|
|
38
|
-
country_name?: string | undefined;
|
|
39
|
-
country_code?: string | undefined;
|
|
40
|
-
country_id?: number | undefined;
|
|
41
|
-
ip?: string | undefined;
|
|
42
|
-
proxy?: boolean | undefined;
|
|
43
|
-
region?: string | undefined;
|
|
44
|
-
region_short?: string | undefined;
|
|
45
|
-
region_id?: number | undefined;
|
|
46
|
-
zip_code?: string | undefined;
|
|
47
|
-
} | null>;
|
|
36
|
+
location: import("vue").ComputedRef<any>;
|
|
48
37
|
countries: import("vue").ComputedRef<any>;
|
|
49
|
-
loading: import("vue").ComputedRef<
|
|
38
|
+
loading: import("vue").ComputedRef<any>;
|
|
50
39
|
companyCountryId: import("vue").ComputedRef<any>;
|
|
51
|
-
getStateShort: (stateName: string) => string;
|
|
52
40
|
getStates: (countryId: number | string) => any;
|
|
53
41
|
changeStates: (selectedCountry: string | number) => void;
|
|
54
42
|
changeLocation: (data?: Partial<LocationInputs>) => Promise<void>;
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
import { ref, computed, watch, nextTick } from "vue";
|
|
2
|
-
import { useIpLocation } from "../stores/IpLocation.js";
|
|
3
2
|
import { useCountriesStore } from "../stores/countries.js";
|
|
4
3
|
import { useCompanyProfile } from "../stores/useCompanyProfile.js";
|
|
5
4
|
import { useCheckoutStore } from "../stores/Checkout.js";
|
|
6
|
-
export function useLocation() {
|
|
7
|
-
const locationStore =
|
|
5
|
+
export function useLocation(defaultLocation) {
|
|
6
|
+
const locationStore = useLocationsStore();
|
|
8
7
|
const countriesStore = useCountriesStore();
|
|
9
8
|
const companyProfileStore = useCompanyProfile();
|
|
10
9
|
const checkoutStore = useCheckoutStore();
|
|
11
10
|
const states = ref([]);
|
|
12
11
|
const manualLocationHeading = ref(null);
|
|
13
|
-
const locationInputs = ref(
|
|
14
|
-
country: "Australia",
|
|
15
|
-
country_id: 14,
|
|
16
|
-
zip_code: 3370,
|
|
17
|
-
region: "",
|
|
18
|
-
region_id: null
|
|
19
|
-
});
|
|
12
|
+
const locationInputs = ref(defaultLocation);
|
|
20
13
|
const location = computed(() => locationStore.location);
|
|
21
14
|
const countries = computed(() => {
|
|
22
15
|
const storeCountries = countriesStore.countries;
|
|
@@ -30,19 +23,6 @@ export function useLocation() {
|
|
|
30
23
|
const loading = computed(() => locationStore.loading);
|
|
31
24
|
const profile = computed(() => companyProfileStore.profile);
|
|
32
25
|
const companyCountryId = computed(() => profile.value?.country_id || 14);
|
|
33
|
-
const stateShortCodes = {
|
|
34
|
-
"New South Wales": "NSW",
|
|
35
|
-
"Victoria": "VIC",
|
|
36
|
-
"Queensland": "QLD",
|
|
37
|
-
"South Australia": "SA",
|
|
38
|
-
"Western Australia": "WA",
|
|
39
|
-
"Tasmania": "TAS",
|
|
40
|
-
"Northern Territory": "NT",
|
|
41
|
-
"Australian Capital Territory": "ACT"
|
|
42
|
-
};
|
|
43
|
-
const getStateShort = (stateName) => {
|
|
44
|
-
return stateShortCodes[stateName] || stateName;
|
|
45
|
-
};
|
|
46
26
|
const getStates = (countryId) => {
|
|
47
27
|
if (!countries.value || countries.value.length === 0) {
|
|
48
28
|
console.warn("No countries available");
|
|
@@ -107,13 +87,13 @@ export function useLocation() {
|
|
|
107
87
|
const newLocation = {
|
|
108
88
|
zip_code: updateData.zip_code,
|
|
109
89
|
region: state.name,
|
|
110
|
-
region_short:
|
|
90
|
+
region_short: state.state_code,
|
|
111
91
|
region_id: state.id,
|
|
112
92
|
country_name: country.name,
|
|
113
93
|
country_id: country.id
|
|
114
94
|
};
|
|
115
|
-
locationStore.
|
|
116
|
-
|
|
95
|
+
locationStore.setLocation(newLocation);
|
|
96
|
+
console.log("newLocation", locationStore);
|
|
117
97
|
} catch (error) {
|
|
118
98
|
console.error("Error updating location:", error);
|
|
119
99
|
}
|
|
@@ -341,7 +321,6 @@ export function useLocation() {
|
|
|
341
321
|
loading,
|
|
342
322
|
companyCountryId,
|
|
343
323
|
// Methods
|
|
344
|
-
getStateShort,
|
|
345
324
|
getStates,
|
|
346
325
|
changeStates,
|
|
347
326
|
changeLocation,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface Promotion {
|
|
2
|
+
id: number;
|
|
3
|
+
labels: string | null;
|
|
4
|
+
voucherdiscounttype_id: number;
|
|
5
|
+
discounttype: number;
|
|
6
|
+
discount: number;
|
|
7
|
+
sortorder: number;
|
|
8
|
+
start_date: string | null;
|
|
9
|
+
end_date: string | null;
|
|
10
|
+
date_range_schedule: number;
|
|
11
|
+
day_time_schedule: number;
|
|
12
|
+
voucherschedule: Array<{
|
|
13
|
+
day: number;
|
|
14
|
+
start_time: string | null;
|
|
15
|
+
end_time: string | null;
|
|
16
|
+
}>;
|
|
17
|
+
includecustomers: number[];
|
|
18
|
+
includecustomertypes: number[];
|
|
19
|
+
includeproducts: number[];
|
|
20
|
+
includeoutlets: number[];
|
|
21
|
+
}
|
|
22
|
+
export interface PriceCalculationResult {
|
|
23
|
+
finalPrice: number;
|
|
24
|
+
originalPrice: number;
|
|
25
|
+
totalDiscount: number;
|
|
26
|
+
hasDiscount: boolean;
|
|
27
|
+
appliedPromotions: Promotion[];
|
|
28
|
+
}
|
|
29
|
+
export declare const usePriceCalculation: () => {
|
|
30
|
+
calculatePrice: (productId: number, price: number, promotions: Promotion[]) => PriceCalculationResult;
|
|
31
|
+
filterPromotions: (promotions: Promotion[], productId: number, customerTypeId?: number) => Promotion[];
|
|
32
|
+
calculateDiscount: (price: number, filteredPromotions: Promotion[]) => number;
|
|
33
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
export const usePriceCalculation = () => {
|
|
2
|
+
const getCurrentDateUTC = () => {
|
|
3
|
+
const now = /* @__PURE__ */ new Date();
|
|
4
|
+
return now.toISOString().split("T")[0];
|
|
5
|
+
};
|
|
6
|
+
const getCurrentTimeUTC = () => {
|
|
7
|
+
const now = /* @__PURE__ */ new Date();
|
|
8
|
+
return now.toISOString().split("T")[1].split(".")[0];
|
|
9
|
+
};
|
|
10
|
+
const getISODayUTC = () => {
|
|
11
|
+
const now = /* @__PURE__ */ new Date();
|
|
12
|
+
const day = now.getUTCDay();
|
|
13
|
+
return day === 0 ? 7 : day;
|
|
14
|
+
};
|
|
15
|
+
const filterPromotions = (promotions, productId, customerTypeId = 1) => {
|
|
16
|
+
if (!promotions || !Array.isArray(promotions)) {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
const currentDate = getCurrentDateUTC();
|
|
20
|
+
const currentTime = getCurrentTimeUTC();
|
|
21
|
+
const dayOfWeek = getISODayUTC();
|
|
22
|
+
return promotions.filter((p) => p.discounttype === 3).filter((p) => p.includeproducts.length === 0 || p.includeproducts.includes(productId)).filter((p) => {
|
|
23
|
+
if (p.includecustomertypes.length === 0) return true;
|
|
24
|
+
const isAllowed = p.includecustomertypes.includes(customerTypeId);
|
|
25
|
+
if (import.meta.client) {
|
|
26
|
+
console.log("Customer Type Filter:", {
|
|
27
|
+
promotionId: p.id,
|
|
28
|
+
includecustomertypes: p.includecustomertypes,
|
|
29
|
+
customerTypeId,
|
|
30
|
+
isAllowed
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return isAllowed;
|
|
34
|
+
}).filter((p) => {
|
|
35
|
+
if (p.date_range_schedule === 0 || !p.start_date && !p.end_date) return true;
|
|
36
|
+
if (p.date_range_schedule === 1) {
|
|
37
|
+
if (p.start_date && !p.end_date) return currentDate >= p.start_date;
|
|
38
|
+
if (!p.start_date && p.end_date) return currentDate <= p.end_date;
|
|
39
|
+
if (p.start_date && p.end_date) {
|
|
40
|
+
return currentDate >= p.start_date && currentDate <= p.end_date;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}).filter((p) => {
|
|
45
|
+
if (p.day_time_schedule === 0 || p.voucherschedule.length === 0) return true;
|
|
46
|
+
const daySchedules = p.voucherschedule.filter((s) => s.day === dayOfWeek);
|
|
47
|
+
if (daySchedules.length === 0) return false;
|
|
48
|
+
return daySchedules.some((s) => {
|
|
49
|
+
if (!s.start_time && !s.end_time) return true;
|
|
50
|
+
if (s.start_time && !s.end_time) return currentTime >= s.start_time;
|
|
51
|
+
if (!s.start_time && s.end_time) return currentTime <= s.end_time;
|
|
52
|
+
if (s.start_time && s.end_time) {
|
|
53
|
+
return currentTime >= s.start_time && currentTime <= s.end_time;
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
});
|
|
57
|
+
}).sort((a, b) => b.sortorder - a.sortorder);
|
|
58
|
+
};
|
|
59
|
+
const calculateDiscount = (price, filteredPromotions) => {
|
|
60
|
+
const fixedDiscounts = filteredPromotions.filter((p) => p.voucherdiscounttype_id === 3).reduce((sum, p) => sum + p.discount, 0);
|
|
61
|
+
const percentageDiscounts = Math.min(
|
|
62
|
+
filteredPromotions.filter((p) => p.voucherdiscounttype_id === 2).reduce((sum, p) => sum + p.discount, 0),
|
|
63
|
+
100
|
|
64
|
+
);
|
|
65
|
+
const percentageAmount = percentageDiscounts / 100 * price;
|
|
66
|
+
const totalDiscount = fixedDiscounts + percentageAmount;
|
|
67
|
+
return Math.min(totalDiscount, price);
|
|
68
|
+
};
|
|
69
|
+
const calculatePrice = (productId, price, promotions) => {
|
|
70
|
+
const customerTypeCookie = useCookie("customer_type");
|
|
71
|
+
let customerTypeId = 1;
|
|
72
|
+
if (customerTypeCookie.value) {
|
|
73
|
+
const parsed = parseInt(customerTypeCookie.value);
|
|
74
|
+
customerTypeId = isNaN(parsed) ? 1 : parsed;
|
|
75
|
+
}
|
|
76
|
+
if (import.meta.client) {
|
|
77
|
+
console.log("Price Calculation Debug:", {
|
|
78
|
+
productId,
|
|
79
|
+
customerTypeId,
|
|
80
|
+
cookieValue: customerTypeCookie.value,
|
|
81
|
+
promotionsCount: promotions.length
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
const filteredPromotions = filterPromotions(promotions, productId, customerTypeId);
|
|
85
|
+
if (import.meta.client) {
|
|
86
|
+
console.log("Filtered Promotions:", {
|
|
87
|
+
total: promotions.length,
|
|
88
|
+
filtered: filteredPromotions.length,
|
|
89
|
+
promotions: filteredPromotions
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const discount = calculateDiscount(price, filteredPromotions);
|
|
93
|
+
const finalPrice = Math.max(price - discount, 0);
|
|
94
|
+
return {
|
|
95
|
+
finalPrice: Math.round(finalPrice * 100) / 100,
|
|
96
|
+
originalPrice: price,
|
|
97
|
+
totalDiscount: Math.round(discount * 100) / 100,
|
|
98
|
+
hasDiscount: discount > 0,
|
|
99
|
+
appliedPromotions: filteredPromotions
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
return {
|
|
103
|
+
calculatePrice,
|
|
104
|
+
filterPromotions,
|
|
105
|
+
calculateDiscount
|
|
106
|
+
};
|
|
107
|
+
};
|
|
@@ -74,5 +74,5 @@ export declare const useQuotationCheckout: () => {
|
|
|
74
74
|
getGuestQuotation: (slug: string, query?: any) => Promise<any>;
|
|
75
75
|
GuestCheckoutQuotation: (slug: string, quotationData: any, query?: any) => Promise<any>;
|
|
76
76
|
paymentMethods: (formData: any) => Promise<any>;
|
|
77
|
-
submitCheckout: (slug: string, quotationData: any) => Promise<
|
|
77
|
+
submitCheckout: (slug: string, quotationData: any) => Promise<any>;
|
|
78
78
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const flowrixApi: {
|
|
2
|
-
get: (endpoint: any, config?: {}, options?: {}) => Promise<
|
|
3
|
-
post: (endpoint: any, config?: {}, options?: {}) => Promise<
|
|
4
|
-
put: (endpoint: any, config?: {}, options?: {}) => Promise<
|
|
5
|
-
patch: (endpoint: any, config?: {}, options?: {}) => Promise<
|
|
6
|
-
delete: (endpoint: any, config?: {}, options?: {}) => Promise<
|
|
2
|
+
get: (endpoint: any, config?: {}, options?: {}) => Promise<any>;
|
|
3
|
+
post: (endpoint: any, config?: {}, options?: {}) => Promise<any>;
|
|
4
|
+
put: (endpoint: any, config?: {}, options?: {}) => Promise<any>;
|
|
5
|
+
patch: (endpoint: any, config?: {}, options?: {}) => Promise<any>;
|
|
6
|
+
delete: (endpoint: any, config?: {}, options?: {}) => Promise<any>;
|
|
7
7
|
};
|
|
@@ -32,16 +32,16 @@ async function request(method, config = {}, endpoint, options = {}) {
|
|
|
32
32
|
...options.headers
|
|
33
33
|
};
|
|
34
34
|
try {
|
|
35
|
+
console.log("headers headers headers headers", headers);
|
|
35
36
|
const response = await $fetch(`${FLOWRIX_API_BASE}${endpoint}`, {
|
|
36
37
|
method,
|
|
37
38
|
...options,
|
|
38
39
|
headers,
|
|
39
40
|
onResponse({ response: response2 }) {
|
|
40
|
-
console.log(response2);
|
|
41
41
|
const token = response2.headers.get("x-session-token");
|
|
42
42
|
if (token) {
|
|
43
43
|
if (process.client) {
|
|
44
|
-
document.cookie = `x-session-token=${token}; path=/; max-age=
|
|
44
|
+
document.cookie = `x-session-token=${token}; path=/; max-age=2592000; secure; SameSite=Lax`;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
let S3Client = null;
|
|
2
|
+
let GetObjectCommand = null;
|
|
3
|
+
async function loadAWSSDK() {
|
|
4
|
+
if (!S3Client) {
|
|
5
|
+
const sdk = await import("@aws-sdk/client-s3");
|
|
6
|
+
S3Client = sdk.S3Client;
|
|
7
|
+
GetObjectCommand = sdk.GetObjectCommand;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
let s3Client = null;
|
|
11
|
+
async function getClient(config = {}) {
|
|
12
|
+
await loadAWSSDK();
|
|
13
|
+
if (s3Client) return s3Client;
|
|
14
|
+
const region = config?.S3_REGION || config.public?.S3_REGION || "us-east-1";
|
|
15
|
+
const accessKeyId = config?.S3_ACCESS_KEY_ID || "";
|
|
16
|
+
const secretAccessKey = config?.S3_SECRET_ACCESS_KEY || "";
|
|
17
|
+
const clientConfig = { region };
|
|
18
|
+
if (accessKeyId && secretAccessKey) {
|
|
19
|
+
clientConfig.credentials = {
|
|
20
|
+
accessKeyId,
|
|
21
|
+
secretAccessKey
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
s3Client = new S3Client(clientConfig);
|
|
25
|
+
return s3Client;
|
|
26
|
+
}
|
|
27
|
+
async function streamToString(stream) {
|
|
28
|
+
const chunks = [];
|
|
29
|
+
for await (const chunk of stream) {
|
|
30
|
+
chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
|
|
31
|
+
}
|
|
32
|
+
return Buffer.concat(chunks).toString("utf-8");
|
|
33
|
+
}
|
|
34
|
+
async function request(config = {}, endpoint, options = {}) {
|
|
35
|
+
await loadAWSSDK();
|
|
36
|
+
const client = await getClient(config);
|
|
37
|
+
const bucket = config.S3_BUCKET || "";
|
|
38
|
+
const TENANT = config.S3_TENANT || "";
|
|
39
|
+
let key = "";
|
|
40
|
+
if (options.filetype && options.filetype == true) {
|
|
41
|
+
key = TENANT + "/" + endpoint;
|
|
42
|
+
} else {
|
|
43
|
+
key = TENANT + "/" + endpoint + ".json";
|
|
44
|
+
}
|
|
45
|
+
const command = new GetObjectCommand({ Bucket: bucket, Key: key });
|
|
46
|
+
try {
|
|
47
|
+
const start = Date.now();
|
|
48
|
+
const response = await client.send(command);
|
|
49
|
+
const body = await streamToString(response.Body);
|
|
50
|
+
const fetchTimeMs = Date.now() - start;
|
|
51
|
+
const fixed = body;
|
|
52
|
+
if (response.ContentType == "application/json") {
|
|
53
|
+
const parsed = JSON.parse(fixed);
|
|
54
|
+
parsed.fetchTimeMs = fetchTimeMs;
|
|
55
|
+
return parsed;
|
|
56
|
+
} else {
|
|
57
|
+
return fixed;
|
|
58
|
+
}
|
|
59
|
+
} catch (error) {
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export const flowrixS3 = {
|
|
64
|
+
get: (endpoint, config = {}, options = {}) => request(config, endpoint, options)
|
|
65
|
+
};
|
|
@@ -1,39 +1,61 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { useRoute } from "vue-router";
|
|
3
3
|
import { defineAsyncComponent, computed } from "vue";
|
|
4
|
+
import { setResponseStatus, setHeader } from "h3";
|
|
5
|
+
const event = useRequestEvent();
|
|
6
|
+
import { usePromotions } from "../stores/promotions";
|
|
4
7
|
const DynamicContent = defineAsyncComponent(() => import("../components/Types/dynamic.vue"));
|
|
8
|
+
const Category = defineAsyncComponent(() => import("@/components/Category/index.vue"));
|
|
9
|
+
const Product = defineAsyncComponent(() => import("@/components/Product/index.vue"));
|
|
10
|
+
const BlogSingle = defineAsyncComponent(() => import("@/components/blog/single.vue"));
|
|
11
|
+
const PageComponent = defineAsyncComponent(() => import("@/components/pages/index.vue"));
|
|
12
|
+
const cmsCategory = defineAsyncComponent(() => import("@/components/cmscategory/index.vue"));
|
|
13
|
+
const Brand = defineAsyncComponent(() => import("@/components/Brand/index.vue"));
|
|
5
14
|
const route = useRoute();
|
|
6
15
|
const slug = route.params.slug || "home";
|
|
7
|
-
const { data, error } = await useFetch(`/api/
|
|
16
|
+
const { data, error } = await useFetch(`/api/permalink/${slug}`, {
|
|
17
|
+
server: true,
|
|
18
|
+
lazy: false
|
|
19
|
+
});
|
|
20
|
+
if (import.meta.server && error.value) {
|
|
21
|
+
const statusCode = error.value.statusCode || 500;
|
|
22
|
+
setResponseStatus(event, statusCode);
|
|
23
|
+
setHeader(
|
|
24
|
+
event,
|
|
25
|
+
"Cache-Control",
|
|
26
|
+
"public, max-age=0, s-maxage=0, must-revalidate"
|
|
27
|
+
);
|
|
28
|
+
}
|
|
8
29
|
const redirectPage = (async (redirectData) => {
|
|
9
30
|
return navigateTo(`/${redirectData.target}`, { redirectCode: redirectData.status_code || 404 });
|
|
10
31
|
});
|
|
11
|
-
if (data.value?.
|
|
12
|
-
redirectPage(data.value?.
|
|
13
|
-
}
|
|
14
|
-
if (error.value || !data.value?.data) {
|
|
15
|
-
throw createError({ statusCode: 404, message: "Page Not Found" });
|
|
32
|
+
if (data.value?.permalink?.type === "redirect") {
|
|
33
|
+
redirectPage(data.value?.permalink);
|
|
16
34
|
}
|
|
17
35
|
useHead({
|
|
18
36
|
style: [
|
|
19
37
|
{
|
|
20
|
-
innerHTML: data.value?.
|
|
38
|
+
innerHTML: data.value?.permalink?.content?.css || "",
|
|
21
39
|
type: "text/css"
|
|
22
40
|
}
|
|
23
41
|
]
|
|
24
42
|
});
|
|
25
43
|
const DynamicComponent = computed(() => {
|
|
26
|
-
const type = data.value?.
|
|
44
|
+
const type = data.value?.permalink?.type;
|
|
27
45
|
if (!type || type === "redirect") {
|
|
28
46
|
return null;
|
|
29
47
|
}
|
|
30
48
|
return defineAsyncComponent(
|
|
31
|
-
() => import(
|
|
49
|
+
() => import(`@/components/Types/${type}/index.vue`).catch(
|
|
50
|
+
() => import(`../components/Types/${type}/index.vue`)
|
|
51
|
+
).catch(
|
|
52
|
+
() => import("./404.vue")
|
|
53
|
+
)
|
|
32
54
|
);
|
|
33
55
|
});
|
|
34
56
|
const NotFoundComponent = defineAsyncComponent(async () => {
|
|
35
|
-
const project404 = import.meta.glob("~/
|
|
36
|
-
const projectKey = "/
|
|
57
|
+
const project404 = import.meta.glob("~/components/404.vue");
|
|
58
|
+
const projectKey = "/components/404.vue";
|
|
37
59
|
if (projectKey && project404[projectKey]) {
|
|
38
60
|
return project404[projectKey]();
|
|
39
61
|
}
|
|
@@ -49,14 +71,39 @@ const NotFoundComponent = defineAsyncComponent(async () => {
|
|
|
49
71
|
</script>
|
|
50
72
|
|
|
51
73
|
<template>
|
|
74
|
+
<template v-if="data && data.permalink.is_dynamic == true">
|
|
52
75
|
<template v-if="data && DynamicComponent">
|
|
53
|
-
<component :is="DynamicComponent" :data="data
|
|
76
|
+
<component :is="DynamicComponent" :data="data.data" />
|
|
54
77
|
</template>
|
|
55
|
-
<template v-else>
|
|
56
|
-
<ClientOnly>
|
|
78
|
+
<template v-else>
|
|
57
79
|
<NotFoundComponent/>
|
|
58
|
-
</ClientOnly>
|
|
59
80
|
</template>
|
|
81
|
+
</template><!-- end is dynamic true-->
|
|
82
|
+
<template v-else>
|
|
83
|
+
<template v-if="data && data?.permalink.type == 'product'">
|
|
84
|
+
<Product :product="data" />
|
|
85
|
+
</template>
|
|
86
|
+
<template v-if="data && data?.permalink.type == 'page'">
|
|
87
|
+
<PageComponent v-if="data" :pageData="data?.data" />
|
|
88
|
+
</template>
|
|
89
|
+
<template v-if="data && data?.permalink.type == 'brand'">
|
|
90
|
+
<Brand v-if="data" :data="data?.data" />
|
|
91
|
+
</template>
|
|
92
|
+
<template v-if="data && data?.permalink.type == 'category'">
|
|
93
|
+
<Category :data="data?.data"/>
|
|
94
|
+
</template>
|
|
95
|
+
<template v-if="data && data?.permalink.type == 'post'">
|
|
96
|
+
<div class="container-fluid px-xl-5 px-0">
|
|
97
|
+
<BlogSingle :data="data?.data" />
|
|
98
|
+
</div>
|
|
99
|
+
</template>
|
|
100
|
+
<template v-if="data && data?.permalink.type == 'cmscategory'">
|
|
101
|
+
<div class="container-fluid px-xl-5 px-4">
|
|
102
|
+
<cmsCategory :data="data?.data" />
|
|
103
|
+
</div>
|
|
104
|
+
</template>
|
|
105
|
+
</template>
|
|
106
|
+
<component v-if="error" :is="NotFoundComponent"/>
|
|
60
107
|
</template>
|
|
61
108
|
|
|
62
109
|
<style>
|