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
|
@@ -1,13 +1,94 @@
|
|
|
1
|
-
export default function (
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export default function (product: any): {
|
|
2
|
+
Wishlist: any;
|
|
3
|
+
SampleQuickview: any;
|
|
4
|
+
promotionsStore: import("pinia").Store<"promotions", import("../../stores/promotions.js").PromotionsState, {
|
|
5
|
+
hasPromotions: (state: {
|
|
6
|
+
promotions: any;
|
|
7
|
+
loading: boolean;
|
|
8
|
+
error: string | null;
|
|
9
|
+
fetchPromise: {
|
|
10
|
+
then: <TResult1 = void, TResult2 = never>(onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>;
|
|
11
|
+
catch: <TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined) => Promise<void | TResult>;
|
|
12
|
+
finally: (onfinally?: (() => void) | null | undefined) => Promise<void>;
|
|
13
|
+
readonly [Symbol.toStringTag]: string;
|
|
14
|
+
} | null;
|
|
15
|
+
} & import("pinia").PiniaCustomStateProperties<import("../../stores/promotions.js").PromotionsState>) => boolean;
|
|
16
|
+
isLoading: (state: {
|
|
17
|
+
promotions: any;
|
|
18
|
+
loading: boolean;
|
|
19
|
+
error: string | null;
|
|
20
|
+
fetchPromise: {
|
|
21
|
+
then: <TResult1 = void, TResult2 = never>(onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>;
|
|
22
|
+
catch: <TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined) => Promise<void | TResult>;
|
|
23
|
+
finally: (onfinally?: (() => void) | null | undefined) => Promise<void>;
|
|
24
|
+
readonly [Symbol.toStringTag]: string;
|
|
25
|
+
} | null;
|
|
26
|
+
} & import("pinia").PiniaCustomStateProperties<import("../../stores/promotions.js").PromotionsState>) => boolean;
|
|
27
|
+
hasError: (state: {
|
|
28
|
+
promotions: any;
|
|
29
|
+
loading: boolean;
|
|
30
|
+
error: string | null;
|
|
31
|
+
fetchPromise: {
|
|
32
|
+
then: <TResult1 = void, TResult2 = never>(onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>;
|
|
33
|
+
catch: <TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined) => Promise<void | TResult>;
|
|
34
|
+
finally: (onfinally?: (() => void) | null | undefined) => Promise<void>;
|
|
35
|
+
readonly [Symbol.toStringTag]: string;
|
|
36
|
+
} | null;
|
|
37
|
+
} & import("pinia").PiniaCustomStateProperties<import("../../stores/promotions.js").PromotionsState>) => boolean;
|
|
38
|
+
}, {
|
|
39
|
+
fetchPromotions(force?: boolean): Promise<any>;
|
|
40
|
+
_doFetch(): Promise<void>;
|
|
41
|
+
refreshPromotions(): Promise<any>;
|
|
42
|
+
clearPromotions(): void;
|
|
43
|
+
}>;
|
|
44
|
+
cartStore: import("pinia").Store<"cart", import("../../stores/Cart.js").CartState, {}, {}>;
|
|
45
|
+
router: import("vue-router").Router;
|
|
46
|
+
route: import("vue-router").RouteLocationNormalizedLoadedGeneric;
|
|
47
|
+
showSampleModal: import("vue").Ref<boolean, boolean>;
|
|
48
|
+
currentSample: import("vue").Ref<any, any>;
|
|
49
|
+
showPreviewModal: import("vue").Ref<boolean, boolean>;
|
|
50
|
+
isAddingToCart: import("vue").Ref<boolean, boolean>;
|
|
51
|
+
isCustomizing: import("vue").Ref<boolean, boolean>;
|
|
52
|
+
hovered: import("vue").Ref<boolean, boolean>;
|
|
53
|
+
buttonLoading: import("vue").Ref<boolean, boolean>;
|
|
54
|
+
openWishlistModal: import("vue").Ref<boolean, boolean>;
|
|
55
|
+
wishlistModalRef: import("vue").Ref<null, null>;
|
|
56
|
+
data: import("vue").Ref<any, any>;
|
|
57
|
+
openPopup: import("vue").Ref<boolean, boolean>;
|
|
6
58
|
checkInCart: import("vue").Ref<number, number>;
|
|
7
59
|
productQty: import("vue").Ref<number, number>;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
60
|
+
isAuthenticated: import("vue").ComputedRef<false>;
|
|
61
|
+
areSamplesInCart: import("vue").ComputedRef<boolean>;
|
|
62
|
+
priceData: import("vue").ComputedRef<import("../usePriceCalculation.js").PriceCalculationResult | {
|
|
63
|
+
finalPrice: any;
|
|
64
|
+
originalPrice: any;
|
|
65
|
+
totalDiscount: number;
|
|
66
|
+
hasDiscount: boolean;
|
|
67
|
+
appliedPromotions: never[];
|
|
68
|
+
}>;
|
|
69
|
+
computedPrice: import("vue").ComputedRef<any>;
|
|
70
|
+
computedPriceFloat: import("vue").ComputedRef<any>;
|
|
71
|
+
hasDiscount: import("vue").ComputedRef<boolean>;
|
|
72
|
+
originalPrice: import("vue").ComputedRef<any>;
|
|
73
|
+
openSampleModal: () => void;
|
|
74
|
+
closeSampleModal: () => void;
|
|
75
|
+
openPreviewModal: (productUrl: any) => Promise<void>;
|
|
76
|
+
closePreviewModal: () => void;
|
|
12
77
|
closePopupModal: () => void;
|
|
78
|
+
openCustomizeModal: () => void;
|
|
79
|
+
imageResize: (image: string, size?: number | string) => string;
|
|
80
|
+
ensureStartsWithSlash: (str: string) => string;
|
|
81
|
+
imagesize: (swatchImage: string) => string;
|
|
82
|
+
addToCart: (prod: any, qty: number) => Promise<void>;
|
|
83
|
+
updateQuantity: (prod: any, quantity: number) => Promise<void>;
|
|
84
|
+
isProductInCart: (productId: string) => void;
|
|
85
|
+
AddTocartMidelware: (prod: any) => Promise<void>;
|
|
86
|
+
updateQuantityMidelware: (prod: any, qty: number) => Promise<void>;
|
|
87
|
+
orderSample: () => Promise<void>;
|
|
88
|
+
removeAllSamples: () => Promise<void>;
|
|
89
|
+
disableOtherSamples: (working?: boolean) => void;
|
|
90
|
+
handleOrderSample: () => void;
|
|
91
|
+
handleWishlistClick: () => void;
|
|
92
|
+
navigateToCustomize: () => void;
|
|
93
|
+
initializeProductCard: () => void;
|
|
13
94
|
};
|
|
@@ -1,36 +1,110 @@
|
|
|
1
|
-
import { ref, defineAsyncComponent } from "vue";
|
|
1
|
+
import { ref, defineAsyncComponent, computed } from "vue";
|
|
2
|
+
import { useRouter, useRoute } from "vue-router";
|
|
2
3
|
import { useCartStore } from "../../stores/Cart.js";
|
|
3
|
-
|
|
4
|
+
import { useAuthStore } from "../../stores/auth.js";
|
|
5
|
+
import { usePromotions } from "../../stores/promotions.js";
|
|
6
|
+
import { usePriceCalculation } from "../usePriceCalculation.js";
|
|
7
|
+
export default function(product) {
|
|
8
|
+
const router = useRouter();
|
|
9
|
+
const route = useRoute();
|
|
4
10
|
const CartStore = useCartStore();
|
|
11
|
+
const authStore = useAuthStore();
|
|
12
|
+
const promotionsStore = usePromotions();
|
|
13
|
+
const { calculatePrice } = usePriceCalculation();
|
|
14
|
+
const Wishlist = defineAsyncComponent(() => import("~/components/WishList/modal.vue"));
|
|
15
|
+
const SampleQuickview = defineAsyncComponent(() => import("~/components/Product/SampleQuickview.vue"));
|
|
16
|
+
const showSampleModal = ref(false);
|
|
17
|
+
const currentSample = ref({});
|
|
18
|
+
const showPreviewModal = ref(false);
|
|
19
|
+
const isAddingToCart = ref(false);
|
|
20
|
+
const isCustomizing = ref(false);
|
|
21
|
+
const hovered = ref(false);
|
|
22
|
+
const buttonLoading = ref(false);
|
|
23
|
+
const openWishlistModal = ref(false);
|
|
24
|
+
const wishlistModalRef = ref(null);
|
|
25
|
+
const data = ref();
|
|
5
26
|
const openPopup = ref(false);
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
27
|
+
const checkInCart = ref(0);
|
|
28
|
+
const productQty = ref(1);
|
|
29
|
+
const isAuthenticated = computed(() => authStore.isAuthenticated);
|
|
30
|
+
const priceData = computed(() => {
|
|
31
|
+
if (!product || !product.id || !product.rpfloat) {
|
|
32
|
+
return {
|
|
33
|
+
finalPrice: product?.pricefloat || 0,
|
|
34
|
+
originalPrice: product?.rpfloat || 0,
|
|
35
|
+
totalDiscount: 0,
|
|
36
|
+
hasDiscount: false,
|
|
37
|
+
appliedPromotions: []
|
|
38
|
+
};
|
|
16
39
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
40
|
+
if (!promotionsStore.hasPromotions) {
|
|
41
|
+
return {
|
|
42
|
+
finalPrice: product.pricefloat || product.rpfloat,
|
|
43
|
+
originalPrice: product.rpfloat,
|
|
44
|
+
totalDiscount: 0,
|
|
45
|
+
hasDiscount: false,
|
|
46
|
+
appliedPromotions: []
|
|
47
|
+
};
|
|
25
48
|
}
|
|
49
|
+
return calculatePrice(
|
|
50
|
+
product.id,
|
|
51
|
+
product.rpfloat,
|
|
52
|
+
promotionsStore.promotions
|
|
53
|
+
);
|
|
26
54
|
});
|
|
27
|
-
const
|
|
28
|
-
|
|
55
|
+
const computedPrice = computed(() => {
|
|
56
|
+
const price = priceData.value.finalPrice;
|
|
57
|
+
return price.toFixed(2);
|
|
58
|
+
});
|
|
59
|
+
const computedPriceFloat = computed(() => {
|
|
60
|
+
return priceData.value.finalPrice;
|
|
61
|
+
});
|
|
62
|
+
const hasDiscount = computed(() => {
|
|
63
|
+
return priceData.value.hasDiscount;
|
|
64
|
+
});
|
|
65
|
+
const originalPrice = computed(() => {
|
|
66
|
+
return priceData.value.originalPrice.toFixed(2);
|
|
67
|
+
});
|
|
68
|
+
const openSampleModal = () => {
|
|
69
|
+
showSampleModal.value = true;
|
|
70
|
+
};
|
|
71
|
+
const closeSampleModal = () => {
|
|
72
|
+
showSampleModal.value = false;
|
|
73
|
+
};
|
|
74
|
+
const openPreviewModal = async (productUrl) => {
|
|
75
|
+
showPreviewModal.value = true;
|
|
76
|
+
const { useQuickView } = await import("../Product/useQuickView.js");
|
|
77
|
+
data.value = await useQuickView(productUrl);
|
|
78
|
+
};
|
|
79
|
+
const closePreviewModal = () => {
|
|
80
|
+
showPreviewModal.value = false;
|
|
81
|
+
};
|
|
82
|
+
const closePopupModal = () => {
|
|
83
|
+
openPopup.value = false;
|
|
84
|
+
};
|
|
85
|
+
const openCustomizeModal = () => {
|
|
86
|
+
navigateToCustomize();
|
|
87
|
+
};
|
|
88
|
+
const imageResize = (image, size = "") => {
|
|
89
|
+
if (!image) return "https://image.webp";
|
|
90
|
+
const newImage = image.replace(/.webp/gi, `${size}.webp`);
|
|
91
|
+
return newImage;
|
|
92
|
+
};
|
|
93
|
+
const ensureStartsWithSlash = (str) => {
|
|
94
|
+
return str.startsWith("/") ? str : "/" + str;
|
|
95
|
+
};
|
|
96
|
+
const imagesize = (swatchImage) => {
|
|
97
|
+
if (swatchImage) {
|
|
98
|
+
let swatchImage320 = swatchImage.replace(/.webp/gi, "320.webp");
|
|
99
|
+
return swatchImage320;
|
|
100
|
+
}
|
|
101
|
+
return swatchImage;
|
|
102
|
+
};
|
|
29
103
|
const isProductInCart = (productId) => {
|
|
30
104
|
if (CartStore.cart.items) {
|
|
31
|
-
|
|
105
|
+
const isincart = Object.values(CartStore.cart.items).filter((v) => v.slug == productId);
|
|
32
106
|
if (isincart.length > 0) {
|
|
33
|
-
productQty.value = isincart[0].qty;
|
|
107
|
+
productQty.value = isincart[0].qty || 1;
|
|
34
108
|
checkInCart.value = 1;
|
|
35
109
|
} else {
|
|
36
110
|
productQty.value = 0;
|
|
@@ -38,51 +112,179 @@ export default function(item, template = "default") {
|
|
|
38
112
|
}
|
|
39
113
|
}
|
|
40
114
|
};
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
115
|
+
const areSamplesInCart = computed(() => {
|
|
116
|
+
if (CartStore.cart.items && product?.sample && Object.keys(product.sample).length > 0) {
|
|
117
|
+
return Object.values(product.sample).every(
|
|
118
|
+
(sample) => Object.values(CartStore.cart.items || {}).some(
|
|
119
|
+
(item) => item.slug === sample.slug
|
|
120
|
+
)
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
return false;
|
|
124
|
+
});
|
|
125
|
+
const disableOtherSamples = (working = false) => {
|
|
126
|
+
if (typeof document === "undefined") return;
|
|
127
|
+
const allButtons = document.querySelectorAll(".ordersample");
|
|
128
|
+
allButtons.forEach((btn) => {
|
|
129
|
+
if (working) {
|
|
130
|
+
btn.classList.add("disabled");
|
|
131
|
+
} else {
|
|
132
|
+
btn.classList.remove("disabled");
|
|
133
|
+
}
|
|
134
|
+
});
|
|
46
135
|
};
|
|
47
|
-
const addToCart = async (
|
|
48
|
-
await
|
|
49
|
-
if (
|
|
136
|
+
const addToCart = async (prod, qty) => {
|
|
137
|
+
await CartStore.addToCart(prod, qty);
|
|
138
|
+
if (CartStore.addedResponse == "success") {
|
|
50
139
|
openPopup.value = true;
|
|
51
140
|
}
|
|
52
|
-
isProductInCart(
|
|
141
|
+
isProductInCart(prod.slug);
|
|
53
142
|
};
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
143
|
+
const updateQuantity = async (prod, quantity) => {
|
|
144
|
+
const SingleProduct = Object.values(CartStore.cart.items || {}).find((item) => item.slug === prod.slug);
|
|
145
|
+
if (SingleProduct) {
|
|
146
|
+
await CartStore.updateQuantity(SingleProduct, quantity);
|
|
147
|
+
productQty.value = SingleProduct.qty;
|
|
148
|
+
isProductInCart(prod.slug);
|
|
58
149
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
150
|
+
};
|
|
151
|
+
const removeAllSamples = async () => {
|
|
152
|
+
if (CartStore.cart.items && product?.sample && Object.keys(product.sample).length > 0) {
|
|
153
|
+
buttonLoading.value = true;
|
|
63
154
|
try {
|
|
64
|
-
const
|
|
65
|
-
|
|
155
|
+
for (const sample of Object.values(product.sample)) {
|
|
156
|
+
const productToRemove = Object.values(CartStore.cart.items).find(
|
|
157
|
+
(item) => item.slug === sample.slug
|
|
158
|
+
);
|
|
159
|
+
if (productToRemove) {
|
|
160
|
+
await CartStore.removeFromCart(
|
|
161
|
+
productToRemove.rowId,
|
|
162
|
+
productToRemove
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
66
166
|
} catch (error) {
|
|
67
|
-
|
|
68
|
-
|
|
167
|
+
console.error("Error removing samples from cart:", error);
|
|
168
|
+
} finally {
|
|
169
|
+
buttonLoading.value = false;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
const orderSample = async () => {
|
|
174
|
+
disableOtherSamples(true);
|
|
175
|
+
if (areSamplesInCart.value) {
|
|
176
|
+
await removeAllSamples();
|
|
177
|
+
disableOtherSamples();
|
|
178
|
+
} else {
|
|
179
|
+
if (product.sample && Object.keys(product.sample).length > 0) {
|
|
180
|
+
buttonLoading.value = true;
|
|
181
|
+
try {
|
|
182
|
+
for (const sample of Object.values(product.sample)) {
|
|
183
|
+
await addToCart({ slug: sample.slug }, 1);
|
|
184
|
+
}
|
|
185
|
+
} catch (error) {
|
|
186
|
+
console.error("Error adding samples to cart:", error);
|
|
187
|
+
} finally {
|
|
188
|
+
buttonLoading.value = false;
|
|
189
|
+
disableOtherSamples();
|
|
190
|
+
}
|
|
69
191
|
}
|
|
70
192
|
}
|
|
71
|
-
}
|
|
72
|
-
const
|
|
73
|
-
|
|
193
|
+
};
|
|
194
|
+
const AddTocartMidelware = async (prod) => {
|
|
195
|
+
isAddingToCart.value = true;
|
|
196
|
+
try {
|
|
197
|
+
await addToCart(prod, 1);
|
|
198
|
+
} catch (error) {
|
|
199
|
+
console.error("Error adding to cart:", error);
|
|
200
|
+
} finally {
|
|
201
|
+
isAddingToCart.value = false;
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
const updateQuantityMidelware = async (prod, qty) => {
|
|
205
|
+
await updateQuantity(prod, qty);
|
|
206
|
+
};
|
|
207
|
+
const navigateToCustomize = () => {
|
|
208
|
+
isCustomizing.value = true;
|
|
209
|
+
};
|
|
210
|
+
const handleWishlistClick = () => {
|
|
211
|
+
if (!isAuthenticated.value) {
|
|
212
|
+
const returnUrl = route.fullPath;
|
|
213
|
+
router.push({
|
|
214
|
+
path: "/login",
|
|
215
|
+
query: { redirect: returnUrl }
|
|
216
|
+
});
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
openWishlistModal.value = true;
|
|
220
|
+
};
|
|
221
|
+
const handleOrderSample = () => {
|
|
222
|
+
alert("Free sample ordered for " + product.title);
|
|
223
|
+
};
|
|
224
|
+
const initializeProductCard = () => {
|
|
225
|
+
if (product?.slug) {
|
|
226
|
+
isProductInCart(product.slug);
|
|
227
|
+
}
|
|
74
228
|
};
|
|
75
229
|
return {
|
|
76
|
-
|
|
230
|
+
// Components
|
|
231
|
+
Wishlist,
|
|
232
|
+
SampleQuickview,
|
|
233
|
+
// Stores
|
|
234
|
+
promotionsStore,
|
|
235
|
+
cartStore: CartStore,
|
|
236
|
+
// Router
|
|
237
|
+
router,
|
|
238
|
+
route,
|
|
239
|
+
// State
|
|
240
|
+
showSampleModal,
|
|
241
|
+
currentSample,
|
|
242
|
+
showPreviewModal,
|
|
243
|
+
isAddingToCart,
|
|
244
|
+
isCustomizing,
|
|
245
|
+
hovered,
|
|
246
|
+
buttonLoading,
|
|
247
|
+
openWishlistModal,
|
|
248
|
+
wishlistModalRef,
|
|
249
|
+
data,
|
|
250
|
+
openPopup,
|
|
251
|
+
checkInCart,
|
|
252
|
+
productQty,
|
|
253
|
+
// Computed
|
|
254
|
+
isAuthenticated,
|
|
255
|
+
areSamplesInCart,
|
|
256
|
+
priceData,
|
|
257
|
+
computedPrice,
|
|
258
|
+
computedPriceFloat,
|
|
259
|
+
hasDiscount,
|
|
260
|
+
originalPrice,
|
|
261
|
+
// Modal handlers
|
|
262
|
+
openSampleModal,
|
|
263
|
+
closeSampleModal,
|
|
264
|
+
openPreviewModal,
|
|
265
|
+
closePreviewModal,
|
|
266
|
+
closePopupModal,
|
|
267
|
+
openCustomizeModal,
|
|
268
|
+
// Utilities
|
|
269
|
+
imageResize,
|
|
270
|
+
ensureStartsWithSlash,
|
|
77
271
|
imagesize,
|
|
272
|
+
// Cart actions
|
|
78
273
|
addToCart,
|
|
79
274
|
updateQuantity,
|
|
80
|
-
checkInCart,
|
|
81
|
-
productQty,
|
|
82
275
|
isProductInCart,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
276
|
+
AddTocartMidelware,
|
|
277
|
+
updateQuantityMidelware,
|
|
278
|
+
// Sample actions
|
|
279
|
+
orderSample,
|
|
280
|
+
removeAllSamples,
|
|
281
|
+
disableOtherSamples,
|
|
282
|
+
handleOrderSample,
|
|
283
|
+
// Wishlist
|
|
284
|
+
handleWishlistClick,
|
|
285
|
+
// Other
|
|
286
|
+
navigateToCustomize,
|
|
287
|
+
// Initialize
|
|
288
|
+
initializeProductCard
|
|
87
289
|
};
|
|
88
290
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { defineAsyncComponent } from "vue";
|
|
2
|
-
import { useHead,
|
|
3
|
-
import { getRequestURL } from "h3";
|
|
4
|
-
import { GTM_view_item } from "../useDataLayer.js";
|
|
5
|
-
import { META_view_item } from "../useMetaLayer.js";
|
|
6
|
-
import { TikTok_view_item } from "../useTikTokDatalayer.js";
|
|
2
|
+
import { useHead, useRoute, useRuntimeConfig } from "#imports";
|
|
7
3
|
import { useCompanyProfile } from "../../stores/useCompanyProfile.js";
|
|
8
4
|
export function useProductComponent(product) {
|
|
9
5
|
const route = useRoute();
|
|
@@ -26,8 +22,8 @@ export function useProductComponent(product) {
|
|
|
26
22
|
});
|
|
27
23
|
let websiteurl = "";
|
|
28
24
|
if (process.server) {
|
|
29
|
-
const
|
|
30
|
-
websiteurl =
|
|
25
|
+
const config = useRuntimeConfig();
|
|
26
|
+
websiteurl = config.WEBSITE_URL || "";
|
|
31
27
|
} else {
|
|
32
28
|
websiteurl = window.location.origin;
|
|
33
29
|
}
|
|
@@ -123,9 +119,6 @@ export function useProductComponent(product) {
|
|
|
123
119
|
}
|
|
124
120
|
]
|
|
125
121
|
});
|
|
126
|
-
GTM_view_item(product, product?.rrpfloat, product?.rpfloat);
|
|
127
|
-
META_view_item(product, product?.rrpfloat, product?.rpfloat);
|
|
128
|
-
TikTok_view_item(product, product?.rrpfloat, product?.rpfloat);
|
|
129
122
|
return {
|
|
130
123
|
Template
|
|
131
124
|
};
|
|
@@ -5,4 +5,4 @@ export declare const useQuickView: (slug: string) => {
|
|
|
5
5
|
execute: any;
|
|
6
6
|
pending: any;
|
|
7
7
|
};
|
|
8
|
-
export declare const useSendQuickValues: (attributes: Record<string, any>, slug: any) => Promise<
|
|
8
|
+
export declare const useSendQuickValues: (attributes: Record<string, any>, slug: any) => Promise<any>;
|
|
@@ -8,18 +8,7 @@ export declare function useService(): {
|
|
|
8
8
|
serviceSuccess: import("vue").Ref<string, string>;
|
|
9
9
|
checkingAvailability: import("vue").Ref<boolean, boolean>;
|
|
10
10
|
addingToCart: import("vue").Ref<boolean, boolean>;
|
|
11
|
-
location: import("vue").ComputedRef<
|
|
12
|
-
city?: string | undefined;
|
|
13
|
-
country_name?: string | undefined;
|
|
14
|
-
country_code?: string | undefined;
|
|
15
|
-
country_id?: number | undefined;
|
|
16
|
-
ip?: string | undefined;
|
|
17
|
-
proxy?: boolean | undefined;
|
|
18
|
-
region?: string | undefined;
|
|
19
|
-
region_short?: string | undefined;
|
|
20
|
-
region_id?: number | undefined;
|
|
21
|
-
zip_code?: string | undefined;
|
|
22
|
-
} | null>;
|
|
11
|
+
location: import("vue").ComputedRef<import("../../stores/locations.js").LocationData | null>;
|
|
23
12
|
services: import("vue").ComputedRef<never[]>;
|
|
24
13
|
currentService: import("vue").ComputedRef<any>;
|
|
25
14
|
cart: import("vue").ComputedRef<{
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ref, computed, watch } from "vue";
|
|
2
2
|
import { useServiceStore } from "../../stores/Services.js";
|
|
3
3
|
import { useCartStore } from "../../stores/Cart.js";
|
|
4
|
-
import {
|
|
4
|
+
import { useLocationsStore } from "../../stores/locations.js";
|
|
5
5
|
export function useService() {
|
|
6
6
|
const serviceStore = useServiceStore();
|
|
7
7
|
const cartStore = useCartStore();
|
|
8
|
-
const locationStore =
|
|
8
|
+
const locationStore = useLocationsStore();
|
|
9
9
|
const servicesAvailability = ref(false);
|
|
10
10
|
const serviceSuccess = ref("");
|
|
11
11
|
const checkingAvailability = ref(false);
|
|
@@ -81,9 +81,9 @@ export { useCookieConsent } from './useCookieConsent.js';
|
|
|
81
81
|
export { GTM_page_view, GTM_view_item, GTM_view_item_list, GTM_view_cart, GTM_add_to_cart, GTM_remove_from_cart, GTM_begin_checkout, GTM_add_shipping_info, GTM_add_payment_info, GTM_purchase, GTM_select_item_color, GTM_select_item_collection, GTM_Attribute_Content } from './useDataLayer.js';
|
|
82
82
|
export { useDynamicHtmlRenderer } from './useDynamicHtmlRenderer.js';
|
|
83
83
|
export { useLocation } from './useLocation.js';
|
|
84
|
-
export { useLocations } from './useLocations.js';
|
|
85
84
|
export { useQuotationCheckout } from './useQuotationCheckout.js';
|
|
86
85
|
export { useSearch } from './useSearch.js';
|
|
87
86
|
export { useSubscriptions } from './useSubscriptions.js';
|
|
88
87
|
export { useWebforms } from './useWebforms.js';
|
|
89
88
|
export { useApp } from './useApp.js';
|
|
89
|
+
export { usePriceCalculation } from './usePriceCalculation.js';
|
|
@@ -81,9 +81,9 @@ export { useCookieConsent } from "./useCookieConsent.js";
|
|
|
81
81
|
export { GTM_page_view, GTM_view_item, GTM_view_item_list, GTM_view_cart, GTM_add_to_cart, GTM_remove_from_cart, GTM_begin_checkout, GTM_add_shipping_info, GTM_add_payment_info, GTM_purchase, GTM_select_item_color, GTM_select_item_collection, GTM_Attribute_Content } from "./useDataLayer.js";
|
|
82
82
|
export { useDynamicHtmlRenderer } from "./useDynamicHtmlRenderer.js";
|
|
83
83
|
export { useLocation } from "./useLocation.js";
|
|
84
|
-
export { useLocations } from "./useLocations.js";
|
|
85
84
|
export { useQuotationCheckout } from "./useQuotationCheckout.js";
|
|
86
85
|
export { useSearch } from "./useSearch.js";
|
|
87
86
|
export { useSubscriptions } from "./useSubscriptions.js";
|
|
88
87
|
export { useWebforms } from "./useWebforms.js";
|
|
89
88
|
export { useApp } from "./useApp.js";
|
|
89
|
+
export { usePriceCalculation } from "./usePriceCalculation.js";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
2
|
import { useAddressesStore } from "../stores/addresses.js";
|
|
3
3
|
import { useAuthStore } from "../stores/auth.js";
|
|
4
|
-
import {
|
|
4
|
+
import { flowrixApi } from "../middleware/flowrix.js";
|
|
5
|
+
import { useRuntimeConfig } from "#imports";
|
|
5
6
|
function formatErrorMessage(message) {
|
|
6
7
|
if (!message) return "An error occurred";
|
|
7
8
|
if (typeof message === "string") {
|
|
@@ -20,13 +21,18 @@ function formatErrorMessage(message) {
|
|
|
20
21
|
export function useAddresses() {
|
|
21
22
|
const store = useAddressesStore();
|
|
22
23
|
const { fetchProfile } = useAuthStore();
|
|
23
|
-
const
|
|
24
|
+
const config = useRuntimeConfig();
|
|
24
25
|
async function addAddress(userData) {
|
|
25
26
|
store.setLoading(true);
|
|
26
27
|
store.setError(null);
|
|
27
28
|
try {
|
|
29
|
+
let rawCookies = "";
|
|
30
|
+
if (process.client) {
|
|
31
|
+
rawCookies = document.cookie || "";
|
|
32
|
+
}
|
|
33
|
+
const apiConfig = { ...config, cookies: rawCookies };
|
|
28
34
|
userData.shipping = 1;
|
|
29
|
-
const response = await post("/mystore/customer/address/add", userData);
|
|
35
|
+
const response = await flowrixApi.post("/mystore/customer/address/add", apiConfig, { body: userData });
|
|
30
36
|
if (response.status === "Success" && response.data) {
|
|
31
37
|
await fetchProfile();
|
|
32
38
|
return response;
|
|
@@ -48,7 +54,12 @@ export function useAddresses() {
|
|
|
48
54
|
store.setLoading(true);
|
|
49
55
|
store.setError(null);
|
|
50
56
|
try {
|
|
51
|
-
|
|
57
|
+
let rawCookies = "";
|
|
58
|
+
if (process.client) {
|
|
59
|
+
rawCookies = document.cookie || "";
|
|
60
|
+
}
|
|
61
|
+
const apiConfig = { ...config, cookies: rawCookies };
|
|
62
|
+
const response = await flowrixApi.patch(`/mystore/customer/address/${userData.id}/update`, apiConfig, { body: userData });
|
|
52
63
|
if (response.status === "Success" && response.data) {
|
|
53
64
|
await fetchProfile();
|
|
54
65
|
return response;
|
|
@@ -70,7 +81,12 @@ export function useAddresses() {
|
|
|
70
81
|
store.setLoading(true);
|
|
71
82
|
store.setError(null);
|
|
72
83
|
try {
|
|
73
|
-
|
|
84
|
+
let rawCookies = "";
|
|
85
|
+
if (process.client) {
|
|
86
|
+
rawCookies = document.cookie || "";
|
|
87
|
+
}
|
|
88
|
+
const apiConfig = { ...config, cookies: rawCookies };
|
|
89
|
+
const response = await flowrixApi.patch(`/mystore/customer/address/${id}/delete`, apiConfig, { body: {} });
|
|
74
90
|
if (response.status === "Success") {
|
|
75
91
|
await fetchProfile();
|
|
76
92
|
return response;
|
|
@@ -92,7 +108,12 @@ export function useAddresses() {
|
|
|
92
108
|
store.setLoading(true);
|
|
93
109
|
store.setError(null);
|
|
94
110
|
try {
|
|
95
|
-
|
|
111
|
+
let rawCookies = "";
|
|
112
|
+
if (process.client) {
|
|
113
|
+
rawCookies = document.cookie || "";
|
|
114
|
+
}
|
|
115
|
+
const apiConfig = { ...config, cookies: rawCookies };
|
|
116
|
+
const response = await flowrixApi.post(`/mystore/customer/address/${addressId}/setshipping`, apiConfig, { body: {} });
|
|
96
117
|
if (response.status === "Success") {
|
|
97
118
|
await fetchProfile();
|
|
98
119
|
return response;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { useHead,
|
|
2
|
-
import { getRequestURL } from "h3";
|
|
1
|
+
import { useHead, useRoute, useRuntimeConfig } from "#imports";
|
|
3
2
|
import { useCompanyProfile } from "../stores/useCompanyProfile.js";
|
|
4
3
|
export const useApp = () => {
|
|
5
4
|
const route = useRoute();
|
|
@@ -21,8 +20,8 @@ export const useApp = () => {
|
|
|
21
20
|
}
|
|
22
21
|
let websiteurl = "";
|
|
23
22
|
if (process.server) {
|
|
24
|
-
const
|
|
25
|
-
websiteurl =
|
|
23
|
+
const config = useRuntimeConfig();
|
|
24
|
+
websiteurl = config.WEBSITE_URL || "";
|
|
26
25
|
} else {
|
|
27
26
|
websiteurl = window.location.origin;
|
|
28
27
|
}
|