@myop/sdk 0.2.3 → 0.2.5

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.
Files changed (37) hide show
  1. package/README.md +368 -208
  2. package/dist/bundled-declarations.d.ts +27 -200
  3. package/dist/cjs/{_IframeSDK.c7f71dba.js → _IframeSDK.69b595c4.js} +45 -31
  4. package/dist/cjs/{_IframeSDK.c7f71dba.js.map → _IframeSDK.69b595c4.js.map} +3 -3
  5. package/dist/cjs/{_IframeSDK.012474c1.min.js → _IframeSDK.845b6f30.min.js} +1 -1
  6. package/dist/cjs/_MyopHelpers.3d50ac48.min.js +1 -0
  7. package/dist/cjs/_MyopHelpers.7baba8b8.js +462 -0
  8. package/dist/cjs/_MyopHelpers.7baba8b8.js.map +7 -0
  9. package/dist/cjs/{_WebComponentSDK.93d3959a.js → _WebComponentSDK.38d1c6e7.js} +45 -31
  10. package/dist/cjs/{_WebComponentSDK.93d3959a.js.map → _WebComponentSDK.38d1c6e7.js.map} +3 -3
  11. package/dist/cjs/{_WebComponentSDK.15ffefb6.min.js → _WebComponentSDK.a9eff853.min.js} +1 -1
  12. package/dist/cjs/{_hostSDK.eeb98d7f.js → _hostSDK.083b3333.js} +45 -31
  13. package/dist/cjs/{_hostSDK.eeb98d7f.js.map → _hostSDK.083b3333.js.map} +3 -3
  14. package/dist/cjs/{_hostSDK.a852b7b7.min.js → _hostSDK.2a26ea6c.min.js} +1 -1
  15. package/dist/cjs/myop_sdk.js +14 -14
  16. package/dist/cjs/myop_sdk.js.map +1 -1
  17. package/dist/cjs/myop_sdk.min.js +1 -1
  18. package/dist/cjs-bundled/myop_sdk.bundled.js +3947 -0
  19. package/dist/cjs-bundled/myop_sdk.bundled.js.map +7 -0
  20. package/dist/cjs-bundled/myop_sdk.bundled.min.js +1 -0
  21. package/dist/module/Iframe/index.js +49 -33
  22. package/dist/module/Iframe/index.js.map +3 -3
  23. package/dist/module/SDK.js +52 -120
  24. package/dist/module/SDK.js.map +3 -3
  25. package/dist/module/helpers/CloudRepository.d.ts +27 -185
  26. package/dist/module/helpers/index.d.ts +0 -1
  27. package/dist/module/helpers/index.js +52 -2521
  28. package/dist/module/helpers/index.js.map +4 -4
  29. package/dist/module/host/index.js +49 -33
  30. package/dist/module/host/index.js.map +3 -3
  31. package/dist/module/webcomponent/index.js +49 -33
  32. package/dist/module/webcomponent/index.js.map +3 -3
  33. package/package.json +1 -1
  34. package/dist/cjs/_MyopHelpers.75e0fd8d.js +0 -2810
  35. package/dist/cjs/_MyopHelpers.75e0fd8d.js.map +0 -7
  36. package/dist/cjs/_MyopHelpers.ecfd80d9.min.js +0 -1
  37. package/dist/module/helpers/enableV2.d.ts +0 -12
