woodsportal-client-sdk 1.1.4-dev.2 → 1.1.4-dev.21
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/README.md +47 -1
- package/dist/adapters/angular/index.d.ts +22 -0
- package/dist/adapters/angular/index.js +34 -0
- package/dist/adapters/angular/index.js.map +1 -0
- package/dist/adapters/react/index.d.ts +22 -0
- package/dist/adapters/react/index.js +18 -0
- package/dist/adapters/react/index.js.map +1 -0
- package/dist/adapters/vue/index.d.ts +22 -0
- package/dist/adapters/vue/index.js +25 -0
- package/dist/adapters/vue/index.js.map +1 -0
- package/dist/auth-utils-5SMVN55N.js +4 -0
- package/dist/auth-utils-5SMVN55N.js.map +1 -0
- package/dist/chunk-FLAVLYA3.js +171 -0
- package/dist/chunk-FLAVLYA3.js.map +1 -0
- package/dist/chunk-FLWPTIGZ.js +126 -0
- package/dist/chunk-FLWPTIGZ.js.map +1 -0
- package/dist/chunk-LEUQDA4M.js +54 -0
- package/dist/chunk-LEUQDA4M.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +9 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-Y5MRAAGK.js +10 -0
- package/dist/chunk-Y5MRAAGK.js.map +1 -0
- package/dist/index.d.ts +95 -3
- package/dist/index.js +399 -273
- package/dist/index.js.map +1 -1
- package/dist/use-sync-Bk2Gp5Ws.d.ts +23 -0
- package/package.json +44 -8
package/dist/index.js
CHANGED
|
@@ -1,152 +1,56 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { actions, actions2, actions3 } from './chunk-FLAVLYA3.js';
|
|
2
|
+
import { ensureValidRefresh, HUBSPOT_DATA, PORTAL_ID, DEV_PORTAL_ID, HUB_ID, setRefreshCallback, getAccessToken, setRefreshToken, setAccessToken, isAuthenticateApp, isExpiresAccessToken, isCookieExpired, getRefreshToken, DEV_API_URL, setPortal, setSubscriptionType, setLoggedInDetails, clearAccessToken, removeAllCookie, getCookie } from './chunk-FLWPTIGZ.js';
|
|
3
|
+
import { __export } from './chunk-PZ5AY32C.js';
|
|
2
4
|
import axios from 'axios';
|
|
3
5
|
import pako from 'pako';
|
|
4
6
|
import { Base64 } from 'js-base64';
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
// src/utils/constants.ts
|
|
12
|
-
var LOGIN_DETAILS, REFRESH_TOKEN, PORTAL, SUBSCRIPTION_TYPE, HUBSPOT_DATA, HUB_ID, DEV_PORTAL_ID;
|
|
13
|
-
var init_constants = __esm({
|
|
14
|
-
"src/utils/constants.ts"() {
|
|
15
|
-
LOGIN_DETAILS = "loginDetails";
|
|
16
|
-
REFRESH_TOKEN = "refreshToken";
|
|
17
|
-
PORTAL = "portal";
|
|
18
|
-
SUBSCRIPTION_TYPE = "ssubscriptionType";
|
|
19
|
-
HUBSPOT_DATA = "hubSpotData";
|
|
20
|
-
HUB_ID = "hubId";
|
|
21
|
-
DEV_PORTAL_ID = "devPortalId";
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
var setCookie, getCookie, removeAllCookie, isCookieExpired;
|
|
25
|
-
var init_cookie = __esm({
|
|
26
|
-
"src/utils/cookie.ts"() {
|
|
27
|
-
setCookie = (key, value, expire) => {
|
|
28
|
-
return Cookies.set(key, value, {
|
|
29
|
-
expires: expire,
|
|
30
|
-
sameSite: "none",
|
|
31
|
-
secure: true
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
getCookie = (key) => {
|
|
35
|
-
return Cookies.get(key);
|
|
36
|
-
};
|
|
37
|
-
removeAllCookie = () => {
|
|
38
|
-
Object.keys(Cookies.get()).forEach((cookieName) => {
|
|
39
|
-
Cookies.remove(cookieName);
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
isCookieExpired = (key) => {
|
|
43
|
-
const value = Cookies.get(key);
|
|
44
|
-
try {
|
|
45
|
-
const { expiresAt } = JSON.parse(value);
|
|
46
|
-
return Date.now() > expiresAt ? true : false;
|
|
47
|
-
} catch {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
}
|
|
8
|
+
// src/client/index.ts
|
|
9
|
+
var client_exports = {};
|
|
10
|
+
__export(client_exports, {
|
|
11
|
+
Client: () => Client
|
|
52
12
|
});
|
|
53
13
|
|
|
54
|
-
// src/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
14
|
+
// src/utils/localStoraget.ts
|
|
15
|
+
var memory = /* @__PURE__ */ new Map();
|
|
16
|
+
var memoryStore = {
|
|
17
|
+
getItem(key) {
|
|
18
|
+
return memory.has(key) ? memory.get(key) : null;
|
|
19
|
+
},
|
|
20
|
+
setItem(key, value) {
|
|
21
|
+
memory.set(key, value);
|
|
22
|
+
},
|
|
23
|
+
removeItem(key) {
|
|
24
|
+
memory.delete(key);
|
|
64
25
|
}
|
|
65
|
-
}
|
|
66
|
-
function
|
|
67
|
-
|
|
68
|
-
|
|
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;
|
|
26
|
+
};
|
|
27
|
+
function resolveStore() {
|
|
28
|
+
if (typeof globalThis === "undefined") {
|
|
29
|
+
return memoryStore;
|
|
77
30
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
var init_token_store = __esm({
|
|
82
|
-
"src/clint/token-store.ts"() {
|
|
83
|
-
init_cookie();
|
|
84
|
-
init_constants();
|
|
85
|
-
accessToken = null;
|
|
86
|
-
tokenExpiresAt = null;
|
|
31
|
+
const ls = globalThis.localStorage;
|
|
32
|
+
if (!ls || typeof ls.getItem !== "function") {
|
|
33
|
+
return memoryStore;
|
|
87
34
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
function setAccessToken(token, expiresIn) {
|
|
98
|
-
return new Promise((resolve) => {
|
|
99
|
-
storAccessToken(token, expiresIn);
|
|
100
|
-
resolve();
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
function getRefreshToken() {
|
|
104
|
-
return JSON.parse(getCookie(REFRESH_TOKEN || null) || null);
|
|
105
|
-
}
|
|
106
|
-
function getPortal() {
|
|
107
|
-
return JSON.parse(getCookie(PORTAL || null) || null);
|
|
108
|
-
}
|
|
109
|
-
var setLoggedInDetails, setPortal, setSubscriptionType;
|
|
110
|
-
var init_auth_utils = __esm({
|
|
111
|
-
"src/clint/auth-utils.ts"() {
|
|
112
|
-
init_constants();
|
|
113
|
-
init_cookie();
|
|
114
|
-
init_token_store();
|
|
115
|
-
setLoggedInDetails = async (data) => {
|
|
116
|
-
return new Promise((resolve) => {
|
|
117
|
-
setCookie(LOGIN_DETAILS, JSON.stringify(data));
|
|
118
|
-
resolve();
|
|
119
|
-
});
|
|
120
|
-
};
|
|
121
|
-
setPortal = async (data) => {
|
|
122
|
-
return new Promise((resolve) => {
|
|
123
|
-
setCookie(PORTAL, JSON.stringify(data));
|
|
124
|
-
resolve();
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
|
-
setSubscriptionType = async (data) => {
|
|
128
|
-
return new Promise((resolve) => {
|
|
129
|
-
setCookie(SUBSCRIPTION_TYPE, JSON.stringify(data));
|
|
130
|
-
resolve();
|
|
131
|
-
});
|
|
132
|
-
};
|
|
35
|
+
try {
|
|
36
|
+
const probeKey = "__woodsportal_client_sdk_ls_probe__";
|
|
37
|
+
ls.setItem(probeKey, "1");
|
|
38
|
+
ls.removeItem(probeKey);
|
|
39
|
+
return ls;
|
|
40
|
+
} catch {
|
|
41
|
+
return memoryStore;
|
|
133
42
|
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// src/utils/config.ts
|
|
137
|
-
init_constants();
|
|
138
|
-
|
|
139
|
-
// src/utils/localStoraget.ts
|
|
43
|
+
}
|
|
140
44
|
var storage = {
|
|
141
45
|
set: (key, value) => {
|
|
142
|
-
|
|
46
|
+
resolveStore().setItem(key, JSON.stringify(value));
|
|
143
47
|
},
|
|
144
48
|
get: (key) => {
|
|
145
|
-
const item =
|
|
49
|
+
const item = resolveStore().getItem(key);
|
|
146
50
|
return item ? JSON.parse(item) : null;
|
|
147
51
|
},
|
|
148
52
|
remove: (key) => {
|
|
149
|
-
|
|
53
|
+
resolveStore().removeItem(key);
|
|
150
54
|
}
|
|
151
55
|
};
|
|
152
56
|
|
|
@@ -159,15 +63,22 @@ var config = {
|
|
|
159
63
|
get devPortalId() {
|
|
160
64
|
const hubSpotData = storage.get(HUBSPOT_DATA);
|
|
161
65
|
return hubSpotData?.[DEV_PORTAL_ID] || "";
|
|
66
|
+
},
|
|
67
|
+
get portalId() {
|
|
68
|
+
const hubSpotData = storage.get(HUBSPOT_DATA);
|
|
69
|
+
return hubSpotData?.[PORTAL_ID] || "";
|
|
70
|
+
},
|
|
71
|
+
get devApiUrl() {
|
|
72
|
+
const hubSpotData = storage.get(HUBSPOT_DATA);
|
|
73
|
+
return hubSpotData?.[DEV_API_URL] || "";
|
|
162
74
|
}
|
|
163
75
|
};
|
|
164
76
|
var setConfig = {
|
|
165
77
|
setDevPortalId(portalId) {
|
|
166
78
|
const existing = storage.get(HUBSPOT_DATA) || {};
|
|
167
|
-
console.log("portalId", portalId);
|
|
168
79
|
storage.set(HUBSPOT_DATA, {
|
|
169
80
|
...existing,
|
|
170
|
-
[
|
|
81
|
+
[PORTAL_ID]: portalId
|
|
171
82
|
});
|
|
172
83
|
}
|
|
173
84
|
};
|
|
@@ -180,7 +91,7 @@ var generateApiUrl = ({
|
|
|
180
91
|
}) => {
|
|
181
92
|
const defaultParams = {
|
|
182
93
|
hubId: config.hubId,
|
|
183
|
-
portalId: config.
|
|
94
|
+
portalId: config.portalId
|
|
184
95
|
};
|
|
185
96
|
params = { ...defaultParams, ...params };
|
|
186
97
|
const url2 = replaceParams(route, params);
|
|
@@ -198,7 +109,7 @@ function replaceParams(template, values) {
|
|
|
198
109
|
);
|
|
199
110
|
}
|
|
200
111
|
|
|
201
|
-
// src/
|
|
112
|
+
// src/client/api-endpoints.ts
|
|
202
113
|
var API_ENDPOINTS = {
|
|
203
114
|
// Auth
|
|
204
115
|
PRE_LOGIN: "/api/auth/pre-login",
|
|
@@ -210,6 +121,7 @@ var API_ENDPOINTS = {
|
|
|
210
121
|
VERIFY_EMAIL: "/api/auth/verify-email",
|
|
211
122
|
REGISTER_EXISTING_USER: "/api/auth/existing-user-register",
|
|
212
123
|
RESEND_EMAIL: "/api/auth/resend-email",
|
|
124
|
+
VERIFY_EMAIL_RESEND: "/api/auth/verify-email/resend",
|
|
213
125
|
LOGOUT: "/api/auth/logout",
|
|
214
126
|
// SSO
|
|
215
127
|
SSO_DETAILS: "/api/auth/sso/active",
|
|
@@ -220,51 +132,64 @@ var API_ENDPOINTS = {
|
|
|
220
132
|
PROFILE: "/api/${hubId}/${portalId}/profiles",
|
|
221
133
|
CHANGE_PASSWORD: "/api/auth/change-password",
|
|
222
134
|
// Pipeline
|
|
223
|
-
PIPELINES: "api/${hubId}/${portalId}/hubspot-object-pipelines/${hubspotObjectTypeId}",
|
|
135
|
+
PIPELINES: "/api/${hubId}/${portalId}/hubspot-object-pipelines/${hubspotObjectTypeId}",
|
|
224
136
|
// 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
|
-
|
|
137
|
+
STAGES: "/api/${hubId}/${portalId}/hubspot-object-pipelines/${objectTypeId}/${pipelineId}/stages",
|
|
138
|
+
// Cache purge (replaces cache=false refresh; requires features.cache-purge-api-enabled on API)
|
|
139
|
+
CACHE_PURGE: "/api/${hubId}/${portalId}/cache-purge-jobs",
|
|
140
|
+
CACHE_PURGE_STATUS: "/api/${hubId}/${portalId}/cache-purge-jobs/${purgeJobId}",
|
|
141
|
+
/** @deprecated Use CACHE_PURGE */
|
|
142
|
+
CACHE_PURGE_LEGACY: "/api/${hubId}/${portalId}/cache/purge",
|
|
143
|
+
/** @deprecated Use CACHE_PURGE_STATUS */
|
|
144
|
+
CACHE_PURGE_STATUS_LEGACY: "/api/${hubId}/${portalId}/cache/purge/${purgeJobId}",
|
|
145
|
+
// Object (read on hubspot-object-data; form layout on hubspot-object-forms)
|
|
146
|
+
OBJECTS: "/api/${hubId}/${portalId}/hubspot-object-data/${hubspotObjectTypeId}/records",
|
|
147
|
+
OBJECTS_FORM: "/api/${hubId}/${portalId}/hubspot-object-forms/${hubspotObjectTypeId}/fields",
|
|
148
|
+
OBJECTS_FORM_OPTIONS: "/api/${hubId}/${portalId}/hubspot-object-forms/${formId}/${objectTypeId}",
|
|
149
|
+
RECORDS_CREATE: "/api/${hubId}/${portalId}/hubspot-object-data/${hubspotObjectTypeId}/records",
|
|
150
|
+
RECORDS_UPDATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}",
|
|
151
|
+
RECORDS_ASSOCIATE: "/api/${hubId}/${portalId}/hubspot-object-data/${fromObjectTypeId}/records/${fromRecordId}/associations/${toObjectTypeId}",
|
|
152
|
+
RECORDS_DISASSOCIATE: "/api/${hubId}/${portalId}/hubspot-object-data/${fromObjectTypeId}/records/${fromRecordId}/associations/${toObjectTypeId}",
|
|
153
|
+
/** @deprecated Use RECORDS_CREATE */
|
|
154
|
+
OBJECTS_CREATE: "/api/${hubId}/${portalId}/hubspot-object-forms/${hubspotObjectTypeId}/fields",
|
|
155
|
+
/** @deprecated Use RECORDS_ASSOCIATE */
|
|
156
|
+
OBJECTS_CREATE_EXISTING: "/api/${hubId}/${portalId}/hubspot-object-forms/:fromObjectTypeId/:fromRecordId/associations/:toObjectTypeId",
|
|
157
|
+
OBJECTS_DETAILS: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}",
|
|
158
|
+
/** @deprecated Use RECORDS_UPDATE */
|
|
159
|
+
OBJECTS_DETAILS_UPDATE: "/api/${hubId}/${portalId}/hubspot-object-forms/${objectId}/records/${id}",
|
|
160
|
+
OBJECTS_DETAILS_UPDATE_LEGACY: "/api/${hubId}/${portalId}/hubspot-object-forms/${objectId}/properties/${id}",
|
|
161
|
+
// Notes (nested under CRM record)
|
|
162
|
+
NOTES: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/notes",
|
|
163
|
+
NOTES_CREATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/notes",
|
|
164
|
+
NOTES_DETAILS_UPDATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/notes/${note_id}",
|
|
165
|
+
NOTES_IMAGE_UPLOAD: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/notes/images",
|
|
166
|
+
NOTES_ATTACHMENT_UPLOAD: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/notes/attachments",
|
|
167
|
+
NOTES_ATTACHMENT_UPDATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/notes/attachments/${note_id}",
|
|
168
|
+
// Email (nested under CRM record)
|
|
169
|
+
EMAILS: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/emails",
|
|
170
|
+
EMAILS_CREATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/emails",
|
|
171
|
+
EMAILS_DETAILS_UPDATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/emails/${email_id}",
|
|
172
|
+
EMAILS_IMAGE_UPLOAD: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/emails/images",
|
|
173
|
+
EMAILS_ATTACHMENT_UPLOAD: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/emails/attachments",
|
|
174
|
+
EMAILS_ATTACHMENT_UPDATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/emails/attachments/${email_id}",
|
|
175
|
+
// File manager (nested under CRM record)
|
|
176
|
+
FILES: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/files",
|
|
177
|
+
FILE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/files/${rowId}",
|
|
178
|
+
FILES_CREATE_FOLDER: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/folders",
|
|
179
|
+
FILES_UPLOAD: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/files"
|
|
253
180
|
};
|
|
254
|
-
init_token_store();
|
|
255
181
|
|
|
256
|
-
// src/
|
|
182
|
+
// src/client/config.ts
|
|
257
183
|
var config2 = {
|
|
258
184
|
baseURL: "https://api.dev.woodsportal.com"
|
|
259
185
|
};
|
|
260
186
|
|
|
261
|
-
// src/
|
|
262
|
-
init_auth_utils();
|
|
187
|
+
// src/client/http-clint.ts
|
|
263
188
|
var axiosInstance = null;
|
|
264
189
|
var config3 = {};
|
|
265
190
|
function initializeHttpClient(clientConfig) {
|
|
266
191
|
config3 = clientConfig;
|
|
267
|
-
const baseURL =
|
|
192
|
+
const baseURL = config?.devApiUrl || config3.baseURL;
|
|
268
193
|
const timeout = config3.timeout ?? 5e4;
|
|
269
194
|
axiosInstance = axios.create({
|
|
270
195
|
baseURL,
|
|
@@ -274,6 +199,7 @@ function initializeHttpClient(clientConfig) {
|
|
|
274
199
|
...config3.headers
|
|
275
200
|
}
|
|
276
201
|
});
|
|
202
|
+
setRefreshCallback(getAuthRefreshToken);
|
|
277
203
|
axiosInstance.interceptors.request.use((config4) => {
|
|
278
204
|
const token = getAccessToken();
|
|
279
205
|
if (token) {
|
|
@@ -300,6 +226,44 @@ function getAxiosInstance() {
|
|
|
300
226
|
}
|
|
301
227
|
return axiosInstance;
|
|
302
228
|
}
|
|
229
|
+
function formatBooleanSearchParam(key, value) {
|
|
230
|
+
return value ? `${key}:1` : `${key}:`;
|
|
231
|
+
}
|
|
232
|
+
var HttpClient = class {
|
|
233
|
+
static async get(url2, params) {
|
|
234
|
+
await ensureValidRefresh();
|
|
235
|
+
const response = await getAxiosInstance().get(url2, { params });
|
|
236
|
+
return response.data;
|
|
237
|
+
}
|
|
238
|
+
static async post(url2, data, options) {
|
|
239
|
+
await ensureValidRefresh();
|
|
240
|
+
const response = await getAxiosInstance().post(url2, data, options);
|
|
241
|
+
return response.data;
|
|
242
|
+
}
|
|
243
|
+
static async put(url2, data) {
|
|
244
|
+
await ensureValidRefresh();
|
|
245
|
+
const response = await getAxiosInstance().put(url2, data);
|
|
246
|
+
return response.data;
|
|
247
|
+
}
|
|
248
|
+
static async delete(url2, config4) {
|
|
249
|
+
await ensureValidRefresh();
|
|
250
|
+
const response = await getAxiosInstance().delete(url2, config4);
|
|
251
|
+
return response.data;
|
|
252
|
+
}
|
|
253
|
+
static formatSearchParams(params) {
|
|
254
|
+
return Object.entries(params).filter(([, value]) => Boolean(value)).map(
|
|
255
|
+
([k, v]) => [
|
|
256
|
+
"type",
|
|
257
|
+
"categories",
|
|
258
|
+
"tags",
|
|
259
|
+
"author",
|
|
260
|
+
"manufacturer",
|
|
261
|
+
"shops",
|
|
262
|
+
"refund_reason"
|
|
263
|
+
].includes(k) ? `${k}.slug:${v}` : ["is_approved"].includes(k) ? formatBooleanSearchParam(k, v) : `${k}:${v}`
|
|
264
|
+
).join(";");
|
|
265
|
+
}
|
|
266
|
+
};
|
|
303
267
|
var AuthHttpClient = class {
|
|
304
268
|
static async get(url2, params) {
|
|
305
269
|
const response = await getAxiosInstance().get(url2, { params });
|
|
@@ -616,14 +580,11 @@ var getParamDetails = (props, isDetailsPage = false) => {
|
|
|
616
580
|
};
|
|
617
581
|
};
|
|
618
582
|
|
|
619
|
-
// src/clint/index.ts
|
|
620
|
-
init_auth_utils();
|
|
621
|
-
|
|
622
583
|
// src/breadcrumb/url.ts
|
|
623
584
|
var useUpdateLink = () => {
|
|
624
|
-
const
|
|
625
|
-
|
|
626
|
-
|
|
585
|
+
const updateLink = async (props, displayName = "prm") => {
|
|
586
|
+
const search = getParam("b");
|
|
587
|
+
const pathname = getPath();
|
|
627
588
|
let breadcrumbs = decodeToBase64(search) || [];
|
|
628
589
|
if (breadcrumbs.length < 1) {
|
|
629
590
|
const routeMenu = getRouteMenu(pathname);
|
|
@@ -636,12 +597,13 @@ var useUpdateLink = () => {
|
|
|
636
597
|
}
|
|
637
598
|
const lastBreadcrumb = breadcrumbs[breadcrumbs.length - 1];
|
|
638
599
|
if (displayName) {
|
|
639
|
-
|
|
640
|
-
|
|
600
|
+
const ex = await getDeep(lastBreadcrumb, displayName) || {};
|
|
601
|
+
await setDeep(lastBreadcrumb, displayName, {
|
|
602
|
+
...ex,
|
|
641
603
|
...props
|
|
642
604
|
});
|
|
643
605
|
} else {
|
|
644
|
-
Object.assign(lastBreadcrumb, props);
|
|
606
|
+
await Object.assign(lastBreadcrumb, props);
|
|
645
607
|
}
|
|
646
608
|
const newBase64 = convertToBase64(breadcrumbs);
|
|
647
609
|
updateBParam(newBase64);
|
|
@@ -656,11 +618,13 @@ var useUpdateLink = () => {
|
|
|
656
618
|
curr = curr[keys[i]];
|
|
657
619
|
}
|
|
658
620
|
curr[keys[keys.length - 1]] = value;
|
|
621
|
+
return curr;
|
|
659
622
|
}
|
|
660
623
|
function getDeep(obj, path) {
|
|
661
624
|
return path.split(".").reduce((acc, key) => acc?.[key], obj);
|
|
662
625
|
}
|
|
663
626
|
const getLinkParams = (displayName = "prm") => {
|
|
627
|
+
const search = getParam("b");
|
|
664
628
|
let breadcrumbs = decodeToBase64(search) || [];
|
|
665
629
|
if (breadcrumbs.length < 1) return null;
|
|
666
630
|
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
|
@@ -681,6 +645,7 @@ var useUpdateLink = () => {
|
|
|
681
645
|
return output;
|
|
682
646
|
};
|
|
683
647
|
const filterParams = (displayName = "prm") => {
|
|
648
|
+
const search = getParam("b");
|
|
684
649
|
let breadcrumbs = decodeToBase64(search) || [];
|
|
685
650
|
if (breadcrumbs.length < 1) return null;
|
|
686
651
|
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
|
@@ -716,7 +681,37 @@ var updateBParam = (newValue) => {
|
|
|
716
681
|
}
|
|
717
682
|
};
|
|
718
683
|
|
|
719
|
-
// src/
|
|
684
|
+
// src/client/index.ts
|
|
685
|
+
var recordWriteContext = (paramsObject) => {
|
|
686
|
+
if (!paramsObject) {
|
|
687
|
+
return void 0;
|
|
688
|
+
}
|
|
689
|
+
const context = {};
|
|
690
|
+
const keys = [
|
|
691
|
+
"parentObjectTypeId",
|
|
692
|
+
"parentObjectRecordId",
|
|
693
|
+
"mediatorObjectTypeId",
|
|
694
|
+
"mediatorObjectRecordId"
|
|
695
|
+
];
|
|
696
|
+
keys.forEach((key) => {
|
|
697
|
+
const value = paramsObject[key];
|
|
698
|
+
if (value !== void 0 && value !== null && String(value).length > 0) {
|
|
699
|
+
context[key] = String(value);
|
|
700
|
+
}
|
|
701
|
+
});
|
|
702
|
+
return Object.keys(context).length > 0 ? context : void 0;
|
|
703
|
+
};
|
|
704
|
+
var mergeRecordWriteBody = (payload, paramsObject, options) => {
|
|
705
|
+
const base = { ...payload || {} };
|
|
706
|
+
const context = recordWriteContext(paramsObject);
|
|
707
|
+
if (context) {
|
|
708
|
+
base.context = context;
|
|
709
|
+
}
|
|
710
|
+
if (options && Object.keys(options).length > 0) {
|
|
711
|
+
base.options = options;
|
|
712
|
+
}
|
|
713
|
+
return base;
|
|
714
|
+
};
|
|
720
715
|
var Client = {
|
|
721
716
|
authentication: {
|
|
722
717
|
preLogin: (data) => AuthHttpClient.post(API_ENDPOINTS.PRE_LOGIN, data),
|
|
@@ -736,10 +731,10 @@ var Client = {
|
|
|
736
731
|
resetPasswordVerifyToken: (data) => AuthHttpClient.post(API_ENDPOINTS.RESET_PASSWORD_VERIFY_TOKEN, data),
|
|
737
732
|
resetPassword: (data) => AuthHttpClient.post(API_ENDPOINTS.RESET_PASSWORD, data),
|
|
738
733
|
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.
|
|
734
|
+
registerExistingUser: (data) => AuthHttpClient.post(API_ENDPOINTS.REGISTER_EXISTING_USER, data?.payload),
|
|
735
|
+
verifyEmailResend: (data) => AuthHttpClient.post(API_ENDPOINTS.VERIFY_EMAIL_RESEND, data),
|
|
741
736
|
resendEmail: (data) => AuthHttpClient.post(API_ENDPOINTS.RESEND_EMAIL, data),
|
|
742
|
-
logout: () =>
|
|
737
|
+
logout: () => HttpClient.post(API_ENDPOINTS.LOGOUT, null)
|
|
743
738
|
},
|
|
744
739
|
sso: {
|
|
745
740
|
getSsoDetails: () => AuthHttpClient.get(API_ENDPOINTS.SSO_DETAILS),
|
|
@@ -747,9 +742,9 @@ var Client = {
|
|
|
747
742
|
ssoCallback: (payload) => AuthHttpClient.get(generateApiUrl({ route: API_ENDPOINTS.SSO_CALLBACK, queryParams: payload?.queryParams }))
|
|
748
743
|
},
|
|
749
744
|
user: {
|
|
750
|
-
me: () =>
|
|
751
|
-
profile: (payload) =>
|
|
752
|
-
changePassword: (data) =>
|
|
745
|
+
me: () => HttpClient.get(generateApiUrl({ route: API_ENDPOINTS.ME })),
|
|
746
|
+
profile: (payload) => HttpClient.get(generateApiUrl({ route: API_ENDPOINTS.PROFILE, queryParams: payload })),
|
|
747
|
+
changePassword: (data) => HttpClient.post(API_ENDPOINTS.CHANGE_PASSWORD, data)
|
|
753
748
|
},
|
|
754
749
|
pipeline: {
|
|
755
750
|
list: (payload = null, param = null) => {
|
|
@@ -766,26 +761,26 @@ var Client = {
|
|
|
766
761
|
apiParams.parentObjectTypeId = "0-2";
|
|
767
762
|
}
|
|
768
763
|
apiParams.isPrimaryCompany = param?.isPrimaryCompany;
|
|
769
|
-
apiParams.cache = payload?.
|
|
764
|
+
apiParams.cache = payload?.cache;
|
|
770
765
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.PIPELINES, params, queryParams: apiParams });
|
|
771
|
-
return
|
|
766
|
+
return HttpClient.get(apiUrl);
|
|
772
767
|
}
|
|
773
768
|
},
|
|
774
769
|
stage: {
|
|
775
770
|
list: (props = null) => {
|
|
776
|
-
const portalId = config.devPortalId;
|
|
777
771
|
const params = {
|
|
778
|
-
hubId: config.hubId,
|
|
779
|
-
portalId,
|
|
772
|
+
// hubId: config.hubId,
|
|
773
|
+
// portalId: portalId,
|
|
780
774
|
objectTypeId: props?.params?.objectTypeId,
|
|
781
775
|
pipelineId: props?.params?.pipelineId
|
|
782
776
|
};
|
|
783
777
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.STAGES, params });
|
|
784
|
-
return
|
|
778
|
+
return HttpClient.get(apiUrl);
|
|
785
779
|
}
|
|
786
780
|
},
|
|
787
781
|
object: {
|
|
788
|
-
list: (payload = null, param = null) => {
|
|
782
|
+
list: async (payload = null, param = null) => {
|
|
783
|
+
param.cache = payload.cache;
|
|
789
784
|
const params = { hubspotObjectTypeId: payload?.hubspotObjectTypeId };
|
|
790
785
|
const { updateLink, getLinkParams } = useUpdateLink();
|
|
791
786
|
const { getParamDetails: getParamDetails2 } = routeParam;
|
|
@@ -804,7 +799,7 @@ var Client = {
|
|
|
804
799
|
const fParams = getLinkParams();
|
|
805
800
|
param = { ...payload?.isFristTimeLoadData && fParams && !payload?.isHome ? fParams : param, ...paramsObject };
|
|
806
801
|
if (!payload?.isFristTimeLoadData || !fParams) {
|
|
807
|
-
updateLink({
|
|
802
|
+
await updateLink({
|
|
808
803
|
"sort": param?.sort,
|
|
809
804
|
"s": param?.search,
|
|
810
805
|
"fPn": param?.filterPropertyName,
|
|
@@ -820,13 +815,13 @@ var Client = {
|
|
|
820
815
|
}
|
|
821
816
|
if (mPipelines != void 0 && mPipelines?.length === 0 && !payload?.specPipeLine) {
|
|
822
817
|
param.filterValue = "";
|
|
823
|
-
updateLink({
|
|
818
|
+
await updateLink({
|
|
824
819
|
"fV": param?.filterValue
|
|
825
820
|
});
|
|
826
821
|
}
|
|
827
822
|
if (mPipelines != void 0 && mPipelines?.length === 1 && !payload?.specPipeLine && mSelectedPipeline != null) {
|
|
828
823
|
param.filterValue = mPipelines[0].pipelineId;
|
|
829
|
-
updateLink({
|
|
824
|
+
await updateLink({
|
|
830
825
|
"fV": param?.filterValue
|
|
831
826
|
});
|
|
832
827
|
}
|
|
@@ -841,45 +836,70 @@ var Client = {
|
|
|
841
836
|
}
|
|
842
837
|
param.parentAccessLabel = parentAccessLabel;
|
|
843
838
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS, params, queryParams: param });
|
|
844
|
-
return
|
|
839
|
+
return HttpClient.get(apiUrl);
|
|
840
|
+
},
|
|
841
|
+
sideBarList: async (payload = null) => {
|
|
842
|
+
const hubspotObjectTypeId = payload?.hubspotObjectTypeId;
|
|
843
|
+
const params = { hubspotObjectTypeId };
|
|
844
|
+
const queryParams = payload.param;
|
|
845
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS, params, queryParams });
|
|
846
|
+
return HttpClient.get(apiUrl);
|
|
845
847
|
},
|
|
846
848
|
form: (payload = null) => {
|
|
847
849
|
const params = { hubspotObjectTypeId: payload?.hubspotObjectTypeId };
|
|
848
|
-
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.
|
|
849
|
-
return
|
|
850
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_FORM, params, queryParams: payload?.params });
|
|
851
|
+
return HttpClient.get(apiUrl);
|
|
850
852
|
},
|
|
851
853
|
objectFormOptions: (payload = null) => {
|
|
852
|
-
const params = {
|
|
854
|
+
const params = {
|
|
855
|
+
formId: payload?.formId,
|
|
856
|
+
objectTypeId: payload?.objectTypeId ?? payload?.hubspotObjectTypeId
|
|
857
|
+
};
|
|
853
858
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_FORM_OPTIONS, params, queryParams: payload?.params });
|
|
854
|
-
return
|
|
859
|
+
return HttpClient.get(apiUrl);
|
|
855
860
|
},
|
|
856
861
|
create: (props = null) => {
|
|
862
|
+
const { getParamDetails: getParamDetailsForCreate } = routeParam;
|
|
863
|
+
const { paramsObject } = getParamDetailsForCreate({ type: props?.componentName });
|
|
864
|
+
const cardParentMerge = props?.componentName === "association" ? true : false;
|
|
865
|
+
const body = mergeRecordWriteBody(props?.payload, paramsObject, {
|
|
866
|
+
cardParentMerge,
|
|
867
|
+
addAnother: props?.params?.addAnother
|
|
868
|
+
});
|
|
857
869
|
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);
|
|
870
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.RECORDS_CREATE, params });
|
|
871
|
+
return HttpClient.post(apiUrl, body);
|
|
862
872
|
},
|
|
863
873
|
createExisting: (props = null) => {
|
|
864
|
-
const
|
|
865
|
-
const
|
|
874
|
+
const { getLinkParams } = useUpdateLink();
|
|
875
|
+
const fParams = getLinkParams();
|
|
876
|
+
const queryParams = { ...fParams, ...props?.params };
|
|
877
|
+
const params = {
|
|
878
|
+
fromObjectTypeId: props?.fromObjectTypeId ?? props?.hubspotObjectTypeId,
|
|
879
|
+
fromRecordId: props?.fromRecordId,
|
|
880
|
+
toObjectTypeId: props?.toObjectTypeId
|
|
881
|
+
};
|
|
866
882
|
const payload = props.payload;
|
|
867
|
-
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.
|
|
868
|
-
return
|
|
883
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.RECORDS_ASSOCIATE, params, queryParams });
|
|
884
|
+
return HttpClient.post(apiUrl, payload);
|
|
869
885
|
},
|
|
870
886
|
removeExisting: (props = null) => {
|
|
871
|
-
const
|
|
872
|
-
const
|
|
873
|
-
const
|
|
874
|
-
const
|
|
875
|
-
|
|
887
|
+
const { getParamDetails: getParamDetailsForRemove } = routeParam;
|
|
888
|
+
const { paramsObject } = getParamDetailsForRemove({ type: props?.componentName });
|
|
889
|
+
const body = mergeRecordWriteBody(props?.payload, paramsObject, void 0);
|
|
890
|
+
const params = {
|
|
891
|
+
fromObjectTypeId: props?.fromObjectTypeId ?? props?.hubspotObjectTypeId,
|
|
892
|
+
fromRecordId: props?.fromRecordId,
|
|
893
|
+
toObjectTypeId: props?.toObjectTypeId
|
|
894
|
+
};
|
|
895
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.RECORDS_DISASSOCIATE, params });
|
|
896
|
+
return HttpClient.delete(apiUrl, { data: body });
|
|
876
897
|
},
|
|
877
898
|
details: (props = null) => {
|
|
878
899
|
const { paramsObject: urlParam, parentAccessLabel } = getParamDetails("", true);
|
|
879
|
-
const portalId = config.devPortalId;
|
|
880
900
|
const params = {
|
|
881
|
-
hubId: config.hubId,
|
|
882
|
-
portalId,
|
|
901
|
+
// hubId: config.hubId,
|
|
902
|
+
// portalId: portalId,
|
|
883
903
|
objectId: props?.params?.objectId,
|
|
884
904
|
id: props?.params?.id
|
|
885
905
|
};
|
|
@@ -889,52 +909,56 @@ var Client = {
|
|
|
889
909
|
...urlParam
|
|
890
910
|
};
|
|
891
911
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_DETAILS, params, queryParams });
|
|
892
|
-
return
|
|
912
|
+
return HttpClient.get(apiUrl);
|
|
893
913
|
},
|
|
894
914
|
update: (props = null) => {
|
|
895
|
-
const portalId = getPortal()?.portalId;
|
|
896
915
|
const params = {
|
|
897
|
-
hubId: config.hubId,
|
|
898
|
-
portalId,
|
|
899
916
|
objectId: props?.params?.objectId,
|
|
900
917
|
id: props?.params?.id
|
|
901
918
|
};
|
|
902
|
-
const {
|
|
903
|
-
const
|
|
904
|
-
|
|
919
|
+
const { getParamDetails: getParamDetailsForUpdate } = routeParam;
|
|
920
|
+
const { paramsObject } = getParamDetailsForUpdate({ type: props?.componentName });
|
|
921
|
+
const cardParentMerge = props?.componentName === "association" ? true : false;
|
|
922
|
+
const rawPayload = props?.payload || {};
|
|
923
|
+
const properties = rawPayload.properties ?? rawPayload.propertyPayload ?? rawPayload;
|
|
924
|
+
const body = mergeRecordWriteBody(
|
|
925
|
+
{ properties },
|
|
926
|
+
paramsObject,
|
|
927
|
+
{ cardParentMerge }
|
|
928
|
+
);
|
|
929
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.RECORDS_UPDATE, params });
|
|
930
|
+
return HttpClient.put(apiUrl, body);
|
|
905
931
|
}
|
|
906
932
|
},
|
|
907
933
|
note: {
|
|
908
934
|
list: (props = null) => {
|
|
909
|
-
const portalId = getPortal()?.portalId;
|
|
910
935
|
const params = {
|
|
911
|
-
hubId: config.hubId,
|
|
912
|
-
portalId,
|
|
936
|
+
// hubId: config.hubId,
|
|
937
|
+
// portalId: portalId,
|
|
913
938
|
objectId: props?.params?.objectId,
|
|
914
939
|
id: props?.params?.id
|
|
915
940
|
};
|
|
916
941
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES, params, queryParams: props?.queryParams });
|
|
917
|
-
return
|
|
942
|
+
return HttpClient.get(apiUrl);
|
|
918
943
|
},
|
|
919
944
|
create: (props = null) => {
|
|
920
945
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
|
|
921
946
|
const queryParams = props.queryParams;
|
|
922
947
|
const payload = props.payload;
|
|
923
948
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES_CREATE, params, queryParams });
|
|
924
|
-
return
|
|
949
|
+
return HttpClient.post(apiUrl, payload);
|
|
925
950
|
},
|
|
926
951
|
update: (props = null) => {
|
|
927
|
-
const portalId = getPortal()?.portalId;
|
|
928
952
|
const params = {
|
|
929
|
-
hubId: config.hubId,
|
|
930
|
-
portalId,
|
|
953
|
+
// hubId: config.hubId,
|
|
954
|
+
// portalId: portalId,
|
|
931
955
|
objectId: props?.params?.objectId,
|
|
932
956
|
id: props?.params?.id,
|
|
933
957
|
note_id: props?.params?.note_id
|
|
934
958
|
};
|
|
935
959
|
const { paramsObject: queryParams } = getParamDetails();
|
|
936
960
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES_DETAILS_UPDATE, params, queryParams });
|
|
937
|
-
return
|
|
961
|
+
return HttpClient.put(apiUrl, props.payload);
|
|
938
962
|
},
|
|
939
963
|
image: (props = null) => {
|
|
940
964
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
|
|
@@ -942,7 +966,7 @@ var Client = {
|
|
|
942
966
|
const payload = props.payload;
|
|
943
967
|
const axiosConfig = props.config || {};
|
|
944
968
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES_IMAGE_UPLOAD, params, queryParams });
|
|
945
|
-
return
|
|
969
|
+
return HttpClient.post(apiUrl, payload, {
|
|
946
970
|
headers: {
|
|
947
971
|
"Content-Type": "multipart/form-data"
|
|
948
972
|
},
|
|
@@ -955,7 +979,7 @@ var Client = {
|
|
|
955
979
|
const payload = props.payload;
|
|
956
980
|
const axiosConfig = props.config || {};
|
|
957
981
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES_ATTACHMENT_UPLOAD, params, queryParams });
|
|
958
|
-
return
|
|
982
|
+
return HttpClient.post(apiUrl, payload, {
|
|
959
983
|
headers: {
|
|
960
984
|
"Content-Type": "multipart/form-data"
|
|
961
985
|
},
|
|
@@ -965,35 +989,33 @@ var Client = {
|
|
|
965
989
|
},
|
|
966
990
|
email: {
|
|
967
991
|
list: (props = null) => {
|
|
968
|
-
const portalId = getPortal()?.portalId;
|
|
969
992
|
const params = {
|
|
970
|
-
hubId: config.hubId,
|
|
971
|
-
portalId,
|
|
993
|
+
// hubId: config.hubId,
|
|
994
|
+
// portalId: portalId,
|
|
972
995
|
objectId: props?.params?.objectId,
|
|
973
996
|
id: props?.params?.id
|
|
974
997
|
};
|
|
975
998
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS, params, queryParams: props?.queryParams });
|
|
976
|
-
return
|
|
999
|
+
return HttpClient.get(apiUrl);
|
|
977
1000
|
},
|
|
978
1001
|
create: (props = null) => {
|
|
979
1002
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
|
|
980
1003
|
const queryParams = props.queryParams;
|
|
981
1004
|
const payload = props.payload;
|
|
982
1005
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS_CREATE, params, queryParams });
|
|
983
|
-
return
|
|
1006
|
+
return HttpClient.post(apiUrl, payload);
|
|
984
1007
|
},
|
|
985
1008
|
update: (props = null) => {
|
|
986
|
-
const portalId = getPortal()?.portalId;
|
|
987
1009
|
const params = {
|
|
988
|
-
hubId: config.hubId,
|
|
989
|
-
portalId,
|
|
1010
|
+
// hubId: config.hubId,
|
|
1011
|
+
// portalId: portalId,
|
|
990
1012
|
objectId: props?.params?.objectId,
|
|
991
1013
|
id: props?.params?.id,
|
|
992
|
-
|
|
1014
|
+
email_id: props?.params?.email_id ?? props?.params?.note_id
|
|
993
1015
|
};
|
|
994
1016
|
const { paramsObject: queryParams } = getParamDetails();
|
|
995
1017
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS_DETAILS_UPDATE, params, queryParams });
|
|
996
|
-
return
|
|
1018
|
+
return HttpClient.put(apiUrl, props.payload);
|
|
997
1019
|
},
|
|
998
1020
|
image: (props = null) => {
|
|
999
1021
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
|
|
@@ -1001,7 +1023,7 @@ var Client = {
|
|
|
1001
1023
|
const payload = props.payload;
|
|
1002
1024
|
const axiosConfig = props.config || {};
|
|
1003
1025
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS_IMAGE_UPLOAD, params, queryParams });
|
|
1004
|
-
return
|
|
1026
|
+
return HttpClient.post(apiUrl, payload, {
|
|
1005
1027
|
headers: {
|
|
1006
1028
|
"Content-Type": "multipart/form-data"
|
|
1007
1029
|
},
|
|
@@ -1014,7 +1036,7 @@ var Client = {
|
|
|
1014
1036
|
const payload = props.payload;
|
|
1015
1037
|
const axiosConfig = props.config || {};
|
|
1016
1038
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS_ATTACHMENT_UPLOAD, params, queryParams });
|
|
1017
|
-
return
|
|
1039
|
+
return HttpClient.post(apiUrl, payload, {
|
|
1018
1040
|
headers: {
|
|
1019
1041
|
"Content-Type": "multipart/form-data"
|
|
1020
1042
|
},
|
|
@@ -1022,36 +1044,49 @@ var Client = {
|
|
|
1022
1044
|
});
|
|
1023
1045
|
}
|
|
1024
1046
|
},
|
|
1047
|
+
cache: {
|
|
1048
|
+
purge: (body, headers) => {
|
|
1049
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.CACHE_PURGE });
|
|
1050
|
+
return HttpClient.post(apiUrl, body, headers ? { headers } : void 0);
|
|
1051
|
+
},
|
|
1052
|
+
purgeStatus: (purgeJobId) => {
|
|
1053
|
+
const apiUrl = generateApiUrl({
|
|
1054
|
+
route: API_ENDPOINTS.CACHE_PURGE_STATUS,
|
|
1055
|
+
params: { purgeJobId }
|
|
1056
|
+
});
|
|
1057
|
+
return HttpClient.get(apiUrl);
|
|
1058
|
+
}
|
|
1059
|
+
},
|
|
1025
1060
|
file: {
|
|
1026
1061
|
list: (props = null) => {
|
|
1027
|
-
const portalId = getPortal()?.portalId;
|
|
1028
1062
|
const params = {
|
|
1029
|
-
hubId: config.hubId,
|
|
1030
|
-
portalId,
|
|
1063
|
+
// hubId: config.hubId,
|
|
1064
|
+
// portalId: portalId,
|
|
1031
1065
|
objectId: props?.params?.objectId,
|
|
1032
1066
|
id: props?.params?.id
|
|
1033
1067
|
};
|
|
1068
|
+
console.log("params_0", params);
|
|
1034
1069
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.FILES, params, queryParams: props?.queryParams });
|
|
1035
|
-
return
|
|
1070
|
+
return HttpClient.get(apiUrl);
|
|
1036
1071
|
},
|
|
1037
1072
|
details: (props = null) => {
|
|
1038
|
-
const portalId = getPortal()?.portalId;
|
|
1039
1073
|
const params = {
|
|
1040
|
-
hubId: config.hubId,
|
|
1041
|
-
portalId,
|
|
1074
|
+
// hubId: config.hubId,
|
|
1075
|
+
// portalId: portalId,
|
|
1042
1076
|
objectId: props?.params?.objectId,
|
|
1043
1077
|
id: props?.params?.id,
|
|
1044
1078
|
rowId: props?.params?.rowId
|
|
1045
1079
|
};
|
|
1080
|
+
console.log("params_1", params);
|
|
1046
1081
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.FILE, params, queryParams: props?.queryParams });
|
|
1047
|
-
return
|
|
1082
|
+
return HttpClient.get(apiUrl);
|
|
1048
1083
|
},
|
|
1049
1084
|
addFolder: (props = null) => {
|
|
1050
1085
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
|
|
1051
1086
|
const queryParams = props.queryParams;
|
|
1052
1087
|
const payload = props.payload;
|
|
1053
1088
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.FILES_CREATE_FOLDER, params, queryParams });
|
|
1054
|
-
return
|
|
1089
|
+
return HttpClient.post(apiUrl, payload);
|
|
1055
1090
|
},
|
|
1056
1091
|
addFile: (props = null) => {
|
|
1057
1092
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
|
|
@@ -1059,7 +1094,7 @@ var Client = {
|
|
|
1059
1094
|
const payload = props.payload;
|
|
1060
1095
|
const axiosConfig = props.config || {};
|
|
1061
1096
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.FILES_UPLOAD, params, queryParams });
|
|
1062
|
-
return
|
|
1097
|
+
return HttpClient.post(apiUrl, payload, {
|
|
1063
1098
|
headers: {
|
|
1064
1099
|
"Content-Type": "multipart/form-data"
|
|
1065
1100
|
},
|
|
@@ -1101,9 +1136,6 @@ function createMutation(mutationFn, options) {
|
|
|
1101
1136
|
}
|
|
1102
1137
|
|
|
1103
1138
|
// src/apis/authentication.ts
|
|
1104
|
-
init_auth_utils();
|
|
1105
|
-
init_cookie();
|
|
1106
|
-
init_token_store();
|
|
1107
1139
|
function preLogin(options) {
|
|
1108
1140
|
const { mutate, isLoading } = createMutation(
|
|
1109
1141
|
async (payload) => {
|
|
@@ -1386,7 +1418,6 @@ function createStore(initializer) {
|
|
|
1386
1418
|
}
|
|
1387
1419
|
|
|
1388
1420
|
// src/utils/getCookieData.ts
|
|
1389
|
-
init_cookie();
|
|
1390
1421
|
var getAuthSubscriptionType = () => {
|
|
1391
1422
|
return getCookie("subscriptionType");
|
|
1392
1423
|
};
|
|
@@ -1415,6 +1446,8 @@ var tableStore = createStore((set, get) => ({
|
|
|
1415
1446
|
selectedPipeline: "",
|
|
1416
1447
|
tableParam: {},
|
|
1417
1448
|
tableDefPermissions: {},
|
|
1449
|
+
tableData: [],
|
|
1450
|
+
tablePrependData: [],
|
|
1418
1451
|
// ==============================
|
|
1419
1452
|
// BASIC SETTERS
|
|
1420
1453
|
// ==============================
|
|
@@ -1519,12 +1552,12 @@ var tableStore = createStore((set, get) => ({
|
|
|
1519
1552
|
// ==============================
|
|
1520
1553
|
setGridData: async (type, deals) => {
|
|
1521
1554
|
if (type === "reset") {
|
|
1522
|
-
set({ gridData: [] });
|
|
1523
|
-
return;
|
|
1555
|
+
await set({ gridData: [] });
|
|
1556
|
+
return [];
|
|
1524
1557
|
}
|
|
1525
1558
|
if (type === "directly") {
|
|
1526
|
-
set({ gridData: deals });
|
|
1527
|
-
return;
|
|
1559
|
+
await set({ gridData: deals });
|
|
1560
|
+
return deals;
|
|
1528
1561
|
}
|
|
1529
1562
|
const finalData = await deals.map(
|
|
1530
1563
|
(deal) => {
|
|
@@ -1583,6 +1616,47 @@ var tableStore = createStore((set, get) => ({
|
|
|
1583
1616
|
}
|
|
1584
1617
|
set({ selectedPipeline: mFilterValue });
|
|
1585
1618
|
return mFilterValue;
|
|
1619
|
+
},
|
|
1620
|
+
setTableData: (response) => {
|
|
1621
|
+
set({
|
|
1622
|
+
tableData: response
|
|
1623
|
+
});
|
|
1624
|
+
},
|
|
1625
|
+
setTablePrependData: async (response) => {
|
|
1626
|
+
const state = get();
|
|
1627
|
+
let rows = [];
|
|
1628
|
+
if (response === "loading") {
|
|
1629
|
+
const row = await state.tableData?.data?.results?.columns.reduce((acc, item) => {
|
|
1630
|
+
if (!item.hidden) {
|
|
1631
|
+
acc[item.key] = "loading";
|
|
1632
|
+
}
|
|
1633
|
+
return acc;
|
|
1634
|
+
}, {});
|
|
1635
|
+
rows = [row, ...state.tablePrependData];
|
|
1636
|
+
} else {
|
|
1637
|
+
const data = response?.data;
|
|
1638
|
+
if (!data) {
|
|
1639
|
+
set({
|
|
1640
|
+
tablePrependData: []
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
const row = await Object.fromEntries(
|
|
1644
|
+
Object.entries(data).map(([key, value]) => [
|
|
1645
|
+
key,
|
|
1646
|
+
value?.value ?? value
|
|
1647
|
+
])
|
|
1648
|
+
);
|
|
1649
|
+
rows = [...state.tablePrependData];
|
|
1650
|
+
if (rows.length > 0) {
|
|
1651
|
+
rows[0] = row;
|
|
1652
|
+
} else {
|
|
1653
|
+
rows.push(row);
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
set({
|
|
1657
|
+
tablePrependData: rows
|
|
1658
|
+
});
|
|
1659
|
+
return rows;
|
|
1586
1660
|
}
|
|
1587
1661
|
}));
|
|
1588
1662
|
function useTable() {
|
|
@@ -1600,7 +1674,7 @@ function list(options) {
|
|
|
1600
1674
|
} = useTable();
|
|
1601
1675
|
const { mutate, isLoading } = createMutation(
|
|
1602
1676
|
async (payload) => {
|
|
1603
|
-
const param = getTableParam(payload?.companyAsMediator);
|
|
1677
|
+
const param = await getTableParam(payload?.companyAsMediator);
|
|
1604
1678
|
const response = await Client.pipeline.list(payload, param);
|
|
1605
1679
|
return response;
|
|
1606
1680
|
},
|
|
@@ -1634,10 +1708,12 @@ function list3(options) {
|
|
|
1634
1708
|
const {
|
|
1635
1709
|
getTableParam
|
|
1636
1710
|
} = useTable();
|
|
1711
|
+
const { setTableData } = actions;
|
|
1637
1712
|
const { mutate, isLoading } = createMutation(
|
|
1638
1713
|
async (payload) => {
|
|
1639
|
-
const param = getTableParam(payload?.companyAsMediator);
|
|
1714
|
+
const param = await getTableParam(payload?.companyAsMediator);
|
|
1640
1715
|
const response = await Client.object.list(payload, param);
|
|
1716
|
+
setTableData(response);
|
|
1641
1717
|
return response;
|
|
1642
1718
|
},
|
|
1643
1719
|
options
|
|
@@ -1648,6 +1724,20 @@ function list3(options) {
|
|
|
1648
1724
|
isLoading
|
|
1649
1725
|
};
|
|
1650
1726
|
}
|
|
1727
|
+
function sideBarList(options) {
|
|
1728
|
+
const { mutate, isLoading } = createMutation(
|
|
1729
|
+
async (payload) => {
|
|
1730
|
+
const response = await Client.object.sideBarList(payload);
|
|
1731
|
+
return response;
|
|
1732
|
+
},
|
|
1733
|
+
options
|
|
1734
|
+
);
|
|
1735
|
+
return {
|
|
1736
|
+
mutate,
|
|
1737
|
+
getSideBarObjects: mutate,
|
|
1738
|
+
isLoading
|
|
1739
|
+
};
|
|
1740
|
+
}
|
|
1651
1741
|
function form(options) {
|
|
1652
1742
|
const { mutate, isLoading } = createMutation(
|
|
1653
1743
|
async (payload) => {
|
|
@@ -1677,9 +1767,12 @@ function objectFormOptions(options) {
|
|
|
1677
1767
|
};
|
|
1678
1768
|
}
|
|
1679
1769
|
function create(options) {
|
|
1770
|
+
const { setTablePrependData } = actions;
|
|
1680
1771
|
const { mutate, isLoading } = createMutation(
|
|
1681
1772
|
async (props) => {
|
|
1773
|
+
await setTablePrependData("loading");
|
|
1682
1774
|
const response = await Client.object.create(props);
|
|
1775
|
+
await setTablePrependData(response);
|
|
1683
1776
|
return response;
|
|
1684
1777
|
},
|
|
1685
1778
|
options
|
|
@@ -1749,9 +1842,11 @@ function update(options) {
|
|
|
1749
1842
|
|
|
1750
1843
|
// src/apis/note.ts
|
|
1751
1844
|
function list4(options) {
|
|
1845
|
+
const { setNotes } = actions2;
|
|
1752
1846
|
const { mutate, isLoading } = createMutation(
|
|
1753
1847
|
async (payload) => {
|
|
1754
1848
|
const response = await Client.note.list(payload);
|
|
1849
|
+
setNotes(response);
|
|
1755
1850
|
return response;
|
|
1756
1851
|
},
|
|
1757
1852
|
options
|
|
@@ -1763,9 +1858,12 @@ function list4(options) {
|
|
|
1763
1858
|
};
|
|
1764
1859
|
}
|
|
1765
1860
|
function create2(options) {
|
|
1861
|
+
const { setPrependNote } = actions2;
|
|
1766
1862
|
const { mutate, isLoading } = createMutation(
|
|
1767
1863
|
async (props) => {
|
|
1864
|
+
await setPrependNote("loading");
|
|
1768
1865
|
const response = await Client.note.create(props);
|
|
1866
|
+
await setPrependNote(response);
|
|
1769
1867
|
return response;
|
|
1770
1868
|
},
|
|
1771
1869
|
options
|
|
@@ -1793,9 +1891,11 @@ function update2(options) {
|
|
|
1793
1891
|
|
|
1794
1892
|
// src/apis/email.ts
|
|
1795
1893
|
function list5(options) {
|
|
1894
|
+
const { setEmails } = actions3;
|
|
1796
1895
|
const { mutate, isLoading } = createMutation(
|
|
1797
1896
|
async (payload) => {
|
|
1798
1897
|
const response = await Client.email.list(payload);
|
|
1898
|
+
setEmails(response);
|
|
1799
1899
|
return response;
|
|
1800
1900
|
},
|
|
1801
1901
|
options
|
|
@@ -1807,9 +1907,12 @@ function list5(options) {
|
|
|
1807
1907
|
};
|
|
1808
1908
|
}
|
|
1809
1909
|
function create3(options) {
|
|
1910
|
+
const { setPrependEmail } = actions3;
|
|
1810
1911
|
const { mutate, isLoading } = createMutation(
|
|
1811
1912
|
async (props) => {
|
|
1913
|
+
await setPrependEmail("loading");
|
|
1812
1914
|
const response = await Client.email.create(props);
|
|
1915
|
+
await setPrependEmail(response);
|
|
1813
1916
|
return response;
|
|
1814
1917
|
},
|
|
1815
1918
|
options
|
|
@@ -1839,7 +1942,6 @@ function update3(options) {
|
|
|
1839
1942
|
function imageUpload(options) {
|
|
1840
1943
|
const { mutate, isLoading } = createMutation(
|
|
1841
1944
|
async (payload) => {
|
|
1842
|
-
console.log("payload", payload);
|
|
1843
1945
|
const response = payload?.type === "email" ? await Client.email.image(payload) : await Client.note.image(payload);
|
|
1844
1946
|
return response;
|
|
1845
1947
|
},
|
|
@@ -1924,10 +2026,31 @@ function addFile(options) {
|
|
|
1924
2026
|
};
|
|
1925
2027
|
}
|
|
1926
2028
|
|
|
1927
|
-
// src/
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
2029
|
+
// src/apis/cache.ts
|
|
2030
|
+
function purge(options) {
|
|
2031
|
+
const { mutate, isLoading } = createMutation(
|
|
2032
|
+
async (payload) => {
|
|
2033
|
+
const safePayload = payload ?? {};
|
|
2034
|
+
const idempotencyKey = typeof safePayload.idempotencyKey === "string" ? safePayload.idempotencyKey : void 0;
|
|
2035
|
+
const headers = idempotencyKey ? { "Idempotency-Key": idempotencyKey } : void 0;
|
|
2036
|
+
const { idempotencyKey: _ignored, ...body } = safePayload;
|
|
2037
|
+
return Client.cache.purge(body, headers);
|
|
2038
|
+
},
|
|
2039
|
+
options
|
|
2040
|
+
);
|
|
2041
|
+
return { mutate, purgeCache: mutate, isLoading };
|
|
2042
|
+
}
|
|
2043
|
+
function purgeStatus(purgeJobId, options) {
|
|
2044
|
+
const { mutate, isLoading } = createMutation(
|
|
2045
|
+
async (jobId) => Client.cache.purgeStatus(jobId ?? purgeJobId),
|
|
2046
|
+
options
|
|
2047
|
+
);
|
|
2048
|
+
return {
|
|
2049
|
+
mutate,
|
|
2050
|
+
getPurgeStatus: () => mutate(purgeJobId),
|
|
2051
|
+
isLoading
|
|
2052
|
+
};
|
|
2053
|
+
}
|
|
1931
2054
|
|
|
1932
2055
|
// src/breadcrumb/breadcrumbs.ts
|
|
1933
2056
|
var getBreadcrumbs = () => {
|
|
@@ -2156,6 +2279,7 @@ var api = {
|
|
|
2156
2279
|
pipelines: list,
|
|
2157
2280
|
stages: list2,
|
|
2158
2281
|
objects: list3,
|
|
2282
|
+
sideBarObjects: sideBarList,
|
|
2159
2283
|
objectsForm: form,
|
|
2160
2284
|
createObject: create,
|
|
2161
2285
|
createExistingObject: createExisting,
|
|
@@ -2175,6 +2299,8 @@ var api = {
|
|
|
2175
2299
|
file: details2,
|
|
2176
2300
|
addFolder,
|
|
2177
2301
|
addFile,
|
|
2302
|
+
purgeCache: purge,
|
|
2303
|
+
cachePurgeStatus: purgeStatus,
|
|
2178
2304
|
getRefreshToken,
|
|
2179
2305
|
getAuthRefreshToken,
|
|
2180
2306
|
isCookieExpired,
|
|
@@ -2200,6 +2326,6 @@ var routeParam = {
|
|
|
2200
2326
|
getParamDetails
|
|
2201
2327
|
};
|
|
2202
2328
|
|
|
2203
|
-
export { api, breadcrumbsDetails, getFieldErrors, getFormErrors, initializeHttpClient, routeParam, store, url };
|
|
2329
|
+
export { api, breadcrumbsDetails, client_exports as clint, getFieldErrors, getFormErrors, initializeHttpClient, routeParam, store, url };
|
|
2204
2330
|
//# sourceMappingURL=index.js.map
|
|
2205
2331
|
//# sourceMappingURL=index.js.map
|