@eka-care/medassist-widget-embed 0.0.6 → 0.0.7
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/dist/iframe-helper.d.ts.map +1 -1
- package/dist/iframe-helper.js +1 -15
- package/iframe-helper.ts +1 -16
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframe-helper.d.ts","sourceRoot":"","sources":["../iframe-helper.ts"],"names":[],"mappings":"AAGA,KAAK,iBAAiB,GAAG,YAAY,GAAG,aAAa,GAAG,SAAS,CAAC;AAElE,UAAU,iBAAiB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;
|
|
1
|
+
{"version":3,"file":"iframe-helper.d.ts","sourceRoot":"","sources":["../iframe-helper.ts"],"names":[],"mappings":"AAGA,KAAK,iBAAiB,GAAG,YAAY,GAAG,aAAa,GAAG,SAAS,CAAC;AAElE,UAAU,iBAAiB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAuBD,eAAO,MAAM,mBAAmB,GAAI,SAAS,iBAAiB,KAAG,IAmEhE,CAAC"}
|
package/dist/iframe-helper.js
CHANGED
|
@@ -14,21 +14,7 @@ const getCurrentScript = () => {
|
|
|
14
14
|
return scripts.length ? scripts[scripts.length - 1] : null;
|
|
15
15
|
};
|
|
16
16
|
const getIframeBaseUrl = (customUrl) => {
|
|
17
|
-
|
|
18
|
-
return customUrl.endsWith("/") ? customUrl : `${customUrl}/`;
|
|
19
|
-
}
|
|
20
|
-
const scriptEl = getCurrentScript();
|
|
21
|
-
if (!scriptEl) {
|
|
22
|
-
return DEFAULT_IFRAME_BASE;
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
const scriptUrl = scriptEl.src || window.location.href;
|
|
26
|
-
const baseUrl = new URL(".", scriptUrl).href;
|
|
27
|
-
return `${baseUrl}dist/`;
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
return DEFAULT_IFRAME_BASE;
|
|
31
|
-
}
|
|
17
|
+
return customUrl || DEFAULT_IFRAME_BASE;
|
|
32
18
|
};
|
|
33
19
|
export const openMedAssistIframe = (options) => {
|
|
34
20
|
const { agentId, title, iconUrl, environment, iframeBaseUrl } = options;
|
package/iframe-helper.ts
CHANGED
|
@@ -29,22 +29,7 @@ const getCurrentScript = (): HTMLScriptElement | null => {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
const getIframeBaseUrl = (customUrl?: string): string => {
|
|
32
|
-
|
|
33
|
-
return customUrl.endsWith("/") ? customUrl : `${customUrl}/`;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const scriptEl = getCurrentScript();
|
|
37
|
-
if (!scriptEl) {
|
|
38
|
-
return DEFAULT_IFRAME_BASE;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
try {
|
|
42
|
-
const scriptUrl = scriptEl.src || window.location.href;
|
|
43
|
-
const baseUrl = new URL(".", scriptUrl).href;
|
|
44
|
-
return `${baseUrl}dist/`;
|
|
45
|
-
} catch {
|
|
46
|
-
return DEFAULT_IFRAME_BASE;
|
|
47
|
-
}
|
|
32
|
+
return customUrl || DEFAULT_IFRAME_BASE;
|
|
48
33
|
};
|
|
49
34
|
|
|
50
35
|
export const openMedAssistIframe = (options: OpenIframeOptions): void => {
|