package/README.md CHANGED
@@ -1,288 +1,448 @@
1
- # Myop SDKs
2
- # Enhance Your UI Management with Real-Time Flexibility
3
-
4
- ## **Next-Level UI/UX Management with Myop SDKs**
5
- Myop offers an open-source set of SDKs designed to connect your application
6
- logic with dynamically chosen user interfaces.
7
- It simplifies experimenting with UI/UX changes without deployments or direct
8
- involvement from your host application.
9
- It allows developers to refactor the look and feel of any component without
10
- disrupting its core functionalities like data fetching, state or event handling
11
- while maintaining typed communication between components and the host application,
12
- just like any local component you have today.
13
-
14
- ## **Table of Contents**
15
- 1. [Root SDK](#root-sdk)
16
- 2. [Host SDK](#host-sdk)
17
- 3. [Iframe SDK](#iframe-sdk)
18
- 4. [WebComponent SDK](#webcomponent-sdk)
19
- 5. [Framework Integrations](#framework-integrations)
20
- - [React](#react)
21
- - [Angular](#angular)
22
- - [Vue.js](#vuejs)
23
- 6. [Key Features of Myop SDKs](#key-features-of-myop-sdks)
24
- 7. [Why Choose Myop SDKs?](#why-choose-myop-sdks)
25
- 8. [Get Started with Myop SDKs Today!](#get-started-with-myop-sdks-today)
26
- 9. [Related Resources](#related-resources)
1
+ <p align="center">
2
+ <a href="https://myop.dev">
3
+ <img src="https://docs.myop.dev/img/logo.svg" alt="Myop Logo" width="200" />
4
+ </a>
5
+ </p>
6
+
7
+ <h1 align="center">Myop SDK</h1>
8
+
9
+ <p align="center">
10
+ <strong>Dynamic UI component management for modern web applications</strong>
11
+ </p>
12
+
13
+ <p align="center">
14
+ <a href="https://www.npmjs.com/package/@myop/sdk"><img src="https://img.shields.io/npm/v/@myop/sdk.svg?style=flat-square" alt="npm version"></a>
15
+ <a href="https://www.npmjs.com/package/@myop/sdk"><img src="https://img.shields.io/npm/dm/@myop/sdk.svg?style=flat-square" alt="npm downloads"></a>
16
+ <a href="https://myop.dev/discord"><img src="https://img.shields.io/badge/Discord-Join%20Us-7289da?style=flat-square&logo=discord&logoColor=white" alt="Discord"></a>
17
+ </p>
18
+
19
+ <p align="center">
20
+ <a href="https://docs.myop.dev">Documentation</a> |
21
+ <a href="https://myop.dev">Website</a> |
22
+ <a href="https://myop.dev/discord">Discord</a>
23
+ </p>
27
24
 
28
25
  ---
29
26
 
30
- ## **Root SDK - The Core of Your Application Integration**
31
- The **Root SDK** is the starting point for using Myop’s powerful UI components. It enables you to dynamically load, control, and interact with Myop components inside your web application, offering full control over UI modifications with minimal setup.
27
+ ## What is Myop?
32
28
 
33
- ### **Installation - How to Integrate the Root SDK**
34
- You can load the Root SDK into your application in one of two ways:
29
+ Myop is an open-source SDK that enables **real-time UI modifications without deployments**. It bridges your application logic with dynamically swappable user interfaces, allowing developers to:
30
+
31
+ - Experiment with UI/UX changes instantly
32
+ - Refactor component appearance without touching core functionality
33
+ - Maintain typed communication between components and host applications
34
+ - Load and manage UI components dynamically at runtime
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ npm install @myop/sdk
40
+ ```
41
+
42
+ Or via CDN:
35
43
 
36
- 1. **Via CDN (Script Tag):**
37
44
  ```html
38
45
  <script src="https://cdn.myop.dev/sdk/next/myop_sdk.min.js"></script>
39
- <script>
40
- // Initialize the SDK
41
- const { hostSDK } = await window.myop.rootSDK.getHostModule();
42
- const { MyopMessages } = await window.myop.rootSDK.getMyopMessages();
43
- </script>
44
46
  ```
45
- 2 **Via NPM (Import into TypeScript/JavaScript Application):**
46
47
 
48
+ ## Quick Start
47
49
 
48
- ```ts
50
+ ### Using npm/ESM
51
+
52
+ ```typescript
49
53
  import { getHostModule } from '@myop/sdk';
50
54
 
55
+ // Initialize the SDK
51
56
  const { hostSDK } = await getHostModule();
52
- ```
57
+ hostSDK.init();
53
58
 
54
- Initialization and Component Loading
55
- Once the SDK is loaded, you can initialize the hostSDK and start interacting with components.
59
+ // Load a component
60
+ const component = await hostSDK.loadComponent(componentConfig, containerElement);
61
+ await component.initiated();
62
+ ```
56
63
 
57
- ```js
58
- // Initialize hostSDK instance
59
- hostSDK.init();
64
+ ### Using CDN
60
65
 
61
- // Load Myop components into your app dynamically
62
- let myopComponent1 = await hostSDK.loadComponent(config.components['myExternalComponent1'], appDiv);
63
- await myopComponent1.initiated();
66
+ ```html
67
+ <script src="https://cdn.myop.dev/sdk/next/myop_sdk.min.js"></script>
68
+ <script>
69
+ const { hostSDK } = await window.myop.rootSDK.getHostModule();
70
+ hostSDK.init();
64
71
 
65
- // Send messages or modify UI components
66
- const appTitleSelector = new MyopMessages.MyopElementSelector('myAppTitle');
67
- myopComponent1.send(new MyopMessages.ChangeTextMessage(appTitleSelector, `Myop - WebComponents`));
72
+ const component = await hostSDK.loadComponent(config, document.getElementById('app'));
73
+ await component.initiated();
74
+ </script>
68
75
  ```
69
- Host SDK - Integrate Myop Components into Your App
70
- The Host SDK is designed for applications that act as containers for Myop components. It provides core functionalities for embedding and managing Myop components within your web app, enabling smooth communication and integration.
71
76
 
72
- With the Host SDK, you can:
77
+ ## Architecture
73
78
 
74
- Dynamically register, load, and control Myop components.
75
- Ensure seamless integration and maintain consistent UX across multiple components.
76
- Communicate with the embedded Myop components using event-driven APIs.
77
- ### 📕 Host SDK Documentation
78
- Explore the full documentation for the Host SDK to unlock the full potential of Myop's component-based UI management.
79
+ The Myop SDK is modular, consisting of several specialized packages:
79
80
 
80
- Iframe SDK - Isolation with Seamless Communication
81
- The Iframe SDK is perfect for integrating Myop components into isolated environments such as iframes. It provides tools and utilities for secure communication between the host app and the Myop components running inside iframes.
81
+ | Module | Description | Import |
82
+ |--------|-------------|--------|
83
+ | **Host SDK** | Core module for embedding and managing Myop components | `@myop/sdk` or `@myop/sdk/host` |
84
+ | **Iframe SDK** | Secure isolation for components in iframes | `@myop/sdk/iframe` |
85
+ | **WebComponent SDK** | Support for self-contained web components | `@myop/sdk/webcomponent` |
86
+ | **Messages** | Type-safe communication between host and components | `@myop/sdk/messages` |
87
+ | **Helpers** | Utility functions and configuration builders | `@myop/sdk/helpers` |
82
88
 
83
- Using the Iframe SDK, developers can:
89
+ ## Framework Integration
84
90
 
85
- Achieve secure isolation for Myop components while retaining communication with the host application.
86
- Benefit from the overall structure and management capabilities of the host app, without sacrificing security or performance.
87
- Easily load and manage iframe-based components within your web app.
88
- How to Load the Iframe SDK
89
- You can load the Iframe SDK after loading the Root SDK in two simple steps:
91
+ Myop provides official framework packages for seamless integration:
90
92
 
91
- Via Script Tag:
92
- ```js
93
- const { IframeSDK } = await window.myop.rootSDK.getIframeModule();
94
- ```
93
+ | Package | Install |
94
+ |---------|---------|
95
+ | React | `npm install @myop/react` |
96
+ | Vue.js | `npm install @myop/vue` |
97
+ | Angular | `npm install @myop/angular` |
95
98
 
96
- Via NPM (Import into TypeScript/JavaScript Application):
99
+ <details>
100
+ <summary><strong>React</strong></summary>
97
101
 
98
- ```ts
99
- import { getIframeModule } from '@myop/sdk';
100
- const { IframeSDK } = await getIframeModule();
102
+ ```bash
103
+ npm install @myop/react
101
104
  ```
102
105
 
103
- ### 📕 Iframe SDK Documentation
104
- For a deep dive into the Iframe SDK’s capabilities and usage, refer to the detailed documentation.
106
+ ```tsx
107
+ import { MyopComponent } from '@myop/react';
108
+
109
+ function App() {
110
+ return (
111
+ <MyopComponent
112
+ componentId="your-component-id"
113
+ environment="production"
114
+ data={{ user: 'John' }}
115
+ onLoad={(component) => console.log('Component loaded', component)}
116
+ onError={(error) => console.error('Error:', error)}
117
+ on={(action, payload) => {
118
+ // Handle CTA actions from the component
119
+ console.log('Action:', action, payload);
120
+ }}
121
+ loader={<div>Loading...</div>}
122
+ fallback={<div>Failed to load</div>}
123
+ />
124
+ );
125
+ }
126
+ ```
105
127
 
106
- WebComponent SDK - Embedding Reusable Web Components
107
- The WebComponent SDK is built to support the use of Myop components packaged as self-contained web components. It simplifies lifecycle management, event handling, and communication, ensuring smooth integration with the host application.
128
+ **Props:**
108
129
 
109
- With this SDK, developers can:
130
+ | Prop | Type | Description |
131
+ |------|------|-------------|
132
+ | `componentId` | `string` | Component ID from Myop Cloud |
133
+ | `environment` | `string` | Environment identifier (default: `"production"`) |
134
+ | `data` | `any` | Data passed to `myop_init_interface` |
135
+ | `onLoad` | `(component) => void` | Called when component loads |
136
+ | `onError` | `(error) => void` | Called on error |
137
+ | `on` | `(action, payload) => void` | Handler for `myop_cta_handler` calls |
138
+ | `loader` | `ReactNode` | Custom loading indicator |
139
+ | `fallback` | `ReactNode` | Custom error fallback |
140
+ | `fadeDuration` | `number` | Loader fade duration in ms |
110
141
 
111
- Create modular, reusable web components that can be used across various applications.
112
- Benefit from lifecycle management tools to handle component states, initialization, and teardown.
113
- Enable communication between the host application and the web components for dynamic, real-time changes.
114
- How to Load the WebComponent SDK
115
- Once the Root SDK is loaded, you can seamlessly load the WebComponent SDK:
142
+ **Preloading:**
116
143
 
117
- Via Script Tag:
118
- ```js
119
- const { WebComponentSDK } = await window.myop.rootSDK.getWebcomponentModule();
120
- ```
144
+ ```tsx
145
+ import { preload, isPreloaded } from '@myop/react';
121
146
 
122
- Via NPM (Import into TypeScript/JavaScript Application):
147
+ // Preload components for faster rendering
148
+ await preload(['component-1', 'component-2'], 'production');
123
149
 
124
- ```ts
125
- import { getWebcomponentModule } from '@myop/sdk';
126
- const { WebComponentSDK } = await getWebcomponentModule();
150
+ // Check if already loaded
151
+ if (isPreloaded('component-1')) {
152
+ // Component will render instantly
153
+ }
127
154
  ```
128
155
 
129
- ### 📕 WebComponent SDK Documentation
130
- Learn more about the WebComponent SDK and how it can enhance your application development in the full documentation.
156
+ **Local Development:**
131
157
 
132
- Framework Integrations
133
- Myop SDKs can be seamlessly integrated with popular frontend frameworks like React, Angular, and Vue.js. This section provides detailed instructions for integrating Myop SDKs with these frameworks to help you get started faster.
158
+ ```tsx
159
+ import { enableLocalDev } from '@myop/react';
134
160
 
135
- React Integration
136
- To use Myop with React, follow these steps:
161
+ // Point to local server
162
+ enableLocalDev();
163
+ ```
164
+
165
+ </details>
137
166
 
138
- Install the Myop SDK via npm:
167
+ <details>
168
+ <summary><strong>Vue.js</strong></summary>
139
169
 
140
170
  ```bash
141
- npm install @myop/sdk
171
+ npm install @myop/vue
142
172
  ```
143
- Create a React Component that Loads Myop Components:
144
-
145
- ```jsx
146
- import React, { useEffect, useRef } from 'react';
147
- import { getHostModule } from '@myop/sdk';
148
173
 
149
- const MyopComponent = () => {
150
- const containerRef = useRef(null);
174
+ ```vue
175
+ <template>
176
+ <MyopContainer
177
+ :componentId="componentId"
178
+ :flowId="flowId"
179
+ @ready="onReady"
180
+ v-bind="$attrs"
181
+ >
182
+ <template #loading>
183
+ <div>Loading...</div>
184
+ </template>
185
+ </MyopContainer>
186
+ </template>
151
187
 
152
- useEffect(() => {
153
- const loadMyopComponent = async () => {
154
- const { hostSDK } = await getHostModule();
155
- const myopComponent = await hostSDK.loadComponent(config.components['myExternalComponent1'], containerRef.current);
156
- await myopComponent.initiated();
157
- };
188
+ <script setup lang="ts">
189
+ import { MyopContainer } from '@myop/vue';
190
+ import type { IMyopComponent } from '@myop/sdk/host';
158
191
 
159
- loadMyopComponent();
160
- }, []);
192
+ const componentId = 'your-component-id';
193
+ const flowId = 'optional-flow-id';
161
194
 
162
- return <div ref={containerRef}></div>;
195
+ const onReady = (component: IMyopComponent, innerRef?: any) => {
196
+ console.log('Component loaded', component);
163
197
  };
164
-
165
- export default MyopComponent;
198
+ </script>
166
199
  ```
167
200
 
168
- Use the React Component:
201
+ **Props:**
169
202
 
170
- ```jsx
171
- import React from 'react';
172
- import MyopComponent from './MyopComponent';
203
+ | Prop | Type | Description |
204
+ |------|------|-------------|
205
+ | `componentId` | `string` | Component ID from Myop Cloud |
206
+ | `flowId` | `string?` | Optional flow ID |
207
+ | `onReady` | `(component, innerRef?) => void` | Called when component loads |
173
208
 
174
- const App = () => {
175
- return (
176
- <div>
177
- <h1>Myop + React</h1>
178
- <MyopComponent />
179
- </div>
180
- );
181
- };
209
+ **Slots:**
182
210
 
183
- export default App;
184
- ```
211
+ | Slot | Description |
212
+ |------|-------------|
213
+ | `loading` | Shown while component loads |
185
214
 
186
- Angular Integration
187
- For Angular applications, you can integrate Myop SDKs by following these steps:
215
+ </details>
188
216
 
189
- Install Myop SDK via npm:
217
+ <details>
218
+ <summary><strong>Angular</strong></summary>
190
219
 
191
220
  ```bash
192
- npm install @myop/sdk
221
+ npm install @myop/angular
193
222
  ```
194
223
 
195
- Import and Use Myop SDK in Angular Component:
196
-
197
- ```ts
198
- import { Component, OnInit, ElementRef } from '@angular/core';
199
- import { getHostModule } from '@myop/sdk';
224
+ ```typescript
225
+ import { Component } from '@angular/core';
226
+ import { MyopContainerComponent } from '@myop/angular';
227
+ import type { IMyopComponent } from '@myop/sdk/host';
200
228
 
201
229
  @Component({
202
- selector: 'app-myop',
203
- template: `<div #container></div>`,
230
+ selector: 'app-root',
231
+ standalone: true,
232
+ imports: [MyopContainerComponent],
233
+ template: `
234
+ <myop-container
235
+ [componentId]="componentId"
236
+ [flowId]="flowId"
237
+ [inputs]="inputs"
238
+ (componentReady)="onComponentReady($event)"
239
+ >
240
+ <!-- Content shown while loading -->
241
+ <div>Loading...</div>
242
+ </myop-container>
243
+ `
204
244
  })
205
- export class MyopComponent implements OnInit {
206
- constructor(private el: ElementRef) {}
207
-
208
- async ngOnInit() {
209
- const { hostSDK } = await getHostModule();
210
- const myopComponent = await hostSDK.loadComponent(config.components['myExternalComponent1'], this.el.nativeElement);
211
- await myopComponent.initiated();
212
- }
245
+ export class AppComponent {
246
+ componentId = 'your-component-id';
247
+ flowId?: string;
248
+ inputs = { theme: 'dark' };
249
+
250
+ onComponentReady(component: IMyopComponent) {
251
+ console.log('Component loaded', component);
252
+ }
213
253
  }
214
254
  ```
215
- Add the Component in the Template:
255
+
256
+ **Inputs:**
257
+
258
+ | Input | Type | Description |
259
+ |-------|------|-------------|
260
+ | `componentId` | `string` | Component ID from Myop Cloud |
261
+ | `flowId` | `string?` | Optional flow ID |
262
+ | `inputs` | `object` | Data passed to the component |
263
+
264
+ **Outputs:**
265
+
266
+ | Output | Type | Description |
267
+ |--------|------|-------------|
268
+ | `componentReady` | `IMyopComponent` | Emitted when component loads |
269
+
270
+ </details>
271
+
272
+ <details>
273
+ <summary><strong>Vanilla JavaScript / CDN</strong></summary>
216
274
 
217
275
  ```html
218
- <app-myop></app-myop>
219
- ```
276
+ <div id="myop-container"></div>
220
277
 
221
- Vue.js Integration
222
- Vue.js developers can integrate Myop SDKs with ease by following these steps:
223
- Install the Myop SDK:
278
+ <script src="https://cdn.myop.dev/sdk/next/myop_sdk.min.js"></script>
279
+ <script>
280
+ async function init() {
281
+ const { hostSDK } = await window.myop.rootSDK.getHostModule();
282
+ const { CloudRepository } = await window.myop.rootSDK.getMyopHelpers();
224
283
 
225
- ```bash
226
- npm install @myop/sdk
284
+ const container = document.getElementById('myop-container');
285
+
286
+ // ============ V1: User Flows ============
287
+ // Fetch from auto-generated flow
288
+ const configV1 = await CloudRepository.Main.fetchComponentV1('component-id');
289
+ await hostSDK.loadComponent(configV1, container);
290
+
291
+ // Or fetch from a specific flow
292
+ const configFromFlow = await CloudRepository.Main.fetchComponentV1('component-id', 'flow-id');
293
+
294
+ // ============ V2: Direct Variant Loading ============
295
+ // Fetch variant directly by component ID and environment
296
+ const variantV2 = await CloudRepository.Main.fetchComponentV2('component-id', 'production');
297
+ await hostSDK.loadComponent(variantV2, container);
298
+ }
299
+
300
+ init();
301
+ </script>
227
302
  ```
228
303
 
229
- Create a Vue Component that Loads Myop Components:
304
+ </details>
230
305
 
231
- ```vue
232
- <template>
233
- <div ref="container"></div>
234
- </template>
306
+ ## API Reference
235
307
 
236
- <script>
308
+ ### CloudRepository
309
+
310
+ Fetch component configurations from Myop Cloud:
311
+
312
+ ```typescript
313
+ import { CloudRepository } from '@myop/sdk/helpers';
314
+
315
+ // Fetch a component (v1 - from user flows)
316
+ const componentConfig = await CloudRepository.Main.fetchComponent('component-id');
317
+
318
+ // Fetch a component from a specific flow
319
+ const componentConfig = await CloudRepository.Main.fetchComponent('component-id', 'flow-id');
320
+
321
+ // Fetch a v2 component variant
322
+ const variantConfig = await CloudRepository.Main.fetchComponentV2('component-id', 'environment');
323
+
324
+ // Fetch a complete user flow
325
+ const flow = await CloudRepository.Main.fetchFlow('flow-id');
326
+
327
+ // Check if a component is preloaded
328
+ const isLoaded = CloudRepository.Main.isPreloaded('component-id');
329
+ ```
330
+
331
+ ### Host SDK
332
+
333
+ ```typescript
237
334
  import { getHostModule } from '@myop/sdk';
238
335
 
239
- export default {
240
- name: 'MyopComponent',
241
- mounted() {
242
- const loadMyopComponent = async () => {
243
- const { hostSDK } = await getHostModule();
244
- const myopComponent = await hostSDK.loadComponent(config.components['myExternalComponent1'], this.$refs.container);
245
- await myopComponent.initiated();
246
- };
247
-
248
- loadMyopComponent();
249
- },
250
- };
251
- </script>
336
+ const { hostSDK } = await getHostModule();
337
+
338
+ // Load a component into a container
339
+ const component = await hostSDK.loadComponent(componentConfig, containerElement);
340
+
341
+ // Load with options
342
+ const component = await hostSDK.loadComponent(componentConfig, container, {
343
+ hidden: false, // Start hidden
344
+ connectProps: true, // Auto-connect props (default: true)
345
+ timeout: 5000, // Initialization timeout
346
+ hooks: { // Lifecycle hooks
347
+ afterSkinSelected: async (skin) => skin
348
+ }
349
+ });
350
+
351
+ // Navigate to a different component
352
+ const newComponent = await hostSDK.navigate(currentComponent, newConfig, {
353
+ staged: true, // Load new component before disposing old one
354
+ });
355
+
356
+ // Send messages to component
357
+ component.send(message);
358
+
359
+ // Dispose component
360
+ component.dispose();
252
361
  ```
253
362
 
254
- Use the Vue Component:
363
+ ### ComponentConfig Builder
255
364
 
256
- ```vue
257
- <template>
258
- <MyopComponent />
259
- </template>
365
+ Build component configurations programmatically:
366
+
367
+ ```typescript
368
+ import { ComponentConfig, SkinConfig } from '@myop/sdk/helpers';
369
+
370
+ const skin = SkinConfig.create()
371
+ .withHTMLLoader({
372
+ HTML: '<div>My Component</div>',
373
+ shadowRootMode: 'open'
374
+ })
375
+ .build();
376
+
377
+ const config = ComponentConfig.create()
378
+ .withName('my-component')
379
+ .withDefaultSkin(skin)
380
+ .withBasicRef('header')
381
+ .withBasicRef('content')
382
+ .build();
383
+ ```
384
+
385
+ ### Iframe SDK
386
+
387
+ For components running inside iframes:
388
+
389
+ ```typescript
390
+ import { getIframeModule } from '@myop/sdk';
391
+
392
+ const { IframeSDK } = await getIframeModule();
260
393
  ```
261
394
 
262
- ### Key Features of Myop SDKs
263
- - Real-time UI Modifications
264
- - Modify your application's UI dynamically without requiring redeployment or backend changes.
265
- - Seamless Integration
266
- - Easily integrate Myop components into any web application, whether in an iframe or as standalone web components.
267
- - Component Flexibility
268
- - Load and use Myop components based on your app’s requirements and communication needs.
269
- - Independent Lifecycle Management
270
- - Manage the lifecycle of each component independently, ensuring optimal performance and reusability.
271
- ### Why Choose Myop SDKs?
272
- Myop offers a powerful, flexible approach to managing your web application’s UI/UX, making it easier to:
273
-
274
- - Scale your application with minimal friction.
275
- - Empower front-end developers to manage UI changes independently.
276
- - Build modular and reusable components that can be dynamically loaded based on real-time conditions.
277
- - With comprehensive documentation and support for various use cases, Myop SDKs provide a future-proof solution for modern web development.
278
-
279
- ### Get Started with Myop SDKs Today!
280
- Take your web app to the next level with Myop SDKs. Whether you’re looking to integrate dynamic UI components, manage separate iframe-based applications, or work with modular web components, Myop has you covered.
281
-
282
- For more information, examples, and detailed documentation, check out the links to each SDK section above.
283
-
284
- Related Resources:
395
+ ### WebComponent SDK
396
+
397
+ For self-contained web components:
398
+
399
+ ```typescript
400
+ import { getWebcomponentModule } from '@myop/sdk';
401
+
402
+ const { WebComponentSDK } = await getWebcomponentModule();
403
+ ```
404
+
405
+ ## Documentation
406
+
407
+ For comprehensive documentation, guides, and examples, visit **[docs.myop.dev](https://docs.myop.dev)**.
408
+
409
+ - [Getting Started Guide](https://docs.myop.dev/getting-started)
410
+ - [Host SDK Reference](https://docs.myop.dev/host-sdk)
411
+ - [Iframe SDK Reference](https://docs.myop.dev/iframe-sdk)
412
+ - [WebComponent SDK Reference](https://docs.myop.dev/webcomponent-sdk)
413
+ - [Message API Reference](https://docs.myop.dev/messages)
414
+
415
+ ## Development
416
+
417
+ ```bash
418
+ # Install dependencies
419
+ npm install
420
+
421
+ # Start development server
422
+ npm run dev
423
+
424
+ # Run tests
425
+ npm test
426
+
427
+ # Build for production
428
+ npm run build
429
+
430
+ # Generate documentation
431
+ npm run build:docs
432
+ ```
433
+
434
+ ## Related Resources
435
+
285
436
  - [Read more about Myop](https://myop.dev)
286
437
  - [Myop Documentation](https://docs.myop.dev)
287
- - [Join Myop on GitHub](https://github.com/myopjs)
288
- - [Discord Community & Support Forum](https://discord.com/invite/wTwZn3fq)
438
+ - [Discord Community](https://myop.dev/discord)
439
+
440
+ ## License
441
+
442
+ This project is licensed under the [MIT License](LICENSE).
443
+
444
+ ---
445
+
446
+ <p align="center">
447
+ Made with care by the <a href="https://myop.dev">Myop</a> team
448
+ </p>