@spot-flow/checkout-inline-js 0.1.49-dev.3 → 0.1.49-dev.5

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.
@@ -1,112 +1,120 @@
1
- export declare const rawPrimaryGeneralData: {
2
- select_payment_method_text: string;
3
- powered: string;
4
- terms: string;
5
- privacy: string;
6
- contact: string;
7
- "error-occured": string;
8
- "transaction-limit": string;
9
- "merchant-email-required": string;
10
- "no-local-currency": string;
11
- "rate-not-found": string;
12
- "error-description": string;
13
- "something-wrong": string;
14
- "merchant-back": string;
15
- "test-card": string;
16
- amount: string;
17
- "to-pay": string;
18
- translating: string;
19
- };
20
- export declare const rawSecondaryGeneralData: {
21
- "try-again": string;
22
- "confirming-txn-status": string;
23
- "few-minutes": string;
24
- "please-wait-for": string;
25
- minutes: string;
26
- "what-is-this": string;
27
- "rate-reflect-note": string;
28
- "rate-please-note": string;
29
- "we-processed": string;
30
- charge: string;
31
- "payment-success": string;
32
- "payment-failed": string;
33
- "error-with-payment": string;
34
- "maximum-retries": string;
35
- "maximum-retries-desc": string;
36
- copy: string;
37
- copied: string;
38
- "copy-fail": string;
39
- "long-processing": string;
40
- "once-confirmed": string;
41
- "verify-payment": string;
42
- };
43
- export declare const rawCardData: {
44
- "enter-card-details": string;
45
- certified: string;
46
- "card-confirmation-one": string;
47
- "card-confirmation-two": string;
48
- "card-holder-name": string;
49
- "card-number": string;
50
- "continue-to": string;
51
- "card-number-invalid": string;
52
- "invalid-issue-card": string;
53
- "card-expired": string;
54
- "enable-popup": string;
55
- "enter-otp": string;
56
- "enter-pin": string;
57
- "cancel-payment": string;
58
- authorize: string;
59
- card: string;
60
- "proceed-3ds": string;
61
- };
62
- export declare const rawTestCardData: {
63
- expiry: string;
64
- "no-auth": string;
65
- address: string;
66
- city: string;
67
- state: string;
68
- country: string;
69
- number: string;
70
- zip: string;
71
- };
72
- export declare const rawTransferData: {
73
- "bank-name": string;
74
- beneficiary: string;
75
- "account-details": string;
76
- "error-fetching": string;
77
- "account-expired": string;
78
- "account-expired-desc": string;
79
- "transfer-header": string;
80
- "account-number": string;
81
- "made-transfer": string;
82
- "expiration-text": string;
83
- };
84
- export declare const rawMomoData: {
85
- "header-text": string;
86
- network: string;
87
- "cancel-payment": string;
88
- "generate-otp": string;
89
- certified: string;
90
- "select-network": string;
91
- "enter-otp": string;
92
- "enter-number": string;
93
- "continue-to": string;
94
- "unable-fetch": string;
95
- "valid-number-message": string;
96
- "enter-phone-otp": string;
97
- authorize: string;
98
- };
99
- export declare const rawEftData: {
100
- "unable-redirect-url": string;
101
- "payment-cancelled": string;
102
- "cancel-payment-desc": string;
103
- "authenticate-request": string;
104
- authenticate: string;
105
- };
106
- export declare const rawOpayData: {
107
- "unable-redirect-url": string;
108
- "payment-cancelled": string;
109
- "cancel-payment-desc": string;
110
- "authenticate-request": string;
111
- authenticate: string;
112
- };
1
+ export declare const rawPrimaryGeneralData: {
2
+ select_payment_method_text: string;
3
+ powered: string;
4
+ terms: string;
5
+ privacy: string;
6
+ contact: string;
7
+ "error-occured": string;
8
+ "transaction-limit": string;
9
+ "merchant-email-required": string;
10
+ "no-local-currency": string;
11
+ "rate-not-found": string;
12
+ "error-description": string;
13
+ "something-wrong": string;
14
+ "merchant-back": string;
15
+ "test-card": string;
16
+ amount: string;
17
+ "to-pay": string;
18
+ translating: string;
19
+ };
20
+ export declare const rawPaymentMethodTexts: {
21
+ "pay-card": string;
22
+ "pay-transfer": string;
23
+ "pay-momo": string;
24
+ "pay-eft": string;
25
+ "pay-with-opay": string;
26
+ };
27
+ export declare const rawSecondaryGeneralData: {
28
+ "try-again": string;
29
+ "confirming-txn-status": string;
30
+ "few-minutes": string;
31
+ "please-wait-for": string;
32
+ minutes: string;
33
+ "what-is-this": string;
34
+ "rate-reflect-note": string;
35
+ "rate-please-note": string;
36
+ "we-processed": string;
37
+ charge: string;
38
+ "payment-success": string;
39
+ "payment-failed": string;
40
+ "error-with-payment": string;
41
+ "maximum-retries": string;
42
+ "maximum-retries-desc": string;
43
+ copy: string;
44
+ copied: string;
45
+ "copy-fail": string;
46
+ "long-processing": string;
47
+ "once-confirmed": string;
48
+ "verify-payment": string;
49
+ };
50
+ export declare const rawCardData: {
51
+ "enter-card-details": string;
52
+ certified: string;
53
+ "card-confirmation-one": string;
54
+ "card-confirmation-two": string;
55
+ "card-holder-name": string;
56
+ "card-number": string;
57
+ "continue-to": string;
58
+ "card-number-invalid": string;
59
+ "invalid-issue-card": string;
60
+ "card-expired": string;
61
+ "enable-popup": string;
62
+ "enter-otp": string;
63
+ "enter-pin": string;
64
+ "cancel-payment": string;
65
+ authorize: string;
66
+ card: string;
67
+ "proceed-3ds": string;
68
+ };
69
+ export declare const rawTestCardData: {
70
+ expiry: string;
71
+ "no-auth": string;
72
+ address: string;
73
+ city: string;
74
+ state: string;
75
+ country: string;
76
+ number: string;
77
+ zip: string;
78
+ };
79
+ export declare const rawTransferData: {
80
+ "bank-name": string;
81
+ beneficiary: string;
82
+ "account-details": string;
83
+ "error-fetching": string;
84
+ "account-expired": string;
85
+ "account-expired-desc": string;
86
+ "transfer-header": string;
87
+ "account-number": string;
88
+ "made-transfer": string;
89
+ "expiration-text": string;
90
+ };
91
+ export declare const rawMomoData: {
92
+ "header-text": string;
93
+ network: string;
94
+ "cancel-payment": string;
95
+ "generate-otp": string;
96
+ certified: string;
97
+ "select-network": string;
98
+ "enter-otp": string;
99
+ "enter-number": string;
100
+ "continue-to": string;
101
+ "unable-fetch": string;
102
+ "valid-number-message": string;
103
+ "enter-phone-otp": string;
104
+ authorize: string;
105
+ "please-wait": string;
106
+ };
107
+ export declare const rawEftData: {
108
+ "unable-redirect-url": string;
109
+ "payment-cancelled": string;
110
+ "cancel-payment-desc": string;
111
+ "authenticate-request": string;
112
+ authenticate: string;
113
+ };
114
+ export declare const rawOpayData: {
115
+ "unable-redirect-url": string;
116
+ "payment-cancelled": string;
117
+ "cancel-payment-desc": string;
118
+ "authenticate-request": string;
119
+ authenticate: string;
120
+ };
@@ -1,17 +1,25 @@
1
- export declare const useTranslateText: (text: string | string[], targetLang?: string) => Promise<any>;
2
- export declare let translatedGeneralData: Record<string, string>;
3
- export declare const translateFunc: (targetLang?: string) => Promise<void>;
4
- export declare let translatedSecGeneralData: Record<string, string>;
5
- export declare const translateSecFunc: (targetLang?: string) => Promise<void>;
6
- export declare let translatedCardData: Record<string, string>;
7
- export declare const translateCardFunc: (targetLang?: string) => Promise<void>;
8
- export declare let translatedTestCardData: Record<string, string>;
9
- export declare const translateTestCardFunc: (targetLang?: string) => Promise<void>;
10
- export declare let translatedTransferData: Record<string, string>;
11
- export declare const translateTransferFunc: (targetLang?: string) => Promise<void>;
12
- export declare let translatedMomoData: Record<string, string>;
13
- export declare const translateMomoFunc: (targetLang?: string) => Promise<void>;
14
- export declare let translatedEftData: Record<string, string>;
15
- export declare const translateEftFunc: (targetLang?: string) => Promise<void>;
16
- export declare let translatedOpayData: Record<string, string>;
17
- export declare const translateOpayFunc: (targetLang?: string) => Promise<void>;
1
+ export declare const browserLanguage: string;
2
+ export declare const setCurrentLanguage: (lang: string) => void;
3
+ export declare const getCurrentLanguage: () => string;
4
+ export declare const computeCurrentLanguage: (currency: string, countryCode?: string) => void;
5
+ export declare const useTranslateText: (text: string | string[], targetLang?: string) => Promise<string>;
6
+ export declare let translatedPaymentMethodData: Record<string, string>;
7
+ export declare const translatePaymentMethods: (targetLang?: string) => Promise<Record<string, string>>;
8
+ export declare let translatedGeneralData: Record<string, string>;
9
+ export declare const translateFunc: (targetLang?: string) => Promise<void>;
10
+ export declare let translatedSecGeneralData: Record<string, string>;
11
+ export declare const translateSecFunc: (targetLang?: string) => Promise<void>;
12
+ export declare let translatedCardData: Record<string, string>;
13
+ export declare const translateCardFunc: (targetLang?: string) => Promise<void>;
14
+ export declare let translatedTestCardData: Record<string, string>;
15
+ export declare const translateTestCardFunc: (targetLang?: string) => Promise<void>;
16
+ export declare let translatedTransferData: Record<string, string>;
17
+ export declare const translateTransferFunc: (targetLang?: string) => Promise<void>;
18
+ export declare let translatedMomoData: Record<string, string>;
19
+ export declare const translateMomoFunc: (targetLang?: string) => Promise<void>;
20
+ export declare let translatedEftData: Record<string, string>;
21
+ export declare const translateEftFunc: (targetLang?: string) => Promise<void>;
22
+ export declare let translatedOpayData: Record<string, string>;
23
+ export declare const translateOpayFunc: (targetLang?: string) => Promise<void>;
24
+ export declare function getTranslation(key: string): string | undefined;
25
+ export declare function updateUI(): void;
@@ -0,0 +1,96 @@
1
+ type LoadingStyle = "skeleton" | "shimmer" | "spinner" | "fade" | "none";
2
+ type LoadingScope = "global" | "section" | "element";
3
+ interface SmartLoadingOptions {
4
+ defaultStyle?: LoadingStyle;
5
+ skeletonClass?: string;
6
+ shimmerClass?: string;
7
+ fadeOpacity?: number;
8
+ }
9
+ interface SectionLoadingConfig {
10
+ sectionId: string;
11
+ style: LoadingStyle;
12
+ translateFunctions: Array<() => Promise<void>>;
13
+ }
14
+ declare class SmartLoadingManager {
15
+ private options;
16
+ private activeSections;
17
+ private loadingElements;
18
+ private sectionConfigs;
19
+ constructor(options?: SmartLoadingOptions);
20
+ /**
21
+ * Register a section with its translation functions
22
+ * Only translates when the section is visible/active
23
+ */
24
+ registerSection(config: SectionLoadingConfig): void;
25
+ /**
26
+ * Translate a specific section when it becomes active
27
+ */
28
+ translateSection(sectionId: string): Promise<void>;
29
+ /**
30
+ * Start loading state for a specific section
31
+ */
32
+ private startSectionLoading;
33
+ /**
34
+ * Stop loading state for a specific section
35
+ */
36
+ private stopSectionLoading;
37
+ /**
38
+ * Update translated content for a specific section
39
+ */
40
+ private updateSectionUI;
41
+ /**
42
+ * Apply loading state to specific elements
43
+ */
44
+ applyLoadingStyle(element: Element, style?: LoadingStyle): void;
45
+ /**
46
+ * Remove loading state from element
47
+ */
48
+ removeLoadingStyle(element: Element): void;
49
+ private applySkeletonLoading;
50
+ private applyShimmerLoading;
51
+ private applySpinnerLoading;
52
+ private removeSpinner;
53
+ /**
54
+ * Apply loading to all translatable elements
55
+ */
56
+ startGlobalLoading(style?: LoadingStyle): void;
57
+ /**
58
+ * Remove loading from all elements
59
+ */
60
+ stopGlobalLoading(): void;
61
+ /**
62
+ * Apply custom loading to elements matching a selector
63
+ */
64
+ applyCustomLoading(selector: string, style: LoadingStyle): void;
65
+ /**
66
+ * Remove loading from elements matching a selector
67
+ */
68
+ removeCustomLoading(selector: string): void;
69
+ /**
70
+ * Apply different loading styles to different element types
71
+ */
72
+ startSmartLoading(config?: {
73
+ headings?: LoadingStyle;
74
+ paragraphs?: LoadingStyle;
75
+ buttons?: LoadingStyle;
76
+ inputs?: LoadingStyle;
77
+ default?: LoadingStyle;
78
+ container?: LoadingStyle;
79
+ }): void;
80
+ private injectStyles;
81
+ /**
82
+ * Check if any section is currently loading
83
+ */
84
+ isLoading(): boolean;
85
+ /**
86
+ * Get all currently loading sections
87
+ */
88
+ getLoadingSections(): string[];
89
+ /**
90
+ * Clear all loading states (useful for error recovery)
91
+ */
92
+ clearAll(): void;
93
+ }
94
+ declare const smartLoadingManager: SmartLoadingManager;
95
+ export default smartLoadingManager;
96
+ export { SmartLoadingManager, type LoadingStyle, type LoadingScope, type SectionLoadingConfig, };
@@ -0,0 +1,14 @@
1
+ type Language = string;
2
+ type TranslationText = string | string[];
3
+ type ObserverCallback = (language: Language) => void;
4
+ type Unsubscribe = () => void;
5
+ interface TranslationManagerInterface {
6
+ setLanguage: (lang: Language) => void;
7
+ getLanguage: () => Language;
8
+ translate: (text: string | string[], targetLang?: Language) => Promise<string[]>;
9
+ subscribe: (callback: ObserverCallback) => Unsubscribe;
10
+ translateRecord: <T extends Record<string, string>>(rawData: T, targetLang?: Language) => Promise<T>;
11
+ }
12
+ declare const TranslationManager: TranslationManagerInterface;
13
+ export default TranslationManager;
14
+ export type { Language, TranslationText, ObserverCallback, Unsubscribe, TranslationManagerInterface, };