@rebilly/instruments 11.2.0 → 11.3.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,6 +1,6 @@
1
- ## [11.2.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v11.1.0...instruments/core-v11.2.0) (2024-11-20)
1
+ ## [11.3.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v11.2.1...instruments/core-v11.3.0) (2024-11-25)
2
2
 
3
3
 
4
4
  ### Features
5
5
 
6
- * **api-metadata, rebilly-js-sdk:** Update resources based on latest api definitions ([#8738](https://github.com/Rebilly/rebilly/issues/8738)) ([6190668](https://github.com/Rebilly/rebilly/commit/61906687f5dd69949d94edd52ed0244cd7493c28))
6
+ * **framepay-npm:** Prepare for publishing, and add error propagation ([#8765](https://github.com/Rebilly/rebilly/issues/8765)) ([b4ab4a5](https://github.com/Rebilly/rebilly/commit/b4ab4a52bba2de2c986b1292896391598194ace8))
package/dist/index.js CHANGED
@@ -1914,6 +1914,32 @@ const state = (() => {
1914
1914
  }
1915
1915
  };
1916
1916
  })().getInstance();
1917
+ const DEFAULT_SCRIPT_LINK = "https://framepay.rebilly.com/framepay.js";
1918
+ const DEFAULT_STYLE_LINK = "https://framepay.rebilly.com/framepay.css";
1919
+ async function loadFramepay({
1920
+ scriptLink,
1921
+ styleLink
1922
+ } = {}) {
1923
+ return new Promise((resolve, reject) => {
1924
+ if (window.Framepay) {
1925
+ resolve(window.Framepay);
1926
+ } else {
1927
+ const framepayStyle = document.createElement("link");
1928
+ framepayStyle.setAttribute("href", styleLink ?? DEFAULT_STYLE_LINK);
1929
+ framepayStyle.setAttribute("rel", "stylesheet");
1930
+ document.head.prepend(framepayStyle);
1931
+ const framepayScript = document.createElement("script");
1932
+ framepayScript.setAttribute("src", scriptLink ?? DEFAULT_SCRIPT_LINK);
1933
+ framepayScript.onload = () => resolve(window.Framepay);
1934
+ framepayScript.onerror = () => reject(
1935
+ new Error(
1936
+ "@rebilly/framepay npm package: Failed to load FramePay script"
1937
+ )
1938
+ );
1939
+ document.head.append(framepayScript);
1940
+ }
1941
+ });
1942
+ }
1917
1943
  /**
1918
1944
  popostmate - A powerful, simple, promise-based postMessage library
1919
1945
  @version v2.0.0
@@ -6262,7 +6288,7 @@ function C$1({ options: e2 }) {
6262
6288
  }
6263
6289
  function o2() {
6264
6290
  const i = {
6265
- "REB-API-CONSUMER": `${["Rebilly", e2.appName, "js-sdk"].filter((g) => g).join("/")}@6190668`
6291
+ "REB-API-CONSUMER": `${["Rebilly", e2.appName, "js-sdk"].filter((g) => g).join("/")}@b4ab4a5`
6266
6292
  };
6267
6293
  return e2.apiKey && (i["REB-APIKEY"] = e2.apiKey), i;
6268
6294
  }
@@ -17934,23 +17960,6 @@ const setupOptions = ({
17934
17960
  }
17935
17961
  return validOptions;
17936
17962
  };
17937
- async function setupFramepay() {
17938
- const { _dev } = state.options || {};
17939
- const urls = {
17940
- script: (_dev == null ? void 0 : _dev.framePayScriptLink) || "https://framepay.rebilly.com/framepay.js",
17941
- style: (_dev == null ? void 0 : _dev.framePayStyleLink) || "https://framepay.rebilly.com/framepay.css"
17942
- };
17943
- return new Promise((resolve) => {
17944
- const framepayStyle = document.createElement("link");
17945
- framepayStyle.setAttribute("href", urls.style);
17946
- framepayStyle.setAttribute("rel", "stylesheet");
17947
- document.head.prepend(framepayStyle);
17948
- const framepayScript = document.createElement("script");
17949
- framepayScript.setAttribute("src", urls.script);
17950
- framepayScript.onload = () => resolve();
17951
- document.head.append(framepayScript);
17952
- });
17953
- }
17954
17963
  var colorName = {
17955
17964
  "aliceblue": [240, 248, 255],
17956
17965
  "antiquewhite": [250, 235, 215],
@@ -21235,10 +21244,7 @@ function getShadowParent(element) {
21235
21244
  }
21236
21245
  return null;
21237
21246
  }
21238
- async function mount({
21239
- setupFramepay: setupFramepay$1 = setupFramepay,
21240
- ...options
21241
- } = {}) {
21247
+ async function mount({ ...options } = {}) {
21242
21248
  var _a, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s2, _t2;
21243
21249
  try {
21244
21250
  state.data = {};
@@ -21265,7 +21271,14 @@ async function mount({
21265
21271
  id: "rebilly-instruments-summary"
21266
21272
  });
21267
21273
  state.loader.startLoading({ id: "rebilly-instruments-form" });
21268
- const [data] = await Promise.all([fetchData(), setupFramepay$1()]);
21274
+ const { _dev } = state.options || {};
21275
+ const [data] = await Promise.all([
21276
+ fetchData(),
21277
+ loadFramepay({
21278
+ scriptLink: _dev == null ? void 0 : _dev.framePayScriptLink,
21279
+ styleLink: _dev == null ? void 0 : _dev.framePayStyleLink
21280
+ })
21281
+ ]);
21269
21282
  state.data = data;
21270
21283
  events.dataReady.dispatch(state.data);
21271
21284
  state.i18n = setupI18n();