@andco/protocol 0.0.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.
Files changed (126) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +44 -0
  3. package/dist/authorization-preparation.d.ts +754 -0
  4. package/dist/authorization-preparation.d.ts.map +1 -0
  5. package/dist/authorization-preparation.js +187 -0
  6. package/dist/authorization.d.ts +99 -0
  7. package/dist/authorization.d.ts.map +1 -0
  8. package/dist/authorization.js +227 -0
  9. package/dist/automatic-charge.d.ts +314 -0
  10. package/dist/automatic-charge.d.ts.map +1 -0
  11. package/dist/automatic-charge.js +126 -0
  12. package/dist/bank-account-authorization.d.ts +6 -0
  13. package/dist/bank-account-authorization.d.ts.map +1 -0
  14. package/dist/bank-account-authorization.js +13 -0
  15. package/dist/callback-state.d.ts +10 -0
  16. package/dist/callback-state.d.ts.map +1 -0
  17. package/dist/callback-state.js +28 -0
  18. package/dist/consent.d.ts +48 -0
  19. package/dist/consent.d.ts.map +1 -0
  20. package/dist/consent.js +110 -0
  21. package/dist/constants.d.ts +17 -0
  22. package/dist/constants.d.ts.map +1 -0
  23. package/dist/constants.js +20 -0
  24. package/dist/errors.d.ts +70 -0
  25. package/dist/errors.d.ts.map +1 -0
  26. package/dist/errors.js +80 -0
  27. package/dist/index.d.ts +33 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +32 -0
  30. package/dist/intent-input.d.ts +637 -0
  31. package/dist/intent-input.d.ts.map +1 -0
  32. package/dist/intent-input.js +101 -0
  33. package/dist/messages/authorization-response.d.ts +12 -0
  34. package/dist/messages/authorization-response.d.ts.map +1 -0
  35. package/dist/messages/authorization-response.js +9 -0
  36. package/dist/messages/base.d.ts +31 -0
  37. package/dist/messages/base.d.ts.map +1 -0
  38. package/dist/messages/base.js +30 -0
  39. package/dist/messages/click.d.ts +11 -0
  40. package/dist/messages/click.d.ts.map +1 -0
  41. package/dist/messages/click.js +8 -0
  42. package/dist/messages/error.d.ts +13 -0
  43. package/dist/messages/error.d.ts.map +1 -0
  44. package/dist/messages/error.js +9 -0
  45. package/dist/messages/index.d.ts +75 -0
  46. package/dist/messages/index.d.ts.map +1 -0
  47. package/dist/messages/index.js +27 -0
  48. package/dist/messages/init.d.ts +9 -0
  49. package/dist/messages/init.d.ts.map +1 -0
  50. package/dist/messages/init.js +6 -0
  51. package/dist/messages/popup.d.ts +108 -0
  52. package/dist/messages/popup.d.ts.map +1 -0
  53. package/dist/messages/popup.js +62 -0
  54. package/dist/messages/ready.d.ts +9 -0
  55. package/dist/messages/ready.d.ts.map +1 -0
  56. package/dist/messages/ready.js +6 -0
  57. package/dist/messages/set-preferences.d.ts +16 -0
  58. package/dist/messages/set-preferences.d.ts.map +1 -0
  59. package/dist/messages/set-preferences.js +20 -0
  60. package/dist/miniapp-icon.d.ts +4 -0
  61. package/dist/miniapp-icon.d.ts.map +1 -0
  62. package/dist/miniapp-icon.js +68 -0
  63. package/dist/miniapp-manifest.d.ts +71 -0
  64. package/dist/miniapp-manifest.d.ts.map +1 -0
  65. package/dist/miniapp-manifest.js +46 -0
  66. package/dist/native-copy.d.ts +7 -0
  67. package/dist/native-copy.d.ts.map +1 -0
  68. package/dist/native-copy.js +436 -0
  69. package/dist/native-intent.d.ts +402 -0
  70. package/dist/native-intent.d.ts.map +1 -0
  71. package/dist/native-intent.js +410 -0
  72. package/dist/native.d.ts +55 -0
  73. package/dist/native.d.ts.map +1 -0
  74. package/dist/native.js +53 -0
  75. package/dist/oauth.d.ts +4 -0
  76. package/dist/oauth.d.ts.map +1 -0
  77. package/dist/oauth.js +3 -0
  78. package/dist/release.d.ts +3 -0
  79. package/dist/release.d.ts.map +1 -0
  80. package/dist/release.js +2 -0
  81. package/dist/scopes.d.ts +35 -0
  82. package/dist/scopes.d.ts.map +1 -0
  83. package/dist/scopes.js +15 -0
  84. package/dist/server.d.ts +9 -0
  85. package/dist/server.d.ts.map +1 -0
  86. package/dist/server.js +14 -0
  87. package/dist/transport/financial-events.d.ts +134 -0
  88. package/dist/transport/financial-events.d.ts.map +1 -0
  89. package/dist/transport/financial-events.js +120 -0
  90. package/dist/transport/generated/oauth-api.d.ts +1685 -0
  91. package/dist/transport/generated/oauth-api.d.ts.map +1 -0
  92. package/dist/transport/generated/oauth-api.js +5 -0
  93. package/dist/transport/index.d.ts +6 -0
  94. package/dist/transport/index.d.ts.map +1 -0
  95. package/dist/transport/index.js +5 -0
  96. package/dist/transport/intents.d.ts +81 -0
  97. package/dist/transport/intents.d.ts.map +1 -0
  98. package/dist/transport/intents.js +286 -0
  99. package/dist/transport/rest.d.ts +76 -0
  100. package/dist/transport/rest.d.ts.map +1 -0
  101. package/dist/transport/rest.js +48 -0
  102. package/dist/transport/runtime.d.ts +8 -0
  103. package/dist/transport/runtime.d.ts.map +1 -0
  104. package/dist/transport/runtime.js +16 -0
  105. package/dist/transport/webhooks.d.ts +27 -0
  106. package/dist/transport/webhooks.d.ts.map +1 -0
  107. package/dist/transport/webhooks.js +68 -0
  108. package/dist/urls.d.ts +71 -0
  109. package/dist/urls.d.ts.map +1 -0
  110. package/dist/urls.js +132 -0
  111. package/dist/userinfo.d.ts +11 -0
  112. package/dist/userinfo.d.ts.map +1 -0
  113. package/dist/userinfo.js +9 -0
  114. package/dist/utils.d.ts +20 -0
  115. package/dist/utils.d.ts.map +1 -0
  116. package/dist/utils.js +45 -0
  117. package/dist/webhook-input.d.ts +22 -0
  118. package/dist/webhook-input.d.ts.map +1 -0
  119. package/dist/webhook-input.js +11 -0
  120. package/dist/webhook-signature.d.ts +54 -0
  121. package/dist/webhook-signature.d.ts.map +1 -0
  122. package/dist/webhook-signature.js +74 -0
  123. package/dist/window-features.d.ts +28 -0
  124. package/dist/window-features.d.ts.map +1 -0
  125. package/dist/window-features.js +55 -0
  126. package/package.json +63 -0
