@fire-spark/core 0.36.1 → 0.36.8

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 (3) hide show
  1. package/dist/index.d.ts +787 -8
  2. package/dist/index.js +3954 -133
  3. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Money, PaymentAdapter, PaymentCollectAt, PaymentContext, PaymentResult, PaymentReversal, PaymentStorage, PaymentUI, RedeemLike, RedeemSource, isRealPaymentMethod, orderRedeems } from "@fire-spark/payments";
2
- import { AndConditions, ApplyFeesInput, ApplyFeesOrderScope, CheckoutMode, CheckoutResolved, CmsBlock, Condition, Customer, CustomerIdentifyInput, CustomerRegisterInput, CustomerUpdateInput, Fee, Fulfillment, FulfillmentListInput, GroupDisplayType, KioskDeviceConfig, KioskDeviceConfigInput, KioskDeviceOverrides, KioskHealthBatchInput, KioskHealthBatchResult, KioskHeartbeatInput, KioskHeartbeatResult, KioskPickupNameRules, KioskRealtimeToken, MasivoTotpCode, MasivoTotpCreateInput, MasivoTotpVerification, MasivoTotpVerifyInput, MatchResult, MatchableRule, Menu, Menu as Menu$1, MenuLookup, MenuLookup as MenuLookup$1, MerchantPayment, ModifierControlType, ModifierGroup, OrConditions, Order as Order$1, Order as Order$2, OrderCancelInput, OrderCancelInput as OrderCancelInput$1, OrderCancelType, OrderCancelType as OrderCancelType$1, OrderDeviceListInput, OrderDeviceListResult, OrderFulfillment, OrderFulfillmentWorkflow, OrderFulfillmentWorkflowEdge, OrderFulfillmentWorkflowNode, OrderInsertInput, OrderLine, OrderListInput, OrderRateInput, OrderRating, OrderRecord, OrderRecordPaymentInput, OrderRedeem, OrderRedemptionStep, OrderReorderInput, OrderSetCustomerInput, OrderTotals, OrderUpdateInput, OrderValidateInput, OrderValidateOutput, PaymentCollectAt as PaymentCollectAt$1, PaymentIntentPutInput, PaymentMethod, PaymentProvider, PaymentTender, PaymentTenderInput, PlaceOrderResult, PosCatalog, PosFloorInput, PosFloorOccupancy, PosFloorPlan, PosFloorRealtimeToken, PosHealthBatchInput, PosHealthBatchResult, PosHeartbeatInput, PosHeartbeatResult, PosKioskOrder, PosKioskSettleInput, PosKioskSettleResult, PosOrderInput, PosOrderResult, PosTableAttachOrderInput, PosTableCloseInput, PosTableJoinInput, PosTableSeatInput, PosTableSeatReservationInput, PosTableSplitInput, PricingModifier, Product, Product as Product$1, Recommendation, RecurringDateCronFormatter, RecurringDateCronResult, RecurringDateCronSummary, RecurringDateCronValues, RulesEngineOrder, RulesEngineOrderLine, RulesEngineParams, RulesEngineRuntime, Schedule, SdkLogContext, SdkLogErrorInfo, SdkLogLevel, SdkLogOptions, Store, StoreGetInput, StoreListInput, StoreNearbyInput, StorefrontAvailability, StorefrontMenu, StorefrontMenuScope, StorefrontMenuStreamOptions, StorefrontPaymentsListInput, StorefrontPreferences, SwitchCustomerArg, SwitchCustomerArg as SwitchCustomerArg$1, SwitchCustomerIdToken, SwitchCustomerResult, SwitchCustomerResult as SwitchCustomerResult$1, TenderRefundInput, TenderReplaceInput, TenderVoidInput, Variant, VariantGroup, WordFilterCheckInput, WordFilterCheckResult } from "@fire-spark/types";
2
+ import { AndConditions, ApplyFeesInput, ApplyFeesOrderScope, CheckoutMode, CheckoutResolved, CmsBlock, Condition, Customer, CustomerIdentifyInput, CustomerRegisterInput, CustomerUpdateInput, Fee, Fulfillment, FulfillmentEligibilityInput, FulfillmentEligibilityInput as FulfillmentEligibilityInput$1, FulfillmentListInput, GroupDisplayType, KioskDeviceConfig, KioskDeviceConfigInput, KioskDeviceOverrides, KioskHealthBatchInput, KioskHealthBatchResult, KioskHeartbeatInput, KioskHeartbeatResult, KioskPickupNameRules, KioskRealtimeToken, LocalServerConfig, LocalServerConfig as LocalServerConfig$1, LocalServerHealthResult, LocalServerHealthResult as LocalServerHealthResult$1, MasivoTotpCode, MasivoTotpCreateInput, MasivoTotpVerification, MasivoTotpVerifyInput, MatchResult, MatchableRule, Menu, Menu as Menu$1, MenuLookup, MenuLookup as MenuLookup$1, MerchantPayment, ModifierControlType, ModifierGroup, OrConditions, Order as Order$1, Order as Order$2, OrderCancelInput, OrderCancelInput as OrderCancelInput$1, OrderCancelType, OrderCancelType as OrderCancelType$1, OrderDeviceListInput, OrderDeviceListResult, OrderFulfillment, OrderFulfillmentWorkflow, OrderFulfillmentWorkflowEdge, OrderFulfillmentWorkflowNode, OrderInsertInput, OrderLine, OrderListInput, OrderRateInput, OrderRating, OrderRecord, OrderRecordPaymentInput, OrderRedeem, OrderRedemptionStep, OrderReorderInput, OrderRouteKind, OrderRouteKind as OrderRouteKind$1, OrderRouteStatus, OrderRoutes, OrderRoutes as OrderRoutes$1, OrderSetCustomerInput, OrderTotals, OrderUpdateInput, OrderValidateInput, OrderValidateOutput, PaymentCollectAt as PaymentCollectAt$1, PaymentEligibilityInput, PaymentEligibilityInput as PaymentEligibilityInput$1, PaymentIntentPutInput, PaymentMethod, PaymentProvider, PaymentTender, PaymentTenderInput, PlaceOrderResult, PosCatalog, PosFloorInput, PosFloorOccupancy, PosFloorPlan, PosFloorRealtimeToken, PosHealthBatchInput, PosHealthBatchResult, PosHeartbeatInput, PosHeartbeatResult, PosKioskOrder, PosKioskSettleInput, PosKioskSettleResult, PosOrderInput, PosOrderResult, PosTableAttachOrderInput, PosTableCloseInput, PosTableJoinInput, PosTableSeatInput, PosTableSeatReservationInput, PosTableSplitInput, PricingModifier, Product, Product as Product$1, Recommendation, RecurringDateCronFormatter, RecurringDateCronResult, RecurringDateCronSummary, RecurringDateCronValues, RouteEligibility, RouteEligibility as RouteEligibility$1, RouteEligibilityDetail, RouteEligibilityFlags, RouteEligibilityReason, RouteFailureKind, RouteFailureKind as RouteFailureKind$1, RouteHealthEvent, RouteHealthEvent as RouteHealthEvent$1, RouteHealthListener, RouteHealthListener as RouteHealthListener$1, RulesEngineOrder, RulesEngineOrderLine, RulesEngineParams, RulesEngineRuntime, Schedule, SdkLogContext, SdkLogErrorInfo, SdkLogLevel, SdkLogOptions, Store, StoreGetInput, StoreListInput, StoreNearbyInput, StorefrontAvailability, StorefrontMenu, StorefrontMenuScope, StorefrontMenuStreamOptions, StorefrontPaymentsListInput, StorefrontPreferences, SwitchCustomerArg, SwitchCustomerArg as SwitchCustomerArg$1, SwitchCustomerIdToken, SwitchCustomerResult, SwitchCustomerResult as SwitchCustomerResult$1, TenderRefundInput, TenderReplaceInput, TenderVoidInput, Variant, VariantGroup, WordFilterCheckInput, WordFilterCheckResult } from "@fire-spark/types";
3
3
  import { Big } from "big.js";
4
4
  //#region src/productCustomization/catalog.utils.d.ts
5
5
  /** Image for a product inside one modifier group, else the product image. */
@@ -312,6 +312,11 @@ type ServiceHttpOptions = {
312
312
  * the cloud. Without `baseUrl`, the one from `auth.configure()` applies.
313
313
  */
314
314
  fallbackBaseUrl?: string;
315
+ /**
316
+ * Optional cloud + local server routing hook. When omitted or when `local`
317
+ * is unset, requests go directly to the cloud URL with zero behavior change.
318
+ */
319
+ routes?: OrderRoutes$1;
315
320
  accessToken?: string;
316
321
  fetchImpl?: typeof fetch;
317
322
  signal?: AbortSignal;
@@ -594,6 +599,18 @@ type CreateOrderOptions = {
594
599
  device?: OrderDeviceCredential;
595
600
  debounceMs?: number;
596
601
  baseUrl?: string;
602
+ /** Optional cloud + local smart routing config (default-off when `local` is unset). */
603
+ routes?: OrderRoutes$1;
604
+ /** Fulfillment eligibility flags (`local_eligible`, `offline_eligible`). */
605
+ fulfillment?: FulfillmentEligibilityInput$1 | null;
606
+ /** Payment eligibility metadata for `getRouteEligibility()` and smart routing. */
607
+ payments?: PaymentEligibilityInput$1[];
608
+ /** Per-order route health callback invoked on circuit transitions. */
609
+ onRouteHealth?: RouteHealthListener$1;
610
+ /** Optional TLS leaf certificate SHA-256 fingerprint verifier for local node. */
611
+ verifyTlsFingerprint?: (expected: string) => Promise<boolean>;
612
+ /** Optional connectivity detector returning true when the device is offline. */
613
+ isOffline?: () => boolean;
597
614
  accessToken?: string;
598
615
  fetchImpl?: typeof fetch;
599
616
  };
@@ -675,6 +692,13 @@ declare class Order {
675
692
  private readonly device?;
676
693
  /** Device voids a failed cancel / refund call did not report yet. */
677
694
  private unreported;
695
+ private readonly routes?;
696
+ private activeRoute;
697
+ private fulfillment;
698
+ private readonly paymentEligibility;
699
+ private readonly onRouteHealthListener?;
700
+ private readonly verifyTlsFingerprint?;
701
+ private readonly isOfflineFn?;
678
702
  private constructor();
679
703
  /**
680
704
  * Opens a cart session: reuses an existing OPEN order for the scope, or a
@@ -693,11 +717,37 @@ declare class Order {
693
717
  sleep?: (ms: number) => Promise<void>;
694
718
  /** Sent by `cancel()` (and `placeOrder`) when present. */
695
719
  device?: CreateOrderOptions["device"];
720
+ fulfillment?: FulfillmentEligibilityInput$1 | null;
721
+ payments?: PaymentEligibilityInput$1[];
722
+ onRouteHealth?: RouteHealthListener$1;
723
+ verifyTlsFingerprint?: (expected: string) => Promise<boolean>;
724
+ isOffline?: () => boolean;
696
725
  }, notify?: () => void): Order;
697
726
  /** Whether this session has a server row yet. */
698
727
  isPersisted(): boolean;
