@joai/sdk 7.0.8 → 9.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/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # @joai/sdk
2
+
3
+ The React entry point contains reusable building blocks for editable content on client websites. The components stay domain-neutral: sites provide identifiers, copy, styling hooks, and rendered fields; the SDK owns session handoff and the editing lifecycle.
4
+
5
+ ## Managed content editor
6
+
7
+ ```tsx
8
+ import { ManagedContentEditor } from '@joai/react'
9
+
10
+ <ManagedContentEditor
11
+ config={{
12
+ contentId: 'content-id',
13
+ publicSlug: 'website-content',
14
+ sessionStorageKey: 'website-content-session',
15
+ team: 'team-slug',
16
+ }}
17
+ initialContent={content}
18
+ title="Inhalte bearbeiten"
19
+ labels={{
20
+ edit: 'Bearbeiten',
21
+ save: 'Entwurf speichern',
22
+ saving: 'Wird gespeichert …',
23
+ publish: 'Veröffentlichen',
24
+ publishing: 'Wird veröffentlicht …',
25
+ cancel: 'Abbrechen',
26
+ toolbar: 'Inhaltseditor',
27
+ unsaved: 'Nicht gespeicherte Änderungen',
28
+ }}
29
+ messages={{
30
+ conflict: 'Der Inhalt wurde zwischenzeitlich geändert. Deine Eingaben bleiben erhalten. Bitte prüfe sie und versuche es erneut.',
31
+ loadError: 'Der Inhalt konnte nicht geladen werden.',
32
+ publishError: 'Die Änderungen konnten nicht veröffentlicht werden.',
33
+ published: 'Die Änderungen wurden veröffentlicht.',
34
+ saveError: 'Der Entwurf konnte nicht gespeichert werden.',
35
+ saved: 'Der Entwurf wurde gespeichert.',
36
+ sessionExpired: 'Deine Sitzung ist abgelaufen.',
37
+ unsavedNavigation: 'Du hast nicht gespeicherte Änderungen. Seite wirklich verlassen?',
38
+ }}
39
+ imagePickerLabels={{
40
+ applyCrop: 'Zuschnitt übernehmen',
41
+ back: 'Zurück',
42
+ choose: 'Bild auswählen',
43
+ close: 'Schließen',
44
+ cropDescription: 'Passe Bildausschnitt und Zoom vor dem Hochladen an.',
45
+ cropTitle: 'Bild zuschneiden',
46
+ dimensionsTooLarge: 'Die Bildabmessungen sind zu groß.',
47
+ dimensionsTooSmall: 'Die Bildabmessungen sind zu klein.',
48
+ drop: 'Bild hier ablegen',
49
+ empty: 'Noch keine Bilder vorhanden.',
50
+ field: 'Bearbeitbares Bild',
51
+ invalidType: 'Bitte wähle eine Bilddatei.',
52
+ libraryDescription: 'Wähle ein vorhandenes Bild oder lade ein neues hoch.',
53
+ libraryTitle: 'Bildmediathek',
54
+ loadError: 'Bilder konnten nicht geladen werden.',
55
+ loading: 'Bilder werden geladen …',
56
+ positionHorizontal: 'Horizontale Position',
57
+ positionVertical: 'Vertikale Position',
58
+ processing: 'Bild wird vorbereitet …',
59
+ retry: 'Erneut versuchen',
60
+ tooLarge: 'Das Bild ist zu groß.',
61
+ upload: 'Bild hochladen',
62
+ uploadError: 'Das Bild konnte nicht hochgeladen werden.',
63
+ uploading: 'Wird hochgeladen …',
64
+ zoom: 'Zoom',
65
+ }}
66
+ reauthenticateLabel="Anmeldung erneuern"
67
+ sessionExpiredMessage="Deine Sitzung ist abgelaufen. Deine lokalen Änderungen bleiben erhalten."
68
+ confirmCancel={() => window.confirm('Nicht gespeicherte Änderungen verwerfen?')}
69
+ confirmLeave={() => window.confirm('Du hast nicht gespeicherte Änderungen. Seite wirklich verlassen?')}
70
+ confirmPublish={() => window.confirm('Änderungen jetzt veröffentlichen?')}
71
+ >
72
+ {children}
73
+ </ManagedContentEditor>
74
+ ```
75
+
76
+ Use `EditableContent`, `EditableImage`, and `useContentValue` from `@joai/react` inside the editor. Pass server-fetched public content as `initialContent` to avoid a client-side loading state for visitors.
77
+
78
+ Configure each image field as a reusable, domain-neutral building block. Images are compressed to WebP at up to 2560 × 2560 pixels by default, while animated GIF and SVG files retain their original format. Cropping is opt-in per field:
79
+
80
+ ```tsx
81
+ <EditableImage
82
+ field="heroImage"
83
+ label="Titelbild"
84
+ maxSourceBytes={40 * 1024 * 1024}
85
+ maxUploadBytes={5 * 1024 * 1024}
86
+ processing={{
87
+ crop: { aspectRatio: 16 / 9, outputWidth: 1920 },
88
+ compression: { maxWidth: 1920, maxHeight: 1080, mimeType: 'image/webp', quality: 0.84 },
89
+ dimensions: { minWidth: 1280, minHeight: 720, maxPixels: 50_000_000 },
90
+ }}
91
+ />
92
+ ```
93
+
94
+ Set `compression: false` or `dimensions: false` to disable only that stage, or `processing={false}` to upload the original image without client-side decoding, validation, cropping, or compression.
95
+
96
+ ## Session storage
97
+
98
+ `useContentSession` and `createSessionTokenStore` are exported for custom shells. A custom `SessionTokenStore` can be injected when a host needs a different persistence mechanism. The URL fragment containing the one-time handoff token is removed before it is exchanged and persisted.
99
+
100
+ The managed editor automatically adds `platform=app` to its reauthentication return URL so JoAi returns a one-time handoff token. Override `reauthenticateUrl` only when a host has a dedicated login callback.
101
+
102
+ `createContentDraftStore` uses `sessionStorage` by default. `ManagedContentEditor` wires it automatically so unsaved values survive refreshes and expired-session reauthentication without being shared across browser sessions.
103
+
104
+ ## Editing behavior
105
+
106
+ - Cancel restores the currently loaded version.
107
+ - Save is disabled when there are no local changes.
108
+ - A dirty publish saves and publishes with one request.
109
+ - Network failures keep local edits available for retry.
110
+ - Refresh, close, and link/navigation attempts warn while edits are unsaved.
111
+ - Editable text and image fields are visibly labelled in edit mode.
112
+ - The image library supports loading, empty, error, byte/dimension validation, cropping, compression, keyboard, focus, and drag-and-drop states.
113
+ - Expired authorization offers a sign-in action and restores locally persisted edits afterwards.
114
+ - Version conflicts load the latest version while preserving local edits.
115
+ - Public content cache entries are invalidated after authenticated mutations.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _$_joai_core0 from "@joai/core";
2
- import { Address, AddressCreatePayload, AddressInput, AddressType, AddressUpdatePayload, Affiliate, AffiliateTier, Agent, AgentActionHistoryEntry, AgentPrivate, AgentSettings, AgentTrustedActionRule, AiCostsResponse, Alert, ApiToken, AppEnv, AppIngestion, AppendKvEntryResult, AppointmentAvailability, AppointmentBooking, AppointmentPolicy, AppointmentPolicyUpsert, AppointmentRequest, Artifact, ArtifactCreatePayload, ArtifactDeliverPayload, ArtifactDelivery, ArtifactStatus, ArtifactType, ArtifactUpdatePayload, AuthUser, AuthUser as AuthUser$1, Automation, AutomationActionInput, AutomationAudiencePreview, AutomationCreatePayload, AutomationEnrollment, AutomationStats, AutomationUpdatePayload, Blueprint, BlueprintSettings, BrandBackend, BrandSiteConfig, BrandSourceConfig, CalendarStatus, Campaign, CampaignAudiencePreview, CampaignAudiencePreviewPayload, CampaignCreatePayload, CampaignRecipient, CampaignRecipientStatus, CampaignStats, CampaignUpdatePayload, Card, Cart, Cart as Cart$1, CartLine, ChangelogEntry, Character, CheckoutSnapshot, CheckoutSnapshot as CheckoutSnapshot$1, CheckoutSnapshotRequest, CommissionAgreement, Configuration, Contact, ContactActivity, ContactCreatePayload, ContactFormData, ContactRelation, ContactRelationPayload, ContactRelationUpdatePayload, Content, ContentVersion, Contract, ContractCategoryName, ContractVersion, Coupon, CouponCondition, CouponRestrictedItem, CreateContentInput, CreateHookPayload, CreateHookPayload as CreateHookPayload$1, CreateInboundHookPayload, CreateInternalHookPayload, CreateKvFieldPayload, CreateWarpLinkedHookPayload, CreateWebHookPayload, Document, EarnResponse, Element, ElementSpec, ElementVariation, EmbedStatus, Entity, Flow, Fulfillment, FulfillmentLocation, FulfillmentLocation as FulfillmentLocation$1, FulfillmentMethod, GamificationData, Goal, GoalCreatePayload, GuestBuyer, GuestBuyer as GuestBuyer$1, Hook, Hook as Hook$1, HookSample, HookSample as HookSample$1, HookTrigger, HookTriggerCondition, HookTriggerInput, IAppResponse, IHttpService, IRequestOptions, Inquiry, InquiryType, Integration, IntegrationType, Intent, Item, ItemCreatePayload, ItemUpdatePayload, JsonValue, KvEntryPayload, KvField, KvFieldWithEntries, Link, LinkCreatePayload, LinkStats, LinkUpdatePayload, LinkVariation, LinkVariationBatchCreatePayload, LinkVariationCreatePayload, LoyaltyAccount, LoyaltyMember, LoyaltyProgram, LoyaltyPromotion, LoyaltyReward, LoyaltyTier, LoyaltyTransaction, McpToolCall, Media, MediaAspectRatio, Meeting, MeetingJoinInfo, MeetingSpeakerAssignment, MeetingSummary, Memory, Message, MetricSource, MetricsResult, Mission, MissionCreatePayload, Notification, NotificationChannel, NotificationSetting, OfficeSnapshot, Order, Order as Order$1, OrderContext, OrderPriceMode, OrderPriceMode as OrderPriceMode$1, OrderStatus, OrderStatus as OrderStatus$1, OrderType, PaginatedResponse, Pass, PatchContentInput, PaymentAccount, PaymentAccountOnboarding, PaymentProvider, Plan, PlanFeature, Product, Product as Product$1, ProductRelation, ProductVariation, ProgramSettings, Project, ProjectExportResponse, ProjectInputAssistIntent, ProjectInputAssistResponse, ProjectMutation, ProjectOutputPreset, ProjectOutputType, ProjectStudioHistoryEntry, Proposal, ProposalAction, ProposalPollOption, PublicFormResults, PurchaseResult, RampProviderInfo, Reactions, RedeemResponse, Reminder, Return, ReturnStatus, Room, RoomKind, Segment, SegmentCountPayload, SegmentCountResult, SegmentCreatePayload, Service, SetKvEntryResult, SharedSocialPost, ShippingCarrierOption, ShippingRate, ShippingRate as ShippingRate$1, ShippingZone, Shortcut, Site, SiteBrand, SiteType, Skill, SkillScopeValue, SocialAuthProvider, SocialBot, SocialPlatform, SocialPost, SocialPostConnection, SocialPostCreatePayload, SocialPostGenerateCaptionPayload, SocialPostGeneratedCaption, SocialPostPlatform, SocialPostStatus, SocialPostUpdatePayload, StampResponse, StoreAgent, StoreData, StorePriceTier, StorePurchaseResult, Subscription, Swarm, Tag, TagType, Task, TaxClass, Team, TeamAccessConfig, TeamCategory, TeamEarning, TeamEarningsBalance, TeamFeature, TeamFeatureUsage, TeamMember, TeamMeta, TeamOrderStats, TeamPayout, TeamPayoutAddress, TeamPrivate, TeamUsage, TerminalConnectionToken, TerminalPaymentIntent, ToggleKvFieldResult, TranslatableValue, Update, UpdateCreatePayload, UpdateRelation, UpdateStats, UpdateType, UpdateUpdatePayload, Upgrade, UpgradeStatus, UserPrivate, UserRole, UserSettings, VolumePrice, WarpBackend, WarpBackendStatus, WarpExecutionBackend, WebHookTriggerEvent, WorkspaceCloudFile, WorkspaceInfo, XIntegrationStatus } from "@joai/core";
2
+ import { Address, AddressCreatePayload, AddressInput, AddressType, AddressUpdatePayload, Affiliate, AffiliateTier, Agent, AgentActionHistoryEntry, AgentPrivate, AgentSettings, AgentTrustedActionRule, AiCostsResponse, Alert, ApiToken, AppEnv, AppIngestion, AppendKvEntryResult, AppointmentAvailability, AppointmentBooking, AppointmentPolicy, AppointmentPolicyUpsert, AppointmentRequest, Artifact, ArtifactCreatePayload, ArtifactDeliverPayload, ArtifactDelivery, ArtifactStatus, ArtifactType, ArtifactUpdatePayload, AuthUser, AuthUser as AuthUser$1, Automation, AutomationActionInput, AutomationAudiencePreview, AutomationCreatePayload, AutomationEnrollment, AutomationStats, AutomationUpdatePayload, Blueprint, BlueprintSettings, BrandBackend, BrandSiteConfig, BrandSourceConfig, CalendarStatus, Campaign, CampaignAudiencePreview, CampaignAudiencePreviewPayload, CampaignCreatePayload, CampaignRecipient, CampaignRecipientStatus, CampaignStats, CampaignUpdatePayload, Card, Cart, Cart as Cart$1, CartLine, ChangelogEntry, Character, CheckoutSnapshot, CheckoutSnapshot as CheckoutSnapshot$1, CheckoutSnapshotRequest, CommissionAgreement, Configuration, Contact, ContactActivity, ContactCreatePayload, ContactFormData, ContactRelation, ContactRelationPayload, ContactRelationUpdatePayload, Content, ContentVersion, Contract, ContractCategoryName, ContractVersion, Coupon, CouponCondition, CouponRestrictedItem, CreateContentInput, CreateHookPayload, CreateHookPayload as CreateHookPayload$1, CreateInboundHookPayload, CreateInternalHookPayload, CreateKvFieldPayload, CreateWarpLinkedHookPayload, CreateWebHookPayload, Document, EarnResponse, Element, ElementSpec, ElementVariation, EmbedStatus, Entity, Flow, Fulfillment, FulfillmentLocation, FulfillmentLocation as FulfillmentLocation$1, FulfillmentMethod, GamificationData, Goal, GoalCreatePayload, GuestBuyer, GuestBuyer as GuestBuyer$1, Hook, Hook as Hook$1, HookSample, HookSample as HookSample$1, HookTrigger, HookTriggerCondition, HookTriggerInput, IAppResponse, IHttpService, IRequestOptions, Inquiry, InquiryType, Integration, IntegrationType, Intent, Item, ItemCreatePayload, ItemUpdatePayload, JsonValue, KvEntryPayload, KvField, KvFieldWithEntries, Link, LinkCreatePayload, LinkStats, LinkUpdatePayload, LinkVariation, LinkVariationBatchCreatePayload, LinkVariationCreatePayload, LoyaltyAccount, LoyaltyMember, LoyaltyProgram, LoyaltyPromotion, LoyaltyReward, LoyaltyTier, LoyaltyTransaction, McpToolCall, Media, MediaAspectRatio, Meeting, MeetingJoinInfo, MeetingSpeakerAssignment, MeetingSummary, Memory, Message, MetricSource, MetricsResult, Mission, MissionCreatePayload, Notification, NotificationChannel, NotificationSetting, OfficeSnapshot, Order, Order as Order$1, OrderContext, OrderPriceMode, OrderPriceMode as OrderPriceMode$1, OrderStatus, OrderStatus as OrderStatus$1, OrderType, PaginatedResponse, Pass, PatchContentInput, PaymentAccount, PaymentAccountOnboarding, PaymentProvider, Plan, PlanFeature, Product, Product as Product$1, ProductDetailSection, ProductRelation, ProductVariation, ProgramSettings, Project, ProjectExportResponse, ProjectInputAssistIntent, ProjectInputAssistResponse, ProjectMutation, ProjectOutputPreset, ProjectOutputType, ProjectStudioHistoryEntry, Proposal, ProposalAction, ProposalPollOption, PublicFormResults, PurchaseResult, RampProviderInfo, Reactions, RedeemResponse, Reminder, Return, ReturnStatus, Room, RoomKind, Segment, SegmentCountPayload, SegmentCountResult, SegmentCreatePayload, Service, SetKvEntryResult, SharedSocialPost, ShippingCarrierOption, ShippingRate, ShippingRate as ShippingRate$1, ShippingZone, Shortcut, Site, SiteBrand, SiteType, Skill, SkillScopeValue, SocialAuthProvider, SocialBot, SocialPlatform, SocialPost, SocialPostConnection, SocialPostCreatePayload, SocialPostGenerateCaptionPayload, SocialPostGeneratedCaption, SocialPostPlatform, SocialPostStatus, SocialPostUpdatePayload, StampResponse, StoreAgent, StoreData, StorePriceTier, StorePurchaseResult, Subscription, Swarm, Tag, TagType, Task, TaxClass, Team, TeamAccessConfig, TeamCategory, TeamEarning, TeamEarningsBalance, TeamFeature, TeamFeatureUsage, TeamMember, TeamMeta, TeamOrderStats, TeamPayout, TeamPayoutAddress, TeamPrivate, TeamUsage, TerminalConnectionToken, TerminalPaymentIntent, ToggleKvFieldResult, TranslatableValue, Update, UpdateCreatePayload, UpdateRelation, UpdateStats, UpdateType, UpdateUpdatePayload, Upgrade, UpgradeStatus, UserPrivate, UserRole, UserSettings, VolumePrice, WarpBackend, WarpBackendStatus, WarpExecutionBackend, WebHookTriggerEvent, WorkspaceCloudFile, WorkspaceInfo, XIntegrationStatus } from "@joai/core";
3
3
  import { WarpChainName, WarpClient, WarpLocale, WarpText, WarpWalletProvider } from "@joai/warps";
