@useparagon/connect 1.0.2 → 1.0.3-experimental.2

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.
@@ -0,0 +1,43 @@
1
+ <!--
2
+ How to use this template:
3
+
4
+ 1. Fill out sections that make sense.
5
+ 2. Delete sections that are not relevant.
6
+ -->
7
+
8
+ ### Issues Closed
9
+
10
+ - <!-- issue_number -->
11
+
12
+ ### Summary
13
+
14
+ <!--
15
+ WHAT did you do? WHY did you do it?
16
+ -->
17
+
18
+ ### Changes
19
+
20
+ <!--
21
+ - change #1
22
+ - change #2
23
+ -->
24
+
25
+ ### Unrelated Changes
26
+
27
+ <!-- did anything not detailed in the related issues get updated? -->
28
+
29
+ ### Configuration Changes
30
+
31
+ <!-- do we need to update any configs? -->
32
+
33
+ ### Future Work
34
+
35
+ <!-- how can this be improved? -->
36
+
37
+ ### Steps to Test
38
+
39
+ <!-- how do we test this? -->
40
+
41
+ ### Screenshots
42
+
43
+ <!-- show your work -->
@@ -0,0 +1,133 @@
1
+ ## ---------------------------------------------------
2
+ ## |\---/|
3
+ ## | ,_, | !! DO NOT MODIFY !!
4
+ ## \_`_/-..----. file managed by `whiskers`
5
+ ## ___/ ` ' ,""+ \
6
+ ## (__...' __\ |`.___.';
7
+ ## (_,...'(_,.`__)/'.....+
8
+ ## ---------------------------------------------------
9
+
10
+ name: build
11
+
12
+ on:
13
+ pull_request: {}
14
+ push:
15
+ branches:
16
+ - main
17
+
18
+ jobs:
19
+ build:
20
+ name: build
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+
24
+ - name: git > checkout
25
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
26
+ with:
27
+ clean: true
28
+ fetch-depth: 1
29
+
30
+ - name: node > setup
31
+ uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
32
+ with:
33
+ node-version-file: .nvmrc
34
+ cache: yarn
35
+
36
+ - name: yarn > install
37
+ run: yarn install --frozen-lockfile
38
+
39
+ - name: yarn > build
40
+ run: yarn build
41
+
42
+ - name: ci > upload artifacts
43
+ uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
44
+ with:
45
+ name: dist
46
+ path: dist/
47
+ if-no-files-found: error
48
+ lint:
49
+ name: lint
50
+ runs-on: ubuntu-latest
51
+ steps:
52
+
53
+ - name: git > checkout
54
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
55
+ with:
56
+ clean: true
57
+ fetch-depth: 1
58
+
59
+ - name: node > setup
60
+ uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
61
+ with:
62
+ node-version-file: .nvmrc
63
+ cache: yarn
64
+
65
+ - name: yarn > install
66
+ run: yarn install --frozen-lockfile
67
+
68
+ - name: yarn > lint
69
+ run: yarn lint
70
+ test:
71
+ name: test
72
+ runs-on: ubuntu-latest
73
+ steps:
74
+
75
+ - name: git > checkout
76
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
77
+ with:
78
+ clean: true
79
+ fetch-depth: 1
80
+
81
+ - name: node > setup
82
+ uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
83
+ with:
84
+ node-version-file: .nvmrc
85
+ cache: yarn
86
+
87
+ - name: yarn > install
88
+ run: yarn install --frozen-lockfile
89
+
90
+ - name: yarn > test
91
+ run: yarn test
92
+ verify_workflow:
93
+ name: verify workflow
94
+ runs-on: ubuntu-latest
95
+ if: always()
96
+ needs:
97
+ - build
98
+ - lint
99
+ - test
100
+ steps:
101
+
102
+ - name: verify workflow success
103
+ if: always()
104
+ run: |-
105
+ # resolve statuses
106
+ BUILD_AGGREGATE=(${{ needs['build'].result }})
107
+ BUILD=unknown
108
+ BUILD=$(if [[ " ${BUILD_AGGREGATE[@]} " == *"success"* ]]; then echo "success"; else echo "$BUILD"; fi)
109
+ BUILD=$(if [[ " ${BUILD_AGGREGATE[@]} " == *"skipped"* ]]; then echo "skipped"; else echo "$BUILD"; fi)
110
+ BUILD=$(if [[ " ${BUILD_AGGREGATE[@]} " == *"cancelled"* ]]; then echo "cancelled"; else echo "$BUILD"; fi)
111
+ BUILD=$(if [[ " ${BUILD_AGGREGATE[@]} " == *"failure"* ]]; then echo "failure"; else echo "$BUILD"; fi)
112
+ LINT_AGGREGATE=(${{ needs['lint'].result }})
113
+ LINT=unknown
114
+ LINT=$(if [[ " ${LINT_AGGREGATE[@]} " == *"success"* ]]; then echo "success"; else echo "$LINT"; fi)
115
+ LINT=$(if [[ " ${LINT_AGGREGATE[@]} " == *"skipped"* ]]; then echo "skipped"; else echo "$LINT"; fi)
116
+ LINT=$(if [[ " ${LINT_AGGREGATE[@]} " == *"cancelled"* ]]; then echo "cancelled"; else echo "$LINT"; fi)
117
+ LINT=$(if [[ " ${LINT_AGGREGATE[@]} " == *"failure"* ]]; then echo "failure"; else echo "$LINT"; fi)
118
+ TEST_AGGREGATE=(${{ needs['test'].result }})
119
+ TEST=unknown
120
+ TEST=$(if [[ " ${TEST_AGGREGATE[@]} " == *"success"* ]]; then echo "success"; else echo "$TEST"; fi)
121
+ TEST=$(if [[ " ${TEST_AGGREGATE[@]} " == *"skipped"* ]]; then echo "skipped"; else echo "$TEST"; fi)
122
+ TEST=$(if [[ " ${TEST_AGGREGATE[@]} " == *"cancelled"* ]]; then echo "cancelled"; else echo "$TEST"; fi)
123
+ TEST=$(if [[ " ${TEST_AGGREGATE[@]} " == *"failure"* ]]; then echo "failure"; else echo "$TEST"; fi)
124
+
125
+ # echo the results of each job
126
+ echo "BUILD: $BUILD"
127
+ echo "LINT: $LINT"
128
+ echo "TEST: $TEST"
129
+
130
+ # assert success
131
+ if [[ "$BUILD" != "success" ]]; then exit 1; fi
132
+ if [[ "$LINT" != "success" ]]; then exit 1; fi
133
+ if [[ "$TEST" != "success" ]]; then exit 1; fi
@@ -0,0 +1,106 @@
1
+ ## ---------------------------------------------------
2
+ ## |\---/|
3
+ ## | ,_, | !! DO NOT MODIFY !!
4
+ ## \_`_/-..----. file managed by `whiskers`
5
+ ## ___/ ` ' ,""+ \
6
+ ## (__...' __\ |`.___.';
7
+ ## (_,...'(_,.`__)/'.....+
8
+ ## ---------------------------------------------------
9
+
10
+ name: publish
11
+ run-name: publish v${{ inputs.version }}
12
+
13
+ on:
14
+ workflow_dispatch:
15
+ inputs:
16
+ branch:
17
+ description: The branch of the build. Used to find artifacts and tag.
18
+ required: true
19
+ release_type:
20
+ description: The type of release.
21
+ required: true
22
+ type: choice
23
+ options:
24
+ - experimental
25
+ - stable
26
+ default: experimental
27
+ version:
28
+ description: "The version of this release. Omit 'v' prefix. Example: '1.0.1-experimental.1'."
29
+ required: true
30
+
31
+ jobs:
32
+ version_bump:
33
+ name: version bump
34
+ runs-on: ubuntu-latest
35
+ timeout-minutes: 5
36
+ steps:
37
+
38
+ - name: git > checkout
39
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
40
+ with:
41
+ clean: true
42
+ fetch-depth: 1
43
+ token: ${{ secrets.BOT_GITHUB_TOKEN }}
44
+ ref: ${{ inputs.branch }}
45
+
46
+ - name: node > setup
47
+ uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
48
+ with:
49
+ node-version-file: .nvmrc
50
+ cache: yarn
51
+
52
+ - name: yarn > install
53
+ run: yarn install --frozen-lockfile
54
+
55
+ - name: yarn > bump version
56
+ run: yarn run release:version:bump ${{ inputs.version }}
57
+
58
+ - name: git > commit version bump
59
+ uses: EndBug/add-and-commit@1bad3abcf0d6ec49a5857d124b0bfb52dc7bb081
60
+ with:
61
+ default_author: github_actions
62
+ message: bump version to ${{ inputs.version }}
63
+ push: true
64
+ tag: v${{ inputs.version }}
65
+ publish:
66
+ name: publish
67
+ runs-on: ubuntu-latest
68
+ needs:
69
+ - version_bump
70
+ steps:
71
+
72
+ - name: git > checkout
73
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
74
+ with:
75
+ clean: true
76
+ fetch-depth: 1
77
+ token: ${{ secrets.BOT_GITHUB_TOKEN }}
78
+ ref: v${{ inputs.version }}
79
+
80
+ - name: node > setup
81
+ uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
82
+ with:
83
+ node-version-file: .nvmrc
84
+ cache: yarn
85
+
86
+ - name: yarn > install
87
+ run: yarn install --frozen-lockfile
88
+
89
+ - name: ci > download artifacts
90
+ uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e
91
+ with:
92
+ workflow: build.yaml
93
+ workflow_conclusion: success
94
+ branch: ${{ inputs.branch }}
95
+
96
+ - name: yarn > publish (experimental)
97
+ if: inputs.release_type == 'experimental'
98
+ env:
99
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
100
+ run: yarn run release:publish:experimental
101
+
102
+ - name: yarn > publish (stable)
103
+ if: inputs.release_type == 'stable'
104
+ env:
105
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
106
+ run: yarn run release:publish:stable
@@ -0,0 +1,36 @@
1
+ ## ---------------------------------------------------
2
+ ## |\---/|
3
+ ## | ,_, | !! DO NOT MODIFY !!
4
+ ## \_`_/-..----. file managed by `whiskers`
5
+ ## ___/ ` ' ,""+ \
6
+ ## (__...' __\ |`.___.';
7
+ ## (_,...'(_,.`__)/'.....+
8
+ ## ---------------------------------------------------
9
+
10
+ name: release
11
+
12
+ on:
13
+ push:
14
+ tags:
15
+ - v*.*.*
16
+
17
+ jobs:
18
+ release:
19
+ name: release
20
+ runs-on: ubuntu-latest
21
+ timeout-minutes: 10
22
+ steps:
23
+
24
+ - name: git > checkout
25
+ uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
26
+ with:
27
+ clean: true
28
+ fetch-depth: 1
29
+ token: ${{ secrets.BOT_GITHUB_TOKEN }}
30
+
31
+ - name: release > create github release
32
+ uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
33
+ with:
34
+ token: ${{ secrets.BOT_GITHUB_TOKEN }}
35
+ generate_release_notes: true
36
+ prerelease: ${{ contains(github.ref, 'experimental') }}
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v18.17.1
package/changelog.md CHANGED
@@ -1,4 +1,15 @@
1
+ ### 1.2.0
2
+
3
+ - add `paragon.completeInstall` method for integration-origin install flows
4
+
5
+ ### 1.1.0
6
+
7
+ - added multiple auth support
8
+
1
9
  ### 1.0.2
