woodsportal-client-sdk 1.1.4-dev.5 → 1.1.4-dev.50
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/CHANGELOG.md +4 -0
- package/README.md +48 -2
- package/dist/adapters/angular/index.d.ts +38 -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 +38 -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 +38 -0
- package/dist/adapters/vue/index.js +25 -0
- package/dist/adapters/vue/index.js.map +1 -0
- package/dist/auth-utils-EJLWWPCI.js +4 -0
- package/dist/auth-utils-EJLWWPCI.js.map +1 -0
- package/dist/chunk-A3N3Z2XW.js +102 -0
- package/dist/chunk-A3N3Z2XW.js.map +1 -0
- package/dist/chunk-B4J3MT7F.js +1404 -0
- package/dist/chunk-B4J3MT7F.js.map +1 -0
- package/dist/chunk-T4ORQSB3.js +42 -0
- package/dist/chunk-T4ORQSB3.js.map +1 -0
- package/dist/chunk-Y5MRAAGK.js +10 -0
- package/dist/chunk-Y5MRAAGK.js.map +1 -0
- package/dist/chunk-YTS4YVJV.js +17 -0
- package/dist/chunk-YTS4YVJV.js.map +1 -0
- package/dist/index.d.ts +113 -2
- package/dist/index.js +396 -848
- package/dist/index.js.map +1 -1
- package/dist/use-uploader-dlc_3esL.d.ts +51 -0
- package/package.json +44 -8
package/dist/index.js
CHANGED
|
@@ -1,189 +1,54 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { getParamDetails, useUpdateLink, useTable, getRouteDetails, actions, actions6, actions3, actions4, getParam, decodeToBase64, generatePath, getPath, getRouteMenu, breadcrumbStage, isMessingParentLastItem, isMessingParent, generateUrl, resetAllStore, actions2 } from './chunk-B4J3MT7F.js';
|
|
2
|
+
import { ensureValidRefresh, HUBSPOT_DATA, PORTAL_ID, DEV_PORTAL_ID, HUB_ID, setRefreshCallback, getAccessToken, setRefreshToken, setAccessToken, isAuthenticateApp, isExpiresAccessToken, getRefreshToken, DEV_API_URL, setPortal, setSubscriptionType, setLoggedInDetails, clearAccessToken } from './chunk-A3N3Z2XW.js';
|
|
3
|
+
import { __export, isCookieExpired, removeAllCookie } from './chunk-T4ORQSB3.js';
|
|
2
4
|
import axios from 'axios';
|
|
3
|
-
import pako from 'pako';
|
|
4
|
-
import { Base64 } from 'js-base64';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
var __export = (target, all) => {
|
|
12
|
-
for (var name in all)
|
|
13
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
// src/utils/constants.ts
|
|
17
|
-
var LOGIN_DETAILS, REFRESH_TOKEN, PORTAL, SUBSCRIPTION_TYPE, HUBSPOT_DATA, HUB_ID, DEV_PORTAL_ID, PORTAL_ID;
|
|
18
|
-
var init_constants = __esm({
|
|
19
|
-
"src/utils/constants.ts"() {
|
|
20
|
-
LOGIN_DETAILS = "loginDetails";
|
|
21
|
-
REFRESH_TOKEN = "refreshToken";
|
|
22
|
-
PORTAL = "portal";
|
|
23
|
-
SUBSCRIPTION_TYPE = "ssubscriptionType";
|
|
24
|
-
HUBSPOT_DATA = "hubSpotData";
|
|
25
|
-
HUB_ID = "hubId";
|
|
26
|
-
DEV_PORTAL_ID = "devPortalId";
|
|
27
|
-
PORTAL_ID = "portalId";
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
var setCookie, getCookie, removeAllCookie, isCookieExpired;
|
|
31
|
-
var init_cookie = __esm({
|
|
32
|
-
"src/utils/cookie.ts"() {
|
|
33
|
-
setCookie = (key, value, expire) => {
|
|
34
|
-
return Cookies.set(key, value, {
|
|
35
|
-
expires: expire,
|
|
36
|
-
sameSite: "none",
|
|
37
|
-
secure: true
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
getCookie = (key) => {
|
|
41
|
-
return Cookies.get(key);
|
|
42
|
-
};
|
|
43
|
-
removeAllCookie = () => {
|
|
44
|
-
Object.keys(Cookies.get()).forEach((cookieName) => {
|
|
45
|
-
Cookies.remove(cookieName);
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
isCookieExpired = (key) => {
|
|
49
|
-
const value = Cookies.get(key);
|
|
50
|
-
try {
|
|
51
|
-
const { expiresAt } = JSON.parse(value);
|
|
52
|
-
return Date.now() > expiresAt ? true : false;
|
|
53
|
-
} catch {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
}
|
|
6
|
+
// src/client/index.ts
|
|
7
|
+
var client_exports = {};
|
|
8
|
+
__export(client_exports, {
|
|
9
|
+
Client: () => Client
|
|
58
10
|
});
|
|
59
11
|
|
|
60
|
-
// src/
|
|
61
|
-
var
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
setSubscriptionType: () => setSubscriptionType
|
|
72
|
-
});
|
|
73
|
-
function setRefreshToken(token, expiresAt) {
|
|
74
|
-
return new Promise((resolve) => {
|
|
75
|
-
setCookie(REFRESH_TOKEN, JSON.stringify(token), expiresAt);
|
|
76
|
-
resolve();
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
function setAccessToken(token, expiresIn) {
|
|
80
|
-
return new Promise((resolve) => {
|
|
81
|
-
storAccessToken(token, expiresIn);
|
|
82
|
-
resolve();
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
function getProfile() {
|
|
86
|
-
return JSON.parse(getCookie(LOGIN_DETAILS || null) || null);
|
|
87
|
-
}
|
|
88
|
-
function getRefreshToken() {
|
|
89
|
-
return JSON.parse(getCookie(REFRESH_TOKEN || null) || null);
|
|
90
|
-
}
|
|
91
|
-
function getPortal() {
|
|
92
|
-
return JSON.parse(getCookie(PORTAL || null) || null);
|
|
93
|
-
}
|
|
94
|
-
function getSubscriptionType() {
|
|
95
|
-
return JSON.parse(getCookie(SUBSCRIPTION_TYPE || null) || null);
|
|
96
|
-
}
|
|
97
|
-
var setLoggedInDetails, setPortal, setSubscriptionType;
|
|
98
|
-
var init_auth_utils = __esm({
|
|
99
|
-
"src/clint/auth-utils.ts"() {
|
|
100
|
-
init_constants();
|
|
101
|
-
init_cookie();
|
|
102
|
-
init_token_store();
|
|
103
|
-
setLoggedInDetails = async (data) => {
|
|
104
|
-
return new Promise((resolve) => {
|
|
105
|
-
setCookie(LOGIN_DETAILS, JSON.stringify(data));
|
|
106
|
-
resolve();
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
setPortal = async (data) => {
|
|
110
|
-
return new Promise((resolve) => {
|
|
111
|
-
setCookie(PORTAL, JSON.stringify(data));
|
|
112
|
-
resolve();
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
setSubscriptionType = async (data) => {
|
|
116
|
-
return new Promise((resolve) => {
|
|
117
|
-
setCookie(SUBSCRIPTION_TYPE, JSON.stringify(data));
|
|
118
|
-
resolve();
|
|
119
|
-
});
|
|
120
|
-
};
|
|
12
|
+
// src/utils/localStoraget.ts
|
|
13
|
+
var memory = /* @__PURE__ */ new Map();
|
|
14
|
+
var memoryStore = {
|
|
15
|
+
getItem(key) {
|
|
16
|
+
return memory.has(key) ? memory.get(key) : null;
|
|
17
|
+
},
|
|
18
|
+
setItem(key, value) {
|
|
19
|
+
memory.set(key, value);
|
|
20
|
+
},
|
|
21
|
+
removeItem(key) {
|
|
22
|
+
memory.delete(key);
|
|
121
23
|
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return accessToken;
|
|
127
|
-
}
|
|
128
|
-
function storAccessToken(token, expiresIn) {
|
|
129
|
-
accessToken = token;
|
|
130
|
-
if (expiresIn) {
|
|
131
|
-
tokenExpiresAt = Date.now() + expiresIn * 1e3;
|
|
132
|
-
} else {
|
|
133
|
-
tokenExpiresAt = null;
|
|
24
|
+
};
|
|
25
|
+
function resolveStore() {
|
|
26
|
+
if (typeof globalThis === "undefined") {
|
|
27
|
+
return memoryStore;
|
|
134
28
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
tokenExpiresAt = null;
|
|
139
|
-
}
|
|
140
|
-
function isExpiresAccessToken() {
|
|
141
|
-
if (!tokenExpiresAt) return true;
|
|
142
|
-
return Date.now() >= tokenExpiresAt;
|
|
143
|
-
}
|
|
144
|
-
function setRefreshCallback(callback) {
|
|
145
|
-
refreshCallback = callback;
|
|
146
|
-
}
|
|
147
|
-
async function ensureValidRefresh() {
|
|
148
|
-
if (isExpiresAccessToken() && refreshCallback) {
|
|
149
|
-
const { getRefreshToken: getRefreshToken2 } = await Promise.resolve().then(() => (init_auth_utils(), auth_utils_exports));
|
|
150
|
-
const refreshToken = getRefreshToken2();
|
|
151
|
-
if (refreshToken) {
|
|
152
|
-
await refreshCallback(refreshToken);
|
|
153
|
-
}
|
|
29
|
+
const ls = globalThis.localStorage;
|
|
30
|
+
if (!ls || typeof ls.getItem !== "function") {
|
|
31
|
+
return memoryStore;
|
|
154
32
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
33
|
+
try {
|
|
34
|
+
const probeKey = "__woodsportal_client_sdk_ls_probe__";
|
|
35
|
+
ls.setItem(probeKey, "1");
|
|
36
|
+
ls.removeItem(probeKey);
|
|
37
|
+
return ls;
|
|
38
|
+
} catch {
|
|
39
|
+
return memoryStore;
|
|
159
40
|
}
|
|
160
|
-
return true;
|
|
161
41
|
}
|
|
162
|
-
var accessToken, tokenExpiresAt, refreshCallback;
|
|
163
|
-
var init_token_store = __esm({
|
|
164
|
-
"src/clint/token-store.ts"() {
|
|
165
|
-
init_cookie();
|
|
166
|
-
init_constants();
|
|
167
|
-
accessToken = null;
|
|
168
|
-
tokenExpiresAt = null;
|
|
169
|
-
refreshCallback = null;
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
// src/utils/config.ts
|
|
174
|
-
init_constants();
|
|
175
|
-
|
|
176
|
-
// src/utils/localStoraget.ts
|
|
177
42
|
var storage = {
|
|
178
43
|
set: (key, value) => {
|
|
179
|
-
|
|
44
|
+
resolveStore().setItem(key, JSON.stringify(value));
|
|
180
45
|
},
|
|
181
46
|
get: (key) => {
|
|
182
|
-
const item =
|
|
47
|
+
const item = resolveStore().getItem(key);
|
|
183
48
|
return item ? JSON.parse(item) : null;
|
|
184
49
|
},
|
|
185
50
|
remove: (key) => {
|
|
186
|
-
|
|
51
|
+
resolveStore().removeItem(key);
|
|
187
52
|
}
|
|
188
53
|
};
|
|
189
54
|
|
|
@@ -200,6 +65,10 @@ var config = {
|
|
|
200
65
|
get portalId() {
|
|
201
66
|
const hubSpotData = storage.get(HUBSPOT_DATA);
|
|
202
67
|
return hubSpotData?.[PORTAL_ID] || "";
|
|
68
|
+
},
|
|
69
|
+
get devApiUrl() {
|
|
70
|
+
const hubSpotData = storage.get(HUBSPOT_DATA);
|
|
71
|
+
return hubSpotData?.[DEV_API_URL] || "";
|
|
203
72
|
}
|
|
204
73
|
};
|
|
205
74
|
var setConfig = {
|
|
@@ -238,7 +107,7 @@ function replaceParams(template, values) {
|
|
|
238
107
|
);
|
|
239
108
|
}
|
|
240
109
|
|
|
241
|
-
// src/
|
|
110
|
+
// src/client/api-endpoints.ts
|
|
242
111
|
var API_ENDPOINTS = {
|
|
243
112
|
// Auth
|
|
244
113
|
PRE_LOGIN: "/api/auth/pre-login",
|
|
@@ -250,6 +119,7 @@ var API_ENDPOINTS = {
|
|
|
250
119
|
VERIFY_EMAIL: "/api/auth/verify-email",
|
|
251
120
|
REGISTER_EXISTING_USER: "/api/auth/existing-user-register",
|
|
252
121
|
RESEND_EMAIL: "/api/auth/resend-email",
|
|
122
|
+
VERIFY_EMAIL_RESEND: "/api/auth/verify-email/resend",
|
|
253
123
|
LOGOUT: "/api/auth/logout",
|
|
254
124
|
// SSO
|
|
255
125
|
SSO_DETAILS: "/api/auth/sso/active",
|
|
@@ -260,51 +130,70 @@ var API_ENDPOINTS = {
|
|
|
260
130
|
PROFILE: "/api/${hubId}/${portalId}/profiles",
|
|
261
131
|
CHANGE_PASSWORD: "/api/auth/change-password",
|
|
262
132
|
// Pipeline
|
|
263
|
-
PIPELINES: "api/${hubId}/${portalId}/hubspot-object-pipelines/${hubspotObjectTypeId}",
|
|
133
|
+
PIPELINES: "/api/${hubId}/${portalId}/hubspot-object-pipelines/${hubspotObjectTypeId}",
|
|
264
134
|
// Stage
|
|
265
|
-
STAGES: "api/${hubId}/${portalId}/hubspot-object-pipelines/${objectTypeId}/${pipelineId}/stages",
|
|
266
|
-
//
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
135
|
+
STAGES: "/api/${hubId}/${portalId}/hubspot-object-pipelines/${objectTypeId}/${pipelineId}/stages",
|
|
136
|
+
// Cache purge (replaces cache=false refresh; requires features.cache-purge-api-enabled on API)
|
|
137
|
+
CACHE_PURGE: "/api/${hubId}/${portalId}/cache-purge-jobs",
|
|
138
|
+
CACHE_PURGE_STATUS: "/api/${hubId}/${portalId}/cache-purge-jobs/${purgeJobId}",
|
|
139
|
+
/** @deprecated Use CACHE_PURGE */
|
|
140
|
+
CACHE_PURGE_LEGACY: "/api/${hubId}/${portalId}/cache/purge",
|
|
141
|
+
/** @deprecated Use CACHE_PURGE_STATUS */
|
|
142
|
+
CACHE_PURGE_STATUS_LEGACY: "/api/${hubId}/${portalId}/cache/purge/${purgeJobId}",
|
|
143
|
+
// Object (read on hubspot-object-data; form layout on hubspot-object-forms)
|
|
144
|
+
OBJECTS: "/api/${hubId}/${portalId}/hubspot-object-data/${hubspotObjectTypeId}/records",
|
|
145
|
+
OBJECTS_FORM: "/api/${hubId}/${portalId}/hubspot-object-forms/${hubspotObjectTypeId}/fields",
|
|
146
|
+
OBJECTS_FORM_OPTIONS: "/api/${hubId}/${portalId}/hubspot-object-forms/${formId}/${objectTypeId}",
|
|
147
|
+
RECORDS_CREATE: "/api/${hubId}/${portalId}/hubspot-object-data/${hubspotObjectTypeId}/records",
|
|
148
|
+
RECORDS_UPDATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}",
|
|
149
|
+
RECORDS_ASSOCIATE: "/api/${hubId}/${portalId}/hubspot-object-data/${fromObjectTypeId}/records/${fromRecordId}/associations/${toObjectTypeId}",
|
|
150
|
+
RECORDS_DISASSOCIATE: "/api/${hubId}/${portalId}/hubspot-object-data/${fromObjectTypeId}/records/${fromRecordId}/associations/${toObjectTypeId}",
|
|
151
|
+
/** @deprecated Use RECORDS_CREATE */
|
|
152
|
+
OBJECTS_CREATE: "/api/${hubId}/${portalId}/hubspot-object-forms/${hubspotObjectTypeId}/fields",
|
|
153
|
+
/** @deprecated Use RECORDS_ASSOCIATE */
|
|
154
|
+
OBJECTS_CREATE_EXISTING: "/api/${hubId}/${portalId}/hubspot-object-forms/:fromObjectTypeId/:fromRecordId/associations/:toObjectTypeId",
|
|
155
|
+
OBJECTS_DETAILS: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}",
|
|
156
|
+
/** @deprecated Use RECORDS_UPDATE */
|
|
157
|
+
OBJECTS_DETAILS_UPDATE: "/api/${hubId}/${portalId}/hubspot-object-forms/${objectId}/records/${id}",
|
|
158
|
+
OBJECTS_DETAILS_UPDATE_LEGACY: "/api/${hubId}/${portalId}/hubspot-object-forms/${objectId}/properties/${id}",
|
|
159
|
+
// Notes (nested under CRM record)
|
|
160
|
+
NOTES: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/notes",
|
|
161
|
+
NOTES_CREATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/notes",
|
|
162
|
+
NOTES_DETAILS_UPDATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/notes/${note_id}",
|
|
163
|
+
NOTES_IMAGE_UPLOAD: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/notes/images",
|
|
164
|
+
NOTES_ATTACHMENT_UPLOAD: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/notes/attachments",
|
|
165
|
+
NOTES_ATTACHMENT_UPDATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/notes/attachments/${note_id}",
|
|
166
|
+
// Email (nested under CRM record)
|
|
167
|
+
EMAILS: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/emails",
|
|
168
|
+
EMAILS_CREATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/emails",
|
|
169
|
+
EMAILS_DETAILS_UPDATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/emails/${email_id}",
|
|
170
|
+
EMAILS_IMAGE_UPLOAD: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/emails/images",
|
|
171
|
+
EMAILS_ATTACHMENT_UPLOAD: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/emails/attachments",
|
|
172
|
+
EMAILS_ATTACHMENT_UPDATE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/emails/attachments/${email_id}",
|
|
173
|
+
// File manager (nested under CRM record)
|
|
174
|
+
FILES: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/files",
|
|
175
|
+
FILE: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/files/${rowId}",
|
|
176
|
+
FILE_DOWNLOAD: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/files/${rowId}/download",
|
|
177
|
+
FILES_CREATE_FOLDER: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/folders",
|
|
178
|
+
FILES_UPLOAD: "/api/${hubId}/${portalId}/hubspot-object-data/${objectId}/records/${id}/files"
|
|
293
179
|
};
|
|
294
|
-
init_token_store();
|
|
295
180
|
|
|
296
|
-
// src/
|
|
181
|
+
// src/client/config.ts
|
|
297
182
|
var config2 = {
|
|
298
|
-
baseURL: "
|
|
183
|
+
baseURL: ""
|
|
299
184
|
};
|
|
300
185
|
|
|
301
|
-
// src/
|
|
302
|
-
init_auth_utils();
|
|
186
|
+
// src/client/http-clint.ts
|
|
303
187
|
var axiosInstance = null;
|
|
304
188
|
var config3 = {};
|
|
305
189
|
function initializeHttpClient(clientConfig) {
|
|
306
190
|
config3 = clientConfig;
|
|
307
|
-
const baseURL =
|
|
191
|
+
const baseURL = config?.devApiUrl || config3.baseURL;
|
|
192
|
+
if (!baseURL) {
|
|
193
|
+
throw new Error(
|
|
194
|
+
"WoodsPortal SDK HTTP client is not configured. Call initializeHttpClient({ baseURL }) at app startup."
|
|
195
|
+
);
|
|
196
|
+
}
|
|
308
197
|
const timeout = config3.timeout ?? 5e4;
|
|
309
198
|
axiosInstance = axios.create({
|
|
310
199
|
baseURL,
|
|
@@ -360,9 +249,9 @@ var HttpClient = class {
|
|
|
360
249
|
const response = await getAxiosInstance().put(url2, data);
|
|
361
250
|
return response.data;
|
|
362
251
|
}
|
|
363
|
-
static async delete(url2) {
|
|
252
|
+
static async delete(url2, config4) {
|
|
364
253
|
await ensureValidRefresh();
|
|
365
|
-
const response = await getAxiosInstance().delete(url2);
|
|
254
|
+
const response = await getAxiosInstance().delete(url2, config4);
|
|
366
255
|
return response.data;
|
|
367
256
|
}
|
|
368
257
|
static formatSearchParams(params) {
|
|
@@ -406,6 +295,9 @@ function getFieldErrors(error) {
|
|
|
406
295
|
return null;
|
|
407
296
|
}
|
|
408
297
|
async function getAuthRefreshToken(refreshToken) {
|
|
298
|
+
if (refreshToken == null || refreshToken.trim() === "") {
|
|
299
|
+
return { token: null, success: false };
|
|
300
|
+
}
|
|
409
301
|
try {
|
|
410
302
|
const headers = {};
|
|
411
303
|
if (config.devPortalId) {
|
|
@@ -451,357 +343,38 @@ var setProfileData = (data) => {
|
|
|
451
343
|
var getProfileData = () => {
|
|
452
344
|
return PROFILE;
|
|
453
345
|
};
|
|
454
|
-
function convertToBase64(obj) {
|
|
455
|
-
try {
|
|
456
|
-
if (!obj) return "";
|
|
457
|
-
const json = JSON.stringify(obj);
|
|
458
|
-
const compressed = pako.deflate(json);
|
|
459
|
-
const base64 = Base64.fromUint8Array(compressed, true);
|
|
460
|
-
return base64;
|
|
461
|
-
} catch (error) {
|
|
462
|
-
console.error("Failed to encode object:", error);
|
|
463
|
-
return "";
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
function decodeToBase64(encoded) {
|
|
467
|
-
try {
|
|
468
|
-
if (!encoded) return null;
|
|
469
|
-
const uint8Array = Base64.toUint8Array(encoded);
|
|
470
|
-
const decompressed = pako.inflate(uint8Array, { to: "string" });
|
|
471
|
-
return JSON.parse(decompressed);
|
|
472
|
-
} catch (error) {
|
|
473
|
-
console.error("Failed to decode object:", error);
|
|
474
|
-
return null;
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
// src/breadcrumb/url-utils.ts
|
|
479
|
-
function mapKeysDeep(obj, keyMap2) {
|
|
480
|
-
if (Array.isArray(obj)) {
|
|
481
|
-
return obj.map((item) => mapKeysDeep(item, keyMap2));
|
|
482
|
-
} else if (obj !== null && typeof obj === "object") {
|
|
483
|
-
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
484
|
-
const mappedKey = keyMap2[key] || key;
|
|
485
|
-
acc[mappedKey] = mapKeysDeep(value, keyMap2);
|
|
486
|
-
return acc;
|
|
487
|
-
}, {});
|
|
488
|
-
}
|
|
489
|
-
return obj;
|
|
490
|
-
}
|
|
491
|
-
function isMessingParent(breadcrumbs) {
|
|
492
|
-
let lastItem = breadcrumbs[breadcrumbs.length - 1];
|
|
493
|
-
let lastItem2 = breadcrumbs[breadcrumbs.length - 2];
|
|
494
|
-
let lastItem3 = breadcrumbs[breadcrumbs.length - 3];
|
|
495
|
-
return lastItem?.o_r_id && (!lastItem2?.o_r_id && lastItem2?.o_t_id) && lastItem3?.o_r_id ? true : false;
|
|
496
|
-
}
|
|
497
|
-
function isMessingParentLastItem(breadcrumbs) {
|
|
498
|
-
let lastItem = breadcrumbs[breadcrumbs.length - 1];
|
|
499
|
-
let lastItem2 = breadcrumbs[breadcrumbs.length - 2];
|
|
500
|
-
return !lastItem?.o_t_id && (lastItem2?.o_r_id && lastItem2?.o_t_id) ? false : true;
|
|
501
|
-
}
|
|
502
|
-
function breadcrumbStage(breadcrumbItems) {
|
|
503
|
-
let breadcrumbType = "child";
|
|
504
|
-
if (breadcrumbItems.length === 1) {
|
|
505
|
-
breadcrumbType = "root";
|
|
506
|
-
} else if (breadcrumbItems.length === 2) {
|
|
507
|
-
breadcrumbType = "root_details";
|
|
508
|
-
}
|
|
509
|
-
return breadcrumbType;
|
|
510
|
-
}
|
|
511
|
-
var generateUrl = (props, breadcrumbs) => {
|
|
512
|
-
const newBase64 = convertToBase64(breadcrumbs);
|
|
513
|
-
let url2 = "";
|
|
514
|
-
if (props?.objectTypeId && props?.recordId) {
|
|
515
|
-
url2 = `/${props?.recordId}/${props?.objectTypeId}/${props?.recordId}?b=${newBase64}`;
|
|
516
|
-
} else {
|
|
517
|
-
url2 = `/association/${props?.objectTypeId}?b=${newBase64}`;
|
|
518
|
-
}
|
|
519
|
-
return url2;
|
|
520
|
-
};
|
|
521
|
-
function getTotalParentLength(data) {
|
|
522
|
-
return data.filter(
|
|
523
|
-
(item) => (item.pt || item.o_t_id) && !item.o_r_id
|
|
524
|
-
).length;
|
|
525
|
-
}
|
|
526
|
-
var generatePath = (breadcrumbs, breadcrumb, index) => {
|
|
527
|
-
const bc = convertToBase64(breadcrumbs.slice(0, index + 1));
|
|
528
|
-
if (index === 0) {
|
|
529
|
-
return {
|
|
530
|
-
name: breadcrumb?.n,
|
|
531
|
-
path: `/${breadcrumb?.pt || breadcrumb?.o_t_id}?b=${bc}`
|
|
532
|
-
};
|
|
533
|
-
} else if (index === 1) {
|
|
534
|
-
if (breadcrumb?.isHome) {
|
|
535
|
-
return {
|
|
536
|
-
name: breadcrumb?.n,
|
|
537
|
-
path: `/association/${breadcrumb?.o_t_id}?b=${bc}`
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
return {
|
|
541
|
-
name: breadcrumb?.n,
|
|
542
|
-
path: `/${breadcrumb?.o_r_id}/${breadcrumb?.o_t_id}/${breadcrumb?.o_r_id}?b=${bc}`
|
|
543
|
-
};
|
|
544
|
-
} else {
|
|
545
|
-
if (breadcrumb?.o_t_id && breadcrumb?.o_r_id && !breadcrumb?.isHome) {
|
|
546
|
-
return {
|
|
547
|
-
name: breadcrumb?.n,
|
|
548
|
-
path: `/${breadcrumb?.o_r_id}/${breadcrumb?.o_t_id}/${breadcrumb?.o_r_id}?b=${bc}`
|
|
549
|
-
};
|
|
550
|
-
} else {
|
|
551
|
-
return {
|
|
552
|
-
name: breadcrumb?.n,
|
|
553
|
-
path: `/association/${breadcrumb?.o_t_id}?b=${bc}`
|
|
554
|
-
};
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
};
|
|
558
346
|
|
|
559
|
-
// src/
|
|
560
|
-
var
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
sort: "sort",
|
|
564
|
-
o_t_id: "objectTypeId",
|
|
565
|
-
s: "search",
|
|
566
|
-
fPn: "filterPropertyName",
|
|
567
|
-
fO: "filterOperator",
|
|
568
|
-
fV: "filterValue",
|
|
569
|
-
c: "cache",
|
|
570
|
-
isPC: "isPrimaryCompany",
|
|
571
|
-
v: "view",
|
|
572
|
-
l: "limit",
|
|
573
|
-
pt: "path",
|
|
574
|
-
p: "page",
|
|
575
|
-
a: "after",
|
|
576
|
-
aPip: "activePipeline",
|
|
577
|
-
aT: "activeTab",
|
|
578
|
-
cT: "create",
|
|
579
|
-
dP: "display",
|
|
580
|
-
dL: "display_label",
|
|
581
|
-
pId: "pipeline_id"
|
|
582
|
-
};
|
|
583
|
-
|
|
584
|
-
// src/utils/param.ts
|
|
585
|
-
function getParam(paramName) {
|
|
586
|
-
if (typeof globalThis === "undefined" || !globalThis.location) return null;
|
|
587
|
-
const hash = globalThis.location.hash || "";
|
|
588
|
-
if (!hash.startsWith("#/")) return null;
|
|
589
|
-
const hashWithoutHash = hash.startsWith("#") ? hash.substring(1) : hash;
|
|
590
|
-
const queryString = hashWithoutHash.split("?")[1];
|
|
591
|
-
if (!queryString) return null;
|
|
592
|
-
const params = new URLSearchParams(queryString);
|
|
593
|
-
return params.get(paramName);
|
|
594
|
-
}
|
|
595
|
-
function getPath() {
|
|
596
|
-
if (typeof globalThis === "undefined" || !globalThis.location) return null;
|
|
597
|
-
const hash = globalThis.location.hash || "";
|
|
598
|
-
if (!hash.startsWith("#/")) return null;
|
|
599
|
-
return hash.slice(1).split("?")[0];
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
// src/breadcrumb/param.ts
|
|
603
|
-
var getRouteMenu = (path) => {
|
|
604
|
-
const apiRoutes = globalThis?.apiRoutes || [];
|
|
605
|
-
return apiRoutes.find((menu) => menu?.path === path);
|
|
606
|
-
};
|
|
607
|
-
var getRouteDetails = () => {
|
|
608
|
-
const search = getParam("b");
|
|
609
|
-
const breadcrumbs = decodeToBase64(search) || [];
|
|
610
|
-
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
|
611
|
-
const mapped = lastItem ? mapKeysDeep(lastItem, keyMap) : null;
|
|
612
|
-
return { routeDetails: mapped };
|
|
613
|
-
};
|
|
614
|
-
var getParamDetails = (props, isDetailsPage = false) => {
|
|
615
|
-
const search = getParam("b");
|
|
616
|
-
let breadcrumbs = decodeToBase64(search) || [];
|
|
617
|
-
if (breadcrumbs.length > 0 && breadcrumbs?.[0]?.isHome) {
|
|
618
|
-
breadcrumbs = breadcrumbs.slice(1);
|
|
619
|
-
}
|
|
620
|
-
let mediatorObjectTypeId = "";
|
|
621
|
-
let mediatorObjectRecordId = "";
|
|
622
|
-
let parentObjectTypeId = "";
|
|
623
|
-
let parentObjectRecordId = "";
|
|
624
|
-
let lastItem = breadcrumbs[breadcrumbs.length - 1];
|
|
625
|
-
const lastItem2 = breadcrumbs[breadcrumbs.length - 2];
|
|
626
|
-
const lastItem3 = breadcrumbs[breadcrumbs.length - 3];
|
|
627
|
-
if (isDetailsPage === true && lastItem && "prm" in lastItem) {
|
|
628
|
-
delete lastItem.prm;
|
|
347
|
+
// src/client/index.ts
|
|
348
|
+
var recordWriteContext = (paramsObject) => {
|
|
349
|
+
if (!paramsObject) {
|
|
350
|
+
return void 0;
|
|
629
351
|
}
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
if (!lastItem?.o_r_id && breadcrumbs.length > 2) {
|
|
642
|
-
parentObjectTypeId = lastItem2?.o_t_id || "";
|
|
643
|
-
parentObjectRecordId = lastItem2?.o_r_id || "";
|
|
644
|
-
}
|
|
645
|
-
if (lastItem?.o_r_id && breadcrumbs.length > 2) {
|
|
646
|
-
parentObjectTypeId = lastItem3?.o_t_id || "";
|
|
647
|
-
parentObjectRecordId = lastItem3?.o_r_id || "";
|
|
648
|
-
}
|
|
649
|
-
if (lastItem2?.o_t_id === "0-5" && !parentObjectTypeId && !parentObjectRecordId) {
|
|
650
|
-
parentObjectTypeId = lastItem2?.o_t_id || "";
|
|
651
|
-
parentObjectRecordId = lastItem2?.o_r_id || "";
|
|
652
|
-
}
|
|
352
|
+
const context = {};
|
|
353
|
+
const keys = [
|
|
354
|
+
"parentObjectTypeId",
|
|
355
|
+
"parentObjectRecordId",
|
|
356
|
+
"mediatorObjectTypeId",
|
|
357
|
+
"mediatorObjectRecordId"
|
|
358
|
+
];
|
|
359
|
+
keys.forEach((key) => {
|
|
360
|
+
const value = paramsObject[key];
|
|
361
|
+
if (value !== void 0 && value !== null && String(value).length > 0) {
|
|
362
|
+
context[key] = String(value);
|
|
653
363
|
}
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
if (breadcrumbs[0]?.prm?.isPC || breadcrumbs[1]?.prm?.isPC || lastItem?.prm?.isPC) {
|
|
657
|
-
paramsObject["isPrimaryCompany"] = true;
|
|
658
|
-
}
|
|
659
|
-
if (parentObjectTypeId && parentObjectRecordId) {
|
|
660
|
-
paramsObject["parentObjectTypeId"] = parentObjectTypeId;
|
|
661
|
-
paramsObject["parentObjectRecordId"] = parentObjectRecordId;
|
|
662
|
-
}
|
|
663
|
-
if (mediatorObjectTypeId && mediatorObjectRecordId) {
|
|
664
|
-
paramsObject["mediatorObjectTypeId"] = mediatorObjectTypeId;
|
|
665
|
-
paramsObject["mediatorObjectRecordId"] = mediatorObjectRecordId;
|
|
666
|
-
}
|
|
667
|
-
const mappedLastItemParam = Object.fromEntries(
|
|
668
|
-
Object.entries(lastItem?.prm || {}).map(([key, value]) => [
|
|
669
|
-
keyMap[key] || key,
|
|
670
|
-
// use mapped name if exists, else keep original
|
|
671
|
-
value
|
|
672
|
-
])
|
|
673
|
-
);
|
|
674
|
-
let queryString = null;
|
|
675
|
-
if (props?.type === "association") {
|
|
676
|
-
queryString = new URLSearchParams({ ...paramsObject, ...{ cache: false } }).toString();
|
|
677
|
-
} else {
|
|
678
|
-
queryString = new URLSearchParams({ ...paramsObject, ...mappedLastItemParam }).toString();
|
|
679
|
-
}
|
|
680
|
-
let params = queryString ? `?${queryString}` : "";
|
|
681
|
-
const totalParentLength = getTotalParentLength(breadcrumbs);
|
|
682
|
-
let parentAccessLabel = false;
|
|
683
|
-
if (breadcrumbs[0]?.prm?.isPC && totalParentLength > 2 || // company object
|
|
684
|
-
!breadcrumbs[0]?.prm?.isPC && totalParentLength > 3 || // normal object
|
|
685
|
-
breadcrumbs[0]?.prm?.isPC && totalParentLength > 1 && props?.type === "ticket" || // company ticket
|
|
686
|
-
!breadcrumbs[0]?.prm?.isPC && totalParentLength > 2 && props?.type === "ticket") {
|
|
687
|
-
parentAccessLabel = true;
|
|
688
|
-
}
|
|
689
|
-
return {
|
|
690
|
-
breadcrumbs,
|
|
691
|
-
// paramsObject: Object.keys(mParamsObject).length === 0 ? null : mParamsObject,
|
|
692
|
-
paramsObject,
|
|
693
|
-
params,
|
|
694
|
-
parentAccessLabel
|
|
695
|
-
};
|
|
364
|
+
});
|
|
365
|
+
return Object.keys(context).length > 0 ? context : void 0;
|
|
696
366
|
};
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
var useUpdateLink = () => {
|
|
703
|
-
const updateLink = async (props, displayName = "prm") => {
|
|
704
|
-
const search = getParam("b");
|
|
705
|
-
const pathname = getPath();
|
|
706
|
-
let breadcrumbs = decodeToBase64(search) || [];
|
|
707
|
-
if (breadcrumbs.length < 1) {
|
|
708
|
-
const routeMenu = getRouteMenu(pathname);
|
|
709
|
-
breadcrumbs = [
|
|
710
|
-
{
|
|
711
|
-
n: routeMenu?.title,
|
|
712
|
-
pt: routeMenu?.path
|
|
713
|
-
}
|
|
714
|
-
];
|
|
715
|
-
}
|
|
716
|
-
const lastBreadcrumb = breadcrumbs[breadcrumbs.length - 1];
|
|
717
|
-
let udatedBreadcrumb = null;
|
|
718
|
-
if (displayName) {
|
|
719
|
-
const ex = await getDeep(lastBreadcrumb, displayName) || {};
|
|
720
|
-
udatedBreadcrumb = await setDeep(lastBreadcrumb, displayName, {
|
|
721
|
-
...ex,
|
|
722
|
-
...props
|
|
723
|
-
});
|
|
724
|
-
} else {
|
|
725
|
-
udatedBreadcrumb = Object.assign(lastBreadcrumb, props);
|
|
726
|
-
}
|
|
727
|
-
breadcrumbs[breadcrumbs.length - 1] = udatedBreadcrumb;
|
|
728
|
-
const newBase64 = convertToBase64(breadcrumbs);
|
|
729
|
-
updateBParam(newBase64);
|
|
730
|
-
};
|
|
731
|
-
function setDeep(obj, path, value) {
|
|
732
|
-
const keys = path.split(".");
|
|
733
|
-
let curr = obj;
|
|
734
|
-
for (let i = 0; i < keys.length - 1; i++) {
|
|
735
|
-
if (!curr[keys[i]] || typeof curr[keys[i]] !== "object") {
|
|
736
|
-
curr[keys[i]] = {};
|
|
737
|
-
}
|
|
738
|
-
curr = curr[keys[i]];
|
|
739
|
-
}
|
|
740
|
-
curr[keys[keys.length - 1]] = value;
|
|
741
|
-
return curr;
|
|
367
|
+
var mergeRecordWriteBody = (payload, paramsObject, options) => {
|
|
368
|
+
const base = { ...payload || {} };
|
|
369
|
+
const context = recordWriteContext(paramsObject);
|
|
370
|
+
if (context) {
|
|
371
|
+
base.context = context;
|
|
742
372
|
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
}
|
|
746
|
-
const getLinkParams = (displayName = "prm") => {
|
|
747
|
-
const search = getParam("b");
|
|
748
|
-
let breadcrumbs = decodeToBase64(search) || [];
|
|
749
|
-
if (breadcrumbs.length < 1) return null;
|
|
750
|
-
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
|
751
|
-
const getDeep2 = (obj, path) => {
|
|
752
|
-
return path.split(".").reduce((acc, key) => acc?.[key], obj);
|
|
753
|
-
};
|
|
754
|
-
const expandKeys = (obj) => {
|
|
755
|
-
return Object.fromEntries(
|
|
756
|
-
Object.entries(obj).map(([key, value]) => [
|
|
757
|
-
keyMap[key] || key,
|
|
758
|
-
// map if exists, else keep original
|
|
759
|
-
value
|
|
760
|
-
])
|
|
761
|
-
);
|
|
762
|
-
};
|
|
763
|
-
const nestedValue = displayName ? getDeep2(lastItem, displayName) : null;
|
|
764
|
-
const output = nestedValue ? expandKeys(nestedValue) : null;
|
|
765
|
-
return output;
|
|
766
|
-
};
|
|
767
|
-
const filterParams = (displayName = "prm") => {
|
|
768
|
-
const search = getParam("b");
|
|
769
|
-
let breadcrumbs = decodeToBase64(search) || [];
|
|
770
|
-
if (breadcrumbs.length < 1) return null;
|
|
771
|
-
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
|
772
|
-
const getDeep2 = (obj, path) => {
|
|
773
|
-
return path.split(".").reduce((acc, key) => acc?.[key], obj);
|
|
774
|
-
};
|
|
775
|
-
const expandKeys = (obj) => {
|
|
776
|
-
return Object.fromEntries(
|
|
777
|
-
Object.entries(obj).map(([key, value]) => [
|
|
778
|
-
keyMap[key] || key,
|
|
779
|
-
// map if exists, else keep original
|
|
780
|
-
value
|
|
781
|
-
])
|
|
782
|
-
);
|
|
783
|
-
};
|
|
784
|
-
const nestedValue = displayName ? getDeep2(lastItem, displayName) : null;
|
|
785
|
-
const output = nestedValue ? expandKeys(nestedValue) : expandKeys(lastItem);
|
|
786
|
-
return output;
|
|
787
|
-
};
|
|
788
|
-
return { updateLink, getLinkParams, filterParams };
|
|
789
|
-
};
|
|
790
|
-
var updateBParam = (newValue) => {
|
|
791
|
-
if (typeof globalThis === "undefined" || !globalThis.location) return;
|
|
792
|
-
const hash = globalThis.location.hash || "";
|
|
793
|
-
if (!hash.startsWith("#/")) return;
|
|
794
|
-
const withoutHash = hash.slice(2);
|
|
795
|
-
const [path, queryString] = withoutHash.split("?");
|
|
796
|
-
const params = new URLSearchParams(queryString || "");
|
|
797
|
-
params.set("b", newValue);
|
|
798
|
-
const newHash = `#/${path}?${params.toString()}`;
|
|
799
|
-
if (typeof globalThis !== "undefined" && globalThis.history && globalThis.history.replaceState) {
|
|
800
|
-
globalThis.history.replaceState(null, "", newHash);
|
|
373
|
+
if (options && Object.keys(options).length > 0) {
|
|
374
|
+
base.options = options;
|
|
801
375
|
}
|
|
376
|
+
return base;
|
|
802
377
|
};
|
|
803
|
-
|
|
804
|
-
// src/clint/index.ts
|
|
805
378
|
var Client = {
|
|
806
379
|
authentication: {
|
|
807
380
|
preLogin: (data) => AuthHttpClient.post(API_ENDPOINTS.PRE_LOGIN, data),
|
|
@@ -821,8 +394,8 @@ var Client = {
|
|
|
821
394
|
resetPasswordVerifyToken: (data) => AuthHttpClient.post(API_ENDPOINTS.RESET_PASSWORD_VERIFY_TOKEN, data),
|
|
822
395
|
resetPassword: (data) => AuthHttpClient.post(API_ENDPOINTS.RESET_PASSWORD, data),
|
|
823
396
|
forgetPassword: (data) => AuthHttpClient.post(API_ENDPOINTS.FORGET_PASSWORD, data),
|
|
824
|
-
registerExistingUser: (data) => AuthHttpClient.post(API_ENDPOINTS.REGISTER_EXISTING_USER, data),
|
|
825
|
-
verifyEmailResend: (data) => AuthHttpClient.post(API_ENDPOINTS.
|
|
397
|
+
registerExistingUser: (data) => AuthHttpClient.post(API_ENDPOINTS.REGISTER_EXISTING_USER, data?.payload),
|
|
398
|
+
verifyEmailResend: (data) => AuthHttpClient.post(API_ENDPOINTS.VERIFY_EMAIL_RESEND, data),
|
|
826
399
|
resendEmail: (data) => AuthHttpClient.post(API_ENDPOINTS.RESEND_EMAIL, data),
|
|
827
400
|
logout: () => HttpClient.post(API_ENDPOINTS.LOGOUT, null)
|
|
828
401
|
},
|
|
@@ -851,7 +424,7 @@ var Client = {
|
|
|
851
424
|
apiParams.parentObjectTypeId = "0-2";
|
|
852
425
|
}
|
|
853
426
|
apiParams.isPrimaryCompany = param?.isPrimaryCompany;
|
|
854
|
-
apiParams.cache = payload?.
|
|
427
|
+
apiParams.cache = payload?.cache;
|
|
855
428
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.PIPELINES, params, queryParams: apiParams });
|
|
856
429
|
return HttpClient.get(apiUrl);
|
|
857
430
|
}
|
|
@@ -859,7 +432,7 @@ var Client = {
|
|
|
859
432
|
stage: {
|
|
860
433
|
list: (props = null) => {
|
|
861
434
|
const params = {
|
|
862
|
-
hubId: config.hubId,
|
|
435
|
+
// hubId: config.hubId,
|
|
863
436
|
// portalId: portalId,
|
|
864
437
|
objectTypeId: props?.params?.objectTypeId,
|
|
865
438
|
pipelineId: props?.params?.pipelineId
|
|
@@ -870,6 +443,7 @@ var Client = {
|
|
|
870
443
|
},
|
|
871
444
|
object: {
|
|
872
445
|
list: async (payload = null, param = null) => {
|
|
446
|
+
param.cache = payload.cache;
|
|
873
447
|
const params = { hubspotObjectTypeId: payload?.hubspotObjectTypeId };
|
|
874
448
|
const { updateLink, getLinkParams } = useUpdateLink();
|
|
875
449
|
const { getParamDetails: getParamDetails2 } = routeParam;
|
|
@@ -916,52 +490,88 @@ var Client = {
|
|
|
916
490
|
}
|
|
917
491
|
if (payload?.isHome) {
|
|
918
492
|
let parentObjectTypeId = "";
|
|
919
|
-
if (userData?.info?.objectTypeId && !param?.isPrimaryCompany) {
|
|
920
|
-
parentObjectTypeId = userData?.info?.objectTypeId;
|
|
921
|
-
} else if (userData?.info?.objectTypeId && param?.isPrimaryCompany) {
|
|
493
|
+
if (userData?.data?.info?.objectTypeId && !param?.isPrimaryCompany) {
|
|
494
|
+
parentObjectTypeId = userData?.data?.info?.objectTypeId;
|
|
495
|
+
} else if (userData?.data?.info?.objectTypeId && param?.isPrimaryCompany) {
|
|
922
496
|
parentObjectTypeId = "0-2";
|
|
923
497
|
}
|
|
924
498
|
param.parentObjectTypeId = parentObjectTypeId;
|
|
925
499
|
}
|
|
926
500
|
param.parentAccessLabel = parentAccessLabel;
|
|
501
|
+
const {
|
|
502
|
+
stageId,
|
|
503
|
+
nextPage
|
|
504
|
+
} = useTable();
|
|
505
|
+
if (stageId) {
|
|
506
|
+
param.stageId = stageId;
|
|
507
|
+
}
|
|
508
|
+
if (param?.view === "BOARD") {
|
|
509
|
+
param.page = nextPage;
|
|
510
|
+
}
|
|
927
511
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS, params, queryParams: param });
|
|
928
512
|
return HttpClient.get(apiUrl);
|
|
929
513
|
},
|
|
514
|
+
sideBarList: async (payload = null) => {
|
|
515
|
+
const hubspotObjectTypeId = payload?.hubspotObjectTypeId;
|
|
516
|
+
const params = { hubspotObjectTypeId };
|
|
517
|
+
const queryParams = payload.param;
|
|
518
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS, params, queryParams });
|
|
519
|
+
return HttpClient.get(apiUrl);
|
|
520
|
+
},
|
|
930
521
|
form: (payload = null) => {
|
|
931
522
|
const params = { hubspotObjectTypeId: payload?.hubspotObjectTypeId };
|
|
932
|
-
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.
|
|
523
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_FORM, params, queryParams: payload?.params });
|
|
933
524
|
return HttpClient.get(apiUrl);
|
|
934
525
|
},
|
|
935
526
|
objectFormOptions: (payload = null) => {
|
|
936
|
-
const params = {
|
|
527
|
+
const params = {
|
|
528
|
+
formId: payload?.formId,
|
|
529
|
+
objectTypeId: payload?.objectTypeId ?? payload?.hubspotObjectTypeId
|
|
530
|
+
};
|
|
937
531
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_FORM_OPTIONS, params, queryParams: payload?.params });
|
|
938
532
|
return HttpClient.get(apiUrl);
|
|
939
533
|
},
|
|
940
534
|
create: (props = null) => {
|
|
535
|
+
const { getParamDetails: getParamDetailsForCreate } = routeParam;
|
|
536
|
+
const { paramsObject } = getParamDetailsForCreate({ type: props?.componentName });
|
|
537
|
+
const cardParentMerge = props?.componentName === "association" ? true : false;
|
|
538
|
+
const body = mergeRecordWriteBody(props?.payload, paramsObject, {
|
|
539
|
+
cardParentMerge,
|
|
540
|
+
addAnother: props?.params?.addAnother
|
|
541
|
+
});
|
|
941
542
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId };
|
|
942
|
-
const
|
|
943
|
-
|
|
944
|
-
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_CREATE, params, queryParams });
|
|
945
|
-
return HttpClient.post(apiUrl, payload);
|
|
543
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.RECORDS_CREATE, params, queryParams: props?.params });
|
|
544
|
+
return HttpClient.post(apiUrl, body);
|
|
946
545
|
},
|
|
947
546
|
createExisting: (props = null) => {
|
|
948
|
-
const
|
|
949
|
-
const
|
|
547
|
+
const { getLinkParams } = useUpdateLink();
|
|
548
|
+
const fParams = getLinkParams();
|
|
549
|
+
const queryParams = { ...fParams, ...props?.params };
|
|
550
|
+
const params = {
|
|
551
|
+
fromObjectTypeId: props?.fromObjectTypeId ?? props?.hubspotObjectTypeId,
|
|
552
|
+
fromRecordId: props?.fromRecordId,
|
|
553
|
+
toObjectTypeId: props?.toObjectTypeId
|
|
554
|
+
};
|
|
950
555
|
const payload = props.payload;
|
|
951
|
-
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.
|
|
556
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.RECORDS_ASSOCIATE, params, queryParams });
|
|
952
557
|
return HttpClient.post(apiUrl, payload);
|
|
953
558
|
},
|
|
954
559
|
removeExisting: (props = null) => {
|
|
955
|
-
const
|
|
956
|
-
const
|
|
957
|
-
const
|
|
958
|
-
const
|
|
959
|
-
|
|
560
|
+
const { getParamDetails: getParamDetailsForRemove } = routeParam;
|
|
561
|
+
const { paramsObject } = getParamDetailsForRemove({ type: props?.componentName });
|
|
562
|
+
const body = mergeRecordWriteBody(props?.payload, paramsObject, void 0);
|
|
563
|
+
const params = {
|
|
564
|
+
fromObjectTypeId: props?.fromObjectTypeId ?? props?.hubspotObjectTypeId,
|
|
565
|
+
fromRecordId: props?.fromRecordId,
|
|
566
|
+
toObjectTypeId: props?.toObjectTypeId
|
|
567
|
+
};
|
|
568
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.RECORDS_DISASSOCIATE, params });
|
|
569
|
+
return HttpClient.delete(apiUrl, { data: body });
|
|
960
570
|
},
|
|
961
571
|
details: (props = null) => {
|
|
962
572
|
const { paramsObject: urlParam, parentAccessLabel } = getParamDetails("", true);
|
|
963
573
|
const params = {
|
|
964
|
-
hubId: config.hubId,
|
|
574
|
+
// hubId: config.hubId,
|
|
965
575
|
// portalId: portalId,
|
|
966
576
|
objectId: props?.params?.objectId,
|
|
967
577
|
id: props?.params?.id
|
|
@@ -975,24 +585,29 @@ var Client = {
|
|
|
975
585
|
return HttpClient.get(apiUrl);
|
|
976
586
|
},
|
|
977
587
|
update: (props = null) => {
|
|
978
|
-
const portalId = getPortal()?.portalId;
|
|
979
588
|
const params = {
|
|
980
|
-
hubId: config.hubId,
|
|
981
|
-
portalId,
|
|
982
589
|
objectId: props?.params?.objectId,
|
|
983
590
|
id: props?.params?.id
|
|
984
591
|
};
|
|
985
|
-
const {
|
|
986
|
-
const
|
|
987
|
-
|
|
592
|
+
const { getParamDetails: getParamDetailsForUpdate } = routeParam;
|
|
593
|
+
const { paramsObject } = getParamDetailsForUpdate({ type: props?.componentName });
|
|
594
|
+
const cardParentMerge = props?.componentName === "association" ? true : false;
|
|
595
|
+
const rawPayload = props?.payload || {};
|
|
596
|
+
const properties = rawPayload.properties ?? rawPayload.propertyPayload ?? rawPayload;
|
|
597
|
+
const body = mergeRecordWriteBody(
|
|
598
|
+
{ properties },
|
|
599
|
+
paramsObject,
|
|
600
|
+
{ cardParentMerge }
|
|
601
|
+
);
|
|
602
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.RECORDS_UPDATE, params });
|
|
603
|
+
return HttpClient.put(apiUrl, body);
|
|
988
604
|
}
|
|
989
605
|
},
|
|
990
606
|
note: {
|
|
991
607
|
list: (props = null) => {
|
|
992
|
-
const portalId = getPortal()?.portalId;
|
|
993
608
|
const params = {
|
|
994
|
-
hubId: config.hubId,
|
|
995
|
-
portalId,
|
|
609
|
+
// hubId: config.hubId,
|
|
610
|
+
// portalId: portalId,
|
|
996
611
|
objectId: props?.params?.objectId,
|
|
997
612
|
id: props?.params?.id
|
|
998
613
|
};
|
|
@@ -1007,10 +622,9 @@ var Client = {
|
|
|
1007
622
|
return HttpClient.post(apiUrl, payload);
|
|
1008
623
|
},
|
|
1009
624
|
update: (props = null) => {
|
|
1010
|
-
const portalId = getPortal()?.portalId;
|
|
1011
625
|
const params = {
|
|
1012
|
-
hubId: config.hubId,
|
|
1013
|
-
portalId,
|
|
626
|
+
// hubId: config.hubId,
|
|
627
|
+
// portalId: portalId,
|
|
1014
628
|
objectId: props?.params?.objectId,
|
|
1015
629
|
id: props?.params?.id,
|
|
1016
630
|
note_id: props?.params?.note_id
|
|
@@ -1048,10 +662,9 @@ var Client = {
|
|
|
1048
662
|
},
|
|
1049
663
|
email: {
|
|
1050
664
|
list: (props = null) => {
|
|
1051
|
-
const portalId = getPortal()?.portalId;
|
|
1052
665
|
const params = {
|
|
1053
|
-
hubId: config.hubId,
|
|
1054
|
-
portalId,
|
|
666
|
+
// hubId: config.hubId,
|
|
667
|
+
// portalId: portalId,
|
|
1055
668
|
objectId: props?.params?.objectId,
|
|
1056
669
|
id: props?.params?.id
|
|
1057
670
|
};
|
|
@@ -1066,13 +679,12 @@ var Client = {
|
|
|
1066
679
|
return HttpClient.post(apiUrl, payload);
|
|
1067
680
|
},
|
|
1068
681
|
update: (props = null) => {
|
|
1069
|
-
const portalId = getPortal()?.portalId;
|
|
1070
682
|
const params = {
|
|
1071
|
-
hubId: config.hubId,
|
|
1072
|
-
portalId,
|
|
683
|
+
// hubId: config.hubId,
|
|
684
|
+
// portalId: portalId,
|
|
1073
685
|
objectId: props?.params?.objectId,
|
|
1074
686
|
id: props?.params?.id,
|
|
1075
|
-
|
|
687
|
+
email_id: props?.params?.email_id ?? props?.params?.note_id
|
|
1076
688
|
};
|
|
1077
689
|
const { paramsObject: queryParams } = getParamDetails();
|
|
1078
690
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS_DETAILS_UPDATE, params, queryParams });
|
|
@@ -1105,12 +717,24 @@ var Client = {
|
|
|
1105
717
|
});
|
|
1106
718
|
}
|
|
1107
719
|
},
|
|
720
|
+
cache: {
|
|
721
|
+
purge: (body, headers) => {
|
|
722
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.CACHE_PURGE });
|
|
723
|
+
return HttpClient.post(apiUrl, body, headers ? { headers } : void 0);
|
|
724
|
+
},
|
|
725
|
+
purgeStatus: (purgeJobId) => {
|
|
726
|
+
const apiUrl = generateApiUrl({
|
|
727
|
+
route: API_ENDPOINTS.CACHE_PURGE_STATUS,
|
|
728
|
+
params: { purgeJobId }
|
|
729
|
+
});
|
|
730
|
+
return HttpClient.get(apiUrl);
|
|
731
|
+
}
|
|
732
|
+
},
|
|
1108
733
|
file: {
|
|
1109
734
|
list: (props = null) => {
|
|
1110
|
-
const portalId = getPortal()?.portalId;
|
|
1111
735
|
const params = {
|
|
1112
|
-
hubId: config.hubId,
|
|
1113
|
-
portalId,
|
|
736
|
+
// hubId: config.hubId,
|
|
737
|
+
// portalId: portalId,
|
|
1114
738
|
objectId: props?.params?.objectId,
|
|
1115
739
|
id: props?.params?.id
|
|
1116
740
|
};
|
|
@@ -1118,10 +742,9 @@ var Client = {
|
|
|
1118
742
|
return HttpClient.get(apiUrl);
|
|
1119
743
|
},
|
|
1120
744
|
details: (props = null) => {
|
|
1121
|
-
const portalId = getPortal()?.portalId;
|
|
1122
745
|
const params = {
|
|
1123
|
-
hubId: config.hubId,
|
|
1124
|
-
portalId,
|
|
746
|
+
// hubId: config.hubId,
|
|
747
|
+
// portalId: portalId,
|
|
1125
748
|
objectId: props?.params?.objectId,
|
|
1126
749
|
id: props?.params?.id,
|
|
1127
750
|
rowId: props?.params?.rowId
|
|
@@ -1129,6 +752,15 @@ var Client = {
|
|
|
1129
752
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.FILE, params, queryParams: props?.queryParams });
|
|
1130
753
|
return HttpClient.get(apiUrl);
|
|
1131
754
|
},
|
|
755
|
+
download: (props = null) => {
|
|
756
|
+
const params = {
|
|
757
|
+
objectId: props?.params?.objectId,
|
|
758
|
+
id: props?.params?.id,
|
|
759
|
+
rowId: props?.params?.rowId
|
|
760
|
+
};
|
|
761
|
+
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.FILE_DOWNLOAD, params, queryParams: props?.queryParams });
|
|
762
|
+
return HttpClient.post(apiUrl, {});
|
|
763
|
+
},
|
|
1132
764
|
addFolder: (props = null) => {
|
|
1133
765
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
|
|
1134
766
|
const queryParams = props.queryParams;
|
|
@@ -1151,6 +783,25 @@ var Client = {
|
|
|
1151
783
|
}
|
|
1152
784
|
}
|
|
1153
785
|
};
|
|
786
|
+
function logError(context, error) {
|
|
787
|
+
if (axios.isAxiosError(error)) {
|
|
788
|
+
resetAllStore();
|
|
789
|
+
console.error(context, {
|
|
790
|
+
message: error.message,
|
|
791
|
+
status: error.response?.status,
|
|
792
|
+
statusText: error.response?.statusText,
|
|
793
|
+
data: error.response?.data,
|
|
794
|
+
url: error.config?.url,
|
|
795
|
+
method: error.config?.method
|
|
796
|
+
});
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
if (error instanceof Error) {
|
|
800
|
+
console.error(context, error.message, error);
|
|
801
|
+
return;
|
|
802
|
+
}
|
|
803
|
+
console.error(context, error);
|
|
804
|
+
}
|
|
1154
805
|
|
|
1155
806
|
// src/mutation/createMutation.ts
|
|
1156
807
|
function createMutation(mutationFn, options) {
|
|
@@ -1171,6 +822,7 @@ function createMutation(mutationFn, options) {
|
|
|
1171
822
|
return response;
|
|
1172
823
|
} catch (error) {
|
|
1173
824
|
options?.onError?.(error, payload);
|
|
825
|
+
logError("[mutation]", error);
|
|
1174
826
|
throw error;
|
|
1175
827
|
} finally {
|
|
1176
828
|
inFlight -= 1;
|
|
@@ -1184,9 +836,6 @@ function createMutation(mutationFn, options) {
|
|
|
1184
836
|
}
|
|
1185
837
|
|
|
1186
838
|
// src/apis/authentication.ts
|
|
1187
|
-
init_auth_utils();
|
|
1188
|
-
init_cookie();
|
|
1189
|
-
init_token_store();
|
|
1190
839
|
function preLogin(options) {
|
|
1191
840
|
const { mutate, isLoading } = createMutation(
|
|
1192
841
|
async (payload) => {
|
|
@@ -1440,242 +1089,6 @@ function changePassword(options) {
|
|
|
1440
1089
|
};
|
|
1441
1090
|
}
|
|
1442
1091
|
|
|
1443
|
-
// src/store/index.ts
|
|
1444
|
-
function createStore(initializer) {
|
|
1445
|
-
let state;
|
|
1446
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
1447
|
-
const get = () => state;
|
|
1448
|
-
const set = (partial) => {
|
|
1449
|
-
const prevState = state;
|
|
1450
|
-
const partialState = typeof partial === "function" ? partial(state) : partial;
|
|
1451
|
-
state = {
|
|
1452
|
-
...state,
|
|
1453
|
-
...partialState
|
|
1454
|
-
};
|
|
1455
|
-
listeners.forEach(
|
|
1456
|
-
(listener) => listener(state, prevState)
|
|
1457
|
-
);
|
|
1458
|
-
};
|
|
1459
|
-
const subscribe = (listener) => {
|
|
1460
|
-
listeners.add(listener);
|
|
1461
|
-
return () => listeners.delete(listener);
|
|
1462
|
-
};
|
|
1463
|
-
state = initializer(set, get);
|
|
1464
|
-
return {
|
|
1465
|
-
getState: get,
|
|
1466
|
-
setState: set,
|
|
1467
|
-
subscribe
|
|
1468
|
-
};
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
|
-
// src/utils/getCookieData.ts
|
|
1472
|
-
init_cookie();
|
|
1473
|
-
var getAuthSubscriptionType = () => {
|
|
1474
|
-
return getCookie("subscriptionType");
|
|
1475
|
-
};
|
|
1476
|
-
|
|
1477
|
-
// src/store/use-table.ts
|
|
1478
|
-
var pageLimit = 10;
|
|
1479
|
-
var tableStore = createStore((set, get) => ({
|
|
1480
|
-
// ==============================
|
|
1481
|
-
// STATE
|
|
1482
|
-
// ==============================
|
|
1483
|
-
tableUniqueId: null,
|
|
1484
|
-
gridData: [],
|
|
1485
|
-
sort: "-hs_createdate",
|
|
1486
|
-
limit: 10,
|
|
1487
|
-
after: "",
|
|
1488
|
-
page: 1,
|
|
1489
|
-
totalItems: 1,
|
|
1490
|
-
numOfPages: 1,
|
|
1491
|
-
currentPage: 1,
|
|
1492
|
-
search: "",
|
|
1493
|
-
filterPropertyName: "hs_pipeline",
|
|
1494
|
-
filterOperator: "eq",
|
|
1495
|
-
filterValue: "",
|
|
1496
|
-
isPrimaryCompany: null,
|
|
1497
|
-
view: null,
|
|
1498
|
-
selectedPipeline: "",
|
|
1499
|
-
tableParam: {},
|
|
1500
|
-
tableDefPermissions: {},
|
|
1501
|
-
// ==============================
|
|
1502
|
-
// BASIC SETTERS
|
|
1503
|
-
// ==============================
|
|
1504
|
-
setTableUniqueId: (v) => set({ tableUniqueId: v }),
|
|
1505
|
-
setSort: (v) => set({ sort: v }),
|
|
1506
|
-
setLimit: (v) => set({ limit: v }),
|
|
1507
|
-
setAfter: (v) => set({ after: v }),
|
|
1508
|
-
setPage: (v) => set({ page: v }),
|
|
1509
|
-
setTotalItems: (v) => set({ totalItems: v }),
|
|
1510
|
-
setNumOfPages: (v) => set({ numOfPages: v }),
|
|
1511
|
-
setCurrentPage: (v) => set({ currentPage: v }),
|
|
1512
|
-
setSearch: (v) => set({ search: v }),
|
|
1513
|
-
setFilterPropertyName: (v) => set({ filterPropertyName: v }),
|
|
1514
|
-
setFilterOperator: (v) => set({ filterOperator: v }),
|
|
1515
|
-
setFilterValue: (v) => set({ filterValue: v }),
|
|
1516
|
-
setIsPrimaryCompany: (v) => set({ isPrimaryCompany: v }),
|
|
1517
|
-
// ==============================
|
|
1518
|
-
// VIEW
|
|
1519
|
-
// ==============================
|
|
1520
|
-
setView: (mView) => {
|
|
1521
|
-
set({
|
|
1522
|
-
page: getAuthSubscriptionType() === "FREE" ? "" : 1,
|
|
1523
|
-
view: mView
|
|
1524
|
-
});
|
|
1525
|
-
},
|
|
1526
|
-
// ==============================
|
|
1527
|
-
// PIPELINE
|
|
1528
|
-
// ==============================
|
|
1529
|
-
changePipeline: (mView) => {
|
|
1530
|
-
set({
|
|
1531
|
-
page: getAuthSubscriptionType() === "FREE" ? "" : 1,
|
|
1532
|
-
selectedPipeline: mView || ""
|
|
1533
|
-
});
|
|
1534
|
-
},
|
|
1535
|
-
setSelectedPipeline: (pipelines, pipeLineId) => {
|
|
1536
|
-
let filterValue = "";
|
|
1537
|
-
if (pipeLineId) {
|
|
1538
|
-
const pipelineSingle = pipelines.find(
|
|
1539
|
-
(pipeline) => pipeline.pipelineId === pipeLineId
|
|
1540
|
-
);
|
|
1541
|
-
filterValue = pipelineSingle?.pipelineId || "";
|
|
1542
|
-
}
|
|
1543
|
-
set({
|
|
1544
|
-
filterPropertyName: "hs_pipeline",
|
|
1545
|
-
filterOperator: "eq",
|
|
1546
|
-
filterValue,
|
|
1547
|
-
selectedPipeline: filterValue
|
|
1548
|
-
});
|
|
1549
|
-
},
|
|
1550
|
-
// ==============================
|
|
1551
|
-
// RESET
|
|
1552
|
-
// ==============================
|
|
1553
|
-
resetTableParam: () => {
|
|
1554
|
-
set({
|
|
1555
|
-
sort: "-hs_createdate",
|
|
1556
|
-
limit: pageLimit,
|
|
1557
|
-
after: "",
|
|
1558
|
-
page: getAuthSubscriptionType() === "FREE" ? "" : 1,
|
|
1559
|
-
totalItems: 1,
|
|
1560
|
-
numOfPages: 1,
|
|
1561
|
-
currentPage: 1,
|
|
1562
|
-
search: "",
|
|
1563
|
-
filterPropertyName: "hs_pipeline",
|
|
1564
|
-
filterOperator: "eq",
|
|
1565
|
-
filterValue: "",
|
|
1566
|
-
isPrimaryCompany: null,
|
|
1567
|
-
selectedPipeline: ""
|
|
1568
|
-
});
|
|
1569
|
-
},
|
|
1570
|
-
// ==============================
|
|
1571
|
-
// PARAM BUILDER
|
|
1572
|
-
// ==============================
|
|
1573
|
-
getTableParam: (companyAsMediator, currentPageOverride) => {
|
|
1574
|
-
const state = get();
|
|
1575
|
-
const baseParams = {
|
|
1576
|
-
sort: state.sort,
|
|
1577
|
-
search: state.search,
|
|
1578
|
-
filterPropertyName: state.filterPropertyName,
|
|
1579
|
-
filterOperator: state.filterOperator,
|
|
1580
|
-
filterValue: state.selectedPipeline,
|
|
1581
|
-
cache: true,
|
|
1582
|
-
isPrimaryCompany: companyAsMediator || false,
|
|
1583
|
-
view: state.view
|
|
1584
|
-
};
|
|
1585
|
-
if (getAuthSubscriptionType() === "FREE") {
|
|
1586
|
-
return {
|
|
1587
|
-
...baseParams,
|
|
1588
|
-
after: state.page
|
|
1589
|
-
};
|
|
1590
|
-
}
|
|
1591
|
-
return {
|
|
1592
|
-
...baseParams,
|
|
1593
|
-
limit: state.limit,
|
|
1594
|
-
page: currentPageOverride || state.page,
|
|
1595
|
-
...state.after && {
|
|
1596
|
-
after: state.after
|
|
1597
|
-
}
|
|
1598
|
-
};
|
|
1599
|
-
},
|
|
1600
|
-
// ==============================
|
|
1601
|
-
// GRID DATA
|
|
1602
|
-
// ==============================
|
|
1603
|
-
setGridData: async (type, deals) => {
|
|
1604
|
-
if (type === "reset") {
|
|
1605
|
-
set({ gridData: [] });
|
|
1606
|
-
return;
|
|
1607
|
-
}
|
|
1608
|
-
if (type === "directly") {
|
|
1609
|
-
set({ gridData: deals });
|
|
1610
|
-
return;
|
|
1611
|
-
}
|
|
1612
|
-
const finalData = await deals.map(
|
|
1613
|
-
(deal) => {
|
|
1614
|
-
const cards = deal?.data?.results?.rows?.map(
|
|
1615
|
-
(row) => ({
|
|
1616
|
-
id: row?.hs_object_id,
|
|
1617
|
-
...row,
|
|
1618
|
-
hubspotObjectTypeId: type === "deals" ? "0-3" : "0-5"
|
|
1619
|
-
})
|
|
1620
|
-
) || [];
|
|
1621
|
-
return {
|
|
1622
|
-
id: deal.id,
|
|
1623
|
-
name: deal.label,
|
|
1624
|
-
count: deal?.data?.total,
|
|
1625
|
-
...deal,
|
|
1626
|
-
cards
|
|
1627
|
-
};
|
|
1628
|
-
}
|
|
1629
|
-
);
|
|
1630
|
-
await set({ gridData: finalData });
|
|
1631
|
-
return finalData;
|
|
1632
|
-
},
|
|
1633
|
-
// ==============================
|
|
1634
|
-
// DEFAULT PIPELINE
|
|
1635
|
-
// ==============================
|
|
1636
|
-
setDefaultPipeline(data, hubspotObjectTypeId) {
|
|
1637
|
-
if (!data) {
|
|
1638
|
-
set({ selectedPipeline: "" });
|
|
1639
|
-
return "";
|
|
1640
|
-
}
|
|
1641
|
-
const { updateLink, filterParams } = useUpdateLink();
|
|
1642
|
-
const params = filterParams();
|
|
1643
|
-
const excludedIds = ["0-1", "0-2", "0-3", "0-4", "0-5"];
|
|
1644
|
-
const state = get();
|
|
1645
|
-
const view = state.view;
|
|
1646
|
-
const selectedPipeline = state.selectedPipeline;
|
|
1647
|
-
let defaultPipelineId = "";
|
|
1648
|
-
let mFilterValue = "";
|
|
1649
|
-
const defaultPipeline = data?.data?.[0];
|
|
1650
|
-
if (excludedIds.includes(hubspotObjectTypeId)) {
|
|
1651
|
-
defaultPipelineId = defaultPipeline?.pipelineId || "";
|
|
1652
|
-
}
|
|
1653
|
-
if (params && params?.filterPropertyName === "hs_pipeline" && params?.filterValue) {
|
|
1654
|
-
mFilterValue = params.filterValue;
|
|
1655
|
-
} else {
|
|
1656
|
-
if (view === "BOARD" && !selectedPipeline) {
|
|
1657
|
-
mFilterValue = defaultPipelineId;
|
|
1658
|
-
updateLink({
|
|
1659
|
-
fV: defaultPipelineId
|
|
1660
|
-
});
|
|
1661
|
-
} else if (!excludedIds.includes(hubspotObjectTypeId)) {
|
|
1662
|
-
mFilterValue = selectedPipeline || null;
|
|
1663
|
-
} else {
|
|
1664
|
-
mFilterValue = data.data.length === 1 ? defaultPipelineId : selectedPipeline;
|
|
1665
|
-
}
|
|
1666
|
-
}
|
|
1667
|
-
set({ selectedPipeline: mFilterValue });
|
|
1668
|
-
return mFilterValue;
|
|
1669
|
-
}
|
|
1670
|
-
}));
|
|
1671
|
-
function useTable() {
|
|
1672
|
-
const tableState = tableStore.getState();
|
|
1673
|
-
return {
|
|
1674
|
-
...tableState,
|
|
1675
|
-
...{ listeners: { subscribe: tableStore.subscribe } }
|
|
1676
|
-
};
|
|
1677
|
-
}
|
|
1678
|
-
|
|
1679
1092
|
// src/apis/pipeline.ts
|
|
1680
1093
|
function list(options) {
|
|
1681
1094
|
const {
|
|
@@ -1714,13 +1127,14 @@ function list2(options) {
|
|
|
1714
1127
|
|
|
1715
1128
|
// src/apis/object.ts
|
|
1716
1129
|
function list3(options) {
|
|
1717
|
-
const {
|
|
1718
|
-
|
|
1719
|
-
} = useTable();
|
|
1130
|
+
const { getTableParam } = useTable();
|
|
1131
|
+
const { setObjectsData, setTableData } = actions;
|
|
1720
1132
|
const { mutate, isLoading } = createMutation(
|
|
1721
1133
|
async (payload) => {
|
|
1722
1134
|
const param = await getTableParam(payload?.companyAsMediator);
|
|
1723
1135
|
const response = await Client.object.list(payload, param);
|
|
1136
|
+
await setObjectsData(response);
|
|
1137
|
+
await setTableData(response, payload);
|
|
1724
1138
|
return response;
|
|
1725
1139
|
},
|
|
1726
1140
|
options
|
|
@@ -1731,6 +1145,22 @@ function list3(options) {
|
|
|
1731
1145
|
isLoading
|
|
1732
1146
|
};
|
|
1733
1147
|
}
|
|
1148
|
+
function sideBarList(options) {
|
|
1149
|
+
const { setMultiObjectData } = actions6;
|
|
1150
|
+
const { mutate, isLoading } = createMutation(
|
|
1151
|
+
async (payload) => {
|
|
1152
|
+
const response = await Client.object.sideBarList(payload);
|
|
1153
|
+
setMultiObjectData(response, payload);
|
|
1154
|
+
return response;
|
|
1155
|
+
},
|
|
1156
|
+
options
|
|
1157
|
+
);
|
|
1158
|
+
return {
|
|
1159
|
+
mutate,
|
|
1160
|
+
getSideBarObjects: mutate,
|
|
1161
|
+
isLoading
|
|
1162
|
+
};
|
|
1163
|
+
}
|
|
1734
1164
|
function form(options) {
|
|
1735
1165
|
const { mutate, isLoading } = createMutation(
|
|
1736
1166
|
async (payload) => {
|
|
@@ -1760,9 +1190,15 @@ function objectFormOptions(options) {
|
|
|
1760
1190
|
};
|
|
1761
1191
|
}
|
|
1762
1192
|
function create(options) {
|
|
1193
|
+
const { setTablePrependData } = actions;
|
|
1194
|
+
const { setMultiObjectPrependData } = actions6;
|
|
1763
1195
|
const { mutate, isLoading } = createMutation(
|
|
1764
1196
|
async (props) => {
|
|
1197
|
+
if (props?.componentName === "sidebarTable") await setMultiObjectPrependData("loading", props);
|
|
1198
|
+
if (props?.componentName != "association" && props?.componentName != "sidebarTable") await setTablePrependData("loading", props);
|
|
1765
1199
|
const response = await Client.object.create(props);
|
|
1200
|
+
if (props?.componentName === "sidebarTable") await setMultiObjectPrependData(response, props);
|
|
1201
|
+
if (props?.componentName != "association" && props?.componentName != "sidebarTable") await setTablePrependData(response, props);
|
|
1766
1202
|
return response;
|
|
1767
1203
|
},
|
|
1768
1204
|
options
|
|
@@ -1832,9 +1268,11 @@ function update(options) {
|
|
|
1832
1268
|
|
|
1833
1269
|
// src/apis/note.ts
|
|
1834
1270
|
function list4(options) {
|
|
1271
|
+
const { setNotes } = actions3;
|
|
1835
1272
|
const { mutate, isLoading } = createMutation(
|
|
1836
1273
|
async (payload) => {
|
|
1837
1274
|
const response = await Client.note.list(payload);
|
|
1275
|
+
setNotes(response, payload);
|
|
1838
1276
|
return response;
|
|
1839
1277
|
},
|
|
1840
1278
|
options
|
|
@@ -1846,9 +1284,12 @@ function list4(options) {
|
|
|
1846
1284
|
};
|
|
1847
1285
|
}
|
|
1848
1286
|
function create2(options) {
|
|
1287
|
+
const { setPrependNote } = actions3;
|
|
1849
1288
|
const { mutate, isLoading } = createMutation(
|
|
1850
1289
|
async (props) => {
|
|
1290
|
+
await setPrependNote("loading");
|
|
1851
1291
|
const response = await Client.note.create(props);
|
|
1292
|
+
await setPrependNote(response);
|
|
1852
1293
|
return response;
|
|
1853
1294
|
},
|
|
1854
1295
|
options
|
|
@@ -1860,10 +1301,11 @@ function create2(options) {
|
|
|
1860
1301
|
};
|
|
1861
1302
|
}
|
|
1862
1303
|
function update2(options) {
|
|
1304
|
+
const { updatePrependNote } = actions3;
|
|
1863
1305
|
const { mutate, isLoading } = createMutation(
|
|
1864
1306
|
async (payload) => {
|
|
1865
1307
|
const response = await Client.note.update(payload);
|
|
1866
|
-
return response;
|
|
1308
|
+
return updatePrependNote(response);
|
|
1867
1309
|
},
|
|
1868
1310
|
options
|
|
1869
1311
|
);
|
|
@@ -1876,9 +1318,11 @@ function update2(options) {
|
|
|
1876
1318
|
|
|
1877
1319
|
// src/apis/email.ts
|
|
1878
1320
|
function list5(options) {
|
|
1321
|
+
const { setEmails } = actions4;
|
|
1879
1322
|
const { mutate, isLoading } = createMutation(
|
|
1880
1323
|
async (payload) => {
|
|
1881
1324
|
const response = await Client.email.list(payload);
|
|
1325
|
+
setEmails(response, payload);
|
|
1882
1326
|
return response;
|
|
1883
1327
|
},
|
|
1884
1328
|
options
|
|
@@ -1890,9 +1334,12 @@ function list5(options) {
|
|
|
1890
1334
|
};
|
|
1891
1335
|
}
|
|
1892
1336
|
function create3(options) {
|
|
1337
|
+
const { setPrependEmail } = actions4;
|
|
1893
1338
|
const { mutate, isLoading } = createMutation(
|
|
1894
1339
|
async (props) => {
|
|
1340
|
+
await setPrependEmail("loading");
|
|
1895
1341
|
const response = await Client.email.create(props);
|
|
1342
|
+
await setPrependEmail(response);
|
|
1896
1343
|
return response;
|
|
1897
1344
|
},
|
|
1898
1345
|
options
|
|
@@ -1904,10 +1351,11 @@ function create3(options) {
|
|
|
1904
1351
|
};
|
|
1905
1352
|
}
|
|
1906
1353
|
function update3(options) {
|
|
1354
|
+
const { updatePrependEmail } = actions4;
|
|
1907
1355
|
const { mutate, isLoading } = createMutation(
|
|
1908
1356
|
async (payload) => {
|
|
1909
1357
|
const response = await Client.email.update(payload);
|
|
1910
|
-
return response;
|
|
1358
|
+
return updatePrependEmail(response);
|
|
1911
1359
|
},
|
|
1912
1360
|
options
|
|
1913
1361
|
);
|
|
@@ -1937,6 +1385,7 @@ function attachmentUpload(options) {
|
|
|
1937
1385
|
const { mutate, isLoading } = createMutation(
|
|
1938
1386
|
async (payload) => {
|
|
1939
1387
|
const response = payload?.type === "email" ? await Client.email.attachment(payload) : await Client.note.attachment(payload);
|
|
1388
|
+
actions2.setAttachment(response);
|
|
1940
1389
|
return response;
|
|
1941
1390
|
},
|
|
1942
1391
|
options
|
|
@@ -2005,11 +1454,46 @@ function addFile(options) {
|
|
|
2005
1454
|
isLoading
|
|
2006
1455
|
};
|
|
2007
1456
|
}
|
|
1457
|
+
function download(options) {
|
|
1458
|
+
const { mutate, isLoading } = createMutation(
|
|
1459
|
+
async (payload) => {
|
|
1460
|
+
const response = await Client.file.download(payload);
|
|
1461
|
+
return response;
|
|
1462
|
+
},
|
|
1463
|
+
options
|
|
1464
|
+
);
|
|
1465
|
+
return {
|
|
1466
|
+
mutate,
|
|
1467
|
+
downloadFile: mutate,
|
|
1468
|
+
isLoading
|
|
1469
|
+
};
|
|
1470
|
+
}
|
|
2008
1471
|
|
|
2009
|
-
// src/
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
1472
|
+
// src/apis/cache.ts
|
|
1473
|
+
function purge(options) {
|
|
1474
|
+
const { mutate, isLoading } = createMutation(
|
|
1475
|
+
async (payload) => {
|
|
1476
|
+
const safePayload = payload ?? {};
|
|
1477
|
+
const idempotencyKey = typeof safePayload.idempotencyKey === "string" ? safePayload.idempotencyKey : void 0;
|
|
1478
|
+
const headers = idempotencyKey ? { "Idempotency-Key": idempotencyKey } : void 0;
|
|
1479
|
+
const { idempotencyKey: _ignored, ...body } = safePayload;
|
|
1480
|
+
return Client.cache.purge(body, headers);
|
|
1481
|
+
},
|
|
1482
|
+
options
|
|
1483
|
+
);
|
|
1484
|
+
return { mutate, purgeCache: mutate, isLoading };
|
|
1485
|
+
}
|
|
1486
|
+
function purgeStatus(purgeJobId, options) {
|
|
1487
|
+
const { mutate, isLoading } = createMutation(
|
|
1488
|
+
async (jobId) => Client.cache.purgeStatus(jobId ?? purgeJobId),
|
|
1489
|
+
options
|
|
1490
|
+
);
|
|
1491
|
+
return {
|
|
1492
|
+
mutate,
|
|
1493
|
+
getPurgeStatus: () => mutate(purgeJobId),
|
|
1494
|
+
isLoading
|
|
1495
|
+
};
|
|
1496
|
+
}
|
|
2013
1497
|
|
|
2014
1498
|
// src/breadcrumb/breadcrumbs.ts
|
|
2015
1499
|
var getBreadcrumbs = () => {
|
|
@@ -2217,6 +1701,66 @@ var buildChildRoute = (props, breadcrumbItems) => {
|
|
|
2217
1701
|
return generateUrl(props, breadcrumbs);
|
|
2218
1702
|
};
|
|
2219
1703
|
|
|
1704
|
+
// src/utils/datetime.ts
|
|
1705
|
+
var DEFAULT_HUBSPOT_TIMEZONE = "Asia/Kolkata";
|
|
1706
|
+
function getCurrentTimeZone() {
|
|
1707
|
+
try {
|
|
1708
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone || DEFAULT_HUBSPOT_TIMEZONE;
|
|
1709
|
+
} catch {
|
|
1710
|
+
return DEFAULT_HUBSPOT_TIMEZONE;
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
function normalizeToTimestamp(value) {
|
|
1714
|
+
if (value == null || value === "") return null;
|
|
1715
|
+
if (typeof value === "number") {
|
|
1716
|
+
return value > 1e11 ? value : null;
|
|
1717
|
+
}
|
|
1718
|
+
if (typeof value === "string" && /^\d+$/.test(value)) {
|
|
1719
|
+
const n = Number(value);
|
|
1720
|
+
return n > 1e11 ? n : null;
|
|
1721
|
+
}
|
|
1722
|
+
if (typeof value === "string" || value instanceof Date) {
|
|
1723
|
+
const date = new Date(value);
|
|
1724
|
+
return Number.isNaN(date.getTime()) ? null : date.getTime();
|
|
1725
|
+
}
|
|
1726
|
+
return null;
|
|
1727
|
+
}
|
|
1728
|
+
function formatGmtOffset(timeZone = getCurrentTimeZone(), date = /* @__PURE__ */ new Date()) {
|
|
1729
|
+
const raw = new Intl.DateTimeFormat("en-US", {
|
|
1730
|
+
timeZone,
|
|
1731
|
+
timeZoneName: "longOffset"
|
|
1732
|
+
}).formatToParts(date).find((part) => part.type === "timeZoneName")?.value;
|
|
1733
|
+
if (!raw) return "";
|
|
1734
|
+
return raw.replace(/GMT([+-])0(\d)(?=:)/, "GMT$1$2");
|
|
1735
|
+
}
|
|
1736
|
+
function formatHubSpotActivityDateTimeParts(timestamp, timeZone = getCurrentTimeZone()) {
|
|
1737
|
+
const ms = normalizeToTimestamp(timestamp);
|
|
1738
|
+
if (ms == null) return null;
|
|
1739
|
+
const date = new Date(ms);
|
|
1740
|
+
const datePart = new Intl.DateTimeFormat("en-US", {
|
|
1741
|
+
timeZone,
|
|
1742
|
+
month: "long",
|
|
1743
|
+
day: "numeric",
|
|
1744
|
+
year: "numeric"
|
|
1745
|
+
}).format(date);
|
|
1746
|
+
const timePart = new Intl.DateTimeFormat("en-US", {
|
|
1747
|
+
timeZone,
|
|
1748
|
+
hour: "numeric",
|
|
1749
|
+
minute: "2-digit",
|
|
1750
|
+
hour12: true
|
|
1751
|
+
}).format(date);
|
|
1752
|
+
const gmtOffset = formatGmtOffset(timeZone, date);
|
|
1753
|
+
return {
|
|
1754
|
+
date: datePart,
|
|
1755
|
+
time: timePart,
|
|
1756
|
+
gmtOffset,
|
|
1757
|
+
formatted: `${datePart} at ${timePart} ${gmtOffset}`.trim()
|
|
1758
|
+
};
|
|
1759
|
+
}
|
|
1760
|
+
function formatHubSpotActivityDateTime(timestamp, timeZone = getCurrentTimeZone()) {
|
|
1761
|
+
return formatHubSpotActivityDateTimeParts(timestamp, timeZone)?.formatted ?? "";
|
|
1762
|
+
}
|
|
1763
|
+
|
|
2220
1764
|
// src/index.ts
|
|
2221
1765
|
var api = {
|
|
2222
1766
|
preLogin,
|
|
@@ -2238,6 +1782,7 @@ var api = {
|
|
|
2238
1782
|
pipelines: list,
|
|
2239
1783
|
stages: list2,
|
|
2240
1784
|
objects: list3,
|
|
1785
|
+
sideBarObjects: sideBarList,
|
|
2241
1786
|
objectsForm: form,
|
|
2242
1787
|
createObject: create,
|
|
2243
1788
|
createExistingObject: createExisting,
|
|
@@ -2255,8 +1800,11 @@ var api = {
|
|
|
2255
1800
|
attachmentUpload,
|
|
2256
1801
|
files: list6,
|
|
2257
1802
|
file: details2,
|
|
1803
|
+
fileDownload: download,
|
|
2258
1804
|
addFolder,
|
|
2259
1805
|
addFile,
|
|
1806
|
+
purgeCache: purge,
|
|
1807
|
+
cachePurgeStatus: purgeStatus,
|
|
2260
1808
|
getRefreshToken,
|
|
2261
1809
|
getAuthRefreshToken,
|
|
2262
1810
|
isCookieExpired,
|
|
@@ -2282,6 +1830,6 @@ var routeParam = {
|
|
|
2282
1830
|
getParamDetails
|
|
2283
1831
|
};
|
|
2284
1832
|
|
|
2285
|
-
export { api, breadcrumbsDetails, getFieldErrors, getFormErrors, initializeHttpClient, routeParam, store, url };
|
|
1833
|
+
export { DEFAULT_HUBSPOT_TIMEZONE, api, breadcrumbsDetails, client_exports as clint, formatGmtOffset, formatHubSpotActivityDateTime, formatHubSpotActivityDateTimeParts, getCurrentTimeZone, getFieldErrors, getFormErrors, initializeHttpClient, normalizeToTimestamp, routeParam, store, url };
|
|
2286
1834
|
//# sourceMappingURL=index.js.map
|
|
2287
1835
|
//# sourceMappingURL=index.js.map
|