woodsportal-client-sdk 1.1.4-dev.3 → 1.1.4-dev.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,153 +1,56 @@
1
- import Cookies from 'js-cookie';
1
+ import { actions, actions2, actions3 } from './chunk-3OQK7XCZ.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
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __esm = (fn, res) => function __init() {
8
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
- };
10
-
11
- // src/utils/constants.ts
12
- var LOGIN_DETAILS, REFRESH_TOKEN, PORTAL, SUBSCRIPTION_TYPE, HUBSPOT_DATA, HUB_ID, DEV_PORTAL_ID, 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
- PORTAL_ID = "portalId";
23
- }
24
- });
25
- var setCookie, getCookie, removeAllCookie, isCookieExpired;
26
- var init_cookie = __esm({
27
- "src/utils/cookie.ts"() {
28
- setCookie = (key, value, expire) => {
29
- return Cookies.set(key, value, {
30
- expires: expire,
31
- sameSite: "none",
32
- secure: true
33
- });
34
- };
35
- getCookie = (key) => {
36
- return Cookies.get(key);
37
- };
38
- removeAllCookie = () => {
39
- Object.keys(Cookies.get()).forEach((cookieName) => {
40
- Cookies.remove(cookieName);
41
- });
42
- };
43
- isCookieExpired = (key) => {
44
- const value = Cookies.get(key);
45
- try {
46
- const { expiresAt } = JSON.parse(value);
47
- return Date.now() > expiresAt ? true : false;
48
- } catch {
49
- return false;
50
- }
51
- };
52
- }
8
+ // src/client/index.ts
9
+ var client_exports = {};
10
+ __export(client_exports, {
11
+ Client: () => Client
53
12
  });
54
13
 
55
- // src/clint/token-store.ts
56
- function getAccessToken() {
57
- return accessToken;
58
- }
59
- function storAccessToken(token, expiresIn) {
60
- accessToken = token;
61
- if (expiresIn) {
62
- tokenExpiresAt = Date.now() + expiresIn * 1e3;
63
- } else {
64
- tokenExpiresAt = null;
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);
65
25
  }
66
- }
67
- function clearAccessToken() {
68
- accessToken = null;
69
- tokenExpiresAt = null;
70
- }
71
- function isExpiresAccessToken() {
72
- if (!tokenExpiresAt) return true;
73
- return Date.now() >= tokenExpiresAt;
74
- }
75
- function isAuthenticateApp() {
76
- if (isCookieExpired(REFRESH_TOKEN) || isExpiresAccessToken()) {
77
- return false;
26
+ };
27
+ function resolveStore() {
28
+ if (typeof globalThis === "undefined") {
29
+ return memoryStore;
78
30
  }
79
- return true;
80
- }
81
- var accessToken, tokenExpiresAt;
82
- var init_token_store = __esm({
83
- "src/clint/token-store.ts"() {
84
- init_cookie();
85
- init_constants();
86
- accessToken = null;
87
- tokenExpiresAt = null;
31
+ const ls = globalThis.localStorage;
32
+ if (!ls || typeof ls.getItem !== "function") {
33
+ return memoryStore;
88
34
  }
89
- });
90
-
91
- // src/clint/auth-utils.ts
92
- function setRefreshToken(token, expiresAt) {
93
- return new Promise((resolve) => {
94
- setCookie(REFRESH_TOKEN, JSON.stringify(token), expiresAt);
95
- resolve();
96
- });
97
- }
98
- function setAccessToken(token, expiresIn) {
99
- return new Promise((resolve) => {
100
- storAccessToken(token, expiresIn);
101
- resolve();
102
- });
103
- }
104
- function getRefreshToken() {
105
- return JSON.parse(getCookie(REFRESH_TOKEN || null) || null);
106
- }
107
- function getPortal() {
108
- return JSON.parse(getCookie(PORTAL || null) || null);
109
- }
110
- var setLoggedInDetails, setPortal, setSubscriptionType;
111
- var init_auth_utils = __esm({
112
- "src/clint/auth-utils.ts"() {
113
- init_constants();
114
- init_cookie();
115
- init_token_store();
116
- setLoggedInDetails = async (data) => {
117
- return new Promise((resolve) => {
118
- setCookie(LOGIN_DETAILS, JSON.stringify(data));
119
- resolve();
120
- });
121
- };
122
- setPortal = async (data) => {
123
- return new Promise((resolve) => {
124
- setCookie(PORTAL, JSON.stringify(data));
125
- resolve();
126
- });
127
- };
128
- setSubscriptionType = async (data) => {
129
- return new Promise((resolve) => {
130
- setCookie(SUBSCRIPTION_TYPE, JSON.stringify(data));
131
- resolve();
132
- });
133
- };
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;
134
42
  }
135
- });
136
-
137
- // src/utils/config.ts
138
- init_constants();
139
-
140
- // src/utils/localStoraget.ts
43
+ }
141
44
  var storage = {
142
45
  set: (key, value) => {
143
- localStorage.setItem(key, JSON.stringify(value));
46
+ resolveStore().setItem(key, JSON.stringify(value));
144
47
  },
145
48
  get: (key) => {
146
- const item = localStorage.getItem(key);
49
+ const item = resolveStore().getItem(key);
147
50
  return item ? JSON.parse(item) : null;
148
51
  },
149
52
  remove: (key) => {
150
- localStorage.removeItem(key);
53
+ resolveStore().removeItem(key);
151
54
  }
152
55
  };
153
56
 
@@ -164,6 +67,10 @@ var config = {
164
67
  get portalId() {
165
68
  const hubSpotData = storage.get(HUBSPOT_DATA);
166
69
  return hubSpotData?.[PORTAL_ID] || "";
70
+ },
71
+ get devApiUrl() {
72
+ const hubSpotData = storage.get(HUBSPOT_DATA);
73
+ return hubSpotData?.[DEV_API_URL] || "";
167
74
  }
168
75
  };
169
76
  var setConfig = {
@@ -202,7 +109,7 @@ function replaceParams(template, values) {
202
109
  );
203
110
  }
204
111
 
205
- // src/clint/api-endpoints.ts
112
+ // src/client/api-endpoints.ts
206
113
  var API_ENDPOINTS = {
207
114
  // Auth
208
115
  PRE_LOGIN: "/api/auth/pre-login",
@@ -214,6 +121,7 @@ var API_ENDPOINTS = {
214
121
  VERIFY_EMAIL: "/api/auth/verify-email",
215
122
  REGISTER_EXISTING_USER: "/api/auth/existing-user-register",
216
123
  RESEND_EMAIL: "/api/auth/resend-email",
124
+ VERIFY_EMAIL_RESEND: "/api/auth/verify-email/resend",
217
125
  LOGOUT: "/api/auth/logout",
218
126
  // SSO
219
127
  SSO_DETAILS: "/api/auth/sso/active",
@@ -224,51 +132,64 @@ var API_ENDPOINTS = {
224
132
  PROFILE: "/api/${hubId}/${portalId}/profiles",
225
133
  CHANGE_PASSWORD: "/api/auth/change-password",
226
134
  // Pipeline
227
- PIPELINES: "api/${hubId}/${portalId}/hubspot-object-pipelines/${hubspotObjectTypeId}",
135
+ PIPELINES: "/api/${hubId}/${portalId}/hubspot-object-pipelines/${hubspotObjectTypeId}",
228
136
  // Stage
229
- STAGES: "api/${hubId}/${portalId}/hubspot-object-pipelines/${objectTypeId}/${pipelineId}/stages",
230
- // Object
231
- OBJECTS: "api/${hubId}/${portalId}/hubspot-object-data/${hubspotObjectTypeId}",
232
- OBJECTS_FORM: "api/${hubId}/${portalId}/hubspot-object-forms/${hubspotObjectTypeId}/fields",
233
- OBJECTS_FORM_OPTIONS: "api/${hubId}/${portalId}/hubspot-object-forms/:fromRecordId/:fromObjectTypeId",
234
- OBJECTS_CREATE: "api/${hubId}/${portalId}/hubspot-object-forms/${hubspotObjectTypeId}/fields",
235
- OBJECTS_CREATE_EXISTING: "api/${hubId}/${portalId}/hubspot-object-forms/:fromObjectTypeId/:fromRecordId/associations/:toObjectTypeId",
236
- OBJECTS_REMOVE_EXISTING: "api/${hubId}/${portalId}/hubspot-object-forms/:fromObjectTypeId/:fromRecordId/disassociate/:toObjectTypeId",
237
- OBJECTS_DETAILS: "api/${hubId}/${portalId}/hubspot-object-data/${objectId}/${id}",
238
- OBJECTS_DETAILS_UPDATE: "api/${hubId}/${portalId}/hubspot-object-forms/${objectId}/properties/${id}",
239
- // Note
240
- NOTES: "api/${hubId}/${portalId}/hubspot-object-notes/${objectId}/${id}",
241
- NOTES_CREATE: "api/${hubId}/${portalId}/hubspot-object-notes/${objectId}/${id}",
242
- NOTES_DETAILS_UPDATE: "api/${hubId}/${portalId}/hubspot-object-notes/${objectId}/${id}/${note_id}",
243
- NOTES_IMAGE_UPLOAD: "api/${hubId}/${portalId}/hubspot-object-notes/images/${objectId}/${id}",
244
- NOTES_ATTACHMENT_UPLOAD: "api/${hubId}/${portalId}/hubspot-object-notes/attachments/${objectId}/${id}",
245
- // Email
246
- EMAILS: "api/${hubId}/${portalId}/hubspot-object-emails/${objectId}/${id}",
247
- EMAILS_CREATE: "api/${hubId}/${portalId}/hubspot-object-emails/${objectId}/${id}",
248
- EMAILS_DETAILS_UPDATE: "api/${hubId}/${portalId}/hubspot-object-emails/${objectId}/${id}/${note_id}",
249
- EMAILS_IMAGE_UPLOAD: "api/${hubId}/${portalId}/hubspot-object-emails/images/${objectId}/${id}",
250
- EMAILS_ATTACHMENT_UPLOAD: "api/${hubId}/${portalId}/hubspot-object-emails/attachments/${objectId}/${id}",
251
- // File
252
- FILES: "api/${hubId}/${portalId}/hubspot-object-files/${objectId}/${id}",
253
- FILE: "api/${hubId}/${portalId}/hubspot-object-files/${objectId}/${id}/${rowId}",
254
- FILES_CREATE_FOLDER: "api/${hubId}/${portalId}/hubspot-object-folders/${objectId}/${id}",
255
- FILES_UPLOAD: "api/${hubId}/${portalId}/hubspot-object-files/${objectId}/${id}",
256
- FILES_DELETE: "api/feature-data/files/${me.hubspotPortals.templateName}${path}/${postId}/${fileId}"
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"
257
180
  };
258
- init_token_store();
259
181
 
260
- // src/clint/config.ts
182
+ // src/client/config.ts
261
183
  var config2 = {
262
184
  baseURL: "https://api.dev.woodsportal.com"
263
185
  };
264
186
 
265
- // src/clint/http-clint.ts
266
- init_auth_utils();
187
+ // src/client/http-clint.ts
267
188
  var axiosInstance = null;
268
189
  var config3 = {};
269
190
  function initializeHttpClient(clientConfig) {
270
191
  config3 = clientConfig;
271
- const baseURL = config3.baseURL ?? config2.baseURL;
192
+ const baseURL = config?.devApiUrl || config3.baseURL;
272
193
  const timeout = config3.timeout ?? 5e4;
273
194
  axiosInstance = axios.create({
274
195
  baseURL,
@@ -278,6 +199,7 @@ function initializeHttpClient(clientConfig) {
278
199
  ...config3.headers
279
200
  }
280
201
  });
202
+ setRefreshCallback(getAuthRefreshToken);
281
203
  axiosInstance.interceptors.request.use((config4) => {
282
204
  const token = getAccessToken();
283
205
  if (token) {
@@ -304,6 +226,44 @@ function getAxiosInstance() {
304
226
  }
305
227
  return axiosInstance;
306
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
+ };
307
267
  var AuthHttpClient = class {
308
268
  static async get(url2, params) {
309
269
  const response = await getAxiosInstance().get(url2, { params });
@@ -620,9 +580,6 @@ var getParamDetails = (props, isDetailsPage = false) => {
620
580
  };
621
581
  };
622
582
 
623
- // src/clint/index.ts
624
- init_auth_utils();
625
-
626
583
  // src/breadcrumb/url.ts
627
584
  var useUpdateLink = () => {
628
585
  const updateLink = async (props, displayName = "prm") => {
@@ -639,17 +596,15 @@ var useUpdateLink = () => {
639
596
  ];
640
597
  }
641
598
  const lastBreadcrumb = breadcrumbs[breadcrumbs.length - 1];
642
- let udatedBreadcrumb = null;
643
599
  if (displayName) {
644
600
  const ex = await getDeep(lastBreadcrumb, displayName) || {};
645
- udatedBreadcrumb = await setDeep(lastBreadcrumb, displayName, {
601
+ await setDeep(lastBreadcrumb, displayName, {
646
602
  ...ex,
647
603
  ...props
648
604
  });
649
605
  } else {
650
- udatedBreadcrumb = Object.assign(lastBreadcrumb, props);
606
+ await Object.assign(lastBreadcrumb, props);
651
607
  }
652
- breadcrumbs[breadcrumbs.length - 1] = udatedBreadcrumb;
653
608
  const newBase64 = convertToBase64(breadcrumbs);
654
609
  updateBParam(newBase64);
655
610
  };
@@ -726,7 +681,37 @@ var updateBParam = (newValue) => {
726
681
  }
727
682
  };
728
683
 
729
- // src/clint/index.ts
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
+ };
730
715
  var Client = {
731
716
  authentication: {
732
717
  preLogin: (data) => AuthHttpClient.post(API_ENDPOINTS.PRE_LOGIN, data),
@@ -746,10 +731,10 @@ var Client = {
746
731
  resetPasswordVerifyToken: (data) => AuthHttpClient.post(API_ENDPOINTS.RESET_PASSWORD_VERIFY_TOKEN, data),
747
732
  resetPassword: (data) => AuthHttpClient.post(API_ENDPOINTS.RESET_PASSWORD, data),
748
733
  forgetPassword: (data) => AuthHttpClient.post(API_ENDPOINTS.FORGET_PASSWORD, data),
749
- registerExistingUser: (data) => AuthHttpClient.post(API_ENDPOINTS.REGISTER_EXISTING_USER, data),
750
- verifyEmailResend: (data) => AuthHttpClient.post(API_ENDPOINTS.REGISTER_EXISTING_USER, data),
734
+ registerExistingUser: (data) => AuthHttpClient.post(API_ENDPOINTS.REGISTER_EXISTING_USER, data?.payload),
735
+ verifyEmailResend: (data) => AuthHttpClient.post(API_ENDPOINTS.VERIFY_EMAIL_RESEND, data),
751
736
  resendEmail: (data) => AuthHttpClient.post(API_ENDPOINTS.RESEND_EMAIL, data),
752
- logout: () => AuthHttpClient.post(API_ENDPOINTS.LOGOUT, null)
737
+ logout: () => HttpClient.post(API_ENDPOINTS.LOGOUT, null)
753
738
  },
754
739
  sso: {
755
740
  getSsoDetails: () => AuthHttpClient.get(API_ENDPOINTS.SSO_DETAILS),
@@ -757,9 +742,9 @@ var Client = {
757
742
  ssoCallback: (payload) => AuthHttpClient.get(generateApiUrl({ route: API_ENDPOINTS.SSO_CALLBACK, queryParams: payload?.queryParams }))
758
743
  },
759
744
  user: {
760
- me: () => AuthHttpClient.get(generateApiUrl({ route: API_ENDPOINTS.ME })),
761
- profile: (payload) => AuthHttpClient.get(generateApiUrl({ route: API_ENDPOINTS.PROFILE, queryParams: payload })),
762
- changePassword: (data) => AuthHttpClient.post(API_ENDPOINTS.CHANGE_PASSWORD, 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)
763
748
  },
764
749
  pipeline: {
765
750
  list: (payload = null, param = null) => {
@@ -776,26 +761,26 @@ var Client = {
776
761
  apiParams.parentObjectTypeId = "0-2";
777
762
  }
778
763
  apiParams.isPrimaryCompany = param?.isPrimaryCompany;
779
- apiParams.cache = payload?.sync ? false : true;
764
+ apiParams.cache = payload?.cache;
780
765
  const apiUrl = generateApiUrl({ route: API_ENDPOINTS.PIPELINES, params, queryParams: apiParams });
781
- return AuthHttpClient.get(apiUrl);
766
+ return HttpClient.get(apiUrl);
782
767
  }
783
768
  },
784
769
  stage: {
785
770
  list: (props = null) => {
786
- const portalId = config.devPortalId;
787
771
  const params = {
788
- hubId: config.hubId,
789
- portalId,
772
+ // hubId: config.hubId,
773
+ // portalId: portalId,
790
774
  objectTypeId: props?.params?.objectTypeId,
791
775
  pipelineId: props?.params?.pipelineId
792
776
  };
793
777
  const apiUrl = generateApiUrl({ route: API_ENDPOINTS.STAGES, params });
794
- return AuthHttpClient.get(apiUrl);
778
+ return HttpClient.get(apiUrl);
795
779
  }
796
780
  },
797
781
  object: {
798
782
  list: async (payload = null, param = null) => {
783
+ param.cache = payload.cache;
799
784
  const params = { hubspotObjectTypeId: payload?.hubspotObjectTypeId };
800
785
  const { updateLink, getLinkParams } = useUpdateLink();
801
786
  const { getParamDetails: getParamDetails2 } = routeParam;
@@ -851,45 +836,70 @@ var Client = {
851
836
  }
852
837
  param.parentAccessLabel = parentAccessLabel;
853
838
  const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS, params, queryParams: param });
854
- return AuthHttpClient.get(apiUrl);
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);
855
847
  },
856
848
  form: (payload = null) => {
857
849
  const params = { hubspotObjectTypeId: payload?.hubspotObjectTypeId };
858
- const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_CREATE, params, queryParams: payload?.params });
859
- return AuthHttpClient.get(apiUrl);
850
+ const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_FORM, params, queryParams: payload?.params });
851
+ return HttpClient.get(apiUrl);
860
852
  },
861
853
  objectFormOptions: (payload = null) => {
862
- const params = { hubspotObjectTypeId: payload?.hubspotObjectTypeId };
854
+ const params = {
855
+ formId: payload?.formId,
856
+ objectTypeId: payload?.objectTypeId ?? payload?.hubspotObjectTypeId
857
+ };
863
858
  const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_FORM_OPTIONS, params, queryParams: payload?.params });
864
- return AuthHttpClient.get(apiUrl);
859
+ return HttpClient.get(apiUrl);
865
860
  },
866
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
+ });
867
869
  const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId };
868
- const queryParams = props.params;
869
- const payload = props.payload;
870
- const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_CREATE, params, queryParams });
871
- return AuthHttpClient.post(apiUrl, payload);
870
+ const apiUrl = generateApiUrl({ route: API_ENDPOINTS.RECORDS_CREATE, params, queryParams: props?.params });
871
+ return HttpClient.post(apiUrl, body);
872
872
  },
873
873
  createExisting: (props = null) => {
874
- const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId };
875
- const queryParams = props.params;
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
+ };
876
882
  const payload = props.payload;
877
- const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_CREATE_EXISTING, params, queryParams });
878
- return AuthHttpClient.post(apiUrl, payload);
883
+ const apiUrl = generateApiUrl({ route: API_ENDPOINTS.RECORDS_ASSOCIATE, params, queryParams });
884
+ return HttpClient.post(apiUrl, payload);
879
885
  },
880
886
  removeExisting: (props = null) => {
881
- const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId };
882
- const queryParams = props.params;
883
- const payload = props.payload;
884
- const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_REMOVE_EXISTING, params, queryParams });
885
- return AuthHttpClient.post(apiUrl, payload);
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 });
886
897
  },
887
898
  details: (props = null) => {
888
899
  const { paramsObject: urlParam, parentAccessLabel } = getParamDetails("", true);
889
- const portalId = config.devPortalId;
890
900
  const params = {
891
- hubId: config.hubId,
892
- portalId,
901
+ // hubId: config.hubId,
902
+ // portalId: portalId,
893
903
  objectId: props?.params?.objectId,
894
904
  id: props?.params?.id
895
905
  };
@@ -899,52 +909,56 @@ var Client = {
899
909
  ...urlParam
900
910
  };
901
911
  const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_DETAILS, params, queryParams });