699
728
  /** Persist a local draft via POST (no-op if already on the server). */
700
729
  persist(): Promise<void>;
730
+ /** Route currently selected for this order (`cloud` when local is unset). */
731
+ getActiveRoute(): OrderRouteKind$1;
732
+ /** Updates fulfillment eligibility (`local_eligible`, `offline_eligible`). */
733
+ setFulfillment(fulfillment: FulfillmentEligibilityInput$1 | null): void;
734
+ /** Registers payment eligibility metadata for `getRouteEligibility()`. */
735
+ setPaymentEligibility(payments: PaymentEligibilityInput$1[]): void;
736
+ private registerPaymentEligibility;
737
+ private isDeviceOffline;
738
+ private routeBaseUrl;
739
+ private routeHttp;
740
+ private activeHttp;
741
+ private collectRouteTenders;
742
+ /**
743
+ * Computes effective local/offline eligibility, available routes, preferred
744
+ * route, and machine-readable reasons for this order.
745
+ */
746
+ getRouteEligibility(input?: {
747
+ payment?: PlaceOrderInput["payment"];
748
+ offline?: boolean;
749
+ }): RouteEligibility$1;
750
+ private handleFlushRouteError;
701
751
  /** Whether local edits failed to reach the server (e.g. offline). */
702
752
  hasPendingSync(): boolean;
703
753
  /** Retries pending edits; call when connectivity returns. */
