@ozura/elements 1.2.0-next.35 → 1.2.0-next.36

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.
@@ -0,0 +1,256 @@
1
+ /**
2
+ * @ozura/elements/vue — Vue 3 wrapper for OzElements.
3
+ *
4
+ * Provides a context-based provider that creates and manages an OzVault instance,
5
+ * five individual field components, and a composable to access createToken +
6
+ * readiness state from anywhere inside the provider tree.
7
+ *
8
+ * Quick start:
9
+ * @example
10
+ * ```vue
11
+ * <script setup lang="ts">
12
+ * import { OzElements, OzCardNumber, OzExpiry, OzCvv, useOzElements } from '@ozura/elements/vue';
13
+ * const { createToken, ready } = useOzElements();
14
+ * </script>
15
+ *
16
+ * <template>
17
+ * <OzElements pub-key="pk_live_..." session-url="/api/oz-session">
18
+ * <OzCardNumber />
19
+ * <OzExpiry />
20
+ * <OzCvv />
21
+ * <button :disabled="!ready" @click="createToken()">Pay</button>
22
+ * </OzElements>
23
+ * </template>
24
+ * ```
25
+ */
26
+ import { type Ref, type PropType, type ComputedRef } from 'vue';
27
+ import type { TokenizeOptions, TokenResponse, BankTokenizeOptions, BankTokenResponse, FontSource, Appearance } from '../types';
28
+ export interface OzElementsProps {
29
+ pubKey: string;
30
+ sessionUrl?: string;
31
+ getSessionKey?: (sessionId: string) => Promise<string>;
32
+ frameBaseUrl?: string;
33
+ fonts?: FontSource[];
34
+ appearance?: Appearance;
35
+ loadTimeoutMs?: number;
36
+ debug?: boolean;
37
+ }
38
+ /**
39
+ * Creates and owns an OzVault instance for the lifetime of this component.
40
+ * All field components must be rendered inside this provider.
41
+ */
42
+ export declare const OzElements: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
43
+ pubKey: {
44
+ type: StringConstructor;
45
+ required: true;
46
+ };
47
+ sessionUrl: {
48
+ type: StringConstructor;
49
+ default: undefined;
50
+ };
51
+ getSessionKey: {
52
+ type: PropType<(sessionId: string) => Promise<string>>;
53
+ default: undefined;
54
+ };
55
+ frameBaseUrl: {
56
+ type: StringConstructor;
57
+ default: undefined;
58
+ };
59
+ fonts: {
60
+ type: PropType<FontSource[]>;
61
+ default: undefined;
62
+ };
63
+ appearance: {
64
+ type: PropType<Appearance>;
65
+ default: undefined;
66
+ };
67
+ loadTimeoutMs: {
68
+ type: NumberConstructor;
69
+ default: undefined;
70
+ };
71
+ debug: {
72
+ type: BooleanConstructor;
73
+ default: undefined;
74
+ };
75
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
76
+ [key: string]: any;
77
+ }>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "ready"[], "ready", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
78
+ pubKey: {
79
+ type: StringConstructor;
80
+ required: true;
81
+ };
82
+ sessionUrl: {
83
+ type: StringConstructor;
84
+ default: undefined;
85
+ };
86
+ getSessionKey: {
87
+ type: PropType<(sessionId: string) => Promise<string>>;
88
+ default: undefined;
89
+ };
90
+ frameBaseUrl: {
91
+ type: StringConstructor;
92
+ default: undefined;
93
+ };
94
+ fonts: {
95
+ type: PropType<FontSource[]>;
96
+ default: undefined;
97
+ };
98
+ appearance: {
99
+ type: PropType<Appearance>;
100
+ default: undefined;
101
+ };
102
+ loadTimeoutMs: {
103
+ type: NumberConstructor;
104
+ default: undefined;
105
+ };
106
+ debug: {
107
+ type: BooleanConstructor;
108
+ default: undefined;
109
+ };
110
+ }>> & Readonly<{
111
+ onReady?: ((...args: any[]) => any) | undefined;
112
+ }>, {
113
+ debug: boolean;
114
+ fonts: FontSource[];
115
+ loadTimeoutMs: number;
116
+ frameBaseUrl: string;
117
+ sessionUrl: string;
118
+ getSessionKey: (sessionId: string) => Promise<string>;
119
+ appearance: Appearance;
120
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
121
+ export interface UseOzElementsReturn {
122
+ /**
123
+ * Tokenizes all mounted card fields. Resolves with a token and cvcSession
124
+ * that can be passed to the Ozura Pay API endpoint.
125
+ */
126
+ createToken: (options?: TokenizeOptions) => Promise<TokenResponse>;
127
+ /**
128
+ * Tokenizes mounted bank account fields (accountNumber + routingNumber).
129
+ */
130
+ createBankToken: (options?: BankTokenizeOptions) => Promise<BankTokenResponse>;
131
+ /**
132
+ * True when the vault tokenizer and all mounted field iframes are ready.
133
+ * Gate your submit button on this.
134
+ */
135
+ ready: ComputedRef<boolean>;
136
+ /**
137
+ * Non-null when OzVault.create() rejected during initialization.
138
+ */
139
+ initError: Ref<Error | null>;
140
+ /**
141
+ * Number of successful tokenizations since the last session refresh.
142
+ */
143
+ tokenizeCount: Ref<number>;
144
+ /**
145
+ * Clears all mounted element fields without destroying the vault.
146
+ */
147
+ reset: () => void;
148
+ }
149
+ /**
150
+ * Returns createToken, createBankToken, ready, initError, tokenizeCount, and reset.
151
+ * Must be called from inside an <OzElements> provider tree.
152
+ *
153
+ * @throws {Error} if called outside an <OzElements> provider
154
+ */
155
+ export declare function useOzElements(): UseOzElementsReturn;
156
+ /** Card number field. Emits `change` (ElementChangeEvent), `focus`, `blur`. */
157
+ export declare const OzCardNumber: import("vue").DefineComponent<{
158
+ placeholder?: string | undefined;
159
+ disabled?: boolean | undefined;
160
+ style?: import("../types").ElementStyleConfig | undefined;
161
+ }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
162
+ [key: string]: any;
163
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("blur" | "change" | "focus")[], "blur" | "change" | "focus", import("vue").PublicProps, Readonly<{
164
+ placeholder?: string | undefined;
165
+ disabled?: boolean | undefined;
166
+ style?: import("../types").ElementStyleConfig | undefined;
167
+ }> & Readonly<{
168
+ onBlur?: ((...args: any[]) => any) | undefined;
169
+ onChange?: ((...args: any[]) => any) | undefined;
170
+ onFocus?: ((...args: any[]) => any) | undefined;
171
+ }>, {
172
+ style: import("../types").ElementStyleConfig | undefined;
173
+ placeholder: string;
174
+ disabled: boolean;
175
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
176
+ /** Expiry date field. Emits `change` (ElementChangeEvent), `focus`, `blur`. */
177
+ export declare const OzExpiry: import("vue").DefineComponent<{
178
+ placeholder?: string | undefined;
179
+ disabled?: boolean | undefined;
180
+ style?: import("../types").ElementStyleConfig | undefined;
181
+ }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
182
+ [key: string]: any;
183
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("blur" | "change" | "focus")[], "blur" | "change" | "focus", import("vue").PublicProps, Readonly<{
184
+ placeholder?: string | undefined;
185
+ disabled?: boolean | undefined;
186
+ style?: import("../types").ElementStyleConfig | undefined;
187
+ }> & Readonly<{
188
+ onBlur?: ((...args: any[]) => any) | undefined;
189
+ onChange?: ((...args: any[]) => any) | undefined;
190
+ onFocus?: ((...args: any[]) => any) | undefined;
191
+ }>, {
192
+ style: import("../types").ElementStyleConfig | undefined;
193
+ placeholder: string;
194
+ disabled: boolean;
195
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
196
+ /** CVV / CVC field. Emits `change` (ElementChangeEvent), `focus`, `blur`. */
197
+ export declare const OzCvv: import("vue").DefineComponent<{
198
+ placeholder?: string | undefined;
199
+ disabled?: boolean | undefined;
200
+ style?: import("../types").ElementStyleConfig | undefined;
201
+ }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
202
+ [key: string]: any;
203
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("blur" | "change" | "focus")[], "blur" | "change" | "focus", import("vue").PublicProps, Readonly<{
204
+ placeholder?: string | undefined;
205
+ disabled?: boolean | undefined;
206
+ style?: import("../types").ElementStyleConfig | undefined;
207
+ }> & Readonly<{
208
+ onBlur?: ((...args: any[]) => any) | undefined;
209
+ onChange?: ((...args: any[]) => any) | undefined;
210
+ onFocus?: ((...args: any[]) => any) | undefined;
211
+ }>, {
212
+ style: import("../types").ElementStyleConfig | undefined;
213
+ placeholder: string;
214
+ disabled: boolean;
215
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
216
+ /** Bank account number field. Emits `change` (ElementChangeEvent), `focus`, `blur`. */
217
+ export declare const OzBankAccountNumber: import("vue").DefineComponent<{
218
+ placeholder?: string | undefined;
219
+ disabled?: boolean | undefined;
220
+ style?: import("../types").ElementStyleConfig | undefined;
221
+ }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
222
+ [key: string]: any;
223
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("blur" | "change" | "focus")[], "blur" | "change" | "focus", import("vue").PublicProps, Readonly<{
224
+ placeholder?: string | undefined;
225
+ disabled?: boolean | undefined;
226
+ style?: import("../types").ElementStyleConfig | undefined;
227
+ }> & Readonly<{
228
+ onBlur?: ((...args: any[]) => any) | undefined;
229
+ onChange?: ((...args: any[]) => any) | undefined;
230
+ onFocus?: ((...args: any[]) => any) | undefined;
231
+ }>, {
232
+ style: import("../types").ElementStyleConfig | undefined;
233
+ placeholder: string;
234
+ disabled: boolean;
235
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
236
+ /** Bank routing number field. Emits `change` (ElementChangeEvent), `focus`, `blur`. */
237
+ export declare const OzBankRoutingNumber: import("vue").DefineComponent<{
238
+ placeholder?: string | undefined;
239
+ disabled?: boolean | undefined;
240
+ style?: import("../types").ElementStyleConfig | undefined;
241
+ }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
242
+ [key: string]: any;
243
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("blur" | "change" | "focus")[], "blur" | "change" | "focus", import("vue").PublicProps, Readonly<{
244
+ placeholder?: string | undefined;
245
+ disabled?: boolean | undefined;
246
+ style?: import("../types").ElementStyleConfig | undefined;
247
+ }> & Readonly<{
248
+ onBlur?: ((...args: any[]) => any) | undefined;
249
+ onChange?: ((...args: any[]) => any) | undefined;
250
+ onFocus?: ((...args: any[]) => any) | undefined;
251
+ }>, {
252
+ style: import("../types").ElementStyleConfig | undefined;
253
+ placeholder: string;
254
+ disabled: boolean;
255
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
256
+ export type { ElementChangeEvent, TokenizeOptions, TokenResponse, BankTokenizeOptions, BankTokenResponse, Appearance, FontSource, } from '../types';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Shared postMessage protocol constants.
3
+ *
4
+ * PROTOCOL_VERSION must be incremented any time a breaking change is made to
5
+ * the postMessage message shape (new required fields, renamed types, removed
6
+ * fields, changed semantics). The SDK reads this value from OZ_FRAME_READY
7
+ * messages and warns when the frame and SDK are out of sync.
8
+ *
9
+ * Non-breaking additions (new optional fields, new message types that old
10
+ * frames can safely ignore) do NOT require a version bump.
11
+ */
12
+ export declare const PROTOCOL_VERSION = 1;