contentful-ui-extensions-sdk 4.20.0 → 4.21.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/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # !! WARNING !!
2
+
3
+ `cf-extension.css` file in this directory is a prebuilt committed version of legacy
4
+ Contentful UI Extension styles.
5
+
6
+ It is here for backwards compatibility only: it will be packaged and published on npm
7
+ so it's available under its legacy URL:
8
+
9
+ https://unpkg.com/contentful-ui-extensions-sdk/dist/cf-extension.css
@@ -59,10 +59,10 @@ export interface LocationAPI {
59
59
  /** Checks the location in which your app is running */
60
60
  is: (type: string) => boolean;
61
61
  }
62
- export interface ParametersAPI {
63
- installation: KeyValueMap;
64
- instance: KeyValueMap;
65
- invocation?: SerializedJSONValue;
62
+ export interface ParametersAPI<InstallationParameters extends KeyValueMap, InstanceParameters extends KeyValueMap, InvocationParameters extends SerializedJSONValue> {
63
+ installation: InstallationParameters;
64
+ instance: InstanceParameters;
65
+ invocation: InvocationParameters;
66
66
  }
67
67
  export interface IdsAPI {
68
68
  user: string;
@@ -163,7 +163,7 @@ export interface AccessAPI {
163
163
  canEditAppConfig: () => Promise<boolean>;
164
164
  }
165
165
  type EntryScopedIds = 'field' | 'entry' | 'contentType';
166
- export interface BaseAppSDK {
166
+ export interface BaseAppSDK<InstallationParameters extends KeyValueMap = KeyValueMap, InstanceParameters extends KeyValueMap = KeyValueMap, InvocationParameters extends SerializedJSONValue = SerializedJSONValue> {
167
167
  /** @deprecated since version 4.0.0 consider using the CMA instead
168
168
  * See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details
169
169
  */
@@ -179,7 +179,7 @@ export interface BaseAppSDK {
179
179
  /** Methods for displaying notifications. */
180
180
  notifier: NotifierAPI;
181
181
  /** Exposes app configuration parameters */
182
- parameters: ParametersAPI;
182
+ parameters: ParametersAPI<InstallationParameters, InstanceParameters, InvocationParameters>;
183
183
  /** Exposes method to identify app's location */
184
184
  location: LocationAPI;
185
185
  /** Exposes methods for checking user's access level */
@@ -191,17 +191,17 @@ export interface BaseAppSDK {
191
191
  /** A CMA Client initialized with default params */
192
192
  cma: CMAClient;
193
193
  }
194
- export type EditorAppSDK = Omit<BaseAppSDK, 'ids'> & SharedEditorSDK & {
194
+ export type EditorAppSDK<InstallationParameters extends KeyValueMap = KeyValueMap, InstanceParameters extends KeyValueMap = KeyValueMap> = Omit<BaseAppSDK<InstallationParameters, InstanceParameters, never>, 'ids'> & SharedEditorSDK & {
195
195
  /** A set of IDs for the app */
196
196
  ids: Omit<IdsAPI, 'field'>;
197
197
  };
198
- export type SidebarAppSDK = Omit<BaseAppSDK, 'ids'> & SharedEditorSDK & {
198
+ export type SidebarAppSDK<InstallationParameters extends KeyValueMap = KeyValueMap, InstanceParameters extends KeyValueMap = KeyValueMap> = Omit<BaseAppSDK<InstallationParameters, InstanceParameters, never>, 'ids'> & SharedEditorSDK & {
199
199
  /** A set of IDs for the app */
200
200
  ids: Omit<IdsAPI, 'field'>;
201
201
  /** Methods to update the size of the iframe the app is contained within. */
202
202
  window: WindowAPI;
203
203
  };
204
- export type FieldAppSDK = BaseAppSDK & SharedEditorSDK & {
204
+ export type FieldAppSDK<InstallationParameters extends KeyValueMap = KeyValueMap, InstanceParameters extends KeyValueMap = KeyValueMap> = BaseAppSDK<InstallationParameters, InstanceParameters, never> & SharedEditorSDK & {
205
205
  /** A set of IDs for the app */
206
206
  ids: IdsAPI;
207
207
  /** Gives you access to the value and metadata of the field the app is attached to. */
@@ -209,7 +209,7 @@ export type FieldAppSDK = BaseAppSDK & SharedEditorSDK & {
209
209
  /** Methods to update the size of the iframe the app is contained within. */
210
210
  window: WindowAPI;
211
211
  };
212
- export type DialogAppSDK = Omit<BaseAppSDK, 'ids'> & {
212
+ export type DialogAppSDK<InstallationParameters extends KeyValueMap = KeyValueMap, InvocationParameters extends SerializedJSONValue = SerializedJSONValue> = Omit<BaseAppSDK<InstallationParameters, never, InvocationParameters>, 'ids'> & {
213
213
  /** A set of IDs for the app */
214
214
  ids: Omit<IdsAPI, EntryScopedIds>;
215
215
  /** Closes the dialog and resolves openCurrentApp promise with data */
@@ -217,21 +217,23 @@ export type DialogAppSDK = Omit<BaseAppSDK, 'ids'> & {
217
217
  /** Methods to update the size of the iframe the app is contained within. */
218
218
  window: WindowAPI;
219
219
  };
220
- export type PageAppSDK = Omit<BaseAppSDK, 'ids'> & {
220
+ export type PageAppSDK<InstallationParameters extends KeyValueMap = KeyValueMap> = Omit<BaseAppSDK<InstallationParameters, never, {
221
+ path: string;
222
+ }>, 'ids'> & {
221
223
  /** A set of IDs actual for the app */
222
224
  ids: Omit<IdsAPI, EntryScopedIds>;
223
225
  };
224
- export type HomeAppSDK = Omit<BaseAppSDK, 'ids'> & {
226
+ export type HomeAppSDK<InstallationParameters extends KeyValueMap = KeyValueMap> = Omit<BaseAppSDK<InstallationParameters, never, never>, 'ids'> & {
225
227
  ids: Omit<IdsAPI, EntryScopedIds>;
226
228
  };
227
- export type ConfigAppSDK = Omit<BaseAppSDK, 'ids'> & {
229
+ export type ConfigAppSDK<InstallationParameters extends KeyValueMap = KeyValueMap> = Omit<BaseAppSDK<InstallationParameters, never, never>, 'ids'> & {
228
230
  /** A set of IDs actual for the app */
229
231
  ids: Omit<IdsAPI, EntryScopedIds | 'extension' | 'app'> & {
230
232
  app: string;
231
233
  };
232
234
  app: AppConfigAPI;
233
235
  };
234
- export type KnownAppSDK = FieldAppSDK | SidebarAppSDK | DialogAppSDK | EditorAppSDK | PageAppSDK | ConfigAppSDK | HomeAppSDK;
236
+ 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>;
235
237
  /** @deprecated consider using {@link BaseAppSDK} */
236
238
  export type BaseExtensionSDK = BaseAppSDK;
237
239
  /** @deprecated consider using {@link EditorAppSDK} */
@@ -263,7 +265,7 @@ export interface Locations {
263
265
  export interface ConnectMessage {
264
266
  id: string;
265
267
  location: Location[keyof Location];
266
- parameters: ParametersAPI;
268
+ parameters: ParametersAPI<KeyValueMap, KeyValueMap, never>;
267
269
  locales: LocalesAPI;
268
270
  user: UserAPI;
269
271
  initialContentTypes: ContentType[];
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"contentful-ui-extensions-sdk","description":"A JavaScript library to develop custom apps for Contentful","version":"4.20.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","types":"dist/index.d.ts","files":["dist/cf-extension-api.js","dist/cf-extension-api.js.map","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 install","lint-staged":"lint-staged"},"dependencies":{"contentful-management":">=7.30.0"},"devDependencies":{"@semantic-release/changelog":"6.0.3","@semantic-release/exec":"6.0.3","@semantic-release/git":"10.0.1","@testing-library/dom":"9.3.1","@types/chai-as-promised":"7.1.5","@types/cross-spawn":"6.0.2","@types/fs-extra":"11.0.1","@types/jsdom":"21.1.1","@types/mocha":"10.0.1","@types/nanoid":"3.0.0","@types/sinon":"^10.0.0","@types/sinon-chai":"^3.2.5","@typescript-eslint/eslint-plugin":"4.33.0","@typescript-eslint/parser":"4.33.0","babel-eslint":"10.1.0","chai":"4.3.7","chai-as-promised":"7.1.1","cross-spawn":"7.0.3","eslint":"7.32.0","eslint-config-prettier":"8.8.0","eslint-config-standard":"16.0.3","eslint-plugin-import":"2.27.5","eslint-plugin-node":"11.1.0","eslint-plugin-prettier":"4.2.1","eslint-plugin-promise":"6.1.1","eslint-plugin-react":"7.32.2","eslint-plugin-standard":"5.0.0","fs-extra":"11.1.1","husky":"8.0.3","jsdom":"22.1.0","lint-staged":"13.2.2","mocha":"10.2.0","mocha-junit-reporter":"2.2.0","mocha-multi-reporters":"1.5.1","mochawesome":"7.1.3","mochawesome-merge":"4.3.0","mochawesome-report-generator":"6.2.0","prettier":"2.8.8","rollup":"2.79.1","rollup-plugin-terser":"7.0.2","rollup-plugin-typescript2":"0.34.1","semantic-release":"19.0.5","sinon":"15.2.0","sinon-chai":"3.7.0","ts-mocha":"10.0.0","tslib":"2.5.3","typescript":"5.1.3"},"lint-staged":{"*.ts":["prettier --write","eslint --fix","git add"],"*.md":["prettier --write","git add"]},"release":{"branches":["master",{"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-ui-extensions-sdk","description":"A JavaScript library to develop custom apps for Contentful","version":"4.21.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","types":"dist/index.d.ts","files":["dist/cf-extension-api.js","dist/cf-extension-api.js.map","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 install","lint-staged":"lint-staged"},"dependencies":{"contentful-management":">=7.30.0"},"devDependencies":{"@semantic-release/changelog":"6.0.3","@semantic-release/exec":"6.0.3","@semantic-release/git":"10.0.1","@testing-library/dom":"9.3.1","@types/chai-as-promised":"7.1.5","@types/cross-spawn":"6.0.2","@types/fs-extra":"11.0.1","@types/jsdom":"21.1.1","@types/mocha":"10.0.1","@types/nanoid":"3.0.0","@types/sinon":"^10.0.0","@types/sinon-chai":"^3.2.5","@typescript-eslint/eslint-plugin":"5.60.0","@typescript-eslint/parser":"5.60.0","babel-eslint":"10.1.0","chai":"4.3.7","chai-as-promised":"7.1.1","cross-spawn":"7.0.3","eslint":"8.43.0","eslint-config-prettier":"8.8.0","eslint-config-standard":"17.1.0","eslint-plugin-import":"2.27.5","eslint-plugin-node":"11.1.0","eslint-plugin-prettier":"4.2.1","eslint-plugin-promise":"6.1.1","eslint-plugin-react":"7.32.2","eslint-plugin-standard":"5.0.0","fs-extra":"11.1.1","husky":"8.0.3","jsdom":"22.1.0","lint-staged":"13.2.2","mocha":"10.2.0","mocha-junit-reporter":"2.2.0","mocha-multi-reporters":"1.5.1","mochawesome":"7.1.3","mochawesome-merge":"4.3.0","mochawesome-report-generator":"6.2.0","prettier":"2.8.8","rollup":"2.79.1","rollup-plugin-terser":"7.0.2","rollup-plugin-typescript2":"0.34.1","semantic-release":"21.0.5","sinon":"15.2.0","sinon-chai":"3.7.0","ts-mocha":"10.0.0","tslib":"2.5.3","typescript":"5.1.3"},"lint-staged":{"*.ts":["prettier --write","eslint --fix","git add"],"*.md":["prettier --write","git add"]},"release":{"branches":["master",{"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"]}}