@integry/sdk 4.5.9 → 4.5.11

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.5.9",
3
+ "version": "4.5.11",
4
4
  "description": "Integry SDK",
5
5
  "main": "dist/umd/index.umd.js",
6
6
  "module": "dist/esm/index.csm.js",
@@ -43,6 +43,7 @@ interface FieldMenuProps {
43
43
  isMultiSelect?: boolean;
44
44
  loadingOptions?: boolean;
45
45
  nextPage?: string;
46
+ tagsComponent?: any;
46
47
  }
47
48
 
48
49
  const FieldDropdown = (props: FieldMenuProps) => {
@@ -65,6 +66,7 @@ const FieldDropdown = (props: FieldMenuProps) => {
65
66
  isMultiSelect = false,
66
67
  loadingOptions = false,
67
68
  nextPage = '',
69
+ tagsComponent = null,
68
70
  } = props;
69
71
 
70
72
  // Set active tab in state
@@ -327,55 +329,63 @@ const FieldDropdown = (props: FieldMenuProps) => {
327
329
  </div>`}
328
330
  </div>`
329
331
  : html` <div className="${styles.mappedFieldMenu}">
330
- ${Object.keys(!isEditable ? searchJSON(tags, searchValue) : tags)
331
- .length > 0
332
- ? Object.keys(
332
+ ${tagsComponent
333
+ ? html`<${tagsComponent} tags=${tags} onSelect=${onTagClick}>
334
+ <//>`
335
+ : html`${Object.keys(
333
336
  !isEditable ? searchJSON(tags, searchValue) : tags,
334
- ).map(
335
- (objKey, index, arr) => html`
336
- <${TagOptions}
337
- objectKey="${objKey}"
338
- keyValue="${objKey}"
339
- objectData="${!isEditable
340
- ? searchJSON(tags, searchValue)[objKey]
341
- : tags[objKey]}"
342
- onSelect=${onTagClick}
343
- isRoot="${true}"
344
- />
345
- ${index !== arr.length - 1
346
- ? ''
347
- : html`<span>
348
- ${isLoadingRootStepData
349
- ? html`<${ThreeDotLoader} color="#999" />`
350
- : html` <a
351
- className=${styles.optionsRefreshProminent}
352
- href="#"
353
- onclick=${handleRefresh}
354
- >Reload fields?</a
355
- >`}
356
- </span>`}
357
- `,
358
- )
359
- : html`<div className=${styles.noOptions}>
360
- ${!isEditable && searchValue !== ''
361
- ? 'Your search did not match any fields'
362
- : html`
363
- <span className=${styles.noOptionsRetry}>
364
- ${isLoadingRootStepData
365
- ? html`<${ThreeDotLoader} color="#999" />`
366
- : html`${isErrorOnLoadingRootStepData
367
- ? 'Could not load fields.'
368
- : 'No fields found.'}
369
- <a
370
- className=${styles.optionsRefresh}
371
- href="#"
372
- onclick=${handleRefresh}
373
- >
374
- ${' '}Try again?</a
375
- >`}
376
- </span>
377
- `}
378
- </div>`}
337
+ ).length > 0
338
+ ? Object.keys(
339
+ !isEditable ? searchJSON(tags, searchValue) : tags,
340
+ ).map(
341
+ (objKey, index, arr) => html`
342
+ <${TagOptions}
343
+ objectKey="${objKey}"
344
+ keyValue="${objKey}"
345
+ objectData="${!isEditable
346
+ ? searchJSON(tags, searchValue)[objKey]
347
+ : tags[objKey]}"
348
+ onSelect=${onTagClick}
349
+ isRoot="${true}"
350
+ />
351
+ ${index !== arr.length - 1
352
+ ? ''
353
+ : html`<span>
354
+ ${isLoadingRootStepData
355
+ ? html`<${ThreeDotLoader} color="#999" />`
356
+ : html` <a
357
+ className=${styles.optionsRefreshProminent}
358
+ href="#"
359
+ onclick=${handleRefresh}
360
+ >Reload fields?</a
361
+ >`}
362
+ </span>`}
363
+ `,
364
+ )
365
+ : html`<div className=${styles.noOptions}>
366
+ ${!isEditable && searchValue !== ''
367
+ ? 'Your search did not match any fields'
368
+ : html`
369
+ <span className=${styles.noOptionsRetry}>
370
+ ${isLoadingRootStepData
371
+ ? html`<${ThreeDotLoader} color="#999" />`
372
+ : html`${isErrorOnLoadingRootStepData
373
+ ? 'Could not load fields.'
374
+ : 'No fields found.'}
375
+ <a
376
+ className=${styles.optionsRefresh}
377
+ href="#"
378
+ onclick=${(e: any) => {
379
+ e.preventDefault();
380
+ e.stopPropagation();
381
+ handleRefresh();
382
+ }}
383
+ >
384
+ ${' '}Try again?</a
385
+ >`}
386
+ </span>
387
+ `}
388
+ </div>`}`}
379
389
  </div>`}
380
390
  </div>
381
391
  </div>`;
