@contentful/app-sdk 4.67.0 → 4.68.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.
@@ -4,7 +4,7 @@ import { ExperienceSDK, ExperienceContext, ExperienceSnapshot } from './types';
4
4
  * Creates the Experience SDK namespace for the experience-toolbar location.
5
5
  *
6
6
  * Throws when called without handshake `experiences` data, mirroring `createAgent`. This keeps the
7
- * public `ExperienceEditorToolbarAppSDK['experiences']` type sound (non-optional, always present).
7
+ * public `ExperienceCanvasToolbarAppSDK['experiences']` type sound (non-optional, always present).
8
8
  */
9
9
  export default function createExperience(channel: Channel, experienceInit?: {
10
10
  context?: ExperienceContext;
@@ -262,14 +262,14 @@ export type AgentAppSDK<InstallationParameters extends KeyValueMap = KeyValueMap
262
262
  /** Methods to update the size of the iframe the app is contained within. */
263
263
  window: WindowAPI;
264
264
  };
265
- export type ExperienceEditorToolbarAppSDK<InstallationParameters extends KeyValueMap = KeyValueMap> = Omit<BaseAppSDK<InstallationParameters, never, never>, 'ids'> & {
265
+ export type ExperienceCanvasToolbarAppSDK<InstallationParameters extends KeyValueMap = KeyValueMap> = Omit<BaseAppSDK<InstallationParameters, never, never>, 'ids'> & {
266
266
  ids: Omit<IdsAPI, EntryScopedIds>;
267
267
  /** Experience SDK for experience-toolbar location */
268
268
  experiences: ExperienceSDK;
269
269
  /** Methods to update the size of the iframe the app is contained within. */
270
270
  window: WindowAPI;
271
271
  };
272
- export type KnownAppSDK<InstallationParameters extends KeyValueMap = KeyValueMap, InstanceParameters extends KeyValueMap = KeyValueMap, InvocationParameters extends SerializedJSONValue = SerializedJSONValue> = FieldAppSDK<InstallationParameters, InstanceParameters> | SidebarAppSDK<InstallationParameters, InstanceParameters> | DialogAppSDK<InstallationParameters, InvocationParameters> | EditorAppSDK<InstallationParameters, InstanceParameters> | PageAppSDK<InstallationParameters> | ConfigAppSDK<InstallationParameters> | HomeAppSDK<InstallationParameters> | AgentAppSDK<InstallationParameters> | ExperienceEditorToolbarAppSDK<InstallationParameters>;
272
+ export type KnownAppSDK<InstallationParameters extends KeyValueMap = KeyValueMap, InstanceParameters extends KeyValueMap = KeyValueMap, InvocationParameters extends SerializedJSONValue = SerializedJSONValue> = FieldAppSDK<InstallationParameters, InstanceParameters> | SidebarAppSDK<InstallationParameters, InstanceParameters> | DialogAppSDK<InstallationParameters, InvocationParameters> | EditorAppSDK<InstallationParameters, InstanceParameters> | PageAppSDK<InstallationParameters> | ConfigAppSDK<InstallationParameters> | HomeAppSDK<InstallationParameters> | AgentAppSDK<InstallationParameters> | ExperienceCanvasToolbarAppSDK<InstallationParameters>;
273
273
  /** @deprecated consider using {@link BaseAppSDK} */
274
274
  export type BaseExtensionSDK = BaseAppSDK;
275
275
  /** @deprecated consider using {@link EditorAppSDK} */
@@ -38,7 +38,7 @@ export interface ComponentPropertyDescriptor<C = unknown, D extends DesignValue
38
38
  export type SameSpaceContentSource = 'crn:contentful:::content:spaces/$self/environments/$self';
39
39
  /**
40
40
  * A reference to a Contentful resource, addressed by `urn`. `linkType` is a `Contentful:`-prefixed
41
- * resource type (e.g. `'Contentful:Template'`).
41
+ * resource type (e.g. `'Contentful:Template'` / its canonical `'Contentful:ExperienceTemplate'`).
42
42
  */
43
43
  export interface ResourceLink<T extends string = string> {
44
44
  sys: {
@@ -105,15 +105,22 @@ export interface DataAssemblyAPI extends DataAssemblyParameterAPI {
105
105
  /** Subscribes to Data Assembly snapshot changes. Returns an unsubscribe function. */
106
106
  onChange(cb: (snapshot: DataAssemblySnapshot) => void): Unsubscribe;
107
107
  }
108
- /** The type of a node within an experience/fragment tree. */
109
- export type ExperienceNodeType = 'Component' | 'Fragment' | 'InlineFragment' | 'Slot';
108
+ /**
109
+ * The type of a node within an experience/fragment tree. Accepts both the current
110
+ * (`Fragment`/`InlineFragment`) and upcoming canonical (`ExperienceFragment`/`InlineExperienceFragment`)
111
+ * vocabulary — the same node entity, named differently across the ExO data-model transition.
112
+ */
113
+ export type ExperienceNodeType = 'Component' | 'Fragment' | 'ExperienceFragment' | 'InlineFragment' | 'InlineExperienceFragment' | 'Slot';
110
114
  export interface ExperienceNodeSnapshot {
111
115
  id: string;
112
116
  nodeType: ExperienceNodeType;
113
117
  }
114
- /** One allowed resource for a slot: the Component(s) that may be placed in it. */
118
+ /**
119
+ * One allowed resource for a slot: the Component(s) that may be placed in it. `type` accepts both
120
+ * the current (`Contentful:ComponentType`) and upcoming canonical (`Contentful:Component`) URN.
121
+ */
115
122
  export interface SlotAllowedResource {
116
- type: 'Contentful:ComponentType';
123
+ type: 'Contentful:ComponentType' | 'Contentful:Component';
117
124
  source: string;
118
125
  allowedTypes: string[];
119
126
  }
@@ -122,7 +129,7 @@ export interface SlotDescriptor {
122
129
  allowedResources: SlotAllowedResource[];
123
130
  currentItems: Array<{
124
131
  nodeId: string;
125
- nodeType: 'Fragment' | 'InlineFragment';
132
+ nodeType: 'Fragment' | 'ExperienceFragment' | 'InlineFragment' | 'InlineExperienceFragment';
126
133
  }>;
127
134
  }
128
135
  /**
@@ -182,10 +189,13 @@ export interface ExperienceMetadata {
182
189
  name?: string;
183
190
  }
184
191
  /**
185
- * Snapshot of the root entity being edited. Discriminated on `sys.type`:
186
- * an `Experience` (optionally backed by a template) or a `Fragment` (no template).
187
- * `Experience.sys.template` is optional, and `Fragment.sys` carries a `componentType`
188
- * ResourceLink and no template.
192
+ * Snapshot of the root entity being edited, discriminated on `sys.type`. Three arms:
193
+ * an `Experience` (optionally backed by a template) plus two shapes of the same fragment
194
+ * entity — `Fragment` (current vocabulary: `sys.componentType`, `Contentful:ComponentType`)
195
+ * and `ExperienceFragment` (upcoming canonical vocabulary: `sys.component`, `Contentful:Component`).
196
+ * `Fragment` and `ExperienceFragment` are the same entity in legacy vs canonical shape; both are
197
+ * accepted so apps stay forward-compatible across the ExO data-model transition. The `Experience`
198
+ * arm carries an optional `template`/`experienceTemplate` (an experience may be un-templated).
189
199
  */
190
200
  export type ExperienceSnapshot = {
191
201
  sys: {
@@ -193,6 +203,7 @@ export type ExperienceSnapshot = {
193
203
  type: 'Experience';
194
204
  version: number;
195
205
  template?: ResourceLink<'Contentful:Template'>;
206
+ experienceTemplate?: ResourceLink<'Contentful:ExperienceTemplate'>;
196
207
  };
197
208
  metadata?: ExperienceMetadata;
198
209
  } | {
@@ -203,6 +214,14 @@ export type ExperienceSnapshot = {
203
214
  componentType: ResourceLink<'Contentful:ComponentType'>;
204
215
  };
205
216
  metadata?: ExperienceMetadata;
217
+ } | {
218
+ sys: {
219
+ id: string;
220
+ type: 'ExperienceFragment';
221
+ version: number;
222
+ component: ResourceLink<'Contentful:Component'>;
223
+ };
224
+ metadata?: ExperienceMetadata;
206
225
  };
207
226
  export interface ExperienceAPI {
208
227
  get(): ExperienceSnapshot;
@@ -226,7 +245,7 @@ export interface ExperienceAPI {
226
245
  dataAssembly: DataAssemblyAPI;
227
246
  }
228
247
  export interface ExperienceContext {
229
- type: 'experience' | 'fragment';
248
+ type: 'experience' | 'fragment' | 'experienceFragment';
230
249
  entityId: string;
231
250
  }
232
251
  export interface ExperienceSDK {
@@ -1,4 +1,8 @@
1
- export type { AppExtensionSDK, BaseExtensionSDK, DialogExtensionSDK, EditorExtensionSDK, FieldExtensionSDK, HomeExtensionSDK, KnownSDK, PageExtensionSDK, SidebarExtensionSDK, ConfigAppSDK, BaseAppSDK, DialogAppSDK, EditorAppSDK, FieldAppSDK, HomeAppSDK, KnownAppSDK, PageAppSDK, SidebarAppSDK, AccessAPI, ArchiveableAction, ConnectMessage, ContentTypeAPI, CrudAction, EditorLocaleSettings, IdsAPI, LocalesAPI, LocationAPI, Locations, NotifierAPI, ParametersAPI, PublishableAction, SharedEditorSDK, UserAPI, JSONPatchItem, HostnamesAPI, AgentAppSDK, ExperienceEditorToolbarAppSDK, } from './api.types';
1
+ import type { KeyValueMap } from 'contentful-management';
2
+ import type { ExperienceCanvasToolbarAppSDK } from './api.types';
3
+ export type { AppExtensionSDK, BaseExtensionSDK, DialogExtensionSDK, EditorExtensionSDK, FieldExtensionSDK, HomeExtensionSDK, KnownSDK, PageExtensionSDK, SidebarExtensionSDK, ConfigAppSDK, BaseAppSDK, DialogAppSDK, EditorAppSDK, FieldAppSDK, HomeAppSDK, KnownAppSDK, PageAppSDK, SidebarAppSDK, AccessAPI, ArchiveableAction, ConnectMessage, ContentTypeAPI, CrudAction, EditorLocaleSettings, IdsAPI, LocalesAPI, LocationAPI, Locations, NotifierAPI, ParametersAPI, PublishableAction, SharedEditorSDK, UserAPI, JSONPatchItem, HostnamesAPI, AgentAppSDK, ExperienceCanvasToolbarAppSDK, } from './api.types';
4
+ /** @deprecated Renamed to ExperienceCanvasToolbarAppSDK. Alias kept for the internal migration window; will be removed. */
5
+ export type ExperienceEditorToolbarAppSDK<InstallationParameters extends KeyValueMap = KeyValueMap> = ExperienceCanvasToolbarAppSDK<InstallationParameters>;
2
6
  export type { AgentAPI, AgentContext, LayoutVariant, ToolbarAction, ToolbarActionName, } from './agent.types';
3
7
  export type { AppConfigAPI, AppState, OnConfigureHandler, OnConfigureHandlerReturn, } from './app.types';
4
8
  export type { DialogsAPI, EntityDialogOptions, OpenAlertOptions, OpenConfirmOptions, OpenCustomWidgetOptions, RecommendationsOptions, CrossSpaceAllowedResource, ResourceEntitySelectorOptions, } from './dialogs.types';
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@contentful/app-sdk","description":"A JavaScript library to develop custom apps for Contentful","version":"4.67.0","author":"Contentful GmbH","license":"MIT","sideEffects":true,"repository":{"url":"https://github.com/contentful/ui-extensions-sdk.git","type":"git"},"homepage":"https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/","main":"dist/cf-extension-api.js","unpkg":"dist/cf-extension-api.bundled.js","jsdelivr":"dist/cf-extension-api.bundled.js","types":"dist/index.d.ts","files":["dist/cf-extension-api.js","dist/cf-extension-api.js.map","dist/cf-extension-api.bundled.js","dist/cf-extension.css","dist/**/*.d.ts"],"scripts":{"test":"ts-mocha -p tsconfig.test.json 'test/unit/*.[jt]s' --reporter mocha-multi-reporters --reporter-options configFile=mocha.unit-reporters.json","lint":"eslint '{lib,test}/**/*.{t,j}s'","lint:fix":"npm run lint -- --fix","build":"npm run check-types && rollup -c --compact","build:debug":"npm run build -- --sourcemap","prepublishOnly":"npm run build","size":"echo \"Gzipped, estimate: $(gzip -9 -c dist/cf-extension-api.js | wc -c) bytes\"","semantic-release":"semantic-release","publish-all":"node ./scripts/publish.js","verify":"node ./scripts/verify.js","check-types":"tsc --noEmit -m commonjs","prepare":"husky","lint-staged":"lint-staged"},"dependencies":{"contentful-management":"^12.3.1"},"devDependencies":{"@rollup/plugin-commonjs":"^29.0.0","@rollup/plugin-node-resolve":"^16.0.0","@semantic-release/changelog":"6.0.3","@semantic-release/exec":"7.1.0","@semantic-release/git":"10.0.1","@testing-library/dom":"10.4.1","@types/chai-as-promised":"7.1.8","@types/cross-spawn":"6.0.6","@types/fs-extra":"11.0.4","@types/jsdom":"28.0.3","@types/mocha":"10.0.10","@types/nanoid":"3.0.0","@types/sinon":"^21.0.0","@types/sinon-chai":"^3.2.5","@typescript-eslint/eslint-plugin":"7.18.0","@typescript-eslint/parser":"7.18.0","babel-eslint":"10.1.0","chai":"4.5.0","chai-as-promised":"7.1.2","cross-spawn":"7.0.6","eslint":"8.57.1","eslint-config-prettier":"10.1.8","eslint-config-standard":"17.1.0","eslint-plugin-import":"2.32.0","eslint-plugin-node":"11.1.0","eslint-plugin-prettier":"5.5.6","eslint-plugin-promise":"6.6.0","eslint-plugin-react":"7.37.5","eslint-plugin-standard":"5.0.0","fs-extra":"11.3.5","husky":"9.1.7","jsdom":"29.1.1","lint-staged":"17.0.8","mocha":"11.7.6","mocha-junit-reporter":"2.2.1","mocha-multi-reporters":"1.5.1","mochawesome":"7.1.4","mochawesome-merge":"5.1.1","mochawesome-report-generator":"6.3.2","prettier":"3.8.4","rollup":"2.80.0","rollup-plugin-terser":"7.0.2","rollup-plugin-typescript2":"0.37.0","semantic-release":"^25.0.2","sinon":"22.0.0","sinon-chai":"3.7.0","ts-mocha":"11.1.0","tslib":"2.8.1","typescript":"5.9.3"},"lint-staged":{"*.ts":["prettier --write","eslint --fix"],"*.md":["prettier --write"]},"release":{"branches":["main",{"name":"canary","channel":"canary","prerelease":"alpha"}],"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog",["@semantic-release/npm",{"npmPublish":false}],["@semantic-release/exec",{"verifyConditionsCmd":"node ./scripts/verify.js","publishCmd":"npm run publish-all"}],["@semantic-release/git",{"message":"chore: ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}","assets":["CHANGELOG.md","package.json","package-lock.json"]}],"@semantic-release/github"]}}
1
+ {"name":"@contentful/app-sdk","description":"A JavaScript library to develop custom apps for Contentful","version":"4.68.0","author":"Contentful GmbH","license":"MIT","sideEffects":true,"repository":{"url":"https://github.com/contentful/ui-extensions-sdk.git","type":"git"},"homepage":"https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/","main":"dist/cf-extension-api.js","unpkg":"dist/cf-extension-api.bundled.js","jsdelivr":"dist/cf-extension-api.bundled.js","types":"dist/index.d.ts","files":["dist/cf-extension-api.js","dist/cf-extension-api.js.map","dist/cf-extension-api.bundled.js","dist/cf-extension.css","dist/**/*.d.ts"],"scripts":{"test":"ts-mocha -p tsconfig.test.json 'test/unit/*.[jt]s' --reporter mocha-multi-reporters --reporter-options configFile=mocha.unit-reporters.json","lint":"eslint '{lib,test}/**/*.{t,j}s'","lint:fix":"npm run lint -- --fix","build":"npm run check-types && rollup -c --compact","build:debug":"npm run build -- --sourcemap","prepublishOnly":"npm run build","size":"echo \"Gzipped, estimate: $(gzip -9 -c dist/cf-extension-api.js | wc -c) bytes\"","semantic-release":"semantic-release","publish-all":"node ./scripts/publish.js","verify":"node ./scripts/verify.js","check-types":"tsc --noEmit -m commonjs","prepare":"husky","lint-staged":"lint-staged"},"dependencies":{"contentful-management":"^12.3.1"},"devDependencies":{"@rollup/plugin-commonjs":"^29.0.0","@rollup/plugin-node-resolve":"^16.0.0","@semantic-release/changelog":"6.0.3","@semantic-release/exec":"7.1.0","@semantic-release/git":"10.0.1","@testing-library/dom":"10.4.1","@types/chai-as-promised":"7.1.8","@types/cross-spawn":"6.0.6","@types/fs-extra":"11.0.4","@types/jsdom":"28.0.3","@types/mocha":"10.0.10","@types/nanoid":"3.0.0","@types/sinon":"^21.0.0","@types/sinon-chai":"^3.2.5","@typescript-eslint/eslint-plugin":"7.18.0","@typescript-eslint/parser":"7.18.0","babel-eslint":"10.1.0","chai":"4.5.0","chai-as-promised":"7.1.2","cross-spawn":"7.0.6","eslint":"8.57.1","eslint-config-prettier":"10.1.8","eslint-config-standard":"17.1.0","eslint-plugin-import":"2.32.0","eslint-plugin-node":"11.1.0","eslint-plugin-prettier":"5.5.6","eslint-plugin-promise":"6.6.0","eslint-plugin-react":"7.37.5","eslint-plugin-standard":"5.0.0","fs-extra":"11.3.5","husky":"9.1.7","jsdom":"29.1.1","lint-staged":"17.0.8","mocha":"11.7.6","mocha-junit-reporter":"2.2.1","mocha-multi-reporters":"1.5.1","mochawesome":"7.1.4","mochawesome-merge":"5.1.1","mochawesome-report-generator":"6.3.2","prettier":"3.8.4","rollup":"2.80.0","rollup-plugin-terser":"7.0.2","rollup-plugin-typescript2":"0.37.0","semantic-release":"^25.0.2","sinon":"22.0.0","sinon-chai":"3.7.0","ts-mocha":"11.1.0","tslib":"2.8.1","typescript":"5.9.3"},"lint-staged":{"*.ts":["prettier --write","eslint --fix"],"*.md":["prettier --write"]},"release":{"branches":["main",{"name":"canary","channel":"canary","prerelease":"alpha"}],"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog",["@semantic-release/npm",{"npmPublish":false}],["@semantic-release/exec",{"verifyConditionsCmd":"node ./scripts/verify.js","publishCmd":"npm run publish-all"}],["@semantic-release/git",{"message":"chore: ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}","assets":["CHANGELOG.md","package.json","package-lock.json"]}],"@semantic-release/github"]}}