drupal-canvas 0.4.1 → 0.4.2
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.
|
@@ -41,7 +41,7 @@ const getPageData = () => {
|
|
|
41
41
|
breadcrumbs: globalThis?.drupalSettings?.canvasData?.v0?.breadcrumbs || [],
|
|
42
42
|
mainEntity: globalThis?.drupalSettings?.canvasData?.v0?.mainEntity || null
|
|
43
43
|
};
|
|
44
|
-
window?.parent.postMessage({
|
|
44
|
+
globalThis?.window?.parent.postMessage({
|
|
45
45
|
type: "_canvas_useswr_data_fetch",
|
|
46
46
|
id: "getPageData()",
|
|
47
47
|
data: pageData
|
|
@@ -64,7 +64,7 @@ const getSiteData = () => {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
window?.parent.postMessage({
|
|
67
|
+
globalThis?.window?.parent.postMessage({
|
|
68
68
|
type: "_canvas_useswr_data_fetch",
|
|
69
69
|
id: "getSiteData()",
|
|
70
70
|
data: siteData
|
package/dist/drupal-utils.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as getSiteData, r as sortMenu, t as getPageData } from "./drupal-utils-
|
|
1
|
+
import { n as getSiteData, r as sortMenu, t as getPageData } from "./drupal-utils-BIEn-IiB.js";
|
|
2
2
|
import { t as FormattedText } from "./FormattedText-C1aZH-9n.js";
|
|
3
|
-
import { t as CanvasJsonApiClient } from "./jsonapi-client-
|
|
3
|
+
import { t as CanvasJsonApiClient } from "./jsonapi-client-VgGykg8d.js";
|
|
4
4
|
import { n as sortMenu$1, t as getNodePath } from "./jsonapi-utils-BA2DcHP4.js";
|
|
5
5
|
import { t as Image } from "./next-image-standalone-Cp3o4ile.js";
|
|
6
6
|
import { t as cn } from "./utils-DuVWmMX9.js";
|
|
@@ -3,11 +3,11 @@ import { DefaultSerializer, JsonApiClient } from "@drupal-api-client/json-api-cl
|
|
|
3
3
|
//#region src/jsonapi-client.ts
|
|
4
4
|
var CanvasJsonApiClient = class extends JsonApiClient {
|
|
5
5
|
constructor(baseUrl, options) {
|
|
6
|
-
if (
|
|
7
|
-
const clientBaseUrl = baseUrl ||
|
|
6
|
+
if (globalThis?.drupalSettings?.canvasData?.v0?.jsonapiSettings === null) throw new Error("The JSON:API module is not installed. Please install it to use JsonApiClient.");
|
|
7
|
+
const clientBaseUrl = baseUrl || globalThis?.drupalSettings?.canvasData?.v0?.baseUrl;
|
|
8
8
|
if (!baseUrl && !clientBaseUrl) throw new Error("Could not determine your site's base URL for the JSON:API client. If working outside of Drupal Canvas, you can use the @drupal-canvas/vite-plugin to automatically configure it for you. Otherwise you must explicitly provide a base URL, i.e. `const client = new JsonApiClient(\"https://...\")`");
|
|
9
9
|
const clientOptions = {
|
|
10
|
-
apiPrefix:
|
|
10
|
+
apiPrefix: globalThis?.drupalSettings?.canvasData?.v0?.jsonapiSettings?.apiPrefix,
|
|
11
11
|
serializer: new DefaultSerializer(),
|
|
12
12
|
...options
|
|
13
13
|
};
|
package/dist/jsonapi-client.js
CHANGED