
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@wf-financing/headless-entry
Advanced tools
Wayflyer provides a `@wf-financing/headless-entry` package that can be used as a client-side headless SDK to interact with the Embedded Finance API.
Wayflyer provides a @wf-financing/headless-entry
package that can be used as a client-side headless SDK to interact with the Embedded Finance API.
Install the package directly from NPM with npm install @wf-financing/headless-entry
.
To minimize bundle size and reduce the impact on partners' page load times, the SDK uses dynamic imports to load main part of functionality.
Initialize the Wayflyer headless SDK by passing the companyToken
and a pointer that specifies whether the SDK should work in mocked mode.
import { type IHeadlessWayflyerCtaSdk, WayflyerHeadlessCtaSdk } from '@wf-financing/headless-entry';
const wayflyerSdk = (await WayflyerHeadlessCtaSdk.loadSdkMode('token')) as IHeadlessWayflyerCtaSdk;
Note: The companyToken should be minted using the Company Token endpoint on the partner's backend. See the Authentication section here for more details.
getCta()
Returns the configuration for the CTA to show to the user.
import type { CtaResponseType } from '@wf-financing/headless-entry';
const cta: CtaResponseType = await wayflyerSdk.getCta();
startHostedApplication(applicationRequest)
Returns a URL to the Wayflyer landing page after the user has given consent for sharing personal data.
import type { StartHostedApplicationRequestType, StartHostedApplicationResponseType } from '@wf-financing/headless-entry';
const merchantData: StartHostedApplicationRequestType = {
company_data: {},
user_data: {},
partner_data: {},
};
const startHostedApplication: StartHostedApplicationResponseType = await wayflyerSdk.startHostedApplication(merchantData);
continueHostedApplication()
Returns a URL to the Wayflyer landing page after the submission of the merchant funding application.
import type { ContinueHostedApplicationResponseType } from '@wf-financing/headless-entry';
const startHostedApplication: ContinueHostedApplicationResponseType = await wayflyerSdk.startHostedApplication(merchantData);
To simplify the testing process, the SDK can be initialized in mock mode. To do so, pass a second argument with the value true
.
import { WayflyerHeadlessCtaSdk } from '@wf-financing/headless-entry';
const wayflyerSdk = (await WayflyerHeadlessCtaSdk.loadSdkMode('token', true)) as IHeadlessWayflyerCtaSdk;
In mock mode, partner can manually set responses for SDK methods via additional methods:
setCtaResponse(responseType: CtaResponseTypes)
setStartHostedApplicationResponse(responseType: StartHostedApplicationResponseTypes)
setContinueHostedApplicationResponse(responseType: ContinueHostedApplicationResponseTypes)
setSdkScenario(sdkScenario: SdkScenarios)
setCtaResponse(responseType: CtaResponseTypes)
Sets a mocked response for the getCta()
method.
import { CtaResponseTypes } from '@wf-financing/headless-entry';
wayflyerSdk.setCtaResponse(CtaResponseTypes.GENERIC_OFFER);
wayflyerSdk.setCtaResponse(CtaResponseTypes.INDICATIVE_OFFER);
wayflyerSdk.setCtaResponse(CtaResponseTypes.CONTINUE_HOSTED_APPLICATION);
wayflyerSdk.setCtaResponse(CtaResponseTypes.NO_CTA);
wayflyerSdk.setCtaResponse(CtaResponseTypes.INVALID_TOKEN);
setCtaResponse(responseType: CtaResponseTypes)
Sets a mocked response for the startHostedApplication(applicationRequest: StartHostedApplicationRequestType)
method.
import { StartHostedApplicationResponseTypes } from '@wf-financing/headless-entry';
wayflyerSdk.setStartHostedApplicationResponse(StartHostedApplicationResponseTypes.REDIRECT_URL);
wayflyerSdk.setStartHostedApplicationResponse(StartHostedApplicationResponseTypes.BAD_REQUEST);
wayflyerSdk.setStartHostedApplicationResponse(StartHostedApplicationResponseTypes.INVALID_TOKEN);
setContinueHostedApplicationResponse(responseType: ContinueHostedApplicationResponseTypes)
Sets a mocked response for the continueHostedApplication()
method.
import { ContinueHostedApplicationResponseTypes } from '@wf-financing/headless-entry';
wayflyerSdk.setContinueHostedApplicationResponse(ContinueHostedApplicationResponseTypes.REDIRECT_URL);
wayflyerSdk.setContinueHostedApplicationResponse(ContinueHostedApplicationResponseTypes.BAD_REQUEST);
wayflyerSdk.setContinueHostedApplicationResponse(ContinueHostedApplicationResponseTypes.INVALID_TOKEN);
setSdkScenario(sdkScenario: SdkScenarios)
Provides complex mocked scenarios for complete E2E testing. This ensures that partners do not encounter incompatible responses for different methods, such as startHostedApplication(applicationRequest: StartHostedApplicationRequestType)
and continueHostedApplication()
, which cannot return valid responses at the same time.
import { SdkScenarios } from '@wf-financing/headless-entry';
wayflyerSdk.setSdkScenario(SdkScenarios.INDICATIVE_NEW_APPLICATION);
wayflyerSdk.setSdkScenario(SdkScenarios.GENERIC_NEW_APPLICATION);
wayflyerSdk.setSdkScenario(SdkScenarios.CONTINUE_APPLICATION);
wayflyerSdk.setSdkScenario(SdkScenarios.NO_CTA);
Note: After calling setSdkScenario(sdkScenario: SdkScenarios)
, other methods for setting manual responses will no longer have any effect.
For further details on using the SDK, troubleshooting, or expanding on these examples, check out our full documentation.
FAQs
Wayflyer provides a `@wf-financing/headless-entry` package that can be used as a client-side headless SDK to interact with the Embedded Finance API.
We found that @wf-financing/headless-entry demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.