Skip to content

Commit

Permalink
[INTER-3686] Add support to render fastlane watermark (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
kfalkowski11 authored May 13, 2024
1 parent 898a084 commit cee15e4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/fastlane/fastlane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default class Fastlane {
public identity: IFastlaneInstance['identity'];
public FastlaneCardComponent: IFastlaneInstance['FastlaneCardComponent'];
public FastlanePaymentComponent: IFastlaneInstance['FastlanePaymentComponent'];
public FastlaneWatermarkComponent: IFastlaneInstance['FastlaneWatermarkComponent'];
setLocale: IFastlaneInstance['setLocale'];

constructor(
Expand All @@ -50,6 +51,7 @@ export default class Fastlane {
};
this.FastlaneCardComponent = instance.FastlaneCardComponent.bind(instance);
this.FastlanePaymentComponent = instance.FastlanePaymentComponent.bind(instance);
this.FastlaneWatermarkComponent = instance.FastlaneWatermarkComponent.bind(instance);
}

private showShippingAddressSelector = async () => {
Expand Down
9 changes: 9 additions & 0 deletions src/types/fastlane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export interface IFastlaneCardComponent {
}) => Promise<IFastlanePaymentToken>;
}

export interface IFastlaneWatermarkComponent {
render: (container: string) => null;
}

interface Field {
placeholder?: string;
prefill?: string;
Expand All @@ -59,6 +63,10 @@ export interface IFastlaneComponentOptions {
shippingAddress?: IFastlaneAddress;
}

export interface IFastlaneWatermarkOptions {
includeAdditionalInfo: boolean;
}

export interface IFastlaneAuthenticatedCustomerResult {
authenticationState: 'succeeded'|'failed'|'canceled'|'not_found';
profileData: {
Expand Down Expand Up @@ -97,6 +105,7 @@ export interface IFastlaneInstance {
};
FastlanePaymentComponent: (options: IFastlaneComponentOptions) => Promise<IFastlanePaymentComponent>;
FastlaneCardComponent: (options: Omit<IFastlaneComponentOptions, 'shippingAddress'>) => IFastlaneCardComponent;
FastlaneWatermarkComponent: (options: IFastlaneWatermarkOptions) => IFastlaneWatermarkComponent;
}

export interface IFastlaneOptions {
Expand Down
1 change: 1 addition & 0 deletions tests/fastlane/fastlane.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ describe('testing Fastlane class', () => {
setLocale: jest.fn(),
FastlaneCardComponent: jest.fn(),
FastlanePaymentComponent: jest.fn(),
FastlaneWatermarkComponent: jest.fn(),
identity: {
lookupCustomerByEmail: jest.fn(),
triggerAuthenticationFlow: jest.fn(),
Expand Down
4 changes: 4 additions & 0 deletions tests/fastlane/initFastlane.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ describe('testing initFastlane function', () => {
setLocale: jest.fn(),
FastlaneCardComponent: jest.fn(),
FastlanePaymentComponent: jest.fn(),
FastlaneWatermarkComponent: jest.fn(),
identity: {
lookupCustomerByEmail: jest.fn(),
},
Expand Down Expand Up @@ -143,6 +144,7 @@ describe('testing initFastlane function', () => {
setLocale: jest.fn(),
FastlaneCardComponent: jest.fn(),
FastlanePaymentComponent: jest.fn(),
FastlaneWatermarkComponent: jest.fn(),
identity: {
lookupCustomerByEmail: jest.fn(),
},
Expand Down Expand Up @@ -215,6 +217,7 @@ describe('testing initFastlane function', () => {
setLocale: jest.fn(),
FastlaneCardComponent: jest.fn(),
FastlanePaymentComponent: jest.fn(),
FastlaneWatermarkComponent: jest.fn(),
identity: {
lookupCustomerByEmail: jest.fn(),
},
Expand Down Expand Up @@ -261,6 +264,7 @@ describe('testing initFastlane function', () => {
setLocale: jest.fn(),
FastlaneCardComponent: jest.fn(),
FastlanePaymentComponent: jest.fn(),
FastlaneWatermarkComponent: jest.fn(),
identity: {
lookupCustomerByEmail: jest.fn(),
},
Expand Down

0 comments on commit cee15e4

Please sign in to comment.