@final-commerce/common 2.11.2-preprod.0 → 2.11.2-staging2.1
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.mts +1 -73
- package/dist/index.d.ts +1 -73
- package/dist/index.js +0 -181
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +0 -166
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +1 -28
- package/dist/pos-types/index.d.ts +1 -28
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1087,78 +1087,6 @@ interface LineStockMove {
|
|
|
1087
1087
|
}
|
|
1088
1088
|
declare function lineStockMoves(item: StockLine, quantity: number, reservations?: readonly StockReservationLink[]): LineStockMove[];
|
|
1089
1089
|
|
|
1090
|
-
interface ShellTipOption {
|
|
1091
|
-
label: string;
|
|
1092
|
-
value: number;
|
|
1093
|
-
}
|
|
1094
|
-
interface ShellTipSettings {
|
|
1095
|
-
enabled?: boolean;
|
|
1096
|
-
tip1?: ShellTipOption;
|
|
1097
|
-
tip2?: ShellTipOption;
|
|
1098
|
-
tip3?: ShellTipOption;
|
|
1099
|
-
customTipLabel?: string;
|
|
1100
|
-
noTipLabel?: string;
|
|
1101
|
-
}
|
|
1102
|
-
interface ShellSettings {
|
|
1103
|
-
pinSwitchUser?: boolean;
|
|
1104
|
-
pinSession?: boolean;
|
|
1105
|
-
stationLock?: number;
|
|
1106
|
-
buildTimeout?: number;
|
|
1107
|
-
lockedAccess?: boolean;
|
|
1108
|
-
cashManagement?: boolean;
|
|
1109
|
-
tips?: ShellTipSettings;
|
|
1110
|
-
}
|
|
1111
|
-
type ShellTipsLevel = Pick<ShellSettings, 'tips'>;
|
|
1112
|
-
|
|
1113
|
-
type ShellSettingsSource = 'station' | 'outlet' | 'flow' | 'company' | 'default';
|
|
1114
|
-
interface ShellSettingsLevels {
|
|
1115
|
-
station?: ShellSettings | null;
|
|
1116
|
-
outlet?: ShellTipsLevel | null;
|
|
1117
|
-
flow?: ShellTipsLevel | null;
|
|
1118
|
-
company?: ShellTipsLevel | null;
|
|
1119
|
-
}
|
|
1120
|
-
type ResolvedShellTipSettings = Required<ShellTipSettings>;
|
|
1121
|
-
interface ResolvedShellSettings {
|
|
1122
|
-
pinSwitchUser: boolean;
|
|
1123
|
-
pinSession: boolean;
|
|
1124
|
-
stationLock: number;
|
|
1125
|
-
buildTimeout: number;
|
|
1126
|
-
lockedAccess: boolean;
|
|
1127
|
-
cashManagement: boolean;
|
|
1128
|
-
tips: ResolvedShellTipSettings;
|
|
1129
|
-
}
|
|
1130
|
-
type TopField = Exclude<keyof ShellSettings, 'tips'>;
|
|
1131
|
-
type TipField = keyof ShellTipSettings;
|
|
1132
|
-
type ShellStationField = TopField;
|
|
1133
|
-
type ShellTipField = TipField;
|
|
1134
|
-
interface ShellSettingsSources {
|
|
1135
|
-
fields: Record<TopField, ShellSettingsSource>;
|
|
1136
|
-
tips: Record<TipField, ShellSettingsSource>;
|
|
1137
|
-
}
|
|
1138
|
-
declare const DEFAULT_SHELL_SETTINGS: ResolvedShellSettings;
|
|
1139
|
-
declare function resolveShellSettingsWithSources(levels: ShellSettingsLevels): {
|
|
1140
|
-
settings: ResolvedShellSettings;
|
|
1141
|
-
sources: ShellSettingsSources;
|
|
1142
|
-
};
|
|
1143
|
-
declare function resolveShellSettings(levels: ShellSettingsLevels): ResolvedShellSettings;
|
|
1144
|
-
declare const SHELL_TIP_PERCENT_MIN = 1;
|
|
1145
|
-
declare const SHELL_TIP_PERCENT_MAX = 100;
|
|
1146
|
-
declare const SHELL_TIP_LABEL_MAX_LENGTH = 20;
|
|
1147
|
-
type ShellSettingsProblemCode = 'boolean' | 'timeout' | 'percent' | 'label' | 'preset';
|
|
1148
|
-
interface ShellSettingsProblem {
|
|
1149
|
-
field: string;
|
|
1150
|
-
code: ShellSettingsProblemCode;
|
|
1151
|
-
}
|
|
1152
|
-
declare const isShellTipPercent: (raw: unknown) => boolean;
|
|
1153
|
-
declare function shellTipSettingsProblems(tips: ShellTipSettings | null | undefined): ShellSettingsProblem[];
|
|
1154
|
-
declare function shellSettingsProblems(settings: ShellSettings | null | undefined): ShellSettingsProblem[];
|
|
1155
|
-
declare const SHELL_FLOW_SETTINGS_PREFIX = "flowSettingsKey";
|
|
1156
|
-
declare const SHELL_FLOW_TIPS_KEY = "flowSettingsKey.tips";
|
|
1157
|
-
declare function readShellTipSettings(raw: unknown): ShellTipSettings | undefined;
|
|
1158
|
-
declare function shellSettingsFromFlowSettings(dict: Record<string, string> | null | undefined): ShellTipsLevel;
|
|
1159
|
-
declare function flowSettingsFromShellSettings(settings: ShellTipsLevel): Record<string, string>;
|
|
1160
|
-
declare function shellSettingsFromCompanyTips(enabled: unknown, options: unknown): ShellTipsLevel;
|
|
1161
|
-
|
|
1162
1090
|
declare const SYSTEM_FAMILY_IDS: {
|
|
1163
1091
|
readonly COUNT: "count";
|
|
1164
1092
|
readonly WEIGHT: "weight-metric";
|
|
@@ -2038,4 +1966,4 @@ declare const EXPENSE_DEFAULT_CATEGORIES: readonly [{
|
|
|
2038
1966
|
}];
|
|
2039
1967
|
type ExpenseDefaultCategoryKey = (typeof EXPENSE_DEFAULT_CATEGORIES)[number]['key'];
|
|
2040
1968
|
|
|
2041
|
-
export { ADYEN_JOB_TITLE_ASSOCIATION_TYPES, ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES, ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES, ADYEN_ROLLOUT_COUNTRY_CODES, ADYEN_STORE_STATE_PROVINCE_COUNTRIES, ADYEN_TAX_NUMBER_FORMATS, ADYEN_TAX_NUMBER_MIN_LENGTH, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AddressLike, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, type AssignUserChange, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, CANADA_PROVINCES, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, type CategoryModifierRow, type CategoryRow, CompanyType, type CompositeAvailabilityRows, type CompositeMakeable, type CompositeMakeableRow, type CompositePriceItem, type CompositePricePart, type CompositeReservationOrder, type CompositeShelf, type CompositeStockPart, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CountryOption, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_HOLD_MINUTES, DEFAULT_RESOLVED_CONFIG,
|
|
1969
|
+
export { ADYEN_JOB_TITLE_ASSOCIATION_TYPES, ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES, ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES, ADYEN_ROLLOUT_COUNTRY_CODES, ADYEN_STORE_STATE_PROVINCE_COUNTRIES, ADYEN_TAX_NUMBER_FORMATS, ADYEN_TAX_NUMBER_MIN_LENGTH, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AddressLike, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, type AssignUserChange, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, CANADA_PROVINCES, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, type CategoryModifierRow, type CategoryRow, CompanyType, type CompositeAvailabilityRows, type CompositeMakeable, type CompositeMakeableRow, type CompositePriceItem, type CompositePricePart, type CompositeReservationOrder, type CompositeShelf, type CompositeStockPart, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CountryOption, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_HOLD_MINUTES, DEFAULT_RESOLVED_CONFIG, DEFAULT_UNIT_ID, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, DualWriteStrategy, EUFixedRates, EUROPE, EVERYWHERE_KEY, EXPENSE_DEFAULT_CATEGORIES, EXPENSE_NAME_MAX_LENGTH, EXPENSE_PAYMENT_METHOD_PRESETS, type EndOfSessionReport, type ExpenseDefaultCategoryKey, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, type GridSlot, HttpMethod, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, type LineStockMove, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifierChoiceRow, type ModifierRow, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, type NormalizedAddress, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForAssignedUsers, type OrderLikeForContext, type OrderLikeForInCart, type OrderLikeForLegacyInference, type OrderLineItem, type OrderMutationData, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderReservationForContext, type OrderStateEventPayload, type OrderStateWritable, type OrderStatusDefinition, type OrderStatusValidationError, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_CHANNELS, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, type PaymentChannel, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, type PoolDrawing, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, ProcessorType, type ProductDiscountBucket, type ProductFeeBucket, ProductSalesChartStep, ProductSalesReportCompare, ProductStatus, ProductType, type Province, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, type ResolveShippingInput, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, SHIPPING_COUNTRIES, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, SalesLineAction, SalesLineSourceArray, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, ShippingChannel, ShippingNoOptionReason, type ShippingOptionRule, ShippingOptionType, type ShippingPlace, type ShippingPriceTier, type ShippingQuoteOption, ShippingRateType, type ShippingResolution, type ShippingTuple, ShippingZoneError, ShippingZoneKind, type ShippingZoneProblem, type ShippingZoneRule, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StockLine, type StockLineComponent, type StockReservationLink, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, type WeeklyHours, addAmounts, addressPlaceKeys, adyenLegalEntityRequiresStateOrProvince, adyenRequiresJobTitle, adyenStoreRequiresStateOrProvince, adyenSupportsTaxNumberAbsent, adyenTaxNumberFormat, amountToString, ancestorChain, applyAssignment, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, cheapestCompositeItem, cheapestCompositePrice, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, currentAssignees, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, hasInCartFlag, hasSellableChoice, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isChoiceAvailableAtOutlet, isConditionOperator, isFulfillmentState, isInCart, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, lineStockMoves, listCountries, listProvinces, listShippingCountries, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, occupancyIn, orderAssignments, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, placeKey, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, removeFragment, resolveFamily, resolveModifiersForProduct, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shipsToCountry, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, validateShippingZone, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
package/dist/index.d.ts
CHANGED
|
@@ -1087,78 +1087,6 @@ interface LineStockMove {
|
|
|
1087
1087
|
}
|
|
1088
1088
|
declare function lineStockMoves(item: StockLine, quantity: number, reservations?: readonly StockReservationLink[]): LineStockMove[];
|
|
1089
1089
|
|
|
1090
|
-
interface ShellTipOption {
|
|
1091
|
-
label: string;
|
|
1092
|
-
value: number;
|
|
1093
|
-
}
|
|
1094
|
-
interface ShellTipSettings {
|
|
1095
|
-
enabled?: boolean;
|
|
1096
|
-
tip1?: ShellTipOption;
|
|
1097
|
-
tip2?: ShellTipOption;
|
|
1098
|
-
tip3?: ShellTipOption;
|
|
1099
|
-
customTipLabel?: string;
|
|
1100
|
-
noTipLabel?: string;
|
|
1101
|
-
}
|
|
1102
|
-
interface ShellSettings {
|
|
1103
|
-
pinSwitchUser?: boolean;
|
|
1104
|
-
pinSession?: boolean;
|
|
1105
|
-
stationLock?: number;
|
|
1106
|
-
buildTimeout?: number;
|
|
1107
|
-
lockedAccess?: boolean;
|
|
1108
|
-
cashManagement?: boolean;
|
|
1109
|
-
tips?: ShellTipSettings;
|
|
1110
|
-
}
|
|
1111
|
-
type ShellTipsLevel = Pick<ShellSettings, 'tips'>;
|
|
1112
|
-
|
|
1113
|
-
type ShellSettingsSource = 'station' | 'outlet' | 'flow' | 'company' | 'default';
|
|
1114
|
-
interface ShellSettingsLevels {
|
|
1115
|
-
station?: ShellSettings | null;
|
|
1116
|
-
outlet?: ShellTipsLevel | null;
|
|
1117
|
-
flow?: ShellTipsLevel | null;
|
|
1118
|
-
company?: ShellTipsLevel | null;
|
|
1119
|
-
}
|
|
1120
|
-
type ResolvedShellTipSettings = Required<ShellTipSettings>;
|
|
1121
|
-
interface ResolvedShellSettings {
|
|
1122
|
-
pinSwitchUser: boolean;
|
|
1123
|
-
pinSession: boolean;
|
|
1124
|
-
stationLock: number;
|
|
1125
|
-
buildTimeout: number;
|
|
1126
|
-
lockedAccess: boolean;
|
|
1127
|
-
cashManagement: boolean;
|
|
1128
|
-
tips: ResolvedShellTipSettings;
|
|
1129
|
-
}
|
|
1130
|
-
type TopField = Exclude<keyof ShellSettings, 'tips'>;
|
|
1131
|
-
type TipField = keyof ShellTipSettings;
|
|
1132
|
-
type ShellStationField = TopField;
|
|
1133
|
-
type ShellTipField = TipField;
|
|
1134
|
-
interface ShellSettingsSources {
|
|
1135
|
-
fields: Record<TopField, ShellSettingsSource>;
|
|
1136
|
-
tips: Record<TipField, ShellSettingsSource>;
|
|
1137
|
-
}
|
|
1138
|
-
declare const DEFAULT_SHELL_SETTINGS: ResolvedShellSettings;
|
|
1139
|
-
declare function resolveShellSettingsWithSources(levels: ShellSettingsLevels): {
|
|
1140
|
-
settings: ResolvedShellSettings;
|
|
1141
|
-
sources: ShellSettingsSources;
|
|
1142
|
-
};
|
|
1143
|
-
declare function resolveShellSettings(levels: ShellSettingsLevels): ResolvedShellSettings;
|
|
1144
|
-
declare const SHELL_TIP_PERCENT_MIN = 1;
|
|
1145
|
-
declare const SHELL_TIP_PERCENT_MAX = 100;
|
|
1146
|
-
declare const SHELL_TIP_LABEL_MAX_LENGTH = 20;
|
|
1147
|
-
type ShellSettingsProblemCode = 'boolean' | 'timeout' | 'percent' | 'label' | 'preset';
|
|
1148
|
-
interface ShellSettingsProblem {
|
|
1149
|
-
field: string;
|
|
1150
|
-
code: ShellSettingsProblemCode;
|
|
1151
|
-
}
|
|
1152
|
-
declare const isShellTipPercent: (raw: unknown) => boolean;
|
|
1153
|
-
declare function shellTipSettingsProblems(tips: ShellTipSettings | null | undefined): ShellSettingsProblem[];
|
|
1154
|
-
declare function shellSettingsProblems(settings: ShellSettings | null | undefined): ShellSettingsProblem[];
|
|
1155
|
-
declare const SHELL_FLOW_SETTINGS_PREFIX = "flowSettingsKey";
|
|
1156
|
-
declare const SHELL_FLOW_TIPS_KEY = "flowSettingsKey.tips";
|
|
1157
|
-
declare function readShellTipSettings(raw: unknown): ShellTipSettings | undefined;
|
|
1158
|
-
declare function shellSettingsFromFlowSettings(dict: Record<string, string> | null | undefined): ShellTipsLevel;
|
|
1159
|
-
declare function flowSettingsFromShellSettings(settings: ShellTipsLevel): Record<string, string>;
|
|
1160
|
-
declare function shellSettingsFromCompanyTips(enabled: unknown, options: unknown): ShellTipsLevel;
|
|
1161
|
-
|
|
1162
1090
|
declare const SYSTEM_FAMILY_IDS: {
|
|
1163
1091
|
readonly COUNT: "count";
|
|
1164
1092
|
readonly WEIGHT: "weight-metric";
|
|
@@ -2038,4 +1966,4 @@ declare const EXPENSE_DEFAULT_CATEGORIES: readonly [{
|
|
|
2038
1966
|
}];
|
|
2039
1967
|
type ExpenseDefaultCategoryKey = (typeof EXPENSE_DEFAULT_CATEGORIES)[number]['key'];
|
|
2040
1968
|
|
|
2041
|
-
export { ADYEN_JOB_TITLE_ASSOCIATION_TYPES, ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES, ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES, ADYEN_ROLLOUT_COUNTRY_CODES, ADYEN_STORE_STATE_PROVINCE_COUNTRIES, ADYEN_TAX_NUMBER_FORMATS, ADYEN_TAX_NUMBER_MIN_LENGTH, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AddressLike, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, type AssignUserChange, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, CANADA_PROVINCES, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, type CategoryModifierRow, type CategoryRow, CompanyType, type CompositeAvailabilityRows, type CompositeMakeable, type CompositeMakeableRow, type CompositePriceItem, type CompositePricePart, type CompositeReservationOrder, type CompositeShelf, type CompositeStockPart, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CountryOption, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_HOLD_MINUTES, DEFAULT_RESOLVED_CONFIG,
|
|
1969
|
+
export { ADYEN_JOB_TITLE_ASSOCIATION_TYPES, ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES, ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES, ADYEN_ROLLOUT_COUNTRY_CODES, ADYEN_STORE_STATE_PROVINCE_COUNTRIES, ADYEN_TAX_NUMBER_FORMATS, ADYEN_TAX_NUMBER_MIN_LENGTH, AFFIRM_COUNTRY_CODES, AFFIRM_PRICE_PLANS, type AddressLike, type AdyenBnplSettings, type AdyenBnplSkippedStore, type AdyenBnplUpdateResult, type AffirmPricePlan, type Amount, type AssignUserChange, AttributeType, type AvailabilityInput, type AvailabilitySlot, type AvailableTransition, BNPL_METHOD_STATUS, BNPL_SKIP_REASON, type BnplMethodStatus, type BnplSkipReason, type BookingOccupancy, BookingRatePeriod, type BookingResourceInput, BookingResourceKind, BookingResourceStatus, BookingRulesError, type BookingRulesInput, BookingType, type BusyWindow, CANADA_PROVINCES, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, type CategoryModifierRow, type CategoryRow, CompanyType, type CompositeAvailabilityRows, type CompositeMakeable, type CompositeMakeableRow, type CompositePriceItem, type CompositePricePart, type CompositeReservationOrder, type CompositeShelf, type CompositeStockPart, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CountryOption, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_HOLD_MINUTES, DEFAULT_RESOLVED_CONFIG, DEFAULT_UNIT_ID, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, DualWriteStrategy, EUFixedRates, EUROPE, EVERYWHERE_KEY, EXPENSE_DEFAULT_CATEGORIES, EXPENSE_NAME_MAX_LENGTH, EXPENSE_PAYMENT_METHOD_PRESETS, type EndOfSessionReport, type ExpenseDefaultCategoryKey, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, type GridSlot, HttpMethod, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LegacyWriteStrategy, LibraryItemType, type LineStockMove, MAX_PRECISION, type Measurable, type MeasurementBase, type MeasurementUnit, type MeasurementUnitFamily, MenuProject, type ModifierChoiceRow, type ModifierRow, type ModifiersBreakdown, type ModifiersTuple, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, type NormalizedAddress, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForAssignedUsers, type OrderLikeForContext, type OrderLikeForInCart, type OrderLikeForLegacyInference, type OrderLineItem, type OrderMutationData, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderReservationForContext, type OrderStateEventPayload, type OrderStateWritable, type OrderStatusDefinition, type OrderStatusValidationError, type OrderWriteStrategy, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_CHANNELS, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, type PaymentChannel, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, type PlanWindowInput, Platform, type PoolDrawing, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, ProcessorType, type ProductDiscountBucket, type ProductFeeBucket, ProductSalesChartStep, ProductSalesReportCompare, ProductStatus, ProductType, type Province, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ReservationStatus, ResidualPaymentMethod, ResidualStatus, type ResolveInputs, type ResolveShippingInput, type ResolveTemplateResult, type ResourceAvailability, ResourceAvailabilityState, type ResourceInWindow, type ResourcePresenceRow, SHIPPING_COUNTRIES, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, SYSTEM_FAMILIES, SYSTEM_FAMILY_IDS, SYSTEM_UNITS, SYSTEM_UNIT_IDS, SalesLineAction, SalesLineSourceArray, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, ShippingChannel, ShippingNoOptionReason, type ShippingOptionRule, ShippingOptionType, type ShippingPlace, type ShippingPriceTier, type ShippingQuoteOption, ShippingRateType, type ShippingResolution, type ShippingTuple, ShippingZoneError, ShippingZoneKind, type ShippingZoneProblem, type ShippingZoneRule, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StockLine, type StockLineComponent, type StockReservationLink, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, type WeeklyHours, addAmounts, addressPlaceKeys, adyenLegalEntityRequiresStateOrProvince, adyenRequiresJobTitle, adyenStoreRequiresStateOrProvince, adyenSupportsTaxNumberAbsent, adyenTaxNumberFormat, amountToString, ancestorChain, applyAssignment, assertUnitSane, availableIn, baseFor, baseFulfillmentDefinitions, baseOf, basePaymentDefinitions, buildAvailability, buildGrid, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, cheapestCompositeItem, cheapestCompositePrice, compositeItemCost, compositeItemUnavailable, compositeMakeable, compositeModifierMismatches, compositeReservationMismatches, compositeVariantInStock, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, currentAssignees, deriveDisplayState, deriveFamilyCode, deriveUnitId, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, extendPrice, extendPriceFor, formatCurrency, formatInUnit, formatMinorUnitsToString, formatQuantity, fromBase, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, hasInCartFlag, hasSellableChoice, holdExpiresAt, inferStatesFromLegacyStatus, isAdyenRolloutCountry, isAffirmCountry, isAffirmPricePlan, isChoiceAvailableAtOutlet, isConditionOperator, isFulfillmentState, isInCart, isPaymentState, isSupportedCurrency, isSystemFamilyCode, isValidQuantity, isWhole, lineStockMoves, listCountries, listProvinces, listShippingCountries, mapToLegacyStatus, maxPrecisionFor, mergeFragment, modifiersSellable, multiplyAmount, normalizeAddress, normalizeCityKey, normalizeCountry, normalizeMongoIdString, normalizePostCode, normalizeProvince, occupancyIn, orderAssignments, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, placeKey, planWindow, poolDemand, poolOf, poolShortfall, poolStockAt, postCodeMatchesProvince, presentAt, priceForTotal, provincesForPostCode, removeFragment, resolveFamily, resolveModifiersForProduct, resolveShipping, resolveTemplate, resolveUnit, roundToPrecision, sameFamily, setOrderState, shipsToCountry, shopDayKey, shopDayRange, signReportForDisplay, slotsForWindow, stringifyMinorUnits, subtractAmounts, toBase, toMinorUnits, validateConfig, validateFragmentCompatibility, validateOrderStatuses, validateShippingZone, violatesFinancialInvariant, windowEndsAt, withinPresence };
|
package/dist/index.js
CHANGED
|
@@ -49,7 +49,6 @@ __export(index_exports, {
|
|
|
49
49
|
DEFAULT_DISPLAY_STATE_MAP: () => DEFAULT_DISPLAY_STATE_MAP,
|
|
50
50
|
DEFAULT_HOLD_MINUTES: () => DEFAULT_HOLD_MINUTES,
|
|
51
51
|
DEFAULT_RESOLVED_CONFIG: () => DEFAULT_RESOLVED_CONFIG,
|
|
52
|
-
DEFAULT_SHELL_SETTINGS: () => DEFAULT_SHELL_SETTINGS,
|
|
53
52
|
DEFAULT_UNIT_ID: () => DEFAULT_UNIT_ID,
|
|
54
53
|
DualWriteStrategy: () => DualWriteStrategy,
|
|
55
54
|
EUFixedRates: () => EUFixedRates,
|
|
@@ -105,11 +104,6 @@ __export(index_exports, {
|
|
|
105
104
|
ResidualPaymentMethod: () => ResidualPaymentMethod,
|
|
106
105
|
ResidualStatus: () => ResidualStatus,
|
|
107
106
|
ResourceAvailabilityState: () => ResourceAvailabilityState,
|
|
108
|
-
SHELL_FLOW_SETTINGS_PREFIX: () => SHELL_FLOW_SETTINGS_PREFIX,
|
|
109
|
-
SHELL_FLOW_TIPS_KEY: () => SHELL_FLOW_TIPS_KEY,
|
|
110
|
-
SHELL_TIP_LABEL_MAX_LENGTH: () => SHELL_TIP_LABEL_MAX_LENGTH,
|
|
111
|
-
SHELL_TIP_PERCENT_MAX: () => SHELL_TIP_PERCENT_MAX,
|
|
112
|
-
SHELL_TIP_PERCENT_MIN: () => SHELL_TIP_PERCENT_MIN,
|
|
113
107
|
SHIPPING_COUNTRIES: () => SHIPPING_COUNTRIES,
|
|
114
108
|
STATE_SCHEMA: () => STATE_SCHEMA,
|
|
115
109
|
STRIPE_SUPPORTED_COUNTRIES: () => STRIPE_SUPPORTED_COUNTRIES,
|
|
@@ -176,7 +170,6 @@ __export(index_exports, {
|
|
|
176
170
|
evaluateConditionSet: () => evaluateConditionSet,
|
|
177
171
|
extendPrice: () => extendPrice,
|
|
178
172
|
extendPriceFor: () => extendPriceFor,
|
|
179
|
-
flowSettingsFromShellSettings: () => flowSettingsFromShellSettings,
|
|
180
173
|
formatCurrency: () => formatCurrency,
|
|
181
174
|
formatInUnit: () => formatInUnit,
|
|
182
175
|
formatMinorUnitsToString: () => formatMinorUnitsToString,
|
|
@@ -210,7 +203,6 @@ __export(index_exports, {
|
|
|
210
203
|
isFulfillmentState: () => isFulfillmentState,
|
|
211
204
|
isInCart: () => isInCart,
|
|
212
205
|
isPaymentState: () => isPaymentState,
|
|
213
|
-
isShellTipPercent: () => isShellTipPercent,
|
|
214
206
|
isSupportedCurrency: () => isSupportedCurrency,
|
|
215
207
|
isSystemFamilyCode: () => isSystemFamilyCode,
|
|
216
208
|
isValidQuantity: () => isValidQuantity,
|
|
@@ -245,22 +237,15 @@ __export(index_exports, {
|
|
|
245
237
|
presentAt: () => presentAt,
|
|
246
238
|
priceForTotal: () => priceForTotal,
|
|
247
239
|
provincesForPostCode: () => provincesForPostCode,
|
|
248
|
-
readShellTipSettings: () => readShellTipSettings,
|
|
249
240
|
removeFragment: () => removeFragment,
|
|
250
241
|
resolveFamily: () => resolveFamily,
|
|
251
242
|
resolveModifiersForProduct: () => resolveModifiersForProduct,
|
|
252
|
-
resolveShellSettings: () => resolveShellSettings,
|
|
253
|
-
resolveShellSettingsWithSources: () => resolveShellSettingsWithSources,
|
|
254
243
|
resolveShipping: () => resolveShipping,
|
|
255
244
|
resolveTemplate: () => resolveTemplate,
|
|
256
245
|
resolveUnit: () => resolveUnit,
|
|
257
246
|
roundToPrecision: () => roundToPrecision,
|
|
258
247
|
sameFamily: () => sameFamily,
|
|
259
248
|
setOrderState: () => setOrderState,
|
|
260
|
-
shellSettingsFromCompanyTips: () => shellSettingsFromCompanyTips,
|
|
261
|
-
shellSettingsFromFlowSettings: () => shellSettingsFromFlowSettings,
|
|
262
|
-
shellSettingsProblems: () => shellSettingsProblems,
|
|
263
|
-
shellTipSettingsProblems: () => shellTipSettingsProblems,
|
|
264
249
|
shipsToCountry: () => shipsToCountry,
|
|
265
250
|
shopDayKey: () => shopDayKey,
|
|
266
251
|
shopDayRange: () => shopDayRange,
|
|
@@ -2063,157 +2048,6 @@ function lineStockMoves(item, quantity, reservations = []) {
|
|
|
2063
2048
|
});
|
|
2064
2049
|
}
|
|
2065
2050
|
|
|
2066
|
-
// utils/shell-settings.util.ts
|
|
2067
|
-
var DEFAULT_SHELL_SETTINGS = {
|
|
2068
|
-
pinSwitchUser: false,
|
|
2069
|
-
pinSession: false,
|
|
2070
|
-
stationLock: 0,
|
|
2071
|
-
buildTimeout: 0,
|
|
2072
|
-
lockedAccess: false,
|
|
2073
|
-
cashManagement: true,
|
|
2074
|
-
tips: {
|
|
2075
|
-
enabled: true,
|
|
2076
|
-
tip1: { label: "Good", value: 15 },
|
|
2077
|
-
tip2: { label: "Great", value: 18 },
|
|
2078
|
-
tip3: { label: "Amazing!", value: 25 },
|
|
2079
|
-
customTipLabel: "Custom",
|
|
2080
|
-
noTipLabel: "No tip"
|
|
2081
|
-
}
|
|
2082
|
-
};
|
|
2083
|
-
var FIELD_ORDER = ["station"];
|
|
2084
|
-
var TIP_ORDER = ["station", "outlet", "flow", "company"];
|
|
2085
|
-
var TOP_FIELDS = [
|
|
2086
|
-
"pinSwitchUser",
|
|
2087
|
-
"pinSession",
|
|
2088
|
-
"stationLock",
|
|
2089
|
-
"buildTimeout",
|
|
2090
|
-
"lockedAccess",
|
|
2091
|
-
"cashManagement"
|
|
2092
|
-
];
|
|
2093
|
-
var TIP_FIELDS = ["enabled", "tip1", "tip2", "tip3", "customTipLabel", "noTipLabel"];
|
|
2094
|
-
function pick(levels, order, read, fallback) {
|
|
2095
|
-
for (const level of order) {
|
|
2096
|
-
const settings = levels[level];
|
|
2097
|
-
if (!settings) continue;
|
|
2098
|
-
const value = read(settings);
|
|
2099
|
-
if (value !== void 0 && value !== null) return { value, source: level };
|
|
2100
|
-
}
|
|
2101
|
-
return { value: fallback, source: "default" };
|
|
2102
|
-
}
|
|
2103
|
-
function resolveShellSettingsWithSources(levels) {
|
|
2104
|
-
const settings = { ...DEFAULT_SHELL_SETTINGS, tips: { ...DEFAULT_SHELL_SETTINGS.tips } };
|
|
2105
|
-
const sources = { fields: {}, tips: {} };
|
|
2106
|
-
for (const field of TOP_FIELDS) {
|
|
2107
|
-
const { value, source } = pick(levels, FIELD_ORDER, (s) => s[field], DEFAULT_SHELL_SETTINGS[field]);
|
|
2108
|
-
settings[field] = value;
|
|
2109
|
-
sources.fields[field] = source;
|
|
2110
|
-
}
|
|
2111
|
-
for (const field of TIP_FIELDS) {
|
|
2112
|
-
const { value, source } = pick(levels, TIP_ORDER, (s) => s.tips?.[field], DEFAULT_SHELL_SETTINGS.tips[field]);
|
|
2113
|
-
settings.tips[field] = value;
|
|
2114
|
-
sources.tips[field] = source;
|
|
2115
|
-
}
|
|
2116
|
-
return { settings, sources };
|
|
2117
|
-
}
|
|
2118
|
-
function resolveShellSettings(levels) {
|
|
2119
|
-
return resolveShellSettingsWithSources(levels).settings;
|
|
2120
|
-
}
|
|
2121
|
-
var SHELL_TIP_PERCENT_MIN = 1;
|
|
2122
|
-
var SHELL_TIP_PERCENT_MAX = 100;
|
|
2123
|
-
var SHELL_TIP_LABEL_MAX_LENGTH = 20;
|
|
2124
|
-
var isLabel = (raw) => typeof raw === "string" && raw.trim().length > 0 && raw.length <= SHELL_TIP_LABEL_MAX_LENGTH;
|
|
2125
|
-
var isShellTipPercent = (raw) => typeof raw === "number" && Number.isInteger(raw) && raw >= SHELL_TIP_PERCENT_MIN && raw <= SHELL_TIP_PERCENT_MAX;
|
|
2126
|
-
function shellTipSettingsProblems(tips) {
|
|
2127
|
-
if (!tips) return [];
|
|
2128
|
-
const problems = [];
|
|
2129
|
-
if (tips.enabled !== void 0 && typeof tips.enabled !== "boolean") {
|
|
2130
|
-
problems.push({ field: "tips.enabled", code: "boolean" });
|
|
2131
|
-
}
|
|
2132
|
-
for (const key of ["tip1", "tip2", "tip3"]) {
|
|
2133
|
-
const option = tips[key];
|
|
2134
|
-
if (option === void 0) continue;
|
|
2135
|
-
if (!option || typeof option !== "object") {
|
|
2136
|
-
problems.push({ field: `tips.${key}`, code: "preset" });
|
|
2137
|
-
continue;
|
|
2138
|
-
}
|
|
2139
|
-
if (!isShellTipPercent(option.value)) problems.push({ field: `tips.${key}`, code: "percent" });
|
|
2140
|
-
if (!isLabel(option.label)) problems.push({ field: `tips.${key}`, code: "label" });
|
|
2141
|
-
}
|
|
2142
|
-
for (const key of ["customTipLabel", "noTipLabel"]) {
|
|
2143
|
-
if (tips[key] !== void 0 && !isLabel(tips[key])) problems.push({ field: `tips.${key}`, code: "label" });
|
|
2144
|
-
}
|
|
2145
|
-
return problems;
|
|
2146
|
-
}
|
|
2147
|
-
function shellSettingsProblems(settings) {
|
|
2148
|
-
if (!settings) return [];
|
|
2149
|
-
const problems = [];
|
|
2150
|
-
for (const field of ["pinSwitchUser", "pinSession", "lockedAccess", "cashManagement"]) {
|
|
2151
|
-
if (settings[field] !== void 0 && typeof settings[field] !== "boolean")
|
|
2152
|
-
problems.push({ field, code: "boolean" });
|
|
2153
|
-
}
|
|
2154
|
-
for (const field of ["stationLock", "buildTimeout"]) {
|
|
2155
|
-
const value = settings[field];
|
|
2156
|
-
if (value !== void 0 && !(typeof value === "number" && Number.isInteger(value) && value >= 0)) {
|
|
2157
|
-
problems.push({ field, code: "timeout" });
|
|
2158
|
-
}
|
|
2159
|
-
}
|
|
2160
|
-
return [...problems, ...shellTipSettingsProblems(settings.tips)];
|
|
2161
|
-
}
|
|
2162
|
-
var SHELL_FLOW_SETTINGS_PREFIX = "flowSettingsKey";
|
|
2163
|
-
var SHELL_FLOW_TIPS_KEY = `${SHELL_FLOW_SETTINGS_PREFIX}.tips`;
|
|
2164
|
-
var readBoolean = (raw) => {
|
|
2165
|
-
if (raw === void 0 || raw === "") return void 0;
|
|
2166
|
-
const v = raw.trim().toLowerCase();
|
|
2167
|
-
if (v === "true") return true;
|
|
2168
|
-
if (v === "false") return false;
|
|
2169
|
-
return void 0;
|
|
2170
|
-
};
|
|
2171
|
-
function readTipOption(raw) {
|
|
2172
|
-
if (!raw || typeof raw !== "object") return void 0;
|
|
2173
|
-
const { label, value } = raw;
|
|
2174
|
-
const n = typeof value === "number" ? value : parseFloat(String(value ?? ""));
|
|
2175
|
-
if (typeof label !== "string" || !Number.isFinite(n) || n < 0) return void 0;
|
|
2176
|
-
return { label, value: n };
|
|
2177
|
-
}
|
|
2178
|
-
function readShellTipSettings(raw) {
|
|
2179
|
-
if (!raw || typeof raw !== "object") return void 0;
|
|
2180
|
-
const r = raw;
|
|
2181
|
-
const tips = {};
|
|
2182
|
-
if (typeof r.enabled === "boolean") tips.enabled = r.enabled;
|
|
2183
|
-
const tip1 = readTipOption(r.tip1);
|
|
2184
|
-
const tip2 = readTipOption(r.tip2);
|
|
2185
|
-
const tip3 = readTipOption(r.tip3);
|
|
2186
|
-
if (tip1) tips.tip1 = tip1;
|
|
2187
|
-
if (tip2) tips.tip2 = tip2;
|
|
2188
|
-
if (tip3) tips.tip3 = tip3;
|
|
2189
|
-
if (typeof r.customTipLabel === "string") tips.customTipLabel = r.customTipLabel;
|
|
2190
|
-
if (typeof r.noTipLabel === "string") tips.noTipLabel = r.noTipLabel;
|
|
2191
|
-
return Object.keys(tips).length > 0 ? tips : void 0;
|
|
2192
|
-
}
|
|
2193
|
-
var parseJson = (raw) => {
|
|
2194
|
-
if (!raw) return void 0;
|
|
2195
|
-
try {
|
|
2196
|
-
return JSON.parse(raw);
|
|
2197
|
-
} catch {
|
|
2198
|
-
return void 0;
|
|
2199
|
-
}
|
|
2200
|
-
};
|
|
2201
|
-
function shellSettingsFromFlowSettings(dict) {
|
|
2202
|
-
const tips = readShellTipSettings(parseJson(dict?.[SHELL_FLOW_TIPS_KEY]));
|
|
2203
|
-
return tips ? { tips } : {};
|
|
2204
|
-
}
|
|
2205
|
-
function flowSettingsFromShellSettings(settings) {
|
|
2206
|
-
return settings.tips && Object.keys(settings.tips).length > 0 ? { [SHELL_FLOW_TIPS_KEY]: JSON.stringify(settings.tips) } : {};
|
|
2207
|
-
}
|
|
2208
|
-
function shellSettingsFromCompanyTips(enabled, options) {
|
|
2209
|
-
const tips = {
|
|
2210
|
-
...readShellTipSettings(typeof options === "string" ? parseJson(options) : options)
|
|
2211
|
-
};
|
|
2212
|
-
const on = typeof enabled === "boolean" ? enabled : readBoolean(typeof enabled === "string" ? enabled : void 0);
|
|
2213
|
-
if (on !== void 0) tips.enabled = on;
|
|
2214
|
-
return Object.keys(tips).length > 0 ? { tips } : {};
|
|
2215
|
-
}
|
|
2216
|
-
|
|
2217
2051
|
// units/family-code.ts
|
|
2218
2052
|
var MAX_SLUG_LENGTH = 32;
|
|
2219
2053
|
var FALLBACK_SLUG = "family";
|
|
@@ -4603,7 +4437,6 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4603
4437
|
DEFAULT_DISPLAY_STATE_MAP,
|
|
4604
4438
|
DEFAULT_HOLD_MINUTES,
|
|
4605
4439
|
DEFAULT_RESOLVED_CONFIG,
|
|
4606
|
-
DEFAULT_SHELL_SETTINGS,
|
|
4607
4440
|
DEFAULT_UNIT_ID,
|
|
4608
4441
|
DualWriteStrategy,
|
|
4609
4442
|
EUFixedRates,
|
|
@@ -4659,11 +4492,6 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4659
4492
|
ResidualPaymentMethod,
|
|
4660
4493
|
ResidualStatus,
|
|
4661
4494
|
ResourceAvailabilityState,
|
|
4662
|
-
SHELL_FLOW_SETTINGS_PREFIX,
|
|
4663
|
-
SHELL_FLOW_TIPS_KEY,
|
|
4664
|
-
SHELL_TIP_LABEL_MAX_LENGTH,
|
|
4665
|
-
SHELL_TIP_PERCENT_MAX,
|
|
4666
|
-
SHELL_TIP_PERCENT_MIN,
|
|
4667
4495
|
SHIPPING_COUNTRIES,
|
|
4668
4496
|
STATE_SCHEMA,
|
|
4669
4497
|
STRIPE_SUPPORTED_COUNTRIES,
|
|
@@ -4730,7 +4558,6 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4730
4558
|
evaluateConditionSet,
|
|
4731
4559
|
extendPrice,
|
|
4732
4560
|
extendPriceFor,
|
|
4733
|
-
flowSettingsFromShellSettings,
|
|
4734
4561
|
formatCurrency,
|
|
4735
4562
|
formatInUnit,
|
|
4736
4563
|
formatMinorUnitsToString,
|
|
@@ -4764,7 +4591,6 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4764
4591
|
isFulfillmentState,
|
|
4765
4592
|
isInCart,
|
|
4766
4593
|
isPaymentState,
|
|
4767
|
-
isShellTipPercent,
|
|
4768
4594
|
isSupportedCurrency,
|
|
4769
4595
|
isSystemFamilyCode,
|
|
4770
4596
|
isValidQuantity,
|
|
@@ -4799,22 +4625,15 @@ var EXPENSE_DEFAULT_CATEGORIES = [
|
|
|
4799
4625
|
presentAt,
|
|
4800
4626
|
priceForTotal,
|
|
4801
4627
|
provincesForPostCode,
|
|
4802
|
-
readShellTipSettings,
|
|
4803
4628
|
removeFragment,
|
|
4804
4629
|
resolveFamily,
|
|
4805
4630
|
resolveModifiersForProduct,
|
|
4806
|
-
resolveShellSettings,
|
|
4807
|
-
resolveShellSettingsWithSources,
|
|
4808
4631
|
resolveShipping,
|
|
4809
4632
|
resolveTemplate,
|
|
4810
4633
|
resolveUnit,
|
|
4811
4634
|
roundToPrecision,
|
|
4812
4635
|
sameFamily,
|
|
4813
4636
|
setOrderState,
|
|
4814
|
-
shellSettingsFromCompanyTips,
|
|
4815
|
-
shellSettingsFromFlowSettings,
|
|
4816
|
-
shellSettingsProblems,
|
|
4817
|
-
shellTipSettingsProblems,
|
|
4818
4637
|
shipsToCountry,
|
|
4819
4638
|
shopDayKey,
|
|
4820
4639
|
shopDayRange,
|