woodsportal-client-sdk 4.0.4-dev.2 → 4.0.4-dev.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +2 -0
  2. package/dist/adapters/angular/index.d.ts +2 -1
  3. package/dist/adapters/angular/index.js +4 -4
  4. package/dist/adapters/react/index.d.ts +2 -1
  5. package/dist/adapters/react/index.js +4 -4
  6. package/dist/adapters/vue/index.d.ts +2 -1
  7. package/dist/adapters/vue/index.js +4 -4
  8. package/dist/auth-error-codes-D7CXVBEN.js +3 -0
  9. package/dist/auth-error-codes-D7CXVBEN.js.map +1 -0
  10. package/dist/auth-interceptor-policy-F7JIJWSQ.js +4 -0
  11. package/dist/auth-interceptor-policy-F7JIJWSQ.js.map +1 -0
  12. package/dist/auth-utils-VTD5TFYE.js +3 -0
  13. package/dist/{auth-utils-MNMC2QGX.js.map → auth-utils-VTD5TFYE.js.map} +1 -1
  14. package/dist/{cache-purge-G5WkHckd.d.ts → cache-purge-Ca4idzyy.d.ts} +1 -1
  15. package/dist/{chunk-D7XKR2O7.js → chunk-BWZAX23E.js} +11 -10
  16. package/dist/chunk-BWZAX23E.js.map +1 -0
  17. package/dist/chunk-COHBSTHF.js +82 -0
  18. package/dist/chunk-COHBSTHF.js.map +1 -0
  19. package/dist/{chunk-YEUFUGGT.js → chunk-GLATNYVU.js} +159 -46
  20. package/dist/chunk-GLATNYVU.js.map +1 -0
  21. package/dist/{chunk-GO35W5PN.js → chunk-IUVL2E7K.js} +175 -17
  22. package/dist/chunk-IUVL2E7K.js.map +1 -0
  23. package/dist/{chunk-FDZNMZS4.js → chunk-LSRSCZBI.js} +507 -166
  24. package/dist/chunk-LSRSCZBI.js.map +1 -0
  25. package/dist/{chunk-VEJKNXUE.js → chunk-LYPJXG74.js} +4 -4
  26. package/dist/{chunk-VEJKNXUE.js.map → chunk-LYPJXG74.js.map} +1 -1
  27. package/dist/chunk-MFIGS74G.js +140 -0
  28. package/dist/chunk-MFIGS74G.js.map +1 -0
  29. package/dist/{chunk-6KKVGCXG.js → chunk-ND7HCTXC.js} +3 -3
  30. package/dist/{chunk-6KKVGCXG.js.map → chunk-ND7HCTXC.js.map} +1 -1
  31. package/dist/{chunk-QPSCMK4W.js → chunk-TVUBMDXX.js} +74 -13
  32. package/dist/chunk-TVUBMDXX.js.map +1 -0
  33. package/dist/entries/auth.d.ts +17 -4
  34. package/dist/entries/auth.js +7 -4
  35. package/dist/entries/auth.js.map +1 -1
  36. package/dist/entries/crm.d.ts +4 -3
  37. package/dist/entries/crm.js +5 -5
  38. package/dist/{http-errors-hlKcIsXD.d.ts → http-errors-B41BMjip.d.ts} +252 -15
  39. package/dist/{index-CCwMopD8.d.ts → index-Bh9eY8sA.d.ts} +5 -1
  40. package/dist/index.d.ts +36 -10
  41. package/dist/index.js +11 -8
  42. package/dist/index.js.map +1 -1
  43. package/package.json +4 -3
  44. package/dist/auth-utils-MNMC2QGX.js +0 -3
  45. package/dist/chunk-D7XKR2O7.js.map +0 -1
  46. package/dist/chunk-FDZNMZS4.js.map +0 -1
  47. package/dist/chunk-GO35W5PN.js.map +0 -1
  48. package/dist/chunk-QPSCMK4W.js.map +0 -1
  49. package/dist/chunk-YEUFUGGT.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { getProfile, setProfileDetails, getCookie } from './chunk-QPSCMK4W.js';
1
+ import { getProfile, setProfileDetails, getCookie } from './chunk-TVUBMDXX.js';
2
2
  import axios from 'axios';
3
3
  import pako from 'pako';
4
4
  import { Base64 } from 'js-base64';
@@ -230,6 +230,63 @@ var tableStore = createStore({
230
230
  selectedPipeline: "",
231
231
  viewType: ""
232
232
  });