@@ -52,6 +52,7 @@ interface MultipurposeFieldProps {
52
52
  buttonText?: string;
53
53
  onButtonClickScript?: string;
54
54
  buttonScriptRequiresAuthToken?: boolean;
55
+ tagsComponent?: any;
55
56
  }
56
57
 
57
58
  const MultipurposeField = (props: MultipurposeFieldProps) => {
@@ -84,6 +85,7 @@ const MultipurposeField = (props: MultipurposeFieldProps) => {
84
85
  buttonText = 'Add',
85
86
  onButtonClickScript = '',
86
87
  buttonScriptRequiresAuthToken = false,
88
+ tagsComponent = null,
87
89
  } = props;
88
90
  const [showTagMenu, setShowTagMenu] = useState(false);
89
91
  const [currentValue, setCurrentValue] = useState(value);
@@ -361,6 +363,7 @@ const MultipurposeField = (props: MultipurposeFieldProps) => {
361
363
  };
362
364
 
363
365
  const onTagClick = (tag: string) => {
366
+ console.log('tag', tag);
364
367
  if (tagify) {
365
368
  if (!allowTagsInText) {
366
369
  tagify.removeAllTags();
@@ -677,6 +680,7 @@ const MultipurposeField = (props: MultipurposeFieldProps) => {
677
680
  ? true
678
681
  : false}
679
682
  refreshRootStepData=${refreshRootStepData}
683
+ tagsComponent=${tagsComponent}
680
684
  />
681
685
  </div>`}
682
686
  </div>
@@ -0,0 +1,71 @@
1
+ import { html } from 'htm/preact';
2
+ import cx from 'classnames';
3
+
4
+ import { Hint } from '@/components/Tooltip';
5
+ import { ThreeDotLoader } from '@/components/ThreeDotLoader';
6
+ import { TagOptions } from '@/components/MultipurposeField/TagOptions';
7
+
8
+ import styles from './styles.module.scss';
9
+
10
+ export interface TestProps {
11
+ tags: any;
12
+ onSelect: (tag: any) => void;
13
+ }
14
+
15
+ /**
16
+ * Test component
17
+ *
18
+ */
19
+ export const TestComponent = (props: TestProps) => {
20
+ const { tags, onSelect, ...restOfProps } = props;
21
+ const tagsLocal: any = {
22
+ FirstName: 'John',
23
+ LastName: 'Doe',
24
+ Gender: 'male',
25
+ Age: 20,
26
+ DateOfBirth: '1990-01-01',
27
+ Email: 'johndoe@example.com',
28
+ Phone: '555-555-1234',
29
+ Address: {
30
+ Street: '123 Main St',
31
+ City: 'New York',
32
+ State: 'NY',
33
+ PostalCode: '10001',
34
+ Country: 'USA',
35
+ },
36
+ PreferredContactMethod: 'email',
37
+ LastContacted: '2023-01-15',
38
+ Twitter: '@johndoe',
39
+ Website: 'https://www.example.com',
40
+ LinkedIn: 'https://www.linkedin.com/in/johndoe',
41
+ Bio: 'John Doe is a software engineer with over 10 years of experience.',
42
+ Relationship: 'professional',
43
+ Tags: ['tech', 'conference', 'networking'],
44
+ JobTitle: 'Software Engineer',
45
+ Company: 'Example Corp.',
46
+ DateCreated: '2023-04-14T12:00:00Z',
47
+ DateUpdated: '2023-04-14T12:00:00Z',
48
+ NextMeeting: {
49
+ Date: '2023-05-01',
50
+ Topic: 'Project Planning',
51
+ Location: 'New York',
52
+ },
53
+ Notes: 'Met at the 2022 Tech Conference in San Francisco.',
54
+ };
55
+
56
+ return html`
57
+ <div>
58
+ ${Object.keys(tagsLocal).map(
59
+ (objKey, index, arr) => html`
60
+ <${TagOptions}
61
+ objectKey="${objKey}"
62
+ keyValue="${objKey}"
63
+ objectData="${tagsLocal[objKey]}"
64
+ onSelect=${onSelect}
65
+ isRoot="${true}"
66
+ />
67
+ `,
68
+ )}
69
+ </div>
70
+ `;
71
+ };
@@ -0,0 +1,152 @@
1
+ .button {
2
+ outline: none;
3
+ cursor: pointer;
4
+ appearance: none;
5
+ font-size: 12px;
6
+ padding: 0px 15px;
7
+ height: 30px;
8
+ &.btnPrimary {
9
+ border: 1px solid #4250f0;
10
+ background: #4250f0;
11
+ border-radius: 4px;
12
+ font-size: 12px;
13
+ color: #ffffff;
14
+ &:not(.disabled):hover {
15
+ background: var(--theme-accent-blue-2, #3a46d5);
16
+ border: 1px solid var(--theme-accent-blue-2, #3a46d5);
17
+ }
18
+ }
19
+ &.btnSecondary {
20
+ border: 1px solid #4250f0;
21
+ background: transparent;
22
+ text-align: center;
23
+ font-size: 12px;
24
+ color: #4250f0;
25
+ border-radius: 4px;
26
+ &:not(.disabled):hover {
27
+ background: #4250f0;
28
+ color: white;
29
+ }
30
+ }
31
+ &.buttonLink {
32
+ border: none;
33
+ color: #4250f0;
34
+ font-weight: 500;
35
+ font-size: 12px;
36
+ background: transparent;
37
+ padding: 0;
38
+ margin: 0;
39
+ &:not(.disabled):hover {
40
+ color: #473a64;
41
+ }
42
+ }
43
+
44
+ &.tell-us-more-btn {
45
+ width: 113px;
46
+ height: 36px;
47
+ background: #ffffff;
48
+ border: 1px solid #4250f0;
49
+ // box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.08), inset 0px -1px 0px rgba(0, 0, 0, 0.2);
50
+ border-radius: 5px;
51
+ font-family: inherit;
52
+ font-style: normal;
53
+ font-weight: 500;
54
+ font-size: 14px;
55
+ line-height: 20px;
56
+ color: #4250f0;
57
+ &:not(.disabled):hover {
58
+ background: #ffffff;
59
+ color: #4250f0;
60
+ }
61
+ padding: 0px;
62
+ }
63
+
64
+ &.integry-primary-btn {
65
+ width: auto;
66
+ height: auto;
67
+ background: #4250f0;
68
+ border: 1px solid #4250f0;
69
+ box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.08),
70
+ inset 0px -1px 0px rgba(0, 0, 0, 0.2);
71
+ border-radius: 5px;
72
+ font-family: inherit;
73
+ font-style: normal;
74
+ font-weight: 500;
75
+ font-size: 14px;
76
+ line-height: 20px;
77
+ text-align: center;
78
+ color: #ffffff;
79
+ &:not(.disabled):hover {
80
+ background: #2c36ad;
81
+ color: #ffffff;
82
+ }
83
+ padding: 0px;
84
+ }
85
+
86
+ &.integry-btn-grey {
87
+ width: auto;
88
+ height: auto;
89
+ background: #f3f3f3;
90
+ border: 1px solid #f3f3f3;
91
+ box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.08),
92
+ inset 0px -1px 0px rgba(0, 0, 0, 0.2);
93
+ border-radius: 5px;
94
+ font-family: inherit;
95
+ font-style: normal;
96
+ font-weight: 500;
97
+ font-size: 14px;
98
+ line-height: 20px;
99
+ text-align: center;
100
+ color: #333333;
101
+ &:not(.disabled):hover {
102
+ background: #e6e6e6;
103
+ color: #333333;
104
+ }
105
+ padding: 0px;
106
+ }
107
+
108
+ &.integry-secondary-btn {
109
+ width: auto;
110
+ height: auto;
111
+ background: #ffffff;
112
+ border: 1px solid #4250f0;
113
+ // box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.08), inset 0px -1px 0px rgba(0, 0, 0, 0.2);
114
+ border-radius: 5px;
115
+ font-family: inherit;
116
+ font-style: normal;
117
+ font-weight: 500;
118
+ font-size: 14px;
119
+ line-height: 20px;
120
+ color: #4250f0;
121
+ &:not(.disabled):hover {
122
+ background: #4250f0;
123
+ color: #ffffff;
124
+ }
125
+ padding: 0px;
126
+ }
127
+
128
+ &.disabled {
129
+ opacity: 0.5;
130
+ cursor: not-allowed;
131
+ }
132
+
133
+ &.flowWrapButton {
134
+ border-radius: 5px;
135
+ border: 1px solid var(--theme-accent-blue-1, #4250f0);
136
+ background: var(--theme-accent-blue-1, #4250f0);
137
+ color: #fff;
138
+ font-family: Inter;
139
+ font-size: 13px;
140
+ font-style: normal;
141
+ font-weight: 400;
142
+ line-height: normal;
143
+ padding: 4.5px 10px;
144
+ cursor: pointer;
145
+ height: auto;
146
+
147
+ &:hover {
148
+ background: var(--theme-accent-blue-2, #3a46d5) !important;
149
+ border: 1px solid var(--theme-accent-blue-2, #3a46d5) !important;
150
+ }
151
+ }
152
+ }
@@ -47,14 +47,14 @@ interface ActionFormPropsType extends StoreType {
47
47
  isReadOnly?: boolean;
48
48
  accountConnected: boolean;
49
49
  selectedAuthId: string;
50
- tagsTree: any;
51
50
  onFieldChangeCallback?: (fieldId: string, value: string) => void;
51
+ tagsComponent?: any;
52
+ tagsTree?: any;
52
53
  }
53
54
 
54
55
  interface ActionFormStateType {
55
56
  loading: boolean;
56
57
  dynamicFieldDataState: any;
57
- tagsTree: any;
58
58
  parentChildMapping: any;
59
59
  dynamicFieldsData: any;
60
60
  parentFieldChanged: boolean;
@@ -81,10 +81,6 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
81
81
  this.state = {
82
82
  loading: false,
83
83
  dynamicFieldDataState: {},
84
- tagsTree:
85
- this.props.tagsTree && Object.keys(this.props.tagsTree).length > 0
86
- ? JSONToActivityOutputData(this.props.tagsTree)
87
- : {},
88
84
  parentChildMapping: this.setParentChildMapping([templateStep]),
89
85
  dynamicFieldsData: {},
90
86
  parentFieldChanged: false,
@@ -1444,14 +1440,18 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1444
1440
  }
1445
1441
  activityOutputData=${this.arrayToNestedJSONWithFirstValue(
1446
1442
  this.props.activityOutputData ||
1447
- this.state.tagsTree,
1443
+ JSONToActivityOutputData(
1444
+ this.props.tagsTree || {},
1445
+ ),
1448
1446
  this.props.dynamicFieldData ||
1449
1447
  this.state.dynamicFieldDataState ||
1450
1448
  {},
1451
1449
  )}
1452
1450
  activityOutputDataRaw=${
1453
1451
  this.props.activityOutputData ||
1454
- this.state.tagsTree
1452
+ JSONToActivityOutputData(
1453
+ this.props.tagsTree || {},
1454
+ )
1455
1455
  }
1456
1456
  description=${elDescription}
1457
1457
  value=${
@@ -1535,6 +1535,7 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1535
1535
  el.data_type === 'STRING[]' ||
1536
1536
  el.data_type === 'NUMBER[]'
1537
1537
  )}
1538
+ tagsComponent=${this.props.tagsComponent}
1538
1539
  ><//>
1539
1540
  </${ConfigureFieldWrapper}>
1540
1541
  </div>
@@ -1832,13 +1833,19 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1832
1833
  type=${el.activity_field?.type}
1833
1834
  labelTags=${getFieldLabelTags(el, false)}
1834
1835
  activityOutputData=${this.arrayToNestedJSONWithFirstValue(
1835
- this.props.activityOutputData,
1836
+ this.props.activityOutputData ||
1837
+ JSONToActivityOutputData(
1838
+ this.props.tagsTree || {},
1839
+ ),
1836
1840
  this.props.dynamicFieldData ||
1837
1841
  this.state.dynamicFieldDataState ||
1838
1842
  {},
1839
1843
  )}
1840
1844
  activityOutputDataRaw=${
1841
- this.props.activityOutputData
1845
+ this.props.activityOutputData ||
1846
+ JSONToActivityOutputData(
1847
+ this.props.tagsTree || {},
1848
+ )
1842
1849
  }
1843
1850
  isMappable=${el.is_mappable}
1844
1851
  isEditable=${el.is_editable}
@@ -1847,6 +1854,7 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1847
1854
  refreshRootStepData=${
1848
1855
  this.refreshRootStepData
1849
1856
  }
1857
+ tagsComponent=${this.props.tagsComponent}
1850
1858
  />
1851
1859
 
1852
1860
  </${ConfigureFieldWrapper}>
@@ -68,6 +68,7 @@ const DynamicFields = (props: DynamicFieldsProps) => {
68
68
  // if configMode is true, then don't fetch dynamic items
69
69
  // fetch dynamic items from endpoint
70
70
  if (sourceFlowIntegrataionInvocationUrl && selectedAuthId) {
71
+ setLoading(true);
71
72
  context?.apiHandler
72
73
  .callSourceFlowIntegrationInvocationUrl<DynamicDataItem[]>(
73
74
  new URL(sourceFlowIntegrataionInvocationUrl),
@@ -92,6 +93,7 @@ const DynamicFields = (props: DynamicFieldsProps) => {
92
93
  .finally(() => setLoading(false));
93
94
  } else if (activity_field && activity_field.dynamic_field_src) {
94
95
  let data;
96
+ setLoading(true);
95
97
  try {
96
98
  data = JSON.parse(endpointData);
97
99
  } catch (error) {
package/src/index.ts CHANGED
@@ -28,6 +28,7 @@ import {
28
28
  RenderModes,
29
29
  Layouts,
30
30
  SetupIntegrationOptions,
31
+ RenderFlowStepOptions,
31
32
  } from '@/types';
32
33
 
33
34
  import { createSDKStore, initialState } from '@/store';
@@ -47,6 +48,7 @@ import FunctionForm from '@/features/common/FunctionForm';
47
48
  import { openPopupWindow } from '@/utils/popup';
48
49
  import { Modal } from '@/components/Modal';
49
50
  import { ListBox } from '@/components/MultipurposeField/Dropdown';
51
+ // import { TestComponent } from '@/components/TestComponent';
50
52
  import { MultipurposeField } from './components/MultipurposeField';
51
53
  import SDKDebugContainer from './features/containers/SDKDebugContainer';
52
54
 
@@ -1982,13 +1984,18 @@ export class IntegryJS {
1982
1984
  };
1983
1985
 
1984
1986
  public renderFlowStep = (
1985
- containerId: string,
1986
- step: any,
1987
- connectedAccountId: string,
1988
- tagsTree = {},
1989
- onFieldChangeCallback?: (fieldId: string, value: string) => void,
1987
+ options: RenderFlowStepOptions = {
1988
+ containerId: 'integry-marketplace',
1989
+ step: {},
1990
+ connectedAccountId: '',
1991
+ tagsComponent: null,
1992
+ tagsTree: {},
1993
+ onFieldChangeCallback: () => {
1994
+ // Placeholder function for future implementation
1995
+ },
1996
+ },
1990
1997
  ) => {
1991
- const target = document.getElementById(containerId);
1998
+ const target = document.getElementById(options.containerId);
1992
1999
 
1993
2000
  if (target) {
1994
2001
  const store = createSDKStore();
@@ -2003,16 +2010,17 @@ export class IntegryJS {
2003
2010
  >
2004
2011
  <${Provider} store=${store} key=${this.getRandomFlowId(10)}>
2005
2012
  <${ActionForm}
2006
- step=${step}
2013
+ step=${options.step}
2007
2014
  stepType=${'CONFIGURE'}
2008
2015
  showStepValidation=${false}
2009
2016
  apiHandler=${this.apiHandler}
2010
2017
  eventEmitter=${this.eventEmitter}
2011
2018
  isReadOnly="${false}"
2012
- selectedAuthId="${connectedAccountId}"
2019
+ selectedAuthId="${options.connectedAccountId}"
2013
2020
  accountConnected=${true}
2014
- tagsTree=${tagsTree}
2015
- onFieldChangeCallback=${onFieldChangeCallback}
2021
+ tagsComponent=${options.tagsComponent}
2022
+ onFieldChangeCallback=${options.onFieldChangeCallback}
2023
+ tagsTree=${options.tagsTree}
2016
2024
  />
2017
2025
  <//>
2018
2026
  <//>
@@ -2021,7 +2029,7 @@ export class IntegryJS {
2021
2029
  );
2022
2030
  } else {
2023
2031
  console.warn(
2024
- `Integry SDK render target with id ${containerId} was not found`,
2032
+ `Integry SDK render target with id ${options.containerId} was not found`,
2025
2033
  );
2026
2034
  }
2027
2035
  };
@@ -1,5 +1,3 @@
1
- import { type } from 'superstruct';
2
-
3
1
  export type IntegrySDKEventType =
4
2
  | 'authorizations'
5
3
  | 'did-add-authorization'
@@ -291,3 +289,11 @@ export type SetupIntegrationOptions = {
291
289
  integrationId?: number;
292
290
  params?: Record<string, string>;
293
291
  };
292
+ export type RenderFlowStepOptions = {
293
+ containerId: string;
294
+ step: any;
295
+ connectedAccountId: string;
296
+ tagsComponent?: any;
297
+ onFieldChangeCallback: (fieldId: string, value: any) => void;
298
+ tagsTree: any;
299
+ };