@umbraco-cms/backoffice 17.0.0-rc2 → 17.0.0-rc3

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.
Files changed (20) hide show
  1. package/dist-cms/external/openid/src/xhr.js +1 -0
  2. package/dist-cms/packages/core/auth/auth-flow.js +2 -0
  3. package/dist-cms/packages/core/collection/menu/menu-item/default/default-collection-menu-item.element.js +1 -3
  4. package/dist-cms/packages/core/entity-sign/components/entity-sign-bundle.element.js +2 -2
  5. package/dist-cms/packages/core/http-client/index.d.ts +2 -1
  6. package/dist-cms/packages/core/http-client/index.js +12 -1
  7. package/dist-cms/packages/core/picker-input/picker-input.context.d.ts +3 -0
  8. package/dist-cms/packages/core/picker-input/picker-input.context.js +10 -2
  9. package/dist-cms/packages/core/resources/try-execute/tryXhrRequest.function.js +1 -0
  10. package/dist-cms/packages/core/resources/types.d.ts +1 -0
  11. package/dist-cms/packages/core/utils/config-collection/index.d.ts +7 -5
  12. package/dist-cms/packages/core/utils/config-collection/index.js +4 -5
  13. package/dist-cms/packages/documents/documents/components/input-document/input-document.context.d.ts +1 -0
  14. package/dist-cms/packages/documents/documents/components/input-document/input-document.context.js +9 -0
  15. package/dist-cms/packages/documents/documents/user-permissions/document/repository/document-permission.server.data.js +1 -0
  16. package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
  17. package/dist-cms/umbraco-package.json +1 -1
  18. package/examples/picker-data-source/example-custom-picker-collection-data-source.ts +5 -5
  19. package/examples/picker-data-source/example-document-picker-data-source.ts +7 -5
  20. package/package.json +1 -1
