@wf-financing/headless-sdk 1.0.1 → 2.0.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/config/url.d.ts +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.es.js +21 -22
- package/dist/sdk/index.d.ts +3 -1
- package/dist/sdk-mode/loadHeadlessMode.d.ts +2 -2
- package/dist/utils/initializeHeadlessSdk.d.ts +2 -2
- package/dist/utils/loadScriptAndInitializeSdk.d.ts +2 -2
- package/package.json +2 -2
package/dist/config/url.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const HEADLESS_PACKAGE_URL = "https://
|
|
1
|
+
export declare const HEADLESS_PACKAGE_URL = "https://embedded-finance-frontend.vercel.app/npm/@wf-financing/headless@2";
|
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||{}),
|
|
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;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ContinueHostedApplicationResponseTypes, CtaResponseTypes, CtaStateType, StartHostedApplicationResponseTypes,
|
|
2
|
-
export type { CanadianProvinceCode, CompanyDataType, ContinueHostedApplicationResponseType, CountryCode, CtaContinueFundingType, CtaGenericOfferType, CtaIndicativeOfferType, CtaResponseType, IHeadlessWayflyerSdk, StartHostedApplicationRequestType, StartHostedApplicationResponseType, UserDataType, USStateCode, } from '@wf-financing/embedded-types';
|
|
1
|
+
export { ContinueHostedApplicationResponseTypes, CtaResponseTypes, CtaStateType, StartHostedApplicationResponseTypes, } from '@wf-financing/embedded-types';
|
|
2
|
+
export type { CanadianProvinceCode, CompanyDataType, ContinueHostedApplicationResponseType, CountryCode, CtaContinueFundingType, CtaGenericOfferType, CtaIndicativeOfferType, CtaResponseType, IHeadlessWayflyerSdk, StartHostedApplicationRequestType, StartHostedApplicationResponseType, UserDataType, USStateCode, SdkOptionsType, } from '@wf-financing/embedded-types';
|
|
3
3
|
export { WayflyerHeadlessSdk } from './sdk';
|
package/dist/index.es.js
CHANGED
|
@@ -1,40 +1,39 @@
|
|
|
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 || {}),
|
|
2
|
-
const
|
|
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) => {
|
|
3
3
|
if (!window.WayflyerHeadlessSdk)
|
|
4
4
|
throw new Error("Failed to load WayflyerHeadlessSdk from the script.");
|
|
5
|
-
const
|
|
6
|
-
return new
|
|
7
|
-
},
|
|
5
|
+
const r = window.WayflyerHeadlessSdk;
|
|
6
|
+
return new r(e, t);
|
|
7
|
+
}, d = (e, t, r) => new Promise((a, i) => {
|
|
8
8
|
e.onload = () => {
|
|
9
9
|
try {
|
|
10
|
-
n(
|
|
10
|
+
a(n(t, r));
|
|
11
11
|
} catch (o) {
|
|
12
|
-
|
|
12
|
+
i(o);
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
-
}),
|
|
15
|
+
}), f = async (e, t) => {
|
|
16
16
|
try {
|
|
17
|
-
const
|
|
17
|
+
const r = document.getElementById(s);
|
|
18
18
|
if (window.WayflyerHeadlessSdk)
|
|
19
|
-
return
|
|
20
|
-
if (
|
|
21
|
-
return
|
|
22
|
-
const
|
|
23
|
-
return
|
|
24
|
-
} catch (
|
|
25
|
-
throw console.error("Error in loading headless SDK:",
|
|
19
|
+
return n(e, t);
|
|
20
|
+
if (r)
|
|
21
|
+
return d(r, e, t);
|
|
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);
|
|
24
|
+
} catch (r) {
|
|
25
|
+
throw console.error("Error in loading headless SDK:", r), new Error("Failed to load script");
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
class
|
|
29
|
-
static async loadSdk(
|
|
30
|
-
return await
|
|
28
|
+
class p {
|
|
29
|
+
static async loadSdk(t, r) {
|
|
30
|
+
return await f(t, r);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
export {
|
|
34
34
|
E as ContinueHostedApplicationResponseTypes,
|
|
35
35
|
l as CtaResponseTypes,
|
|
36
|
-
|
|
37
|
-
I as SdkScenarios,
|
|
36
|
+
y as CtaStateType,
|
|
38
37
|
c as StartHostedApplicationResponseTypes,
|
|
39
|
-
|
|
38
|
+
p as WayflyerHeadlessSdk
|
|
40
39
|
};
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { SdkOptionsType } from '@wf-financing/embedded-types';
|
|
2
|
+
|
|
1
3
|
export declare class WayflyerHeadlessSdk {
|
|
2
|
-
static loadSdk(companyToken: string,
|
|
4
|
+
static loadSdk(companyToken: string, options?: SdkOptionsType): Promise<void | import('@wf-financing/embedded-types').IHeadlessWayflyerSdk>;
|
|
3
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IHeadlessWayflyerSdk } from '@wf-financing/embedded-types';
|
|
1
|
+
import { IHeadlessWayflyerSdk, SdkOptionsType } from '@wf-financing/embedded-types';
|
|
2
2
|
|
|
3
|
-
type LoadHeadlessSdkModeType = (companyToken: string,
|
|
3
|
+
type LoadHeadlessSdkModeType = (companyToken: string, options?: SdkOptionsType) => Promise<IHeadlessWayflyerSdk | void>;
|
|
4
4
|
export declare const loadHeadlessSdkMode: LoadHeadlessSdkModeType;
|
|
5
5
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IHeadlessWayflyerSdk } from '@wf-financing/embedded-types';
|
|
1
|
+
import { IHeadlessWayflyerSdk, SdkOptionsType } from '@wf-financing/embedded-types';
|
|
2
2
|
|
|
3
|
-
export declare const initializeHeadlessSdk: (companyToken: string,
|
|
3
|
+
export declare const initializeHeadlessSdk: (companyToken: string, options?: SdkOptionsType) => IHeadlessWayflyerSdk;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IHeadlessWayflyerSdk } from '@wf-financing/embedded-types';
|
|
1
|
+
import { IHeadlessWayflyerSdk, SdkOptionsType } from '@wf-financing/embedded-types';
|
|
2
2
|
|
|
3
|
-
export declare const loadScriptAndInitializeSdk: (script: HTMLScriptElement, companyToken: string,
|
|
3
|
+
export declare const loadScriptAndInitializeSdk: (script: HTMLScriptElement, companyToken: string, options?: SdkOptionsType) => Promise<IHeadlessWayflyerSdk>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wf-financing/headless-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
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.
|
|
18
|
+
"@wf-financing/embedded-types": "0.4.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"vite": "^6.3.5",
|