@fun-xyz/fiat-contract 0.28.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.28.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-YNVLBTT7.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,
@@ -575,7 +576,8 @@ var $quote = obj({
575
576
  totalFee: import_zod.z.string(),
576
577
  feeBreakdown: import_zod.z.array($feeLine),
577
578
  paymentMethod: import_zod.z.enum(PAYMENT_METHOD_CATEGORIES),
578
- expiresAt: import_zod.z.string()
579
+ expiresAt: import_zod.z.string(),
580
+ feeSubsidy: $money.optional()
579
581
  });
580
582
  var QuoteSchema = $quote;
581
583
  var $quoteLimitRange = obj({ min: import_zod.z.string(), max: import_zod.z.string() });
@@ -918,15 +920,23 @@ var $kycInputRequiredState = obj({
918
920
  error: $failureReason.optional()
919
921
  });
920
922
  var KycInputRequiredStateSchema = $kycInputRequiredState;
921
- 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 = {
922
929
  kind: import_zod.z.literal("KYC"),
923
930
  phase: import_zod.z.literal("NO_ACTION_REQUIRED"),
924
931
  quote: $quote.optional(),
925
- reason: import_zod.z.enum(["IN_REVIEW", "ON_HOLD", "REJECTED"]),
926
932
  retryAfter: import_zod.z.string().optional(),
927
933
  failureReason: $failureReason.optional(),
928
934
  error: $failureReason.optional()
929
- });
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
+ ]);
930
940
  var KycNoActionRequiredStateSchema = $kycNoActionRequiredState;
931
941
  var $pendingOrderState = obj({
932
942
  kind: import_zod.z.literal("PENDING_ORDER"),
@@ -1232,7 +1242,7 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $blockedStep
1232
1242
  var FiatStepResponseSchema = $stepResponse;
1233
1243
 
1234
1244
  // package.json
1235
- var version = "0.28.0";
1245
+ var version = "0.30.0";
1236
1246
 
1237
1247
  // src/table.ts
1238
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-YNVLBTT7.mjs";
15
+ } from "./chunk-OLRRCFJQ.mjs";
16
16
  import {
17
17
  MOONPAY_ENDPOINTS
18
18
  } from "./chunk-F4NRKWF5.mjs";
@@ -438,7 +438,8 @@ var $quote = obj({
438
438
  totalFee: z.string(),
439
439
  feeBreakdown: z.array($feeLine),
440
440
  paymentMethod: z.enum(PAYMENT_METHOD_CATEGORIES),
441
- expiresAt: z.string()
441
+ expiresAt: z.string(),
442
+ feeSubsidy: $money.optional()
442
443
  });
443
444
  var QuoteSchema = $quote;
444
445
  var $quoteLimitRange = obj({ min: z.string(), max: z.string() });
@@ -781,15 +782,23 @@ var $kycInputRequiredState = obj({
781
782
  error: $failureReason.optional()
782
783
  });
783
784
  var KycInputRequiredStateSchema = $kycInputRequiredState;
784
- 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 = {
785
791
  kind: z.literal("KYC"),
786
792
  phase: z.literal("NO_ACTION_REQUIRED"),
787
793
  quote: $quote.optional(),
788
- reason: z.enum(["IN_REVIEW", "ON_HOLD", "REJECTED"]),
789
794
  retryAfter: z.string().optional(),
790
795
  failureReason: $failureReason.optional(),
791
796
  error: $failureReason.optional()
792
- });
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
+ ]);
793
802
  var KycNoActionRequiredStateSchema = $kycNoActionRequiredState;
794
803
  var $pendingOrderState = obj({
795
804
  kind: z.literal("PENDING_ORDER"),
@@ -2350,6 +2359,7 @@ export {
2350
2359
  KycFieldIdSchema,
2351
2360
  KycInputRequiredStateSchema,
2352
2361
  KycNoActionRequiredStateSchema,
2362
+ KycReviewDurationSchema,
2353
2363
  KycSdkResultReportSchema,
2354
2364
  MOONPAY_ENDPOINTS,
2355
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.28.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-YNVLBTT7.mjs";
14
+ } from "./chunk-OLRRCFJQ.mjs";
15
15
  export {
16
16
  DOCUMENTED_ENDPOINTS,
17
17
  STATE_KEYS,
package/dist/types.d.ts CHANGED
@@ -150,6 +150,11 @@ export interface Quote {
150
150
  feeBreakdown: FeeLine[];
151
151
  paymentMethod: PaymentMethodCategory;
152
152
  expiresAt: string;
153
+ /**
154
+ * The fee the partner reimburses after settlement. Absent when this deposit is not subsidized.
155
+ * A prediction: settlement decides again.
156
+ */
157
+ feeSubsidy?: FiatAmount;
153
158
  }
154
159
  /** One inclusive amount interval the current routing set can actually serve. */
155
160
  export interface QuoteLimitRange {
@@ -535,6 +540,17 @@ export interface PreparedPayment {
535
540
  * cheap, adding one back costs a client release (handshake-gated).
536
541
  */
537
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
+ };
538
554
  /**
539
555
  * The semantic state. Three rules keep this union honest:
540
556
  * 1. sub-states are payload discriminants, never new kinds
@@ -602,6 +618,8 @@ export type FlowState =
602
618
  */
603
619
  reason: 'IN_REVIEW' | 'ON_HOLD' | 'REJECTED';
604
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;
605
623
  /**
606
624
  * REJECTED is reserved for an explicit non-retryable outcome and renders in place — it
607
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.28.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": {