10
+
2
11
  - type fixes
12
+
3
13
  ### 1.0.1
4
- - connect sdk
14
+
15
+ - connect sdk
@@ -2,7 +2,7 @@ import { OauthCallbackResponse } from './entities/credential.interface';
2
2
  import { IIntegrationMetadata } from './entities/integration.interface';
3
3
  import { PersonaMeta } from './entities/persona.interface';
4
4
  import SDKEventEmitter from './SDKEventEmitter';
5
- import { AuthenticateOptions, AuthenticatedConnectUser, Props as ConnectModalProps, ConnectParams, ConnectUser, EventInfo, IConnectSDK, InstallOptions, TriggerWorkflowRequest } from './types';
5
+ import { AuthenticateOptions, AuthenticatedConnectUser, Props as ConnectModalProps, ConnectParams, ConnectUser, DisableWorkflowOptions, EventInfo, IConnectSDK, InstallOptions, TriggerWorkflowRequest, UninstallOptions } from './types';
6
6
  export declare const PARAGON_OVERFLOW_EMPTY_VALUE = "PARAGON_OVERFLOW_EMPTY_VALUE";
7
7
  export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
8
8
  root: HTMLIFrameElement | undefined;
@@ -34,7 +34,6 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
34
34
  * so that we will be able to know whether style is added in body or not
