@fire-spark/core 0.24.0 → 0.26.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/dist/index.d.ts +1276 -4
- package/dist/index.js +1802 -12
- 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, CheckoutMode, CheckoutResolved, CmsBlock, Condition, Customer, CustomerIdentifyInput, CustomerRegisterInput, CustomerUpdateInput, 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, OrderInsertInput, OrderLine, OrderListInput, 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, 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, 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";
|
|
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. */
|
|
@@ -986,11 +986,18 @@ type ValidateOrderAgainstMenuInput = {
|
|
|
986
986
|
* `redemptionSteps` for these lines, totals and redeems.
|
|
987
987
|
*/
|
|
988
988
|
redemptionSteps?: OrderRedemptionStep[];
|
|
989
|
-
/**
|
|
989
|
+
/**
|
|
990
|
+
* Instant the order is validated at: redeem expiry and product schedules
|
|
991
|
+
* read it instead of the current time (an order imported from a Local
|
|
992
|
+
* Node is validated as of when it happened). `now` and `scheduleAt`
|
|
993
|
+
* override it.
|
|
994
|
+
*/
|
|
995
|
+
asOf?: Date;
|
|
996
|
+
/** Epoch ms used for `expires_at` checks. Defaults to `asOf`, then now. */
|
|
990
997
|
now?: number;
|
|
991
998
|
/** IANA zone for product schedules. Omit to use `scheduleAt`'s clock. */
|
|
992
999
|
timeZone?: string;
|
|
993
|
-
/** Instant for product schedules. Defaults to
|
|
1000
|
+
/** Instant for product schedules. Defaults to `asOf`, then now. */
|
|
994
1001
|
scheduleAt?: Date;
|
|
995
1002
|
};
|
|
996
1003
|
/** Payment a redeem references, as listed for the merchant. */
|
|
@@ -2004,4 +2011,1269 @@ declare const normalizePickupName: (raw: string) => string;
|
|
|
2004
2011
|
/** `null` when the name is valid for the given rules. */
|
|
2005
2012
|
declare const validatePickupName: (raw: string, rules: KioskPickupNameRules) => PickupNameIssue | null;
|
|
2006
2013
|
//#endregion
|
|
2007
|
-
|
|
2014
|
+
//#region src/state/state.types.d.ts
|
|
2015
|
+
/** A JSON number kept as its exact decimal text, never a JS `number`. */
|
|
2016
|
+
interface LosslessNumberLike {
|
|
2017
|
+
readonly raw: string;
|
|
2018
|
+
}
|
|
2019
|
+
/** Value tree accepted by `canonicalize`. */
|
|
2020
|
+
type CanonicalInput = null | boolean | string | number | bigint | LosslessNumberLike | CanonicalInput[] | {
|
|
2021
|
+
[key: string]: CanonicalInput | undefined;
|
|
2022
|
+
};
|
|
2023
|
+
type CanonicalizationErrorCode = "INVALID_JSON" | "DUPLICATE_KEY" | "MAX_DEPTH" | "INVALID_NUMBER" | "NUMBER_OUT_OF_RANGE" | "LONE_SURROGATE" | "UNSUPPORTED_VALUE";
|
|
2024
|
+
interface CanonicalizationError extends Error {
|
|
2025
|
+
code: CanonicalizationErrorCode;
|
|
2026
|
+
}
|
|
2027
|
+
/** What one node caches. `channel_ids` is sorted and deduplicated. */
|
|
2028
|
+
interface StateScope {
|
|
2029
|
+
merchant_id: string;
|
|
2030
|
+
env: string;
|
|
2031
|
+
store_id: string;
|
|
2032
|
+
channel_ids: string[];
|
|
2033
|
+
}
|
|
2034
|
+
interface StateRootInput {
|
|
2035
|
+
algo: string;
|
|
2036
|
+
scopeKey: string;
|
|
2037
|
+
sections: Record<string, string>;
|
|
2038
|
+
}
|
|
2039
|
+
interface StateManifestSection {
|
|
2040
|
+
name: string;
|
|
2041
|
+
kind: "table" | "projection" | "credential";
|
|
2042
|
+
hash: string;
|
|
2043
|
+
size_bytes: number;
|
|
2044
|
+
}
|
|
2045
|
+
interface StateManifest {
|
|
2046
|
+
scope_key: string;
|
|
2047
|
+
seq: number;
|
|
2048
|
+
root_hash: string;
|
|
2049
|
+
algo: string;
|
|
2050
|
+
created_at: string;
|
|
2051
|
+
latest_seq: number;
|
|
2052
|
+
sections: StateManifestSection[];
|
|
2053
|
+
}
|
|
2054
|
+
interface StateGoldenVector {
|
|
2055
|
+
name: string;
|
|
2056
|
+
input: string;
|
|
2057
|
+
canonical?: string;
|
|
2058
|
+
section?: string;
|
|
2059
|
+
hash?: string;
|
|
2060
|
+
error?: CanonicalizationErrorCode;
|
|
2061
|
+
}
|
|
2062
|
+
interface StateGoldenRootVector {
|
|
2063
|
+
name: string;
|
|
2064
|
+
scope: StateScope;
|
|
2065
|
+
scope_key: string;
|
|
2066
|
+
sections: Record<string, string>;
|
|
2067
|
+
root_hash: string;
|
|
2068
|
+
}
|
|
2069
|
+
interface StateGoldenVectors {
|
|
2070
|
+
algo: string;
|
|
2071
|
+
vectors: StateGoldenVector[];
|
|
2072
|
+
roots: StateGoldenRootVector[];
|
|
2073
|
+
}
|
|
2074
|
+
interface StateVectorFailure {
|
|
2075
|
+
name: string;
|
|
2076
|
+
expected: string;
|
|
2077
|
+
actual: string;
|
|
2078
|
+
}
|
|
2079
|
+
//#endregion
|
|
2080
|
+
//#region src/state/canonical.d.ts
|
|
2081
|
+
/** Nesting limit for parsing and serializing, so input can't blow the stack. */
|
|
2082
|
+
declare const CANONICAL_MAX_DEPTH = 256;
|
|
2083
|
+
/** Largest decimal exponent accepted, so `1e999999999` can't allocate GBs. */
|
|
2084
|
+
declare const CANONICAL_MAX_EXPONENT = 1000;
|
|
2085
|
+
declare const createCanonicalizationError: (code: CanonicalizationErrorCode, message: string) => CanonicalizationError;
|
|
2086
|
+
declare const isCanonicalizationError: (error: unknown) => error is CanonicalizationError;
|
|
2087
|
+
/** A JSON number kept as its exact text. Check with `instanceof`. */
|
|
2088
|
+
declare const LosslessNumber: {
|
|
2089
|
+
new (raw: string): LosslessNumberLike;
|
|
2090
|
+
};
|
|
2091
|
+
/**
|
|
2092
|
+
* Exact decimal text in plain notation: no exponent, no trailing zeros and
|
|
2093
|
+
* `-0` as `0`. Never rounds.
|
|
2094
|
+
*/
|
|
2095
|
+
declare const canonicalNumber: (raw: string) => string;
|
|
2096
|
+
/** RFC 8785 string serialization. Lone surrogates are rejected (I-JSON). */
|
|
2097
|
+
declare const canonicalString: (value: string) => string;
|
|
2098
|
+
/** `fs-c14n-v1` text of a value: sorted keys, no whitespace, exact numbers. */
|
|
2099
|
+
declare const canonicalize: (value: CanonicalInput) => string;
|
|
2100
|
+
/**
|
|
2101
|
+
* Parses JSON text keeping every number as its exact decimal text
|
|
2102
|
+
* (`LosslessNumber`). Objects have no prototype, so `__proto__` is a key.
|
|
2103
|
+
*/
|
|
2104
|
+
declare const parseLosslessJson: (text: string) => CanonicalInput;
|
|
2105
|
+
/** Canonical text of JSON text, without ever going through JS numbers. */
|
|
2106
|
+
declare const canonicalizeJson: (text: string) => string;
|
|
2107
|
+
//#endregion
|
|
2108
|
+
//#region src/state/hash.d.ts
|
|
2109
|
+
declare const STATE_ALGO = "fs-c14n-v1";
|
|
2110
|
+
declare const STATE_HASH_PREFIX = "sha256:";
|
|
2111
|
+
declare const isStateHash: (value: string) => boolean;
|
|
2112
|
+
/** Sorted, deduplicated copy of a scope, the only form ever hashed. */
|
|
2113
|
+
declare const normalizeStateScope: (scope: StateScope) => StateScope;
|
|
2114
|
+
/** `sha256(canonical(scope))`, written `sha256:<hex>`. */
|
|
2115
|
+
declare const stateScopeKey: (scope: StateScope) => string;
|
|
2116
|
+
/** `sha256("fs-c14n-v1\n" + name + "\n" + canonical)`, written `sha256:<hex>`. */
|
|
2117
|
+
declare const stateSectionHash: (name: string, canonical: string) => string;
|
|
2118
|
+
/** Hash of a section from raw JSON text, keeping every number exact. */
|
|
2119
|
+
declare const stateSectionHashOfJson: (name: string, json: string) => string;
|
|
2120
|
+
/** `sha256(canonical({algo, scope_key, sections}))`, written `sha256:<hex>`. */
|
|
2121
|
+
declare const stateRootHash: (input: StateRootInput) => string;
|
|
2122
|
+
//#endregion
|
|
2123
|
+
//#region src/state/goldenVectors.d.ts
|
|
2124
|
+
/**
|
|
2125
|
+
* Checks every `fs-c14n-v1` golden vector and returns the failures. Shared by
|
|
2126
|
+
* the Node tests and the Hermes runner, so all runtimes check the same file.
|
|
2127
|
+
*/
|
|
2128
|
+
declare const runStateGoldenVectors: (file: StateGoldenVectors) => StateVectorFailure[];
|
|
2129
|
+
//#endregion
|
|
2130
|
+
//#region src/state/sha256.d.ts
|
|
2131
|
+
/** UTF-8 bytes of a well-formed string. No `TextEncoder`, so Hermes-safe. */
|
|
2132
|
+
declare const utf8Encode: (value: string) => number[];
|
|
2133
|
+
/** Lowercase hex SHA-256 of bytes (FIPS 180-4), in plain JS. */
|
|
2134
|
+
declare const sha256Hex: (bytes: ArrayLike<number>) => string;
|
|
2135
|
+
/** Lowercase hex SHA-256 of the UTF-8 bytes of a string. */
|
|
2136
|
+
declare const sha256HexOfString: (value: string) => string;
|
|
2137
|
+
//#endregion
|
|
2138
|
+
//#region src/fulfillment/graph.d.ts
|
|
2139
|
+
declare const findNodeById: (workflow: OrderFulfillmentWorkflow, nodeId: string) => {
|
|
2140
|
+
id: string;
|
|
2141
|
+
type: "fulfillmentStep";
|
|
2142
|
+
position: {
|
|
2143
|
+
x: number;
|
|
2144
|
+
y: number;
|
|
2145
|
+
};
|
|
2146
|
+
data: {
|
|
2147
|
+
kind: "join" | "start" | "state" | "terminal";
|
|
2148
|
+
label: Record<string, string>;
|
|
2149
|
+
description?: Record<string, string> | undefined;
|
|
2150
|
+
mappedStatus: string;
|
|
2151
|
+
milestone?: string | undefined;
|
|
2152
|
+
checkout_release?: boolean | undefined;
|
|
2153
|
+
payment_scope?: "digital" | "in_person" | undefined;
|
|
2154
|
+
joinPolicy?: "all" | "any" | undefined;
|
|
2155
|
+
actions?: {
|
|
2156
|
+
id: string;
|
|
2157
|
+
type: "invoke_callback" | "notify_webhook";
|
|
2158
|
+
webhook_ids?: string[] | undefined;
|
|
2159
|
+
callback_ids?: string[] | undefined;
|
|
2160
|
+
}[] | undefined;
|
|
2161
|
+
entered_at?: string | undefined;
|
|
2162
|
+
ready_at?: string | undefined;
|
|
2163
|
+
advance_requested_at?: string | undefined;
|
|
2164
|
+
resumed_at?: string | undefined;
|
|
2165
|
+
exited_at?: string | undefined;
|
|
2166
|
+
skipped_at?: string | undefined;
|
|
2167
|
+
logs?: {
|
|
2168
|
+
type: "error" | "info" | "success" | "warning";
|
|
2169
|
+
message: string;
|
|
2170
|
+
at: string;
|
|
2171
|
+
actor_name?: string | undefined;
|
|
2172
|
+
actor_avatar_url?: string | undefined;
|
|
2173
|
+
}[] | undefined;
|
|
2174
|
+
callback_run?: {
|
|
2175
|
+
attempt: number;
|
|
2176
|
+
errors: {
|
|
2177
|
+
attempt: number;
|
|
2178
|
+
at: string;
|
|
2179
|
+
message: string;
|
|
2180
|
+
status?: number | undefined;
|
|
2181
|
+
body?: unknown;
|
|
2182
|
+
started_at?: string | undefined;
|
|
2183
|
+
duration_ms?: number | undefined;
|
|
2184
|
+
}[];
|
|
2185
|
+
response?: unknown;
|
|
2186
|
+
started_at?: string | undefined;
|
|
2187
|
+
finished_at?: string | undefined;
|
|
2188
|
+
duration_ms?: number | undefined;
|
|
2189
|
+
} | undefined;
|
|
2190
|
+
webhook_runs?: {
|
|
2191
|
+
id: string;
|
|
2192
|
+
webhook_id: string;
|
|
2193
|
+
alias?: string | null | undefined;
|
|
2194
|
+
url: string;
|
|
2195
|
+
type: string;
|
|
2196
|
+
status: string;
|
|
2197
|
+
started_at: string;
|
|
2198
|
+
finished_at: string;
|
|
2199
|
+
duration_ms: number;
|
|
2200
|
+
ok: boolean;
|
|
2201
|
+
http_status?: number | undefined;
|
|
2202
|
+
error?: string | undefined;
|
|
2203
|
+
payload?: {
|
|
2204
|
+
id: string;
|
|
2205
|
+
type: string;
|
|
2206
|
+
created_at: string;
|
|
2207
|
+
data: Record<string, unknown>;
|
|
2208
|
+
} | undefined;
|
|
2209
|
+
idempotency_key?: string | undefined;
|
|
2210
|
+
resent_by?: string | undefined;
|
|
2211
|
+
}[] | undefined;
|
|
2212
|
+
manual_advance?: {
|
|
2213
|
+
reason: string;
|
|
2214
|
+
to_status: string;
|
|
2215
|
+
at: string;
|
|
2216
|
+
actor_name?: string | undefined;
|
|
2217
|
+
actor_avatar_url?: string | undefined;
|
|
2218
|
+
} | undefined;
|
|
2219
|
+
};
|
|
2220
|
+
} | null;
|
|
2221
|
+
declare const findStartNode: (workflow: OrderFulfillmentWorkflow) => {
|
|
2222
|
+
id: string;
|
|
2223
|
+
type: "fulfillmentStep";
|
|
2224
|
+
position: {
|
|
2225
|
+
x: number;
|
|
2226
|
+
y: number;
|
|
2227
|
+
};
|
|
2228
|
+
data: {
|
|
2229
|
+
kind: "join" | "start" | "state" | "terminal";
|
|
2230
|
+
label: Record<string, string>;
|
|
2231
|
+
description?: Record<string, string> | undefined;
|
|
2232
|
+
mappedStatus: string;
|
|
2233
|
+
milestone?: string | undefined;
|
|
2234
|
+
checkout_release?: boolean | undefined;
|
|
2235
|
+
payment_scope?: "digital" | "in_person" | undefined;
|
|
2236
|
+
joinPolicy?: "all" | "any" | undefined;
|
|
2237
|
+
actions?: {
|
|
2238
|
+
id: string;
|
|
2239
|
+
type: "invoke_callback" | "notify_webhook";
|
|
2240
|
+
webhook_ids?: string[] | undefined;
|
|
2241
|
+
callback_ids?: string[] | undefined;
|
|
2242
|
+
}[] | undefined;
|
|
2243
|
+
entered_at?: string | undefined;
|
|
2244
|
+
ready_at?: string | undefined;
|
|
2245
|
+
advance_requested_at?: string | undefined;
|
|
2246
|
+
resumed_at?: string | undefined;
|
|
2247
|
+
exited_at?: string | undefined;
|
|
2248
|
+
skipped_at?: string | undefined;
|
|
2249
|
+
logs?: {
|
|
2250
|
+
type: "error" | "info" | "success" | "warning";
|
|
2251
|
+
message: string;
|
|
2252
|
+
at: string;
|
|
2253
|
+
actor_name?: string | undefined;
|
|
2254
|
+
actor_avatar_url?: string | undefined;
|
|
2255
|
+
}[] | undefined;
|
|
2256
|
+
callback_run?: {
|
|
2257
|
+
attempt: number;
|
|
2258
|
+
errors: {
|
|
2259
|
+
attempt: number;
|
|
2260
|
+
at: string;
|
|
2261
|
+
message: string;
|
|
2262
|
+
status?: number | undefined;
|
|
2263
|
+
body?: unknown;
|
|
2264
|
+
started_at?: string | undefined;
|
|
2265
|
+
duration_ms?: number | undefined;
|
|
2266
|
+
}[];
|
|
2267
|
+
response?: unknown;
|
|
2268
|
+
started_at?: string | undefined;
|
|
2269
|
+
finished_at?: string | undefined;
|
|
2270
|
+
duration_ms?: number | undefined;
|
|
2271
|
+
} | undefined;
|
|
2272
|
+
webhook_runs?: {
|
|
2273
|
+
id: string;
|
|
2274
|
+
webhook_id: string;
|
|
2275
|
+
alias?: string | null | undefined;
|
|
2276
|
+
url: string;
|
|
2277
|
+
type: string;
|
|
2278
|
+
status: string;
|
|
2279
|
+
started_at: string;
|
|
2280
|
+
finished_at: string;
|
|
2281
|
+
duration_ms: number;
|
|
2282
|
+
ok: boolean;
|
|
2283
|
+
http_status?: number | undefined;
|
|
2284
|
+
error?: string | undefined;
|
|
2285
|
+
payload?: {
|
|
2286
|
+
id: string;
|
|
2287
|
+
type: string;
|
|
2288
|
+
created_at: string;
|
|
2289
|
+
data: Record<string, unknown>;
|
|
2290
|
+
} | undefined;
|
|
2291
|
+
idempotency_key?: string | undefined;
|
|
2292
|
+
resent_by?: string | undefined;
|
|
2293
|
+
}[] | undefined;
|
|
2294
|
+
manual_advance?: {
|
|
2295
|
+
reason: string;
|
|
2296
|
+
to_status: string;
|
|
2297
|
+
at: string;
|
|
2298
|
+
actor_name?: string | undefined;
|
|
2299
|
+
actor_avatar_url?: string | undefined;
|
|
2300
|
+
} | undefined;
|
|
2301
|
+
};
|
|
2302
|
+
} | null;
|
|
2303
|
+
declare const outgoingEdges: (workflow: OrderFulfillmentWorkflow, nodeId: string) => {
|
|
2304
|
+
id: string;
|
|
2305
|
+
source: string;
|
|
2306
|
+
target: string;
|
|
2307
|
+
type?: "fulfillmentEdge" | undefined;
|
|
2308
|
+
sourceHandle?: string | null | undefined;
|
|
2309
|
+
targetHandle?: string | null | undefined;
|
|
2310
|
+
data?: {
|
|
2311
|
+
label?: string | undefined;
|
|
2312
|
+
pathKind?: "cancel" | "default" | "refund" | "success" | undefined;
|
|
2313
|
+
conditions?: ({
|
|
2314
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2315
|
+
product_id?: string | undefined;
|
|
2316
|
+
tag?: string | undefined;
|
|
2317
|
+
fulfillment_id: string;
|
|
2318
|
+
store_id: string;
|
|
2319
|
+
channel_id: string;
|
|
2320
|
+
brand_id: string;
|
|
2321
|
+
primitive: "string";
|
|
2322
|
+
type: "Failure message" | "Order includes product with tag" | "Request path";
|
|
2323
|
+
operator: "contains" | "ends with" | "equal to" | "is all of" | "is any of" | "is none of" | "not equal to" | "starts with";
|
|
2324
|
+
caseInsensitive?: boolean | undefined;
|
|
2325
|
+
value: string | string[];
|
|
2326
|
+
invalidMessage?: string | undefined;
|
|
2327
|
+
} | {
|
|
2328
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2329
|
+
product_id?: string | undefined;
|
|
2330
|
+
tag?: string | undefined;
|
|
2331
|
+
fulfillment_id: string;
|
|
2332
|
+
store_id: string;
|
|
2333
|
+
channel_id: string;
|
|
2334
|
+
brand_id: string;
|
|
2335
|
+
primitive: "number";
|
|
2336
|
+
type: "API error rate" | "Accumulated events" | "Cart product count" | "Customer age" | "HTTP status" | "Order includes product" | "Order includes product with tag";
|
|
2337
|
+
operator: "equal to" | "greater than" | "greater than or equal to" | "is all of" | "is any of" | "is none of" | "less than" | "less than or equal to" | "not equal to";
|
|
2338
|
+
value: number | number[];
|
|
2339
|
+
include_modifiers?: boolean | undefined;
|
|
2340
|
+
window_minutes?: number | undefined;
|
|
2341
|
+
invalidMessage?: string | undefined;
|
|
2342
|
+
} | {
|
|
2343
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2344
|
+
product_id?: string | undefined;
|
|
2345
|
+
tag?: string | undefined;
|
|
2346
|
+
fulfillment_id: string;
|
|
2347
|
+
store_id: string;
|
|
2348
|
+
channel_id: string;
|
|
2349
|
+
brand_id: string;
|
|
2350
|
+
primitive: "currency";
|
|
2351
|
+
type: "Order includes product with tag" | "Order total";
|
|
2352
|
+
operator: "equal to" | "greater than" | "greater than or equal to" | "less than" | "less than or equal to" | "not equal to";
|
|
2353
|
+
value: number;
|
|
2354
|
+
invalidMessage?: string | undefined;
|
|
2355
|
+
} | {
|
|
2356
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2357
|
+
product_id?: string | undefined;
|
|
2358
|
+
tag?: string | undefined;
|
|
2359
|
+
fulfillment_id: string;
|
|
2360
|
+
store_id: string;
|
|
2361
|
+
channel_id: string;
|
|
2362
|
+
brand_id: string;
|
|
2363
|
+
primitive: "boolean";
|
|
2364
|
+
type: "Customer is anonymous" | "Is anonymous order" | "Order includes product with tag" | "Order is scheduled" | "Payment captured" | "Payment is mixed";
|
|
2365
|
+
operator: "is" | "is not";
|
|
2366
|
+
value: boolean;
|
|
2367
|
+
invalidMessage?: string | undefined;
|
|
2368
|
+
} | {
|
|
2369
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2370
|
+
primitive: "enum";
|
|
2371
|
+
type: "Payment collect at" | "Payment method" | "Payment status";
|
|
2372
|
+
operator: "is" | "is any of" | "is none of" | "is not";
|
|
2373
|
+
value: string | string[];
|
|
2374
|
+
invalidMessage?: string | undefined;
|
|
2375
|
+
} | {
|
|
2376
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2377
|
+
primitive: "absolute date";
|
|
2378
|
+
type: "Today";
|
|
2379
|
+
operator: "is" | "is after" | "is before" | "is not";
|
|
2380
|
+
value: Date;
|
|
2381
|
+
invalidMessage?: string | undefined;
|
|
2382
|
+
} | {
|
|
2383
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2384
|
+
primitive: "relative date";
|
|
2385
|
+
type: "Birthday" | "Customer last session" | "Customer last visit" | "Registration";
|
|
2386
|
+
operator: "occurred" | "occurred in the last" | "occurred more than";
|
|
2387
|
+
value: string;
|
|
2388
|
+
invalidMessage?: string | undefined;
|
|
2389
|
+
} | {
|
|
2390
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2391
|
+
primitive: "recurring date";
|
|
2392
|
+
type: "Current date";
|
|
2393
|
+
operator: "falls within period";
|
|
2394
|
+
startDate: Date;
|
|
2395
|
+
endDate: Date;
|
|
2396
|
+
allDay: boolean;
|
|
2397
|
+
repeat: "CUSTOM" | "DAILY" | "FORTNIGHTLY" | "LAST_DAY_OF_MONTH" | "MONTHLY" | "NONE" | "WEEKDAYS" | "WEEKENDS" | "WEEKLY" | "WEEK_OF_MONTH";
|
|
2398
|
+
value: string;
|
|
2399
|
+
invalidMessage?: string | undefined;
|
|
2400
|
+
} | {
|
|
2401
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2402
|
+
primitive: "custom";
|
|
2403
|
+
type: "Brand" | "Brands" | "Channel" | "Channels" | "Fulfillment" | "Fulfillments" | "Payment" | "Store" | "Stores";
|
|
2404
|
+
operator: "is" | "is all of" | "is any of" | "is none of" | "is not";
|
|
2405
|
+
value: string;
|
|
2406
|
+
label_ids?: string[] | undefined;
|
|
2407
|
+
invalidMessage?: string | undefined;
|
|
2408
|
+
})[][] | undefined;
|
|
2409
|
+
taken_at?: string | undefined;
|
|
2410
|
+
} | undefined;
|
|
2411
|
+
}[];
|
|
2412
|
+
declare const incomingEdges: (workflow: OrderFulfillmentWorkflow, nodeId: string) => {
|
|
2413
|
+
id: string;
|
|
2414
|
+
source: string;
|
|
2415
|
+
target: string;
|
|
2416
|
+
type?: "fulfillmentEdge" | undefined;
|
|
2417
|
+
sourceHandle?: string | null | undefined;
|
|
2418
|
+
targetHandle?: string | null | undefined;
|
|
2419
|
+
data?: {
|
|
2420
|
+
label?: string | undefined;
|
|
2421
|
+
pathKind?: "cancel" | "default" | "refund" | "success" | undefined;
|
|
2422
|
+
conditions?: ({
|
|
2423
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2424
|
+
product_id?: string | undefined;
|
|
2425
|
+
tag?: string | undefined;
|
|
2426
|
+
fulfillment_id: string;
|
|
2427
|
+
store_id: string;
|
|
2428
|
+
channel_id: string;
|
|
2429
|
+
brand_id: string;
|
|
2430
|
+
primitive: "string";
|
|
2431
|
+
type: "Failure message" | "Order includes product with tag" | "Request path";
|
|
2432
|
+
operator: "contains" | "ends with" | "equal to" | "is all of" | "is any of" | "is none of" | "not equal to" | "starts with";
|
|
2433
|
+
caseInsensitive?: boolean | undefined;
|
|
2434
|
+
value: string | string[];
|
|
2435
|
+
invalidMessage?: string | undefined;
|
|
2436
|
+
} | {
|
|
2437
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2438
|
+
product_id?: string | undefined;
|
|
2439
|
+
tag?: string | undefined;
|
|
2440
|
+
fulfillment_id: string;
|
|
2441
|
+
store_id: string;
|
|
2442
|
+
channel_id: string;
|
|
2443
|
+
brand_id: string;
|
|
2444
|
+
primitive: "number";
|
|
2445
|
+
type: "API error rate" | "Accumulated events" | "Cart product count" | "Customer age" | "HTTP status" | "Order includes product" | "Order includes product with tag";
|
|
2446
|
+
operator: "equal to" | "greater than" | "greater than or equal to" | "is all of" | "is any of" | "is none of" | "less than" | "less than or equal to" | "not equal to";
|
|
2447
|
+
value: number | number[];
|
|
2448
|
+
include_modifiers?: boolean | undefined;
|
|
2449
|
+
window_minutes?: number | undefined;
|
|
2450
|
+
invalidMessage?: string | undefined;
|
|
2451
|
+
} | {
|
|
2452
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2453
|
+
product_id?: string | undefined;
|
|
2454
|
+
tag?: string | undefined;
|
|
2455
|
+
fulfillment_id: string;
|
|
2456
|
+
store_id: string;
|
|
2457
|
+
channel_id: string;
|
|
2458
|
+
brand_id: string;
|
|
2459
|
+
primitive: "currency";
|
|
2460
|
+
type: "Order includes product with tag" | "Order total";
|
|
2461
|
+
operator: "equal to" | "greater than" | "greater than or equal to" | "less than" | "less than or equal to" | "not equal to";
|
|
2462
|
+
value: number;
|
|
2463
|
+
invalidMessage?: string | undefined;
|
|
2464
|
+
} | {
|
|
2465
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2466
|
+
product_id?: string | undefined;
|
|
2467
|
+
tag?: string | undefined;
|
|
2468
|
+
fulfillment_id: string;
|
|
2469
|
+
store_id: string;
|
|
2470
|
+
channel_id: string;
|
|
2471
|
+
brand_id: string;
|
|
2472
|
+
primitive: "boolean";
|
|
2473
|
+
type: "Customer is anonymous" | "Is anonymous order" | "Order includes product with tag" | "Order is scheduled" | "Payment captured" | "Payment is mixed";
|
|
2474
|
+
operator: "is" | "is not";
|
|
2475
|
+
value: boolean;
|
|
2476
|
+
invalidMessage?: string | undefined;
|
|
2477
|
+
} | {
|
|
2478
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2479
|
+
primitive: "enum";
|
|
2480
|
+
type: "Payment collect at" | "Payment method" | "Payment status";
|
|
2481
|
+
operator: "is" | "is any of" | "is none of" | "is not";
|
|
2482
|
+
value: string | string[];
|
|
2483
|
+
invalidMessage?: string | undefined;
|
|
2484
|
+
} | {
|
|
2485
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2486
|
+
primitive: "absolute date";
|
|
2487
|
+
type: "Today";
|
|
2488
|
+
operator: "is" | "is after" | "is before" | "is not";
|
|
2489
|
+
value: Date;
|
|
2490
|
+
invalidMessage?: string | undefined;
|
|
2491
|
+
} | {
|
|
2492
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2493
|
+
primitive: "relative date";
|
|
2494
|
+
type: "Birthday" | "Customer last session" | "Customer last visit" | "Registration";
|
|
2495
|
+
operator: "occurred" | "occurred in the last" | "occurred more than";
|
|
2496
|
+
value: string;
|
|
2497
|
+
invalidMessage?: string | undefined;
|
|
2498
|
+
} | {
|
|
2499
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2500
|
+
primitive: "recurring date";
|
|
2501
|
+
type: "Current date";
|
|
2502
|
+
operator: "falls within period";
|
|
2503
|
+
startDate: Date;
|
|
2504
|
+
endDate: Date;
|
|
2505
|
+
allDay: boolean;
|
|
2506
|
+
repeat: "CUSTOM" | "DAILY" | "FORTNIGHTLY" | "LAST_DAY_OF_MONTH" | "MONTHLY" | "NONE" | "WEEKDAYS" | "WEEKENDS" | "WEEKLY" | "WEEK_OF_MONTH";
|
|
2507
|
+
value: string;
|
|
2508
|
+
invalidMessage?: string | undefined;
|
|
2509
|
+
} | {
|
|
2510
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2511
|
+
primitive: "custom";
|
|
2512
|
+
type: "Brand" | "Brands" | "Channel" | "Channels" | "Fulfillment" | "Fulfillments" | "Payment" | "Store" | "Stores";
|
|
2513
|
+
operator: "is" | "is all of" | "is any of" | "is none of" | "is not";
|
|
2514
|
+
value: string;
|
|
2515
|
+
label_ids?: string[] | undefined;
|
|
2516
|
+
invalidMessage?: string | undefined;
|
|
2517
|
+
})[][] | undefined;
|
|
2518
|
+
taken_at?: string | undefined;
|
|
2519
|
+
} | undefined;
|
|
2520
|
+
}[];
|
|
2521
|
+
declare const defaultOutgoingEdge: (workflow: OrderFulfillmentWorkflow, nodeId: string) => {
|
|
2522
|
+
id: string;
|
|
2523
|
+
source: string;
|
|
2524
|
+
target: string;
|
|
2525
|
+
type?: "fulfillmentEdge" | undefined;
|
|
2526
|
+
sourceHandle?: string | null | undefined;
|
|
2527
|
+
targetHandle?: string | null | undefined;
|
|
2528
|
+
data?: {
|
|
2529
|
+
label?: string | undefined;
|
|
2530
|
+
pathKind?: "cancel" | "default" | "refund" | "success" | undefined;
|
|
2531
|
+
conditions?: ({
|
|
2532
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2533
|
+
product_id?: string | undefined;
|
|
2534
|
+
tag?: string | undefined;
|
|
2535
|
+
fulfillment_id: string;
|
|
2536
|
+
store_id: string;
|
|
2537
|
+
channel_id: string;
|
|
2538
|
+
brand_id: string;
|
|
2539
|
+
primitive: "string";
|
|
2540
|
+
type: "Failure message" | "Order includes product with tag" | "Request path";
|
|
2541
|
+
operator: "contains" | "ends with" | "equal to" | "is all of" | "is any of" | "is none of" | "not equal to" | "starts with";
|
|
2542
|
+
caseInsensitive?: boolean | undefined;
|
|
2543
|
+
value: string | string[];
|
|
2544
|
+
invalidMessage?: string | undefined;
|
|
2545
|
+
} | {
|
|
2546
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2547
|
+
product_id?: string | undefined;
|
|
2548
|
+
tag?: string | undefined;
|
|
2549
|
+
fulfillment_id: string;
|
|
2550
|
+
store_id: string;
|
|
2551
|
+
channel_id: string;
|
|
2552
|
+
brand_id: string;
|
|
2553
|
+
primitive: "number";
|
|
2554
|
+
type: "API error rate" | "Accumulated events" | "Cart product count" | "Customer age" | "HTTP status" | "Order includes product" | "Order includes product with tag";
|
|
2555
|
+
operator: "equal to" | "greater than" | "greater than or equal to" | "is all of" | "is any of" | "is none of" | "less than" | "less than or equal to" | "not equal to";
|
|
2556
|
+
value: number | number[];
|
|
2557
|
+
include_modifiers?: boolean | undefined;
|
|
2558
|
+
window_minutes?: number | undefined;
|
|
2559
|
+
invalidMessage?: string | undefined;
|
|
2560
|
+
} | {
|
|
2561
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2562
|
+
product_id?: string | undefined;
|
|
2563
|
+
tag?: string | undefined;
|
|
2564
|
+
fulfillment_id: string;
|
|
2565
|
+
store_id: string;
|
|
2566
|
+
channel_id: string;
|
|
2567
|
+
brand_id: string;
|
|
2568
|
+
primitive: "currency";
|
|
2569
|
+
type: "Order includes product with tag" | "Order total";
|
|
2570
|
+
operator: "equal to" | "greater than" | "greater than or equal to" | "less than" | "less than or equal to" | "not equal to";
|
|
2571
|
+
value: number;
|
|
2572
|
+
invalidMessage?: string | undefined;
|
|
2573
|
+
} | {
|
|
2574
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2575
|
+
product_id?: string | undefined;
|
|
2576
|
+
tag?: string | undefined;
|
|
2577
|
+
fulfillment_id: string;
|
|
2578
|
+
store_id: string;
|
|
2579
|
+
channel_id: string;
|
|
2580
|
+
brand_id: string;
|
|
2581
|
+
primitive: "boolean";
|
|
2582
|
+
type: "Customer is anonymous" | "Is anonymous order" | "Order includes product with tag" | "Order is scheduled" | "Payment captured" | "Payment is mixed";
|
|
2583
|
+
operator: "is" | "is not";
|
|
2584
|
+
value: boolean;
|
|
2585
|
+
invalidMessage?: string | undefined;
|
|
2586
|
+
} | {
|
|
2587
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2588
|
+
primitive: "enum";
|
|
2589
|
+
type: "Payment collect at" | "Payment method" | "Payment status";
|
|
2590
|
+
operator: "is" | "is any of" | "is none of" | "is not";
|
|
2591
|
+
value: string | string[];
|
|
2592
|
+
invalidMessage?: string | undefined;
|
|
2593
|
+
} | {
|
|
2594
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2595
|
+
primitive: "absolute date";
|
|
2596
|
+
type: "Today";
|
|
2597
|
+
operator: "is" | "is after" | "is before" | "is not";
|
|
2598
|
+
value: Date;
|
|
2599
|
+
invalidMessage?: string | undefined;
|
|
2600
|
+
} | {
|
|
2601
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2602
|
+
primitive: "relative date";
|
|
2603
|
+
type: "Birthday" | "Customer last session" | "Customer last visit" | "Registration";
|
|
2604
|
+
operator: "occurred" | "occurred in the last" | "occurred more than";
|
|
2605
|
+
value: string;
|
|
2606
|
+
invalidMessage?: string | undefined;
|
|
2607
|
+
} | {
|
|
2608
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2609
|
+
primitive: "recurring date";
|
|
2610
|
+
type: "Current date";
|
|
2611
|
+
operator: "falls within period";
|
|
2612
|
+
startDate: Date;
|
|
2613
|
+
endDate: Date;
|
|
2614
|
+
allDay: boolean;
|
|
2615
|
+
repeat: "CUSTOM" | "DAILY" | "FORTNIGHTLY" | "LAST_DAY_OF_MONTH" | "MONTHLY" | "NONE" | "WEEKDAYS" | "WEEKENDS" | "WEEKLY" | "WEEK_OF_MONTH";
|
|
2616
|
+
value: string;
|
|
2617
|
+
invalidMessage?: string | undefined;
|
|
2618
|
+
} | {
|
|
2619
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2620
|
+
primitive: "custom";
|
|
2621
|
+
type: "Brand" | "Brands" | "Channel" | "Channels" | "Fulfillment" | "Fulfillments" | "Payment" | "Store" | "Stores";
|
|
2622
|
+
operator: "is" | "is all of" | "is any of" | "is none of" | "is not";
|
|
2623
|
+
value: string;
|
|
2624
|
+
label_ids?: string[] | undefined;
|
|
2625
|
+
invalidMessage?: string | undefined;
|
|
2626
|
+
})[][] | undefined;
|
|
2627
|
+
taken_at?: string | undefined;
|
|
2628
|
+
} | undefined;
|
|
2629
|
+
} | null;
|
|
2630
|
+
declare const findFirstState: (workflow: OrderFulfillmentWorkflow) => OrderFulfillmentWorkflowNode | null;
|
|
2631
|
+
declare const canEnterJoin: (workflow: OrderFulfillmentWorkflow, node: OrderFulfillmentWorkflowNode) => boolean;
|
|
2632
|
+
/** Unused primary outs whose conditions match the order (Door fork, etc.). */
|
|
2633
|
+
declare const matchingPrimaryOutgoing: (input: {
|
|
2634
|
+
workflow: OrderFulfillmentWorkflow;
|
|
2635
|
+
nodeId: string;
|
|
2636
|
+
order: OrderRecord;
|
|
2637
|
+
outgoingBySource?: Map<string, OrderFulfillmentWorkflowEdge[]>;
|
|
2638
|
+
nodesById?: Map<string, OrderFulfillmentWorkflowNode>;
|
|
2639
|
+
}) => OrderFulfillmentWorkflowEdge[];
|
|
2640
|
+
declare const indexOutgoingBySource: (workflow: OrderFulfillmentWorkflow) => Map<string, OrderFulfillmentWorkflowEdge[]>;
|
|
2641
|
+
declare const unusedOutgoing: (workflow: OrderFulfillmentWorkflow, nodeId: string, outgoingBySource?: Map<string, OrderFulfillmentWorkflowEdge[]>) => OrderFulfillmentWorkflowEdge[];
|
|
2642
|
+
/** First edge wins; every edge into that same target travels with it. */
|
|
2643
|
+
declare const pickAdvanceTarget: (edges: {
|
|
2644
|
+
id: string;
|
|
2645
|
+
target: string;
|
|
2646
|
+
}[]) => {
|
|
2647
|
+
targetId: string;
|
|
2648
|
+
edgeIds: string[];
|
|
2649
|
+
} | null;
|
|
2650
|
+
declare const resolveAdvanceEdges: (input: {
|
|
2651
|
+
workflow: OrderFulfillmentWorkflow;
|
|
2652
|
+
currentNodeIds: string[];
|
|
2653
|
+
fulfillmentStatus: string;
|
|
2654
|
+
order: OrderRecord;
|
|
2655
|
+
}) => OrderFulfillmentWorkflowEdge[];
|
|
2656
|
+
declare const findMappedStatusNode: (workflow: OrderFulfillmentWorkflow, status: string) => {
|
|
2657
|
+
id: string;
|
|
2658
|
+
type: "fulfillmentStep";
|
|
2659
|
+
position: {
|
|
2660
|
+
x: number;
|
|
2661
|
+
y: number;
|
|
2662
|
+
};
|
|
2663
|
+
data: {
|
|
2664
|
+
kind: "join" | "start" | "state" | "terminal";
|
|
2665
|
+
label: Record<string, string>;
|
|
2666
|
+
description?: Record<string, string> | undefined;
|
|
2667
|
+
mappedStatus: string;
|
|
2668
|
+
milestone?: string | undefined;
|
|
2669
|
+
checkout_release?: boolean | undefined;
|
|
2670
|
+
payment_scope?: "digital" | "in_person" | undefined;
|
|
2671
|
+
joinPolicy?: "all" | "any" | undefined;
|
|
2672
|
+
actions?: {
|
|
2673
|
+
id: string;
|
|
2674
|
+
type: "invoke_callback" | "notify_webhook";
|
|
2675
|
+
webhook_ids?: string[] | undefined;
|
|
2676
|
+
callback_ids?: string[] | undefined;
|
|
2677
|
+
}[] | undefined;
|
|
2678
|
+
entered_at?: string | undefined;
|
|
2679
|
+
ready_at?: string | undefined;
|
|
2680
|
+
advance_requested_at?: string | undefined;
|
|
2681
|
+
resumed_at?: string | undefined;
|
|
2682
|
+
exited_at?: string | undefined;
|
|
2683
|
+
skipped_at?: string | undefined;
|
|
2684
|
+
logs?: {
|
|
2685
|
+
type: "error" | "info" | "success" | "warning";
|
|
2686
|
+
message: string;
|
|
2687
|
+
at: string;
|
|
2688
|
+
actor_name?: string | undefined;
|
|
2689
|
+
actor_avatar_url?: string | undefined;
|
|
2690
|
+
}[] | undefined;
|
|
2691
|
+
callback_run?: {
|
|
2692
|
+
attempt: number;
|
|
2693
|
+
errors: {
|
|
2694
|
+
attempt: number;
|
|
2695
|
+
at: string;
|
|
2696
|
+
message: string;
|
|
2697
|
+
status?: number | undefined;
|
|
2698
|
+
body?: unknown;
|
|
2699
|
+
started_at?: string | undefined;
|
|
2700
|
+
duration_ms?: number | undefined;
|
|
2701
|
+
}[];
|
|
2702
|
+
response?: unknown;
|
|
2703
|
+
started_at?: string | undefined;
|
|
2704
|
+
finished_at?: string | undefined;
|
|
2705
|
+
duration_ms?: number | undefined;
|
|
2706
|
+
} | undefined;
|
|
2707
|
+
webhook_runs?: {
|
|
2708
|
+
id: string;
|
|
2709
|
+
webhook_id: string;
|
|
2710
|
+
alias?: string | null | undefined;
|
|
2711
|
+
url: string;
|
|
2712
|
+
type: string;
|
|
2713
|
+
status: string;
|
|
2714
|
+
started_at: string;
|
|
2715
|
+
finished_at: string;
|
|
2716
|
+
duration_ms: number;
|
|
2717
|
+
ok: boolean;
|
|
2718
|
+
http_status?: number | undefined;
|
|
2719
|
+
error?: string | undefined;
|
|
2720
|
+
payload?: {
|
|
2721
|
+
id: string;
|
|
2722
|
+
type: string;
|
|
2723
|
+
created_at: string;
|
|
2724
|
+
data: Record<string, unknown>;
|
|
2725
|
+
} | undefined;
|
|
2726
|
+
idempotency_key?: string | undefined;
|
|
2727
|
+
resent_by?: string | undefined;
|
|
2728
|
+
}[] | undefined;
|
|
2729
|
+
manual_advance?: {
|
|
2730
|
+
reason: string;
|
|
2731
|
+
to_status: string;
|
|
2732
|
+
at: string;
|
|
2733
|
+
actor_name?: string | undefined;
|
|
2734
|
+
actor_avatar_url?: string | undefined;
|
|
2735
|
+
} | undefined;
|
|
2736
|
+
};
|
|
2737
|
+
} | null;
|
|
2738
|
+
declare const isTerminalMappedStatus: (workflow: OrderFulfillmentWorkflow, status: string) => boolean;
|
|
2739
|
+
/** Unused primary outs are only success terminals — ready to auto-enter. */
|
|
2740
|
+
declare const resolveSuccessTerminalEdges: (input: {
|
|
2741
|
+
workflow: OrderFulfillmentWorkflow;
|
|
2742
|
+
currentNodeIds: string[];
|
|
2743
|
+
order: OrderRecord;
|
|
2744
|
+
}) => OrderFulfillmentWorkflowEdge[];
|
|
2745
|
+
/**
|
|
2746
|
+
* The `cancel` / `refund` edge out of the current nodes whose conditions
|
|
2747
|
+
* match the order (e.g. `Payment captured`), used when callbacks fail
|
|
2748
|
+
* (§7.1). `null` when none applies: no terminal is invented.
|
|
2749
|
+
*/
|
|
2750
|
+
declare const resolveFailureTerminalEdge: (input: {
|
|
2751
|
+
workflow: OrderFulfillmentWorkflow;
|
|
2752
|
+
currentNodeIds: string[];
|
|
2753
|
+
order: OrderRecord;
|
|
2754
|
+
}) => {
|
|
2755
|
+
edge: {
|
|
2756
|
+
id: string;
|
|
2757
|
+
source: string;
|
|
2758
|
+
target: string;
|
|
2759
|
+
type?: "fulfillmentEdge" | undefined;
|
|
2760
|
+
sourceHandle?: string | null | undefined;
|
|
2761
|
+
targetHandle?: string | null | undefined;
|
|
2762
|
+
data?: {
|
|
2763
|
+
label?: string | undefined;
|
|
2764
|
+
pathKind?: "cancel" | "default" | "refund" | "success" | undefined;
|
|
2765
|
+
conditions?: ({
|
|
2766
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2767
|
+
product_id?: string | undefined;
|
|
2768
|
+
tag?: string | undefined;
|
|
2769
|
+
fulfillment_id: string;
|
|
2770
|
+
store_id: string;
|
|
2771
|
+
channel_id: string;
|
|
2772
|
+
brand_id: string;
|
|
2773
|
+
primitive: "string";
|
|
2774
|
+
type: "Failure message" | "Order includes product with tag" | "Request path";
|
|
2775
|
+
operator: "contains" | "ends with" | "equal to" | "is all of" | "is any of" | "is none of" | "not equal to" | "starts with";
|
|
2776
|
+
caseInsensitive?: boolean | undefined;
|
|
2777
|
+
value: string | string[];
|
|
2778
|
+
invalidMessage?: string | undefined;
|
|
2779
|
+
} | {
|
|
2780
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2781
|
+
product_id?: string | undefined;
|
|
2782
|
+
tag?: string | undefined;
|
|
2783
|
+
fulfillment_id: string;
|
|
2784
|
+
store_id: string;
|
|
2785
|
+
channel_id: string;
|
|
2786
|
+
brand_id: string;
|
|
2787
|
+
primitive: "number";
|
|
2788
|
+
type: "API error rate" | "Accumulated events" | "Cart product count" | "Customer age" | "HTTP status" | "Order includes product" | "Order includes product with tag";
|
|
2789
|
+
operator: "equal to" | "greater than" | "greater than or equal to" | "is all of" | "is any of" | "is none of" | "less than" | "less than or equal to" | "not equal to";
|
|
2790
|
+
value: number | number[];
|
|
2791
|
+
include_modifiers?: boolean | undefined;
|
|
2792
|
+
window_minutes?: number | undefined;
|
|
2793
|
+
invalidMessage?: string | undefined;
|
|
2794
|
+
} | {
|
|
2795
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2796
|
+
product_id?: string | undefined;
|
|
2797
|
+
tag?: string | undefined;
|
|
2798
|
+
fulfillment_id: string;
|
|
2799
|
+
store_id: string;
|
|
2800
|
+
channel_id: string;
|
|
2801
|
+
brand_id: string;
|
|
2802
|
+
primitive: "currency";
|
|
2803
|
+
type: "Order includes product with tag" | "Order total";
|
|
2804
|
+
operator: "equal to" | "greater than" | "greater than or equal to" | "less than" | "less than or equal to" | "not equal to";
|
|
2805
|
+
value: number;
|
|
2806
|
+
invalidMessage?: string | undefined;
|
|
2807
|
+
} | {
|
|
2808
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2809
|
+
product_id?: string | undefined;
|
|
2810
|
+
tag?: string | undefined;
|
|
2811
|
+
fulfillment_id: string;
|
|
2812
|
+
store_id: string;
|
|
2813
|
+
channel_id: string;
|
|
2814
|
+
brand_id: string;
|
|
2815
|
+
primitive: "boolean";
|
|
2816
|
+
type: "Customer is anonymous" | "Is anonymous order" | "Order includes product with tag" | "Order is scheduled" | "Payment captured" | "Payment is mixed";
|
|
2817
|
+
operator: "is" | "is not";
|
|
2818
|
+
value: boolean;
|
|
2819
|
+
invalidMessage?: string | undefined;
|
|
2820
|
+
} | {
|
|
2821
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2822
|
+
primitive: "enum";
|
|
2823
|
+
type: "Payment collect at" | "Payment method" | "Payment status";
|
|
2824
|
+
operator: "is" | "is any of" | "is none of" | "is not";
|
|
2825
|
+
value: string | string[];
|
|
2826
|
+
invalidMessage?: string | undefined;
|
|
2827
|
+
} | {
|
|
2828
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2829
|
+
primitive: "absolute date";
|
|
2830
|
+
type: "Today";
|
|
2831
|
+
operator: "is" | "is after" | "is before" | "is not";
|
|
2832
|
+
value: Date;
|
|
2833
|
+
invalidMessage?: string | undefined;
|
|
2834
|
+
} | {
|
|
2835
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2836
|
+
primitive: "relative date";
|
|
2837
|
+
type: "Birthday" | "Customer last session" | "Customer last visit" | "Registration";
|
|
2838
|
+
operator: "occurred" | "occurred in the last" | "occurred more than";
|
|
2839
|
+
value: string;
|
|
2840
|
+
invalidMessage?: string | undefined;
|
|
2841
|
+
} | {
|
|
2842
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2843
|
+
primitive: "recurring date";
|
|
2844
|
+
type: "Current date";
|
|
2845
|
+
operator: "falls within period";
|
|
2846
|
+
startDate: Date;
|
|
2847
|
+
endDate: Date;
|
|
2848
|
+
allDay: boolean;
|
|
2849
|
+
repeat: "CUSTOM" | "DAILY" | "FORTNIGHTLY" | "LAST_DAY_OF_MONTH" | "MONTHLY" | "NONE" | "WEEKDAYS" | "WEEKENDS" | "WEEKLY" | "WEEK_OF_MONTH";
|
|
2850
|
+
value: string;
|
|
2851
|
+
invalidMessage?: string | undefined;
|
|
2852
|
+
} | {
|
|
2853
|
+
interpretation?: "both" | "client" | "server" | undefined;
|
|
2854
|
+
primitive: "custom";
|
|
2855
|
+
type: "Brand" | "Brands" | "Channel" | "Channels" | "Fulfillment" | "Fulfillments" | "Payment" | "Store" | "Stores";
|
|
2856
|
+
operator: "is" | "is all of" | "is any of" | "is none of" | "is not";
|
|
2857
|
+
value: string;
|
|
2858
|
+
label_ids?: string[] | undefined;
|
|
2859
|
+
invalidMessage?: string | undefined;
|
|
2860
|
+
})[][] | undefined;
|
|
2861
|
+
taken_at?: string | undefined;
|
|
2862
|
+
} | undefined;
|
|
2863
|
+
};
|
|
2864
|
+
target: {
|
|
2865
|
+
id: string;
|
|
2866
|
+
type: "fulfillmentStep";
|
|
2867
|
+
position: {
|
|
2868
|
+
x: number;
|
|
2869
|
+
y: number;
|
|
2870
|
+
};
|
|
2871
|
+
data: {
|
|
2872
|
+
kind: "join" | "start" | "state" | "terminal";
|
|
2873
|
+
label: Record<string, string>;
|
|
2874
|
+
description?: Record<string, string> | undefined;
|
|
2875
|
+
mappedStatus: string;
|
|
2876
|
+
milestone?: string | undefined;
|
|
2877
|
+
checkout_release?: boolean | undefined;
|
|
2878
|
+
payment_scope?: "digital" | "in_person" | undefined;
|
|
2879
|
+
joinPolicy?: "all" | "any" | undefined;
|
|
2880
|
+
actions?: {
|
|
2881
|
+
id: string;
|
|
2882
|
+
type: "invoke_callback" | "notify_webhook";
|
|
2883
|
+
webhook_ids?: string[] | undefined;
|
|
2884
|
+
callback_ids?: string[] | undefined;
|
|
2885
|
+
}[] | undefined;
|
|
2886
|
+
entered_at?: string | undefined;
|
|
2887
|
+
ready_at?: string | undefined;
|
|
2888
|
+
advance_requested_at?: string | undefined;
|
|
2889
|
+
resumed_at?: string | undefined;
|
|
2890
|
+
exited_at?: string | undefined;
|
|
2891
|
+
skipped_at?: string | undefined;
|
|
2892
|
+
logs?: {
|
|
2893
|
+
type: "error" | "info" | "success" | "warning";
|
|
2894
|
+
message: string;
|
|
2895
|
+
at: string;
|
|
2896
|
+
actor_name?: string | undefined;
|
|
2897
|
+
actor_avatar_url?: string | undefined;
|
|
2898
|
+
}[] | undefined;
|
|
2899
|
+
callback_run?: {
|
|
2900
|
+
attempt: number;
|
|
2901
|
+
errors: {
|
|
2902
|
+
attempt: number;
|
|
2903
|
+
at: string;
|
|
2904
|
+
message: string;
|
|
2905
|
+
status?: number | undefined;
|
|
2906
|
+
body?: unknown;
|
|
2907
|
+
started_at?: string | undefined;
|
|
2908
|
+
duration_ms?: number | undefined;
|
|
2909
|
+
}[];
|
|
2910
|
+
response?: unknown;
|
|
2911
|
+
started_at?: string | undefined;
|
|
2912
|
+
finished_at?: string | undefined;
|
|
2913
|
+
duration_ms?: number | undefined;
|
|
2914
|
+
} | undefined;
|
|
2915
|
+
webhook_runs?: {
|
|
2916
|
+
id: string;
|
|
2917
|
+
webhook_id: string;
|
|
2918
|
+
alias?: string | null | undefined;
|
|
2919
|
+
url: string;
|
|
2920
|
+
type: string;
|
|
2921
|
+
status: string;
|
|
2922
|
+
started_at: string;
|
|
2923
|
+
finished_at: string;
|
|
2924
|
+
duration_ms: number;
|
|
2925
|
+
ok: boolean;
|
|
2926
|
+
http_status?: number | undefined;
|
|
2927
|
+
error?: string | undefined;
|
|
2928
|
+
payload?: {
|
|
2929
|
+
id: string;
|
|
2930
|
+
type: string;
|
|
2931
|
+
created_at: string;
|
|
2932
|
+
data: Record<string, unknown>;
|
|
2933
|
+
} | undefined;
|
|
2934
|
+
idempotency_key?: string | undefined;
|
|
2935
|
+
resent_by?: string | undefined;
|
|
2936
|
+
}[] | undefined;
|
|
2937
|
+
manual_advance?: {
|
|
2938
|
+
reason: string;
|
|
2939
|
+
to_status: string;
|
|
2940
|
+
at: string;
|
|
2941
|
+
actor_name?: string | undefined;
|
|
2942
|
+
actor_avatar_url?: string | undefined;
|
|
2943
|
+
} | undefined;
|
|
2944
|
+
};
|
|
2945
|
+
};
|
|
2946
|
+
} | null;
|
|
2947
|
+
declare const resolveAdvanceEdge: (input: {
|
|
2948
|
+
workflow: OrderFulfillmentWorkflow;
|
|
2949
|
+
currentNodeIds: string[];
|
|
2950
|
+
fulfillmentStatus: string;
|
|
2951
|
+
order: OrderRecord;
|
|
2952
|
+
}) => OrderFulfillmentWorkflowEdge | null;
|
|
2953
|
+
declare const nextCurrentNodeIds: (input: {
|
|
2954
|
+
workflow: OrderFulfillmentWorkflow;
|
|
2955
|
+
currentNodeIds: string[];
|
|
2956
|
+
targetId: string;
|
|
2957
|
+
entered: boolean;
|
|
2958
|
+
takenSourceIds: string[];
|
|
2959
|
+
order?: OrderRecord;
|
|
2960
|
+
}) => string[];
|
|
2961
|
+
/** Prefer the entered target, then any sitting terminal, then the first head. */
|
|
2962
|
+
declare const sittingWorkflowNode: (workflow: OrderFulfillmentWorkflow, currentNodeIds: string[], fallbackId?: string) => {
|
|
2963
|
+
id: string;
|
|
2964
|
+
type: "fulfillmentStep";
|
|
2965
|
+
position: {
|
|
2966
|
+
x: number;
|
|
2967
|
+
y: number;
|
|
2968
|
+
};
|
|
2969
|
+
data: {
|
|
2970
|
+
kind: "join" | "start" | "state" | "terminal";
|
|
2971
|
+
label: Record<string, string>;
|
|
2972
|
+
description?: Record<string, string> | undefined;
|
|
2973
|
+
mappedStatus: string;
|
|
2974
|
+
milestone?: string | undefined;
|
|
2975
|
+
checkout_release?: boolean | undefined;
|
|
2976
|
+
payment_scope?: "digital" | "in_person" | undefined;
|
|
2977
|
+
joinPolicy?: "all" | "any" | undefined;
|
|
2978
|
+
actions?: {
|
|
2979
|
+
id: string;
|
|
2980
|
+
type: "invoke_callback" | "notify_webhook";
|
|
2981
|
+
webhook_ids?: string[] | undefined;
|
|
2982
|
+
callback_ids?: string[] | undefined;
|
|
2983
|
+
}[] | undefined;
|
|
2984
|
+
entered_at?: string | undefined;
|
|
2985
|
+
ready_at?: string | undefined;
|
|
2986
|
+
advance_requested_at?: string | undefined;
|
|
2987
|
+
resumed_at?: string | undefined;
|
|
2988
|
+
exited_at?: string | undefined;
|
|
2989
|
+
skipped_at?: string | undefined;
|
|
2990
|
+
logs?: {
|
|
2991
|
+
type: "error" | "info" | "success" | "warning";
|
|
2992
|
+
message: string;
|
|
2993
|
+
at: string;
|
|
2994
|
+
actor_name?: string | undefined;
|
|
2995
|
+
actor_avatar_url?: string | undefined;
|
|
2996
|
+
}[] | undefined;
|
|
2997
|
+
callback_run?: {
|
|
2998
|
+
attempt: number;
|
|
2999
|
+
errors: {
|
|
3000
|
+
attempt: number;
|
|
3001
|
+
at: string;
|
|
3002
|
+
message: string;
|
|
3003
|
+
status?: number | undefined;
|
|
3004
|
+
body?: unknown;
|
|
3005
|
+
started_at?: string | undefined;
|
|
3006
|
+
duration_ms?: number | undefined;
|
|
3007
|
+
}[];
|
|
3008
|
+
response?: unknown;
|
|
3009
|
+
started_at?: string | undefined;
|
|
3010
|
+
finished_at?: string | undefined;
|
|
3011
|
+
duration_ms?: number | undefined;
|
|
3012
|
+
} | undefined;
|
|
3013
|
+
webhook_runs?: {
|
|
3014
|
+
id: string;
|
|
3015
|
+
webhook_id: string;
|
|
3016
|
+
alias?: string | null | undefined;
|
|
3017
|
+
url: string;
|
|
3018
|
+
type: string;
|
|
3019
|
+
status: string;
|
|
3020
|
+
started_at: string;
|
|
3021
|
+
finished_at: string;
|
|
3022
|
+
duration_ms: number;
|
|
3023
|
+
ok: boolean;
|
|
3024
|
+
http_status?: number | undefined;
|
|
3025
|
+
error?: string | undefined;
|
|
3026
|
+
payload?: {
|
|
3027
|
+
id: string;
|
|
3028
|
+
type: string;
|
|
3029
|
+
created_at: string;
|
|
3030
|
+
data: Record<string, unknown>;
|
|
3031
|
+
} | undefined;
|
|
3032
|
+
idempotency_key?: string | undefined;
|
|
3033
|
+
resent_by?: string | undefined;
|
|
3034
|
+
}[] | undefined;
|
|
3035
|
+
manual_advance?: {
|
|
3036
|
+
reason: string;
|
|
3037
|
+
to_status: string;
|
|
3038
|
+
at: string;
|
|
3039
|
+
actor_name?: string | undefined;
|
|
3040
|
+
actor_avatar_url?: string | undefined;
|
|
3041
|
+
} | undefined;
|
|
3042
|
+
};
|
|
3043
|
+
} | null;
|
|
3044
|
+
declare const appendNodeLog: (node: OrderFulfillmentWorkflowNode, type: "info" | "success" | "warning" | "error", message: string, extra?: {
|
|
3045
|
+
actor_name?: string;
|
|
3046
|
+
actor_avatar_url?: string;
|
|
3047
|
+
}) => void;
|
|
3048
|
+
declare const applyManualAdvanceNote: (input: {
|
|
3049
|
+
workflow: OrderFulfillmentWorkflow;
|
|
3050
|
+
targetIds: string[];
|
|
3051
|
+
reason: string;
|
|
3052
|
+
to_status: string;
|
|
3053
|
+
actor_name?: string;
|
|
3054
|
+
actor_avatar_url?: string;
|
|
3055
|
+
}) => void;
|
|
3056
|
+
declare const markNodeEntered: (node: OrderFulfillmentWorkflowNode, at?: string) => void;
|
|
3057
|
+
/**
|
|
3058
|
+
* In-memory only: the caller persists `workflow` in a write it already
|
|
3059
|
+
* makes. The node did its own work and now waits for the next advance.
|
|
3060
|
+
*/
|
|
3061
|
+
declare const markNodesReady: (input: {
|
|
3062
|
+
workflow: OrderFulfillmentWorkflow;
|
|
3063
|
+
nodeIds: string[];
|
|
3064
|
+
at?: string;
|
|
3065
|
+
}) => void;
|
|
3066
|
+
/**
|
|
3067
|
+
* In-memory only. `requestedAt` is when the advance reached the API (it
|
|
3068
|
+
* travels in the hook payload); `resumedAt` is when the walker woke up.
|
|
3069
|
+
*/
|
|
3070
|
+
declare const markNodesAdvance: (input: {
|
|
3071
|
+
workflow: OrderFulfillmentWorkflow;
|
|
3072
|
+
nodeIds: string[];
|
|
3073
|
+
resumedAt: string;
|
|
3074
|
+
requestedAt?: string;
|
|
3075
|
+
}) => void;
|
|
3076
|
+
declare const markNodeExited: (node: OrderFulfillmentWorkflowNode, at?: string) => void;
|
|
3077
|
+
/** In-memory only. The caller already writes `workflow`. */
|
|
3078
|
+
declare const markNodeSkipped: (node: OrderFulfillmentWorkflowNode, at?: string) => void;
|
|
3079
|
+
declare const markEdgeTaken: (edge: OrderFulfillmentWorkflowEdge, at?: string) => void;
|
|
3080
|
+
declare const enterWorkflowNode: (input: {
|
|
3081
|
+
workflow: OrderFulfillmentWorkflow;
|
|
3082
|
+
nodeId: string;
|
|
3083
|
+
fromEdgeId?: string;
|
|
3084
|
+
fromEdgeIds?: string[];
|
|
3085
|
+
order?: OrderRecord;
|
|
3086
|
+
}) => {
|
|
3087
|
+
id: string;
|
|
3088
|
+
type: "fulfillmentStep";
|
|
3089
|
+
position: {
|
|
3090
|
+
x: number;
|
|
3091
|
+
y: number;
|
|
3092
|
+
};
|
|
3093
|
+
data: {
|
|
3094
|
+
kind: "join" | "start" | "state" | "terminal";
|
|
3095
|
+
label: Record<string, string>;
|
|
3096
|
+
description?: Record<string, string> | undefined;
|
|
3097
|
+
mappedStatus: string;
|
|
3098
|
+
milestone?: string | undefined;
|
|
3099
|
+
checkout_release?: boolean | undefined;
|
|
3100
|
+
payment_scope?: "digital" | "in_person" | undefined;
|
|
3101
|
+
joinPolicy?: "all" | "any" | undefined;
|
|
3102
|
+
actions?: {
|
|
3103
|
+
id: string;
|
|
3104
|
+
type: "invoke_callback" | "notify_webhook";
|
|
3105
|
+
webhook_ids?: string[] | undefined;
|
|
3106
|
+
callback_ids?: string[] | undefined;
|
|
3107
|
+
}[] | undefined;
|
|
3108
|
+
entered_at?: string | undefined;
|
|
3109
|
+
ready_at?: string | undefined;
|
|
3110
|
+
advance_requested_at?: string | undefined;
|
|
3111
|
+
resumed_at?: string | undefined;
|
|
3112
|
+
exited_at?: string | undefined;
|
|
3113
|
+
skipped_at?: string | undefined;
|
|
3114
|
+
logs?: {
|
|
3115
|
+
type: "error" | "info" | "success" | "warning";
|
|
3116
|
+
message: string;
|
|
3117
|
+
at: string;
|
|
3118
|
+
actor_name?: string | undefined;
|
|
3119
|
+
actor_avatar_url?: string | undefined;
|
|
3120
|
+
}[] | undefined;
|
|
3121
|
+
callback_run?: {
|
|
3122
|
+
attempt: number;
|
|
3123
|
+
errors: {
|
|
3124
|
+
attempt: number;
|
|
3125
|
+
at: string;
|
|
3126
|
+
message: string;
|
|
3127
|
+
status?: number | undefined;
|
|
3128
|
+
body?: unknown;
|
|
3129
|
+
started_at?: string | undefined;
|
|
3130
|
+
duration_ms?: number | undefined;
|
|
3131
|
+
}[];
|
|
3132
|
+
response?: unknown;
|
|
3133
|
+
started_at?: string | undefined;
|
|
3134
|
+
finished_at?: string | undefined;
|
|
3135
|
+
duration_ms?: number | undefined;
|
|
3136
|
+
} | undefined;
|
|
3137
|
+
webhook_runs?: {
|
|
3138
|
+
id: string;
|
|
3139
|
+
webhook_id: string;
|
|
3140
|
+
alias?: string | null | undefined;
|
|
3141
|
+
url: string;
|
|
3142
|
+
type: string;
|
|
3143
|
+
status: string;
|
|
3144
|
+
started_at: string;
|
|
3145
|
+
finished_at: string;
|
|
3146
|
+
duration_ms: number;
|
|
3147
|
+
ok: boolean;
|
|
3148
|
+
http_status?: number | undefined;
|
|
3149
|
+
error?: string | undefined;
|
|
3150
|
+
payload?: {
|
|
3151
|
+
id: string;
|
|
3152
|
+
type: string;
|
|
3153
|
+
created_at: string;
|
|
3154
|
+
data: Record<string, unknown>;
|
|
3155
|
+
} | undefined;
|
|
3156
|
+
idempotency_key?: string | undefined;
|
|
3157
|
+
resent_by?: string | undefined;
|
|
3158
|
+
}[] | undefined;
|
|
3159
|
+
manual_advance?: {
|
|
3160
|
+
reason: string;
|
|
3161
|
+
to_status: string;
|
|
3162
|
+
at: string;
|
|
3163
|
+
actor_name?: string | undefined;
|
|
3164
|
+
actor_avatar_url?: string | undefined;
|
|
3165
|
+
} | undefined;
|
|
3166
|
+
};
|
|
3167
|
+
} | null;
|
|
3168
|
+
declare const clearNodeVisit: (node: OrderFulfillmentWorkflowNode) => void;
|
|
3169
|
+
declare const clearEdgeTaken: (edge: OrderFulfillmentWorkflowEdge) => void;
|
|
3170
|
+
type OrderStatusFromNode = "COMPLETED" | "VOIDED" | "REVERSED" | "REFUNDED";
|
|
3171
|
+
/**
|
|
3172
|
+
* An order with a charge never ends `VOIDED` (0.11.0): a `VOIDED` terminal,
|
|
3173
|
+
* node or payload becomes `REVERSED` when a tender was captured.
|
|
3174
|
+
*/
|
|
3175
|
+
declare const reversedWhenCaptured: <T extends OrderStatusFromNode>(status: T, paymentCaptured: boolean) => "REVERSED" | T;
|
|
3176
|
+
/**
|
|
3177
|
+
* Order status for a fulfillment status that ends the order. Lane statuses
|
|
3178
|
+
* (`PREPARING`, `DELIVERED`, `PAID`) return nothing: `DELIVERED` closes
|
|
3179
|
+
* only when the node itself is a terminal.
|
|
3180
|
+
*/
|
|
3181
|
+
declare const orderStatusForFulfillmentStatus: (fulfillmentStatus: string | undefined, paymentCaptured?: boolean) => OrderStatusFromNode | undefined;
|
|
3182
|
+
/**
|
|
3183
|
+
* Order status implied by the node we just entered. Entering a node never
|
|
3184
|
+
* writes `payment_status`: it is derived from the tenders (D32). Every
|
|
3185
|
+
* terminal closes the order. A captured payment turns any `VOIDED` result
|
|
3186
|
+
* (payload, milestone, mapped or unknown terminal) into `REVERSED`.
|
|
3187
|
+
*/
|
|
3188
|
+
declare const orderFieldsFromNode: (node: Pick<OrderFulfillmentWorkflowNode, "data">, terminalStatus?: OrderStatusFromNode, paymentCaptured?: boolean) => {
|
|
3189
|
+
status?: OrderStatusFromNode;
|
|
3190
|
+
};
|
|
3191
|
+
//#endregion
|
|
3192
|
+
//#region src/fulfillment/status.d.ts
|
|
3193
|
+
type NodeKind = OrderFulfillmentWorkflowNode["data"]["kind"];
|
|
3194
|
+
type PathKind = "default" | "success" | "cancel" | "refund";
|
|
3195
|
+
/** `injecting` / ` Injecting ` → `INJECTING`. Casing never matters. */
|
|
3196
|
+
declare const normalizeFulfillmentStatus: (status: string) => string;
|
|
3197
|
+
declare const fulfillmentStatusesEqual: (left: string, right: string) => boolean;
|
|
3198
|
+
/** Edge path kind is derived from the target: default, or terminal outcome. */
|
|
3199
|
+
declare const pathKindForTargetNode: (target?: {
|
|
3200
|
+
kind: NodeKind;
|
|
3201
|
+
mappedStatus?: string;
|
|
3202
|
+
} | null) => PathKind;
|
|
3203
|
+
//#endregion
|
|
3204
|
+
//#region src/order/fees.d.ts
|
|
3205
|
+
type FeeRounding = Fee["effects"][number]["rounding"];
|
|
3206
|
+
declare const roundFeeAmount: (value: number, rounding: FeeRounding, digits: number) => number;
|
|
3207
|
+
type FeeEffect = Fee["effects"][number];
|
|
3208
|
+
declare const stripFeeLines: (lines: OrderLine[]) => OrderLine[];
|
|
3209
|
+
declare const stubUnsupportedFeeAmount: (effect: FeeEffect) => number;
|
|
3210
|
+
declare const selectMatchingFees: (fees: Fee[], order: ApplyFeesOrderScope, roots: OrderLine[]) => Fee[];
|
|
3211
|
+
declare const applyFees: (input: ApplyFeesInput) => OrderLine[];
|
|
3212
|
+
declare const rebuildOrderLinesWithFees: (input: ApplyFeesInput) => OrderLine[];
|
|
3213
|
+
//#endregion
|
|
3214
|
+
//#region src/order/checkout.d.ts
|
|
3215
|
+
/** `now` (ISO) evaluates time conditions at another moment, e.g. a sale. */
|
|
3216
|
+
declare const collectCheckoutIssues: (checkout: CheckoutPreferences, order: OrderRecord, fulfillmentType?: string | null, now?: string) => OrderIssue[];
|
|
3217
|
+
//#endregion
|
|
3218
|
+
//#region src/rules/orderFacts.d.ts
|
|
3219
|
+
declare const orderFactsFromOrder: (order: OrderRecord) => RulesEngineParams;
|
|
3220
|
+
declare const buildRulesEngineFromOrder: (order: OrderRecord) => RulesEngine;
|
|
3221
|
+
//#endregion
|
|
3222
|
+
//#region src/shared/locale.d.ts
|
|
3223
|
+
declare const DEFAULT_LOCALE = "en";
|
|
3224
|
+
declare const normalizeLocaleKey: (raw: string) => string;
|
|
3225
|
+
declare const findLocaleKey: (value: Record<string, string>, locale: string) => string | undefined;
|
|
3226
|
+
declare const pickMultiLanguageText: (value: Record<string, string> | string | null | undefined, locale?: string, fallback?: string) => string;
|
|
3227
|
+
//#endregion
|
|
3228
|
+
//#region src/hpke/hpke.d.ts
|
|
3229
|
+
/**
|
|
3230
|
+
* HPKE base mode (RFC 9180): DHKEM(P-256, HKDF-SHA256), HKDF-SHA256 and
|
|
3231
|
+
* AES-GCM, single-shot (sequence 0). WebCrypto only, so the cloud and a
|
|
3232
|
+
* Local Node share it. Credentials sent to a node are sealed with it.
|
|
3233
|
+
*/
|
|
3234
|
+
type HpkeAead = "AES-128-GCM" | "AES-256-GCM";
|
|
3235
|
+
interface HpkePublicJwk {
|
|
3236
|
+
kty: "EC";
|
|
3237
|
+
crv: "P-256";
|
|
3238
|
+
x: string;
|
|
3239
|
+
y: string;
|
|
3240
|
+
}
|
|
3241
|
+
interface HpkePrivateJwk extends HpkePublicJwk {
|
|
3242
|
+
d: string;
|
|
3243
|
+
}
|
|
3244
|
+
interface HpkeSealInput {
|
|
3245
|
+
recipient: HpkePublicJwk;
|
|
3246
|
+
plaintext: Uint8Array;
|
|
3247
|
+
info: Uint8Array;
|
|
3248
|
+
aad: Uint8Array;
|
|
3249
|
+
aead?: HpkeAead;
|
|
3250
|
+
/** Tests only: a fixed ephemeral key (RFC 9180 vectors). */
|
|
3251
|
+
ephemeral?: HpkePrivateJwk;
|
|
3252
|
+
}
|
|
3253
|
+
interface HpkeOpenInput {
|
|
3254
|
+
recipient: HpkePrivateJwk;
|
|
3255
|
+
enc: Uint8Array;
|
|
3256
|
+
ciphertext: Uint8Array;
|
|
3257
|
+
info: Uint8Array;
|
|
3258
|
+
aad: Uint8Array;
|
|
3259
|
+
aead?: HpkeAead;
|
|
3260
|
+
}
|
|
3261
|
+
/** Envelope on the wire: `enc` and `ct` are base64url. */
|
|
3262
|
+
interface HpkeEnvelope {
|
|
3263
|
+
alg: typeof HPKE_ALG;
|
|
3264
|
+
kid?: string;
|
|
3265
|
+
enc: string;
|
|
3266
|
+
ct: string;
|
|
3267
|
+
}
|
|
3268
|
+
declare const HPKE_ALG: "HPKE-Base-P256-SHA256-AES256GCM";
|
|
3269
|
+
declare const base64UrlEncode: (bytes: Uint8Array) => string;
|
|
3270
|
+
declare const base64UrlDecode: (value: string) => Uint8Array<ArrayBuffer>;
|
|
3271
|
+
/** Seals `plaintext` to the recipient's P-256 key. */
|
|
3272
|
+
declare const hpkeSeal: (input: HpkeSealInput) => Promise<{
|
|
3273
|
+
enc: Uint8Array<ArrayBuffer>;
|
|
3274
|
+
ciphertext: Uint8Array<ArrayBuffer>;
|
|
3275
|
+
}>;
|
|
3276
|
+
/** Opens a sealed message; throws when anything was altered. */
|
|
3277
|
+
declare const hpkeOpen: (input: HpkeOpenInput) => Promise<Uint8Array<ArrayBuffer>>;
|
|
3278
|
+
//#endregion
|
|
3279
|
+
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 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, LosslessNumber, type LosslessNumberLike, type Menu, type MenuCategoryNode, type MenuLookup, type MilestoneSteps, type MilestoneTrackItem, type ModifierControlType, type ModifierCtx, type ModifierGroupCtx, type NestedMenuCategory, 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 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, 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, getScheduleWindow, hpkeOpen, hpkeSeal, incomingEdges, indexMenu, indexOutgoingBySource, isCanonicalizationError, isCardNumberComplete, isCardNumberDefinitelyInvalid, isCheckoutFieldFilled, isCustomerInfoFieldFilled, isCustomerInfoPlaceholder, isCustomerInfoValueValid, isCvcComplete, isDelegatedSessionExpiredError, isDeviceCharged, isDeviceNotLinked, isExpiryComplete, isGenId, isKioskUnauthorized, 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, 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 };
|