hey-pharmacist-ecommerce 1.1.27 → 1.1.29

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.
Files changed (61) hide show
  1. package/dist/index.d.mts +344 -640
  2. package/dist/index.d.ts +344 -640
  3. package/dist/index.js +1814 -835
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +1814 -837
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +1 -1
  8. package/src/components/AccountOrdersTab.tsx +1 -1
  9. package/src/components/AccountSettingsTab.tsx +88 -6
  10. package/src/components/CartItem.tsx +1 -1
  11. package/src/components/Header.tsx +8 -2
  12. package/src/components/OrderCard.tsx +4 -4
  13. package/src/components/ProductCard.tsx +59 -42
  14. package/src/components/QuickViewModal.tsx +13 -13
  15. package/src/hooks/useAddresses.ts +4 -1
  16. package/src/hooks/usePaymentMethods.ts +26 -31
  17. package/src/hooks/useProducts.ts +63 -64
  18. package/src/hooks/useWishlistProducts.ts +4 -5
  19. package/src/index.ts +2 -0
  20. package/src/lib/Apis/api.ts +0 -1
  21. package/src/lib/Apis/apis/auth-api.ts +18 -29
  22. package/src/lib/Apis/apis/products-api.ts +845 -405
  23. package/src/lib/Apis/models/category-populated.ts +0 -12
  24. package/src/lib/Apis/models/category-sub-category-populated.ts +2 -2
  25. package/src/lib/Apis/models/category.ts +0 -18
  26. package/src/lib/Apis/models/{table-cell-dto.ts → change-password-dto.ts} +6 -6
  27. package/src/lib/Apis/models/create-product-dto.ts +30 -23
  28. package/src/lib/Apis/models/create-sub-category-dto.ts +6 -0
  29. package/src/lib/Apis/models/create-variant-dto.ts +29 -29
  30. package/src/lib/Apis/models/index.ts +5 -7
  31. package/src/lib/Apis/models/paginated-products-dto.ts +6 -6
  32. package/src/lib/Apis/models/product-summary.ts +69 -0
  33. package/src/lib/Apis/models/product-variant.ts +34 -65
  34. package/src/lib/Apis/models/product.ts +138 -0
  35. package/src/lib/Apis/models/products-insights-dto.ts +12 -0
  36. package/src/lib/Apis/models/single-product-media.ts +0 -12
  37. package/src/lib/Apis/models/sub-category.ts +6 -12
  38. package/src/lib/Apis/models/update-product-dto.ts +30 -19
  39. package/src/lib/Apis/models/update-sub-category-dto.ts +6 -0
  40. package/src/lib/Apis/models/{update-product-variant-dto.ts → update-variant-dto.ts} +51 -45
  41. package/src/lib/Apis/models/{shallow-parent-category-dto.ts → variant-id-inventory-body.ts} +5 -11
  42. package/src/lib/api-adapter/config.ts +53 -0
  43. package/src/lib/validations/address.ts +1 -1
  44. package/src/providers/FavoritesProvider.tsx +5 -5
  45. package/src/providers/WishlistProvider.tsx +4 -4
  46. package/src/screens/CartScreen.tsx +1 -1
  47. package/src/screens/ChangePasswordScreen.tsx +2 -6
  48. package/src/screens/CheckoutScreen.tsx +40 -11
  49. package/src/screens/EditProfileScreen.tsx +5 -1
  50. package/src/screens/ForgotPasswordScreen.tsx +153 -0
  51. package/src/screens/ProductDetailScreen.tsx +51 -60
  52. package/src/screens/RegisterScreen.tsx +31 -31
  53. package/src/screens/ResetPasswordScreen.tsx +202 -0
  54. package/src/screens/SearchResultsScreen.tsx +264 -26
  55. package/src/screens/ShopScreen.tsx +42 -45
  56. package/src/screens/WishlistScreen.tsx +35 -31
  57. package/src/lib/Apis/apis/product-variants-api.ts +0 -552
  58. package/src/lib/Apis/models/create-single-variant-product-dto.ts +0 -154
  59. package/src/lib/Apis/models/extended-product-dto.ts +0 -206
  60. package/src/lib/Apis/models/frequently-bought-product-dto.ts +0 -71
  61. package/src/lib/Apis/models/table-dto.ts +0 -34
package/dist/index.js CHANGED
@@ -3,13 +3,13 @@
3
3
 
4
4
  var React8 = require('react');
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
- var globalAxios4 = require('axios');
6
+ var globalAxios18 = require('axios');
7
7
  var framerMotion = require('framer-motion');
8
8
  var lucideReact = require('lucide-react');
9
9
  var reactQuery = require('@tanstack/react-query');
10
10
  var navigation = require('next/navigation');
11
11
  var Image4 = require('next/image');
12
- var Link7 = require('next/link');
12
+ var Link9 = require('next/link');
13
13
  var dynamic = require('next/dynamic');
14
14
  var reactHookForm = require('react-hook-form');
15
15
  var zod$1 = require('@hookform/resolvers/zod');
@@ -18,9 +18,9 @@ var zod = require('zod');
18
18
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
19
19
 
20
20
  var React8__default = /*#__PURE__*/_interopDefault(React8);
21
- var globalAxios4__default = /*#__PURE__*/_interopDefault(globalAxios4);
21
+ var globalAxios18__default = /*#__PURE__*/_interopDefault(globalAxios18);
22
22
  var Image4__default = /*#__PURE__*/_interopDefault(Image4);
23
- var Link7__default = /*#__PURE__*/_interopDefault(Link7);
23
+ var Link9__default = /*#__PURE__*/_interopDefault(Link9);
24
24
  var dynamic__default = /*#__PURE__*/_interopDefault(dynamic);
25
25
 
26
26
  var __defProp = Object.defineProperty;
