hey-pharmacist-ecommerce 1.1.19 → 1.1.22
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/index.d.mts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +722 -487
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +724 -489
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/components/CartItem.tsx +29 -17
- package/src/lib/Apis/api.ts +0 -1
- package/src/lib/Apis/apis/products-api.ts +187 -0
- package/src/lib/Apis/apis/stores-api.ts +244 -0
- package/src/lib/Apis/models/create-product-dto.ts +6 -0
- package/src/lib/Apis/models/create-single-variant-product-dto.ts +6 -0
- package/src/lib/Apis/models/extended-product-dto.ts +6 -0
- package/src/lib/Apis/models/index.ts +2 -0
- package/src/lib/Apis/models/new-client-email-dto.ts +159 -0
- package/src/lib/Apis/models/product.ts +6 -0
- package/src/lib/Apis/models/schedule-tour-email-dto.ts +45 -0
- package/src/lib/Apis/models/update-product-dto.ts +6 -0
- package/src/lib/Apis/sharedConfig.ts +9 -0
- package/src/lib/Apis/wrapper.ts +11 -16
- package/src/lib/api-adapter/config.ts +12 -6
- package/src/providers/CartProvider.tsx +152 -82
- package/src/screens/CartScreen.tsx +1 -1
- package/src/screens/CheckoutScreen.tsx +21 -6
- package/src/screens/ProductDetailScreen.tsx +140 -132
- package/src/styles/globals.css +18 -5
- package/src/lib/Apis/apis/inventory-api.ts +0 -267
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import React8, { createContext, forwardRef, useContext, useEffect, useState, useCallback,
|
|
2
|
+
import React8, { createContext, forwardRef, useContext, useEffect, useState, useCallback, useRef, useMemo } from 'react';
|
|
3
3
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import globalAxios4 from 'axios';
|
|
5
5
|
import { motion, AnimatePresence } from 'framer-motion';
|
|
6
|
-
import { Eye, Star, ShoppingCart, Sparkles, ShieldCheck, TrendingUp, Search, ArrowUpDown, ChevronDown, LayoutGrid, LayoutList, X, Clock, Package, ChevronLeft, Check, Heart, Truck, RotateCcw, Shield, Trash2, Minus, Plus, ShoppingBag, ArrowRight, CheckCircle2, Edit3, MapPin, CreditCard, Lock, EyeOff, UserPlus, User, Settings, Filter, ChevronRight, ArrowUpRight, PackageCheck, Warehouse, BellRing, Crown, Phone, Grid, List, ArrowLeft, LogOut, Menu, Mail, Facebook, Twitter, Instagram, Shirt, Pill, Box, ExternalLink, Globe, Home, CheckCircle, Edit, Bell, AlertTriangle, Info,
|
|
6
|
+
import { Eye, Star, ShoppingCart, Sparkles, ShieldCheck, TrendingUp, Search, ArrowUpDown, ChevronDown, LayoutGrid, LayoutList, X, Clock, Package, ChevronLeft, Check, Heart, Truck, RotateCcw, Shield, Trash2, Minus, Plus, ShoppingBag, ArrowRight, CheckCircle2, Edit3, MapPin, CreditCard, AlertCircle, Lock, EyeOff, UserPlus, User, Settings, Filter, ChevronRight, ArrowUpRight, PackageCheck, Warehouse, BellRing, Crown, Phone, Grid, List, ArrowLeft, LogOut, Menu, Mail, Facebook, Twitter, Instagram, Shirt, Pill, Box, ExternalLink, Globe, Home, CheckCircle, Edit, Bell, AlertTriangle, Info, XCircle } from 'lucide-react';
|
|
7
7
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
8
8
|
import { useRouter, useSearchParams } from 'next/navigation';
|
|
9
9
|
import Image4 from 'next/image';
|
|
@@ -51,6 +51,21 @@ var init_configuration = __esm({
|
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
+
// src/lib/Apis/sharedConfig.ts
|
|
55
|
+
var AXIOS_CONFIG;
|
|
56
|
+
var init_sharedConfig = __esm({
|
|
57
|
+
"src/lib/Apis/sharedConfig.ts"() {
|
|
58
|
+
init_configuration();
|
|
59
|
+
AXIOS_CONFIG = new Configuration({
|
|
60
|
+
basePath: "https://api.heypharmacist.com",
|
|
61
|
+
// Default fallback
|
|
62
|
+
baseOptions: {
|
|
63
|
+
timeout: 2e4
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
54
69
|
// src/lib/api-adapter/config.ts
|
|
55
70
|
var config_exports = {};
|
|
56
71
|
__export(config_exports, {
|
|
@@ -63,13 +78,10 @@ __export(config_exports, {
|
|
|
63
78
|
});
|
|
64
79
|
function initializeApiAdapter(config) {
|
|
65
80
|
currentConfig = config;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
accessToken: () => getAuthToken() || ""
|
|
71
|
-
// Bearer token
|
|
72
|
-
});
|
|
81
|
+
AXIOS_CONFIG.basePath = config.apiBaseUrl;
|
|
82
|
+
AXIOS_CONFIG.apiKey = config.storeId;
|
|
83
|
+
AXIOS_CONFIG.accessToken = () => getAuthToken() || "";
|
|
84
|
+
apiConfiguration = AXIOS_CONFIG;
|
|
73
85
|
return apiConfiguration;
|
|
74
86
|
}
|
|
75
87
|
function getApiConfiguration() {
|
|
@@ -94,6 +106,7 @@ function setAuthToken(token) {
|
|
|
94
106
|
if (apiConfiguration) {
|
|
95
107
|
apiConfiguration.accessToken = () => token;
|
|
96
108
|
}
|
|
109
|
+
AXIOS_CONFIG.accessToken = () => token;
|
|
97
110
|
}
|
|
98
111
|
}
|
|
99
112
|
function getAuthToken() {
|
|
@@ -108,12 +121,13 @@ function clearAuthToken() {
|
|
|
108
121
|
if (apiConfiguration) {
|
|
109
122
|
apiConfiguration.accessToken = () => "";
|
|
110
123
|
}
|
|
124
|
+
AXIOS_CONFIG.accessToken = () => "";
|
|
111
125
|
}
|
|
112
126
|
}
|
|
113
127
|
var apiConfiguration, currentConfig;
|
|
114
128
|
var init_config = __esm({
|
|
115
129
|
"src/lib/api-adapter/config.ts"() {
|
|
116
|
-
|
|
130
|
+
init_sharedConfig();
|
|
117
131
|
apiConfiguration = null;
|
|
118
132
|
currentConfig = null;
|
|
119
133
|
}
|
|
@@ -5304,6 +5318,45 @@ var ProductsApiAxiosParamCreator = function(configuration) {
|
|
|
5304
5318
|
options: localVarRequestOptions
|
|
5305
5319
|
};
|
|
5306
5320
|
},
|
|
5321
|
+
/**
|
|
5322
|
+
*
|
|
5323
|
+
* @summary Get the featured product for home screen
|
|
5324
|
+
* @param {*} [options] Override http request option.
|
|
5325
|
+
* @throws {RequiredError}
|
|
5326
|
+
*/
|
|
5327
|
+
getFeaturedProduct: async (options = {}) => {
|
|
5328
|
+
const localVarPath = `/products/featured`;
|
|
5329
|
+
const localVarUrlObj = new URL(localVarPath, "https://example.com");
|
|
5330
|
+
let baseOptions;
|
|
5331
|
+
if (configuration) {
|
|
5332
|
+
baseOptions = configuration.baseOptions;
|
|
5333
|
+
}
|
|
5334
|
+
const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
|
|
5335
|
+
const localVarHeaderParameter = {};
|
|
5336
|
+
const localVarQueryParameter = {};
|
|
5337
|
+
if (configuration && configuration.accessToken) {
|
|
5338
|
+
const accessToken = typeof configuration.accessToken === "function" ? await configuration.accessToken() : await configuration.accessToken;
|
|
5339
|
+
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
|
|
5340
|
+
}
|
|
5341
|
+
if (configuration && configuration.apiKey) {
|
|
5342
|
+
const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
|
|
5343
|
+
localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
|
|
5344
|
+
}
|
|
5345
|
+
const query = new URLSearchParams(localVarUrlObj.search);
|
|
5346
|
+
for (const key in localVarQueryParameter) {
|
|
5347
|
+
query.set(key, localVarQueryParameter[key]);
|
|
5348
|
+
}
|
|
5349
|
+
for (const key in options.params) {
|
|
5350
|
+
query.set(key, options.params[key]);
|
|
5351
|
+
}
|
|
5352
|
+
localVarUrlObj.search = new URLSearchParams(query).toString();
|
|
5353
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
5354
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
5355
|
+
return {
|
|
5356
|
+
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
|
5357
|
+
options: localVarRequestOptions
|
|
5358
|
+
};
|
|
5359
|
+
},
|
|
5307
5360
|
/**
|
|
5308
5361
|
*
|
|
5309
5362
|
* @summary Get insights on store Products
|
|
@@ -5484,6 +5537,56 @@ var ProductsApiAxiosParamCreator = function(configuration) {
|
|
|
5484
5537
|
options: localVarRequestOptions
|
|
5485
5538
|
};
|
|
5486
5539
|
},
|
|
5540
|
+
/**
|
|
5541
|
+
*
|
|
5542
|
+
* @summary Set or unset a product as featured for home screen
|
|
5543
|
+
* @param {string} id Product ID
|
|
5544
|
+
* @param {boolean} featured Whether to set the product as featured
|
|
5545
|
+
* @param {*} [options] Override http request option.
|
|
5546
|
+
* @throws {RequiredError}
|
|
5547
|
+
*/
|
|
5548
|
+
setFeaturedProduct: async (id, featured, options = {}) => {
|
|
5549
|
+
if (id === null || id === void 0) {
|
|
5550
|
+
throw new RequiredError("id", "Required parameter id was null or undefined when calling setFeaturedProduct.");
|
|
5551
|
+
}
|
|
5552
|
+
if (featured === null || featured === void 0) {
|
|
5553
|
+
throw new RequiredError("featured", "Required parameter featured was null or undefined when calling setFeaturedProduct.");
|
|
5554
|
+
}
|
|
5555
|
+
const localVarPath = `/products/{id}/featured`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
|
5556
|
+
const localVarUrlObj = new URL(localVarPath, "https://example.com");
|
|
5557
|
+
let baseOptions;
|
|
5558
|
+
if (configuration) {
|
|
5559
|
+
baseOptions = configuration.baseOptions;
|
|
5560
|
+
}
|
|
5561
|
+
const localVarRequestOptions = { method: "PATCH", ...baseOptions, ...options };
|
|
5562
|
+
const localVarHeaderParameter = {};
|
|
5563
|
+
const localVarQueryParameter = {};
|
|
5564
|
+
if (configuration && configuration.accessToken) {
|
|
5565
|
+
const accessToken = typeof configuration.accessToken === "function" ? await configuration.accessToken() : await configuration.accessToken;
|
|
5566
|
+
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
|
|
5567
|
+
}
|
|
5568
|
+
if (configuration && configuration.apiKey) {
|
|
5569
|
+
const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
|
|
5570
|
+
localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
|
|
5571
|
+
}
|
|
5572
|
+
if (featured !== void 0) {
|
|
5573
|
+
localVarQueryParameter["featured"] = featured;
|
|
5574
|
+
}
|
|
5575
|
+
const query = new URLSearchParams(localVarUrlObj.search);
|
|
5576
|
+
for (const key in localVarQueryParameter) {
|
|
5577
|
+
query.set(key, localVarQueryParameter[key]);
|
|
5578
|
+
}
|
|
5579
|
+
for (const key in options.params) {
|
|
5580
|
+
query.set(key, options.params[key]);
|
|
5581
|
+
}
|
|
5582
|
+
localVarUrlObj.search = new URLSearchParams(query).toString();
|
|
5583
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
5584
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
5585
|
+
return {
|
|
5586
|
+
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
|
5587
|
+
options: localVarRequestOptions
|
|
5588
|
+
};
|
|
5589
|
+
},
|
|
5487
5590
|
/**
|
|
5488
5591
|
*
|
|
5489
5592
|
* @summary Update a product
|
|
@@ -5667,6 +5770,19 @@ var ProductsApiFp = function(configuration) {
|
|
|
5667
5770
|
return axios.request(axiosRequestArgs);
|
|
5668
5771
|
};
|
|
5669
5772
|
},
|
|
5773
|
+
/**
|
|
5774
|
+
*
|
|
5775
|
+
* @summary Get the featured product for home screen
|
|
5776
|
+
* @param {*} [options] Override http request option.
|
|
5777
|
+
* @throws {RequiredError}
|
|
5778
|
+
*/
|
|
5779
|
+
async getFeaturedProduct(options) {
|
|
5780
|
+
const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getFeaturedProduct(options);
|
|
5781
|
+
return (axios = globalAxios4, basePath = BASE_PATH) => {
|
|
5782
|
+
const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
|
|
5783
|
+
return axios.request(axiosRequestArgs);
|
|
5784
|
+
};
|
|
5785
|
+
},
|
|
5670
5786
|
/**
|
|
5671
5787
|
*
|
|
5672
5788
|
* @summary Get insights on store Products
|
|
@@ -5725,6 +5841,21 @@ var ProductsApiFp = function(configuration) {
|
|
|
5725
5841
|
return axios.request(axiosRequestArgs);
|
|
5726
5842
|
};
|
|
5727
5843
|
},
|
|
5844
|
+
/**
|
|
5845
|
+
*
|
|
5846
|
+
* @summary Set or unset a product as featured for home screen
|
|
5847
|
+
* @param {string} id Product ID
|
|
5848
|
+
* @param {boolean} featured Whether to set the product as featured
|
|
5849
|
+
* @param {*} [options] Override http request option.
|
|
5850
|
+
* @throws {RequiredError}
|
|
5851
|
+
*/
|
|
5852
|
+
async setFeaturedProduct(id, featured, options) {
|
|
5853
|
+
const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).setFeaturedProduct(id, featured, options);
|
|
5854
|
+
return (axios = globalAxios4, basePath = BASE_PATH) => {
|
|
5855
|
+
const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
|
|
5856
|
+
return axios.request(axiosRequestArgs);
|
|
5857
|
+
};
|
|
5858
|
+
},
|
|
5728
5859
|
/**
|
|
5729
5860
|
*
|
|
5730
5861
|
* @summary Update a product
|
|
@@ -5851,6 +5982,16 @@ var ProductsApi = class extends BaseAPI {
|
|
|
5851
5982
|
async getAllProductsForStore(searchTerm, productType, categoryId, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options) {
|
|
5852
5983
|
return ProductsApiFp(this.configuration).getAllProductsForStore(searchTerm, productType, categoryId, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options).then((request) => request(this.axios, this.basePath));
|
|
5853
5984
|
}
|
|
5985
|
+
/**
|
|
5986
|
+
*
|
|
5987
|
+
* @summary Get the featured product for home screen
|
|
5988
|
+
* @param {*} [options] Override http request option.
|
|
5989
|
+
* @throws {RequiredError}
|
|
5990
|
+
* @memberof ProductsApi
|
|
5991
|
+
*/
|
|
5992
|
+
async getFeaturedProduct(options) {
|
|
5993
|
+
return ProductsApiFp(this.configuration).getFeaturedProduct(options).then((request) => request(this.axios, this.basePath));
|
|
5994
|
+
}
|
|
5854
5995
|
/**
|
|
5855
5996
|
*
|
|
5856
5997
|
* @summary Get insights on store Products
|
|
@@ -5897,6 +6038,18 @@ var ProductsApi = class extends BaseAPI {
|
|
|
5897
6038
|
async getTopSellingProducts(limit, page, isActive, includeNoVariantProducts, options) {
|
|
5898
6039
|
return ProductsApiFp(this.configuration).getTopSellingProducts(limit, page, isActive, includeNoVariantProducts, options).then((request) => request(this.axios, this.basePath));
|
|
5899
6040
|
}
|
|
6041
|
+
/**
|
|
6042
|
+
*
|
|
6043
|
+
* @summary Set or unset a product as featured for home screen
|
|
6044
|
+
* @param {string} id Product ID
|
|
6045
|
+
* @param {boolean} featured Whether to set the product as featured
|
|
6046
|
+
* @param {*} [options] Override http request option.
|
|
6047
|
+
* @throws {RequiredError}
|
|
6048
|
+
* @memberof ProductsApi
|
|
6049
|
+
*/
|
|
6050
|
+
async setFeaturedProduct(id, featured, options) {
|
|
6051
|
+
return ProductsApiFp(this.configuration).setFeaturedProduct(id, featured, options).then((request) => request(this.axios, this.basePath));
|
|
6052
|
+
}
|
|
5900
6053
|
/**
|
|
5901
6054
|
*
|
|
5902
6055
|
* @summary Update a product
|
|
@@ -6914,6 +7067,10 @@ function CartProvider({ children }) {
|
|
|
6914
7067
|
const [isLoading, setIsLoading] = useState(false);
|
|
6915
7068
|
const { isAuthenticated } = useAuth();
|
|
6916
7069
|
const notification = useNotification();
|
|
7070
|
+
const cartRef = useRef(cart);
|
|
7071
|
+
useEffect(() => {
|
|
7072
|
+
cartRef.current = cart;
|
|
7073
|
+
}, [cart]);
|
|
6917
7074
|
const refreshCart = useCallback(async () => {
|
|
6918
7075
|
if (!isAuthenticated) {
|
|
6919
7076
|
setCart(null);
|
|
@@ -6921,7 +7078,9 @@ function CartProvider({ children }) {
|
|
|
6921
7078
|
}
|
|
6922
7079
|
try {
|
|
6923
7080
|
const response = await new CartApi(getApiConfiguration()).getUserCart();
|
|
6924
|
-
|
|
7081
|
+
if (response.data) {
|
|
7082
|
+
setCart(response.data);
|
|
7083
|
+
}
|
|
6925
7084
|
} catch (error) {
|
|
6926
7085
|
console.error("Failed to fetch cart:", error);
|
|
6927
7086
|
}
|
|
@@ -6929,99 +7088,159 @@ function CartProvider({ children }) {
|
|
|
6929
7088
|
useEffect(() => {
|
|
6930
7089
|
refreshCart();
|
|
6931
7090
|
}, [refreshCart]);
|
|
6932
|
-
const addToCart = async (productId, quantity = 1, variantId) => {
|
|
7091
|
+
const addToCart = useCallback(async (productId, quantity = 1, variantId) => {
|
|
7092
|
+
if (!isAuthenticated) return;
|
|
6933
7093
|
setIsLoading(true);
|
|
6934
7094
|
try {
|
|
6935
|
-
const
|
|
7095
|
+
const currentCart = cartRef.current;
|
|
7096
|
+
const currentItems = currentCart?.cartBody?.items || [];
|
|
6936
7097
|
const targetVariantId = variantId || productId;
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
7098
|
+
let itemsFound = false;
|
|
7099
|
+
const simplifiedItems = currentItems.map((item) => {
|
|
7100
|
+
let q = Number(item.quantity) || 0;
|
|
7101
|
+
if (String(item.productVariantId) === String(targetVariantId)) {
|
|
7102
|
+
itemsFound = true;
|
|
7103
|
+
q += Number(quantity);
|
|
7104
|
+
}
|
|
7105
|
+
return {
|
|
7106
|
+
_id: item._id,
|
|
7107
|
+
productVariantId: item.productVariantId,
|
|
7108
|
+
quantity: q
|
|
6945
7109
|
};
|
|
6946
|
-
}
|
|
6947
|
-
|
|
7110
|
+
});
|
|
7111
|
+
if (!itemsFound) {
|
|
7112
|
+
simplifiedItems.push({
|
|
6948
7113
|
productVariantId: targetVariantId,
|
|
6949
|
-
quantity
|
|
7114
|
+
quantity: Number(quantity)
|
|
6950
7115
|
});
|
|
6951
7116
|
}
|
|
6952
|
-
const
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
)
|
|
7117
|
+
const payload = {
|
|
7118
|
+
_id: currentCart?.cartBody?._id,
|
|
7119
|
+
items: simplifiedItems
|
|
7120
|
+
};
|
|
7121
|
+
const response = await new CartApi(getApiConfiguration()).handleUserCart(payload);
|
|
7122
|
+
if (response.data) {
|
|
7123
|
+
setCart(response.data);
|
|
7124
|
+
notification.success("Added to cart", "The item was added to your cart.");
|
|
7125
|
+
}
|
|
6958
7126
|
} catch (error) {
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
error.response?.data?.message || "Something went wrong while adding this item to your cart."
|
|
6962
|
-
);
|
|
6963
|
-
throw error;
|
|
7127
|
+
console.error("Add to cart error:", error);
|
|
7128
|
+
notification.error("Could not add to cart", error.response?.data?.message || "Something went wrong.");
|
|
6964
7129
|
} finally {
|
|
6965
7130
|
setIsLoading(false);
|
|
6966
7131
|
}
|
|
6967
|
-
};
|
|
6968
|
-
const updateQuantity = async (productId, quantity) => {
|
|
7132
|
+
}, [isAuthenticated, notification]);
|
|
7133
|
+
const updateQuantity = useCallback(async (productId, quantity) => {
|
|
7134
|
+
const currentCart = cartRef.current;
|
|
7135
|
+
if (!currentCart) return;
|
|
6969
7136
|
setIsLoading(true);
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
};
|
|
7137
|
+
const targetQ = Number(quantity);
|
|
7138
|
+
const oldCart = currentCart;
|
|
7139
|
+
setCart((prev) => {
|
|
7140
|
+
if (!prev) return null;
|
|
7141
|
+
const newItems = prev.cartBody.items.map((item) => {
|
|
7142
|
+
if (String(item.productVariantId) === String(productId)) {
|
|
7143
|
+
return { ...item, quantity: targetQ };
|
|
6978
7144
|
}
|
|
6979
7145
|
return item;
|
|
6980
7146
|
});
|
|
6981
|
-
const
|
|
6982
|
-
|
|
7147
|
+
const newSubtotal = newItems.reduce((acc, item) => acc + (item.productVariantData.finalPrice || 0) * item.quantity, 0);
|
|
7148
|
+
return {
|
|
7149
|
+
...prev,
|
|
7150
|
+
subTotal: newSubtotal,
|
|
7151
|
+
total: newSubtotal + (prev.shipping || 0) + (prev.tax || 0),
|
|
7152
|
+
cartBody: { ...prev.cartBody, items: newItems }
|
|
7153
|
+
};
|
|
7154
|
+
});
|
|
7155
|
+
try {
|
|
7156
|
+
const simplifiedItems = oldCart.cartBody.items.map((item) => ({
|
|
7157
|
+
_id: item._id,
|
|
7158
|
+
productVariantId: item.productVariantId,
|
|
7159
|
+
quantity: String(item.productVariantId) === String(productId) ? targetQ : item.quantity
|
|
7160
|
+
}));
|
|
7161
|
+
const payload = {
|
|
7162
|
+
_id: oldCart.cartBody._id,
|
|
7163
|
+
items: simplifiedItems
|
|
7164
|
+
};
|
|
7165
|
+
console.log("payload", payload);
|
|
7166
|
+
const response = await new CartApi(getApiConfiguration()).handleUserCart(payload);
|
|
7167
|
+
if (response.data) {
|
|
7168
|
+
setCart(response.data);
|
|
7169
|
+
} else {
|
|
7170
|
+
await refreshCart();
|
|
7171
|
+
}
|
|
6983
7172
|
} catch (error) {
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
);
|
|
6988
|
-
throw error;
|
|
7173
|
+
console.error("Update quantity error:", error);
|
|
7174
|
+
setCart(oldCart);
|
|
7175
|
+
notification.error("Could not update cart", error.response?.data?.message || "Failed to update quantity.");
|
|
6989
7176
|
} finally {
|
|
6990
7177
|
setIsLoading(false);
|
|
6991
7178
|
}
|
|
6992
|
-
};
|
|
6993
|
-
const removeFromCart = async (productId) => {
|
|
7179
|
+
}, [notification, refreshCart]);
|
|
7180
|
+
const removeFromCart = useCallback(async (productId) => {
|
|
7181
|
+
const currentCart = cartRef.current;
|
|
7182
|
+
if (!currentCart) return;
|
|
6994
7183
|
setIsLoading(true);
|
|
7184
|
+
const oldCart = currentCart;
|
|
7185
|
+
setCart((prev) => {
|
|
7186
|
+
if (!prev) return null;
|
|
7187
|
+
const newItems = prev.cartBody.items.filter((item) => String(item.productVariantId) !== String(productId));
|
|
7188
|
+
const newSubtotal = newItems.reduce((acc, item) => acc + (item.productVariantData.finalPrice || 0) * item.quantity, 0);
|
|
7189
|
+
return {
|
|
7190
|
+
...prev,
|
|
7191
|
+
subTotal: newSubtotal,
|
|
7192
|
+
total: newSubtotal + (prev.shipping || 0) + (prev.tax || 0),
|
|
7193
|
+
cartBody: { ...prev.cartBody, items: newItems }
|
|
7194
|
+
};
|
|
7195
|
+
});
|
|
6995
7196
|
try {
|
|
6996
|
-
|
|
6997
|
-
const
|
|
6998
|
-
|
|
6999
|
-
|
|
7197
|
+
console.log("Removing item with productVariantId:", productId);
|
|
7198
|
+
const itemsToKeep = currentCart.cartBody.items.filter((item) => String(item.productVariantId) !== String(productId));
|
|
7199
|
+
console.log("Items to keep count:", itemsToKeep.length);
|
|
7200
|
+
const simplifiedItems = itemsToKeep.map((item) => ({
|
|
7201
|
+
_id: item._id,
|
|
7202
|
+
productVariantId: item.productVariantId,
|
|
7203
|
+
quantity: item.quantity
|
|
7204
|
+
}));
|
|
7205
|
+
if (simplifiedItems.length === 0) {
|
|
7206
|
+
console.log("Cart will be empty, calling clearCart");
|
|
7207
|
+
await new CartApi(getApiConfiguration()).clearCart();
|
|
7208
|
+
setCart(null);
|
|
7209
|
+
} else {
|
|
7210
|
+
const payload = {
|
|
7211
|
+
_id: currentCart.cartBody._id,
|
|
7212
|
+
items: simplifiedItems
|
|
7213
|
+
};
|
|
7214
|
+
console.log("Remove from cart payload:", JSON.stringify(payload, null, 2));
|
|
7215
|
+
const response = await new CartApi(getApiConfiguration()).handleUserCart(payload);
|
|
7216
|
+
console.log("Remove from cart response:", response.status, response.data);
|
|
7217
|
+
if (response.data) {
|
|
7218
|
+
setCart(response.data);
|
|
7219
|
+
}
|
|
7220
|
+
}
|
|
7000
7221
|
} catch (error) {
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
error
|
|
7004
|
-
|
|
7005
|
-
|
|
7222
|
+
console.error("Remove from cart error:", error);
|
|
7223
|
+
if (error.response) {
|
|
7224
|
+
console.error("Error response data:", error.response.data);
|
|
7225
|
+
}
|
|
7226
|
+
setCart(oldCart);
|
|
7227
|
+
notification.error("Could not remove item", error.response?.data?.message || "Failed to remove item.");
|
|
7006
7228
|
} finally {
|
|
7007
7229
|
setIsLoading(false);
|
|
7008
7230
|
}
|
|
7009
|
-
};
|
|
7010
|
-
const clearCart = async () => {
|
|
7231
|
+
}, [notification]);
|
|
7232
|
+
const clearCart = useCallback(async () => {
|
|
7011
7233
|
setIsLoading(true);
|
|
7012
7234
|
try {
|
|
7013
|
-
|
|
7235
|
+
await new CartApi(getApiConfiguration()).clearCart();
|
|
7014
7236
|
setCart(null);
|
|
7015
7237
|
} catch (error) {
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
error.response?.data?.message || "We could not clear your cart. Please try again."
|
|
7019
|
-
);
|
|
7020
|
-
throw error;
|
|
7238
|
+
console.error("Clear cart error:", error);
|
|
7239
|
+
notification.error("Could not clear cart", error.response?.data?.message || "Failed to clear cart.");
|
|
7021
7240
|
} finally {
|
|
7022
7241
|
setIsLoading(false);
|
|
7023
7242
|
}
|
|
7024
|
-
};
|
|
7243
|
+
}, [notification]);
|
|
7025
7244
|
const value = {
|
|
7026
7245
|
cart,
|
|
7027
7246
|
isLoading,
|
|
@@ -7035,10 +7254,10 @@ function CartProvider({ children }) {
|
|
|
7035
7254
|
}
|
|
7036
7255
|
|
|
7037
7256
|
// src/lib/Apis/wrapper.ts
|
|
7038
|
-
init_configuration();
|
|
7039
7257
|
init_config();
|
|
7040
7258
|
init_config();
|
|
7041
|
-
|
|
7259
|
+
init_sharedConfig();
|
|
7260
|
+
init_sharedConfig();
|
|
7042
7261
|
globalAxios4.interceptors.request.use(async (config) => {
|
|
7043
7262
|
if (!config?.headers) {
|
|
7044
7263
|
throw new Error(
|
|
@@ -7056,22 +7275,16 @@ globalAxios4.interceptors.request.use(async (config) => {
|
|
|
7056
7275
|
config.headers["X-Store-Key"] = ecommerceConfig.storeId;
|
|
7057
7276
|
}
|
|
7058
7277
|
} catch (error) {
|
|
7059
|
-
console.warn("API configuration not initialized yet:", error);
|
|
7060
7278
|
}
|
|
7061
7279
|
}
|
|
7062
7280
|
return config;
|
|
7063
7281
|
});
|
|
7064
|
-
var abortController;
|
|
7065
7282
|
if (typeof window !== "undefined") {
|
|
7066
|
-
abortController = new AbortController();
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
basePath: BaseUrl,
|
|
7070
|
-
baseOptions: {
|
|
7071
|
-
signal: abortController?.signal,
|
|
7072
|
-
timeout: 2e4
|
|
7283
|
+
const abortController = new AbortController();
|
|
7284
|
+
if (AXIOS_CONFIG.baseOptions) {
|
|
7285
|
+
AXIOS_CONFIG.baseOptions.signal = abortController.signal;
|
|
7073
7286
|
}
|
|
7074
|
-
}
|
|
7287
|
+
}
|
|
7075
7288
|
var WishlistContext = createContext(void 0);
|
|
7076
7289
|
function WishlistProvider({ children }) {
|
|
7077
7290
|
const [state, setState] = useState({
|
|
@@ -8967,6 +9180,7 @@ function ProductDetailScreen({ productId }) {
|
|
|
8967
9180
|
const { buildPath } = useBasePath();
|
|
8968
9181
|
const { product: productData, isLoading } = useProduct(productId);
|
|
8969
9182
|
const { addToCart } = useCart();
|
|
9183
|
+
const { isAuthenticated } = useAuth();
|
|
8970
9184
|
const notification = useNotification();
|
|
8971
9185
|
const [selectedVariant, setSelectedVariant] = useState(null);
|
|
8972
9186
|
const [quantity, setQuantity] = useState(1);
|
|
@@ -9085,6 +9299,14 @@ function ProductDetailScreen({ productId }) {
|
|
|
9085
9299
|
setActiveImageIndex(0);
|
|
9086
9300
|
};
|
|
9087
9301
|
const handleAddToCart = async () => {
|
|
9302
|
+
if (!isAuthenticated) {
|
|
9303
|
+
notification.error(
|
|
9304
|
+
"Sign-in required",
|
|
9305
|
+
"Please sign in to add items to your cart."
|
|
9306
|
+
);
|
|
9307
|
+
router.push(buildPath(`/login?redirect=${encodeURIComponent(window.location.pathname + window.location.search)}`));
|
|
9308
|
+
return;
|
|
9309
|
+
}
|
|
9088
9310
|
if (!product || !selectedVariant) return;
|
|
9089
9311
|
setIsAddingToCart(true);
|
|
9090
9312
|
try {
|
|
@@ -9357,7 +9579,7 @@ function ProductDetailScreen({ productId }) {
|
|
|
9357
9579
|
)
|
|
9358
9580
|
] }),
|
|
9359
9581
|
selectedVariant && /* @__PURE__ */ jsxs("span", { className: "text-sm text-slate-500", children: [
|
|
9360
|
-
selectedVariant.inventoryCount ||
|
|
9582
|
+
selectedVariant.inventoryCount || 0,
|
|
9361
9583
|
" available"
|
|
9362
9584
|
] })
|
|
9363
9585
|
] })
|
|
@@ -9479,6 +9701,7 @@ function ProductDetailScreen({ productId }) {
|
|
|
9479
9701
|
function CartItem({ item }) {
|
|
9480
9702
|
const { updateQuantity, removeFromCart } = useCart();
|
|
9481
9703
|
const [isUpdating, setIsUpdating] = useState(false);
|
|
9704
|
+
const [isRemoving, setIsRemoving] = useState(false);
|
|
9482
9705
|
const handleUpdateQuantity = async (newQuantity) => {
|
|
9483
9706
|
if (newQuantity < 1) return;
|
|
9484
9707
|
setIsUpdating(true);
|
|
@@ -9489,7 +9712,12 @@ function CartItem({ item }) {
|
|
|
9489
9712
|
}
|
|
9490
9713
|
};
|
|
9491
9714
|
const handleRemove = async () => {
|
|
9492
|
-
|
|
9715
|
+
setIsRemoving(true);
|
|
9716
|
+
try {
|
|
9717
|
+
await removeFromCart(item.productVariantId);
|
|
9718
|
+
} finally {
|
|
9719
|
+
setIsRemoving(false);
|
|
9720
|
+
}
|
|
9493
9721
|
};
|
|
9494
9722
|
const itemTotal = item.productVariantData.finalPrice * item.quantity;
|
|
9495
9723
|
const unitPrice = item.productVariantData.finalPrice;
|
|
@@ -9534,9 +9762,10 @@ function CartItem({ item }) {
|
|
|
9534
9762
|
"button",
|
|
9535
9763
|
{
|
|
9536
9764
|
onClick: handleRemove,
|
|
9537
|
-
|
|
9765
|
+
disabled: isRemoving || isUpdating,
|
|
9766
|
+
className: `p-2 rounded-full transition-colors group ${isRemoving ? "bg-red-50 cursor-not-allowed" : "hover:bg-red-50"}`,
|
|
9538
9767
|
"aria-label": "Remove item",
|
|
9539
|
-
children: /* @__PURE__ */ jsx(Trash2, { className: "size-5 text-[#676c80] group-hover:text-red-500 transition-colors" })
|
|
9768
|
+
children: isRemoving ? /* @__PURE__ */ jsx("span", { className: "inline-block h-5 w-5 animate-spin rounded-full border-2 border-red-500 border-t-transparent" }) : /* @__PURE__ */ jsx(Trash2, { className: "size-5 text-[#676c80] group-hover:text-red-500 transition-colors" })
|
|
9540
9769
|
}
|
|
9541
9770
|
)
|
|
9542
9771
|
] }),
|
|
@@ -9701,7 +9930,7 @@ function CartScreen() {
|
|
|
9701
9930
|
{
|
|
9702
9931
|
type: "submit",
|
|
9703
9932
|
onClick: handleSubmit,
|
|
9704
|
-
className: "w-full rounded-full border-2 border-
|
|
9933
|
+
className: "w-full rounded-full border-2 border-[#E67E50] bg-[#E67E50] hover:bg-[#E67E50]/80 text-white px-4 py-3 text-sm font-medium transition-colors flex items-center justify-center gap-2",
|
|
9705
9934
|
children: [
|
|
9706
9935
|
"Proceed to Checkout",
|
|
9707
9936
|
/* @__PURE__ */ jsx(ArrowRight, { className: "h-5 w-5" })
|
|
@@ -10352,7 +10581,13 @@ function CheckoutScreen() {
|
|
|
10352
10581
|
router.push(buildPath(`/orders/${response.data?.id}`));
|
|
10353
10582
|
}
|
|
10354
10583
|
} catch (err) {
|
|
10355
|
-
|
|
10584
|
+
console.error("Checkout error:", err);
|
|
10585
|
+
let msg = err?.response?.data?.message || err?.message || "Failed to place order";
|
|
10586
|
+
if (msg.toLowerCase().includes("insufficient balance")) {
|
|
10587
|
+
msg = "Insufficient balance in your account to complete this order.";
|
|
10588
|
+
} else if (msg.toLowerCase().includes("browser was not found")) {
|
|
10589
|
+
msg = "A temporary server error occurred while processing your invoice. Please contact support.";
|
|
10590
|
+
}
|
|
10356
10591
|
setError(msg);
|
|
10357
10592
|
notification.error(
|
|
10358
10593
|
"Could not place order",
|
|
@@ -10370,444 +10605,444 @@ function CheckoutScreen() {
|
|
|
10370
10605
|
const tax = 0;
|
|
10371
10606
|
const total = subtotal + shippingPrice + tax;
|
|
10372
10607
|
return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-white pb-16", children: [
|
|
10373
|
-
/* @__PURE__ */
|
|
10374
|
-
|
|
10375
|
-
|
|
10376
|
-
|
|
10377
|
-
|
|
10378
|
-
{
|
|
10379
|
-
|
|
10380
|
-
|
|
10381
|
-
className: "
|
|
10382
|
-
|
|
10383
|
-
/* @__PURE__ */
|
|
10384
|
-
|
|
10385
|
-
|
|
10608
|
+
/* @__PURE__ */ jsx("form", { onSubmit: handleSubmit(onSubmit), children: /* @__PURE__ */ jsxs("div", { className: "pt-12 container mx-auto grid gap-10 px-4 lg:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]", children: [
|
|
10609
|
+
/* @__PURE__ */ jsxs(
|
|
10610
|
+
motion.div,
|
|
10611
|
+
{
|
|
10612
|
+
initial: { opacity: 0, y: 24 },
|
|
10613
|
+
animate: { opacity: 1, y: 0 },
|
|
10614
|
+
className: "space-y-8",
|
|
10615
|
+
children: [
|
|
10616
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-12", children: [
|
|
10617
|
+
/* @__PURE__ */ jsx("h1", { className: "font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] mb-2 text-3xl", children: "Checkout" }),
|
|
10618
|
+
/* @__PURE__ */ jsx("p", { className: "font-['Poppins',sans-serif] text-[14px] text-[#676c80] text-md leading-relaxed", children: "Complete your order information below" })
|
|
10619
|
+
] }),
|
|
10620
|
+
/* @__PURE__ */ jsxs("section", { className: "bg-white border-2 border-gray-100 rounded-[24px] p-8 text-[#2B4B7C]", children: [
|
|
10621
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-4", children: [
|
|
10622
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
10623
|
+
/* @__PURE__ */ jsx("h2", { className: "font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] mb-2 text-2xl", children: "Contact Information" }),
|
|
10624
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-slate-500", children: "We use temperature-aware packaging and real-time tracking on every shipment." })
|
|
10625
|
+
] }),
|
|
10626
|
+
/* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-2 rounded-full bg-primary-50 px-3 py-1 text-xs font-semibold uppercase tracking-wide text-primary-700", children: [
|
|
10627
|
+
/* @__PURE__ */ jsx(Truck, { className: "h-4 w-4" }),
|
|
10628
|
+
"Dispatch in 12h"
|
|
10629
|
+
] })
|
|
10386
10630
|
] }),
|
|
10387
|
-
/* @__PURE__ */ jsxs("
|
|
10388
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
10389
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
10390
|
-
/* @__PURE__ */ jsx("
|
|
10391
|
-
/* @__PURE__ */
|
|
10631
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-6 grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
10632
|
+
isDelivery && /* @__PURE__ */ jsxs("div", { className: "md:col-span-2 space-y-4", children: [
|
|
10633
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
10634
|
+
/* @__PURE__ */ jsx("label", { className: "block font-semibold", children: "Select Address" }),
|
|
10635
|
+
/* @__PURE__ */ jsxs(
|
|
10636
|
+
Button,
|
|
10637
|
+
{
|
|
10638
|
+
type: "button",
|
|
10639
|
+
variant: "outline-solid",
|
|
10640
|
+
size: "sm",
|
|
10641
|
+
onClick: () => {
|
|
10642
|
+
setEditingAddress(null);
|
|
10643
|
+
setIsAddressModalOpen(true);
|
|
10644
|
+
},
|
|
10645
|
+
children: [
|
|
10646
|
+
/* @__PURE__ */ jsx(Plus, { className: "h-4 w-4 mr-2" }),
|
|
10647
|
+
"Add New Address"
|
|
10648
|
+
]
|
|
10649
|
+
}
|
|
10650
|
+
)
|
|
10392
10651
|
] }),
|
|
10393
|
-
/* @__PURE__ */
|
|
10394
|
-
|
|
10395
|
-
|
|
10652
|
+
userAddresses.length > 0 ? /* @__PURE__ */ jsx("div", { className: "grid gap-4", children: userAddresses.map((addr) => /* @__PURE__ */ jsxs(
|
|
10653
|
+
"label",
|
|
10654
|
+
{
|
|
10655
|
+
className: `group relative flex items-start gap-3 p-4 rounded-2xl border ${selectedAddressId === addr.id ? "border-primary-500 bg-primary-50 shadow-xs" : "border-slate-200 bg-white"} cursor-pointer hover:border-primary-300 transition-colors`,
|
|
10656
|
+
children: [
|
|
10657
|
+
/* @__PURE__ */ jsx(
|
|
10658
|
+
"input",
|
|
10659
|
+
{
|
|
10660
|
+
type: "radio",
|
|
10661
|
+
name: "selectedAddress",
|
|
10662
|
+
value: addr.id,
|
|
10663
|
+
checked: selectedAddressId === addr.id,
|
|
10664
|
+
onChange: () => {
|
|
10665
|
+
setSelectedAddressId(addr.id);
|
|
10666
|
+
setValue("shipping.name", addr.name);
|
|
10667
|
+
setValue("shipping.phone", addr.phone || void 0);
|
|
10668
|
+
setValue("shipping.street1", addr.street1);
|
|
10669
|
+
setValue("shipping.street2", addr.street2 || "");
|
|
10670
|
+
setValue("shipping.city", addr.city);
|
|
10671
|
+
setValue("shipping.state", addr.state);
|
|
10672
|
+
setValue("shipping.zip", addr.zip);
|
|
10673
|
+
setValue("shipping.country", addr.country);
|
|
10674
|
+
},
|
|
10675
|
+
className: "mt-1"
|
|
10676
|
+
}
|
|
10677
|
+
),
|
|
10678
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
10679
|
+
/* @__PURE__ */ jsx("p", { className: "font-semibold text-slate-900", children: addr.name }),
|
|
10680
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-slate-600", children: addr.street1 }),
|
|
10681
|
+
addr.street2 && /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-600", children: addr.street2 }),
|
|
10682
|
+
/* @__PURE__ */ jsxs("p", { className: "text-sm text-slate-600", children: [
|
|
10683
|
+
addr.city,
|
|
10684
|
+
", ",
|
|
10685
|
+
addr.state,
|
|
10686
|
+
" ",
|
|
10687
|
+
addr.zip
|
|
10688
|
+
] }),
|
|
10689
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-slate-600", children: addr.country }),
|
|
10690
|
+
addr.phone && /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-600 mt-1", children: addr.phone }),
|
|
10691
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-3 flex items-center gap-2", children: [
|
|
10692
|
+
addr.isDefault && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-1 rounded-full bg-primary-100 px-2.5 py-0.5 text-xs font-semibold text-primary-700", children: "Default" }),
|
|
10693
|
+
/* @__PURE__ */ jsxs(
|
|
10694
|
+
"button",
|
|
10695
|
+
{
|
|
10696
|
+
type: "button",
|
|
10697
|
+
onClick: (e) => {
|
|
10698
|
+
e.preventDefault();
|
|
10699
|
+
setEditingAddress(addr);
|
|
10700
|
+
setIsAddressModalOpen(true);
|
|
10701
|
+
},
|
|
10702
|
+
className: "inline-flex items-center gap-1 rounded-full border border-slate-200 px-2.5 py-0.5 text-xs font-medium text-slate-600 hover:border-primary-300 hover:text-primary-600",
|
|
10703
|
+
children: [
|
|
10704
|
+
/* @__PURE__ */ jsx(Edit3, { className: "h-3.5 w-3.5" }),
|
|
10705
|
+
" Edit"
|
|
10706
|
+
]
|
|
10707
|
+
}
|
|
10708
|
+
),
|
|
10709
|
+
/* @__PURE__ */ jsxs(
|
|
10710
|
+
"button",
|
|
10711
|
+
{
|
|
10712
|
+
type: "button",
|
|
10713
|
+
onClick: async (e) => {
|
|
10714
|
+
e.preventDefault();
|
|
10715
|
+
const yes = window.confirm("Delete this address?");
|
|
10716
|
+
if (!yes) return;
|
|
10717
|
+
try {
|
|
10718
|
+
await removeAddress(addr.id);
|
|
10719
|
+
if (selectedAddressId === addr.id) setSelectedAddressId(null);
|
|
10720
|
+
notification.success("Address deleted");
|
|
10721
|
+
} catch (e2) {
|
|
10722
|
+
notification.error("Failed to delete address");
|
|
10723
|
+
}
|
|
10724
|
+
},
|
|
10725
|
+
className: "inline-flex items-center gap-1 rounded-full border border-red-200 px-2.5 py-0.5 text-xs font-semibold text-red-600 hover:border-red-300 hover:text-red-700",
|
|
10726
|
+
children: [
|
|
10727
|
+
/* @__PURE__ */ jsx(Trash2, { className: "h-3.5 w-3.5" }),
|
|
10728
|
+
" Delete"
|
|
10729
|
+
]
|
|
10730
|
+
}
|
|
10731
|
+
)
|
|
10732
|
+
] })
|
|
10733
|
+
] })
|
|
10734
|
+
]
|
|
10735
|
+
},
|
|
10736
|
+
addr.id
|
|
10737
|
+
)) }) : /* @__PURE__ */ jsxs("div", { className: "text-center py-8 bg-slate-50 rounded-lg", children: [
|
|
10738
|
+
/* @__PURE__ */ jsx(MapPin, { className: "h-12 w-12 mx-auto text-slate-400" }),
|
|
10739
|
+
/* @__PURE__ */ jsx("p", { className: "mt-2 text-slate-600", children: "No addresses found" }),
|
|
10740
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-slate-500", children: "Add a new address to continue" })
|
|
10396
10741
|
] })
|
|
10397
10742
|
] }),
|
|
10398
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
|
|
10417
|
-
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
|
|
10424
|
-
|
|
10425
|
-
|
|
10743
|
+
!isDelivery && storeAddresses.length > 0 && /* @__PURE__ */ jsxs("div", { className: "md:col-span-2", children: [
|
|
10744
|
+
/* @__PURE__ */ jsx("label", { className: "block mb-2 font-semibold", children: "Select Pickup Location" }),
|
|
10745
|
+
/* @__PURE__ */ jsx(
|
|
10746
|
+
"select",
|
|
10747
|
+
{
|
|
10748
|
+
className: "w-full border rounded-sm p-2",
|
|
10749
|
+
value: selectedStoreAddressId || "",
|
|
10750
|
+
onChange: (e) => setSelectedStoreAddressId(e.target.value),
|
|
10751
|
+
children: storeAddresses.map((addr) => /* @__PURE__ */ jsxs("option", { value: addr.id, children: [
|
|
10752
|
+
addr.name,
|
|
10753
|
+
" - ",
|
|
10754
|
+
addr.street1,
|
|
10755
|
+
", ",
|
|
10756
|
+
addr.city
|
|
10757
|
+
] }, addr.id))
|
|
10758
|
+
}
|
|
10759
|
+
)
|
|
10760
|
+
] })
|
|
10761
|
+
] })
|
|
10762
|
+
] }),
|
|
10763
|
+
isDelivery && selectedAddressId && /* @__PURE__ */ jsxs("div", { className: "bg-white border-2 border-gray-100 rounded-[24px] p-8 text-[#2B4B7C]", children: [
|
|
10764
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 text-xl font-semibold text-gray-900 pb-4 mb-8 border-b", children: [
|
|
10765
|
+
/* @__PURE__ */ jsx(Truck, { className: "text-accent w-8 h-8 flex items-center justify-center text-[#2B4B7C]" }),
|
|
10766
|
+
/* @__PURE__ */ jsx("h2", { className: "font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] text-2xl", children: "Shipping Options" })
|
|
10767
|
+
] }),
|
|
10768
|
+
shippingRatesLoading ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center py-12", children: [
|
|
10769
|
+
/* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-accent" }),
|
|
10770
|
+
/* @__PURE__ */ jsx("span", { className: "ml-3 text-gray-600", children: "Loading shipping options..." })
|
|
10771
|
+
] }) : shippingRatesError ? /* @__PURE__ */ jsxs("div", { className: "text-center py-12", children: [
|
|
10772
|
+
/* @__PURE__ */ jsx("div", { className: "w-16 h-16 mx-auto mb-4 bg-red-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx("svg", { className: "w-8 h-8 text-red-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }) }),
|
|
10773
|
+
/* @__PURE__ */ jsx("p", { className: "text-red-500 text-lg font-medium", children: "Error loading shipping options" }),
|
|
10774
|
+
/* @__PURE__ */ jsx("p", { className: "text-red-400 text-sm mt-1", children: shippingRatesError })
|
|
10775
|
+
] }) : shippingRates && shippingRates.length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-4", children: shippingRates.map((rate) => {
|
|
10776
|
+
const isSelected = !!selectedShippingRateId && selectedShippingRateId === rate.objectId;
|
|
10777
|
+
const isTest = rate.test;
|
|
10778
|
+
const hasAttributes = rate.attributes && rate.attributes.length > 0;
|
|
10779
|
+
return /* @__PURE__ */ jsxs(
|
|
10780
|
+
"div",
|
|
10781
|
+
{
|
|
10782
|
+
onClick: () => {
|
|
10783
|
+
setSelectedShippingRateId(rate.objectId);
|
|
10784
|
+
setShippingPrice(parseFloat(rate.amount));
|
|
10785
|
+
},
|
|
10786
|
+
className: `relative p-5 border-2 rounded-xl cursor-pointer transition-all duration-200 hover:shadow-md ${isSelected ? "border-primary-500 bg-primary-50 ring-2 ring-primary-200" : "border-gray-200 hover:border-gray-300"}`,
|
|
10787
|
+
children: [
|
|
10788
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between", children: [
|
|
10789
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4 flex-1", children: [
|
|
10790
|
+
/* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
|
|
10791
|
+
Image4,
|
|
10426
10792
|
{
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
|
|
10430
|
-
|
|
10431
|
-
|
|
10432
|
-
|
|
10433
|
-
setValue("shipping.name", addr.name);
|
|
10434
|
-
setValue("shipping.phone", addr.phone || void 0);
|
|
10435
|
-
setValue("shipping.street1", addr.street1);
|
|
10436
|
-
setValue("shipping.street2", addr.street2 || "");
|
|
10437
|
-
setValue("shipping.city", addr.city);
|
|
10438
|
-
setValue("shipping.state", addr.state);
|
|
10439
|
-
setValue("shipping.zip", addr.zip);
|
|
10440
|
-
setValue("shipping.country", addr.country);
|
|
10793
|
+
src: rate.providerImage75 || "/placeholder-product.jpg",
|
|
10794
|
+
alt: rate.provider,
|
|
10795
|
+
className: "w-12 h-12 rounded-lg object-contain bg-white border border-gray-200 p-1",
|
|
10796
|
+
onError: (e) => {
|
|
10797
|
+
const target = e.target;
|
|
10798
|
+
target.style.display = "none";
|
|
10441
10799
|
},
|
|
10442
|
-
|
|
10800
|
+
width: 48,
|
|
10801
|
+
height: 48
|
|
10443
10802
|
}
|
|
10444
|
-
),
|
|
10445
|
-
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
10446
|
-
/* @__PURE__ */
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
" ",
|
|
10454
|
-
addr.zip
|
|
10803
|
+
) }),
|
|
10804
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
10805
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
10806
|
+
/* @__PURE__ */ jsxs("h3", { className: "text-lg font-semibold text-gray-900", children: [
|
|
10807
|
+
rate.provider,
|
|
10808
|
+
" ",
|
|
10809
|
+
rate.servicelevel?.name
|
|
10810
|
+
] }),
|
|
10811
|
+
isTest && /* @__PURE__ */ jsx("span", { className: "px-2 py-1 text-xs font-medium bg-primary-100 text-primary-800 rounded-full", children: "TEST" })
|
|
10455
10812
|
] }),
|
|
10456
|
-
/* @__PURE__ */ jsx("
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
className: "inline-flex items-center gap-1 rounded-full border border-red-200 px-2.5 py-0.5 text-xs font-semibold text-red-600 hover:border-red-300 hover:text-red-700",
|
|
10493
|
-
children: [
|
|
10494
|
-
/* @__PURE__ */ jsx(Trash2, { className: "h-3.5 w-3.5" }),
|
|
10495
|
-
" Delete"
|
|
10496
|
-
]
|
|
10497
|
-
}
|
|
10498
|
-
)
|
|
10813
|
+
hasAttributes && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2 mb-3", children: rate.attributes.map((attr) => /* @__PURE__ */ jsx(
|
|
10814
|
+
"span",
|
|
10815
|
+
{
|
|
10816
|
+
className: `px-2 py-1 text-xs font-medium rounded-full ${attr === "FASTEST" ? "bg-green-100 text-green-800" : attr === "BESTVALUE" ? "bg-blue-100 text-blue-800" : attr === "CHEAPEST" ? "bg-purple-100 text-purple-800" : "bg-gray-100 text-gray-800"}`,
|
|
10817
|
+
children: attr
|
|
10818
|
+
},
|
|
10819
|
+
attr
|
|
10820
|
+
)) }),
|
|
10821
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1 text-sm text-gray-600", children: [
|
|
10822
|
+
rate.durationTerms && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
10823
|
+
/* @__PURE__ */ jsx("svg", { className: "w-4 h-4 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
10824
|
+
/* @__PURE__ */ jsx("span", { children: rate.durationTerms })
|
|
10825
|
+
] }),
|
|
10826
|
+
rate.estimatedDays && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
10827
|
+
/* @__PURE__ */ jsx("svg", { className: "w-4 h-4 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
10828
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
10829
|
+
"Estimated ",
|
|
10830
|
+
rate.estimatedDays,
|
|
10831
|
+
" day",
|
|
10832
|
+
rate.estimatedDays !== 1 ? "s" : ""
|
|
10833
|
+
] })
|
|
10834
|
+
] }),
|
|
10835
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
10836
|
+
/* @__PURE__ */ jsx("svg", { className: "w-4 h-4 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" }) }),
|
|
10837
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
10838
|
+
"Carrier: ",
|
|
10839
|
+
rate.provider
|
|
10840
|
+
] })
|
|
10841
|
+
] }),
|
|
10842
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
10843
|
+
/* @__PURE__ */ jsx("svg", { className: "w-4 h-4 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1" }) }),
|
|
10844
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
10845
|
+
"Currency: ",
|
|
10846
|
+
rate.currency
|
|
10847
|
+
] })
|
|
10848
|
+
] })
|
|
10499
10849
|
] })
|
|
10500
10850
|
] })
|
|
10501
|
-
]
|
|
10502
|
-
|
|
10503
|
-
|
|
10504
|
-
|
|
10505
|
-
|
|
10506
|
-
|
|
10507
|
-
|
|
10508
|
-
|
|
10509
|
-
|
|
10510
|
-
|
|
10511
|
-
|
|
10512
|
-
|
|
10513
|
-
|
|
10514
|
-
|
|
10515
|
-
|
|
10516
|
-
|
|
10517
|
-
|
|
10518
|
-
|
|
10519
|
-
|
|
10520
|
-
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
] })
|
|
10528
|
-
] })
|
|
10529
|
-
] }),
|
|
10530
|
-
isDelivery && selectedAddressId && /* @__PURE__ */ jsxs("div", { className: "bg-white border-2 border-gray-100 rounded-[24px] p-8 text-[#2B4B7C]", children: [
|
|
10531
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 text-xl font-semibold text-gray-900 pb-4 mb-8 border-b", children: [
|
|
10532
|
-
/* @__PURE__ */ jsx(Truck, { className: "text-accent w-8 h-8 flex items-center justify-center text-[#2B4B7C]" }),
|
|
10533
|
-
/* @__PURE__ */ jsx("h2", { className: "font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] text-2xl", children: "Shipping Options" })
|
|
10851
|
+
] }),
|
|
10852
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-end", children: [
|
|
10853
|
+
/* @__PURE__ */ jsx("div", { className: "text-2xl font-bold text-gray-900", children: formatPrice(parseFloat(rate.amount)) }),
|
|
10854
|
+
rate.amount !== rate.amountLocal && /* @__PURE__ */ jsxs("div", { className: "text-sm text-gray-500", children: [
|
|
10855
|
+
rate.amountLocal,
|
|
10856
|
+
" ",
|
|
10857
|
+
rate.currencyLocal
|
|
10858
|
+
] })
|
|
10859
|
+
] })
|
|
10860
|
+
] }),
|
|
10861
|
+
isSelected && /* @__PURE__ */ jsx("div", { className: "absolute top-3 right-3", children: /* @__PURE__ */ jsx("div", { className: "w-6 h-6 bg-primary-500 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx(Check, { className: "w-4 h-4 text-white" }) }) })
|
|
10862
|
+
]
|
|
10863
|
+
},
|
|
10864
|
+
rate.objectId
|
|
10865
|
+
);
|
|
10866
|
+
}) }) : /* @__PURE__ */ jsxs("div", { className: "text-center py-12", children: [
|
|
10867
|
+
/* @__PURE__ */ jsx("div", { className: "w-16 h-16 mx-auto mb-4 bg-gray-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx(Truck, { className: "w-8 h-8 text-gray-400" }) }),
|
|
10868
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-500 text-lg font-medium", children: "No shipping options available" }),
|
|
10869
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-400 text-sm mt-1", children: "Please check the shipping address or try a different location." })
|
|
10870
|
+
] })
|
|
10871
|
+
] }),
|
|
10872
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
10873
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-white border-2 border-gray-100 rounded-[24px] p-8", children: [
|
|
10874
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-6", children: [
|
|
10875
|
+
/* @__PURE__ */ jsx(Truck, { className: "w-8 h-8 text-[#2B4B7C]" }),
|
|
10876
|
+
/* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold text-[#2B4B7C]", children: "Delivery Method" })
|
|
10534
10877
|
] }),
|
|
10535
|
-
|
|
10536
|
-
|
|
10537
|
-
|
|
10538
|
-
|
|
10539
|
-
|
|
10540
|
-
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
|
|
10878
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-3", children: [
|
|
10879
|
+
{
|
|
10880
|
+
label: "Delivery",
|
|
10881
|
+
icon: /* @__PURE__ */ jsx(Truck, { className: "w-5 h-5" }),
|
|
10882
|
+
value: true,
|
|
10883
|
+
desc: "Shipped to your address"
|
|
10884
|
+
},
|
|
10885
|
+
{
|
|
10886
|
+
label: "Pickup",
|
|
10887
|
+
icon: /* @__PURE__ */ jsx(MapPin, { className: "w-5 h-5" }),
|
|
10888
|
+
value: false,
|
|
10889
|
+
desc: "Collect from pharmacy"
|
|
10890
|
+
}
|
|
10891
|
+
].map((option) => {
|
|
10892
|
+
const active = isDelivery === option.value;
|
|
10546
10893
|
return /* @__PURE__ */ jsxs(
|
|
10547
|
-
"
|
|
10894
|
+
"button",
|
|
10548
10895
|
{
|
|
10896
|
+
type: "button",
|
|
10549
10897
|
onClick: () => {
|
|
10550
|
-
|
|
10551
|
-
|
|
10898
|
+
setIsDelivery(option.value);
|
|
10899
|
+
if (option.value) {
|
|
10900
|
+
setSelectedShippingRateId(null);
|
|
10901
|
+
setShippingPrice(0);
|
|
10902
|
+
}
|
|
10552
10903
|
},
|
|
10553
|
-
className: `relative
|
|
10904
|
+
className: `relative flex w-full items-center justify-between rounded-xl border-2 p-4 transition-all duration-200 ${active ? "border-primary-500 bg-primary-50" : "border-gray-200 hover:border-primary-300"}`,
|
|
10554
10905
|
children: [
|
|
10555
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-
|
|
10556
|
-
/* @__PURE__ */
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
{
|
|
10560
|
-
|
|
10561
|
-
|
|
10562
|
-
|
|
10563
|
-
|
|
10564
|
-
|
|
10565
|
-
|
|
10566
|
-
},
|
|
10567
|
-
width: 48,
|
|
10568
|
-
height: 48
|
|
10569
|
-
}
|
|
10570
|
-
) }),
|
|
10571
|
-
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
10572
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
10573
|
-
/* @__PURE__ */ jsxs("h3", { className: "text-lg font-semibold text-gray-900", children: [
|
|
10574
|
-
rate.provider,
|
|
10575
|
-
" ",
|
|
10576
|
-
rate.servicelevel?.name
|
|
10577
|
-
] }),
|
|
10578
|
-
isTest && /* @__PURE__ */ jsx("span", { className: "px-2 py-1 text-xs font-medium bg-primary-100 text-primary-800 rounded-full", children: "TEST" })
|
|
10579
|
-
] }),
|
|
10580
|
-
hasAttributes && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2 mb-3", children: rate.attributes.map((attr) => /* @__PURE__ */ jsx(
|
|
10581
|
-
"span",
|
|
10582
|
-
{
|
|
10583
|
-
className: `px-2 py-1 text-xs font-medium rounded-full ${attr === "FASTEST" ? "bg-green-100 text-green-800" : attr === "BESTVALUE" ? "bg-blue-100 text-blue-800" : attr === "CHEAPEST" ? "bg-purple-100 text-purple-800" : "bg-gray-100 text-gray-800"}`,
|
|
10584
|
-
children: attr
|
|
10585
|
-
},
|
|
10586
|
-
attr
|
|
10587
|
-
)) }),
|
|
10588
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1 text-sm text-gray-600", children: [
|
|
10589
|
-
rate.durationTerms && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
10590
|
-
/* @__PURE__ */ jsx("svg", { className: "w-4 h-4 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
10591
|
-
/* @__PURE__ */ jsx("span", { children: rate.durationTerms })
|
|
10592
|
-
] }),
|
|
10593
|
-
rate.estimatedDays && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
10594
|
-
/* @__PURE__ */ jsx("svg", { className: "w-4 h-4 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
10595
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
10596
|
-
"Estimated ",
|
|
10597
|
-
rate.estimatedDays,
|
|
10598
|
-
" day",
|
|
10599
|
-
rate.estimatedDays !== 1 ? "s" : ""
|
|
10600
|
-
] })
|
|
10601
|
-
] }),
|
|
10602
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
10603
|
-
/* @__PURE__ */ jsx("svg", { className: "w-4 h-4 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" }) }),
|
|
10604
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
10605
|
-
"Carrier: ",
|
|
10606
|
-
rate.provider
|
|
10607
|
-
] })
|
|
10608
|
-
] }),
|
|
10609
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
10610
|
-
/* @__PURE__ */ jsx("svg", { className: "w-4 h-4 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1" }) }),
|
|
10611
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
10612
|
-
"Currency: ",
|
|
10613
|
-
rate.currency
|
|
10614
|
-
] })
|
|
10615
|
-
] })
|
|
10616
|
-
] })
|
|
10617
|
-
] })
|
|
10618
|
-
] }),
|
|
10619
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-end", children: [
|
|
10620
|
-
/* @__PURE__ */ jsx("div", { className: "text-2xl font-bold text-gray-900", children: formatPrice(parseFloat(rate.amount)) }),
|
|
10621
|
-
rate.amount !== rate.amountLocal && /* @__PURE__ */ jsxs("div", { className: "text-sm text-gray-500", children: [
|
|
10622
|
-
rate.amountLocal,
|
|
10623
|
-
" ",
|
|
10624
|
-
rate.currencyLocal
|
|
10625
|
-
] })
|
|
10906
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
10907
|
+
/* @__PURE__ */ jsx(
|
|
10908
|
+
"div",
|
|
10909
|
+
{
|
|
10910
|
+
className: `p-2 rounded-lg ${active ? "bg-primary-100 text-primary-600" : "bg-gray-100 text-gray-600"}`,
|
|
10911
|
+
children: option.icon
|
|
10912
|
+
}
|
|
10913
|
+
),
|
|
10914
|
+
/* @__PURE__ */ jsxs("div", { className: "text-left", children: [
|
|
10915
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium text-gray-900", children: option.label }),
|
|
10916
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: option.desc })
|
|
10626
10917
|
] })
|
|
10627
10918
|
] }),
|
|
10628
|
-
|
|
10919
|
+
active && /* @__PURE__ */ jsx("div", { className: "w-5 h-5 rounded-full bg-primary-500 flex items-center justify-center", children: /* @__PURE__ */ jsx(Check, { className: "w-3 h-3 text-white" }) })
|
|
10629
10920
|
]
|
|
10630
10921
|
},
|
|
10631
|
-
|
|
10922
|
+
option.label
|
|
10632
10923
|
);
|
|
10633
|
-
}) })
|
|
10634
|
-
/* @__PURE__ */ jsx("div", { className: "w-16 h-16 mx-auto mb-4 bg-gray-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx(Truck, { className: "w-8 h-8 text-gray-400" }) }),
|
|
10635
|
-
/* @__PURE__ */ jsx("p", { className: "text-gray-500 text-lg font-medium", children: "No shipping options available" }),
|
|
10636
|
-
/* @__PURE__ */ jsx("p", { className: "text-gray-400 text-sm mt-1", children: "Please check the shipping address or try a different location." })
|
|
10637
|
-
] })
|
|
10924
|
+
}) })
|
|
10638
10925
|
] }),
|
|
10639
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
10640
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
10641
|
-
/* @__PURE__ */
|
|
10642
|
-
|
|
10643
|
-
/* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold text-[#2B4B7C]", children: "Delivery Method" })
|
|
10644
|
-
] }),
|
|
10645
|
-
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-3", children: [
|
|
10646
|
-
{
|
|
10647
|
-
label: "Delivery",
|
|
10648
|
-
icon: /* @__PURE__ */ jsx(Truck, { className: "w-5 h-5" }),
|
|
10649
|
-
value: true,
|
|
10650
|
-
desc: "Shipped to your address"
|
|
10651
|
-
},
|
|
10652
|
-
{
|
|
10653
|
-
label: "Pickup",
|
|
10654
|
-
icon: /* @__PURE__ */ jsx(MapPin, { className: "w-5 h-5" }),
|
|
10655
|
-
value: false,
|
|
10656
|
-
desc: "Collect from pharmacy"
|
|
10657
|
-
}
|
|
10658
|
-
].map((option) => {
|
|
10659
|
-
const active = isDelivery === option.value;
|
|
10660
|
-
return /* @__PURE__ */ jsxs(
|
|
10661
|
-
"button",
|
|
10662
|
-
{
|
|
10663
|
-
type: "button",
|
|
10664
|
-
onClick: () => {
|
|
10665
|
-
setIsDelivery(option.value);
|
|
10666
|
-
if (option.value) {
|
|
10667
|
-
setSelectedShippingRateId(null);
|
|
10668
|
-
setShippingPrice(0);
|
|
10669
|
-
}
|
|
10670
|
-
},
|
|
10671
|
-
className: `relative flex w-full items-center justify-between rounded-xl border-2 p-4 transition-all duration-200 ${active ? "border-primary-500 bg-primary-50" : "border-gray-200 hover:border-primary-300"}`,
|
|
10672
|
-
children: [
|
|
10673
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
10674
|
-
/* @__PURE__ */ jsx(
|
|
10675
|
-
"div",
|
|
10676
|
-
{
|
|
10677
|
-
className: `p-2 rounded-lg ${active ? "bg-primary-100 text-primary-600" : "bg-gray-100 text-gray-600"}`,
|
|
10678
|
-
children: option.icon
|
|
10679
|
-
}
|
|
10680
|
-
),
|
|
10681
|
-
/* @__PURE__ */ jsxs("div", { className: "text-left", children: [
|
|
10682
|
-
/* @__PURE__ */ jsx("div", { className: "font-medium text-gray-900", children: option.label }),
|
|
10683
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: option.desc })
|
|
10684
|
-
] })
|
|
10685
|
-
] }),
|
|
10686
|
-
active && /* @__PURE__ */ jsx("div", { className: "w-5 h-5 rounded-full bg-primary-500 flex items-center justify-center", children: /* @__PURE__ */ jsx(Check, { className: "w-3 h-3 text-white" }) })
|
|
10687
|
-
]
|
|
10688
|
-
},
|
|
10689
|
-
option.label
|
|
10690
|
-
);
|
|
10691
|
-
}) })
|
|
10926
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-white border-2 border-gray-100 rounded-[24px] p-8", children: [
|
|
10927
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-6", children: [
|
|
10928
|
+
/* @__PURE__ */ jsx(CreditCard, { className: "w-8 h-8 text-[#2B4B7C]" }),
|
|
10929
|
+
/* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold text-[#2B4B7C]", children: "Payment Method" })
|
|
10692
10930
|
] }),
|
|
10693
|
-
/* @__PURE__ */
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
|
|
10698
|
-
|
|
10699
|
-
|
|
10700
|
-
|
|
10701
|
-
"button",
|
|
10702
|
-
{
|
|
10703
|
-
type: "button",
|
|
10704
|
-
onClick: () => setPaymentMethod(pm.value),
|
|
10705
|
-
className: `
|
|
10931
|
+
/* @__PURE__ */ jsx("div", { className: "grid gap-4 md:grid-cols-3", children: PAYMENT_METHODS.map((pm) => {
|
|
10932
|
+
const active = paymentMethod === pm.value;
|
|
10933
|
+
return /* @__PURE__ */ jsxs(
|
|
10934
|
+
"button",
|
|
10935
|
+
{
|
|
10936
|
+
type: "button",
|
|
10937
|
+
onClick: () => setPaymentMethod(pm.value),
|
|
10938
|
+
className: `
|
|
10706
10939
|
group relative flex w-full items-center justify-between rounded-xl border-2 p-3
|
|
10707
10940
|
transition-all duration-200 ease-out
|
|
10708
10941
|
focus:outline-hidden f
|
|
10709
10942
|
${active ? `${pm.activeClass} shadow-md scale-[1.02]` : `${pm.className} border-gray-200 bg-white hover:shadow-xs hover:-translate-y-0.5`}
|
|
10710
10943
|
`,
|
|
10711
|
-
|
|
10712
|
-
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10716
|
-
|
|
10944
|
+
children: [
|
|
10945
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
10946
|
+
/* @__PURE__ */ jsx(
|
|
10947
|
+
"div",
|
|
10948
|
+
{
|
|
10949
|
+
className: `
|
|
10717
10950
|
flex items-center justify-center rounded-lg p-2
|
|
10718
10951
|
transition-colors duration-200
|
|
10719
10952
|
${pm.value === "Card" ? " text-blue-600" : pm.value === "Cash" ? " text-amber-600" : " text-emerald-600"}
|
|
10720
10953
|
${active ? "opacity-80" : "group-hover:opacity-90"}
|
|
10721
10954
|
`,
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10729
|
-
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
] })
|
|
10955
|
+
children: pm.icon
|
|
10956
|
+
}
|
|
10957
|
+
),
|
|
10958
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-semibold text-gray-900", children: pm.label })
|
|
10959
|
+
] }),
|
|
10960
|
+
active && /* @__PURE__ */ jsx("div", { className: "flex h-6 w-6 items-center justify-center rounded-full shadow-xs", children: /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5 text-white" }) })
|
|
10961
|
+
]
|
|
10962
|
+
},
|
|
10963
|
+
pm.value
|
|
10964
|
+
);
|
|
10965
|
+
}) }),
|
|
10966
|
+
/* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500 mt-4", children: [
|
|
10967
|
+
paymentMethod === "Card" && "You will be redirected to a secure payment page.",
|
|
10968
|
+
paymentMethod === "Cash" && "Pay with cash at the time of delivery or pickup.",
|
|
10969
|
+
paymentMethod === "Credit" && "Use your available account credit for this order."
|
|
10738
10970
|
] })
|
|
10739
10971
|
] })
|
|
10740
|
-
]
|
|
10741
|
-
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10746
|
-
|
|
10747
|
-
|
|
10748
|
-
|
|
10749
|
-
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
|
|
10758
|
-
|
|
10759
|
-
|
|
10760
|
-
|
|
10761
|
-
|
|
10762
|
-
/* @__PURE__ */ jsx("p", { className: "font-['Poppins',sans-serif] font-semibold text-[12px] text-[#E67E50] mt-1", children: formatPrice(item.productVariantData.finalPrice * item.quantity) })
|
|
10763
|
-
] })
|
|
10764
|
-
] }, `${item.productId}-${item.color}-${item.size}`)) }),
|
|
10765
|
-
/* @__PURE__ */ jsx("div", { className: "h-px bg-[#5B9BD5]/20 my-4" }),
|
|
10766
|
-
/* @__PURE__ */ jsxs("div", { className: "text-sm text-slate-600 space-y-3 py-4", children: [
|
|
10767
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
10768
|
-
/* @__PURE__ */ jsx("span", { children: "Subtotal" }),
|
|
10769
|
-
/* @__PURE__ */ jsx("span", { className: "font-semibold text-slate-900", children: formatPrice(subtotal) })
|
|
10770
|
-
] }),
|
|
10771
|
-
isDelivery && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
10772
|
-
/* @__PURE__ */ jsx("span", { children: "Shipping" }),
|
|
10773
|
-
/* @__PURE__ */ jsx("span", { className: "font-semibold", children: formatPrice(shippingPrice) })
|
|
10774
|
-
] }),
|
|
10775
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
10776
|
-
/* @__PURE__ */ jsx("span", { children: "Estimated tax" }),
|
|
10777
|
-
/* @__PURE__ */ jsx("span", { className: "font-semibold", children: formatPrice(tax) })
|
|
10972
|
+
] })
|
|
10973
|
+
]
|
|
10974
|
+
}
|
|
10975
|
+
),
|
|
10976
|
+
/* @__PURE__ */ jsx(
|
|
10977
|
+
motion.aside,
|
|
10978
|
+
{
|
|
10979
|
+
initial: { opacity: 0, y: 32 },
|
|
10980
|
+
animate: { opacity: 1, y: 0 },
|
|
10981
|
+
transition: { duration: 0.5, ease: "easeOut", delay: 0.1 },
|
|
10982
|
+
className: "space-y-10 lg:sticky lg:top-24 lg:col-span-1",
|
|
10983
|
+
children: /* @__PURE__ */ jsxs("div", { className: "bg-linear-to-br from-[#5B9BD5]/10 to-[#2B4B7C]/10 rounded-[24px] p-8 border-2 border-[#5B9BD5]/20 sticky top-24", children: [
|
|
10984
|
+
/* @__PURE__ */ jsx("h2", { className: "font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] mb-6 text-2xl", children: "Order Summary" }),
|
|
10985
|
+
/* @__PURE__ */ jsxs("section", { className: "mt-8 pt-6 border-t border-slate-100", children: [
|
|
10986
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-4 mb-6", children: cart?.cartBody?.items?.map((item) => /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
|
|
10987
|
+
/* @__PURE__ */ jsx("div", { className: "w-16 h-16 rounded-xl overflow-hidden bg-white shrink-0", children: /* @__PURE__ */ jsx(Image4, { src: item.productVariantData.productMedia?.[0]?.file || "/placeholder-product.jpg", alt: item.productVariantData.name, className: "w-full h-full object-cover", height: 200, width: 200 }) }),
|
|
10988
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
10989
|
+
/* @__PURE__ */ jsx("p", { className: "font-['Poppins',sans-serif] font-medium text-[12px] text-[#2B4B7C] mb-1", children: item?.productVariantData?.name }),
|
|
10990
|
+
/* @__PURE__ */ jsxs("p", { className: "font-['Poppins',sans-serif] text-[11px] text-[#676c80]", children: [
|
|
10991
|
+
item?.productVariantData?.brand,
|
|
10992
|
+
" \u2022 Qty: ",
|
|
10993
|
+
item.quantity
|
|
10778
10994
|
] }),
|
|
10779
|
-
/* @__PURE__ */ jsx("
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10783
|
-
|
|
10995
|
+
/* @__PURE__ */ jsx("p", { className: "font-['Poppins',sans-serif] font-semibold text-[12px] text-[#E67E50] mt-1", children: formatPrice(item.productVariantData.finalPrice * item.quantity) })
|
|
10996
|
+
] })
|
|
10997
|
+
] }, `${item.productId}-${item.color}-${item.size}`)) }),
|
|
10998
|
+
/* @__PURE__ */ jsx("div", { className: "h-px bg-[#5B9BD5]/20 my-4" }),
|
|
10999
|
+
/* @__PURE__ */ jsxs("div", { className: "text-sm text-slate-600 space-y-3 py-4", children: [
|
|
11000
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
11001
|
+
/* @__PURE__ */ jsx("span", { children: "Subtotal" }),
|
|
11002
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold text-slate-900", children: formatPrice(subtotal) })
|
|
10784
11003
|
] }),
|
|
10785
|
-
|
|
10786
|
-
/* @__PURE__ */ jsx("
|
|
10787
|
-
|
|
10788
|
-
] })
|
|
11004
|
+
isDelivery && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
11005
|
+
/* @__PURE__ */ jsx("span", { children: "Shipping" }),
|
|
11006
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold", children: formatPrice(shippingPrice) })
|
|
11007
|
+
] }),
|
|
11008
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
11009
|
+
/* @__PURE__ */ jsx("span", { children: "Estimated tax" }),
|
|
11010
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold", children: formatPrice(tax) })
|
|
11011
|
+
] }),
|
|
11012
|
+
/* @__PURE__ */ jsx("div", { className: "h-px bg-[#5B9BD5]/20 mt-6" }),
|
|
11013
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-6", children: [
|
|
11014
|
+
/* @__PURE__ */ jsx("span", { className: "font-['Poppins',sans-serif] font-semibold text-[16px] text-[#2B4B7C]", children: "Total" }),
|
|
11015
|
+
/* @__PURE__ */ jsx("span", { className: "font-['Poppins',sans-serif] font-bold text-[24px] text-[#E67E50]", children: formatPrice(total) })
|
|
11016
|
+
] })
|
|
10789
11017
|
] }),
|
|
10790
|
-
/* @__PURE__ */ jsxs(
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10805
|
-
|
|
11018
|
+
/* @__PURE__ */ jsx("div", { className: "bg-white/80 rounded-xl p-4", children: /* @__PURE__ */ jsxs("p", { className: "font-['Poppins',sans-serif] text-[11px] text-[#676c80] leading-[1.6]", children: [
|
|
11019
|
+
/* @__PURE__ */ jsx("strong", { className: "text-[#2B4B7C]", children: "Payment:" }),
|
|
11020
|
+
" We'll contact you to arrange payment upon pickup or delivery. We accept cash, credit cards, and all major payment methods."
|
|
11021
|
+
] }) })
|
|
11022
|
+
] }),
|
|
11023
|
+
error && /* @__PURE__ */ jsx("div", { className: "mt-4 p-4 rounded-xl bg-red-50 border border-red-200 text-red-600 text-sm font-medium animate-in fade-in slide-in-from-top-1 duration-200", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
11024
|
+
/* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4 shrink-0 mt-0.5" }),
|
|
11025
|
+
/* @__PURE__ */ jsx("span", { children: error })
|
|
11026
|
+
] }) }),
|
|
11027
|
+
/* @__PURE__ */ jsxs(
|
|
11028
|
+
"button",
|
|
11029
|
+
{
|
|
11030
|
+
type: "submit",
|
|
11031
|
+
className: "font-['Poppins',sans-serif] font-medium text-[14px] px-6 py-3 rounded-full text-white hover:bg-[#d66f45] hover:shadow-lg transition-all duration-300 mt-4 w-full bg-[#E67E50] hover:bg-[#2B4B7C] flex items-center justify-center gap-2",
|
|
11032
|
+
children: [
|
|
11033
|
+
/* @__PURE__ */ jsx(CreditCard, { className: "h-5 w-5" }),
|
|
11034
|
+
isSubmitting ? "Placing order..." : "Place Secure Order"
|
|
11035
|
+
]
|
|
11036
|
+
}
|
|
11037
|
+
),
|
|
11038
|
+
/* @__PURE__ */ jsxs("p", { className: "mt-4 flex items-center justify-center gap-2 text-xs text-slate-500", children: [
|
|
11039
|
+
/* @__PURE__ */ jsx(Lock, { className: "h-4 w-4" }),
|
|
11040
|
+
"Fully encrypted checkout \u2014 cancel anytime before shipment."
|
|
10806
11041
|
] })
|
|
10807
|
-
}
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
] }),
|
|
11042
|
+
] })
|
|
11043
|
+
}
|
|
11044
|
+
)
|
|
11045
|
+
] }) }),
|
|
10811
11046
|
/* @__PURE__ */ jsx(
|
|
10812
11047
|
AddressFormModal,
|
|
10813
11048
|
{
|