woodsportal-client-sdk 1.1.4-dev.2 → 1.1.4-dev.20
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/adapters/react/index.d.ts +33 -0
- package/dist/adapters/react/index.js +290 -0
- package/dist/adapters/react/index.js.map +1 -0
- package/dist/index.d.ts +95 -3
- package/dist/index.js +679 -172
- package/dist/index.js.map +1 -1
- package/package.json +17 -7
package/dist/index.js
CHANGED
|
@@ -3,13 +3,18 @@ import axios from 'axios';
|
|
|
3
3
|
import pako from 'pako';
|
|
4
4
|
import { Base64 } from 'js-base64';
|
|
5
5
|
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
6
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
8
|
var __esm = (fn, res) => function __init() {
|
|
8
9
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
10
|
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
10
15
|
|
|
11
16
|
// src/utils/constants.ts
|
|
12
|
-
var LOGIN_DETAILS, REFRESH_TOKEN, PORTAL, SUBSCRIPTION_TYPE, HUBSPOT_DATA, HUB_ID, DEV_PORTAL_ID;
|
|
17
|
+
var LOGIN_DETAILS, REFRESH_TOKEN, PORTAL, SUBSCRIPTION_TYPE, HUBSPOT_DATA, HUB_ID, DEV_PORTAL_ID, PORTAL_ID, DEV_API_URL;
|
|
13
18
|
var init_constants = __esm({
|
|
14
19
|
"src/utils/constants.ts"() {
|
|
15
20
|
LOGIN_DETAILS = "loginDetails";
|
|
@@ -19,6 +24,8 @@ var init_constants = __esm({
|
|
|
19
24
|
HUBSPOT_DATA = "hubSpotData";
|
|
20
25
|
HUB_ID = "hubId";
|
|
21
26
|
DEV_PORTAL_ID = "devPortalId";
|
|
27
|
+
PORTAL_ID = "portalId";
|
|
28
|
+
DEV_API_URL = "devApiUrl";
|
|
22
29
|
}
|
|
23
30
|
});
|
|
24
31
|
var setCookie, getCookie, removeAllCookie, isCookieExpired;
|
|
@@ -51,43 +58,19 @@ var init_cookie = __esm({
|
|
|
51
58
|
}
|
|
52
59
|
});
|
|
53
60
|
|
|
54
|
-
// src/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
function clearAccessToken() {
|
|
67
|
-
accessToken = null;
|
|
68
|
-
tokenExpiresAt = null;
|
|
69
|
-
}
|
|
70
|
-
function isExpiresAccessToken() {
|
|
71
|
-
if (!tokenExpiresAt) return true;
|
|
72
|
-
return Date.now() >= tokenExpiresAt;
|
|
73
|
-
}
|
|
74
|
-
function isAuthenticateApp() {
|
|
75
|
-
if (isCookieExpired(REFRESH_TOKEN) || isExpiresAccessToken()) {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
var accessToken, tokenExpiresAt;
|
|
81
|
-
var init_token_store = __esm({
|
|
82
|
-
"src/clint/token-store.ts"() {
|
|
83
|
-
init_cookie();
|
|
84
|
-
init_constants();
|
|
85
|
-
accessToken = null;
|
|
86
|
-
tokenExpiresAt = null;
|
|
87
|
-
}
|
|
61
|
+
// src/client/auth-utils.ts
|
|
62
|
+
var auth_utils_exports = {};
|
|
63
|
+
__export(auth_utils_exports, {
|
|
64
|
+
getPortal: () => getPortal,
|
|
65
|
+
getProfile: () => getProfile,
|
|
66
|
+
getRefreshToken: () => getRefreshToken,
|
|
67
|
+
getSubscriptionType: () => getSubscriptionType,
|
|
68
|
+
setAccessToken: () => setAccessToken,
|
|
69
|
+
setLoggedInDetails: () => setLoggedInDetails,
|
|
70
|
+
setPortal: () => setPortal,
|
|
71
|
+
setRefreshToken: () => setRefreshToken,
|
|
72
|
+
setSubscriptionType: () => setSubscriptionType
|
|
88
73
|
});
|
|
89
|
-
|
|
90
|
-
// src/clint/auth-utils.ts
|
|
91
74
|
function setRefreshToken(token, expiresAt) {
|
|
92
75
|
return new Promise((resolve) => {
|
|
93
76
|
setCookie(REFRESH_TOKEN, JSON.stringify(token), expiresAt);
|
|
@@ -100,15 +83,21 @@ function setAccessToken(token, expiresIn) {
|
|
|
100
83
|
resolve();
|
|
101
84
|
});
|
|
102
85
|
}
|
|
86
|
+
function getProfile() {
|
|
87
|
+
return JSON.parse(getCookie(LOGIN_DETAILS || null) || null);
|
|
88
|
+
}
|
|
103
89
|
function getRefreshToken() {
|
|
104
90
|
return JSON.parse(getCookie(REFRESH_TOKEN || null) || null);
|
|
105
91
|
}
|
|
106
92
|
function getPortal() {
|
|
107
93
|
return JSON.parse(getCookie(PORTAL || null) || null);
|
|
108
94
|
}
|
|
95
|
+
function getSubscriptionType() {
|
|
96
|
+
return JSON.parse(getCookie(SUBSCRIPTION_TYPE || null) || null);
|
|
97
|
+
}
|
|
109
98
|
var setLoggedInDetails, setPortal, setSubscriptionType;
|
|
110
99
|
var init_auth_utils = __esm({
|
|
111
|
-
"src/
|
|
100
|
+
"src/client/auth-utils.ts"() {
|
|
112
101
|
init_constants();
|
|
113
102
|
init_cookie();
|
|
114
103
|
init_token_store();
|
|
@@ -133,20 +122,104 @@ var init_auth_utils = __esm({
|
|
|
133
122
|
}
|
|
134
123
|
});
|
|
135
124
|
|
|
125
|
+
// src/client/token-store.ts
|
|
126
|
+
function getAccessToken() {
|
|
127
|
+
return accessToken;
|
|
128
|
+
}
|
|
129
|
+
function storAccessToken(token, expiresIn) {
|
|
130
|
+
accessToken = token;
|
|
131
|
+
if (expiresIn) {
|
|
132
|
+
tokenExpiresAt = Date.now() + expiresIn * 1e3;
|
|
133
|
+
} else {
|
|
134
|
+
tokenExpiresAt = null;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function clearAccessToken() {
|
|
138
|
+
accessToken = null;
|
|
139
|
+
tokenExpiresAt = null;
|
|
140
|
+
}
|
|
141
|
+
function isExpiresAccessToken() {
|
|
142
|
+
if (!tokenExpiresAt) return true;
|
|
143
|
+
return Date.now() >= tokenExpiresAt;
|
|
144
|
+
}
|
|
145
|
+
function setRefreshCallback(callback) {
|
|
146
|
+
refreshCallback = callback;
|
|
147
|
+
}
|
|
148
|
+
async function ensureValidRefresh() {
|
|
149
|
+
if (isExpiresAccessToken() && refreshCallback) {
|
|
150
|
+
const { getRefreshToken: getRefreshToken2 } = await Promise.resolve().then(() => (init_auth_utils(), auth_utils_exports));
|
|
151
|
+
const refreshToken = getRefreshToken2();
|
|
152
|
+
if (refreshToken) {
|
|
153
|
+
await refreshCallback(refreshToken);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function isAuthenticateApp() {
|
|
158
|
+
if (isCookieExpired(REFRESH_TOKEN) || isExpiresAccessToken()) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
var accessToken, tokenExpiresAt, refreshCallback;
|
|
164
|
+
var init_token_store = __esm({
|
|
165
|
+
"src/client/token-store.ts"() {
|
|
166
|
+
init_cookie();
|
|
167
|
+
init_constants();
|
|
168
|
+
accessToken = null;
|
|
169
|
+
tokenExpiresAt = null;
|
|
170
|
+
refreshCallback = null;
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// src/client/index.ts
|
|
175
|
+
var client_exports = {};
|
|
176
|
+
__export(client_exports, {
|
|
177
|
+
Client: () => Client
|
|
178
|
+
});
|
|
179
|
+
|
|
136
180
|
// src/utils/config.ts
|
|
137
181
|
init_constants();
|
|
138
182
|
|
|
139
183
|
// src/utils/localStoraget.ts
|
|
184
|
+
var memory = /* @__PURE__ */ new Map();
|
|
185
|
+
var memoryStore = {
|
|
186
|
+
getItem(key) {
|
|
187
|
+
return memory.has(key) ? memory.get(key) : null;
|
|
188
|
+
},
|
|
189
|
+
setItem(key, value) {
|
|
190
|
+
memory.set(key, value);
|
|
191
|
+
},
|
|
192
|
+
removeItem(key) {
|
|
193
|
+
memory.delete(key);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
function resolveStore() {
|
|
197
|
+
if (typeof globalThis === "undefined") {
|
|
198
|
+
return memoryStore;
|
|
199
|
+
}
|
|
200
|
+
const ls = globalThis.localStorage;
|
|
201
|
+
if (!ls || typeof ls.getItem !== "function") {
|
|
202
|
+
return memoryStore;
|
|
203
|
+
}
|
|
204
|
+
try {
|
|
205
|
+
const probeKey = "__woodsportal_client_sdk_ls_probe__";
|
|
206
|
+
ls.setItem(probeKey, "1");
|
|
207
|
+
ls.removeItem(probeKey);
|
|
208
|
+
return ls;
|
|
209
|
+
} catch {
|
|
210
|
+
return memoryStore;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
140
213
|
var storage = {
|
|
141
214
|
set: (key, value) => {
|
|
142
|
-
|
|
215
|
+
resolveStore().setItem(key, JSON.stringify(value));
|
|
143
216
|
},
|
|
144
217
|
get: (key) => {
|
|
145
|
-
const item =
|
|
218
|
+
const item = resolveStore().getItem(key);
|
|
146
219
|
return item ? JSON.parse(item) : null;
|
|
147
220
|
},
|
|
148
221
|
remove: (key) => {
|
|
149
|
-
|
|
222
|
+
resolveStore().removeItem(key);
|
|
150
223
|
}
|
|
151
224
|
};
|
|
152
225
|
|
|
@@ -159,15 +232,22 @@ var config = {
|
|
|
159
232
|
get devPortalId() {
|
|
160
233
|
const hubSpotData = storage.get(HUBSPOT_DATA);
|
|
161
234
|
return hubSpotData?.[DEV_PORTAL_ID] || "";
|
|
235
|
+
},
|
|
236
|
+
get portalId() {
|
|
237
|
+
const hubSpotData = storage.get(HUBSPOT_DATA);
|
|
238
|
+
return hubSpotData?.[PORTAL_ID] || "";
|
|
239
|
+
},
|
|
240
|
+
get devApiUrl() {
|
|
241
|
+
const hubSpotData = storage.get(HUBSPOT_DATA);
|
|
242
|
+
return hubSpotData?.[DEV_API_URL] || "";
|
|
162
243
|
}
|
|
163
244
|
};
|
|
164
245
|
var setConfig = {
|
|
165
246
|
setDevPortalId(portalId) {
|
|
166
247
|
const existing = storage.get(HUBSPOT_DATA) || {};
|
|
167
|
-
console.log("portalId", portalId);
|
|
168
248
|
storage.set(HUBSPOT_DATA, {
|
|
169
249
|
...existing,
|
|
170
|
-
[
|
|
250
|
+
[PORTAL_ID]: portalId
|
|
171
251
|
});
|
|
172
252
|
}
|
|
173
253
|
};
|
|
@@ -180,7 +260,7 @@ var generateApiUrl = ({
|
|
|
180
260
|
}) => {
|
|
181
261
|
const defaultParams = {
|
|
182
262
|
hubId: config.hubId,
|
|
183
|
-
portalId: config.
|
|
263
|
+
portalId: config.portalId
|
|
184
264
|
};
|
|
185
265
|
params = { ...defaultParams, ...params };
|
|
186
266
|
const url2 = replaceParams(route, params);
|
|
@@ -198,7 +278,7 @@ function replaceParams(template, values) {
|
|
|
198
278
|
);
|
|
199
279
|
}
|
|
200
280
|
|
|
201
|
-
// src/
|
|
281
|
+
// src/client/api-endpoints.ts
|
|
202
282
|
var API_ENDPOINTS = {
|
|
203
283
|
// Auth
|
|
204
284
|
PRE_LOGIN: "/api/auth/pre-login",
|
|
@@ -210,6 +290,7 @@ var API_ENDPOINTS = {
|
|
|
210
290
|
VERIFY_EMAIL: "/api/auth/verify-email",
|
|
211
291
|
REGISTER_EXISTING_USER: "/api/auth/existing-user-register",
|
|
212
292
|
RESEND_EMAIL: "/api/auth/resend-email",
|
|
293
|
+
VERIFY_EMAIL_RESEND: "/api/auth/verify-email/resend",
|
|
213
294
|
LOGOUT: "/api/auth/logout",
|
|
214
295
|
// SSO
|
|
215
296
|
SSO_DETAILS: "/api/auth/sso/active",
|
|
@@ -220,51 +301,66 @@ var API_ENDPOINTS = {
|
|
|
220
301
|
PROFILE: "/api/${hubId}/${portalId}/profiles",
|
|
221
302
|
CHANGE_PASSWORD: "/api/auth/change-password",
|
|
222
303
|
// Pipeline
|
|
223
|
-
PIPELINES: "api/${hubId}/${portalId}/hubspot-object-pipelines/${hubspotObjectTypeId}",
|
|
304
|
+
PIPELINES: "/api/${hubId}/${portalId}/hubspot-object-pipelines/${hubspotObjectTypeId}",
|
|
224
305
|
// Stage
|
|
225
|
-
STAGES: "api/${hubId}/${portalId}/hubspot-object-pipelines/${objectTypeId}/${pipelineId}/stages",
|
|
226
|
-
//
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
306
|
+
STAGES: "/api/${hubId}/${portalId}/hubspot-object-pipelines/${objectTypeId}/${pipelineId}/stages",
|
|
307
|
+
// Cache purge (replaces cache=false refresh; requires features.cache-purge-api-enabled on API)
|
|
308
|
+
CACHE_PURGE: "/api/${hubId}/${portalId}/cache-purge-jobs",
|
|
309
|
+
CACHE_PURGE_STATUS: "/api/${hubId}/${portalId}/cache-purge-jobs/${purgeJobId}",
|
|
310
|
+
/** @deprecated Use CACHE_PURGE */
|
|
311
|
+
CACHE_PURGE_LEGACY: "/api/${hubId}/${portalId}/cache/purge",
|
|
312
|
+
/** @deprecated Use CACHE_PURGE_STATUS */
|
|
313
|
+
CACHE_PURGE_STATUS_LEGACY: "/api/${hubId}/${portalId}/cache/purge/${purgeJobId}",
|
|
314
|
+
// Object (read on hubspot-object-data; form layout on hubspot-object-forms)
|
|
315
|
+
OBJECTS: "/api/${hubId}/${portalId}/hubspot-object-data/${hubspotObjectTypeId}/records",
|
|
316
|
+
OBJECTS_FORM: "/api/${hubId}/${portalId}/hubspot-object-forms/${hubspotObjectTypeId}/fields",
|
|
317
|
+
OBJECTS_FORM_OPTIONS: "/api/${hubId}/${portalId}/hubspot-object-forms/${formId}/${objectTypeId}",
|
|
318
|
+
RECORDS_CREATE: "/api/${hubId}/${portalId}/hubspot-object-data/${hubspotObjectTypeId}/records",
|
|
319
|
+
RECORDS_UPDATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}",
|
|
320
|
+
RECORDS_ASSOCIATE: "/api/${hubId}/${portalId}/hubspot-object-data/${fromObjectTypeId}/records/${fromRecordId}/associations/${toObjectTypeId}",
|
|
321
|
+
RECORDS_DISASSOCIATE: "/api/${hubId}/${portalId}/hubspot-object-data/${fromObjectTypeId}/records/${fromRecordId}/associations/${toObjectTypeId}",
|
|
322
|
+
/** @deprecated Use RECORDS_CREATE */
|
|
323
|
+
OBJECTS_CREATE: "/api/${hubId}/${portalId}/hubspot-object-forms/${hubspotObjectTypeId}/fields",
|
|
324
|
+
/** @deprecated Use RECORDS_ASSOCIATE */
|
|
325
|
+
OBJECTS_CREATE_EXISTING: "/api/${hubId}/${portalId}/hubspot-object-forms/:fromObjectTypeId/:fromRecordId/associations/:toObjectTypeId",
|
|
326
|
+
OBJECTS_DETAILS: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}",
|
|
327
|
+
/** @deprecated Use RECORDS_UPDATE */
|
|
328
|
+
OBJECTS_DETAILS_UPDATE: "/api/${hubId}/${portalId}/hubspot-object-forms/${objectId}/records/${id}",
|
|
329
|
+
OBJECTS_DETAILS_UPDATE_LEGACY: "/api/${hubId}/${portalId}/hubspot-object-forms/${objectId}/properties/${id}",
|
|
330
|
+
// Notes (nested under CRM record)
|
|
331
|
+
NOTES: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/notes",
|
|
332
|
+
NOTES_CREATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/notes",
|
|
333
|
+
NOTES_DETAILS_UPDATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/notes/${note_id}",
|
|
334
|
+
NOTES_IMAGE_UPLOAD: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/notes/images",
|
|
335
|
+
NOTES_ATTACHMENT_UPLOAD: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/notes/attachments",
|
|
336
|
+
NOTES_ATTACHMENT_UPDATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/notes/attachments/${note_id}",
|
|
337
|
+
// Email (nested under CRM record)
|
|
338
|
+
EMAILS: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/emails",
|
|
339
|
+
EMAILS_CREATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/emails",
|
|
340
|
+
EMAILS_DETAILS_UPDATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/emails/${email_id}",
|
|
341
|
+
EMAILS_IMAGE_UPLOAD: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/emails/images",
|
|
342
|
+
EMAILS_ATTACHMENT_UPLOAD: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/emails/attachments",
|
|
343
|
+
EMAILS_ATTACHMENT_UPDATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/emails/attachments/${email_id}",
|
|
344
|
+
// File manager (nested under CRM record)
|
|
345
|
+
FILES: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/files",
|
|
346
|
+
FILE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/files/${rowId}",
|
|
347
|
+
FILES_CREATE_FOLDER: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/folders",
|
|
348
|
+
FILES_UPLOAD: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/files"
|
|
253
349
|
};
|
|
254
350
|
init_token_store();
|
|
255
351
|
|
|
256
|
-
// src/
|
|
352
|
+
// src/client/config.ts
|
|
257
353
|
var config2 = {
|
|
258
354
|
baseURL: "https://api.dev.woodsportal.com"
|
|
259
355
|
};
|
|
260
356
|
|
|
261
|
-
// src/
|
|
357
|
+
// src/client/http-clint.ts
|
|
262
358
|
init_auth_utils();
|
|
263
359
|
var axiosInstance = null;
|
|
264
360
|
var config3 = {};
|
|
265
361
|
function initializeHttpClient(clientConfig) {
|
|
266
362
|
config3 = clientConfig;
|
|
267
|
-
const baseURL =
|
|
363
|
+
const baseURL = config?.devApiUrl || config3.baseURL;
|
|
268
364
|
const timeout = config3.timeout ?? 5e4;
|
|
269
365
|
axiosInstance = axios.create({
|
|
270
366
|
baseURL,
|
|
@@ -274,6 +370,7 @@ function initializeHttpClient(clientConfig) {
|
|
|
274
370
|
...config3.headers
|
|
275
371
|
}
|
|
276
372
|
});
|
|
373
|
+
setRefreshCallback(getAuthRefreshToken);
|
|
277
374
|
axiosInstance.interceptors.request.use((config4) => {
|
|
278
375
|
const token = getAccessToken();
|
|
279
376
|
if (token) {
|
|
@@ -300,6 +397,44 @@ function getAxiosInstance() {
|
|
|
300
397
|
}
|
|
301
398
|
return axiosInstance;
|
|
302
399
|
}
|
|
400
|
+
function formatBooleanSearchParam(key, value) {
|
|
401
|
+
return value ? `${key}:1` : `${key}:`;
|
|
402
|
+
}
|
|
403
|
+
var HttpClient = class {
|
|
404
|
+
static async get(url2, params) {
|
|
405
|
+
await ensureValidRefresh();
|
|
406
|
+
const response = await getAxiosInstance().get(url2, { params });
|
|
407
|
+
return response.data;
|
|
408
|
+
}
|
|
409
|
+
static async post(url2, data, options) {
|
|
410
|
+
await ensureValidRefresh();
|
|
411
|
+
const response = await getAxiosInstance().post(url2, data, options);
|
|
412
|
+
return response.data;
|
|
413
|
+
}
|
|
414
|
+
static async put(url2, data) {
|
|
415
|
+
await ensureValidRefresh();
|
|
416
|
+
const response = await getAxiosInstance().put(url2, data);
|
|
417
|
+
return response.data;
|
|
418
|
+
}
|
|
419
|
+
static async delete(url2, config4) {
|
|
420
|
+
await ensureValidRefresh();
|
|
421
|
+
const response = await getAxiosInstance().delete(url2, config4);
|
|
422
|
+
return response.data;
|
|
423
|
+
}
|
|
424
|
+
static formatSearchParams(params) {
|
|
425
|
+
return Object.entries(params).filter(([, value]) => Boolean(value)).map(
|
|
426
|
+
([k, v]) => [
|
|
427
|
+
"type",
|
|
428
|
+
"categories",
|
|
429
|
+
"tags",
|
|
430
|
+
"author",
|
|
431
|
+
"manufacturer",
|
|
432
|
+
"shops",
|
|
433
|
+
"refund_reason"
|
|
434
|
+
].includes(k) ? `${k}.slug:${v}` : ["is_approved"].includes(k) ? formatBooleanSearchParam(k, v) : `${k}:${v}`
|
|
435
|
+
).join(";");
|
|
436
|
+
}
|
|
437
|
+
};
|
|
303
438
|
var AuthHttpClient = class {
|
|
304
439
|
static async get(url2, params) {
|
|
305
440
|
const response = await getAxiosInstance().get(url2, { params });
|
|
@@ -616,14 +751,11 @@ var getParamDetails = (props, isDetailsPage = false) => {
|
|
|
616
751
|
};
|
|
617
752
|
};
|
|
618
753
|
|
|
619
|
-
// src/clint/index.ts
|
|
620
|
-
init_auth_utils();
|
|
621
|
-
|
|
622
754
|
// src/breadcrumb/url.ts
|
|
623
755
|
var useUpdateLink = () => {
|
|
624
|
-
const
|
|
625
|
-
|
|
626
|
-
|
|
756
|
+
const updateLink = async (props, displayName = "prm") => {
|
|
757
|
+
const search = getParam("b");
|
|
758
|
+
const pathname = getPath();
|
|
627
759
|
let breadcrumbs = decodeToBase64(search) || [];
|
|
628
760
|
if (breadcrumbs.length < 1) {
|
|
629
761
|
const routeMenu = getRouteMenu(pathname);
|
|
@@ -636,12 +768,13 @@ var useUpdateLink = () => {
|
|
|
636
768
|
}
|
|
637
769
|
const lastBreadcrumb = breadcrumbs[breadcrumbs.length - 1];
|
|
638
770
|
if (displayName) {
|
|
639
|
-
|
|
640
|
-
|
|
771
|
+
const ex = await getDeep(lastBreadcrumb, displayName) || {};
|
|
772
|
+
await setDeep(lastBreadcrumb, displayName, {
|
|
773
|
+
...ex,
|
|
641
774
|
...props
|
|
642
775
|
});
|
|
643
776
|
} else {
|
|
644
|
-
Object.assign(lastBreadcrumb, props);
|
|
777
|
+
await Object.assign(lastBreadcrumb, props);
|
|
645
778
|
}
|
|
646
779
|
const newBase64 = convertToBase64(breadcrumbs);
|
|
647
780
|
updateBParam(newBase64);
|
|
@@ -656,11 +789,13 @@ var useUpdateLink = () => {
|
|
|
656
789
|
curr = curr[keys[i]];
|
|
657
790
|
}
|
|
658
791
|
curr[keys[keys.length - 1]] = value;
|
|
792
|
+
return curr;
|
|
659
793
|
}
|
|
660
794
|
function getDeep(obj, path) {
|
|
661
795
|
return path.split(".").reduce((acc, key) => acc?.[key], obj);
|
|
662
796
|
}
|
|
663
797
|
const getLinkParams = (displayName = "prm") => {
|
|
798
|
+
const search = getParam("b");
|
|
664
799
|
let breadcrumbs = decodeToBase64(search) || [];
|
|
665
800
|
if (breadcrumbs.length < 1) return null;
|
|
666
801
|
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
|
@@ -681,6 +816,7 @@ var useUpdateLink = () => {
|
|
|
681
816
|
return output;
|
|
682
817
|
};
|
|
683
818
|
const filterParams = (displayName = "prm") => {
|
|
819
|
+
const search = getParam("b");
|
|
684
820
|
let breadcrumbs = decodeToBase64(search) || [];
|
|
685
821
|
if (breadcrumbs.length < 1) return null;
|
|
686
822
|
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
|
@@ -716,7 +852,37 @@ var updateBParam = (newValue) => {
|
|
|
716
852
|
}
|
|
717
853
|
};
|
|
718
854
|
|
|
719
|
-
// src/
|
|
855
|
+
// src/client/index.ts
|
|
856
|
+
var recordWriteContext = (paramsObject) => {
|
|
857
|
+
if (!paramsObject) {
|
|
858
|
+
return void 0;
|
|
859
|
+
}
|
|
860
|
+
const context = {};
|
|
861
|
+
const keys = [
|
|
862
|
+
"parentObjectTypeId",
|
|
863
|
+
"parentObjectRecordId",
|
|
864
|
+
"mediatorObjectTypeId",
|
|
865
|
+
"mediatorObjectRecordId"
|
|
866
|
+
];
|
|
867
|
+
keys.forEach((key) => {
|
|
868
|
+
const value = paramsObject[key];
|
|
869
|
+
if (value !== void 0 && value !== null && String(value).length > 0) {
|
|
870
|
+
context[key] = String(value);
|
|
871
|
+
}
|
|
872
|
+
});
|
|
873
|
+
return Object.keys(context).length > 0 ? context : void 0;
|
|
874
|
+
};
|
|
875
|
+
var mergeRecordWriteBody = (payload, paramsObject, options) => {
|
|
876
|
+
const base = { ...payload || {} };
|
|
877
|
+
const context = recordWriteContext(paramsObject);
|
|
878
|
+
if (context) {
|
|
879
|
+
base.context = context;
|
|
880
|
+
}
|
|
881
|
+
if (options && Object.keys(options).length > 0) {
|
|
882
|
+
base.options = options;
|
|
883
|
+
}
|
|
884
|
+
return base;
|
|
885
|
+
};
|
|
720
886
|
var Client = {
|
|
721
887
|
authentication: {
|
|
722
888
|
preLogin: (data) => AuthHttpClient.post(API_ENDPOINTS.PRE_LOGIN, data),
|
|
@@ -736,10 +902,10 @@ var Client = {
|
|
|
736
902
|
resetPasswordVerifyToken: (data) => AuthHttpClient.post(API_ENDPOINTS.RESET_PASSWORD_VERIFY_TOKEN, data),
|
|
737
903
|
resetPassword: (data) => AuthHttpClient.post(API_ENDPOINTS.RESET_PASSWORD, data),
|
|
738
904
|
forgetPassword: (data) => AuthHttpClient.post(API_ENDPOINTS.FORGET_PASSWORD, data),
|
|
739
|
-
registerExistingUser: (data) => AuthHttpClient.post(API_ENDPOINTS.REGISTER_EXISTING_USER, data),
|
|
740
|
-
verifyEmailResend: (data) => AuthHttpClient.post(API_ENDPOINTS.
|
|
905
|
+
registerExistingUser: (data) => AuthHttpClient.post(API_ENDPOINTS.REGISTER_EXISTING_USER, data?.payload),
|
|
906
|
+
verifyEmailResend: (data) => AuthHttpClient.post(API_ENDPOINTS.VERIFY_EMAIL_RESEND, data),
|
|
741
907
|
resendEmail: (data) => AuthHttpClient.post(API_ENDPOINTS.RESEND_EMAIL, data),
|
|
742
|
-
logout: () =>
|
|
908
|
+
logout: () => HttpClient.post(API_ENDPOINTS.LOGOUT, null)
|
|
743
909
|
},
|
|
744
910
|
sso: {
|
|
745
911
|
getSsoDetails: () => AuthHttpClient.get(API_ENDPOINTS.SSO_DETAILS),
|
|
@@ -747,9 +913,9 @@ var Client = {
|
|
|
747
913
|
ssoCallback: (payload) => AuthHttpClient.get(generateApiUrl({ route: API_ENDPOINTS.SSO_CALLBACK, queryParams: payload?.queryParams }))
|
|
748
914
|
},
|
|
749
915
|
user: {
|
|
750
|
-
me: () =>
|
|
751
|
-
profile: (payload) =>
|
|
752
|
-
changePassword: (data) =>
|
|
916
|
+
me: () => HttpClient.get(generateApiUrl({ route: API_ENDPOINTS.ME })),
|
|
917
|
+
profile: (payload) => HttpClient.get(generateApiUrl({ route: API_ENDPOINTS.PROFILE, queryParams: payload })),
|
|
918
|
+
changePassword: (data) => HttpClient.post(API_ENDPOINTS.CHANGE_PASSWORD, data)
|
|
753
919
|
},
|
|
754
920
|
pipeline: {
|
|
755
921
|
list: (payload = null, param = null) => {
|
|
@@ -766,26 +932,26 @@ var Client = {
|
|
|
766
932
|
apiParams.parentObjectTypeId = "0-2";
|
|
767
933
|
}
|
|
768
934
|
apiParams.isPrimaryCompany = param?.isPrimaryCompany;
|
|
769
|
-
apiParams.cache = payload?.
|
|
935
|
+
apiParams.cache = payload?.cache;
|
|
770
936
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.PIPELINES, params, queryParams: apiParams });
|
|
771
|
-
return
|
|
937
|
+
return HttpClient.get(apiUrl);
|
|
772
938
|
}
|
|
773
939
|
},
|
|
774
940
|
stage: {
|
|
775
941
|
list: (props = null) => {
|
|
776
|
-
const portalId = config.devPortalId;
|
|
777
942
|
const params = {
|
|
778
|
-
hubId: config.hubId,
|
|
779
|
-
portalId,
|
|
943
|
+
// hubId: config.hubId,
|
|
944
|
+
// portalId: portalId,
|
|
780
945
|
objectTypeId: props?.params?.objectTypeId,
|
|
781
946
|
pipelineId: props?.params?.pipelineId
|
|
782
947
|
};
|
|
783
948
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.STAGES, params });
|
|
784
|
-
return
|
|
949
|
+
return HttpClient.get(apiUrl);
|
|
785
950
|
}
|
|
786
951
|
},
|
|
787
952
|
object: {
|
|
788
|
-
list: (payload = null, param = null) => {
|
|
953
|
+
list: async (payload = null, param = null) => {
|
|
954
|
+
param.cache = payload.cache;
|
|
789
955
|
const params = { hubspotObjectTypeId: payload?.hubspotObjectTypeId };
|
|
790
956
|
const { updateLink, getLinkParams } = useUpdateLink();
|
|
791
957
|
const { getParamDetails: getParamDetails2 } = routeParam;
|
|
@@ -804,7 +970,7 @@ var Client = {
|
|
|
804
970
|
const fParams = getLinkParams();
|
|
805
971
|
param = { ...payload?.isFristTimeLoadData && fParams && !payload?.isHome ? fParams : param, ...paramsObject };
|
|
806
972
|
if (!payload?.isFristTimeLoadData || !fParams) {
|
|
807
|
-
updateLink({
|
|
973
|
+
await updateLink({
|
|
808
974
|
"sort": param?.sort,
|
|
809
975
|
"s": param?.search,
|
|
810
976
|
"fPn": param?.filterPropertyName,
|
|
@@ -820,13 +986,13 @@ var Client = {
|
|
|
820
986
|
}
|
|
821
987
|
if (mPipelines != void 0 && mPipelines?.length === 0 && !payload?.specPipeLine) {
|
|
822
988
|
param.filterValue = "";
|
|
823
|
-
updateLink({
|
|
989
|
+
await updateLink({
|
|
824
990
|
"fV": param?.filterValue
|
|
825
991
|
});
|
|
826
992
|
}
|
|
827
993
|
if (mPipelines != void 0 && mPipelines?.length === 1 && !payload?.specPipeLine && mSelectedPipeline != null) {
|
|
828
994
|
param.filterValue = mPipelines[0].pipelineId;
|
|
829
|
-
updateLink({
|
|
995
|
+
await updateLink({
|
|
830
996
|
"fV": param?.filterValue
|
|
831
997
|
});
|
|
832
998
|
}
|
|
@@ -841,45 +1007,70 @@ var Client = {
|
|
|
841
1007
|
}
|
|
842
1008
|
param.parentAccessLabel = parentAccessLabel;
|
|
843
1009
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS, params, queryParams: param });
|
|
844
|
-
return
|
|
1010
|
+
return HttpClient.get(apiUrl);
|
|
1011
|
+
},
|
|
1012
|
+
sideBarList: async (payload = null) => {
|
|
1013
|
+
const hubspotObjectTypeId = payload?.hubspotObjectTypeId;
|
|
1014
|
+
const params = { hubspotObjectTypeId };
|
|
1015
|
+
const queryParams = payload.param;
|
|
1016
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS, params, queryParams });
|
|
1017
|
+
return HttpClient.get(apiUrl);
|
|
845
1018
|
},
|
|
846
1019
|
form: (payload = null) => {
|
|
847
1020
|
const params = { hubspotObjectTypeId: payload?.hubspotObjectTypeId };
|
|
848
|
-
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.
|
|
849
|
-
return
|
|
1021
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_FORM, params, queryParams: payload?.params });
|
|
1022
|
+
return HttpClient.get(apiUrl);
|
|
850
1023
|
},
|
|
851
1024
|
objectFormOptions: (payload = null) => {
|
|
852
|
-
const params = {
|
|
1025
|
+
const params = {
|
|
1026
|
+
formId: payload?.formId,
|
|
1027
|
+
objectTypeId: payload?.objectTypeId ?? payload?.hubspotObjectTypeId
|
|
1028
|
+
};
|
|
853
1029
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_FORM_OPTIONS, params, queryParams: payload?.params });
|
|
854
|
-
return
|
|
1030
|
+
return HttpClient.get(apiUrl);
|
|
855
1031
|
},
|
|
856
1032
|
create: (props = null) => {
|
|
1033
|
+
const { getParamDetails: getParamDetailsForCreate } = routeParam;
|
|
1034
|
+
const { paramsObject } = getParamDetailsForCreate({ type: props?.componentName });
|
|
1035
|
+
const cardParentMerge = props?.componentName === "association" ? true : false;
|
|
1036
|
+
const body = mergeRecordWriteBody(props?.payload, paramsObject, {
|
|
1037
|
+
cardParentMerge,
|
|
1038
|
+
addAnother: props?.params?.addAnother
|
|
1039
|
+
});
|
|
857
1040
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId };
|
|
858
|
-
const
|
|
859
|
-
|
|
860
|
-
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_CREATE, params, queryParams });
|
|
861
|
-
return AuthHttpClient.post(apiUrl, payload);
|
|
1041
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.RECORDS_CREATE, params });
|
|
1042
|
+
return HttpClient.post(apiUrl, body);
|
|
862
1043
|
},
|
|
863
1044
|
createExisting: (props = null) => {
|
|
864
|
-
const
|
|
865
|
-
const
|
|
1045
|
+
const { getLinkParams } = useUpdateLink();
|
|
1046
|
+
const fParams = getLinkParams();
|
|
1047
|
+
const queryParams = { ...fParams, ...props?.params };
|
|
1048
|
+
const params = {
|
|
1049
|
+
fromObjectTypeId: props?.fromObjectTypeId ?? props?.hubspotObjectTypeId,
|
|
1050
|
+
fromRecordId: props?.fromRecordId,
|
|
1051
|
+
toObjectTypeId: props?.toObjectTypeId
|
|
1052
|
+
};
|
|
866
1053
|
const payload = props.payload;
|
|
867
|
-
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.
|
|
868
|
-
return
|
|
1054
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.RECORDS_ASSOCIATE, params, queryParams });
|
|
1055
|
+
return HttpClient.post(apiUrl, payload);
|
|
869
1056
|
},
|
|
870
1057
|
removeExisting: (props = null) => {
|
|
871
|
-
const
|
|
872
|
-
const
|
|
873
|
-
const
|
|
874
|
-
const
|
|
875
|
-
|
|
1058
|
+
const { getParamDetails: getParamDetailsForRemove } = routeParam;
|
|
1059
|
+
const { paramsObject } = getParamDetailsForRemove({ type: props?.componentName });
|
|
1060
|
+
const body = mergeRecordWriteBody(props?.payload, paramsObject, void 0);
|
|
1061
|
+
const params = {
|
|
1062
|
+
fromObjectTypeId: props?.fromObjectTypeId ?? props?.hubspotObjectTypeId,
|
|
1063
|
+
fromRecordId: props?.fromRecordId,
|
|
1064
|
+
toObjectTypeId: props?.toObjectTypeId
|
|
1065
|
+
};
|
|
1066
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.RECORDS_DISASSOCIATE, params });
|
|
1067
|
+
return HttpClient.delete(apiUrl, { data: body });
|
|
876
1068
|
},
|
|
877
1069
|
details: (props = null) => {
|
|
878
1070
|
const { paramsObject: urlParam, parentAccessLabel } = getParamDetails("", true);
|
|
879
|
-
const portalId = config.devPortalId;
|
|
880
1071
|
const params = {
|
|
881
|
-
hubId: config.hubId,
|
|
882
|
-
portalId,
|
|
1072
|
+
// hubId: config.hubId,
|
|
1073
|
+
// portalId: portalId,
|
|
883
1074
|
objectId: props?.params?.objectId,
|
|
884
1075
|
id: props?.params?.id
|
|
885
1076
|
};
|
|
@@ -889,52 +1080,56 @@ var Client = {
|
|
|
889
1080
|
...urlParam
|
|
890
1081
|
};
|
|
891
1082
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_DETAILS, params, queryParams });
|
|
892
|
-
return
|
|
1083
|
+
return HttpClient.get(apiUrl);
|
|
893
1084
|
},
|
|
894
1085
|
update: (props = null) => {
|
|
895
|
-
const portalId = getPortal()?.portalId;
|
|
896
1086
|
const params = {
|
|
897
|
-
hubId: config.hubId,
|
|
898
|
-
portalId,
|
|
899
1087
|
objectId: props?.params?.objectId,
|
|
900
1088
|
id: props?.params?.id
|
|
901
1089
|
};
|
|
902
|
-
const {
|
|
903
|
-
const
|
|
904
|
-
|
|
1090
|
+
const { getParamDetails: getParamDetailsForUpdate } = routeParam;
|
|
1091
|
+
const { paramsObject } = getParamDetailsForUpdate({ type: props?.componentName });
|
|
1092
|
+
const cardParentMerge = props?.componentName === "association" ? true : false;
|
|
1093
|
+
const rawPayload = props?.payload || {};
|
|
1094
|
+
const properties = rawPayload.properties ?? rawPayload.propertyPayload ?? rawPayload;
|
|
1095
|
+
const body = mergeRecordWriteBody(
|
|
1096
|
+
{ properties },
|
|
1097
|
+
paramsObject,
|
|
1098
|
+
{ cardParentMerge }
|
|
1099
|
+
);
|
|
1100
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.RECORDS_UPDATE, params });
|
|
1101
|
+
return HttpClient.put(apiUrl, body);
|
|
905
1102
|
}
|
|
906
1103
|
},
|
|
907
1104
|
note: {
|
|
908
1105
|
list: (props = null) => {
|
|
909
|
-
const portalId = getPortal()?.portalId;
|
|
910
1106
|
const params = {
|
|
911
|
-
hubId: config.hubId,
|
|
912
|
-
portalId,
|
|
1107
|
+
// hubId: config.hubId,
|
|
1108
|
+
// portalId: portalId,
|
|
913
1109
|
objectId: props?.params?.objectId,
|
|
914
1110
|
id: props?.params?.id
|
|
915
1111
|
};
|
|
916
1112
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES, params, queryParams: props?.queryParams });
|
|
917
|
-
return
|
|
1113
|
+
return HttpClient.get(apiUrl);
|
|
918
1114
|
},
|
|
919
1115
|
create: (props = null) => {
|
|
920
1116
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
|
|
921
1117
|
const queryParams = props.queryParams;
|
|
922
1118
|
const payload = props.payload;
|
|
923
1119
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES_CREATE, params, queryParams });
|
|
924
|
-
return
|
|
1120
|
+
return HttpClient.post(apiUrl, payload);
|
|
925
1121
|
},
|
|
926
1122
|
update: (props = null) => {
|
|
927
|
-
const portalId = getPortal()?.portalId;
|
|
928
1123
|
const params = {
|
|
929
|
-
hubId: config.hubId,
|
|
930
|
-
portalId,
|
|
1124
|
+
// hubId: config.hubId,
|
|
1125
|
+
// portalId: portalId,
|
|
931
1126
|
objectId: props?.params?.objectId,
|
|
932
1127
|
id: props?.params?.id,
|
|
933
1128
|
note_id: props?.params?.note_id
|
|
934
1129
|
};
|
|
935
1130
|
const { paramsObject: queryParams } = getParamDetails();
|
|
936
1131
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES_DETAILS_UPDATE, params, queryParams });
|
|
937
|
-
return
|
|
1132
|
+
return HttpClient.put(apiUrl, props.payload);
|
|
938
1133
|
},
|
|
939
1134
|
image: (props = null) => {
|
|
940
1135
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
|
|
@@ -942,7 +1137,7 @@ var Client = {
|
|
|
942
1137
|
const payload = props.payload;
|
|
943
1138
|
const axiosConfig = props.config || {};
|
|
944
1139
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES_IMAGE_UPLOAD, params, queryParams });
|
|
945
|
-
return
|
|
1140
|
+
return HttpClient.post(apiUrl, payload, {
|
|
946
1141
|
headers: {
|
|
947
1142
|
"Content-Type": "multipart/form-data"
|
|
948
1143
|
},
|
|
@@ -955,7 +1150,7 @@ var Client = {
|
|
|
955
1150
|
const payload = props.payload;
|
|
956
1151
|
const axiosConfig = props.config || {};
|
|
957
1152
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES_ATTACHMENT_UPLOAD, params, queryParams });
|
|
958
|
-
return
|
|
1153
|
+
return HttpClient.post(apiUrl, payload, {
|
|
959
1154
|
headers: {
|
|
960
1155
|
"Content-Type": "multipart/form-data"
|
|
961
1156
|
},
|
|
@@ -965,35 +1160,33 @@ var Client = {
|
|
|
965
1160
|
},
|
|
966
1161
|
email: {
|
|
967
1162
|
list: (props = null) => {
|
|
968
|
-
const portalId = getPortal()?.portalId;
|
|
969
1163
|
const params = {
|
|
970
|
-
hubId: config.hubId,
|
|
971
|
-
portalId,
|
|
1164
|
+
// hubId: config.hubId,
|
|
1165
|
+
// portalId: portalId,
|
|
972
1166
|
objectId: props?.params?.objectId,
|
|
973
1167
|
id: props?.params?.id
|
|
974
1168
|
};
|
|
975
1169
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS, params, queryParams: props?.queryParams });
|
|
976
|
-
return
|
|
1170
|
+
return HttpClient.get(apiUrl);
|
|
977
1171
|
},
|
|
978
1172
|
create: (props = null) => {
|
|
979
1173
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
|
|
980
1174
|
const queryParams = props.queryParams;
|
|
981
1175
|
const payload = props.payload;
|
|
982
1176
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS_CREATE, params, queryParams });
|
|
983
|
-
return
|
|
1177
|
+
return HttpClient.post(apiUrl, payload);
|
|
984
1178
|
},
|
|
985
1179
|
update: (props = null) => {
|
|
986
|
-
const portalId = getPortal()?.portalId;
|
|
987
1180
|
const params = {
|
|
988
|
-
hubId: config.hubId,
|
|
989
|
-
portalId,
|
|
1181
|
+
// hubId: config.hubId,
|
|
1182
|
+
// portalId: portalId,
|
|
990
1183
|
objectId: props?.params?.objectId,
|
|
991
1184
|
id: props?.params?.id,
|
|
992
|
-
|
|
1185
|
+
email_id: props?.params?.email_id ?? props?.params?.note_id
|
|
993
1186
|
};
|
|
994
1187
|
const { paramsObject: queryParams } = getParamDetails();
|
|
995
1188
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS_DETAILS_UPDATE, params, queryParams });
|
|
996
|
-
return
|
|
1189
|
+
return HttpClient.put(apiUrl, props.payload);
|
|
997
1190
|
},
|
|
998
1191
|
image: (props = null) => {
|
|
999
1192
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
|
|
@@ -1001,7 +1194,7 @@ var Client = {
|
|
|
1001
1194
|
const payload = props.payload;
|
|
1002
1195
|
const axiosConfig = props.config || {};
|
|
1003
1196
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS_IMAGE_UPLOAD, params, queryParams });
|
|
1004
|
-
return
|
|
1197
|
+
return HttpClient.post(apiUrl, payload, {
|
|
1005
1198
|
headers: {
|
|
1006
1199
|
"Content-Type": "multipart/form-data"
|
|
1007
1200
|
},
|
|
@@ -1014,7 +1207,7 @@ var Client = {
|
|
|
1014
1207
|
const payload = props.payload;
|
|
1015
1208
|
const axiosConfig = props.config || {};
|
|
1016
1209
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS_ATTACHMENT_UPLOAD, params, queryParams });
|
|
1017
|
-
return
|
|
1210
|
+
return HttpClient.post(apiUrl, payload, {
|
|
1018
1211
|
headers: {
|
|
1019
1212
|
"Content-Type": "multipart/form-data"
|
|
1020
1213
|
},
|
|
@@ -1022,36 +1215,49 @@ var Client = {
|
|
|
1022
1215
|
});
|
|
1023
1216
|
}
|
|
1024
1217
|
},
|
|
1218
|
+
cache: {
|
|
1219
|
+
purge: (body, headers) => {
|
|
1220
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.CACHE_PURGE });
|
|
1221
|
+
return HttpClient.post(apiUrl, body, headers ? { headers } : void 0);
|
|
1222
|
+
},
|
|
1223
|
+
purgeStatus: (purgeJobId) => {
|
|
1224
|
+
const apiUrl = generateApiUrl({
|
|
1225
|
+
route: API_ENDPOINTS.CACHE_PURGE_STATUS,
|
|
1226
|
+
params: { purgeJobId }
|
|
1227
|
+
});
|
|
1228
|
+
return HttpClient.get(apiUrl);
|
|
1229
|
+
}
|
|
1230
|
+
},
|
|
1025
1231
|
file: {
|
|
1026
1232
|
list: (props = null) => {
|
|
1027
|
-
const portalId = getPortal()?.portalId;
|
|
1028
1233
|
const params = {
|
|
1029
|
-
hubId: config.hubId,
|
|
1030
|
-
portalId,
|
|
1234
|
+
// hubId: config.hubId,
|
|
1235
|
+
// portalId: portalId,
|
|
1031
1236
|
objectId: props?.params?.objectId,
|
|
1032
1237
|
id: props?.params?.id
|
|
1033
1238
|
};
|
|
1239
|
+
console.log("params_0", params);
|
|
1034
1240
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.FILES, params, queryParams: props?.queryParams });
|
|
1035
|
-
return
|
|
1241
|
+
return HttpClient.get(apiUrl);
|
|
1036
1242
|
},
|
|
1037
1243
|
details: (props = null) => {
|
|
1038
|
-
const portalId = getPortal()?.portalId;
|
|
1039
1244
|
const params = {
|
|
1040
|
-
hubId: config.hubId,
|
|
1041
|
-
portalId,
|
|
1245
|
+
// hubId: config.hubId,
|
|
1246
|
+
// portalId: portalId,
|
|
1042
1247
|
objectId: props?.params?.objectId,
|
|
1043
1248
|
id: props?.params?.id,
|
|
1044
1249
|
rowId: props?.params?.rowId
|
|
1045
1250
|
};
|
|
1251
|
+
console.log("params_1", params);
|
|
1046
1252
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.FILE, params, queryParams: props?.queryParams });
|
|
1047
|
-
return
|
|
1253
|
+
return HttpClient.get(apiUrl);
|
|
1048
1254
|
},
|
|
1049
1255
|
addFolder: (props = null) => {
|
|
1050
1256
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
|
|
1051
1257
|
const queryParams = props.queryParams;
|
|
1052
1258
|
const payload = props.payload;
|
|
1053
1259
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.FILES_CREATE_FOLDER, params, queryParams });
|
|
1054
|
-
return
|
|
1260
|
+
return HttpClient.post(apiUrl, payload);
|
|
1055
1261
|
},
|
|
1056
1262
|
addFile: (props = null) => {
|
|
1057
1263
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
|
|
@@ -1059,7 +1265,7 @@ var Client = {
|
|
|
1059
1265
|
const payload = props.payload;
|
|
1060
1266
|
const axiosConfig = props.config || {};
|
|
1061
1267
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.FILES_UPLOAD, params, queryParams });
|
|
1062
|
-
return
|
|
1268
|
+
return HttpClient.post(apiUrl, payload, {
|
|
1063
1269
|
headers: {
|
|
1064
1270
|
"Content-Type": "multipart/form-data"
|
|
1065
1271
|
},
|
|
@@ -1415,6 +1621,8 @@ var tableStore = createStore((set, get) => ({
|
|
|
1415
1621
|
selectedPipeline: "",
|
|
1416
1622
|
tableParam: {},
|
|
1417
1623
|
tableDefPermissions: {},
|
|
1624
|
+
tableData: [],
|
|
1625
|
+
tablePrependData: [],
|
|
1418
1626
|
// ==============================
|
|
1419
1627
|
// BASIC SETTERS
|
|
1420
1628
|
// ==============================
|
|
@@ -1519,12 +1727,12 @@ var tableStore = createStore((set, get) => ({
|
|
|
1519
1727
|
// ==============================
|
|
1520
1728
|
setGridData: async (type, deals) => {
|
|
1521
1729
|
if (type === "reset") {
|
|
1522
|
-
set({ gridData: [] });
|
|
1523
|
-
return;
|
|
1730
|
+
await set({ gridData: [] });
|
|
1731
|
+
return [];
|
|
1524
1732
|
}
|
|
1525
1733
|
if (type === "directly") {
|
|
1526
|
-
set({ gridData: deals });
|
|
1527
|
-
return;
|
|
1734
|
+
await set({ gridData: deals });
|
|
1735
|
+
return deals;
|
|
1528
1736
|
}
|
|
1529
1737
|
const finalData = await deals.map(
|
|
1530
1738
|
(deal) => {
|
|
@@ -1583,6 +1791,47 @@ var tableStore = createStore((set, get) => ({
|
|
|
1583
1791
|
}
|
|
1584
1792
|
set({ selectedPipeline: mFilterValue });
|
|
1585
1793
|
return mFilterValue;
|
|
1794
|
+
},
|
|
1795
|
+
setTableData: (response) => {
|
|
1796
|
+
set({
|
|
1797
|
+
tableData: response
|
|
1798
|
+
});
|
|
1799
|
+
},
|
|
1800
|
+
setTablePrependData: async (response) => {
|
|
1801
|
+
const state = get();
|
|
1802
|
+
let rows = [];
|
|
1803
|
+
if (response === "loading") {
|
|
1804
|
+
const row = await state.tableData?.data?.results?.columns.reduce((acc, item) => {
|
|
1805
|
+
if (!item.hidden) {
|
|
1806
|
+
acc[item.key] = "loading";
|
|
1807
|
+
}
|
|
1808
|
+
return acc;
|
|
1809
|
+
}, {});
|
|
1810
|
+
rows = [row, ...state.tablePrependData];
|
|
1811
|
+
} else {
|
|
1812
|
+
const data = response?.data;
|
|
1813
|
+
if (!data) {
|
|
1814
|
+
set({
|
|
1815
|
+
tablePrependData: []
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
const row = await Object.fromEntries(
|
|
1819
|
+
Object.entries(data).map(([key, value]) => [
|
|
1820
|
+
key,
|
|
1821
|
+
value?.value ?? value
|
|
1822
|
+
])
|
|
1823
|
+
);
|
|
1824
|
+
rows = [...state.tablePrependData];
|
|
1825
|
+
if (rows.length > 0) {
|
|
1826
|
+
rows[0] = row;
|
|
1827
|
+
} else {
|
|
1828
|
+
rows.push(row);
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
set({
|
|
1832
|
+
tablePrependData: rows
|
|
1833
|
+
});
|
|
1834
|
+
return rows;
|
|
1586
1835
|
}
|
|
1587
1836
|
}));
|
|
1588
1837
|
function useTable() {
|
|
@@ -1600,7 +1849,7 @@ function list(options) {
|
|
|
1600
1849
|
} = useTable();
|
|
1601
1850
|
const { mutate, isLoading } = createMutation(
|
|
1602
1851
|
async (payload) => {
|
|
1603
|
-
const param = getTableParam(payload?.companyAsMediator);
|
|
1852
|
+
const param = await getTableParam(payload?.companyAsMediator);
|
|
1604
1853
|
const response = await Client.pipeline.list(payload, param);
|
|
1605
1854
|
return response;
|
|
1606
1855
|
},
|
|
@@ -1629,15 +1878,98 @@ function list2(options) {
|
|
|
1629
1878
|
};
|
|
1630
1879
|
}
|
|
1631
1880
|
|
|
1881
|
+
// src/store2/store.ts
|
|
1882
|
+
function createStore2(initialState) {
|
|
1883
|
+
let state = initialState;
|
|
1884
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
1885
|
+
return {
|
|
1886
|
+
getState() {
|
|
1887
|
+
return state;
|
|
1888
|
+
},
|
|
1889
|
+
setState(partial) {
|
|
1890
|
+
state = {
|
|
1891
|
+
...state,
|
|
1892
|
+
...partial
|
|
1893
|
+
};
|
|
1894
|
+
listeners.forEach(
|
|
1895
|
+
(listener) => listener(state)
|
|
1896
|
+
);
|
|
1897
|
+
},
|
|
1898
|
+
subscribe(listener) {
|
|
1899
|
+
listeners.add(listener);
|
|
1900
|
+
return () => listeners.delete(listener);
|
|
1901
|
+
}
|
|
1902
|
+
};
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
// src/store2/use-table.ts
|
|
1906
|
+
var tableStore2 = createStore2({
|
|
1907
|
+
tableData: [],
|
|
1908
|
+
tablePrependData: []
|
|
1909
|
+
});
|
|
1910
|
+
var actions = {
|
|
1911
|
+
setTableData(response) {
|
|
1912
|
+
tableStore2.setState({
|
|
1913
|
+
tableData: response
|
|
1914
|
+
});
|
|
1915
|
+
},
|
|
1916
|
+
async setTablePrependData(response) {
|
|
1917
|
+
const state = tableStore2.getState();
|
|
1918
|
+
let rows = [];
|
|
1919
|
+
if (response === "loading") {
|
|
1920
|
+
const row = await state.tableData?.data?.results?.columns.reduce((acc, item) => {
|
|
1921
|
+
if (!item.hidden) {
|
|
1922
|
+
acc[item.key] = "loading";
|
|
1923
|
+
}
|
|
1924
|
+
return acc;
|
|
1925
|
+
}, {});
|
|
1926
|
+
rows = [row, ...state.tablePrependData];
|
|
1927
|
+
} else if (response?.data) {
|
|
1928
|
+
const data = response?.data;
|
|
1929
|
+
if (!data) {
|
|
1930
|
+
tableStore2.setState({
|
|
1931
|
+
tablePrependData: []
|
|
1932
|
+
});
|
|
1933
|
+
}
|
|
1934
|
+
const row = await Object.fromEntries(
|
|
1935
|
+
Object.entries(data).map(([key, value]) => [
|
|
1936
|
+
key,
|
|
1937
|
+
value?.value ?? value
|
|
1938
|
+
])
|
|
1939
|
+
);
|
|
1940
|
+
rows = [...state.tablePrependData];
|
|
1941
|
+
if (rows.length > 0) {
|
|
1942
|
+
rows[0] = row;
|
|
1943
|
+
} else {
|
|
1944
|
+
rows.push(row);
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
tableStore2.setState({
|
|
1948
|
+
tablePrependData: rows
|
|
1949
|
+
});
|
|
1950
|
+
}
|
|
1951
|
+
};
|
|
1952
|
+
function useTable2() {
|
|
1953
|
+
const tableState = tableStore2.getState();
|
|
1954
|
+
return {
|
|
1955
|
+
...tableState,
|
|
1956
|
+
...actions
|
|
1957
|
+
};
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1632
1960
|
// src/apis/object.ts
|
|
1633
1961
|
function list3(options) {
|
|
1634
1962
|
const {
|
|
1635
1963
|
getTableParam
|
|
1636
1964
|
} = useTable();
|
|
1965
|
+
const {
|
|
1966
|
+
setTableData
|
|
1967
|
+
} = useTable2();
|
|
1637
1968
|
const { mutate, isLoading } = createMutation(
|
|
1638
1969
|
async (payload) => {
|
|
1639
|
-
const param = getTableParam(payload?.companyAsMediator);
|
|
1970
|
+
const param = await getTableParam(payload?.companyAsMediator);
|
|
1640
1971
|
const response = await Client.object.list(payload, param);
|
|
1972
|
+
setTableData(response);
|
|
1641
1973
|
return response;
|
|
1642
1974
|
},
|
|
1643
1975
|
options
|
|
@@ -1648,6 +1980,20 @@ function list3(options) {
|
|
|
1648
1980
|
isLoading
|
|
1649
1981
|
};
|
|
1650
1982
|
}
|
|
1983
|
+
function sideBarList(options) {
|
|
1984
|
+
const { mutate, isLoading } = createMutation(
|
|
1985
|
+
async (payload) => {
|
|
1986
|
+
const response = await Client.object.sideBarList(payload);
|
|
1987
|
+
return response;
|
|
1988
|
+
},
|
|
1989
|
+
options
|
|
1990
|
+
);
|
|
1991
|
+
return {
|
|
1992
|
+
mutate,
|
|
1993
|
+
getSideBarObjects: mutate,
|
|
1994
|
+
isLoading
|
|
1995
|
+
};
|
|
1996
|
+
}
|
|
1651
1997
|
function form(options) {
|
|
1652
1998
|
const { mutate, isLoading } = createMutation(
|
|
1653
1999
|
async (payload) => {
|
|
@@ -1677,9 +2023,14 @@ function objectFormOptions(options) {
|
|
|
1677
2023
|
};
|
|
1678
2024
|
}
|
|
1679
2025
|
function create(options) {
|
|
2026
|
+
const {
|
|
2027
|
+
setTablePrependData
|
|
2028
|
+
} = useTable2();
|
|
1680
2029
|
const { mutate, isLoading } = createMutation(
|
|
1681
2030
|
async (props) => {
|
|
2031
|
+
await setTablePrependData("loading");
|
|
1682
2032
|
const response = await Client.object.create(props);
|
|
2033
|
+
await setTablePrependData(response);
|
|
1683
2034
|
return response;
|
|
1684
2035
|
},
|
|
1685
2036
|
options
|
|
@@ -1747,11 +2098,70 @@ function update(options) {
|
|
|
1747
2098
|
};
|
|
1748
2099
|
}
|
|
1749
2100
|
|
|
2101
|
+
// src/store2/use-note.ts
|
|
2102
|
+
var noteStore = createStore2({
|
|
2103
|
+
notes: [],
|
|
2104
|
+
prependNotes: []
|
|
2105
|
+
});
|
|
2106
|
+
var actions2 = {
|
|
2107
|
+
setNotes(response) {
|
|
2108
|
+
noteStore.setState({
|
|
2109
|
+
notes: response
|
|
2110
|
+
});
|
|
2111
|
+
},
|
|
2112
|
+
async setPrependNote(response) {
|
|
2113
|
+
const state = noteStore.getState();
|
|
2114
|
+
let rows = [];
|
|
2115
|
+
if (response === "loading") {
|
|
2116
|
+
const row = await state.notes?.data?.results?.columns.reduce((acc, item) => {
|
|
2117
|
+
if (!item.hidden) {
|
|
2118
|
+
acc[item.key] = "loading";
|
|
2119
|
+
}
|
|
2120
|
+
return acc;
|
|
2121
|
+
}, {});
|
|
2122
|
+
rows = [row, ...state.prependNotes];
|
|
2123
|
+
} else if (response?.data) {
|
|
2124
|
+
const data = response?.data;
|
|
2125
|
+
if (!data) {
|
|
2126
|
+
noteStore.setState({
|
|
2127
|
+
prependNotes: []
|
|
2128
|
+
});
|
|
2129
|
+
}
|
|
2130
|
+
const row = await Object.fromEntries(
|
|
2131
|
+
Object.entries(data).map(([key, value]) => [
|
|
2132
|
+
key,
|
|
2133
|
+
value?.value ?? value
|
|
2134
|
+
])
|
|
2135
|
+
);
|
|
2136
|
+
rows = [...state.prependNotes];
|
|
2137
|
+
if (rows.length > 0) {
|
|
2138
|
+
rows[0] = row;
|
|
2139
|
+
} else {
|
|
2140
|
+
rows.push(row);
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
noteStore.setState({
|
|
2144
|
+
prependNotes: rows
|
|
2145
|
+
});
|
|
2146
|
+
}
|
|
2147
|
+
};
|
|
2148
|
+
function useNote() {
|
|
2149
|
+
const noteState = noteStore.getState();
|
|
2150
|
+
return {
|
|
2151
|
+
...noteState,
|
|
2152
|
+
...actions2
|
|
2153
|
+
};
|
|
2154
|
+
}
|
|
2155
|
+
|
|
1750
2156
|
// src/apis/note.ts
|
|
1751
2157
|
function list4(options) {
|
|
2158
|
+
const {
|
|
2159
|
+
setNotes
|
|
2160
|
+
} = useNote();
|
|
1752
2161
|
const { mutate, isLoading } = createMutation(
|
|
1753
2162
|
async (payload) => {
|
|
1754
2163
|
const response = await Client.note.list(payload);
|
|
2164
|
+
setNotes(response);
|
|
1755
2165
|
return response;
|
|
1756
2166
|
},
|
|
1757
2167
|
options
|
|
@@ -1763,9 +2173,14 @@ function list4(options) {
|
|
|
1763
2173
|
};
|
|
1764
2174
|
}
|
|
1765
2175
|
function create2(options) {
|
|
2176
|
+
const {
|
|
2177
|
+
setPrependNote
|
|
2178
|
+
} = useNote();
|
|
1766
2179
|
const { mutate, isLoading } = createMutation(
|
|
1767
2180
|
async (props) => {
|
|
2181
|
+
await setPrependNote("loading");
|
|
1768
2182
|
const response = await Client.note.create(props);
|
|
2183
|
+
await setPrependNote(response);
|
|
1769
2184
|
return response;
|
|
1770
2185
|
},
|
|
1771
2186
|
options
|
|
@@ -1791,11 +2206,70 @@ function update2(options) {
|
|
|
1791
2206
|
};
|
|
1792
2207
|
}
|
|
1793
2208
|
|
|
2209
|
+
// src/store2/use-email.ts
|
|
2210
|
+
var emailStore = createStore2({
|
|
2211
|
+
emails: [],
|
|
2212
|
+
prependEmails: []
|
|
2213
|
+
});
|
|
2214
|
+
var actions3 = {
|
|
2215
|
+
setEmails(response) {
|
|
2216
|
+
emailStore.setState({
|
|
2217
|
+
emails: response
|
|
2218
|
+
});
|
|
2219
|
+
},
|
|
2220
|
+
async setPrependEmail(response) {
|
|
2221
|
+
const state = emailStore.getState();
|
|
2222
|
+
let rows = [];
|
|
2223
|
+
if (response === "loading") {
|
|
2224
|
+
const row = await state.emails?.data?.results?.columns.reduce((acc, item) => {
|
|
2225
|
+
if (!item.hidden) {
|
|
2226
|
+
acc[item.key] = "loading";
|
|
2227
|
+
}
|
|
2228
|
+
return acc;
|
|
2229
|
+
}, {});
|
|
2230
|
+
rows = [row, ...state.prependEmails];
|
|
2231
|
+
} else if (response?.data) {
|
|
2232
|
+
const data = response?.data;
|
|
2233
|
+
if (!data) {
|
|
2234
|
+
emailStore.setState({
|
|
2235
|
+
prependEmails: []
|
|
2236
|
+
});
|
|
2237
|
+
}
|
|
2238
|
+
const row = await Object.fromEntries(
|
|
2239
|
+
Object.entries(data).map(([key, value]) => [
|
|
2240
|
+
key,
|
|
2241
|
+
value?.value ?? value
|
|
2242
|
+
])
|
|
2243
|
+
);
|
|
2244
|
+
rows = [...state.prependEmails];
|
|
2245
|
+
if (rows.length > 0) {
|
|
2246
|
+
rows[0] = row;
|
|
2247
|
+
} else {
|
|
2248
|
+
rows.push(row);
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
emailStore.setState({
|
|
2252
|
+
prependEmails: rows
|
|
2253
|
+
});
|
|
2254
|
+
}
|
|
2255
|
+
};
|
|
2256
|
+
function useEmail() {
|
|
2257
|
+
const emailState = emailStore.getState();
|
|
2258
|
+
return {
|
|
2259
|
+
...emailState,
|
|
2260
|
+
...actions3
|
|
2261
|
+
};
|
|
2262
|
+
}
|
|
2263
|
+
|
|
1794
2264
|
// src/apis/email.ts
|
|
1795
2265
|
function list5(options) {
|
|
2266
|
+
const {
|
|
2267
|
+
setEmails
|
|
2268
|
+
} = useEmail();
|
|
1796
2269
|
const { mutate, isLoading } = createMutation(
|
|
1797
2270
|
async (payload) => {
|
|
1798
2271
|
const response = await Client.email.list(payload);
|
|
2272
|
+
setEmails(response);
|
|
1799
2273
|
return response;
|
|
1800
2274
|
},
|
|
1801
2275
|
options
|
|
@@ -1807,9 +2281,14 @@ function list5(options) {
|
|
|
1807
2281
|
};
|
|
1808
2282
|
}
|
|
1809
2283
|
function create3(options) {
|
|
2284
|
+
const {
|
|
2285
|
+
setPrependEmail
|
|
2286
|
+
} = useEmail();
|
|
1810
2287
|
const { mutate, isLoading } = createMutation(
|
|
1811
2288
|
async (props) => {
|
|
2289
|
+
await setPrependEmail("loading");
|
|
1812
2290
|
const response = await Client.email.create(props);
|
|
2291
|
+
await setPrependEmail(response);
|
|
1813
2292
|
return response;
|
|
1814
2293
|
},
|
|
1815
2294
|
options
|
|
@@ -1839,7 +2318,6 @@ function update3(options) {
|
|
|
1839
2318
|
function imageUpload(options) {
|
|
1840
2319
|
const { mutate, isLoading } = createMutation(
|
|
1841
2320
|
async (payload) => {
|
|
1842
|
-
console.log("payload", payload);
|
|
1843
2321
|
const response = payload?.type === "email" ? await Client.email.image(payload) : await Client.note.image(payload);
|
|
1844
2322
|
return response;
|
|
1845
2323
|
},
|
|
@@ -1924,6 +2402,32 @@ function addFile(options) {
|
|
|
1924
2402
|
};
|
|
1925
2403
|
}
|
|
1926
2404
|
|
|
2405
|
+
// src/apis/cache.ts
|
|
2406
|
+
function purge(options) {
|
|
2407
|
+
const { mutate, isLoading } = createMutation(
|
|
2408
|
+
async (payload) => {
|
|
2409
|
+
const safePayload = payload ?? {};
|
|
2410
|
+
const idempotencyKey = typeof safePayload.idempotencyKey === "string" ? safePayload.idempotencyKey : void 0;
|
|
2411
|
+
const headers = idempotencyKey ? { "Idempotency-Key": idempotencyKey } : void 0;
|
|
2412
|
+
const { idempotencyKey: _ignored, ...body } = safePayload;
|
|
2413
|
+
return Client.cache.purge(body, headers);
|
|
2414
|
+
},
|
|
2415
|
+
options
|
|
2416
|
+
);
|
|
2417
|
+
return { mutate, purgeCache: mutate, isLoading };
|
|
2418
|
+
}
|
|
2419
|
+
function purgeStatus(purgeJobId, options) {
|
|
2420
|
+
const { mutate, isLoading } = createMutation(
|
|
2421
|
+
async (jobId) => Client.cache.purgeStatus(jobId ?? purgeJobId),
|
|
2422
|
+
options
|
|
2423
|
+
);
|
|
2424
|
+
return {
|
|
2425
|
+
mutate,
|
|
2426
|
+
getPurgeStatus: () => mutate(purgeJobId),
|
|
2427
|
+
isLoading
|
|
2428
|
+
};
|
|
2429
|
+
}
|
|
2430
|
+
|
|
1927
2431
|
// src/index.ts
|
|
1928
2432
|
init_auth_utils();
|
|
1929
2433
|
init_token_store();
|
|
@@ -2156,6 +2660,7 @@ var api = {
|
|
|
2156
2660
|
pipelines: list,
|
|
2157
2661
|
stages: list2,
|
|
2158
2662
|
objects: list3,
|
|
2663
|
+
sideBarObjects: sideBarList,
|
|
2159
2664
|
objectsForm: form,
|
|
2160
2665
|
createObject: create,
|
|
2161
2666
|
createExistingObject: createExisting,
|
|
@@ -2175,6 +2680,8 @@ var api = {
|
|
|
2175
2680
|
file: details2,
|
|
2176
2681
|
addFolder,
|
|
2177
2682
|
addFile,
|
|
2683
|
+
purgeCache: purge,
|
|
2684
|
+
cachePurgeStatus: purgeStatus,
|
|
2178
2685
|
getRefreshToken,
|
|
2179
2686
|
getAuthRefreshToken,
|
|
2180
2687
|
isCookieExpired,
|
|
@@ -2200,6 +2707,6 @@ var routeParam = {
|
|
|
2200
2707
|
getParamDetails
|
|
2201
2708
|
};
|
|
2202
2709
|
|
|
2203
|
-
export { api, breadcrumbsDetails, getFieldErrors, getFormErrors, initializeHttpClient, routeParam, store, url };
|
|
2710
|
+
export { api, breadcrumbsDetails, client_exports as clint, getFieldErrors, getFormErrors, initializeHttpClient, routeParam, store, url };
|
|
2204
2711
|
//# sourceMappingURL=index.js.map
|
|
2205
2712
|
//# sourceMappingURL=index.js.map
|