@joai/sdk 1.4.1 → 2.0.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
@@ -195,22 +195,6 @@ type UserPrivate = {
195
195
  kyc?: Kyc | null;
196
196
  settings: UserSettings;
197
197
  };
198
- type Earning = {
199
- id: number;
200
- amount: number;
201
- type: string;
202
- description: string | null;
203
- createdAt: string;
204
- };
205
- type PayoutEntry = {
206
- id: number;
207
- amount: number;
208
- status: string;
209
- tx: string | null;
210
- failureReason: string | null;
211
- processedAt: string | null;
212
- createdAt: string;
213
- };
214
198
  type UserSocialAccount = {
215
199
  platform: string;
216
200
  id: string;
@@ -532,7 +516,7 @@ type AppSubscription = {
532
516
  createdAt: string;
533
517
  updatedAt: string;
534
518
  };
535
- type PaymentProvider = 'xmoney' | 'lemonsqueezy' | 'stripe' | 'stripe-connect' | 'apple' | 'google' | 'blockchain' | 'offline';
519
+ type PaymentProvider = 'xmoney' | 'lemonsqueezy' | 'stripe' | 'stripe-connect' | 'mollie' | 'mollie-connect' | 'apple' | 'google' | 'blockchain' | 'offline';
536
520
  type PaymentAccount = {
537
521
  provider: string;
538
522
  connected: boolean;
@@ -546,13 +530,17 @@ type PaymentAccountOnboarding = {
546
530
  };
547
531
  type TerminalConnectionToken = {
548
532
  secret: string;
549
- locationId: string;
533
+ locationId: string | null;
550
534
  connectedAccountId: string;
535
+ appId?: string | null;
536
+ webhookUrl?: string | null;
551
537
  };
552
538
  type TerminalPaymentIntent = {
553
- clientSecret: string;
539
+ clientSecret: string | null;
554
540
  paymentIntentId: string;
555
541
  connectedAccountId: string;
542
+ payload?: string | null;
543
+ signature?: string | null;
556
544
  };
557
545
  type PlanFeature = 'general' | 'messages' | 'team-members' | 'teams' | 'support' | 'agent' | 'auto-mode' | 'cloud-sync' | 'wallet-cloud' | 'wallet-cloud-premium' | 'wallet-multi' | 'cards' | 'alerts' | 'advanced-commands' | 'tasks' | 'integrations' | 'message-history' | 'memory' | 'documents' | 'voice-input' | 'voice-live' | 'image-gen' | 'video-gen' | 'openclaw' | 'skills' | 'items' | 'context-length' | 'workspace-storage' | 'ingestions' | 'agent-email' | 'streak-freezes' | 'byok' | 'mcp' | 'phone-call' | 'phone-number' | 'custom-domain' | 'contacts' | 'links' | 'store-fee-rate' | 'store-fee-rate-physical' | 'tap-to-pay';
558
546
  type PlanBenefit = {
@@ -578,6 +566,7 @@ type BillingAddress = {
578
566
  type PlanInterval = 'weekly' | 'monthly' | 'yearly' | 'lifetime';
579
567
  type Plan = {
580
568
  resource: 'plan';
569
+ id: string;
581
570
  sku: string;
582
571
  name: TranslatableValue;
583
572
  description: Partial<Record<WarpLocale, string>>;
@@ -759,6 +748,11 @@ type Cart = {
759
748
  couponDiscount: number;
760
749
  };
761
750
  type CouponCondition = 'none' | 'onetime-use' | 'previous-purchase';
751
+ type CouponRestrictedItemType = 'product' | 'service';
752
+ type CouponRestrictedItem = {
753
+ type: CouponRestrictedItemType;
754
+ ref: string;
755
+ };
762
756
  type Coupon = {
763
757
  id: string;
764
758
  code: string;
@@ -767,6 +761,7 @@ type Coupon = {
767
761
  percent: number | null;
768
762
  price: number | null;
769
763
  condition: CouponCondition;
764
+ restrictedItems: CouponRestrictedItem[];
770
765
  usesLeft: number | null;
771
766
  expiresAt: string | null;
772
767
  active: boolean;
@@ -1041,8 +1036,8 @@ type WarpBackend = {
1041
1036
  chain: WarpChainName | null;
1042
1037
  alias: string;
1043
1038
  name: string;
1044
- title: string;
1045
- description: string;
1039
+ title: WarpText;
1040
+ description: WarpText;
1046
1041
  preview: string | null;
1047
1042
  creator: string;
1048
1043
  status: WarpBackendStatus;
@@ -1232,6 +1227,7 @@ type StoreData = {
1232
1227
  items: StoreItem[];
1233
1228
  };
1234
1229
  type StorePriceTier = {
1230
+ id: string;
1235
1231
  sku: string;
1236
1232
  priceCents: number;
1237
1233
  label: string;
@@ -1259,6 +1255,20 @@ type TeamEarningsBalance = {
1259
1255
  pendingCents: number;
1260
1256
  paidCents: number;
1261
1257
  totalCents: number;
1258
+ availableCents: number;
1259
+ };
1260
+ type TeamPayout = {
1261
+ id: number;
1262
+ amount: number;
1263
+ status: string;
1264
+ tx: string | null;
1265
+ failureReason: string | null;
1266
+ processedAt: string | null;
1267
+ createdAt: string;
1268
+ };
1269
+ type TeamPayoutAddress = {
1270
+ payoutAddress: string | null;
1271
+ payoutChain: string | null;
1262
1272
  };
1263
1273
  type CommissionAgreement = {
1264
1274
  id: number;
@@ -2493,13 +2503,23 @@ type SegmentCountResult = {
2493
2503
  }; //#endregion
2494
2504
  //#region src/campaign/types.d.ts
2495
2505
  type CampaignChannel = 'email' | 'whatsapp' | 'sms' | 'push';
2496
- type CampaignStatus = 'draft' | 'sending' | 'completed' | 'failed';
2506
+ type CampaignStatus = 'draft' | 'pending' | 'approved' | 'rejected' | 'sending' | 'completed' | 'failed';
2507
+ type CampaignCategory = 'MARKETING' | 'UTILITY' | 'AUTHENTICATION';
2508
+ type CampaignApproval = {
2509
+ language: string | null;
2510
+ category: CampaignCategory | null;
2511
+ placeholders: string[];
2512
+ templateParams: Record<string, string>;
2513
+ externalStatus: string | null;
2514
+ rejectionReason: string | null;
2515
+ };
2497
2516
  type Campaign = {
2498
2517
  id: string;
2499
2518
  name: string;
2500
2519
  channel: CampaignChannel;
2501
2520
  subject: string | null;
2502
2521
  content: string;
2522
+ approval: CampaignApproval;
2503
2523
  tags: string[];
2504
2524
  status: CampaignStatus;
2505
2525
  totalCount: number;
@@ -2515,8 +2535,20 @@ type CampaignCreatePayload = {
2515
2535
  channel: CampaignChannel;
2516
2536
  subject?: string;
2517
2537
  content: string;
2538
+ language?: string;
2539
+ category?: CampaignCategory;
2540
+ templateParams?: Record<string, string>;
2518
2541
  tags?: string[];
2519
2542
  contactIds?: string[];
2543
+ segmentId?: string;
2544
+ };
2545
+ type CampaignUpdatePayload = {
2546
+ name: string;
2547
+ subject?: string;
2548
+ content: string;
2549
+ language?: string;
2550
+ category?: CampaignCategory;
2551
+ templateParams?: Record<string, string>;
2520
2552
  };
2521
2553
  type CampaignStats = {
2522
2554
  totalCampaigns: number;
@@ -3088,12 +3120,16 @@ declare class CardsResource {
3088
3120
  declare class CartsResource {
3089
3121
  private readonly http;
3090
3122
  constructor(http: IHttpService);
3091
- get(): Promise<IAppResponse<Cart>>;
3092
- add(type: 'product' | 'service' | 'coupon', id: string, quantity?: number, configuration?: Configuration): Promise<IAppResponse<Cart>>;
3123
+ get(provider?: string): Promise<IAppResponse<Cart>>;
3124
+ add(type: 'product' | 'service' | 'coupon', id: string, quantity?: number, options?: {
3125
+ fresh?: boolean;
3126
+ configuration?: Configuration;
3127
+ }): Promise<IAppResponse<Cart>>;
3093
3128
  remove(type: 'product' | 'service' | 'coupon', id: string): Promise<IAppResponse<Cart>>;
3094
3129
  updateQuantity(type: 'product' | 'service' | 'coupon', id: string, quantity: number): Promise<IAppResponse<Cart>>;
3095
3130
  clear(): Promise<IAppResponse<Cart>>;
3096
3131
  applyCoupon(code: string): Promise<IAppResponse<void>>;
3132
+ removeCoupon(): Promise<IAppResponse<void>>;
3097
3133
  }
3098
3134
  //#endregion
3099
3135
  //#region src/resources/coupons.d.ts
@@ -3106,6 +3142,7 @@ type CouponPayload = {
3106
3142
  active?: boolean;
3107
3143
  public?: boolean;
3108
3144
  condition?: CouponCondition;
3145
+ restrictedItems?: CouponRestrictedItem[] | null;
3109
3146
  usesLeft?: number | null;
3110
3147
  expiresAt?: string | null;
3111
3148
  media?: MediaLibraryAttributes[];
@@ -3116,6 +3153,7 @@ declare class CouponsResource {
3116
3153
  list(team: string, options?: {
3117
3154
  public?: boolean;
3118
3155
  }): Promise<IAppResponse<Coupon[]>>;
3156
+ get(id: string): Promise<IAppResponse<Coupon>>;
3119
3157
  create(team: string, data: CouponPayload): Promise<IAppResponse<Coupon>>;
3120
3158
  update(id: string, data: Partial<CouponPayload> & {
3121
3159
  clearExpiry?: boolean;
@@ -3489,6 +3527,10 @@ declare class StoreResource {
3489
3527
  get(locale?: string): Promise<StoreData>;
3490
3528
  earnings(teamSlug: string, page?: number): Promise<IAppResponse<TeamEarning[]>>;
3491
3529
  earningsBalance(teamSlug: string): Promise<IAppResponse<TeamEarningsBalance>>;
3530
+ payouts(teamSlug: string, page?: number): Promise<IAppResponse<TeamPayout[]>>;
3531
+ requestPayout(teamSlug: string): Promise<IAppResponse<TeamPayout>>;
3532
+ payoutAddress(teamSlug: string): Promise<IAppResponse<TeamPayoutAddress>>;
3533
+ updatePayoutAddress(teamSlug: string, address: string, chain?: string): Promise<IAppResponse<void>>;
3492
3534
  commissions(teamSlug: string): Promise<IAppResponse<CommissionAgreement[]>>;
3493
3535
  priceTiers(): Promise<IAppResponse<StorePriceTier[]>>;
3494
3536
  purchase(entityType: string, entityId: string, paymentMethod?: string): Promise<IAppResponse<StorePurchaseResult>>;
@@ -3506,7 +3548,10 @@ declare class MediaResource {
3506
3548
  }): Promise<IAppResponse<Media[]>>;
3507
3549
  upload(data: {
3508
3550
  team: string;
3509
- file: File;
3551
+ file?: File;
3552
+ fileUrl?: string;
3553
+ fileName?: string;
3554
+ mimeType?: string;
3510
3555
  type: MediaUploadType;
3511
3556
  label?: string;
3512
3557
  tags?: string[];
@@ -4040,6 +4085,9 @@ declare class CampaignsResource {
4040
4085
  list(): Promise<IAppResponse<Campaign[]>>;
4041
4086
  get(id: string): Promise<IAppResponse<Campaign>>;
4042
4087
  create(payload: CampaignCreatePayload): Promise<IAppResponse<Campaign>>;
4088
+ update(id: string, payload: CampaignUpdatePayload): Promise<IAppResponse<Campaign>>;
4089
+ submitForApproval(id: string): Promise<IAppResponse<Campaign>>;
4090
+ refreshApproval(id: string): Promise<IAppResponse<Campaign>>;
4043
4091
  send(id: string): Promise<IAppResponse<Campaign>>;
4044
4092
  delete(id: string): Promise<IAppResponse<void>>;
4045
4093
  }
@@ -4099,13 +4147,9 @@ declare class UsersResource {
4099
4147
  updateEmail(email: string): Promise<IAppResponse<UserPrivate>>;
4100
4148
  resendEmailVerification(): Promise<IAppResponse<UserPrivate>>;
4101
4149
  deleteMe(): Promise<IAppResponse<void>>;
4102
- updatePayoutAddress(address: string, chain?: string): Promise<IAppResponse<void>>;
4103
4150
  getAffiliate(code: string): Promise<IAppResponse<Affiliate>>;
4104
4151
  getAffiliateTiers(): Promise<IAppResponse<AffiliateTier[]>>;
4105
4152
  storeAffiliate(name: string, email: string, application: string): Promise<IAppResponse<void>>;
4106
- getEarnings(page: number): Promise<IAppResponse<Earning[]>>;
4107
- getPayouts(page: number): Promise<IAppResponse<PayoutEntry[]>>;
4108
- requestPayout(): Promise<IAppResponse<PayoutEntry>>;
4109
4153
  }
4110
4154
  //#endregion
4111
4155
  //#region src/resources/voice.d.ts
package/dist/index.mjs CHANGED
@@ -660,15 +660,15 @@ var CartsResource = class {
660
660
  constructor(http) {
661
661
  this.http = http;
662
662
  }
663
- get() {
664
- return this.http.get("cart");
663
+ get(provider) {
664
+ return this.http.get(provider ? `cart?provider=${provider}` : "cart");
665
665
  }
666
- add(type, id, quantity = 1, configuration) {
666
+ add(type, id, quantity = 1, options) {
667
667
  return this.http.post("cart/add", {
668
668
  id,
669
669
  type,
670
670
  quantity,
671
- configuration
671
+ ...options
672
672
  });
673
673
  }
674
674
  remove(type, id) {
@@ -690,6 +690,9 @@ var CartsResource = class {
690
690
  applyCoupon(code) {
691
691
  return this.http.post("cart/coupon", { code });
692
692
  }
693
+ removeCoupon() {
694
+ return this.http.post("cart/coupon/remove");
695
+ }
693
696
  };
694
697
  //#endregion
695
698
  //#region src/resources/coupons.ts
@@ -701,6 +704,9 @@ var CouponsResource = class {
701
704
  const qs = options?.public ? `?team=${encodeURIComponent(team)}` : "";
702
705
  return this.http.get(`coupons${qs}`, options?.public ? {} : { headers: { "X-Team": team } });
703
706
  }
707
+ get(id) {
708
+ return this.http.get(`coupons/${id}`);
709
+ }
704
710
  create(team, data) {
705
711
  return this.http.post("coupons", data, { headers: { "X-Team": team } });
706
712
  }
@@ -1274,6 +1280,22 @@ var StoreResource = class {
1274
1280
  earningsBalance(teamSlug) {
1275
1281
  return this.http.get(`earnings/balance?team=${teamSlug}`);
1276
1282
  }
1283
+ payouts(teamSlug, page = 1) {
1284
+ return this.http.get(`payouts?team=${teamSlug}&page=${page}`);
1285
+ }
1286
+ requestPayout(teamSlug) {
1287
+ return this.http.post("payouts", { team: teamSlug });
1288
+ }
1289
+ payoutAddress(teamSlug) {
1290
+ return this.http.get(`payouts/payout-address?team=${teamSlug}`);
1291
+ }
1292
+ updatePayoutAddress(teamSlug, address, chain) {
1293
+ return this.http.put("payouts/payout-address", {
1294
+ team: teamSlug,
1295
+ payoutAddress: address,
1296
+ payoutChain: chain
1297
+ });
1298
+ }
1277
1299
  commissions(teamSlug) {
1278
1300
  return this.http.get(`billing/commissions?team=${encodeURIComponent(teamSlug)}`);
1279
1301
  }
@@ -1303,13 +1325,25 @@ var MediaResource = class {
1303
1325
  return this.http.get(`media/public${qs ? "?" + qs : ""}`);
1304
1326
  }
1305
1327
  upload(data) {
1306
- const formData = new FormData();
1307
- formData.append("file", data.file, data.file.name);
1308
- formData.append("type", data.type);
1309
- if (data.label) formData.append("label", data.label);
1310
- if (data.tags) data.tags.forEach((t) => formData.append("tags[]", t));
1311
- if (data.copyright) formData.append("copyright", data.copyright);
1312
- return this.http.post("media", formData, { headers: { "X-Team": data.team } });
1328
+ const { team, file, fileUrl, fileName, mimeType, type, label, tags, copyright } = data;
1329
+ if (file) {
1330
+ const formData = new FormData();
1331
+ formData.append("file", file, file.name);
1332
+ formData.append("type", type);
1333
+ if (label) formData.append("label", label);
1334
+ if (tags) tags.forEach((t) => formData.append("tags[]", t));
1335
+ if (copyright) formData.append("copyright", copyright);
1336
+ return this.http.post("media", formData, { headers: { "X-Team": team } });
1337
+ }
1338
+ return this.http.post("media", {
1339
+ fileUrl,
1340
+ fileName,
1341
+ mimeType,
1342
+ type,
1343
+ label,
1344
+ tags,
1345
+ copyright
1346
+ }, { headers: { "X-Team": team } });
1313
1347
  }
1314
1348
  listTeam(team, params) {
1315
1349
  const query = new URLSearchParams();
@@ -2055,6 +2089,15 @@ var CampaignsResource = class {
2055
2089
  create(payload) {
2056
2090
  return this.http.post("campaigns", payload);
2057
2091
  }
2092
+ update(id, payload) {
2093
+ return this.http.put(`campaigns/${id}`, payload);
2094
+ }
2095
+ submitForApproval(id) {
2096
+ return this.http.post(`campaigns/${id}/submit`);
2097
+ }
2098
+ refreshApproval(id) {
2099
+ return this.http.post(`campaigns/${id}/refresh`);
2100
+ }
2058
2101
  send(id) {
2059
2102
  return this.http.post(`campaigns/${id}/send`);
2060
2103
  }
@@ -2178,12 +2221,6 @@ var UsersResource = class {
2178
2221
  deleteMe() {
2179
2222
  return this.http.post("me/request-delete");
2180
2223
  }
2181
- updatePayoutAddress(address, chain) {
2182
- return this.http.put("me/payout-address", {
2183
- payoutAddress: address,
2184
- payoutChain: chain
2185
- });
2186
- }
2187
2224
  getAffiliate(code) {
2188
2225
  return this.http.get(`affiliates/${code}`);
2189
2226
  }
@@ -2197,15 +2234,6 @@ var UsersResource = class {
2197
2234
  application
2198
2235
  });
2199
2236
  }
2200
- getEarnings(page) {
2201
- return this.http.get(`earnings?page=${page}`);
2202
- }
2203
- getPayouts(page) {
2204
- return this.http.get(`payouts?page=${page}`);
2205
- }
2206
- requestPayout() {
2207
- return this.http.post("payouts");
2208
- }
2209
2237
  };
2210
2238
  //#endregion
2211
2239
  //#region src/resources/voice.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "1.4.1",
3
+ "version": "2.0.0",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",