@bloonio/lokotro-pay 1.1.2 → 1.2.1

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.1.2",
4
- "description": "Angular SDK for Lokotro Pay - Payment processing library with multiple payment methods",
3
+ "version": "1.2.1",
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": "index.d.ts",
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": "./index.d.ts",
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,10 @@ interface LokotroPaymentBody {
218
218
  cardHolderName?: string;
219
219
  merchant?: LokotroMerchantInfo;
220
220
  mastercardPaymentMethod?: 'HOSTED_SESSION' | 'DIRECT_CAPTURE';
221
+ /** Optional override of default currency resolution for the payment method. */
221
222
  transactionalCurrency?: string;
223
+ nativePayToken?: string;
224
+ nativePayTokenType?: string;
222
225
  metadata?: Record<string, unknown>;
223
226
  }
224
227
  /**
@@ -448,14 +451,34 @@ interface LokotroOtpResendRequest {
448
451
  paymentId?: string;
449
452
  }
450
453
  /**
451
- * Theme configuration
454
+ * Theme configuration for the checkout widget.
455
+ *
456
+ * All fields are optional — anything left undefined falls back to the
457
+ * package's clean white default (or inherits from the host app's CSS).
458
+ *
459
+ * Pass to `<lokotro-pay-checkout [themeConfig]="...">` to brand the widget:
460
+ * ```ts
461
+ * themeConfig: LokotroPayThemeConfig = {
462
+ * primaryColor: '#2563EB',
463
+ * secondaryColor: '#1E40AF',
464
+ * tertiaryColor: '#3BFBDA',
465
+ * };
466
+ * ```
452
467
  */
