@joai/sdk 4.2.0 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -154,8 +154,33 @@ type WalletList = Partial<Record<WarpChainName, {
154
154
  provider: WarpWalletProvider;
155
155
  address?: string;
156
156
  }>>; //#endregion
157
+ //#region src/user/permissions.d.ts
158
+ /** Permission string values — must match joai--api `UserPermission::value`. */
159
+ declare const UserPermissions: {
160
+ readonly BillingManage: "billing-manage";
161
+ readonly TeamManage: "team-manage";
162
+ readonly TeamView: "team-view";
163
+ readonly TeamMemberInvite: "team-member-invite";
164
+ readonly TeamMemberRemove: "team-member-remove";
165
+ readonly TeamSecretView: "team-secret-view";
166
+ readonly TeamSecretManage: "team-secret-manage";
167
+ readonly AgentExecute: "agent-execute";
168
+ readonly AgentWalletManage: "agent-wallet-manage";
169
+ readonly SwarmCreate: "swarm-create";
170
+ };
171
+ type UserPermission = (typeof UserPermissions)[keyof typeof UserPermissions];
172
+ //#endregion
173
+ //#region src/user/roles.d.ts
174
+ /** Team member roles — values must match joai--api `UserRole::toName()`. */
175
+ declare const UserRoles: {
176
+ readonly Owner: "owner";
177
+ readonly Admin: "admin";
178
+ readonly Member: "member";
179
+ readonly Developer: "developer";
180
+ };
181
+ type UserRole = (typeof UserRoles)[keyof typeof UserRoles];
182
+ //#endregion
157
183
  //#region src/user/types.d.ts
158
- type UserRole = 'owner' | 'member';
159
184
  type UserMode = 'simple' | 'advanced';
160
185
  type UserInterest = 'payments' | 'health' | 'content' | 'business' | 'finance' | 'research' | 'shopping' | 'web3' | 'developer' | 'fitness' | 'ecommerce';
