@wf-financing/headless-sdk 3.0.0 → 3.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.
package/README.md CHANGED
@@ -55,6 +55,13 @@ import type { ContinueHostedApplicationResponseType } from '@wf-financing/headle
55
55
  const startHostedApplication: ContinueHostedApplicationResponseType = await wayflyerSdk.continueHostedApplication();
56
56
  ```
57
57
 
58
+ ### `dismissCta()`
59
+ Dismiss CTA for current combination of company and user.
60
+
61
+ ```jsx
62
+ await wayflyerSdk.dismissCta();
63
+ ```
64
+
58
65
  ## Sandbox
59
66
 
60
67
  To simplify the testing process, the SDK can be initialized in sandbox mode. To do so, pass the second argument of type `SdkOptionsType` with `isSandbox` flag set to `true`. In sandbox mode, the partner can simulate responses for SDK methods with the help of additional package `@wf-financing/sandbox-ui`.
package/dist/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var s=(e=>(e.GENERIC_OFFER="generic_offer",e.INDICATIVE_OFFER="indicative_offer",e.CONTINUE_HOSTED_APPLICATION="continue_hosted_application",e.NO_CTA="no_cta",e.INVALID_TOKEN="invalid_token",e))(s||{}),i=(e=>(e.REDIRECT_URL="redirect_url",e.BAD_REQUEST="bad_request",e.INVALID_TOKEN="invalid_token",e))(i||{}),o=(e=>(e.REDIRECT_URL="redirect_url",e.BAD_REQUEST="bad_request",e.INVALID_TOKEN="invalid_token",e))(o||{}),l=(e=>(e.GENERIC_OFFER="generic_offer",e.INDICATIVE_OFFER="indicative_offer",e.CONTINUE_APPLICATION="continue_application",e))(l||{});const d="wayflyer-headless-sdk",S="https://embedded-finance-frontend.vercel.app/npm/@wf-financing/headless@2",c=(e,r)=>{if(!window.WayflyerHeadlessSdk)throw new Error("Failed to load WayflyerHeadlessSdk from the script.");const t=window.WayflyerHeadlessSdk;return new t(e,r)},n=(e,r,t)=>new Promise((a,E)=>{e.onload=()=>{try{a(c(r,t))}catch(y){E(y)}}}),f=async(e,r)=>{try{const t=document.getElementById(d);if(window.WayflyerHeadlessSdk)return c(e,r);if(t)return n(t,e,r);const a=document.createElement("script");return a.src=S,a.type="module",a.id=d,a.async=!0,document.head.appendChild(a),n(a,e,r)}catch(t){throw console.error("Error in loading headless SDK:",t),new Error("Failed to load script")}};class I{static async loadSdk(r,t){return await f(r,t)}}exports.ContinueHostedApplicationResponseTypes=o;exports.CtaResponseTypes=s;exports.CtaStateType=l;exports.StartHostedApplicationResponseTypes=i;exports.WayflyerHeadlessSdk=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var n=(e=>(e.GENERIC_OFFER="generic_offer",e.INDICATIVE_OFFER="indicative_offer",e.CONTINUE_APPLICATION="continue_application",e))(n||{});const a="wayflyer-headless-sdk",c="https://embedded-finance-frontend.vercel.app/npm/@wf-financing/headless@2",l=(e,d)=>{if(!window.WayflyerHeadlessSdk)throw new Error("Failed to load WayflyerHeadlessSdk from the script.");const r=window.WayflyerHeadlessSdk;return new r(e,d)},s=(e,d,r)=>new Promise((t,o)=>{e.onload=()=>{try{t(l(d,r))}catch(i){o(i)}}}),y=async(e,d)=>{try{const r=document.getElementById(a);if(window.WayflyerHeadlessSdk)return l(e,d);if(r)return s(r,e,d);const t=document.createElement("script");return t.src=c,t.type="module",t.id=a,t.async=!0,document.head.appendChild(t),s(t,e,d)}catch(r){throw console.error("Error in loading headless SDK:",r),new Error("Failed to load script")}};class S{static async loadSdk(d,r){return await y(d,r)}}exports.CtaStateType=n;exports.WayflyerHeadlessSdk=S;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { ContinueHostedApplicationResponseTypes, CtaResponseTypes, CtaStateType, StartHostedApplicationResponseTypes, } from '@wf-financing/embedded-types';
2
- export type { CanadianProvinceCode, CompanyDataType, ContinueHostedApplicationResponseType, CountryCode, CtaContinueFundingType, CtaGenericOfferType, CtaIndicativeOfferType, CtaResponseType, IWayflyerHeadlessSdk, StartHostedApplicationRequestType, StartHostedApplicationResponseType, UserDataType, USStateCode, SdkOptionsType, } from '@wf-financing/embedded-types';
1
+ export { CtaStateType } from '@wf-financing/embedded-types';
2
+ export type { CanadianProvinceCode, CompanyDataType, ContinueHostedApplicationResponseType, CountryCode, CtaContinueFundingType, CtaGenericOfferType, CtaIndicativeOfferType, CtaResponseType, IWayflyerHeadlessSdk, SdkOptionsType, StartHostedApplicationRequestType, StartHostedApplicationResponseType, UserDataType, USStateCode, } from '@wf-financing/embedded-types';
3
3
  export { WayflyerHeadlessSdk } from './sdk';
package/dist/index.es.js CHANGED
@@ -1,39 +1,36 @@
1
- var l = /* @__PURE__ */ ((e) => (e.GENERIC_OFFER = "generic_offer", e.INDICATIVE_OFFER = "indicative_offer", e.CONTINUE_HOSTED_APPLICATION = "continue_hosted_application", e.NO_CTA = "no_cta", e.INVALID_TOKEN = "invalid_token", e))(l || {}), c = /* @__PURE__ */ ((e) => (e.REDIRECT_URL = "redirect_url", e.BAD_REQUEST = "bad_request", e.INVALID_TOKEN = "invalid_token", e))(c || {}), E = /* @__PURE__ */ ((e) => (e.REDIRECT_URL = "redirect_url", e.BAD_REQUEST = "bad_request", e.INVALID_TOKEN = "invalid_token", e))(E || {}), y = /* @__PURE__ */ ((e) => (e.GENERIC_OFFER = "generic_offer", e.INDICATIVE_OFFER = "indicative_offer", e.CONTINUE_APPLICATION = "continue_application", e))(y || {});
2
- const s = "wayflyer-headless-sdk", I = "https://embedded-finance-frontend.vercel.app/npm/@wf-financing/headless@2", n = (e, t) => {
1
+ var c = /* @__PURE__ */ ((e) => (e.GENERIC_OFFER = "generic_offer", e.INDICATIVE_OFFER = "indicative_offer", e.CONTINUE_APPLICATION = "continue_application", e))(c || {});
2
+ const t = "wayflyer-headless-sdk", i = "https://embedded-finance-frontend.vercel.app/npm/@wf-financing/headless@2", n = (e, d) => {
3
3
  if (!window.WayflyerHeadlessSdk)
4
4
  throw new Error("Failed to load WayflyerHeadlessSdk from the script.");
5
5
  const r = window.WayflyerHeadlessSdk;
6
- return new r(e, t);
7
- }, d = (e, t, r) => new Promise((a, i) => {
6
+ return new r(e, d);
7
+ }, s = (e, d, r) => new Promise((a, l) => {
8
8
  e.onload = () => {
9
9
  try {
10
- a(n(t, r));
10
+ a(n(d, r));
11
11
  } catch (o) {
12
- i(o);
12
+ l(o);
13
13
  }
14
14
  };
15
- }), f = async (e, t) => {
15
+ }), y = async (e, d) => {
16
16
  try {
17
- const r = document.getElementById(s);
17
+ const r = document.getElementById(t);
18
18
  if (window.WayflyerHeadlessSdk)
19
- return n(e, t);
19
+ return n(e, d);
20
20
  if (r)
21
- return d(r, e, t);
21
+ return s(r, e, d);
22
22
  const a = document.createElement("script");
23
- return a.src = I, a.type = "module", a.id = s, a.async = !0, document.head.appendChild(a), d(a, e, t);
23
+ return a.src = i, a.type = "module", a.id = t, a.async = !0, document.head.appendChild(a), s(a, e, d);
24
24
  } catch (r) {
25
25
  throw console.error("Error in loading headless SDK:", r), new Error("Failed to load script");
26
26
  }
27
27
  };
28
- class p {
29
- static async loadSdk(t, r) {
30
- return await f(t, r);
28
+ class f {
29
+ static async loadSdk(d, r) {
30
+ return await y(d, r);
31
31
  }
32
32
  }
33
33
  export {
34
- E as ContinueHostedApplicationResponseTypes,
35
- l as CtaResponseTypes,
36
- y as CtaStateType,
37
- c as StartHostedApplicationResponseTypes,
38
- p as WayflyerHeadlessSdk
34
+ c as CtaStateType,
35
+ f as WayflyerHeadlessSdk
39
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wf-financing/headless-sdk",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,7 +15,7 @@
15
15
  "dist"
16
16
  ],
17
17
  "dependencies": {
18
- "@wf-financing/embedded-types": "0.4.1"
18
+ "@wf-financing/embedded-types": "0.4.2"
19
19
  },
20
20
  "devDependencies": {
21
21
  "vite": "^6.3.5",