453
468
  interface LokotroPayThemeConfig {
469
+ /** Brand primary — primary buttons, focused inputs, key accents. */
454
470
  primaryColor?: string;
471
+ /** Brand secondary — gradient companion to primary, secondary actions. */
455
472
  secondaryColor?: string;
473
+ /** Brand tertiary — highlights, OTP focus rings, gradient end stop. */
474
+ tertiaryColor?: string;
475
+ /** @deprecated use `tertiaryColor`. Kept for backward compatibility. */
456
476
  accentColor?: string;
457
477
  backgroundColor?: string;
478
+ surfaceColor?: string;
458
479
  textColor?: string;
480
+ secondaryTextColor?: string;
481
+ borderColor?: string;
459
482
  errorColor?: string;
460
483
  successColor?: string;
461
484
  warningColor?: string;
@@ -572,15 +595,11 @@ interface LokotroPaymentState {
572
595
  }
573
596
  declare class LokotroPaymentService {
574
597
  private httpClient;
575
- /** Allowed domains for redirect URLs to prevent open redirect attacks */
576
- private static readonly ALLOWED_REDIRECT_DOMAINS;
577
598
  private stateSubject;
578
599
  state$: Observable<LokotroPaymentState>;
579
600
  private currentPaymentBody?;
580
601
  private mobileMoneyPollingTimer?;
581
602
  private mobileMoneyPollingAttempts;
582
- private pollingStop$;
583
- private pollingSubscription?;
584
603
  private static readonly MOBILE_MONEY_POLL_INTERVAL;
585
604
  private static readonly MOBILE_MONEY_MAX_ATTEMPTS;
586
605
  constructor(httpClient: LokotroHttpClientService);
@@ -709,16 +728,6 @@ declare class LokotroPaymentService {
709
728
  private getBoolean;
710
729
  private asRecord;
711
730
  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
731
  static ɵfac: i0.ɵɵFactoryDeclaration<LokotroPaymentService, never>;
723
732
  static ɵprov: i0.ɵɵInjectableDeclaration<LokotroPaymentService>;
724
733
  }
@@ -942,9 +951,10 @@ declare class LokotroLocalizationService {
942
951
  * Main checkout widget with clean, theme-based design
943
952
  */
944
953
 
945
- declare class LokotroPayCheckoutComponent implements OnInit, OnDestroy {
954
+ declare class LokotroPayCheckoutComponent implements OnInit, OnChanges, OnDestroy {
946
955
  private paymentService;
947
956
  localization: LokotroLocalizationService;
957
+ private elementRef;
948
958
  title?: string;
949
959
  titleStyle?: Record<string, string>;
950
960
  titleBackgroundColor?: string;
@@ -959,16 +969,24 @@ declare class LokotroPayCheckoutComponent implements OnInit, OnDestroy {
959
969
  error: EventEmitter<LokotroPayOnError>;
960
970
  closed: EventEmitter<void>;
961
971
  state?: LokotroPaymentState;
972
+ /** Default to light theme — payment widgets should look like clean white cards. */
962
973
  isDarkTheme: boolean;
963
974
  private static readonly MAX_RETRY_ATTEMPTS;
964
975
  private retryAttempts;
965
976
  private stateSubscription?;
966
- private readonly destroy$;
967
- constructor(paymentService: LokotroPaymentService, localization: LokotroLocalizationService);
977
+ constructor(paymentService: LokotroPaymentService, localization: LokotroLocalizationService, elementRef: ElementRef<HTMLElement>);
968
978
  /** Check if user has retries left */
969
979
  get hasRetriesLeft(): boolean;
970
980
  ngOnInit(): void;
981
+ ngOnChanges(changes: SimpleChanges): void;
971
982
  ngOnDestroy(): void;
983
+ /**
984
+ * Apply the merchant-provided theme as CSS custom properties on the
985
+ * checkout host element. Only sets variables for fields the merchant
986
+ * provided — undefined fields fall back to the package defaults defined
987
+ * in lokotro-pay.scss.
988
+ */
989
+ private applyThemeConfig;
972
990
  private initializeEnvironment;
973
991
  private initializeLocalization;
974
992
  private subscribeToState;
@@ -1104,6 +1122,9 @@ declare class LokotroProcessingComponent {
1104
1122
  /**
1105
1123
  * Lokotro Pay - Result Component
1106
1124
  * Success, Error, Warning, Info screens
1125
+ *
1126
+ * Designed for financial UX: clean white surface, prominent amount focal
1127
+ * on success, filled status badge, restrained transaction-detail panel.
1107
1128
  */
1108
1129
 
1109
1130
  type ResultType = 'success' | 'error' | 'warning' | 'info';
@@ -1134,6 +1155,7 @@ declare class LokotroResultComponent implements OnInit, OnDestroy {
1134
1155
  private clearCountdown;
1135
1156
  private triggerAutoRedirect;
1136
1157
  getCountdownProgress(): number;
1158
+ formatNumber(amount: number): string;
1137
1159
  formatAmount(amount: number, currency?: string): string;
1138
1160
  onPrimaryClick(): void;
1139
1161
  onSecondaryClick(): void;
@@ -1207,10 +1229,11 @@ declare class LokotroPayModule {
1207
1229
 
1208
1230
  /**
1209
1231
  * Lokotro Pay - Color Constants
1210
- * Angular version of the Flutter Lokotro Pay plugin colors
1211
- */
1212
- /**
1213
- * Color scheme for Lokotro Pay - matching Lokotroo App design
1232
+ *
1233
+ * Neutral white-background palette intended for payment surfaces.
1234
+ * Brand colors (primary/secondary/tertiary) default to slate so the
1235
+ * widget renders correctly with no themeConfig provided. Merchants
1236
+ * override at runtime via `<lokotro-pay-checkout [themeConfig]>`.
1214
1237
  */
1215
1238
  declare const LokotroPayColors: {
1216
1239
  primary: string;
@@ -1221,6 +1244,9 @@ declare const LokotroPayColors: {
1221
1244
  secondaryDark: string;
1222
1245
  secondaryLight: string;
1223
1246
  secondaryVariant: string;
1247
+ tertiary: string;
1248
+ tertiaryDark: string;
1249
+ tertiaryLight: string;
1224
1250
  accent: string;
1225
1251
  accentDark: string;
1226
1252
  accentLight: string;