@joai/core 4.15.3 → 4.15.4
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 +90 -15
- package/dist/index.mjs +179 -12
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -23,6 +23,7 @@ declare const getFormsBaseUrl: (env: AppEnv) => "http://forms.joai--api.test:300
|
|
|
23
23
|
declare const getDigestBaseUrl: (env: AppEnv) => "http://localhost:3005" | "https://devnet-digests.joai.ai" | "https://testnet-digests.joai.ai" | "https://digests.joai.ai";
|
|
24
24
|
declare const getStoreBaseUrl: (env: AppEnv) => "http://localhost:3005" | "https://devnet-store.joai.ai" | "https://testnet-store.joai.ai" | "https://store.joai.ai";
|
|
25
25
|
declare const getAgentsBaseUrl: (env: AppEnv) => "http://localhost:3007" | "https://devnet-agents.joai.ai" | "https://testnet-agents.joai.ai" | "https://agents.joai.ai";
|
|
26
|
+
declare const getGenBaseUrl: (env: AppEnv) => "http://localhost:3011" | "https://devnet-gen.joai.ai" | "https://testnet-gen.joai.ai" | "https://gen.joai.ai";
|
|
26
27
|
declare const getMcpServerUrl: (env: AppEnv) => string;
|
|
27
28
|
declare const getMcpServerAgentUrl: (env: AppEnv, agent: string) => string;
|
|
28
29
|
declare const getSitesBaseUrl: (env: AppEnv) => "http://sites.joai--api.test:3007" | "https://devnet-sites.joai.ai" | "https://testnet-sites.joai.ai" | "https://sites.joai.ai";
|
|
@@ -811,6 +812,7 @@ declare const NativeApps: {
|
|
|
811
812
|
readonly Artifacts: "artifacts";
|
|
812
813
|
readonly Social: "social";
|
|
813
814
|
readonly Studio: "studio";
|
|
815
|
+
readonly Loyalty: "loyalty";
|
|
814
816
|
};
|
|
815
817
|
type NativeApp = (typeof NativeApps)[keyof typeof NativeApps];
|
|
816
818
|
declare const nativeAppSlugs: NativeApp[];
|
|
@@ -871,6 +873,7 @@ type TeamMeta = {
|
|
|
871
873
|
'payments.coupons'?: boolean;
|
|
872
874
|
'kiosk.enabled'?: boolean;
|
|
873
875
|
'stock.enabled'?: boolean;
|
|
876
|
+
'orders.notify_emails'?: string[];
|
|
874
877
|
contactPropertyMaskWarp?: string;
|
|
875
878
|
branding?: TeamBrand | null;
|
|
876
879
|
settings: Record<string, unknown> & {
|
|
@@ -992,6 +995,7 @@ type TeamSettings = {
|
|
|
992
995
|
'payments.coupons'?: boolean;
|
|
993
996
|
'kiosk.enabled'?: boolean;
|
|
994
997
|
'stock.enabled'?: boolean;
|
|
998
|
+
'orders.notify_emails'?: string[];
|
|
995
999
|
branding?: TeamBrand | null;
|
|
996
1000
|
};
|
|
997
1001
|
type TeamUsage = Partial<Record<PlanFeature, TeamFeatureUsage>> & {
|
|
@@ -1256,7 +1260,8 @@ type Product = {
|
|
|
1256
1260
|
media?: Media[];
|
|
1257
1261
|
};
|
|
1258
1262
|
type OrderItem = {
|
|
1259
|
-
id: string | null;
|
|
1263
|
+
id: string | null; /** Database id of the order_items row — required for fulfillments/returns. */
|
|
1264
|
+
orderItemId: number;
|
|
1260
1265
|
name: string;
|
|
1261
1266
|
quantity: number;
|
|
1262
1267
|
unitPrice: number;
|
|
@@ -1282,6 +1287,7 @@ type Order = {
|
|
|
1282
1287
|
status: OrderStatus;
|
|
1283
1288
|
paymentUrl?: string | null;
|
|
1284
1289
|
invoiceUrl: string | null;
|
|
1290
|
+
deliveryNoteUrl: string | null;
|
|
1285
1291
|
justCreated?: boolean;
|
|
1286
1292
|
createdAt: string;
|
|
1287
1293
|
invoiceDate: string;
|
|
@@ -2582,6 +2588,7 @@ type PatchContentInput = {
|
|
|
2582
2588
|
};
|
|
2583
2589
|
//#endregion
|
|
2584
2590
|
//#region src/address/formatAddressSnapshot.d.ts
|
|
2591
|
+
/** Accepts camelCase API snapshots and legacy snake_case stored snapshots. */
|
|
2585
2592
|
declare const formatAddressSnapshotLines: (address: AddressSnapshot | null | undefined) => string[];
|
|
2586
2593
|
//#endregion
|
|
2587
2594
|
//#region src/billing/orderStatus.d.ts
|
|
@@ -2589,8 +2596,8 @@ declare const formatAddressSnapshotLines: (address: AddressSnapshot | null | und
|
|
|
2589
2596
|
declare const ORDER_FULFILLMENT_STATUSES: readonly OrderStatus[];
|
|
2590
2597
|
/** Statuses where checkout is finished and the guest may leave the JoAi thank-you page. */
|
|
2591
2598
|
declare const ORDER_POST_CHECKOUT_STATUSES: readonly OrderStatus[];
|
|
2592
|
-
/** Storefront/admin label kind — pickup remaps
|
|
2593
|
-
type OrderStatusDisplay = OrderStatus | 'preparing' | 'ready_for_pickup' | 'picked_up';
|
|
2599
|
+
/** Storefront/admin label kind — pickup remaps fulfillment steps; invoice remaps delivered → paid. */
|
|
2600
|
+
type OrderStatusDisplay = OrderStatus | 'new' | 'preparing' | 'ready_for_pickup' | 'picked_up' | 'paid';
|
|
2594
2601
|
declare const isOrderPending: (status: OrderStatus) => boolean;
|
|
2595
2602
|
declare const isOrderCanceled: (status: OrderStatus) => boolean;
|
|
2596
2603
|
declare const isOrderInFulfillment: (status: OrderStatus) => boolean;
|
|
@@ -2603,6 +2610,36 @@ declare const isPickupReady: (order: Pick<Order, "fulfillmentMethod"> & {
|
|
|
2603
2610
|
declare const isPickupOrderReady: (order: Pick<Order, "fulfillmentMethod" | "status"> & {
|
|
2604
2611
|
fulfillments?: Order["fulfillments"] | null;
|
|
2605
2612
|
}) => boolean;
|
|
2613
|
+
/** Next owner action for a local-pickup packing workstation. */
|
|
2614
|
+
type PickupNextAction = 'mark_ready' | 'mark_picked_up' | null;
|
|
2615
|
+
declare const getPickupNextAction: (order: Pick<Order, "fulfillmentMethod" | "status"> & {
|
|
2616
|
+
fulfillments?: Order["fulfillments"] | null;
|
|
2617
|
+
items?: Order["items"];
|
|
2618
|
+
}) => PickupNextAction;
|
|
2619
|
+
/** Allowed manual status targets for pickup (illegal jumps stay out). Ready/picked-up go via fulfillment. */
|
|
2620
|
+
declare const getPickupEditableStatuses: (status: OrderStatus) => OrderStatus[];
|
|
2621
|
+
/** Allowed manual status targets for shipping. Carrier ship stays on fulfillment; delivered closes the order. */
|
|
2622
|
+
declare const getShippingEditableStatuses: (status: OrderStatus) => OrderStatus[];
|
|
2623
|
+
/** Allowed manual status targets for invoice/service orders (no fulfillment method). */
|
|
2624
|
+
declare const getInvoiceEditableStatuses: (status: OrderStatus) => OrderStatus[];
|
|
2625
|
+
/** Manual owner-editable statuses for the order's fulfillment context. */
|
|
2626
|
+
declare const getEditableOrderStatuses: (status: OrderStatus, fulfillmentMethod?: string | null) => OrderStatus[];
|
|
2627
|
+
declare const canTransitionOrderStatus: (from: OrderStatus, to: OrderStatus, fulfillmentMethod?: string | null) => boolean;
|
|
2628
|
+
/** Owner fulfill dialog: payment → prepare → dispatch → complete. */
|
|
2629
|
+
type FulfillmentFlowStep = 'payment' | 'prepare' | 'dispatch' | 'complete';
|
|
2630
|
+
type FulfillmentFlowAction = 'notify_ready' | 'mark_collected' | 'mark_shipped' | 'mark_delivered' | null;
|
|
2631
|
+
declare const resolveFulfillmentFlowStep: (order: Pick<Order, "fulfillmentMethod" | "status"> & {
|
|
2632
|
+
fulfillments?: Order["fulfillments"] | null;
|
|
2633
|
+
}) => FulfillmentFlowStep | null;
|
|
2634
|
+
declare const getFulfillmentFlowAction: (order: Pick<Order, "fulfillmentMethod" | "status"> & {
|
|
2635
|
+
fulfillments?: Order["fulfillments"] | null;
|
|
2636
|
+
items?: Order["items"];
|
|
2637
|
+
}) => FulfillmentFlowAction;
|
|
2638
|
+
/** Stepper index 0–3: payment → prepare → dispatch → complete. */
|
|
2639
|
+
declare const getFulfillmentFlowStepperIndex: (step: FulfillmentFlowStep | null) => number;
|
|
2640
|
+
declare const canOpenFulfillmentFlow: (order: Pick<Order, "fulfillmentMethod" | "status" | "type"> & {
|
|
2641
|
+
items?: Order["items"];
|
|
2642
|
+
}) => boolean;
|
|
2606
2643
|
//#endregion
|
|
2607
2644
|
//#region src/commerce/helpers.d.ts
|
|
2608
2645
|
type CartLine = {
|
|
@@ -2610,6 +2647,8 @@ type CartLine = {
|
|
|
2610
2647
|
quantity: number;
|
|
2611
2648
|
};
|
|
2612
2649
|
declare const cartLineTotal: <T extends CartLine>(items: T[]) => number;
|
|
2650
|
+
/** Merchandise total after a discount (cents), never below zero. */
|
|
2651
|
+
declare const cartPayableTotal: <T extends CartLine>(items: T[], discountCents?: number) => number;
|
|
2613
2652
|
declare const isCompleteAddressInput: (address: Pick<AddressInput, "name" | "addressOne" | "city" | "zipCode" | "country">) => boolean;
|
|
2614
2653
|
//#endregion
|
|
2615
2654
|
//#region src/budget/types.d.ts
|
|
@@ -2830,6 +2869,13 @@ type Document = {
|
|
|
2830
2869
|
name: string;
|
|
2831
2870
|
content: string | null;
|
|
2832
2871
|
documentUrl: string | null;
|
|
2872
|
+
sourceUrl?: string | null;
|
|
2873
|
+
type?: string;
|
|
2874
|
+
meta?: Record<string, unknown> | null;
|
|
2875
|
+
slug?: string | null;
|
|
2876
|
+
isPublic?: boolean;
|
|
2877
|
+
url?: string | null;
|
|
2878
|
+
archivedAt?: string | null;
|
|
2833
2879
|
createdAt: string;
|
|
2834
2880
|
};
|
|
2835
2881
|
//#endregion
|
|
@@ -3689,15 +3735,6 @@ type OfficeEntity = {
|
|
|
3689
3735
|
};
|
|
3690
3736
|
//#endregion
|
|
3691
3737
|
//#region src/ogimage/types.d.ts
|
|
3692
|
-
type OgImageType = 'default' | 'article' | 'category' | 'listing' | 'brand';
|
|
3693
|
-
type OgImageParams = {
|
|
3694
|
-
type?: OgImageType;
|
|
3695
|
-
title: string;
|
|
3696
|
-
subtitle?: string;
|
|
3697
|
-
category?: string;
|
|
3698
|
-
categoryColor?: string;
|
|
3699
|
-
brandLogo?: string;
|
|
3700
|
-
};
|
|
3701
3738
|
declare const OG_IMAGE_WIDTH = 1200;
|
|
3702
3739
|
declare const OG_IMAGE_HEIGHT = 630;
|
|
3703
3740
|
declare const OG_IMAGE_CONFIG: {
|
|
@@ -3720,13 +3757,51 @@ declare const OgImageColors: {
|
|
|
3720
3757
|
};
|
|
3721
3758
|
//#endregion
|
|
3722
3759
|
//#region src/ogimage/helpers.d.ts
|
|
3723
|
-
type OgResourceType = 'meeting';
|
|
3760
|
+
type OgResourceType = 'meeting' | 'action' | 'app' | 'actions' | 'apps' | 'changelog' | 'agent' | 'agents' | 'skill' | 'flow' | 'blueprint' | 'digest' | 'digests' | 'store' | 'product' | 'service';
|
|
3724
3761
|
type OgResourceParams = {
|
|
3725
3762
|
meeting: {
|
|
3726
3763
|
code: string;
|
|
3727
3764
|
};
|
|
3765
|
+
action: {
|
|
3766
|
+
slug: string;
|
|
3767
|
+
locale?: string;
|
|
3768
|
+
};
|
|
3769
|
+
app: {
|
|
3770
|
+
slug: string;
|
|
3771
|
+
locale?: string;
|
|
3772
|
+
};
|
|
3773
|
+
actions: Record<string, never>;
|
|
3774
|
+
apps: Record<string, never>;
|
|
3775
|
+
changelog: Record<string, never>;
|
|
3776
|
+
agent: {
|
|
3777
|
+
id: string;
|
|
3778
|
+
locale?: string;
|
|
3779
|
+
};
|
|
3780
|
+
agents: Record<string, never>;
|
|
3781
|
+
skill: {
|
|
3782
|
+
id: string;
|
|
3783
|
+
};
|
|
3784
|
+
flow: {
|
|
3785
|
+
slug: string;
|
|
3786
|
+
};
|
|
3787
|
+
blueprint: {
|
|
3788
|
+
slug: string;
|
|
3789
|
+
};
|
|
3790
|
+
digest: {
|
|
3791
|
+
id: string;
|
|
3792
|
+
};
|
|
3793
|
+
digests: Record<string, never>;
|
|
3794
|
+
store: Record<string, never>;
|
|
3795
|
+
product: {
|
|
3796
|
+
teamname: string;
|
|
3797
|
+
slug: string;
|
|
3798
|
+
};
|
|
3799
|
+
service: {
|
|
3800
|
+
teamname: string;
|
|
3801
|
+
slug: string;
|
|
3802
|
+
};
|
|
3728
3803
|
};
|
|
3729
|
-
declare function ogImageUrl<T extends OgResourceType>(type: T, params: OgResourceParams[T]): string;
|
|
3804
|
+
declare function ogImageUrl<T extends OgResourceType>(type: T, params: OgResourceParams[T], env?: AppEnv): string;
|
|
3730
3805
|
//#endregion
|
|
3731
3806
|
//#region src/project/types.d.ts
|
|
3732
3807
|
type ProjectStatus = 'draft' | 'planned' | 'render-ready' | 'rendered' | 'composed' | 'exported';
|
|
@@ -4720,4 +4795,4 @@ type CliSessionStatus = {
|
|
|
4720
4795
|
meta: CliSessionMeta | null;
|
|
4721
4796
|
};
|
|
4722
4797
|
//#endregion
|
|
4723
|
-
export { AUTOMATION_SEND_CHANNELS, Achievement, Address, AddressCreatePayload, AddressInput, AddressSnapshot, type AddressType, AddressTypes, AddressUpdatePayload, Affiliate, AffiliateStatus, AffiliateTier, AffiliateTierName, Agent, AgentActionHistoryEntry, AgentCharacter, AgentDelegatable, AgentEngine, AgentExecuteHandler, AgentExecuteOptions, AgentGender, AgentMessageMeta, AgentMessageOptions, AgentPrivate, AgentSettings, AgentSetupTarget, AgentSimple, AgentToolingAccess, AgentTrustedActionRule, AgentWalletMode, AggregatedRoute, AiCostEntry, AiCostsResponse, AiCostsSummary, Alert, ApiToken, AppAccessRule, AppEnv, AppFile, AppFileType, AppIngestion, AppSetupTarget, AppendKvEntryResult, AppointmentAvailability, AppointmentAvailabilityService, AppointmentAvailabilitySlot, AppointmentBooking, AppointmentBookingContext, AppointmentPolicy, AppointmentPolicySync, AppointmentRequest, AppointmentSlot, Artifact, ArtifactBlock, ArtifactBlockType, ArtifactContactSummary, ArtifactCreatePayload, ArtifactDeliverIntegration, ArtifactDeliverPayload, ArtifactDelivery, ArtifactLink, ArtifactStatus, ArtifactType, ArtifactUpdatePayload, AuthUser, Automation, AutomationAction, AutomationActionConfig, AutomationActionInput, AutomationActionType, AutomationAudiencePreview, AutomationCreatePayload, AutomationEnrollment, AutomationEnrollmentChange, AutomationEnrollmentStatus, AutomationEnrollmentUpdatedPayload, AutomationSendChannel, AutomationSendChannelId, AutomationSkipReason, AutomationStats, AutomationTriggerConfig, AutomationTriggerType, AutomationUpdatePayload, BillingManageAccess, Blueprint, BlueprintOnboardingStep, BlueprintRedirect, BlueprintSettings, BlueprintShortcut, BlueprintTask, BlueprintTeam, BoardSummaryViewable, BookmarkEntry, BrandBackend, BrandIntegration, BrandIntegrationAction, BrandIntegrationProvider, BrandSearchHit, BrandSiteConfig, BrandSourceConfig, Budget, ByokProviderConfig, ByokProviderName, ByokProviders, CAMPAIGN_CHANNELS, CONTACT_MESSAGE_SEND_WARP, CalendarProvider, CalendarStatus, Campaign, CampaignApproval, CampaignAudiencePreview, CampaignAudiencePreviewPayload, CampaignCategory, CampaignChannel, CampaignChannelId, CampaignCreatePayload, CampaignRecipient, CampaignRecipientStatus, CampaignSkipReason, CampaignSkipReasons, CampaignStats, CampaignStatus, CampaignUpdatePayload, Card, Cart, CartItem, CartLine, Challenge, Challenges, ChangelogEntry, Character, ChatClientAction, ChatClientThought, ChatStreamData, ChatStreamEventType, CheckoutSnapshot, CheckoutSnapshotRequest, CliSessionMeta, CliSessionStatus, CommissionAgreement, Configuration, Contact, ContactActivity, ContactActivityAuthor, ContactActivityType, ContactConsent, ContactConsentStatus, ContactCreatePayload, ContactFormData, ContactHealth, ContactRelation, ContactRelationCategory, ContactRelationContact, ContactRelationDirection, ContactRelationPayload, ContactRelationType, ContactRelationUpdatePayload, ContactViewable, Content, ContentDefinition, ContentEntry, ContentField, ContentFieldType, ContentPatch, ContentStatus, ContentValue, ContentVersion, Contract, ContractCategoryDisplayNames, ContractCategoryName, ContractCodeMetadata, ContractEntity, ContractOnNetwork, ContractVersion, ContractsAddressConfig, CortexExecuteOptions, Coupon, CouponCondition, CouponRestrictedItem, CouponRestrictedItemType, CreateContentInput, CreateHookPayload, CreateInboundHookPayload, CreateInternalHookPayload, CreateKvFieldPayload, CreateWarpLinkedHookPayload, CreateWebHookPayload, DefaultCodeMetadata, DefaultInviteTeamRole, DemoFlow, DemoMessage, Desk, DeskItem, DeskItemRole, Document, EarnResponse, Earning, Element, ElementSpec, ElementType, ElementVariation, EmailProvider, EmbedStatus, EncryptionStatus, Entity, EntityDirectExecuteRequest, EntityProposable, EntitySignable, EntityTemplate, Experience, FeatureSetupTarget, FileInfo, FileMetadata, Flow, FlowCategory, FlowInputMapping, FlowStatus, FlowStep, Fulfillment, FulfillmentLocation, type FulfillmentMethod, FulfillmentMethods, type FulfillmentStatus, FulfillmentStatuses, GamificationData, GamificationEventType, Goal, GoalCreatePayload, GoalPriority, GoalProgressViewable, GoalStatus, GuestBuyer, HintOptions, HintPosition, Hook, HookSample, HookTrigger, HookTriggerCondition, HookTriggerInput, HttpService, IAppResponse, IHttpService, IRequestOptions, IngestionSourceType, IngestionStatus, Inquiry, InquiryStatus, InquiryType, Integration, IntegrationConnectionDetails, IntegrationDetails, IntegrationMeta, IntegrationType, Intent, InviteableTeamRoles, Item, ItemCreatePayload, ItemExecutionStatus, ItemPriority, ItemStatus, ItemUpdatePayload, ItemViewable, JoaiUrls, JsonValue, KvEntry, KvEntryPayload, KvField, KvFieldWithEntries, KvValue, Kyc, KycStatus, Link, LinkCreatePayload, LinkScanHistory, LinkStats, LinkUpdatePayload, LinkVariation, LinkVariationBatchCreatePayload, LinkVariationCreatePayload, LocalAgentWallet, LoyaltyAccount, LoyaltyMember, LoyaltyNextTier, LoyaltyProgram, LoyaltyPromotion, LoyaltyReward, LoyaltyStatus, LoyaltyTier, LoyaltyTierInfo, LoyaltyTransaction, McpToolCall, McpToolCallBroadcast, McpToolCallStatus, Media, MediaAspectRatio, MediaAttributes, MediaItems, MediaLibraryAttributes, MediaMime, Meeting, MeetingConferenceProvider, MeetingFeature, MeetingJoinInfo, MeetingJoinTeam, MeetingParticipant, MeetingSessionState, MeetingSpeakerAssignment, MeetingStatus, MeetingSummary, MeetingTranscriptEntry, MeetingUsage, Memory, Message, MessageId, MessageRole, Metric, MetricSource, MetricsResult, Milestone, MilestoneType, Mission, MissionBudget, MissionCreatePayload, MissionPlan, MissionPriority, MissionSchedule, MissionStatus, MissionViewable, MollieTerminalPaymentResult, MultimodalContent, MultimodalFile, NATIVE_AUTH_TOKEN_PARAM, NativeApp, NativeApps, Notification, NotificationAction, NotificationAgent, NotificationChannel, NotificationSetting, OG_IMAGE_CONFIG, OG_IMAGE_HEIGHT, OG_IMAGE_WIDTH, ORDER_FULFILLMENT_STATUSES, ORDER_POST_CHECKOUT_STATUSES, OUTBOUND_CHANNELS, OfficeAgent, OfficeEntity, OfficeEntityKind, OfficeLiveOverrides, OfficeMember, OfficeSnapshot, OfficeStatus, OfficeStatusFilter, OfficeTypeFilter, OgImageColors, OgImageParams, OgImageType, Order, OrderConfigurationItem, OrderContext, OrderItem, OrderPriceMode, OrderSource, OrderStatus, OrderStatusDisplay, OrderType, OutboundChannel, OutboundChannelId, PLATFORM_CURRENCY, PaginatedResponse, Pass, PatchContentInput, PaymentAccount, PaymentAccountOnboarding, PaymentProvider, PayoutEntry, PeriodTypeLabels, PeriodTypeOptions, PermissionConfigType, PermissionPresetName, PermissionPresetNames, PersonaQuestionable, Plan, PlanBenefit, PlanExtra, PlanFeature, PlanInterval, PolicyMethod, PolicySetting, PricingModel, Product, ProductDiscount, ProductMeta, ProductPieces, ProductRating, ProductRelation, ProductRelationType, ProductVariation, ProductVariationMeta, ProductVariationType, ProgramSettings, Project, ProjectAspectRatio, ProjectAssembly, ProjectCaptionStyle, ProjectClipCandidate, ProjectClips, ProjectExport, ProjectExportAsset, ProjectExportResponse, ProjectImages, ProjectInputAssistIntent, ProjectInputAssistResponse, ProjectMutation, ProjectOutputPreset, ProjectOutputType, ProjectPlan, ProjectRender, ProjectRenderMode, ProjectSelectedClip, ProjectShot, ProjectSoundtrack, ProjectSourceMedia, ProjectStatus, ProjectStudioHistoryEntry, ProjectStudioQuestion, ProjectStudioResponse, ProjectStudioStage, ProjectStudioState, ProjectStudioSummary, ProjectStyleDirection, ProjectTranscript, ProjectTranscriptSegment, Proposal, ProposalAction, ProposalActionPayment, ProposalActionPaymentSerializable, ProposalActionSerializable, ProposalPollOption, ProposalStatus, PublicFormResults, PurchaseOptions, PurchaseResult, RampProvider, RampProviderInfo, Reactions, RecentExperience, RedeemResponse, Reminder, Return, type ReturnStatus, ReturnStatuses, ReturnUpdateStatus, ReturnUpdateStatuses, Room, RoomId, RoomKind, ScInfo, SchedulePreset, SecretAuthorizable, SecretSettable, Segment, SegmentCondition, SegmentConditionType, SegmentCountPayload, SegmentCountResult, SegmentCreatePayload, SegmentGroup, SendableActivityUpdate, SendableAgentAction, SendableAgentMessage, SendableAgentThought, SendableMedia, SendableUserMessage, Service, SetKvEntryResult, SharedSocialPost, ShippingRate, ShippingZone, Shortcut, Site, SiteAgent, SiteBrand, SiteRoute, SiteTeam, SiteType, Skill, SkillMediaBindingRole, SkillMediaBindingRoleValue, SkillScope, SkillScopeValue, SkillType, SkillTypeValue, SocialAuthProvider, SocialBot, SocialPlatform, SocialPost, SocialPostConnection, SocialPostCreatePayload, SocialPostGenerateCaptionPayload, SocialPostGeneratedCaption, SocialPostPlatform, SocialPostStatus, SocialPostUpdatePayload, StampResponse, StoreAgent, StoreCheckoutItem, StoreData, StoreEntityType, StoreInfo, StoreItem, StoreListing, StorePriceTier, StorePricing, StorePurchasable, StorePurchaseResult, Streak, Subscription, SubscriptionDelivery, SubscriptionInterval, SubscriptionPlan, SubscriptionStatus, Swarm, Tag, TagType, Task, Team, TeamAccessCatalog, TeamAccessConfig, TeamBrand, TeamCategory, TeamCurrencySource, TeamEarning, TeamEarningsBalance, TeamFeature, TeamFeatureAccess, TeamFeatureArea, TeamFeatureUsage, TeamManageAccess, TeamMember, TeamMeta, TeamOrderStats, TeamPayout, TeamPayoutAddress, TeamPlace, TeamPrivate, TeamSettings, TeamUsage, TeamViewAccess, TerminalConnectionToken, TerminalPaymentIntent, Tier, TierFeature, TierName, ToggleKvFieldResult, TranscriptEntry, TranscriptionCorrection, TranscriptionResponse, TranslatableValue, UNIFIED_MCP_SERVER_NAME, Update, UpdateCreatePayload, UpdateRelation, UpdateStats, UpdateStatus, UpdateType, UpdateUpdatePayload, Upgrade, UpgradeSourceType, UpgradeStatus, User, UserInterest, UserMode, type UserPermission, UserPermissions, UserPrivate, type UserRole, UserRoles, UserSettings, UserSocialAccount, UserStats, VolumePrice, Wallet, WalletList, WarpApprovable, WarpBackend, WarpBackendStatus, WarpBatchItem, WarpBatchable, WarpCloudExecutable, WarpCreateable, WarpExecutable, WarpExecutionBackend, WarpExtras, WarpExtrasFaq, WarpInputable, WarpScreenshotVariant, WarpSearchHit, WarpSelectable, WarpSelectableDetails, WarpSuggestion, WarpTestable, WarpViewable, WebHookTriggerEvent, WorkspaceCloudFile, WorkspaceContext, WorkspaceInfo, WorkspaceSettings, XIntegrationStatus, abbreviateNumber, addressTypeValues, automationSendChannel, buildAgentMcpServerName, buildAgentSetupClipboardText, buildAppSetupClipboardText, buildFeatureSetupClipboardText, buildMcpServerName, cartLineTotal, createCursorMcpInstallLink, defaultInviteTeamRole, formatAddressSnapshotLines, fulfillmentMethodValues, fulfillmentStatusValues, getAgentSetupPromptUrl, getAgentsBaseUrl, getApiBaseUrl, getAppBaseUrl, getAssetAppLogoUrl, getAssetChainLogoUrl, getAssetPartnerLogoUrl, getAssetTokenLogoUrl, getAssetWalletLogoUrl, getCortexBaseUrl, getDigestBaseUrl, getFormsBaseUrl, getLoginUrl, getMcpServerAgentUrl, getMcpServerUrl, getSiteUrl, getSitesBaseUrl, getSitesRootDomain, getStoreBaseUrl, getWarpScreenshotUrl, hasAllPermissions, hasAllTeamPermissions, hasAnyPermissions, hasPermission, hasTeamPermission, integrationSlugForChannel, inviteableTeamRoles, isAutomationSendChannelId, isCampaignChannelId, isCompleteAddressInput, isContactMessageAction, isContactMessageWarpId, isFileFormatAudio, isFileFormatImage, isFileFormatVideo, isNativeApp, isNativeAppAccessible, isNativeAppGated, isNativeAppLocked, isOrderCanceled, isOrderInFulfillment, isOrderPending, isOrderPostCheckout, isPickupOrderReady, isPickupReady, isTeamFeatureAccessible, isTeamFeatureGated, isTeamFeatureLocked, isUnifiedMcpUrl, isUserRole, localize, nativeAppSlugs, normalizeAutomationActionType, ogImageUrl, outboundChannel, permissionPresetRules, resolveAccessCatalog, resolveAgentMcpUrl, resolveConnectMcpUrl, resolveOrderStatusDisplay, resolveTeamCurrency, resolveWarpText, returnStatusValues, returnUpdateStatusValues, sanitizeAlphanumeric, sanitizeNumeric, slugifyMcpSegment, teamCategories, toCurrencyDisplay, toHexEncodedNonce, toNameInitials, toNftId, toPreviewText, userPermissionValues, userRoleValues, withRetry };
|
|
4798
|
+
export { AUTOMATION_SEND_CHANNELS, Achievement, Address, AddressCreatePayload, AddressInput, AddressSnapshot, type AddressType, AddressTypes, AddressUpdatePayload, Affiliate, AffiliateStatus, AffiliateTier, AffiliateTierName, Agent, AgentActionHistoryEntry, AgentCharacter, AgentDelegatable, AgentEngine, AgentExecuteHandler, AgentExecuteOptions, AgentGender, AgentMessageMeta, AgentMessageOptions, AgentPrivate, AgentSettings, AgentSetupTarget, AgentSimple, AgentToolingAccess, AgentTrustedActionRule, AgentWalletMode, AggregatedRoute, AiCostEntry, AiCostsResponse, AiCostsSummary, Alert, ApiToken, AppAccessRule, AppEnv, AppFile, AppFileType, AppIngestion, AppSetupTarget, AppendKvEntryResult, AppointmentAvailability, AppointmentAvailabilityService, AppointmentAvailabilitySlot, AppointmentBooking, AppointmentBookingContext, AppointmentPolicy, AppointmentPolicySync, AppointmentRequest, AppointmentSlot, Artifact, ArtifactBlock, ArtifactBlockType, ArtifactContactSummary, ArtifactCreatePayload, ArtifactDeliverIntegration, ArtifactDeliverPayload, ArtifactDelivery, ArtifactLink, ArtifactStatus, ArtifactType, ArtifactUpdatePayload, AuthUser, Automation, AutomationAction, AutomationActionConfig, AutomationActionInput, AutomationActionType, AutomationAudiencePreview, AutomationCreatePayload, AutomationEnrollment, AutomationEnrollmentChange, AutomationEnrollmentStatus, AutomationEnrollmentUpdatedPayload, AutomationSendChannel, AutomationSendChannelId, AutomationSkipReason, AutomationStats, AutomationTriggerConfig, AutomationTriggerType, AutomationUpdatePayload, BillingManageAccess, Blueprint, BlueprintOnboardingStep, BlueprintRedirect, BlueprintSettings, BlueprintShortcut, BlueprintTask, BlueprintTeam, BoardSummaryViewable, BookmarkEntry, BrandBackend, BrandIntegration, BrandIntegrationAction, BrandIntegrationProvider, BrandSearchHit, BrandSiteConfig, BrandSourceConfig, Budget, ByokProviderConfig, ByokProviderName, ByokProviders, CAMPAIGN_CHANNELS, CONTACT_MESSAGE_SEND_WARP, CalendarProvider, CalendarStatus, Campaign, CampaignApproval, CampaignAudiencePreview, CampaignAudiencePreviewPayload, CampaignCategory, CampaignChannel, CampaignChannelId, CampaignCreatePayload, CampaignRecipient, CampaignRecipientStatus, CampaignSkipReason, CampaignSkipReasons, CampaignStats, CampaignStatus, CampaignUpdatePayload, Card, Cart, CartItem, CartLine, Challenge, Challenges, ChangelogEntry, Character, ChatClientAction, ChatClientThought, ChatStreamData, ChatStreamEventType, CheckoutSnapshot, CheckoutSnapshotRequest, CliSessionMeta, CliSessionStatus, CommissionAgreement, Configuration, Contact, ContactActivity, ContactActivityAuthor, ContactActivityType, ContactConsent, ContactConsentStatus, ContactCreatePayload, ContactFormData, ContactHealth, ContactRelation, ContactRelationCategory, ContactRelationContact, ContactRelationDirection, ContactRelationPayload, ContactRelationType, ContactRelationUpdatePayload, ContactViewable, Content, ContentDefinition, ContentEntry, ContentField, ContentFieldType, ContentPatch, ContentStatus, ContentValue, ContentVersion, Contract, ContractCategoryDisplayNames, ContractCategoryName, ContractCodeMetadata, ContractEntity, ContractOnNetwork, ContractVersion, ContractsAddressConfig, CortexExecuteOptions, Coupon, CouponCondition, CouponRestrictedItem, CouponRestrictedItemType, CreateContentInput, CreateHookPayload, CreateInboundHookPayload, CreateInternalHookPayload, CreateKvFieldPayload, CreateWarpLinkedHookPayload, CreateWebHookPayload, DefaultCodeMetadata, DefaultInviteTeamRole, DemoFlow, DemoMessage, Desk, DeskItem, DeskItemRole, Document, EarnResponse, Earning, Element, ElementSpec, ElementType, ElementVariation, EmailProvider, EmbedStatus, EncryptionStatus, Entity, EntityDirectExecuteRequest, EntityProposable, EntitySignable, EntityTemplate, Experience, FeatureSetupTarget, FileInfo, FileMetadata, Flow, FlowCategory, FlowInputMapping, FlowStatus, FlowStep, Fulfillment, FulfillmentFlowAction, FulfillmentFlowStep, FulfillmentLocation, type FulfillmentMethod, FulfillmentMethods, type FulfillmentStatus, FulfillmentStatuses, GamificationData, GamificationEventType, Goal, GoalCreatePayload, GoalPriority, GoalProgressViewable, GoalStatus, GuestBuyer, HintOptions, HintPosition, Hook, HookSample, HookTrigger, HookTriggerCondition, HookTriggerInput, HttpService, IAppResponse, IHttpService, IRequestOptions, IngestionSourceType, IngestionStatus, Inquiry, InquiryStatus, InquiryType, Integration, IntegrationConnectionDetails, IntegrationDetails, IntegrationMeta, IntegrationType, Intent, InviteableTeamRoles, Item, ItemCreatePayload, ItemExecutionStatus, ItemPriority, ItemStatus, ItemUpdatePayload, ItemViewable, JoaiUrls, JsonValue, KvEntry, KvEntryPayload, KvField, KvFieldWithEntries, KvValue, Kyc, KycStatus, Link, LinkCreatePayload, LinkScanHistory, LinkStats, LinkUpdatePayload, LinkVariation, LinkVariationBatchCreatePayload, LinkVariationCreatePayload, LocalAgentWallet, LoyaltyAccount, LoyaltyMember, LoyaltyNextTier, LoyaltyProgram, LoyaltyPromotion, LoyaltyReward, LoyaltyStatus, LoyaltyTier, LoyaltyTierInfo, LoyaltyTransaction, McpToolCall, McpToolCallBroadcast, McpToolCallStatus, Media, MediaAspectRatio, MediaAttributes, MediaItems, MediaLibraryAttributes, MediaMime, Meeting, MeetingConferenceProvider, MeetingFeature, MeetingJoinInfo, MeetingJoinTeam, MeetingParticipant, MeetingSessionState, MeetingSpeakerAssignment, MeetingStatus, MeetingSummary, MeetingTranscriptEntry, MeetingUsage, Memory, Message, MessageId, MessageRole, Metric, MetricSource, MetricsResult, Milestone, MilestoneType, Mission, MissionBudget, MissionCreatePayload, MissionPlan, MissionPriority, MissionSchedule, MissionStatus, MissionViewable, MollieTerminalPaymentResult, MultimodalContent, MultimodalFile, NATIVE_AUTH_TOKEN_PARAM, NativeApp, NativeApps, Notification, NotificationAction, NotificationAgent, NotificationChannel, NotificationSetting, OG_IMAGE_CONFIG, OG_IMAGE_HEIGHT, OG_IMAGE_WIDTH, ORDER_FULFILLMENT_STATUSES, ORDER_POST_CHECKOUT_STATUSES, OUTBOUND_CHANNELS, OfficeAgent, OfficeEntity, OfficeEntityKind, OfficeLiveOverrides, OfficeMember, OfficeSnapshot, OfficeStatus, OfficeStatusFilter, OfficeTypeFilter, OgImageColors, Order, OrderConfigurationItem, OrderContext, OrderItem, OrderPriceMode, OrderSource, OrderStatus, OrderStatusDisplay, OrderType, OutboundChannel, OutboundChannelId, PLATFORM_CURRENCY, PaginatedResponse, Pass, PatchContentInput, PaymentAccount, PaymentAccountOnboarding, PaymentProvider, PayoutEntry, PeriodTypeLabels, PeriodTypeOptions, PermissionConfigType, PermissionPresetName, PermissionPresetNames, PersonaQuestionable, PickupNextAction, Plan, PlanBenefit, PlanExtra, PlanFeature, PlanInterval, PolicyMethod, PolicySetting, PricingModel, Product, ProductDiscount, ProductMeta, ProductPieces, ProductRating, ProductRelation, ProductRelationType, ProductVariation, ProductVariationMeta, ProductVariationType, ProgramSettings, Project, ProjectAspectRatio, ProjectAssembly, ProjectCaptionStyle, ProjectClipCandidate, ProjectClips, ProjectExport, ProjectExportAsset, ProjectExportResponse, ProjectImages, ProjectInputAssistIntent, ProjectInputAssistResponse, ProjectMutation, ProjectOutputPreset, ProjectOutputType, ProjectPlan, ProjectRender, ProjectRenderMode, ProjectSelectedClip, ProjectShot, ProjectSoundtrack, ProjectSourceMedia, ProjectStatus, ProjectStudioHistoryEntry, ProjectStudioQuestion, ProjectStudioResponse, ProjectStudioStage, ProjectStudioState, ProjectStudioSummary, ProjectStyleDirection, ProjectTranscript, ProjectTranscriptSegment, Proposal, ProposalAction, ProposalActionPayment, ProposalActionPaymentSerializable, ProposalActionSerializable, ProposalPollOption, ProposalStatus, PublicFormResults, PurchaseOptions, PurchaseResult, RampProvider, RampProviderInfo, Reactions, RecentExperience, RedeemResponse, Reminder, Return, type ReturnStatus, ReturnStatuses, ReturnUpdateStatus, ReturnUpdateStatuses, Room, RoomId, RoomKind, ScInfo, SchedulePreset, SecretAuthorizable, SecretSettable, Segment, SegmentCondition, SegmentConditionType, SegmentCountPayload, SegmentCountResult, SegmentCreatePayload, SegmentGroup, SendableActivityUpdate, SendableAgentAction, SendableAgentMessage, SendableAgentThought, SendableMedia, SendableUserMessage, Service, SetKvEntryResult, SharedSocialPost, ShippingRate, ShippingZone, Shortcut, Site, SiteAgent, SiteBrand, SiteRoute, SiteTeam, SiteType, Skill, SkillMediaBindingRole, SkillMediaBindingRoleValue, SkillScope, SkillScopeValue, SkillType, SkillTypeValue, SocialAuthProvider, SocialBot, SocialPlatform, SocialPost, SocialPostConnection, SocialPostCreatePayload, SocialPostGenerateCaptionPayload, SocialPostGeneratedCaption, SocialPostPlatform, SocialPostStatus, SocialPostUpdatePayload, StampResponse, StoreAgent, StoreCheckoutItem, StoreData, StoreEntityType, StoreInfo, StoreItem, StoreListing, StorePriceTier, StorePricing, StorePurchasable, StorePurchaseResult, Streak, Subscription, SubscriptionDelivery, SubscriptionInterval, SubscriptionPlan, SubscriptionStatus, Swarm, Tag, TagType, Task, Team, TeamAccessCatalog, TeamAccessConfig, TeamBrand, TeamCategory, TeamCurrencySource, TeamEarning, TeamEarningsBalance, TeamFeature, TeamFeatureAccess, TeamFeatureArea, TeamFeatureUsage, TeamManageAccess, TeamMember, TeamMeta, TeamOrderStats, TeamPayout, TeamPayoutAddress, TeamPlace, TeamPrivate, TeamSettings, TeamUsage, TeamViewAccess, TerminalConnectionToken, TerminalPaymentIntent, Tier, TierFeature, TierName, ToggleKvFieldResult, TranscriptEntry, TranscriptionCorrection, TranscriptionResponse, TranslatableValue, UNIFIED_MCP_SERVER_NAME, Update, UpdateCreatePayload, UpdateRelation, UpdateStats, UpdateStatus, UpdateType, UpdateUpdatePayload, Upgrade, UpgradeSourceType, UpgradeStatus, User, UserInterest, UserMode, type UserPermission, UserPermissions, UserPrivate, type UserRole, UserRoles, UserSettings, UserSocialAccount, UserStats, VolumePrice, Wallet, WalletList, WarpApprovable, WarpBackend, WarpBackendStatus, WarpBatchItem, WarpBatchable, WarpCloudExecutable, WarpCreateable, WarpExecutable, WarpExecutionBackend, WarpExtras, WarpExtrasFaq, WarpInputable, WarpScreenshotVariant, WarpSearchHit, WarpSelectable, WarpSelectableDetails, WarpSuggestion, WarpTestable, WarpViewable, WebHookTriggerEvent, WorkspaceCloudFile, WorkspaceContext, WorkspaceInfo, WorkspaceSettings, XIntegrationStatus, abbreviateNumber, addressTypeValues, automationSendChannel, buildAgentMcpServerName, buildAgentSetupClipboardText, buildAppSetupClipboardText, buildFeatureSetupClipboardText, buildMcpServerName, canOpenFulfillmentFlow, canTransitionOrderStatus, cartLineTotal, cartPayableTotal, createCursorMcpInstallLink, defaultInviteTeamRole, formatAddressSnapshotLines, fulfillmentMethodValues, fulfillmentStatusValues, getAgentSetupPromptUrl, getAgentsBaseUrl, getApiBaseUrl, getAppBaseUrl, getAssetAppLogoUrl, getAssetChainLogoUrl, getAssetPartnerLogoUrl, getAssetTokenLogoUrl, getAssetWalletLogoUrl, getCortexBaseUrl, getDigestBaseUrl, getEditableOrderStatuses, getFormsBaseUrl, getFulfillmentFlowAction, getFulfillmentFlowStepperIndex, getGenBaseUrl, getInvoiceEditableStatuses, getLoginUrl, getMcpServerAgentUrl, getMcpServerUrl, getPickupEditableStatuses, getPickupNextAction, getShippingEditableStatuses, getSiteUrl, getSitesBaseUrl, getSitesRootDomain, getStoreBaseUrl, getWarpScreenshotUrl, hasAllPermissions, hasAllTeamPermissions, hasAnyPermissions, hasPermission, hasTeamPermission, integrationSlugForChannel, inviteableTeamRoles, isAutomationSendChannelId, isCampaignChannelId, isCompleteAddressInput, isContactMessageAction, isContactMessageWarpId, isFileFormatAudio, isFileFormatImage, isFileFormatVideo, isNativeApp, isNativeAppAccessible, isNativeAppGated, isNativeAppLocked, isOrderCanceled, isOrderInFulfillment, isOrderPending, isOrderPostCheckout, isPickupOrderReady, isPickupReady, isTeamFeatureAccessible, isTeamFeatureGated, isTeamFeatureLocked, isUnifiedMcpUrl, isUserRole, localize, nativeAppSlugs, normalizeAutomationActionType, ogImageUrl, outboundChannel, permissionPresetRules, resolveAccessCatalog, resolveAgentMcpUrl, resolveConnectMcpUrl, resolveFulfillmentFlowStep, resolveOrderStatusDisplay, resolveTeamCurrency, resolveWarpText, returnStatusValues, returnUpdateStatusValues, sanitizeAlphanumeric, sanitizeNumeric, slugifyMcpSegment, teamCategories, toCurrencyDisplay, toHexEncodedNonce, toNameInitials, toNftId, toPreviewText, userPermissionValues, userRoleValues, withRetry };
|
package/dist/index.mjs
CHANGED
|
@@ -42,6 +42,12 @@ const getAgentsBaseUrl = (env) => {
|
|
|
42
42
|
if (env === "testnet") return "https://testnet-agents.joai.ai";
|
|
43
43
|
return "https://agents.joai.ai";
|
|
44
44
|
};
|
|
45
|
+
const getGenBaseUrl = (env) => {
|
|
46
|
+
if (env === "local") return "http://localhost:3011";
|
|
47
|
+
if (env === "devnet") return "https://devnet-gen.joai.ai";
|
|
48
|
+
if (env === "testnet") return "https://testnet-gen.joai.ai";
|
|
49
|
+
return "https://gen.joai.ai";
|
|
50
|
+
};
|
|
45
51
|
const getMcpServerUrl = (env) => `${getCortexBaseUrl(env)}/mcp`;
|
|
46
52
|
const getMcpServerAgentUrl = (env, agent) => `${getCortexBaseUrl(env)}/mcp/agents/${agent}`;
|
|
47
53
|
const getSitesBaseUrl = (env) => {
|
|
@@ -366,16 +372,22 @@ const AddressTypes = {
|
|
|
366
372
|
const addressTypeValues = Object.values(AddressTypes);
|
|
367
373
|
//#endregion
|
|
368
374
|
//#region src/address/formatAddressSnapshot.ts
|
|
375
|
+
const pickLine = (...values) => values.find((value) => typeof value === "string" && value.trim().length > 0);
|
|
376
|
+
/** Accepts camelCase API snapshots and legacy snake_case stored snapshots. */
|
|
369
377
|
const formatAddressSnapshotLines = (address) => {
|
|
370
378
|
if (!address) return [];
|
|
379
|
+
const loose = address;
|
|
380
|
+
const addressOne = pickLine(address.addressOne, loose.address_one);
|
|
381
|
+
const addressTwo = pickLine(address.addressTwo, loose.address_two);
|
|
382
|
+
const postalCity = [pickLine(address.zipCode, loose.zip_code), pickLine(address.city)].filter(Boolean).join(" ");
|
|
371
383
|
return [
|
|
372
|
-
address.company,
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
address.state,
|
|
377
|
-
address.country
|
|
378
|
-
].filter((line) => !!line
|
|
384
|
+
pickLine(address.company),
|
|
385
|
+
addressOne,
|
|
386
|
+
addressTwo,
|
|
387
|
+
postalCity || void 0,
|
|
388
|
+
pickLine(address.state),
|
|
389
|
+
pickLine(address.country)
|
|
390
|
+
].filter((line) => !!line);
|
|
379
391
|
};
|
|
380
392
|
//#endregion
|
|
381
393
|
//#region src/billing/orderStatus.ts
|
|
@@ -399,10 +411,12 @@ const isOrderInFulfillment = (status) => ORDER_FULFILLMENT_STATUSES.includes(sta
|
|
|
399
411
|
const isOrderPostCheckout = (status) => ORDER_POST_CHECKOUT_STATUSES.includes(status);
|
|
400
412
|
const resolveOrderStatusDisplay = (status, fulfillmentMethod) => {
|
|
401
413
|
if (fulfillmentMethod === "pickup") {
|
|
414
|
+
if (status === "pending") return "new";
|
|
402
415
|
if (status === "confirmed" || status === "processing") return "preparing";
|
|
403
416
|
if (status === "shipped") return "ready_for_pickup";
|
|
404
417
|
if (status === "delivered") return "picked_up";
|
|
405
418
|
}
|
|
419
|
+
if (!fulfillmentMethod && status === "delivered") return "paid";
|
|
406
420
|
return status;
|
|
407
421
|
};
|
|
408
422
|
const isPickupReady = (order) => order.fulfillmentMethod === "pickup" && (order.fulfillments ?? []).some((fulfillment) => fulfillment.status === "ready_for_pickup");
|
|
@@ -416,6 +430,122 @@ const isPickupOrderReady = (order) => {
|
|
|
416
430
|
if (fulfillments.length === 0) return true;
|
|
417
431
|
return !fulfillments.some((fulfillment) => fulfillment.status === "delivered");
|
|
418
432
|
};
|
|
433
|
+
const getPickupNextAction = (order) => {
|
|
434
|
+
if (order.fulfillmentMethod !== "pickup") return null;
|
|
435
|
+
if (order.status === "delivered" || order.status === "canceled" || order.status === "returned") return null;
|
|
436
|
+
if (isPickupOrderReady(order) || order.status === "shipped") return "mark_picked_up";
|
|
437
|
+
if (isOrderInFulfillment(order.status) && (order.items ?? []).some((item) => !item.digital)) return "mark_ready";
|
|
438
|
+
return null;
|
|
439
|
+
};
|
|
440
|
+
/** Allowed manual status targets for pickup (illegal jumps stay out). Ready/picked-up go via fulfillment. */
|
|
441
|
+
const getPickupEditableStatuses = (status) => {
|
|
442
|
+
if (status === "pending") return ["pending", "canceled"];
|
|
443
|
+
if (status === "confirmed") return [
|
|
444
|
+
"confirmed",
|
|
445
|
+
"processing",
|
|
446
|
+
"canceled"
|
|
447
|
+
];
|
|
448
|
+
if (status === "processing") return ["processing", "canceled"];
|
|
449
|
+
if (status === "shipped") return ["shipped", "canceled"];
|
|
450
|
+
if (status === "delivered") return ["delivered"];
|
|
451
|
+
if (status === "canceled") return ["canceled"];
|
|
452
|
+
if (status === "returned") return ["returned"];
|
|
453
|
+
return [status];
|
|
454
|
+
};
|
|
455
|
+
/** Allowed manual status targets for shipping. Carrier ship stays on fulfillment; delivered closes the order. */
|
|
456
|
+
const getShippingEditableStatuses = (status) => {
|
|
457
|
+
if (status === "pending") return ["pending", "canceled"];
|
|
458
|
+
if (status === "confirmed") return [
|
|
459
|
+
"confirmed",
|
|
460
|
+
"processing",
|
|
461
|
+
"delivered",
|
|
462
|
+
"canceled"
|
|
463
|
+
];
|
|
464
|
+
if (status === "processing") return [
|
|
465
|
+
"processing",
|
|
466
|
+
"delivered",
|
|
467
|
+
"canceled"
|
|
468
|
+
];
|
|
469
|
+
if (status === "shipped") return [
|
|
470
|
+
"shipped",
|
|
471
|
+
"delivered",
|
|
472
|
+
"canceled"
|
|
473
|
+
];
|
|
474
|
+
if (status === "delivered") return ["delivered"];
|
|
475
|
+
if (status === "canceled") return ["canceled"];
|
|
476
|
+
if (status === "returned") return ["returned"];
|
|
477
|
+
return [status];
|
|
478
|
+
};
|
|
479
|
+
/** Allowed manual status targets for invoice/service orders (no fulfillment method). */
|
|
480
|
+
const getInvoiceEditableStatuses = (status) => {
|
|
481
|
+
if (status === "pending") return [
|
|
482
|
+
"pending",
|
|
483
|
+
"delivered",
|
|
484
|
+
"canceled"
|
|
485
|
+
];
|
|
486
|
+
if (status === "confirmed") return [
|
|
487
|
+
"confirmed",
|
|
488
|
+
"delivered",
|
|
489
|
+
"canceled"
|
|
490
|
+
];
|
|
491
|
+
if (status === "processing") return [
|
|
492
|
+
"processing",
|
|
493
|
+
"delivered",
|
|
494
|
+
"canceled"
|
|
495
|
+
];
|
|
496
|
+
if (status === "shipped") return [
|
|
497
|
+
"shipped",
|
|
498
|
+
"delivered",
|
|
499
|
+
"canceled"
|
|
500
|
+
];
|
|
501
|
+
if (status === "delivered" || status === "completed") return [status];
|
|
502
|
+
if (status === "canceled") return ["canceled"];
|
|
503
|
+
if (status === "returned") return ["returned"];
|
|
504
|
+
return [status];
|
|
505
|
+
};
|
|
506
|
+
/** Manual owner-editable statuses for the order's fulfillment context. */
|
|
507
|
+
const getEditableOrderStatuses = (status, fulfillmentMethod) => {
|
|
508
|
+
if (fulfillmentMethod === "pickup") return getPickupEditableStatuses(status);
|
|
509
|
+
if (fulfillmentMethod === "shipping") return getShippingEditableStatuses(status);
|
|
510
|
+
return getInvoiceEditableStatuses(status);
|
|
511
|
+
};
|
|
512
|
+
const canTransitionOrderStatus = (from, to, fulfillmentMethod) => {
|
|
513
|
+
if (from === to) return true;
|
|
514
|
+
return getEditableOrderStatuses(from, fulfillmentMethod).includes(to);
|
|
515
|
+
};
|
|
516
|
+
const resolveFulfillmentFlowStep = (order) => {
|
|
517
|
+
if (!order.fulfillmentMethod) return null;
|
|
518
|
+
if (order.status === "canceled" || order.status === "returned") return "complete";
|
|
519
|
+
if (order.status === "pending") return "payment";
|
|
520
|
+
if (order.status === "delivered" || order.status === "completed") return "complete";
|
|
521
|
+
if (order.fulfillmentMethod === "pickup") {
|
|
522
|
+
if (isPickupOrderReady(order) || order.status === "shipped") return "dispatch";
|
|
523
|
+
return "prepare";
|
|
524
|
+
}
|
|
525
|
+
if (order.status === "shipped") return "dispatch";
|
|
526
|
+
return "prepare";
|
|
527
|
+
};
|
|
528
|
+
const getFulfillmentFlowAction = (order) => {
|
|
529
|
+
const step = resolveFulfillmentFlowStep(order);
|
|
530
|
+
if (step === "prepare" && isOrderInFulfillment(order.status)) {
|
|
531
|
+
if (!(order.items ?? []).some((item) => !item.digital)) return null;
|
|
532
|
+
return order.fulfillmentMethod === "pickup" ? "notify_ready" : "mark_shipped";
|
|
533
|
+
}
|
|
534
|
+
if (step === "dispatch") return order.fulfillmentMethod === "pickup" ? "mark_collected" : "mark_delivered";
|
|
535
|
+
return null;
|
|
536
|
+
};
|
|
537
|
+
/** Stepper index 0–3: payment → prepare → dispatch → complete. */
|
|
538
|
+
const getFulfillmentFlowStepperIndex = (step) => {
|
|
539
|
+
if (step === "prepare") return 1;
|
|
540
|
+
if (step === "dispatch") return 2;
|
|
541
|
+
if (step === "complete") return 3;
|
|
542
|
+
return 0;
|
|
543
|
+
};
|
|
544
|
+
const canOpenFulfillmentFlow = (order) => {
|
|
545
|
+
if (!order.fulfillmentMethod || order.type !== "order") return false;
|
|
546
|
+
if (order.status === "canceled" || order.status === "returned") return false;
|
|
547
|
+
return (order.items ?? []).some((item) => !item.digital);
|
|
548
|
+
};
|
|
419
549
|
//#endregion
|
|
420
550
|
//#region src/commerce/enums.ts
|
|
421
551
|
const FulfillmentStatuses = {
|
|
@@ -449,6 +579,8 @@ const returnUpdateStatusValues = Object.values(ReturnUpdateStatuses);
|
|
|
449
579
|
//#endregion
|
|
450
580
|
//#region src/commerce/helpers.ts
|
|
451
581
|
const cartLineTotal = (items) => items.reduce((total, item) => total + item.price * item.quantity, 0);
|
|
582
|
+
/** Merchandise total after a discount (cents), never below zero. */
|
|
583
|
+
const cartPayableTotal = (items, discountCents = 0) => Math.max(0, cartLineTotal(items) - Math.max(0, discountCents));
|
|
452
584
|
const isCompleteAddressInput = (address) => Boolean(address.name.trim() && address.addressOne.trim() && address.city.trim() && address.zipCode.trim() && address.country.trim());
|
|
453
585
|
//#endregion
|
|
454
586
|
//#region src/budget/types.ts
|
|
@@ -600,10 +732,44 @@ const OgImageColors = {
|
|
|
600
732
|
};
|
|
601
733
|
//#endregion
|
|
602
734
|
//#region src/ogimage/helpers.ts
|
|
603
|
-
const
|
|
604
|
-
|
|
735
|
+
const withLocale = (path, locale) => {
|
|
736
|
+
if (!locale || locale === "en") return path;
|
|
737
|
+
return `${path}?locale=${encodeURIComponent(locale)}`;
|
|
738
|
+
};
|
|
739
|
+
function ogImageUrl(type, params, env = "mainnet") {
|
|
740
|
+
const base = `${getGenBaseUrl(env)}/image/og`;
|
|
605
741
|
switch (type) {
|
|
606
|
-
case "meeting": return `${
|
|
742
|
+
case "meeting": return `${base}/meeting/${params.code}`;
|
|
743
|
+
case "action": {
|
|
744
|
+
const { slug, locale } = params;
|
|
745
|
+
return withLocale(`${base}/action/${encodeURIComponent(slug)}`, locale);
|
|
746
|
+
}
|
|
747
|
+
case "app": {
|
|
748
|
+
const { slug, locale } = params;
|
|
749
|
+
return withLocale(`${base}/app/${encodeURIComponent(slug)}`, locale);
|
|
750
|
+
}
|
|
751
|
+
case "actions": return `${base}/actions`;
|
|
752
|
+
case "apps": return `${base}/apps`;
|
|
753
|
+
case "changelog": return `${base}/changelog`;
|
|
754
|
+
case "agent": {
|
|
755
|
+
const { id, locale } = params;
|
|
756
|
+
return withLocale(`${base}/agent/${encodeURIComponent(id)}`, locale);
|
|
757
|
+
}
|
|
758
|
+
case "agents": return `${base}/agents`;
|
|
759
|
+
case "skill": return `${base}/skill/${encodeURIComponent(params.id)}`;
|
|
760
|
+
case "flow": return `${base}/flow/${encodeURIComponent(params.slug)}`;
|
|
761
|
+
case "blueprint": return `${base}/blueprint/${encodeURIComponent(params.slug)}`;
|
|
762
|
+
case "digest": return `${base}/digest/${encodeURIComponent(params.id)}`;
|
|
763
|
+
case "digests": return `${base}/digests`;
|
|
764
|
+
case "store": return `${base}/store`;
|
|
765
|
+
case "product": {
|
|
766
|
+
const { teamname, slug } = params;
|
|
767
|
+
return `${base}/store/${encodeURIComponent(teamname)}/${encodeURIComponent(slug)}`;
|
|
768
|
+
}
|
|
769
|
+
case "service": {
|
|
770
|
+
const { teamname, slug } = params;
|
|
771
|
+
return `${base}/store/service/${encodeURIComponent(teamname)}/${encodeURIComponent(slug)}`;
|
|
772
|
+
}
|
|
607
773
|
}
|
|
608
774
|
}
|
|
609
775
|
//#endregion
|
|
@@ -665,7 +831,8 @@ const NativeApps = {
|
|
|
665
831
|
Contracts: "contracts",
|
|
666
832
|
Artifacts: "artifacts",
|
|
667
833
|
Social: "social",
|
|
668
|
-
Studio: "studio"
|
|
834
|
+
Studio: "studio",
|
|
835
|
+
Loyalty: "loyalty"
|
|
669
836
|
};
|
|
670
837
|
const nativeAppSlugs = Object.values(NativeApps);
|
|
671
838
|
const isNativeApp = (value) => typeof value === "string" && nativeAppSlugs.includes(value);
|
|
@@ -763,4 +930,4 @@ const DefaultInviteTeamRole = UserRoles.Member;
|
|
|
763
930
|
const inviteableTeamRoles = () => [...InviteableTeamRoles];
|
|
764
931
|
const defaultInviteTeamRole = () => DefaultInviteTeamRole;
|
|
765
932
|
//#endregion
|
|
766
|
-
export { AUTOMATION_SEND_CHANNELS, AddressTypes, AgentToolingAccess, BillingManageAccess, CAMPAIGN_CHANNELS, CONTACT_MESSAGE_SEND_WARP, ContractCategoryDisplayNames, DefaultCodeMetadata, DefaultInviteTeamRole, FulfillmentMethods, FulfillmentStatuses, HttpService, InviteableTeamRoles, JoaiUrls, NATIVE_AUTH_TOKEN_PARAM, NativeApps, OG_IMAGE_CONFIG, OG_IMAGE_HEIGHT, OG_IMAGE_WIDTH, ORDER_FULFILLMENT_STATUSES, ORDER_POST_CHECKOUT_STATUSES, OUTBOUND_CHANNELS, OgImageColors, PLATFORM_CURRENCY, PeriodTypeLabels, PeriodTypeOptions, PermissionPresetNames, ReturnStatuses, ReturnUpdateStatuses, SkillMediaBindingRole, SkillScope, SkillType, TeamManageAccess, TeamViewAccess, UNIFIED_MCP_SERVER_NAME, UserPermissions, UserRoles, abbreviateNumber, addressTypeValues, automationSendChannel, buildAgentMcpServerName, buildAgentSetupClipboardText, buildAppSetupClipboardText, buildFeatureSetupClipboardText, buildMcpServerName, cartLineTotal, createCursorMcpInstallLink, defaultInviteTeamRole, formatAddressSnapshotLines, fulfillmentMethodValues, fulfillmentStatusValues, getAgentSetupPromptUrl, getAgentsBaseUrl, getApiBaseUrl, getAppBaseUrl, getAssetAppLogoUrl, getAssetChainLogoUrl, getAssetPartnerLogoUrl, getAssetTokenLogoUrl, getAssetWalletLogoUrl, getCortexBaseUrl, getDigestBaseUrl, getFormsBaseUrl, getLoginUrl, getMcpServerAgentUrl, getMcpServerUrl, getSiteUrl, getSitesBaseUrl, getSitesRootDomain, getStoreBaseUrl, getWarpScreenshotUrl, hasAllPermissions, hasAllTeamPermissions, hasAnyPermissions, hasPermission, hasTeamPermission, integrationSlugForChannel, inviteableTeamRoles, isAutomationSendChannelId, isCampaignChannelId, isCompleteAddressInput, isContactMessageAction, isContactMessageWarpId, isFileFormatAudio, isFileFormatImage, isFileFormatVideo, isNativeApp, isNativeAppAccessible, isNativeAppGated, isNativeAppLocked, isOrderCanceled, isOrderInFulfillment, isOrderPending, isOrderPostCheckout, isPickupOrderReady, isPickupReady, isTeamFeatureAccessible, isTeamFeatureGated, isTeamFeatureLocked, isUnifiedMcpUrl, isUserRole, localize, nativeAppSlugs, normalizeAutomationActionType, ogImageUrl, outboundChannel, permissionPresetRules, resolveAccessCatalog, resolveAgentMcpUrl, resolveConnectMcpUrl, resolveOrderStatusDisplay, resolveTeamCurrency, resolveWarpText, returnStatusValues, returnUpdateStatusValues, sanitizeAlphanumeric, sanitizeNumeric, slugifyMcpSegment, teamCategories, toCurrencyDisplay, toHexEncodedNonce, toNameInitials, toNftId, toPreviewText, userPermissionValues, userRoleValues, withRetry };
|
|
933
|
+
export { AUTOMATION_SEND_CHANNELS, AddressTypes, AgentToolingAccess, BillingManageAccess, CAMPAIGN_CHANNELS, CONTACT_MESSAGE_SEND_WARP, ContractCategoryDisplayNames, DefaultCodeMetadata, DefaultInviteTeamRole, FulfillmentMethods, FulfillmentStatuses, HttpService, InviteableTeamRoles, JoaiUrls, NATIVE_AUTH_TOKEN_PARAM, NativeApps, OG_IMAGE_CONFIG, OG_IMAGE_HEIGHT, OG_IMAGE_WIDTH, ORDER_FULFILLMENT_STATUSES, ORDER_POST_CHECKOUT_STATUSES, OUTBOUND_CHANNELS, OgImageColors, PLATFORM_CURRENCY, PeriodTypeLabels, PeriodTypeOptions, PermissionPresetNames, ReturnStatuses, ReturnUpdateStatuses, SkillMediaBindingRole, SkillScope, SkillType, TeamManageAccess, TeamViewAccess, UNIFIED_MCP_SERVER_NAME, UserPermissions, UserRoles, abbreviateNumber, addressTypeValues, automationSendChannel, buildAgentMcpServerName, buildAgentSetupClipboardText, buildAppSetupClipboardText, buildFeatureSetupClipboardText, buildMcpServerName, canOpenFulfillmentFlow, canTransitionOrderStatus, cartLineTotal, cartPayableTotal, createCursorMcpInstallLink, defaultInviteTeamRole, formatAddressSnapshotLines, fulfillmentMethodValues, fulfillmentStatusValues, getAgentSetupPromptUrl, getAgentsBaseUrl, getApiBaseUrl, getAppBaseUrl, getAssetAppLogoUrl, getAssetChainLogoUrl, getAssetPartnerLogoUrl, getAssetTokenLogoUrl, getAssetWalletLogoUrl, getCortexBaseUrl, getDigestBaseUrl, getEditableOrderStatuses, getFormsBaseUrl, getFulfillmentFlowAction, getFulfillmentFlowStepperIndex, getGenBaseUrl, getInvoiceEditableStatuses, getLoginUrl, getMcpServerAgentUrl, getMcpServerUrl, getPickupEditableStatuses, getPickupNextAction, getShippingEditableStatuses, getSiteUrl, getSitesBaseUrl, getSitesRootDomain, getStoreBaseUrl, getWarpScreenshotUrl, hasAllPermissions, hasAllTeamPermissions, hasAnyPermissions, hasPermission, hasTeamPermission, integrationSlugForChannel, inviteableTeamRoles, isAutomationSendChannelId, isCampaignChannelId, isCompleteAddressInput, isContactMessageAction, isContactMessageWarpId, isFileFormatAudio, isFileFormatImage, isFileFormatVideo, isNativeApp, isNativeAppAccessible, isNativeAppGated, isNativeAppLocked, isOrderCanceled, isOrderInFulfillment, isOrderPending, isOrderPostCheckout, isPickupOrderReady, isPickupReady, isTeamFeatureAccessible, isTeamFeatureGated, isTeamFeatureLocked, isUnifiedMcpUrl, isUserRole, localize, nativeAppSlugs, normalizeAutomationActionType, ogImageUrl, outboundChannel, permissionPresetRules, resolveAccessCatalog, resolveAgentMcpUrl, resolveConnectMcpUrl, resolveFulfillmentFlowStep, resolveOrderStatusDisplay, resolveTeamCurrency, resolveWarpText, returnStatusValues, returnUpdateStatusValues, sanitizeAlphanumeric, sanitizeNumeric, slugifyMcpSegment, teamCategories, toCurrencyDisplay, toHexEncodedNonce, toNameInitials, toNftId, toPreviewText, userPermissionValues, userRoleValues, withRetry };
|