0.0.2 • Published 24 days ago

@embedded-banking-fundr/pbl-uat v0.0.2

Weekly downloads
-
License
-
Repository
-
Last release
24 days ago

Rabobank Invoice Finance Component

Install

To incorporate the Rabobank Invoice Finance component into your project, install it using npm or yarn:

NPM

npm i @embedded-banking-fundr/rabobank-pbl@stable

Attributes/Properties

Use these properties to configure the Rabo widget and pass them to the widget via the initRaboWidget function. The initRaboWidget returns a cleanup function that should be run everytime the widgets gets removed from the dom. This is to make sure all data in the store gets reset and nothing stays behind.

PropertyDescriptionTypeExampleRequired
apiKeyIdentifier for the partner widget.String"DLS_Widget"x
partnerIdIdentifier for the partner widget.String"DLS_Widget"x
modeMode of the widget.String"sandbox" / "production"
contactDetailsContact person's details.Object
contactDetails.nameContact person's name.String"John"
contactDetails.phoneContact person's phone number.String"123-456-7890"
contactDetails.emailContact person's email address.String"johndoe@example.com"
contactDetails.surnameContact person's surname.String"Doe"
kvkNumberKVK number for the company.String"33236408"
campaignIdCampaign name.String
loanAmountDesired amount for the loanString"10.000"

Usage in Different Frameworks

REACT

import { initRaboWidget } from '@embedded-banking-fundr/rabobank-pbl';
const config = {
  apiKey: 'API_KEY',
  mode: 'sandbox' | 'production',
  partnerId: 'PARTNER_ID',
  //... other config props
}

const cleanupWidget = initRaboWidget(config);

const PblWrapper = () => {
  return (
    <rabobank-pbl></rabobank-pbl>
  );
};

export default PblWrapper;

ANGULAR

Update your app.module.ts to include "CUSTOM_ELEMENTS_SCHEMA":

import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
...

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule
    ],
    providers: [],
    bootstrap: [AppComponent],
    schemas:[CUSTOM_ELEMENTS_SCHEMA]
})

Then, define your component:

import { Component, ElementRef, Input, ViewChild } from '@angular/core';
import { initRaboWidget } from '@embedded-banking-fundr/rabobank-pbl';

@Component({
  selector: 'app-rabobank-pbl-wrapper',
  template:
    '<rabobank-pbl></rabobank-pbl>',
})
export class PblWrapperComponent {
  @ViewChild('rabobank-pbl') pbl: ElementRef | undefined;
  config = {
    apiKey: 'API_KEY',
    mode: 'sandbox' | 'production',
    partnerId: 'PARTNER_ID',
    //... other config props
  }
  constructor() {
    cleanupWidget = initRaboWidget(config);
  }
}

VUE

<script setup>
import { initRaboWidget } from '@embedded-banking-fundr/rabobank-pbl';
const config = {
  apiKey: 'API_KEY',
  mode: 'sandbox' | 'production',
  partnerId: 'PARTNER_ID',
  //... other config props
};
const cleanupWidget = initRaboWidget(config);
</script>

<template>  
  <rabobank-pbl></rabobank-pbl>
</template>

Styling

Adjust the component's appearance through CSS variables:

<style>
  rabobank-pbl {
    --rabobank-color-primary: #123456;
    --rabobank-color-secondary: #abcdef;
    --rabobank-svg-primary: #123456;
    --rabobank-svg-primary-light: rgba(18, 52, 86, 0.69);
    --rabobank-svg-secondary: #abcdef;
  }
</style>

Event Handling

The component emits several events that you can subscribe to for notifications about various interactions and states. Below is a list of events with their descriptions:

Subscribing to Events

To react to these events, you can subscribe to them anywhere in your application using the subscribeToEvent function. Here's how you can subscribe and handle an event:

import { subscribeToEvent } from '@embedded-banking-fundr/rabobank-pbl';

// Example: Subscribing to the 'started' event
const subscription = subscribeToEvent('started', (data) => {
  console.log('Invoice finance process started', data);
});

// Remember to unsubscribe when you're done listening to the event
subscription.unsubscribe();

Available Events and Data

Event NameDescriptionData
startedEmitted when user starts the journey.{ partnerId, caseId }
abandonEmitted when a user abandons the invoice process, or on time out{ partnerId, caseId, invoiceId? }
concludedEmitted when the invoice finance process is completed and the user closes the widget.{ partnerId, caseId, invoiceId? }
exitEmitted after both abandon and concluded.{ partnerId, caseId, invoiceId? }

This event handling system allows you to monitor and react to various states and interactions within the invoice finance process.