@worthai/onboarding-sdk 2.0.0 → 2.0.1
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/README.md +10 -10
- package/dist/interfaces/OnboardingAppMessage.d.ts +1 -1
- package/package.json +10 -3
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @worthai/onboarding-sdk
|
|
2
2
|
|
|
3
3
|
A TypeScript SDK for seamless cross-origin communication between parent and child sites using iframe postMessage API. This SDK provides type-safe utilities for building onboarding flows with secure message passing between applications.
|
|
4
4
|
|
|
@@ -8,17 +8,17 @@ A TypeScript SDK for seamless cross-origin communication between parent and chil
|
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
# Add as workspace dependency
|
|
11
|
-
pnpm add @
|
|
11
|
+
pnpm add @worthai/onboarding-sdk@workspace:*
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
### External projects
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
17
|
# Using npm
|
|
18
|
-
npm install @
|
|
18
|
+
npm install @worthai/onboarding-sdk
|
|
19
19
|
|
|
20
20
|
# Using pnpm
|
|
21
|
-
pnpm install @
|
|
21
|
+
pnpm install @worthai/onboarding-sdk
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
## 🛠️ API Reference
|
|
@@ -32,7 +32,7 @@ Creates an onboarding app instance for parent-to-child communication with type-s
|
|
|
32
32
|
> **Note**: The following example is illustrative code for vanilla TypeScript. Adapt to your framework's patterns when using React or other JavaScript frameworks.
|
|
33
33
|
|
|
34
34
|
```typescript
|
|
35
|
-
import { createOnboardingApp } from '@
|
|
35
|
+
import { createOnboardingApp } from '@worthai/onboarding-sdk';
|
|
36
36
|
|
|
37
37
|
// Create an onboarding app instance and communicate with it
|
|
38
38
|
const onboardingApp = createOnboardingApp({
|
|
@@ -80,7 +80,7 @@ Creates an onboarding consumer app instance for child-to-parent communication wi
|
|
|
80
80
|
> **Note**: The following example is illustrative code for vanilla TypeScript. Adapt to your framework's patterns when using React or other JavaScript frameworks.
|
|
81
81
|
|
|
82
82
|
```typescript
|
|
83
|
-
import { createOnboardingConsumerApp } from '@
|
|
83
|
+
import { createOnboardingConsumerApp } from '@worthai/onboarding-sdk';
|
|
84
84
|
|
|
85
85
|
// Create an onboarding consumer app instance for child-to-parent communication
|
|
86
86
|
const consumerApp = createOnboardingConsumerApp({
|
|
@@ -137,7 +137,7 @@ const subscription = consumerApp.subscribe((event) => {
|
|
|
137
137
|
### Parent Site Implementation
|
|
138
138
|
|
|
139
139
|
```typescript
|
|
140
|
-
import { createOnboardingApp } from '@
|
|
140
|
+
import { createOnboardingApp } from '@worthai/onboarding-sdk';
|
|
141
141
|
|
|
142
142
|
// Initialize the onboarding app
|
|
143
143
|
const onboardingApp = createOnboardingApp({
|
|
@@ -169,7 +169,7 @@ onboardingApp.prev();
|
|
|
169
169
|
### Child Site Implementation
|
|
170
170
|
|
|
171
171
|
```typescript
|
|
172
|
-
import { createOnboardingConsumerApp } from '@
|
|
172
|
+
import { createOnboardingConsumerApp } from '@worthai/onboarding-sdk';
|
|
173
173
|
|
|
174
174
|
// Initialize the consumer app
|
|
175
175
|
const consumerApp = createOnboardingConsumerApp({
|
|
@@ -200,7 +200,7 @@ The SDK allows parent sites to inject custom CSS styles into the child iframe. T
|
|
|
200
200
|
#### Parent Site: Sending Custom CSS
|
|
201
201
|
|
|
202
202
|
```typescript
|
|
203
|
-
import { createOnboardingApp } from '@
|
|
203
|
+
import { createOnboardingApp } from '@worthai/onboarding-sdk';
|
|
204
204
|
|
|
205
205
|
const onboardingApp = createOnboardingApp({
|
|
206
206
|
origin: 'https://onboarding.example.com',
|
|
@@ -227,7 +227,7 @@ onboardingApp.postMessage({
|
|
|
227
227
|
#### Child Site: Receiving and Applying Custom CSS
|
|
228
228
|
|
|
229
229
|
```typescript
|
|
230
|
-
import { createOnboardingConsumerApp } from '@
|
|
230
|
+
import { createOnboardingConsumerApp } from '@worthai/onboarding-sdk';
|
|
231
231
|
|
|
232
232
|
const consumerApp = createOnboardingConsumerApp({
|
|
233
233
|
allowedOrigins: ['https://parent.example.com'],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@worthai/onboarding-sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"source": "./src",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -15,14 +15,21 @@
|
|
|
15
15
|
"import": "./dist/index.js"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/joinworth/onboarding-sdk-poc"
|
|
21
|
+
},
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"registry": "https://registry.npmjs.org",
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
18
26
|
"scripts": {
|
|
19
27
|
"dev": "vite",
|
|
20
28
|
"build": "vite build",
|
|
21
29
|
"preview": "vite preview",
|
|
22
30
|
"storybook": "storybook dev -p 6006",
|
|
23
31
|
"build-storybook": "storybook build",
|
|
24
|
-
"bump-patch-version": "npm version patch -m 'chore: bump patch version to %s'"
|
|
25
|
-
"publish-to-github": "npm publish --access public"
|
|
32
|
+
"bump-patch-version": "npm version patch -m 'chore: bump patch version to %s'"
|
|
26
33
|
},
|
|
27
34
|
"devDependencies": {
|
|
28
35
|
"@storybook/addon-docs": "^9.1.10",
|