woodsportal-client-sdk 4.0.0-dev.0 → 4.0.0-dev.1

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.
@@ -1,5 +1,5 @@
1
- import { multiObjectStore, actions, tableUiStore, tableUiActions } from './chunk-SSS4DNXP.js';
2
- import { uploaderStore, actions3, syncStore, actions7, userStore, actions6, emailStore, actions5, noteStore, actions4, tableStore, actions2 } from './chunk-KBXI2JBA.js';
1
+ import { multiObjectStore, actions } from './chunk-7KE6XWM5.js';
2
+ import { uploaderStore, actions3, syncStore, actions7, userStore, actions6, emailStore, actions5, noteStore, actions4, tableUiStore, tableUiActions, tableStore, actions2 } from './chunk-5TLHHOP5.js';
3
3
 
4
4
  // src/main/adapters/shared/createAdapterHooks.ts
5
5
  function createAdapterHooks(createComposable) {
@@ -16,5 +16,5 @@ function createAdapterHooks(createComposable) {
16
16
  }
17
17
 
18
18
  export { createAdapterHooks };
19
- //# sourceMappingURL=chunk-H57IQHVF.js.map
20
- //# sourceMappingURL=chunk-H57IQHVF.js.map
19
+ //# sourceMappingURL=chunk-4CTHZLKL.js.map
20
+ //# sourceMappingURL=chunk-4CTHZLKL.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/main/adapters/shared/createAdapterHooks.ts"],"names":["actions"],"mappings":";;;;AAgCO,SAAS,mBAAmB,gBAAA,EAAqC;AACpE,EAAA,OAAO;AAAA,IACH,QAAA,EAAU,gBAAA,CAAkD,UAAA,EAAYA,QAAY,CAAA;AAAA,IACpF,UAAA,EAAY,gBAAA,CAAsD,YAAA,EAAc,cAAc,CAAA;AAAA,IAC9F,qBAAA,EAAuB,gBAAA,CAAiB,gBAAA,EAAkBA,OAAkB,CAAA;AAAA,IAC5E,OAAA,EAAS,gBAAA,CAAgD,SAAA,EAAWA,QAAW,CAAA;AAAA,IAC/E,QAAA,EAAU,gBAAA,CAAkD,UAAA,EAAYA,QAAY,CAAA;AAAA,IACpF,OAAA,EAAS,gBAAA,CAAgD,SAAA,EAAWA,QAAW,CAAA;AAAA,IAC/E,OAAA,EAAS,gBAAA,CAAgD,SAAA,EAAWA,QAAW,CAAA;AAAA,IAC/E,WAAA,EAAa,gBAAA,CAAwD,aAAA,EAAeA,QAAe;AAAA,GACvG;AACJ","file":"chunk-H57IQHVF.js","sourcesContent":["import type { SubscribableStore } from './bindStoreWithActions'\nimport {\n tableStore,\n tableActions,\n type TableState,\n tableUiStore,\n tableUiActions,\n type TableUiState,\n multiObjectStore,\n multiObjectActions,\n noteStore,\n noteActions,\n type NoteState,\n emailStore,\n emailActions,\n type EmailState,\n userStore,\n userActions,\n type UserState,\n syncStore,\n syncActions,\n type SyncState,\n uploaderStore,\n uploaderActions,\n type UploaderState\n} from './stores'\n\ntype ComposableFactory = <TState extends object, TActions extends object>(\n store: SubscribableStore<TState>,\n actions: TActions\n) => () => TState & TActions\n\nexport function createAdapterHooks(createComposable: ComposableFactory) {\n return {\n useTable: createComposable<TableState, typeof tableActions>(tableStore, tableActions),\n useTableUi: createComposable<TableUiState, typeof tableUiActions>(tableUiStore, tableUiActions),\n useMultiObjectActions: createComposable(multiObjectStore, multiObjectActions),\n useNote: createComposable<NoteState, typeof noteActions>(noteStore, noteActions),\n useEmail: createComposable<EmailState, typeof emailActions>(emailStore, emailActions),\n useUser: createComposable<UserState, typeof userActions>(userStore, userActions),\n useSync: createComposable<SyncState, typeof syncActions>(syncStore, syncActions),\n useUploader: createComposable<UploaderState, typeof uploaderActions>(uploaderStore, uploaderActions)\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/main/adapters/shared/createAdapterHooks.ts"],"names":["actions"],"mappings":";;;;AAgCO,SAAS,mBAAmB,gBAAA,EAAqC;AACpE,EAAA,OAAO;AAAA,IACH,QAAA,EAAU,gBAAA,CAAkD,UAAA,EAAYA,QAAY,CAAA;AAAA,IACpF,UAAA,EAAY,gBAAA,CAAsD,YAAA,EAAc,cAAc,CAAA;AAAA,IAC9F,qBAAA,EAAuB,gBAAA,CAAiB,gBAAA,EAAkBA,OAAkB,CAAA;AAAA,IAC5E,OAAA,EAAS,gBAAA,CAAgD,SAAA,EAAWA,QAAW,CAAA;AAAA,IAC/E,QAAA,EAAU,gBAAA,CAAkD,UAAA,EAAYA,QAAY,CAAA;AAAA,IACpF,OAAA,EAAS,gBAAA,CAAgD,SAAA,EAAWA,QAAW,CAAA;AAAA,IAC/E,OAAA,EAAS,gBAAA,CAAgD,SAAA,EAAWA,QAAW,CAAA;AAAA,IAC/E,WAAA,EAAa,gBAAA,CAAwD,aAAA,EAAeA,QAAe;AAAA,GACvG;AACJ","file":"chunk-4CTHZLKL.js","sourcesContent":["import type { SubscribableStore } from './bindStoreWithActions'\nimport {\n tableStore,\n tableActions,\n type TableState,\n tableUiStore,\n tableUiActions,\n type TableUiState,\n multiObjectStore,\n multiObjectActions,\n noteStore,\n noteActions,\n type NoteState,\n emailStore,\n emailActions,\n type EmailState,\n userStore,\n userActions,\n type UserState,\n syncStore,\n syncActions,\n type SyncState,\n uploaderStore,\n uploaderActions,\n type UploaderState\n} from './stores'\n\ntype ComposableFactory = <TState extends object, TActions extends object>(\n store: SubscribableStore<TState>,\n actions: TActions\n) => () => TState & TActions\n\nexport function createAdapterHooks(createComposable: ComposableFactory) {\n return {\n useTable: createComposable<TableState, typeof tableActions>(tableStore, tableActions),\n useTableUi: createComposable<TableUiState, typeof tableUiActions>(tableUiStore, tableUiActions),\n useMultiObjectActions: createComposable(multiObjectStore, multiObjectActions),\n useNote: createComposable<NoteState, typeof noteActions>(noteStore, noteActions),\n useEmail: createComposable<EmailState, typeof emailActions>(emailStore, emailActions),\n useUser: createComposable<UserState, typeof userActions>(userStore, userActions),\n useSync: createComposable<SyncState, typeof syncActions>(syncStore, syncActions),\n useUploader: createComposable<UploaderState, typeof uploaderActions>(uploaderStore, uploaderActions)\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { getProfile, setProfileDetails } from './chunk-3FUHGFAQ.js';
1
+ import { getProfile, setProfileDetails, getCookie } from './chunk-3FUHGFAQ.js';
2
2
  import axios from 'axios';
3
3
  import pako from 'pako';
4
4
  import { Base64 } from 'js-base64';
@@ -178,6 +178,30 @@ function createStore(initialState) {
178
178
  };
179
179
  }
