@fun-xyz/fiat-contract 0.29.0 → 0.30.0

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 CHANGED
@@ -95,6 +95,9 @@ this package is [ENG-5268](https://linear.app/funxyz/issue/ENG-5268).
95
95
  provider-owned payment surface while auth or KYC continues, but its `CLIENT_SURFACE` transition
96
96
  is not active yet. A client exposes it only after a later response makes the same `quoteRef`
97
97
  executable; the prepared surface provider must match the response provider.
98
+ 18. **Review duration sets the wait.** `KYC{NO_ACTION_REQUIRED, IN_REVIEW}` may carry `review`. `BRIEF`
99
+ means the client keeps the buyer on the current screen with a loading state and polls, then shows
100
+ the in-review screen if nothing changes within `holdMs`; `EXTENDED` or absent shows it at once.
98
101
 
99
102
  ## Provider-owned flows
100
103
 
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.29.0";
2
+ var version = "0.30.0";
3
3
 
4
4
  // src/table.ts
5
5
  var TABLE_VERSION = version;
@@ -514,4 +514,4 @@ export {
514
514
  tableEntry,
515
515
  isTerminal
516
516
  };
517
- //# sourceMappingURL=chunk-VQTJSULZ.mjs.map
517
+ //# sourceMappingURL=chunk-OLRRCFJQ.mjs.map
package/dist/index.js CHANGED
@@ -73,6 +73,7 @@ __export(index_exports, {
73
73
  KycFieldIdSchema: () => KycFieldIdSchema,
74
74
  KycInputRequiredStateSchema: () => KycInputRequiredStateSchema,
75
75
  KycNoActionRequiredStateSchema: () => KycNoActionRequiredStateSchema,
76
+ KycReviewDurationSchema: () => KycReviewDurationSchema,
76
77
  KycSdkResultReportSchema: () => KycSdkResultReportSchema,
77
78
  MOONPAY_ENDPOINTS: () => MOONPAY_ENDPOINTS,
78
79
  MoonPayCheckoutSchema: () => MoonPayCheckoutSchema,
@@ -919,15 +920,23 @@ var $kycInputRequiredState = obj({
919
920
  error: $failureReason.optional()
920
921
  });
921
922
  var KycInputRequiredStateSchema = $kycInputRequiredState;
922
- var $kycNoActionRequiredState = obj({
923
+ var $kycReviewDuration = import_zod.z.discriminatedUnion("duration", [
924
+ obj({ duration: import_zod.z.literal("BRIEF"), holdMs: import_zod.z.number().int().positive().max(6e5) }),
925
+ obj({ duration: import_zod.z.literal("EXTENDED") })
926
+ ]);
927
+ var KycReviewDurationSchema = $kycReviewDuration;
928
+ var $kycNoActionRequiredFields = {
923
929
  kind: import_zod.z.literal("KYC"),
924
930
  phase: import_zod.z.literal("NO_ACTION_REQUIRED"),
925
931
  quote: $quote.optional(),
926
- reason: import_zod.z.enum(["IN_REVIEW", "ON_HOLD", "REJECTED"]),
927
932
  retryAfter: import_zod.z.string().optional(),
928
933
  failureReason: $failureReason.optional(),
929
934
  error: $failureReason.optional()
930
- });
935
+ };
936
+ var $kycNoActionRequiredState = import_zod.z.union([
937
+ obj({ ...$kycNoActionRequiredFields, reason: import_zod.z.literal("IN_REVIEW"), review: $kycReviewDuration.optional() }),
938
+ obj({ ...$kycNoActionRequiredFields, reason: import_zod.z.enum(["ON_HOLD", "REJECTED"]) })
939
+ ]);
931
940
  var KycNoActionRequiredStateSchema = $kycNoActionRequiredState;
932
941
  var $pendingOrderState = obj({
933
942
  kind: import_zod.z.literal("PENDING_ORDER"),
@@ -1233,7 +1242,7 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $blockedStep
1233
1242
  var FiatStepResponseSchema = $stepResponse;
1234
1243
 
1235
1244
  // package.json
1236
- var version = "0.29.0";
1245
+ var version = "0.30.0";
1237
1246
 
1238
1247
  // src/table.ts
1239
1248
  var TABLE_VERSION = version;
package/dist/index.mjs CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  tableEntry,
13
13
  unofferedEndpoints,
14
14
  unreachableStates
15
- } from "./chunk-VQTJSULZ.mjs";
15
+ } from "./chunk-OLRRCFJQ.mjs";
16
16
  import {
17
17
  MOONPAY_ENDPOINTS
18
18
  } from "./chunk-F4NRKWF5.mjs";
@@ -782,15 +782,23 @@ var $kycInputRequiredState = obj({
782
782
  error: $failureReason.optional()
783
783
  });
784
784
  var KycInputRequiredStateSchema = $kycInputRequiredState;
785
- var $kycNoActionRequiredState = obj({
785
+ var $kycReviewDuration = z.discriminatedUnion("duration", [
786
+ obj({ duration: z.literal("BRIEF"), holdMs: z.number().int().positive().max(6e5) }),
787
+ obj({ duration: z.literal("EXTENDED") })
788
+ ]);
789
+ var KycReviewDurationSchema = $kycReviewDuration;
790
+ var $kycNoActionRequiredFields = {
786
791
  kind: z.literal("KYC"),
787
792
  phase: z.literal("NO_ACTION_REQUIRED"),
788
793
  quote: $quote.optional(),
789
- reason: z.enum(["IN_REVIEW", "ON_HOLD", "REJECTED"]),
790
794
  retryAfter: z.string().optional(),
791
795
  failureReason: $failureReason.optional(),
792
796
  error: $failureReason.optional()
793
- });
797
+ };
798
+ var $kycNoActionRequiredState = z.union([
799
+ obj({ ...$kycNoActionRequiredFields, reason: z.literal("IN_REVIEW"), review: $kycReviewDuration.optional() }),
800
+ obj({ ...$kycNoActionRequiredFields, reason: z.enum(["ON_HOLD", "REJECTED"]) })
801
+ ]);
794
802
  var KycNoActionRequiredStateSchema = $kycNoActionRequiredState;
795
803
  var $pendingOrderState = obj({
796
804
  kind: z.literal("PENDING_ORDER"),
@@ -2351,6 +2359,7 @@ export {
2351
2359
  KycFieldIdSchema,
2352
2360
  KycInputRequiredStateSchema,
2353
2361
  KycNoActionRequiredStateSchema,
2362
+ KycReviewDurationSchema,
2354
2363
  KycSdkResultReportSchema,
2355
2364
  MOONPAY_ENDPOINTS,
2356
2365
  MoonPayCheckoutSchema,
package/dist/schemas.d.ts CHANGED
@@ -28,7 +28,7 @@
28
28
  */
29
29
  import { z } from 'zod';
30
30
  import type { UsStateCode } from './codes';
31
- import type { BlockedReason, CryptoAmount, FailureReason, FeeLine, FiatAmount, FiatEndpoint, FiatProvider, FiatStepResponse, FieldSpec, FlowState, FormDescriptor, FormField, FormFieldType, InstructionField, Instructions, Instrument, JsonValue, KYCProvider, OrderRef, OrderStatus, OrderSummary, PollSpec, PreparedPayment, PaymentSurface, Quote, QuoteLimitRange, QuoteLimits, Recovery, Refund, ReportSpec, SelectOption, StatusHistoryEntry, Surface, PreferredIdentityDocument, KycFieldId, ClientExecutedDelivery, KycSdkResultReport, SurfaceKind, SurfaceProvider, TermsAcceptance, Transition, TransitionInputs, TransitionParams, Tx, FiatGeo, FiatNextRequest } from './types';
31
+ import type { BlockedReason, CryptoAmount, FailureReason, FeeLine, FiatAmount, FiatEndpoint, FiatProvider, FiatStepResponse, FieldSpec, FlowState, FormDescriptor, FormField, FormFieldType, InstructionField, Instructions, Instrument, JsonValue, KYCProvider, KycReviewDuration, OrderRef, OrderStatus, OrderSummary, PollSpec, PreparedPayment, PaymentSurface, Quote, QuoteLimitRange, QuoteLimits, Recovery, Refund, ReportSpec, SelectOption, StatusHistoryEntry, Surface, PreferredIdentityDocument, KycFieldId, ClientExecutedDelivery, KycSdkResultReport, SurfaceKind, SurfaceProvider, TermsAcceptance, Transition, TransitionInputs, TransitionParams, Tx, FiatGeo, FiatNextRequest } from './types';
32
32
  import type { FiatTermsErrorBody, FiatTermsRequest, FiatTermsResponse, TermsDocument, TermsDocumentAcceptance } from './terms';
33
33
  import type { FiatRoutingQuoteErrorBody, FiatRoutingQuoteRequest, FiatRoutingQuoteTerms, FiatRoutingTableErrorBody, FiatRoutingTableQuery, FiatRoutingTableRequest, FiatRoutingTableResponse } from './routing';
34
34
  export declare const JsonSchema: z.ZodType<JsonValue>;
@@ -98,6 +98,7 @@ export declare const FunAuthStateSchema: z.ZodType<State<'FUN_AUTH'>>;
98
98
  export declare const SessionAuthStateSchema: z.ZodType<State<'SESSION_AUTH'>>;
99
99
  export declare const KycCaptureStateSchema: z.ZodType<State<'KYC', 'CAPTURE'>>;
100
100
  export declare const KycInputRequiredStateSchema: z.ZodType<State<'KYC', 'INPUT_REQUIRED'>>;
101
+ export declare const KycReviewDurationSchema: z.ZodType<KycReviewDuration>;
101
102
  export declare const KycNoActionRequiredStateSchema: z.ZodType<State<'KYC', 'NO_ACTION_REQUIRED'>>;
102
103
  export declare const PendingOrderStateSchema: z.ZodType<State<'PENDING_ORDER'>>;
103
104
  export declare const BlockedReasonSchema: z.ZodType<BlockedReason>;
package/dist/table.js CHANGED
@@ -36,7 +36,7 @@ __export(table_exports, {
36
36
  module.exports = __toCommonJS(table_exports);
37
37
 
38
38
  // package.json
39
- var version = "0.29.0";
39
+ var version = "0.30.0";
40
40
 
41
41
  // src/table.ts
42
42
  var TABLE_VERSION = version;
package/dist/table.mjs CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  tableEntry,
12
12
  unofferedEndpoints,
13
13
  unreachableStates
14
- } from "./chunk-VQTJSULZ.mjs";
14
+ } from "./chunk-OLRRCFJQ.mjs";
15
15
  export {
16
16
  DOCUMENTED_ENDPOINTS,
17
17
  STATE_KEYS,
package/dist/types.d.ts CHANGED
@@ -540,6 +540,17 @@ export interface PreparedPayment {
540
540
  * cheap, adding one back costs a client release (handshake-gated).
541
541
  */
542
542
  export type AuthChallenge = Record<string, JsonValue>;
543
+ /**
544
+ * The expected length of a provider's KYC review. `BRIEF`: the client stays on its current screen,
545
+ * polling, for up to `holdMs` (at most 600000), then shows the in-review screen. `EXTENDED`: the
546
+ * client shows the in-review screen at once.
547
+ */
548
+ export type KycReviewDuration = {
549
+ duration: 'BRIEF';
550
+ holdMs: number;
551
+ } | {
552
+ duration: 'EXTENDED';
553
+ };
543
554
  /**
544
555
  * The semantic state. Three rules keep this union honest:
545
556
  * 1. sub-states are payload discriminants, never new kinds
@@ -607,6 +618,8 @@ export type FlowState =
607
618
  */
608
619
  reason: 'IN_REVIEW' | 'ON_HOLD' | 'REJECTED';
609
620
  retryAfter?: string;
621
+ /** How long the provider's review is expected to take. Set only with `reason: 'IN_REVIEW'`; absent means EXTENDED. */
622
+ review?: KycReviewDuration;
610
623
  /**
611
624
  * REJECTED is reserved for an explicit non-retryable outcome and renders in place — it
612
625
  * never routes through `ORDER{CREATED, FAILED}`. Correctable outcomes return CAPTURE or
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fun-xyz/fiat-contract",
3
- "version": "0.29.0",
3
+ "version": "0.30.0",
4
4
  "description": "Published conformance contract for Fun's headless fiat onramp: FlowState/Transition types, zod schemas, the transition table as data, recorded fixtures, assertion helpers.",
5
5
  "license": "MIT",
6
6
  "repository": {