@wf-financing/headless-sdk 3.0.6 → 4.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/README.md CHANGED
@@ -7,16 +7,16 @@ Install the package directly from NPM with `npm install @wf-financing/headless-s
7
7
  To minimize bundle size and reduce the impact on partners' page load times, the SDK uses dynamic imports to load the main functionality.
8
8
 
9
9
  ## Instantiation
10
- Initialize the Wayflyer headless SDK by passing the `companyToken` and an optional `options` object with a type of `SdkOptionsType` that specifies additional functionality of SDK instance - e.g. consuming sandbox API instead of the production.
10
+ Initialize the Wayflyer headless SDK by passing the `companyToken` and an optional `options` object with a type of `HeadlessSdkOptions` that specifies additional functionality of SDK instance - e.g. consuming sandbox API instead of the production.
11
11
 
12
12
  ```jsx
13
- import { WayflyerHeadlessSdk, SdkOptionsType } from '@wf-financing/headless-sdk';
13
+ import { WayflyerHeadlessSdk, HeadlessSdkOptions } from '@wf-financing/headless-sdk';
14
14
 
15
15
  // instantiation in production mode
16
16
  const wayflyerHeadlessSdk = await WayflyerHeadlessSdk.loadSdk(companyToken);
17
17
 
18
- // instantiation in sandbox mode, `options` type of SdkOptionsType
19
- const options: SdkOptionsType = { isSandbox: true };
18
+ // instantiation in sandbox mode, `options` type of HeadlessSdkOptions
19
+ const options: HeadlessSdkOptions = { isSandbox: true };
20
20
  const wayflyerHeadlessSdk = await WayflyerHeadlessSdk.loadSdk(companyToken, options);
21
21
  ```
22
22
  Note: The companyToken should be minted using the Company Token endpoint on the partner's backend. See the Authentication section [here](https://docs.wayflyer.com/embedded-finance/authentication) for more details.
@@ -64,12 +64,12 @@ await wayflyerSdk.dismissCta();
64
64
 
65
65
  ## Sandbox
66
66
 
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`.
67
+ To simplify the testing process, the SDK can be initialized in sandbox mode. To do so, pass the second argument of type `HeadlessSdkOptions` 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`.
68
68
 
69
69
  ```jsx
70
- import { WayflyerHeadlessSdk, SdkOptionsType } from '@wf-financing/headless-sdk';
70
+ import { WayflyerHeadlessSdk, HeadlessSdkOptions } from '@wf-financing/headless-sdk';
71
71
 
72
- const options: SdkOptionsType = { isSandbox: true };
72
+ const options: HeadlessSdkOptions = { isSandbox: true };
73
73
  const wayflyerSdk = await WayflyerHeadlessSdk.loadSdk(companyToken, options);
