Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
authentic-ts-client
Advanced tools
TypeScript SDK for interacting with the Authentic API.
npm install authentic-ts-client
Client
Most interaction with the SDK is done through the Client
class, which can be optionally configured on instantiation.
import { Client } from "authentic-ts-client";
const authentic = new Client({
// Optional configurations
authConfig: {
awsRegion: "us-east-1",
},
});
Application
An insurance Application
with Authentic consists of three main parts: meta
, questions
(also referred to as fields
), and exposures
.
ApplicationMeta
can be thought of as a prequalification or "lead" which is submitted to create a new application.
// Find the customer's business class
const availableBusinessClasses = await authentic.getBusinessClasses();
const customerBusinessClass = availableBusinessClasses.find(
(businessClass) => businessClass.name === "Juice Bar"
);
// Set up the customer's states of operation
const customerStateCodes = ["OH", "NY"];
// Choose which insurance product the customer is applying for
const availableProducts = await authentic.getAvailableProducts(
applicationMeta.businessClassCode,
applicationMeta.stateCodes
);
const customerProduct = availableProducts.find(
(product) => product.name === "General Liability"
);
// Submit the customer's `ApplicationMeta` to create a new application
const applicationMeta = {
email: "customer@email.com",
businessClassCode: customerBusinessClass.code,
stateCodes: customerStateCodes,
productIds: customerProduct.id;
};
const application = await authentic.createApplication(applicationMeta);
An Application
's questions are broken up into sections. These sections are ordered, as are the questions within them. The SDK provides getters to track which sections have yet to be completed, updating these getters as new answers are submitted.
Note: If accepting user input, each ApplicationField
includes properties to validate input as well as display the question. (ex: type
, title
, description
, helperText
, minimum
, maximum
, etc.)
// Find the first question within the current section that has yet to be answered
const currentQuestion = application.currentSection.fields.find(
(field) => !application.answers.questions[field.name]
);
// Submit an answer for the current question
const wasErrorSubmitting = await application.submitQuestionAnswer(
authentic.api,
{
fieldName: currentQuestion.name,
fieldValue: "Example answer",
}
);
Once all Application.sections
are complete, at least one answer for each ApplicationExposure
must be submitted. Exposures are the last piece of application information needed to generate policy quotes.
// Set up an exposure answer to submit
const exposureAnswer: ApplicationExposureAnswer = {
id: "1",
exposureName: application.currentExposure.name,
fieldValues: {},
};
// Populate our exposure answer's `fieldValues` (question answers)
for (const exposureSection of application.currentExposure.sections) {
for (const exposureQuestion of exposureSection.fields) {
exposureAnswer.fieldValues[exposureQuestion.name] = "Example answer";
}
}
// Submit the exposure answer
const wasErrorSubmitting = await application.submitExposureAnswer(
authentic.api,
exposureAnswer
);
In order to generate policy quotes the user must be signed up and authenticated. This is done by a verification code sent to the customer's email.
// Send verification code (flagging `true` to sign up a new user if the email isn't registered)
const wasErrorSending = await authentic.auth.sendCode(
application.meta.email,
true
);
// Verify the code
const wasErrorVerifying = await authentic.auth.verifyCode(code);
With a completed Application
and an authenticated user, policy quotes can now be generated for the customer. These quotes can purchased by the customer through a generated payment link.
const wasErrorApplying = await application.apply(authentic.api);
const policyQuotes = application.quotes;
const quotesPaymentLink = await application.getQuotesPaymentLink(authentic.api);
With an authenticated user, you can easily fetch all policies associated with that user.
const policies = await authentic.getPolicies();
An important tool within the SDK is the ability to prefill applications by answering questions on behalf of the end customer. These prefilled answers serve to provide the customer with a "one-click" experience.
Prefilling can be done programmatically when creating an application within the SDK, or encoded into your custom application URL.
const prefillData: ApplicationPrefillData = {
meta: {
email: "customer@email.com",
businessClassCode: "72311",
stateCodes: ["OH"],
productIds: ["aee80d5f-d110-4edb-8708-e5db2190a618"],
},
answers: {
CLASS_DESCRIPTION: "Barber Shops & Beauty Salons",
MARKET_GROUP_LONG: "Personal Services",
BUSINESS_LEGAL_NAME: "Customer Business Name",
MAILING_ADDRESS: "100 Ohio Ave UNIT T2, McDonald, OH 44437, US",
DATE_OF_BIRTH: "1994-01-06T05:00:00.000Z",
NAME: "Customer Name",
PHONE: "1112223333",
FRANCHISE_SELECTED: "No",
GENERIC_BUSINESS_MGMT_PRACTICES_DECLINE: "None of the above",
NUM_BARBERS: "2",
NUM_BEAUTICIANS: "3",
NUM_EMPLOYEES: "5",
PERSONAL_SERVICES_HERBAL_THERAPY: "No",
PERSONAL_SERVICES_KERATIN_BRAZILIAN: "No",
PERSONAL_SERVICES_MANUFACTURE: "No",
PERSONAL_SERVICES_MASSAGE_THERAPY: "No",
PERSONAL_SERVICES_SALON_SPA_FORBIDDEN_ACTIVITIES: "None of the above",
PERSONAL_SERVICES_SWIMMING_POOL: "No",
POLICY_START_DATE: "2023-08-28T04:00:00.000Z",
PRIOR_LOSS_COUNT: "0",
PL_END_ELECT: "No",
},
exposures: [
{
id: "1",
name: "business_location",
fieldValues: {
ADDRESS: "100 street, UNIT 2, city, OH 33333, US",
SALES: "250000",
PAYROLL: "40000",
AREA: "3500",
},
},
],
};
// Prefilling programmatically
const application = await authentic.createApplication(
prefillData.meta,
prefillData
);
// Prefilling via encoded URL
const applicationUrl = getApplicationUrl({
baseUrl: "your-company.authenticinsurance.com/apply",
prefillData,
});
Authentic allows you to customize the theming of your insurance portal to your brand, giving the end customer a seamless and trustworthy experience.
const themeOverrides: ThemeOverrides = {
brandName: "Your company",
brandLogoUrl: "https://your-company.com/logo.png",
primaryColor: "#000000",
borderRadius: 4,
};
// Redirect user to prefilled and branded application (if in a browser environment)
redirectToApplicationUrl({
baseUrl: "your-company.authenticinsurance.com/apply",
prefillData,
themeOverrides,
});
FAQs
TypeScript SDK for interacting with the Authentic API.
The npm package authentic-ts-client receives a total of 0 weekly downloads. As such, authentic-ts-client popularity was classified as not popular.
We found that authentic-ts-client demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.