@integry/sdk 4.6.35 → 4.6.37

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.35",
3
+ "version": "4.6.37",
4
4
  "description": "Integry SDK",
5
5
  "main": "dist/umd/index.umd.js",
6
6
  "module": "dist/esm/index.csm.js",
@@ -234,7 +234,45 @@ const MultipurposeField = (props: MultipurposeFieldProps) => {
234
234
  .replace(/\u00A0/g, '');
235
235
  };
236
236
 
237
+ const capitalize = (text: string) => {
238
+ if (!text) return '';
239
+ return text.charAt(0).toUpperCase() + text.slice(1);
240
+ };
241
+
237
242
  const tagTemplate = (tagData: any) => {
243
+ if (tagData.appIcon) {
244
+ const origin = tagData.value.split('.')[0];
245
+ let originText = capitalize(origin);
246
+ switch (origin) {
247
+ case 'steps':
248
+ originText = 'Step';
249
+ break;
250
+ case 'storage':
251
+ originText = 'User variable';
252
+ break;
253
+ case 'setup_form':
254
+ originText = 'Setup form';
255
+ break;
256
+ default:
257
+ originText = capitalize(origin);
258
+ }
259
+ return `
260
+ <tag
261
+ contenteditable='false'
262
+ spellcheck='false'
263
+ tabIndex="-1"
264
+ class="tagify__tag ${tagData.class ? tagData.class : ''}"
265
+ >
266
+ <div class="${styles.tagifyTagTemplate}">
267
+ <div class="${styles.tagifyAppIcon}">
268
+ <img src="${tagData.appIcon}" alt="" />
269
+ </div>
270
+ <span data-hint="${
271
+ typeof tagData.title === 'string' ? tagData.title : ''
272
+ }" class='tagify__tag-text'>${originText}: ${tagData.text}</span>
273
+ </div>
274
+ </tag>`;
275
+ }
238
276
  return `
239
277
  <tag
240
278
  contenteditable='false'
@@ -383,6 +421,7 @@ const MultipurposeField = (props: MultipurposeFieldProps) => {
383
421
  value: tag.currentPath,
384
422
  text: tag.key,
385
423
  title: tag.value,
424
+ appIcon: tag.parentAppIcon,
386
425
  };
387
426
  isStandardTag = false; // This tag is coming from TagsMenu component
388
427
  }
@@ -391,6 +430,7 @@ const MultipurposeField = (props: MultipurposeFieldProps) => {
391
430
  value: result.value,
392
431
  text: isStandardTag ? result.text : prettifyString(result.text),
393
432
  title: isStandardTag ? getTagData(tag) : result.title,
433
+ appIcon: result.appIcon,
394
434
  editable: false,
395
435
  });
396
436
  tagify.injectAtCaret(tagElm);
@@ -54,3 +54,21 @@
54
54
  }
55
55
  }
56
56
  }
57
+ .tagifyTagTemplate {
58
+ background-color: #f5f5f5;
59
+ --tag-hover: #e0e0e0;
60
+ --tag-bg: #e0e0e0;
61
+ display: inline;
62
+ align-items: center; /* Ensures vertical alignment */
63
+ gap: 4px; /* Optional spacing between icon and text */
64
+ .tagifyAppIcon {
65
+ img {
66
+ margin-right: 5px;
67
+
68
+ width: 16px; /* Adjust based on your design */
69
+ height: 16px;
70
+ object-fit: contain;
71
+ display: block;
72
+ }
73
+ }
74
+ }
@@ -354,6 +354,55 @@ const ValuesList = ({
354
354
  </ul>
355
355
  </div>
356
356
  `;
357
+
358
+ // Helper function to find parent tag with appIcon
359
+ const findParentWithAppIcon = (
360
+ tags: Record<string, unknown> | unknown[],
361
+ path: string,
362
+ ): string | undefined => {
363
+ if (!path) return undefined;
364
+
365
+ const pathParts = path.split('.');
366
+ let currentTags = tags;
367
+ let parentWithIcon: string | undefined;
368
+
369
+ // Navigate through the path to find the parent with appIcon
370
+ for (let i = 0; i < pathParts.length; i += 1) {
371
+ const part = pathParts[i];
372
+
373
+ // Skip 'output' parts in the path
374
+ if (part === 'output') {
375
+ // Skip processing for 'output'
376
+ return undefined;
377
+ }
378
+
379
+ // Handle array indices
380
+ if (part.startsWith('[') && part.endsWith(']')) {
381
+ const index = Number.parseInt(part.substring(1, part.length - 1), 10);
382
+ if (Array.isArray(currentTags) && index < currentTags.length) {
383
+ const item = currentTags[index];
384
+ if (isTagNode(item) && item.appIcon) {
385
+ parentWithIcon = item.appIcon;
386
+ }
387
+ currentTags = item as Record<string, unknown>;
388
+ } else {
389
+ break;
390
+ }
391
+ }
392
+ // Handle object properties
393
+ if (!Array.isArray(currentTags) && currentTags[part]) {
394
+ const item = currentTags[part];
395
+ if (isTagNode(item) && item.appIcon) {
396
+ parentWithIcon = item.appIcon;
397
+ }
398
+ currentTags = item as Record<string, unknown>;
399
+ } else {
400
+ break;
401
+ }
402
+ }
403
+
404
+ return parentWithIcon;
405
+ };
357
406
  const TagList = ({
358
407
  tags,
359
408
  searchTerm,
@@ -1409,6 +1458,13 @@ const TabMenu = ({ data, onSelect, onOptionClick }: TagMenuProps) => {
1409
1458
 
1410
1459
  // Regular tab handling
1411
1460
  const activeData = data[activeTab];
1461
+ const steps = activeData.tags || [];
1462
+ const hasSingleEmptyStep =
1463
+ !Array.isArray(steps) && // Handle the case where steps is an object
1464
+ Object.keys(steps).length === 1 &&
1465
+ isTagNode(Object.values(steps)[0]) &&
1466
+ Object.keys((Object.values(steps)[0] as TagNode).output || {}).length ===
1467
+ 0;
1412
1468
  return html`
1413
1469
  <div class="${styles.tabContent}">
1414
1470
  <div class="${styles.searchWrapper}">
@@ -1444,15 +1500,19 @@ const TabMenu = ({ data, onSelect, onOptionClick }: TagMenuProps) => {
1444
1500
  `
1445
1501
  : ''}
1446
1502
  </div>
1447
- <div class="${styles.tagsListWrapper}">
1448
- <${TagList}
1449
- tags=${activeData.tags}
1450
- searchTerm=${searchTerm}
1451
- globalSearchMode=${globalSearchMode}
1452
- onSelect=${onSelect}
1453
- activeTab=${data[activeTab].machineName || activeTab}
1454
- />
1455
- </div>
1503
+ ${hasSingleEmptyStep
1504
+ ? html`<div class="${styles.emptyStep}">
1505
+ <span>No tags found</span>
1506
+ </div>`
1507
+ : html` <div class="${styles.tagsListWrapper}">
1508
+ <${TagList}
1509
+ tags=${activeData.tags}
1510
+ searchTerm=${searchTerm}
1511
+ globalSearchMode=${globalSearchMode}
1512
+ onSelect=${onSelect}
1513
+ activeTab=${data[activeTab].machineName || activeTab}
1514
+ />
1515
+ </div>`}
1456
1516
  </div>
1457
1517
  `;
1458
1518
  };
@@ -221,6 +221,7 @@
221
221
  text-overflow: ellipsis;
222
222
  white-space: nowrap;
223
223
  margin-left: 5px;
224
+ min-width: 20px;
224
225
 
225
226
  mark {
226
227
  background-color: yellow;
@@ -254,6 +255,16 @@
254
255
  }
255
256
  }
256
257
  }
258
+ .emptyStep {
259
+ span {
260
+ color: #666;
261
+ font-style: italic;
262
+ margin: 10px 0;
263
+ text-align: center;
264
+ font-size: 12px;
265
+ margin-left: 5px;
266
+ }
267
+ }
257
268
  .tagsListWrapper {
258
269
  max-height: 260px; /* Increased max height for better viewing */
259
270
  overflow-y: auto;
@@ -136,7 +136,7 @@ const AuthorizationRow = (props: {
136
136
  };
137
137
 
138
138
  const MarketplaceApps = (props: any) => {
139
- const { genericData, renderMode, userConfig, appName } = props;
139
+ const { genericData, renderMode, userConfig, appName, fetchAll } = props;
140
140
  const context = useContext(AppContext);
141
141
  const [apps, setApps] = useState<any[]>([]);
142
142
  const [filteredApps, setFilteredApps] = useState<any[]>([]);
@@ -174,6 +174,7 @@ const MarketplaceApps = (props: any) => {
174
174
  .getMarketplaceAppsV2({
175
175
  cursor: search !== '' ? null : cursorToUse,
176
176
  search,
177
+ fetchAll,
177
178
  })
178
179
  .then((appsResponse) => {
179
180
  const tempApps = appsResponse.apps.map((app: any) => ({
@@ -137,7 +137,7 @@ const AuthorizationRow = (props: {
137
137
  };
138
138
 
139
139
  const MarketplaceAppsCompact = (props: any) => {
140
- const { genericData, renderMode, userConfig, appName } = props;
140
+ const { genericData, renderMode, userConfig, appName, fetchAll } = props;
141
141
  const context = useContext(AppContext);
142
142
  const [apps, setApps] = useState<any[]>([]);
143
143
  const [filteredApps, setFilteredApps] = useState<any[]>([]);
@@ -177,6 +177,7 @@ const MarketplaceAppsCompact = (props: any) => {
177
177
  .getMarketplaceAppsV2({
178
178
  cursor: search !== '' ? null : cursorToUse,
179
179
  search,
180
+ fetchAll,
180
181
  })
181
182
  .then((appsResponse) => {
182
183
  const tempApps = appsResponse.apps.map((app: any) => ({
@@ -13,6 +13,7 @@ interface ContainerProps extends StoreType {
13
13
  renderAppPageMode: MarketplaceRenderModes;
14
14
  renderFlowSetupMode: MarketplaceRenderModes;
15
15
  appName?: string;
16
+ fetchAll?: boolean;
16
17
  }
17
18
 
18
19
  const MarketplaceContainer = (props: ContainerProps) => {
@@ -22,6 +23,7 @@ const MarketplaceContainer = (props: ContainerProps) => {
22
23
  renderAppPageMode,
23
24
  renderFlowSetupMode,
24
25
  appName = '',
26
+ fetchAll = false,
25
27
  } = props;
26
28
  const { app_id } = genericData;
27
29
 
@@ -50,6 +52,7 @@ const MarketplaceContainer = (props: ContainerProps) => {
50
52
  : MarketplaceApps}
51
53
  renderMode=${renderMode}
52
54
  appName=${appName}
55
+ fetchAll=${fetchAll}
53
56
  />`}
54
57
  ${renderMode === MarketplaceRenderModes.MODAL &&
55
58
  html`
@@ -64,6 +67,7 @@ const MarketplaceContainer = (props: ContainerProps) => {
64
67
  : MarketplaceApps}
65
68
  renderMode=${renderMode}
66
69
  appName=${appName}
70
+ fetchAll=${fetchAll}
67
71
  />`}
68
72
  <//>
69
73
  `}
package/src/index.ts CHANGED
@@ -1748,6 +1748,7 @@ export class IntegryJS {
1748
1748
  renderMode: RenderModes = RenderModes.MODAL,
1749
1749
  containerId = 'integry-marketplace',
1750
1750
  layout = Layouts.WIDE,
1751
+ fetchAll = false,
1751
1752
  ) => {
1752
1753
  let target = document.getElementById(containerId);
1753
1754
  if (!target) {
@@ -1822,6 +1823,7 @@ export class IntegryJS {
1822
1823
  renderMode=${renderMode}
1823
1824
  renderAppPageMode=${renderMode}
1824
1825
  renderFlowSetupMode=${TemplateFormRenderModes.INLINE}
1826
+ fetchAll=${fetchAll}
1825
1827
  >
1826
1828
  <//>
1827
1829
  <//>
@@ -1026,6 +1026,7 @@ class IntegryAPI {
1026
1026
  public getMarketplaceAppsV2 = async ({
1027
1027
  cursor = <string | null>null,
1028
1028
  search = '',
1029
+ fetchAll = false,
1029
1030
  }): Promise<any | null> => {
1030
1031
  const url = new URL(`${this.config.baseAPIUrl}/apps/list/`);
1031
1032
 
@@ -1033,7 +1034,7 @@ class IntegryAPI {
1033
1034
  app_key: this.config.appKey,
1034
1035
  hash: this.config.hash,
1035
1036
  user_id: this.config.userId,
1036
- page_size: 30,
1037
+ page_size: fetchAll ? 9999 : 30,
1037
1038
  });
1038
1039
 
1039
1040
  if (search !== '' && search !== null) {