74
74
  ```
75
75
 
@@ -1 +1 @@
1
- export declare const HEADLESS_PACKAGE_URL = "https://embedded-finance-frontend.vercel.app/npm/@wf-financing/headless@2";
1
+ export declare const HEADLESS_PACKAGE_URL = "https://embedded-finance-frontend.vercel.app/npm/@wf-financing/headless@3";
package/dist/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var l=(e=>(e.GENERIC_OFFER="generic_offer",e.INDICATIVE_OFFER="indicative_offer",e.CONTINUE_APPLICATION="continue_application",e))(l||{});const s="wayflyer-headless-sdk",c="https://embedded-finance-frontend.vercel.app/npm/@wf-financing/headless@2",n=(e,d)=>{if(!window.WayflyerHeadlessSdk)throw new Error("Failed to load WayflyerHeadlessSdk from the script.");const r=window.WayflyerHeadlessSdk;return window.waylflyerHeadlessSdk||(window.waylflyerHeadlessSdk=new r(e,d)),window.waylflyerHeadlessSdk},t=(e,d,r)=>new Promise((a,i)=>{e.onload=()=>{try{a(n(d,r))}catch(o){i(o)}}}),y=async(e,d)=>{try{const r=document.getElementById(s);if(window.WayflyerHeadlessSdk)return n(e,d);if(r)return t(r,e,d);const a=document.createElement("script");return a.src=c,a.type="module",a.id=s,a.async=!0,document.head.appendChild(a),t(a,e,d)}catch(r){throw console.error("Error in loading headless SDK:",r),new Error("Failed to load script")}};class f{static async loadSdk(d,r){return await y(d,r)}}exports.CtaStateType=l;exports.WayflyerHeadlessSdk=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var l=(e=>(e.GENERIC_OFFER="generic_offer",e.INDICATIVE_OFFER="indicative_offer",e.CONTINUE_APPLICATION="continue_application",e))(l||{});const s="wayflyer-headless-sdk",c="https://embedded-finance-frontend.vercel.app/npm/@wf-financing/headless@3",n=(e,d)=>{if(!window.WayflyerHeadlessSdk)throw new Error("Failed to load WayflyerHeadlessSdk from the script.");const r=window.WayflyerHeadlessSdk;return window.waylflyerHeadlessSdk||(window.waylflyerHeadlessSdk=new r(e,d)),window.waylflyerHeadlessSdk},t=(e,d,r)=>new Promise((a,i)=>{e.onload=()=>{try{a(n(d,r))}catch(o){i(o)}}}),y=async(e,d)=>{try{const r=document.getElementById(s);if(window.WayflyerHeadlessSdk)return n(e,d);if(r)return t(r,e,d);const a=document.createElement("script");return a.src=c,a.type="module",a.id=s,a.async=!0,document.head.appendChild(a),t(a,e,d)}catch(r){throw console.error("Error in loading headless SDK:",r),new Error("Failed to load script")}};class f{static async loadSdk(d,r){return await y(d,r)}}exports.CtaStateType=l;exports.WayflyerHeadlessSdk=f;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
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';
2
+ export type { CanadianProvinceCode, CompanyDataType, ContinueHostedApplicationResponseType, CountryCode, CtaContinueFundingType, CtaGenericOfferType, CtaIndicativeOfferType, CtaResponseType, IWayflyerHeadlessSdk, SdkOptionsType, HeadlessSdkOptions, StartHostedApplicationRequestType, StartHostedApplicationResponseType, UserDataType, USStateCode, } from '@wf-financing/embedded-types';
3
3
  export { WayflyerHeadlessSdk } from './sdk';
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  var o = /* @__PURE__ */ ((e) => (e.GENERIC_OFFER = "generic_offer", e.INDICATIVE_OFFER = "indicative_offer", e.CONTINUE_APPLICATION = "continue_application", e))(o || {});
2
- const s = "wayflyer-headless-sdk", c = "https://embedded-finance-frontend.vercel.app/npm/@wf-financing/headless@2", l = (e, d) => {
2
+ const s = "wayflyer-headless-sdk", c = "https://embedded-finance-frontend.vercel.app/npm/@wf-financing/headless@3", l = (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;
@@ -1,5 +1,5 @@
1
- import { SdkOptionsType, IWayflyerHeadlessSdk } from '@wf-financing/embedded-types';
1
+ import { HeadlessSdkOptions, IWayflyerHeadlessSdk } from '@wf-financing/embedded-types';
2
2
 
3
3
  export declare class WayflyerHeadlessSdk {
4
- static loadSdk(companyToken: string, options?: SdkOptionsType): Promise<IWayflyerHeadlessSdk>;
4
+ static loadSdk(companyToken: string, options?: HeadlessSdkOptions): Promise<IWayflyerHeadlessSdk>;
5
5
  }
@@ -1,5 +1,5 @@
1
- import { IWayflyerHeadlessSdk, SdkOptionsType } from '@wf-financing/embedded-types';
1
+ import { IWayflyerHeadlessSdk, HeadlessSdkOptions } from '@wf-financing/embedded-types';
2
2
 
3
- type LoadHeadlessSdkModeType = (companyToken: string, options?: SdkOptionsType) => Promise<IWayflyerHeadlessSdk | void>;
3
+ type LoadHeadlessSdkModeType = (companyToken: string, options?: HeadlessSdkOptions) => Promise<IWayflyerHeadlessSdk | void>;
4
4
  export declare const loadHeadlessSdkMode: LoadHeadlessSdkModeType;
5
5
  export {};
@@ -1,3 +1,3 @@
1
- import { IWayflyerHeadlessSdk, SdkOptionsType } from '@wf-financing/embedded-types';
1
+ import { IWayflyerHeadlessSdk, HeadlessSdkOptions } from '@wf-financing/embedded-types';
2
2
 
3
- export declare const initializeHeadlessSdk: (companyToken: string, options?: SdkOptionsType) => IWayflyerHeadlessSdk;
3
+ export declare const initializeHeadlessSdk: (companyToken: string, options?: HeadlessSdkOptions) => IWayflyerHeadlessSdk;
@@ -1,3 +1,3 @@
1
- import { IWayflyerHeadlessSdk, SdkOptionsType } from '@wf-financing/embedded-types';
1
+ import { IWayflyerHeadlessSdk, HeadlessSdkOptions } from '@wf-financing/embedded-types';
2
2
 
3
- export declare const loadScriptAndInitializeSdk: (script: HTMLScriptElement, companyToken: string, options?: SdkOptionsType) => Promise<IWayflyerHeadlessSdk>;
3
+ export declare const loadScriptAndInitializeSdk: (script: HTMLScriptElement, companyToken: string, options?: HeadlessSdkOptions) => Promise<IWayflyerHeadlessSdk>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wf-financing/headless-sdk",
3
- "version": "3.0.6",
3
+ "version": "4.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.7.0"
18
+ "@wf-financing/embedded-types": "1.0.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "vite": "^6.3.5",