902
- return AuthHttpClient.get(apiUrl);
912
+ return HttpClient.get(apiUrl);
903
913
  },
904
914
  update: (props = null) => {
905
- const portalId = getPortal()?.portalId;
906
915
  const params = {
907
- hubId: config.hubId,
908
- portalId,
909
916
  objectId: props?.params?.objectId,
910
917
  id: props?.params?.id
911
918
  };
912
- const { paramsObject: queryParams } = getParamDetails();
913
- const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_DETAILS_UPDATE, params, queryParams });
914
- return AuthHttpClient.put(apiUrl, props.payload);
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);
915
931
  }
916
932
  },
917
933
  note: {
918
934
  list: (props = null) => {
919
- const portalId = getPortal()?.portalId;
920
935
  const params = {
921
- hubId: config.hubId,
922
- portalId,
936
+ // hubId: config.hubId,
937
+ // portalId: portalId,
923
938
  objectId: props?.params?.objectId,
924
939
  id: props?.params?.id
925
940
  };
926
941
  const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES, params, queryParams: props?.queryParams });
927
- return AuthHttpClient.get(apiUrl);
942
+ return HttpClient.get(apiUrl);
928
943
  },
929
944
  create: (props = null) => {
930
945
  const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
931
946
  const queryParams = props.queryParams;
932
947
  const payload = props.payload;
933
948
  const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES_CREATE, params, queryParams });