4
4
 
5
5
  //#region src/resources/agents.d.ts
@@ -1307,7 +1307,7 @@ declare class MeetingsResource {
1307
1307
  get(id: string): Promise<_$_joai_core0.IAppResponse<Meeting>>;
1308
1308
  getSummary(id: string): Promise<_$_joai_core0.IAppResponse<MeetingSummary>>;
1309
1309
  join(code: string): Promise<_$_joai_core0.IAppResponse<MeetingJoinInfo>>;
1310
- cancel(code: string, data?: {
1310
+ cancel(code: string, options?: {
1311
1311
  reason?: string;
1312
1312
  }): Promise<_$_joai_core0.IAppResponse<Meeting>>;
1313
1313
  share(id: string, recipients: {
@@ -1507,6 +1507,9 @@ declare class ProductsResource {
1507
1507
  virtual?: boolean;
1508
1508
  public?: boolean;
1509
1509
  taxClassId?: string | null;
1510
+ meta?: {
1511
+ details?: ProductDetailSection[];
1512
+ };
1510
1513
  }, teamSlug?: string): Promise<_$_joai_core0.IAppResponse<Product>>;
1511
1514
  update(id: string, data: {
1512
1515
  name?: TranslatableValue;
@@ -1514,6 +1517,9 @@ declare class ProductsResource {
1514
1517
  tags?: string[] | null;
1515
1518
  description?: TranslatableValue | null;
1516
1519
  settings?: Record<string, unknown> | null;
1520
+ meta?: {
1521
+ details?: ProductDetailSection[];
1522
+ };
1517
1523
  active?: boolean;
1518
1524
  public?: boolean;
1519
1525
  virtual?: boolean;
package/dist/index.mjs CHANGED
@@ -2003,8 +2003,9 @@ var MeetingsResource = class {
2003
2003
  join(code) {
2004
2004
  return this.http.get(`meetings/join/${code}`);
2005
2005
  }
2006
- cancel(code, data) {
2007
- return this.http.post(`meetings/cancel/${code}`, data ?? {});
2006
+ cancel(code, options) {
2007
+ const body = options?.reason ? { reason: options.reason } : {};
2008
+ return this.http.post(`meetings/cancel/${code}`, body);
2008
2009
  }
2009
2010
  share(id, recipients) {
2010
2011
  return this.http.post(`meetings/${id}/share`, { recipients });
@@ -3339,7 +3340,7 @@ var MemoryCache = class {
3339
3340
  this.store.clear();
3340
3341
  }
3341
3342
  bust(prefix) {
3342
- for (const key of this.store.keys()) if (key.startsWith(prefix)) this.store.delete(key);
3343
+ for (const key of this.store.keys()) if (key.startsWith(prefix) || key.startsWith(`/${prefix}`)) this.store.delete(key);
3343
3344
  }
3344
3345
  };
3345
3346
  //#endregion
@@ -3363,6 +3364,10 @@ const DEFAULTS = {
3363
3364
  agents: 1e4,
3364
3365
  rooms: 1e4
3365
3366
  };
3367
+ const RELATED_PREFIXES = {
3368
+ content: ["contents"],
3369
+ contents: ["content"]
3370
+ };
3366
3371
  function getTtl(url, ttlMap, defaultTtl) {
3367
3372
  for (const [prefix, ttl] of Object.entries(ttlMap)) if (url.startsWith(prefix) || url.startsWith(`/${prefix}`)) return ttl;
3368
3373
  return defaultTtl;
@@ -3450,6 +3455,7 @@ var CachedHttpService = class {
3450
3455
  bust(prefix) {
3451
3456
  this.cacheVersion++;
3452
3457
  this.cache.bust(prefix);
3458
+ for (const relatedPrefix of RELATED_PREFIXES[prefix] ?? []) this.cache.bust(relatedPrefix);
3453
3459
  }
3454
3460
  };
3455
3461
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "7.0.8",
3
+ "version": "9.0.0",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,11 +35,11 @@
35
35
  "test": "jest --config jest.config.js"
36
36
  },
37
37
  "dependencies": {
38
- "@joai/core": "^4.15.7",
38
+ "@joai/core": "^5.0.0",
39
39
  "@joai/warps": "*"
40
40
  },
41
41
  "peerDependencies": {
42
- "@joai/core": "^4.15.7"
42
+ "@joai/core": "^5.0.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "tsdown": "^0.21.0",