hey-pharmacist-ecommerce 1.1.19 → 1.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +722 -487
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +724 -489
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/components/CartItem.tsx +29 -17
- package/src/lib/Apis/api.ts +0 -1
- package/src/lib/Apis/apis/products-api.ts +187 -0
- package/src/lib/Apis/apis/stores-api.ts +244 -0
- package/src/lib/Apis/models/create-product-dto.ts +6 -0
- package/src/lib/Apis/models/create-single-variant-product-dto.ts +6 -0
- package/src/lib/Apis/models/extended-product-dto.ts +6 -0
- package/src/lib/Apis/models/index.ts +2 -0
- package/src/lib/Apis/models/new-client-email-dto.ts +159 -0
- package/src/lib/Apis/models/product.ts +6 -0
- package/src/lib/Apis/models/schedule-tour-email-dto.ts +45 -0
- package/src/lib/Apis/models/update-product-dto.ts +6 -0
- package/src/lib/Apis/sharedConfig.ts +9 -0
- package/src/lib/Apis/wrapper.ts +11 -16
- package/src/lib/api-adapter/config.ts +12 -6
- package/src/providers/CartProvider.tsx +152 -82
- package/src/screens/CartScreen.tsx +1 -1
- package/src/screens/CheckoutScreen.tsx +21 -6
- package/src/screens/ProductDetailScreen.tsx +140 -132
- package/src/styles/globals.css +18 -5
- package/src/lib/Apis/apis/inventory-api.ts +0 -267
|
@@ -67,6 +67,12 @@ export interface CreateSingleVariantProductDTO {
|
|
|
67
67
|
* @memberof CreateSingleVariantProductDTO
|
|
68
68
|
*/
|
|
69
69
|
upc?: string;
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* @type {boolean}
|
|
73
|
+
* @memberof CreateSingleVariantProductDTO
|
|
74
|
+
*/
|
|
75
|
+
homeScreenFeatured?: boolean;
|
|
70
76
|
/**
|
|
71
77
|
*
|
|
72
78
|
* @type {Array<string>}
|
|
@@ -107,6 +107,12 @@ export interface ExtendedProductDTO {
|
|
|
107
107
|
* @memberof ExtendedProductDTO
|
|
108
108
|
*/
|
|
109
109
|
upc: string;
|
|
110
|
+
/**
|
|
111
|
+
*
|
|
112
|
+
* @type {boolean}
|
|
113
|
+
* @memberof ExtendedProductDTO
|
|
114
|
+
*/
|
|
115
|
+
homeScreenFeatured: boolean;
|
|
110
116
|
/**
|
|
111
117
|
*
|
|
112
118
|
* @type {boolean}
|
|
@@ -96,6 +96,7 @@ export * from './marketing-campaign-content-dto';
|
|
|
96
96
|
export * from './marketing-list-contact-dto';
|
|
97
97
|
export * from './move-subcategory-dto';
|
|
98
98
|
export * from './my-favorite-list-dto';
|
|
99
|
+
export * from './new-client-email-dto';
|
|
99
100
|
export * from './notification';
|
|
100
101
|
export * from './object-id';
|
|
101
102
|
export * from './open-api';
|
|
@@ -128,6 +129,7 @@ export * from './reserve-appointment';
|
|
|
128
129
|
export * from './review';
|
|
129
130
|
export * from './role';
|
|
130
131
|
export * from './schedule-campaign-draft-dto';
|
|
132
|
+
export * from './schedule-tour-email-dto';
|
|
131
133
|
export * from './send-test-email-dto';
|
|
132
134
|
export * from './shallow-parent-category-dto';
|
|
133
135
|
export * from './shipment';
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Hey Pharamcist API
|
|
5
|
+
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
|
6
|
+
*
|
|
7
|
+
* OpenAPI spec version: 1.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by the swagger code generator program.
|
|
11
|
+
* https://github.com/swagger-api/swagger-codegen.git
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @export
|
|
17
|
+
* @interface NewClientEmailDto
|
|
18
|
+
*/
|
|
19
|
+
export interface NewClientEmailDto {
|
|
20
|
+
_id?: string;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @type {string}
|
|
24
|
+
* @memberof NewClientEmailDto
|
|
25
|
+
*/
|
|
26
|
+
domainName: string;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @type {string}
|
|
30
|
+
* @memberof NewClientEmailDto
|
|
31
|
+
*/
|
|
32
|
+
hostingProvider: string;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @type {string}
|
|
36
|
+
* @memberof NewClientEmailDto
|
|
37
|
+
*/
|
|
38
|
+
currentWebsiteFeedback: string;
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @type {string}
|
|
42
|
+
* @memberof NewClientEmailDto
|
|
43
|
+
*/
|
|
44
|
+
suggestedWebsiteName: string;
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @type {string}
|
|
48
|
+
* @memberof NewClientEmailDto
|
|
49
|
+
*/
|
|
50
|
+
hostingPreference: string;
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @type {string}
|
|
54
|
+
* @memberof NewClientEmailDto
|
|
55
|
+
*/
|
|
56
|
+
businessName: string;
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
* @type {string}
|
|
60
|
+
* @memberof NewClientEmailDto
|
|
61
|
+
*/
|
|
62
|
+
businessType: string;
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
* @type {string}
|
|
66
|
+
* @memberof NewClientEmailDto
|
|
67
|
+
*/
|
|
68
|
+
businessPhone: string;
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
* @type {string}
|
|
72
|
+
* @memberof NewClientEmailDto
|
|
73
|
+
*/
|
|
74
|
+
businessEmail: string;
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
* @type {string}
|
|
78
|
+
* @memberof NewClientEmailDto
|
|
79
|
+
*/
|
|
80
|
+
fax: string;
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
* @type {string}
|
|
84
|
+
* @memberof NewClientEmailDto
|
|
85
|
+
*/
|
|
86
|
+
whatsapp: string;
|
|
87
|
+
/**
|
|
88
|
+
*
|
|
89
|
+
* @type {string}
|
|
90
|
+
* @memberof NewClientEmailDto
|
|
91
|
+
*/
|
|
92
|
+
location: string;
|
|
93
|
+
/**
|
|
94
|
+
*
|
|
95
|
+
* @type {string}
|
|
96
|
+
* @memberof NewClientEmailDto
|
|
97
|
+
*/
|
|
98
|
+
socialMedia: string;
|
|
99
|
+
/**
|
|
100
|
+
*
|
|
101
|
+
* @type {string}
|
|
102
|
+
* @memberof NewClientEmailDto
|
|
103
|
+
*/
|
|
104
|
+
layoutStyle: string;
|
|
105
|
+
/**
|
|
106
|
+
*
|
|
107
|
+
* @type {Array<string>}
|
|
108
|
+
* @memberof NewClientEmailDto
|
|
109
|
+
*/
|
|
110
|
+
sections: Array<string>;
|
|
111
|
+
/**
|
|
112
|
+
*
|
|
113
|
+
* @type {string}
|
|
114
|
+
* @memberof NewClientEmailDto
|
|
115
|
+
*/
|
|
116
|
+
businessDescription: string;
|
|
117
|
+
/**
|
|
118
|
+
*
|
|
119
|
+
* @type {Array<string>}
|
|
120
|
+
* @memberof NewClientEmailDto
|
|
121
|
+
*/
|
|
122
|
+
services: Array<string>;
|
|
123
|
+
/**
|
|
124
|
+
*
|
|
125
|
+
* @type {Array<string>}
|
|
126
|
+
* @memberof NewClientEmailDto
|
|
127
|
+
*/
|
|
128
|
+
features: Array<string>;
|
|
129
|
+
/**
|
|
130
|
+
*
|
|
131
|
+
* @type {string}
|
|
132
|
+
* @memberof NewClientEmailDto
|
|
133
|
+
*/
|
|
134
|
+
otherPages: string;
|
|
135
|
+
/**
|
|
136
|
+
*
|
|
137
|
+
* @type {string}
|
|
138
|
+
* @memberof NewClientEmailDto
|
|
139
|
+
*/
|
|
140
|
+
otherServices: string;
|
|
141
|
+
/**
|
|
142
|
+
*
|
|
143
|
+
* @type {string}
|
|
144
|
+
* @memberof NewClientEmailDto
|
|
145
|
+
*/
|
|
146
|
+
otherFeatures: string;
|
|
147
|
+
/**
|
|
148
|
+
*
|
|
149
|
+
* @type {string}
|
|
150
|
+
* @memberof NewClientEmailDto
|
|
151
|
+
*/
|
|
152
|
+
logoFile?: string;
|
|
153
|
+
/**
|
|
154
|
+
*
|
|
155
|
+
* @type {string}
|
|
156
|
+
* @memberof NewClientEmailDto
|
|
157
|
+
*/
|
|
158
|
+
brandingFiles?: string;
|
|
159
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Hey Pharamcist API
|
|
5
|
+
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
|
6
|
+
*
|
|
7
|
+
* OpenAPI spec version: 1.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by the swagger code generator program.
|
|
11
|
+
* https://github.com/swagger-api/swagger-codegen.git
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @export
|
|
17
|
+
* @interface ScheduleTourEmailDto
|
|
18
|
+
*/
|
|
19
|
+
export interface ScheduleTourEmailDto {
|
|
20
|
+
_id?: string;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @type {string}
|
|
24
|
+
* @memberof ScheduleTourEmailDto
|
|
25
|
+
*/
|
|
26
|
+
name: string;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @type {string}
|
|
30
|
+
* @memberof ScheduleTourEmailDto
|
|
31
|
+
*/
|
|
32
|
+
email: string;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @type {string}
|
|
36
|
+
* @memberof ScheduleTourEmailDto
|
|
37
|
+
*/
|
|
38
|
+
phone: string;
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @type {string}
|
|
42
|
+
* @memberof ScheduleTourEmailDto
|
|
43
|
+
*/
|
|
44
|
+
message: string;
|
|
45
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Configuration } from "./configuration";
|
|
2
|
+
|
|
3
|
+
// Initialize with defaults, will be updated by initializeApiAdapter
|
|
4
|
+
export const AXIOS_CONFIG = new Configuration({
|
|
5
|
+
basePath: "https://api.heypharmacist.com", // Default fallback
|
|
6
|
+
baseOptions: {
|
|
7
|
+
timeout: 20000,
|
|
8
|
+
},
|
|
9
|
+
});
|
package/src/lib/Apis/wrapper.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import globalAxios from "axios";
|
|
2
|
-
import { Configuration } from "./configuration";
|
|
3
2
|
import { getCurrentConfig } from '../api-adapter/config';
|
|
4
3
|
import { getAuthToken } from '../api-adapter/config';
|
|
4
|
+
import { AXIOS_CONFIG } from "./sharedConfig";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export const BaseUrl = "https://api.heypharmacist.com"; // Prod
|
|
6
|
+
// Re-export AXIOS_CONFIG for use in other files
|
|
7
|
+
export { AXIOS_CONFIG } from "./sharedConfig";
|
|
9
8
|
|
|
10
9
|
globalAxios.interceptors.request.use(async (config) => {
|
|
11
10
|
|
|
@@ -20,17 +19,18 @@ globalAxios.interceptors.request.use(async (config) => {
|
|
|
20
19
|
// Get storeId from configuration instead of cookies
|
|
21
20
|
const ecommerceConfig = getCurrentConfig();
|
|
22
21
|
const token = getAuthToken();
|
|
23
|
-
|
|
22
|
+
|
|
24
23
|
if (token) {
|
|
25
24
|
config.headers.Authorization = `Bearer ${token}`;
|
|
26
25
|
}
|
|
27
|
-
|
|
26
|
+
|
|
28
27
|
if (ecommerceConfig?.storeId) {
|
|
29
28
|
config.headers["X-Store-Key"] = ecommerceConfig.storeId;
|
|
30
29
|
}
|
|
31
30
|
} catch (error) {
|
|
32
31
|
// Configuration not initialized yet, skip adding headers
|
|
33
|
-
|
|
32
|
+
// Console debug only to reduce noise
|
|
33
|
+
// console.debug('API configuration not initialized yet:', error);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -38,15 +38,10 @@ globalAxios.interceptors.request.use(async (config) => {
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
// Lazy-init AbortController only on client to avoid SSR errors
|
|
41
|
-
let abortController: AbortController | undefined;
|
|
42
41
|
if (typeof window !== 'undefined') {
|
|
43
|
-
abortController = new AbortController();
|
|
42
|
+
const abortController = new AbortController();
|
|
43
|
+
if (AXIOS_CONFIG.baseOptions) {
|
|
44
|
+
AXIOS_CONFIG.baseOptions.signal = abortController.signal;
|
|
45
|
+
}
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
export const AXIOS_CONFIG = new Configuration({
|
|
47
|
-
basePath: BaseUrl,
|
|
48
|
-
baseOptions: {
|
|
49
|
-
signal: abortController?.signal,
|
|
50
|
-
timeout: 20000,
|
|
51
|
-
},
|
|
52
|
-
});
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { Configuration } from '../Apis/configuration';
|
|
7
7
|
import { EcommerceConfig } from '../types';
|
|
8
|
+
import { AXIOS_CONFIG } from '../Apis/sharedConfig';
|
|
8
9
|
|
|
9
10
|
let apiConfiguration: Configuration | null = null;
|
|
10
11
|
let currentConfig: EcommerceConfig | null = null;
|
|
@@ -14,12 +15,13 @@ let currentConfig: EcommerceConfig | null = null;
|
|
|
14
15
|
*/
|
|
15
16
|
export function initializeApiAdapter(config: EcommerceConfig): Configuration {
|
|
16
17
|
currentConfig = config;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
|
|
19
|
+
// Update the singleton AXIOS_CONFIG
|
|
20
|
+
AXIOS_CONFIG.basePath = config.apiBaseUrl;
|
|
21
|
+
AXIOS_CONFIG.apiKey = config.storeId;
|
|
22
|
+
AXIOS_CONFIG.accessToken = () => getAuthToken() || '';
|
|
23
|
+
|
|
24
|
+
apiConfiguration = AXIOS_CONFIG;
|
|
23
25
|
|
|
24
26
|
return apiConfiguration;
|
|
25
27
|
}
|
|
@@ -57,6 +59,8 @@ export function setAuthToken(token: string): void {
|
|
|
57
59
|
if (apiConfiguration) {
|
|
58
60
|
apiConfiguration.accessToken = () => token;
|
|
59
61
|
}
|
|
62
|
+
// Also update the singleton directly
|
|
63
|
+
AXIOS_CONFIG.accessToken = () => token;
|
|
60
64
|
}
|
|
61
65
|
}
|
|
62
66
|
|
|
@@ -74,6 +78,8 @@ export function clearAuthToken(): void {
|
|
|
74
78
|
if (apiConfiguration) {
|
|
75
79
|
apiConfiguration.accessToken = () => '';
|
|
76
80
|
}
|
|
81
|
+
// Also update the singleton directly
|
|
82
|
+
AXIOS_CONFIG.accessToken = () => '';
|
|
77
83
|
}
|
|
78
84
|
}
|
|
79
85
|
|