@@ -30,6 +30,7 @@ export class FetchRequestor extends Requestor {
30
30
  const requestInit = {};
31
31
  requestInit.method = settings.method;
32
32
  requestInit.mode = 'cors';
33
+ requestInit.credentials = settings.credentials ?? 'include';
33
34
  if (settings.data) {
34
35
  if (settings.method && settings.method.toUpperCase() === 'POST') {
35
36
  requestInit.body = settings.data;
@@ -294,6 +294,7 @@ export class UmbAuthFlow {
294
294
  const token = await this.performWithFreshTokens();
295
295
  const request = new Request(this.#unlink_endpoint, {
296
296
  method: 'POST',
297
+ credentials: 'include',
297
298
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` },
298
299
  body: JSON.stringify({ loginProvider, providerKey }),
299
300
  });
@@ -370,6 +371,7 @@ export class UmbAuthFlow {
370
371
  async #makeLinkTokenRequest(provider) {
371
372
  const token = await this.performWithFreshTokens();
372
373
  const request = await fetch(`${this.#link_key_endpoint}?provider=${provider}`, {
374
+ credentials: 'include',
373
375
  headers: {
374
376
  Authorization: `Bearer ${token}`,
375
377
  'Content-Type': 'application/json',
@@ -54,9 +54,7 @@ let UmbDefaultCollectionMenuItemElement = class UmbDefaultCollectionMenuItemElem
54
54
  ?selected=${this._isSelected}
55
55
  @selected=${() => this.#api?.select()}
56
56
  @deselected=${() => this.#api?.deselect()}>
57
- ${item.icon
58
- ? html `<uui-icon slot="icon" name=${item.icon}></uui-icon>`
59
- : html `<uui-icon slot="icon" name=${getItemFallbackIcon()}></uui-icon>`}
57
+ <umb-icon slot="icon" name=${item.icon ?? getItemFallbackIcon()}></umb-icon>
60
58
  </uui-menu-item>
61
59
  `;
62
60
  }
@@ -140,9 +140,9 @@ let UmbEntitySignBundleElement = class UmbEntitySignBundleElement extends UmbLit
140
140
 
141
141
  .infobox {
142
142
  position: absolute;
143
- top: 100%;
143
+ top: 0;
144
144
  margin-top: calc(-12px + var(--offset-h));
145
- left: 100%;
145
+ left: 19px;
146
146
  margin-left: -6px;
147
147
  background-color: transparent;
148
148
  padding: var(--uui-size-2);
@@ -1 +1,2 @@
1
- export { client as umbHttpClient } from '../backend-api/index.js';
1
+ import { client } from '../backend-api/index.js';
2
+ export { client as umbHttpClient };
@@ -1 +1,12 @@
1
- export { client as umbHttpClient } from '../backend-api/index.js';
1
+ import { client } from '../backend-api/index.js';
2
+ /**
3
+ * Pre-configure the client with default credentials for cookie-based authentication.
4
+ * This ensures all requests include cookies by default, which is required for
5
+ * cookie-based authentication in Umbraco 17.0+.
6
+ *
7
+ * Extensions using this client will automatically get credentials: 'include'.
8
+ */
9
+ client.setConfig({
10
+ credentials: 'include',
11
+ });
12
+ export { client as umbHttpClient };
@@ -35,7 +35,10 @@ export declare class UmbPickerInputContext<PickedItemType extends UmbItemModel =
35
35
  */
36
36
  constructor(host: UmbControllerHost, repositoryAlias: string, modalAlias?: string | UmbModalToken<UmbPickerModalData<PickerItemType>, PickerModalValueType>);
37
37
  getSelection(): string[];
38
+ getSelectedItems(): PickedItemType[];
39
+ getSelectedItemByUnique(unique: string): PickedItemType | undefined;
38
40
  setSelection(selection: Array<string | null>): void;
39
41
  openPicker(pickerData?: Partial<PickerModalConfigType>): Promise<void>;
42
+ protected _requestItemName(unique: string): Promise<string>;
40
43
  requestRemoveItem(unique: string): Promise<void>;
41
44
  }
@@ -49,6 +49,12 @@ export class UmbPickerInputContext extends UmbContextBase {
49
49
  getSelection() {
50
50
  return this.#itemManager.getUniques();
51
51
  }
52
+ getSelectedItems() {
53
+ return this.#itemManager.getItems();
54
+ }
55
+ getSelectedItemByUnique(unique) {
56
+ return this.#itemManager.getItems().find((item) => item.unique === unique);
57
+ }
52
58
  setSelection(selection) {
53
59
  // Note: Currently we do not support picking root item. So we filter out null values:
54
60
  this.#itemManager.setUniques(selection.filter((value) => value !== null));
@@ -72,9 +78,11 @@ export class UmbPickerInputContext extends UmbContextBase {
72
78
  this.setSelection(modalValue.selection);
73
79
  this.getHostElement().dispatchEvent(new UmbChangeEvent());
74
80
  }
81
+ async _requestItemName(unique) {
82
+ return this.getSelectedItemByUnique(unique)?.name ?? '#general_notFound';
83
+ }
75
84
  async requestRemoveItem(unique) {
76
- const item = this.#itemManager.getItems().find((item) => item.unique === unique);
77
- const name = item?.name ?? '#general_notFound';
85
+ const name = await this._requestItemName(unique);
78
86
  await umbConfirmModal(this, {
79
87
  color: 'danger',
80
88
  headline: `#actions_remove ${name}?`,
@@ -36,6 +36,7 @@ function createXhrRequest(options) {
36
36
  return new UmbCancelablePromise(async (resolve, reject, onCancel) => {
37
37
  const xhr = new XMLHttpRequest();
38
38
  xhr.open(options.method, `${baseUrl}${options.url}`, true);
39
+ xhr.withCredentials = options.withCredentials ?? true;
39
40
  // Set default headers
40
41
  if (options.token) {
41
42
  const token = typeof options.token === 'function' ? await options.token() : options.token;
@@ -4,6 +4,7 @@ export interface XhrRequestOptions extends UmbTryExecuteOptions {
4
4
  baseUrl?: string;
5
5
  method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
6
6
  url: string;
7
+ withCredentials?: boolean;
7
8
  body?: unknown;
8
9
  token?: string | (() => undefined | string | Promise<string | undefined>);
9
10
  headers?: Record<string, string>;
@@ -1,8 +1,10 @@
1
- import type { UmbConfigCollectionModel } from './types.js';
1
+ import type { UmbConfigCollectionEntryModel } from './types.js';
2
2
  /**
3
3
  * Get a value from a config collection by its alias.
4
- * @param {UmbConfigCollectionModel | undefined} config - The config collection to get the value from.
5
- * @param {string} alias - The alias of the value to get.
6
- * @returns {T | undefined} The value with the specified alias, or undefined if not found or if the config is undefined.
4
+ * @param config - The config collection to get the value from.
5
+ * @param alias - The alias of the config entry to get the value for.
6
+ * @returns The value of the config entry with the specified alias, or undefined if not found.
7
7
  */
8
- export declare function getConfigValue<T>(config: UmbConfigCollectionModel | undefined, alias: string): T | undefined;
8
+ export declare function getConfigValue<T extends UmbConfigCollectionEntryModel, K extends T['alias']>(config: T[] | undefined, alias: K): Extract<T, {
9
+ alias: K;
10
+ }>["value"] | undefined;
@@ -1,10 +1,9 @@
1
1
  /**
2
2
  * Get a value from a config collection by its alias.
3
- * @param {UmbConfigCollectionModel | undefined} config - The config collection to get the value from.
4
- * @param {string} alias - The alias of the value to get.
5
- * @returns {T | undefined} The value with the specified alias, or undefined if not found or if the config is undefined.
3
+ * @param config - The config collection to get the value from.
4
+ * @param alias - The alias of the config entry to get the value for.
5
+ * @returns The value of the config entry with the specified alias, or undefined if not found.
6
6
  */
7
7
  export function getConfigValue(config, alias) {
8
- const entry = config?.find((entry) => entry.alias === alias);
9
- return entry?.value;
8
+ return config?.find((entry) => entry.alias === alias)?.value;
10
9
  }
@@ -18,5 +18,6 @@ UmbDocumentTreeItemModel, UmbDocumentPickerModalData, UmbDocumentPickerModalValu
18
18
  #private;
19
19
  constructor(host: UmbControllerHost);
20
20
  openPicker(pickerData?: Partial<UmbDocumentPickerModalData>, args?: UmbDocumentPickerInputContextOpenArgs): Promise<void>;
21
+ protected _requestItemName(unique: string): Promise<string>;
21
22
  }
22
23
  export {};
@@ -2,6 +2,7 @@ import { UMB_DOCUMENT_PICKER_MODAL, UMB_DOCUMENT_SEARCH_PROVIDER_ALIAS } from '.
2
2
  import { UMB_DOCUMENT_ITEM_REPOSITORY_ALIAS } from '../../item/constants.js';
3
3
  import { UmbPickerInputContext } from '../../../../core/picker-input/index.js';
4
4
  import { UMB_VARIANT_CONTEXT } from '../../../../core/variant/index.js';
5
+ import { UmbDocumentItemDataResolver } from '../../item/index.js';
5
6
  export class UmbDocumentPickerInputContext extends UmbPickerInputContext {
6
7
  constructor(host) {
7
8
  super(host, UMB_DOCUMENT_ITEM_REPOSITORY_ALIAS, UMB_DOCUMENT_PICKER_MODAL);
@@ -30,6 +31,14 @@ export class UmbDocumentPickerInputContext extends UmbPickerInputContext {
30
31
  };
31
32
  await super.openPicker(combinedPickerData);
32
33
  }
34
+ async _requestItemName(unique) {
35
+ const item = this.getSelectedItemByUnique(unique);
36
+ const resolver = new UmbDocumentItemDataResolver(this);
37
+ resolver.setData(item);
38
+ const name = await resolver.getName();
39
+ this.removeUmbController(resolver);
40
+ return name ?? '#general_notFound';
41
+ }
33
42
  #pickableFilter = (item, allowedContentTypes) => {
34
43
  if (allowedContentTypes && allowedContentTypes.length > 0) {
35
44
  return allowedContentTypes
@@ -16,6 +16,7 @@ export class UmbDocumentPermissionServerDataSource {
16
16
  requestPermissions(id) {
17
17
  return tryExecute(this.#host, fetch(`/umbraco/management/api/v1/document/${id}/permissions`, {
18
18
  method: 'GET',
19
+ credentials: 'include',
19
20
  headers: {
20
21
  'Content-Type': 'application/json',
21
22
  },