@joai/sdk 4.2.1 → 4.2.3

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
@@ -596,6 +596,10 @@ type CheckoutSnapshot = {
596
596
  expiresAt: string;
597
597
  accessToken?: string | null;
598
598
  };
599
+ type GuestBuyer = {
600
+ name: string;
601
+ email: string;
602
+ };
599
603
  type CheckoutSnapshotRequest = {
600
604
  fulfillmentMethod: FulfillmentMethod;
601
605
  items: {
@@ -779,6 +783,7 @@ type Media = {
779
783
  library: MediaLibraryAttributes;
780
784
  tags?: string[];
781
785
  copyright?: string | null;
786
+ aiGenerated?: boolean;
782
787
  }; //#endregion
783
788
  //#region src/billing/types.d.ts
784
789
  type TranslatableValue = Partial<Record<WarpLocale, string>>;
@@ -995,7 +1000,7 @@ type Order = {
995
1000
  linkVariationId: string | null;
996
1001
  notes: string | null;
997
1002
  fulfillmentMethod?: FulfillmentMethod | null;
998
- address?: AddressSnapshot | null;
1003
+ billingAddress?: AddressSnapshot | null;
999
1004
  shippingAddress?: AddressSnapshot | null;
1000
1005
  shippingRate?: Pick<ShippingRate, 'name' | 'price' | 'estimatedMinDays' | 'estimatedMaxDays'> | null;
1001
1006
  fulfillmentLocation?: {
@@ -1325,7 +1330,6 @@ type WarpExtras = {
1325
1330
  faq?: Record<string, WarpExtrasFaq[]>;
1326
1331
  notification?: {
1327
1332
  enabled?: boolean;
1328
- contact?: string | null;
1329
1333
  };
1330
1334
  optIn?: {
1331
1335
  enabled?: boolean;
@@ -1383,7 +1387,7 @@ type BrandSourceConfig = {
1383
1387
  contract?: string;
1384
1388
  endpoints?: string[];
1385
1389
  };
1386
- type BrandIntegrationProvider = 'claude' | 'codex' | 'cursor' | 'openai';
1390
+ type BrandIntegrationProvider = 'claude' | 'codex' | 'cursor' | 'openai' | 'grok';
1387
1391
  type BrandIntegrationAction = {
1388
1392
  type: 'copy' | 'link' | 'deeplink';
1389
1393
  label: string;
@@ -1622,12 +1626,13 @@ type Service = {
1622
1626
  slug: string;
1623
1627
  name: TranslatableValue;
1624
1628
  price: number;
1625
- durationMinutes: number;
1629
+ durationMinutes: number | null;
1626
1630
  tags?: string[] | null;
1627
1631
  description: TranslatableValue | null;
1628
1632
  active: boolean;
1629
1633
  digital: boolean;
1630
1634
  public: boolean;
1635
+ bookable: boolean;
1631
1636
  settings?: Record<string, unknown> | null;
1632
1637
  createdAt: string;
1633
1638
  updatedAt: string;
@@ -3137,10 +3142,7 @@ declare class AddressesResource {
3137
3142
  //#endregion
3138
3143
  //#region src/commerce/checkout.d.ts
3139
3144
  type PlaceCheckoutOrderRequest = CheckoutSnapshotRequest & {
3140
- guest?: {
3141
- name: string;
3142
- email: string;
3143
- };
3145
+ guest?: GuestBuyer;
3144
3146
  notes?: string;
3145
3147
  idempotencyKey?: string;
3146
3148
  saveAddresses?: boolean;
@@ -4052,6 +4054,7 @@ declare class MediaResource {
4052
4054
  label?: string;
4053
4055
  tags?: string[];
4054
4056
  copyright?: string;
4057
+ aiGenerated?: boolean;
4055
4058
  }): Promise<IAppResponse<Media>>;
4056
4059
  list(team: string, params?: {
4057
4060
  page?: number;
@@ -4062,6 +4065,7 @@ declare class MediaResource {
4062
4065
  update(team: string, mediaId: string, data: {
4063
4066
  name: string;
4064
4067
  copyright?: string | null;
4068
+ aiGenerated?: boolean;
4065
4069
  }): Promise<IAppResponse<Media>>;
4066
4070
  updateTags(team: string, mediaId: string, tags: string[]): Promise<IAppResponse<Media>>;
4067
4071
  /** Download the stored bytes of a media item as a File (used to re-edit existing images). */
@@ -4372,10 +4376,11 @@ declare class ServicesResource {
4372
4376
  description?: TranslatableValue | null;
4373
4377
  digital?: boolean;
4374
4378
  public?: boolean;
4379
+ bookable?: boolean;
4375
4380
  pricingModel?: string;
4376
4381
  settings?: Record<string, unknown> | null;
4377
4382
  }): Promise<IAppResponse<Service>>;
4378
- update(id: string, data: Partial<Pick<Service, 'name' | 'price' | 'description' | 'active' | 'digital' | 'public'>> & {
4383
+ update(id: string, data: Partial<Pick<Service, 'name' | 'price' | 'description' | 'active' | 'digital' | 'public' | 'bookable'>> & {
4379
4384
  durationMinutes?: number | null;
4380
4385
  settings?: Record<string, unknown> | null;
4381
4386
  }): Promise<IAppResponse<Service>>;
@@ -4880,6 +4885,7 @@ interface JoAiClientConfig {
4880
4885
  agentAuthKey?: string;
4881
4886
  cache?: CacheConfig;
4882
4887
  buildSecret?: string;
4888
+ customFetch?: typeof globalThis.fetch;
4883
4889
  }
4884
4890
  declare class JoAiClient {
4885
4891
  readonly http: IHttpService;
@@ -5019,4 +5025,4 @@ declare class DistributionResource {
5019
5025
  private fetchDistribution;
5020
5026
  }
5021
5027
  //#endregion
5022
- export { AddressesResource, AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, type AttachedMedia, type AuthConfirmCodeRequest, type AuthConfirmCodeResponse, type AuthNativeSessionResponse, type AuthPortalSessionResponse, AuthResource, type AuthSendCodeRequest, type BackendWarp, type BackendWarpBrand, BillingResource, BlueprintsResource, type CacheConfig, CachedHttpService, CampaignsResource, CardsResource, CartsResource, ChangelogResource, CharactersResource, CheckoutResource, CommerceResource, ContactsResource, ContractsResource, type CreateHookPayload, type CreateInboundHookPayload, type CreateInternalHookPayload, type CreateWarpLinkedHookPayload, type CreateWebHookPayload, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, FulfillmentsResource, GoalsResource, type GuestCheckoutDraft, type GuestCommerceStorageOptions, type GuestOrderAccess, type Hook, type HookSample, type HookTrigger, type HookTriggerCondition, type HookTriggerInput, HooksResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, type JoAiClientConfig, KvResource, LinksResource, LoyaltyResource, McpResource, type MediaUploadType, MeetingsResource, MemoriesResource, MessagesResource, MissionsResource, NotificationsResource, OfficeResource, type OpenPortalSessionOptions, type OpeningHoursEntry, type OpeningHoursFormatOptions, OrdersResource, PersonaResource, type Product, type ProductVariation, ProductsResource, ProjectsResource, RemindersResource, ReturnsResource, SegmentsResource, ServicesResource, ShippingResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, type TeamInviteInfo, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, type WebHookTriggerEvent, WorkspaceResource, completePortalSession, createClient, createGuestCommerceStorage, formatOpeningHours, getAuthFragmentToken, isAllowedRedirectUrl, isPortalCallbackUrl, openPortalSession, sanitizePortalCallbackUrl };
5028
+ export { AddressesResource, AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, type AttachedMedia, type AuthConfirmCodeRequest, type AuthConfirmCodeResponse, type AuthNativeSessionResponse, type AuthPortalSessionResponse, AuthResource, type AuthSendCodeRequest, type BackendWarp, type BackendWarpBrand, BillingResource, BlueprintsResource, type CacheConfig, CachedHttpService, CampaignsResource, CardsResource, CartsResource, ChangelogResource, CharactersResource, CheckoutResource, CommerceResource, ContactsResource, ContractsResource, type CreateHookPayload, type CreateInboundHookPayload, type CreateInternalHookPayload, type CreateWarpLinkedHookPayload, type CreateWebHookPayload, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, FulfillmentsResource, GoalsResource, type GuestBuyer, type GuestCheckoutDraft, type GuestCommerceStorageOptions, type GuestOrderAccess, type Hook, type HookSample, type HookTrigger, type HookTriggerCondition, type HookTriggerInput, HooksResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, type JoAiClientConfig, KvResource, LinksResource, LoyaltyResource, McpResource, type MediaUploadType, MeetingsResource, MemoriesResource, MessagesResource, MissionsResource, NotificationsResource, OfficeResource, type OpenPortalSessionOptions, type OpeningHoursEntry, type OpeningHoursFormatOptions, OrdersResource, PersonaResource, type PlaceCheckoutOrderRequest, type Product, type ProductVariation, ProductsResource, ProjectsResource, RemindersResource, ReturnsResource, SegmentsResource, ServicesResource, ShippingResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, type TeamInviteInfo, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, type WebHookTriggerEvent, WorkspaceResource, completePortalSession, createClient, createGuestCommerceStorage, formatOpeningHours, getAuthFragmentToken, isAllowedRedirectUrl, isPortalCallbackUrl, openPortalSession, sanitizePortalCallbackUrl };
package/dist/index.mjs CHANGED
@@ -422,6 +422,12 @@ const safeSet = (key, value) => {
422
422
  localStorage.setItem(key, value);
423
423
  } catch {}
424
424
  };
425
+ const safeRemove = (key) => {
426
+ if (typeof localStorage === "undefined") return;
427
+ try {
428
+ localStorage.removeItem(key);
429
+ } catch {}
430
+ };
425
431
  const parseGuestOrderAccess = (entry) => {
426
432
  if (!entry || typeof entry !== "object") return null;
427
433
  const record = entry;
@@ -461,19 +467,25 @@ function createGuestCommerceStorage(options) {
461
467
  },
462
468
  saveOrderAccess({ orderId, accessToken }) {
463
469
  const key = orderAccessKey(options.namespace, orderId);
464
- if (accessToken) safeSet(key, accessToken);
470
+ const resolvedToken = accessToken || safeGet(key);
471
+ if (resolvedToken) safeSet(key, resolvedToken);
465
472
  const orders = readOrderList(options.namespace).filter((entry) => entry.orderId !== orderId);
466
473
  orders.unshift({
467
474
  orderId,
468
- accessToken
475
+ accessToken: resolvedToken
469
476
  });
470
- safeSet(ordersKey(options.namespace), JSON.stringify(orders.slice(0, maxOrders)));
477
+ const kept = orders.slice(0, maxOrders);
478
+ for (const dropped of orders.slice(maxOrders)) safeRemove(orderAccessKey(options.namespace, dropped.orderId));
479
+ safeSet(ordersKey(options.namespace), JSON.stringify(kept));
471
480
  },
472
481
  readOrderAccess(orderId) {
473
482
  return safeGet(orderAccessKey(options.namespace, orderId));
474
483
  },
475
484
  listOrderAccess() {
476
- return readOrderList(options.namespace);
485
+ return readOrderList(options.namespace).map((entry) => ({
486
+ orderId: entry.orderId,
487
+ accessToken: entry.accessToken || safeGet(orderAccessKey(options.namespace, entry.orderId))
488
+ }));
477
489
  }
478
490
  };
479
491
  }
@@ -1603,7 +1615,7 @@ var MediaResource = class {
1603
1615
  return this.http.get(`media/public${qs ? "?" + qs : ""}`);
1604
1616
  }
1605
1617
  upload(data) {
1606
- const { team, file, fileUrl, fileName, mimeType, type, aspect, label, tags, copyright } = data;
1618
+ const { team, file, fileUrl, fileName, mimeType, type, aspect, label, tags, copyright, aiGenerated } = data;
1607
1619
  if (file) {
1608
1620
  const formData = new FormData();
1609
1621
  formData.append("file", file, file.name);
@@ -1612,6 +1624,7 @@ var MediaResource = class {
1612
1624
  if (label) formData.append("label", label);
1613
1625
  if (tags) tags.forEach((t) => formData.append("tags[]", t));
1614
1626
  if (copyright) formData.append("copyright", copyright);
1627
+ if (aiGenerated) formData.append("aiGenerated", "1");
1615
1628
  return this.http.post("media", formData, { headers: { "X-Team": team } });
1616
1629
  }
1617
1630
  return this.http.post("media", {
@@ -1622,7 +1635,8 @@ var MediaResource = class {
1622
1635
  aspect,
1623
1636
  label,
1624
1637
  tags,
1625
- copyright
1638
+ copyright,
1639
+ aiGenerated
1626
1640
  }, { headers: { "X-Team": team } });
1627
1641
  }
1628
1642
  list(team, params) {
@@ -2916,7 +2930,8 @@ var JoAiClient = class {
2916
2930
  if (config.buildSecret) headers["X-Build-Secret"] = config.buildSecret;
2917
2931
  const http = new HttpService(`${apiBaseUrl}/v1`, void 0, config.apiToken, {
2918
2932
  headers,
2919
- csrfBaseUrl: apiBaseUrl
2933
+ csrfBaseUrl: apiBaseUrl,
2934
+ customFetch: config.customFetch
2920
2935
  });
2921
2936
  const cache = config.cache;
2922
2937
  this.http = cache?.enabled !== false ? new CachedHttpService(http, cache?.overrides, cache?.defaultTtl) : http;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "4.2.1",
3
+ "version": "4.2.3",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",