35
35
  */
36
36
  private originalBodyOverflow;
37
- private configs;
38
37
  constructor();
39
38
  /**
40
39
  * post message handler
@@ -43,7 +42,24 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
43
42
  private eventMessageHandler;
44
43
  private functionInvocationHandler;
45
44
  private createReactRoot;
45
+ /**
46
+ * checks
47
+ * - if integartion name is valid
48
+ * - if integration is setup in project
49
+ * - if integration is active in project
50
+ * throws error if any of these is not met
51
+ * @param action
52
+ * @param validateIsEnabled boolean
53
+ */
46
54
  private validateAction;
55
+ /**
56
+ * checks if the integration is installed.
57
+ * Assumes that the user is authenticated
58
+ * @param action
59
+ * @param userState
60
+ * @returns boolean value
61
+ */
62
+ private isAlreadyInstalled;
47
63
  private bootstrapSDKState;
48
64
  setModalState(statePartial: Partial<ConnectModalProps>): void;
49
65
  /**
@@ -114,6 +130,7 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
114
130
  * @returns api request response
115
131
  */
116
132
  request<TResponse>(action: string, path: string, init: {
133
+ selectedCredentialId?: string;
117
134
  method: RequestInit['method'];
118
135
  body: RequestInit['body'] | object;
119
136
  headers: RequestInit['headers'];
@@ -147,7 +164,7 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
147
164
  * @param workflowId
148
165
  * @param payload
149
166
  */
150
- workflow(workflowId: string, { body, query, headers }?: TriggerWorkflowRequest): Promise<object | undefined>;
167
+ workflow(workflowId: string, { selectedCredentialId, body, query, headers }?: TriggerWorkflowRequest): Promise<object | undefined>;
151
168
  /**
152
169
  * for programmatically installing an integration
153
170
  */
@@ -156,8 +173,9 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
156
173
  * gates headless feature to pro and enterprise users
157
174
  */
158
175
  ensureHeadlessIsSupported(): void;
159
- uninstallIntegration(action: string): Promise<void>;
160
- disableWorkflow(workflowId: string): Promise<void>;
176
+ uninstallIntegration(action: string, options?: UninstallOptions): Promise<void>;
177
+ disableWorkflow(workflowId: string, options?: DisableWorkflowOptions): Promise<void>;
178
+ private getIntegrationForWorkflow;
161
179
  private updateLocalState;
162
180
  /**
163
181
  * also returns false if unable to find workflow in configured workflow property of any integration
@@ -178,7 +196,6 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
178
196
  */
179
197
  private updateIntegrations;
180
198
  setUserMetadata(meta: PersonaMeta): Promise<AuthenticatedConnectUser>;
181
- getIntegrationConfigs(actionNames: string[]): Promise<void>;
182
199
  /**
183
200
  * @param {host: string;} domain
184
201
  * sets the domain for making http service request
@@ -187,4 +204,20 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
187
204
  configureGlobal(param: {
188
205
  host: string;
189
206
  }): void;
207
+ /**
208
+ * some integration required flow in which user recieve authorization code
209
+ * from marketplace oauth flow , so needed this method see PARA-8385
210
+ */
211
+ completeInstall(action: string, options: {
212
+ authorizationCode: string;
213
+ showPortalAfterInstall?: boolean;
214
+ redirectUrl?: string;
215
+ integrationOptions?: Record<string, unknown>;
216
+ }): Promise<void>;
217
+ /**
218
+ * update credential data in integration
219
+ * @param newCredential
220
+ * @param integration
221
+ */
222
+ private updateCredentialData;
190
223
  }
@@ -30,4 +30,7 @@ export interface IConnectIntegrationWithCredentialInfo extends IConnectIntegrati
30
30
  hasCredential: boolean;
31
31
  connectedUserLimitOnDevCred: number;
32
32
  connectedUserLimitReached: boolean;
33
+ needPreOauthInputs: boolean;
34
+ name: string;
35
+ brandColor: string;
33
36
  }