934
- return AuthHttpClient.post(apiUrl, payload);
949
+ return HttpClient.post(apiUrl, payload);
935
950
  },
936
951
  update: (props = null) => {
937
- const portalId = getPortal()?.portalId;
938
952
  const params = {
939
- hubId: config.hubId,
940
- portalId,
953
+ // hubId: config.hubId,
954
+ // portalId: portalId,
941
955
  objectId: props?.params?.objectId,
942
956
  id: props?.params?.id,
943
957
  note_id: props?.params?.note_id
944
958
  };
945
959
  const { paramsObject: queryParams } = getParamDetails();
946
960
  const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES_DETAILS_UPDATE, params, queryParams });
947
- return AuthHttpClient.put(apiUrl, props.payload);
961
+ return HttpClient.put(apiUrl, props.payload);
948
962
  },
949
963
  image: (props = null) => {
950
964
  const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
@@ -952,7 +966,7 @@ var Client = {
952
966
  const payload = props.payload;
953
967
  const axiosConfig = props.config || {};
954
968
  const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES_IMAGE_UPLOAD, params, queryParams });
955
- return AuthHttpClient.post(apiUrl, payload, {
969
+ return HttpClient.post(apiUrl, payload, {
956
970
  headers: {
957
971
  "Content-Type": "multipart/form-data"
958
972
  },
@@ -965,7 +979,7 @@ var Client = {
965
979
  const payload = props.payload;
966
980
  const axiosConfig = props.config || {};
967
981
  const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES_ATTACHMENT_UPLOAD, params, queryParams });
968
- return AuthHttpClient.post(apiUrl, payload, {
982
+ return HttpClient.post(apiUrl, payload, {
969
983
  headers: {
970
984
  "Content-Type": "multipart/form-data"
971
985
  },
@@ -975,35 +989,33 @@ var Client = {
975
989
  },
976
990
  email: {
977
991
  list: (props = null) => {
978
- const portalId = getPortal()?.portalId;
979
992
  const params = {
980
- hubId: config.hubId,
981
- portalId,
993
+ // hubId: config.hubId,
994
+ // portalId: portalId,
982
995
  objectId: props?.params?.objectId,
983
996
  id: props?.params?.id
984
997
  };
985
998
  const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS, params, queryParams: props?.queryParams });
986
- return AuthHttpClient.get(apiUrl);
999
+ return HttpClient.get(apiUrl);
987
1000
  },
988
1001
  create: (props = null) => {
989
1002
  const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
990
1003
  const queryParams = props.queryParams;
991
1004
  const payload = props.payload;
992
1005
  const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS_CREATE, params, queryParams });
993
- return AuthHttpClient.post(apiUrl, payload);
1006
+ return HttpClient.post(apiUrl, payload);
994
1007
  },
995
1008
  update: (props = null) => {
996
- const portalId = getPortal()?.portalId;
997
1009
  const params = {
998
- hubId: config.hubId,
999
- portalId,
1010
+ // hubId: config.hubId,
1011
+ // portalId: portalId,
1000
1012
  objectId: props?.params?.objectId,
1001
1013
  id: props?.params?.id,
1002
- note_id: props?.params?.note_id
1014
+ email_id: props?.params?.email_id ?? props?.params?.note_id
1003
1015
  };
1004
1016
  const { paramsObject: queryParams } = getParamDetails();
1005
1017
  const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS_DETAILS_UPDATE, params, queryParams });
1006
- return AuthHttpClient.put(apiUrl, props.payload);
1018
+ return HttpClient.put(apiUrl, props.payload);
1007
1019
  },
1008
1020
  image: (props = null) => {
1009
1021
  const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
@@ -1011,7 +1023,7 @@ var Client = {
1011
1023
  const payload = props.payload;
1012
1024
  const axiosConfig = props.config || {};
1013
1025
  const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS_IMAGE_UPLOAD, params, queryParams });
1014
- return AuthHttpClient.post(apiUrl, payload, {
1026
+ return HttpClient.post(apiUrl, payload, {
1015
1027
  headers: {
1016
1028
  "Content-Type": "multipart/form-data"
1017
1029
  },
@@ -1024,7 +1036,7 @@ var Client = {
1024
1036
  const payload = props.payload;
1025
1037
  const axiosConfig = props.config || {};
1026
1038
  const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS_ATTACHMENT_UPLOAD, params, queryParams });
1027
- return AuthHttpClient.post(apiUrl, payload, {
1039
+ return HttpClient.post(apiUrl, payload, {
1028
1040
  headers: {
1029
1041
  "Content-Type": "multipart/form-data"
1030
1042
  },
@@ -1032,36 +1044,49 @@ var Client = {
1032
1044
  });
1033
1045
  }
1034
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
+ },
1035
1060
  file: {
1036
1061
  list: (props = null) => {
1037
- const portalId = getPortal()?.portalId;
1038
1062
  const params = {
1039
- hubId: config.hubId,
1040
- portalId,
1063
+ // hubId: config.hubId,
1064
+ // portalId: portalId,
1041
1065
  objectId: props?.params?.objectId,
1042
1066
  id: props?.params?.id
1043
1067
  };
1068
+ console.log("params_0", params);
1044
1069
  const apiUrl = generateApiUrl({ route: API_ENDPOINTS.FILES, params, queryParams: props?.queryParams });
1045
- return AuthHttpClient.get(apiUrl);
1070
+ return HttpClient.get(apiUrl);
1046
1071
  },
1047
1072
  details: (props = null) => {
1048
- const portalId = getPortal()?.portalId;
1049
1073
  const params = {
1050
- hubId: config.hubId,
1051
- portalId,
1074
+ // hubId: config.hubId,
1075
+ // portalId: portalId,
1052
1076
  objectId: props?.params?.objectId,
1053
1077
  id: props?.params?.id,
1054
1078
  rowId: props?.params?.rowId
1055
1079
  };
1080
+ console.log("params_1", params);
1056
1081
  const apiUrl = generateApiUrl({ route: API_ENDPOINTS.FILE, params, queryParams: props?.queryParams });
1057
- return AuthHttpClient.get(apiUrl);
1082
+ return HttpClient.get(apiUrl);
1058
1083
  },
1059
1084
  addFolder: (props = null) => {
1060
1085
  const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
1061
1086
  const queryParams = props.queryParams;
1062
1087
  const payload = props.payload;
1063
1088
  const apiUrl = generateApiUrl({ route: API_ENDPOINTS.FILES_CREATE_FOLDER, params, queryParams });
1064
- return AuthHttpClient.post(apiUrl, payload);
1089
+ return HttpClient.post(apiUrl, payload);
1065
1090
  },
1066
1091
  addFile: (props = null) => {
1067
1092
  const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
@@ -1069,7 +1094,7 @@ var Client = {
1069
1094
  const payload = props.payload;
1070
1095
  const axiosConfig = props.config || {};
1071
1096
  const apiUrl = generateApiUrl({ route: API_ENDPOINTS.FILES_UPLOAD, params, queryParams });
1072
- return AuthHttpClient.post(apiUrl, payload, {
1097
+ return HttpClient.post(apiUrl, payload, {
1073
1098
  headers: {
1074
1099
  "Content-Type": "multipart/form-data"
1075
1100
  },
@@ -1111,9 +1136,6 @@ function createMutation(mutationFn, options) {
1111
1136
  }
1112
1137
 
1113
1138
  // src/apis/authentication.ts
1114
- init_auth_utils();
1115
- init_cookie();
1116
- init_token_store();
1117
1139
  function preLogin(options) {
1118
1140
  const { mutate, isLoading } = createMutation(
1119
1141
  async (payload) => {
@@ -1396,7 +1418,6 @@ function createStore(initializer) {
1396
1418
  }
1397
1419
 
1398
1420
  // src/utils/getCookieData.ts
1399
- init_cookie();
1400
1421
  var getAuthSubscriptionType = () => {
1401
1422
  return getCookie("subscriptionType");
1402
1423
  };
@@ -1425,6 +1446,8 @@ var tableStore = createStore((set, get) => ({
1425
1446
  selectedPipeline: "",
1426
1447
  tableParam: {},
1427
1448
  tableDefPermissions: {},
1449
+ tableData: [],
1450
+ tablePrependData: [],
1428
1451
  // ==============================
1429
1452
  // BASIC SETTERS
1430
1453
  // ==============================
@@ -1529,12 +1552,12 @@ var tableStore = createStore((set, get) => ({
1529
1552
  // ==============================
1530
1553
  setGridData: async (type, deals) => {
1531
1554
  if (type === "reset") {
1532
- set({ gridData: [] });
1533
- return;
1555
+ await set({ gridData: [] });
1556
+ return [];
1534
1557
  }
1535
1558
  if (type === "directly") {
1536
- set({ gridData: deals });
1537
- return;
1559
+ await set({ gridData: deals });
1560
+ return deals;
1538
1561
  }
1539
1562
  const finalData = await deals.map(
1540
1563
  (deal) => {
@@ -1593,6 +1616,47 @@ var tableStore = createStore((set, get) => ({
1593
1616
  }
1594
1617
  set({ selectedPipeline: mFilterValue });
1595
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;
1596
1660
  }
1597
1661
  }));
1598
1662
  function useTable() {
@@ -1644,10 +1708,12 @@ function list3(options) {
1644
1708
  const {
1645
1709
  getTableParam
1646
1710
  } = useTable();
1711
+ const { setTableData } = actions;
1647
1712
  const { mutate, isLoading } = createMutation(
1648
1713
  async (payload) => {
1649
1714
  const param = await getTableParam(payload?.companyAsMediator);
1650
1715
  const response = await Client.object.list(payload, param);
1716
+ setTableData(response, payload);
1651
1717
  return response;
1652
1718
  },
1653
1719
  options
@@ -1658,6 +1724,20 @@ function list3(options) {
1658
1724
  isLoading
1659
1725
  };
1660
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
+ }
1661
1741
  function form(options) {
1662
1742
  const { mutate, isLoading } = createMutation(
1663
1743
  async (payload) => {
@@ -1687,9 +1767,12 @@ function objectFormOptions(options) {
1687
1767
  };
1688
1768
  }
1689
1769
  function create(options) {
1770
+ const { setTablePrependData } = actions;
1690
1771
  const { mutate, isLoading } = createMutation(
1691
1772
  async (props) => {
1773
+ if (props?.componentName != "association") await setTablePrependData("loading", props?.payload?.propertyPayload?.hs_pipeline_stage);
1692
1774
  const response = await Client.object.create(props);
1775
+ if (props?.componentName != "association") await setTablePrependData(response, props?.payload?.propertyPayload?.hs_pipeline_stage);
1693
1776
  return response;
1694
1777
  },
1695
1778
  options
@@ -1759,9 +1842,11 @@ function update(options) {
1759
1842
 
1760
1843
  // src/apis/note.ts
1761
1844
  function list4(options) {
1845
+ const { setNotes } = actions2;
1762
1846
  const { mutate, isLoading } = createMutation(
1763
1847
  async (payload) => {
1764
1848
  const response = await Client.note.list(payload);
1849
+ setNotes(response, payload);
1765
1850
  return response;
1766
1851
  },
1767
1852
  options
@@ -1773,9 +1858,12 @@ function list4(options) {
1773
1858
  };
1774
1859
  }
1775
1860
  function create2(options) {
1861
+ const { setPrependNote } = actions2;
1776
1862
  const { mutate, isLoading } = createMutation(
1777
1863
  async (props) => {
1864
+ await setPrependNote("loading");
1778
1865
  const response = await Client.note.create(props);
1866
+ await setPrependNote(response);
1779
1867
  return response;
1780
1868
  },
1781
1869
  options
@@ -1787,9 +1875,11 @@ function create2(options) {
1787
1875
  };
1788
1876
  }
1789
1877
  function update2(options) {
1878
+ const { updatePrependNote } = actions2;
1790
1879
  const { mutate, isLoading } = createMutation(
1791
1880
  async (payload) => {
1792
1881
  const response = await Client.note.update(payload);
1882
+ updatePrependNote(response);
1793
1883
  return response;
1794
1884
  },
1795
1885
  options
@@ -1803,9 +1893,11 @@ function update2(options) {
1803
1893
 
1804
1894
  // src/apis/email.ts
1805
1895
  function list5(options) {
1896
+ const { setEmails } = actions3;
1806
1897
  const { mutate, isLoading } = createMutation(
1807
1898
  async (payload) => {
1808
1899
  const response = await Client.email.list(payload);
1900
+ setEmails(response, payload);
1809
1901
  return response;
1810
1902
  },
1811
1903
  options
@@ -1817,9 +1909,12 @@ function list5(options) {
1817
1909
  };
1818
1910
  }
1819
1911
  function create3(options) {
1912
+ const { setPrependEmail } = actions3;
1820
1913
  const { mutate, isLoading } = createMutation(
1821
1914
  async (props) => {
1915
+ await setPrependEmail("loading");
1822
1916
  const response = await Client.email.create(props);
1917
+ await setPrependEmail(response);
1823
1918
  return response;
1824
1919
  },
1825
1920
  options
@@ -1831,9 +1926,11 @@ function create3(options) {
1831
1926
  };
1832
1927
  }
1833
1928
  function update3(options) {
1929
+ const { updatePrependEmail } = actions3;
1834
1930
  const { mutate, isLoading } = createMutation(
1835
1931
  async (payload) => {
1836
1932
  const response = await Client.email.update(payload);
1933
+ updatePrependEmail(response);
1837
1934
  return response;
1838
1935
  },
1839
1936
  options
@@ -1849,7 +1946,6 @@ function update3(options) {
1849
1946
  function imageUpload(options) {
1850
1947
  const { mutate, isLoading } = createMutation(
1851
1948
  async (payload) => {
1852
- console.log("payload", payload);
1853
1949
  const response = payload?.type === "email" ? await Client.email.image(payload) : await Client.note.image(payload);
1854
1950
  return response;
1855
1951
  },
@@ -1934,10 +2030,31 @@ function addFile(options) {
1934
2030
  };
1935
2031
  }
1936
2032
 
1937
- // src/index.ts
1938
- init_auth_utils();
1939
- init_token_store();
1940
- init_cookie();
2033
+ // src/apis/cache.ts
2034
+ function purge(options) {
2035
+ const { mutate, isLoading } = createMutation(
2036
+ async (payload) => {
2037
+ const safePayload = payload ?? {};
2038
+ const idempotencyKey = typeof safePayload.idempotencyKey === "string" ? safePayload.idempotencyKey : void 0;
2039
+ const headers = idempotencyKey ? { "Idempotency-Key": idempotencyKey } : void 0;
2040
+ const { idempotencyKey: _ignored, ...body } = safePayload;
2041
+ return Client.cache.purge(body, headers);
2042
+ },
2043
+ options
2044
+ );
2045
+ return { mutate, purgeCache: mutate, isLoading };
2046
+ }
2047
+ function purgeStatus(purgeJobId, options) {
2048
+ const { mutate, isLoading } = createMutation(
2049
+ async (jobId) => Client.cache.purgeStatus(jobId ?? purgeJobId),
2050
+ options
2051
+ );
2052
+ return {
2053
+ mutate,
2054
+ getPurgeStatus: () => mutate(purgeJobId),
2055
+ isLoading
2056
+ };
2057
+ }
1941
2058
 
1942
2059
  // src/breadcrumb/breadcrumbs.ts
1943
2060
  var getBreadcrumbs = () => {
@@ -2145,6 +2262,66 @@ var buildChildRoute = (props, breadcrumbItems) => {
2145
2262
  return generateUrl(props, breadcrumbs);
2146
2263
  };
2147
2264
 
2265
+ // src/utils/datetime.ts
2266
+ var DEFAULT_HUBSPOT_TIMEZONE = "Asia/Kolkata";
2267
+ function getCurrentTimeZone() {
2268
+ try {
2269
+ return Intl.DateTimeFormat().resolvedOptions().timeZone || DEFAULT_HUBSPOT_TIMEZONE;
2270
+ } catch {
2271
+ return DEFAULT_HUBSPOT_TIMEZONE;
2272
+ }
2273
+ }
2274
+ function normalizeToTimestamp(value) {
2275
+ if (value == null || value === "") return null;
2276
+ if (typeof value === "number") {
2277
+ return value > 1e11 ? value : null;
2278
+ }
2279
+ if (typeof value === "string" && /^\d+$/.test(value)) {
2280
+ const n = Number(value);
2281
+ return n > 1e11 ? n : null;
2282
+ }
2283
+ if (typeof value === "string" || value instanceof Date) {
2284
+ const date = new Date(value);
2285
+ return Number.isNaN(date.getTime()) ? null : date.getTime();
2286
+ }
2287
+ return null;
2288
+ }
2289
+ function formatGmtOffset(timeZone = getCurrentTimeZone(), date = /* @__PURE__ */ new Date()) {
2290
+ const raw = new Intl.DateTimeFormat("en-US", {
2291
+ timeZone,
2292
+ timeZoneName: "longOffset"
2293
+ }).formatToParts(date).find((part) => part.type === "timeZoneName")?.value;
2294
+ if (!raw) return "";
2295
+ return raw.replace(/GMT([+-])0(\d)(?=:)/, "GMT$1$2");
2296
+ }
2297
+ function formatHubSpotActivityDateTimeParts(timestamp, timeZone = getCurrentTimeZone()) {
2298
+ const ms = normalizeToTimestamp(timestamp);
2299
+ if (ms == null) return null;
2300
+ const date = new Date(ms);
2301
+ const datePart = new Intl.DateTimeFormat("en-US", {
2302
+ timeZone,
2303
+ month: "long",
2304
+ day: "numeric",
2305
+ year: "numeric"
2306
+ }).format(date);
2307
+ const timePart = new Intl.DateTimeFormat("en-US", {
2308
+ timeZone,
2309
+ hour: "numeric",
2310
+ minute: "2-digit",
2311
+ hour12: true
2312
+ }).format(date);
2313
+ const gmtOffset = formatGmtOffset(timeZone, date);
2314
+ return {
2315
+ date: datePart,
2316
+ time: timePart,
2317
+ gmtOffset,
2318
+ formatted: `${datePart} at ${timePart} ${gmtOffset}`.trim()
2319
+ };
2320
+ }
2321
+ function formatHubSpotActivityDateTime(timestamp, timeZone = getCurrentTimeZone()) {
2322
+ return formatHubSpotActivityDateTimeParts(timestamp, timeZone)?.formatted ?? "";
2323
+ }
2324
+
2148
2325
  // src/index.ts
2149
2326
  var api = {
2150
2327
  preLogin,
@@ -2166,6 +2343,7 @@ var api = {
2166
2343
  pipelines: list,
2167
2344
  stages: list2,
2168
2345
  objects: list3,
2346
+ sideBarObjects: sideBarList,
2169
2347
  objectsForm: form,
2170
2348
  createObject: create,
2171
2349
  createExistingObject: createExisting,
@@ -2185,6 +2363,8 @@ var api = {
2185
2363
  file: details2,
2186
2364
  addFolder,
2187
2365
  addFile,
2366
+ purgeCache: purge,
2367
+ cachePurgeStatus: purgeStatus,
2188
2368
  getRefreshToken,
2189
2369
  getAuthRefreshToken,
2190
2370
  isCookieExpired,
@@ -2210,6 +2390,6 @@ var routeParam = {
2210
2390
  getParamDetails
2211
2391
  };
2212
2392
 
2213
- export { api, breadcrumbsDetails, getFieldErrors, getFormErrors, initializeHttpClient, routeParam, store, url };
2393
+ export { DEFAULT_HUBSPOT_TIMEZONE, api, breadcrumbsDetails, client_exports as clint, formatGmtOffset, formatHubSpotActivityDateTime, formatHubSpotActivityDateTimeParts, getCurrentTimeZone, getFieldErrors, getFormErrors, initializeHttpClient, normalizeToTimestamp, routeParam, store, url };
2214
2394
  //# sourceMappingURL=index.js.map
2215
2395
  //# sourceMappingURL=index.js.map