@joai/sdk 1.3.0 → 1.4.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
@@ -261,7 +261,7 @@ type AffiliateStatus = 'pending' | 'approved' | 'rejected' | 'suspended' | 'demo
261
261
  //#region src/team/constants.d.ts
262
262
  declare const teamCategories: readonly ["general", "food-drink", "retail", "beauty-wellness", "health", "sports-fitness", "trades-services", "professional-services", "education-culture", "clubs-organizations", "leisure-tourism"]; //#endregion
263
263
  //#region src/team/types.d.ts
264
- type TeamCategory = typeof teamCategories[number];
264
+ type TeamCategory = (typeof teamCategories)[number];
265
265
  type TeamFeature = 'shop' | 'appointments';
266
266
  type TeamMember = User & {
267
267
  role: UserRole | null;
@@ -271,7 +271,7 @@ type TeamMember = User & {
271
271
  type TeamMeta = {
272
272
  'extra.messages'?: number;
273
273
  'limit.spending'?: number | null;
274
- 'currency'?: string;
274
+ currency?: string;
275
275
  'extra.usage.enabled'?: boolean;
276
276
  'auto.reload.enabled'?: boolean;
277
277
  'auto.reload.threshold_cents'?: number | null;
@@ -281,9 +281,10 @@ type TeamMeta = {
281
281
  'board.auto.enabled'?: boolean;
282
282
  'payments.online'?: boolean;
283
283
  'payments.coupons'?: boolean;
284
+ 'kiosk.enabled'?: boolean;
284
285
  'stock.enabled'?: boolean;
285
- 'contactPropertyMaskWarp'?: string;
286
- 'branding'?: TeamBrand | null;
286
+ contactPropertyMaskWarp?: string;
287
+ branding?: TeamBrand | null;
287
288
  settings: Record<string, unknown>;
288
289
  };
289
290
  type Team = {
@@ -304,6 +305,7 @@ type Team = {
304
305
  createdAt: string;
305
306
  blueprints?: Blueprint[];
306
307
  flows?: Flow[];
308
+ coupons?: Coupon[];
307
309
  };
308
310
  type TeamBrand = {
309
311
  bg?: string;
@@ -738,7 +740,7 @@ type CartItem = {
738
740
  name: TranslatableValue;
739
741
  price: number;
740
742
  quantity: number;
741
- type: 'service' | 'product';
743
+ type: 'service' | 'product' | 'coupon';
742
744
  sku: string | null;
743
745
  badge: string | null;
744
746
  configuration?: Configuration;
@@ -760,11 +762,17 @@ type CouponCondition = 'none' | 'onetime-use' | 'previous-purchase';
760
762
  type Coupon = {
761
763
  id: string;
762
764
  code: string;
765
+ name: TranslatableValue;
763
766
  amount: number | null;
764
767
  percent: number | null;
768
+ price: number | null;
765
769
  condition: CouponCondition;
766
770
  usesLeft: number | null;
767
771
  expiresAt: string | null;
772
+ active: boolean;
773
+ public: boolean;
774
+ sellable: boolean;
775
+ media: Media[];
768
776
  };
769
777
  type PurchaseResult = {
770
778
  order_id?: string;
@@ -795,7 +803,7 @@ type Skill = {
795
803
  screenshots: string[];
796
804
  }; //#endregion
797
805
  //#region src/integration/types.d.ts
798
- type IntegrationType = 'none' | 'webhook' | 'api-token' | 'telegram' | 'slack' | 'whatsapp' | 'twilio' | 'sms' | 'n8n' | 'apple-health' | 'mcp' | 'x' | 'email' | 'calendar' | 'embed' | 'discord' | 'github' | 'sentry' | 'readwise';
806
+ type IntegrationType = 'none' | 'webhook' | 'api-token' | 'telegram' | 'slack' | 'whatsapp' | 'twilio' | 'sms' | 'n8n' | 'apple-health' | 'mcp' | 'x' | 'email' | 'calendar' | 'embed' | 'discord' | 'github' | 'push' | 'sentry' | 'readwise';
799
807
  type IntegrationDetails = {
800
808
  type: IntegrationType;
801
809
  name: string;
@@ -1039,10 +1047,10 @@ type WarpBackend = {
1039
1047
  creator: string;
1040
1048
  status: WarpBackendStatus;
1041
1049
  active: boolean;
1042
- category: WarpBackendCategory;
1043
1050
  featured: boolean;
1044
1051
  form: boolean;
1045
1052
  store: boolean;
1053
+ public: boolean;
1046
1054
  executions: number;
1047
1055
  price?: number | null;
1048
1056
  primaryAddress: string | null;
@@ -1057,7 +1065,6 @@ type WarpBackend = {
1057
1065
  executionHistory?: number[] | null;
1058
1066
  };
1059
1067
  type WarpBackendStatus = 'unverified' | 'verified' | 'blacklisted';
1060
- type WarpBackendCategory = 'none';
1061
1068
  type WarpExecutionBackend = {
1062
1069
  id: string;
1063
1070
  room: string | null;
@@ -2454,7 +2461,7 @@ type LoyaltyMember = {
2454
2461
  updatedAt: string;
2455
2462
  }; //#endregion
2456
2463
  //#region src/segment/types.d.ts
2457
- type SegmentConditionType = 'tag' | 'has_email' | 'has_phone' | 'created_after' | 'created_before' | 'email_contains';
2464
+ type SegmentConditionType = 'tag' | 'has_email' | 'has_phone' | 'has_user' | 'last_purchase_after' | 'last_purchase_before' | 'total_order_amount' | 'order_count_at_least' | 'never_purchased' | 'avg_order_value_at_least' | 'last_contact_after' | 'last_contact_before' | 'created_after' | 'created_before' | 'email_contains';
2458
2465
  type SegmentCondition = {
2459
2466
  type: SegmentConditionType;
2460
2467
  value: string | boolean;
@@ -2485,7 +2492,7 @@ type SegmentCountResult = {
2485
2492
  reachable: number | null;
2486
2493
  }; //#endregion
2487
2494
  //#region src/campaign/types.d.ts
2488
- type CampaignChannel = 'email' | 'whatsapp' | 'sms';
2495
+ type CampaignChannel = 'email' | 'whatsapp' | 'sms' | 'push';
2489
2496
  type CampaignStatus = 'draft' | 'sending' | 'completed' | 'failed';
2490
2497
  type Campaign = {
2491
2498
  id: string;
@@ -3082,9 +3089,9 @@ declare class CartsResource {
3082
3089
  private readonly http;
3083
3090
  constructor(http: IHttpService);
3084
3091
  get(): Promise<IAppResponse<Cart>>;
3085
- add(type: 'product' | 'service', id: string, quantity?: number, configuration?: Configuration): Promise<IAppResponse<Cart>>;
3086
- remove(type: 'product' | 'service', id: string): Promise<IAppResponse<Cart>>;
3087
- updateQuantity(type: 'product' | 'service', id: string, quantity: number): Promise<IAppResponse<Cart>>;
3092
+ add(type: 'product' | 'service' | 'coupon', id: string, quantity?: number, configuration?: Configuration): Promise<IAppResponse<Cart>>;
3093
+ remove(type: 'product' | 'service' | 'coupon', id: string): Promise<IAppResponse<Cart>>;
3094
+ updateQuantity(type: 'product' | 'service' | 'coupon', id: string, quantity: number): Promise<IAppResponse<Cart>>;
3088
3095
  clear(): Promise<IAppResponse<Cart>>;
3089
3096
  applyCoupon(code: string): Promise<IAppResponse<void>>;
3090
3097
  }
@@ -3092,16 +3099,23 @@ declare class CartsResource {
3092
3099
  //#region src/resources/coupons.d.ts
3093
3100
  type CouponPayload = {
3094
3101
  code: string;
3102
+ name?: TranslatableValue;
3095
3103
  percent?: number | null;
3096
3104
  amount?: number | null;
3105
+ price?: number | null;
3106
+ active?: boolean;
3107
+ public?: boolean;
3097
3108
  condition?: CouponCondition;
3098
3109
  usesLeft?: number | null;
3099
3110
  expiresAt?: string | null;
3111
+ media?: MediaLibraryAttributes[];
3100
3112
  };
3101
3113
  declare class CouponsResource {
3102
3114
  private readonly http;
3103
3115
  constructor(http: IHttpService);
3104
- list(team: string): Promise<IAppResponse<Coupon[]>>;
3116
+ list(team: string, options?: {
3117
+ public?: boolean;
3118
+ }): Promise<IAppResponse<Coupon[]>>;
3105
3119
  create(team: string, data: CouponPayload): Promise<IAppResponse<Coupon>>;
3106
3120
  update(id: string, data: Partial<CouponPayload> & {
3107
3121
  clearExpiry?: boolean;
@@ -3623,7 +3637,7 @@ declare class OrdersResource {
3623
3637
  sendConfirmation?: boolean;
3624
3638
  items?: {
3625
3639
  id: string;
3626
- type: 'product' | 'service';
3640
+ type: 'product' | 'service' | 'coupon';
3627
3641
  quantity: number;
3628
3642
  configuration?: Configuration;
3629
3643
  }[];
@@ -3988,12 +4002,10 @@ type TeamMutationPayload = {
3988
4002
  declare class TeamsResource {
3989
4003
  private readonly http;
3990
4004
  constructor(http: IHttpService);
3991
- list(): Promise<IAppResponse<Team[]>>;
3992
- listPublic(params?: {
4005
+ list(params?: {
3993
4006
  tags?: string;
3994
4007
  }): Promise<IAppResponse<Team[]>>;
3995
4008
  get(slug: string): Promise<IAppResponse<Team>>;
3996
- getPublic(slug: string): Promise<IAppResponse<Team>>;
3997
4009
  create(data: TeamMutationPayload & {
3998
4010
  name: string;
3999
4011
  }): Promise<IAppResponse<TeamPrivate>>;
@@ -4047,14 +4059,12 @@ declare class SegmentsResource {
4047
4059
  declare class UpdatesResource {
4048
4060
  private readonly http;
4049
4061
  constructor(http: IHttpService);
4050
- listPublic(params?: {
4051
- type?: string;
4052
- tags?: string;
4053
- with?: UpdateRelation[];
4054
- }): Promise<IAppResponse<Update[]>>;
4055
4062
  list(params?: {
4056
- type?: UpdateType;
4063
+ team?: string;
4064
+ type?: UpdateType | string;
4065
+ status?: string;
4057
4066
  active?: boolean;
4067
+ tags?: string;
4058
4068
  with?: UpdateRelation[];
4059
4069
  }): Promise<IAppResponse<Update[]>>;
4060
4070
  create(payload: UpdateCreatePayload): Promise<IAppResponse<Update>>;
package/dist/index.mjs CHANGED
@@ -697,8 +697,9 @@ var CouponsResource = class {
697
697
  constructor(http) {
698
698
  this.http = http;
699
699
  }
700
- list(team) {
701
- return this.http.get("coupons", { headers: { "X-Team": team } });
700
+ list(team, options) {
701
+ const qs = options?.public ? `?team=${encodeURIComponent(team)}` : "";
702
+ return this.http.get(`coupons${qs}`, options?.public ? {} : { headers: { "X-Team": team } });
702
703
  }
703
704
  create(team, data) {
704
705
  return this.http.post("coupons", data, { headers: { "X-Team": team } });
@@ -1968,19 +1969,13 @@ var TeamsResource = class {
1968
1969
  constructor(http) {
1969
1970
  this.http = http;
1970
1971
  }
1971
- list() {
1972
- return this.http.get("teams");
1973
- }
1974
- listPublic(params) {
1972
+ list(params) {
1975
1973
  const qs = params?.tags ? `?tags=${encodeURIComponent(params.tags)}` : "";
1976
- return this.http.get(`teams/public${qs}`);
1974
+ return this.http.get(`teams${qs}`);
1977
1975
  }
1978
1976
  get(slug) {
1979
1977
  return this.http.get(`teams/${encodeURIComponent(slug)}`);
1980
1978
  }
1981
- getPublic(slug) {
1982
- return this.http.get(`teams/public/${encodeURIComponent(slug)}`);
1983
- }
1984
1979
  create(data) {
1985
1980
  return this.http.post("teams", data);
1986
1981
  }
@@ -2095,18 +2090,13 @@ var UpdatesResource = class {
2095
2090
  constructor(http) {
2096
2091
  this.http = http;
2097
2092
  }
2098
- listPublic(params) {
2099
- const query = new URLSearchParams();
2100
- if (params?.type) query.set("type", params.type);
2101
- if (params?.tags) query.set("tags", params.tags);
2102
- if (params?.with?.length) query.set("with", params.with.join(","));
2103
- const qs = query.toString();
2104
- return this.http.get(`updates/public${qs ? "?" + qs : ""}`);
2105
- }
2106
2093
  list(params) {
2107
2094
  const query = new URLSearchParams();
2095
+ if (params?.team) query.set("team", params.team);
2108
2096
  if (params?.type) query.set("type", params.type);
2097
+ if (params?.status) query.set("status", params.status);
2109
2098
  if (params?.active != null) query.set("active", String(params.active));
2099
+ if (params?.tags) query.set("tags", params.tags);
2110
2100
  if (params?.with?.length) query.set("with", params.with.join(","));
2111
2101
  const qs = query.toString();
2112
2102
  return this.http.get(`updates${qs ? "?" + qs : ""}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "1.3.0",
3
+ "version": "1.4.1",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",