@integry/sdk 4.6.33 → 4.6.35

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integry/sdk",
3
- "version": "4.6.33",
3
+ "version": "4.6.35",
4
4
  "description": "Integry SDK",
5
5
  "main": "dist/umd/index.umd.js",
6
6
  "module": "dist/esm/index.csm.js",
@@ -88,7 +88,6 @@ const arrayToObject = (arr: unknown[]): Record<string, unknown> =>
88
88
  newObj[`[${index}]`] = item;
89
89
  return newObj;
90
90
  }, {});
91
-
92
91
  // Check if output data matches the search term
93
92
  const outputMatchesSearch = (output: unknown, term: string): boolean => {
94
93
  if (!term || !output) return false;
@@ -436,12 +435,33 @@ const TagList = ({
436
435
  const isExpandable = (value: unknown): boolean => {
437
436
  if (value === null || value === undefined) return false;
438
437
 
439
- // Arrays and objects with properties are expandable
438
+ // Arrays with items are expandable
440
439
  if (Array.isArray(value)) return value.length > 0;
440
+
441
+ // Objects with properties are expandable
441
442
  if (typeof value === 'object') {
442
443
  // Check if it's a TagNode with tags
443
- if (isTagNode(value) && value.tags)
444
- return Object.keys(value.tags).length > 0;
444
+ if (isTagNode(value)) {
445
+ // Check if it has tags
446
+ if (value.tags && Object.keys(value.tags).length > 0) {
447
+ return true;
448
+ }
449
+
450
+ // Check if it has output that is expandable
451
+ if (value.output) {
452
+ if (Array.isArray(value.output) && value.output.length > 0) {
453
+ return true;
454
+ }
455
+ if (
456
+ typeof value.output === 'object' &&
457
+ value.output !== null &&
458
+ Object.keys(value.output as Record<string, unknown>).length > 0
459
+ ) {
460
+ return true;
461
+ }
462
+ }
463
+ }
464
+
445
465
  // Regular object with properties
446
466
  return Object.keys(value as Record<string, unknown>).length > 0;
447
467
  }
@@ -488,23 +508,42 @@ const TagList = ({
488
508
  }, [processedTags, searchTerm]);
489
509
 
490
510
  // Update the toggleExpand function with proper type checking
491
- const toggleExpand = (key: string) => {
492
- // For steps with nested steps, we don't allow collapsing
511
+ const toggleExpand = (key: string, event?: Event) => {
512
+ if (event) {
513
+ event.stopPropagation(); // Prevent event bubbling
514
+ }
515
+
516
+ // Get the node that we want to toggle
493
517
  const node = processedTags[key];
494
- if (isTagNode(node) && node.tags && Object.keys(node.tags).length > 0) {
495
- // Instead, toggle the output expansion
496
- setExpandedOutputs((prev) => ({
497
- ...prev,
498
- [key]: !prev[key],
499
- }));
500
- return;
518
+
519
+ if (isTagNode(node)) {
520
+ // If it's a TagNode with tags, toggle output expansion
521
+ if (node.tags && Object.keys(node.tags).length > 0) {
522
+ // Toggle the output expansion
523
+ setExpandedOutputs((prev) => ({
524
+ ...prev,
525
+ [key]: !prev[key],
526
+ }));
527
+ return;
528
+ }
529
+
530
+ // If it's a TagNode with expandable output, toggle node expansion
531
+ if (node.output && isExpandable(node.output)) {
532
+ setExpandedNodes((prev) => ({
533
+ ...prev,
534
+ [key]: !prev[key],
535
+ }));
536
+ return;
537
+ }
501
538
  }
502
539
 
503
- // For regular nodes or steps without nested steps, toggle normal expansion
504
- setExpandedNodes((prev) => ({
505
- ...prev,
506
- [key]: !prev[key],
507
- }));
540
+ // For arrays, objects, or steps without nested tags - toggle normal expansion
541
+ setExpandedNodes((prev) => {
542
+ const newExpandedNodes = { ...prev };
543
+ // Toggle the value
544
+ newExpandedNodes[key] = !prev[key];
545
+ return newExpandedNodes;
546
+ });
508
547
  };
509
548
 
510
549
  const toggleOutputExpand = (key: string, e: Event) => {
@@ -685,8 +724,38 @@ const TagList = ({
685
724
  isTagNode(value) &&
686
725
  value.output &&
687
726
  typeof value.output === 'object';
688
- const hasChildren =
689
- hasNestedSteps || hasOutput || isExpandable(value);
727
+ // Determine if this item has children that can be expanded
728
+ let hasChildren = hasNestedSteps || hasOutput;
729
+
730
+ // Check if this is an array or object (even if it's inside a step's output)
731
+ // This will allow us to show expand/collapse icons for arrays and objects
732
+ const isArray = Array.isArray(value);
733
+ const isObject =
734
+ !isArray &&
735
+ typeof value === 'object' &&
736
+ value !== null &&
737
+ Object.keys(value as Record<string, unknown>).length > 0;
738
+
739
+ // If this is an array or object (not a step), mark it as having children
740
+ if (!isStep && (isArray || isObject)) {
741
+ hasChildren = true;
742
+ }
743
+
744
+ // If this is a step with output that is an array or object, also mark it as having children
745
+ if (isStep && isTagNode(value) && value.output) {
746
+ // The output could be any data type - check if it's an array or object with content
747
+ const outputIsArray =
748
+ Array.isArray(value.output) && value.output.length > 0;
749
+ const outputIsObject =
750
+ !outputIsArray &&
751
+ typeof value.output === 'object' &&
752
+ value.output !== null &&
753
+ Object.keys(value.output as Record<string, unknown>).length > 0;
754
+
755
+ if (outputIsArray || outputIsObject) {
756
+ hasChildren = true;
757
+ }
758
+ }
690
759
  const isExpanded = expandedNodes[key];
691
760
  const isOutputExpanded = expandedOutputs[key];
692
761
  const currentPath = path ? `${path}.${key}` : key;
@@ -702,13 +771,12 @@ const TagList = ({
702
771
  text = key;
703
772
  }
704
773
 
705
- let tagsParam: Record<string, unknown> | unknown[] = {};
774
+ let tagsParam: unknown = {};
706
775
 
707
776
  if (isTagNode(value)) {
708
- if (Array.isArray(value.output)) {
777
+ // If the output exists, use it directly regardless of its type
778
+ if (value.output !== undefined) {
709
779
  tagsParam = value.output;
710
- } else if (value.output) {
711
- tagsParam = value.output as Record<string, unknown>;
712
780
  }
713
781
  }
714
782
 
@@ -725,15 +793,19 @@ const TagList = ({
725
793
  return html`
726
794
  <li key=${key} class="${nodeMatches ? styles.searchMatch : ''}">
727
795
  <div
728
- onClick=${() => {
729
- if (isStep) {
796
+ onClick=${(e: Event) => {
797
+ if (isStep && hasOutput) {
798
+ // For step nodes with output, toggle output expansion
730
799
  setExpandedOutputs((prev) => ({
731
800
  ...prev,
732
801
  [key]: !prev[key],
733
802
  }));
734
803
  } else if (hasChildren) {
804
+ // For array/object nodes, toggle node expansion
735
805
  toggleExpand(key);
806
+ toggleOutputExpand(key, e);
736
807
  } else {
808
+ // For leaf nodes, select the value
737
809
  const tagPath = `${activeTab}.${extractStepsFromOutputPath(
738
810
  currentPath,
739
811
  )}`;
@@ -809,11 +881,81 @@ const TagList = ({
809
881
  </span>
810
882
  </span>`
811
883
  : ''}
812
- ${isStep && hasOutput
884
+ <!-- Expand/collapse icon for steps with output -->
885
+ ${isStep && hasOutput ? html`` : ''}
886
+
887
+ <!-- Expand/collapse icon for arrays -->
888
+ ${Array.isArray(value) && value.length > 0
889
+ ? html`<span
890
+ class="${styles.outputIndicator} ${styles.objectExpandIcon}"
891
+ onClick=${(e: Event) => toggleOutputExpand(key, e)}
892
+ title="Toggle expand output"
893
+ >
894
+ <svg
895
+ xmlns="http://www.w3.org/2000/svg"
896
+ width="24"
897
+ height="24"
898
+ viewBox="0 0 24 24"
899
+ fill="none"
900
+ stroke="currentColor"
901
+ strokeWidth="2"
902
+ strokeLinecap="round"
903
+ strokeLinejoin="round"
904
+ style="transform: ${isOutputExpanded
905
+ ? 'rotate(180deg)'
906
+ : 'rotate(0deg)'};
907
+ transition: transform 0.2s;"
908
+ >
909
+ <path d="m6 9 6 6 6-6"></path>
910
+ </svg>
911
+ </span>`
912
+ : ''}
913
+
914
+ <!-- Expand/collapse icon for objects -->
915
+ ${!isStep &&
916
+ !Array.isArray(value) &&
917
+ typeof value === 'object' &&
918
+ value !== null &&
919
+ Object.keys(value as Record<string, unknown>).length > 0
920
+ ? html`<span
921
+ class="${styles.outputIndicator} ${styles.objectExpandIcon}"
922
+ onClick=${(e: Event) => toggleOutputExpand(key, e)}
923
+ title="Toggle expand output"
924
+ >
925
+ <svg
926
+ xmlns="http://www.w3.org/2000/svg"
927
+ width="24"
928
+ height="24"
929
+ viewBox="0 0 24 24"
930
+ fill="none"
931
+ stroke="currentColor"
932
+ strokeWidth="2"
933
+ strokeLinecap="round"
934
+ strokeLinejoin="round"
935
+ style="transform: ${isOutputExpanded
936
+ ? 'rotate(180deg)'
937
+ : 'rotate(0deg)'};
938
+ transition: transform 0.2s;"
939
+ >
940
+ <path d="m6 9 6 6 6-6"></path>
941
+ </svg>
942
+ </span>`
943
+ : ''}
944
+
945
+ <!-- Expand/collapse icon for step output that contains arrays or objects -->
946
+ ${isStep &&
947
+ isTagNode(value) &&
948
+ value.output &&
949
+ ((Array.isArray(value.output) && value.output.length > 0) ||
950
+ (!Array.isArray(value.output) &&
951
+ typeof value.output === 'object' &&
952
+ value.output !== null &&
953
+ Object.keys(value.output as Record<string, unknown>)
954
+ .length > 0))
813
955
  ? html`<span
814
- class="${styles.outputIndicator}"
956
+ class="${styles.outputIndicator} ${styles.objectExpandIcon}"
815
957
  onClick=${(e: Event) => toggleOutputExpand(key, e)}
816
- title="Toggle output data"
958
+ title="Toggle expand output"
817
959
  >
818
960
  <svg
819
961
  xmlns="http://www.w3.org/2000/svg"
@@ -838,15 +980,102 @@ const TagList = ({
838
980
 
839
981
  ${isStep && hasOutput && isOutputExpanded
840
982
  ? html`<div class="${styles.outputSection}">
841
- <${TagList}
842
- tags=${tagsParam}
843
- searchTerm=${searchTerm}
844
- level=${level + 1}
845
- path=${`${currentPath}.output`}
846
- globalSearchMode=${globalSearchMode}
847
- onSelect=${onSelect}
848
- activeTab=${activeTab}
849
- />
983
+ <div style="position: relative;">
984
+ <!-- SPECIAL CASE: Force array handling -->
985
+ ${(() => {
986
+ // For arrays specifically, render them directly
987
+ if (Array.isArray(tagsParam)) {
988
+ // Create a wrapper div to show each array item
989
+ return html`
990
+ <div class="${styles.arrayOutput}">
991
+ <ul>
992
+ ${tagsParam.map(
993
+ (item, index) => html`
994
+ <li key=${index}>
995
+ <div class="${styles.listItemContent}">
996
+ <span class="${styles.key}"
997
+ >[${index}]</span
998
+ >
999
+ ${typeof item === 'object' &&
1000
+ item !== null
1001
+ ? html`
1002
+ <span class="${styles.value}">
1003
+ ${Array.isArray(item)
1004
+ ? `Array(${item.length})`
1005
+ : `Object(${
1006
+ Object.keys(
1007
+ item as Record<
1008
+ string,
1009
+ unknown
1010
+ >,
1011
+ ).length
1012
+ } keys)`}
1013
+ </span>
1014
+ <span
1015
+ class="${styles.outputIndicator} ${styles.objectExpandIcon}"
1016
+ onClick=${(e: Event) =>
1017
+ toggleOutputExpand(key, e)}
1018
+ title="Toggle expand output"
1019
+ >
1020
+ <svg
1021
+ xmlns="http://www.w3.org/2000/svg"
1022
+ width="24"
1023
+ height="24"
1024
+ viewBox="0 0 24 24"
1025
+ fill="none"
1026
+ stroke="currentColor"
1027
+ strokeWidth="2"
1028
+ strokeLinecap="round"
1029
+ strokeLinejoin="round"
1030
+ style="transform: ${isOutputExpanded
1031
+ ? 'rotate(180deg)'
1032
+ : 'rotate(0deg)'};
1033
+ transition: transform 0.2s;"
1034
+ >
1035
+ <path d="m6 9 6 6 6-6"></path>
1036
+ </svg>
1037
+ </span>
1038
+ `
1039
+ : html`
1040
+ <span class="${styles.value}">
1041
+ ${String(item)}
1042
+ </span>
1043
+ `}
1044
+ </div>
1045
+ </li>
1046
+ `,
1047
+ )}
1048
+ </ul>
1049
+ </div>
1050
+ `;
1051
+ }
1052
+
1053
+ // For objects, render keys and values
1054
+ if (
1055
+ typeof tagsParam === 'object' &&
1056
+ tagsParam !== null
1057
+ ) {
1058
+ return html`
1059
+ <${TagList}
1060
+ tags=${tagsParam as Record<string, unknown>}
1061
+ searchTerm=${searchTerm}
1062
+ level=${level + 1}
1063
+ path=${`${currentPath}.output`}
1064
+ globalSearchMode=${globalSearchMode}
1065
+ onSelect=${onSelect}
1066
+ activeTab=${activeTab}
1067
+ />
1068
+ `;
1069
+ }
1070
+
1071
+ // For primitive values, just show the string representation
1072
+ return html`
1073
+ <div style="padding: 4px; color: #666;">
1074
+ ${String(tagsParam)}
1075
+ </div>
1076
+ `;
1077
+ })()}
1078
+ </div>
850
1079
  </div>`
851
1080
  : ''}
852
1081
  ${hasNestedSteps && isExpanded
@@ -860,16 +1089,39 @@ const TagList = ({
860
1089
  activeTab=${activeTab}
861
1090
  />`
862
1091
  : ''}
863
- ${!isStep && hasChildren && isExpanded
864
- ? html`<${TagList}
865
- tags=${tagsParamForOutput}
866
- searchTerm=${searchTerm}
867
- level=${level + 1}
868
- path=${currentPath}
869
- globalSearchMode=${globalSearchMode}
870
- onSelect=${onSelect}
871
- activeTab=${activeTab}
872
- />`
1092
+ <!-- Display expanded array content with additional debug info -->
1093
+ ${Array.isArray(value) && value.length > 0 && isExpanded
1094
+ ? html`<div class="${styles.outputSection}">
1095
+ <${TagList}
1096
+ tags=${value}
1097
+ searchTerm=${searchTerm}
1098
+ level=${level + 1}
1099
+ path=${currentPath}
1100
+ globalSearchMode=${globalSearchMode}
1101
+ onSelect=${onSelect}
1102
+ activeTab=${activeTab}
1103
+ />
1104
+ </div>`
1105
+ : ''}
1106
+
1107
+ <!-- Display expanded object content with additional debug info -->
1108
+ ${!isStep &&
1109
+ !Array.isArray(value) &&
1110
+ typeof value === 'object' &&
1111
+ value !== null &&
1112
+ Object.keys(value as Record<string, unknown>).length > 0 &&
1113
+ isExpanded
1114
+ ? html`<div class="${styles.outputSection}">
1115
+ <${TagList}
1116
+ tags=${value as Record<string, unknown>}
1117
+ searchTerm=${searchTerm}
1118
+ level=${level + 1}
1119
+ path=${currentPath}
1120
+ globalSearchMode=${globalSearchMode}
1121
+ onSelect=${onSelect}
1122
+ activeTab=${activeTab}
1123
+ />
1124
+ </div>`
873
1125
  : ''}
874
1126
  </li>
875
1127
  `;
@@ -135,6 +135,7 @@
135
135
  }
136
136
  span.tagIcon {
137
137
  margin-right: 10px;
138
+ order: 1;
138
139
  svg,
139
140
  img {
140
141
  width: 1rem;
@@ -147,6 +148,7 @@
147
148
  }
148
149
  }
149
150
  span.key {
151
+ order: 3;
150
152
  mark {
151
153
  background-color: yellow;
152
154
  color: inherit;
@@ -156,15 +158,39 @@
156
158
  }
157
159
  }
158
160
  span.outputIndicator {
159
- margin-left: auto;
160
161
  cursor: pointer;
161
162
  color: #71717a;
163
+ display: flex;
164
+ align-items: center;
165
+ justify-content: center;
166
+ min-width: 20px;
167
+ min-height: 20px;
168
+ order: 2;
169
+
162
170
  svg {
163
171
  width: 1rem;
164
172
  height: 1rem;
165
173
  }
174
+
166
175
  &:hover {
167
176
  color: #3b82f6;
177
+ background-color: rgba(59, 130, 246, 0.1);
178
+ border-radius: 2px;
179
+ }
180
+
181
+ &.objectExpandIcon {
182
+ svg {
183
+ color: #4f46e5; /* Indigo color to match theme */
184
+ }
185
+
186
+ &:hover {
187
+ background-color: rgba(
188
+ 79,
189
+ 70,
190
+ 229,
191
+ 0.15
192
+ ); /* Slightly darker on hover */
193
+ }
168
194
  }
169
195
  }
170
196
  span.value {
@@ -176,6 +202,7 @@
176
202
  text-overflow: ellipsis;
177
203
  white-space: nowrap;
178
204
  margin-left: 5px;
205
+ order: 4;
179
206
 
180
207
  mark {
181
208
  background-color: yellow;
@@ -228,8 +255,8 @@
228
255
  }
229
256
  }
230
257
  .tagsListWrapper {
231
- max-height: 170px;
232
- overflow-y: scroll;
258
+ max-height: 260px; /* Increased max height for better viewing */
259
+ overflow-y: auto;
233
260
  .valuesList {
234
261
  ul {
235
262
  margin: 5px 0;
@@ -595,6 +595,10 @@ const RenderAppPage = (props: WraperrProps) => {
595
595
  alt=${appData?.name}
596
596
  />
597
597
  <span>${selectedFlow?.flow.name}</span>
598
+ ${selectedFlow?.flow?.version_number &&
599
+ html`<span class=${styles.flowVersion}
600
+ >v${selectedFlow?.flow?.version_number}</span
601
+ >`}
598
602
  </div>
599
603
  </div>
600
604
  `}
@@ -53,6 +53,19 @@
53
53
  border-radius: 0 !important;
54
54
  user-select: none;
55
55
  }
56
+ .flowVersion {
57
+ background: rgb(233, 236, 238);
58
+ color: rgb(79, 79, 79);
59
+ font-size: 10px;
60
+ font-weight: 400;
61
+ padding: 2px 8px;
62
+ line-height: 12px;
63
+ text-align: center;
64
+ padding: 4px 9px;
65
+ /* height: 20px; */
66
+ display: inline-block;
67
+ margin-left: 7px;
68
+ }
56
69
 
57
70
  span {
58
71
  color: var(--black-and-grey-title-and-desc, #333);
@@ -1,116 +0,0 @@
1
- // import { useState } from 'react';
2
-
3
- // const data: any = {
4
- // setupForm: [
5
- // {
6
- // id: 'mailchimp',
7
- // name: 'Configure Mailchimp (Add Subscriber)',
8
- // fields: [
9
- // 'mailchimp_list',
10
- // 'email',
11
- // 'mailchimp_status',
12
- // 'mailchimp_custom_fields',
13
- // ],
14
- // },
15
- // {
16
- // id: 'slack',
17
- // name: 'Configure Slack (Post Message)',
18
- // fields: ['channel', 'message'],
19
- // },
20
- // ],
21
- // triggers: [
22
- // {
23
- // id: 'webhook1',
24
- // name: 'Incoming Webhook (Block)',
25
- // fields: ['url', 'payload'],
26
- // },
27
- // {
28
- // id: 'webhook2',
29
- // name: 'Incoming Webhook',
30
- // fields: ['endpoint', 'headers'],
31
- // },
32
- // ],
33
- // };
34
-
35
- // type Item = {
36
- // id: string;
37
- // name: string;
38
- // fields: string[];
39
- // };
40
-
41
- // export default function TagsMenuComponent() {
42
- // const [activeTab, setActiveTab] = useState('setupForm');
43
- // const [activeItem, setActiveItem] = useState<Item>({
44
- // id: '',
45
- // name: '',
46
- // fields: [],
47
- // });
48
-
49
- // const handleItemClick = (item: any) => setActiveItem(item);
50
- // const handleBack = () =>
51
- // setActiveItem({
52
- // id: '',
53
- // name: '',
54
- // fields: [],
55
- // });
56
-
57
- // return (
58
- // <div className="p-4">
59
- // <div className="flex space-x-4 border-b">
60
- // {['setupForm', 'triggers'].map((tab) => (
61
- // <button
62
- // key={tab}
63
- // className={`p-2 ${
64
- // activeTab === tab
65
- // ? 'font-bold border-b-2 border-black'
66
- // : 'text-gray-500'
67
- // }`}
68
- // onClick={() => {
69
- // setActiveTab(tab);
70
- // setActiveItem({
71
- // id: '',
72
- // name: '',
73
- // fields: [],
74
- // });
75
- // }}
76
- // >
77
- // {tab === 'setupForm' ? 'Setup Form' : 'Triggers'}
78
- // </button>
79
- // ))}
80
- // </div>
81
-
82
- // <div className="mt-4">
83
- // {activeItem ? (
84
- // <div>
85
- // <button className="text-blue-500 mb-4" onClick={handleBack}>
86
- // &larr; Back
87
- // </button>
88
- // <h2 className="font-semibold mb-2">
89
- // {activeItem ? activeItem.name : ''}
90
- // </h2>
91
- // <div className="space-y-2">
92
- // {activeItem.fields.map((field) => (
93
- // <div
94
- // key={field}
95
- // className="bg-gray-100 px-2 py-1 rounded text-gray-700"
96
- // >
97
- // {field}
98
- // </div>
99
- // ))}
100
- // </div>
101
- // </div>
102
- // ) : (
103
- // data[activeTab].map((item: any) => (
104
- // <div
105
- // key={item.id}
106
- // className="flex items-center space-x-2 p-2 hover:bg-gray-100 cursor-pointer rounded"
107
- // onClick={() => handleItemClick(item)}
108
- // >
109
- // <span>{item.name}</span>
110
- // </div>
111
- // ))
112
- // )}
113
- // </div>
114
- // </div>
115
- // );
116
- // }
@@ -1,16 +0,0 @@
1
- .loader {
2
- animation-name: ckw;
3
- animation-duration: 1s;
4
- animation-iteration-count: infinite;
5
- animation-timing-function: linear;
6
- transform-origin: 50% 50%;
7
- }
8
-
9
- @keyframes ckw {
10
- 0% {
11
- transform: rotate(0deg);
12
- }
13
- 100% {
14
- transform: rotate(360deg);
15
- }
16
- }