180
180
 
181
+ // src/main/state/crm/table-ui.ts
182
+ var tableUiStore = createStore({
183
+ tableUniqueId: null,
184
+ gridData: [],
185
+ sort: "-hs_createdate",
186
+ limit: 10,
187
+ after: "",
188
+ page: 1,
189
+ nextPage: 1,
190
+ stageId: "",
191
+ totalItems: 1,
192
+ numOfPages: 1,
193
+ currentPage: 1,
194
+ search: "",
195
+ filterPropertyName: "hs_pipeline",
196
+ filterOperator: "eq",
197
+ filterValue: "",
198
+ isPrimaryCompany: null,
199
+ view: null,
200
+ selectedPipeline: "",
201
+ tableParam: {},
202
+ tableDefPermissions: {}
203
+ });
204
+
181
205
  // src/main/state/crm/use-form.ts
182
206
  var formStore = createStore({
183
207
  form: null
@@ -234,8 +258,16 @@ var actions2 = {
234
258
  });
235
259
  }
236
260
  if (response?.info?.viewType == "BOARD") {
237
- const stageId = context?.stageId;
261
+ const storeStageId = tableUiStore.getState().stageId;
262
+ const stageId = storeStageId !== void 0 && storeStageId !== null && storeStageId !== "" ? storeStageId : context?.stageId;
238
263
  if (stageId) {
264
+ const existingResults = state.objectsData?.data?.results;
265
+ if (!Array.isArray(existingResults)) {
266
+ tableStore.setState({
267
+ objectsData: response
268
+ });
269
+ return;
270
+ }
239
271
  const boardData = { ...state.objectsData };
240
272
  const updatedBoardData = await {
241
273
  ...boardData,
@@ -791,43 +823,9 @@ var actions6 = {
791
823
  }
792
824
  };
793
825
 
794
- // src/main/state/crm/use-sync.ts
795
- var syncStore = createStore({
796
- apiSync: false,
797
- sync: false,
798
- isSyncLoading: false,
799
- isSyncDisable: false
800
- });
801
- var actions7 = {
802
- setIsSyncLoading(status) {
803
- syncStore.setState({
804
- isSyncLoading: status,
805
- sync: status
806
- });
807
- },
808
- setSync(status) {
809
- resetAllStore();
810
- syncStore.setState({
811
- isSyncLoading: status,
812
- sync: status
813
- });
814
- },
815
- setApiSync(status) {
816
- syncStore.setState({
817
- isSyncLoading: status,
818
- apiSync: status
819
- });
820
- },
821
- setSyncDisable(status) {
822
- syncStore.setState({
823
- isSyncDisable: status
824
- });
825
- }
826
- };
827
- var resetAllStore = () => {
828
- actions2.clearTablePrependData();
829
- actions4.clearPrependNotes();
830
- actions5.clearPrependEmails();
826
+ // src/main/core/utils/getCookieData.ts
827
+ var getAuthSubscriptionType = () => {
828
+ return getCookie("subscriptionType");
831
829
  };
832
830
  function convertToBase64(obj) {
833
831
  try {
@@ -962,42 +960,6 @@ var keyMap = {
962
960
  pId: "pipeline_id"
963
961
  };
964
962
 
965
- // src/main/core/utils/url.ts
966
- var ticketHubspotObjectTypeId = () => {
967
- const paramDetails = getParamDetails();
968
- if (
969
- // this hubspotObjectTypeId only for main contact ticket object type
970
- paramDetails?.breadcrumbs?.length === 2 && paramDetails?.breadcrumbs[0]?.pt === "/0-5"
971
- ) {
972
- return "0-1";
973
- }
974
- if (
975
- // this hubspotObjectTypeId only for main company ticket object type
976
- paramDetails?.breadcrumbs?.length === 2 && paramDetails?.breadcrumbs[0]?.pt === "/0-5-c"
977
- ) {
978
- return "0-2";
979
- }
980
- return "";
981
- };
982
-
983
- // src/main/core/utils/param.ts
984
- function getParam(paramName) {
985
- if (typeof globalThis === "undefined" || !globalThis.location) return null;
986
- const hash = globalThis.location.hash || "";
987
- if (!hash.startsWith("#/")) return null;
988
- const hashWithoutHash = hash.startsWith("#") ? hash.substring(1) : hash;
989
- const queryString = hashWithoutHash.split("?")[1];
990
- if (!queryString) return null;
991
- const params = new URLSearchParams(queryString);
992
- return params.get(paramName);
993
- }
994
- function getPath() {
995
- if (typeof globalThis === "undefined" || !globalThis.location) return null;
996
- const hash = globalThis.location.hash || "";
997
- if (!hash.startsWith("#/")) return null;
998
- return hash.slice(1).split("?")[0];
999
- }
1000
-
1001
963
  // src/main/features/navigation/param.ts
1002
964
  var getRouteMenu = (path) => {
1003
965
  const apiRoutes = globalThis?.apiRoutes || [];
@@ -1094,6 +1056,42 @@ var getParamDetails = (props, isDetailsPage = false) => {
1094
1056
  };
1095
1057
  };
1096
1058
 
1059
+ // src/main/core/utils/url.ts
1060
+ var ticketHubspotObjectTypeId = () => {
1061
+ const paramDetails = getParamDetails();
1062
+ if (
1063
+ // this hubspotObjectTypeId only for main contact ticket object type
1064
+ paramDetails?.breadcrumbs?.length === 2 && paramDetails?.breadcrumbs[0]?.pt === "/0-5"
1065
+ ) {
1066
+ return "0-1";
1067
+ }
1068
+ if (
1069
+ // this hubspotObjectTypeId only for main company ticket object type
1070
+ paramDetails?.breadcrumbs?.length === 2 && paramDetails?.breadcrumbs[0]?.pt === "/0-5-c"
1071
+ ) {
1072
+ return "0-2";
1073
+ }
1074
+ return "";
1075
+ };
1076
+
1077
+ // src/main/core/utils/param.ts
1078
+ function getParam(paramName) {
1079
+ if (typeof globalThis === "undefined" || !globalThis.location) return null;
1080
+ const hash = globalThis.location.hash || "";
1081
+ if (!hash.startsWith("#/")) return null;
1082
+ const hashWithoutHash = hash.startsWith("#") ? hash.substring(1) : hash;
1083
+ const queryString = hashWithoutHash.split("?")[1];
1084
+ if (!queryString) return null;
1085
+ const params = new URLSearchParams(queryString);
1086
+ return params.get(paramName);
1087
+ }
1088
+ function getPath() {
1089
+ if (typeof globalThis === "undefined" || !globalThis.location) return null;
1090
+ const hash = globalThis.location.hash || "";
1091
+ if (!hash.startsWith("#/")) return null;
1092
+ return hash.slice(1).split("?")[0];
1093
+ }
1094
+
1097
1095
  // src/main/features/navigation/url.ts
1098
1096
  var updateLink = () => {
1099
1097
  const updateLink2 = async (props, displayName = "prm") => {
@@ -1195,6 +1193,232 @@ var updateBParam = (newValue) => {
1195
1193
  }
1196
1194
  };
1197
1195
 
1198
- export { actions, actions2, actions3, actions4, actions5, actions6, actions7, breadcrumbStage, configureLogger, createStore, decodeToBase64, emailStore, generatePath, generateUrl, getParam, getParamDetails, getPath, getRouteDetails, getRouteMenu, isHttpTracingEnabled, isMessingParent, isMessingParentLastItem, logger, noteStore, resetAllStore, sanitizeAxiosErrorData, syncStore, tableStore, ticketHubspotObjectTypeId, updateLink, uploaderStore, userStore };
1199
- //# sourceMappingURL=chunk-KBXI2JBA.js.map
1200
- //# sourceMappingURL=chunk-KBXI2JBA.js.map
1196
+ // src/main/state/crm/table-ui-actions.ts
1197
+ var pageLimit = 10;
1198
+ var boardPaginationDefaults = {
1199
+ stageId: "",
1200
+ nextPage: 1
1201
+ };
1202
+ var tableUiActions = {
1203
+ setTableUniqueId(v) {
1204
+ tableUiStore.setState({ tableUniqueId: v });
1205
+ },
1206
+ setSort(v) {
1207
+ tableUiStore.setState({ sort: v });
1208
+ },
1209
+ setLimit(v) {
1210
+ tableUiStore.setState({ limit: v });
1211
+ },
1212
+ setAfter(v) {
1213
+ tableUiStore.setState({ after: v });
1214
+ },
1215
+ setPage(v) {
1216
+ tableUiStore.setState({ page: v });
1217
+ },
1218
+ setNextPage(v) {
1219
+ tableUiStore.setState({ nextPage: v });
1220
+ },
1221
+ setStageId(v) {
1222
+ tableUiStore.setState({ stageId: v });
1223
+ },
1224
+ setTotalItems(v) {
1225
+ tableUiStore.setState({ totalItems: v });
1226
+ },
1227
+ setNumOfPages(v) {
1228
+ tableUiStore.setState({ numOfPages: v });
1229
+ },
1230
+ setCurrentPage(v) {
1231
+ tableUiStore.setState({ currentPage: v });
1232
+ },
1233
+ setSearch(v) {
1234
+ tableUiStore.setState({ search: v });
1235
+ },
1236
+ setFilterPropertyName(v) {
1237
+ tableUiStore.setState({ filterPropertyName: v });
1238
+ },
1239
+ setFilterOperator(v) {
1240
+ tableUiStore.setState({ filterOperator: v });
1241
+ },
1242
+ setFilterValue(v) {
1243
+ tableUiStore.setState({ filterValue: v });
1244
+ },
1245
+ setIsPrimaryCompany(v) {
1246
+ tableUiStore.setState({ isPrimaryCompany: v });
1247
+ },
1248
+ setTableFilterData(v) {
1249
+ tableUiStore.setState({ tableParam: v });
1250
+ },
1251
+ setTableDefPermissions(v) {
1252
+ tableUiStore.setState({ tableDefPermissions: v });
1253
+ },
1254
+ setView(mView) {
1255
+ tableUiStore.setState({
1256
+ page: getAuthSubscriptionType() === "FREE" ? "" : 1,
1257
+ view: mView,
1258
+ ...boardPaginationDefaults
1259
+ });
1260
+ },
1261
+ changePipeline(mView) {
1262
+ tableUiStore.setState({
1263
+ page: getAuthSubscriptionType() === "FREE" ? "" : 1,
1264
+ selectedPipeline: mView || ""
1265
+ });
1266
+ },
1267
+ setSelectedPipeline(pipelines, pipeLineId) {
1268
+ let filterValue = "";
1269
+ if (pipeLineId) {
1270
+ const pipelineSingle = pipelines.find((pipeline) => pipeline.pipelineId === pipeLineId);
1271
+ filterValue = pipelineSingle?.pipelineId || "";
1272
+ }
1273
+ tableUiStore.setState({
1274
+ filterPropertyName: "hs_pipeline",
1275
+ filterOperator: "eq",
1276
+ filterValue,
1277
+ selectedPipeline: filterValue
1278
+ });
1279
+ },
1280
+ resetTableParam() {
1281
+ tableUiStore.setState({
1282
+ sort: "-hs_createdate",
1283
+ limit: pageLimit,
1284
+ after: "",
1285
+ page: getAuthSubscriptionType() === "FREE" ? "" : 1,
1286
+ totalItems: 1,
1287
+ numOfPages: 1,
1288
+ currentPage: 1,
1289
+ search: "",
1290
+ filterPropertyName: "hs_pipeline",
1291
+ filterOperator: "eq",
1292
+ filterValue: "",
1293
+ isPrimaryCompany: null,
1294
+ selectedPipeline: ""
1295
+ });
1296
+ },
1297
+ getTableParam(companyAsMediator, currentPageOverride) {
1298
+ const state = tableUiStore.getState();
1299
+ const baseParams = {
1300
+ sort: state.sort,
1301
+ search: state.search,
1302
+ filterPropertyName: state.filterPropertyName,
1303
+ filterOperator: state.filterOperator,
1304
+ filterValue: state.selectedPipeline,
1305
+ cache: true,
1306
+ isPrimaryCompany: companyAsMediator || false,
1307
+ view: state.view
1308
+ };
1309
+ if (getAuthSubscriptionType() === "FREE") {
1310
+ return {
1311
+ ...baseParams,
1312
+ after: state.page
1313
+ };
1314
+ }
1315
+ return {
1316
+ ...baseParams,
1317
+ limit: state.limit,
1318
+ page: currentPageOverride ?? state.page,
1319
+ ...state.after ? { after: state.after } : {}
1320
+ };
1321
+ },
1322
+ buildListTableParams(options) {
1323
+ return tableUiActions.getTableParam(options?.companyAsMediator, options?.currentPageOverride);
1324
+ },
1325
+ async setGridData(type, deals) {
1326
+ if (type === "reset") {
1327
+ tableUiStore.setState({ gridData: [] });
1328
+ return [];
1329
+ }
1330
+ if (type === "directly") {
1331
+ tableUiStore.setState({ gridData: deals });
1332
+ return deals;
1333
+ }
1334
+ const finalData = deals.map((deal) => {
1335
+ const cards = deal?.data?.results?.rows?.map((row) => ({
1336
+ id: row?.hs_object_id,
1337
+ ...row,
1338
+ hubspotObjectTypeId: type === "deals" ? "0-3" : "0-5"
1339
+ })) || [];
1340
+ return {
1341
+ id: deal.id,
1342
+ name: deal.label,
1343
+ count: deal?.data?.total,
1344
+ ...deal,
1345
+ cards
1346
+ };
1347
+ });
1348
+ tableUiStore.setState({ gridData: finalData });
1349
+ return finalData;
1350
+ },
1351
+ setDefaultPipeline(data, hubspotObjectTypeId) {
1352
+ if (!data) {
1353
+ tableUiStore.setState({ selectedPipeline: "" });
1354
+ return "";
1355
+ }
1356
+ const { updateLink: updateLink2, filterParams } = updateLink();
1357
+ const params = filterParams();
1358
+ const excludedIds = ["0-1", "0-2", "0-3", "0-4", "0-5", "home"];
1359
+ const state = tableUiStore.getState();
1360
+ const view = state.view;
1361
+ const selectedPipeline = state.selectedPipeline;
1362
+ let defaultPipelineId = "";
1363
+ let mFilterValue = "";
1364
+ const defaultPipeline = data?.data?.[0];
1365
+ if (excludedIds.includes(hubspotObjectTypeId)) {
1366
+ defaultPipelineId = defaultPipeline?.pipelineId || "";
1367
+ }
1368
+ if (params && params?.filterPropertyName === "hs_pipeline" && params?.filterValue) {
1369
+ mFilterValue = params.filterValue;
1370
+ } else if (view === "BOARD" && !selectedPipeline) {
1371
+ mFilterValue = defaultPipelineId;
1372
+ updateLink2({ fV: defaultPipelineId });
1373
+ } else if (!excludedIds.includes(hubspotObjectTypeId)) {
1374
+ mFilterValue = selectedPipeline || null;
1375
+ } else {
1376
+ mFilterValue = data.data.length === 1 ? defaultPipelineId : selectedPipeline;
1377
+ }
1378
+ tableUiStore.setState({ selectedPipeline: mFilterValue });
1379
+ return mFilterValue;
1380
+ }
1381
+ };
1382
+
1383
+ // src/main/state/crm/use-sync.ts
1384
+ var syncStore = createStore({
1385
+ apiSync: false,
1386
+ sync: false,
1387
+ isSyncLoading: false,
1388
+ isSyncDisable: false
1389
+ });
1390
+ var actions7 = {
1391
+ setIsSyncLoading(status) {
1392
+ syncStore.setState({
1393
+ isSyncLoading: status,
1394
+ sync: status
1395
+ });
1396
+ },
1397
+ setSync(status) {
1398
+ resetAllStore();
1399
+ syncStore.setState({
1400
+ isSyncLoading: status,
1401
+ sync: status
1402
+ });
1403
+ },
1404
+ setApiSync(status) {
1405
+ syncStore.setState({
1406
+ isSyncLoading: status,
1407
+ apiSync: status
1408
+ });
1409
+ },
1410
+ setSyncDisable(status) {
1411
+ syncStore.setState({
1412
+ isSyncDisable: status
1413
+ });
1414
+ }
1415
+ };
1416
+ var resetAllStore = () => {
1417
+ actions2.clearTablePrependData();
1418
+ actions4.clearPrependNotes();
1419
+ actions5.clearPrependEmails();
1420
+ };
1421
+
1422
+ export { actions, actions2, actions3, actions4, actions5, actions6, actions7, breadcrumbStage, configureLogger, createStore, decodeToBase64, emailStore, generatePath, generateUrl, getParam, getParamDetails, getPath, getRouteDetails, getRouteMenu, isHttpTracingEnabled, isMessingParent, isMessingParentLastItem, logger, noteStore, resetAllStore, sanitizeAxiosErrorData, syncStore, tableStore, tableUiActions, tableUiStore, ticketHubspotObjectTypeId, updateLink, uploaderStore, userStore };
1423
+ //# sourceMappingURL=chunk-5TLHHOP5.js.map
1424
+ //# sourceMappingURL=chunk-5TLHHOP5.js.map