@wf-financing/ui 4.5.2 → 4.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @wf-financing/ui
2
2
 
3
+ ## 4.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Wait for an event from the loaded script before initializing the SDK
8
+
3
9
  ## 4.5.2
4
10
 
5
11
  ### Patch Changes
package/dist/index.es.js CHANGED
@@ -23993,7 +23993,7 @@ const i8 = "https://static.wayflyer.com/flyui-assets/styles/flyui-b0050fc0.css",
23993
23993
  rootName: "bannerRoot",
23994
23994
  rootElement: "div",
23995
23995
  rootElementId: "banner-root"
23996
- }, u8 = [s8, a8, l8], dS = "wayflyer-headless-sdk", c8 = "https://embedded-finance-frontend.vercel.app/npm/@wf-financing/headless@3", yv = "4.5.2", d8 = (e) => u8.reduce((t, n) => {
23996
+ }, u8 = [s8, a8, l8], dS = "wayflyer-headless-sdk", c8 = "https://embedded-finance-frontend.vercel.app/npm/@wf-financing/headless@3", yv = "4.6.0", d8 = (e) => u8.reduce((t, n) => {
23997
23997
  const { rootElement: r, rootElementId: o, rootName: a } = n;
23998
23998
  let l = e.getElementById(o);
23999
23999
  return l || (l = document.createElement(r), l.id = o, e.appendChild(l)), {
@@ -34085,6 +34085,7 @@ class rU {
34085
34085
  }
34086
34086
  }
34087
34087
  const iU = () => {
34088
- window.WayflyerUiSdk = rU;
34088
+ const e = "UI_SDK_READY_EVENT";
34089
+ window.WayflyerUiSdk = rU, window.dispatchEvent(new CustomEvent(e));
34089
34090
  };
34090
34091
  iU();
package/index.ts CHANGED
@@ -1,7 +1,13 @@
1
1
  import { WayflyerUiSdk } from './sdk';
2
2
 
3
3
  const addUiSdkToWindow = () => {
4
+ const UI_SDK_READY_EVENT = 'UI_SDK_READY_EVENT';
5
+
4
6
  window.WayflyerUiSdk = WayflyerUiSdk;
7
+ /**
8
+ * Trigger event handler in entry point that notifies it that the SDK is ready to use. See packages/ui-sdk-entry/utils/loadUiSdkScript.ts
9
+ */
10
+ window.dispatchEvent(new CustomEvent(UI_SDK_READY_EVENT));
5
11
  };
6
12
 
7
13
  addUiSdkToWindow();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wf-financing/ui",
3
- "version": "4.5.2",
3
+ "version": "4.6.0",
4
4
  "exports": {
5
5
  ".": {
6
6
  "import": "./dist/index.es.js",