@joai/core 4.1.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -8,8 +8,8 @@ type SocialAuthProvider = 'github' | 'apple' | 'google' | 'x' | 'telegram' | 'sl
8
8
  type AppEnv = 'mainnet' | 'testnet' | 'devnet' | 'local';
9
9
  //#endregion
10
10
  //#region src/auth/token.d.ts
11
- /** One-time native/deep-link handoff param (exchanged for a Bearer via API). */
12
- declare const AUTH_CODE_PARAM = "auth_code";
11
+ /** One-time native/deep-link handoff fragment key (exchanged for a Bearer via POST). */
12
+ declare const NATIVE_AUTH_TOKEN_PARAM = "token";
13
13
  /** Login URL on the main app with a direct return URL (no mini-app callback). */
14
14
  declare const getLoginUrl: (env: AppEnv, returnTo: string, branding?: {
15
15
  team: string;
@@ -197,8 +197,50 @@ type WalletList = Partial<Record<WarpChainName, {
197
197
  address?: string;
198
198
  }>>;
199
199
  //#endregion
200
+ //#region src/user/permissions.d.ts
201
+ /** Permission string values — must match joai--api `UserPermission::value`. */
202
+ declare const UserPermissions: {
203
+ readonly BillingManage: "billing-manage";
204
+ readonly TeamManage: "team-manage";
205
+ readonly TeamView: "team-view";
206
+ readonly TeamMemberInvite: "team-member-invite";
207
+ readonly TeamMemberRemove: "team-member-remove";
208
+ readonly TeamSecretView: "team-secret-view";
209
+ readonly TeamSecretManage: "team-secret-manage";
210
+ readonly AgentExecute: "agent-execute";
211
+ readonly AgentWalletManage: "agent-wallet-manage";
212
+ readonly SwarmCreate: "swarm-create";
213
+ };
214
+ type UserPermission = (typeof UserPermissions)[keyof typeof UserPermissions];
215
+ declare const userPermissionValues: [UserPermission, ...UserPermission[]];
216
+ declare const hasPermission: (granted: readonly UserPermission[] | undefined, required: UserPermission) => boolean;
217
+ declare const hasAllPermissions: (granted: readonly UserPermission[] | undefined, required: readonly UserPermission[]) => boolean;
218
+ declare const hasAnyPermissions: (granted: readonly UserPermission[] | undefined, required: readonly UserPermission[]) => boolean;
219
+ declare const hasTeamPermission: (team: {
220
+ permissions?: UserPermission[];
221
+ } | null | undefined, permission: UserPermission) => boolean;
222
+ declare const hasAllTeamPermissions: (team: {
223
+ permissions?: UserPermission[];
224
+ } | null | undefined, permissions: UserPermission[]) => boolean;
225
+ //#endregion
226
+ //#region src/user/roles.d.ts
227
+ /** Team member roles — values must match joai--api `UserRole::toName()`. */
228
+ declare const UserRoles: {
229
+ readonly Owner: "owner";
230
+ readonly Admin: "admin";
231
+ readonly Member: "member";
232
+ readonly Developer: "developer";
233
+ };
234
+ type UserRole = (typeof UserRoles)[keyof typeof UserRoles];
235
+ declare const userRoleValues: [UserRole, ...UserRole[]];
236
+ declare const isUserRole: (value: string) => value is UserRole;
237
+ /** Roles assignable via team invite — owner is never inviteable. Must match API `RolePermissions::inviteable()`. */
238
+ declare const InviteableTeamRoles: readonly ["member", "developer", "admin"];
239
+ declare const DefaultInviteTeamRole: "member";
240
+ declare const inviteableTeamRoles: () => UserRole[];
241
+ declare const defaultInviteTeamRole: () => UserRole;
242
+ //#endregion
200
243
  //#region src/user/types.d.ts
201
- type UserRole = 'owner' | 'member';
202
244
  type UserMode = 'simple' | 'advanced';
203
245
  type UserInterest = 'payments' | 'health' | 'content' | 'business' | 'finance' | 'research' | 'shopping' | 'web3' | 'developer' | 'fitness' | 'ecommerce';
204
246
  type UserSettings = {
@@ -234,8 +276,6 @@ type UserPrivate = {
234
276
  socials: UserSocialAccount[];
235
277
  justCreated: boolean;
236
278
  affiliate: Affiliate | null;
237
- billingAddress: BillingAddress | null;
238
- betaRestricted: boolean;
239
279
  kyc?: Kyc | null;
240
280
  settings: UserSettings;
241
281
  };
@@ -303,15 +343,13 @@ type AffiliateTier = {
303
343
  };
304
344
  type AffiliateStatus = 'pending' | 'approved' | 'rejected' | 'suspended' | 'demoted';
305
345
  //#endregion
306
- //#region src/team/constants.d.ts
307
- declare const teamCategories: readonly ["general", "food-drink", "retail", "beauty-wellness", "health", "sports-fitness", "trades-services", "professional-services", "education-culture", "clubs-organizations", "leisure-tourism"];
308
- //#endregion
309
346
  //#region src/team/apps.d.ts
310
347
  declare const NativeApps: {
311
348
  readonly Board: "board";
312
349
  readonly Shop: "shop";
313
350
  readonly SmartLinks: "smart-links";
314
351
  readonly Contacts: "contacts";
352
+ readonly Forms: "forms";
315
353
  readonly Appointments: "appointments";
316
354
  readonly Workspace: "workspace";
317
355
  readonly Meeting: "meeting";
@@ -327,6 +365,38 @@ type NativeApp = (typeof NativeApps)[keyof typeof NativeApps];
327
365
  declare const nativeAppSlugs: NativeApp[];
328
366
  declare const isNativeApp: (value: unknown) => value is NativeApp;
329
367
  //#endregion
368
+ //#region src/access/team-access.d.ts
369
+ type TeamFeatureArea = 'nativeApps' | 'agentSettings' | 'teamSettings' | 'developerHub' | 'areas' | 'commerce';
370
+ type GatedFeatureArea = Exclude<TeamFeatureArea, 'nativeApps'>;
371
+ /** Keys per area that the API evaluates in `team.access`. */
372
+ type TeamAccessCatalog = Partial<Record<TeamFeatureArea, string[]>>;
373
+ type TeamAccessConfig = {
374
+ accessCatalog: TeamAccessCatalog;
375
+ };
376
+ /** Resolved feature access from API `TeamPrivate.access` — do not evaluate rules on the client. */
377
+ type TeamFeatureAccess = {
378
+ nativeApps?: Partial<Record<NativeApp, boolean>>;
379
+ agentSettings?: Partial<Record<string, boolean>>;
380
+ teamSettings?: Partial<Record<string, boolean>>;
381
+ developerHub?: Partial<Record<string, boolean>>;
382
+ areas?: Partial<Record<string, boolean>>;
383
+ commerce?: Partial<Record<string, boolean>>;
384
+ };
385
+ type TeamWithAccess = {
386
+ access?: TeamFeatureAccess | null;
387
+ accessCatalog?: TeamAccessCatalog | null;
388
+ };
389
+ declare const resolveAccessCatalog: (team: TeamWithAccess | null | undefined, accessConfig: TeamAccessConfig | null | undefined) => TeamAccessCatalog | null | undefined;
390
+ declare const isTeamFeatureGated: (catalog: TeamAccessCatalog | null | undefined, area: GatedFeatureArea, key: string) => boolean;
391
+ declare const isNativeAppGated: (catalog: TeamAccessCatalog | null | undefined, app: NativeApp) => boolean;
392
+ declare const isTeamFeatureAccessible: (team: TeamWithAccess | null | undefined, area: GatedFeatureArea, key: string) => boolean;
393
+ declare const isTeamFeatureLocked: (team: TeamWithAccess | null | undefined, catalog: TeamAccessCatalog | null | undefined, area: GatedFeatureArea, key: string) => boolean;
394
+ declare const isNativeAppAccessible: (team: TeamWithAccess | null | undefined, app: NativeApp) => boolean;
395
+ declare const isNativeAppLocked: (team: TeamWithAccess | null | undefined, catalog: TeamAccessCatalog | null | undefined, app: NativeApp) => boolean;
396
+ //#endregion
397
+ //#region src/team/constants.d.ts
398
+ declare const teamCategories: readonly ["general", "food-drink", "retail", "beauty-wellness", "health", "sports-fitness", "trades-services", "professional-services", "education-culture", "clubs-organizations", "leisure-tourism"];
399
+ //#endregion
330
400
  //#region src/team/types.d.ts
331
401
  type TeamCategory = (typeof teamCategories)[number];
332
402
  type TeamFeature = 'shop' | 'appointments';
@@ -438,6 +508,10 @@ type TeamPrivate = {
438
508
  category: TeamCategory;
439
509
  createdAt: string;
440
510
  justCreated: boolean;
511
+ role?: UserRole | null;
512
+ permissions?: UserPermission[];
513
+ access?: TeamFeatureAccess;
514
+ accessCatalog?: TeamAccessCatalog;
441
515
  };
442
516
  type ByokProviderConfig = {
443
517
  apiKey?: string;
@@ -524,6 +598,200 @@ type AiCostsResponse = {
524
598
  };
525
599
  };
526
600
  //#endregion
601
+ //#region src/address/enums.d.ts
602
+ declare const AddressTypes: {
603
+ readonly Billing: "billing";
604
+ readonly Shipping: "shipping";
605
+ };
606
+ type AddressType = (typeof AddressTypes)[keyof typeof AddressTypes];
607
+ declare const addressTypeValues: [AddressType, ...AddressType[]];
608
+ //#endregion
609
+ //#region src/address/types.d.ts
610
+ type Address = {
611
+ id: string;
612
+ type: AddressType;
613
+ name: string;
614
+ company: string | null;
615
+ addressOne: string;
616
+ addressTwo: string | null;
617
+ city: string;
618
+ state: string | null;
619
+ zipCode: string;
620
+ country: string;
621
+ phone: string | null;
622
+ isDefault: boolean;
623
+ business: boolean;
624
+ vatId: string | null;
625
+ isEU: boolean;
626
+ isEEA: boolean;
627
+ };
628
+ type AddressSnapshot = Pick<Address, 'name' | 'company' | 'addressOne' | 'addressTwo' | 'city' | 'state' | 'zipCode' | 'country' | 'phone' | 'business' | 'vatId'>;
629
+ type AddressInput = {
630
+ name: string;
631
+ addressOne: string;
632
+ city: string;
633
+ zipCode: string;
634
+ country: string;
635
+ type?: AddressType;
636
+ company?: string | null;
637
+ addressTwo?: string | null;
638
+ state?: string | null;
639
+ phone?: string | null;
640
+ business?: boolean;
641
+ vatId?: string | null;
642
+ };
643
+ type AddressCreatePayload = {
644
+ name: string;
645
+ country: string;
646
+ type?: AddressType;
647
+ email?: string | null;
648
+ company?: string | null;
649
+ addressOne?: string | null;
650
+ addressTwo?: string | null;
651
+ city?: string | null;
652
+ state?: string | null;
653
+ zipCode?: string | null;
654
+ vatId?: string | null;
655
+ phone?: string | null;
656
+ isDefault?: boolean;
657
+ contact?: string;
658
+ team?: string;
659
+ };
660
+ type AddressUpdatePayload = Partial<Omit<AddressCreatePayload, 'contact' | 'team'>>;
661
+ //#endregion
662
+ //#region src/commerce/enums.d.ts
663
+ declare const FulfillmentStatuses: {
664
+ readonly Pending: "pending";
665
+ readonly ReadyForPickup: "ready_for_pickup";
666
+ readonly Shipped: "shipped";
667
+ readonly Delivered: "delivered";
668
+ readonly Cancelled: "cancelled";
669
+ };
670
+ type FulfillmentStatus = (typeof FulfillmentStatuses)[keyof typeof FulfillmentStatuses];
671
+ declare const fulfillmentStatusValues: [FulfillmentStatus, ...FulfillmentStatus[]];
672
+ declare const FulfillmentMethods: {
673
+ readonly Shipping: "shipping";
674
+ readonly Pickup: "pickup";
675
+ };
676
+ type FulfillmentMethod = (typeof FulfillmentMethods)[keyof typeof FulfillmentMethods];
677
+ declare const fulfillmentMethodValues: [FulfillmentMethod, ...FulfillmentMethod[]];
678
+ declare const ReturnStatuses: {
679
+ readonly Requested: "requested";
680
+ readonly Approved: "approved";
681
+ readonly Rejected: "rejected";
682
+ readonly Received: "received";
683
+ readonly Closed: "closed";
684
+ };
685
+ type ReturnStatus = (typeof ReturnStatuses)[keyof typeof ReturnStatuses];
686
+ declare const returnStatusValues: [ReturnStatus, ...ReturnStatus[]];
687
+ declare const ReturnUpdateStatuses: {
688
+ readonly Approved: "approved";
689
+ readonly Rejected: "rejected";
690
+ readonly Received: "received";
691
+ readonly Closed: "closed";
692
+ };
693
+ type ReturnUpdateStatus = (typeof ReturnUpdateStatuses)[keyof typeof ReturnUpdateStatuses];
694
+ declare const returnUpdateStatusValues: [ReturnUpdateStatus, ...ReturnUpdateStatus[]];
695
+ //#endregion
696
+ //#region src/commerce/types.d.ts
697
+ type ShippingRate = {
698
+ id: number;
699
+ name: string;
700
+ price: number;
701
+ fee?: number;
702
+ freeShippingThreshold?: number | null;
703
+ minOrderValue?: number | null;
704
+ maxOrderValue?: number | null;
705
+ minWeight?: number | null;
706
+ maxWeight?: number | null;
707
+ estimatedMinDays?: number | null;
708
+ estimatedMaxDays?: number | null;
709
+ active?: boolean;
710
+ position?: number;
711
+ };
712
+ type CheckoutSnapshot = {
713
+ id: string;
714
+ fulfillmentMethod: FulfillmentMethod;
715
+ totals: {
716
+ subtotal: number;
717
+ shippingFee: number;
718
+ total: number;
719
+ };
720
+ expiresAt: string;
721
+ accessToken?: string | null;
722
+ };
723
+ type CheckoutSnapshotRequest = {
724
+ fulfillmentMethod: FulfillmentMethod;
725
+ items: {
726
+ id: string;
727
+ type: 'product' | 'service' | 'coupon';
728
+ quantity: number;
729
+ }[];
730
+ billingAddressId?: number | null;
731
+ shippingAddressId?: number | null;
732
+ billingAddress?: AddressInput;
733
+ shippingAddress?: AddressInput;
734
+ shippingRateId?: number | null;
735
+ fulfillmentLocationId?: number | null;
736
+ };
737
+ type ShippingZone = {
738
+ id: number;
739
+ name: string;
740
+ countries: string[];
741
+ postal_code_rules: string[] | null;
742
+ active: boolean;
743
+ position: number;
744
+ rates: ShippingRate[];
745
+ };
746
+ type FulfillmentLocation = {
747
+ id: number;
748
+ name: string;
749
+ address_id: number | null;
750
+ address: Address | null;
751
+ instructions: string | null;
752
+ active: boolean;
753
+ };
754
+ type Fulfillment = {
755
+ id: string;
756
+ orderId: number;
757
+ method: FulfillmentMethod;
758
+ status: FulfillmentStatus;
759
+ carrierCode: string | null;
760
+ trackingNumber: string | null;
761
+ trackingUrl: string | null;
762
+ items: {
763
+ orderItemId: number;
764
+ quantity: number;
765
+ }[];
766
+ shippedAt: string | null;
767
+ readyForPickupAt: string | null;
768
+ deliveredAt: string | null;
769
+ };
770
+ type Return = {
771
+ id: string;
772
+ orderId: number;
773
+ status: ReturnStatus;
774
+ reason: string;
775
+ merchantNote: string | null;
776
+ items: {
777
+ orderItemId: number;
778
+ quantity: number;
779
+ condition: string | null;
780
+ }[];
781
+ refundAmount: number | null;
782
+ };
783
+ type SubscriptionDelivery = {
784
+ fulfillmentMethod: FulfillmentMethod | null;
785
+ nextOrderAt: string | null;
786
+ pausedAt: string | null;
787
+ shippingAddress?: AddressSnapshot | null;
788
+ shippingRate?: Pick<ShippingRate, 'name' | 'price'> | null;
789
+ fulfillmentLocation?: {
790
+ name: string;
791
+ instructions: string | null;
792
+ } | null;
793
+ };
794
+ //#endregion
527
795
  //#region src/json/types.d.ts
528
796
  type JsonValue = string | number | boolean | null | JsonValue[] | {
529
797
  [key: string]: JsonValue;
@@ -653,7 +921,7 @@ type OrderType = 'order' | 'quote';
653
921
  type SubscriptionStatus = 'active' | 'canceled' | 'past_due' | 'pending';
654
922
  type SubscriptionInterval = 'weekly' | 'biweekly' | 'monthly' | 'quarterly' | 'yearly';
655
923
  type PricingModel = 'free' | 'one-time' | 'weekly' | 'biweekly' | 'monthly' | 'quarterly' | 'yearly' | 'per-run';
656
- type AppSubscription = {
924
+ type Subscription = {
657
925
  id: string;
658
926
  orderId: string;
659
927
  teamId: string;
@@ -666,6 +934,7 @@ type AppSubscription = {
666
934
  meta: Record<string, JsonValue> | null;
667
935
  createdAt: string;
668
936
  updatedAt: string;
937
+ delivery?: SubscriptionDelivery | null;
669
938
  };
670
939
  type PaymentProvider = 'xmoney' | 'lemonsqueezy' | 'stripe' | 'stripe-connect' | 'mollie' | 'mollie-connect' | 'apple' | 'google' | 'blockchain' | 'offline';
671
940
  type PaymentAccount = {
@@ -712,16 +981,6 @@ type PlanExtra = {
712
981
  price: number;
713
982
  unitName: string;
714
983
  };
715
- type BillingAddress = {
716
- name: string;
717
- addressOne: string | null;
718
- city: string | null;
719
- state: string | null;
720
- zipCode: string | null;
721
- country: string;
722
- vatId: string | null;
723
- isEU: boolean;
724
- };
725
984
  type PlanInterval = 'weekly' | 'monthly' | 'yearly' | 'lifetime';
726
985
  type Plan = {
727
986
  resource: 'plan';
@@ -896,6 +1155,17 @@ type Order = {
896
1155
  paymentMode: string | null;
897
1156
  linkVariationId: string | null;
898
1157
  notes: string | null;
1158
+ fulfillmentMethod?: FulfillmentMethod | null;
1159
+ address?: AddressSnapshot | null;
1160
+ shippingAddress?: AddressSnapshot | null;
1161
+ shippingRate?: Pick<ShippingRate, 'name' | 'price' | 'estimatedMinDays' | 'estimatedMaxDays'> | null;
1162
+ fulfillmentLocation?: {
1163
+ name: string;
1164
+ instructions?: string | null;
1165
+ } | null;
1166
+ shippingFee?: number;
1167
+ fulfillments?: Fulfillment[];
1168
+ subscription?: Subscription | null;
899
1169
  configuration?: OrderConfigurationItem[];
900
1170
  items: OrderItem[];
901
1171
  coupon?: Coupon | null;
@@ -957,7 +1227,7 @@ type PurchaseResult = {
957
1227
  };
958
1228
  type PurchaseOptions = {
959
1229
  forceProvider?: PaymentProvider;
960
- billingAddress?: BillingAddress | null;
1230
+ billingAddress?: AddressSnapshot | null;
961
1231
  meta?: Record<string, string>;
962
1232
  };
963
1233
  //#endregion
@@ -1696,7 +1966,8 @@ type Meeting = {
1696
1966
  captureMode: 'desktop_local' | null;
1697
1967
  transcriptUrl: string | null;
1698
1968
  summaryUrl: string | null;
1699
- participants?: MeetingParticipant[];
1969
+ participants?: MeetingParticipant[]; /** The customer associated with an appointment booking, when available. */
1970
+ contact?: Contact | null;
1700
1971
  speakerAssignments?: MeetingSpeakerAssignment[] | null;
1701
1972
  scheduledAt: string | null;
1702
1973
  calendarEventId: number | null;
@@ -1791,6 +2062,7 @@ type AppointmentPolicy = {
1791
2062
  bookingCapacity?: number | null;
1792
2063
  bookingCapacityUnit?: 'booking' | 'person' | null;
1793
2064
  requireApproval?: boolean | null;
2065
+ notificationEmail?: string | null;
1794
2066
  sync?: AppointmentPolicySync | null;
1795
2067
  agent?: Agent | null;
1796
2068
  agentUuid?: string | null;
@@ -1841,6 +2113,14 @@ type AppointmentRequest = {
1841
2113
  createdAt: string;
1842
2114
  };
1843
2115
  //#endregion
2116
+ //#region src/commerce/helpers.d.ts
2117
+ type CartLine = {
2118
+ price: number;
2119
+ quantity: number;
2120
+ };
2121
+ declare const cartLineTotal: <T extends CartLine>(items: T[]) => number;
2122
+ declare const isCompleteAddressInput: (address: Pick<AddressInput, "name" | "addressOne" | "city" | "zipCode" | "country">) => boolean;
2123
+ //#endregion
1844
2124
  //#region src/budget/types.d.ts
1845
2125
  type Budget = {
1846
2126
  id: number;
@@ -3630,6 +3910,32 @@ type SchedulePreset = {
3630
3910
  description: string;
3631
3911
  };
3632
3912
  //#endregion
3913
+ //#region src/access/mcp-access.d.ts
3914
+ /** Preset names — must match joai--api `PermissionPreset::value`. */
3915
+ declare const PermissionPresetNames: {
3916
+ readonly TeamManage: "teamManage";
3917
+ readonly TeamView: "teamView";
3918
+ readonly BillingManage: "billingManage";
3919
+ readonly AgentTooling: "agentTooling";
3920
+ readonly SecretView: "secretView";
3921
+ readonly SecretManage: "secretManage";
3922
+ readonly TeamMemberInvite: "teamMemberInvite";
3923
+ readonly TeamMemberRemove: "teamMemberRemove";
3924
+ readonly AgentWalletManage: "agentWalletManage";
3925
+ readonly SwarmCreate: "swarmCreate";
3926
+ };
3927
+ type PermissionPresetName = (typeof PermissionPresetNames)[keyof typeof PermissionPresetNames];
3928
+ /** Permission presets for MCP tool gating — not used by the PWA (UI reads `team.access` from API). */
3929
+ type AppAccessRule = {
3930
+ permissions?: UserPermission[];
3931
+ permissionsAny?: UserPermission[];
3932
+ };
3933
+ declare const permissionPresetRules: Record<PermissionPresetName, AppAccessRule>;
3934
+ declare const TeamManageAccess: AppAccessRule;
3935
+ declare const TeamViewAccess: AppAccessRule;
3936
+ declare const AgentToolingAccess: AppAccessRule;
3937
+ declare const BillingManageAccess: AppAccessRule;
3938
+ //#endregion
3633
3939
  //#region src/wallet-chains/types.d.ts
3634
3940
  type RampProvider = 'coinbase' | 'xmoney' | 'moonpay';
3635
3941
  type RampProviderInfo = {
@@ -3803,4 +4109,4 @@ type CliSessionStatus = {
3803
4109
  meta: CliSessionMeta | null;
3804
4110
  };
3805
4111
  //#endregion
3806
- export { AUTH_CODE_PARAM, Achievement, Affiliate, AffiliateStatus, AffiliateTier, AffiliateTierName, Agent, AgentActionHistoryEntry, AgentCharacter, AgentDelegatable, AgentEngine, AgentExecuteHandler, AgentExecuteOptions, AgentGender, AgentMessageMeta, AgentMessageOptions, AgentPrivate, AgentSettings, AgentSimple, AgentWalletMode, AggregatedRoute, AiCostEntry, AiCostsResponse, AiCostsSummary, Alert, ApiToken, AppEnv, AppFile, AppFileType, AppIngestion, AppSubscription, AppendKvEntryResult, AppointmentAvailability, AppointmentAvailabilityService, AppointmentAvailabilitySlot, AppointmentBooking, AppointmentBookingContext, AppointmentPolicy, AppointmentPolicySync, AppointmentRequest, AppointmentSlot, AuthUser, BillingAddress, Blueprint, BlueprintOnboardingStep, BlueprintRedirect, BlueprintSettings, BlueprintShortcut, BlueprintTask, BlueprintTeam, BoardSummaryViewable, BookmarkEntry, BrandBackend, BrandIntegration, BrandIntegrationAction, BrandIntegrationProvider, BrandSearchHit, BrandSiteConfig, BrandSourceConfig, Budget, ByokProviderConfig, ByokProviderName, ByokProviders, CalendarProvider, CalendarStatus, Campaign, CampaignApproval, CampaignCategory, CampaignChannel, CampaignCreatePayload, CampaignStats, CampaignStatus, CampaignUpdatePayload, Card, Cart, CartItem, Challenge, Challenges, ChangelogEntry, Character, ChatClientAction, ChatClientThought, ChatStreamData, ChatStreamEventType, CliSessionMeta, CliSessionStatus, CommissionAgreement, Configuration, Contact, ContactActivity, ContactActivityAuthor, ContactActivityType, ContactConsent, ContactConsentStatus, ContactCreatePayload, ContactFormData, ContactHealth, ContactViewable, Contract, ContractCategoryDisplayNames, ContractCategoryName, ContractCodeMetadata, ContractEntity, ContractOnNetwork, ContractVersion, ContractsAddressConfig, CortexExecuteOptions, Coupon, CouponCondition, CouponRestrictedItem, CouponRestrictedItemType, CreateHookPayload, CreateInboundHookPayload, CreateInternalHookPayload, CreateKvFieldPayload, CreateWarpLinkedHookPayload, CreateWebHookPayload, DefaultCodeMetadata, DemoFlow, DemoMessage, Desk, DeskItem, DeskItemRole, Document, EarnResponse, Earning, Element, ElementSpec, ElementType, ElementVariation, EmailProvider, EmbedStatus, EncryptionStatus, Entity, EntityDirectExecuteRequest, EntityProposable, EntitySignable, EntityTemplate, Experience, FileInfo, FileMetadata, Flow, FlowCategory, FlowInputMapping, FlowStatus, FlowStep, GamificationData, GamificationEventType, Goal, GoalCreatePayload, GoalPriority, GoalProgressViewable, GoalStatus, HintOptions, HintPosition, Hook, HookSample, HookTrigger, HookTriggerCondition, HookTriggerInput, HttpService, IAppResponse, IHttpService, IRequestOptions, IngestionSourceType, IngestionStatus, Inquiry, InquiryStatus, InquiryType, Integration, IntegrationConnectionDetails, IntegrationDetails, IntegrationMeta, IntegrationType, Intent, 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, Milestone, MilestoneType, Mission, MissionBudget, MissionCreatePayload, MissionPlan, MissionPriority, MissionSchedule, MissionStatus, MissionViewable, MollieTerminalPaymentResult, MultimodalContent, MultimodalFile, NativeApp, NativeApps, Notification, NotificationAction, NotificationAgent, NotificationChannel, NotificationSetting, OG_IMAGE_CONFIG, OG_IMAGE_HEIGHT, OG_IMAGE_WIDTH, OfficeAgent, OfficeEntity, OfficeEntityKind, OfficeLiveOverrides, OfficeMember, OfficeSnapshot, OfficeStatus, OfficeStatusFilter, OfficeTypeFilter, OgImageColors, OgImageParams, OgImageType, Order, OrderConfigurationItem, OrderContext, OrderItem, OrderSource, OrderStatus, OrderType, PaginatedResponse, Pass, PaymentAccount, PaymentAccountOnboarding, PaymentProvider, PayoutEntry, PeriodTypeLabels, PeriodTypeOptions, PermissionConfigType, 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, Room, RoomId, RoomKind, ScInfo, SchedulePreset, SecretAuthorizable, SecretSettable, Segment, SegmentCondition, SegmentConditionType, SegmentCountPayload, SegmentCountResult, SegmentCreatePayload, SegmentGroup, SendableActivityUpdate, SendableAgentAction, SendableAgentMessage, SendableAgentThought, SendableMedia, SendableUserMessage, Service, SetKvEntryResult, Shortcut, Site, SiteAgent, SiteBrand, SiteRoute, SiteTeam, Skill, SkillMediaBindingRole, SkillMediaBindingRoleValue, SkillScope, SkillScopeValue, SkillType, SkillTypeValue, SocialAuthProvider, SocialBot, SocialPlatform, StampResponse, StoreAgent, StoreCheckoutItem, StoreData, StoreEntityType, StoreInfo, StoreItem, StoreListing, StorePriceTier, StorePricing, StorePurchasable, StorePurchaseResult, Streak, SubscriptionInterval, SubscriptionPlan, SubscriptionStatus, Swarm, Tag, TagType, Task, Team, TeamBrand, TeamCategory, TeamEarning, TeamEarningsBalance, TeamFeature, TeamFeatureUsage, TeamMember, TeamMeta, TeamPayout, TeamPayoutAddress, TeamPlace, TeamPrivate, TeamSettings, TeamUsage, TerminalConnectionToken, TerminalPaymentIntent, Tier, TierFeature, TierName, ToggleKvFieldResult, TranscriptEntry, TranscriptionCorrection, TranscriptionResponse, TranslatableValue, Update, UpdateCreatePayload, UpdateRelation, UpdateStats, UpdateStatus, UpdateType, UpdateUpdatePayload, Upgrade, UpgradeSourceType, UpgradeStatus, User, UserInterest, UserMode, UserPrivate, UserRole, 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, getAgentsBaseUrl, getApiBaseUrl, getAppBaseUrl, getAssetAppLogoUrl, getAssetChainLogoUrl, getAssetPartnerLogoUrl, getAssetTokenLogoUrl, getAssetWalletLogoUrl, getCortexBaseUrl, getDigestBaseUrl, getFormsBaseUrl, getLoginUrl, getMcpServerAgentUrl, getSiteUrl, getSitesBaseUrl, getSitesRootDomain, getStoreBaseUrl, getWarpScreenshotUrl, isFileFormatAudio, isFileFormatImage, isFileFormatVideo, isNativeApp, localize, nativeAppSlugs, ogImageUrl, resolveWarpText, sanitizeAlphanumeric, sanitizeNumeric, teamCategories, toCurrencyDisplay, toHexEncodedNonce, toNameInitials, toNftId, toPreviewText, withRetry };
4112
+ export { 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, AgentSimple, AgentToolingAccess, AgentWalletMode, AggregatedRoute, AiCostEntry, AiCostsResponse, AiCostsSummary, Alert, ApiToken, AppAccessRule, AppEnv, AppFile, AppFileType, AppIngestion, AppendKvEntryResult, AppointmentAvailability, AppointmentAvailabilityService, AppointmentAvailabilitySlot, AppointmentBooking, AppointmentBookingContext, AppointmentPolicy, AppointmentPolicySync, AppointmentRequest, AppointmentSlot, AuthUser, BillingManageAccess, Blueprint, BlueprintOnboardingStep, BlueprintRedirect, BlueprintSettings, BlueprintShortcut, BlueprintTask, BlueprintTeam, BoardSummaryViewable, BookmarkEntry, BrandBackend, BrandIntegration, BrandIntegrationAction, BrandIntegrationProvider, BrandSearchHit, BrandSiteConfig, BrandSourceConfig, Budget, ByokProviderConfig, ByokProviderName, ByokProviders, CalendarProvider, CalendarStatus, Campaign, CampaignApproval, CampaignCategory, CampaignChannel, CampaignCreatePayload, 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, ContactViewable, Contract, ContractCategoryDisplayNames, ContractCategoryName, ContractCodeMetadata, ContractEntity, ContractOnNetwork, ContractVersion, ContractsAddressConfig, CortexExecuteOptions, Coupon, CouponCondition, CouponRestrictedItem, CouponRestrictedItemType, 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, FileInfo, FileMetadata, Flow, FlowCategory, FlowInputMapping, FlowStatus, FlowStep, Fulfillment, FulfillmentLocation, type FulfillmentMethod, FulfillmentMethods, type FulfillmentStatus, FulfillmentStatuses, GamificationData, GamificationEventType, Goal, GoalCreatePayload, GoalPriority, GoalProgressViewable, GoalStatus, 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, 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, OfficeAgent, OfficeEntity, OfficeEntityKind, OfficeLiveOverrides, OfficeMember, OfficeSnapshot, OfficeStatus, OfficeStatusFilter, OfficeTypeFilter, OgImageColors, OgImageParams, OgImageType, Order, OrderConfigurationItem, OrderContext, OrderItem, OrderSource, OrderStatus, OrderType, PaginatedResponse, Pass, 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, Skill, SkillMediaBindingRole, SkillMediaBindingRoleValue, SkillScope, SkillScopeValue, SkillType, SkillTypeValue, SocialAuthProvider, SocialBot, SocialPlatform, 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, TeamEarning, TeamEarningsBalance, TeamFeature, TeamFeatureAccess, TeamFeatureArea, TeamFeatureUsage, TeamManageAccess, TeamMember, TeamMeta, TeamPayout, TeamPayoutAddress, TeamPlace, TeamPrivate, TeamSettings, TeamUsage, TeamViewAccess, TerminalConnectionToken, TerminalPaymentIntent, Tier, TierFeature, TierName, ToggleKvFieldResult, TranscriptEntry, TranscriptionCorrection, TranscriptionResponse, TranslatableValue, 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, cartLineTotal, defaultInviteTeamRole, fulfillmentMethodValues, fulfillmentStatusValues, getAgentsBaseUrl, getApiBaseUrl, getAppBaseUrl, getAssetAppLogoUrl, getAssetChainLogoUrl, getAssetPartnerLogoUrl, getAssetTokenLogoUrl, getAssetWalletLogoUrl, getCortexBaseUrl, getDigestBaseUrl, getFormsBaseUrl, getLoginUrl, getMcpServerAgentUrl, getSiteUrl, getSitesBaseUrl, getSitesRootDomain, getStoreBaseUrl, getWarpScreenshotUrl, hasAllPermissions, hasAllTeamPermissions, hasAnyPermissions, hasPermission, hasTeamPermission, inviteableTeamRoles, isCompleteAddressInput, isFileFormatAudio, isFileFormatImage, isFileFormatVideo, isNativeApp, isNativeAppAccessible, isNativeAppGated, isNativeAppLocked, isTeamFeatureAccessible, isTeamFeatureGated, isTeamFeatureLocked, isUserRole, localize, nativeAppSlugs, ogImageUrl, permissionPresetRules, resolveAccessCatalog, resolveWarpText, returnStatusValues, returnUpdateStatusValues, sanitizeAlphanumeric, sanitizeNumeric, teamCategories, toCurrencyDisplay, toHexEncodedNonce, toNameInitials, toNftId, toPreviewText, userPermissionValues, userRoleValues, withRetry };
package/dist/index.mjs CHANGED
@@ -58,8 +58,8 @@ const getSitesRootDomain = (env) => {
58
58
  const getSiteUrl = (env, teamSlug, brandSlug) => `https://${getSitesRootDomain(env)}/${teamSlug}/${brandSlug}`;
59
59
  //#endregion
60
60
  //#region src/auth/token.ts
61
- /** One-time native/deep-link handoff param (exchanged for a Bearer via API). */
62
- const AUTH_CODE_PARAM = "auth_code";
61
+ /** One-time native/deep-link handoff fragment key (exchanged for a Bearer via POST). */
62
+ const NATIVE_AUTH_TOKEN_PARAM = "token";
63
63
  /** Login URL on the main app with a direct return URL (no mini-app callback). */
64
64
  const getLoginUrl = (env, returnTo, branding) => {
65
65
  const params = new URLSearchParams({ redirect: returnTo });
@@ -282,6 +282,47 @@ function resolveWarpText(text, locale = "en") {
282
282
  return text[locale] ?? text.en ?? Object.values(text)[0] ?? "";
283
283
  }
284
284
  //#endregion
285
+ //#region src/address/enums.ts
286
+ const AddressTypes = {
287
+ Billing: "billing",
288
+ Shipping: "shipping"
289
+ };
290
+ const addressTypeValues = Object.values(AddressTypes);
291
+ //#endregion
292
+ //#region src/commerce/enums.ts
293
+ const FulfillmentStatuses = {
294
+ Pending: "pending",
295
+ ReadyForPickup: "ready_for_pickup",
296
+ Shipped: "shipped",
297
+ Delivered: "delivered",
298
+ Cancelled: "cancelled"
299
+ };
300
+ const fulfillmentStatusValues = Object.values(FulfillmentStatuses);
301
+ const FulfillmentMethods = {
302
+ Shipping: "shipping",
303
+ Pickup: "pickup"
304
+ };
305
+ const fulfillmentMethodValues = Object.values(FulfillmentMethods);
306
+ const ReturnStatuses = {
307
+ Requested: "requested",
308
+ Approved: "approved",
309
+ Rejected: "rejected",
310
+ Received: "received",
311
+ Closed: "closed"
312
+ };
313
+ const returnStatusValues = Object.values(ReturnStatuses);
314
+ const ReturnUpdateStatuses = {
315
+ Approved: "approved",
316
+ Rejected: "rejected",
317
+ Received: "received",
318
+ Closed: "closed"
319
+ };
320
+ const returnUpdateStatusValues = Object.values(ReturnUpdateStatuses);
321
+ //#endregion
322
+ //#region src/commerce/helpers.ts
323
+ const cartLineTotal = (items) => items.reduce((total, item) => total + item.price * item.quantity, 0);
324
+ const isCompleteAddressInput = (address) => Boolean(address.name.trim() && address.addressOne.trim() && address.city.trim() && address.zipCode.trim() && address.country.trim());
325
+ //#endregion
285
326
  //#region src/budget/types.ts
286
327
  const PeriodTypeLabels = {
287
328
  0: "One-time",
@@ -402,6 +443,7 @@ const NativeApps = {
402
443
  Shop: "shop",
403
444
  SmartLinks: "smart-links",
404
445
  Contacts: "contacts",
446
+ Forms: "forms",
405
447
  Appointments: "appointments",
406
448
  Workspace: "workspace",
407
449
  Meeting: "meeting",
@@ -416,4 +458,95 @@ const NativeApps = {
416
458
  const nativeAppSlugs = Object.values(NativeApps);
417
459
  const isNativeApp = (value) => typeof value === "string" && nativeAppSlugs.includes(value);
418
460
  //#endregion
419
- export { AUTH_CODE_PARAM, ContractCategoryDisplayNames, DefaultCodeMetadata, HttpService, JoaiUrls, NativeApps, OG_IMAGE_CONFIG, OG_IMAGE_HEIGHT, OG_IMAGE_WIDTH, OgImageColors, PeriodTypeLabels, PeriodTypeOptions, SkillMediaBindingRole, SkillScope, SkillType, abbreviateNumber, getAgentsBaseUrl, getApiBaseUrl, getAppBaseUrl, getAssetAppLogoUrl, getAssetChainLogoUrl, getAssetPartnerLogoUrl, getAssetTokenLogoUrl, getAssetWalletLogoUrl, getCortexBaseUrl, getDigestBaseUrl, getFormsBaseUrl, getLoginUrl, getMcpServerAgentUrl, getSiteUrl, getSitesBaseUrl, getSitesRootDomain, getStoreBaseUrl, getWarpScreenshotUrl, isFileFormatAudio, isFileFormatImage, isFileFormatVideo, isNativeApp, localize, nativeAppSlugs, ogImageUrl, resolveWarpText, sanitizeAlphanumeric, sanitizeNumeric, teamCategories, toCurrencyDisplay, toHexEncodedNonce, toNameInitials, toNftId, toPreviewText, withRetry };
461
+ //#region src/user/permissions.ts
462
+ /** Permission string values — must match joai--api `UserPermission::value`. */
463
+ const UserPermissions = {
464
+ BillingManage: "billing-manage",
465
+ TeamManage: "team-manage",
466
+ TeamView: "team-view",
467
+ TeamMemberInvite: "team-member-invite",
468
+ TeamMemberRemove: "team-member-remove",
469
+ TeamSecretView: "team-secret-view",
470
+ TeamSecretManage: "team-secret-manage",
471
+ AgentExecute: "agent-execute",
472
+ AgentWalletManage: "agent-wallet-manage",
473
+ SwarmCreate: "swarm-create"
474
+ };
475
+ const userPermissionValues = Object.values(UserPermissions);
476
+ const hasPermission = (granted, required) => Boolean(granted?.includes(required));
477
+ const hasAllPermissions = (granted, required) => required.every((permission) => hasPermission(granted, permission));
478
+ const hasAnyPermissions = (granted, required) => required.some((permission) => hasPermission(granted, permission));
479
+ const hasTeamPermission = (team, permission) => hasPermission(team?.permissions, permission);
480
+ const hasAllTeamPermissions = (team, permissions) => hasAllPermissions(team?.permissions, permissions);
481
+ //#endregion
482
+ //#region src/access/mcp-access.ts
483
+ /** Preset names — must match joai--api `PermissionPreset::value`. */
484
+ const PermissionPresetNames = {
485
+ TeamManage: "teamManage",
486
+ TeamView: "teamView",
487
+ BillingManage: "billingManage",
488
+ AgentTooling: "agentTooling",
489
+ SecretView: "secretView",
490
+ SecretManage: "secretManage",
491
+ TeamMemberInvite: "teamMemberInvite",
492
+ TeamMemberRemove: "teamMemberRemove",
493
+ AgentWalletManage: "agentWalletManage",
494
+ SwarmCreate: "swarmCreate"
495
+ };
496
+ const teamManageOr = (...permissions) => ({ permissionsAny: [UserPermissions.TeamManage, ...permissions] });
497
+ const permissionPresetRules = {
498
+ teamManage: { permissions: [UserPermissions.TeamManage] },
499
+ teamView: teamManageOr(UserPermissions.TeamView),
500
+ billingManage: teamManageOr(UserPermissions.BillingManage),
501
+ agentTooling: teamManageOr(UserPermissions.AgentExecute),
502
+ secretView: teamManageOr(UserPermissions.TeamSecretView),
503
+ secretManage: teamManageOr(UserPermissions.TeamSecretManage),
504
+ teamMemberInvite: teamManageOr(UserPermissions.TeamMemberInvite),
505
+ teamMemberRemove: teamManageOr(UserPermissions.TeamMemberRemove),
506
+ agentWalletManage: teamManageOr(UserPermissions.AgentWalletManage),
507
+ swarmCreate: teamManageOr(UserPermissions.SwarmCreate)
508
+ };
509
+ const TeamManageAccess = permissionPresetRules.teamManage;
510
+ const TeamViewAccess = permissionPresetRules.teamView;
511
+ const AgentToolingAccess = permissionPresetRules.agentTooling;
512
+ const BillingManageAccess = permissionPresetRules.billingManage;
513
+ //#endregion
514
+ //#region src/access/team-access.ts
515
+ const resolveAccessCatalog = (team, accessConfig) => team?.accessCatalog ?? accessConfig?.accessCatalog;
516
+ const featureSection = (team, area) => team?.access?.[area];
517
+ const isTeamFeatureGated = (catalog, area, key) => Boolean(catalog?.[area]?.includes(key));
518
+ const isNativeAppGated = (catalog, app) => Boolean(catalog?.nativeApps?.includes(app));
519
+ const isTeamFeatureAccessible = (team, area, key) => {
520
+ const section = featureSection(team, area);
521
+ if (!section || !(key in section)) return true;
522
+ return section[key] === true;
523
+ };
524
+ const isTeamFeatureLocked = (team, catalog, area, key) => isTeamFeatureGated(catalog, area, key) && !isTeamFeatureAccessible(team, area, key);
525
+ const isNativeAppAccessible = (team, app) => {
526
+ const section = team?.access?.nativeApps;
527
+ if (!section || !(app in section)) return true;
528
+ return section[app] === true;
529
+ };
530
+ const isNativeAppLocked = (team, catalog, app) => isNativeAppGated(catalog, app) && !isNativeAppAccessible(team, app);
531
+ //#endregion
532
+ //#region src/user/roles.ts
533
+ /** Team member roles — values must match joai--api `UserRole::toName()`. */
534
+ const UserRoles = {
535
+ Owner: "owner",
536
+ Admin: "admin",
537
+ Member: "member",
538
+ Developer: "developer"
539
+ };
540
+ const userRoleValues = Object.values(UserRoles);
541
+ const isUserRole = (value) => userRoleValues.includes(value);
542
+ /** Roles assignable via team invite — owner is never inviteable. Must match API `RolePermissions::inviteable()`. */
543
+ const InviteableTeamRoles = [
544
+ UserRoles.Member,
545
+ UserRoles.Developer,
546
+ UserRoles.Admin
547
+ ];
548
+ const DefaultInviteTeamRole = UserRoles.Member;
549
+ const inviteableTeamRoles = () => [...InviteableTeamRoles];
550
+ const defaultInviteTeamRole = () => DefaultInviteTeamRole;
551
+ //#endregion
552
+ export { AddressTypes, AgentToolingAccess, BillingManageAccess, ContractCategoryDisplayNames, DefaultCodeMetadata, DefaultInviteTeamRole, FulfillmentMethods, FulfillmentStatuses, HttpService, InviteableTeamRoles, JoaiUrls, NATIVE_AUTH_TOKEN_PARAM, NativeApps, OG_IMAGE_CONFIG, OG_IMAGE_HEIGHT, OG_IMAGE_WIDTH, OgImageColors, PeriodTypeLabels, PeriodTypeOptions, PermissionPresetNames, ReturnStatuses, ReturnUpdateStatuses, SkillMediaBindingRole, SkillScope, SkillType, TeamManageAccess, TeamViewAccess, UserPermissions, UserRoles, abbreviateNumber, addressTypeValues, cartLineTotal, defaultInviteTeamRole, fulfillmentMethodValues, fulfillmentStatusValues, getAgentsBaseUrl, getApiBaseUrl, getAppBaseUrl, getAssetAppLogoUrl, getAssetChainLogoUrl, getAssetPartnerLogoUrl, getAssetTokenLogoUrl, getAssetWalletLogoUrl, getCortexBaseUrl, getDigestBaseUrl, getFormsBaseUrl, getLoginUrl, getMcpServerAgentUrl, getSiteUrl, getSitesBaseUrl, getSitesRootDomain, getStoreBaseUrl, getWarpScreenshotUrl, hasAllPermissions, hasAllTeamPermissions, hasAnyPermissions, hasPermission, hasTeamPermission, inviteableTeamRoles, isCompleteAddressInput, isFileFormatAudio, isFileFormatImage, isFileFormatVideo, isNativeApp, isNativeAppAccessible, isNativeAppGated, isNativeAppLocked, isTeamFeatureAccessible, isTeamFeatureGated, isTeamFeatureLocked, isUserRole, localize, nativeAppSlugs, ogImageUrl, permissionPresetRules, resolveAccessCatalog, resolveWarpText, returnStatusValues, returnUpdateStatusValues, sanitizeAlphanumeric, sanitizeNumeric, 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.1.0",
3
+ "version": "4.3.0",
4
4
  "description": "JoAi shared types, HTTP service, and config",
5
5
  "license": "MIT",
6
6
  "type": "module",