hey-pharmacist-ecommerce 1.1.28 → 1.1.30
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 +10552 -1370
- package/dist/index.d.ts +10552 -1370
- package/dist/index.js +4696 -1281
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4640 -1283
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/AccountOrdersTab.tsx +1 -1
- package/src/components/AccountSettingsTab.tsx +88 -6
- package/src/components/CartItem.tsx +1 -1
- package/src/components/Header.tsx +8 -2
- package/src/components/OrderCard.tsx +4 -4
- package/src/components/ProductCard.tsx +59 -42
- package/src/components/QuickViewModal.tsx +13 -13
- package/src/hooks/useAddresses.ts +4 -1
- package/src/hooks/usePaymentMethods.ts +26 -31
- package/src/hooks/useProducts.ts +63 -64
- package/src/hooks/useStoreCapabilities.ts +87 -0
- package/src/hooks/useWishlistProducts.ts +4 -5
- package/src/index.ts +6 -0
- package/src/lib/Apis/api.ts +0 -1
- package/src/lib/Apis/apis/auth-api.ts +37 -36
- package/src/lib/Apis/apis/categories-api.ts +97 -0
- package/src/lib/Apis/apis/products-api.ts +942 -405
- package/src/lib/Apis/apis/shipping-api.ts +105 -0
- package/src/lib/Apis/apis/stores-api.ts +356 -0
- package/src/lib/Apis/apis/sub-categories-api.ts +97 -0
- package/src/lib/Apis/apis/users-api.ts +8 -8
- package/src/lib/Apis/models/address-created-request.ts +0 -12
- package/src/lib/Apis/models/address.ts +0 -12
- package/src/lib/Apis/models/api-key-info-dto.ts +49 -0
- package/src/lib/Apis/models/category-populated.ts +0 -12
- package/src/lib/Apis/models/category-sub-category-populated.ts +2 -2
- package/src/lib/Apis/models/category.ts +0 -18
- package/src/lib/Apis/models/{table-cell-dto.ts → change-password-dto.ts} +6 -6
- package/src/lib/Apis/models/create-address-dto.ts +0 -12
- package/src/lib/Apis/models/create-discount-dto.ts +0 -8
- package/src/lib/Apis/models/create-product-dto.ts +30 -23
- package/src/lib/Apis/models/create-store-address-dto.ts +0 -12
- package/src/lib/Apis/models/create-store-dto-settings.ts +51 -0
- package/src/lib/Apis/models/create-store-dto.ts +7 -0
- package/src/lib/Apis/models/create-sub-category-dto.ts +6 -0
- package/src/lib/Apis/models/create-variant-dto.ts +26 -32
- package/src/lib/Apis/models/discount.ts +0 -8
- package/src/lib/Apis/models/index.ts +16 -7
- package/src/lib/Apis/models/paginated-products-dto.ts +6 -6
- package/src/lib/Apis/models/populated-discount.ts +0 -8
- package/src/lib/Apis/models/product-summary.ts +69 -0
- package/src/lib/Apis/models/product-variant.ts +31 -68
- package/src/lib/Apis/models/product.ts +138 -0
- package/src/lib/Apis/models/products-insights-dto.ts +12 -0
- package/src/lib/Apis/models/reorder-categories-dto.ts +27 -0
- package/src/lib/Apis/models/reorder-products-dto.ts +49 -0
- package/src/lib/Apis/models/{table-dto.ts → reorder-products-success-response-dto.ts} +8 -9
- package/src/lib/Apis/models/reorder-subcategories-dto.ts +33 -0
- package/src/lib/Apis/models/{shallow-parent-category-dto.ts → reorder-success-response-dto.ts} +7 -7
- package/src/lib/Apis/models/shipment-with-order.ts +18 -0
- package/src/lib/Apis/models/shipment.ts +18 -0
- package/src/lib/Apis/models/single-product-media.ts +0 -12
- package/src/lib/Apis/models/store-api-keys-response-dto.ts +34 -0
- package/src/lib/Apis/models/store-capabilities-dto.ts +63 -0
- package/src/lib/Apis/models/store-entity.ts +7 -0
- package/src/lib/Apis/models/store.ts +7 -0
- package/src/lib/Apis/models/sub-category.ts +6 -12
- package/src/lib/Apis/models/update-address-dto.ts +0 -12
- package/src/lib/Apis/models/update-api-keys-dto.ts +39 -0
- package/src/lib/Apis/models/update-discount-dto.ts +0 -8
- package/src/lib/Apis/models/update-manual-shipment-status-dto.ts +47 -0
- package/src/lib/Apis/models/update-product-dto.ts +30 -19
- package/src/lib/Apis/models/update-store-dto.ts +7 -0
- package/src/lib/Apis/models/update-sub-category-dto.ts +6 -0
- package/src/lib/Apis/models/{update-product-variant-dto.ts → update-variant-dto.ts} +46 -46
- package/src/lib/Apis/models/variant-id-inventory-body.ts +27 -0
- package/src/lib/api-adapter/config.ts +53 -0
- package/src/lib/validations/address.ts +1 -1
- package/src/providers/FavoritesProvider.tsx +5 -5
- package/src/providers/WishlistProvider.tsx +4 -4
- package/src/screens/CartScreen.tsx +1 -1
- package/src/screens/ChangePasswordScreen.tsx +2 -6
- package/src/screens/CheckoutScreen.tsx +402 -288
- package/src/screens/ForgotPasswordScreen.tsx +153 -0
- package/src/screens/ProductDetailScreen.tsx +51 -60
- package/src/screens/RegisterScreen.tsx +31 -31
- package/src/screens/ResetPasswordScreen.tsx +208 -0
- package/src/screens/SearchResultsScreen.tsx +264 -26
- package/src/screens/ShopScreen.tsx +42 -45
- package/src/screens/WishlistScreen.tsx +35 -31
- package/src/lib/Apis/apis/product-variants-api.ts +0 -552
- package/src/lib/Apis/models/create-single-variant-product-dto.ts +0 -154
- package/src/lib/Apis/models/extended-product-dto.ts +0 -206
- package/src/lib/Apis/models/frequently-bought-product-dto.ts +0 -71
|
@@ -11,9 +11,8 @@
|
|
|
11
11
|
* https://github.com/swagger-api/swagger-codegen.git
|
|
12
12
|
* Do not edit the class manually.
|
|
13
13
|
*/
|
|
14
|
-
import {
|
|
14
|
+
import { CreateVariantDto } from './create-variant-dto';
|
|
15
15
|
import { SingleProductMedia } from './single-product-media';
|
|
16
|
-
import { SubCategory } from './sub-category';
|
|
17
16
|
/**
|
|
18
17
|
*
|
|
19
18
|
* @export
|
|
@@ -35,40 +34,52 @@ export interface UpdateProductDto {
|
|
|
35
34
|
description?: string;
|
|
36
35
|
/**
|
|
37
36
|
*
|
|
38
|
-
* @type {
|
|
37
|
+
* @type {string}
|
|
39
38
|
* @memberof UpdateProductDto
|
|
40
39
|
*/
|
|
41
|
-
|
|
40
|
+
brand?: string;
|
|
42
41
|
/**
|
|
43
42
|
*
|
|
44
43
|
* @type {string}
|
|
45
44
|
* @memberof UpdateProductDto
|
|
46
45
|
*/
|
|
47
|
-
|
|
46
|
+
sku?: string;
|
|
48
47
|
/**
|
|
49
48
|
*
|
|
50
49
|
* @type {string}
|
|
51
50
|
* @memberof UpdateProductDto
|
|
52
51
|
*/
|
|
53
|
-
|
|
52
|
+
upc?: string;
|
|
54
53
|
/**
|
|
55
54
|
*
|
|
56
|
-
* @type {
|
|
55
|
+
* @type {Array<SingleProductMedia>}
|
|
57
56
|
* @memberof UpdateProductDto
|
|
58
57
|
*/
|
|
59
|
-
|
|
58
|
+
media?: Array<SingleProductMedia>;
|
|
60
59
|
/**
|
|
61
60
|
*
|
|
62
61
|
* @type {Array<string>}
|
|
63
62
|
* @memberof UpdateProductDto
|
|
64
63
|
*/
|
|
65
|
-
|
|
64
|
+
tags?: Array<string>;
|
|
65
|
+
/**
|
|
66
|
+
* Category IDs
|
|
67
|
+
* @type {Array<string>}
|
|
68
|
+
* @memberof UpdateProductDto
|
|
69
|
+
*/
|
|
70
|
+
categoryIds?: Array<string>;
|
|
71
|
+
/**
|
|
72
|
+
* SubCategory IDs
|
|
73
|
+
* @type {Array<string>}
|
|
74
|
+
* @memberof UpdateProductDto
|
|
75
|
+
*/
|
|
76
|
+
subCategoryIds?: Array<string>;
|
|
66
77
|
/**
|
|
67
78
|
*
|
|
68
|
-
* @type {
|
|
79
|
+
* @type {boolean}
|
|
69
80
|
* @memberof UpdateProductDto
|
|
70
81
|
*/
|
|
71
|
-
|
|
82
|
+
showStock?: boolean;
|
|
72
83
|
/**
|
|
73
84
|
*
|
|
74
85
|
* @type {boolean}
|
|
@@ -76,27 +87,27 @@ export interface UpdateProductDto {
|
|
|
76
87
|
*/
|
|
77
88
|
homeScreenFeatured?: boolean;
|
|
78
89
|
/**
|
|
79
|
-
*
|
|
80
|
-
* @type {Array<
|
|
90
|
+
* IDs of frequently bought together products
|
|
91
|
+
* @type {Array<string>}
|
|
81
92
|
* @memberof UpdateProductDto
|
|
82
93
|
*/
|
|
83
|
-
|
|
94
|
+
frequentlyBoughtWith?: Array<string>;
|
|
84
95
|
/**
|
|
85
|
-
*
|
|
96
|
+
* IDs of frequently bought together products (alias)
|
|
86
97
|
* @type {Array<string>}
|
|
87
98
|
* @memberof UpdateProductDto
|
|
88
99
|
*/
|
|
89
100
|
frequentlyBoughtProducts?: Array<string>;
|
|
90
101
|
/**
|
|
91
102
|
*
|
|
92
|
-
* @type {
|
|
103
|
+
* @type {boolean}
|
|
93
104
|
* @memberof UpdateProductDto
|
|
94
105
|
*/
|
|
95
|
-
|
|
106
|
+
isActive?: boolean;
|
|
96
107
|
/**
|
|
97
108
|
*
|
|
98
|
-
* @type {Array<
|
|
109
|
+
* @type {Array<CreateVariantDto>}
|
|
99
110
|
* @memberof UpdateProductDto
|
|
100
111
|
*/
|
|
101
|
-
|
|
112
|
+
variants?: Array<CreateVariantDto>;
|
|
102
113
|
}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* https://github.com/swagger-api/swagger-codegen.git
|
|
12
12
|
* Do not edit the class manually.
|
|
13
13
|
*/
|
|
14
|
+
import { CreateStoreDtoSettings } from './create-store-dto-settings';
|
|
14
15
|
/**
|
|
15
16
|
*
|
|
16
17
|
* @export
|
|
@@ -102,4 +103,10 @@ export interface UpdateStoreDto {
|
|
|
102
103
|
* @memberof UpdateStoreDto
|
|
103
104
|
*/
|
|
104
105
|
storeBillingAddress?: string;
|
|
106
|
+
/**
|
|
107
|
+
*
|
|
108
|
+
* @type {CreateStoreDtoSettings}
|
|
109
|
+
* @memberof UpdateStoreDto
|
|
110
|
+
*/
|
|
111
|
+
settings?: CreateStoreDtoSettings;
|
|
105
112
|
}
|
|
@@ -15,92 +15,92 @@ import { SingleProductMedia } from './single-product-media';
|
|
|
15
15
|
/**
|
|
16
16
|
*
|
|
17
17
|
* @export
|
|
18
|
-
* @interface
|
|
18
|
+
* @interface UpdateVariantDto
|
|
19
19
|
*/
|
|
20
|
-
export interface
|
|
20
|
+
export interface UpdateVariantDto {
|
|
21
21
|
_id?: string;
|
|
22
22
|
/**
|
|
23
23
|
*
|
|
24
24
|
* @type {string}
|
|
25
|
-
* @memberof
|
|
25
|
+
* @memberof UpdateVariantDto
|
|
26
26
|
*/
|
|
27
27
|
name?: string;
|
|
28
28
|
/**
|
|
29
29
|
*
|
|
30
|
-
* @type {
|
|
31
|
-
* @memberof
|
|
30
|
+
* @type {string}
|
|
31
|
+
* @memberof UpdateVariantDto
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
description?: string;
|
|
34
34
|
/**
|
|
35
35
|
*
|
|
36
36
|
* @type {string}
|
|
37
|
-
* @memberof
|
|
37
|
+
* @memberof UpdateVariantDto
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
sku?: string;
|
|
40
40
|
/**
|
|
41
41
|
*
|
|
42
|
-
* @type {
|
|
43
|
-
* @memberof
|
|
42
|
+
* @type {string}
|
|
43
|
+
* @memberof UpdateVariantDto
|
|
44
44
|
*/
|
|
45
|
-
|
|
45
|
+
brand?: string;
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
48
|
-
* @type {
|
|
49
|
-
* @memberof
|
|
47
|
+
*
|
|
48
|
+
* @type {Array<SingleProductMedia>}
|
|
49
|
+
* @memberof UpdateVariantDto
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
media?: Array<SingleProductMedia>;
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
*
|
|
54
54
|
* @type {number}
|
|
55
|
-
* @memberof
|
|
55
|
+
* @memberof UpdateVariantDto
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
retailPrice?: number;
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* Initial inventory count
|
|
60
60
|
* @type {number}
|
|
61
|
-
* @memberof
|
|
61
|
+
* @memberof UpdateVariantDto
|
|
62
62
|
*/
|
|
63
|
-
|
|
63
|
+
inventoryCount?: number;
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* Width in cm
|
|
66
66
|
* @type {number}
|
|
67
|
-
* @memberof
|
|
67
|
+
* @memberof UpdateVariantDto
|
|
68
68
|
*/
|
|
69
|
-
|
|
69
|
+
width?: number;
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
72
|
-
* @type {
|
|
73
|
-
* @memberof
|
|
71
|
+
* Height in cm
|
|
72
|
+
* @type {number}
|
|
73
|
+
* @memberof UpdateVariantDto
|
|
74
74
|
*/
|
|
75
|
-
|
|
75
|
+
height?: number;
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
78
|
-
* @type {
|
|
79
|
-
* @memberof
|
|
77
|
+
* Length in cm
|
|
78
|
+
* @type {number}
|
|
79
|
+
* @memberof UpdateVariantDto
|
|
80
80
|
*/
|
|
81
|
-
|
|
81
|
+
length?: number;
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* Weight in grams
|
|
84
84
|
* @type {number}
|
|
85
|
-
* @memberof
|
|
85
|
+
* @memberof UpdateVariantDto
|
|
86
86
|
*/
|
|
87
|
-
|
|
87
|
+
weight?: number;
|
|
88
88
|
/**
|
|
89
89
|
*
|
|
90
|
-
* @type {
|
|
91
|
-
* @memberof
|
|
90
|
+
* @type {boolean}
|
|
91
|
+
* @memberof UpdateVariantDto
|
|
92
92
|
*/
|
|
93
|
-
|
|
93
|
+
isActive?: boolean;
|
|
94
94
|
/**
|
|
95
|
-
*
|
|
96
|
-
* @type {
|
|
97
|
-
* @memberof
|
|
95
|
+
* Custom attributes like color, size, etc.
|
|
96
|
+
* @type {any}
|
|
97
|
+
* @memberof UpdateVariantDto
|
|
98
98
|
*/
|
|
99
|
-
|
|
99
|
+
attributes?: any;
|
|
100
100
|
/**
|
|
101
|
-
*
|
|
102
|
-
* @type {
|
|
103
|
-
* @memberof
|
|
101
|
+
* Variant ID to update
|
|
102
|
+
* @type {string}
|
|
103
|
+
* @memberof UpdateVariantDto
|
|
104
104
|
*/
|
|
105
|
-
|
|
105
|
+
id: string;
|
|
106
106
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Hey Pharamcist API
|
|
5
|
+
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
|
6
|
+
*
|
|
7
|
+
* OpenAPI spec version: 1.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by the swagger code generator program.
|
|
11
|
+
* https://github.com/swagger-api/swagger-codegen.git
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @export
|
|
17
|
+
* @interface VariantIdInventoryBody
|
|
18
|
+
*/
|
|
19
|
+
export interface VariantIdInventoryBody {
|
|
20
|
+
_id?: string;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @type {number}
|
|
24
|
+
* @memberof VariantIdInventoryBody
|
|
25
|
+
*/
|
|
26
|
+
quantityChange?: number;
|
|
27
|
+
}
|
|
@@ -83,3 +83,56 @@ export function clearAuthToken(): void {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Change user password
|
|
88
|
+
* Custom implementation to fix the auto-generated API which incorrectly sends passwords as headers
|
|
89
|
+
*/
|
|
90
|
+
export async function changePassword(oldPassword: string, newPassword: string): Promise<void> {
|
|
91
|
+
if (!currentConfig) {
|
|
92
|
+
throw new Error('API adapter not initialized.');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const token = getAuthToken();
|
|
96
|
+
if (!token) {
|
|
97
|
+
throw new Error('User is not authenticated');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const url = `${currentConfig.apiBaseUrl}/auth/change-password`;
|
|
101
|
+
|
|
102
|
+
console.log('Change Password Request:', {
|
|
103
|
+
url,
|
|
104
|
+
storeId: currentConfig.storeId,
|
|
105
|
+
hasToken: !!token,
|
|
106
|
+
tokenPrefix: token.substring(0, 20) + '...',
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const response = await fetch(url, {
|
|
110
|
+
method: 'POST',
|
|
111
|
+
headers: {
|
|
112
|
+
'Content-Type': 'application/json',
|
|
113
|
+
'X-Store-Key': currentConfig.storeId,
|
|
114
|
+
'Authorization': `Bearer ${token}`,
|
|
115
|
+
},
|
|
116
|
+
body: JSON.stringify({
|
|
117
|
+
oldPassword,
|
|
118
|
+
newPassword,
|
|
119
|
+
}),
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
console.log('Change Password Response:', {
|
|
123
|
+
status: response.status,
|
|
124
|
+
statusText: response.statusText,
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
if (!response.ok) {
|
|
128
|
+
const errorData = await response.json().catch(() => ({}));
|
|
129
|
+
console.error('Change Password Error:', errorData);
|
|
130
|
+
throw {
|
|
131
|
+
response: {
|
|
132
|
+
data: errorData,
|
|
133
|
+
status: response.status,
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
@@ -8,7 +8,7 @@ export const addressSchema = z.object({
|
|
|
8
8
|
state: z.string().min(2, 'State is required'),
|
|
9
9
|
zip: z.string().min(4, 'ZIP code is required'),
|
|
10
10
|
country: z.string().min(2, 'Country is required'),
|
|
11
|
-
phone: z.string().min(10, 'Phone number
|
|
11
|
+
phone: z.string().min(10, 'Phone number must be at least 10 characters').optional().or(z.literal('')),
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
export type AddressFormData = z.infer<typeof addressSchema>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Product } from '@/lib/Apis';
|
|
4
4
|
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
|
|
5
5
|
import { useNotification } from './NotificationProvider';
|
|
6
6
|
|
|
7
7
|
interface FavoritesContextType {
|
|
8
8
|
favorites: string[];
|
|
9
9
|
isFavorite: (productId: string) => boolean;
|
|
10
|
-
toggleFavorite: (product:
|
|
11
|
-
addToFavorites: (product:
|
|
10
|
+
toggleFavorite: (product: Product) => void;
|
|
11
|
+
addToFavorites: (product: Product) => void;
|
|
12
12
|
removeFromFavorites: (productId: string) => void;
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -53,7 +53,7 @@ export function FavoritesProvider({ children }: { children: ReactNode }) {
|
|
|
53
53
|
return favorites.includes(productId);
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
const addToFavorites = (product:
|
|
56
|
+
const addToFavorites = (product: Product) => {
|
|
57
57
|
if (!favorites.includes(product.id)) {
|
|
58
58
|
setFavorites(prev => [...prev, product.id]);
|
|
59
59
|
notification.success(
|
|
@@ -71,7 +71,7 @@ export function FavoritesProvider({ children }: { children: ReactNode }) {
|
|
|
71
71
|
);
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
const toggleFavorite = (product:
|
|
74
|
+
const toggleFavorite = (product: Product) => {
|
|
75
75
|
if (isFavorite(product.id)) {
|
|
76
76
|
removeFromFavorites(product.id);
|
|
77
77
|
} else {
|
|
@@ -5,12 +5,12 @@ import { WishlistApi } from '@/lib/Apis/apis/wishlist-api';
|
|
|
5
5
|
import { AXIOS_CONFIG } from '@/lib/Apis/wrapper';
|
|
6
6
|
import { useAuth } from './AuthProvider';
|
|
7
7
|
import { useMemo } from 'react';
|
|
8
|
-
import {
|
|
8
|
+
import { ProductsApi, Wishlist, Product } from '@/lib/Apis';
|
|
9
9
|
import { useNotification } from './NotificationProvider';
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
interface WishlistContextType extends Wishlist {
|
|
13
|
-
addToWishlist: (product:
|
|
13
|
+
addToWishlist: (product: Product) => Promise<void>;
|
|
14
14
|
removeFromWishlist: (productId: string) => Promise<void>;
|
|
15
15
|
isInWishlist: (productId: string) => boolean;
|
|
16
16
|
getWishlistCount: () => number;
|
|
@@ -64,7 +64,7 @@ export function WishlistProvider({ children }: { children: ReactNode }) {
|
|
|
64
64
|
error: error instanceof Error ? error.message : 'Failed to load wishlist',
|
|
65
65
|
}));
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
68
68
|
}, [isAuthenticated]);
|
|
69
69
|
|
|
70
70
|
|
|
@@ -72,7 +72,7 @@ export function WishlistProvider({ children }: { children: ReactNode }) {
|
|
|
72
72
|
fetchWishlist();
|
|
73
73
|
}, [fetchWishlist]);
|
|
74
74
|
|
|
75
|
-
const addToWishlist = async (product:
|
|
75
|
+
const addToWishlist = async (product: Product) => {
|
|
76
76
|
if (!isAuthenticated) {
|
|
77
77
|
notification.error(
|
|
78
78
|
'Sign-in required',
|
|
@@ -88,7 +88,7 @@ export function CartScreen() {
|
|
|
88
88
|
);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
const subtotal = cart.total;
|
|
91
|
+
const subtotal = cart.cartBody.items.reduce((total, item) => total + item.productVariantData.finalPrice * item.quantity, 0);
|
|
92
92
|
const shipping = 0;
|
|
93
93
|
const tax = 0;
|
|
94
94
|
const total = subtotal + shipping + tax;
|
|
@@ -9,8 +9,7 @@ import { useRouter } from 'next/navigation';
|
|
|
9
9
|
import { Lock, ShieldCheck } from 'lucide-react';
|
|
10
10
|
import { Input } from '@/components/ui/Input';
|
|
11
11
|
import { Button } from '@/components/ui/Button';
|
|
12
|
-
import {
|
|
13
|
-
import { getApiConfiguration } from '@/lib/api-adapter/config';
|
|
12
|
+
import { changePassword } from '@/lib/api-adapter/config';
|
|
14
13
|
import { useAuth } from '@/providers/AuthProvider';
|
|
15
14
|
import { useBasePath } from '@/providers/BasePathProvider';
|
|
16
15
|
|
|
@@ -53,10 +52,7 @@ export function ChangePasswordScreen() {
|
|
|
53
52
|
setIsSubmitting(true);
|
|
54
53
|
setStatus(null);
|
|
55
54
|
try {
|
|
56
|
-
await
|
|
57
|
-
data.currentPassword,
|
|
58
|
-
data.newPassword
|
|
59
|
-
);
|
|
55
|
+
await changePassword(data.currentPassword, data.newPassword);
|
|
60
56
|
setStatus({ type: 'success', message: 'Password updated successfully' });
|
|
61
57
|
setTimeout(() => router.push(buildPath('/account')), 600);
|
|
62
58
|
} catch (error: any) {
|