@integry/sdk 3.3.2-beta.6 → 3.3.2-beta.8

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/LICENSE CHANGED
@@ -1,13 +1,13 @@
1
- Copyright 2021 Osama Aamer <osama@integry.io>
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
1
+ Copyright 2021 Osama Aamer <osama@integry.io>
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
13
  limitations under the License.
package/README.md CHANGED
@@ -1,21 +1,21 @@
1
- # Integry SDK
2
-
3
- ### Integry at a glance
4
-
5
- Integry is an integration platform that provides integrations inside your app for your users. You can customize the look and feel of the integrations such that they appear just like your app. For example, your users can connect your app to Slack and send messages to Slack
6
-
7
- ### What is this package for?
8
-
9
- Use Integry SDK to embed integration creation experiences inside your app.
10
-
11
- ### Install the SDK
12
-
13
- ```shell
14
- # yarn
15
- yarn add @integry/sdk
16
-
17
- # npm
18
- npm i @integry/sdk
19
- ```
20
-
21
- Get started and learn more using our [documentation.](https://sdk.integry.io)
1
+ # Integry SDK
2
+
3
+ ### Integry at a glance
4
+
5
+ Integry is an integration platform that provides integrations inside your app for your users. You can customize the look and feel of the integrations such that they appear just like your app. For example, your users can connect your app to Slack and send messages to Slack
6
+
7
+ ### What is this package for?
8
+
9
+ Use Integry SDK to embed integration creation experiences inside your app.
10
+
11
+ ### Install the SDK
12
+
13
+ ```shell
14
+ # yarn
15
+ yarn add @integry/sdk
16
+
17
+ # npm
18
+ npm i @integry/sdk
19
+ ```
20
+
21
+ Get started and learn more using our [documentation.](https://sdk.integry.io)
@@ -1,176 +1,176 @@
1
- # Integry SDK
2
-
3
- ## General features
4
-
5
- - No extra dependencies needed, drastically reduced bundle size
6
- - No transpilation steps needed
7
- - Vanilla JS implementation
8
- - Improved documentation
9
- - Available as a package on NPM
10
- - Can be embedded using a script tag
11
- - Built-in Typescript support
12
- - More powerful events management
13
- - Multi-level customization. Start with built in components and layouts.
14
- - Multiple render modes including inline rendering, modal support and detached rendering where we decouple the views from one another
15
- - Discover more customization options starting from simple CSS overrides to extending and implementing your own custom widgets
16
-
17
- ## Tech stack
18
-
19
- - [Preact](https://github.com/developit/preact)
20
- - [htm](https://github.com/developit/htm)
21
- - [Unistore](https://github.com/developit/unistore)
22
- - [Rollup](https://rollupjs.org/)
23
- - NodeJS
24
- - Yarn
25
-
26
- ## Directory structure
27
-
28
- ```
29
- .
30
- ├── dist # Compiled files
31
- ├── examples # Example projects using SDK
32
- ├── playground # HTML files covering different debug scenarios
33
- ├── sdk-docs # `Docusaurus` documentation site for SDK
34
- ├── src # Source files
35
- │ ├── components # Preact components used in the SDK
36
- │ ├── contexts # Preact contexts used in the SDK
37
- │ ├── extensions # SDK HMAC and API extensions
38
- │ ├── features # Directory-wise breakdown of different SDK views
39
- │ ├── hooks # Preact hooks
40
- │ ├── interfaces # Typescript interfaces
41
- │ ├── modules # API and event emitter live here
42
- │ ├── store # SDK data store setup
43
- │ ├── types # Typescript types live here
44
- │ ├── utils # Utilities used in the SDK
45
- │ ├── index.ts # JS Modules entry point
46
- │ └── index.umd.ts # UMD entry point
47
- ├── types # General Typescript types for rollup
48
- ├── rollup.config.js # Rollup configuration
49
- ├── tsconfig.json # TS configuration
50
- └── README.md
51
- ```
52
-
53
- ## Setting up your development environment
54
-
55
- ### Pre-requisites
56
-
57
- 1. NodeJS
58
- 2. yarn
59
-
60
- ### Starting the local environment
61
-
62
- 1. `cd` into the SDK root directory which is located at `<repo_root>/sdk-v3`
63
- 2. Install dependencies by running `yarn install`
64
- 3. Start the local development environment by running `yarn start`
65
- 4. The development server will start at http://localhost:10001
66
-
67
- ### Choosing which mode to debug
68
-
69
- The SDK has multiple playground HTML files to work on different areas. Each html file lives in the `sdk-v3/playground` directory and contains code which sets up the SDK and calls different methods. You can edit these files to debug different aspects of the SDK.
70
-
71
- 1. http://localhost:10001/index.html
72
-
73
- You can use this playground to debug a normal SDK embed which starts from the Flows listing page. You can click on a Flow and setup integrations. You can select from the tabs at the top to either view available Flows or view existing integrations.
74
-
75
- 2. http://localhost:10001/template.html
76
-
77
- You can use this playground to directly open a Flow.
78
-
79
- 3. http://localhost:10001/auths.html
80
-
81
- You can use this playground to work on the app account management feature provided by the SDK.
82
-
83
- ## Development
84
-
85
- ### Hot reloading
86
-
87
- When you make a change to the code in development mode, Rollup will automatically re-compile the code. After it is done, you will have to refresh the page to see the latest changes.
88
-
89
- ### Debugging using Redux Devtools
90
-
91
- The SDK supports Redux Devtools to look into the internal state and debug actions. Devtools are enabled by default and can be enabled/disabled in the `src/store/index.ts` file. To use the devtools, install the Redux Devtools extension, open the developer tools in your browser and then refresh the SDK playground page.
92
-
93
- ### Styling
94
-
95
- Styles are co-located with each component in a `styles.module.scss` file. This is then imported into a component and used.
96
-
97
- ```tsx
98
- import styles from './styles.module.scss';
99
-
100
- <div class=${styles.selectWrapper} />
101
- ```
102
-
103
- ## Debugging certain features
104
-
105
- ### API Calls
106
-
107
- All API calls are centrally located inside the directory: `src/modules/api/index.ts`.
108
-
109
- ### Manage app accounts
110
-
111
- The code for the manage app accounts feature starts with the `index.ts` entry point.
112
-
113
- ```ts
114
- /**
115
- * Render the account connection modal
116
- * @param data
117
- */
118
- public renderAccountConnectionModal = (data?: {
119
- deploymentId?: string;
120
- appId?: number;
121
- authTypeId?: number;
122
- }): void => {
123
- //
124
- }
125
- ```
126
-
127
- This function sets up our render destination inside the HTML, initializes the store and finally calls the Preact `render` method to render the `AuthSetupContainer` component inside the target container.
128
-
129
- All of the code for managing app accounts feature is located in `src/features/containers/AuthSetupContainer`.
130
-
131
- ```
132
- . AuthSetupContainer
133
- ├── AppSelection.ts # Renders the app selection screen
134
- ├── AuthTypeSelection.ts # Renders the auth type selection screen
135
- ├── Footer.ts # Renders the footer inside auth type selection
136
- ├── Header.ts # Renders the header which shows step title and close icon
137
- ├── index.ts # Wraps the entire feature with state and API calls
138
- └── PostAdditionPopup.ts # Renders the modal which appears after we add an auth
139
- ```
140
-
141
- ### Flow setup
142
-
143
- The code for flow setup starts with the `index.ts` entry point.
144
-
145
- ```ts
146
- /**
147
- * Render the flow setup form we ship
148
- * @param data
149
- */
150
- public renderFlowSetupForm = (data: {
151
- flowId?: string;
152
- flowContainerId: string;
153
- }): void => {
154
- //
155
- }
156
- ```
157
-
158
- This function sets up our render destination inside the HTML, initializes the store and finally calls the Preact `render` method to render the `FlowSetupContainer` component inside the target container.
159
-
160
- All of the code for rendering a Flow setup form is located in `src/features/containers/FlowSetupContainer/index.ts`.
161
-
162
- ### Normal SDK embed
163
-
164
- The code for the normal SDK embed setup starts with the `index.ts` entry point.
165
-
166
- ```ts
167
- /**
168
- *
169
- * @param initConfig
170
- */
171
- public init = (initConfig: InitConfig) => {}
172
- ```
173
-
174
- This function sets up our render destination inside the HTML, initializes the store and finally calls the Preact `render` method to render the `SDKContainer` component inside the target container.
175
-
176
- All of the code for rendering a the normal SDK embed is located in `src/features/containers/SDKContainer/index.ts`.
1
+ # Integry SDK
2
+
3
+ ## General features
4
+
5
+ - No extra dependencies needed, drastically reduced bundle size
6
+ - No transpilation steps needed
7
+ - Vanilla JS implementation
8
+ - Improved documentation
9
+ - Available as a package on NPM
10
+ - Can be embedded using a script tag
11
+ - Built-in Typescript support
12
+ - More powerful events management
13
+ - Multi-level customization. Start with built in components and layouts.
14
+ - Multiple render modes including inline rendering, modal support and detached rendering where we decouple the views from one another
15
+ - Discover more customization options starting from simple CSS overrides to extending and implementing your own custom widgets
16
+
17
+ ## Tech stack
18
+
19
+ - [Preact](https://github.com/developit/preact)
20
+ - [htm](https://github.com/developit/htm)
21
+ - [Unistore](https://github.com/developit/unistore)
22
+ - [Rollup](https://rollupjs.org/)
23
+ - NodeJS
24
+ - Yarn
25
+
26
+ ## Directory structure
27
+
28
+ ```
29
+ .
30
+ ├── dist # Compiled files
31
+ ├── examples # Example projects using SDK
32
+ ├── playground # HTML files covering different debug scenarios
33
+ ├── sdk-docs # `Docusaurus` documentation site for SDK
34
+ ├── src # Source files
35
+ │ ├── components # Preact components used in the SDK
36
+ │ ├── contexts # Preact contexts used in the SDK
37
+ │ ├── extensions # SDK HMAC and API extensions
38
+ │ ├── features # Directory-wise breakdown of different SDK views
39
+ │ ├── hooks # Preact hooks
40
+ │ ├── interfaces # Typescript interfaces
41
+ │ ├── modules # API and event emitter live here
42
+ │ ├── store # SDK data store setup
43
+ │ ├── types # Typescript types live here
44
+ │ ├── utils # Utilities used in the SDK
45
+ │ ├── index.ts # JS Modules entry point
46
+ │ └── index.umd.ts # UMD entry point
47
+ ├── types # General Typescript types for rollup
48
+ ├── rollup.config.js # Rollup configuration
49
+ ├── tsconfig.json # TS configuration
50
+ └── README.md
51
+ ```
52
+
53
+ ## Setting up your development environment
54
+
55
+ ### Pre-requisites
56
+
57
+ 1. NodeJS
58
+ 2. yarn
59
+
60
+ ### Starting the local environment
61
+
62
+ 1. `cd` into the SDK root directory which is located at `<repo_root>/sdk-v3`
63
+ 2. Install dependencies by running `yarn install`
64
+ 3. Start the local development environment by running `yarn start`
65
+ 4. The development server will start at http://localhost:10001
66
+
67
+ ### Choosing which mode to debug
68
+
69
+ The SDK has multiple playground HTML files to work on different areas. Each html file lives in the `sdk-v3/playground` directory and contains code which sets up the SDK and calls different methods. You can edit these files to debug different aspects of the SDK.
70
+
71
+ 1. http://localhost:10001/index.html
72
+
73
+ You can use this playground to debug a normal SDK embed which starts from the Flows listing page. You can click on a Flow and setup integrations. You can select from the tabs at the top to either view available Flows or view existing integrations.
74
+
75
+ 2. http://localhost:10001/template.html
76
+
77
+ You can use this playground to directly open a Flow.
78
+
79
+ 3. http://localhost:10001/auths.html
80
+
81
+ You can use this playground to work on the app account management feature provided by the SDK.
82
+
83
+ ## Development
84
+
85
+ ### Hot reloading
86
+
87
+ When you make a change to the code in development mode, Rollup will automatically re-compile the code. After it is done, you will have to refresh the page to see the latest changes.
88
+
89
+ ### Debugging using Redux Devtools
90
+
91
+ The SDK supports Redux Devtools to look into the internal state and debug actions. Devtools are enabled by default and can be enabled/disabled in the `src/store/index.ts` file. To use the devtools, install the Redux Devtools extension, open the developer tools in your browser and then refresh the SDK playground page.
92
+
93
+ ### Styling
94
+
95
+ Styles are co-located with each component in a `styles.module.scss` file. This is then imported into a component and used.
96
+
97
+ ```tsx
98
+ import styles from './styles.module.scss';
99
+
100
+ <div class=${styles.selectWrapper} />
101
+ ```
102
+
103
+ ## Debugging certain features
104
+
105
+ ### API Calls
106
+
107
+ All API calls are centrally located inside the directory: `src/modules/api/index.ts`.
108
+
109
+ ### Manage app accounts
110
+
111
+ The code for the manage app accounts feature starts with the `index.ts` entry point.
112
+
113
+ ```ts
114
+ /**
115
+ * Render the account connection modal
116
+ * @param data
117
+ */
118
+ public renderAccountConnectionModal = (data?: {
119
+ deploymentId?: string;
120
+ appId?: number;
121
+ authTypeId?: number;
122
+ }): void => {
123
+ //
124
+ }
125
+ ```
126
+
127
+ This function sets up our render destination inside the HTML, initializes the store and finally calls the Preact `render` method to render the `AuthSetupContainer` component inside the target container.
128
+
129
+ All of the code for managing app accounts feature is located in `src/features/containers/AuthSetupContainer`.
130
+
131
+ ```
132
+ . AuthSetupContainer
133
+ ├── AppSelection.ts # Renders the app selection screen
134
+ ├── AuthTypeSelection.ts # Renders the auth type selection screen
135
+ ├── Footer.ts # Renders the footer inside auth type selection
136
+ ├── Header.ts # Renders the header which shows step title and close icon
137
+ ├── index.ts # Wraps the entire feature with state and API calls
138
+ └── PostAdditionPopup.ts # Renders the modal which appears after we add an auth
139
+ ```
140
+
141
+ ### Flow setup
142
+
143
+ The code for flow setup starts with the `index.ts` entry point.
144
+
145
+ ```ts
146
+ /**
147
+ * Render the flow setup form we ship
148
+ * @param data
149
+ */
150
+ public renderFlowSetupForm = (data: {
151
+ flowId?: string;
152
+ flowContainerId: string;
153
+ }): void => {
154
+ //
155
+ }
156
+ ```
157
+
158
+ This function sets up our render destination inside the HTML, initializes the store and finally calls the Preact `render` method to render the `FlowSetupContainer` component inside the target container.
159
+
160
+ All of the code for rendering a Flow setup form is located in `src/features/containers/FlowSetupContainer/index.ts`.
161
+
162
+ ### Normal SDK embed
163
+
164
+ The code for the normal SDK embed setup starts with the `index.ts` entry point.
165
+
166
+ ```ts
167
+ /**
168
+ *
169
+ * @param initConfig
170
+ */
171
+ public init = (initConfig: InitConfig) => {}
172
+ ```
173
+
174
+ This function sets up our render destination inside the HTML, initializes the store and finally calls the Preact `render` method to render the `SDKContainer` component inside the target container.
175
+
176
+ All of the code for rendering a the normal SDK embed is located in `src/features/containers/SDKContainer/index.ts`.