3a-ecommerce-utils 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,3 +1,128 @@
1
+ import {
2
+ ADD_ADDRESS_MUTATION,
3
+ AUTH_COOKIE_NAMES,
4
+ CANCEL_ORDER_MUTATION,
5
+ CREATE_CATEGORY_MUTATION,
6
+ CREATE_COUPON_MUTATION,
7
+ CREATE_ORDER_MUTATION,
8
+ CREATE_PRODUCT_MUTATION,
9
+ CREATE_REVIEW_MUTATION,
10
+ DASHBOARD_STATS_QUERY,
11
+ DELETE_ADDRESS_MUTATION,
12
+ DELETE_CATEGORY_MUTATION,
13
+ DELETE_COUPON_MUTATION,
14
+ DELETE_PRODUCT_MUTATION,
15
+ DELETE_REVIEW_MUTATION,
16
+ DELETE_USER_MUTATION,
17
+ FORGOT_PASSWORD_MUTATION,
18
+ GET_CATEGORIES_QUERY,
19
+ GET_CATEGORY_QUERY,
20
+ GET_COUPONS_QUERY,
21
+ GET_COUPON_QUERY,
22
+ GET_ME_QUERY,
23
+ GET_MY_ADDRESSES_QUERY,
24
+ GET_ORDERS_BY_CUSTOMER_QUERY,
25
+ GET_ORDERS_QUERY,
26
+ GET_ORDER_QUERY,
27
+ GET_PRODUCTS_BY_SELLER_QUERY,
28
+ GET_PRODUCTS_QUERY,
29
+ GET_PRODUCT_QUERY,
30
+ GET_PRODUCT_REVIEWS_QUERY,
31
+ GET_USERS_QUERY,
32
+ GET_USER_BY_ID_QUERY,
33
+ GET_USER_QUERY,
34
+ GOOGLE_AUTH_MUTATION,
35
+ LOGIN_MUTATION,
36
+ LOGOUT_MUTATION,
37
+ Logger,
38
+ MARK_REVIEW_HELPFUL_MUTATION,
39
+ REGISTER_MUTATION,
40
+ RESET_PASSWORD_MUTATION,
41
+ SALES_ANALYTICS_QUERY,
42
+ SEARCH_PRODUCTS_QUERY,
43
+ SEND_VERIFICATION_EMAIL_MUTATION,
44
+ SET_DEFAULT_ADDRESS_MUTATION,
45
+ TOGGLE_COUPON_STATUS_MUTATION,
46
+ UPDATE_ADDRESS_MUTATION,
47
+ UPDATE_CATEGORY_MUTATION,
48
+ UPDATE_COUPON_MUTATION,
49
+ UPDATE_ORDER_STATUS_MUTATION,
50
+ UPDATE_PAYMENT_STATUS_MUTATION,
51
+ UPDATE_PRODUCT_MUTATION,
52
+ UPDATE_PROFILE_MUTATION,
53
+ UPDATE_USER_ROLE_MUTATION,
54
+ VALIDATE_COUPON_QUERY,
55
+ VALIDATE_RESET_TOKEN_QUERY,
56
+ VERIFY_EMAIL_MUTATION,
57
+ addDays,
58
+ addHours,
59
+ areCookiesEnabled,
60
+ calculateDiscount,
61
+ calculatePercentage,
62
+ calculateTax,
63
+ capitalize,
64
+ capitalizeWords,
65
+ chunk,
66
+ clearAuth,
67
+ createApiResponse,
68
+ debounce,
69
+ deepMerge,
70
+ delay,
71
+ difference,
72
+ flatten,
73
+ formatCurrency,
74
+ formatDate,
75
+ formatIndianCompact,
76
+ formatNumber,
77
+ formatPrice,
78
+ formatPriceShort,
79
+ generateRandomCode,
80
+ getAccessToken,
81
+ getCookie,
82
+ getCurrentUser,
83
+ getDaysDifference,
84
+ getNestedValue,
85
+ getRefreshToken,
86
+ getStoredAuth,
87
+ groupBy,
88
+ intersection,
89
+ isArray,
90
+ isBoolean,
91
+ isDateInRange,
92
+ isEmpty,
93
+ isFunction,
94
+ isFutureDate,
95
+ isNull,
96
+ isNullOrUndefined,
97
+ isNumber,
98
+ isObject,
99
+ isPastDate,
100
+ isString,
101
+ isTokenExpired,
102
+ isUndefined,
103
+ omit,
104
+ pick,
105
+ removeCookie,
106
+ removeDuplicates,
107
+ retry,
108
+ roundDown,
109
+ roundUp,
110
+ setCookie,
111
+ setNestedValue,
112
+ setupAutoRefresh,
113
+ slugify,
114
+ sortBy,
115
+ storeAuth,
116
+ throttle,
117
+ toTitleCase,
118
+ truncate,
119
+ tryParse,
120
+ unique,
121
+ updateAccessToken,
122
+ validateUserRole,
123
+ willTokenExpireSoon,
124
+ withErrorHandling
125
+ } from "./chunk-NOOKRTMI.mjs";
1
126
  import {
2
127
  ADMIN_APP_URL,
3
128
  API_ENDPOINTS,
@@ -9,7 +134,6 @@ import {
9
134
  ERROR_MESSAGES,
10
135
  HTTP_STATUS,
11
136
  JWT_CONFIG,
12
- LogLevel,
13
137
  ORDER_CONFIG,
14
138
  PAGINATION,
15
139
  PORT_CONFIG,
@@ -50,7 +174,7 @@ import {
50
174
  validateRating,
51
175
  validateSku,
52
176
  validateUrl
53
- } from "./chunk-PEAZVBSD.mjs";
177
+ } from "./chunk-E26IEY7N.mjs";
54
178
 
55
179
  // ../../node_modules/delayed-stream/lib/delayed_stream.js
56
180
  var require_delayed_stream = __commonJS({
@@ -11690,1137 +11814,6 @@ var require_follow_redirects = __commonJS({
11690
11814
  }
11691
11815
  });
11692
11816
 
11693
- // src/cookies.ts
11694
- var DEFAULT_OPTIONS = {
11695
- path: "/",
11696
- secure: process.env.NODE_ENV === "production",
11697
- sameSite: "Lax"
11698
- };
11699
- var setCookie = (name, value, options = {}) => {
11700
- if (typeof document === "undefined") return;
11701
- const opts = { ...DEFAULT_OPTIONS, ...options };
11702
- let cookieString = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
11703
- if (opts.expires) {
11704
- const date = /* @__PURE__ */ new Date();
11705
- date.setTime(date.getTime() + opts.expires * 24 * 60 * 60 * 1e3);
11706
- cookieString += `; expires=${date.toUTCString()}`;
11707
- }
11708
- if (opts.path) {
11709
- cookieString += `; path=${opts.path}`;
11710
- }
11711
- if (opts.domain) {
11712
- cookieString += `; domain=${opts.domain}`;
11713
- }
11714
- if (opts.secure) {
11715
- cookieString += "; secure";
11716
- }
11717
- if (opts.sameSite) {
11718
- cookieString += `; samesite=${opts.sameSite}`;
11719
- }
11720
- document.cookie = cookieString;
11721
- };
11722
- var getCookie = (name) => {
11723
- if (typeof document === "undefined") return null;
11724
- const nameEQ = `${encodeURIComponent(name)}=`;
11725
- const cookies = document.cookie.split(";");
11726
- for (let cookie of cookies) {
11727
- cookie = cookie.trim();
11728
- if (cookie.indexOf(nameEQ) === 0) {
11729
- return decodeURIComponent(cookie.substring(nameEQ.length));
11730
- }
11731
- }
11732
- return null;
11733
- };
11734
- var removeCookie = (name, options = {}) => {
11735
- if (typeof document === "undefined") return;
11736
- const opts = { ...DEFAULT_OPTIONS, ...options };
11737
- setCookie(name, "", { ...opts, expires: -1 });
11738
- };
11739
- var areCookiesEnabled = () => {
11740
- if (typeof document === "undefined") return false;
11741
- try {
11742
- document.cookie = "cookietest=1";
11743
- const result = document.cookie.indexOf("cookietest=") !== -1;
11744
- document.cookie = "cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT";
11745
- return result;
11746
- } catch {
11747
- return false;
11748
- }
11749
- };
11750
- var AUTH_COOKIE_NAMES = {
11751
- ACCESS_TOKEN: "accessToken",
11752
- REFRESH_TOKEN: "refreshToken",
11753
- TOKEN_EXPIRY: "tokenExpiry",
11754
- USER: "user"
11755
- };
11756
-
11757
- // src/auth.ts
11758
- var ACCESS_TOKEN_EXPIRY = 1;
11759
- var REFRESH_TOKEN_EXPIRY = 7;
11760
- var storeAuth = (data) => {
11761
- setCookie(AUTH_COOKIE_NAMES.USER, JSON.stringify(data.user), {
11762
- expires: REFRESH_TOKEN_EXPIRY
11763
- });
11764
- setCookie(AUTH_COOKIE_NAMES.ACCESS_TOKEN, data.accessToken, {
11765
- expires: ACCESS_TOKEN_EXPIRY
11766
- });
11767
- if (data.refreshToken) {
11768
- setCookie(AUTH_COOKIE_NAMES.REFRESH_TOKEN, data.refreshToken, {
11769
- expires: REFRESH_TOKEN_EXPIRY
11770
- });
11771
- }
11772
- const expiresIn = data.expiresIn || 3600;
11773
- const expiryTime = (/* @__PURE__ */ new Date()).getTime() + expiresIn * 1e3;
11774
- setCookie(AUTH_COOKIE_NAMES.TOKEN_EXPIRY, expiryTime.toString(), {
11775
- expires: ACCESS_TOKEN_EXPIRY
11776
- });
11777
- };
11778
- var getStoredAuth = () => {
11779
- const userStr = getCookie(AUTH_COOKIE_NAMES.USER);
11780
- const token = getCookie(AUTH_COOKIE_NAMES.ACCESS_TOKEN);
11781
- const expiryStr = getCookie(AUTH_COOKIE_NAMES.TOKEN_EXPIRY);
11782
- if (!userStr || !token) {
11783
- return null;
11784
- }
11785
- try {
11786
- const user = JSON.parse(userStr);
11787
- const expiresIn = expiryStr ? parseInt(expiryStr) - (/* @__PURE__ */ new Date()).getTime() : 0;
11788
- return {
11789
- user,
11790
- token,
11791
- expiresIn: Math.max(0, expiresIn)
11792
- };
11793
- } catch {
11794
- return null;
11795
- }
11796
- };
11797
- var isTokenExpired = () => {
11798
- const tokenExpiry = getCookie(AUTH_COOKIE_NAMES.TOKEN_EXPIRY);
11799
- if (!tokenExpiry) {
11800
- return true;
11801
- }
11802
- const now = (/* @__PURE__ */ new Date()).getTime();
11803
- return now > parseInt(tokenExpiry);
11804
- };
11805
- var willTokenExpireSoon = () => {
11806
- const tokenExpiry = getCookie(AUTH_COOKIE_NAMES.TOKEN_EXPIRY);
11807
- if (!tokenExpiry) {
11808
- return true;
11809
- }
11810
- const now = (/* @__PURE__ */ new Date()).getTime();
11811
- const expiryTime = parseInt(tokenExpiry);
11812
- const timeUntilExpiry = expiryTime - now;
11813
- return timeUntilExpiry < 3e5;
11814
- };
11815
- var clearAuth = () => {
11816
- removeCookie(AUTH_COOKIE_NAMES.USER);
11817
- removeCookie(AUTH_COOKIE_NAMES.ACCESS_TOKEN);
11818
- removeCookie(AUTH_COOKIE_NAMES.REFRESH_TOKEN);
11819
- removeCookie(AUTH_COOKIE_NAMES.TOKEN_EXPIRY);
11820
- };
11821
- var validateUserRole = (requiredRole) => {
11822
- const userStr = getCookie(AUTH_COOKIE_NAMES.USER);
11823
- if (!userStr) {
11824
- return false;
11825
- }
11826
- try {
11827
- const user = JSON.parse(userStr);
11828
- return user.role === requiredRole;
11829
- } catch {
11830
- return false;
11831
- }
11832
- };
11833
- var getCurrentUser = () => {
11834
- const userStr = getCookie(AUTH_COOKIE_NAMES.USER);
11835
- if (!userStr) {
11836
- return null;
11837
- }
11838
- try {
11839
- return JSON.parse(userStr);
11840
- } catch {
11841
- return null;
11842
- }
11843
- };
11844
- var getAccessToken = () => {
11845
- return getCookie(AUTH_COOKIE_NAMES.ACCESS_TOKEN);
11846
- };
11847
- var getRefreshToken = () => {
11848
- return getCookie(AUTH_COOKIE_NAMES.REFRESH_TOKEN);
11849
- };
11850
- var updateAccessToken = (newToken, expiresIn) => {
11851
- setCookie(AUTH_COOKIE_NAMES.ACCESS_TOKEN, newToken, {
11852
- expires: ACCESS_TOKEN_EXPIRY
11853
- });
11854
- if (expiresIn) {
11855
- const expiryTime = (/* @__PURE__ */ new Date()).getTime() + expiresIn * 1e3;
11856
- setCookie(AUTH_COOKIE_NAMES.TOKEN_EXPIRY, expiryTime.toString(), {
11857
- expires: ACCESS_TOKEN_EXPIRY
11858
- });
11859
- }
11860
- };
11861
- var setupAutoRefresh = (refreshFn) => {
11862
- const checkAndRefresh = async () => {
11863
- if (willTokenExpireSoon() && !isTokenExpired()) {
11864
- try {
11865
- await refreshFn();
11866
- } catch (error) {
11867
- clearAuth();
11868
- window.location.href = SHELL_APP_URL;
11869
- }
11870
- }
11871
- };
11872
- const interval = setInterval(checkAndRefresh, 5 * 60 * 1e3);
11873
- return () => clearInterval(interval);
11874
- };
11875
-
11876
- // src/api/user.queries.ts
11877
- var GET_USERS_QUERY = `
11878
- query GetUsers($page: Int, $limit: Int, $search: String, $role: String) {
11879
- users(page: $page, limit: $limit, search: $search, role: $role) {
11880
- users {
11881
- id
11882
- name
11883
- email
11884
- role
11885
- isActive
11886
- emailVerified
11887
- createdAt
11888
- lastLogin
11889
- }
11890
- pagination {
11891
- page
11892
- limit
11893
- total
11894
- pages
11895
- sellerCount
11896
- adminCount
11897
- customerCount
11898
- }
11899
- }
11900
- }
11901
- `;
11902
- var GET_USER_QUERY = `
11903
- query GetUser($id: ID!) {
11904
- user(id: $id) {
11905
- id
11906
- name
11907
- email
11908
- role
11909
- isActive
11910
- emailVerified
11911
- createdAt
11912
- lastLogin
11913
- }
11914
- }
11915
- `;
11916
- var GET_USER_BY_ID_QUERY = `
11917
- query GetUserById($id: ID!) {
11918
- getUserById(id: $id) {
11919
- user {
11920
- id
11921
- name
11922
- email
11923
- role
11924
- isActive
11925
- emailVerified
11926
- createdAt
11927
- lastLogin
11928
- }
11929
- accessToken
11930
- refreshToken
11931
- tokenExpiry
11932
- }
11933
- }
11934
- `;
11935
- var GET_ME_QUERY = `
11936
- query GetMe {
11937
- me {
11938
- id
11939
- name
11940
- email
11941
- role
11942
- isActive
11943
- emailVerified
11944
- createdAt
11945
- lastLogin
11946
- }
11947
- }
11948
- `;
11949
- var LOGIN_MUTATION = `
11950
- mutation Login($input: LoginInput!) {
11951
- login(input: $input) {
11952
- user {
11953
- id
11954
- name
11955
- email
11956
- role
11957
- isActive
11958
- emailVerified
11959
- createdAt
11960
- }
11961
- accessToken
11962
- refreshToken
11963
- }
11964
- }
11965
- `;
11966
- var REGISTER_MUTATION = `
11967
- mutation Register($input: RegisterInput!) {
11968
- register(input: $input) {
11969
- user {
11970
- id
11971
- name
11972
- email
11973
- role
11974
- isActive
11975
- emailVerified
11976
- createdAt
11977
- }
11978
- accessToken
11979
- refreshToken
11980
- }
11981
- }
11982
- `;
11983
- var GOOGLE_AUTH_MUTATION = `
11984
- mutation GoogleAuth($input: GoogleAuthInput!) {
11985
- googleAuth(input: $input) {
11986
- user {
11987
- id
11988
- name
11989
- email
11990
- role
11991
- isActive
11992
- emailVerified
11993
- createdAt
11994
- profilePicture
11995
- }
11996
- accessToken
11997
- refreshToken
11998
- }
11999
- }
12000
- `;
12001
- var LOGOUT_MUTATION = `
12002
- mutation Logout {
12003
- logout
12004
- }
12005
- `;
12006
- var UPDATE_USER_ROLE_MUTATION = `
12007
- mutation UpdateUserRole($id: ID!, $role: String!) {
12008
- updateUserRole(id: $id, role: $role) {
12009
- id
12010
- name
12011
- email
12012
- role
12013
- isActive
12014
- emailVerified
12015
- createdAt
12016
- lastLogin
12017
- }
12018
- }
12019
- `;
12020
- var DELETE_USER_MUTATION = `
12021
- mutation DeleteUser($id: ID!) {
12022
- deleteUser(id: $id)
12023
- }
12024
- `;
12025
- var SEND_VERIFICATION_EMAIL_MUTATION = `
12026
- mutation SendVerificationEmail($source: String) {
12027
- sendVerificationEmail(source: $source) {
12028
- success
12029
- message
12030
- }
12031
- }
12032
- `;
12033
- var VERIFY_EMAIL_MUTATION = `
12034
- mutation VerifyEmail {
12035
- verifyEmail {
12036
- success
12037
- message
12038
- user {
12039
- id
12040
- name
12041
- email
12042
- role
12043
- isActive
12044
- emailVerified
12045
- createdAt
12046
- }
12047
- }
12048
- }
12049
- `;
12050
- var FORGOT_PASSWORD_MUTATION = `
12051
- mutation ForgotPassword($email: String!, $role: String!) {
12052
- forgotPassword(email: $email, role: $role) {
12053
- success
12054
- message
12055
- resetToken
12056
- resetUrl
12057
- }
12058
- }
12059
- `;
12060
- var RESET_PASSWORD_MUTATION = `
12061
- mutation ResetPassword($token: String!, $password: String!, $confirmPassword: String!) {
12062
- resetPassword(token: $token, password: $password, confirmPassword: $confirmPassword) {
12063
- success
12064
- message
12065
- }
12066
- }
12067
- `;
12068
- var VALIDATE_RESET_TOKEN_QUERY = `
12069
- query ValidateResetToken($token: String!) {
12070
- validateResetToken(token: $token) {
12071
- success
12072
- message
12073
- email
12074
- }
12075
- }
12076
- `;
12077
- var UPDATE_PROFILE_MUTATION = `
12078
- mutation UpdateProfile($input: UpdateProfileInput!) {
12079
- updateProfile(input: $input) {
12080
- success
12081
- message
12082
- user {
12083
- id
12084
- name
12085
- email
12086
- role
12087
- isActive
12088
- emailVerified
12089
- createdAt
12090
- }
12091
- }
12092
- }
12093
- `;
12094
-
12095
- // src/api/product.queries.ts
12096
- var GET_PRODUCTS_QUERY = `
12097
- query GetProducts($page: Int, $limit: Int, $search: String, $category: String, $minPrice: Float, $maxPrice: Float, $sortBy: String, $sortOrder: String, $featured: Boolean, $includeInactive: Boolean) {
12098
- products(page: $page, limit: $limit, search: $search, category: $category, minPrice: $minPrice, maxPrice: $maxPrice, sortBy: $sortBy, sortOrder: $sortOrder, featured: $featured, includeInactive: $includeInactive) {
12099
- products {
12100
- id
12101
- name
12102
- description
12103
- price
12104
- stock
12105
- category
12106
- sellerId
12107
- isActive
12108
- imageUrl
12109
- tags
12110
- rating
12111
- reviewCount
12112
- createdAt
12113
- updatedAt
12114
- }
12115
- pagination {
12116
- page
12117
- limit
12118
- total
12119
- pages
12120
- }
12121
- }
12122
- }
12123
- `;
12124
- var GET_PRODUCT_QUERY = `
12125
- query GetProduct($id: ID!) {
12126
- product(id: $id) {
12127
- id
12128
- name
12129
- description
12130
- price
12131
- stock
12132
- category
12133
- sellerId
12134
- seller {
12135
- id
12136
- name
12137
- email
12138
- }
12139
- isActive
12140
- imageUrl
12141
- tags
12142
- rating
12143
- reviewCount
12144
- createdAt
12145
- updatedAt
12146
- }
12147
- }
12148
- `;
12149
- var GET_PRODUCTS_BY_SELLER_QUERY = `
12150
- query GetProductsBySeller($sellerId: String!) {
12151
- productsBySeller(sellerId: $sellerId) {
12152
- id
12153
- name
12154
- description
12155
- price
12156
- stock
12157
- category
12158
- sellerId
12159
- isActive
12160
- imageUrl
12161
- tags
12162
- rating
12163
- reviewCount
12164
- createdAt
12165
- updatedAt
12166
- }
12167
- }
12168
- `;
12169
- var CREATE_PRODUCT_MUTATION = `
12170
- mutation CreateProduct($input: CreateProductInput!) {
12171
- createProduct(input: $input) {
12172
- id
12173
- name
12174
- description
12175
- price
12176
- stock
12177
- category
12178
- sellerId
12179
- isActive
12180
- imageUrl
12181
- tags
12182
- rating
12183
- reviewCount
12184
- createdAt
12185
- updatedAt
12186
- }
12187
- }
12188
- `;
12189
- var UPDATE_PRODUCT_MUTATION = `
12190
- mutation UpdateProduct($id: ID!, $input: UpdateProductInput!) {
12191
- updateProduct(id: $id, input: $input) {
12192
- id
12193
- name
12194
- description
12195
- price
12196
- stock
12197
- category
12198
- sellerId
12199
- isActive
12200
- imageUrl
12201
- tags
12202
- rating
12203
- reviewCount
12204
- createdAt
12205
- updatedAt
12206
- }
12207
- }
12208
- `;
12209
- var DELETE_PRODUCT_MUTATION = `
12210
- mutation DeleteProduct($id: ID!) {
12211
- deleteProduct(id: $id)
12212
- }
12213
- `;
12214
- var SEARCH_PRODUCTS_QUERY = `
12215
- query SearchProducts($search: String!, $limit: Int) {
12216
- searchProducts(search: $search, limit: $limit) {
12217
- id
12218
- name
12219
- description
12220
- price
12221
- stock
12222
- category
12223
- sellerId
12224
- isActive
12225
- imageUrl
12226
- tags
12227
- rating
12228
- reviewCount
12229
- createdAt
12230
- updatedAt
12231
- }
12232
- }
12233
- `;
12234
-
12235
- // src/api/order.queries.ts
12236
- var GET_ORDERS_QUERY = `
12237
- query GetOrders($page: Int, $limit: Int, $customerId: String) {
12238
- orders(page: $page, limit: $limit, customerId: $customerId) {
12239
- orders {
12240
- id
12241
- orderNumber
12242
- customerId
12243
- customerEmail
12244
- items {
12245
- productId
12246
- productName
12247
- quantity
12248
- price
12249
- subtotal
12250
- }
12251
- subtotal
12252
- tax
12253
- shipping
12254
- discount
12255
- total
12256
- orderStatus
12257
- paymentStatus
12258
- paymentMethod
12259
- shippingAddress {
12260
- street
12261
- city
12262
- state
12263
- zip
12264
- country
12265
- }
12266
- notes
12267
- createdAt
12268
- updatedAt
12269
- }
12270
- pagination {
12271
- page
12272
- limit
12273
- total
12274
- pages
12275
- }
12276
- }
12277
- }
12278
- `;
12279
- var GET_ORDER_QUERY = `
12280
- query GetOrder($id: ID!) {
12281
- order(id: $id) {
12282
- id
12283
- orderNumber
12284
- customerId
12285
- customerEmail
12286
- items {
12287
- productId
12288
- productName
12289
- quantity
12290
- price
12291
- subtotal
12292
- }
12293
- subtotal
12294
- tax
12295
- shipping
12296
- total
12297
- orderStatus
12298
- paymentStatus
12299
- paymentMethod
12300
- shippingAddress {
12301
- street
12302
- city
12303
- state
12304
- zip
12305
- country
12306
- }
12307
- notes
12308
- createdAt
12309
- updatedAt
12310
- }
12311
- }
12312
- `;
12313
- var GET_ORDERS_BY_CUSTOMER_QUERY = `
12314
- query GetOrdersByCustomer($customerId: String!) {
12315
- ordersByCustomer(customerId: $customerId) {
12316
- id
12317
- orderNumber
12318
- customerId
12319
- customerEmail
12320
- items {
12321
- productId
12322
- productName
12323
- quantity
12324
- price
12325
- subtotal
12326
- }
12327
- subtotal
12328
- tax
12329
- shipping
12330
- total
12331
- orderStatus
12332
- paymentStatus
12333
- paymentMethod
12334
- shippingAddress {
12335
- street
12336
- city
12337
- state
12338
- zip
12339
- country
12340
- }
12341
- notes
12342
- createdAt
12343
- updatedAt
12344
- }
12345
- }
12346
- `;
12347
- var CREATE_ORDER_MUTATION = `
12348
- mutation CreateOrder($input: CreateOrderInput!) {
12349
- createOrder(input: $input) {
12350
- order {
12351
- id
12352
- orderNumber
12353
- customerId
12354
- customerEmail
12355
- sellerId
12356
- items {
12357
- productId
12358
- productName
12359
- quantity
12360
- price
12361
- sellerId
12362
- subtotal
12363
- }
12364
- subtotal
12365
- tax
12366
- shipping
12367
- discount
12368
- couponCode
12369
- total
12370
- orderStatus
12371
- paymentStatus
12372
- paymentMethod
12373
- shippingAddress {
12374
- street
12375
- city
12376
- state
12377
- zip
12378
- country
12379
- }
12380
- notes
12381
- createdAt
12382
- updatedAt
12383
- }
12384
- orders {
12385
- id
12386
- orderNumber
12387
- customerId
12388
- customerEmail
12389
- sellerId
12390
- items {
12391
- productId
12392
- productName
12393
- quantity
12394
- price
12395
- sellerId
12396
- subtotal
12397
- }
12398
- subtotal
12399
- tax
12400
- shipping
12401
- discount
12402
- total
12403
- orderStatus
12404
- paymentStatus
12405
- createdAt
12406
- }
12407
- orderCount
12408
- }
12409
- }
12410
- `;
12411
- var UPDATE_ORDER_STATUS_MUTATION = `
12412
- mutation UpdateOrderStatus($id: ID!, $status: OrderStatus!) {
12413
- updateOrderStatus(id: $id, status: $status) {
12414
- id
12415
- orderNumber
12416
- orderStatus
12417
- updatedAt
12418
- }
12419
- }
12420
- `;
12421
- var UPDATE_PAYMENT_STATUS_MUTATION = `
12422
- mutation UpdatePaymentStatus($id: ID!, $status: PaymentStatus!) {
12423
- updatePaymentStatus(id: $id, status: $status) {
12424
- id
12425
- orderNumber
12426
- paymentStatus
12427
- updatedAt
12428
- }
12429
- }
12430
- `;
12431
- var CANCEL_ORDER_MUTATION = `
12432
- mutation CancelOrder($id: ID!) {
12433
- cancelOrder(id: $id) {
12434
- id
12435
- orderNumber
12436
- orderStatus
12437
- updatedAt
12438
- }
12439
- }
12440
- `;
12441
-
12442
- // src/api/coupon.queries.ts
12443
- var GET_COUPONS_QUERY = `
12444
- query GetCoupons($page: Int, $limit: Int, $isActive: Boolean, $search: String) {
12445
- coupons(page: $page, limit: $limit, isActive: $isActive, search: $search) {
12446
- coupons {
12447
- id
12448
- code
12449
- description
12450
- discountType
12451
- discount
12452
- minPurchase
12453
- maxDiscount
12454
- validFrom
12455
- validTo
12456
- usageLimit
12457
- usageCount
12458
- isActive
12459
- createdAt
12460
- updatedAt
12461
- }
12462
- pagination {
12463
- page
12464
- limit
12465
- total
12466
- pages
12467
- }
12468
- }
12469
- }
12470
- `;
12471
- var GET_COUPON_QUERY = `
12472
- query GetCoupon($id: ID!) {
12473
- coupon(id: $id) {
12474
- id
12475
- code
12476
- description
12477
- discountType
12478
- discount
12479
- minPurchase
12480
- maxDiscount
12481
- validFrom
12482
- validTo
12483
- usageLimit
12484
- usageCount
12485
- isActive
12486
- createdAt
12487
- updatedAt
12488
- }
12489
- }
12490
- `;
12491
- var VALIDATE_COUPON_QUERY = `
12492
- query ValidateCoupon($code: String!, $orderTotal: Float!) {
12493
- validateCoupon(code: $code, orderTotal: $orderTotal) {
12494
- valid
12495
- discount
12496
- discountValue
12497
- finalTotal
12498
- discountType
12499
- message
12500
- code
12501
- }
12502
- }
12503
- `;
12504
- var CREATE_COUPON_MUTATION = `
12505
- mutation CreateCoupon($input: CreateCouponInput!) {
12506
- createCoupon(input: $input) {
12507
- id
12508
- code
12509
- description
12510
- discountType
12511
- discount
12512
- minPurchase
12513
- maxDiscount
12514
- validFrom
12515
- validTo
12516
- usageLimit
12517
- usageCount
12518
- isActive
12519
- createdAt
12520
- updatedAt
12521
- }
12522
- }
12523
- `;
12524
- var UPDATE_COUPON_MUTATION = `
12525
- mutation UpdateCoupon($id: ID!, $input: UpdateCouponInput!) {
12526
- updateCoupon(id: $id, input: $input) {
12527
- id
12528
- code
12529
- description
12530
- discountType
12531
- discount
12532
- minPurchase
12533
- maxDiscount
12534
- validFrom
12535
- validTo
12536
- usageLimit
12537
- usageCount
12538
- isActive
12539
- createdAt
12540
- updatedAt
12541
- }
12542
- }
12543
- `;
12544
- var DELETE_COUPON_MUTATION = `
12545
- mutation DeleteCoupon($id: ID!) {
12546
- deleteCoupon(id: $id)
12547
- }
12548
- `;
12549
- var TOGGLE_COUPON_STATUS_MUTATION = `
12550
- mutation ToggleCouponStatus($id: ID!) {
12551
- toggleCouponStatus(id: $id) {
12552
- id
12553
- isActive
12554
- }
12555
- }
12556
- `;
12557
-
12558
- // src/api/category.queries.ts
12559
- var GET_CATEGORIES_QUERY = `
12560
- query GetCategories($filter: CategoryFilterInput) {
12561
- categories(filter: $filter) {
12562
- success
12563
- message
12564
- data {
12565
- id
12566
- name
12567
- description
12568
- icon
12569
- slug
12570
- isActive
12571
- productCount
12572
- createdAt
12573
- updatedAt
12574
- }
12575
- count
12576
- }
12577
- }
12578
- `;
12579
- var GET_CATEGORY_QUERY = `
12580
- query GetCategory($id: String!) {
12581
- category(id: $id) {
12582
- id
12583
- name
12584
- description
12585
- icon
12586
- slug
12587
- isActive
12588
- productCount
12589
- createdAt
12590
- updatedAt
12591
- }
12592
- }
12593
- `;
12594
- var CREATE_CATEGORY_MUTATION = `
12595
- mutation CreateCategory($input: CategoryInput!) {
12596
- createCategory(input: $input) {
12597
- success
12598
- message
12599
- data {
12600
- id
12601
- name
12602
- description
12603
- icon
12604
- slug
12605
- isActive
12606
- productCount
12607
- createdAt
12608
- updatedAt
12609
- }
12610
- }
12611
- }
12612
- `;
12613
- var UPDATE_CATEGORY_MUTATION = `
12614
- mutation UpdateCategory($id: ID!, $input: CategoryInput!) {
12615
- updateCategory(id: $id, input: $input) {
12616
- success
12617
- message
12618
- data {
12619
- id
12620
- name
12621
- description
12622
- icon
12623
- slug
12624
- isActive
12625
- productCount
12626
- createdAt
12627
- updatedAt
12628
- }
12629
- }
12630
- }
12631
- `;
12632
- var DELETE_CATEGORY_MUTATION = `
12633
- mutation DeleteCategory($id: ID!) {
12634
- deleteCategory(id: $id) {
12635
- success
12636
- message
12637
- }
12638
- }
12639
- `;
12640
-
12641
- // src/api/dashboard.queries.ts
12642
- var DASHBOARD_STATS_QUERY = `
12643
- query GetDashboardStats {
12644
- dashboardStats {
12645
- totalUsers
12646
- totalOrders
12647
- totalRevenue
12648
- pendingOrders
12649
- }
12650
- }
12651
- `;
12652
- var SALES_ANALYTICS_QUERY = `
12653
- query GetSalesAnalytics($period: String!) {
12654
- salesAnalytics(period: $period) {
12655
- daily {
12656
- date
12657
- sales
12658
- orders
12659
- revenue
12660
- }
12661
- weekly {
12662
- date
12663
- sales
12664
- orders
12665
- revenue
12666
- }
12667
- monthly {
12668
- date
12669
- sales
12670
- orders
12671
- revenue
12672
- }
12673
- }
12674
- }
12675
- `;
12676
-
12677
- // src/api/review.queries.ts
12678
- var GET_PRODUCT_REVIEWS_QUERY = `
12679
- query GetProductReviews($productId: ID!, $page: Int, $limit: Int) {
12680
- productReviews(productId: $productId, page: $page, limit: $limit) {
12681
- reviews {
12682
- id
12683
- productId
12684
- userId
12685
- userName
12686
- rating
12687
- comment
12688
- helpful
12689
- createdAt
12690
- }
12691
- pagination {
12692
- page
12693
- limit
12694
- total
12695
- pages
12696
- }
12697
- }
12698
- }
12699
- `;
12700
- var CREATE_REVIEW_MUTATION = `
12701
- mutation CreateReview($productId: ID!, $input: CreateReviewInput!) {
12702
- createReview(productId: $productId, input: $input) {
12703
- success
12704
- message
12705
- review {
12706
- id
12707
- productId
12708
- userId
12709
- userName
12710
- rating
12711
- comment
12712
- helpful
12713
- createdAt
12714
- }
12715
- }
12716
- }
12717
- `;
12718
- var MARK_REVIEW_HELPFUL_MUTATION = `
12719
- mutation MarkReviewHelpful($reviewId: ID!) {
12720
- markReviewHelpful(reviewId: $reviewId) {
12721
- id
12722
- helpful
12723
- }
12724
- }
12725
- `;
12726
- var DELETE_REVIEW_MUTATION = `
12727
- mutation DeleteReview($reviewId: ID!) {
12728
- deleteReview(reviewId: $reviewId)
12729
- }
12730
- `;
12731
-
12732
- // src/api/address.queries.ts
12733
- var GET_MY_ADDRESSES_QUERY = `
12734
- query GetMyAddresses {
12735
- myAddresses {
12736
- addresses {
12737
- id
12738
- userId
12739
- street
12740
- city
12741
- state
12742
- zip
12743
- country
12744
- isDefault
12745
- label
12746
- createdAt
12747
- updatedAt
12748
- }
12749
- }
12750
- }
12751
- `;
12752
- var ADD_ADDRESS_MUTATION = `
12753
- mutation AddAddress($input: AddAddressInput!) {
12754
- addAddress(input: $input) {
12755
- success
12756
- message
12757
- address {
12758
- id
12759
- userId
12760
- street
12761
- city
12762
- state
12763
- zip
12764
- country
12765
- isDefault
12766
- label
12767
- createdAt
12768
- updatedAt
12769
- }
12770
- }
12771
- }
12772
- `;
12773
- var UPDATE_ADDRESS_MUTATION = `
12774
- mutation UpdateAddress($id: ID!, $input: UpdateAddressInput!) {
12775
- updateAddress(id: $id, input: $input) {
12776
- success
12777
- message
12778
- address {
12779
- id
12780
- userId
12781
- street
12782
- city
12783
- state
12784
- zip
12785
- country
12786
- isDefault
12787
- label
12788
- createdAt
12789
- updatedAt
12790
- }
12791
- }
12792
- }
12793
- `;
12794
- var DELETE_ADDRESS_MUTATION = `
12795
- mutation DeleteAddress($id: ID!) {
12796
- deleteAddress(id: $id) {
12797
- success
12798
- message
12799
- }
12800
- }
12801
- `;
12802
- var SET_DEFAULT_ADDRESS_MUTATION = `
12803
- mutation SetDefaultAddress($id: ID!) {
12804
- setDefaultAddress(id: $id) {
12805
- success
12806
- message
12807
- address {
12808
- id
12809
- userId
12810
- street
12811
- city
12812
- state
12813
- zip
12814
- country
12815
- isDefault
12816
- label
12817
- createdAt
12818
- updatedAt
12819
- }
12820
- }
12821
- }
12822
- `;
12823
-
12824
11817
  // ../../node_modules/axios/lib/helpers/bind.js
12825
11818
  function bind(fn, thisArg) {
12826
11819
  return function wrap() {
@@ -12841,10 +11834,10 @@ var kindOfTest = (type) => {
12841
11834
  return (thing) => kindOf(thing) === type;
12842
11835
  };
12843
11836
  var typeOfTest = (type) => (thing) => typeof thing === type;
12844
- var { isArray } = Array;
12845
- var isUndefined = typeOfTest("undefined");
11837
+ var { isArray: isArray2 } = Array;
11838
+ var isUndefined2 = typeOfTest("undefined");
12846
11839
  function isBuffer(val) {
12847
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
11840
+ return val !== null && !isUndefined2(val) && val.constructor !== null && !isUndefined2(val.constructor) && isFunction2(val.constructor.isBuffer) && val.constructor.isBuffer(val);
12848
11841
  }
12849
11842
  var isArrayBuffer = kindOfTest("ArrayBuffer");
12850
11843
  function isArrayBufferView(val) {
@@ -12856,11 +11849,11 @@ function isArrayBufferView(val) {
12856
11849
  }
12857
11850
  return result;
12858
11851
  }
12859
- var isString = typeOfTest("string");
12860
- var isFunction = typeOfTest("function");
12861
- var isNumber = typeOfTest("number");
12862
- var isObject = (thing) => thing !== null && typeof thing === "object";
12863
- var isBoolean = (thing) => thing === true || thing === false;
11852
+ var isString2 = typeOfTest("string");
11853
+ var isFunction2 = typeOfTest("function");
11854
+ var isNumber2 = typeOfTest("number");
11855
+ var isObject2 = (thing) => thing !== null && typeof thing === "object";
11856
+ var isBoolean2 = (thing) => thing === true || thing === false;
12864
11857
  var isPlainObject = (val) => {
12865
11858
  if (kindOf(val) !== "object") {
12866
11859
  return false;
@@ -12869,7 +11862,7 @@ var isPlainObject = (val) => {
12869
11862
  return (prototype3 === null || prototype3 === Object.prototype || Object.getPrototypeOf(prototype3) === null) && !(toStringTag in val) && !(iterator in val);
12870
11863
  };
12871
11864
  var isEmptyObject = (val) => {
12872
- if (!isObject(val) || isBuffer(val)) {
11865
+ if (!isObject2(val) || isBuffer(val)) {
12873
11866
  return false;
12874
11867
  }
12875
11868
  try {
@@ -12882,11 +11875,11 @@ var isDate = kindOfTest("Date");
12882
11875
  var isFile = kindOfTest("File");
12883
11876
  var isBlob = kindOfTest("Blob");
12884
11877
  var isFileList = kindOfTest("FileList");
12885
- var isStream = (val) => isObject(val) && isFunction(val.pipe);
11878
+ var isStream = (val) => isObject2(val) && isFunction2(val.pipe);
12886
11879
  var isFormData = (thing) => {
12887
11880
  let kind;
12888
- return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
12889
- kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
11881
+ return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction2(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
11882
+ kind === "object" && isFunction2(thing.toString) && thing.toString() === "[object FormData]"));
12890
11883
  };
12891
11884
  var isURLSearchParams = kindOfTest("URLSearchParams");
12892
11885
  var [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
@@ -12900,7 +11893,7 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
12900
11893
  if (typeof obj !== "object") {
12901
11894
  obj = [obj];
12902
11895
  }
12903
- if (isArray(obj)) {
11896
+ if (isArray2(obj)) {
12904
11897
  for (i = 0, l = obj.length; i < l; i++) {
12905
11898
  fn.call(null, obj[i], i, obj);
12906
11899
  }
@@ -12937,7 +11930,7 @@ var _global = (() => {
12937
11930
  if (typeof globalThis !== "undefined") return globalThis;
12938
11931
  return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
12939
11932
  })();
12940
- var isContextDefined = (context) => !isUndefined(context) && context !== _global;
11933
+ var isContextDefined = (context) => !isUndefined2(context) && context !== _global;
12941
11934
  function merge() {
12942
11935
  const { caseless, skipUndefined } = isContextDefined(this) && this || {};
12943
11936
  const result = {};
@@ -12947,9 +11940,9 @@ function merge() {
12947
11940
  result[targetKey] = merge(result[targetKey], val);
12948
11941
  } else if (isPlainObject(val)) {
12949
11942
  result[targetKey] = merge({}, val);
12950
- } else if (isArray(val)) {
11943
+ } else if (isArray2(val)) {
12951
11944
  result[targetKey] = val.slice();
12952
- } else if (!skipUndefined || !isUndefined(val)) {
11945
+ } else if (!skipUndefined || !isUndefined2(val)) {
12953
11946
  result[targetKey] = val;
12954
11947
  }
12955
11948
  };
@@ -12960,7 +11953,7 @@ function merge() {
12960
11953
  }
12961
11954
  var extend = (a, b, thisArg, { allOwnKeys } = {}) => {
12962
11955
  forEach(b, (val, key) => {
12963
- if (thisArg && isFunction(val)) {
11956
+ if (thisArg && isFunction2(val)) {
12964
11957
  a[key] = bind(val, thisArg);
12965
11958
  } else {
12966
11959
  a[key] = val;
@@ -13014,9 +12007,9 @@ var endsWith = (str, searchString, position) => {
13014
12007
  };
13015
12008
  var toArray = (thing) => {
13016
12009
  if (!thing) return null;
13017
- if (isArray(thing)) return thing;
12010
+ if (isArray2(thing)) return thing;
13018
12011
  let i = thing.length;
13019
- if (!isNumber(i)) return null;
12012
+ if (!isNumber2(i)) return null;
13020
12013
  const arr = new Array(i);
13021
12014
  while (i-- > 0) {
13022
12015
  arr[i] = thing[i];
@@ -13069,11 +12062,11 @@ var reduceDescriptors = (obj, reducer) => {
13069
12062
  };
13070
12063
  var freezeMethods = (obj) => {
13071
12064
  reduceDescriptors(obj, (descriptor, name) => {
13072
- if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
12065
+ if (isFunction2(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
13073
12066
  return false;
13074
12067
  }
13075
12068
  const value = obj[name];
13076
- if (!isFunction(value)) return;
12069
+ if (!isFunction2(value)) return;
13077
12070
  descriptor.enumerable = false;
13078
12071
  if ("writable" in descriptor) {
13079
12072
  descriptor.writable = false;
@@ -13093,7 +12086,7 @@ var toObjectSet = (arrayOrString, delimiter) => {
13093
12086
  obj[value] = true;
13094
12087
  });
13095
12088
  };
13096
- isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
12089
+ isArray2(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
13097
12090
  return obj;
13098
12091
  };
13099
12092
  var noop = () => {
@@ -13102,12 +12095,12 @@ var toFiniteNumber = (value, defaultValue) => {
13102
12095
  return value != null && Number.isFinite(value = +value) ? value : defaultValue;
13103
12096
  };
13104
12097
  function isSpecCompliantForm(thing) {
13105
- return !!(thing && isFunction(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
12098
+ return !!(thing && isFunction2(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
13106
12099
  }
13107
12100
  var toJSONObject = (obj) => {
13108
12101
  const stack = new Array(10);
13109
12102
  const visit = (source, i) => {
13110
- if (isObject(source)) {
12103
+ if (isObject2(source)) {
13111
12104
  if (stack.indexOf(source) >= 0) {
13112
12105
  return;
13113
12106
  }
@@ -13116,10 +12109,10 @@ var toJSONObject = (obj) => {
13116
12109
  }
13117
12110
  if (!("toJSON" in source)) {
13118
12111
  stack[i] = source;
13119
- const target = isArray(source) ? [] : {};
12112
+ const target = isArray2(source) ? [] : {};
13120
12113
  forEach(source, (value, key) => {
13121
12114
  const reducedValue = visit(value, i + 1);
13122
- !isUndefined(reducedValue) && (target[key] = reducedValue);
12115
+ !isUndefined2(reducedValue) && (target[key] = reducedValue);
13123
12116
  });
13124
12117
  stack[i] = void 0;
13125
12118
  return target;
@@ -13130,7 +12123,7 @@ var toJSONObject = (obj) => {
13130
12123
  return visit(obj, 0);
13131
12124
  };
13132
12125
  var isAsyncFn = kindOfTest("AsyncFunction");
13133
- var isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
12126
+ var isThenable = (thing) => thing && (isObject2(thing) || isFunction2(thing)) && isFunction2(thing.then) && isFunction2(thing.catch);
13134
12127
  var _setImmediate = ((setImmediateSupported, postMessageSupported) => {
13135
12128
  if (setImmediateSupported) {
13136
12129
  return setImmediate;
@@ -13148,32 +12141,32 @@ var _setImmediate = ((setImmediateSupported, postMessageSupported) => {
13148
12141
  })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
13149
12142
  })(
13150
12143
  typeof setImmediate === "function",
13151
- isFunction(_global.postMessage)
12144
+ isFunction2(_global.postMessage)
13152
12145
  );
13153
12146
  var asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
13154
- var isIterable = (thing) => thing != null && isFunction(thing[iterator]);
12147
+ var isIterable = (thing) => thing != null && isFunction2(thing[iterator]);
13155
12148
  var utils_default = {
13156
- isArray,
12149
+ isArray: isArray2,
13157
12150
  isArrayBuffer,
13158
12151
  isBuffer,
13159
12152
  isFormData,
13160
12153
  isArrayBufferView,
13161
- isString,
13162
- isNumber,
13163
- isBoolean,
13164
- isObject,
12154
+ isString: isString2,
12155
+ isNumber: isNumber2,
12156
+ isBoolean: isBoolean2,
12157
+ isObject: isObject2,
13165
12158
  isPlainObject,
13166
12159
  isEmptyObject,
13167
12160
  isReadableStream,
13168
12161
  isRequest,
13169
12162
  isResponse,
13170
12163
  isHeaders,
13171
- isUndefined,
12164
+ isUndefined: isUndefined2,
13172
12165
  isDate,
13173
12166
  isFile,
13174
12167
  isBlob,
13175
12168
  isRegExp,
13176
- isFunction,
12169
+ isFunction: isFunction2,
13177
12170
  isStream,
13178
12171
  isURLSearchParams,
13179
12172
  isTypedArray,
@@ -14460,7 +13453,7 @@ function speedometer(samplesCount, min) {
14460
13453
  var speedometer_default = speedometer;
14461
13454
 
14462
13455
  // ../../node_modules/axios/lib/helpers/throttle.js
14463
- function throttle(fn, freq) {
13456
+ function throttle2(fn, freq) {
14464
13457
  let timestamp = 0;
14465
13458
  let threshold = 1e3 / freq;
14466
13459
  let lastArgs;
@@ -14492,7 +13485,7 @@ function throttle(fn, freq) {
14492
13485
  const flush = () => lastArgs && invoke(lastArgs);
14493
13486
  return [throttled, flush];
14494
13487
  }
14495
- var throttle_default = throttle;
13488
+ var throttle_default = throttle2;
14496
13489
 
14497
13490
  // ../../node_modules/axios/lib/helpers/progressEventReducer.js
14498
13491
  var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
@@ -15639,7 +14632,7 @@ var trackStream = (stream4, chunkSize, onProgress, onFinish) => {
15639
14632
 
15640
14633
  // ../../node_modules/axios/lib/adapters/fetch.js
15641
14634
  var DEFAULT_CHUNK_SIZE = 64 * 1024;
15642
- var { isFunction: isFunction2 } = utils_default;
14635
+ var { isFunction: isFunction3 } = utils_default;
15643
14636
  var globalFetchAPI = (({ Request, Response }) => ({
15644
14637
  Request,
15645
14638
  Response
@@ -15660,13 +14653,13 @@ var factory = (env) => {
15660
14653
  skipUndefined: true
15661
14654
  }, globalFetchAPI, env);
15662
14655
  const { fetch: envFetch, Request, Response } = env;
15663
- const isFetchSupported = envFetch ? isFunction2(envFetch) : typeof fetch === "function";
15664
- const isRequestSupported = isFunction2(Request);
15665
- const isResponseSupported = isFunction2(Response);
14656
+ const isFetchSupported = envFetch ? isFunction3(envFetch) : typeof fetch === "function";
14657
+ const isRequestSupported = isFunction3(Request);
14658
+ const isResponseSupported = isFunction3(Response);
15666
14659
  if (!isFetchSupported) {
15667
14660
  return false;
15668
14661
  }
15669
- const isReadableStreamSupported = isFetchSupported && isFunction2(ReadableStream2);
14662
+ const isReadableStreamSupported = isFetchSupported && isFunction3(ReadableStream2);
15670
14663
  const encodeText = isFetchSupported && (typeof TextEncoder2 === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder2()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
15671
14664
  const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
15672
14665
  let duplexAccessed = false;
@@ -16508,348 +15501,6 @@ var GraphQLClient = class {
16508
15501
  function createGraphQLClient(config) {
16509
15502
  return new GraphQLClient(config);
16510
15503
  }
16511
-
16512
- // src/api/logger.client.ts
16513
- var Logger = class {
16514
- static configure(options) {
16515
- if (options.maxLogs !== void 0) this.maxLogs = options.maxLogs;
16516
- if (options.enableConsole !== void 0) this.enableConsole = options.enableConsole;
16517
- }
16518
- static addLog(entry) {
16519
- this.logs.push(entry);
16520
- if (this.logs.length > this.maxLogs) this.logs.shift();
16521
- }
16522
- static format(entry) {
16523
- return `[${entry.timestamp}] [${entry.level}]${entry.context ? ` [${entry.context}]` : ""}: ${entry.message}`;
16524
- }
16525
- static debug(message, data, context) {
16526
- this.log(LogLevel.DEBUG, message, data, context);
16527
- }
16528
- static info(message, data, context) {
16529
- this.log(LogLevel.INFO, message, data, context);
16530
- }
16531
- static warn(message, data, context) {
16532
- this.log(LogLevel.WARN, message, data, context);
16533
- }
16534
- static error(message, error, context) {
16535
- this.log(LogLevel.ERROR, message, error, context);
16536
- }
16537
- static log(level, message, data, context) {
16538
- const entry = {
16539
- level,
16540
- message,
16541
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
16542
- data,
16543
- context
16544
- };
16545
- this.addLog(entry);
16546
- if (!this.enableConsole) return;
16547
- const formatted = this.format(entry);
16548
- switch (level) {
16549
- case LogLevel.ERROR:
16550
- console.error(formatted, data ?? "");
16551
- break;
16552
- case LogLevel.WARN:
16553
- console.warn(formatted, data ?? "");
16554
- break;
16555
- case LogLevel.INFO:
16556
- console.info(formatted, data ?? "");
16557
- break;
16558
- default:
16559
- console.debug(formatted, data ?? "");
16560
- }
16561
- }
16562
- static getLogs(level) {
16563
- return level ? this.logs.filter((l) => l.level === level) : [...this.logs];
16564
- }
16565
- static clearLogs() {
16566
- this.logs = [];
16567
- }
16568
- };
16569
- Logger.logs = [];
16570
- Logger.maxLogs = 1e3;
16571
- Logger.enableConsole = true;
16572
-
16573
- // src/helpers.ts
16574
- var capitalize = (str) => {
16575
- if (!str) return "";
16576
- return str.charAt(0).toUpperCase() + str.slice(1);
16577
- };
16578
- var capitalizeWords = (str) => {
16579
- if (!str) return "";
16580
- return str.split(" ").map((word) => capitalize(word)).join(" ");
16581
- };
16582
- var toTitleCase = (str) => {
16583
- if (!str) return "";
16584
- return str.replace(/\w\S*/g, (txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase());
16585
- };
16586
- var slugify = (str) => {
16587
- if (!str) return "";
16588
- return str.toLowerCase().trim().replace(/\s+/g, "-").replace(/[^\w-]/g, "");
16589
- };
16590
- var generateRandomCode = (length = 6) => {
16591
- const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
16592
- let result = "";
16593
- for (let i = 0; i < length; i++) {
16594
- result += chars.charAt(Math.floor(Math.random() * chars.length));
16595
- }
16596
- return result;
16597
- };
16598
- var truncate = (str, length, suffix = "...") => {
16599
- if (!str || str.length <= length) return str;
16600
- return str.substring(0, length) + suffix;
16601
- };
16602
- var formatCurrency = (amount, currency = "USD") => {
16603
- return new Intl.NumberFormat("en-US", {
16604
- style: "currency",
16605
- currency
16606
- }).format(amount);
16607
- };
16608
- var formatNumber = (num, decimals = 2) => {
16609
- return parseFloat(num.toFixed(decimals));
16610
- };
16611
- var roundUp = (num, decimals = 2) => {
16612
- const factor = Math.pow(10, decimals);
16613
- return Math.ceil(num * factor) / factor;
16614
- };
16615
- var roundDown = (num, decimals = 2) => {
16616
- const factor = Math.pow(10, decimals);
16617
- return Math.floor(num * factor) / factor;
16618
- };
16619
- var calculatePercentage = (value, percentage) => {
16620
- return formatNumber(value * percentage / 100);
16621
- };
16622
- var calculateDiscount = (price, discountPercent) => {
16623
- return formatNumber(price - price * discountPercent / 100);
16624
- };
16625
- var calculateTax = (amount, taxRate) => {
16626
- return formatNumber(amount * taxRate);
16627
- };
16628
- var chunk = (arr, size) => {
16629
- const chunks = [];
16630
- for (let i = 0; i < arr.length; i += size) {
16631
- chunks.push(arr.slice(i, i + size));
16632
- }
16633
- return chunks;
16634
- };
16635
- var unique = (arr) => {
16636
- return Array.from(new Set(arr));
16637
- };
16638
- var removeDuplicates = (arr, key) => {
16639
- const seen = /* @__PURE__ */ new Set();
16640
- return arr.filter((item) => {
16641
- const value = item[key];
16642
- if (seen.has(value)) return false;
16643
- seen.add(value);
16644
- return true;
16645
- });
16646
- };
16647
- var groupBy = (arr, key) => {
16648
- return arr.reduce((result, item) => {
16649
- const groupKey = String(item[key]);
16650
- if (!result[groupKey]) {
16651
- result[groupKey] = [];
16652
- }
16653
- result[groupKey].push(item);
16654
- return result;
16655
- }, {});
16656
- };
16657
- var sortBy = (arr, key, order = "ASC") => {
16658
- const sorted = [...arr].sort((a, b) => {
16659
- const aVal = a[key];
16660
- const bVal = b[key];
16661
- if (aVal < bVal) return order === "ASC" ? -1 : 1;
16662
- if (aVal > bVal) return order === "ASC" ? 1 : -1;
16663
- return 0;
16664
- });
16665
- return sorted;
16666
- };
16667
- var flatten = (arr) => {
16668
- return arr.reduce((flat, item) => flat.concat(item), []);
16669
- };
16670
- var difference = (arr1, arr2) => {
16671
- return arr1.filter((item) => !arr2.includes(item));
16672
- };
16673
- var intersection = (arr1, arr2) => {
16674
- return arr1.filter((item) => arr2.includes(item));
16675
- };
16676
- var omit = (obj, keys) => {
16677
- const result = { ...obj };
16678
- keys.forEach((key) => delete result[key]);
16679
- return result;
16680
- };
16681
- var pick = (obj, keys) => {
16682
- const result = {};
16683
- keys.forEach((key) => {
16684
- if (key in obj) {
16685
- result[key] = obj[key];
16686
- }
16687
- });
16688
- return result;
16689
- };
16690
- var deepMerge = (target, source) => {
16691
- const result = { ...target };
16692
- for (const key in source) {
16693
- if (source.hasOwnProperty(key)) {
16694
- if (typeof source[key] === "object" && source[key] !== null && !Array.isArray(source[key])) {
16695
- result[key] = deepMerge(
16696
- target[key] || {},
16697
- source[key]
16698
- );
16699
- } else {
16700
- result[key] = source[key];
16701
- }
16702
- }
16703
- }
16704
- return result;
16705
- };
16706
- var isEmpty = (obj) => {
16707
- return Object.keys(obj).length === 0;
16708
- };
16709
- var getNestedValue = (obj, path) => {
16710
- const keys = path.split(".");
16711
- let result = obj;
16712
- for (const key of keys) {
16713
- if (result && typeof result === "object" && key in result) {
16714
- result = result[key];
16715
- } else {
16716
- return void 0;
16717
- }
16718
- }
16719
- return result;
16720
- };
16721
- var setNestedValue = (obj, path, value) => {
16722
- const keys = path.split(".");
16723
- let current = obj;
16724
- for (let i = 0; i < keys.length - 1; i++) {
16725
- const key = keys[i];
16726
- if (!(key in current) || typeof current[key] !== "object") {
16727
- current[key] = {};
16728
- }
16729
- current = current[key];
16730
- }
16731
- current[keys[keys.length - 1]] = value;
16732
- };
16733
- var formatDate = (date, format = "MM/DD/YYYY") => {
16734
- const dateObj = new Date(date);
16735
- const year = dateObj.getFullYear();
16736
- const month = String(dateObj.getMonth() + 1).padStart(2, "0");
16737
- const day = String(dateObj.getDate()).padStart(2, "0");
16738
- const hours = String(dateObj.getHours()).padStart(2, "0");
16739
- const minutes = String(dateObj.getMinutes()).padStart(2, "0");
16740
- const seconds = String(dateObj.getSeconds()).padStart(2, "0");
16741
- return format.replace("YYYY", String(year)).replace("MM", month).replace("DD", day).replace("HH", hours).replace("mm", minutes).replace("ss", seconds);
16742
- };
16743
- var addDays = (date, days) => {
16744
- const result = new Date(date);
16745
- result.setDate(result.getDate() + days);
16746
- return result;
16747
- };
16748
- var addHours = (date, hours) => {
16749
- const result = new Date(date);
16750
- result.setHours(result.getHours() + hours);
16751
- return result;
16752
- };
16753
- var getDaysDifference = (date1, date2) => {
16754
- const diffTime = Math.abs(date2.getTime() - date1.getTime());
16755
- return Math.ceil(diffTime / (1e3 * 60 * 60 * 24));
16756
- };
16757
- var isDateInRange = (date, startDate, endDate) => {
16758
- return date >= startDate && date <= endDate;
16759
- };
16760
- var isFutureDate = (date) => {
16761
- return date > /* @__PURE__ */ new Date();
16762
- };
16763
- var isPastDate = (date) => {
16764
- return date < /* @__PURE__ */ new Date();
16765
- };
16766
- var delay = (ms) => {
16767
- return new Promise((resolve) => setTimeout(resolve, ms));
16768
- };
16769
- var debounce = (fn, wait) => {
16770
- let timeoutId;
16771
- return (...args) => {
16772
- clearTimeout(timeoutId);
16773
- timeoutId = setTimeout(() => fn(...args), wait);
16774
- };
16775
- };
16776
- var throttle2 = (fn, limit) => {
16777
- let inThrottle;
16778
- return (...args) => {
16779
- if (!inThrottle) {
16780
- fn(...args);
16781
- inThrottle = true;
16782
- setTimeout(() => inThrottle = false, limit);
16783
- }
16784
- };
16785
- };
16786
- var tryParse = (json, fallback) => {
16787
- try {
16788
- return JSON.parse(json);
16789
- } catch {
16790
- return fallback;
16791
- }
16792
- };
16793
- var withErrorHandling = async (fn) => {
16794
- try {
16795
- const data = await fn();
16796
- return { success: true, data };
16797
- } catch (error) {
16798
- const message = error instanceof Error ? error.message : "Unknown error";
16799
- return { success: false, error: message };
16800
- }
16801
- };
16802
- var createApiResponse = (success, data, message, statusCode = 200) => {
16803
- return {
16804
- success,
16805
- statusCode,
16806
- message: message || (success ? "Success" : "Error"),
16807
- data: data || (success ? {} : null)
16808
- };
16809
- };
16810
- var retry = async (fn, maxAttempts = 3, delayMs = 1e3) => {
16811
- for (let attempt = 1; attempt <= maxAttempts; attempt++) {
16812
- try {
16813
- return await fn();
16814
- } catch (error) {
16815
- if (attempt === maxAttempts) throw error;
16816
- await delay(delayMs * attempt);
16817
- }
16818
- }
16819
- throw new Error("Retry failed");
16820
- };
16821
- var isString2 = (val) => typeof val === "string";
16822
- var isNumber2 = (val) => typeof val === "number";
16823
- var isBoolean2 = (val) => typeof val === "boolean";
16824
- var isArray2 = (val) => Array.isArray(val);
16825
- var isObject2 = (val) => typeof val === "object" && val !== null && !Array.isArray(val);
16826
- var isFunction3 = (val) => typeof val === "function";
16827
- var isNull = (val) => val === null;
16828
- var isUndefined2 = (val) => val === void 0;
16829
- var isNullOrUndefined = (val) => val === null || val === void 0;
16830
- var formatIndianCompact = (num = 0) => {
16831
- if (num >= 1e7) {
16832
- return (num / 1e7).toFixed(2).replace(/\.00$/, "") + "Cr";
16833
- }
16834
- if (num >= 1e5) {
16835
- return (num / 1e5).toFixed(2).replace(/\.00$/, "") + "L";
16836
- }
16837
- return "\u20B9" + num?.toLocaleString("en-IN", {
16838
- minimumFractionDigits: 2,
16839
- maximumFractionDigits: 2
16840
- });
16841
- };
16842
- function formatPrice(price) {
16843
- return `\u20B9${price?.toFixed(2)}`;
16844
- }
16845
- function formatPriceShort(price) {
16846
- if (price >= 1e5) {
16847
- return `\u20B9${(price / 1e5).toFixed(1)}L`;
16848
- } else if (price >= 1e3) {
16849
- return `\u20B9${(price / 1e3).toFixed(1)}K`;
16850
- }
16851
- return `\u20B9${price.toFixed(0)}`;
16852
- }
16853
15504
  export {
16854
15505
  ADD_ADDRESS_MUTATION,
16855
15506
  ADMIN_APP_URL,
@@ -16962,20 +15613,20 @@ export {
16962
15613
  getStoredAuth,
16963
15614
  groupBy,
16964
15615
  intersection,
16965
- isArray2 as isArray,
16966
- isBoolean2 as isBoolean,
15616
+ isArray,
15617
+ isBoolean,
16967
15618
  isDateInRange,
16968
15619
  isEmpty,
16969
- isFunction3 as isFunction,
15620
+ isFunction,
16970
15621
  isFutureDate,
16971
15622
  isNull,
16972
15623
  isNullOrUndefined,
16973
- isNumber2 as isNumber,
16974
- isObject2 as isObject,
15624
+ isNumber,
15625
+ isObject,
16975
15626
  isPastDate,
16976
- isString2 as isString,
15627
+ isString,
16977
15628
  isTokenExpired,
16978
- isUndefined2 as isUndefined,
15629
+ isUndefined,
16979
15630
  isValidCouponCode,
16980
15631
  isValidEmail,
16981
15632
  isValidObjectId,
@@ -16997,7 +15648,7 @@ export {
16997
15648
  slugify,
16998
15649
  sortBy,
16999
15650
  storeAuth,
17000
- throttle2 as throttle,
15651
+ throttle,
17001
15652
  toTitleCase,
17002
15653
  truncate,
17003
15654
  tryParse,