@@ -0,0 +1,402 @@
1
+ import * as v from "valibot";
2
+ /** Authenticated Host presentation; bank commands and account ownership remain on Platform. */
3
+ export declare const AndCoNativeIntentPreparationSchema: v.ObjectSchema<{
4
+ readonly intent: v.VariantSchema<"type", [v.ObjectSchema<{
5
+ readonly type: v.LiteralSchema<"deposit", undefined>;
6
+ readonly amount: v.NullableSchema<v.ObjectSchema<{
7
+ readonly confirmed: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
8
+ readonly frozen_at: v.NullableSchema<v.StringSchema<undefined>, undefined>;
9
+ readonly currency: v.LiteralSchema<"CLP", undefined>;
10
+ readonly suggested: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
11
+ readonly editable: v.BooleanSchema<undefined>;
12
+ }, undefined>, undefined>;
13
+ readonly destination: v.ObjectSchema<{
14
+ readonly bank_account_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
15
+ readonly account_holder_id: v.StringSchema<undefined>;
16
+ readonly account_holder_name: v.StringSchema<undefined>;
17
+ readonly account_kind: v.PicklistSchema<["checking", "debit", "savings"], undefined>;
18
+ readonly account_number: v.StringSchema<undefined>;
19
+ readonly bank_id: v.StringSchema<undefined>;
20
+ readonly country: v.LiteralSchema<"CL", undefined>;
21
+ }, undefined>;
22
+ readonly progress: v.ObjectSchema<{
23
+ readonly credited: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
24
+ readonly remaining: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
25
+ }, undefined>;
26
+ readonly closure: v.NullableSchema<v.ObjectSchema<{
27
+ readonly closed_at: v.StringSchema<undefined>;
28
+ readonly total: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
29
+ }, undefined>, undefined>;
30
+ readonly completion: v.NullableSchema<v.ObjectSchema<{
31
+ readonly completed_at: v.StringSchema<undefined>;
32
+ readonly total: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
33
+ }, undefined>, undefined>;
34
+ readonly transactions: v.ArraySchema<v.ObjectSchema<{
35
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
36
+ readonly received_at: v.StringSchema<undefined>;
37
+ readonly note: v.NullableSchema<v.StringSchema<undefined>, undefined>;
38
+ readonly outcome: v.PicklistSchema<["credited", "reversed"], undefined>;
39
+ readonly receipt_time_source: v.PicklistSchema<["bank_timestamp", "unknown"], undefined>;
40
+ readonly account_holder_name_masked: v.StringSchema<undefined>;
41
+ readonly account_number_masked: v.StringSchema<undefined>;
42
+ readonly bank_id: v.StringSchema<undefined>;
43
+ readonly amount: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
44
+ readonly currency: v.LiteralSchema<"CLP", undefined>;
45
+ }, undefined>, undefined>;
46
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
47
+ readonly status: v.PicklistSchema<["requires_action", "processing.confirmed", "processing.settling", "processing.reversing", "processing.reconciling", "succeeded", "completed", "closed", "failed", "failed.insufficient_funds", "cancelled", "expired"], undefined>;
48
+ readonly fee: v.ObjectSchema<{
49
+ readonly currency: v.LiteralSchema<"CLP", undefined>;
50
+ readonly amount: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
51
+ }, undefined>;
52
+ readonly note: v.OptionalSchema<v.ObjectSchema<{
53
+ readonly suggested: v.StringSchema<undefined>;
54
+ readonly editable: v.BooleanSchema<undefined>;
55
+ }, undefined>, undefined>;
56
+ readonly expires_at: v.NullableSchema<v.StringSchema<undefined>, undefined>;
57
+ readonly server_time: v.StringSchema<undefined>;
58
+ readonly can_confirm: v.BooleanSchema<undefined>;
59
+ readonly project: v.ObjectSchema<{
60
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
61
+ readonly name: v.StringSchema<undefined>;
62
+ }, undefined>;
63
+ }, undefined>, v.ObjectSchema<{
64
+ readonly type: v.LiteralSchema<"withdrawal", undefined>;
65
+ readonly beneficiary: v.ObjectSchema<{
66
+ readonly editable: v.BooleanSchema<undefined>;
67
+ readonly account_holder_id: v.StringSchema<undefined>;
68
+ readonly account_holder_name: v.StringSchema<undefined>;
69
+ readonly account_kind: v.PicklistSchema<["checking", "debit", "savings"], undefined>;
70
+ readonly account_number: v.StringSchema<undefined>;
71
+ readonly bank_id: v.StringSchema<undefined>;
72
+ readonly country: v.LiteralSchema<"CL", undefined>;
73
+ }, undefined>;
74
+ readonly source: v.OptionalSchema<v.UnionSchema<[v.ObjectSchema<{
75
+ readonly bank_account_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
76
+ }, undefined>, v.ObjectSchema<{
77
+ readonly account_holder_id: v.StringSchema<undefined>;
78
+ readonly account_holder_name: v.StringSchema<undefined>;
79
+ readonly account_kind: v.PicklistSchema<["checking", "debit", "savings"], undefined>;
80
+ readonly account_number: v.StringSchema<undefined>;
81
+ readonly bank_id: v.StringSchema<undefined>;
82
+ readonly country: v.LiteralSchema<"CL", undefined>;
83
+ }, undefined>], undefined>, undefined>;
84
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
85
+ readonly status: v.PicklistSchema<["requires_action", "processing.confirmed", "processing.settling", "processing.reversing", "processing.reconciling", "succeeded", "completed", "closed", "failed", "failed.insufficient_funds", "cancelled", "expired"], undefined>;
86
+ readonly amount: v.ObjectSchema<{
87
+ readonly currency: v.LiteralSchema<"CLP", undefined>;
88
+ readonly suggested: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
89
+ readonly editable: v.BooleanSchema<undefined>;
90
+ }, undefined>;
91
+ readonly fee: v.ObjectSchema<{
92
+ readonly currency: v.LiteralSchema<"CLP", undefined>;
93
+ readonly amount: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
94
+ }, undefined>;
95
+ readonly note: v.OptionalSchema<v.ObjectSchema<{
96
+ readonly suggested: v.StringSchema<undefined>;
97
+ readonly editable: v.BooleanSchema<undefined>;
98
+ }, undefined>, undefined>;
99
+ readonly expires_at: v.NullableSchema<v.StringSchema<undefined>, undefined>;
100
+ readonly server_time: v.StringSchema<undefined>;
101
+ readonly can_confirm: v.BooleanSchema<undefined>;
102
+ readonly project: v.ObjectSchema<{
103
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
104
+ readonly name: v.StringSchema<undefined>;
105
+ }, undefined>;
106
+ }, undefined>], undefined>;
107
+ readonly sources: v.ArraySchema<v.ObjectSchema<{
108
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
109
+ readonly number: v.StringSchema<undefined>;
110
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
111
+ }, undefined>, undefined>;
112
+ readonly checklist: v.NullableSchema<v.ObjectSchema<{
113
+ readonly accountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
114
+ readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>;
115
+ readonly credits: v.ArraySchema<v.ObjectSchema<{
116
+ readonly movementId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
117
+ readonly transactionId: v.StringSchema<undefined>;
118
+ readonly amount: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
119
+ readonly receivedAt: v.StringSchema<undefined>;
120
+ readonly note: v.NullableSchema<v.StringSchema<undefined>, undefined>;
121
+ readonly assignedIntentId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, undefined>;
122
+ readonly assignedProjectName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
123
+ readonly unavailableReason: v.NullableSchema<v.StringSchema<undefined>, undefined>;
124
+ }, undefined>, undefined>;
125
+ readonly otherRequests: v.ArraySchema<v.ObjectSchema<{
126
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
127
+ readonly projectName: v.StringSchema<undefined>;
128
+ readonly target: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
129
+ }, undefined>, undefined>;
130
+ }, undefined>, undefined>;
131
+ readonly funding: v.OptionalSchema<v.ObjectSchema<{
132
+ readonly commandId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
133
+ readonly pendingSourceId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, undefined>;
134
+ readonly pendingAmount: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
135
+ readonly pendingNote: v.NullableSchema<v.StringSchema<undefined>, undefined>;
136
+ readonly completed: v.BooleanSchema<undefined>;
137
+ }, undefined>, undefined>;
138
+ readonly confirmedNote: v.NullableSchema<v.StringSchema<undefined>, undefined>;
139
+ readonly sourceEditable: v.BooleanSchema<undefined>;
140
+ readonly banks: v.ArraySchema<v.ObjectSchema<{
141
+ readonly id: v.StringSchema<undefined>;
142
+ readonly name: v.StringSchema<undefined>;
143
+ }, undefined>, undefined>;
144
+ readonly retryable: v.BooleanSchema<undefined>;
145
+ readonly developmentDeposit: v.BooleanSchema<undefined>;
146
+ }, undefined>;
147
+ export type AndCoNativeIntentPreparation = v.InferOutput<typeof AndCoNativeIntentPreparationSchema>;
148
+ /** Explicit commands supported by the current web presentation. */
149
+ export declare const AndCoNativeIntentCommandSchema: v.VariantSchema<"action", [v.StrictObjectSchema<{
150
+ readonly action: v.LiteralSchema<"fund_deposit", undefined>;
151
+ readonly commandId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, undefined>;
152
+ readonly sourceAccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
153
+ readonly amount: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, number, undefined>]>;
154
+ readonly note: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 140, undefined>]>, undefined>;
155
+ }, undefined>, v.StrictObjectSchema<{
156
+ readonly action: v.LiteralSchema<"confirm_withdrawal", undefined>;
157
+ readonly sourceAccountId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, undefined>;
158
+ readonly amount: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.CheckAction<string, undefined>]>, undefined>;
159
+ readonly beneficiary: v.OptionalSchema<v.StrictObjectSchema<{
160
+ account_holder_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>;
161
+ account_holder_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>;
162
+ account_kind: v.PicklistSchema<["checking", "debit", "savings"], undefined>;
163
+ account_number: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>;
164
+ bank_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
165
+ country: v.LiteralSchema<"CL", undefined>;
166
+ }, undefined>, undefined>;
167
+ readonly note: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.CheckAction<string, "note_too_long">]>, undefined>;
168
+ }, undefined>, v.StrictObjectSchema<{
169
+ readonly action: v.LiteralSchema<"fund_development_deposit", undefined>;
170
+ }, undefined>, v.StrictObjectSchema<{
171
+ readonly action: v.LiteralSchema<"close_deposit", undefined>;
172
+ }, undefined>, v.StrictObjectSchema<{
173
+ readonly action: v.LiteralSchema<"confirm_deposit_target", undefined>;
174
+ readonly amount: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, number, undefined>]>;
175
+ readonly expectedTarget: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, number, undefined>]>;
176
+ }, undefined>, v.StrictObjectSchema<{
177
+ readonly action: v.LiteralSchema<"assign_deposit_credits", undefined>;
178
+ readonly expectedVersion: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>;
179
+ readonly selectedMovements: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>, undefined>, v.CheckAction<string[], undefined>]>;
180
+ }, undefined>], undefined>;
181
+ export type AndCoNativeIntentCommand = v.InferOutput<typeof AndCoNativeIntentCommandSchema>;
182
+ /** Recognizes only the canonical Intent path, never a generic trusted-origin URL. */
183
+ export declare function ANDCO_NATIVE_INTENT_ID(value: string | URL, bankOrigin: string | URL): string | null;
184
+ /** Validates a presentation's callbacks against the active Miniapp, independently of the Intent's authority. */
185
+ export declare function ANDCO_NATIVE_INTENT_PRESENTATION(value: string, bankOrigin: string, miniappOrigin: string): {
186
+ readonly id: string;
187
+ readonly returnUri: string;
188
+ readonly errorReturnUri: string;
189
+ readonly state: string;
190
+ readonly presentation: "redirect" | "popup";
191
+ };
192
+ export type AndCoNativeIntentPresentation = ReturnType<typeof ANDCO_NATIVE_INTENT_PRESENTATION>;
193
+ /** Returns to the original document without changing the financial operation. */
194
+ export declare function ANDCO_NATIVE_INTENT_CALLBACK(presentation: AndCoNativeIntentPresentation, result: "complete" | "dismiss"): string;
195
+ /** Reads the current state or submits one explicit command; commands are never retried automatically. */
196
+ export declare function requestAndCoNativeIntent(options: {
197
+ accessToken: string;
198
+ bankOrigin: string;
199
+ presentation: AndCoNativeIntentPresentation;
200
+ command?: AndCoNativeIntentCommand;
201
+ fetcher?: typeof fetch;
202
+ }): Promise<{
203
+ intent: {
204
+ type: "deposit";
205
+ amount: {
206
+ confirmed: string | null;
207
+ frozen_at: string | null;
208
+ currency: "CLP";
209
+ suggested: string;
210
+ editable: boolean;
211
+ } | null;
212
+ destination: {
213
+ bank_account_id: string;
214
+ account_holder_id: string;
215
+ account_holder_name: string;
216
+ account_kind: "checking" | "debit" | "savings";
217
+ account_number: string;
218
+ bank_id: string;
219
+ country: "CL";
220
+ };
221
+ progress: {
222
+ credited: string;
223
+ remaining: string | null;
224
+ };
225
+ closure: {
226
+ closed_at: string;
227
+ total: string;
228
+ } | null;
229
+ completion: {
230
+ completed_at: string;
231
+ total: string;
232
+ } | null;
233
+ transactions: {
234
+ id: string;
235
+ received_at: string;
236
+ note: string | null;
237
+ outcome: "credited" | "reversed";
238
+ receipt_time_source: "unknown" | "bank_timestamp";
239
+ account_holder_name_masked: string;
240
+ account_number_masked: string;
241
+ bank_id: string;
242
+ amount: string;
243
+ currency: "CLP";
244
+ }[];
245
+ id: string;
246
+ status: "completed" | "requires_action" | "processing.confirmed" | "processing.settling" | "processing.reversing" | "processing.reconciling" | "succeeded" | "closed" | "failed" | "failed.insufficient_funds" | "cancelled" | "expired";
247
+ fee: {
248
+ currency: "CLP";
249
+ amount: string;
250
+ };
251
+ note?: {
252
+ suggested: string;
253
+ editable: boolean;
254
+ } | undefined;
255
+ expires_at: string | null;
256
+ server_time: string;
257
+ can_confirm: boolean;
258
+ project: {
259
+ id: string;
260
+ name: string;
261
+ };
262
+ } | {
263
+ type: "withdrawal";
264
+ beneficiary: {
265
+ editable: boolean;
266
+ account_holder_id: string;
267
+ account_holder_name: string;
268
+ account_kind: "checking" | "debit" | "savings";
269
+ account_number: string;
270
+ bank_id: string;
271
+ country: "CL";
272
+ };
273
+ source?: {
274
+ account_holder_id: string;
275
+ account_holder_name: string;
276
+ account_kind: "checking" | "debit" | "savings";
277
+ account_number: string;
278
+ bank_id: string;
279
+ country: "CL";
280
+ } | {
281
+ bank_account_id: string;
282
+ } | undefined;
283
+ id: string;
284
+ status: "completed" | "requires_action" | "processing.confirmed" | "processing.settling" | "processing.reversing" | "processing.reconciling" | "succeeded" | "closed" | "failed" | "failed.insufficient_funds" | "cancelled" | "expired";
285
+ amount: {
286
+ currency: "CLP";
287
+ suggested: string;
288
+ editable: boolean;
289
+ };
290
+ fee: {
291
+ currency: "CLP";
292
+ amount: string;
293
+ };
294
+ note?: {
295
+ suggested: string;
296
+ editable: boolean;
297
+ } | undefined;
298
+ expires_at: string | null;
299
+ server_time: string;
300
+ can_confirm: boolean;
301
+ project: {
302
+ id: string;
303
+ name: string;
304
+ };
305
+ };
306
+ sources: {
307
+ id: string;
308
+ number: string;
309
+ name: string | null;
310
+ }[];
311
+ checklist: {
312
+ accountId: string;
313
+ version: number;
314
+ credits: {
315
+ movementId: string;
316
+ transactionId: string;
317
+ amount: string;
318
+ receivedAt: string;
319
+ note: string | null;
320
+ assignedIntentId: string | null;
321
+ assignedProjectName: string | null;
322
+ unavailableReason: string | null;
323
+ }[];
324
+ otherRequests: {
325
+ id: string;
326
+ projectName: string;
327
+ target: string | null;
328
+ }[];
329
+ } | null;
330
+ funding?: {
331
+ commandId: string;
332
+ pendingSourceId: string | null;
333
+ pendingAmount: string | null;
334
+ pendingNote: string | null;
335
+ completed: boolean;
336
+ } | undefined;
337
+ confirmedNote: string | null;
338
+ sourceEditable: boolean;
339
+ banks: {
340
+ id: string;
341
+ name: string;
342
+ }[];
343
+ retryable: boolean;
344
+ developmentDeposit: boolean;
345
+ }>;
346
+ /** A mounted native presentation; disposing it never changes or retries the financial operation. */
347
+ export declare class AndCoNativeIntentSession {
348
+ private readonly load;
349
+ snapshot: {
350
+ data: AndCoNativeIntentPreparation | null;
351
+ pending: boolean;
352
+ error: string | null;
353
+ retryCommand?: AndCoNativeIntentCommand;
354
+ };
355
+ private listeners;
356
+ private disposed;
357
+ private reading;
358
+ private timer;
359
+ constructor(load: (command?: AndCoNativeIntentCommand) => Promise<AndCoNativeIntentPreparation>);
360
+ subscribe(listener: () => void): () => void;
361
+ private publish;
362
+ refresh(): Promise<void>;
363
+ submit(command: AndCoNativeIntentCommand): Promise<void>;
364
+ dispose(): void;
365
+ }
366
+ /** Server-authoritative lifecycle and display values used by both native renderers. */
367
+ export declare function ANDCO_NATIVE_INTENT_VIEW(data: AndCoNativeIntentPreparation, now?: number, observedAt?: number): {
368
+ terminal: boolean;
369
+ expired: boolean;
370
+ processing: boolean;
371
+ frozen: boolean;
372
+ remaining: number | null;
373
+ canSubmit: boolean;
374
+ title: string;
375
+ status: string;
376
+ };
377
+ /** User-edited values, separate from the durable financial state. */
378
+ export type AndCoNativeIntentForm = {
379
+ source: string;
380
+ amount: string;
381
+ note: string;
382
+ beneficiary: Extract<AndCoNativeIntentPreparation["intent"], {
383
+ type: "withdrawal";
384
+ }>["beneficiary"] | null;
385
+ };
386
+ /** Restores accepted command values; otherwise defaults only an unambiguous source. */
387
+ export declare function ANDCO_NATIVE_INTENT_FORM(data: AndCoNativeIntentPreparation, retry?: AndCoNativeIntentCommand): AndCoNativeIntentForm;
388
+ /** Builds an explicit command without resending editable values on a frozen withdrawal. */
389
+ export declare function ANDCO_NATIVE_INTENT_COMMAND(data: AndCoNativeIntentPreparation, form: AndCoNativeIntentForm): AndCoNativeIntentCommand;
390
+ /** Validates the proposed command while preserving an already accepted deposit's frozen amount. */
391
+ export declare function ANDCO_NATIVE_INTENT_FORM_VALID(data: AndCoNativeIntentPreparation, form: AndCoNativeIntentForm): boolean;
392
+ export type AndCoNativeDepositChecklistDraft = {
393
+ version: number;
394
+ selected: string[];
395
+ };
396
+ /** Preserves the User's selection while a changed account version requires explicit review. */
397
+ export declare function ANDCO_NATIVE_DEPOSIT_CHECKLIST(intentId: string, checklist: NonNullable<AndCoNativeIntentPreparation["checklist"]>, draft: AndCoNativeDepositChecklistDraft | null): {
398
+ selected: Set<string>;
399
+ conflict: boolean;
400
+ moving: boolean;
401
+ };
402
+ //# sourceMappingURL=native-intent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-intent.d.ts","sourceRoot":"","sources":["../src/native-intent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAyC7B,+FAA+F;AAC/F,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAoE7C,CAAC;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAEpG,mEAAmE;AACnE,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA8BzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAW5F,qFAAqF;AACrF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,UAAU,EAAE,MAAM,GAAG,GAAG,iBAUnF;AAED,gHAAgH;AAChH,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;;;;;;E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