@@ -1,3 +1,4 @@
1
+ import { SDKIntegration } from '../types/connect';
1
2
  import { DataType, KeyedSource } from '../types/resolvers';
2
3
  import { NonNullUndefinedField } from '../types/sdk';
3
4
  /**
@@ -13,3 +14,10 @@ export declare function parseKeyedSource(param: KeyedSource<DataType.ANY>[]): Re
13
14
  * @returns
14
15
  */
15
16
  export declare function stripUndefinedAndNull<T extends object>(obj: T): NonNullUndefinedField<T>;
17
+ /**
18
+ * provides the action state object after a credential is deleted.
19
+ * @param `deletedCredentialId` (string): The ID of the credential that was deleted.
20
+ * @param `deletedActionState` (`SDKIntegration`): The user state for the action whose credential was deleted
21
+ * @returns an object of type `SDKIntegration`.
22
+ */
23
+ export declare const getActionStateForCredentialDelete: (deletedCredentialId: string, deletedActionState: SDKIntegration) => SDKIntegration;
@@ -1,20 +1,6 @@
1
- import { AuthenticationScheme } from '../entities/credential.interface';
2
1
  import { IConnectIntegrationWithCredentialInfo } from '../entities/integration.interface';
3
- import { IntegrationConnectInput } from '../types/action';
4
2
  import { DataType, KeyedSource } from '../types/resolvers';
5
3
  import { IConnectUserContext } from './ConnectUserContext';
6
- /**
7
- * this check if inputs needs to be shown before oauth
8
- * @param integration
9
- * @returns
10
- */
11
- export declare const shouldShowPreAuthInputs: ({ integration, authScheme, endUserSuppliedValues, isAccountTypeSupported, }: {
12
- integration: IConnectIntegrationWithCredentialInfo;
13
- provider?: string | undefined;
14
- authScheme?: AuthenticationScheme | undefined;
15
- endUserSuppliedValues?: IntegrationConnectInput[] | undefined;
16
- isAccountTypeSupported: boolean;
17
- }) => boolean;
18
4
  /**
19
5
  * start oauth flow with new popup
20
6
  * @param param0