@@ -79,6 +79,7 @@ var init_sharedConfig = __esm({
79
79
  // src/lib/api-adapter/config.ts
80
80
  var config_exports = {};
81
81
  __export(config_exports, {
82
+ changePassword: () => changePassword,
82
83
  clearAuthToken: () => clearAuthToken,
83
84
  getApiConfiguration: () => getApiConfiguration,
84
85
  getAuthToken: () => getAuthToken,
@@ -134,6 +135,48 @@ function clearAuthToken() {
134
135
  AXIOS_CONFIG.accessToken = () => "";
135
136
  }
136
137
  }
138
+ async function changePassword(oldPassword, newPassword) {
139
+ if (!currentConfig) {
140
+ throw new Error("API adapter not initialized.");
141
+ }
142
+ const token = getAuthToken();
143
+ if (!token) {
144
+ throw new Error("User is not authenticated");
145
+ }
146
+ const url = `${currentConfig.apiBaseUrl}/auth/change-password`;
147
+ console.log("Change Password Request:", {
148
+ url,
149
+ storeId: currentConfig.storeId,
150
+ hasToken: !!token,
151
+ tokenPrefix: token.substring(0, 20) + "..."
152
+ });
153
+ const response = await fetch(url, {
154
+ method: "POST",
155
+ headers: {
156
+ "Content-Type": "application/json",
157
+ "X-Store-Key": currentConfig.storeId,
158
+ "Authorization": `Bearer ${token}`
159
+ },
160
+ body: JSON.stringify({
161
+ oldPassword,
162
+ newPassword
163
+ })
164
+ });
165
+ console.log("Change Password Response:", {
166
+ status: response.status,
167
+ statusText: response.statusText
168
+ });
169
+ if (!response.ok) {
170
+ const errorData = await response.json().catch(() => ({}));
171
+ console.error("Change Password Error:", errorData);
172
+ throw {
173
+ response: {
174
+ data: errorData,
175
+ status: response.status
176
+ }
177
+ };
178
+ }
179
+ }
137
180
  var apiConfiguration, currentConfig;
138
181
  var init_config = __esm({
139
182
  "src/lib/api-adapter/config.ts"() {
@@ -227,7 +270,7 @@ function ThemeProvider({ config, children }) {
227
270
  init_config();
228
271
  var BASE_PATH = "/".replace(/\/+$/, "");
229
272
  var BaseAPI = class {
230
- constructor(configuration, basePath = BASE_PATH, axios = globalAxios4__default.default) {
273
+ constructor(configuration, basePath = BASE_PATH, axios = globalAxios18__default.default) {
231
274
  this.basePath = basePath;
232
275
  this.axios = axios;
233
276
  if (configuration) {
@@ -898,7 +941,7 @@ var UsersApiFp = function(configuration) {
898
941
  */
899
942
  async allowUserCredit(body, userId, options) {
900
943
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).allowUserCredit(body, userId, options);
901
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
944
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
902
945
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
903
946
  return axios.request(axiosRequestArgs);
904
947
  };
@@ -912,7 +955,7 @@ var UsersApiFp = function(configuration) {
912
955
  */
913
956
  async changeUserEmail(body, options) {
914
957
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).changeUserEmail(body, options);
915
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
958
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
916
959
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
917
960
  return axios.request(axiosRequestArgs);
918
961
  };
@@ -926,7 +969,7 @@ var UsersApiFp = function(configuration) {
926
969
  */
927
970
  async createUser(body, options) {
928
971
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).createUser(body, options);
929
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
972
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
930
973
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
931
974
  return axios.request(axiosRequestArgs);
932
975
  };
@@ -939,7 +982,7 @@ var UsersApiFp = function(configuration) {
939
982
  */
940
983
  async deleteMyProfile(options) {
941
984
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).deleteMyProfile(options);
942
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
985
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
943
986
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
944
987
  return axios.request(axiosRequestArgs);
945
988
  };
@@ -953,7 +996,7 @@ var UsersApiFp = function(configuration) {
953
996
  */
954
997
  async deleteUser(id, options) {
955
998
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).deleteUser(id, options);
956
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
999
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
957
1000
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
958
1001
  return axios.request(axiosRequestArgs);
959
1002
  };
@@ -967,7 +1010,7 @@ var UsersApiFp = function(configuration) {
967
1010
  */
968
1011
  async disableUserCredit(userId, options) {
969
1012
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).disableUserCredit(userId, options);
970
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
1013
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
971
1014
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
972
1015
  return axios.request(axiosRequestArgs);
973
1016
  };
@@ -988,7 +1031,7 @@ var UsersApiFp = function(configuration) {
988
1031
  */
989
1032
  async getAllUsers(role, sortingOrder, sortingColumn, createdBefore, createdAfter, search, limit, page, options) {
990
1033
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).getAllUsers(role, sortingOrder, sortingColumn, createdBefore, createdAfter, search, limit, page, options);
991
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
1034
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
992
1035
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
993
1036
  return axios.request(axiosRequestArgs);
994
1037
  };
@@ -1002,7 +1045,7 @@ var UsersApiFp = function(configuration) {
1002
1045
  */
1003
1046
  async getInsights(groupId, options) {
1004
1047
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).getInsights(groupId, options);
1005
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
1048
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
1006
1049
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1007
1050
  return axios.request(axiosRequestArgs);
1008
1051
  };
@@ -1015,7 +1058,7 @@ var UsersApiFp = function(configuration) {
1015
1058
  */
1016
1059
  async getMyProfile(options) {
1017
1060
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).getMyProfile(options);
1018
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
1061
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
1019
1062
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1020
1063
  return axios.request(axiosRequestArgs);
1021
1064
  };
@@ -1029,7 +1072,7 @@ var UsersApiFp = function(configuration) {
1029
1072
  */
1030
1073
  async getSingleUser(id, options) {
1031
1074
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).getSingleUser(id, options);
1032
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
1075
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
1033
1076
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1034
1077
  return axios.request(axiosRequestArgs);
1035
1078
  };
@@ -1042,7 +1085,7 @@ var UsersApiFp = function(configuration) {
1042
1085
  */
1043
1086
  async sendOTP(options) {
1044
1087
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).sendOTP(options);
1045
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
1088
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
1046
1089
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1047
1090
  return axios.request(axiosRequestArgs);
1048
1091
  };
@@ -1056,7 +1099,7 @@ var UsersApiFp = function(configuration) {
1056
1099
  */
1057
1100
  async updateMyProfile(body, options) {
1058
1101
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).updateMyProfile(body, options);
1059
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
1102
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
1060
1103
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1061
1104
  return axios.request(axiosRequestArgs);
1062
1105
  };
@@ -1071,7 +1114,7 @@ var UsersApiFp = function(configuration) {
1071
1114
  */
1072
1115
  async updateUser(body, id, options) {
1073
1116
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).updateUser(body, id, options);
1074
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
1117
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
1075
1118
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1076
1119
  return axios.request(axiosRequestArgs);
1077
1120
  };
@@ -1084,7 +1127,7 @@ var UsersApiFp = function(configuration) {
1084
1127
  */
1085
1128
  async verifyOTP(options) {
1086
1129
  const localVarAxiosArgs = await UsersApiAxiosParamCreator(configuration).verifyOTP(options);
1087
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
1130
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
1088
1131
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1089
1132
  return axios.request(axiosRequestArgs);
1090
1133
  };
@@ -1299,17 +1342,13 @@ var AuthApiAxiosParamCreator = function(configuration) {
1299
1342
  /**
1300
1343
  *
1301
1344
  * @summary Change user password
1302
- * @param {string} oldPassword
1303
- * @param {string} newPassword
1345
+ * @param {ChangePasswordDto} body
1304
1346
  * @param {*} [options] Override http request option.
1305
1347
  * @throws {RequiredError}
1306
1348
  */
1307
- changePassword: async (oldPassword, newPassword, options = {}) => {
1308
- if (oldPassword === null || oldPassword === void 0) {
1309
- throw new RequiredError("oldPassword", "Required parameter oldPassword was null or undefined when calling changePassword.");
1310
- }
1311
- if (newPassword === null || newPassword === void 0) {
1312
- throw new RequiredError("newPassword", "Required parameter newPassword was null or undefined when calling changePassword.");
1349
+ changePassword: async (body, options = {}) => {
1350
+ if (body === null || body === void 0) {
1351
+ throw new RequiredError("body", "Required parameter body was null or undefined when calling changePassword.");
1313
1352
  }
1314
1353
  const localVarPath = `/auth/change-password`;
1315
1354
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
@@ -1324,12 +1363,7 @@ var AuthApiAxiosParamCreator = function(configuration) {
1324
1363
  const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
1325
1364
  localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
1326
1365
  }
1327
- if (oldPassword !== void 0 && oldPassword !== null) {
1328
- localVarHeaderParameter["oldPassword"] = String(oldPassword);
1329
- }
1330
- if (newPassword !== void 0 && newPassword !== null) {
1331
- localVarHeaderParameter["newPassword"] = String(newPassword);
1332
- }
1366
+ localVarHeaderParameter["Content-Type"] = "application/json";
1333
1367
  const query = new URLSearchParams(localVarUrlObj.search);
1334
1368
  for (const key in localVarQueryParameter) {
1335
1369
  query.set(key, localVarQueryParameter[key]);
@@ -1340,6 +1374,8 @@ var AuthApiAxiosParamCreator = function(configuration) {
1340
1374
  localVarUrlObj.search = new URLSearchParams(query).toString();
1341
1375
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1342
1376
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1377
+ const needsSerialization = typeof body !== "string" || (localVarRequestOptions.headers || (localVarRequestOptions.headers = {}))["Content-Type"] === "application/json";
1378
+ localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== void 0 ? body : {}) : body || "";
1343
1379
  return {
1344
1380
  url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
1345
1381
  options: localVarRequestOptions
@@ -1701,7 +1737,7 @@ var AuthApiFp = function(configuration) {
1701
1737
  */
1702
1738
  async changeEmail(body, options) {
1703
1739
  const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).changeEmail(body, options);
1704
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
1740
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
1705
1741
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1706
1742
  return axios.request(axiosRequestArgs);
1707
1743
  };
@@ -1709,14 +1745,13 @@ var AuthApiFp = function(configuration) {
1709
1745
  /**
1710
1746
  *
1711
1747
  * @summary Change user password
1712
- * @param {string} oldPassword
1713
- * @param {string} newPassword
1748
+ * @param {ChangePasswordDto} body
1714
1749
  * @param {*} [options] Override http request option.
1715
1750
  * @throws {RequiredError}
1716
1751
  */
1717
- async changePassword(oldPassword, newPassword, options) {
1718
- const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).changePassword(oldPassword, newPassword, options);
1719
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
1752
+ async changePassword(body, options) {
1753
+ const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).changePassword(body, options);
1754
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
1720
1755
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1721
1756
  return axios.request(axiosRequestArgs);
1722
1757
  };
@@ -1730,7 +1765,7 @@ var AuthApiFp = function(configuration) {
1730
1765
  */
1731
1766
  async dashboardLogin(body, options) {
1732
1767
  const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).dashboardLogin(body, options);
1733
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
1768
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
1734
1769
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1735
1770
  return axios.request(axiosRequestArgs);
1736
1771
  };
@@ -1745,7 +1780,7 @@ var AuthApiFp = function(configuration) {
1745
1780
  */
1746
1781
  async resetPassword(newPassword, token, options) {
1747
1782
  const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).resetPassword(newPassword, token, options);
1748
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
1783
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
1749
1784
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1750
1785
  return axios.request(axiosRequestArgs);
1751
1786
  };
@@ -1759,7 +1794,7 @@ var AuthApiFp = function(configuration) {
1759
1794
  */
1760
1795
  async sendForgetPasswordEmail(body, options) {
1761
1796
  const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).sendForgetPasswordEmail(body, options);
1762
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
1797
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
1763
1798
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1764
1799
  return axios.request(axiosRequestArgs);
1765
1800
  };
@@ -1773,7 +1808,7 @@ var AuthApiFp = function(configuration) {
1773
1808
  */
1774
1809
  async signin(body, options) {
1775
1810
  const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).signin(body, options);
1776
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
1811
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
1777
1812
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1778
1813
  return axios.request(axiosRequestArgs);
1779
1814
  };
@@ -1787,7 +1822,7 @@ var AuthApiFp = function(configuration) {
1787
1822
  */
1788
1823
  async signinWithGmail(body, options) {
1789
1824
  const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).signinWithGmail(body, options);
1790
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
1825
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
1791
1826
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1792
1827
  return axios.request(axiosRequestArgs);
1793
1828
  };
@@ -1801,7 +1836,7 @@ var AuthApiFp = function(configuration) {
1801
1836
  */
1802
1837
  async signup(body, options) {
1803
1838
  const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).signup(body, options);
1804
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
1839
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
1805
1840
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1806
1841
  return axios.request(axiosRequestArgs);
1807
1842
  };
@@ -1815,7 +1850,7 @@ var AuthApiFp = function(configuration) {
1815
1850
  */
1816
1851
  async signupWithGmail(body, options) {
1817
1852
  const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).signupWithGmail(body, options);
1818
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
1853
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
1819
1854
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1820
1855
  return axios.request(axiosRequestArgs);
1821
1856
  };
@@ -1829,7 +1864,7 @@ var AuthApiFp = function(configuration) {
1829
1864
  */
1830
1865
  async verifyUserEmail(body, options) {
1831
1866
  const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).verifyUserEmail(body, options);
1832
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
1867
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
1833
1868
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
1834
1869
  return axios.request(axiosRequestArgs);
1835
1870
  };
@@ -1851,14 +1886,13 @@ var AuthApi = class extends BaseAPI {
1851
1886
  /**
1852
1887
  *
1853
1888
  * @summary Change user password
1854
- * @param {string} oldPassword
1855
- * @param {string} newPassword
1889
+ * @param {ChangePasswordDto} body
1856
1890
  * @param {*} [options] Override http request option.
1857
1891
  * @throws {RequiredError}
1858
1892
  * @memberof AuthApi
1859
1893
  */
1860
- async changePassword(oldPassword, newPassword, options) {
1861
- return AuthApiFp(this.configuration).changePassword(oldPassword, newPassword, options).then((request) => request(this.axios, this.basePath));
1894
+ async changePassword(body, options) {
1895
+ return AuthApiFp(this.configuration).changePassword(body, options).then((request) => request(this.axios, this.basePath));
1862
1896
  }
1863
1897
  /**
1864
1898
  *
@@ -2750,7 +2784,7 @@ var AddressesApiFp = function(configuration) {
2750
2784
  */
2751
2785
  async adminCreateAddressForUser(body, userId, options) {
2752
2786
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).adminCreateAddressForUser(body, userId, options);
2753
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
2787
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
2754
2788
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2755
2789
  return axios.request(axiosRequestArgs);
2756
2790
  };
@@ -2764,7 +2798,7 @@ var AddressesApiFp = function(configuration) {
2764
2798
  */
2765
2799
  async adminDeleteUserAddress(addressId, options) {
2766
2800
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).adminDeleteUserAddress(addressId, options);
2767
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
2801
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
2768
2802
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2769
2803
  return axios.request(axiosRequestArgs);
2770
2804
  };
@@ -2778,7 +2812,7 @@ var AddressesApiFp = function(configuration) {
2778
2812
  */
2779
2813
  async adminGetSingleUserAddresses(userId, options) {
2780
2814
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).adminGetSingleUserAddresses(userId, options);
2781
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
2815
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
2782
2816
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2783
2817
  return axios.request(axiosRequestArgs);
2784
2818
  };
@@ -2793,7 +2827,7 @@ var AddressesApiFp = function(configuration) {
2793
2827
  */
2794
2828
  async adminUpdateUserAddress(body, addressId, options) {
2795
2829
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).adminUpdateUserAddress(body, addressId, options);
2796
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
2830
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
2797
2831
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2798
2832
  return axios.request(axiosRequestArgs);
2799
2833
  };
@@ -2807,7 +2841,7 @@ var AddressesApiFp = function(configuration) {
2807
2841
  */
2808
2842
  async createAddressForStore(body, options) {
2809
2843
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).createAddressForStore(body, options);
2810
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
2844
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
2811
2845
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2812
2846
  return axios.request(axiosRequestArgs);
2813
2847
  };
@@ -2821,7 +2855,7 @@ var AddressesApiFp = function(configuration) {
2821
2855
  */
2822
2856
  async createAddressForUser(body, options) {
2823
2857
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).createAddressForUser(body, options);
2824
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
2858
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
2825
2859
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2826
2860
  return axios.request(axiosRequestArgs);
2827
2861
  };
@@ -2835,7 +2869,7 @@ var AddressesApiFp = function(configuration) {
2835
2869
  */
2836
2870
  async deleteUserAddress(addressId, options) {
2837
2871
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).deleteUserAddress(addressId, options);
2838
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
2872
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
2839
2873
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2840
2874
  return axios.request(axiosRequestArgs);
2841
2875
  };
@@ -2849,7 +2883,7 @@ var AddressesApiFp = function(configuration) {
2849
2883
  */
2850
2884
  async getAllStoreAddresses(storeId, options) {
2851
2885
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).getAllStoreAddresses(storeId, options);
2852
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
2886
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
2853
2887
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2854
2888
  return axios.request(axiosRequestArgs);
2855
2889
  };
@@ -2862,7 +2896,7 @@ var AddressesApiFp = function(configuration) {
2862
2896
  */
2863
2897
  async getAllUserAddresses(options) {
2864
2898
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).getAllUserAddresses(options);
2865
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
2899
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
2866
2900
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2867
2901
  return axios.request(axiosRequestArgs);
2868
2902
  };
@@ -2875,7 +2909,7 @@ var AddressesApiFp = function(configuration) {
2875
2909
  */
2876
2910
  async getMyAddresses(options) {
2877
2911
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).getMyAddresses(options);
2878
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
2912
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
2879
2913
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2880
2914
  return axios.request(axiosRequestArgs);
2881
2915
  };
@@ -2888,7 +2922,7 @@ var AddressesApiFp = function(configuration) {
2888
2922
  */
2889
2923
  async getMyDefaultAddress(options) {
2890
2924
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).getMyDefaultAddress(options);
2891
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
2925
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
2892
2926
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2893
2927
  return axios.request(axiosRequestArgs);
2894
2928
  };
@@ -2902,7 +2936,7 @@ var AddressesApiFp = function(configuration) {
2902
2936
  */
2903
2937
  async getSingleAddress(addressId, options) {
2904
2938
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).getSingleAddress(addressId, options);
2905
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
2939
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
2906
2940
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2907
2941
  return axios.request(axiosRequestArgs);
2908
2942
  };
@@ -2917,7 +2951,7 @@ var AddressesApiFp = function(configuration) {
2917
2951
  */
2918
2952
  async setDefaultShippingAddress(userId, addressId, options) {
2919
2953
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).setDefaultShippingAddress(userId, addressId, options);
2920
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
2954
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
2921
2955
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2922
2956
  return axios.request(axiosRequestArgs);
2923
2957
  };
@@ -2931,7 +2965,7 @@ var AddressesApiFp = function(configuration) {
2931
2965
  */
2932
2966
  async updateDefaultAddress(addressId, options) {
2933
2967
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).updateDefaultAddress(addressId, options);
2934
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
2968
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
2935
2969
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2936
2970
  return axios.request(axiosRequestArgs);
2937
2971
  };
@@ -2946,7 +2980,7 @@ var AddressesApiFp = function(configuration) {
2946
2980
  */
2947
2981
  async updateUserAddress(body, addressId, options) {
2948
2982
  const localVarAxiosArgs = await AddressesApiAxiosParamCreator(configuration).updateUserAddress(body, addressId, options);
2949
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
2983
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
2950
2984
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
2951
2985
  return axios.request(axiosRequestArgs);
2952
2986
  };
@@ -3328,7 +3362,7 @@ var CartApiFp = function(configuration) {
3328
3362
  */
3329
3363
  async clearCart(options) {
3330
3364
  const localVarAxiosArgs = await CartApiAxiosParamCreator(configuration).clearCart(options);
3331
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
3365
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
3332
3366
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3333
3367
  return axios.request(axiosRequestArgs);
3334
3368
  };
@@ -3342,7 +3376,7 @@ var CartApiFp = function(configuration) {
3342
3376
  */
3343
3377
  async getUserCart(rateId, options) {
3344
3378
  const localVarAxiosArgs = await CartApiAxiosParamCreator(configuration).getUserCart(rateId, options);
3345
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
3379
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
3346
3380
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3347
3381
  return axios.request(axiosRequestArgs);
3348
3382
  };
@@ -3356,7 +3390,7 @@ var CartApiFp = function(configuration) {
3356
3390
  */
3357
3391
  async handleUserCart(body, options) {
3358
3392
  const localVarAxiosArgs = await CartApiAxiosParamCreator(configuration).handleUserCart(body, options);
3359
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
3393
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
3360
3394
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3361
3395
  return axios.request(axiosRequestArgs);
3362
3396
  };
@@ -3374,7 +3408,7 @@ var CartApiFp = function(configuration) {
3374
3408
  */
3375
3409
  async handleVisitorCart(body, isDelivery, userId, rateId, addressId, options) {
3376
3410
  const localVarAxiosArgs = await CartApiAxiosParamCreator(configuration).handleVisitorCart(body, isDelivery, userId, rateId, addressId, options);
3377
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
3411
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
3378
3412
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3379
3413
  return axios.request(axiosRequestArgs);
3380
3414
  };
@@ -3760,7 +3794,7 @@ var CategoriesApiFp = function(configuration) {
3760
3794
  */
3761
3795
  async createCategory(body, options) {
3762
3796
  const localVarAxiosArgs = await CategoriesApiAxiosParamCreator(configuration).createCategory(body, options);
3763
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
3797
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
3764
3798
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3765
3799
  return axios.request(axiosRequestArgs);
3766
3800
  };
@@ -3774,7 +3808,7 @@ var CategoriesApiFp = function(configuration) {
3774
3808
  */
3775
3809
  async deleteCategory(id, options) {
3776
3810
  const localVarAxiosArgs = await CategoriesApiAxiosParamCreator(configuration).deleteCategory(id, options);
3777
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
3811
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
3778
3812
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3779
3813
  return axios.request(axiosRequestArgs);
3780
3814
  };
@@ -3790,7 +3824,7 @@ var CategoriesApiFp = function(configuration) {
3790
3824
  */
3791
3825
  async getAllCategories(search, limit, page, options) {
3792
3826
  const localVarAxiosArgs = await CategoriesApiAxiosParamCreator(configuration).getAllCategories(search, limit, page, options);
3793
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
3827
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
3794
3828
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3795
3829
  return axios.request(axiosRequestArgs);
3796
3830
  };
@@ -3803,7 +3837,7 @@ var CategoriesApiFp = function(configuration) {
3803
3837
  */
3804
3838
  async getCategoreisAndSubCategories(options) {
3805
3839
  const localVarAxiosArgs = await CategoriesApiAxiosParamCreator(configuration).getCategoreisAndSubCategories(options);
3806
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
3840
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
3807
3841
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3808
3842
  return axios.request(axiosRequestArgs);
3809
3843
  };
@@ -3817,7 +3851,7 @@ var CategoriesApiFp = function(configuration) {
3817
3851
  */
3818
3852
  async getCategoryFilters(id, options) {
3819
3853
  const localVarAxiosArgs = await CategoriesApiAxiosParamCreator(configuration).getCategoryFilters(id, options);
3820
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
3854
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
3821
3855
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3822
3856
  return axios.request(axiosRequestArgs);
3823
3857
  };
@@ -3831,7 +3865,7 @@ var CategoriesApiFp = function(configuration) {
3831
3865
  */
3832
3866
  async getSingleCategory(id, options) {
3833
3867
  const localVarAxiosArgs = await CategoriesApiAxiosParamCreator(configuration).getSingleCategory(id, options);
3834
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
3868
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
3835
3869
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3836
3870
  return axios.request(axiosRequestArgs);
3837
3871
  };
@@ -3846,7 +3880,7 @@ var CategoriesApiFp = function(configuration) {
3846
3880
  */
3847
3881
  async updateCategory(body, id, options) {
3848
3882
  const localVarAxiosArgs = await CategoriesApiAxiosParamCreator(configuration).updateCategory(body, id, options);
3849
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
3883
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
3850
3884
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
3851
3885
  return axios.request(axiosRequestArgs);
3852
3886
  };
@@ -4564,7 +4598,7 @@ var OrdersApiFp = function(configuration) {
4564
4598
  */
4565
4599
  async assignPaymentMethod(orderId, paymentMethod, billingAddressId, options) {
4566
4600
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).assignPaymentMethod(orderId, paymentMethod, billingAddressId, options);
4567
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
4601
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
4568
4602
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4569
4603
  return axios.request(axiosRequestArgs);
4570
4604
  };
@@ -4578,7 +4612,7 @@ var OrdersApiFp = function(configuration) {
4578
4612
  */
4579
4613
  async cancelOrder(id, options) {
4580
4614
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).cancelOrder(id, options);
4581
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
4615
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
4582
4616
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4583
4617
  return axios.request(axiosRequestArgs);
4584
4618
  };
@@ -4596,7 +4630,7 @@ var OrdersApiFp = function(configuration) {
4596
4630
  */
4597
4631
  async createCheckout(body, isDelivery, userId, rateId, billingAddressId, options) {
4598
4632
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).createCheckout(body, isDelivery, userId, rateId, billingAddressId, options);
4599
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
4633
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
4600
4634
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4601
4635
  return axios.request(axiosRequestArgs);
4602
4636
  };
@@ -4610,7 +4644,7 @@ var OrdersApiFp = function(configuration) {
4610
4644
  */
4611
4645
  async deleteOrder(id, options) {
4612
4646
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).deleteOrder(id, options);
4613
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
4647
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
4614
4648
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4615
4649
  return axios.request(axiosRequestArgs);
4616
4650
  };
@@ -4631,7 +4665,7 @@ var OrdersApiFp = function(configuration) {
4631
4665
  */
4632
4666
  async getAllOrders(paymentStatus, orderStatus, page, limit, search, createdAfter, createdBefore, userId, options) {
4633
4667
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).getAllOrders(paymentStatus, orderStatus, page, limit, search, createdAfter, createdBefore, userId, options);
4634
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
4668
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
4635
4669
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4636
4670
  return axios.request(axiosRequestArgs);
4637
4671
  };
@@ -4645,7 +4679,7 @@ var OrdersApiFp = function(configuration) {
4645
4679
  */
4646
4680
  async getSingleOrder(id, options) {
4647
4681
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).getSingleOrder(id, options);
4648
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
4682
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
4649
4683
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4650
4684
  return axios.request(axiosRequestArgs);
4651
4685
  };
@@ -4658,7 +4692,7 @@ var OrdersApiFp = function(configuration) {
4658
4692
  */
4659
4693
  async getStoreOrderInsights(options) {
4660
4694
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).getStoreOrderInsights(options);
4661
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
4695
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
4662
4696
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4663
4697
  return axios.request(axiosRequestArgs);
4664
4698
  };
@@ -4671,7 +4705,7 @@ var OrdersApiFp = function(configuration) {
4671
4705
  */
4672
4706
  async getUserOrders(options) {
4673
4707
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).getUserOrders(options);
4674
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
4708
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
4675
4709
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4676
4710
  return axios.request(axiosRequestArgs);
4677
4711
  };
@@ -4685,7 +4719,7 @@ var OrdersApiFp = function(configuration) {
4685
4719
  */
4686
4720
  async payOrder(orderId, options) {
4687
4721
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).payOrder(orderId, options);
4688
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
4722
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
4689
4723
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4690
4724
  return axios.request(axiosRequestArgs);
4691
4725
  };
@@ -4699,7 +4733,7 @@ var OrdersApiFp = function(configuration) {
4699
4733
  */
4700
4734
  async sendOrderEmail(body, options) {
4701
4735
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).sendOrderEmail(body, options);
4702
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
4736
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
4703
4737
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4704
4738
  return axios.request(axiosRequestArgs);
4705
4739
  };
@@ -4720,7 +4754,7 @@ var OrdersApiFp = function(configuration) {
4720
4754
  */
4721
4755
  async updateOrder(body, isDelivery, id, paymentMethod, userId, rateId, addressId, billingAddressId, options) {
4722
4756
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).updateOrder(body, isDelivery, id, paymentMethod, userId, rateId, addressId, billingAddressId, options);
4723
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
4757
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
4724
4758
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4725
4759
  return axios.request(axiosRequestArgs);
4726
4760
  };
@@ -4735,7 +4769,7 @@ var OrdersApiFp = function(configuration) {
4735
4769
  */
4736
4770
  async updateOrderStatus(id, orderStatus, options) {
4737
4771
  const localVarAxiosArgs = await OrdersApiAxiosParamCreator(configuration).updateOrderStatus(id, orderStatus, options);
4738
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
4772
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
4739
4773
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
4740
4774
  return axios.request(axiosRequestArgs);
4741
4775
  };
@@ -4899,7 +4933,57 @@ var ProductsApiAxiosParamCreator = function(configuration) {
4899
4933
  return {
4900
4934
  /**
4901
4935
  *
4902
- * @summary Create a product
4936
+ * @summary Add a new variant to a product
4937
+ * @param {CreateVariantDto} body
4938
+ * @param {string} productId Product ID
4939
+ * @param {*} [options] Override http request option.
4940
+ * @throws {RequiredError}
4941
+ */
4942
+ addVariant: async (body, productId, options = {}) => {
4943
+ if (body === null || body === void 0) {
4944
+ throw new RequiredError("body", "Required parameter body was null or undefined when calling addVariant.");
4945
+ }
4946
+ if (productId === null || productId === void 0) {
4947
+ throw new RequiredError("productId", "Required parameter productId was null or undefined when calling addVariant.");
4948
+ }
4949
+ const localVarPath = `/products/{productId}/variants`.replace(`{${"productId"}}`, encodeURIComponent(String(productId)));
4950
+ const localVarUrlObj = new URL(localVarPath, "https://example.com");
4951
+ let baseOptions;
4952
+ if (configuration) {
4953
+ baseOptions = configuration.baseOptions;
4954
+ }
4955
+ const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
4956
+ const localVarHeaderParameter = {};
4957
+ const localVarQueryParameter = {};
4958
+ if (configuration && configuration.accessToken) {
4959
+ const accessToken = typeof configuration.accessToken === "function" ? await configuration.accessToken() : await configuration.accessToken;
4960
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
4961
+ }
4962
+ if (configuration && configuration.apiKey) {
4963
+ const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
4964
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
4965
+ }
4966
+ localVarHeaderParameter["Content-Type"] = "application/json";
4967
+ const query = new URLSearchParams(localVarUrlObj.search);
4968
+ for (const key in localVarQueryParameter) {
4969
+ query.set(key, localVarQueryParameter[key]);
4970
+ }
4971
+ for (const key in options.params) {
4972
+ query.set(key, options.params[key]);
4973
+ }
4974
+ localVarUrlObj.search = new URLSearchParams(query).toString();
4975
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
4976
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
4977
+ const needsSerialization = typeof body !== "string" || (localVarRequestOptions.headers || (localVarRequestOptions.headers = {}))["Content-Type"] === "application/json";
4978
+ localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== void 0 ? body : {}) : body || "";
4979
+ return {
4980
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
4981
+ options: localVarRequestOptions
4982
+ };
4983
+ },
4984
+ /**
4985
+ *
4986
+ * @summary Create a new product with variants
4903
4987
  * @param {CreateProductDto} body
4904
4988
  * @param {*} [options] Override http request option.
4905
4989
  * @throws {RequiredError}
@@ -4908,7 +4992,7 @@ var ProductsApiAxiosParamCreator = function(configuration) {
4908
4992
  if (body === null || body === void 0) {
4909
4993
  throw new RequiredError("body", "Required parameter body was null or undefined when calling createProduct.");
4910
4994
  }
4911
- const localVarPath = `/products/create`;
4995
+ const localVarPath = `/products`;
4912
4996
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
4913
4997
  let baseOptions;
4914
4998
  if (configuration) {
@@ -4945,16 +5029,16 @@ var ProductsApiAxiosParamCreator = function(configuration) {
4945
5029
  },
4946
5030
  /**
4947
5031
  *
4948
- * @summary Create a Product that has a single variant
4949
- * @param {CreateSingleVariantProductDTO} body
5032
+ * @summary [DEPRECATED] Use POST /products instead
5033
+ * @param {CreateProductDto} body
4950
5034
  * @param {*} [options] Override http request option.
4951
5035
  * @throws {RequiredError}
4952
5036
  */
4953
- createSingleVariantProduct: async (body, options = {}) => {
5037
+ createProductLegacy: async (body, options = {}) => {
4954
5038
  if (body === null || body === void 0) {
4955
- throw new RequiredError("body", "Required parameter body was null or undefined when calling createSingleVariantProduct.");
5039
+ throw new RequiredError("body", "Required parameter body was null or undefined when calling createProductLegacy.");
4956
5040
  }
4957
- const localVarPath = `/products/create-single-variant`;
5041
+ const localVarPath = `/products/create`;
4958
5042
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
4959
5043
  let baseOptions;
4960
5044
  if (configuration) {
@@ -4991,8 +5075,8 @@ var ProductsApiAxiosParamCreator = function(configuration) {
4991
5075
  },
4992
5076
  /**
4993
5077
  *
4994
- * @summary Delete a product
4995
- * @param {string} id
5078
+ * @summary Delete a product and all its variants
5079
+ * @param {string} id Product ID
4996
5080
  * @param {*} [options] Override http request option.
4997
5081
  * @throws {RequiredError}
4998
5082
  */
@@ -5034,32 +5118,26 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5034
5118
  },
5035
5119
  /**
5036
5120
  *
5037
- * @summary Get all products of a specific category
5038
- * @param {string} categoryId Category ID
5039
- * @param {string} [searchTerm] OpenAI Search Query
5040
- * @param {number} [maxPrice] highest price to filter with
5041
- * @param {number} [minPrice] lowest price to filter with
5042
- * @param {string} [brandFilter] brands to filter with (comma separated string)
5043
- * @param {string} [availability] specifies whether to show available products or out of stock ones
5044
- * @param {string} [sort] specifies which attribute to sort with
5045
- * @param {boolean} [includeNoVariantProducts]
5046
- * @param {boolean} [isActive]
5047
- * @param {number} [limit]
5048
- * @param {number} [page]
5121
+ * @summary Delete a variant from a product
5122
+ * @param {string} productId Product ID
5123
+ * @param {string} variantId Variant ID
5049
5124
  * @param {*} [options] Override http request option.
5050
5125
  * @throws {RequiredError}
5051
5126
  */
5052
- getAllCategoryProducts: async (categoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options = {}) => {
5053
- if (categoryId === null || categoryId === void 0) {
5054
- throw new RequiredError("categoryId", "Required parameter categoryId was null or undefined when calling getAllCategoryProducts.");
5127
+ deleteVariant: async (productId, variantId, options = {}) => {
5128
+ if (productId === null || productId === void 0) {
5129
+ throw new RequiredError("productId", "Required parameter productId was null or undefined when calling deleteVariant.");
5055
5130
  }
5056
- const localVarPath = `/products/allCategoryProducts/{categoryId}`.replace(`{${"categoryId"}}`, encodeURIComponent(String(categoryId)));
5131
+ if (variantId === null || variantId === void 0) {
5132
+ throw new RequiredError("variantId", "Required parameter variantId was null or undefined when calling deleteVariant.");
5133
+ }
5134
+ const localVarPath = `/products/{productId}/variants/{variantId}`.replace(`{${"productId"}}`, encodeURIComponent(String(productId))).replace(`{${"variantId"}}`, encodeURIComponent(String(variantId)));
5057
5135
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
5058
5136
  let baseOptions;
5059
5137
  if (configuration) {
5060
5138
  baseOptions = configuration.baseOptions;
5061
5139
  }
5062
- const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
5140
+ const localVarRequestOptions = { method: "DELETE", ...baseOptions, ...options };
5063
5141
  const localVarHeaderParameter = {};
5064
5142
  const localVarQueryParameter = {};
5065
5143
  if (configuration && configuration.accessToken) {
@@ -5070,35 +5148,48 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5070
5148
  const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5071
5149
  localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5072
5150
  }
5073
- if (searchTerm !== void 0) {
5074
- localVarQueryParameter["searchTerm"] = searchTerm;
5075
- }
5076
- if (maxPrice !== void 0) {
5077
- localVarQueryParameter["maxPrice"] = maxPrice;
5078
- }
5079
- if (minPrice !== void 0) {
5080
- localVarQueryParameter["minPrice"] = minPrice;
5081
- }
5082
- if (brandFilter !== void 0) {
5083
- localVarQueryParameter["brandFilter"] = brandFilter;
5084
- }
5085
- if (availability !== void 0) {
5086
- localVarQueryParameter["availability"] = availability;
5151
+ const query = new URLSearchParams(localVarUrlObj.search);
5152
+ for (const key in localVarQueryParameter) {
5153
+ query.set(key, localVarQueryParameter[key]);
5087
5154
  }
5088
- if (sort !== void 0) {
5089
- localVarQueryParameter["sort"] = sort;
5155
+ for (const key in options.params) {
5156
+ query.set(key, options.params[key]);
5090
5157
  }
5091
- if (includeNoVariantProducts !== void 0) {
5092
- localVarQueryParameter["includeNoVariantProducts"] = includeNoVariantProducts;
5158
+ localVarUrlObj.search = new URLSearchParams(query).toString();
5159
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
5160
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
5161
+ return {
5162
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
5163
+ options: localVarRequestOptions
5164
+ };
5165
+ },
5166
+ /**
5167
+ *
5168
+ * @summary [DEPRECATED] Use GET /products/all?categoryId=:id instead
5169
+ * @param {string} categoryId
5170
+ * @param {*} [options] Override http request option.
5171
+ * @throws {RequiredError}
5172
+ */
5173
+ getAllCategoryProducts: async (categoryId, options = {}) => {
5174
+ if (categoryId === null || categoryId === void 0) {
5175
+ throw new RequiredError("categoryId", "Required parameter categoryId was null or undefined when calling getAllCategoryProducts.");
5093
5176
  }
5094
- if (isActive !== void 0) {
5095
- localVarQueryParameter["isActive"] = isActive;
5177
+ const localVarPath = `/products/allCategoryProducts/{categoryId}`.replace(`{${"categoryId"}}`, encodeURIComponent(String(categoryId)));
5178
+ const localVarUrlObj = new URL(localVarPath, "https://example.com");
5179
+ let baseOptions;
5180
+ if (configuration) {
5181
+ baseOptions = configuration.baseOptions;
5096
5182
  }
5097
- if (limit !== void 0) {
5098
- localVarQueryParameter["limit"] = limit;
5183
+ const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
5184
+ const localVarHeaderParameter = {};
5185
+ const localVarQueryParameter = {};
5186
+ if (configuration && configuration.accessToken) {
5187
+ const accessToken = typeof configuration.accessToken === "function" ? await configuration.accessToken() : await configuration.accessToken;
5188
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
5099
5189
  }
5100
- if (page !== void 0) {
5101
- localVarQueryParameter["page"] = page;
5190
+ if (configuration && configuration.apiKey) {
5191
+ const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5192
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5102
5193
  }
5103
5194
  const query = new URLSearchParams(localVarUrlObj.search);
5104
5195
  for (const key in localVarQueryParameter) {
@@ -5117,12 +5208,12 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5117
5208
  },
5118
5209
  /**
5119
5210
  *
5120
- * @summary Get all filters for products
5211
+ * @summary Get all available filters (brands, price range)
5121
5212
  * @param {*} [options] Override http request option.
5122
5213
  * @throws {RequiredError}
5123
5214
  */
5124
5215
  getAllFilters: async (options = {}) => {
5125
- const localVarPath = `/products/allFilters`;
5216
+ const localVarPath = `/products/filters`;
5126
5217
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
5127
5218
  let baseOptions;
5128
5219
  if (configuration) {
@@ -5156,26 +5247,23 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5156
5247
  },
5157
5248
  /**
5158
5249
  *
5159
- * @summary Get all products of a specific sub category
5160
- * @param {string} subCategoryId Sub Category ID
5161
- * @param {string} [searchTerm] OpenAI Search Query
5162
- * @param {number} [maxPrice] highest price to filter with
5163
- * @param {number} [minPrice] lowest price to filter with
5164
- * @param {string} [brandFilter] brands to filter with (comma separated string)
5165
- * @param {string} [availability] specifies whether to show available products or out of stock ones
5166
- * @param {string} [sort] specifies which attribute to sort with
5167
- * @param {boolean} [includeNoVariantProducts]
5250
+ * @summary Get all products with filtering and pagination
5251
+ * @param {string} [searchTerm]
5252
+ * @param {number} [maxPrice]
5253
+ * @param {number} [minPrice]
5254
+ * @param {string} [brandFilter] Comma-separated brand names
5255
+ * @param {string} [availability]
5256
+ * @param {string} [sort]
5257
+ * @param {string} [subCategoryId]
5258
+ * @param {string} [categoryId]
5168
5259
  * @param {boolean} [isActive]
5169
5260
  * @param {number} [limit]
5170
5261
  * @param {number} [page]
5171
5262
  * @param {*} [options] Override http request option.
5172
5263
  * @throws {RequiredError}
5173
5264
  */
5174
- getAllProducts: async (subCategoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options = {}) => {
5175
- if (subCategoryId === null || subCategoryId === void 0) {
5176
- throw new RequiredError("subCategoryId", "Required parameter subCategoryId was null or undefined when calling getAllProducts.");
5177
- }
5178
- const localVarPath = `/products/allProducts/{subCategoryId}`.replace(`{${"subCategoryId"}}`, encodeURIComponent(String(subCategoryId)));
5265
+ getAllProducts: async (searchTerm, maxPrice, minPrice, brandFilter, availability, sort, subCategoryId, categoryId, isActive, limit, page, options = {}) => {
5266
+ const localVarPath = `/products/all`;
5179
5267
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
5180
5268
  let baseOptions;
5181
5269
  if (configuration) {
@@ -5210,8 +5298,11 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5210
5298
  if (sort !== void 0) {
5211
5299
  localVarQueryParameter["sort"] = sort;
5212
5300
  }
5213
- if (includeNoVariantProducts !== void 0) {
5214
- localVarQueryParameter["includeNoVariantProducts"] = includeNoVariantProducts;
5301
+ if (subCategoryId !== void 0) {
5302
+ localVarQueryParameter["subCategoryId"] = subCategoryId;
5303
+ }
5304
+ if (categoryId !== void 0) {
5305
+ localVarQueryParameter["categoryId"] = categoryId;
5215
5306
  }
5216
5307
  if (isActive !== void 0) {
5217
5308
  localVarQueryParameter["isActive"] = isActive;
@@ -5239,24 +5330,16 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5239
5330
  },
5240
5331
  /**
5241
5332
  *
5242
- * @summary Get all products
5243
- * @param {string} [searchTerm] OpenAI Search Query
5244
- * @param {string} [productType] Product Type
5245
- * @param {string} [categoryId] Category ID
5246
- * @param {number} [maxPrice] highest price to filter with
5247
- * @param {number} [minPrice] lowest price to filter with
5248
- * @param {string} [brandFilter] brands to filter with (comma separated string)
5249
- * @param {string} [availability] specifies whether to show available products or out of stock ones
5250
- * @param {string} [sort] specifies which attribute to sort with
5251
- * @param {boolean} [includeNoVariantProducts]
5252
- * @param {boolean} [isActive]
5253
- * @param {number} [limit]
5254
- * @param {number} [page]
5333
+ * @summary [DEPRECATED] Use GET /products/all?subCategoryId=:id instead
5334
+ * @param {string} subCategoryId
5255
5335
  * @param {*} [options] Override http request option.
5256
5336
  * @throws {RequiredError}
5257
5337
  */
5258
- getAllProductsForStore: async (searchTerm, productType, categoryId, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options = {}) => {
5259
- const localVarPath = `/products/all`;
5338
+ getAllProductsBySubCategory: async (subCategoryId, options = {}) => {
5339
+ if (subCategoryId === null || subCategoryId === void 0) {
5340
+ throw new RequiredError("subCategoryId", "Required parameter subCategoryId was null or undefined when calling getAllProductsBySubCategory.");
5341
+ }
5342
+ const localVarPath = `/products/allProducts/{subCategoryId}`.replace(`{${"subCategoryId"}}`, encodeURIComponent(String(subCategoryId)));
5260
5343
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
5261
5344
  let baseOptions;
5262
5345
  if (configuration) {
@@ -5273,42 +5356,6 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5273
5356
  const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5274
5357
  localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5275
5358
  }
5276
- if (searchTerm !== void 0) {
5277
- localVarQueryParameter["searchTerm"] = searchTerm;
5278
- }
5279
- if (productType !== void 0) {
5280
- localVarQueryParameter["productType"] = productType;
5281
- }
5282
- if (categoryId !== void 0) {
5283
- localVarQueryParameter["categoryId"] = categoryId;
5284
- }
5285
- if (maxPrice !== void 0) {
5286
- localVarQueryParameter["maxPrice"] = maxPrice;
5287
- }
5288
- if (minPrice !== void 0) {
5289
- localVarQueryParameter["minPrice"] = minPrice;
5290
- }
5291
- if (brandFilter !== void 0) {
5292
- localVarQueryParameter["brandFilter"] = brandFilter;
5293
- }
5294
- if (availability !== void 0) {
5295
- localVarQueryParameter["availability"] = availability;
5296
- }
5297
- if (sort !== void 0) {
5298
- localVarQueryParameter["sort"] = sort;
5299
- }
5300
- if (includeNoVariantProducts !== void 0) {
5301
- localVarQueryParameter["includeNoVariantProducts"] = includeNoVariantProducts;
5302
- }
5303
- if (isActive !== void 0) {
5304
- localVarQueryParameter["isActive"] = isActive;
5305
- }
5306
- if (limit !== void 0) {
5307
- localVarQueryParameter["limit"] = limit;
5308
- }
5309
- if (page !== void 0) {
5310
- localVarQueryParameter["page"] = page;
5311
- }
5312
5359
  const query = new URLSearchParams(localVarUrlObj.search);
5313
5360
  for (const key in localVarQueryParameter) {
5314
5361
  query.set(key, localVarQueryParameter[key]);
@@ -5365,7 +5412,7 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5365
5412
  },
5366
5413
  /**
5367
5414
  *
5368
- * @summary Get insights on store Products
5415
+ * @summary Get product insights for the store
5369
5416
  * @param {*} [options] Override http request option.
5370
5417
  * @throws {RequiredError}
5371
5418
  */
@@ -5405,15 +5452,16 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5405
5452
  /**
5406
5453
  *
5407
5454
  * @summary Get related products
5408
- * @param {string} productId Product ID
5455
+ * @param {string} id Product ID
5456
+ * @param {number} [limit]
5409
5457
  * @param {*} [options] Override http request option.
5410
5458
  * @throws {RequiredError}
5411
5459
  */
5412
- getRelatedProducts: async (productId, options = {}) => {
5413
- if (productId === null || productId === void 0) {
5414
- throw new RequiredError("productId", "Required parameter productId was null or undefined when calling getRelatedProducts.");
5460
+ getRelatedProducts: async (id, limit, options = {}) => {
5461
+ if (id === null || id === void 0) {
5462
+ throw new RequiredError("id", "Required parameter id was null or undefined when calling getRelatedProducts.");
5415
5463
  }
5416
- const localVarPath = `/products/relatedProducts/{productId}`.replace(`{${"productId"}}`, encodeURIComponent(String(productId)));
5464
+ const localVarPath = `/products/{id}/related`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
5417
5465
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
5418
5466
  let baseOptions;
5419
5467
  if (configuration) {
@@ -5430,6 +5478,9 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5430
5478
  const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5431
5479
  localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5432
5480
  }
5481
+ if (limit !== void 0) {
5482
+ localVarQueryParameter["limit"] = limit;
5483
+ }
5433
5484
  const query = new URLSearchParams(localVarUrlObj.search);
5434
5485
  for (const key in localVarQueryParameter) {
5435
5486
  query.set(key, localVarQueryParameter[key]);
@@ -5447,16 +5498,16 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5447
5498
  },
5448
5499
  /**
5449
5500
  *
5450
- * @summary Get a single product
5451
- * @param {string} id Product ID
5501
+ * @summary [DEPRECATED] Use GET /products/:id/related instead
5502
+ * @param {string} productId
5452
5503
  * @param {*} [options] Override http request option.
5453
5504
  * @throws {RequiredError}
5454
5505
  */
5455
- getSingleProduct: async (id, options = {}) => {
5456
- if (id === null || id === void 0) {
5457
- throw new RequiredError("id", "Required parameter id was null or undefined when calling getSingleProduct.");
5506
+ getRelatedProductsLegacy: async (productId, options = {}) => {
5507
+ if (productId === null || productId === void 0) {
5508
+ throw new RequiredError("productId", "Required parameter productId was null or undefined when calling getRelatedProductsLegacy.");
5458
5509
  }
5459
- const localVarPath = `/products/singleProduct/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
5510
+ const localVarPath = `/products/relatedProducts/{productId}`.replace(`{${"productId"}}`, encodeURIComponent(String(productId)));
5460
5511
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
5461
5512
  let baseOptions;
5462
5513
  if (configuration) {
@@ -5490,16 +5541,16 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5490
5541
  },
5491
5542
  /**
5492
5543
  *
5493
- * @summary Get top selling products
5494
- * @param {number} [limit]
5495
- * @param {number} [page]
5496
- * @param {boolean} [isActive]
5497
- * @param {boolean} [includeNoVariantProducts]
5544
+ * @summary Get a single product with all details
5545
+ * @param {string} id Product ID
5498
5546
  * @param {*} [options] Override http request option.
5499
5547
  * @throws {RequiredError}
5500
5548
  */
5501
- getTopSellingProducts: async (limit, page, isActive, includeNoVariantProducts, options = {}) => {
5502
- const localVarPath = `/products/top-selling`;
5549
+ getSingleProduct: async (id, options = {}) => {
5550
+ if (id === null || id === void 0) {
5551
+ throw new RequiredError("id", "Required parameter id was null or undefined when calling getSingleProduct.");
5552
+ }
5553
+ const localVarPath = `/products/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
5503
5554
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
5504
5555
  let baseOptions;
5505
5556
  if (configuration) {
@@ -5516,18 +5567,6 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5516
5567
  const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5517
5568
  localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5518
5569
  }
5519
- if (limit !== void 0) {
5520
- localVarQueryParameter["limit"] = limit;
5521
- }
5522
- if (page !== void 0) {
5523
- localVarQueryParameter["page"] = page;
5524
- }
5525
- if (isActive !== void 0) {
5526
- localVarQueryParameter["isActive"] = isActive;
5527
- }
5528
- if (includeNoVariantProducts !== void 0) {
5529
- localVarQueryParameter["includeNoVariantProducts"] = includeNoVariantProducts;
5530
- }
5531
5570
  const query = new URLSearchParams(localVarUrlObj.search);
5532
5571
  for (const key in localVarQueryParameter) {
5533
5572
  query.set(key, localVarQueryParameter[key]);
@@ -5545,26 +5584,22 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5545
5584
  },
5546
5585
  /**
5547
5586
  *
5548
- * @summary Update a product
5549
- * @param {UpdateProductDto} body
5587
+ * @summary [DEPRECATED] Use GET /products/:id instead
5550
5588
  * @param {string} id Product ID
5551
5589
  * @param {*} [options] Override http request option.
5552
5590
  * @throws {RequiredError}
5553
5591
  */
5554
- updateProduct: async (body, id, options = {}) => {
5555
- if (body === null || body === void 0) {
5556
- throw new RequiredError("body", "Required parameter body was null or undefined when calling updateProduct.");
5557
- }
5592
+ getSingleProductLegacy: async (id, options = {}) => {
5558
5593
  if (id === null || id === void 0) {
5559
- throw new RequiredError("id", "Required parameter id was null or undefined when calling updateProduct.");
5594
+ throw new RequiredError("id", "Required parameter id was null or undefined when calling getSingleProductLegacy.");
5560
5595
  }
5561
- const localVarPath = `/products/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
5596
+ const localVarPath = `/products/singleProduct/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
5562
5597
  const localVarUrlObj = new URL(localVarPath, "https://example.com");
5563
5598
  let baseOptions;
5564
5599
  if (configuration) {
5565
5600
  baseOptions = configuration.baseOptions;
5566
5601
  }
5567
- const localVarRequestOptions = { method: "PATCH", ...baseOptions, ...options };
5602
+ const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
5568
5603
  const localVarHeaderParameter = {};
5569
5604
  const localVarQueryParameter = {};
5570
5605
  if (configuration && configuration.accessToken) {
@@ -5575,7 +5610,6 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5575
5610
  const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5576
5611
  localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5577
5612
  }
5578
- localVarHeaderParameter["Content-Type"] = "application/json";
5579
5613
  const query = new URLSearchParams(localVarUrlObj.search);
5580
5614
  for (const key in localVarQueryParameter) {
5581
5615
  query.set(key, localVarQueryParameter[key]);
@@ -5586,141 +5620,353 @@ var ProductsApiAxiosParamCreator = function(configuration) {
5586
5620
  localVarUrlObj.search = new URLSearchParams(query).toString();
5587
5621
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
5588
5622
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
5589
- const needsSerialization = typeof body !== "string" || (localVarRequestOptions.headers || (localVarRequestOptions.headers = {}))["Content-Type"] === "application/json";
5590
- localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== void 0 ? body : {}) : body || "";
5591
5623
  return {
5592
5624
  url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
5593
5625
  options: localVarRequestOptions
5594
5626
  };
5595
- }
5596
- };
5597
- };
5598
- var ProductsApiFp = function(configuration) {
5599
- return {
5600
- /**
5601
- *
5602
- * @summary Create a product
5603
- * @param {CreateProductDto} body
5604
- * @param {*} [options] Override http request option.
5605
- * @throws {RequiredError}
5606
- */
5607
- async createProduct(body, options) {
5608
- const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).createProduct(body, options);
5609
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
5610
- const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5611
- return axios.request(axiosRequestArgs);
5612
- };
5613
5627
  },
5614
5628
  /**
5615
5629
  *
5616
- * @summary Create a Product that has a single variant
5617
- * @param {CreateSingleVariantProductDTO} body
5630
+ * @summary Get top selling products
5631
+ * @param {number} [limit]
5632
+ * @param {number} [page]
5618
5633
  * @param {*} [options] Override http request option.
5619
5634
  * @throws {RequiredError}
5620
5635
  */
5621
- async createSingleVariantProduct(body, options) {
5622
- const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).createSingleVariantProduct(body, options);
5623
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
5636
+ getTopSellingProducts: async (limit, page, options = {}) => {
5637
+ const localVarPath = `/products/top-selling`;
5638
+ const localVarUrlObj = new URL(localVarPath, "https://example.com");
5639
+ let baseOptions;
5640
+ if (configuration) {
5641
+ baseOptions = configuration.baseOptions;
5642
+ }
5643
+ const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
5644
+ const localVarHeaderParameter = {};
5645
+ const localVarQueryParameter = {};
5646
+ if (configuration && configuration.accessToken) {
5647
+ const accessToken = typeof configuration.accessToken === "function" ? await configuration.accessToken() : await configuration.accessToken;
5648
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
5649
+ }
5650
+ if (configuration && configuration.apiKey) {
5651
+ const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5652
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5653
+ }
5654
+ if (limit !== void 0) {
5655
+ localVarQueryParameter["limit"] = limit;
5656
+ }
5657
+ if (page !== void 0) {
5658
+ localVarQueryParameter["page"] = page;
5659
+ }
5660
+ const query = new URLSearchParams(localVarUrlObj.search);
5661
+ for (const key in localVarQueryParameter) {
5662
+ query.set(key, localVarQueryParameter[key]);
5663
+ }
5664
+ for (const key in options.params) {
5665
+ query.set(key, options.params[key]);
5666
+ }
5667
+ localVarUrlObj.search = new URLSearchParams(query).toString();
5668
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
5669
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
5670
+ return {
5671
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
5672
+ options: localVarRequestOptions
5673
+ };
5674
+ },
5675
+ /**
5676
+ *
5677
+ * @summary Update variant inventory (add or subtract)
5678
+ * @param {VariantIdInventoryBody} body
5679
+ * @param {string} productId Product ID
5680
+ * @param {string} variantId Variant ID
5681
+ * @param {*} [options] Override http request option.
5682
+ * @throws {RequiredError}
5683
+ */
5684
+ updateInventory: async (body, productId, variantId, options = {}) => {
5685
+ if (body === null || body === void 0) {
5686
+ throw new RequiredError("body", "Required parameter body was null or undefined when calling updateInventory.");
5687
+ }
5688
+ if (productId === null || productId === void 0) {
5689
+ throw new RequiredError("productId", "Required parameter productId was null or undefined when calling updateInventory.");
5690
+ }
5691
+ if (variantId === null || variantId === void 0) {
5692
+ throw new RequiredError("variantId", "Required parameter variantId was null or undefined when calling updateInventory.");
5693
+ }
5694
+ const localVarPath = `/products/{productId}/variants/{variantId}/inventory`.replace(`{${"productId"}}`, encodeURIComponent(String(productId))).replace(`{${"variantId"}}`, encodeURIComponent(String(variantId)));
5695
+ const localVarUrlObj = new URL(localVarPath, "https://example.com");
5696
+ let baseOptions;
5697
+ if (configuration) {
5698
+ baseOptions = configuration.baseOptions;
5699
+ }
5700
+ const localVarRequestOptions = { method: "PATCH", ...baseOptions, ...options };
5701
+ const localVarHeaderParameter = {};
5702
+ const localVarQueryParameter = {};
5703
+ if (configuration && configuration.accessToken) {
5704
+ const accessToken = typeof configuration.accessToken === "function" ? await configuration.accessToken() : await configuration.accessToken;
5705
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
5706
+ }
5707
+ if (configuration && configuration.apiKey) {
5708
+ const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5709
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5710
+ }
5711
+ localVarHeaderParameter["Content-Type"] = "application/json";
5712
+ const query = new URLSearchParams(localVarUrlObj.search);
5713
+ for (const key in localVarQueryParameter) {
5714
+ query.set(key, localVarQueryParameter[key]);
5715
+ }
5716
+ for (const key in options.params) {
5717
+ query.set(key, options.params[key]);
5718
+ }
5719
+ localVarUrlObj.search = new URLSearchParams(query).toString();
5720
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
5721
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
5722
+ const needsSerialization = typeof body !== "string" || (localVarRequestOptions.headers || (localVarRequestOptions.headers = {}))["Content-Type"] === "application/json";
5723
+ localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== void 0 ? body : {}) : body || "";
5724
+ return {
5725
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
5726
+ options: localVarRequestOptions
5727
+ };
5728
+ },
5729
+ /**
5730
+ *
5731
+ * @summary Update a product (not variants)
5732
+ * @param {UpdateProductDto} body
5733
+ * @param {string} id Product ID
5734
+ * @param {*} [options] Override http request option.
5735
+ * @throws {RequiredError}
5736
+ */
5737
+ updateProduct: async (body, id, options = {}) => {
5738
+ if (body === null || body === void 0) {
5739
+ throw new RequiredError("body", "Required parameter body was null or undefined when calling updateProduct.");
5740
+ }
5741
+ if (id === null || id === void 0) {
5742
+ throw new RequiredError("id", "Required parameter id was null or undefined when calling updateProduct.");
5743
+ }
5744
+ const localVarPath = `/products/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
5745
+ const localVarUrlObj = new URL(localVarPath, "https://example.com");
5746
+ let baseOptions;
5747
+ if (configuration) {
5748
+ baseOptions = configuration.baseOptions;
5749
+ }
5750
+ const localVarRequestOptions = { method: "PATCH", ...baseOptions, ...options };
5751
+ const localVarHeaderParameter = {};
5752
+ const localVarQueryParameter = {};
5753
+ if (configuration && configuration.accessToken) {
5754
+ const accessToken = typeof configuration.accessToken === "function" ? await configuration.accessToken() : await configuration.accessToken;
5755
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
5756
+ }
5757
+ if (configuration && configuration.apiKey) {
5758
+ const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5759
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5760
+ }
5761
+ localVarHeaderParameter["Content-Type"] = "application/json";
5762
+ const query = new URLSearchParams(localVarUrlObj.search);
5763
+ for (const key in localVarQueryParameter) {
5764
+ query.set(key, localVarQueryParameter[key]);
5765
+ }
5766
+ for (const key in options.params) {
5767
+ query.set(key, options.params[key]);
5768
+ }
5769
+ localVarUrlObj.search = new URLSearchParams(query).toString();
5770
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
5771
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
5772
+ const needsSerialization = typeof body !== "string" || (localVarRequestOptions.headers || (localVarRequestOptions.headers = {}))["Content-Type"] === "application/json";
5773
+ localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== void 0 ? body : {}) : body || "";
5774
+ return {
5775
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
5776
+ options: localVarRequestOptions
5777
+ };
5778
+ },
5779
+ /**
5780
+ *
5781
+ * @summary Update a variant
5782
+ * @param {UpdateVariantDto} body
5783
+ * @param {string} productId Product ID
5784
+ * @param {string} variantId Variant ID
5785
+ * @param {*} [options] Override http request option.
5786
+ * @throws {RequiredError}
5787
+ */
5788
+ updateVariant: async (body, productId, variantId, options = {}) => {
5789
+ if (body === null || body === void 0) {
5790
+ throw new RequiredError("body", "Required parameter body was null or undefined when calling updateVariant.");
5791
+ }
5792
+ if (productId === null || productId === void 0) {
5793
+ throw new RequiredError("productId", "Required parameter productId was null or undefined when calling updateVariant.");
5794
+ }
5795
+ if (variantId === null || variantId === void 0) {
5796
+ throw new RequiredError("variantId", "Required parameter variantId was null or undefined when calling updateVariant.");
5797
+ }
5798
+ const localVarPath = `/products/{productId}/variants/{variantId}`.replace(`{${"productId"}}`, encodeURIComponent(String(productId))).replace(`{${"variantId"}}`, encodeURIComponent(String(variantId)));
5799
+ const localVarUrlObj = new URL(localVarPath, "https://example.com");
5800
+ let baseOptions;
5801
+ if (configuration) {
5802
+ baseOptions = configuration.baseOptions;
5803
+ }
5804
+ const localVarRequestOptions = { method: "PATCH", ...baseOptions, ...options };
5805
+ const localVarHeaderParameter = {};
5806
+ const localVarQueryParameter = {};
5807
+ if (configuration && configuration.accessToken) {
5808
+ const accessToken = typeof configuration.accessToken === "function" ? await configuration.accessToken() : await configuration.accessToken;
5809
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
5810
+ }
5811
+ if (configuration && configuration.apiKey) {
5812
+ const localVarApiKeyValue = typeof configuration.apiKey === "function" ? await configuration.apiKey("x-store-key") : await configuration.apiKey;
5813
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
5814
+ }
5815
+ localVarHeaderParameter["Content-Type"] = "application/json";
5816
+ const query = new URLSearchParams(localVarUrlObj.search);
5817
+ for (const key in localVarQueryParameter) {
5818
+ query.set(key, localVarQueryParameter[key]);
5819
+ }
5820
+ for (const key in options.params) {
5821
+ query.set(key, options.params[key]);
5822
+ }
5823
+ localVarUrlObj.search = new URLSearchParams(query).toString();
5824
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
5825
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
5826
+ const needsSerialization = typeof body !== "string" || (localVarRequestOptions.headers || (localVarRequestOptions.headers = {}))["Content-Type"] === "application/json";
5827
+ localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== void 0 ? body : {}) : body || "";
5828
+ return {
5829
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
5830
+ options: localVarRequestOptions
5831
+ };
5832
+ }
5833
+ };
5834
+ };
5835
+ var ProductsApiFp = function(configuration) {
5836
+ return {
5837
+ /**
5838
+ *
5839
+ * @summary Add a new variant to a product
5840
+ * @param {CreateVariantDto} body
5841
+ * @param {string} productId Product ID
5842
+ * @param {*} [options] Override http request option.
5843
+ * @throws {RequiredError}
5844
+ */
5845
+ async addVariant(body, productId, options) {
5846
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).addVariant(body, productId, options);
5847
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
5624
5848
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5625
5849
  return axios.request(axiosRequestArgs);
5626
5850
  };
5627
5851
  },
5628
5852
  /**
5629
5853
  *
5630
- * @summary Delete a product
5631
- * @param {string} id
5854
+ * @summary Create a new product with variants
5855
+ * @param {CreateProductDto} body
5856
+ * @param {*} [options] Override http request option.
5857
+ * @throws {RequiredError}
5858
+ */
5859
+ async createProduct(body, options) {
5860
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).createProduct(body, options);
5861
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
5862
+ const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5863
+ return axios.request(axiosRequestArgs);
5864
+ };
5865
+ },
5866
+ /**
5867
+ *
5868
+ * @summary [DEPRECATED] Use POST /products instead
5869
+ * @param {CreateProductDto} body
5870
+ * @param {*} [options] Override http request option.
5871
+ * @throws {RequiredError}
5872
+ */
5873
+ async createProductLegacy(body, options) {
5874
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).createProductLegacy(body, options);
5875
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
5876
+ const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5877
+ return axios.request(axiosRequestArgs);
5878
+ };
5879
+ },
5880
+ /**
5881
+ *
5882
+ * @summary Delete a product and all its variants
5883
+ * @param {string} id Product ID
5632
5884
  * @param {*} [options] Override http request option.
5633
5885
  * @throws {RequiredError}
5634
5886
  */
5635
5887
  async deleteProduct(id, options) {
5636
5888
  const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).deleteProduct(id, options);
5637
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
5889
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
5638
5890
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5639
5891
  return axios.request(axiosRequestArgs);
5640
5892
  };
5641
5893
  },
5642
5894
  /**
5643
5895
  *
5644
- * @summary Get all products of a specific category
5645
- * @param {string} categoryId Category ID
5646
- * @param {string} [searchTerm] OpenAI Search Query
5647
- * @param {number} [maxPrice] highest price to filter with
5648
- * @param {number} [minPrice] lowest price to filter with
5649
- * @param {string} [brandFilter] brands to filter with (comma separated string)
5650
- * @param {string} [availability] specifies whether to show available products or out of stock ones
5651
- * @param {string} [sort] specifies which attribute to sort with
5652
- * @param {boolean} [includeNoVariantProducts]
5653
- * @param {boolean} [isActive]
5654
- * @param {number} [limit]
5655
- * @param {number} [page]
5896
+ * @summary Delete a variant from a product
5897
+ * @param {string} productId Product ID
5898
+ * @param {string} variantId Variant ID
5899
+ * @param {*} [options] Override http request option.
5900
+ * @throws {RequiredError}
5901
+ */
5902
+ async deleteVariant(productId, variantId, options) {
5903
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).deleteVariant(productId, variantId, options);
5904
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
5905
+ const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5906
+ return axios.request(axiosRequestArgs);
5907
+ };
5908
+ },
5909
+ /**
5910
+ *
5911
+ * @summary [DEPRECATED] Use GET /products/all?categoryId=:id instead
5912
+ * @param {string} categoryId
5656
5913
  * @param {*} [options] Override http request option.
5657
5914
  * @throws {RequiredError}
5658
5915
  */
5659
- async getAllCategoryProducts(categoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options) {
5660
- const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getAllCategoryProducts(categoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options);
5661
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
5916
+ async getAllCategoryProducts(categoryId, options) {
5917
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getAllCategoryProducts(categoryId, options);
5918
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
5662
5919
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5663
5920
  return axios.request(axiosRequestArgs);
5664
5921
  };
5665
5922
  },
5666
5923
  /**
5667
5924
  *
5668
- * @summary Get all filters for products
5925
+ * @summary Get all available filters (brands, price range)
5669
5926
  * @param {*} [options] Override http request option.
5670
5927
  * @throws {RequiredError}
5671
5928
  */
5672
5929
  async getAllFilters(options) {
5673
5930
  const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getAllFilters(options);
5674
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
5931
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
5675
5932
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5676
5933
  return axios.request(axiosRequestArgs);
5677
5934
  };
5678
5935
  },
5679
5936
  /**
5680
5937
  *
5681
- * @summary Get all products of a specific sub category
5682
- * @param {string} subCategoryId Sub Category ID
5683
- * @param {string} [searchTerm] OpenAI Search Query
5684
- * @param {number} [maxPrice] highest price to filter with
5685
- * @param {number} [minPrice] lowest price to filter with
5686
- * @param {string} [brandFilter] brands to filter with (comma separated string)
5687
- * @param {string} [availability] specifies whether to show available products or out of stock ones
5688
- * @param {string} [sort] specifies which attribute to sort with
5689
- * @param {boolean} [includeNoVariantProducts]
5938
+ * @summary Get all products with filtering and pagination
5939
+ * @param {string} [searchTerm]
5940
+ * @param {number} [maxPrice]
5941
+ * @param {number} [minPrice]
5942
+ * @param {string} [brandFilter] Comma-separated brand names
5943
+ * @param {string} [availability]
5944
+ * @param {string} [sort]
5945
+ * @param {string} [subCategoryId]
5946
+ * @param {string} [categoryId]
5690
5947
  * @param {boolean} [isActive]
5691
5948
  * @param {number} [limit]
5692
5949
  * @param {number} [page]
5693
5950
  * @param {*} [options] Override http request option.
5694
5951
  * @throws {RequiredError}
5695
5952
  */
5696
- async getAllProducts(subCategoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options) {
5697
- const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getAllProducts(subCategoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options);
5698
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
5953
+ async getAllProducts(searchTerm, maxPrice, minPrice, brandFilter, availability, sort, subCategoryId, categoryId, isActive, limit, page, options) {
5954
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getAllProducts(searchTerm, maxPrice, minPrice, brandFilter, availability, sort, subCategoryId, categoryId, isActive, limit, page, options);
5955
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
5699
5956
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5700
5957
  return axios.request(axiosRequestArgs);
5701
5958
  };
5702
5959
  },
5703
5960
  /**
5704
5961
  *
5705
- * @summary Get all products
5706
- * @param {string} [searchTerm] OpenAI Search Query
5707
- * @param {string} [productType] Product Type
5708
- * @param {string} [categoryId] Category ID
5709
- * @param {number} [maxPrice] highest price to filter with
5710
- * @param {number} [minPrice] lowest price to filter with
5711
- * @param {string} [brandFilter] brands to filter with (comma separated string)
5712
- * @param {string} [availability] specifies whether to show available products or out of stock ones
5713
- * @param {string} [sort] specifies which attribute to sort with
5714
- * @param {boolean} [includeNoVariantProducts]
5715
- * @param {boolean} [isActive]
5716
- * @param {number} [limit]
5717
- * @param {number} [page]
5962
+ * @summary [DEPRECATED] Use GET /products/all?subCategoryId=:id instead
5963
+ * @param {string} subCategoryId
5718
5964
  * @param {*} [options] Override http request option.
5719
5965
  * @throws {RequiredError}
5720
5966
  */
5721
- async getAllProductsForStore(searchTerm, productType, categoryId, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options) {
5722
- const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getAllProductsForStore(searchTerm, productType, categoryId, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options);
5723
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
5967
+ async getAllProductsBySubCategory(subCategoryId, options) {
5968
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getAllProductsBySubCategory(subCategoryId, options);
5969
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
5724
5970
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5725
5971
  return axios.request(axiosRequestArgs);
5726
5972
  };
@@ -5733,20 +5979,20 @@ var ProductsApiFp = function(configuration) {
5733
5979
  */
5734
5980
  async getFeaturedProduct(options) {
5735
5981
  const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getFeaturedProduct(options);
5736
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
5982
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
5737
5983
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5738
5984
  return axios.request(axiosRequestArgs);
5739
5985
  };
5740
5986
  },
5741
5987
  /**
5742
5988
  *
5743
- * @summary Get insights on store Products
5989
+ * @summary Get product insights for the store
5744
5990
  * @param {*} [options] Override http request option.
5745
5991
  * @throws {RequiredError}
5746
5992
  */
5747
5993
  async getProductsInsights(options) {
5748
5994
  const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getProductsInsights(options);
5749
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
5995
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
5750
5996
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5751
5997
  return axios.request(axiosRequestArgs);
5752
5998
  };
@@ -5754,27 +6000,56 @@ var ProductsApiFp = function(configuration) {
5754
6000
  /**
5755
6001
  *
5756
6002
  * @summary Get related products
5757
- * @param {string} productId Product ID
6003
+ * @param {string} id Product ID
6004
+ * @param {number} [limit]
6005
+ * @param {*} [options] Override http request option.
6006
+ * @throws {RequiredError}
6007
+ */
6008
+ async getRelatedProducts(id, limit, options) {
6009
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getRelatedProducts(id, limit, options);
6010
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
6011
+ const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6012
+ return axios.request(axiosRequestArgs);
6013
+ };
6014
+ },
6015
+ /**
6016
+ *
6017
+ * @summary [DEPRECATED] Use GET /products/:id/related instead
6018
+ * @param {string} productId
5758
6019
  * @param {*} [options] Override http request option.
5759
6020
  * @throws {RequiredError}
5760
6021
  */
5761
- async getRelatedProducts(productId, options) {
5762
- const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getRelatedProducts(productId, options);
5763
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
6022
+ async getRelatedProductsLegacy(productId, options) {
6023
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getRelatedProductsLegacy(productId, options);
6024
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
5764
6025
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5765
6026
  return axios.request(axiosRequestArgs);
5766
6027
  };
5767
6028
  },
5768
6029
  /**
5769
6030
  *
5770
- * @summary Get a single product
6031
+ * @summary Get a single product with all details
5771
6032
  * @param {string} id Product ID
5772
6033
  * @param {*} [options] Override http request option.
5773
6034
  * @throws {RequiredError}
5774
6035
  */
5775
6036
  async getSingleProduct(id, options) {
5776
6037
  const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getSingleProduct(id, options);
5777
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
6038
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
6039
+ const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6040
+ return axios.request(axiosRequestArgs);
6041
+ };
6042
+ },
6043
+ /**
6044
+ *
6045
+ * @summary [DEPRECATED] Use GET /products/:id instead
6046
+ * @param {string} id Product ID
6047
+ * @param {*} [options] Override http request option.
6048
+ * @throws {RequiredError}
6049
+ */
6050
+ async getSingleProductLegacy(id, options) {
6051
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getSingleProductLegacy(id, options);
6052
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
5778
6053
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5779
6054
  return axios.request(axiosRequestArgs);
5780
6055
  };
@@ -5784,29 +6059,59 @@ var ProductsApiFp = function(configuration) {
5784
6059
  * @summary Get top selling products
5785
6060
  * @param {number} [limit]
5786
6061
  * @param {number} [page]
5787
- * @param {boolean} [isActive]
5788
- * @param {boolean} [includeNoVariantProducts]
5789
6062
  * @param {*} [options] Override http request option.
5790
6063
  * @throws {RequiredError}
5791
6064
  */
5792
- async getTopSellingProducts(limit, page, isActive, includeNoVariantProducts, options) {
5793
- const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getTopSellingProducts(limit, page, isActive, includeNoVariantProducts, options);
5794
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
6065
+ async getTopSellingProducts(limit, page, options) {
6066
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getTopSellingProducts(limit, page, options);
6067
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
5795
6068
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5796
6069
  return axios.request(axiosRequestArgs);
5797
6070
  };
5798
6071
  },
5799
6072
  /**
5800
6073
  *
5801
- * @summary Update a product
5802
- * @param {UpdateProductDto} body
5803
- * @param {string} id Product ID
6074
+ * @summary Update variant inventory (add or subtract)
6075
+ * @param {VariantIdInventoryBody} body
6076
+ * @param {string} productId Product ID
6077
+ * @param {string} variantId Variant ID
5804
6078
  * @param {*} [options] Override http request option.
5805
6079
  * @throws {RequiredError}
5806
6080
  */
5807
- async updateProduct(body, id, options) {
5808
- const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).updateProduct(body, id, options);
5809
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
6081
+ async updateInventory(body, productId, variantId, options) {
6082
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).updateInventory(body, productId, variantId, options);
6083
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
6084
+ const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6085
+ return axios.request(axiosRequestArgs);
6086
+ };
6087
+ },
6088
+ /**
6089
+ *
6090
+ * @summary Update a product (not variants)
6091
+ * @param {UpdateProductDto} body
6092
+ * @param {string} id Product ID
6093
+ * @param {*} [options] Override http request option.
6094
+ * @throws {RequiredError}
6095
+ */
6096
+ async updateProduct(body, id, options) {
6097
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).updateProduct(body, id, options);
6098
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
6099
+ const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6100
+ return axios.request(axiosRequestArgs);
6101
+ };
6102
+ },
6103
+ /**
6104
+ *
6105
+ * @summary Update a variant
6106
+ * @param {UpdateVariantDto} body
6107
+ * @param {string} productId Product ID
6108
+ * @param {string} variantId Variant ID
6109
+ * @param {*} [options] Override http request option.
6110
+ * @throws {RequiredError}
6111
+ */
6112
+ async updateVariant(body, productId, variantId, options) {
6113
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).updateVariant(body, productId, variantId, options);
6114
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
5810
6115
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
5811
6116
  return axios.request(axiosRequestArgs);
5812
6117
  };
@@ -5816,7 +6121,19 @@ var ProductsApiFp = function(configuration) {
5816
6121
  var ProductsApi = class extends BaseAPI {
5817
6122
  /**
5818
6123
  *
5819
- * @summary Create a product
6124
+ * @summary Add a new variant to a product
6125
+ * @param {CreateVariantDto} body
6126
+ * @param {string} productId Product ID
6127
+ * @param {*} [options] Override http request option.
6128
+ * @throws {RequiredError}
6129
+ * @memberof ProductsApi
6130
+ */
6131
+ async addVariant(body, productId, options) {
6132
+ return ProductsApiFp(this.configuration).addVariant(body, productId, options).then((request) => request(this.axios, this.basePath));
6133
+ }
6134
+ /**
6135
+ *
6136
+ * @summary Create a new product with variants
5820
6137
  * @param {CreateProductDto} body
5821
6138
  * @param {*} [options] Override http request option.
5822
6139
  * @throws {RequiredError}
@@ -5827,19 +6144,19 @@ var ProductsApi = class extends BaseAPI {
5827
6144
  }
5828
6145
  /**
5829
6146
  *
5830
- * @summary Create a Product that has a single variant
5831
- * @param {CreateSingleVariantProductDTO} body
6147
+ * @summary [DEPRECATED] Use POST /products instead
6148
+ * @param {CreateProductDto} body
5832
6149
  * @param {*} [options] Override http request option.
5833
6150
  * @throws {RequiredError}
5834
6151
  * @memberof ProductsApi
5835
6152
  */
5836
- async createSingleVariantProduct(body, options) {
5837
- return ProductsApiFp(this.configuration).createSingleVariantProduct(body, options).then((request) => request(this.axios, this.basePath));
6153
+ async createProductLegacy(body, options) {
6154
+ return ProductsApiFp(this.configuration).createProductLegacy(body, options).then((request) => request(this.axios, this.basePath));
5838
6155
  }
5839
6156
  /**
5840
6157
  *
5841
- * @summary Delete a product
5842
- * @param {string} id
6158
+ * @summary Delete a product and all its variants
6159
+ * @param {string} id Product ID
5843
6160
  * @param {*} [options] Override http request option.
5844
6161
  * @throws {RequiredError}
5845
6162
  * @memberof ProductsApi
@@ -5849,28 +6166,30 @@ var ProductsApi = class extends BaseAPI {
5849
6166
  }
5850
6167
  /**
5851
6168
  *
5852
- * @summary Get all products of a specific category
5853
- * @param {string} categoryId Category ID
5854
- * @param {string} [searchTerm] OpenAI Search Query
5855
- * @param {number} [maxPrice] highest price to filter with
5856
- * @param {number} [minPrice] lowest price to filter with
5857
- * @param {string} [brandFilter] brands to filter with (comma separated string)
5858
- * @param {string} [availability] specifies whether to show available products or out of stock ones
5859
- * @param {string} [sort] specifies which attribute to sort with
5860
- * @param {boolean} [includeNoVariantProducts]
5861
- * @param {boolean} [isActive]
5862
- * @param {number} [limit]
5863
- * @param {number} [page]
6169
+ * @summary Delete a variant from a product
6170
+ * @param {string} productId Product ID
6171
+ * @param {string} variantId Variant ID
6172
+ * @param {*} [options] Override http request option.
6173
+ * @throws {RequiredError}
6174
+ * @memberof ProductsApi
6175
+ */
6176
+ async deleteVariant(productId, variantId, options) {
6177
+ return ProductsApiFp(this.configuration).deleteVariant(productId, variantId, options).then((request) => request(this.axios, this.basePath));
6178
+ }
6179
+ /**
6180
+ *
6181
+ * @summary [DEPRECATED] Use GET /products/all?categoryId=:id instead
6182
+ * @param {string} categoryId
5864
6183
  * @param {*} [options] Override http request option.
5865
6184
  * @throws {RequiredError}
5866
6185
  * @memberof ProductsApi
5867
6186
  */
5868
- async getAllCategoryProducts(categoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options) {
5869
- return ProductsApiFp(this.configuration).getAllCategoryProducts(categoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options).then((request) => request(this.axios, this.basePath));
6187
+ async getAllCategoryProducts(categoryId, options) {
6188
+ return ProductsApiFp(this.configuration).getAllCategoryProducts(categoryId, options).then((request) => request(this.axios, this.basePath));
5870
6189
  }
5871
6190
  /**
5872
6191
  *
5873
- * @summary Get all filters for products
6192
+ * @summary Get all available filters (brands, price range)
5874
6193
  * @param {*} [options] Override http request option.
5875
6194
  * @throws {RequiredError}
5876
6195
  * @memberof ProductsApi
@@ -5880,15 +6199,15 @@ var ProductsApi = class extends BaseAPI {
5880
6199
  }
5881
6200
  /**
5882
6201
  *
5883
- * @summary Get all products of a specific sub category
5884
- * @param {string} subCategoryId Sub Category ID
5885
- * @param {string} [searchTerm] OpenAI Search Query
5886
- * @param {number} [maxPrice] highest price to filter with
5887
- * @param {number} [minPrice] lowest price to filter with
5888
- * @param {string} [brandFilter] brands to filter with (comma separated string)
5889
- * @param {string} [availability] specifies whether to show available products or out of stock ones
5890
- * @param {string} [sort] specifies which attribute to sort with
5891
- * @param {boolean} [includeNoVariantProducts]
6202
+ * @summary Get all products with filtering and pagination
6203
+ * @param {string} [searchTerm]
6204
+ * @param {number} [maxPrice]
6205
+ * @param {number} [minPrice]
6206
+ * @param {string} [brandFilter] Comma-separated brand names
6207
+ * @param {string} [availability]
6208
+ * @param {string} [sort]
6209
+ * @param {string} [subCategoryId]
6210
+ * @param {string} [categoryId]
5892
6211
  * @param {boolean} [isActive]
5893
6212
  * @param {number} [limit]
5894
6213
  * @param {number} [page]
@@ -5896,30 +6215,19 @@ var ProductsApi = class extends BaseAPI {
5896
6215
  * @throws {RequiredError}
5897
6216
  * @memberof ProductsApi
5898
6217
  */
5899
- async getAllProducts(subCategoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options) {
5900
- return ProductsApiFp(this.configuration).getAllProducts(subCategoryId, searchTerm, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options).then((request) => request(this.axios, this.basePath));
6218
+ async getAllProducts(searchTerm, maxPrice, minPrice, brandFilter, availability, sort, subCategoryId, categoryId, isActive, limit, page, options) {
6219
+ return ProductsApiFp(this.configuration).getAllProducts(searchTerm, maxPrice, minPrice, brandFilter, availability, sort, subCategoryId, categoryId, isActive, limit, page, options).then((request) => request(this.axios, this.basePath));
5901
6220
  }
5902
6221
  /**
5903
6222
  *
5904
- * @summary Get all products
5905
- * @param {string} [searchTerm] OpenAI Search Query
5906
- * @param {string} [productType] Product Type
5907
- * @param {string} [categoryId] Category ID
5908
- * @param {number} [maxPrice] highest price to filter with
5909
- * @param {number} [minPrice] lowest price to filter with
5910
- * @param {string} [brandFilter] brands to filter with (comma separated string)
5911
- * @param {string} [availability] specifies whether to show available products or out of stock ones
5912
- * @param {string} [sort] specifies which attribute to sort with
5913
- * @param {boolean} [includeNoVariantProducts]
5914
- * @param {boolean} [isActive]
5915
- * @param {number} [limit]
5916
- * @param {number} [page]
6223
+ * @summary [DEPRECATED] Use GET /products/all?subCategoryId=:id instead
6224
+ * @param {string} subCategoryId
5917
6225
  * @param {*} [options] Override http request option.
5918
6226
  * @throws {RequiredError}
5919
6227
  * @memberof ProductsApi
5920
6228
  */
5921
- async getAllProductsForStore(searchTerm, productType, categoryId, maxPrice, minPrice, brandFilter, availability, sort, includeNoVariantProducts, isActive, limit, page, options) {
5922
- 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));
6229
+ async getAllProductsBySubCategory(subCategoryId, options) {
6230
+ return ProductsApiFp(this.configuration).getAllProductsBySubCategory(subCategoryId, options).then((request) => request(this.axios, this.basePath));
5923
6231
  }
5924
6232
  /**
5925
6233
  *
@@ -5933,7 +6241,7 @@ var ProductsApi = class extends BaseAPI {
5933
6241
  }
5934
6242
  /**
5935
6243
  *
5936
- * @summary Get insights on store Products
6244
+ * @summary Get product insights for the store
5937
6245
  * @param {*} [options] Override http request option.
5938
6246
  * @throws {RequiredError}
5939
6247
  * @memberof ProductsApi
@@ -5944,17 +6252,29 @@ var ProductsApi = class extends BaseAPI {
5944
6252
  /**
5945
6253
  *
5946
6254
  * @summary Get related products
5947
- * @param {string} productId Product ID
6255
+ * @param {string} id Product ID
6256
+ * @param {number} [limit]
6257
+ * @param {*} [options] Override http request option.
6258
+ * @throws {RequiredError}
6259
+ * @memberof ProductsApi
6260
+ */
6261
+ async getRelatedProducts(id, limit, options) {
6262
+ return ProductsApiFp(this.configuration).getRelatedProducts(id, limit, options).then((request) => request(this.axios, this.basePath));
6263
+ }
6264
+ /**
6265
+ *
6266
+ * @summary [DEPRECATED] Use GET /products/:id/related instead
6267
+ * @param {string} productId
5948
6268
  * @param {*} [options] Override http request option.
5949
6269
  * @throws {RequiredError}
5950
6270
  * @memberof ProductsApi
5951
6271
  */
5952
- async getRelatedProducts(productId, options) {
5953
- return ProductsApiFp(this.configuration).getRelatedProducts(productId, options).then((request) => request(this.axios, this.basePath));
6272
+ async getRelatedProductsLegacy(productId, options) {
6273
+ return ProductsApiFp(this.configuration).getRelatedProductsLegacy(productId, options).then((request) => request(this.axios, this.basePath));
5954
6274
  }
5955
6275
  /**
5956
6276
  *
5957
- * @summary Get a single product
6277
+ * @summary Get a single product with all details
5958
6278
  * @param {string} id Product ID
5959
6279
  * @param {*} [options] Override http request option.
5960
6280
  * @throws {RequiredError}
@@ -5963,23 +6283,45 @@ var ProductsApi = class extends BaseAPI {
5963
6283
  async getSingleProduct(id, options) {
5964
6284
  return ProductsApiFp(this.configuration).getSingleProduct(id, options).then((request) => request(this.axios, this.basePath));
5965
6285
  }
6286
+ /**
6287
+ *
6288
+ * @summary [DEPRECATED] Use GET /products/:id instead
6289
+ * @param {string} id Product ID
6290
+ * @param {*} [options] Override http request option.
6291
+ * @throws {RequiredError}
6292
+ * @memberof ProductsApi
6293
+ */
6294
+ async getSingleProductLegacy(id, options) {
6295
+ return ProductsApiFp(this.configuration).getSingleProductLegacy(id, options).then((request) => request(this.axios, this.basePath));
6296
+ }
5966
6297
  /**
5967
6298
  *
5968
6299
  * @summary Get top selling products
5969
6300
  * @param {number} [limit]
5970
6301
  * @param {number} [page]
5971
- * @param {boolean} [isActive]
5972
- * @param {boolean} [includeNoVariantProducts]
5973
6302
  * @param {*} [options] Override http request option.
5974
6303
  * @throws {RequiredError}
5975
6304
  * @memberof ProductsApi
5976
6305
  */
5977
- async getTopSellingProducts(limit, page, isActive, includeNoVariantProducts, options) {
5978
- return ProductsApiFp(this.configuration).getTopSellingProducts(limit, page, isActive, includeNoVariantProducts, options).then((request) => request(this.axios, this.basePath));
6306
+ async getTopSellingProducts(limit, page, options) {
6307
+ return ProductsApiFp(this.configuration).getTopSellingProducts(limit, page, options).then((request) => request(this.axios, this.basePath));
6308
+ }
6309
+ /**
6310
+ *
6311
+ * @summary Update variant inventory (add or subtract)
6312
+ * @param {VariantIdInventoryBody} body
6313
+ * @param {string} productId Product ID
6314
+ * @param {string} variantId Variant ID
6315
+ * @param {*} [options] Override http request option.
6316
+ * @throws {RequiredError}
6317
+ * @memberof ProductsApi
6318
+ */
6319
+ async updateInventory(body, productId, variantId, options) {
6320
+ return ProductsApiFp(this.configuration).updateInventory(body, productId, variantId, options).then((request) => request(this.axios, this.basePath));
5979
6321
  }
5980
6322
  /**
5981
6323
  *
5982
- * @summary Update a product
6324
+ * @summary Update a product (not variants)
5983
6325
  * @param {UpdateProductDto} body
5984
6326
  * @param {string} id Product ID
5985
6327
  * @param {*} [options] Override http request option.
@@ -5989,6 +6331,19 @@ var ProductsApi = class extends BaseAPI {
5989
6331
  async updateProduct(body, id, options) {
5990
6332
  return ProductsApiFp(this.configuration).updateProduct(body, id, options).then((request) => request(this.axios, this.basePath));
5991
6333
  }
6334
+ /**
6335
+ *
6336
+ * @summary Update a variant
6337
+ * @param {UpdateVariantDto} body
6338
+ * @param {string} productId Product ID
6339
+ * @param {string} variantId Variant ID
6340
+ * @param {*} [options] Override http request option.
6341
+ * @throws {RequiredError}
6342
+ * @memberof ProductsApi
6343
+ */
6344
+ async updateVariant(body, productId, variantId, options) {
6345
+ return ProductsApiFp(this.configuration).updateVariant(body, productId, variantId, options).then((request) => request(this.axios, this.basePath));
6346
+ }
5992
6347
  };
5993
6348
  var ShippingApiAxiosParamCreator = function(configuration) {
5994
6349
  return {
@@ -6214,7 +6569,7 @@ var ShippingApiFp = function(configuration) {
6214
6569
  */
6215
6570
  async getAllShipments(options) {
6216
6571
  const localVarAxiosArgs = await ShippingApiAxiosParamCreator(configuration).getAllShipments(options);
6217
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
6572
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
6218
6573
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6219
6574
  return axios.request(axiosRequestArgs);
6220
6575
  };
@@ -6227,7 +6582,7 @@ var ShippingApiFp = function(configuration) {
6227
6582
  */
6228
6583
  async getAllUserShipments(options) {
6229
6584
  const localVarAxiosArgs = await ShippingApiAxiosParamCreator(configuration).getAllUserShipments(options);
6230
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
6585
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
6231
6586
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6232
6587
  return axios.request(axiosRequestArgs);
6233
6588
  };
@@ -6241,7 +6596,7 @@ var ShippingApiFp = function(configuration) {
6241
6596
  */
6242
6597
  async getOrderShipment(orderId, options) {
6243
6598
  const localVarAxiosArgs = await ShippingApiAxiosParamCreator(configuration).getOrderShipment(orderId, options);
6244
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
6599
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
6245
6600
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6246
6601
  return axios.request(axiosRequestArgs);
6247
6602
  };
@@ -6256,7 +6611,7 @@ var ShippingApiFp = function(configuration) {
6256
6611
  */
6257
6612
  async getShippingRates(body, addressId, options) {
6258
6613
  const localVarAxiosArgs = await ShippingApiAxiosParamCreator(configuration).getShippingRates(body, addressId, options);
6259
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
6614
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
6260
6615
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6261
6616
  return axios.request(axiosRequestArgs);
6262
6617
  };
@@ -6269,7 +6624,7 @@ var ShippingApiFp = function(configuration) {
6269
6624
  */
6270
6625
  async getStoreAddress(options) {
6271
6626
  const localVarAxiosArgs = await ShippingApiAxiosParamCreator(configuration).getStoreAddress(options);
6272
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
6627
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
6273
6628
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6274
6629
  return axios.request(axiosRequestArgs);
6275
6630
  };
@@ -6529,7 +6884,7 @@ var WishlistApiFp = function(configuration) {
6529
6884
  */
6530
6885
  async addToWishlist(productId, options) {
6531
6886
  const localVarAxiosArgs = await WishlistApiAxiosParamCreator(configuration).addToWishlist(productId, options);
6532
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
6887
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
6533
6888
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6534
6889
  return axios.request(axiosRequestArgs);
6535
6890
  };
@@ -6542,7 +6897,7 @@ var WishlistApiFp = function(configuration) {
6542
6897
  */
6543
6898
  async clearWishlist(options) {
6544
6899
  const localVarAxiosArgs = await WishlistApiAxiosParamCreator(configuration).clearWishlist(options);
6545
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
6900
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
6546
6901
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6547
6902
  return axios.request(axiosRequestArgs);
6548
6903
  };
@@ -6555,7 +6910,7 @@ var WishlistApiFp = function(configuration) {
6555
6910
  */
6556
6911
  async getWishlist(options) {
6557
6912
  const localVarAxiosArgs = await WishlistApiAxiosParamCreator(configuration).getWishlist(options);
6558
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
6913
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
6559
6914
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6560
6915
  return axios.request(axiosRequestArgs);
6561
6916
  };
@@ -6568,7 +6923,7 @@ var WishlistApiFp = function(configuration) {
6568
6923
  */
6569
6924
  async getWishlistItemCount(options) {
6570
6925
  const localVarAxiosArgs = await WishlistApiAxiosParamCreator(configuration).getWishlistItemCount(options);
6571
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
6926
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
6572
6927
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6573
6928
  return axios.request(axiosRequestArgs);
6574
6929
  };
@@ -6582,7 +6937,7 @@ var WishlistApiFp = function(configuration) {
6582
6937
  */
6583
6938
  async removeFromWishlist(productId, options) {
6584
6939
  const localVarAxiosArgs = await WishlistApiAxiosParamCreator(configuration).removeFromWishlist(productId, options);
6585
- return (axios = globalAxios4__default.default, basePath = BASE_PATH) => {
6940
+ return (axios = globalAxios18__default.default, basePath = BASE_PATH) => {
6586
6941
  const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
6587
6942
  return axios.request(axiosRequestArgs);
6588
6943
  };
@@ -7031,7 +7386,7 @@ init_config();
7031
7386
  init_config();
7032
7387
  init_sharedConfig();
7033
7388
  init_sharedConfig();
7034
- globalAxios4__default.default.interceptors.request.use(async (config) => {
7389
+ globalAxios18__default.default.interceptors.request.use(async (config) => {
7035
7390
  if (!config?.headers) {
7036
7391
  throw new Error(
7037
7392
  `Expected 'config' and 'config.headers' not to be undefined`
@@ -7234,38 +7589,6 @@ function EcommerceProvider({ config, children, withToaster = true, basePath = ""
7234
7589
  );
7235
7590
  return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client, children: /* @__PURE__ */ jsxRuntime.jsx(ThemeProvider, { config, children: /* @__PURE__ */ jsxRuntime.jsx(BasePathProvider, { basePath, children: /* @__PURE__ */ jsxRuntime.jsx(AuthProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(NotificationProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(CartProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(WishlistProvider, { children }) }) }) }) }) }) });
7236
7591
  }
7237
-
7238
- // src/lib/utils/format.ts
7239
- function formatPrice(price, currency = "USD") {
7240
- return new Intl.NumberFormat("en-US", {
7241
- style: "currency",
7242
- currency
7243
- }).format(price);
7244
- }
7245
- function formatDate(date, format = "short") {
7246
- const d = typeof date === "string" ? new Date(date) : date;
7247
- if (format === "long") {
7248
- return new Intl.DateTimeFormat("en-US", {
7249
- year: "numeric",
7250
- month: "long",
7251
- day: "numeric",
7252
- hour: "2-digit",
7253
- minute: "2-digit"
7254
- }).format(d);
7255
- }
7256
- return new Intl.DateTimeFormat("en-US", {
7257
- year: "numeric",
7258
- month: "short",
7259
- day: "numeric"
7260
- }).format(d);
7261
- }
7262
- function truncate(text, maxLength) {
7263
- if (text.length <= maxLength) return text;
7264
- return text.slice(0, maxLength) + "...";
7265
- }
7266
- function getInitials(firstName, lastName) {
7267
- return `${firstName?.charAt(0)}${lastName?.charAt(0)}`.toUpperCase();
7268
- }
7269
7592
  function QuickViewModal({ product, onClose, onNavigateToProduct }) {
7270
7593
  const [selectedVariantIndex, setSelectedVariantIndex] = React8.useState(0);
7271
7594
  const [selectedSizeIndex, setSelectedSizeIndex] = React8.useState(0);
@@ -7280,8 +7603,8 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
7280
7603
  setQuantity(newQuantity);
7281
7604
  }
7282
7605
  };
7283
- const selectedVariant = product.productVariants[selectedVariantIndex];
7284
- selectedVariant.productMedia[selectedSizeIndex];
7606
+ const selectedVariant = product.variants[selectedVariantIndex];
7607
+ selectedVariant.media[selectedSizeIndex];
7285
7608
  const displayPrice = selectedVariant.finalPrice;
7286
7609
  const displayOriginalPrice = selectedVariant.retailPrice;
7287
7610
  const isDiscounted = selectedVariant.isDiscounted;
@@ -7323,24 +7646,20 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
7323
7646
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-8", children: [
7324
7647
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between mb-6", children: [
7325
7648
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
7326
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "font-['Poppins',sans-serif] text-[11px] text-primary uppercase tracking-wide font-medium mb-2", children: [
7327
- product.brand,
7328
- " \u2022 ",
7329
- product.parentCategories?.[0]?.name || "Uncategorized"
7330
- ] }),
7649
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-['Poppins',sans-serif] text-[11px] text-primary uppercase tracking-wide font-medium mb-2", children: product.brand }),
7331
7650
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-['Poppins',sans-serif] font-semibold text-secondary tracking-[-1px]", children: displayName }),
7332
7651
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mt-2", children: [
7333
7652
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-0.5", children: [...Array(5)].map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
7334
7653
  lucideReact.Star,
7335
7654
  {
7336
- className: `size-4 ${i < Math.floor(product.rating ? product.rating : 0) ? "text-accent fill-accent" : "text-gray-300"}`
7655
+ className: `size-4 ${i < Math.floor(product.summary?.averageRating || 0) ? "text-accent fill-accent" : "text-gray-300"}`
7337
7656
  },
7338
7657
  i
7339
7658
  )) }),
7340
7659
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-['Poppins',sans-serif] text-[13px] text-muted", children: [
7341
- product.rating,
7660
+ product.summary?.averageRating || 0,
7342
7661
  " (",
7343
- product.reviews ? product.reviews.length : 0,
7662
+ product.summary?.reviewCount || 0,
7344
7663
  " reviews)"
7345
7664
  ] })
7346
7665
  ] })
@@ -7360,7 +7679,7 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
7360
7679
  /* @__PURE__ */ jsxRuntime.jsx(
7361
7680
  "img",
7362
7681
  {
7363
- src: selectedVariant.productMedia[selectedImageIndex]?.file || selectedVariant.productMedia[0]?.file,
7682
+ src: selectedVariant.media[selectedImageIndex]?.file || selectedVariant.media[0]?.file,
7364
7683
  alt: product.name,
7365
7684
  className: "w-full h-full object-contain"
7366
7685
  }
@@ -7371,7 +7690,7 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
7371
7690
  "%"
7372
7691
  ] }) }) })
7373
7692
  ] }),
7374
- selectedVariant.productMedia.length > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-4 gap-3", children: selectedVariant.productMedia.map((image, index) => /* @__PURE__ */ jsxRuntime.jsx(
7693
+ selectedVariant.media.length > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-4 gap-3", children: selectedVariant.media.map((image, index) => /* @__PURE__ */ jsxRuntime.jsx(
7375
7694
  "div",
7376
7695
  {
7377
7696
  className: `aspect-square rounded-xl overflow-hidden cursor-pointer transition-opacity ${selectedImageIndex === index ? "ring-2 ring-primary" : "bg-gray-50 hover:opacity-75"}`,
@@ -7418,9 +7737,9 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
7418
7737
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6", children: [
7419
7738
  /* @__PURE__ */ jsxRuntime.jsxs("h3", { className: "font-['Poppins',sans-serif] font-semibold text-[13px] text-secondary mb-3", children: [
7420
7739
  "Selected Variant: ",
7421
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-normal text-muted", children: product.productVariants[selectedVariantIndex].name })
7740
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-normal text-muted", children: product.variants[selectedVariantIndex].name })
7422
7741
  ] }),
7423
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-3", children: product.productVariants.map((variant, index) => /* @__PURE__ */ jsxRuntime.jsx(
7742
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-3", children: product.variants.map((variant, index) => /* @__PURE__ */ jsxRuntime.jsx(
7424
7743
  "button",
7425
7744
  {
7426
7745
  onClick: () => {
@@ -7434,7 +7753,7 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
7434
7753
  children: /* @__PURE__ */ jsxRuntime.jsx(
7435
7754
  Image4__default.default,
7436
7755
  {
7437
- src: variant.productMedia?.[0]?.file || "",
7756
+ src: variant.media?.[0]?.file || "",
7438
7757
  alt: variant.color || `Variant ${index + 1}`,
7439
7758
  className: "object-cover",
7440
7759
  height: 32,
@@ -7492,7 +7811,7 @@ function QuickViewModal({ product, onClose, onNavigateToProduct }) {
7492
7811
  ] })
7493
7812
  }
7494
7813
  ),
7495
- /* @__PURE__ */ jsxRuntime.jsx(Link7__default.default, { href: `/products/${product._id}`, children: /* @__PURE__ */ jsxRuntime.jsxs(
7814
+ /* @__PURE__ */ jsxRuntime.jsx(Link9__default.default, { href: `/products/${product._id}`, children: /* @__PURE__ */ jsxRuntime.jsxs(
7496
7815
  "button",
7497
7816
  {
7498
7817
  onClick: () => {
@@ -7522,7 +7841,8 @@ function ProductCard({
7522
7841
  showFavoriteButton = true,
7523
7842
  className
7524
7843
  }) {
7525
- navigation.useRouter();
7844
+ const router = navigation.useRouter();
7845
+ const { isAuthenticated } = useAuth();
7526
7846
  const { buildPath } = useBasePath();
7527
7847
  const [isFavorite, setIsFavorite] = React8.useState(isFavorited);
7528
7848
  const { addToWishlist, removeFromWishlist, isInWishlist } = useWishlist();
@@ -7549,14 +7869,14 @@ function ProductCard({
7549
7869
  setSelectedVariantImage(null);
7550
7870
  setSelectedVariantId(null);
7551
7871
  setIsImageLoaded(false);
7552
- if (product.productVariants && product.productVariants.length > 0) {
7553
- const firstVariant = product.productVariants[0];
7554
- if (firstVariant.productMedia && firstVariant.productMedia.length > 0) {
7555
- setSelectedVariantImage(firstVariant.productMedia[0].file);
7872
+ if (product.variants && product.variants.length > 0) {
7873
+ const firstVariant = product.variants[0];
7874
+ if (firstVariant.media && firstVariant.media.length > 0) {
7875
+ setSelectedVariantImage(firstVariant.media[0].file);
7556
7876
  setSelectedVariantId(firstVariant.id || firstVariant._id || null);
7557
7877
  }
7558
7878
  }
7559
- }, [product._id, product.productVariants]);
7879
+ }, [product._id, product.variants]);
7560
7880
  const handleKeyDown = (e) => {
7561
7881
  if (e.key === "Enter" || e.key === " ") {
7562
7882
  e.preventDefault();
@@ -7564,46 +7884,43 @@ function ProductCard({
7564
7884
  }
7565
7885
  };
7566
7886
  const variantImages = React8.useMemo(() => {
7567
- if (!product.productVariants || product.productVariants.length === 0) {
7887
+ if (!product.variants || product.variants.length === 0) {
7568
7888
  return [];
7569
7889
  }
7570
- return product.productVariants.filter((variant) => variant.productMedia && variant.productMedia.length > 0).map((variant) => ({
7890
+ return product.variants.filter((variant) => variant.media && variant.media.length > 0).map((variant) => ({
7571
7891
  variantId: variant.id || variant._id,
7572
7892
  variantName: variant.name,
7573
- image: variant.productMedia[0].file
7893
+ image: variant.media[0].file
7574
7894
  }));
7575
- }, [product.productVariants]);
7895
+ }, [product.variants]);
7576
7896
  const selectedVariant = React8.useMemo(() => {
7577
- if (!selectedVariantId || !product.productVariants) return null;
7578
- return product.productVariants.find(
7897
+ if (!selectedVariantId || !product.variants) return null;
7898
+ return product.variants.find(
7579
7899
  (variant) => (variant.id || variant._id) === selectedVariantId
7580
7900
  );
7581
- }, [selectedVariantId, product.productVariants]);
7582
- const displayName = React8.useMemo(() => {
7583
- return selectedVariant?.name || product.name;
7584
- }, [selectedVariant, product.name]);
7901
+ }, [selectedVariantId, product.variants]);
7585
7902
  const displayFinalPrice = React8.useMemo(() => {
7586
- return selectedVariant?.finalPrice ?? product.finalPrice;
7587
- }, [selectedVariant, product.finalPrice]);
7903
+ return selectedVariant?.finalPrice ?? product.variants?.[0]?.finalPrice ?? 0;
7904
+ }, [selectedVariant, product.variants]);
7588
7905
  const displayPriceBeforeDiscount = React8.useMemo(() => {
7589
- return selectedVariant?.retailPrice ?? product.priceBeforeDiscount;
7590
- }, [selectedVariant, product.priceBeforeDiscount]);
7906
+ return selectedVariant?.retailPrice ?? product.variants?.[0]?.retailPrice ?? 0;
7907
+ }, [selectedVariant, product.variants]);
7591
7908
  const displayIsDiscounted = React8.useMemo(() => {
7592
- return selectedVariant ? selectedVariant.isDiscounted : product.isDiscounted;
7593
- }, [selectedVariant, product.isDiscounted]);
7909
+ return selectedVariant ? selectedVariant.isDiscounted : product.variants?.[0]?.isDiscounted;
7910
+ }, [selectedVariant, product.variants]);
7594
7911
  const displayDiscountAmount = React8.useMemo(() => {
7595
- return selectedVariant ? selectedVariant.discountAmount : product.discountAmount;
7596
- }, [selectedVariant, product.discountAmount]);
7912
+ return selectedVariant ? selectedVariant.discountAmount : product.variants?.[0]?.discountAmount;
7913
+ }, [selectedVariant, product.variants]);
7597
7914
  const displayInventoryCount = React8.useMemo(() => {
7598
- return selectedVariant ? selectedVariant.inventoryCount : product.inventoryCount;
7599
- }, [selectedVariant, product.inventoryCount]);
7915
+ return selectedVariant ? selectedVariant.inventoryCount : product.variants?.[0]?.inventoryCount;
7916
+ }, [selectedVariant, product.variants]);
7600
7917
  const imageSource = React8.useMemo(() => {
7601
- const src = selectedVariantImage || product.productMedia?.[0]?.file || "/placeholder-product.jpg";
7918
+ const src = selectedVariantImage || selectedVariant?.media?.[0]?.file || product.media?.[0]?.file || "/placeholder-product.jpg";
7602
7919
  return {
7603
7920
  src,
7604
7921
  alt: product.name || "Product image"
7605
7922
  };
7606
- }, [product.productMedia, product.name, selectedVariantImage]);
7923
+ }, [product.media, product.name, selectedVariantImage]);
7607
7924
  React8.useEffect(() => {
7608
7925
  setIsImageLoaded(false);
7609
7926
  }, [imageSource.src]);
@@ -7664,18 +7981,21 @@ function ProductCard({
7664
7981
  "%"
7665
7982
  ] }) }) }),
7666
7983
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-1", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-['Poppins',sans-serif] text-xs text-[#5B9BD5] uppercase tracking-wide font-medium", children: product.brand }) }),
7667
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-[40px] mb-3", children: /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] line-clamp-2", children: displayName }) }),
7668
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 mb-2", children: [
7984
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-[40px] mb-3", children: [
7985
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] line-clamp-2", children: product.name }),
7986
+ selectedVariant && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-['Poppins',sans-serif] text-[#676c80]", children: selectedVariant.name })
7987
+ ] }),
7988
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 ", children: [
7669
7989
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-0.5", children: [...Array(5)].map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
7670
7990
  lucideReact.Star,
7671
7991
  {
7672
- className: `size-4 ${i < Math.floor(product.rating ? product.rating : 0) ? "text-[#E67E50] fill-[#E67E50]" : "text-gray-300"}`
7992
+ className: `size-4 ${i < Math.floor(product.summary?.averageRating || 0) ? "text-[#E67E50] fill-[#E67E50]" : "text-gray-300"}`
7673
7993
  },
7674
7994
  i
7675
7995
  )) }),
7676
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-['Poppins',sans-serif] text-[10px] text-[#676c80]", children: [
7996
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-['Poppins',sans-serif] text-[10px] text-[#676c80] mt-4", children: [
7677
7997
  "(",
7678
- product.reviews?.length || 0,
7998
+ product.summary?.reviewCount || 0,
7679
7999
  ")"
7680
8000
  ] })
7681
8001
  ] }),
@@ -7686,7 +8006,7 @@ function ProductCard({
7686
8006
  ] }),
7687
8007
  displayIsDiscounted && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-['Poppins',sans-serif] text-sm text-[#676c80] line-through", children: [
7688
8008
  "$",
7689
- formatPrice(displayPriceBeforeDiscount)
8009
+ displayPriceBeforeDiscount.toFixed(2)
7690
8010
  ] })
7691
8011
  ] }),
7692
8012
  variantImages.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1.5 mb-3", children: variantImages.map((variant, index) => /* @__PURE__ */ jsxRuntime.jsx(
@@ -7733,6 +8053,21 @@ function ProductCard({
7733
8053
  );
7734
8054
  return;
7735
8055
  }
8056
+ if (displayInventoryCount === 0) {
8057
+ notification.error(
8058
+ "Out of Stock",
8059
+ "This item is currently out of stock."
8060
+ );
8061
+ return;
8062
+ }
8063
+ if (!isAuthenticated) {
8064
+ notification.error(
8065
+ "Sign-in required",
8066
+ "Please sign in to add items to your cart."
8067
+ );
8068
+ router.push(buildPath(`/login?redirect=${encodeURIComponent(window.location.pathname + window.location.search)}`));
8069
+ return;
8070
+ }
7736
8071
  try {
7737
8072
  await addToCart(
7738
8073
  product._id || product.id,
@@ -7880,81 +8215,75 @@ var Input = React8.forwardRef(
7880
8215
  );
7881
8216
  Input.displayName = "Input";
7882
8217
  function useProducts(filters, page = 1, limit = 20) {
7883
- const [products, setProducts] = React8.useState([]);
7884
- const [isLoading, setIsLoading] = React8.useState(true);
7885
- const [error, setError] = React8.useState(null);
7886
- const [pagination, setPagination] = React8.useState({
7887
- page: 1,
7888
- limit: 20,
7889
- total: 0,
7890
- totalPages: 0
7891
- });
7892
- const fetchProducts = React8.useCallback(async () => {
7893
- setIsLoading(true);
7894
- setError(null);
7895
- try {
7896
- let response;
7897
- if (filters?.subCategory) {
7898
- response = await new ProductsApi(AXIOS_CONFIG).getAllProducts(
7899
- filters.subCategory,
7900
- filters?.search,
7901
- filters?.maxPrice,
7902
- filters?.minPrice,
7903
- void 0,
7904
- // brandFilter
7905
- filters?.inStock !== void 0 ? filters.inStock ? "in-stock" : "out-of-stock" : void 0,
7906
- void 0,
7907
- // sort
7908
- true,
7909
- // includeNoVariantProducts
7910
- true,
7911
- // isActive
7912
- limit,
7913
- page
7914
- );
7915
- } else {
7916
- response = await new ProductsApi(AXIOS_CONFIG).getAllProductsForStore(
7917
- filters?.search,
7918
- void 0,
7919
- // productType
7920
- filters?.category,
7921
- filters?.maxPrice,
7922
- filters?.minPrice,
7923
- void 0,
7924
- // brandFilter
7925
- filters?.inStock !== void 0 ? filters.inStock ? "in-stock" : "out-of-stock" : void 0,
7926
- void 0,
7927
- // sort
7928
- true,
7929
- // includeNoVariantProducts
7930
- true,
7931
- // isActive
7932
- limit,
7933
- page
7934
- );
7935
- }
7936
- setProducts(response.data.data);
7937
- setPagination({
7938
- page: response.data.currentPage || page,
7939
- limit: response.data.limit || limit,
7940
- total: products.length,
7941
- // Use filtered count
7942
- totalPages: Math.ceil(products.length / limit)
7943
- });
7944
- } catch (err) {
7945
- setError(err);
8218
+ const { data, isLoading, error, refetch } = reactQuery.useQuery({
8219
+ queryKey: [
8220
+ "products",
8221
+ filters?.search,
8222
+ filters?.category,
8223
+ filters?.subCategory,
8224
+ filters?.maxPrice,
8225
+ filters?.minPrice,
8226
+ filters?.inStock,
8227
+ page,
8228
+ limit
8229
+ ],
8230
+ queryFn: async () => {
8231
+ const response = await new ProductsApi(AXIOS_CONFIG).getAllProducts(
8232
+ filters?.search ?? "",
8233
+ // searchTerm
8234
+ filters?.maxPrice,
8235
+ // maxPrice
8236
+ filters?.minPrice,
8237
+ // minPrice
8238
+ void 0,
8239
+ // brandFilter
8240
+ filters?.inStock !== void 0 ? filters.inStock ? "in-stock" : "out-of-stock" : void 0,
8241
+ // availability
8242
+ "createdAt",
8243
+ // sort
8244
+ filters?.subCategory,
8245
+ // subCategoryId
8246
+ filters?.category,
8247
+ // categoryId
8248
+ true,
8249
+ // isActive
8250
+ limit,
8251
+ // limit
8252
+ page
8253
+ // page
8254
+ );
8255
+ const res = response.data;
8256
+ console.log("Products API response:", res);
8257
+ return {
8258
+ products: res.data || [],
8259
+ pagination: {
8260
+ page: res.currentPage || page,
8261
+ limit: res.limit || limit,
8262
+ total: res.totalItems || 0,
8263
+ totalPages: res.totalPages || 0
8264
+ }
8265
+ };
7946
8266
  }
7947
- setIsLoading(false);
7948
- }, [filters, page, limit]);
7949
- React8.useEffect(() => {
7950
- fetchProducts();
7951
- }, [fetchProducts]);
7952
- return { products, isLoading, error, pagination };
8267
+ });
8268
+ console.log("useProducts data:", data);
8269
+ return {
8270
+ products: data?.products || [],
8271
+ isLoading,
8272
+ error,
8273
+ pagination: data?.pagination || {
8274
+ page: 1,
8275
+ limit: 20,
8276
+ total: 0,
8277
+ totalPages: 0
8278
+ },
8279
+ refetch
8280
+ };
7953
8281
  }
7954
8282
  function useProduct(id) {
7955
8283
  const [product, setProduct] = React8.useState(null);
7956
8284
  const [isLoading, setIsLoading] = React8.useState(true);
7957
8285
  const [error, setError] = React8.useState(null);
8286
+ console.log("product", product);
7958
8287
  React8.useEffect(() => {
7959
8288
  const fetchProduct = async () => {
7960
8289
  setIsLoading(true);
@@ -7992,6 +8321,38 @@ function useCategories() {
7992
8321
  }, []);
7993
8322
  return { categories, isLoading, error };
7994
8323
  }
8324
+
8325
+ // src/lib/utils/format.ts
8326
+ function formatPrice(price, currency = "USD") {
8327
+ return new Intl.NumberFormat("en-US", {
8328
+ style: "currency",
8329
+ currency
8330
+ }).format(price);
8331
+ }
8332
+ function formatDate(date, format = "short") {
8333
+ const d = typeof date === "string" ? new Date(date) : date;
8334
+ if (format === "long") {
8335
+ return new Intl.DateTimeFormat("en-US", {
8336
+ year: "numeric",
8337
+ month: "long",
8338
+ day: "numeric",
8339
+ hour: "2-digit",
8340
+ minute: "2-digit"
8341
+ }).format(d);
8342
+ }
8343
+ return new Intl.DateTimeFormat("en-US", {
8344
+ year: "numeric",
8345
+ month: "short",
8346
+ day: "numeric"
8347
+ }).format(d);
8348
+ }
8349
+ function truncate(text, maxLength) {
8350
+ if (text.length <= maxLength) return text;
8351
+ return text.slice(0, maxLength) + "...";
8352
+ }
8353
+ function getInitials(firstName, lastName) {
8354
+ return `${firstName?.charAt(0)}${lastName?.charAt(0)}`.toUpperCase();
8355
+ }
7995
8356
  function ShopScreen({ initialFilters = {}, categoryName }) {
7996
8357
  const router = navigation.useRouter();
7997
8358
  const { buildPath } = useBasePath();
@@ -8016,19 +8377,23 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8016
8377
  const { categories, isLoading: isLoadingCategories } = useCategories();
8017
8378
  const handleSearch = (e) => {
8018
8379
  e.preventDefault();
8019
- if (searchQuery.trim()) {
8380
+ const sanitized = searchQuery.trim().replace(/\s+/g, " ");
8381
+ if (sanitized) {
8020
8382
  setIsSearching(true);
8021
- router.push(buildPath(`/search?q=${encodeURIComponent(searchQuery.trim())}`));
8383
+ router.push(buildPath(`/search?q=${encodeURIComponent(sanitized)}`));
8022
8384
  }
8023
8385
  };
8024
8386
  const handleInputChange = (e) => {
8025
8387
  setSearchQuery(e.target.value);
8026
8388
  };
8027
8389
  const handleKeyDown = (e) => {
8028
- if (e.key === "Enter" && searchQuery.trim()) {
8390
+ if (e.key === "Enter") {
8029
8391
  e.preventDefault();
8030
- setIsSearching(true);
8031
- router.push(buildPath(`/search?q=${encodeURIComponent(searchQuery.trim())}`));
8392
+ const sanitized = searchQuery.trim().replace(/\s+/g, " ");
8393
+ if (sanitized) {
8394
+ setIsSearching(true);
8395
+ router.push(buildPath(`/search?q=${encodeURIComponent(sanitized)}`));
8396
+ }
8032
8397
  }
8033
8398
  };
8034
8399
  const priceRanges = React8.useMemo(
@@ -8051,9 +8416,10 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8051
8416
  if (filters.category) updates[filters.category] = true;
8052
8417
  if (filters.subCategory) {
8053
8418
  const parent = categories.find(
8054
- (c) => c.categorySubCategories?.some((sc) => sc.id === filters.subCategory)
8419
+ (c) => c.categorySubCategories?.some((sc) => (sc._id ?? sc.id) === filters.subCategory)
8055
8420
  );
8056
- if (parent?.id) updates[parent.id] = true;
8421
+ const parentId = parent?._id ?? parent?.id;
8422
+ if (parentId) updates[parentId] = true;
8057
8423
  }
8058
8424
  if (Object.keys(updates).length) {
8059
8425
  setExpandedCategories((prev) => ({ ...prev, ...updates }));
@@ -8078,7 +8444,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8078
8444
  let newArrivals2 = 0;
8079
8445
  let inStockCount = 0;
8080
8446
  products.forEach((product) => {
8081
- if (product.inventoryCount > 0) inStockCount += 1;
8447
+ if (product.summary?.totalInventory > 0) inStockCount += 1;
8082
8448
  if (new Date(product.createdAt).getTime() >= monthAgo) newArrivals2 += 1;
8083
8449
  });
8084
8450
  return { newArrivals: newArrivals2, inStockCount };
@@ -8138,9 +8504,9 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8138
8504
  const items = [...filteredProducts];
8139
8505
  switch (sortOption) {
8140
8506
  case "price-low-high":
8141
- return items.sort((a, b) => a.finalPrice - b.finalPrice);
8507
+ return items.sort((a, b) => (a.variants?.[0]?.finalPrice ?? 0) - (b.variants?.[0]?.finalPrice ?? 0));
8142
8508
  case "price-high-low":
8143
- return items.sort((a, b) => b.finalPrice - a.finalPrice);
8509
+ return items.sort((a, b) => (b.variants?.[0]?.finalPrice ?? 0) - (a.variants?.[0]?.finalPrice ?? 0));
8144
8510
  case "newest":
8145
8511
  return items.sort(
8146
8512
  (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
@@ -8398,7 +8764,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8398
8764
  let subName;
8399
8765
  let parentName;
8400
8766
  categories.forEach((cat) => {
8401
- const found = cat.categorySubCategories?.find((sc) => sc.id === subCategoryFilter);
8767
+ const found = cat.categorySubCategories?.find((sc) => (sc._id ?? sc.id) === subCategoryFilter);
8402
8768
  if (found) {
8403
8769
  subName = found.name;
8404
8770
  parentName = cat.name;
@@ -8410,7 +8776,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8410
8776
  onRemove: handleRemoveSubCategory
8411
8777
  });
8412
8778
  if (categoryFilter) {
8413
- const catObj = categories.find((c) => c.id === categoryFilter);
8779
+ const catObj = categories.find((c) => (c._id ?? c.id) === categoryFilter);
8414
8780
  chips.push({
8415
8781
  key: "category",
8416
8782
  label: `Category: ${catObj?.name ?? parentName ?? categoryFilter}`,
@@ -8418,7 +8784,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8418
8784
  });
8419
8785
  }
8420
8786
  } else if (categoryFilter) {
8421
- const category = categories.find((cat) => cat.id === categoryFilter);
8787
+ const category = categories.find((cat) => (cat._id ?? cat.id) === categoryFilter);
8422
8788
  chips.push({
8423
8789
  key: "category",
8424
8790
  label: `Category: ${category?.name ?? categoryFilter}`,
@@ -8531,15 +8897,16 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8531
8897
  }
8532
8898
  ),
8533
8899
  expandedFilterSections.category && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: sortedCategories.map((category) => {
8534
- const isCategoryActive = categoryFilter === category.id;
8535
- const isExpanded = !!expandedCategories[category.id];
8900
+ const categoryId = category._id ?? category.id ?? "";
8901
+ const isCategoryActive = categoryFilter === categoryId;
8902
+ const isExpanded = !!expandedCategories[categoryId];
8536
8903
  const Icon = getCategoryIconForFilter(category.name ?? "");
8537
8904
  return /* @__PURE__ */ jsxRuntime.jsxs(
8538
8905
  "button",
8539
8906
  {
8540
8907
  onClick: () => {
8541
- if (!isExpanded) toggleCategoryExpand(category.id ?? "");
8542
- handleCategoryChange(category.id ?? "");
8908
+ if (!isExpanded) toggleCategoryExpand(categoryId);
8909
+ handleCategoryChange(categoryId);
8543
8910
  },
8544
8911
  className: `w-full text-left px-4 py-3 rounded-xl font-['Poppins',sans-serif] text-[13px] transition-all flex items-center gap-3 ${isCategoryActive ? "bg-primary text-white shadow-lg" : "text-secondary hover:bg-gray-50 border-2 border-gray-100"}`,
8545
8912
  children: [
@@ -8547,7 +8914,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8547
8914
  category.name
8548
8915
  ]
8549
8916
  },
8550
- category.id
8917
+ categoryId
8551
8918
  );
8552
8919
  }) })
8553
8920
  ] }),
@@ -8729,14 +9096,15 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8729
9096
  ),
8730
9097
  displayCategories.map((category, index) => {
8731
9098
  const Icon = getCategoryIcon(category.name ?? "");
8732
- const isSelected = categoryFilter === category.id;
9099
+ const categoryId = category._id ?? category.id ?? "";
9100
+ const isSelected = categoryFilter === categoryId;
8733
9101
  return /* @__PURE__ */ jsxRuntime.jsx(
8734
9102
  framerMotion.motion.button,
8735
9103
  {
8736
9104
  initial: { opacity: 0, y: 20 },
8737
9105
  animate: { opacity: 1, y: 0 },
8738
9106
  transition: { delay: index * 0.1 },
8739
- onClick: () => handleCategoryChange(category.id ?? ""),
9107
+ onClick: () => handleCategoryChange(categoryId),
8740
9108
  className: `group relative overflow-hidden rounded-[24px] p-6 min-h-[180px] min-w-[170px] transition-all duration-300 ${isSelected ? "bg-linear-to-br from-primary to-secondary text-white shadow-xl scale-105" : "bg-linear-to-br from-gray-50 to-white hover:shadow-lg border-2 border-gray-100 hover:border-primary"}`,
8741
9109
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
8742
9110
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: `size-12 rounded-full mb-3 mx-auto flex items-center justify-center transition-all ${isSelected ? "bg-white/20" : "bg-linear-to-br from-primary/10 to-secondary/10 group-hover:scale-110"}`, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: `size-6 ${isSelected ? "text-white" : "text-primary"}` }) }),
@@ -8744,7 +9112,7 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8744
9112
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: `font-['Poppins',sans-serif] text-[11px] ${isSelected ? "text-white/80" : "text-muted"}`, children: category.description })
8745
9113
  ] })
8746
9114
  },
8747
- category.id
9115
+ categoryId
8748
9116
  );
8749
9117
  })
8750
9118
  ] })
@@ -8835,9 +9203,11 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8835
9203
  }
8836
9204
  }
8837
9205
  ) }, product._id)) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4", children: displayedProducts.map((product) => {
8838
- product.priceBeforeDiscount && product.priceBeforeDiscount > product.finalPrice ? Math.round(
8839
- (product.priceBeforeDiscount - product.finalPrice) / product.priceBeforeDiscount * 100
8840
- ) : 0;
9206
+ const firstVariant = product.variants?.[0];
9207
+ const displayFinalPrice = firstVariant?.finalPrice ?? 0;
9208
+ const displayRetailPrice = firstVariant?.retailPrice ?? 0;
9209
+ const displayIsDiscounted = firstVariant?.isDiscounted ?? false;
9210
+ const displayInventoryCount = firstVariant?.inventoryCount ?? 0;
8841
9211
  return /* @__PURE__ */ jsxRuntime.jsxs(
8842
9212
  framerMotion.motion.div,
8843
9213
  {
@@ -8848,29 +9218,26 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8848
9218
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative h-48 w-full overflow-hidden rounded-2xl bg-gray-100 md:h-40 md:w-40", children: /* @__PURE__ */ jsxRuntime.jsx(
8849
9219
  Image4__default.default,
8850
9220
  {
8851
- src: product.productMedia[0]?.file || "/placeholder-product.jpg",
9221
+ src: product.media?.[0]?.file || "/placeholder-product.jpg",
8852
9222
  alt: product.name,
8853
9223
  fill: true,
8854
9224
  className: "object-cover transition duration-500 group-hover:scale-105"
8855
9225
  }
8856
9226
  ) }),
8857
9227
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-3", children: [
8858
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2 text-xs font-semibold uppercase tracking-wide text-primary-600", children: [
8859
- product.parentCategories.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full bg-primary-50 px-3 py-1 text-primary-700", children: product.parentCategories.map((category) => category?.name).join(", ") }),
8860
- product.tags?.slice(0, 3).map((tag) => /* @__PURE__ */ jsxRuntime.jsx(
8861
- "span",
8862
- {
8863
- className: "rounded-full bg-slate-100 px-3 py-1 text-gray-600",
8864
- children: tag
8865
- },
8866
- tag
8867
- ))
8868
- ] }),
9228
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap items-center gap-2 text-xs font-semibold uppercase tracking-wide text-primary-600", children: product.tags?.slice(0, 3).map((tag) => /* @__PURE__ */ jsxRuntime.jsx(
9229
+ "span",
9230
+ {
9231
+ className: "rounded-full bg-slate-100 px-3 py-1 text-gray-600",
9232
+ children: tag
9233
+ },
9234
+ tag
9235
+ )) }),
8869
9236
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-semibold text-gray-900 line-clamp-2", children: product.name }),
8870
9237
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-4 text-sm text-gray-500", children: [
8871
9238
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-2 font-medium text-primary-600", children: [
8872
9239
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ShieldCheck, { className: "h-4 w-4" }),
8873
- product.inventoryCount > 0 ? "In stock & ready to ship" : "Restocking soon"
9240
+ displayInventoryCount > 0 ? "In stock & ready to ship" : "Restocking soon"
8874
9241
  ] }),
8875
9242
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-2", children: [
8876
9243
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: "h-4 w-4 text-primary-500" }),
@@ -8881,8 +9248,8 @@ function ShopScreen({ initialFilters = {}, categoryName }) {
8881
9248
  ] }),
8882
9249
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full flex-col items-end gap-3 md:w-auto", children: [
8883
9250
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-right", children: [
8884
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-3xl font-semibold text-gray-900", children: formatPrice(product.finalPrice) }),
8885
- product.isDiscounted && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-400 line-through", children: formatPrice(product.priceBeforeDiscount) })
9251
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-3xl font-semibold text-gray-900", children: formatPrice(displayFinalPrice) }),
9252
+ displayIsDiscounted && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-400 line-through", children: formatPrice(displayRetailPrice) })
8886
9253
  ] }),
8887
9254
  /* @__PURE__ */ jsxRuntime.jsx(
8888
9255
  "button",
@@ -8974,21 +9341,21 @@ function ProductDetailScreen({ productId }) {
8974
9341
  return initialProductData;
8975
9342
  }
8976
9343
  if (!productData) return null;
8977
- if (productData.productVariants?.length && selectedVariant) {
9344
+ if (productData.variants?.length && selectedVariant) {
8978
9345
  return {
8979
9346
  ...productData,
8980
9347
  price: selectedVariant.finalPrice,
8981
9348
  inStock: selectedVariant.isActive,
8982
9349
  sku: selectedVariant.sku || productData.sku,
8983
- variantId: selectedVariant.id,
9350
+ variantId: selectedVariant._id,
8984
9351
  variantName: selectedVariant.name
8985
9352
  };
8986
9353
  }
8987
9354
  return productData;
8988
9355
  }, [productData, selectedVariant, initialProductData]);
8989
9356
  const getVariantImages = () => {
8990
- if (selectedVariant?.productMedia?.length) {
8991
- return selectedVariant.productMedia.map((media) => ({
9357
+ if (selectedVariant?.media?.length) {
9358
+ return selectedVariant.media.map((media) => ({
8992
9359
  src: media.file,
8993
9360
  width: 800,
8994
9361
  height: 1e3,
@@ -8997,8 +9364,8 @@ function ProductDetailScreen({ productId }) {
8997
9364
  url: media.file
8998
9365
  }));
8999
9366
  }
9000
- if (product?.productMedia?.length) {
9001
- return product.productMedia.map((media) => ({
9367
+ if (product?.media?.length) {
9368
+ return product.media.map((media) => ({
9002
9369
  src: media.file,
9003
9370
  width: 800,
9004
9371
  height: 1e3,
@@ -9007,14 +9374,14 @@ function ProductDetailScreen({ productId }) {
9007
9374
  url: media.file
9008
9375
  }));
9009
9376
  }
9010
- if (product?.images?.length) {
9011
- return product.images.map((image) => ({
9012
- src: image,
9377
+ if (product?.media?.length) {
9378
+ return product.media.map((media) => ({
9379
+ src: media.file,
9013
9380
  width: 800,
9014
9381
  height: 1e3,
9015
9382
  alt: product?.name || "Product image",
9016
- url: image,
9017
- file: image,
9383
+ url: media.file,
9384
+ file: media.file,
9018
9385
  type: "image"
9019
9386
  }));
9020
9387
  }
@@ -9050,23 +9417,18 @@ function ProductDetailScreen({ productId }) {
9050
9417
  }
9051
9418
  }, [product?.productVariants]);
9052
9419
  React8.useEffect(() => {
9053
- if (!product?.id) return;
9420
+ if (!product?._id) return;
9054
9421
  const fetchRelated = async () => {
9055
9422
  try {
9056
- const response = await new ProductsApi(AXIOS_CONFIG).getRelatedProducts(product.id, {
9057
- params: {
9058
- limit: 4
9059
- }
9060
- });
9423
+ const response = await new ProductsApi(AXIOS_CONFIG).getRelatedProducts(product._id, 4);
9424
+ console.log("response.data", response.data);
9061
9425
  setRelatedProducts(response.data || []);
9062
9426
  } catch (error) {
9063
9427
  console.error("Failed to fetch related products", error);
9064
9428
  }
9065
9429
  };
9066
9430
  fetchRelated();
9067
- return () => {
9068
- };
9069
- }, [product?.id]);
9431
+ }, [product?._id]);
9070
9432
  const handleVariantSelect = async (variant) => {
9071
9433
  setSelectedVariant(variant);
9072
9434
  setActiveImageIndex(0);
@@ -9084,9 +9446,9 @@ function ProductDetailScreen({ productId }) {
9084
9446
  setIsAddingToCart(true);
9085
9447
  try {
9086
9448
  await addToCart(
9087
- product.id,
9449
+ product._id,
9088
9450
  quantity,
9089
- selectedVariant.id
9451
+ selectedVariant._id
9090
9452
  );
9091
9453
  notification.success(
9092
9454
  "Added to cart",
@@ -9105,14 +9467,14 @@ function ProductDetailScreen({ productId }) {
9105
9467
  const { addToWishlist, removeFromWishlist, isInWishlist } = useWishlist();
9106
9468
  React8.useEffect(() => {
9107
9469
  if (product) {
9108
- setIsFavorited(isInWishlist(product.id));
9470
+ setIsFavorited(isInWishlist(product._id));
9109
9471
  }
9110
9472
  }, [product, isInWishlist]);
9111
9473
  const handleToggleFavorite = async () => {
9112
9474
  if (!product) return;
9113
9475
  try {
9114
9476
  if (isFavorited) {
9115
- await removeFromWishlist(product.id);
9477
+ await removeFromWishlist(product._id);
9116
9478
  notification.info(
9117
9479
  "Removed from saved items",
9118
9480
  `${product.name} was removed from your saved items.`
@@ -9153,7 +9515,7 @@ function ProductDetailScreen({ productId }) {
9153
9515
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "mx-auto h-10 w-10 text-primary-500" }),
9154
9516
  /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "mt-6 text-2xl font-semibold text-gray-900", children: "Product not found" }),
9155
9517
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-gray-600", children: "It may have been removed or is temporarily unavailable. Discover other pharmacy essentials in our catalogue." }),
9156
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-6", children: /* @__PURE__ */ jsxRuntime.jsx(Link7__default.default, { href: "/shop", className: "inline-block", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { children: "Browse products" }) }) })
9518
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-6", children: /* @__PURE__ */ jsxRuntime.jsx(Link9__default.default, { href: "/shop", className: "inline-block", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { children: "Browse products" }) }) })
9157
9519
  ] }) }) });
9158
9520
  }
9159
9521
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-h-screen bg-white", children: [
@@ -9207,7 +9569,7 @@ function ProductDetailScreen({ productId }) {
9207
9569
  ] }) }) })
9208
9570
  ]
9209
9571
  },
9210
- selectedVariant?.id || "default"
9572
+ selectedVariant?._id || "default"
9211
9573
  ),
9212
9574
  variantImages.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-8 gap-2", children: variantImages.map((image, index) => /* @__PURE__ */ jsxRuntime.jsx(
9213
9575
  "button",
@@ -9235,7 +9597,7 @@ function ProductDetailScreen({ productId }) {
9235
9597
  /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "font-['Poppins',sans-serif] text-[12px] text-primary uppercase tracking-wide font-medium mb-2", children: [
9236
9598
  product.brand,
9237
9599
  " \u2022 ",
9238
- product.parentCategories?.[0]?.name || "Uncategorized"
9600
+ product.categoryIds?.[0]?.name || "Uncategorized"
9239
9601
  ] }),
9240
9602
  /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-3xl font-['Poppins',sans-serif] font-semibold text-secondary tracking-[-1.5px] mb-3", children: selectedVariant?.name || product.name }),
9241
9603
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
@@ -9253,7 +9615,7 @@ function ProductDetailScreen({ productId }) {
9253
9615
  " reviews)"
9254
9616
  ] })
9255
9617
  ] }),
9256
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 mb-6 pb-6 border-b-2 border-gray-100", children: [
9618
+ selectedVariant && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 mb-6 pb-6 border-b-2 border-gray-100", children: [
9257
9619
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-['Poppins',sans-serif] font-bold text-[40px] text-[#E67E50]", children: [
9258
9620
  "$",
9259
9621
  variantPrice.toFixed(2)
@@ -9270,10 +9632,10 @@ function ProductDetailScreen({ productId }) {
9270
9632
  ] })
9271
9633
  ] }),
9272
9634
  selectedVariant && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6", children: [
9273
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 mb-2", children: selectedVariant.inventoryStatus === "OUT_OF_STOCK" /* OUTOFSTOCK */ || selectedVariant.inventoryStatus === "LOW_STOCK" /* LOWSTOCK */ ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9635
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 mb-2", children: selectedVariant.inventoryStatus === "OUT_OF_STOCK" /* OUTOFSTOCK */ ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9274
9636
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-3 rounded-full bg-red-500" }),
9275
9637
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-['Poppins',sans-serif] text-[13px] text-red-600 font-medium", children: "Out of Stock" })
9276
- ] }) : selectedVariant.inventoryCount <= 10 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9638
+ ] }) : selectedVariant.inventoryStatus === "LOW_STOCK" /* LOWSTOCK */ || selectedVariant.inventoryCount <= 10 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9277
9639
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-3 rounded-full bg-primary animate-pulse" }),
9278
9640
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-['Poppins',sans-serif] text-[13px] text-primary font-medium", children: [
9279
9641
  "Only ",
@@ -9286,7 +9648,7 @@ function ProductDetailScreen({ productId }) {
9286
9648
  ] }) }),
9287
9649
  /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "font-['Poppins',sans-serif] text-[12px] text-muted", children: [
9288
9650
  "SKU: ",
9289
- selectedVariant?.sku
9651
+ selectedVariant?.sku || product?.sku
9290
9652
  ] })
9291
9653
  ] }),
9292
9654
  product.description && /* @__PURE__ */ jsxRuntime.jsx(
@@ -9296,11 +9658,11 @@ function ProductDetailScreen({ productId }) {
9296
9658
  dangerouslySetInnerHTML: { __html: product.description }
9297
9659
  }
9298
9660
  ),
9299
- product?.productVariants && product.productVariants.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6", children: [
9661
+ product?.variants && product.variants.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6", children: [
9300
9662
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-['Poppins',sans-serif] font-semibold text-[14px] text-secondary mb-3", children: "Select Variant" }),
9301
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-3", children: product.productVariants.map((variant) => {
9302
- const isSelected = selectedVariant?.id === variant.id;
9303
- const variantImage = variant.productMedia?.[0]?.file || product.productMedia?.[0]?.file || product.images?.[0] || "/placeholder-product.jpg";
9663
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-3", children: product.variants.map((variant) => {
9664
+ const isSelected = selectedVariant?._id === variant._id;
9665
+ const variantImage = variant.media?.[0]?.file || product.media?.[0]?.file || product.images?.[0] || "/placeholder-product.jpg";
9304
9666
  return /* @__PURE__ */ jsxRuntime.jsxs(
9305
9667
  "button",
9306
9668
  {
@@ -9328,7 +9690,7 @@ function ProductDetailScreen({ productId }) {
9328
9690
  isSelected && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-5 w-5 text-secondary shrink-0" })
9329
9691
  ]
9330
9692
  },
9331
- variant.id
9693
+ variant._id
9332
9694
  );
9333
9695
  }) })
9334
9696
  ] }),
@@ -9369,13 +9731,13 @@ function ProductDetailScreen({ productId }) {
9369
9731
  {
9370
9732
  className: "flex-1 font-['Poppins',sans-serif] font-medium text-[14px] px-8 py-4 rounded-full transition-all duration-300 flex items-center justify-center gap-3 bg-[#E67E50] text-white hover:bg-[#d66f45] hover:shadow-lg disabled:opacity-50 disabled:cursor-not-allowed",
9371
9733
  onClick: handleAddToCart,
9372
- disabled: !selectedVariant || selectedVariant.inventoryStatus === "OUT_OF_STOCK" /* OUTOFSTOCK */,
9734
+ disabled: !selectedVariant || selectedVariant.inventoryStatus === "OUT_OF_STOCK" /* OUTOFSTOCK */ || isAddingToCart,
9373
9735
  children: isAddingToCart ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9374
9736
  /* @__PURE__ */ jsxRuntime.jsxs("svg", { className: "animate-spin h-5 w-5", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
9375
9737
  /* @__PURE__ */ jsxRuntime.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
9376
9738
  /* @__PURE__ */ jsxRuntime.jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
9377
9739
  ] }),
9378
- "Loading..."
9740
+ "Adding..."
9379
9741
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9380
9742
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ShoppingCart, { className: "h-4 w-4" }),
9381
9743
  !selectedVariant ? "Select a variant" : selectedVariant.inventoryStatus === "OUT_OF_STOCK" /* OUTOFSTOCK */ ? "Out of Stock" : "Add to Cart"
@@ -9477,7 +9839,7 @@ function ProductDetailScreen({ productId }) {
9477
9839
  router.push(buildPath(`/products/${item._id || item.id}`));
9478
9840
  }
9479
9841
  },
9480
- relatedProduct.id
9842
+ relatedProduct._id
9481
9843
  )) })
9482
9844
  ] })
9483
9845
  ] }) }) })
@@ -9518,7 +9880,7 @@ function CartItem({ item }) {
9518
9880
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-28 h-28 rounded-[16px] overflow-hidden bg-gray-50 shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(
9519
9881
  Image4__default.default,
9520
9882
  {
9521
- src: item.productVariantData.productMedia[0]?.file || "/placeholder-product.jpg",
9883
+ src: item.productVariantData.media[0]?.file || "/placeholder-product.jpg",
9522
9884
  alt: item.productVariantData.name,
9523
9885
  className: "w-full h-full object-cover",
9524
9886
  height: 112,
@@ -9629,7 +9991,7 @@ function CartScreen() {
9629
9991
  }
9630
9992
  ) }) }) }) });
9631
9993
  }
9632
- const subtotal = cart.total;
9994
+ const subtotal = cart.cartBody.items.reduce((total2, item) => total2 + item.productVariantData.finalPrice * item.quantity, 0);
9633
9995
  const shipping = 0;
9634
9996
  const tax = 0;
9635
9997
  const total = subtotal + shipping + tax;
@@ -9756,7 +10118,9 @@ function useAddresses() {
9756
10118
  const sortedAddresses = React8.useMemo(() => {
9757
10119
  return [...addresses].sort((a, b) => {
9758
10120
  if (a.isDefault === b.isDefault) {
9759
- return (b.updatedAt.toISOString() || "").localeCompare(a.updatedAt.toISOString() || "");
10121
+ const dateA = a.updatedAt || "";
10122
+ const dateB = b.updatedAt || "";
10123
+ return dateB.toString().localeCompare(dateA.toString());
9760
10124
  }
9761
10125
  return a.isDefault ? -1 : 1;
9762
10126
  });
@@ -9859,7 +10223,7 @@ var addressSchema = zod.z.object({
9859
10223
  state: zod.z.string().min(2, "State is required"),
9860
10224
  zip: zod.z.string().min(4, "ZIP code is required"),
9861
10225
  country: zod.z.string().min(2, "Country is required"),
9862
- phone: zod.z.string().min(10, "Phone number is required")
10226
+ phone: zod.z.string().min(10, "Phone number must be at least 10 characters").optional().or(zod.z.literal(""))
9863
10227
  });
9864
10228
  function AddressFormModal({ isOpen, onClose, onAddressAdded, onAddressUpdated, initialAddress }) {
9865
10229
  const [isSubmitting, setIsSubmitting] = React8.useState(false);
@@ -10116,13 +10480,21 @@ function CheckoutScreen() {
10116
10480
  sameAsShipping: true,
10117
10481
  shipping: {
10118
10482
  name: user ? `${user.firstname} ${user.lastname}` : "",
10119
- phone: user?.phoneNumber || void 0,
10483
+ phone: user?.phoneNumber || "",
10120
10484
  country: "United States"
10485
+ // street1: '',
10486
+ // city: '',
10487
+ // state: '',
10488
+ // zip: '',
10121
10489
  },
10122
10490
  billing: {
10123
10491
  name: user ? `${user.firstname} ${user.lastname}` : "",
10124
- phone: user?.phoneNumber || void 0,
10492
+ phone: user?.phoneNumber || "",
10125
10493
  country: "United States"
10494
+ // street1: '',
10495
+ // city: '',
10496
+ // state: '',
10497
+ // zip: '',
10126
10498
  }
10127
10499
  }
10128
10500
  });
@@ -10143,7 +10515,7 @@ function CheckoutScreen() {
10143
10515
  if (defaultAddress && !selectedAddressId) {
10144
10516
  setSelectedAddressId(defaultAddress.id);
10145
10517
  setValue("shipping.name", defaultAddress.name);
10146
- setValue("shipping.phone", defaultAddress.phone || void 0);
10518
+ setValue("shipping.phone", defaultAddress.phone || "");
10147
10519
  setValue("shipping.street1", defaultAddress.street1);
10148
10520
  setValue("shipping.street2", defaultAddress.street2 || "");
10149
10521
  setValue("shipping.city", defaultAddress.city);
@@ -10291,7 +10663,6 @@ function CheckoutScreen() {
10291
10663
  items,
10292
10664
  paymentMethod,
10293
10665
  orderStatus: "Pending",
10294
- chargeTax: true,
10295
10666
  orderRemindingDates: [],
10296
10667
  shippingAddress: data.shipping,
10297
10668
  billingAddress: sameAsShipping ? data.shipping : data.billing
@@ -10300,7 +10671,8 @@ function CheckoutScreen() {
10300
10671
  const response = await api.createCheckout(
10301
10672
  orderDTO,
10302
10673
  isDelivery,
10303
- user?.id,
10674
+ void 0,
10675
+ // dont pass userId
10304
10676
  isDelivery ? selectedShippingRateId || void 0 : void 0,
10305
10677
  billingAddressId
10306
10678
  );
@@ -10369,7 +10741,7 @@ function CheckoutScreen() {
10369
10741
  router.push(buildPath("/cart"));
10370
10742
  return null;
10371
10743
  }
10372
- const subtotal = cart.total;
10744
+ const subtotal = cart.cartBody.items.reduce((total2, item) => total2 + item.productVariantData.finalPrice * item.quantity, 0);
10373
10745
  const tax = 0;
10374
10746
  const total = subtotal + shippingPrice + tax;
10375
10747
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-h-screen bg-white pb-16", children: [
@@ -10432,7 +10804,7 @@ function CheckoutScreen() {
10432
10804
  onChange: () => {
10433
10805
  setSelectedAddressId(addr.id);
10434
10806
  setValue("shipping.name", addr.name);
10435
- setValue("shipping.phone", addr.phone || void 0);
10807
+ setValue("shipping.phone", addr.phone || "");
10436
10808
  setValue("shipping.street1", addr.street1);
10437
10809
  setValue("shipping.street2", addr.street2 || "");
10438
10810
  setValue("shipping.city", addr.city);
@@ -10738,7 +11110,7 @@ function CheckoutScreen() {
10738
11110
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-['Poppins',sans-serif] font-semibold text-[#2B4B7C] mb-6 text-2xl", children: "Order Summary" }),
10739
11111
  /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "mt-8 pt-6 border-t border-slate-100", children: [
10740
11112
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4 mb-6", children: cart?.cartBody?.items?.map((item) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3", children: [
10741
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-16 h-16 rounded-xl overflow-hidden bg-white shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(Image4__default.default, { src: item.productVariantData.productMedia?.[0]?.file || "/placeholder-product.jpg", alt: item.productVariantData.name, className: "w-full h-full object-cover", height: 200, width: 200 }) }),
11113
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-16 h-16 rounded-xl overflow-hidden bg-white shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(Image4__default.default, { src: item.productVariantData?.media?.[0]?.file || "/placeholder-product.jpg", alt: item.productVariantData.name, className: "w-full h-full object-cover", height: 200, width: 200 }) }),
10742
11114
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
10743
11115
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-['Poppins',sans-serif] font-medium text-[12px] text-[#2B4B7C] mb-1", children: item?.productVariantData?.name }),
10744
11116
  /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "font-['Poppins',sans-serif] text-[11px] text-[#676c80]", children: [
@@ -10748,7 +11120,7 @@ function CheckoutScreen() {
10748
11120
  ] }),
10749
11121
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-['Poppins',sans-serif] font-semibold text-[12px] text-[#E67E50] mt-1", children: formatPrice(item.productVariantData.finalPrice * item.quantity) })
10750
11122
  ] })
10751
- ] }, `${item.productId}-${item.color}-${item.size}`)) }),
11123
+ ] }, item.productVariantId || item.id)) }),
10752
11124
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-px bg-[#5B9BD5]/20 my-4" }),
10753
11125
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm text-slate-600 space-y-3 py-4", children: [
10754
11126
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
@@ -10778,11 +11150,35 @@ function CheckoutScreen() {
10778
11150
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-4 w-4 shrink-0 mt-0.5" }),
10779
11151
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: error })
10780
11152
  ] }) }),
11153
+ Object.keys(errors).length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 p-4 rounded-xl bg-amber-50 border border-amber-200 text-amber-700 text-sm font-medium", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
11154
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-4 w-4 shrink-0 mt-0.5" }),
11155
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11156
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold mb-1", children: "Please fix the following errors:" }),
11157
+ /* @__PURE__ */ jsxRuntime.jsxs("ul", { className: "list-disc list-inside space-y-1", children: [
11158
+ errors.shipping?.name && /* @__PURE__ */ jsxRuntime.jsx("li", { children: errors.shipping.name.message }),
11159
+ errors.shipping?.phone && /* @__PURE__ */ jsxRuntime.jsx("li", { children: errors.shipping.phone.message }),
11160
+ errors.shipping?.street1 && /* @__PURE__ */ jsxRuntime.jsx("li", { children: errors.shipping.street1.message }),
11161
+ errors.shipping?.city && /* @__PURE__ */ jsxRuntime.jsx("li", { children: errors.shipping.city.message }),
11162
+ errors.shipping?.state && /* @__PURE__ */ jsxRuntime.jsx("li", { children: errors.shipping.state.message }),
11163
+ errors.shipping?.zip && /* @__PURE__ */ jsxRuntime.jsx("li", { children: errors.shipping.zip.message }),
11164
+ errors.shipping?.country && /* @__PURE__ */ jsxRuntime.jsx("li", { children: errors.shipping.country.message }),
11165
+ !sameAsShipping && errors.billing?.name && /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
11166
+ "Billing: ",
11167
+ errors.billing.name.message
11168
+ ] }),
11169
+ !sameAsShipping && errors.billing?.street1 && /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
11170
+ "Billing: ",
11171
+ errors.billing.street1.message
11172
+ ] })
11173
+ ] })
11174
+ ] })
11175
+ ] }) }),
10781
11176
  /* @__PURE__ */ jsxRuntime.jsxs(
10782
11177
  "button",
10783
11178
  {
10784
11179
  type: "submit",
10785
- 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",
11180
+ disabled: isSubmitting,
11181
+ 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 disabled:opacity-50 disabled:cursor-not-allowed",
10786
11182
  children: [
10787
11183
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: "h-5 w-5" }),
10788
11184
  isSubmitting ? "Placing order..." : "Place Secure Order"
@@ -10807,7 +11203,7 @@ function CheckoutScreen() {
10807
11203
  refresh().then(() => {
10808
11204
  setSelectedAddressId(addr.id);
10809
11205
  setValue("shipping.name", addr.name);
10810
- setValue("shipping.phone", addr.phone || void 0);
11206
+ setValue("shipping.phone", addr.phone || "");
10811
11207
  setValue("shipping.street1", addr.street1);
10812
11208
  setValue("shipping.street2", addr.street2 || "");
10813
11209
  setValue("shipping.city", addr.city);
@@ -10949,7 +11345,7 @@ function LoginScreen() {
10949
11345
  "Remember me"
10950
11346
  ] }),
10951
11347
  /* @__PURE__ */ jsxRuntime.jsx(
10952
- Link7__default.default,
11348
+ Link9__default.default,
10953
11349
  {
10954
11350
  href: buildPath("/forgot-password"),
10955
11351
  className: "font-medium text-primary transition hover:opacity-80",
@@ -10971,15 +11367,15 @@ function LoginScreen() {
10971
11367
  ),
10972
11368
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted", children: [
10973
11369
  "Don't have an account? ",
10974
- /* @__PURE__ */ jsxRuntime.jsx(Link7__default.default, { href: buildPath("/register"), className: "font-medium text-primary transition hover:opacity-90", children: "Sign up" })
11370
+ /* @__PURE__ */ jsxRuntime.jsx(Link9__default.default, { href: buildPath("/register"), className: "font-medium text-primary transition hover:opacity-90", children: "Sign up" })
10975
11371
  ] }) })
10976
11372
  ] })
10977
11373
  }
10978
11374
  ) }) });
10979
11375
  }
10980
11376
  var registerSchema = zod.z.object({
10981
- firstName: zod.z.string().min(2, "First name is required"),
10982
- lastName: zod.z.string().min(2, "Last name is required"),
11377
+ firstname: zod.z.string().min(2, "First name is required"),
11378
+ lastname: zod.z.string().min(2, "Last name is required"),
10983
11379
  email: zod.z.string().email("Enter a valid email"),
10984
11380
  phone: zod.z.string().optional(),
10985
11381
  password: zod.z.string().min(6, "Password must be at least 6 characters"),
@@ -11034,90 +11430,411 @@ function RegisterScreen() {
11034
11430
  animate: { opacity: 1, x: 0 },
11035
11431
  transition: { duration: 0.4 },
11036
11432
  className: "flex items-center justify-center px-6 py-12 lg:px-16",
11037
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full max-w-xl space-y-10 text-center", children: [
11433
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full max-w-xl space-y-10 text-center", children: [
11434
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
11435
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.UserPlus, { strokeWidth: 2, className: "h-16 w-16 mx-auto text-white rounded-full bg-primary m-2 mb-4 px-4" }),
11436
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-4xl text-secondary", children: "Create Your Account" }),
11437
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted", children: "Join Holmdel Pharmacy Care for convenient healthcare access" })
11438
+ ] }),
11439
+ /* @__PURE__ */ jsxRuntime.jsxs(
11440
+ "form",
11441
+ {
11442
+ onSubmit: handleSubmit(onSubmit),
11443
+ className: "text-start space-y-6 rounded-3xl border border-slate-100 bg-white p-8 shadow-lg shadow-primary-50",
11444
+ style: {
11445
+ boxShadow: "0px 4px 6px -4px #0000001A, 0px 10px 15px -3px #0000001A"
11446
+ },
11447
+ children: [
11448
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 md:grid-cols-2 text-start", children: [
11449
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11450
+ /* @__PURE__ */ jsxRuntime.jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11451
+ "First name ",
11452
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-primary-500", children: "*" })
11453
+ ] }),
11454
+ /* @__PURE__ */ jsxRuntime.jsx(
11455
+ Input,
11456
+ {
11457
+ placeholder: "Alex",
11458
+ ...register("firstname"),
11459
+ error: errors.firstname?.message
11460
+ }
11461
+ )
11462
+ ] }),
11463
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11464
+ /* @__PURE__ */ jsxRuntime.jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11465
+ "Last name ",
11466
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-primary-500", children: "*" })
11467
+ ] }),
11468
+ /* @__PURE__ */ jsxRuntime.jsx(
11469
+ Input,
11470
+ {
11471
+ placeholder: "Morgan",
11472
+ ...register("lastname"),
11473
+ error: errors.lastname?.message
11474
+ }
11475
+ )
11476
+ ] })
11477
+ ] }),
11478
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11479
+ /* @__PURE__ */ jsxRuntime.jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11480
+ "Email Address ",
11481
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-primary-500", children: "*" })
11482
+ ] }),
11483
+ /* @__PURE__ */ jsxRuntime.jsx(
11484
+ Input,
11485
+ {
11486
+ type: "email",
11487
+ placeholder: "you@example.com",
11488
+ ...register("email"),
11489
+ error: errors.email?.message
11490
+ }
11491
+ )
11492
+ ] }),
11493
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11494
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-sm text-secondary mb-3", children: "Phone Number" }),
11495
+ /* @__PURE__ */ jsxRuntime.jsx(
11496
+ Input,
11497
+ {
11498
+ type: "tel",
11499
+ placeholder: "+1 (555) 123-4567",
11500
+ ...register("phone"),
11501
+ error: errors.phone?.message
11502
+ }
11503
+ )
11504
+ ] }),
11505
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
11506
+ /* @__PURE__ */ jsxRuntime.jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11507
+ "Password ",
11508
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-primary-500", children: "*" })
11509
+ ] }),
11510
+ /* @__PURE__ */ jsxRuntime.jsx(
11511
+ Input,
11512
+ {
11513
+ type: showPassword ? "text" : "password",
11514
+ placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
11515
+ ...register("password"),
11516
+ error: errors.password?.message
11517
+ }
11518
+ ),
11519
+ /* @__PURE__ */ jsxRuntime.jsx(
11520
+ "button",
11521
+ {
11522
+ type: "button",
11523
+ onClick: () => setShowPassword((prev) => !prev),
11524
+ className: "absolute right-3 top-[42px] text-slate-400 transition hover:text-slate-600",
11525
+ children: showPassword ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.EyeOff, { className: "h-5 w-5" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { className: "h-5 w-5" })
11526
+ }
11527
+ )
11528
+ ] }),
11529
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
11530
+ /* @__PURE__ */ jsxRuntime.jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11531
+ "Confirm Password ",
11532
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-primary-500", children: "*" })
11533
+ ] }),
11534
+ /* @__PURE__ */ jsxRuntime.jsx(
11535
+ Input,
11536
+ {
11537
+ type: showConfirmPassword ? "text" : "password",
11538
+ placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
11539
+ ...register("confirmPassword"),
11540
+ error: errors.confirmPassword?.message
11541
+ }
11542
+ ),
11543
+ /* @__PURE__ */ jsxRuntime.jsx(
11544
+ "button",
11545
+ {
11546
+ type: "button",
11547
+ onClick: () => setShowConfirmPassword((prev) => !prev),
11548
+ className: "absolute right-3 top-[42px] text-slate-400 transition hover:text-slate-600",
11549
+ children: showConfirmPassword ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.EyeOff, { className: "h-5 w-5" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { className: "h-5 w-5" })
11550
+ }
11551
+ )
11552
+ ] }),
11553
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3 rounded-2xl bg-slate-50 p-4 text-sm text-slate-600", children: [
11554
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Shield, { strokeWidth: 2, className: "mt-0.5 h-8 w-8 text-primary" }),
11555
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
11556
+ "By creating an account, you agree to our",
11557
+ " ",
11558
+ /* @__PURE__ */ jsxRuntime.jsx(Link9__default.default, { href: buildPath("/terms"), className: "font-semibold text-primary hover:opacity-70", children: "Terms of Service" }),
11559
+ " ",
11560
+ "and",
11561
+ " ",
11562
+ /* @__PURE__ */ jsxRuntime.jsx(
11563
+ Link9__default.default,
11564
+ {
11565
+ href: buildPath("/privacy"),
11566
+ className: "font-semibold text-primary hover:opacity-70",
11567
+ children: "Privacy Policy"
11568
+ }
11569
+ ),
11570
+ ". We protect your information with bank-level encryption."
11571
+ ] })
11572
+ ] }),
11573
+ /* @__PURE__ */ jsxRuntime.jsx(
11574
+ "button",
11575
+ {
11576
+ type: "submit",
11577
+ disabled: isSubmitting,
11578
+ className: "w-full bg-secondary hover:opacity-80 text-white font-medium py-3 px-4 rounded-lg transition-colors disabled:opacity-70 disabled:cursor-not-allowed",
11579
+ children: isSubmitting ? "Creating account..." : "Create my account"
11580
+ }
11581
+ )
11582
+ ]
11583
+ }
11584
+ ),
11585
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted", children: [
11586
+ "Already have an account? ",
11587
+ /* @__PURE__ */ jsxRuntime.jsx(Link9__default.default, { href: buildPath("/login"), className: "font-medium text-primary transition hover:opacity-90", children: "Sign in" })
11588
+ ] }) })
11589
+ ] })
11590
+ }
11591
+ ) }) });
11592
+ }
11593
+ init_sharedConfig();
11594
+ var forgotPasswordSchema = zod.z.object({
11595
+ email: zod.z.string().email("Enter a valid email address")
11596
+ });
11597
+ function ForgotPasswordScreen() {
11598
+ const { buildPath } = useBasePath();
11599
+ const [isSubmitting, setIsSubmitting] = React8.useState(false);
11600
+ const [status, setStatus] = React8.useState(
11601
+ null
11602
+ );
11603
+ const {
11604
+ register,
11605
+ handleSubmit,
11606
+ formState: { errors }
11607
+ } = reactHookForm.useForm({
11608
+ resolver: zod$1.zodResolver(forgotPasswordSchema)
11609
+ });
11610
+ const onSubmit = async (data) => {
11611
+ setIsSubmitting(true);
11612
+ setStatus(null);
11613
+ try {
11614
+ const authApi = new AuthApi(AXIOS_CONFIG);
11615
+ await authApi.sendForgetPasswordEmail({ email: data.email });
11616
+ setStatus({
11617
+ type: "success",
11618
+ message: "Password reset link sent! Check your email inbox."
11619
+ });
11620
+ } catch (error) {
11621
+ setStatus({
11622
+ type: "error",
11623
+ message: error?.response?.data?.message || "Unable to send reset email. Please try again."
11624
+ });
11625
+ } finally {
11626
+ setIsSubmitting(false);
11627
+ }
11628
+ };
11629
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-screen bg-linear-to-b from-[#F8FAFC] to-[#EBF4FB]", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid min-h-screen overflow-hidden pb-12", children: /* @__PURE__ */ jsxRuntime.jsx(
11630
+ framerMotion.motion.section,
11631
+ {
11632
+ initial: { opacity: 0, x: 24 },
11633
+ animate: { opacity: 1, x: 0 },
11634
+ transition: { duration: 0.4 },
11635
+ className: "flex items-center justify-center px-6 py-12 lg:px-16",
11636
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full max-w-lg space-y-10 text-center", children: [
11637
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
11638
+ /* @__PURE__ */ jsxRuntime.jsx(
11639
+ lucideReact.Mail,
11640
+ {
11641
+ strokeWidth: 2,
11642
+ className: "h-16 w-16 mx-auto text-white rounded-full bg-secondary m-2 mb-4 px-4"
11643
+ }
11644
+ ),
11645
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-4xl text-secondary", children: "Forgot Password?" }),
11646
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted", children: "No worries! Enter your email and we'll send you reset instructions." })
11647
+ ] }),
11648
+ /* @__PURE__ */ jsxRuntime.jsxs(
11649
+ "form",
11650
+ {
11651
+ onSubmit: handleSubmit(onSubmit),
11652
+ className: "space-y-6 rounded-3xl border bg-white p-8",
11653
+ style: {
11654
+ boxShadow: "0px 4px 6px -4px #0000001A, 0px 10px 15px -3px #0000001A"
11655
+ },
11656
+ children: [
11657
+ status && /* @__PURE__ */ jsxRuntime.jsxs(
11658
+ "div",
11659
+ {
11660
+ className: `flex items-start gap-2 rounded-2xl border px-4 py-3 text-sm ${status.type === "success" ? "border-green-200 bg-green-50 text-green-800" : "border-red-200 bg-red-50 text-red-700"}`,
11661
+ children: [
11662
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-[2px] text-base", children: status.type === "success" ? "\u2714" : "!" }),
11663
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: status.message })
11664
+ ]
11665
+ }
11666
+ ),
11667
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-start text-secondary", children: [
11668
+ /* @__PURE__ */ jsxRuntime.jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11669
+ "Email Address ",
11670
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-primary-500", children: "*" })
11671
+ ] }),
11672
+ /* @__PURE__ */ jsxRuntime.jsx(
11673
+ Input,
11674
+ {
11675
+ type: "email",
11676
+ placeholder: "you@example.com",
11677
+ ...register("email"),
11678
+ error: errors.email?.message,
11679
+ className: "text-secondary"
11680
+ }
11681
+ )
11682
+ ] }),
11683
+ /* @__PURE__ */ jsxRuntime.jsx(
11684
+ "button",
11685
+ {
11686
+ type: "submit",
11687
+ disabled: isSubmitting,
11688
+ className: "w-full bg-secondary hover:opacity-80 text-white font-medium py-3 px-4 rounded-lg transition-colors disabled:opacity-70 disabled:cursor-not-allowed flex items-center justify-center gap-2",
11689
+ children: isSubmitting ? "Sending..." : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11690
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Send, { className: "h-4 w-4" }),
11691
+ "Send Reset Link"
11692
+ ] })
11693
+ }
11694
+ ),
11695
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pt-4 border-t border-slate-200", children: /* @__PURE__ */ jsxRuntime.jsxs(
11696
+ Link9__default.default,
11697
+ {
11698
+ href: buildPath("/login"),
11699
+ className: "flex items-center justify-center gap-2 text-sm font-medium text-primary transition hover:opacity-80",
11700
+ children: [
11701
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowLeft, { className: "h-4 w-4" }),
11702
+ "Back to login"
11703
+ ]
11704
+ }
11705
+ ) })
11706
+ ]
11707
+ }
11708
+ ),
11709
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted", children: [
11710
+ "Don't have an account?",
11711
+ " ",
11712
+ /* @__PURE__ */ jsxRuntime.jsx(
11713
+ Link9__default.default,
11714
+ {
11715
+ href: buildPath("/register"),
11716
+ className: "font-medium text-primary transition hover:opacity-90",
11717
+ children: "Sign up"
11718
+ }
11719
+ )
11720
+ ] }) })
11721
+ ] })
11722
+ }
11723
+ ) }) });
11724
+ }
11725
+ init_sharedConfig();
11726
+ var resetPasswordSchema = zod.z.object({
11727
+ newPassword: zod.z.string().min(8, "Password must be at least 8 characters"),
11728
+ confirmPassword: zod.z.string().min(8, "Confirm your new password")
11729
+ }).refine((data) => data.newPassword === data.confirmPassword, {
11730
+ path: ["confirmPassword"],
11731
+ message: "Passwords do not match"
11732
+ });
11733
+ function ResetPasswordScreen() {
11734
+ const router = navigation.useRouter();
11735
+ const { buildPath } = useBasePath();
11736
+ const params = navigation.useParams();
11737
+ const token = params?.token;
11738
+ params?.storeId;
11739
+ const [showPassword, setShowPassword] = React8.useState(false);
11740
+ const [showConfirmPassword, setShowConfirmPassword] = React8.useState(false);
11741
+ const [isSubmitting, setIsSubmitting] = React8.useState(false);
11742
+ const [status, setStatus] = React8.useState(
11743
+ null
11744
+ );
11745
+ const {
11746
+ register,
11747
+ handleSubmit,
11748
+ formState: { errors }
11749
+ } = reactHookForm.useForm({
11750
+ resolver: zod$1.zodResolver(resetPasswordSchema)
11751
+ });
11752
+ React8.useEffect(() => {
11753
+ if (!token) {
11754
+ setStatus({
11755
+ type: "error",
11756
+ message: "Invalid or missing reset token. Please request a new password reset link."
11757
+ });
11758
+ }
11759
+ }, [token]);
11760
+ const onSubmit = async (data) => {
11761
+ if (!token) {
11762
+ setStatus({
11763
+ type: "error",
11764
+ message: "Reset token is missing. Please use the link from your email."
11765
+ });
11766
+ return;
11767
+ }
11768
+ setIsSubmitting(true);
11769
+ setStatus(null);
11770
+ try {
11771
+ const authApi = new AuthApi(AXIOS_CONFIG);
11772
+ await authApi.resetPassword(data.newPassword, token);
11773
+ setStatus({
11774
+ type: "success",
11775
+ message: "Password reset successfully! Redirecting to login..."
11776
+ });
11777
+ setTimeout(() => router.push(buildPath("/login")), 2e3);
11778
+ } catch (error) {
11779
+ setStatus({
11780
+ type: "error",
11781
+ message: error?.response?.data?.message || "Unable to reset password. The link may have expired."
11782
+ });
11783
+ } finally {
11784
+ setIsSubmitting(false);
11785
+ }
11786
+ };
11787
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-screen bg-linear-to-b from-[#F8FAFC] to-[#EBF4FB]", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid min-h-screen overflow-hidden pb-12", children: /* @__PURE__ */ jsxRuntime.jsx(
11788
+ framerMotion.motion.section,
11789
+ {
11790
+ initial: { opacity: 0, x: 24 },
11791
+ animate: { opacity: 1, x: 0 },
11792
+ transition: { duration: 0.4 },
11793
+ className: "flex items-center justify-center px-6 py-12 lg:px-16",
11794
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full max-w-lg space-y-10 text-center", children: [
11038
11795
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
11039
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.UserPlus, { strokeWidth: 2, className: "h-16 w-16 mx-auto text-white rounded-full bg-primary m-2 mb-4 px-4" }),
11040
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-4xl text-secondary", children: "Create Your Account" }),
11041
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted", children: "Join Holmdel Pharmacy Care for convenient healthcare access" })
11796
+ /* @__PURE__ */ jsxRuntime.jsx(
11797
+ lucideReact.Lock,
11798
+ {
11799
+ strokeWidth: 2,
11800
+ className: "h-16 w-16 mx-auto text-white rounded-full bg-secondary m-2 mb-4 px-4"
11801
+ }
11802
+ ),
11803
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-4xl text-secondary", children: "Reset Password" }),
11804
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted", children: "Enter your new password below to reset your account password." })
11042
11805
  ] }),
11043
11806
  /* @__PURE__ */ jsxRuntime.jsxs(
11044
11807
  "form",
11045
11808
  {
11046
11809
  onSubmit: handleSubmit(onSubmit),
11047
- className: "text-start space-y-6 rounded-3xl border border-slate-100 bg-white p-8 shadow-lg shadow-primary-50",
11810
+ className: "space-y-6 rounded-3xl border bg-white p-8",
11048
11811
  style: {
11049
11812
  boxShadow: "0px 4px 6px -4px #0000001A, 0px 10px 15px -3px #0000001A"
11050
11813
  },
11051
11814
  children: [
11052
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 md:grid-cols-2 text-start", children: [
11053
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11054
- /* @__PURE__ */ jsxRuntime.jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11055
- "First name ",
11056
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-primary-500", children: "*" })
11057
- ] }),
11058
- /* @__PURE__ */ jsxRuntime.jsx(
11059
- Input,
11060
- {
11061
- placeholder: "Alex",
11062
- ...register("firstName"),
11063
- error: errors.firstName?.message
11064
- }
11065
- )
11066
- ] }),
11067
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11068
- /* @__PURE__ */ jsxRuntime.jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11069
- "Last name ",
11070
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-primary-500", children: "*" })
11071
- ] }),
11072
- /* @__PURE__ */ jsxRuntime.jsx(
11073
- Input,
11074
- {
11075
- placeholder: "Morgan",
11076
- ...register("lastName"),
11077
- error: errors.lastName?.message
11078
- }
11079
- )
11080
- ] })
11081
- ] }),
11082
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11083
- /* @__PURE__ */ jsxRuntime.jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11084
- "Email Address ",
11085
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-primary-500", children: "*" })
11086
- ] }),
11087
- /* @__PURE__ */ jsxRuntime.jsx(
11088
- Input,
11089
- {
11090
- type: "email",
11091
- placeholder: "you@example.com",
11092
- ...register("email"),
11093
- error: errors.email?.message
11094
- }
11095
- )
11096
- ] }),
11097
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11098
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-sm text-secondary mb-3", children: "Phone Number" }),
11099
- /* @__PURE__ */ jsxRuntime.jsx(
11100
- Input,
11101
- {
11102
- type: "tel",
11103
- placeholder: "+1 (555) 123-4567",
11104
- ...register("phone"),
11105
- error: errors.phone?.message
11106
- }
11107
- )
11108
- ] }),
11109
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
11815
+ status && /* @__PURE__ */ jsxRuntime.jsxs(
11816
+ "div",
11817
+ {
11818
+ className: `flex items-start gap-2 rounded-2xl border px-4 py-3 text-sm ${status.type === "success" ? "border-green-200 bg-green-50 text-green-800" : "border-red-200 bg-red-50 text-red-700"}`,
11819
+ children: [
11820
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-[2px] text-base", children: status.type === "success" ? "\u2714" : "!" }),
11821
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: status.message })
11822
+ ]
11823
+ }
11824
+ ),
11825
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative text-start text-secondary", children: [
11110
11826
  /* @__PURE__ */ jsxRuntime.jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11111
- "Password ",
11827
+ "New Password ",
11112
11828
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-primary-500", children: "*" })
11113
11829
  ] }),
11114
11830
  /* @__PURE__ */ jsxRuntime.jsx(
11115
11831
  Input,
11116
11832
  {
11117
11833
  type: showPassword ? "text" : "password",
11118
- placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
11119
- ...register("password"),
11120
- error: errors.password?.message
11834
+ placeholder: "Enter new password (min. 8 characters)",
11835
+ ...register("newPassword"),
11836
+ error: errors.newPassword?.message,
11837
+ className: "text-secondary"
11121
11838
  }
11122
11839
  ),
11123
11840
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -11130,7 +11847,7 @@ function RegisterScreen() {
11130
11847
  }
11131
11848
  )
11132
11849
  ] }),
11133
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
11850
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative text-start text-secondary", children: [
11134
11851
  /* @__PURE__ */ jsxRuntime.jsxs("h2", { className: "text-sm text-secondary mb-3", children: [
11135
11852
  "Confirm Password ",
11136
11853
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-primary-500", children: "*" })
@@ -11139,9 +11856,10 @@ function RegisterScreen() {
11139
11856
  Input,
11140
11857
  {
11141
11858
  type: showConfirmPassword ? "text" : "password",
11142
- placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
11859
+ placeholder: "Re-enter new password",
11143
11860
  ...register("confirmPassword"),
11144
- error: errors.confirmPassword?.message
11861
+ error: errors.confirmPassword?.message,
11862
+ className: "text-secondary"
11145
11863
  }
11146
11864
  ),
11147
11865
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -11154,42 +11872,30 @@ function RegisterScreen() {
11154
11872
  }
11155
11873
  )
11156
11874
  ] }),
11157
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3 rounded-2xl bg-slate-50 p-4 text-sm text-slate-600", children: [
11158
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Shield, { strokeWidth: 2, className: "mt-0.5 h-8 w-8 text-primary" }),
11159
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
11160
- "By creating an account, you agree to our",
11161
- " ",
11162
- /* @__PURE__ */ jsxRuntime.jsx(Link7__default.default, { href: buildPath("/terms"), className: "font-semibold text-primary hover:opacity-70", children: "Terms of Service" }),
11163
- " ",
11164
- "and",
11165
- " ",
11166
- /* @__PURE__ */ jsxRuntime.jsx(
11167
- Link7__default.default,
11168
- {
11169
- href: buildPath("/privacy"),
11170
- className: "font-semibold text-primary hover:opacity-70",
11171
- children: "Privacy Policy"
11172
- }
11173
- ),
11174
- ". We protect your information with bank-level encryption."
11175
- ] })
11176
- ] }),
11177
11875
  /* @__PURE__ */ jsxRuntime.jsx(
11178
11876
  "button",
11179
11877
  {
11180
11878
  type: "submit",
11181
- disabled: isSubmitting,
11879
+ disabled: isSubmitting || !token,
11182
11880
  className: "w-full bg-secondary hover:opacity-80 text-white font-medium py-3 px-4 rounded-lg transition-colors disabled:opacity-70 disabled:cursor-not-allowed",
11183
- children: isSubmitting ? "Creating account..." : "Create my account"
11881
+ children: isSubmitting ? "Resetting Password..." : "Reset Password"
11184
11882
  }
11185
- )
11883
+ ),
11884
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 rounded-2xl border border-slate-200 bg-slate-50 px-4 py-3 text-sm text-slate-600", children: [
11885
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ShieldCheck, { className: "h-4 w-4 text-primary-600" }),
11886
+ "Use a strong password that you haven't used elsewhere."
11887
+ ] }),
11888
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pt-4 border-t border-slate-200", children: /* @__PURE__ */ jsxRuntime.jsx(
11889
+ Link9__default.default,
11890
+ {
11891
+ href: buildPath("/login"),
11892
+ className: "text-sm font-medium text-primary transition hover:opacity-80",
11893
+ children: "Back to login"
11894
+ }
11895
+ ) })
11186
11896
  ]
11187
11897
  }
11188
- ),
11189
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted", children: [
11190
- "Already have an account? ",
11191
- /* @__PURE__ */ jsxRuntime.jsx(Link7__default.default, { href: buildPath("/login"), className: "font-medium text-primary transition hover:opacity-90", children: "Sign in" })
11192
- ] }) })
11898
+ )
11193
11899
  ] })
11194
11900
  }
11195
11901
  ) }) });
@@ -11550,7 +12256,7 @@ function AccountOrdersTab() {
11550
12256
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-12 h-12 rounded-lg bg-slate-100 shrink-0 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
11551
12257
  Image4__default.default,
11552
12258
  {
11553
- src: item?.productVariantData?.productMedia?.[0]?.file || "/placeholder-product.jpg",
12259
+ src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.jpg",
11554
12260
  alt: item?.productVariantData?.name || "Product image",
11555
12261
  fill: true,
11556
12262
  className: "object-cover",
@@ -11867,12 +12573,32 @@ function AccountAddressesTab() {
11867
12573
  )
11868
12574
  ] });
11869
12575
  }
12576
+ init_sharedConfig();
11870
12577
  function AccountSettingsTab() {
11871
12578
  const router = navigation.useRouter();
11872
12579
  const { buildPath } = useBasePath();
12580
+ const { logout } = useAuth();
11873
12581
  const [emailNotifications, setEmailNotifications] = React8.useState(true);
11874
12582
  const [orderUpdates, setOrderUpdates] = React8.useState(true);
11875
12583
  const [promotionalEmails, setPromotionalEmails] = React8.useState(false);
12584
+ const [showDeleteModal, setShowDeleteModal] = React8.useState(false);
12585
+ const [isDeleting, setIsDeleting] = React8.useState(false);
12586
+ const [deleteError, setDeleteError] = React8.useState(null);
12587
+ const handleDeleteAccount = async () => {
12588
+ setIsDeleting(true);
12589
+ setDeleteError(null);
12590
+ try {
12591
+ const usersApi = new UsersApi(AXIOS_CONFIG);
12592
+ await usersApi.deleteMyProfile();
12593
+ logout();
12594
+ router.push(buildPath("/"));
12595
+ } catch (error) {
12596
+ setDeleteError(
12597
+ error?.response?.data?.message || "Failed to delete account. Please try again."
12598
+ );
12599
+ setIsDeleting(false);
12600
+ }
12601
+ };
11876
12602
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-6 space-y-6", children: [
11877
12603
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-2xl border border-slate-200 bg-white p-6", children: [
11878
12604
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
@@ -11959,11 +12685,7 @@ function AccountSettingsTab() {
11959
12685
  variant: "outline-solid",
11960
12686
  size: "sm",
11961
12687
  className: "border-red-200 text-red-600 hover:bg-red-50",
11962
- onClick: () => {
11963
- if (confirm("Are you sure you want to delete your account? This action cannot be undone.")) {
11964
- alert("Account deletion functionality coming soon");
11965
- }
11966
- },
12688
+ onClick: () => setShowDeleteModal(true),
11967
12689
  children: [
11968
12690
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4" }),
11969
12691
  "Delete"
@@ -11972,7 +12694,63 @@ function AccountSettingsTab() {
11972
12694
  )
11973
12695
  ] })
11974
12696
  ] })
11975
- ] })
12697
+ ] }),
12698
+ /* @__PURE__ */ jsxRuntime.jsx(
12699
+ Modal,
12700
+ {
12701
+ isOpen: showDeleteModal,
12702
+ onClose: () => {
12703
+ setShowDeleteModal(false);
12704
+ setDeleteError(null);
12705
+ },
12706
+ title: "Delete Account",
12707
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
12708
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3 rounded-lg border border-red-200 bg-red-50 p-4", children: [
12709
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangle, { className: "h-5 w-5 text-red-600 mt-0.5 flex-shrink-0" }),
12710
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12711
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold text-red-900", children: "Warning: This action is permanent" }),
12712
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-red-700 mt-1", children: "Deleting your account will permanently remove all your data, including:" }),
12713
+ /* @__PURE__ */ jsxRuntime.jsxs("ul", { className: "text-sm text-red-700 mt-2 ml-4 list-disc space-y-1", children: [
12714
+ /* @__PURE__ */ jsxRuntime.jsx("li", { children: "Personal information and profile" }),
12715
+ /* @__PURE__ */ jsxRuntime.jsx("li", { children: "Order history and tracking" }),
12716
+ /* @__PURE__ */ jsxRuntime.jsx("li", { children: "Saved addresses and payment methods" }),
12717
+ /* @__PURE__ */ jsxRuntime.jsx("li", { children: "Wishlist items" })
12718
+ ] })
12719
+ ] })
12720
+ ] }),
12721
+ deleteError && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700", children: [
12722
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Error: " }),
12723
+ deleteError
12724
+ ] }),
12725
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-slate-600", children: "Are you absolutely sure you want to delete your account? This action cannot be undone." }),
12726
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3 pt-2", children: [
12727
+ /* @__PURE__ */ jsxRuntime.jsx(
12728
+ Button,
12729
+ {
12730
+ variant: "outline-solid",
12731
+ onClick: () => {
12732
+ setShowDeleteModal(false);
12733
+ setDeleteError(null);
12734
+ },
12735
+ disabled: isDeleting,
12736
+ className: "flex-1",
12737
+ children: "Cancel"
12738
+ }
12739
+ ),
12740
+ /* @__PURE__ */ jsxRuntime.jsx(
12741
+ Button,
12742
+ {
12743
+ onClick: handleDeleteAccount,
12744
+ isLoading: isDeleting,
12745
+ disabled: isDeleting,
12746
+ className: "flex-1 bg-red-600 hover:bg-red-700 text-white",
12747
+ children: isDeleting ? "Deleting..." : "Delete Account"
12748
+ }
12749
+ )
12750
+ ] })
12751
+ ] })
12752
+ }
12753
+ )
11976
12754
  ] });
11977
12755
  }
11978
12756
  var tabs = [
@@ -12068,7 +12846,7 @@ function OrderCard({ order }) {
12068
12846
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-12 h-12 rounded-sm bg-gray-100 shrink-0 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
12069
12847
  Image4__default.default,
12070
12848
  {
12071
- src: item?.productVariantData?.productMedia?.[0]?.file || "/placeholder-product.jpg",
12849
+ src: item?.productVariantData?.media?.[0]?.file || "/placeholder-product.jpg",
12072
12850
  alt: item?.productVariantData?.name || "Product image",
12073
12851
  fill: true,
12074
12852
  className: "object-cover",
@@ -12402,7 +13180,7 @@ function CurrentOrdersScreen() {
12402
13180
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold uppercase tracking-[0.35em] text-white/70", children: "Quick actions" }),
12403
13181
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-4 space-y-3 text-sm text-white/80", children: [
12404
13182
  /* @__PURE__ */ jsxRuntime.jsxs(
12405
- Link7__default.default,
13183
+ Link9__default.default,
12406
13184
  {
12407
13185
  href: buildPath("/orders"),
12408
13186
  className: "flex items-center justify-between rounded-2xl bg-white/10 px-4 py-3 transition hover:bg-white/20",
@@ -12978,43 +13756,45 @@ function WishlistScreen() {
12978
13756
  }
12979
13757
  };
12980
13758
  const totalValue = React8.useMemo(
12981
- () => wishlistProducts.reduce((sum, product) => sum + (product.finalPrice ?? 0), 0),
13759
+ () => wishlistProducts.reduce((sum, product) => sum + (product.summary?.minPrice ?? 0), 0),
12982
13760
  [wishlistProducts]
12983
13761
  );
12984
13762
  React8.useMemo(
12985
13763
  () => wishlistProducts.reduce((sum, product) => {
12986
- const before = product.priceBeforeDiscount ?? product.finalPrice ?? 0;
12987
- const after = product.finalPrice ?? 0;
12988
- const savings = Math.max(before - after, 0);
12989
- return sum + savings;
13764
+ if (product.summary?.hasDiscount) {
13765
+ const maxPrice = product.summary?.maxPrice ?? 0;
13766
+ const minPrice = product.summary?.minPrice ?? 0;
13767
+ return sum + (maxPrice - minPrice);
13768
+ }
13769
+ return sum;
12990
13770
  }, 0),
12991
13771
  [wishlistProducts]
12992
13772
  );
12993
13773
  React8.useMemo(
12994
- () => wishlistProducts.filter((product) => (product.inventoryCount ?? 0) > 0).length,
13774
+ () => wishlistProducts.filter((product) => (product.summary?.totalInventory ?? 0) > 0).length,
12995
13775
  [wishlistProducts]
12996
13776
  );
12997
13777
  const processedProducts = React8.useMemo(() => {
12998
13778
  let list = [...wishlistProducts];
12999
13779
  if (onlyInStock) {
13000
- list = list.filter((product) => (product.inventoryCount ?? 0) > 0);
13780
+ list = list.filter((product) => (product.summary?.totalInventory ?? 0) > 0);
13001
13781
  }
13002
13782
  switch (sortOption) {
13003
13783
  case "price-low":
13004
- list.sort((a, b) => (a.finalPrice ?? 0) - (b.finalPrice ?? 0));
13784
+ list.sort((a, b) => (a.summary?.minPrice ?? 0) - (b.summary?.minPrice ?? 0));
13005
13785
  break;
13006
13786
  case "price-high":
13007
- list.sort((a, b) => (b.finalPrice ?? 0) - (a.finalPrice ?? 0));
13787
+ list.sort((a, b) => (b.summary?.maxPrice ?? 0) - (a.summary?.maxPrice ?? 0));
13008
13788
  break;
13009
13789
  case "name":
13010
13790
  list.sort((a, b) => (a.name || "").localeCompare(b.name || ""));
13011
13791
  break;
13012
13792
  case "availability":
13013
- list.sort((a, b) => (b.inventoryCount ?? 0) - (a.inventoryCount ?? 0));
13793
+ list.sort((a, b) => (b.summary?.totalInventory ?? 0) - (a.summary?.totalInventory ?? 0));
13014
13794
  break;
13015
13795
  case "featured":
13016
13796
  default:
13017
- list.sort((a, b) => (b.totalSold ?? 0) - (a.totalSold ?? 0));
13797
+ list.sort((a, b) => (b.summary?.totalSold ?? 0) - (a.summary?.totalSold ?? 0));
13018
13798
  break;
13019
13799
  }
13020
13800
  return list;
@@ -13155,8 +13935,8 @@ function WishlistScreen() {
13155
13935
  ProductCard,
13156
13936
  {
13157
13937
  product,
13158
- onClickProduct: (p) => router.push(buildPath(`/products/${p.id}`)),
13159
- onFavorite: () => handleRemoveFromWishlist(product.id),
13938
+ onClickProduct: (p) => router.push(buildPath(`/products/${p._id}`)),
13939
+ onFavorite: () => handleRemoveFromWishlist(product._id || product.id || ""),
13160
13940
  isFavorited: true
13161
13941
  }
13162
13942
  )
@@ -13178,7 +13958,7 @@ function WishlistScreen() {
13178
13958
  Image4__default.default,
13179
13959
  {
13180
13960
  fill: true,
13181
- src: product.productMedia?.[0]?.file || "/placeholder-product.jpg",
13961
+ src: product.media?.[0]?.file || "/placeholder-product.jpg",
13182
13962
  alt: product.name || "Wishlist item",
13183
13963
  className: "h-full w-full object-cover"
13184
13964
  }
@@ -13187,24 +13967,24 @@ function WishlistScreen() {
13187
13967
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
13188
13968
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
13189
13969
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold text-secondary", children: product.name }),
13190
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted", children: product.parentCategories?.map((category) => category?.name).join(", ") || "General wellness" })
13970
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted", children: "General wellness" })
13191
13971
  ] }),
13192
13972
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-right", children: [
13193
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-bold text-primary", children: formatPrice(product.finalPrice ?? 0) }),
13194
- product.isDiscounted && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-emerald-500", children: [
13973
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-bold text-primary", children: formatPrice(product.summary?.minPrice ?? 0) }),
13974
+ product.summary?.hasDiscount && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-emerald-500", children: [
13195
13975
  "You save ",
13196
- formatPrice(Math.max((product.priceBeforeDiscount ?? 0) - (product.finalPrice ?? 0), 0))
13976
+ formatPrice(Math.max((product.summary?.maxPrice ?? 0) - (product.summary?.minPrice ?? 0), 0))
13197
13977
  ] })
13198
13978
  ] })
13199
13979
  ] }),
13200
13980
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-3 text-xs text-slate-500", children: [
13201
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: `inline-flex items-center gap-1 rounded-full px-2.5 py-1 font-medium ${product.inventoryCount > 0 ? "bg-emerald-100 text-emerald-700" : "bg-rose-100 text-rose-700"}`, children: [
13981
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: `inline-flex items-center gap-1 rounded-full px-2.5 py-1 font-medium ${(product.summary?.totalInventory ?? 0) > 0 ? "bg-emerald-100 text-emerald-700" : "bg-rose-100 text-rose-700"}`, children: [
13202
13982
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Package, { className: "h-3.5 w-3.5" }),
13203
- product.inventoryCount > 0 ? "In stock" : "Backordered"
13983
+ (product.summary?.totalInventory ?? 0) > 0 ? "In stock" : "Backordered"
13204
13984
  ] }),
13205
- product.totalSold > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1 rounded-full bg-slate-200 px-2.5 py-1 font-medium text-slate-700", children: [
13985
+ (product.summary?.totalSold ?? 0) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1 rounded-full bg-slate-200 px-2.5 py-1 font-medium text-slate-700", children: [
13206
13986
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "h-3.5 w-3.5" }),
13207
- product.totalSold,
13987
+ product.summary?.totalSold,
13208
13988
  "+ purchased"
13209
13989
  ] })
13210
13990
  ] }),
@@ -13213,17 +13993,16 @@ function WishlistScreen() {
13213
13993
  Button,
13214
13994
  {
13215
13995
  size: "sm",
13216
- onClick: () => router.push(buildPath(`/products/${product.id}`)),
13996
+ onClick: () => router.push(buildPath(`/products/${product._id}`)),
13997
+ className: "bg-primary/90 text-white hover:bg-primary/70",
13217
13998
  children: "View details"
13218
13999
  }
13219
14000
  ),
13220
14001
  /* @__PURE__ */ jsxRuntime.jsx(
13221
- Button,
14002
+ "button",
13222
14003
  {
13223
- size: "sm",
13224
- variant: "outline-solid",
13225
- onClick: () => handleRemoveFromWishlist(product.id),
13226
- className: "text-secondary",
14004
+ onClick: () => handleRemoveFromWishlist(product._id || product.id || ""),
14005
+ className: "text-red-500 hover:text-red-600 hover:bg-red-50 transition-colors cursor-pointer border border-red-500 rounded-full px-4 py-1 text-sm flex-row",
13227
14006
  children: "Remove"
13228
14007
  }
13229
14008
  )
@@ -13262,34 +14041,85 @@ function SearchPage() {
13262
14041
  const [searchInput, setSearchInput] = React8.useState(searchQuery);
13263
14042
  const [hasSearched, setHasSearched] = React8.useState(false);
13264
14043
  const { isInWishlist } = useWishlist();
14044
+ const [suggestions, setSuggestions] = React8.useState([]);
14045
+ const [showSuggestions, setShowSuggestions] = React8.useState(false);
14046
+ const [recentSearches, setRecentSearches] = React8.useState([]);
14047
+ React8.useEffect(() => {
14048
+ const stored = localStorage.getItem("recent_searches");
14049
+ if (stored) {
14050
+ try {
14051
+ setRecentSearches(JSON.parse(stored));
14052
+ } catch (e) {
14053
+ console.error("Failed to parse recent searches", e);
14054
+ }
14055
+ }
14056
+ }, []);
14057
+ const saveRecentSearch = React8.useCallback((query) => {
14058
+ if (!query.trim()) return;
14059
+ setRecentSearches((prev) => {
14060
+ const updated = [query, ...prev.filter((s) => s !== query)].slice(0, 5);
14061
+ localStorage.setItem("recent_searches", JSON.stringify(updated));
14062
+ return updated;
14063
+ });
14064
+ }, []);
14065
+ const generateSuggestions = React8.useMemo(() => {
14066
+ if (!searchInput.trim() || searchInput.length < 2) {
14067
+ return [];
14068
+ }
14069
+ const query = searchInput.toLowerCase().trim();
14070
+ const suggestionSet = /* @__PURE__ */ new Set();
14071
+ products.forEach((product) => {
14072
+ if (product.name?.toLowerCase().includes(query)) {
14073
+ suggestionSet.add(product.name);
14074
+ }
14075
+ if (product.brand?.toLowerCase().includes(query)) {
14076
+ suggestionSet.add(product.brand);
14077
+ }
14078
+ product.tags?.forEach((tag) => {
14079
+ if (tag.toLowerCase().includes(query)) {
14080
+ suggestionSet.add(tag);
14081
+ }
14082
+ });
14083
+ });
14084
+ return Array.from(suggestionSet).slice(0, 5);
14085
+ }, [searchInput, products]);
14086
+ React8.useEffect(() => {
14087
+ setSuggestions(generateSuggestions);
14088
+ }, [generateSuggestions]);
14089
+ const sanitizeSearchInput = React8.useCallback((input) => {
14090
+ let sanitized = input.trim();
14091
+ sanitized = sanitized.replace(/\s+/g, " ");
14092
+ return sanitized;
14093
+ }, []);
13265
14094
  React8.useEffect(() => {
13266
14095
  const fetchSearchResults = async () => {
13267
- if (!searchQuery.trim()) {
14096
+ const sanitizedQuery = sanitizeSearchInput(searchQuery);
14097
+ if (!sanitizedQuery) {
13268
14098
  setProducts([]);
13269
14099
  setIsLoading(false);
14100
+ setHasSearched(false);
13270
14101
  return;
13271
14102
  }
13272
14103
  try {
13273
14104
  setIsLoading(true);
13274
14105
  const api = new ProductsApi(AXIOS_CONFIG);
13275
- const response = await api.getAllProductsForStore(
13276
- searchQuery,
13277
- void 0,
13278
- // productType
13279
- void 0,
13280
- // categoryId
14106
+ let response = await api.getAllProducts(
14107
+ sanitizedQuery,
14108
+ // searchTerm
13281
14109
  void 0,
13282
14110
  // maxPrice
13283
14111
  void 0,
13284
14112
  // minPrice
13285
14113
  void 0,
13286
14114
  // brandFilter
13287
- "in-stock",
14115
+ void 0,
13288
14116
  // availability
13289
14117
  "relevance",
13290
14118
  // sort
13291
- true,
13292
- // includeNoVariantProducts
14119
+ void 0,
14120
+ // subCategoryId
14121
+ void 0,
14122
+ // categoryId
13293
14123
  true,
13294
14124
  // isActive
13295
14125
  20,
@@ -13297,33 +14127,64 @@ function SearchPage() {
13297
14127
  1
13298
14128
  // page
13299
14129
  );
14130
+ console.log("Search API Response:", {
14131
+ query: sanitizedQuery,
14132
+ status: response.status,
14133
+ dataLength: response.data?.data?.length,
14134
+ totalItems: response.data?.totalItems
14135
+ });
13300
14136
  if (response.data?.data) {
13301
14137
  const transformedProducts = response.data.data.map((item) => ({
13302
14138
  ...item,
13303
14139
  id: item._id || ""
13304
14140
  }));
13305
14141
  setProducts(transformedProducts);
14142
+ if (transformedProducts.length > 0) {
14143
+ saveRecentSearch(sanitizedQuery);
14144
+ }
13306
14145
  } else {
13307
14146
  setProducts([]);
13308
14147
  }
13309
14148
  setHasSearched(true);
13310
14149
  } catch (error) {
13311
14150
  console.error("Error fetching search results:", error);
14151
+ if (error instanceof Error) {
14152
+ console.error("Error details:", error.message);
14153
+ }
13312
14154
  setProducts([]);
14155
+ setHasSearched(true);
13313
14156
  } finally {
13314
14157
  setIsLoading(false);
13315
14158
  }
13316
14159
  };
13317
14160
  fetchSearchResults();
13318
- }, [searchQuery]);
14161
+ }, [searchQuery, sanitizeSearchInput, saveRecentSearch]);
13319
14162
  const handleSearch = (e) => {
13320
14163
  e.preventDefault();
13321
- if (searchInput.trim()) {
13322
- window.location.href = `/search?q=${encodeURIComponent(searchInput.trim())}`;
14164
+ const sanitized = sanitizeSearchInput(searchInput);
14165
+ if (sanitized) {
14166
+ setShowSuggestions(false);
14167
+ router.push(buildPath(`/search?q=${encodeURIComponent(sanitized)}`));
13323
14168
  }
13324
14169
  };
13325
14170
  const clearSearch = () => {
13326
14171
  setSearchInput("");
14172
+ setShowSuggestions(false);
14173
+ };
14174
+ const handleSuggestionClick = (suggestion) => {
14175
+ setSearchInput(suggestion);
14176
+ setShowSuggestions(false);
14177
+ router.push(buildPath(`/search?q=${encodeURIComponent(suggestion)}`));
14178
+ };
14179
+ const handleInputChange = (e) => {
14180
+ const value = e.target.value;
14181
+ setSearchInput(value);
14182
+ setShowSuggestions(value.trim().length >= 2);
14183
+ };
14184
+ const handleInputFocus = () => {
14185
+ if (searchInput.trim().length >= 2) {
14186
+ setShowSuggestions(true);
14187
+ }
13327
14188
  };
13328
14189
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "container mx-auto px-4 py-8", children: [
13329
14190
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-2xl mx-auto mb-8", children: /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSearch, className: "relative", children: [
@@ -13334,9 +14195,12 @@ function SearchPage() {
13334
14195
  {
13335
14196
  type: "text",
13336
14197
  value: searchInput,
13337
- onChange: (e) => setSearchInput(e.target.value),
14198
+ onChange: handleInputChange,
14199
+ onFocus: handleInputFocus,
14200
+ onBlur: () => setTimeout(() => setShowSuggestions(false), 200),
13338
14201
  placeholder: "Search for products...",
13339
- className: "pl-10 pr-10 py-6 text-base rounded-lg border-gray-300 focus:ring-2 focus:ring-primary-500 focus:border-primary-500"
14202
+ className: "pl-10 pr-10 py-6 text-base rounded-lg border-gray-300 focus:ring-2 focus:ring-primary-500 focus:border-primary-500",
14203
+ autoComplete: "off"
13340
14204
  }
13341
14205
  ),
13342
14206
  searchInput && /* @__PURE__ */ jsxRuntime.jsx(
@@ -13347,13 +14211,64 @@ function SearchPage() {
13347
14211
  className: "absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",
13348
14212
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-5 w-5" })
13349
14213
  }
13350
- )
14214
+ ),
14215
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: showSuggestions && (suggestions.length > 0 || recentSearches.length > 0) && /* @__PURE__ */ jsxRuntime.jsxs(
14216
+ framerMotion.motion.div,
14217
+ {
14218
+ initial: { opacity: 0, y: -10 },
14219
+ animate: { opacity: 1, y: 0 },
14220
+ exit: { opacity: 0, y: -10 },
14221
+ transition: { duration: 0.2 },
14222
+ className: "absolute z-50 w-full mt-2 bg-white rounded-lg shadow-lg border border-gray-200 overflow-hidden",
14223
+ children: [
14224
+ suggestions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-2", children: [
14225
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-2 text-xs font-semibold text-gray-500 uppercase tracking-wider flex items-center gap-2", children: [
14226
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.TrendingUp, { className: "h-3 w-3" }),
14227
+ "Suggestions"
14228
+ ] }),
14229
+ suggestions.map((suggestion, index) => /* @__PURE__ */ jsxRuntime.jsxs(
14230
+ "button",
14231
+ {
14232
+ type: "button",
14233
+ onClick: () => handleSuggestionClick(suggestion),
14234
+ className: "w-full text-left px-3 py-2.5 hover:bg-gray-50 rounded-md transition-colors flex items-center gap-2 group",
14235
+ children: [
14236
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "h-4 w-4 text-gray-400 group-hover:text-primary-500" }),
14237
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-gray-700 group-hover:text-gray-900", children: suggestion })
14238
+ ]
14239
+ },
14240
+ index
14241
+ ))
14242
+ ] }),
14243
+ recentSearches.length > 0 && !searchInput.trim() && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-2 border-t border-gray-100", children: [
14244
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-2 text-xs font-semibold text-gray-500 uppercase tracking-wider flex items-center gap-2", children: [
14245
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: "h-3 w-3" }),
14246
+ "Recent Searches"
14247
+ ] }),
14248
+ recentSearches.map((search, index) => /* @__PURE__ */ jsxRuntime.jsxs(
14249
+ "button",
14250
+ {
14251
+ type: "button",
14252
+ onClick: () => handleSuggestionClick(search),
14253
+ className: "w-full text-left px-3 py-2.5 hover:bg-gray-50 rounded-md transition-colors flex items-center gap-2 group",
14254
+ children: [
14255
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: "h-4 w-4 text-gray-400 group-hover:text-primary-500" }),
14256
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-gray-700 group-hover:text-gray-900", children: search })
14257
+ ]
14258
+ },
14259
+ index
14260
+ ))
14261
+ ] })
14262
+ ]
14263
+ }
14264
+ ) })
13351
14265
  ] }),
13352
14266
  /* @__PURE__ */ jsxRuntime.jsx(
13353
14267
  "button",
13354
14268
  {
13355
14269
  type: "submit",
13356
- className: "mt-4 w-full bg-primary-600 hover:bg-primary-700 text-white font-medium py-2 px-4 rounded-lg transition-colors",
14270
+ className: "mt-4 w-full bg-primary-600 hover:bg-primary-700 text-white font-medium py-2 px-4 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
14271
+ disabled: !searchInput.trim(),
13357
14272
  children: "Search"
13358
14273
  }
13359
14274
  )
@@ -13373,17 +14288,63 @@ function SearchPage() {
13373
14288
  },
13374
14289
  product.id
13375
14290
  )) }) : hasSearched ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center py-12", children: [
13376
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-gray-500 text-lg mb-4", children: [
13377
- 'No products found for "',
13378
- searchQuery,
13379
- '"'
14291
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6", children: [
14292
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-16 h-16 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-4", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "h-8 w-8 text-gray-400" }) }),
14293
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-semibold text-gray-900 mb-2", children: "No products found" }),
14294
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-gray-500 text-base mb-1", children: [
14295
+ `We couldn't find any products matching "`,
14296
+ searchQuery,
14297
+ '"'
14298
+ ] }),
14299
+ /* @__PURE__ */ jsxRuntime.jsx(
14300
+ "button",
14301
+ {
14302
+ onClick: clearSearch,
14303
+ className: "px-6 py-2.5 mt-4 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors font-medium border border-gray-300 bg-white cursor-pointer",
14304
+ children: "Clear Search"
14305
+ }
14306
+ )
13380
14307
  ] }),
13381
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-gray-500 mb-6", children: [
13382
- "Try different keywords or check out our",
13383
- " ",
13384
- /* @__PURE__ */ jsxRuntime.jsx(Link7__default.default, { href: "/shop", className: "text-primary-600 hover:underline ml-1 font-medium", children: "featured products" })
14308
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col sm:flex-row gap-3 justify-center items-center", children: /* @__PURE__ */ jsxRuntime.jsx(
14309
+ Link9__default.default,
14310
+ {
14311
+ href: buildPath("/shop"),
14312
+ className: "px-6 py-2.5 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors font-medium",
14313
+ children: "Browse All Products"
14314
+ }
14315
+ ) }),
14316
+ recentSearches.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-8 pt-8 border-t border-gray-200", children: [
14317
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-gray-700 mb-3", children: "Recent Searches:" }),
14318
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2 justify-center", children: recentSearches.map((search, index) => /* @__PURE__ */ jsxRuntime.jsx(
14319
+ "button",
14320
+ {
14321
+ onClick: () => handleSuggestionClick(search),
14322
+ className: "px-3 py-1.5 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-full text-sm transition-colors",
14323
+ children: search
14324
+ },
14325
+ index
14326
+ )) })
14327
+ ] })
14328
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center py-12", children: [
14329
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-16 h-16 bg-primary-50 rounded-full flex items-center justify-center mx-auto mb-4", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "h-8 w-8 text-primary-500" }) }),
14330
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-semibold text-gray-900 mb-2", children: "Start Searching" }),
14331
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-gray-500 mb-6", children: "Enter a search term above to find products" }),
14332
+ recentSearches.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-md mx-auto", children: [
14333
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-gray-700 mb-3", children: "Recent Searches:" }),
14334
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2 justify-center", children: recentSearches.map((search, index) => /* @__PURE__ */ jsxRuntime.jsxs(
14335
+ "button",
14336
+ {
14337
+ onClick: () => handleSuggestionClick(search),
14338
+ className: "px-3 py-1.5 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-full text-sm transition-colors flex items-center gap-2",
14339
+ children: [
14340
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: "h-3 w-3" }),
14341
+ search
14342
+ ]
14343
+ },
14344
+ index
14345
+ )) })
13385
14346
  ] })
13386
- ] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center py-12", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-gray-500", children: "Enter a search term to find products" }) })
14347
+ ] })
13387
14348
  ] })
13388
14349
  ] });
13389
14350
  }
@@ -13684,7 +14645,17 @@ function EditProfileScreen() {
13684
14645
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Phone, { className: "absolute left-3 top-[38px] h-4 w-4 text-slate-400" })
13685
14646
  ] }),
13686
14647
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-3", children: [
13687
- /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "submit", size: "lg", isLoading: isSubmitting, children: "Save changes" }),
14648
+ /* @__PURE__ */ jsxRuntime.jsx(
14649
+ Button,
14650
+ {
14651
+ type: "submit",
14652
+ size: "lg",
14653
+ isLoading: isSubmitting,
14654
+ className: "border-slate-300 text-slate-800 hover:bg-slate-50",
14655
+ variant: "outline-solid",
14656
+ children: "Save changes"
14657
+ }
14658
+ ),
13688
14659
  /* @__PURE__ */ jsxRuntime.jsx(
13689
14660
  Button,
13690
14661
  {
@@ -13731,7 +14702,7 @@ function Header() {
13731
14702
  { href: buildPath("/shop"), label: "Shop" }
13732
14703
  ];
13733
14704
  return /* @__PURE__ */ jsxRuntime.jsx("header", { className: "sticky top-0 z-10 bg-white/80 backdrop-blur-xl border-b border-gray-200 shadow-xs", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "container mx-auto px-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between h-20", children: [
13734
- /* @__PURE__ */ jsxRuntime.jsx(Link7__default.default, { href: buildPath("/"), className: "flex items-center gap-3", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-12 h-12", children: /* @__PURE__ */ jsxRuntime.jsx(
14705
+ /* @__PURE__ */ jsxRuntime.jsx(Link9__default.default, { href: buildPath("/"), className: "flex items-center gap-3", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-12 h-12", children: /* @__PURE__ */ jsxRuntime.jsx(
13735
14706
  Image4__default.default,
13736
14707
  {
13737
14708
  src: config.logo,
@@ -13741,7 +14712,7 @@ function Header() {
13741
14712
  }
13742
14713
  ) }) }),
13743
14714
  /* @__PURE__ */ jsxRuntime.jsx("nav", { className: "hidden lg:flex items-center gap-8", children: navLinks.map((link) => /* @__PURE__ */ jsxRuntime.jsxs(
13744
- Link7__default.default,
14715
+ Link9__default.default,
13745
14716
  {
13746
14717
  href: link.href,
13747
14718
  className: "text-gray-700 hover:text-primary-600 font-medium transition-colors relative group",
@@ -13779,13 +14750,19 @@ function Header() {
13779
14750
  value: searchQuery,
13780
14751
  onChange: (e) => setSearchQuery(e.target.value),
13781
14752
  onKeyDown: (e) => {
13782
- if (e.key === "Enter" && searchQuery.trim()) {
13783
- window.location.href = buildPath(`/search?q=${encodeURIComponent(searchQuery.trim())}`);
14753
+ if (e.key === "Enter") {
14754
+ const sanitized = searchQuery.trim().replace(/\s+/g, " ");
14755
+ if (sanitized) {
14756
+ router.push(buildPath(`/search?q=${encodeURIComponent(sanitized)}`));
14757
+ setIsSearchOpen(false);
14758
+ setSearchQuery("");
14759
+ }
13784
14760
  }
13785
14761
  },
13786
14762
  placeholder: "Search products...",
13787
14763
  className: "w-full outline-hidden text-gray-700",
13788
- autoFocus: true
14764
+ autoFocus: true,
14765
+ autoComplete: "off"
13789
14766
  }
13790
14767
  ),
13791
14768
  searchQuery && /* @__PURE__ */ jsxRuntime.jsx(
@@ -13801,11 +14778,11 @@ function Header() {
13801
14778
  ) })
13802
14779
  ] }),
13803
14780
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4", children: [
13804
- /* @__PURE__ */ jsxRuntime.jsxs(Link7__default.default, { href: buildPath("/wishlist"), className: "relative p-2 text-gray-700 hover:text-red-500 transition-colors", children: [
14781
+ /* @__PURE__ */ jsxRuntime.jsxs(Link9__default.default, { href: buildPath("/wishlist"), className: "relative p-2 text-gray-700 hover:text-red-500 transition-colors", children: [
13805
14782
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heart, { className: "w-6 h-6" }),
13806
14783
  wishlistCount > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute -top-1 -right-1 bg-red-500 text-white text-xs font-bold rounded-full w-5 h-5 flex items-center justify-center", children: wishlistCount })
13807
14784
  ] }),
13808
- /* @__PURE__ */ jsxRuntime.jsxs(Link7__default.default, { href: buildPath("/cart"), className: "relative p-2 text-gray-700 hover:text-primary-600 transition-colors", children: [
14785
+ /* @__PURE__ */ jsxRuntime.jsxs(Link9__default.default, { href: buildPath("/cart"), className: "relative p-2 text-gray-700 hover:text-primary-600 transition-colors", children: [
13809
14786
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ShoppingCart, { className: "w-6 h-6" }),
13810
14787
  cart?.cartBody?.items?.length && cart.cartBody?.items?.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute -top-1 -right-1 bg-red-500 text-white text-xs font-bold rounded-full w-5 h-5 flex items-center justify-center", children: cart.cartBody?.items?.length }) : null
13811
14788
  ] }),
@@ -13839,7 +14816,7 @@ function Header() {
13839
14816
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-slate-500 truncate", children: user?.email })
13840
14817
  ] }),
13841
14818
  /* @__PURE__ */ jsxRuntime.jsxs(
13842
- Link7__default.default,
14819
+ Link9__default.default,
13843
14820
  {
13844
14821
  href: buildPath("/account"),
13845
14822
  onClick: () => setIsDropdownOpen(false),
@@ -13866,7 +14843,7 @@ function Header() {
13866
14843
  ] }) })
13867
14844
  ] })
13868
14845
  ] }) : /* @__PURE__ */ jsxRuntime.jsx(
13869
- Link7__default.default,
14846
+ Link9__default.default,
13870
14847
  {
13871
14848
  href: buildPath("/login"),
13872
14849
  className: "hidden sm:block px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors font-medium",
@@ -13892,7 +14869,7 @@ function Header() {
13892
14869
  className: "lg:hidden overflow-hidden border-t border-gray-200",
13893
14870
  children: /* @__PURE__ */ jsxRuntime.jsxs("nav", { className: "flex flex-col gap-1 py-2", children: [
13894
14871
  navLinks.map((link) => /* @__PURE__ */ jsxRuntime.jsx(
13895
- Link7__default.default,
14872
+ Link9__default.default,
13896
14873
  {
13897
14874
  href: link.href,
13898
14875
  className: "px-4 py-3 text-gray-700 hover:bg-gray-50 rounded-lg font-medium",
@@ -13902,7 +14879,7 @@ function Header() {
13902
14879
  link.href
13903
14880
  )),
13904
14881
  !isAuthenticated && /* @__PURE__ */ jsxRuntime.jsx(
13905
- Link7__default.default,
14882
+ Link9__default.default,
13906
14883
  {
13907
14884
  href: buildPath("/login"),
13908
14885
  onClick: () => setIsMobileMenuOpen(false),
@@ -13970,7 +14947,7 @@ function Footer() {
13970
14947
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
13971
14948
  /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "text-lg font-semibold text-white mb-4", children: "Shop" }),
13972
14949
  /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-2", children: footerLinks.shop.map((link) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
13973
- Link7__default.default,
14950
+ Link9__default.default,
13974
14951
  {
13975
14952
  href: link.href,
13976
14953
  className: "hover:text-primary-500 transition-colors",
@@ -13981,7 +14958,7 @@ function Footer() {
13981
14958
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
13982
14959
  /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "text-lg font-semibold text-white mb-4", children: "Account" }),
13983
14960
  /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-2", children: footerLinks.account.map((link) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
13984
- Link7__default.default,
14961
+ Link9__default.default,
13985
14962
  {
13986
14963
  href: link.href,
13987
14964
  className: "hover:text-primary-500 transition-colors",
@@ -13992,7 +14969,7 @@ function Footer() {
13992
14969
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
13993
14970
  /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "text-lg font-semibold text-white mb-4", children: "Support" }),
13994
14971
  /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-2", children: footerLinks.support.map((link) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
13995
- Link7__default.default,
14972
+ Link9__default.default,
13996
14973
  {
13997
14974
  href: link.href,
13998
14975
  className: "hover:text-primary-500 transition-colors",
@@ -14052,6 +15029,7 @@ exports.EcommerceProvider = EcommerceProvider;
14052
15029
  exports.EditProfileScreen = EditProfileScreen;
14053
15030
  exports.EmptyState = EmptyState;
14054
15031
  exports.Footer = Footer;
15032
+ exports.ForgotPasswordScreen = ForgotPasswordScreen;
14055
15033
  exports.Header = Header;
14056
15034
  exports.Input = Input;
14057
15035
  exports.LoginScreen = LoginScreen;
@@ -14065,6 +15043,7 @@ exports.ProductCardSkeleton = ProductCardSkeleton;
14065
15043
  exports.ProductDetailScreen = ProductDetailScreen;
14066
15044
  exports.ProfileScreen = AccountPage;
14067
15045
  exports.RegisterScreen = RegisterScreen;
15046
+ exports.ResetPasswordScreen = ResetPasswordScreen;
14068
15047
  exports.SearchResultsScreen = SearchPage;
14069
15048
  exports.ShopScreen = ShopScreen;
14070
15049
  exports.Skeleton = Skeleton;