@@ -842,7 +892,11 @@ declare class Order {
842
892
  * `OrderPaymentRequiredError` instead of placing.
843
893
  */
844
894
  placeOrder(input?: PlaceOrderInput): Promise<void>;
895
+ private placeOrderSmart;
896
+ private recoverPlaceFailure;
897
+ private verifyPlacedOnRoute;
845
898
  private placeOnce;
899
+ private placeOnceTracked;
846
900
  /** Installed `@fire-spark/payments-*` adapters (provider + method). */
847
901
  setPaymentAdapters(adapters: PaymentAdapter[]): void;
848
902
  /** Template modal/sheet the adapters use to talk to the customer. */
@@ -1282,6 +1336,192 @@ interface CartPlacement {
1282
1336
  * Indices are assigned here. A forged index in the cart is not an input. */
1283
1337
  declare const placeCartLines: (root: OrderLine, lines: OrderLine[], lookup: MenuLookup$1, locale: string) => CartPlacement;
1284
1338
  //#endregion
1339
+ //#region src/order/routing/classify.d.ts
1340
+ interface RouteFailureClassification {
1341
+ kind: RouteFailureKind$1;
1342
+ shouldReroute: boolean;
1343
+ shouldVerifyOriginal: boolean;
1344
+ markRouteDown: boolean;
1345
+ aborted: boolean;
1346
+ reason: string;
1347
+ }
1348
+ /**
1349
+ * Classifies a route failure per Local Nodes Architecture §4:
1350
+ * - Business 4xx -> never reroute
1351
+ * - TLS mismatch / DNS / connection refused / connect timeout -> obvious outage
1352
+ * - Gateway 503 LOCAL_NODE_DRAINING / 502 LOCAL_CLOUD_UNREACHABLE -> reroute
1353
+ * - Generic 5xx / response timeout / mid-response drop -> ambiguous (verify first)
1354
+ */
1355
+ declare const classifyRouteFailure: (error: unknown, options?: {
1356
+ signal?: AbortSignal;
1357
+ }) => RouteFailureClassification;
1358
+ //#endregion
1359
+ //#region src/order/routing/eligibility.d.ts
1360
+ interface SdkPaymentEligibility {
1361
+ readonly local_eligible: boolean;
1362
+ readonly offline_eligible: boolean;
1363
+ }
1364
+ /**
1365
+ * Provider + method eligibility ceilings mirrored from P1/P5
1366
+ * (`PAYMENT_PROVIDER_ELIGIBILITY_CEILINGS`). Online CARD, 3DS, redirect,
1367
+ * DEUNA, and Cashea are always cloud-only; REDEMPTION is never offline.
1368
+ */
1369
+ declare const SDK_PAYMENT_ELIGIBILITY_CEILINGS: Readonly<Record<string, SdkPaymentEligibility>>;
1370
+ declare const resolveSdkPaymentEligibilityCeiling: (providerId?: string | null, method?: string | null) => SdkPaymentEligibility;
1371
+ interface ResolvedPaymentEligibility extends SdkPaymentEligibility {
1372
+ ceiling: SdkPaymentEligibility;
1373
+ }
1374
+ /**
1375
+ * Effective payment eligibility:
1376
+ * `payment.local_eligible && method.local_eligible && ceiling.local_eligible`
1377
+ * (and `offline_eligible => local_eligible`).
1378
+ */
1379
+ declare const resolvePaymentEligibility: (payment: PaymentEligibilityInput$1) => ResolvedPaymentEligibility;
1380
+ interface RouteTenderCandidate {
1381
+ payment_id?: string | null;
1382
+ method?: string | null;
1383
+ provider?: string | null;
1384
+ }
1385
+ interface RouteHealthSnapshot {
1386
+ cloudDown: boolean;
1387
+ localDown: boolean;
1388
+ localSnapshotStale: boolean;
1389
+ localTlsMismatch: boolean;
1390
+ }
1391
+ interface ResolveRouteEligibilityInput {
1392
+ routes?: OrderRoutes$1 | null;
1393
+ fulfillment?: FulfillmentEligibilityInput$1 | null;
1394
+ tenders: readonly RouteTenderCandidate[];
1395
+ paymentsById: ReadonlyMap<string, PaymentEligibilityInput$1>;
1396
+ hasInFlightCharge?: boolean;
1397
+ activeRoute?: OrderRouteKind$1 | null;
1398
+ health?: RouteHealthSnapshot;
1399
+ offline?: boolean;
1400
+ /** Override whether a TLS-layer pinning transport is available on this host. */
1401
+ tlsPinningAvailable?: boolean;
1402
+ }
1403
+ declare const resolveOrderRouteEligibility: (input: ResolveRouteEligibilityInput) => RouteEligibility$1;
1404
+ //#endregion
1405
+ //#region src/order/routing/errors.d.ts
1406
+ declare class TlsFingerprintMismatchError extends Error {
1407
+ readonly code: "TLS_FINGERPRINT_MISMATCH";
1408
+ readonly url: string;
1409
+ readonly expected: string;
1410
+ readonly actual: string | null;
1411
+ constructor(url: string, expected: string, actual?: string | null);
1412
+ }
1413
+ declare const isTlsFingerprintMismatchError: (error: unknown) => error is TlsFingerprintMismatchError;
1414
+ declare class OrderRouteUnavailableError extends Error {
1415
+ readonly code: "ROUTE_UNAVAILABLE";
1416
+ readonly eligibility: RouteEligibility$1;
1417
+ constructor(eligibility: RouteEligibility$1, message?: string);
1418
+ }
1419
+ declare const isOrderRouteUnavailableError: (error: unknown) => error is OrderRouteUnavailableError;
1420
+ //#endregion
1421
+ //#region src/shared/certFingerprint.d.ts
1422
+ /** Normalize a SHA-256 certificate fingerprint to colon-separated uppercase. */
1423
+ declare const normalizeCertFingerprint: (raw: string) => string | null;
1424
+ /** Constant-length comparison of two SHA-256 certificate fingerprints. */
1425
+ declare const certFingerprintsMatch: (expected: string | null | undefined, actual: string | null | undefined) => boolean;
1426
+ /**
1427
+ * Collects and normalizes all valid SHA-256 leaf pins from a local server
1428
+ * config (`tls_fingerprint` + optional rotation `tls_fingerprints`).
1429
+ * Empty array means no valid pin is configured (fail-closed).
1430
+ */
1431
+ declare const resolveLocalPins: (local: Pick<LocalServerConfig$1, "tls_fingerprint" | "tls_fingerprints"> | null | undefined) => string[];
1432
+ /** Returns true when `actual` matches any normalized SHA-256 pin in `pins`. */
1433
+ declare const certMatchesAnyPin: (pins: readonly string[], actual: string | null | undefined) => boolean;
1434
+ //#endregion
1435
+ //#region src/shared/localServer.d.ts
1436
+ /** Build `https://<host>:<port>`, wrapping bare IPv6 literals in brackets. */
1437
+ declare const formatLocalServerUrl: (host: string, port: number) => string;
1438
+ /** Extract the local server base URL from `OrderRoutes`, or `null` if disabled. */
1439
+ declare const resolveLocalRouteUrl: (routes?: OrderRoutes$1 | null) => string | null;
1440
+ interface TestLocalServerHealthOptions {
1441
+ fetchImpl?: typeof fetch;
1442
+ timeoutMs?: number;
1443
+ /** Optional runtime hook to verify the peer TLS leaf cert fingerprint. */
1444
+ verifyFingerprint?: (expected: string) => Promise<boolean>;
1445
+ }
1446
+ /** Test connectivity to a local server via `GET /local/v1/health`. */
1447
+ declare const testLocalServerHealth: (target: Pick<LocalServerConfig$1, "url" | "tls_fingerprint" | "tls_fingerprints">, options?: TestLocalServerHealthOptions) => Promise<LocalServerHealthResult$1>;
1448
+ //#endregion
1449
+ //#region src/order/routing/health.d.ts
1450
+ /** Default cooldown before re-probing a failed route (30 s). */
1451
+ declare const DEFAULT_ROUTE_COOLDOWN_MS = 30000;
1452
+ /** Default max local snapshot age for online local routing (24 h). */
1453
+ declare const DEFAULT_MAX_SNAPSHOT_AGE_MS: number;
1454
+ /** Subscribe to route health transitions (down, degraded, healthy). */
1455
+ declare const onRouteHealth: (listener: RouteHealthListener$1) => () => void;
1456
+ declare const getRouteHealth: (route: OrderRouteKind$1, baseUrl: string) => RouteHealthEvent$1 | null;
1457
+ interface MarkRouteDownInput {
1458
+ route: OrderRouteKind$1;
1459
+ baseUrl: string;
1460
+ cooldownMs?: number;
1461
+ reason?: string | null;
1462
+ failureKind?: RouteFailureKind$1 | null;
1463
+ now?: number;
1464
+ listener?: RouteHealthListener$1;
1465
+ }
1466
+ declare const markRouteDown: (input: MarkRouteDownInput) => RouteHealthEvent$1;
1467
+ declare const markRouteHealthy: (route: OrderRouteKind$1, baseUrl: string, options?: {
1468
+ now?: number;
1469
+ listener?: RouteHealthListener$1;
1470
+ }) => RouteHealthEvent$1 | null;
1471
+ /**
1472
+ * Returns true while `downUntil` is active. Automatically clears expired
1473
+ * cooldowns so the next request re-probes the route.
1474
+ */
1475
+ declare const isRouteCircuitOpen: (route: OrderRouteKind$1, baseUrl: string, now?: number) => boolean;
1476
+ declare const verifyLocalRoutePin: (local: Pick<LocalServerConfig$1, "url" | "tls_fingerprint" | "tls_fingerprints">, verifyFingerprint?: (expected: string) => Promise<boolean>, now?: number) => Promise<void>;
1477
+ interface ProbeLocalRouteHealthOptions extends TestLocalServerHealthOptions {
1478
+ maxSnapshotAgeMs?: number;
1479
+ cooldownMs?: number;
1480
+ listener?: RouteHealthListener$1;
1481
+ }
1482
+ interface LocalRouteProbeResult extends LocalServerHealthResult$1 {
1483
+ snapshot_stale: boolean;
1484
+ }
1485
+ /**
1486
+ * Probes `GET /local/v1/health`, verifies TLS pin + snapshot freshness,
1487
+ * and updates circuit breaker state + `onRouteHealth` listeners.
1488
+ */
1489
+ declare const probeLocalRouteHealth: (local: Pick<LocalServerConfig$1, "url" | "tls_fingerprint" | "tls_fingerprints">, options?: ProbeLocalRouteHealthOptions) => Promise<LocalRouteProbeResult>;
1490
+ //#endregion
1491
+ //#region src/order/routing/router.d.ts
1492
+ /** Request header hinting to the local node that the device is offline. */
1493
+ declare const MODE_HINT_HEADER = "x-firespark-mode-hint";
1494
+ /**
1495
+ * @deprecated TLS pinning is enforced at the TLS handshake layer, never via
1496
+ * request headers. Kept exported only so existing callers do not break.
1497
+ */
1498
+ declare const TLS_PIN_HEADER = "x-firespark-tls-pin";
1499
+ /**
1500
+ * @deprecated TLS pinning is enforced at the TLS handshake layer, never via
1501
+ * response headers. Kept exported only so existing callers do not break.
1502
+ */
1503
+ declare const TLS_FINGERPRINT_RESPONSE_HEADER = "x-firespark-tls-fingerprint";
1504
+ declare const hasSmartRouting: (routes?: OrderRoutes$1 | null) => boolean;
1505
+ /**
1506
+ * True when any live tender on the current intent has an in-flight charge
1507
+ * (`status === "PENDING"` with an `attempt_reference` on a PIN pad / provider).
1508
+ * Per §4, the SDK never reroutes until that tender resolves.
1509
+ */
1510
+ declare const hasInFlightPayment: (order: Order$1) => boolean;
1511
+ interface BuildRouteHttpInput {
1512
+ base: ServiceHttpOptions;
1513
+ routes: OrderRoutes$1;
1514
+ target: OrderRouteKind$1;
1515
+ offlineHint?: boolean;
1516
+ verifyTlsFingerprint?: (expected: string) => Promise<boolean>;
1517
+ }
1518
+ /**
1519
+ * Builds route-scoped `ServiceHttpOptions`. Cloud requests are sent directly
1520
+ * to `routes.cloud` with no local headers; local requests enforce TLS-layer
1521
+ * certificate pinning (fail-closed) and optional offline mode hint headers.
1522
+ */
1523
+ declare const buildRouteHttpOptions: (input: BuildRouteHttpInput) => ServiceHttpOptions;
1524
+ //#endregion
1285
1525
  //#region src/services/availability.d.ts
1286
1526
  declare const getAvailability: (scope?: StorefrontMenuScope, options?: ServiceHttpOptions) => Promise<StorefrontAvailability>;
1287
1527
  //#endregion
@@ -1657,6 +1897,35 @@ declare const getOrigin: () => OriginState | null;
1657
1897
  /** Called when the answering origin (cloud, local, fallback) changes. */
1658
1898
  declare const onOriginChange: (listener: OriginListener) => () => void;
1659
1899
  //#endregion
1900
+ //#region src/shared/nodePinnedFetch.d.ts
1901
+ interface PinnedFetchOptions {
1902
+ timeoutMs?: number;
1903
+ }
1904
+ type PinnedFetchFactory = (pins: readonly string[], options?: PinnedFetchOptions) => typeof fetch;
1905
+ /**
1906
+ * Node.js TLS-layer certificate pinning fetch.
1907
+ * Verifies the peer leaf X.509 certificate SHA-256 fingerprint during the
1908
+ * TLS handshake (`secureConnect`) BEFORE handing the socket to `https.request`,
1909
+ * ensuring zero HTTP headers or request body bytes are sent on mismatch.
1910
+ */
1911
+ declare const createNodePinnedFetch: (pins: readonly string[], options?: PinnedFetchOptions) => typeof fetch;
1912
+ //#endregion
1913
+ //#region src/shared/tlsPinning.d.ts
1914
+ /** True when running on Node.js where `node:tls` pinning is built in. */
1915
+ declare const isNodeRuntime: () => boolean;
1916
+ /**
1917
+ * Registers the host's real TLS-layer pinning transport (e.g. the Expo
1918
+ * `@fire-spark/tls-pinning` native iOS/Android bridge). Pass `null` to reset.
1919
+ */
1920
+ declare const configureLocalTlsPinning: (factory: PinnedFetchFactory | null) => void;
1921
+ /**
1922
+ * Returns the active TLS-layer pinning transport, or `null` when the current
1923
+ * runtime cannot enforce certificate pinning at the TLS layer (fail-closed).
1924
+ */
1925
+ declare const getLocalTlsPinning: () => PinnedFetchFactory | null;
1926
+ /** True when the current host can enforce TLS-layer certificate pinning. */
1927
+ declare const hasLocalTlsPinning: () => boolean;
1928
+ //#endregion
1660
1929
  //#region src/schedule/schedule.d.ts
1661
1930
  type ScheduleWindow = {
1662
1931
  active: true;
@@ -1851,6 +2120,7 @@ declare class RulesEngine {
1851
2120
  customer?: RulesEngineParams["customer"];
1852
2121
  payment?: RulesEngineParams["payment"];
1853
2122
  monitoring?: RulesEngineParams["monitoring"];
2123
+ execution?: RulesEngineParams["execution"];
1854
2124
  referenceDate?: string;
1855
2125
  timezone?: string;
1856
2126
  runtime?: RulesEngineParams["runtime"];
@@ -2280,6 +2550,8 @@ declare const findNodeById: (workflow: OrderFulfillmentWorkflow, nodeId: string)
2280
2550
  finished_at: string;
2281
2551
  duration_ms: number;
2282
2552
  ok: boolean;
2553
+ omitted?: boolean | undefined;
2554
+ omitted_reason?: string | undefined;
2283
2555
  http_status?: number | undefined;
2284
2556
  error?: string | undefined;
2285
2557
  payload?: {
@@ -2362,6 +2634,8 @@ declare const findStartNode: (workflow: OrderFulfillmentWorkflow) => {
2362
2634
  finished_at: string;
2363
2635
  duration_ms: number;
2364
2636
  ok: boolean;
2637
+ omitted?: boolean | undefined;
2638
+ omitted_reason?: string | undefined;
2365
2639
  http_status?: number | undefined;
2366
2640
  error?: string | undefined;
2367
2641
  payload?: {
@@ -2443,7 +2717,7 @@ declare const outgoingEdges: (workflow: OrderFulfillmentWorkflow, nodeId: string
2443
2717
  channel_id: string;
2444
2718
  brand_id: string;
2445
2719
  primitive: "boolean";
2446
- type: "Customer is anonymous" | "Is anonymous order" | "Order includes product with tag" | "Order is scheduled" | "Payment captured" | "Payment is mixed";
2720
+ type: "Customer is anonymous" | "Is anonymous order" | "Is running local" | "Is running offline" | "Order includes product with tag" | "Order is scheduled" | "Payment captured" | "Payment is mixed";
2447
2721
  operator: "is" | "is not";
2448
2722
  value: boolean;
2449
2723
  invalidMessage?: string | undefined;
@@ -2552,7 +2826,7 @@ declare const incomingEdges: (workflow: OrderFulfillmentWorkflow, nodeId: string
2552
2826
  channel_id: string;
2553
2827
  brand_id: string;
2554
2828
  primitive: "boolean";
2555
- type: "Customer is anonymous" | "Is anonymous order" | "Order includes product with tag" | "Order is scheduled" | "Payment captured" | "Payment is mixed";
2829
+ type: "Customer is anonymous" | "Is anonymous order" | "Is running local" | "Is running offline" | "Order includes product with tag" | "Order is scheduled" | "Payment captured" | "Payment is mixed";
2556
2830
  operator: "is" | "is not";
2557
2831
  value: boolean;
2558
2832
  invalidMessage?: string | undefined;
@@ -2661,7 +2935,7 @@ declare const defaultOutgoingEdge: (workflow: OrderFulfillmentWorkflow, nodeId:
2661
2935
  channel_id: string;
2662
2936
  brand_id: string;
2663
2937
  primitive: "boolean";
2664
- type: "Customer is anonymous" | "Is anonymous order" | "Order includes product with tag" | "Order is scheduled" | "Payment captured" | "Payment is mixed";
2938
+ type: "Customer is anonymous" | "Is anonymous order" | "Is running local" | "Is running offline" | "Order includes product with tag" | "Order is scheduled" | "Payment captured" | "Payment is mixed";
2665
2939
  operator: "is" | "is not";
2666
2940
  value: boolean;
2667
2941
  invalidMessage?: string | undefined;
@@ -2716,6 +2990,7 @@ declare const matchingPrimaryOutgoing: (input: {
2716
2990
  workflow: OrderFulfillmentWorkflow;
2717
2991
  nodeId: string;
2718
2992
  order: OrderRecord;
2993
+ execution?: RulesEngineParams["execution"];
2719
2994
  outgoingBySource?: Map<string, OrderFulfillmentWorkflowEdge[]>;
2720
2995
  nodesById?: Map<string, OrderFulfillmentWorkflowNode>;
2721
2996
  }) => OrderFulfillmentWorkflowEdge[];
@@ -2734,6 +3009,7 @@ declare const resolveAdvanceEdges: (input: {
2734
3009
  currentNodeIds: string[];
2735
3010
  fulfillmentStatus: string;
2736
3011
  order: OrderRecord;
3012
+ execution?: RulesEngineParams["execution"];
2737
3013
  }) => OrderFulfillmentWorkflowEdge[];
2738
3014
  declare const findMappedStatusNode: (workflow: OrderFulfillmentWorkflow, status: string) => {
2739
3015
  id: string;
@@ -2797,6 +3073,8 @@ declare const findMappedStatusNode: (workflow: OrderFulfillmentWorkflow, status:
2797
3073
  finished_at: string;
2798
3074
  duration_ms: number;
2799
3075
  ok: boolean;
3076
+ omitted?: boolean | undefined;
3077
+ omitted_reason?: string | undefined;
2800
3078
  http_status?: number | undefined;
2801
3079
  error?: string | undefined;
2802
3080
  payload?: {
@@ -2823,6 +3101,7 @@ declare const resolveSuccessTerminalEdges: (input: {
2823
3101
  workflow: OrderFulfillmentWorkflow;
2824
3102
  currentNodeIds: string[];
2825
3103
  order: OrderRecord;
3104
+ execution?: RulesEngineParams["execution"];
2826
3105
  }) => OrderFulfillmentWorkflowEdge[];
2827
3106
  /**
2828
3107
  * The `cancel` / `refund` edge out of the current nodes whose conditions
@@ -2833,6 +3112,7 @@ declare const resolveFailureTerminalEdge: (input: {
2833
3112
  workflow: OrderFulfillmentWorkflow;
2834
3113
  currentNodeIds: string[];
2835
3114
  order: OrderRecord;
3115
+ execution?: RulesEngineParams["execution"];
2836
3116
  }) => {
2837
3117
  edge: {
2838
3118
  id: string;
@@ -2895,7 +3175,7 @@ declare const resolveFailureTerminalEdge: (input: {
2895
3175
  channel_id: string;
2896
3176
  brand_id: string;
2897
3177
  primitive: "boolean";
2898
- type: "Customer is anonymous" | "Is anonymous order" | "Order includes product with tag" | "Order is scheduled" | "Payment captured" | "Payment is mixed";
3178
+ type: "Customer is anonymous" | "Is anonymous order" | "Is running local" | "Is running offline" | "Order includes product with tag" | "Order is scheduled" | "Payment captured" | "Payment is mixed";
2899
3179
  operator: "is" | "is not";
2900
3180
  value: boolean;
2901
3181
  invalidMessage?: string | undefined;
@@ -3005,6 +3285,8 @@ declare const resolveFailureTerminalEdge: (input: {
3005
3285
  finished_at: string;
3006
3286
  duration_ms: number;
3007
3287
  ok: boolean;
3288
+ omitted?: boolean | undefined;
3289
+ omitted_reason?: string | undefined;
3008
3290
  http_status?: number | undefined;
3009
3291
  error?: string | undefined;
3010
3292
  payload?: {
@@ -3031,6 +3313,7 @@ declare const resolveAdvanceEdge: (input: {
3031
3313
  currentNodeIds: string[];
3032
3314
  fulfillmentStatus: string;
3033
3315
  order: OrderRecord;
3316
+ execution?: RulesEngineParams["execution"];
3034
3317
  }) => OrderFulfillmentWorkflowEdge | null;
3035
3318
  declare const nextCurrentNodeIds: (input: {
3036
3319
  workflow: OrderFulfillmentWorkflow;
@@ -3039,6 +3322,7 @@ declare const nextCurrentNodeIds: (input: {
3039
3322
  entered: boolean;
3040
3323
  takenSourceIds: string[];
3041
3324
  order?: OrderRecord;
3325
+ execution?: RulesEngineParams["execution"];
3042
3326
  }) => string[];
3043
3327
  /** Prefer the entered target, then any sitting terminal, then the first head. */
3044
3328
  declare const sittingWorkflowNode: (workflow: OrderFulfillmentWorkflow, currentNodeIds: string[], fallbackId?: string) => {
@@ -3103,6 +3387,8 @@ declare const sittingWorkflowNode: (workflow: OrderFulfillmentWorkflow, currentN
3103
3387
  finished_at: string;
3104
3388
  duration_ms: number;
3105
3389
  ok: boolean;
3390
+ omitted?: boolean | undefined;
3391
+ omitted_reason?: string | undefined;
3106
3392
  http_status?: number | undefined;
3107
3393
  error?: string | undefined;
3108
3394
  payload?: {
@@ -3165,6 +3451,7 @@ declare const enterWorkflowNode: (input: {
3165
3451
  fromEdgeId?: string;
3166
3452
  fromEdgeIds?: string[];
3167
3453
  order?: OrderRecord;
3454
+ execution?: RulesEngineParams["execution"];
3168
3455
  }) => {
3169
3456
  id: string;
3170
3457
  type: "fulfillmentStep";
@@ -3227,6 +3514,8 @@ declare const enterWorkflowNode: (input: {
3227
3514
  finished_at: string;
3228
3515
  duration_ms: number;
3229
3516
  ok: boolean;
3517
+ omitted?: boolean | undefined;
3518
+ omitted_reason?: string | undefined;
3230
3519
  http_status?: number | undefined;
3231
3520
  error?: string | undefined;
3232
3521
  payload?: {
@@ -3274,8 +3563,14 @@ declare const orderFieldsFromNode: (node: Pick<OrderFulfillmentWorkflowNode, "da
3274
3563
  //#region src/fulfillment/status.d.ts
3275
3564
  type NodeKind = OrderFulfillmentWorkflowNode["data"]["kind"];
3276
3565
  type PathKind = "default" | "success" | "cancel" | "refund";
3566
+ /** Terminal fulfillment statuses recognized by the workflow model. */
3567
+ declare const FULFILLMENT_WORKFLOW_TERMINAL_STATUSES: readonly ["FULFILLED", "VOIDED", "REFUNDED", "REVERSED", "FAILED"];
3568
+ /** System-reserved status keys set by the engine, not merchant steps. */
3569
+ declare const RESERVED_FULFILLMENT_STATUSES: readonly ["FAILED"];
3277
3570
  /** `injecting` / ` Injecting ` → `INJECTING`. Casing never matters. */
3278
3571
  declare const normalizeFulfillmentStatus: (status: string) => string;
3572
+ declare const isReservedFulfillmentStatus: (status: string) => boolean;
3573
+ declare const isTerminalFulfillmentStatus: (status: string) => boolean;
3279
3574
  declare const fulfillmentStatusesEqual: (left: string, right: string) => boolean;
3280
3575
  /** Edge path kind is derived from the target: default, or terminal outcome. */
3281
3576
  declare const pathKindForTargetNode: (target?: {
@@ -3283,6 +3578,490 @@ declare const pathKindForTargetNode: (target?: {
3283
3578
  mappedStatus?: string;
3284
3579
  } | null) => PathKind;
3285
3580
  //#endregion
3581
+ //#region src/fulfillment/engine/engine.types.d.ts
3582
+ declare const WORKFLOW_SCHEMA_VERSION = 1;
3583
+ declare const MAX_SUPPORTED_WORKFLOW_SCHEMA_VERSION = 1;
3584
+ declare const SCHEDULED_STATUS = "AWAITING_SCHEDULED_TIME";
3585
+ declare const CALLBACK_MISSING_LOCAL_URL = "CALLBACK_MISSING_LOCAL_URL";
3586
+ declare const WORKFLOW_TIMEOUT = "WORKFLOW_TIMEOUT";
3587
+ declare const OFFLINE_NO_LOCAL_URL = "OFFLINE_NO_LOCAL_URL";
3588
+ declare const DEFAULT_WEBHOOK_TIMEOUT_S = 10;
3589
+ declare const DEFAULT_MAX_INCOMPLETE_MINUTES = 240;
3590
+ declare const MIN_MAX_INCOMPLETE_MINUTES = 1;
3591
+ declare const MAX_MAX_INCOMPLETE_MINUTES = 43200;
3592
+ type FulfillmentStepName = "ACCEPTING" | "PROCESS_STATE_NODE" | "PAUSE_FOR_ADVANCE" | "WARN_NO_EDGE" | "FINALIZE" | "ROLLBACK_PROCESS_STATE_NODE" | "ROLLBACK_ACCEPT";
3593
+ type FulfillmentRunStatus = "PROCESSING" | "WAITING" | "SUCCESS" | "FAILED";
3594
+ type FulfillmentTerminalOrderStatus = "COMPLETED" | "VOIDED" | "REVERSED" | "REFUNDED" | "FAILED";
3595
+ type EngineOrderStatus = "OPEN" | "CLOSED" | "COMPLETED" | "VOIDED" | "REVERSED" | "REFUNDED" | "CANCELLED" | "FAILED";
3596
+ interface EngineExecutionContext {
3597
+ is_local: boolean;
3598
+ is_offline: boolean;
3599
+ }
3600
+ interface EngineStepLog {
3601
+ type: "info" | "success" | "warning" | "error";
3602
+ message: string;
3603
+ code?: string;
3604
+ details?: Record<string, unknown>;
3605
+ }
3606
+ interface EngineStepLogEntry {
3607
+ started_at: string;
3608
+ ended_at: string | null;
3609
+ step: FulfillmentStepName;
3610
+ logs: EngineStepLog[];
3611
+ }
3612
+ type EngineStepsLogs = EngineStepLogEntry[];
3613
+ interface EngineOrder extends OrderRecord {
3614
+ scheduled_at?: string | null;
3615
+ }
3616
+ interface EngineOrderFulfillment {
3617
+ id: string;
3618
+ order_id: string;
3619
+ fulfillment_id: string;
3620
+ workflow_version?: number;
3621
+ workflow: OrderFulfillmentWorkflow;
3622
+ current_node_ids: string[];
3623
+ step: FulfillmentStepName;
3624
+ status: FulfillmentRunStatus;
3625
+ run_id: string;
3626
+ steps_logs: EngineStepsLogs;
3627
+ warning_count: number;
3628
+ expires_at?: string | null;
3629
+ scheduled_wake_at?: string | null;
3630
+ error_code?: string | null;
3631
+ error_message?: string | null;
3632
+ }
3633
+ interface EngineWebhookTarget {
3634
+ id: string;
3635
+ alias?: string | null;
3636
+ url: string;
3637
+ local_url?: string | null;
3638
+ type?: string | null;
3639
+ events: string[];
3640
+ timeout?: number | null;
3641
+ retries?: number | null;
3642
+ secret?: string | null;
3643
+ metadata?: Record<string, unknown> | null;
3644
+ }
3645
+ interface EngineWebhookEnvelope {
3646
+ id: string;
3647
+ type: string;
3648
+ created_at: string;
3649
+ data: Record<string, unknown>;
3650
+ }
3651
+ interface EngineWebhookNodeRun {
3652
+ id: string;
3653
+ webhook_id: string;
3654
+ alias: string | null;
3655
+ url: string;
3656
+ type: string;
3657
+ status: string;
3658
+ started_at: string;
3659
+ finished_at: string;
3660
+ duration_ms: number;
3661
+ ok: boolean;
3662
+ omitted?: boolean;
3663
+ omitted_reason?: string;
3664
+ http_status?: number;
3665
+ error?: string;
3666
+ payload?: EngineWebhookEnvelope;
3667
+ idempotency_key?: string;
3668
+ resent_by?: string;
3669
+ }
3670
+ interface EngineCallbackRunError {
3671
+ attempt: number;
3672
+ at: string;
3673
+ message: string;
3674
+ status?: number;
3675
+ body?: unknown;
3676
+ started_at?: string;
3677
+ duration_ms?: number;
3678
+ }
3679
+ interface EngineCallbackRun {
3680
+ attempt: number;
3681
+ errors: EngineCallbackRunError[];
3682
+ response?: unknown;
3683
+ started_at?: string;
3684
+ finished_at?: string;
3685
+ duration_ms?: number;
3686
+ }
3687
+ interface CallbackMissingLocalUrlDetails {
3688
+ mode: "offline";
3689
+ node_id: string;
3690
+ node_name: string;
3691
+ step: string;
3692
+ webhook_id: string;
3693
+ webhook_name: string;
3694
+ }
3695
+ interface WorkflowTimeoutDetails {
3696
+ max_incomplete_minutes: number;
3697
+ elapsed_minutes: number;
3698
+ node_id: string | null;
3699
+ node_name: string | null;
3700
+ status: string;
3701
+ }
3702
+ interface EngineFulfillmentPatch {
3703
+ workflow?: OrderFulfillmentWorkflow;
3704
+ current_node_ids?: string[];
3705
+ step?: FulfillmentStepName;
3706
+ status?: FulfillmentRunStatus;
3707
+ run_id?: string;
3708
+ steps_logs?: EngineStepsLogs;
3709
+ warning_count?: number;
3710
+ expires_at?: string | null;
3711
+ error_code?: string | null;
3712
+ error_message?: string | null;
3713
+ scheduled_wake_at?: string | null;
3714
+ }
3715
+ interface EngineOrderStatusPatch {
3716
+ fulfillment_status: string;
3717
+ status?: FulfillmentTerminalOrderStatus;
3718
+ resolved_at?: string | null;
3719
+ }
3720
+ interface EngineFlagReviewInput {
3721
+ order: EngineOrder;
3722
+ key: string;
3723
+ message: string;
3724
+ }
3725
+ interface FulfillmentStoragePort {
3726
+ getOrderFulfillment: (orderFulfillmentId: string) => Promise<EngineOrderFulfillment | null>;
3727
+ getOrder: (orderId: string) => Promise<EngineOrder | null>;
3728
+ updateOrderFulfillment: (orderFulfillmentId: string, patch: EngineFulfillmentPatch) => Promise<void>;
3729
+ casPauseOrderFulfillment: (orderFulfillmentId: string, patch: {
3730
+ steps_logs: EngineStepsLogs;
3731
+ workflow?: OrderFulfillmentWorkflow;
3732
+ }) => Promise<boolean>;
3733
+ updateOrderStatusAndSettle: (orderId: string, patch: EngineOrderStatusPatch) => Promise<void>;
3734
+ mergeOrderMetadata: (orderId: string, metadata: Record<string, unknown>) => Promise<void>;
3735
+ persistNodeWebhookRuns: (orderFulfillmentId: string, nodeId: string, runs: EngineWebhookNodeRun[]) => Promise<void>;
3736
+ flagOrderForReview?: (input: EngineFlagReviewInput) => Promise<void>;
3737
+ }
3738
+ interface EngineOrderChangedEvent {
3739
+ orderFulfillmentId: string;
3740
+ row?: EngineOrderFulfillment;
3741
+ order?: EngineOrder;
3742
+ error?: {
3743
+ message: string;
3744
+ code?: string;
3745
+ } | null;
3746
+ }
3747
+ interface EngineWebhookFailureEvent {
3748
+ order: EngineOrder;
3749
+ message: string;
3750
+ http_status?: number | null;
3751
+ webhook_id: string;
3752
+ url?: string;
3753
+ alias?: string | null;
3754
+ type?: string;
3755
+ nodeId?: string;
3756
+ }
3757
+ interface FulfillmentExecutionPort {
3758
+ getExecutionContext: () => EngineExecutionContext;
3759
+ now?: () => Date;
3760
+ loadWebhooks: () => Promise<EngineWebhookTarget[]>;
3761
+ signPayload?: (secret: string, body: string) => Promise<string>;
3762
+ fetchImpl?: typeof fetch;
3763
+ sleep?: (msOrDate: number | Date) => Promise<void>;
3764
+ readScheduledInstant?: (orderId: string) => Promise<string | null>;
3765
+ onOrderChanged?: (event: EngineOrderChangedEvent) => Promise<void>;
3766
+ onInjectionFailed?: (input: {
3767
+ orderId: string;
3768
+ message: string;
3769
+ code?: string;
3770
+ }) => Promise<void>;
3771
+ onWebhookFailed?: (event: EngineWebhookFailureEvent) => Promise<void>;
3772
+ onWaitingPayment?: (orderId: string) => Promise<void>;
3773
+ webhookRetryDelayMs?: (failureCount: number) => number;
3774
+ parseCallbackResponse?: (mappedStatus: string, body: unknown) => {
3775
+ ok: true;
3776
+ data: unknown;
3777
+ } | {
3778
+ ok: false;
3779
+ message: string;
3780
+ };
3781
+ toPublicWebhookOrder?: (order: EngineOrder) => Record<string, unknown>;
3782
+ webhookEventsForStatus?: (subscribed: string[], metadata: Record<string, unknown> | null | undefined, status: string) => string[];
3783
+ onRecordWebhookDeliveries?: (input: {
3784
+ orderId: string;
3785
+ runs: EngineWebhookNodeRun[];
3786
+ }) => Promise<void>;
3787
+ isPaymentCaptured?: (order: EngineOrder) => boolean;
3788
+ }
3789
+ interface FulfillmentPorts {
3790
+ storage: FulfillmentStoragePort;
3791
+ execution: FulfillmentExecutionPort;
3792
+ }
3793
+ interface EngineScope {
3794
+ orderFulfillmentId: string;
3795
+ orderId: string;
3796
+ }
3797
+ interface ProcessStateNodeConfig extends EngineScope {
3798
+ nodeId?: string;
3799
+ fromEdgeId?: string;
3800
+ fromEdgeIds?: string[];
3801
+ traverseStart?: boolean;
3802
+ runId?: string;
3803
+ terminalStatus?: "COMPLETED" | "VOIDED" | "REVERSED" | "REFUNDED";
3804
+ }
3805
+ interface ProcessStateNodeCallbackJob {
3806
+ nodeId: string;
3807
+ callback_ids: string[];
3808
+ }
3809
+ interface ProcessStateNodeResult {
3810
+ currentNodeId: string;
3811
+ currentNodeIds: string[];
3812
+ kind: "start" | "state" | "join" | "terminal";
3813
+ mappedStatus: string;
3814
+ entered: boolean;
3815
+ fromEdgeId?: string;
3816
+ fromEdgeIds?: string[];
3817
+ previousNodeIds?: string[];
3818
+ callbackJobs: ProcessStateNodeCallbackJob[];
3819
+ payment_status?: string;
3820
+ successTerminal?: {
3821
+ nodeId: string;
3822
+ edgeIds: string[];
3823
+ } | null;
3824
+ alreadyTerminal?: boolean;
3825
+ }
3826
+ interface EnterAndPauseResult {
3827
+ ran: ProcessStateNodeResult;
3828
+ paused: boolean;
3829
+ }
3830
+ interface AdvanceAndEnterConfig extends EngineScope {
3831
+ fulfillmentStatus: string;
3832
+ requestedAt?: string;
3833
+ terminalStatus?: "COMPLETED" | "VOIDED" | "REVERSED" | "REFUNDED";
3834
+ }
3835
+ type AdvanceAndEnterResult = {
3836
+ noEdge: true;
3837
+ } | {
3838
+ noEdge: false;
3839
+ ran: ProcessStateNodeResult;
3840
+ paused: boolean;
3841
+ };
3842
+ interface InvokeCallbackAttemptConfig extends EngineScope {
3843
+ nodeId: string;
3844
+ callbackId: string;
3845
+ failureCount: number;
3846
+ }
3847
+ interface InvokeCallbackAttemptResult {
3848
+ ok: boolean;
3849
+ message?: string;
3850
+ status?: number;
3851
+ retries: number;
3852
+ code?: string;
3853
+ details?: CallbackMissingLocalUrlDetails;
3854
+ fatal?: boolean;
3855
+ }
3856
+ interface DispatchWebhooksConfig extends EngineScope {
3857
+ previousNodeIds: string[];
3858
+ currentNodeIds: string[];
3859
+ }
3860
+ interface FinalizePlaceOrderConfig {
3861
+ orderFulfillmentId: string;
3862
+ status: "SUCCESS" | "FAILED";
3863
+ failureMessage?: string;
3864
+ errorCode?: string;
3865
+ errorDetails?: Record<string, unknown>;
3866
+ }
3867
+ interface PendingWebhooks {
3868
+ previousNodeIds: string[];
3869
+ currentNodeIds: string[];
3870
+ }
3871
+ interface EnterRunResult {
3872
+ next: ProcessStateNodeResult;
3873
+ failed: boolean;
3874
+ fatalCode?: string;
3875
+ fatalMessage?: string;
3876
+ fatalDetails?: CallbackMissingLocalUrlDetails;
3877
+ pending: PendingWebhooks | null;
3878
+ }
3879
+ //#endregion
3880
+ //#region src/fulfillment/engine/timeout.d.ts
3881
+ declare const normalizeMaxIncompleteMinutes: (value: unknown) => number;
3882
+ /**
3883
+ * Computes `expires_at = max(placed_at, scheduled_at) + max_incomplete_minutes`
3884
+ * so future-scheduled orders do not expire before their scheduled window.
3885
+ */
3886
+ declare const computeOrderExpiresAt: (input: {
3887
+ placedAt: Date | string;
3888
+ scheduledAt?: Date | string | null;
3889
+ maxIncompleteMinutes?: number | null;
3890
+ }) => string;
3891
+ /** True when a run is still active and its `expires_at` deadline has passed. */
3892
+ declare const isExpiredFulfillment: (row: Pick<EngineOrderFulfillment, "status" | "expires_at">, now?: Date) => boolean;
3893
+ declare const buildWorkflowTimeoutDetails: (input: {
3894
+ row: Pick<EngineOrderFulfillment, "workflow" | "current_node_ids" | "status">;
3895
+ order?: Pick<EngineOrder, "issued_at" | "scheduled_at"> | null;
3896
+ createdAt?: string | null;
3897
+ maxIncompleteMinutes?: number | null;
3898
+ now?: Date;
3899
+ }) => {
3900
+ message: string;
3901
+ details: WorkflowTimeoutDetails;
3902
+ };
3903
+ //#endregion
3904
+ //#region src/fulfillment/engine/versioning.d.ts
3905
+ declare class WorkflowSchemaVersionError extends Error {
3906
+ readonly code = "UNSUPPORTED_WORKFLOW_SCHEMA_VERSION";
3907
+ readonly schemaVersion: number;
3908
+ readonly maxSupportedVersion: number;
3909
+ constructor(schemaVersion: number, maxSupportedVersion: number);
3910
+ }
3911
+ /** Reads the schema version from a workflow object; absent defaults to 1. */
3912
+ declare const workflowSchemaVersionOf: (workflow: unknown) => number;
3913
+ declare const isSupportedWorkflowSchemaVersion: (workflow: unknown, maxSupported?: number) => boolean;
3914
+ declare const assertSupportedWorkflowSchemaVersion: (workflow: unknown, maxSupported?: number) => number;
3915
+ //#endregion
3916
+ //#region src/fulfillment/engine/stepsLogs.d.ts
3917
+ declare const beginEngineStepLog: (steps_logs: EngineStepsLogs, step: FulfillmentStepName, message?: string, now?: () => Date) => void;
3918
+ declare const appendEngineStepLog: (steps_logs: EngineStepsLogs, step: FulfillmentStepName, log: EngineStepLog) => void;
3919
+ declare const completeEngineStepLog: (steps_logs: EngineStepsLogs, step: FulfillmentStepName, message: string, now?: () => Date) => void;
3920
+ declare const failActiveEngineStepLog: (steps_logs: EngineStepsLogs, message: string, extra?: {
3921
+ code?: string;
3922
+ details?: Record<string, unknown>;
3923
+ now?: () => Date;
3924
+ }) => void;
3925
+ //#endregion
3926
+ //#region src/fulfillment/engine/processStateNode.d.ts
3927
+ declare const isInterruptTerminalStatus: (status: string | undefined) => boolean;
3928
+ declare const defaultIsPaymentCaptured: (order: EngineOrder) => boolean;
3929
+ declare const callbackIdsFromNode: (actions?: {
3930
+ type: string;
3931
+ callback_ids?: string[];
3932
+ }[]) => string[];
3933
+ declare const processStateNode: (ports: FulfillmentPorts, config: ProcessStateNodeConfig) => Promise<ProcessStateNodeResult>;
3934
+ //#endregion
3935
+ //#region src/fulfillment/engine/pauseForAdvance.d.ts
3936
+ interface PauseForAdvanceConfig {
3937
+ orderFulfillmentId: string;
3938
+ }
3939
+ interface ResumeFromAdvanceConfig extends PauseForAdvanceConfig {
3940
+ orderId: string;
3941
+ fulfillmentStatus?: string;
3942
+ requestedAt?: string;
3943
+ emit?: boolean;
3944
+ }
3945
+ declare const pauseForAdvance: (ports: FulfillmentPorts, config: PauseForAdvanceConfig) => Promise<void>;
3946
+ declare const resumeFromAdvance: (ports: FulfillmentPorts, config: ResumeFromAdvanceConfig) => Promise<{
3947
+ edges: null;
3948
+ } | {
3949
+ edges: import("@fire-spark/types").OrderFulfillmentWorkflowEdge[];
3950
+ }>;
3951
+ //#endregion
3952
+ //#region src/fulfillment/engine/enterAndPause.d.ts
3953
+ /**
3954
+ * Nodes with callbacks, a success terminal ahead, or a terminal node keep
3955
+ * the workflow in charge (durable callback retries, ordered webhooks).
3956
+ */
3957
+ declare const canPauseNow: (ran: ProcessStateNodeResult) => boolean;
3958
+ declare const enterAndPause: (ports: FulfillmentPorts, config: ProcessStateNodeConfig) => Promise<EnterAndPauseResult>;
3959
+ declare const advanceAndEnter: (ports: FulfillmentPorts, config: AdvanceAndEnterConfig) => Promise<AdvanceAndEnterResult>;
3960
+ //#endregion
3961
+ //#region src/fulfillment/engine/scheduledSuccessor.d.ts
3962
+ interface ScheduledSuccessorConfig extends EngineScope {
3963
+ nodeId: string;
3964
+ }
3965
+ /** Mapped status of the next primary node, or null when the wait must end. */
3966
+ declare const scheduledSuccessorStatus: (ports: FulfillmentPorts, config: ScheduledSuccessorConfig) => Promise<string | null>;
3967
+ //#endregion
3968
+ //#region src/fulfillment/engine/callbacks.d.ts
3969
+ declare const buildEngineCallbackError: (input: {
3970
+ attempt: number;
3971
+ started_at: string;
3972
+ message: string;
3973
+ status?: number;
3974
+ body?: unknown;
3975
+ now?: () => Date;
3976
+ }) => EngineCallbackRunError;
3977
+ declare const buildEngineCallbackRun: (input: {
3978
+ attempt: number;
3979
+ errors: EngineCallbackRunError[];
3980
+ started_at: string;
3981
+ previous?: EngineCallbackRun;
3982
+ response?: unknown;
3983
+ now?: () => Date;
3984
+ }) => EngineCallbackRun;
3985
+ declare const injectingMetadataFromCallback: (data: unknown) => {
3986
+ order_authorization_id: string;
3987
+ injection_order_id: string;
3988
+ } | null;
3989
+ declare const invokeCallbackAttempt: (ports: FulfillmentPorts, config: InvokeCallbackAttemptConfig) => Promise<InvokeCallbackAttemptResult>;
3990
+ type RunNodeCallbacksResult = {
3991
+ ok: true;
3992
+ } | {
3993
+ ok: false;
3994
+ message?: string;
3995
+ fatal?: boolean;
3996
+ code?: string;
3997
+ details?: CallbackMissingLocalUrlDetails;
3998
+ };
3999
+ declare const runNodeCallbacks: (ports: FulfillmentPorts, scope: EngineScope, next: ProcessStateNodeResult) => Promise<RunNodeCallbacksResult>;
4000
+ declare const resolveCallbackFailTerminal: (ports: FulfillmentPorts, config: {
4001
+ orderFulfillmentId: string;
4002
+ }) => Promise<{
4003
+ nodeId: string;
4004
+ edgeId: string;
4005
+ mappedStatus: string;
4006
+ } | null>;
4007
+ //#endregion
4008
+ //#region src/fulfillment/engine/webhooks.d.ts
4009
+ declare const engineWebhookStatusKey: (status: string) => string;
4010
+ declare const defaultWebhookEventsForStatus: (events: readonly string[], metadata: Record<string, unknown> | null | undefined, status: string) => string[];
4011
+ declare const defaultWebhookRetryDelayMs: (failureCount: number) => number;
4012
+ declare const engineHmacSha256Hex: (secret: string, body: string) => Promise<string>;
4013
+ /** Same webhook, order, type and status → same id, wherever it is sent. */
4014
+ declare const engineWebhookDeliveryId: (webhookId: string, orderId: string, type: string, status: string) => string;
4015
+ declare const engineWebhookTransitionStates: (workflow: OrderFulfillmentWorkflow, previousNodeIds: readonly string[], currentNodeIds: readonly string[], order?: EngineOrder, execution?: EngineExecutionContext) => {
4016
+ next_states: string[];
4017
+ current_states: string[];
4018
+ entered_states: string[];
4019
+ };
4020
+ declare const engineWebhookRunsForEnteredNodes: (workflow: OrderFulfillmentWorkflow, currentNodeIds: readonly string[], previousNodeIds: readonly string[], runs: EngineWebhookNodeRun[]) => {
4021
+ nodeId: string;
4022
+ runs: EngineWebhookNodeRun[];
4023
+ }[];
4024
+ /** Target URL for a webhook given cloud / local-online / offline mode. */
4025
+ declare const resolveWebhookTargetUrl: (webhook: Pick<EngineWebhookTarget, "url" | "local_url">, execution: EngineExecutionContext) => {
4026
+ url: string | null;
4027
+ omitted: boolean;
4028
+ };
4029
+ declare const dispatchOrderWebhooks: (ports: FulfillmentPorts, config: DispatchWebhooksConfig) => Promise<EngineWebhookNodeRun[]>;
4030
+ //#endregion
4031
+ //#region src/fulfillment/engine/finalize.d.ts
4032
+ declare const engineOrderStatusForFailedRun: (order: EngineOrder | null, isPaymentCaptured?: typeof defaultIsPaymentCaptured) => "REVERSED" | "VOIDED" | null;
4033
+ declare const finalizePlaceOrder: (ports: FulfillmentPorts, config: FinalizePlaceOrderConfig) => Promise<{
4034
+ failed: boolean;
4035
+ }>;
4036
+ declare const warnNoEdge: (ports: FulfillmentPorts, config: {
4037
+ orderFulfillmentId: string;
4038
+ fulfillmentStatus: string;
4039
+ }) => Promise<void>;
4040
+ //#endregion
4041
+ //#region src/fulfillment/engine/runner.d.ts
4042
+ declare const pendingWebhooksOf: (next: ProcessStateNodeResult) => PendingWebhooks | null;
4043
+ declare const dispatchPendingWebhooks: (ports: FulfillmentPorts, scope: EngineScope, pending: PendingWebhooks | null) => Promise<void>;
4044
+ /** Callbacks (durable retries) and the callback-fail terminal for a node. */
4045
+ declare const settleEnter: (ports: FulfillmentPorts, scope: EngineScope, next: ProcessStateNodeResult) => Promise<EnterRunResult>;
4046
+ declare const autoEnterSuccessTerminal: (ports: FulfillmentPorts, scope: EngineScope, ran: EnterRunResult, terminalStatus?: "COMPLETED" | "VOIDED" | "REVERSED" | "REFUNDED") => Promise<EnterRunResult>;
4047
+ declare const runIsTerminal: (ran: EnterRunResult) => boolean;
4048
+ interface StepOutcome {
4049
+ status: "WAITING" | "SCHEDULED_WAIT" | "SUCCESS" | "FAILED";
4050
+ scheduledWakeAt?: string;
4051
+ errorCode?: string;
4052
+ errorMessage?: string;
4053
+ }
4054
+ /** Starts a workflow run from the start node up to the first pause or terminal. */
4055
+ declare const executeStart: (ports: FulfillmentPorts, scope: EngineScope, runId?: string) => Promise<StepOutcome>;
4056
+ /** Advances a waiting workflow run by one status event. */
4057
+ declare const executeAdvance: (ports: FulfillmentPorts, scope: EngineScope, event: {
4058
+ fulfillment_status: string;
4059
+ requested_at?: string;
4060
+ status?: "COMPLETED" | "VOIDED" | "REVERSED" | "REFUNDED";
4061
+ }) => Promise<StepOutcome>;
4062
+ /** Wakes a workflow run that was paused on `AWAITING_SCHEDULED_TIME`. */
4063
+ declare const executeScheduledWake: (ports: FulfillmentPorts, scope: EngineScope, nodeId: string, terminalStatus?: "COMPLETED" | "VOIDED" | "REVERSED" | "REFUNDED") => Promise<StepOutcome>;
4064
+ //#endregion
3286
4065
  //#region src/order/fees.d.ts
3287
4066
  type FeeRounding = Fee["effects"][number]["rounding"];
3288
4067
  declare const roundFeeAmount: (value: number, rounding: FeeRounding, digits: number) => number;
@@ -3298,8 +4077,8 @@ declare const rebuildOrderLinesWithFees: (input: ApplyFeesInput) => OrderLine[];
3298
4077
  declare const collectCheckoutIssues: (checkout: CheckoutPreferences, order: OrderRecord, fulfillmentType?: string | null, now?: string) => OrderIssue[];
3299
4078
  //#endregion
3300
4079
  //#region src/rules/orderFacts.d.ts
3301
- declare const orderFactsFromOrder: (order: OrderRecord) => RulesEngineParams;
3302
- declare const buildRulesEngineFromOrder: (order: OrderRecord) => RulesEngine;
4080
+ declare const orderFactsFromOrder: (order: OrderRecord, execution?: RulesEngineParams["execution"]) => RulesEngineParams;
4081
+ declare const buildRulesEngineFromOrder: (order: OrderRecord, execution?: RulesEngineParams["execution"]) => RulesEngine;
3303
4082
  //#endregion
3304
4083
  //#region src/shared/locale.d.ts
3305
4084
  declare const DEFAULT_LOCALE = "en";
@@ -3358,4 +4137,4 @@ declare const hpkeSeal: (input: HpkeSealInput) => Promise<{
3358
4137
  /** Opens a sealed message; throws when anything was altered. */
3359
4138
  declare const hpkeOpen: (input: HpkeOpenInput) => Promise<Uint8Array<ArrayBuffer>>;
3360
4139
  //#endregion
3361
- export { type ApplyRedeemInput, type AuthConfigureOptions, type BuildScheduleSlotsConfig, CANONICAL_MAX_DEPTH, CANONICAL_MAX_EXPONENT, CARD_BRANDS, CUSTOMER_INFO_PLACEHOLDERS, type CanonicalInput, type CanonicalizationError, type CanonicalizationErrorCode, type CardBrand, type CardBrandSpec, type CardCvcError, type CardExpiry, type CardExpiryError, type CardNumberError, type CardPreviewSlot, type CardholderNameError, type CmsBlockScope, type CmsVisibilityBlock, type CmsVisibilityContext, type CmsVisibilityRules, type CreateOrderOptions, type CreateSessionOptions, type CustomizationPath, type CustomizationSession, DEFAULT_LOCALE, DEFAULT_RECOMMENDATION_TYPES, DelegatedSessionExpiredError, type DeunaCallbackUrls, type DeunaOrderStatus, type ExchangeOptions, type FailedCharge, type FiresparkOrigin, type FlatMenuCategory, type GenOrderIdOptions, type GetCmsBlockOptions, type GroupDisplayType, HPKE_ALG, type HpkeAead, type HpkeEnvelope, type HpkeOpenInput, type HpkePrivateJwk, type HpkePublicJwk, type HpkeSealInput, ID_HASH_FORMATS, type IdBuilder, type IdHashFormat, type ListMenusStreamOptions, type ListPaymentsOptions, type LocalDeviceCredentials, LosslessNumber, type LosslessNumberLike, type Menu, type MenuCategoryNode, type MenuLookup, type MilestoneSteps, type MilestoneTrackItem, type ModifierControlType, type ModifierCtx, type ModifierGroupCtx, type NestedMenuCategory, ORIGIN_HEADER, Order, OrderAuthPinnedError, type OrderCancelInput, type OrderCancelOptions, type OrderCancelResult, type OrderCancelType, type OrderCustomerSource, type OrderDeviceCredential, type OrderDraft, type OrderIssue, type OrderIssueCode, type OrderLineDiff, type OrderLineIssue, type OrderLineIssueCode, OrderNotOpenError, OrderPaymentRequiredError, type OrderScope, OrderSyncPendingError, OrderSyncRejectedError, OrderValidationError, type OrderValidationResult, type OriginListener, type OriginState, type PayIntentOptions, type PayIntentResult, type PayOptions, type PaymentCardBrand, type PaymentProgressEvent, type PaymentProgressListener, type PaymentRunOptions, type PaymentSessionOptions, PickupNameIssue, type PricingModifier, type Product, type ProductCtx, type QuantitiesByPath, type RecommendationType, RecurringDateCron, type RedeemPaymentRow, type RemoveRedeemInput, type ReorderOrderOptions, type ResetOptions, type ReversalOutcome, type ReverseAllOptions, RulesEngine, SCHEDULED_AT_ERROR_CODES, SCHEDULED_ORDER_MAX_HORIZON_HOURS, SCHEDULED_ORDER_MAX_HORIZON_MINUTES, SCHEDULED_ORDER_MIN_LEAD_MINUTES, SCHEDULED_ORDER_SLOT_MINUTES, STATE_ALGO, STATE_HASH_PREFIX, type ScheduleSlot, type ScheduleSlotCart, type ScheduleSlotCartLine, type ScheduleWindow, type SelectionStatus, type SelectionsByPath, type SerializedError, type ServiceHttpOptions, type SimpleTenderPayment, type Snapshot, type StateGoldenRootVector, type StateGoldenVector, type StateGoldenVectors, type StateManifest, type StateManifestSection, type StateRootInput, type StateScope, type StateVectorFailure, type StorefrontAccessToken, type StorefrontErrorDetails, StorefrontHttpError, type SwitchCustomerArg, type SwitchCustomerIdToken, type SwitchCustomerResult, TokenExchangeError, type TrackWorkflow, type ValidateOptions, type ValidateOrderAgainstMenuInput, type Variant, type VariantGroup, type VariantGroupCtx, type VariantOptionCtx, type VariantSelection, type VerifyWebhookSignatureInput, type VisitedState, addLines, appendNodeLog, applyCmsVisibility, applyFees, applyManualAdvanceNote, auth, base64UrlDecode, base64UrlEncode, buildCustomerSnapshot, buildRulesEngineFromOrder, buildScheduleSlots, canEnterJoin, cancelTypeOf, canonicalNumber, canonicalString, canonicalize, canonicalizeJson, capRedeems, cappedRedeems, cardBrandSpec, cardDigits, cardNumberGaps, cardNumberMaxLength, cardPreviewGroups, caretAfterDigits, clearEdgeTaken, clearNodeVisit, cmsVisibilityNeedsTimezone, collectCheckoutIssues, collectOrderLineDiffs, computeStartingPrice, countCartProducts, coveredAmount, createCanonicalizationError, createDeunaWidgetApi, createSession, currentNodes, cvcMaxLength, defaultConditionError, defaultOutgoingEdge, detectCardBrand, enterWorkflowNode, findFirstState, findLocaleKey, findMappedStatusNode, findNodeById, findStartNode, fitRedeems, flattenMenuCategories, flushLogs, formatCardNumber, formatCvc, formatExpiry, formatRecurringDateCronSummary, fromOrderLines, fulfillmentStatusesEqual, genId, genOrderId, getLogContext, getOrigin, getScheduleWindow, hpkeOpen, hpkeSeal, incomingEdges, indexMenu, indexOutgoingBySource, isCanonicalizationError, isCardNumberComplete, isCardNumberDefinitelyInvalid, isCheckoutFieldFilled, isCustomerInfoFieldFilled, isCustomerInfoPlaceholder, isCustomerInfoValueValid, isCvcComplete, isDelegatedSessionExpiredError, isDeviceCharged, isDeviceNotLinked, isExpiryComplete, isGenId, isKioskUnauthorized, isLocalOrderUnknown, isMilestoneStepDone, isOnSchedule, isOrderNotOpenError, isOrderPaymentRequiredError, isOrderValidationError, isPosDeviceNotLinked, isPosUnauthorized, isRealPaymentMethod, isScheduleSlot, isScheduledAtError, isStateHash, isStorefrontNotFound, isTerminalMappedStatus, isVariantBase, linePayableTotal, listMenusStream, localizePosError, log, logError, luhnCheck, markEdgeTaken, markNodeEntered, markNodeExited, markNodeSkipped, markNodesAdvance, markNodesReady, matchAbsoluteDateOperator, matchBooleanOperator, matchCurrencyOperator, matchEnumOperator, matchNumberOperator, matchRecurringDateOperator, matchRelativeDateOperator, matchStringOperator, matchingPrimaryOutgoing, milestoneSteps, milestoneTrack, nestMenuCategories, nextCurrentNodeIds, normalizeCardholderName, normalizeCustomerPhone, normalizeFulfillmentStatus, normalizeLocaleKey, normalizePickupName, normalizeStateScope, onOriginChange, orderFactsFromOrder, orderFieldsFromNode, orderPayableTotal, orderRedeemedTotal, orderRedeems, orderStatusForFulfillmentStatus, outgoingEdges, parseExpiry, parseLosslessJson, pathKindForTargetNode, paymentMatchesClientConditions, pickAdvanceTarget, pickMultiLanguageText, placeCartLines, rebuildOrderLinesWithFees, rebuildRootGroups, recomputeTotals, redeemedTotal, redeemsForPayment, redemptionCap, redemptionSteps, remainingAmount, removeLine, replaceLine, resolveAdvanceEdge, resolveAdvanceEdges, resolveCheckout, resolveFailureTerminalEdge, resolveModifierImageUrl, resolveSchedulePrepMinutes, resolveSuccessTerminalEdges, reversePayment, reversedWhenCaptured, roundFeeAmount, runPaymentAttempt, runStateGoldenVectors, scheduledInstant, selectMatchingFees, selectablePayments, serializeError, services, setLineQuantity, sha256Hex, sha256HexOfString, sittingWorkflowNode, stateRootHash, stateScopeKey, stateSectionHash, stateSectionHashOfJson, storefrontJson, stripFeeLines, stubUnsupportedFeeAmount, summarizeRecurringDateCron, toOrderLines, toPaymentCardBrand, unusedOutgoing, utf8Encode, validateCardNumber, validateCardholderName, validateCvc, validateExpiry, validateOrderAgainstMenu, validatePickupName, verifyWebhookSignature, visitedStates };
4140
+ export { type AdvanceAndEnterConfig, type AdvanceAndEnterResult, type ApplyRedeemInput, type AuthConfigureOptions, type BuildRouteHttpInput, type BuildScheduleSlotsConfig, CALLBACK_MISSING_LOCAL_URL, CANONICAL_MAX_DEPTH, CANONICAL_MAX_EXPONENT, CARD_BRANDS, CUSTOMER_INFO_PLACEHOLDERS, type CallbackMissingLocalUrlDetails, type CanonicalInput, type CanonicalizationError, type CanonicalizationErrorCode, type CardBrand, type CardBrandSpec, type CardCvcError, type CardExpiry, type CardExpiryError, type CardNumberError, type CardPreviewSlot, type CardholderNameError, type CmsBlockScope, type CmsVisibilityBlock, type CmsVisibilityContext, type CmsVisibilityRules, type CreateOrderOptions, type CreateSessionOptions, type CustomizationPath, type CustomizationSession, DEFAULT_LOCALE, DEFAULT_MAX_INCOMPLETE_MINUTES, DEFAULT_MAX_SNAPSHOT_AGE_MS, DEFAULT_RECOMMENDATION_TYPES, DEFAULT_ROUTE_COOLDOWN_MS, DEFAULT_WEBHOOK_TIMEOUT_S, DelegatedSessionExpiredError, type DeunaCallbackUrls, type DeunaOrderStatus, type DispatchWebhooksConfig, type EngineCallbackRun, type EngineCallbackRunError, type EngineExecutionContext, type EngineFlagReviewInput, type EngineFulfillmentPatch, type EngineOrder, type EngineOrderChangedEvent, type EngineOrderFulfillment, type EngineOrderStatus, type EngineOrderStatusPatch, type EngineScope, type EngineStepLog, type EngineStepLogEntry, type EngineStepsLogs, type EngineWebhookEnvelope, type EngineWebhookFailureEvent, type EngineWebhookNodeRun, type EngineWebhookTarget, type EnterAndPauseResult, type EnterRunResult, type ExchangeOptions, FULFILLMENT_WORKFLOW_TERMINAL_STATUSES, type FailedCharge, type FinalizePlaceOrderConfig, type FiresparkOrigin, type FlatMenuCategory, type FulfillmentEligibilityInput, type FulfillmentExecutionPort, type FulfillmentPorts, type FulfillmentRunStatus, type FulfillmentStepName, type FulfillmentStoragePort, type FulfillmentTerminalOrderStatus, type GenOrderIdOptions, type GetCmsBlockOptions, type GroupDisplayType, HPKE_ALG, type HpkeAead, type HpkeEnvelope, type HpkeOpenInput, type HpkePrivateJwk, type HpkePublicJwk, type HpkeSealInput, ID_HASH_FORMATS, type IdBuilder, type IdHashFormat, type InvokeCallbackAttemptConfig, type InvokeCallbackAttemptResult, type ListMenusStreamOptions, type ListPaymentsOptions, type LocalDeviceCredentials, type LocalRouteProbeResult, type LocalServerConfig, type LocalServerHealthResult, LosslessNumber, type LosslessNumberLike, MAX_MAX_INCOMPLETE_MINUTES, MAX_SUPPORTED_WORKFLOW_SCHEMA_VERSION, MIN_MAX_INCOMPLETE_MINUTES, MODE_HINT_HEADER, type MarkRouteDownInput, type Menu, type MenuCategoryNode, type MenuLookup, type MilestoneSteps, type MilestoneTrackItem, type ModifierControlType, type ModifierCtx, type ModifierGroupCtx, type NestedMenuCategory, OFFLINE_NO_LOCAL_URL, ORIGIN_HEADER, Order, OrderAuthPinnedError, type OrderCancelInput, type OrderCancelOptions, type OrderCancelResult, type OrderCancelType, type OrderCustomerSource, type OrderDeviceCredential, type OrderDraft, type OrderIssue, type OrderIssueCode, type OrderLineDiff, type OrderLineIssue, type OrderLineIssueCode, OrderNotOpenError, OrderPaymentRequiredError, type OrderRouteKind, type OrderRouteStatus, OrderRouteUnavailableError, type OrderRoutes, type OrderScope, OrderSyncPendingError, OrderSyncRejectedError, OrderValidationError, type OrderValidationResult, type OriginListener, type OriginState, type PauseForAdvanceConfig, type PayIntentOptions, type PayIntentResult, type PayOptions, type PaymentCardBrand, type PaymentEligibilityInput, type PaymentProgressEvent, type PaymentProgressListener, type PaymentRunOptions, type PaymentSessionOptions, type PendingWebhooks, PickupNameIssue, type PinnedFetchFactory, type PinnedFetchOptions, type PricingModifier, type ProbeLocalRouteHealthOptions, type ProcessStateNodeCallbackJob, type ProcessStateNodeConfig, type ProcessStateNodeResult, type Product, type ProductCtx, type QuantitiesByPath, RESERVED_FULFILLMENT_STATUSES, type RecommendationType, RecurringDateCron, type RedeemPaymentRow, type RemoveRedeemInput, type ReorderOrderOptions, type ResetOptions, type ResolveRouteEligibilityInput, type ResolvedPaymentEligibility, type ResumeFromAdvanceConfig, type ReversalOutcome, type ReverseAllOptions, type RouteEligibility, type RouteEligibilityDetail, type RouteEligibilityFlags, type RouteEligibilityReason, type RouteFailureClassification, type RouteFailureKind, type RouteHealthEvent, type RouteHealthListener, type RouteHealthSnapshot, type RouteTenderCandidate, RulesEngine, type RunNodeCallbacksResult, SCHEDULED_AT_ERROR_CODES, SCHEDULED_ORDER_MAX_HORIZON_HOURS, SCHEDULED_ORDER_MAX_HORIZON_MINUTES, SCHEDULED_ORDER_MIN_LEAD_MINUTES, SCHEDULED_ORDER_SLOT_MINUTES, SCHEDULED_STATUS, SDK_PAYMENT_ELIGIBILITY_CEILINGS, STATE_ALGO, STATE_HASH_PREFIX, type ScheduleSlot, type ScheduleSlotCart, type ScheduleSlotCartLine, type ScheduleWindow, type ScheduledSuccessorConfig, type SdkPaymentEligibility, type SelectionStatus, type SelectionsByPath, type SerializedError, type ServiceHttpOptions, type SimpleTenderPayment, type Snapshot, type StateGoldenRootVector, type StateGoldenVector, type StateGoldenVectors, type StateManifest, type StateManifestSection, type StateRootInput, type StateScope, type StateVectorFailure, type StepOutcome, type StorefrontAccessToken, type StorefrontErrorDetails, StorefrontHttpError, type SwitchCustomerArg, type SwitchCustomerIdToken, type SwitchCustomerResult, TLS_FINGERPRINT_RESPONSE_HEADER, TLS_PIN_HEADER, type TestLocalServerHealthOptions, TlsFingerprintMismatchError, TokenExchangeError, type TrackWorkflow, type ValidateOptions, type ValidateOrderAgainstMenuInput, type Variant, type VariantGroup, type VariantGroupCtx, type VariantOptionCtx, type VariantSelection, type VerifyWebhookSignatureInput, type VisitedState, WORKFLOW_SCHEMA_VERSION, WORKFLOW_TIMEOUT, WorkflowSchemaVersionError, type WorkflowTimeoutDetails, addLines, advanceAndEnter, appendEngineStepLog, appendNodeLog, applyCmsVisibility, applyFees, applyManualAdvanceNote, assertSupportedWorkflowSchemaVersion, auth, autoEnterSuccessTerminal, base64UrlDecode, base64UrlEncode, beginEngineStepLog, buildCustomerSnapshot, buildEngineCallbackError, buildEngineCallbackRun, buildRouteHttpOptions, buildRulesEngineFromOrder, buildScheduleSlots, buildWorkflowTimeoutDetails, callbackIdsFromNode, canEnterJoin, canPauseNow, cancelTypeOf, canonicalNumber, canonicalString, canonicalize, canonicalizeJson, capRedeems, cappedRedeems, cardBrandSpec, cardDigits, cardNumberGaps, cardNumberMaxLength, cardPreviewGroups, caretAfterDigits, certFingerprintsMatch, certMatchesAnyPin, classifyRouteFailure, clearEdgeTaken, clearNodeVisit, cmsVisibilityNeedsTimezone, collectCheckoutIssues, collectOrderLineDiffs, completeEngineStepLog, computeOrderExpiresAt, computeStartingPrice, configureLocalTlsPinning, countCartProducts, coveredAmount, createCanonicalizationError, createDeunaWidgetApi, createNodePinnedFetch, createSession, currentNodes, cvcMaxLength, defaultConditionError, defaultIsPaymentCaptured, defaultOutgoingEdge, defaultWebhookEventsForStatus, defaultWebhookRetryDelayMs, detectCardBrand, dispatchOrderWebhooks, dispatchPendingWebhooks, engineHmacSha256Hex, engineOrderStatusForFailedRun, engineWebhookDeliveryId, engineWebhookRunsForEnteredNodes, engineWebhookStatusKey, engineWebhookTransitionStates, enterAndPause, enterWorkflowNode, executeAdvance, executeScheduledWake, executeStart, failActiveEngineStepLog, finalizePlaceOrder, findFirstState, findLocaleKey, findMappedStatusNode, findNodeById, findStartNode, fitRedeems, flattenMenuCategories, flushLogs, formatCardNumber, formatCvc, formatExpiry, formatLocalServerUrl, formatRecurringDateCronSummary, fromOrderLines, fulfillmentStatusesEqual, genId, genOrderId, getLocalTlsPinning, getLogContext, getOrigin, getRouteHealth, getScheduleWindow, hasInFlightPayment, hasLocalTlsPinning, hasSmartRouting, hpkeOpen, hpkeSeal, incomingEdges, indexMenu, indexOutgoingBySource, injectingMetadataFromCallback, invokeCallbackAttempt, isCanonicalizationError, isCardNumberComplete, isCardNumberDefinitelyInvalid, isCheckoutFieldFilled, isCustomerInfoFieldFilled, isCustomerInfoPlaceholder, isCustomerInfoValueValid, isCvcComplete, isDelegatedSessionExpiredError, isDeviceCharged, isDeviceNotLinked, isExpiredFulfillment, isExpiryComplete, isGenId, isInterruptTerminalStatus, isKioskUnauthorized, isLocalOrderUnknown, isMilestoneStepDone, isNodeRuntime, isOnSchedule, isOrderNotOpenError, isOrderPaymentRequiredError, isOrderRouteUnavailableError, isOrderValidationError, isPosDeviceNotLinked, isPosUnauthorized, isRealPaymentMethod, isReservedFulfillmentStatus, isRouteCircuitOpen, isScheduleSlot, isScheduledAtError, isStateHash, isStorefrontNotFound, isSupportedWorkflowSchemaVersion, isTerminalFulfillmentStatus, isTerminalMappedStatus, isTlsFingerprintMismatchError, isVariantBase, linePayableTotal, listMenusStream, localizePosError, log, logError, luhnCheck, markEdgeTaken, markNodeEntered, markNodeExited, markNodeSkipped, markNodesAdvance, markNodesReady, markRouteDown, markRouteHealthy, matchAbsoluteDateOperator, matchBooleanOperator, matchCurrencyOperator, matchEnumOperator, matchNumberOperator, matchRecurringDateOperator, matchRelativeDateOperator, matchStringOperator, matchingPrimaryOutgoing, milestoneSteps, milestoneTrack, nestMenuCategories, nextCurrentNodeIds, normalizeCardholderName, normalizeCertFingerprint, normalizeCustomerPhone, normalizeFulfillmentStatus, normalizeLocaleKey, normalizeMaxIncompleteMinutes, normalizePickupName, normalizeStateScope, onOriginChange, onRouteHealth, orderFactsFromOrder, orderFieldsFromNode, orderPayableTotal, orderRedeemedTotal, orderRedeems, orderStatusForFulfillmentStatus, outgoingEdges, parseExpiry, parseLosslessJson, pathKindForTargetNode, pauseForAdvance, paymentMatchesClientConditions, pendingWebhooksOf, pickAdvanceTarget, pickMultiLanguageText, placeCartLines, probeLocalRouteHealth, processStateNode, rebuildOrderLinesWithFees, rebuildRootGroups, recomputeTotals, redeemedTotal, redeemsForPayment, redemptionCap, redemptionSteps, remainingAmount, removeLine, replaceLine, resolveAdvanceEdge, resolveAdvanceEdges, resolveCallbackFailTerminal, resolveCheckout, resolveFailureTerminalEdge, resolveLocalPins, resolveLocalRouteUrl, resolveModifierImageUrl, resolveOrderRouteEligibility, resolvePaymentEligibility, resolveSchedulePrepMinutes, resolveSdkPaymentEligibilityCeiling, resolveSuccessTerminalEdges, resolveWebhookTargetUrl, resumeFromAdvance, reversePayment, reversedWhenCaptured, roundFeeAmount, runIsTerminal, runNodeCallbacks, runPaymentAttempt, runStateGoldenVectors, scheduledInstant, scheduledSuccessorStatus, selectMatchingFees, selectablePayments, serializeError, services, setLineQuantity, settleEnter, sha256Hex, sha256HexOfString, sittingWorkflowNode, stateRootHash, stateScopeKey, stateSectionHash, stateSectionHashOfJson, storefrontJson, stripFeeLines, stubUnsupportedFeeAmount, summarizeRecurringDateCron, testLocalServerHealth, toOrderLines, toPaymentCardBrand, unusedOutgoing, utf8Encode, validateCardNumber, validateCardholderName, validateCvc, validateExpiry, validateOrderAgainstMenu, validatePickupName, verifyLocalRoutePin, verifyWebhookSignature, visitedStates, warnNoEdge, workflowSchemaVersionOf };