@fire-spark/core 0.42.3 → 0.44.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 +48 -2
- package/dist/index.js +166 -22
- 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, isDeliveryFee, isRealPaymentMethod, orderRedeems } from "@fire-spark/payments";
|
|
2
|
-
import { AndConditions, ApplyFeesInput, ApplyFeesOrderScope, CheckoutMode, CheckoutResolved, CmsBlock, Condition, Customer, CustomerIdentifyInput, CustomerRegisterInput, CustomerUpdateInput, DeviceSecretStorage, DeviceSecretsConfigureOptions, DeviceSecretsConfigureOptions as DeviceSecretsConfigureOptions$1, DeviceSecretsPayload, DeviceSecretsPayload as DeviceSecretsPayload$1, 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, OrderAdvanceFulfillmentInput, 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, SwitchCustomerOptions, SwitchCustomerOptions as SwitchCustomerOptions$1, 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, DeviceSecretStorage, DeviceSecretsConfigureOptions, DeviceSecretsConfigureOptions as DeviceSecretsConfigureOptions$1, DeviceSecretsPayload, DeviceSecretsPayload as DeviceSecretsPayload$1, 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, OrderAdvanceFulfillmentInput, 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, ProductRewardSavings, 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, SwitchCustomerOptions, SwitchCustomerOptions as SwitchCustomerOptions$1, 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. */
|
|
@@ -671,6 +671,12 @@ type ApplyRedeemInput = {
|
|
|
671
671
|
provider?: PaymentProvider;
|
|
672
672
|
/** ISO datetime with offset; validation fails once it has passed. */
|
|
673
673
|
expires_at?: string;
|
|
674
|
+
/**
|
|
675
|
+
* Optional informational unit full price of a Masivo `PRODUCT` reward.
|
|
676
|
+
* Stored in `line.metadata.reward_savings` to display savings; never
|
|
677
|
+
* alters line prices, charged discounts, taxes, or order totals.
|
|
678
|
+
*/
|
|
679
|
+
full_price?: number;
|
|
674
680
|
};
|
|
675
681
|
type RemoveRedeemInput = {
|
|
676
682
|
reward_id: string;
|
|
@@ -1353,6 +1359,34 @@ declare const redemptionSteps: (order: StepOrder) => OrderRedemptionStep[];
|
|
|
1353
1359
|
/** Sum root line group totals into order totals (Big.js). */
|
|
1354
1360
|
declare const recomputeTotals: (lines: OrderLine[], currency?: string) => OrderTotals;
|
|
1355
1361
|
//#endregion
|
|
1362
|
+
//#region src/order/rewardSavings.d.ts
|
|
1363
|
+
declare const REWARD_SAVINGS_METADATA_KEY: "reward_savings";
|
|
1364
|
+
interface ComputeProductRewardSavingsInput {
|
|
1365
|
+
fullPrice: number;
|
|
1366
|
+
quantity: number;
|
|
1367
|
+
lineValue: number;
|
|
1368
|
+
}
|
|
1369
|
+
/**
|
|
1370
|
+
* Cart value of a root line for Masivo product-reward savings comparison.
|
|
1371
|
+
* Matches `masivoContacts.payload` (`group_subtotal`, else `group_total`).
|
|
1372
|
+
*/
|
|
1373
|
+
declare const lineCartValue: (line: Pick<OrderLine, "group_subtotal" | "group_total">) => number;
|
|
1374
|
+
/**
|
|
1375
|
+
* Informational Masivo product-reward savings:
|
|
1376
|
+
* `full_price_total = full_price * quantity`
|
|
1377
|
+
* `savings = max(0, full_price * quantity - lineValue)`
|
|
1378
|
+
* Exact Big.js arithmetic, never rounded.
|
|
1379
|
+
*/
|
|
1380
|
+
declare const computeProductRewardSavings: (input: ComputeProductRewardSavingsInput) => ProductRewardSavings;
|
|
1381
|
+
/** Reads informational `reward_savings` from `line.metadata`, or null. */
|
|
1382
|
+
declare const getLineRewardSavings: (line: Pick<OrderLine, "metadata"> | null | undefined) => ProductRewardSavings | null;
|
|
1383
|
+
/** Attaches or removes `metadata.reward_savings` without mutating totals. */
|
|
1384
|
+
declare const withLineRewardSavings: (line: OrderLine, savings: ProductRewardSavings | null) => OrderLine;
|
|
1385
|
+
/** Recomputes `full_price_total` and `savings` after a line quantity change. */
|
|
1386
|
+
declare const rescaleLineRewardSavings: (line: OrderLine) => OrderLine;
|
|
1387
|
+
/** Applies a `line.uid -> ProductRewardSavings` map to matching lines. */
|
|
1388
|
+
declare const applyRewardSavingsToLines: (lines: OrderLine[], byLineUid: Readonly<Record<string, ProductRewardSavings>> | undefined) => OrderLine[];
|
|
1389
|
+
//#endregion
|
|
1356
1390
|
//#region src/order/lines.d.ts
|
|
1357
1391
|
declare const addLines: (lines: OrderLine[], incoming: OrderLine | OrderLine[]) => OrderLine[];
|
|
1358
1392
|
declare const removeLine: (lines: OrderLine[], lineUid: string) => OrderLine[];
|
|
@@ -2660,6 +2694,7 @@ declare const findNodeById: (workflow: OrderFulfillmentWorkflow, nodeId: string)
|
|
|
2660
2694
|
status: "failed" | "no_connection" | "offline_skipped" | "opted_out" | "sent";
|
|
2661
2695
|
template_id?: string | undefined;
|
|
2662
2696
|
locale?: string | undefined;
|
|
2697
|
+
message_id?: string | null | undefined;
|
|
2663
2698
|
resend_id?: string | null | undefined;
|
|
2664
2699
|
attempts?: number | undefined;
|
|
2665
2700
|
short_code?: string | null | undefined;
|
|
@@ -2758,6 +2793,7 @@ declare const findStartNode: (workflow: OrderFulfillmentWorkflow) => {
|
|
|
2758
2793
|
status: "failed" | "no_connection" | "offline_skipped" | "opted_out" | "sent";
|
|
2759
2794
|
template_id?: string | undefined;
|
|
2760
2795
|
locale?: string | undefined;
|
|
2796
|
+
message_id?: string | null | undefined;
|
|
2761
2797
|
resend_id?: string | null | undefined;
|
|
2762
2798
|
attempts?: number | undefined;
|
|
2763
2799
|
short_code?: string | null | undefined;
|
|
@@ -3211,6 +3247,7 @@ declare const findMappedStatusNode: (workflow: OrderFulfillmentWorkflow, status:
|
|
|
3211
3247
|
status: "failed" | "no_connection" | "offline_skipped" | "opted_out" | "sent";
|
|
3212
3248
|
template_id?: string | undefined;
|
|
3213
3249
|
locale?: string | undefined;
|
|
3250
|
+
message_id?: string | null | undefined;
|
|
3214
3251
|
resend_id?: string | null | undefined;
|
|
3215
3252
|
attempts?: number | undefined;
|
|
3216
3253
|
short_code?: string | null | undefined;
|
|
@@ -3437,6 +3474,7 @@ declare const resolveFailureTerminalEdge: (input: {
|
|
|
3437
3474
|
status: "failed" | "no_connection" | "offline_skipped" | "opted_out" | "sent";
|
|
3438
3475
|
template_id?: string | undefined;
|
|
3439
3476
|
locale?: string | undefined;
|
|
3477
|
+
message_id?: string | null | undefined;
|
|
3440
3478
|
resend_id?: string | null | undefined;
|
|
3441
3479
|
attempts?: number | undefined;
|
|
3442
3480
|
short_code?: string | null | undefined;
|
|
@@ -3553,6 +3591,7 @@ declare const sittingWorkflowNode: (workflow: OrderFulfillmentWorkflow, currentN
|
|
|
3553
3591
|
status: "failed" | "no_connection" | "offline_skipped" | "opted_out" | "sent";
|
|
3554
3592
|
template_id?: string | undefined;
|
|
3555
3593
|
locale?: string | undefined;
|
|
3594
|
+
message_id?: string | null | undefined;
|
|
3556
3595
|
resend_id?: string | null | undefined;
|
|
3557
3596
|
attempts?: number | undefined;
|
|
3558
3597
|
short_code?: string | null | undefined;
|
|
@@ -3694,6 +3733,7 @@ declare const enterWorkflowNode: (input: {
|
|
|
3694
3733
|
status: "failed" | "no_connection" | "offline_skipped" | "opted_out" | "sent";
|
|
3695
3734
|
template_id?: string | undefined;
|
|
3696
3735
|
locale?: string | undefined;
|
|
3736
|
+
message_id?: string | null | undefined;
|
|
3697
3737
|
resend_id?: string | null | undefined;
|
|
3698
3738
|
attempts?: number | undefined;
|
|
3699
3739
|
short_code?: string | null | undefined;
|
|
@@ -4247,6 +4287,12 @@ declare const DEFAULT_LOCALE = "en";
|
|
|
4247
4287
|
declare const normalizeLocaleKey: (raw: string) => string;
|
|
4248
4288
|
declare const findLocaleKey: (value: Record<string, string>, locale: string) => string | undefined;
|
|
4249
4289
|
declare const pickMultiLanguageText: (value: Record<string, string> | string | null | undefined, locale?: string, fallback?: string) => string;
|
|
4290
|
+
/**
|
|
4291
|
+
* Resolves a localized text map (or legacy plain string) with fallback chain:
|
|
4292
|
+
* exact `locale` -> base language -> `merchantLocale` (exact -> base) ->
|
|
4293
|
+
* first non-empty entry -> `fallback`.
|
|
4294
|
+
*/
|
|
4295
|
+
declare const pickLocalizedText: (value: Record<string, string> | string | null | undefined, locale?: string, merchantLocale?: string, fallback?: string) => string;
|
|
4250
4296
|
//#endregion
|
|
4251
4297
|
//#region src/hpke/hpke.d.ts
|
|
4252
4298
|
/**
|
|
@@ -4299,4 +4345,4 @@ declare const hpkeSeal: (input: HpkeSealInput) => Promise<{
|
|
|
4299
4345
|
/** Opens a sealed message; throws when anything was altered. */
|
|
4300
4346
|
declare const hpkeOpen: (input: HpkeOpenInput) => Promise<Uint8Array<ArrayBuffer>>;
|
|
4301
4347
|
//#endregion
|
|
4302
|
-
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 DeviceSecretStorage, type DeviceSecretsConfigureOptions, type DeviceSecretsPayload, type DeviceSecretsStore, 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 PosOrderHttpOptions, 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 SwitchCustomerOptions, 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, clearDeviceSecrets, clearEdgeTaken, clearNodeVisit, cmsVisibilityNeedsTimezone, collectCheckoutIssues, collectOrderLineDiffs, completeEngineStepLog, computeOrderExpiresAt, computeStartingPrice, configureDeviceSecrets, configureLocalTlsPinning, countCartProducts, coveredAmount, createCanonicalizationError, createDeunaWidgetApi, createDeviceSecretsStore, 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, findShippingFeeLine, findStartNode, fitRedeems, flattenMenuCategories, flushLogs, formatCardNumber, formatCvc, formatExpiry, formatLocalServerUrl, formatRecurringDateCronSummary, fromOrderLines, fulfillmentStatusesEqual, genId, genOrderId, getLocalTlsPinning, getLogContext, getOrigin, getRouteHealth, getScheduleWindow, getSecret, hasInFlightPayment, hasLocalTlsPinning, hasSmartRouting, hpkeOpen, hpkeSeal, incomingEdges, indexMenu, indexOutgoingBySource, injectingMetadataFromCallback, invokeCallbackAttempt, isCanonicalizationError, isCardNumberComplete, isCardNumberDefinitelyInvalid, isCheckoutFieldFilled, isCustomerInfoFieldFilled, isCustomerInfoPlaceholder, isCustomerInfoValueValid, isCvcComplete, isDelegatedSessionExpiredError, isDeliveryFee, isDeviceCharged, isDeviceNotLinked, isExpiredFulfillment, isExpiryComplete, isGenId, isInterruptTerminalStatus, isKioskUnauthorized, isLocalOrderUnknown, isMilestoneStepDone, isNodeRuntime, isOnSchedule, isOrderNotOpenError, isOrderPaymentRequiredError, isOrderRouteUnavailableError, isOrderValidationError, isPosDeviceNotLinked, isPosUnauthorized, isRealPaymentMethod, isReservedFulfillmentStatus, isRouteCircuitOpen, isScheduleSlot, isScheduledAtError, isShippingFeeLine, isStateHash, isStorefrontNotFound, isSupportedWorkflowSchemaVersion, isTerminalFulfillmentStatus, isTerminalMappedStatus, isTlsFingerprintMismatchError, isVariantBase, linePayableTotal, listMenusStream, listSecretKeys, 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, syncDeviceSecrets, testLocalServerHealth, toOrderLines, toPaymentCardBrand, unusedOutgoing, utf8Encode, validateCardNumber, validateCardholderName, validateCvc, validateExpiry, validateOrderAgainstMenu, validatePickupName, verifyLocalRoutePin, verifyWebhookSignature, visitedStates, warnNoEdge, workflowSchemaVersionOf };
|
|
4348
|
+
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 ComputeProductRewardSavingsInput, 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 DeviceSecretStorage, type DeviceSecretsConfigureOptions, type DeviceSecretsPayload, type DeviceSecretsStore, 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 PosOrderHttpOptions, type PricingModifier, type ProbeLocalRouteHealthOptions, type ProcessStateNodeCallbackJob, type ProcessStateNodeConfig, type ProcessStateNodeResult, type Product, type ProductCtx, type QuantitiesByPath, RESERVED_FULFILLMENT_STATUSES, REWARD_SAVINGS_METADATA_KEY, 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 SwitchCustomerOptions, 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, applyRewardSavingsToLines, 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, clearDeviceSecrets, clearEdgeTaken, clearNodeVisit, cmsVisibilityNeedsTimezone, collectCheckoutIssues, collectOrderLineDiffs, completeEngineStepLog, computeOrderExpiresAt, computeProductRewardSavings, computeStartingPrice, configureDeviceSecrets, configureLocalTlsPinning, countCartProducts, coveredAmount, createCanonicalizationError, createDeunaWidgetApi, createDeviceSecretsStore, 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, findShippingFeeLine, findStartNode, fitRedeems, flattenMenuCategories, flushLogs, formatCardNumber, formatCvc, formatExpiry, formatLocalServerUrl, formatRecurringDateCronSummary, fromOrderLines, fulfillmentStatusesEqual, genId, genOrderId, getLineRewardSavings, getLocalTlsPinning, getLogContext, getOrigin, getRouteHealth, getScheduleWindow, getSecret, hasInFlightPayment, hasLocalTlsPinning, hasSmartRouting, hpkeOpen, hpkeSeal, incomingEdges, indexMenu, indexOutgoingBySource, injectingMetadataFromCallback, invokeCallbackAttempt, isCanonicalizationError, isCardNumberComplete, isCardNumberDefinitelyInvalid, isCheckoutFieldFilled, isCustomerInfoFieldFilled, isCustomerInfoPlaceholder, isCustomerInfoValueValid, isCvcComplete, isDelegatedSessionExpiredError, isDeliveryFee, isDeviceCharged, isDeviceNotLinked, isExpiredFulfillment, isExpiryComplete, isGenId, isInterruptTerminalStatus, isKioskUnauthorized, isLocalOrderUnknown, isMilestoneStepDone, isNodeRuntime, isOnSchedule, isOrderNotOpenError, isOrderPaymentRequiredError, isOrderRouteUnavailableError, isOrderValidationError, isPosDeviceNotLinked, isPosUnauthorized, isRealPaymentMethod, isReservedFulfillmentStatus, isRouteCircuitOpen, isScheduleSlot, isScheduledAtError, isShippingFeeLine, isStateHash, isStorefrontNotFound, isSupportedWorkflowSchemaVersion, isTerminalFulfillmentStatus, isTerminalMappedStatus, isTlsFingerprintMismatchError, isVariantBase, lineCartValue, linePayableTotal, listMenusStream, listSecretKeys, 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, pickLocalizedText, pickMultiLanguageText, placeCartLines, probeLocalRouteHealth, processStateNode, rebuildOrderLinesWithFees, rebuildRootGroups, recomputeTotals, redeemedTotal, redeemsForPayment, redemptionCap, redemptionSteps, remainingAmount, removeLine, replaceLine, rescaleLineRewardSavings, 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, syncDeviceSecrets, testLocalServerHealth, toOrderLines, toPaymentCardBrand, unusedOutgoing, utf8Encode, validateCardNumber, validateCardholderName, validateCvc, validateExpiry, validateOrderAgainstMenu, validatePickupName, verifyLocalRoutePin, verifyWebhookSignature, visitedStates, warnNoEdge, withLineRewardSavings, workflowSchemaVersionOf };
|
package/dist/index.js
CHANGED
|
@@ -2626,6 +2626,8 @@ const getPosLogDevice = () => {
|
|
|
2626
2626
|
};
|
|
2627
2627
|
//#endregion
|
|
2628
2628
|
//#region src/services/http.ts
|
|
2629
|
+
const SDK_VERSION_HEADER = "X-Firespark-Sdk-Version";
|
|
2630
|
+
const SDK_PROTOCOL_VERSION = "0.43.0";
|
|
2629
2631
|
var StorefrontHttpError = class extends Error {
|
|
2630
2632
|
status;
|
|
2631
2633
|
/** `details.code` when present, else the top-level `code`. */
|
|
@@ -2702,6 +2704,7 @@ const storefrontRequest = async (path, init = {}, options = {}) => {
|
|
|
2702
2704
|
return withAuthRetry(options, (accessToken) => {
|
|
2703
2705
|
const headers = new Headers(init.headers);
|
|
2704
2706
|
headers.set("Authorization", `Bearer ${accessToken}`);
|
|
2707
|
+
if (!headers.has("X-Firespark-Sdk-Version")) headers.set(SDK_VERSION_HEADER, SDK_PROTOCOL_VERSION);
|
|
2705
2708
|
if (init.body && !headers.has("Content-Type")) headers.set("Content-Type", "application/json");
|
|
2706
2709
|
const signal = options.signal ?? init.signal;
|
|
2707
2710
|
const req = {
|
|
@@ -5400,6 +5403,7 @@ const posBases = (options) => {
|
|
|
5400
5403
|
const posFetch = async (path, init, options) => {
|
|
5401
5404
|
const fetchImpl = options?.fetchImpl ?? fetch;
|
|
5402
5405
|
const headers = new Headers(init.headers);
|
|
5406
|
+
if (!headers.has("X-Firespark-Sdk-Version")) headers.set(SDK_VERSION_HEADER, SDK_PROTOCOL_VERSION);
|
|
5403
5407
|
if (init.body && !headers.has("Content-Type")) headers.set("Content-Type", "application/json");
|
|
5404
5408
|
const signal = options?.signal ?? init.signal;
|
|
5405
5409
|
const req = {
|
|
@@ -7385,23 +7389,48 @@ const languageOf = (locale) => {
|
|
|
7385
7389
|
const firstNonEmpty = (value) => {
|
|
7386
7390
|
return Object.values(value).find((text) => text.trim());
|
|
7387
7391
|
};
|
|
7392
|
+
const matchLocale = (value, locale) => {
|
|
7393
|
+
const exactKey = findLocaleKey(value, locale);
|
|
7394
|
+
const exact = exactKey ? value[exactKey] : void 0;
|
|
7395
|
+
if (exact?.trim()) return exact.trim();
|
|
7396
|
+
const lang = languageOf(locale);
|
|
7397
|
+
if (lang) {
|
|
7398
|
+
const baseKey = findLocaleKey(value, lang);
|
|
7399
|
+
const baseText = baseKey ? value[baseKey] : void 0;
|
|
7400
|
+
if (baseText?.trim()) return baseText.trim();
|
|
7401
|
+
const siblingKey = Object.keys(value).find((key) => {
|
|
7402
|
+
return languageOf(key) === lang && Boolean(value[key]?.trim());
|
|
7403
|
+
});
|
|
7404
|
+
const siblingText = siblingKey ? value[siblingKey] : void 0;
|
|
7405
|
+
if (siblingText?.trim()) return siblingText.trim();
|
|
7406
|
+
}
|
|
7407
|
+
};
|
|
7388
7408
|
const pickMultiLanguageText = (value, locale, fallback = "") => {
|
|
7389
7409
|
if (value == null) return fallback;
|
|
7390
7410
|
if (typeof value === "string") return value || fallback;
|
|
7391
7411
|
if (locale) {
|
|
7392
|
-
const
|
|
7393
|
-
|
|
7394
|
-
if (exact?.trim()) return exact;
|
|
7395
|
-
const lang = languageOf(locale);
|
|
7396
|
-
if (lang) {
|
|
7397
|
-
const langKey = Object.keys(value).find((key) => {
|
|
7398
|
-
return languageOf(key) === lang;
|
|
7399
|
-
});
|
|
7400
|
-
const langText = langKey ? value[langKey] : void 0;
|
|
7401
|
-
if (langText?.trim()) return langText;
|
|
7402
|
-
}
|
|
7412
|
+
const hit = matchLocale(value, locale);
|
|
7413
|
+
if (hit) return hit;
|
|
7403
7414
|
}
|
|
7404
|
-
return firstNonEmpty(value) ?? fallback;
|
|
7415
|
+
return firstNonEmpty(value)?.trim() ?? fallback;
|
|
7416
|
+
};
|
|
7417
|
+
/**
|
|
7418
|
+
* Resolves a localized text map (or legacy plain string) with fallback chain:
|
|
7419
|
+
* exact `locale` -> base language -> `merchantLocale` (exact -> base) ->
|
|
7420
|
+
* first non-empty entry -> `fallback`.
|
|
7421
|
+
*/
|
|
7422
|
+
const pickLocalizedText = (value, locale, merchantLocale, fallback = "") => {
|
|
7423
|
+
if (value == null) return fallback;
|
|
7424
|
+
if (typeof value === "string") return value.trim() || fallback;
|
|
7425
|
+
if (locale) {
|
|
7426
|
+
const hit = matchLocale(value, locale);
|
|
7427
|
+
if (hit) return hit;
|
|
7428
|
+
}
|
|
7429
|
+
if (merchantLocale) {
|
|
7430
|
+
const hit = matchLocale(value, merchantLocale);
|
|
7431
|
+
if (hit) return hit;
|
|
7432
|
+
}
|
|
7433
|
+
return firstNonEmpty(value)?.trim() ?? fallback;
|
|
7405
7434
|
};
|
|
7406
7435
|
//#endregion
|
|
7407
7436
|
//#region src/order/fees.ts
|
|
@@ -8065,6 +8094,108 @@ const computeLineFingerprint = (root, lines) => {
|
|
|
8065
8094
|
return `${root.id}[${childKeys(root.uid)}]`;
|
|
8066
8095
|
};
|
|
8067
8096
|
//#endregion
|
|
8097
|
+
//#region src/order/rewardSavings.ts
|
|
8098
|
+
const REWARD_SAVINGS_METADATA_KEY = "reward_savings";
|
|
8099
|
+
const isNonNegativeFinite = (value) => {
|
|
8100
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
8101
|
+
};
|
|
8102
|
+
const isRecord = (value) => {
|
|
8103
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
8104
|
+
};
|
|
8105
|
+
/**
|
|
8106
|
+
* Cart value of a root line for Masivo product-reward savings comparison.
|
|
8107
|
+
* Matches `masivoContacts.payload` (`group_subtotal`, else `group_total`).
|
|
8108
|
+
*/
|
|
8109
|
+
const lineCartValue = (line) => {
|
|
8110
|
+
if (Number.isFinite(line.group_subtotal)) return line.group_subtotal;
|
|
8111
|
+
return line.group_total;
|
|
8112
|
+
};
|
|
8113
|
+
/**
|
|
8114
|
+
* Informational Masivo product-reward savings:
|
|
8115
|
+
* `full_price_total = full_price * quantity`
|
|
8116
|
+
* `savings = max(0, full_price * quantity - lineValue)`
|
|
8117
|
+
* Exact Big.js arithmetic, never rounded.
|
|
8118
|
+
*/
|
|
8119
|
+
const computeProductRewardSavings = (input) => {
|
|
8120
|
+
const { fullPrice, quantity, lineValue } = input;
|
|
8121
|
+
const fullBig = new Big(String(fullPrice));
|
|
8122
|
+
const fullTotalBig = fullBig.times(String(quantity));
|
|
8123
|
+
const diff = fullTotalBig.minus(String(lineValue));
|
|
8124
|
+
const savingsBig = diff.gt(0) ? diff : new Big(0);
|
|
8125
|
+
return {
|
|
8126
|
+
full_price: fullBig.toNumber(),
|
|
8127
|
+
full_price_total: fullTotalBig.toNumber(),
|
|
8128
|
+
savings: savingsBig.toNumber()
|
|
8129
|
+
};
|
|
8130
|
+
};
|
|
8131
|
+
/** Reads informational `reward_savings` from `line.metadata`, or null. */
|
|
8132
|
+
const getLineRewardSavings = (line) => {
|
|
8133
|
+
const meta = line?.metadata;
|
|
8134
|
+
if (!isRecord(meta)) return null;
|
|
8135
|
+
const raw = meta[REWARD_SAVINGS_METADATA_KEY];
|
|
8136
|
+
if (!isRecord(raw)) return null;
|
|
8137
|
+
const { full_price, full_price_total, savings } = raw;
|
|
8138
|
+
if (!isNonNegativeFinite(full_price)) return null;
|
|
8139
|
+
if (!isNonNegativeFinite(full_price_total)) return null;
|
|
8140
|
+
if (!isNonNegativeFinite(savings)) return null;
|
|
8141
|
+
return {
|
|
8142
|
+
full_price,
|
|
8143
|
+
full_price_total,
|
|
8144
|
+
savings
|
|
8145
|
+
};
|
|
8146
|
+
};
|
|
8147
|
+
/** Attaches or removes `metadata.reward_savings` without mutating totals. */
|
|
8148
|
+
const withLineRewardSavings = (line, savings) => {
|
|
8149
|
+
const prev = isRecord(line.metadata) ? line.metadata : {};
|
|
8150
|
+
if (!savings) {
|
|
8151
|
+
if (!("reward_savings" in prev)) return line;
|
|
8152
|
+
const { [REWARD_SAVINGS_METADATA_KEY]: _drop, ...rest } = prev;
|
|
8153
|
+
return {
|
|
8154
|
+
...line,
|
|
8155
|
+
metadata: rest
|
|
8156
|
+
};
|
|
8157
|
+
}
|
|
8158
|
+
const metadata = {
|
|
8159
|
+
...prev,
|
|
8160
|
+
[REWARD_SAVINGS_METADATA_KEY]: savings
|
|
8161
|
+
};
|
|
8162
|
+
return {
|
|
8163
|
+
...line,
|
|
8164
|
+
metadata
|
|
8165
|
+
};
|
|
8166
|
+
};
|
|
8167
|
+
/** Recomputes `full_price_total` and `savings` after a line quantity change. */
|
|
8168
|
+
const rescaleLineRewardSavings = (line) => {
|
|
8169
|
+
const current = getLineRewardSavings(line);
|
|
8170
|
+
if (!current) return line;
|
|
8171
|
+
const fullPrice = current.full_price;
|
|
8172
|
+
const quantity = line.quantity;
|
|
8173
|
+
const lineValue = lineCartValue(line);
|
|
8174
|
+
const next = computeProductRewardSavings({
|
|
8175
|
+
fullPrice,
|
|
8176
|
+
quantity,
|
|
8177
|
+
lineValue
|
|
8178
|
+
});
|
|
8179
|
+
return withLineRewardSavings(line, next);
|
|
8180
|
+
};
|
|
8181
|
+
/** Applies a `line.uid -> ProductRewardSavings` map to matching lines. */
|
|
8182
|
+
const applyRewardSavingsToLines = (lines, byLineUid) => {
|
|
8183
|
+
if (!byLineUid || Object.keys(byLineUid).length === 0) return lines;
|
|
8184
|
+
let changed = false;
|
|
8185
|
+
const next = lines.map((line) => {
|
|
8186
|
+
const savings = byLineUid[line.uid];
|
|
8187
|
+
if (!savings) return line;
|
|
8188
|
+
const existing = getLineRewardSavings(line);
|
|
8189
|
+
const sameFull = existing?.full_price === savings.full_price;
|
|
8190
|
+
const sameTotal = existing?.full_price_total === savings.full_price_total;
|
|
8191
|
+
const sameSavings = existing?.savings === savings.savings;
|
|
8192
|
+
if (sameFull && sameTotal && sameSavings) return line;
|
|
8193
|
+
changed = true;
|
|
8194
|
+
return withLineRewardSavings(line, savings);
|
|
8195
|
+
});
|
|
8196
|
+
return changed ? next : lines;
|
|
8197
|
+
};
|
|
8198
|
+
//#endregion
|
|
8068
8199
|
//#region src/order/lines.ts
|
|
8069
8200
|
const removeSubtree = (lines, rootUid) => {
|
|
8070
8201
|
const drop = /* @__PURE__ */ new Set([rootUid]);
|
|
@@ -8104,11 +8235,11 @@ const scaleLineQuantity = (line, nextQty) => {
|
|
|
8104
8235
|
group_tax_total: gTax,
|
|
8105
8236
|
group_total: gTot
|
|
8106
8237
|
};
|
|
8107
|
-
return {
|
|
8238
|
+
return rescaleLineRewardSavings({
|
|
8108
8239
|
...b1,
|
|
8109
8240
|
...b2,
|
|
8110
8241
|
...b3
|
|
8111
|
-
};
|
|
8242
|
+
});
|
|
8112
8243
|
};
|
|
8113
8244
|
const collectDescendantUids = (lines, rootUid) => {
|
|
8114
8245
|
const uids = /* @__PURE__ */ new Set([rootUid]);
|
|
@@ -10500,7 +10631,7 @@ var Order = class Order {
|
|
|
10500
10631
|
*/
|
|
10501
10632
|
applyRedeem(input) {
|
|
10502
10633
|
if (this.deleted) return;
|
|
10503
|
-
const { line_uid, provider, ...rest } = input;
|
|
10634
|
+
const { line_uid, provider, full_price, ...rest } = input;
|
|
10504
10635
|
const redeem = buildRedeem(rest);
|
|
10505
10636
|
if (redeem.type === "PRODUCT" && line_uid === void 0) throw new Error("Product reward requires a root product line");
|
|
10506
10637
|
if (provider) this.redemptionProviders.set(redeem.payment_id, provider);
|
|
@@ -10515,12 +10646,21 @@ var Order = class Order {
|
|
|
10515
10646
|
throw new Error(msg);
|
|
10516
10647
|
}
|
|
10517
10648
|
if (redeem.type === "PRODUCT" && line.type !== "PRODUCT") throw new Error("Product reward requires a root product line");
|
|
10649
|
+
const hasFullPrice = redeem.type === "PRODUCT" && typeof full_price === "number" && Number.isFinite(full_price) && full_price >= 0;
|
|
10518
10650
|
const lines = this.draft.lines.map((item) => {
|
|
10519
10651
|
if (item.uid !== line_uid) return item;
|
|
10520
|
-
|
|
10652
|
+
const updated = {
|
|
10521
10653
|
...item,
|
|
10522
10654
|
redeem: [...item.redeem ?? [], redeem]
|
|
10523
10655
|
};
|
|
10656
|
+
if (!hasFullPrice) return updated;
|
|
10657
|
+
const fullPrice = full_price;
|
|
10658
|
+
const quantity = updated.quantity;
|
|
10659
|
+
return withLineRewardSavings(updated, computeProductRewardSavings({
|
|
10660
|
+
fullPrice,
|
|
10661
|
+
quantity,
|
|
10662
|
+
lineValue: lineCartValue(updated)
|
|
10663
|
+
}));
|
|
10524
10664
|
});
|
|
10525
10665
|
this.commitLines({ lines });
|
|
10526
10666
|
}
|
|
@@ -10544,15 +10684,17 @@ var Order = class Order {
|
|
|
10544
10684
|
}
|
|
10545
10685
|
const lines = this.draft.lines.map((item) => {
|
|
10546
10686
|
if (item.uid !== line_uid) return item;
|
|
10547
|
-
const
|
|
10687
|
+
const nextRedeem = subtractRedeem(...[
|
|
10548
10688
|
item.redeem ?? [],
|
|
10549
10689
|
reward_id,
|
|
10550
10690
|
quantity
|
|
10551
|
-
];
|
|
10552
|
-
|
|
10691
|
+
]);
|
|
10692
|
+
const updated = {
|
|
10553
10693
|
...item,
|
|
10554
|
-
redeem:
|
|
10694
|
+
redeem: nextRedeem
|
|
10555
10695
|
};
|
|
10696
|
+
if (nextRedeem.some((r) => r.type === "PRODUCT")) return updated;
|
|
10697
|
+
return withLineRewardSavings(updated, null);
|
|
10556
10698
|
});
|
|
10557
10699
|
this.commitLines({ lines });
|
|
10558
10700
|
}
|
|
@@ -10803,7 +10945,9 @@ var Order = class Order {
|
|
|
10803
10945
|
...b4,
|
|
10804
10946
|
...b5
|
|
10805
10947
|
};
|
|
10806
|
-
await services.orders.validate(body, this.activeHttp());
|
|
10948
|
+
const res = await services.orders.validate(body, this.activeHttp());
|
|
10949
|
+
const nextLines = applyRewardSavingsToLines(this.draft.lines, res.reward_savings);
|
|
10950
|
+
if (nextLines !== this.draft.lines) this.commitLines({ lines: nextLines });
|
|
10807
10951
|
}
|
|
10808
10952
|
/**
|
|
10809
10953
|
* Tenders of the next intent: one REDEMPTION per `payment_id` that
|
|
@@ -17947,4 +18091,4 @@ const hpkeOpen = async (input) => {
|
|
|
17947
18091
|
return new Uint8Array(opened);
|
|
17948
18092
|
};
|
|
17949
18093
|
//#endregion
|
|
17950
|
-
export { CALLBACK_MISSING_LOCAL_URL, CANONICAL_MAX_DEPTH, CANONICAL_MAX_EXPONENT, CARD_BRANDS, CUSTOMER_INFO_PLACEHOLDERS, DEFAULT_LOCALE, DEFAULT_MAX_INCOMPLETE_MINUTES, DEFAULT_MAX_SNAPSHOT_AGE_MS, DEFAULT_RECOMMENDATION_TYPES, DEFAULT_ROUTE_COOLDOWN_MS, DEFAULT_WEBHOOK_TIMEOUT_S, DelegatedSessionExpiredError, FULFILLMENT_WORKFLOW_TERMINAL_STATUSES, HPKE_ALG, ID_HASH_FORMATS, LosslessNumber, MAX_MAX_INCOMPLETE_MINUTES, MAX_SUPPORTED_WORKFLOW_SCHEMA_VERSION, MIN_MAX_INCOMPLETE_MINUTES, MODE_HINT_HEADER, OFFLINE_NO_LOCAL_URL, ORIGIN_HEADER, Order, OrderAuthPinnedError, OrderNotOpenError, OrderPaymentRequiredError, OrderRouteUnavailableError, OrderSyncPendingError, OrderSyncRejectedError, OrderValidationError, RESERVED_FULFILLMENT_STATUSES, RecurringDateCron, RulesEngine, 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, StorefrontHttpError, TLS_FINGERPRINT_RESPONSE_HEADER, TLS_PIN_HEADER, TlsFingerprintMismatchError, TokenExchangeError, WORKFLOW_SCHEMA_VERSION, WORKFLOW_TIMEOUT, WorkflowSchemaVersionError, 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, clearDeviceSecrets, clearEdgeTaken, clearNodeVisit, cmsVisibilityNeedsTimezone, collectCheckoutIssues, collectOrderLineDiffs, completeEngineStepLog, computeOrderExpiresAt, computeStartingPrice, configureDeviceSecrets, configureLocalTlsPinning, countCartProducts, coveredAmount, createCanonicalizationError, createDeunaWidgetApi, createDeviceSecretsStore, 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, findShippingFeeLine, findStartNode, fitRedeems, flattenMenuCategories, flushLogs, formatCardNumber, formatCvc, formatExpiry, formatLocalServerUrl, formatRecurringDateCronSummary, fromOrderLines, fulfillmentStatusesEqual, genId, genOrderId, getLocalTlsPinning, getLogContext, getOrigin, getRouteHealth, getScheduleWindow, getSecret, hasInFlightPayment, hasLocalTlsPinning, hasSmartRouting, hpkeOpen, hpkeSeal, incomingEdges, indexMenu, indexOutgoingBySource, injectingMetadataFromCallback, invokeCallbackAttempt, isCanonicalizationError, isCardNumberComplete, isCardNumberDefinitelyInvalid, isCheckoutFieldFilled, isCustomerInfoFieldFilled, isCustomerInfoPlaceholder, isCustomerInfoValueValid, isCvcComplete, isDelegatedSessionExpiredError, isDeliveryFee, isDeviceCharged, isDeviceNotLinked, isExpiredFulfillment, isExpiryComplete, isGenId, isInterruptTerminalStatus, isKioskUnauthorized, isLocalOrderUnknown, isMilestoneStepDone, isNodeRuntime, isOnSchedule, isOrderNotOpenError, isOrderPaymentRequiredError, isOrderRouteUnavailableError, isOrderValidationError, isPosDeviceNotLinked, isPosUnauthorized, isRealPaymentMethod, isReservedFulfillmentStatus, isRouteCircuitOpen, isScheduleSlot, isScheduledAtError, isShippingFeeLine, isStateHash, isStorefrontNotFound, isSupportedWorkflowSchemaVersion, isTerminalFulfillmentStatus, isTerminalMappedStatus, isTlsFingerprintMismatchError, isVariantBase, linePayableTotal, listMenusStream, listSecretKeys, 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, syncDeviceSecrets, testLocalServerHealth, toOrderLines, toPaymentCardBrand, unusedOutgoing, utf8Encode, validateCardNumber, validateCardholderName, validateCvc, validateExpiry, validateOrderAgainstMenu, validatePickupName, verifyLocalRoutePin, verifyWebhookSignature, visitedStates, warnNoEdge, workflowSchemaVersionOf };
|
|
18094
|
+
export { CALLBACK_MISSING_LOCAL_URL, CANONICAL_MAX_DEPTH, CANONICAL_MAX_EXPONENT, CARD_BRANDS, CUSTOMER_INFO_PLACEHOLDERS, DEFAULT_LOCALE, DEFAULT_MAX_INCOMPLETE_MINUTES, DEFAULT_MAX_SNAPSHOT_AGE_MS, DEFAULT_RECOMMENDATION_TYPES, DEFAULT_ROUTE_COOLDOWN_MS, DEFAULT_WEBHOOK_TIMEOUT_S, DelegatedSessionExpiredError, FULFILLMENT_WORKFLOW_TERMINAL_STATUSES, HPKE_ALG, ID_HASH_FORMATS, LosslessNumber, MAX_MAX_INCOMPLETE_MINUTES, MAX_SUPPORTED_WORKFLOW_SCHEMA_VERSION, MIN_MAX_INCOMPLETE_MINUTES, MODE_HINT_HEADER, OFFLINE_NO_LOCAL_URL, ORIGIN_HEADER, Order, OrderAuthPinnedError, OrderNotOpenError, OrderPaymentRequiredError, OrderRouteUnavailableError, OrderSyncPendingError, OrderSyncRejectedError, OrderValidationError, RESERVED_FULFILLMENT_STATUSES, REWARD_SAVINGS_METADATA_KEY, RecurringDateCron, RulesEngine, 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, StorefrontHttpError, TLS_FINGERPRINT_RESPONSE_HEADER, TLS_PIN_HEADER, TlsFingerprintMismatchError, TokenExchangeError, WORKFLOW_SCHEMA_VERSION, WORKFLOW_TIMEOUT, WorkflowSchemaVersionError, addLines, advanceAndEnter, appendEngineStepLog, appendNodeLog, applyCmsVisibility, applyFees, applyManualAdvanceNote, applyRewardSavingsToLines, 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, clearDeviceSecrets, clearEdgeTaken, clearNodeVisit, cmsVisibilityNeedsTimezone, collectCheckoutIssues, collectOrderLineDiffs, completeEngineStepLog, computeOrderExpiresAt, computeProductRewardSavings, computeStartingPrice, configureDeviceSecrets, configureLocalTlsPinning, countCartProducts, coveredAmount, createCanonicalizationError, createDeunaWidgetApi, createDeviceSecretsStore, 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, findShippingFeeLine, findStartNode, fitRedeems, flattenMenuCategories, flushLogs, formatCardNumber, formatCvc, formatExpiry, formatLocalServerUrl, formatRecurringDateCronSummary, fromOrderLines, fulfillmentStatusesEqual, genId, genOrderId, getLineRewardSavings, getLocalTlsPinning, getLogContext, getOrigin, getRouteHealth, getScheduleWindow, getSecret, hasInFlightPayment, hasLocalTlsPinning, hasSmartRouting, hpkeOpen, hpkeSeal, incomingEdges, indexMenu, indexOutgoingBySource, injectingMetadataFromCallback, invokeCallbackAttempt, isCanonicalizationError, isCardNumberComplete, isCardNumberDefinitelyInvalid, isCheckoutFieldFilled, isCustomerInfoFieldFilled, isCustomerInfoPlaceholder, isCustomerInfoValueValid, isCvcComplete, isDelegatedSessionExpiredError, isDeliveryFee, isDeviceCharged, isDeviceNotLinked, isExpiredFulfillment, isExpiryComplete, isGenId, isInterruptTerminalStatus, isKioskUnauthorized, isLocalOrderUnknown, isMilestoneStepDone, isNodeRuntime, isOnSchedule, isOrderNotOpenError, isOrderPaymentRequiredError, isOrderRouteUnavailableError, isOrderValidationError, isPosDeviceNotLinked, isPosUnauthorized, isRealPaymentMethod, isReservedFulfillmentStatus, isRouteCircuitOpen, isScheduleSlot, isScheduledAtError, isShippingFeeLine, isStateHash, isStorefrontNotFound, isSupportedWorkflowSchemaVersion, isTerminalFulfillmentStatus, isTerminalMappedStatus, isTlsFingerprintMismatchError, isVariantBase, lineCartValue, linePayableTotal, listMenusStream, listSecretKeys, 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, pickLocalizedText, pickMultiLanguageText, placeCartLines, probeLocalRouteHealth, processStateNode, rebuildOrderLinesWithFees, rebuildRootGroups, recomputeTotals, redeemedTotal, redeemsForPayment, redemptionCap, redemptionSteps, remainingAmount, removeLine, replaceLine, rescaleLineRewardSavings, 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, syncDeviceSecrets, testLocalServerHealth, toOrderLines, toPaymentCardBrand, unusedOutgoing, utf8Encode, validateCardNumber, validateCardholderName, validateCvc, validateExpiry, validateOrderAgainstMenu, validatePickupName, verifyLocalRoutePin, verifyWebhookSignature, visitedStates, warnNoEdge, withLineRewardSavings, workflowSchemaVersionOf };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fire-spark/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.0",
|
|
4
4
|
"description": "Fire Spark headless SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"big.js": "6.2.1",
|
|
21
21
|
"dayjs": "1.11.9",
|
|
22
22
|
"@types/big.js": "6.2.2",
|
|
23
|
-
"@fire-spark/payments": "^0.
|
|
24
|
-
"@fire-spark/types": "^0.
|
|
23
|
+
"@fire-spark/payments": "^0.44.0",
|
|
24
|
+
"@fire-spark/types": "^0.44.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"tsdown": "^0.22.14",
|