@eka-care/medassist-widget-embed 0.1.8 → 0.1.9-dev.0

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/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  declare const getCurrentScript: () => HTMLScriptElement | null;
2
2
  type WidgetEnvironment = "production" | "development" | "staging";
3
3
  declare const getEnvironment: (value: string | null) => WidgetEnvironment | undefined;
4
- declare const DEFAULT_WIDGET_ASSET_BASE = "https://unpkg.com/@eka-care/medassist-widget@latest/dist/";
4
+ declare const scriptEl: HTMLScriptElement | null;
5
+ declare const DEFAULT_WIDGET_ASSET_BASE: string;
5
6
  type MedAssistInitConfig = {
6
7
  auth?: string;
7
8
  agentId?: string;
@@ -20,7 +21,6 @@ interface EkaMedAssistWindow extends Window {
20
21
  }
21
22
  declare const globalMedAssistConfig: MedAssistInitConfig;
22
23
  declare const getWidgetElement: () => HTMLElement | null;
23
- declare const scriptEl: HTMLScriptElement | null;
24
24
  declare const scriptBaseUrl: string;
25
25
  declare const widgetAssetBaseUrl: string;
26
26
  declare const WIDGET_JS_URL: string;
@@ -31,7 +31,6 @@ declare class MedAssistWidgetLoader extends HTMLElement {
31
31
  private defaultIconUrl;
32
32
  private widgetLoaded;
33
33
  private displayMode;
34
- private onClose?;
35
34
  constructor();
36
35
  static get observedAttributes(): string[];
37
36
  connectedCallback(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,gBAAgB,QAAO,iBAAiB,GAAG,IAahD,CAAC;AAEF,KAAK,iBAAiB,GAAG,YAAY,GAAG,aAAa,GAAG,SAAS,CAAC;AAElE,QAAA,MAAM,cAAc,GAClB,OAAO,MAAM,GAAG,IAAI,KACnB,iBAAiB,GAAG,SAStB,CAAC;AAEF,QAAA,MAAM,yBAAyB,8DAC8B,CAAC;AAE9D,KAAK,mBAAmB,GAAG;IAC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AgB,QAAO,WAAW,GAAG,IAK1C,CAAC;AA6BF,QAAA,MAAM,aAAa,QASf,CAAC;AAEL,QAAA,MAAM,kBAAkB,QAmBpB,CAAC;AAEL,QAAA,MAAM,aAAa,QAA6C,CAAC;AACjE,QAAA,MAAM,cAAc,QAA8C,CAAC;AAEnE,QAAA,IAAI,mBAAmB,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAW,CAAC;AACrD,QAAA,IAAI,oBAAoB,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,IAAW,CAAC;AAExD,cAAM,qBAAsB,SAAQ,WAAW;IAC7C,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,WAAW,CAAoB;;IAUvC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,iBAAiB,IAAI,IAAI;IAQzB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAmBrC,cAAc,IAAI,IAAI;IAe7B,YAAY,IAAI,IAAI;IAiEpB,kBAAkB,IAAI,IAAI;IA6BpB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IA0F9B,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IA4BpC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CA0ClC"}
package/dist/index.js CHANGED
@@ -19,7 +19,15 @@ const getEnvironment = (value) => {
19
19
  }
20
20
  return undefined;
21
21
  };
22
- const DEFAULT_WIDGET_ASSET_BASE = "https://unpkg.com/@eka-care/medassist-widget@latest/dist/";
22
+ const scriptEl = getCurrentScript();
23
+ // Detect version tag from script src (e.g., @dev, @latest)
24
+ const DEFAULT_WIDGET_ASSET_BASE = (() => {
25
+ var _a;
26
+ if ((_a = scriptEl === null || scriptEl === void 0 ? void 0 : scriptEl.src) === null || _a === void 0 ? void 0 : _a.includes("@dev")) {
27
+ return "https://unpkg.com/@eka-care/medassist-widget@dev/dist/";
28
+ }
29
+ return "https://unpkg.com/@eka-care/medassist-widget@latest/dist/";
30
+ })();
23
31
  const globalMedAssistConfig = {};
24
32
  const getWidgetElement = () => {
25
33
  if (typeof document === "undefined") {
@@ -57,7 +65,6 @@ if (typeof window !== "undefined") {
57
65
  },
58
66
  };
59
67
  }
60
- const scriptEl = getCurrentScript();
61
68
  const scriptBaseUrl = (() => {
62
69
  if (!scriptEl) {
63
70
  return "";
@@ -95,7 +102,7 @@ class MedAssistWidgetLoader extends HTMLElement {
95
102
  constructor() {
96
103
  super();
97
104
  this.attachShadow({ mode: "open" });
98
- this.defaultIconUrl = "./assets/bot-icon.svg";
105
+ this.defaultIconUrl = "https://cdn.eka.care/bot-icon.svg";
99
106
  this.widgetLoaded = false;
100
107
  this.displayMode = this.getAttribute("display-mode") === "full" ? "full" : "widget";
101
108
  }