@methodfi/opal-react 0.0.1 → 0.0.2
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/README.md +20 -16
- package/dist/index.d.ts +1 -32
- package/dist/index.js +98 -507
- package/package.json +16 -30
- package/dist/components/OpalIframe.d.ts +0 -3
- package/dist/components/OpalIframe.d.ts.map +0 -1
- package/dist/components/OpalProvider.d.ts +0 -34
- package/dist/components/OpalProvider.d.ts.map +0 -1
- package/dist/constants/index.d.ts +0 -4
- package/dist/constants/index.d.ts.map +0 -1
- package/dist/hooks/useOpal.d.ts +0 -37
- package/dist/hooks/useOpal.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -620
- package/dist/index.mjs.map +0 -1
- package/dist/types/index.d.ts +0 -145
- package/dist/types/index.d.ts.map +0 -1
package/dist/types/index.d.ts
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
export type OpalEnvironment = 'local' | 'dev' | 'sandbox' | 'production';
|
|
2
|
-
export type OpalMode = 'opal' | 'card_connect' | 'account_verification' | string;
|
|
3
|
-
export type OpalEventObject = 'session' | 'card' | 'account' | 'bank' | string;
|
|
4
|
-
export type OpalEventAction = 'started' | 'errored' | 'exited' | 'verified' | 'completed' | string;
|
|
5
|
-
export type OpalEventType = 'opal.session.started' | 'opal.session.errored' | 'opal.session.exited' | 'card_connect.session.started' | 'card_connect.session.errored' | 'card_connect.card.verified' | 'account_verification.session.started' | 'account_verification.session.errored' | 'account_verification.account.verified' | string;
|
|
6
|
-
/**
|
|
7
|
-
* Structured event object matching Method's Opal event format
|
|
8
|
-
* Events follow the pattern: <mode>.<object>.<action>
|
|
9
|
-
*/
|
|
10
|
-
export interface OpalEvent {
|
|
11
|
-
/** The type of event, formatted as <mode>.<object>.<action> */
|
|
12
|
-
type: OpalEventType;
|
|
13
|
-
/** The operational mode associated with the event (e.g., 'card_connect') */
|
|
14
|
-
mode: OpalMode;
|
|
15
|
-
/** The object the event is related to (e.g., 'card', 'session') */
|
|
16
|
-
object: OpalEventObject;
|
|
17
|
-
/** The action that occurred (e.g., 'started', 'verified', 'errored') */
|
|
18
|
-
action: OpalEventAction;
|
|
19
|
-
/** The ISO 8601 timestamp of when the event occurred */
|
|
20
|
-
timestamp: string;
|
|
21
|
-
/** Additional context or details related to the event (varies by event type) */
|
|
22
|
-
data?: OpalEventData | null;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Error data structure for Opal session errors
|
|
26
|
-
*/
|
|
27
|
-
export interface OpalErrorData {
|
|
28
|
-
/** Error type identifier */
|
|
29
|
-
type: string;
|
|
30
|
-
/** Error sub-type for more specific categorization */
|
|
31
|
-
sub_type?: string;
|
|
32
|
-
/** Human-readable error message */
|
|
33
|
-
message: string;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Card verification event data
|
|
37
|
-
*/
|
|
38
|
-
export interface CardVerifiedEventData {
|
|
39
|
-
/** The account ID of the verified card */
|
|
40
|
-
account: string;
|
|
41
|
-
/** Additional metadata about the card verification */
|
|
42
|
-
metadata?: Record<string, any>;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Account verification event data
|
|
46
|
-
*/
|
|
47
|
-
export interface AccountVerifiedEventData {
|
|
48
|
-
/** The account ID of the verified account */
|
|
49
|
-
account: string;
|
|
50
|
-
/** Account verification details */
|
|
51
|
-
account_verification?: {
|
|
52
|
-
account_id: string;
|
|
53
|
-
type: string;
|
|
54
|
-
[key: string]: any;
|
|
55
|
-
};
|
|
56
|
-
/** Additional metadata */
|
|
57
|
-
metadata?: Record<string, any>;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Union type for all possible event data structures
|
|
61
|
-
*/
|
|
62
|
-
export type OpalEventData = OpalErrorData | CardVerifiedEventData | AccountVerifiedEventData | Record<string, any>;
|
|
63
|
-
/**
|
|
64
|
-
* Legacy error interface for backward compatibility
|
|
65
|
-
*/
|
|
66
|
-
export interface OpalError {
|
|
67
|
-
code: string;
|
|
68
|
-
message: string;
|
|
69
|
-
type: 'api_error' | 'connection_error' | 'validation_error';
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Configuration object for the useOpal hook
|
|
73
|
-
*/
|
|
74
|
-
export interface OpalConfig {
|
|
75
|
-
/** Environment to connect to (default: 'production') */
|
|
76
|
-
env?: OpalEnvironment;
|
|
77
|
-
/** Called when Opal opens */
|
|
78
|
-
onOpen?: () => void;
|
|
79
|
-
/** Called when Opal closes */
|
|
80
|
-
onExit?: (data?: any) => void;
|
|
81
|
-
/** Called for all Opal events with properly typed event object */
|
|
82
|
-
onEvent?: (event: OpalEvent) => void;
|
|
83
|
-
/** Called when an error occurs */
|
|
84
|
-
onError?: (error: OpalErrorData) => void;
|
|
85
|
-
/** Called on successful completion */
|
|
86
|
-
onSuccess?: (data: OpalSuccessData) => void;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Success data structure for completed Opal sessions
|
|
90
|
-
*/
|
|
91
|
-
export interface OpalSuccessData {
|
|
92
|
-
/** The session ID of the completed session */
|
|
93
|
-
sessionId: string;
|
|
94
|
-
/** Additional metadata from the session */
|
|
95
|
-
metadata?: Record<string, any>;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Options for opening an Opal session
|
|
99
|
-
*/
|
|
100
|
-
export interface OpalOpenOptions {
|
|
101
|
-
/** The Opal token (otkn_*) obtained from POST /opal/token */
|
|
102
|
-
token: string;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Legacy message interface - use OpalEvent instead
|
|
106
|
-
* @deprecated Use OpalEvent for better type safety
|
|
107
|
-
*/
|
|
108
|
-
export interface OpalMessage {
|
|
109
|
-
type: string;
|
|
110
|
-
mode: string;
|
|
111
|
-
object: string;
|
|
112
|
-
action: string;
|
|
113
|
-
timestamp: string;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Return type for the useOpal hook
|
|
117
|
-
*/
|
|
118
|
-
export interface UseOpalReturn {
|
|
119
|
-
/** Opens Opal with the provided token and options */
|
|
120
|
-
open: (options: OpalOpenOptions) => void;
|
|
121
|
-
/** Closes the current Opal session */
|
|
122
|
-
close: () => void;
|
|
123
|
-
/** Whether Opal is loaded and ready for interaction */
|
|
124
|
-
isReady: boolean;
|
|
125
|
-
/** Whether Opal is currently open */
|
|
126
|
-
isOpen: boolean;
|
|
127
|
-
/** Current error state, if any */
|
|
128
|
-
error: OpalError | OpalErrorData | null;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Props for the OpalIframe component
|
|
132
|
-
*/
|
|
133
|
-
export interface OpalIframeProps {
|
|
134
|
-
/** The Opal token */
|
|
135
|
-
token: string;
|
|
136
|
-
/** The full Opal URL with token */
|
|
137
|
-
opalUrl: string;
|
|
138
|
-
/** Callback for handling iframe messages */
|
|
139
|
-
onMessage: (message: OpalEvent) => void;
|
|
140
|
-
/** Callback for when the iframe should be closed */
|
|
141
|
-
onClose: () => void;
|
|
142
|
-
/** Optional styles for the iframe container */
|
|
143
|
-
style?: React.CSSProperties;
|
|
144
|
-
}
|
|
145
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,GAAG,YAAY,CAAC;AAGzE,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,cAAc,GAAG,sBAAsB,GAAG,MAAM,CAAC;AAGjF,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAG/E,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,GAAG,MAAM,CAAC;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