161
186
  type UserSettings = {
@@ -191,7 +216,6 @@ type UserPrivate = {
191
216
  socials: UserSocialAccount[];
192
217
  justCreated: boolean;
193
218
  affiliate: Affiliate | null;
194
- betaRestricted: boolean;
195
219
  kyc?: Kyc | null;
196
220
  settings: UserSettings;
197
221
  };
@@ -242,8 +266,6 @@ type AffiliateTier = {
242
266
  threshold: number;
243
267
  };
244
268
  type AffiliateStatus = 'pending' | 'approved' | 'rejected' | 'suspended' | 'demoted'; //#endregion
245
- //#region src/team/constants.d.ts
246
- declare const teamCategories: readonly ["general", "food-drink", "retail", "beauty-wellness", "health", "sports-fitness", "trades-services", "professional-services", "education-culture", "clubs-organizations", "leisure-tourism"]; //#endregion
247
269
  //#region src/team/apps.d.ts
248
270
  declare const NativeApps: {
249
271
  readonly Board: "board";
@@ -264,6 +286,25 @@ declare const NativeApps: {
264
286
  };
265
287
  type NativeApp = (typeof NativeApps)[keyof typeof NativeApps];
266
288
  //#endregion
289
+ //#region src/access/team-access.d.ts
290
+ type TeamFeatureArea = 'nativeApps' | 'agentSettings' | 'teamSettings' | 'developerHub' | 'areas' | 'commerce';
291
+ /** Keys per area that the API evaluates in `team.access`. */
292
+ type TeamAccessCatalog = Partial<Record<TeamFeatureArea, string[]>>;
293
+ type TeamAccessConfig = {
294
+ accessCatalog: TeamAccessCatalog;
295
+ };
296
+ /** Resolved feature access from API `TeamPrivate.access` — do not evaluate rules on the client. */
297
+ type TeamFeatureAccess = {
298
+ nativeApps?: Partial<Record<NativeApp, boolean>>;
299
+ agentSettings?: Partial<Record<string, boolean>>;
300
+ teamSettings?: Partial<Record<string, boolean>>;
301
+ developerHub?: Partial<Record<string, boolean>>;
302
+ areas?: Partial<Record<string, boolean>>;
303
+ commerce?: Partial<Record<string, boolean>>;
304
+ };
305
+ //#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"]; //#endregion
267
308
  //#region src/team/types.d.ts
268
309
  type TeamCategory = (typeof teamCategories)[number];
269
310
  type TeamFeature = 'shop' | 'appointments';
@@ -375,6 +416,10 @@ type TeamPrivate = {
375
416
  category: TeamCategory;
376
417
  createdAt: string;
377
418
  justCreated: boolean;
419
+ role?: UserRole | null;
420
+ permissions?: UserPermission[];
421
+ access?: TeamFeatureAccess;
422
+ accessCatalog?: TeamAccessCatalog;
378
423
  };
379
424
  type ByokProviderConfig = {
380
425
  apiKey?: string;
@@ -442,8 +487,14 @@ type AiCostsResponse = {
442
487
  };
443
488
  };
444
489
  }; //#endregion
490
+ //#region src/address/enums.d.ts
491
+ declare const AddressTypes: {
492
+ readonly Billing: "billing";
493
+ readonly Shipping: "shipping";
494
+ };
495
+ type AddressType = (typeof AddressTypes)[keyof typeof AddressTypes];
496
+ //#endregion
445
497
  //#region src/address/types.d.ts
446
- type AddressType = 'shipping' | 'billing';
447
498
  type Address = {
448
499
  id: string;
449
500
  type: AddressType;
@@ -495,8 +546,30 @@ type AddressCreatePayload = {
495
546
  team?: string;
496
547
  };
497
548
  type AddressUpdatePayload = Partial<Omit<AddressCreatePayload, 'contact' | 'team'>>; //#endregion
549
+ //#region src/commerce/enums.d.ts
550
+ declare const FulfillmentStatuses: {
551
+ readonly Pending: "pending";
552
+ readonly ReadyForPickup: "ready_for_pickup";
553
+ readonly Shipped: "shipped";
554
+ readonly Delivered: "delivered";
555
+ readonly Cancelled: "cancelled";
556
+ };
557
+ type FulfillmentStatus = (typeof FulfillmentStatuses)[keyof typeof FulfillmentStatuses];
558
+ declare const FulfillmentMethods: {
559
+ readonly Shipping: "shipping";
560
+ readonly Pickup: "pickup";
561
+ };
562
+ type FulfillmentMethod = (typeof FulfillmentMethods)[keyof typeof FulfillmentMethods];
563
+ declare const ReturnStatuses: {
564
+ readonly Requested: "requested";
565
+ readonly Approved: "approved";
566
+ readonly Rejected: "rejected";
567
+ readonly Received: "received";
568
+ readonly Closed: "closed";
569
+ };
570
+ type ReturnStatus = (typeof ReturnStatuses)[keyof typeof ReturnStatuses];
571
+ //#endregion
498
572
  //#region src/commerce/types.d.ts
499
- type FulfillmentMethod = 'shipping' | 'pickup';
500
573
  type ShippingRate = {
501
574
  id: number;
502
575
  name: string;
@@ -554,7 +627,6 @@ type FulfillmentLocation = {
554
627
  instructions: string | null;
555
628
  active: boolean;
556
629
  };
557
- type FulfillmentStatus = 'pending' | 'ready_for_pickup' | 'shipped' | 'delivered' | 'cancelled';
558
630
  type Fulfillment = {
559
631
  id: string;
560
632
  orderId: number;
@@ -571,7 +643,6 @@ type Fulfillment = {
571
643
  readyForPickupAt: string | null;
572
644
  deliveredAt: string | null;
573
645
  };
574
- type ReturnStatus = 'requested' | 'approved' | 'rejected' | 'received' | 'closed';
575
646
  type Return = {
576
647
  id: string;
577
648
  orderId: number;
@@ -4486,7 +4557,7 @@ type TeamMutationPayload = {
4486
4557
  settings?: Record<string, JsonValue>;
4487
4558
  emails?: {
4488
4559
  email: string;
4489
- role: 'owner' | 'admin' | 'member';
4560
+ role: UserRole;
4490
4561
  }[];
4491
4562
  website?: string | null;
4492
4563
  phone?: string | null;
@@ -4512,7 +4583,7 @@ declare class TeamsResource {
4512
4583
  updateTagline(teamSlug: string, tagline: TranslatableValue | null): Promise<IAppResponse<TeamPrivate>>;
4513
4584
  invite(teamSlug: string, payload: {
4514
4585
  email: string;
4515
- role: 'owner' | 'admin' | 'member';
4586
+ role: UserRole;
4516
4587
  }): Promise<IAppResponse<void>>;
4517
4588
  inviteMember(teamSlug: string, email: string, role: UserRole): Promise<IAppResponse<void>>;
4518
4589
  removeMember(teamSlug: string, memberId: string): Promise<IAppResponse<void>>;
@@ -4527,6 +4598,7 @@ declare class TeamsResource {
4527
4598
  }): Promise<IAppResponse<TeamPlace[]>>;
4528
4599
  selectPlace(teamSlug: string, sourceId: string | null): Promise<IAppResponse<TeamPrivate>>;
4529
4600
  listPrivate(): Promise<IAppResponse<TeamPrivate[]>>;
4601
+ accessConfig(): Promise<IAppResponse<TeamAccessConfig>>;
4530
4602
  getInviteByToken(token: string): Promise<IAppResponse<TeamInviteInfo>>;
4531
4603
  acceptInvite(slug: string): Promise<IAppResponse<void>>;
4532
4604
  usage(teamSlug: string): Promise<IAppResponse<TeamUsage>>;
package/dist/index.mjs CHANGED
@@ -110,6 +110,34 @@ var HttpService = class {
110
110
  };
111
111
  }
112
112
  };
113
+ Object.values({
114
+ Billing: "billing",
115
+ Shipping: "shipping"
116
+ });
117
+ Object.values({
118
+ Pending: "pending",
119
+ ReadyForPickup: "ready_for_pickup",
120
+ Shipped: "shipped",
121
+ Delivered: "delivered",
122
+ Cancelled: "cancelled"
123
+ });
124
+ Object.values({
125
+ Shipping: "shipping",
126
+ Pickup: "pickup"
127
+ });
128
+ Object.values({
129
+ Requested: "requested",
130
+ Approved: "approved",
131
+ Rejected: "rejected",
132
+ Received: "received",
133
+ Closed: "closed"
134
+ });
135
+ Object.values({
136
+ Approved: "approved",
137
+ Rejected: "rejected",
138
+ Received: "received",
139
+ Closed: "closed"
140
+ });
113
141
  Object.values({
114
142
  Board: "board",
115
143
  Shop: "shop",
@@ -127,6 +155,47 @@ Object.values({
127
155
  Sites: "sites",
128
156
  Contracts: "contracts"
129
157
  });
158
+ /** Permission string values — must match joai--api `UserPermission::value`. */
159
+ const UserPermissions = {
160
+ BillingManage: "billing-manage",
161
+ TeamManage: "team-manage",
162
+ TeamView: "team-view",
163
+ TeamMemberInvite: "team-member-invite",
164
+ TeamMemberRemove: "team-member-remove",
165
+ TeamSecretView: "team-secret-view",
166
+ TeamSecretManage: "team-secret-manage",
167
+ AgentExecute: "agent-execute",
168
+ AgentWalletManage: "agent-wallet-manage",
169
+ SwarmCreate: "swarm-create"
170
+ };
171
+ Object.values(UserPermissions);
172
+ const teamManageOr = (...permissions) => ({ permissionsAny: [UserPermissions.TeamManage, ...permissions] });
173
+ const permissionPresetRules = {
174
+ teamManage: { permissions: [UserPermissions.TeamManage] },
175
+ teamView: teamManageOr(UserPermissions.TeamView),
176
+ billingManage: teamManageOr(UserPermissions.BillingManage),
177
+ agentTooling: teamManageOr(UserPermissions.AgentExecute),
178
+ secretView: teamManageOr(UserPermissions.TeamSecretView),
179
+ secretManage: teamManageOr(UserPermissions.TeamSecretManage),
180
+ teamMemberInvite: teamManageOr(UserPermissions.TeamMemberInvite),
181
+ teamMemberRemove: teamManageOr(UserPermissions.TeamMemberRemove),
182
+ agentWalletManage: teamManageOr(UserPermissions.AgentWalletManage),
183
+ swarmCreate: teamManageOr(UserPermissions.SwarmCreate)
184
+ };
185
+ permissionPresetRules.teamManage;
186
+ permissionPresetRules.teamView;
187
+ permissionPresetRules.agentTooling;
188
+ permissionPresetRules.billingManage;
189
+ /** Team member roles — values must match joai--api `UserRole::toName()`. */
190
+ const UserRoles = {
191
+ Owner: "owner",
192
+ Admin: "admin",
193
+ Member: "member",
194
+ Developer: "developer"
195
+ };
196
+ Object.values(UserRoles);
197
+ UserRoles.Member, UserRoles.Developer, UserRoles.Admin;
198
+ UserRoles.Member;
130
199
  //#endregion
131
200
  //#region src/resources/agents.ts
132
201
  var AgentsResource = class {
@@ -2298,6 +2367,9 @@ var TeamsResource = class {
2298
2367
  listPrivate() {
2299
2368
  return this.http.get("teams?me=true");
2300
2369
  }
2370
+ accessConfig() {
2371
+ return this.http.get("teams/access-config");
2372
+ }
2301
2373
  getInviteByToken(token) {
2302
2374
  return this.http.get(`teams/invite/${token}`);
2303
2375
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",