@bloonio/lokotro-pay 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloonio/lokotro-pay",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Angular SDK for Lokotro Pay -
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Angular SDK for Lokotro Pay - Clean white-surface payment checkout with themeable brand colors and support for cards, mobile money, e-wallets, and more.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
7
7
|
"payment",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"url": "https://github.com/bloonio/lokotro-pay-angular.git"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@angular/common": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",
|
|
22
|
-
"@angular/core": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",
|
|
23
|
-
"@angular/forms": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",
|
|
21
|
+
"@angular/common": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0",
|
|
22
|
+
"@angular/core": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0",
|
|
23
|
+
"@angular/forms": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0",
|
|
24
24
|
"rxjs": "^7.8.0"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
@@ -28,14 +28,15 @@
|
|
|
28
28
|
},
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"module": "fesm2022/bloonio-lokotro-pay.mjs",
|
|
31
|
-
"typings": "
|
|
31
|
+
"typings": "types/bloonio-lokotro-pay.d.ts",
|
|
32
32
|
"exports": {
|
|
33
33
|
"./package.json": {
|
|
34
34
|
"default": "./package.json"
|
|
35
35
|
},
|
|
36
36
|
".": {
|
|
37
|
-
"types": "./
|
|
37
|
+
"types": "./types/bloonio-lokotro-pay.d.ts",
|
|
38
38
|
"default": "./fesm2022/bloonio-lokotro-pay.mjs"
|
|
39
39
|
}
|
|
40
|
-
}
|
|
40
|
+
},
|
|
41
|
+
"type": "module"
|
|
41
42
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { OnInit, OnDestroy, EventEmitter, InjectionToken, ModuleWithProviders } from '@angular/core';
|
|
2
|
+
import { OnInit, OnChanges, OnDestroy, EventEmitter, ElementRef, SimpleChanges, InjectionToken, ModuleWithProviders } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { FormGroup, FormBuilder } from '@angular/forms';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
@@ -218,7 +218,6 @@ interface LokotroPaymentBody {
|
|
|
218
218
|
cardHolderName?: string;
|
|
219
219
|
merchant?: LokotroMerchantInfo;
|
|
220
220
|
mastercardPaymentMethod?: 'HOSTED_SESSION' | 'DIRECT_CAPTURE';
|
|
221
|
-
transactionalCurrency?: string;
|
|
222
221
|
metadata?: Record<string, unknown>;
|
|
223
222
|
}
|
|
224
223
|
/**
|
|
@@ -448,14 +447,34 @@ interface LokotroOtpResendRequest {
|
|
|
448
447
|
paymentId?: string;
|
|
449
448
|
}
|
|
450
449
|
/**
|
|
451
|
-
* Theme configuration
|
|
450
|
+
* Theme configuration for the checkout widget.
|
|
451
|
+
*
|
|
452
|
+
* All fields are optional — anything left undefined falls back to the
|
|
453
|
+
* package's clean white default (or inherits from the host app's CSS).
|
|
454
|
+
*
|
|
455
|
+
* Pass to `<lokotro-pay-checkout [themeConfig]="...">` to brand the widget:
|
|
456
|
+
* ```ts
|
|
457
|
+
* themeConfig: LokotroPayThemeConfig = {
|
|
458
|
+
* primaryColor: '#2563EB',
|
|
459
|
+
* secondaryColor: '#1E40AF',
|
|
460
|
+
* tertiaryColor: '#3BFBDA',
|
|
461
|
+
* };
|
|
462
|
+
* ```
|
|
452
463
|
*/
|
|
453
464
|
interface LokotroPayThemeConfig {
|
|
465
|
+
/** Brand primary — primary buttons, focused inputs, key accents. */
|
|
454
466
|
primaryColor?: string;
|
|
467
|
+
/** Brand secondary — gradient companion to primary, secondary actions. */
|
|
455
468
|
secondaryColor?: string;
|
|
469
|
+
/** Brand tertiary — highlights, OTP focus rings, gradient end stop. */
|
|
470
|
+
tertiaryColor?: string;
|
|
471
|
+
/** @deprecated use `tertiaryColor`. Kept for backward compatibility. */
|
|
456
472
|
accentColor?: string;
|
|
457
473
|
backgroundColor?: string;
|
|
474
|
+
surfaceColor?: string;
|
|
458
475
|
textColor?: string;
|
|
476
|
+
secondaryTextColor?: string;
|
|
477
|
+
borderColor?: string;
|
|
459
478
|
errorColor?: string;
|
|
460
479
|
successColor?: string;
|
|
461
480
|
warningColor?: string;
|
|
@@ -572,15 +591,11 @@ interface LokotroPaymentState {
|
|
|
572
591
|
}
|
|
573
592
|
declare class LokotroPaymentService {
|
|
574
593
|
private httpClient;
|
|
575
|
-
/** Allowed domains for redirect URLs to prevent open redirect attacks */
|
|
576
|
-
private static readonly ALLOWED_REDIRECT_DOMAINS;
|
|
577
594
|
private stateSubject;
|
|
578
595
|
state$: Observable<LokotroPaymentState>;
|
|
579
596
|
private currentPaymentBody?;
|
|
580
597
|
private mobileMoneyPollingTimer?;
|
|
581
598
|
private mobileMoneyPollingAttempts;
|
|
582
|
-
private pollingStop$;
|
|
583
|
-
private pollingSubscription?;
|
|
584
599
|
private static readonly MOBILE_MONEY_POLL_INTERVAL;
|
|
585
600
|
private static readonly MOBILE_MONEY_MAX_ATTEMPTS;
|
|
586
601
|
constructor(httpClient: LokotroHttpClientService);
|
|
@@ -709,16 +724,6 @@ declare class LokotroPaymentService {
|
|
|
709
724
|
private getBoolean;
|
|
710
725
|
private asRecord;
|
|
711
726
|
private getRecordArray;
|
|
712
|
-
/**
|
|
713
|
-
* Validate that a redirect URL points to an allowed domain.
|
|
714
|
-
* Prevents open redirect attacks if the API response is compromised.
|
|
715
|
-
*/
|
|
716
|
-
private isValidRedirectUrl;
|
|
717
|
-
/**
|
|
718
|
-
* Full cleanup - call when the host component is destroyed.
|
|
719
|
-
* Addresses singleton state collision by ensuring polling and state are reset.
|
|
720
|
-
*/
|
|
721
|
-
destroy(): void;
|
|
722
727
|
static ɵfac: i0.ɵɵFactoryDeclaration<LokotroPaymentService, never>;
|
|
723
728
|
static ɵprov: i0.ɵɵInjectableDeclaration<LokotroPaymentService>;
|
|
724
729
|
}
|
|
@@ -942,9 +947,10 @@ declare class LokotroLocalizationService {
|
|
|
942
947
|
* Main checkout widget with clean, theme-based design
|
|
943
948
|
*/
|
|
944
949
|
|
|
945
|
-
declare class LokotroPayCheckoutComponent implements OnInit, OnDestroy {
|
|
950
|
+
declare class LokotroPayCheckoutComponent implements OnInit, OnChanges, OnDestroy {
|
|
946
951
|
private paymentService;
|
|
947
952
|
localization: LokotroLocalizationService;
|
|
953
|
+
private elementRef;
|
|
948
954
|
title?: string;
|
|
949
955
|
titleStyle?: Record<string, string>;
|
|
950
956
|
titleBackgroundColor?: string;
|
|
@@ -959,16 +965,24 @@ declare class LokotroPayCheckoutComponent implements OnInit, OnDestroy {
|
|
|
959
965
|
error: EventEmitter<LokotroPayOnError>;
|
|
960
966
|
closed: EventEmitter<void>;
|
|
961
967
|
state?: LokotroPaymentState;
|
|
968
|
+
/** Default to light theme — payment widgets should look like clean white cards. */
|
|
962
969
|
isDarkTheme: boolean;
|
|
963
970
|
private static readonly MAX_RETRY_ATTEMPTS;
|
|
964
971
|
private retryAttempts;
|
|
965
972
|
private stateSubscription?;
|
|
966
|
-
|
|
967
|
-
constructor(paymentService: LokotroPaymentService, localization: LokotroLocalizationService);
|
|
973
|
+
constructor(paymentService: LokotroPaymentService, localization: LokotroLocalizationService, elementRef: ElementRef<HTMLElement>);
|
|
968
974
|
/** Check if user has retries left */
|
|
969
975
|
get hasRetriesLeft(): boolean;
|
|
970
976
|
ngOnInit(): void;
|
|
977
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
971
978
|
ngOnDestroy(): void;
|
|
979
|
+
/**
|
|
980
|
+
* Apply the merchant-provided theme as CSS custom properties on the
|
|
981
|
+
* checkout host element. Only sets variables for fields the merchant
|
|
982
|
+
* provided — undefined fields fall back to the package defaults defined
|
|
983
|
+
* in lokotro-pay.scss.
|
|
984
|
+
*/
|
|
985
|
+
private applyThemeConfig;
|
|
972
986
|
private initializeEnvironment;
|
|
973
987
|
private initializeLocalization;
|
|
974
988
|
private subscribeToState;
|
|
@@ -1104,6 +1118,9 @@ declare class LokotroProcessingComponent {
|
|
|
1104
1118
|
/**
|
|
1105
1119
|
* Lokotro Pay - Result Component
|
|
1106
1120
|
* Success, Error, Warning, Info screens
|
|
1121
|
+
*
|
|
1122
|
+
* Designed for financial UX: clean white surface, prominent amount focal
|
|
1123
|
+
* on success, filled status badge, restrained transaction-detail panel.
|
|
1107
1124
|
*/
|
|
1108
1125
|
|
|
1109
1126
|
type ResultType = 'success' | 'error' | 'warning' | 'info';
|
|
@@ -1134,6 +1151,7 @@ declare class LokotroResultComponent implements OnInit, OnDestroy {
|
|
|
1134
1151
|
private clearCountdown;
|
|
1135
1152
|
private triggerAutoRedirect;
|
|
1136
1153
|
getCountdownProgress(): number;
|
|
1154
|
+
formatNumber(amount: number): string;
|
|
1137
1155
|
formatAmount(amount: number, currency?: string): string;
|
|
1138
1156
|
onPrimaryClick(): void;
|
|
1139
1157
|
onSecondaryClick(): void;
|
|
@@ -1207,10 +1225,11 @@ declare class LokotroPayModule {
|
|
|
1207
1225
|
|
|
1208
1226
|
/**
|
|
1209
1227
|
* Lokotro Pay - Color Constants
|
|
1210
|
-
*
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
*
|
|
1228
|
+
*
|
|
1229
|
+
* Neutral white-background palette intended for payment surfaces.
|
|
1230
|
+
* Brand colors (primary/secondary/tertiary) default to slate so the
|
|
1231
|
+
* widget renders correctly with no themeConfig provided. Merchants
|
|
1232
|
+
* override at runtime via `<lokotro-pay-checkout [themeConfig]>`.
|
|
1214
1233
|
*/
|
|
1215
1234
|
declare const LokotroPayColors: {
|
|
1216
1235
|
primary: string;
|
|
@@ -1221,6 +1240,9 @@ declare const LokotroPayColors: {
|
|
|
1221
1240
|
secondaryDark: string;
|
|
1222
1241
|
secondaryLight: string;
|
|
1223
1242
|
secondaryVariant: string;
|
|
1243
|
+
tertiary: string;
|
|
1244
|
+
tertiaryDark: string;
|
|
1245
|
+
tertiaryLight: string;
|
|
1224
1246
|
accent: string;
|
|
1225
1247
|
accentDark: string;
|
|
1226
1248
|
accentLight: string;
|