233
+ function getBoardStagesFromState(state) {
234
+ const fromTable = state.tableData?.data?.results;
235
+ if (Array.isArray(fromTable)) {
236
+ return fromTable;
237
+ }
238
+ const fromObjects = state.objectsData?.data?.results;
239
+ if (Array.isArray(fromObjects)) {
240
+ return fromObjects;
241
+ }
242
+ return [];
243
+ }
244
+ function isBoardStagePageResponse(response) {
245
+ const results = response?.data?.results;
246
+ return response?.info?.viewType === "BOARD" && results != null && !Array.isArray(results);
247
+ }
248
+ function resolveRecordIdFromResponseData(data) {
249
+ if (!data) {
250
+ return void 0;
251
+ }
252
+ const id = data.id ?? data.hs_object_id?.value ?? data.hs_object_id;
253
+ return id != null && id !== "" ? String(id) : void 0;
254
+ }
255
+ function mapResponseFieldsToRowValues(data) {
256
+ return Object.fromEntries(Object.entries(data).map(([key, value]) => [key, value?.value ?? value]));
257
+ }
258
+ function matchRowId(row, recordId) {
259
+ const rowId = row?.id ?? row?.hs_object_id;
260
+ return rowId != null && String(rowId) === recordId;
261
+ }
262
+ function matchHsObjectId(row, recordId) {
263
+ return row?.hs_object_id != null && String(row.hs_object_id) === recordId;
264
+ }
265
+ function mergeRowWithResponseData(row, data) {
266
+ return { ...row, ...mapResponseFieldsToRowValues(data) };
267
+ }
268
+ function patchListRows(rows, data, recordId, matchRow = matchRowId) {
269
+ return rows.map((row) => matchRow(row, recordId) ? mergeRowWithResponseData(row, data) : row);
270
+ }
271
+ function patchBoardStages(stages, data, recordId, matchRow = matchRowId) {
272
+ return stages.map((stage) => ({
273
+ ...stage,
274
+ data: {
275
+ ...stage.data,
276
+ results: {
277
+ ...stage.data?.results,
278
+ rows: patchListRows(stage.data?.results?.rows ?? [], data, recordId, matchRow)
279
+ }
280
+ }
281
+ }));
282
+ }
283
+ function resolveRecordId(payload, data) {
284
+ const payloadId = payload?.params?.id;
285
+ if (payloadId != null && payloadId !== "") {
286
+ return String(payloadId);
287
+ }
288
+ return resolveRecordIdFromResponseData(data);
289
+ }
233
290
  var actions2 = {
234
291
  /** Called from Client.object.list — feeds purgeCrmListCacheAfterCrmWrite / purgeCrmDetailAndListAfterCrmWrite. */
235
292
  setObjectsQueryParams(params) {
@@ -307,7 +364,7 @@ var actions2 = {
307
364
  const viewType = response?.info?.viewType;
308
365
  let newTablePrependData;
309
366
  if (viewType === "BOARD") {
310
- const stages = response?.data?.results ?? [];
367
+ const stages = Array.isArray(response?.data?.results) ? response.data.results : getBoardStagesFromState(state);
311
368
  newTablePrependData = state.tablePrependData.map((prependStage) => {
312
369
  const matchingStage = stages.find((stage) => String(stage.id) === String(prependStage.id));
313
370
  const rows = matchingStage?.data?.results?.rows ?? [];
@@ -358,8 +415,9 @@ var actions2 = {
358
415
  if (payload.isFristTimeLoadData) {
359
416
  newTablePrependData = [];
360
417
  }
418
+ const preserveBoardTableData = isBoardStagePageResponse(response) && state.tableData?.info?.viewType === "BOARD" && Array.isArray(state.tableData?.data?.results);
361
419
  tableStore.setState({
362
- tableData: response,
420
+ tableData: preserveBoardTableData ? state.tableData : response,
363
421
  tablePrependData: newTablePrependData || [],
364
422
  hubspotObjectTypeId,
365
423
  viewType
@@ -407,7 +465,7 @@ var actions2 = {
407
465
  let rows = [];
408
466
  if (state.tableData?.info?.viewType == "BOARD") {
409
467
  if (response === "loading") {
410
- const responseData = state.tableData?.data?.results ?? [];
468
+ const responseData = getBoardStagesFromState(state);
411
469
  const pipelineStage = props?.payload?.propertyPayload?.hs_pipeline_stage || props?.payload?.propertyPayload?.dealstage || formState?.form?.data?.pipelineDefaults?.defaultStage?.id;
412
470
  rows = responseData.map(({ id, data }) => {
413
471
  const matchedPrepend = state.tablePrependData.find((item) => String(item.id) === String(id));
@@ -489,6 +547,69 @@ var actions2 = {
489
547
  tableStore.setState({
490
548
  tablePrependData: rows
491
549
  });
550
+ },
551
+ updateTablePrependData(response, payload) {
552
+ const data = response?.data;
553
+ const recordId = resolveRecordId(payload, data);
554
+ if (!data || !recordId) {
555
+ return response;
556
+ }
557
+ const state = tableStore.getState();
558
+ const viewType = state.tableData?.info?.viewType ?? state.viewType;
559
+ const objectsDataMatcher = payload?.params?.id != null && payload.params.id !== "" ? matchHsObjectId : matchRowId;
560
+ let tablePrependData = state.tablePrependData;
561
+ if (viewType === "BOARD") {
562
+ tablePrependData = patchBoardStages(state.tablePrependData, data, recordId);
563
+ } else {
564
+ tablePrependData = patchListRows(state.tablePrependData, data, recordId);
565
+ }
566
+ const stateUpdates = { tablePrependData };
567
+ const patchListResponse = (cached, matchRow = matchRowId) => {
568
+ const rows = cached?.data?.results?.rows ?? cached?.results?.rows;
569
+ if (!rows) {
570
+ return cached;
571
+ }
572
+ const patchedRows = patchListRows(rows, data, recordId, matchRow);
573
+ if (cached?.data?.results?.rows) {
574
+ return {
575
+ ...cached,
576
+ data: {
577
+ ...cached.data,
578
+ results: {
579
+ ...cached.data.results,
580
+ rows: patchedRows
581
+ }
582
+ }
583
+ };
584
+ }
585
+ return {
586
+ ...cached,
587
+ results: {
588
+ ...cached.results,
589
+ rows: patchedRows
590
+ }
591
+ };
592
+ };
593
+ const patchBoardResponse = (cached, matchRow = matchRowId) => {
594
+ if (!Array.isArray(cached?.data?.results)) {
595
+ return cached;
596
+ }
597
+ return {
598
+ ...cached,
599
+ data: {
600
+ ...cached.data,
601
+ results: patchBoardStages(cached.data.results, data, recordId, matchRow)
602
+ }
603
+ };
604
+ };
605
+ if (state.objectsData) {
606
+ stateUpdates.objectsData = viewType === "BOARD" ? patchBoardResponse(state.objectsData, objectsDataMatcher) : patchListResponse(state.objectsData, objectsDataMatcher);
607
+ }
608
+ if (state.tableData) {
609
+ stateUpdates.tableData = viewType === "BOARD" ? patchBoardResponse(state.tableData) : patchListResponse(state.tableData);
610
+ }
611
+ tableStore.setState(stateUpdates);
612
+ return response;
492
613
  }
493
614
  };
494
615
 
@@ -809,20 +930,6 @@ var actions5 = {
809
930
  }
810
931
  };
811
932
 
812
- // src/main/state/crm/use-user.ts
813
- var userStore = createStore({
814
- profile: getProfile()
815
- });
816
- var actions6 = {
817
- setProfile(response) {
818
- const data = response?.data || null;
819
- userStore.setState({
820
- profile: data
821
- });
822
- setProfileDetails(data);
823
- }
824
- };
825
-
826
933
  // src/main/core/utils/getCookieData.ts
827
934
  var getAuthSubscriptionType = () => {
828
935
  return getCookie("subscriptionType");
@@ -989,7 +1096,7 @@ var getParamDetails = (props, isDetailsPage = false) => {
989
1096
  delete lastItem.prm;
990
1097
  }
991
1098
  if (breadcrumbs.length > 1) {
992
- if (props?.type === "ticket" || props?.type === "association") {
1099
+ if (props?.type === "ticket" || props?.type === "association" || props?.type === "sidebarAssociation") {
993
1100
  mediatorObjectTypeId = breadcrumbs[1]?.o_t_id || "";
994
1101
  mediatorObjectRecordId = breadcrumbs[1]?.o_r_id || "";
995
1102
  if (lastItem?.o_t_id && lastItem?.o_r_id) {
@@ -1038,7 +1145,7 @@ var getParamDetails = (props, isDetailsPage = false) => {
1038
1145
  ])
1039
1146
  );
1040
1147
  let queryString = null;
1041
- if (props?.type === "association") {
1148
+ if (props?.type === "association" || props?.type === "sidebarAssociation") {
1042
1149
  queryString = new URLSearchParams({ ...paramsObject, ...{ cache: false } }).toString();
1043
1150
  } else {
1044
1151
  queryString = new URLSearchParams({ ...paramsObject, ...mappedLastItemParam }).toString();
@@ -1387,6 +1494,20 @@ var tableUiActions = {
1387
1494
  }
1388
1495
  };
1389
1496
 
1497
+ // src/main/state/crm/use-user.ts
1498
+ var userStore = createStore({
1499
+ profile: getProfile()
1500
+ });
1501
+ var actions6 = {
1502
+ setProfile(response) {
1503
+ const data = response?.data || null;
1504
+ userStore.setState({
1505
+ profile: data
1506
+ });
1507
+ setProfileDetails(data);
1508
+ }
1509
+ };
1510
+
1390
1511
  // src/main/state/crm/folder-tree.ts
1391
1512
  var LOADING_TREE_NODE_ID = "__loading__";
1392
1513
  function createLoadingTreeNode() {
@@ -1394,34 +1515,26 @@ function createLoadingTreeNode() {
1394
1515
  id: LOADING_TREE_NODE_ID,
1395
1516
  name: "loading",
1396
1517
  type: "loading",
1397
- child: []
1518
+ child: [],
1519
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1520
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
1398
1521
  };
1399
1522
  }
1400
1523
  function isLoadingTreeNode(node) {
1401
1524
  return node?.id === LOADING_TREE_NODE_ID || node?.type === "loading";
1402
1525
  }
1403
- function normalizeFileUploadToTreeNode(data) {
1404
- return {
1405
- id: String(data.id ?? ""),
1406
- name: data.name,
1407
- type: data.type,
1408
- size: data.size,
1409
- updatedAt: data.updatedAt,
1410
- createdAt: data.createdAt,
1411
- createdBy: data.createdBy,
1412
- child: []
1413
- };
1414
- }
1415
- function normalizeFolderCreateToTreeNode(data) {
1526
+ function toTreeNode(data) {
1527
+ const { parentFolderId: _parentFolderId, alreadyExists: _alreadyExists, child, ...raw } = data;
1528
+ const isFolder = raw.type === "folder" || !raw.type && !raw.size;
1416
1529
  return {
1417
- id: String(data.id ?? ""),
1418
- name: data.name,
1419
- type: "folder",
1420
- size: "-",
1421
- updatedAt: data.updatedAt,
1422
- createdAt: data.createdAt,
1423
- createdBy: data.createdBy,
1424
- child: []
1530
+ id: String(raw.id ?? ""),
1531
+ name: raw.name,
1532
+ type: raw.type ?? (isFolder ? "folder" : void 0),
1533
+ size: raw.size ?? (isFolder ? "-" : void 0),
1534
+ updatedAt: raw.updatedAt,
1535
+ createdAt: raw.createdAt,
1536
+ createdBy: raw.createdBy,
1537
+ child: Array.isArray(child) ? child : []
1425
1538
  };
1426
1539
  }
1427
1540
  function stripParentFolderId(item) {
@@ -1545,7 +1658,7 @@ var actions7 = {
1545
1658
  id
1546
1659
  });
1547
1660
  },
1548
- async updateTreeWithCreate(parentFolderId, response, createKind) {
1661
+ async updateTreeWithCreate(parentFolderId, response, _createKind) {
1549
1662
  const state = fileStore.getState();
1550
1663
  const tree = state.files?.data;
1551
1664
  if (!tree || !parentFolderId) {
@@ -1570,7 +1683,7 @@ var actions7 = {
1570
1683
  return;
1571
1684
  }
1572
1685
  const resolvedParentId = String(data.parentFolderId ?? parentFolderId);
1573
- const normalizedNode = createKind === "folder" ? normalizeFolderCreateToTreeNode(data) : normalizeFileUploadToTreeNode(data);
1686
+ const normalizedNode = toTreeNode(data);
1574
1687
  const { tree: updatedTree } = replaceOrPrependChildAt(tree, resolvedParentId, normalizedNode);
1575
1688
  fileStore.setState({
1576
1689
  files: {
@@ -1628,5 +1741,5 @@ var resetAllStore = () => {
1628
1741
  };
1629
1742
 
1630
1743
  export { actions, actions2, actions3, actions4, actions5, actions7 as actions6, actions6 as actions7, actions8, breadcrumbStage, configureLogger, createStore, decodeToBase64, emailStore, fileStore, generatePath, generateUrl, getParam, getParamDetails, getPath, getRouteDetails, getRouteMenu, isHttpTracingEnabled, isMessingParent, isMessingParentLastItem, logger, noteStore, resetAllStore, sanitizeAxiosErrorData, syncStore, tableStore, tableUiActions, tableUiStore, ticketHubspotObjectTypeId, updateLink, uploaderStore, userStore };
1631
- //# sourceMappingURL=chunk-YEUFUGGT.js.map
1632
- //# sourceMappingURL=chunk-YEUFUGGT.js.map
1744
+ //# sourceMappingURL=chunk-GLATNYVU.js.map
1745
+ //# sourceMappingURL=chunk-GLATNYVU.js.map