@joai/core 4.15.2 → 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 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;
@@ -2222,6 +2228,8 @@ type Meeting = {
2222
2228
  contacts?: Contact[];
2223
2229
  speakerAssignments?: MeetingSpeakerAssignment[] | null;
2224
2230
  scheduledAt: string | null;
2231
+ scheduledEndAt?: string | null;
2232
+ timezone?: string | null;
2225
2233
  calendarEventId: number | null;
2226
2234
  startedAt: string | null;
2227
2235
  endedAt: string | null;
@@ -2580,6 +2588,7 @@ type PatchContentInput = {
2580
2588
  };
2581
2589
  //#endregion
2582
2590
  //#region src/address/formatAddressSnapshot.d.ts
2591
+ /** Accepts camelCase API snapshots and legacy snake_case stored snapshots. */
2583
2592
  declare const formatAddressSnapshotLines: (address: AddressSnapshot | null | undefined) => string[];
2584
2593
  //#endregion
2585
2594
  //#region src/billing/orderStatus.d.ts
@@ -2587,10 +2596,50 @@ declare const formatAddressSnapshotLines: (address: AddressSnapshot | null | und
2587
2596
  declare const ORDER_FULFILLMENT_STATUSES: readonly OrderStatus[];
2588
2597
  /** Statuses where checkout is finished and the guest may leave the JoAi thank-you page. */
2589
2598
  declare const ORDER_POST_CHECKOUT_STATUSES: readonly OrderStatus[];
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';
2590
2601
  declare const isOrderPending: (status: OrderStatus) => boolean;
2591
2602
  declare const isOrderCanceled: (status: OrderStatus) => boolean;
2592
2603
  declare const isOrderInFulfillment: (status: OrderStatus) => boolean;
2593
2604
  declare const isOrderPostCheckout: (status: OrderStatus) => boolean;
2605
+ declare const resolveOrderStatusDisplay: (status: OrderStatus, fulfillmentMethod?: string | null) => OrderStatusDisplay;
2606
+ declare const isPickupReady: (order: Pick<Order, "fulfillmentMethod"> & {
2607
+ fulfillments?: Order["fulfillments"] | null;
2608
+ }) => boolean;
2609
+ /** True when a pickup order is waiting for the guest (fulfillment ready, or shipped without delivered fulfillments). */
2610
+ declare const isPickupOrderReady: (order: Pick<Order, "fulfillmentMethod" | "status"> & {
2611
+ fulfillments?: Order["fulfillments"] | null;
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;
2594
2643
  //#endregion
2595
2644
  //#region src/commerce/helpers.d.ts
2596
2645
  type CartLine = {
@@ -2598,6 +2647,8 @@ type CartLine = {
2598
2647
  quantity: number;
2599
2648
  };
2600
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;
2601
2652
  declare const isCompleteAddressInput: (address: Pick<AddressInput, "name" | "addressOne" | "city" | "zipCode" | "country">) => boolean;
2602
2653
  //#endregion
2603
2654
  //#region src/budget/types.d.ts
@@ -2818,6 +2869,13 @@ type Document = {
2818
2869
  name: string;
2819
2870
  content: string | null;
2820
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;
2821
2879
  createdAt: string;
2822
2880
  };
2823
2881
  //#endregion
@@ -3064,7 +3122,7 @@ declare const isUnifiedMcpUrl: (mcpUrl: string) => boolean;
3064
3122
  declare const getAgentSetupPromptUrl: (env: AppEnv) => string;
3065
3123
  declare const buildAgentSetupClipboardText: (env: AppEnv, target: AgentSetupTarget) => string;
3066
3124
  declare const buildAppSetupClipboardText: (env: AppEnv, target: AppSetupTarget) => string;
3067
- /** Marketing / public pages: no known agent yet — unified MCP + OAuth agent pick. */
3125
+ /** Marketing / public pages: no known agent yet — unified MCP; OAuth UI handles login/agent pick. */
3068
3126
  declare const buildFeatureSetupClipboardText: (env: AppEnv, target?: FeatureSetupTarget) => string;
3069
3127
  declare const createCursorMcpInstallLink: (mcpServerUrl: string, serverName: string) => string;
3070
3128
  /** Default owner/connect MCP URL. Optional agent UUID soft-prefills OAuth via `?agent=`. */
@@ -3677,15 +3735,6 @@ type OfficeEntity = {
3677
3735
  };
3678
3736
  //#endregion
3679
3737
  //#region src/ogimage/types.d.ts
3680
- type OgImageType = 'default' | 'article' | 'category' | 'listing' | 'brand';
3681
- type OgImageParams = {
3682
- type?: OgImageType;
3683
- title: string;
3684
- subtitle?: string;
3685
- category?: string;
3686
- categoryColor?: string;
3687
- brandLogo?: string;
3688
- };
3689
3738
  declare const OG_IMAGE_WIDTH = 1200;
3690
3739
  declare const OG_IMAGE_HEIGHT = 630;
3691
3740
  declare const OG_IMAGE_CONFIG: {
@@ -3708,13 +3757,51 @@ declare const OgImageColors: {
3708
3757
  };
3709
3758
  //#endregion
3710
3759
  //#region src/ogimage/helpers.d.ts
3711
- type OgResourceType = 'meeting';
3760
+ type OgResourceType = 'meeting' | 'action' | 'app' | 'actions' | 'apps' | 'changelog' | 'agent' | 'agents' | 'skill' | 'flow' | 'blueprint' | 'digest' | 'digests' | 'store' | 'product' | 'service';
3712
3761
  type OgResourceParams = {
3713
3762
  meeting: {
3714
3763
  code: string;
3715
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
+ };
3716
3803
  };
3717
- 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;
3718
3805
  //#endregion
3719
3806
  //#region src/project/types.d.ts
3720
3807
  type ProjectStatus = 'draft' | 'planned' | 'render-ready' | 'rendered' | 'composed' | 'exported';
@@ -4340,6 +4427,7 @@ type Update = {
4340
4427
  linkUrl: string | null;
4341
4428
  startsAt: string | null;
4342
4429
  endsAt: string | null;
4430
+ props?: Record<string, string>;
4343
4431
  team?: Team;
4344
4432
  createdAt: string;
4345
4433
  updatedAt: string;
@@ -4354,6 +4442,7 @@ type UpdateCreatePayload = {
4354
4442
  startsAt?: string;
4355
4443
  endsAt?: string;
4356
4444
  status?: UpdateStatus;
4445
+ props?: Record<string, string>;
4357
4446
  };
4358
4447
  type UpdateUpdatePayload = Partial<UpdateCreatePayload>;
4359
4448
  type UpdateStats = {
@@ -4387,9 +4476,19 @@ type SocialPost = {
4387
4476
  canCancel: boolean;
4388
4477
  canRetry: boolean;
4389
4478
  canDelete: boolean;
4479
+ shareUrl: string | null;
4390
4480
  createdAt: string;
4391
4481
  updatedAt: string;
4392
4482
  };
4483
+ type SharedSocialPost = {
4484
+ platform: SocialPostPlatform;
4485
+ status: SocialPostStatus;
4486
+ body: string | null;
4487
+ media: Media[];
4488
+ scheduledAt: string | null;
4489
+ publishedAt: string | null;
4490
+ team: Team;
4491
+ };
4393
4492
  type SocialPostCreatePayload = {
4394
4493
  platform: SocialPostPlatform;
4395
4494
  body?: string | null;
@@ -4696,4 +4795,4 @@ type CliSessionStatus = {
4696
4795
  meta: CliSessionMeta | null;
4697
4796
  };
4698
4797
  //#endregion
4699
- 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, 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, 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, isTeamFeatureAccessible, isTeamFeatureGated, isTeamFeatureLocked, isUnifiedMcpUrl, isUserRole, localize, nativeAppSlugs, normalizeAutomationActionType, ogImageUrl, outboundChannel, permissionPresetRules, resolveAccessCatalog, resolveAgentMcpUrl, resolveConnectMcpUrl, 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
- address.addressOne,
374
- address.addressTwo,
375
- [address.zipCode, address.city].filter(Boolean).join(" "),
376
- address.state,
377
- address.country
378
- ].filter((line) => !!line && line.trim().length > 0);
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
@@ -397,6 +409,143 @@ const isOrderPending = (status) => status === "pending";
397
409
  const isOrderCanceled = (status) => status === "canceled";
398
410
  const isOrderInFulfillment = (status) => ORDER_FULFILLMENT_STATUSES.includes(status);
399
411
  const isOrderPostCheckout = (status) => ORDER_POST_CHECKOUT_STATUSES.includes(status);
412
+ const resolveOrderStatusDisplay = (status, fulfillmentMethod) => {
413
+ if (fulfillmentMethod === "pickup") {
414
+ if (status === "pending") return "new";
415
+ if (status === "confirmed" || status === "processing") return "preparing";
416
+ if (status === "shipped") return "ready_for_pickup";
417
+ if (status === "delivered") return "picked_up";
418
+ }
419
+ if (!fulfillmentMethod && status === "delivered") return "paid";
420
+ return status;
421
+ };
422
+ const isPickupReady = (order) => order.fulfillmentMethod === "pickup" && (order.fulfillments ?? []).some((fulfillment) => fulfillment.status === "ready_for_pickup");
423
+ /** True when a pickup order is waiting for the guest (fulfillment ready, or shipped without delivered fulfillments). */
424
+ const isPickupOrderReady = (order) => {
425
+ if (order.fulfillmentMethod !== "pickup" || order.status === "delivered") return false;
426
+ if (isPickupReady(order)) return true;
427
+ if (order.status !== "shipped") return false;
428
+ const fulfillments = order.fulfillments;
429
+ if (!fulfillments) return true;
430
+ if (fulfillments.length === 0) return true;
431
+ return !fulfillments.some((fulfillment) => fulfillment.status === "delivered");
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
+ };
400
549
  //#endregion
401
550
  //#region src/commerce/enums.ts
402
551
  const FulfillmentStatuses = {
@@ -430,6 +579,8 @@ const returnUpdateStatusValues = Object.values(ReturnUpdateStatuses);
430
579
  //#endregion
431
580
  //#region src/commerce/helpers.ts
432
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));
433
584
  const isCompleteAddressInput = (address) => Boolean(address.name.trim() && address.addressOne.trim() && address.city.trim() && address.zipCode.trim() && address.country.trim());
434
585
  //#endregion
435
586
  //#region src/budget/types.ts
@@ -496,9 +647,7 @@ const buildAgentSetupClipboardText = (env, target) => {
496
647
  "",
497
648
  "Connect me to JoAi MCP:",
498
649
  `- MCP: ${target.mcpUrl}`,
499
- `- Agent: ${target.agentName}`,
500
- "",
501
- "Authenticate with OAuth. The agent in the MCP URL is preselected and can be changed."
650
+ `- Agent: ${target.agentName}`
502
651
  ].join("\n");
503
652
  return [
504
653
  `Fetch and execute the appropriate instructions to set me up for JoAi from ${promptUrl}`,
@@ -519,7 +668,7 @@ const buildAppSetupClipboardText = (env, target) => {
519
668
  `- MCP: ${target.mcpUrl}`
520
669
  ].join("\n");
521
670
  };
522
- /** Marketing / public pages: no known agent yet — unified MCP + OAuth agent pick. */
671
+ /** Marketing / public pages: no known agent yet — unified MCP; OAuth UI handles login/agent pick. */
523
672
  const buildFeatureSetupClipboardText = (env, target = {}) => {
524
673
  const promptUrl = getAgentSetupPromptUrl(env);
525
674
  const mcpUrl = resolveConnectMcpUrl(env);
@@ -530,8 +679,6 @@ const buildFeatureSetupClipboardText = (env, target = {}) => {
530
679
  "Connect me to JoAi MCP:",
531
680
  `- MCP: ${mcpUrl}`,
532
681
  "",
533
- "Authenticate with OAuth when asked. If you don’t have an agent yet, create and name one there. Pick my team and agent during login.",
534
- "",
535
682
  featureName ? `Once connected, help me with JoAi ${featureName}.` : "Once connected, help me run JoAi."
536
683
  ];
537
684
  if (target.taskHint?.trim()) lines.push(target.taskHint.trim());
@@ -585,10 +732,44 @@ const OgImageColors = {
585
732
  };
586
733
  //#endregion
587
734
  //#region src/ogimage/helpers.ts
588
- const OG_BASE = "https://gen.joai.ai/image/og";
589
- function ogImageUrl(type, params) {
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`;
590
741
  switch (type) {
591
- case "meeting": return `${OG_BASE}/meeting/${params.code}`;
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
+ }
592
773
  }
593
774
  }
594
775
  //#endregion
@@ -650,7 +831,8 @@ const NativeApps = {
650
831
  Contracts: "contracts",
651
832
  Artifacts: "artifacts",
652
833
  Social: "social",
653
- Studio: "studio"
834
+ Studio: "studio",
835
+ Loyalty: "loyalty"
654
836
  };
655
837
  const nativeAppSlugs = Object.values(NativeApps);
656
838
  const isNativeApp = (value) => typeof value === "string" && nativeAppSlugs.includes(value);
@@ -748,4 +930,4 @@ const DefaultInviteTeamRole = UserRoles.Member;
748
930
  const inviteableTeamRoles = () => [...InviteableTeamRoles];
749
931
  const defaultInviteTeamRole = () => DefaultInviteTeamRole;
750
932
  //#endregion
751
- 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, isTeamFeatureAccessible, isTeamFeatureGated, isTeamFeatureLocked, isUnifiedMcpUrl, isUserRole, localize, nativeAppSlugs, normalizeAutomationActionType, ogImageUrl, outboundChannel, permissionPresetRules, resolveAccessCatalog, resolveAgentMcpUrl, resolveConnectMcpUrl, 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/core",
3
- "version": "4.15.2",
3
+ "version": "4.15.4",
4
4
  "description": "JoAi shared types, HTTP service, and config",
5
5
  "license": "MIT",
6
6
  "type": "module",