@soyio/soyio-widget 0.0.1 → 0.0.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.
package/README.md CHANGED
@@ -1,2 +1,33 @@
1
1
  # soy-io-widget
2
- This is the library for include a soyio widget
2
+ This is the library for include a soyio widget.
3
+
4
+ This library contemplate that an iframe with the ID: soyio-widget-iframe should be created before instantiate the widget.
5
+
6
+ ## How to work
7
+
8
+ For frontend frameworks, this should be imported as follows.
9
+
10
+ ``` VUE
11
+ <script>
12
+ import Widget from '@soyio/soyio-widget'
13
+
14
+ // Vue syntax
15
+ onMounted(() => {
16
+ const widget = new Widget()
17
+ })
18
+ </script>
19
+ <template>
20
+ <iframe id="soyio-widget-iframe"></iframe>
21
+ </template>
22
+
23
+ ```
24
+
25
+ The widget class receive the following object:
26
+
27
+ ```JS
28
+ {
29
+ userEmail?: string
30
+ }
31
+ ```
32
+
33
+ And if there is an email this is sended to the iframe.
@@ -1,2 +1,2 @@
1
1
  export declare const IFRAME_ID = "soyio-widget-iframe";
2
- export declare const DEVELOPMENT_WIDGET_URL = "https://pl-soyio-staging-7a391ba45b99.herokuapp.com";
2
+ export declare const DEVELOPMENT_WIDGET_URL = "https://pl-soyio-staging-7a391ba45b99.herokuapp.com/widget";
@@ -0,0 +1,3 @@
1
+ declare function setReady(iframe: HTMLIFrameElement): void;
2
+ declare function configUser(iframe: HTMLIFrameElement, userEmail: string): void;
3
+ export { setReady, configUser };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,10 @@
1
- declare const soyioWidget: {
2
- create(): HTMLIFrameElement;
3
- };
4
- export default soyioWidget;
1
+ interface WidgetProps {
2
+ userEmail?: string;
3
+ }
4
+ declare class Widget {
5
+ private iframe;
6
+ userEmail?: string;
7
+ constructor({ userEmail }: WidgetProps);
8
+ initialize(): void;
9
+ }
10
+ export default Widget;