@agilie/sdk-template 1.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.
Files changed (2) hide show
  1. package/package.json +16 -0
  2. package/src/embed.js +21 -0
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@agilie/sdk-template",
3
+ "version": "1.0.2",
4
+ "main": "src/embed.js",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1"
7
+ },
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "keywords": [],
12
+ "author": "",
13
+ "license": "ISC",
14
+ "description": "",
15
+ "gitHead": "511240f12b5048dfff3bc6e0f1b002a7d916f94a"
16
+ }
package/src/embed.js ADDED
@@ -0,0 +1,21 @@
1
+ (function () {
2
+ const loadScript = (src) => {
3
+ return new Promise((resolve, reject) => {
4
+ const script = document.createElement('script');
5
+ script.src = src;
6
+ script.type = 'module';
7
+ script.onload = resolve;
8
+ script.onerror = reject;
9
+ document.head.appendChild(script);
10
+ });
11
+ };
12
+
13
+ window.YourSDK = {
14
+ init: async (options) => {
15
+ await loadScript('https://cdn.example.com/embed-widget/main.js'); // укажи свой путь
16
+ const el = document.createElement('your-widget');
17
+ el.setAttribute('data-config', JSON.stringify(options));
18
+ document.body.appendChild(el);
19
+ },
20
+ };
21
+ })();