npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@lendi/lendi-lead-library

v1.10.2

Published

Support green call files through funnels

Downloads

144

Readme

Lendi Lead Library

Importing

import LendiLeads from '@lendi/lendi-leads-library';

Sending data through a funnel that uses lala-customer-app

Once you have the data, it must first be set in sessionStorage:

// See below for valid funnel names.
import LendiLeads from "@lendi/lendi-lead-library";
const L3 = new LendiLeads(funnelName);

// Put your funnel data in here as a valid funnel object for leads service to consume
L3.set(data);

// We have some special optional keys that make it easier for other frontends to read the L3 data
L3.setFirstName('test_first_name');
L3.setMobileNumber('test_mobile_number');
L3.setEmail('test_email');

Valid funnel names are: 'BORROWING_POWER', 'NEW_HOME_LOAN', 'REFINANCE', 'BLOG', 'PROPERTY_REPORT', 'STAMP_DUTY_CALCULATOR', 'APPOINTMENT_BOOKING', 'SIGN_UP' and 'INVITE'.

The data should be in a format that the API is expecting, there is no typescript validation on your input. However since the @lendi/lead-client is a peerDependency, the data should correspond to the funnelName using one of the following types:

  • StampDutyDataV2, BorrowingPowerDataV2, FunnelDataV2 or PropertyReportDataV2.

After the data has been saved it will automatically be found and pulled from storage in lala-customer-app.

Sending data through a funnel with it's own log in page

Once data gathered, use:


// This should be a reference to the environment
// base URL as L3 will remain unaware.
const baseURL = process.env.API_URL;

LendiLeads.sendLead(data: LeadsRecord, baseURL: string);

This method expects that the data has been formatted in a way that is expected for the leads endpoint.

Note that there will be no types to validate the payload, this contract is between the consuming app and the API. The interface for a leads record is:

interface LeadsRecord {
  generatedAt: string;
  timeZone: string;
  mobileNumber: string;
  firstName: string;
  origin: LeadsRecordOriginEnum;
  brand: LeadsRecordBrandEnum;
  accountOrigin: string;
  data?: FunnelDataV1 | BorrowingPowerDataV1 | StampDutyDataV1 | PropertyReportDataV1;
  email?: string;
  gclId?: string;
  utm?: string;
}

When constructing this object, there are several helper methods available

  • gclId: (this is a google ads query string) use: LendiLeads.retrieveGCLID();
  • accountOrigin: LendiLeads.retrieveAccountOrigin();
  • generatedAt: new Date().toISOString();
  • timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone;

Using leads data on the frontend

Some leads data can be consumed statically by front end applications. They have access to firstName, mobileNumber, and email if they have been previously set. To use them do this:

import LendiLeads from '@lendi/lendi-lead-library';

const firstName: string | undefined = LendiLeads.firstName;
const mobileNumber: string | undefined = LendiLeads.mobileNumber;
const email: string | undefined = LendiLeads.email;

Use with lendi-app

In the case of Lendi-app, this library contains several transformation methods to translate the query string data into a format that is required by the core team's leads service. The main transformation method is named:

LendiLeads.transform_DEPRECATED(queryData: { [key: string]: string }, phoneNumber: string)

The queryData should be exactly what was received from the end of the funnel. phoneNumber is a separate parameter as this is collected in a separate stage (e.g. inside lala-customer-app).

Under the hood, this will call either a .transformFunnel_DEPRECATED() or .transformBorrowing_DEPRECATED() if the data came from either of the funnels (new home loan or refinance) or the borrowing power calculator.

Once this data has been returned, there is a corresponding method: LendiLeads.send_DEPRECATED(data: OldFunnel, brand: LeadsRecordBrandEnum, baseURL: string)

For the parameters:

  • data can be passed through directly from the transformation method.
  • brand can be passed through as a value on the enum Brand which is exported from this library: import { Brand } from '@lendi/lendi-lead-library'
  • baseURL should be the base url of the API for the current environment, the library will append /v1/leads to the end of that URL.

NOTE: the reason these methods have been marked as _DEPRECATED is because once lendi-app is retired, the methods should never have a use again and the library should take more responsibility for the sending of leads data.

Types

The majority of the types required will be in the package @lendi/lead-client as they are created from the generated client using the core team's openapi.yaml swagger doc.