@brillout/docpress 0.5.10 → 0.5.11

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/index.d.ts CHANGED
@@ -68,6 +68,12 @@ type Config = {
68
68
  };
69
69
  faviconUrl: string;
70
70
  algolia: null | {
71
+ PENDING_APPROVAL: true;
72
+ appId?: undefined;
73
+ apiKey?: undefined;
74
+ indexName?: undefined;
75
+ } | {
76
+ PENDING_APPROVAL?: undefined;
71
77
  appId: string;
72
78
  apiKey: string;
73
79
  indexName: string;
@@ -81,6 +87,7 @@ type Config = {
81
87
  websiteUrl: string;
82
88
  bannerUrl?: string;
83
89
  twitterHandle: string;
90
+ globalNote?: React.ReactNode;
84
91
  i18n?: true;
85
92
  };
86
93
 
@@ -395,6 +395,7 @@ function EditPageNote({ pageContext }) {
395
395
  // src/PageLayout.tsx
396
396
  function PageLayout({ pageContext, children }) {
397
397
  const { isLandingPage, pageTitle } = pageContext;
398
+ const { globalNote } = pageContext.config;
398
399
  return /* @__PURE__ */ React6.createElement(React6.StrictMode, null, /* @__PURE__ */ React6.createElement(PageContextProvider, {
399
400
  pageContext
400
401
  }, /* @__PURE__ */ React6.createElement("div", {
@@ -410,7 +411,7 @@ function PageLayout({ pageContext, children }) {
410
411
  id: "page-container"
411
412
  }, /* @__PURE__ */ React6.createElement(MobileHeader, null), /* @__PURE__ */ React6.createElement("div", {
412
413
  id: "page-content"
413
- }, pageTitle && /* @__PURE__ */ React6.createElement("h1", null, pageTitle), children, !isLandingPage && /* @__PURE__ */ React6.createElement(EditPageNote, {
414
+ }, globalNote, pageTitle && /* @__PURE__ */ React6.createElement("h1", null, pageTitle), children, !isLandingPage && /* @__PURE__ */ React6.createElement(EditPageNote, {
414
415
  pageContext
415
416
  }))), /* @__PURE__ */ React6.createElement(NavigationMask, null)))));
416
417
  }
@@ -568,13 +569,18 @@ function getDocSearchCSS(pageContext) {
568
569
  `;
569
570
  return docSearchCSS;
570
571
  }
571
- var _a;
572
+ var _a, _b;
572
573
  function getDocSearchJS(pageContext) {
573
574
  const { algolia } = pageContext.meta;
574
- const docSearchJS = !algolia ? "" : escapeInject(_a || (_a = __template([`
575
+ let docSearchJS = !algolia ? "" : escapeInject(_a || (_a = __template([`
575
576
  <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@docsearch/js@alpha"><\/script>
576
577
  <script type="text/javascript">
577
- const appId = '`, "';\n const apiKey = '", "';\n const indexName = '", "';\n const transformItems = ", ";\n docsearch({\n container: '#docsearch-desktop',\n appId, apiKey, indexName, transformItems\n });\n docsearch({\n container: '#docsearch-mobile',\n appId, apiKey, indexName, transformItems\n });\n <\/script>\n "])), algolia.appId, algolia.apiKey, algolia.indexName, dangerouslySkipEscape(getTransformItems()));
578
+ const appId = '`, "';\n const apiKey = '", "';\n const indexName = '", "';\n const transformItems = ", ";\n docsearch({\n container: '#docsearch-desktop',\n appId, apiKey, indexName, transformItems\n });\n docsearch({\n container: '#docsearch-mobile',\n appId, apiKey, indexName, transformItems\n });\n <\/script>\n "])), algolia.appId || "FAKE", algolia.apiKey || "FAKE", algolia.indexName || "FAKE", dangerouslySkipEscape(getTransformItems()));
579
+ if (algolia == null ? void 0 : algolia.PENDING_APPROVAL) {
580
+ docSearchJS = escapeInject(_b || (_b = __template(["\n ", `
581
+ <script>[document.getElementById('docsearch-desktop'), document.getElementById('docsearch-mobile')].forEach(el => el.addEventListener('click', () => window.alert("Algolia approval is pending: the search results will be empty. Try again in a couple of days.")))<\/script>
582
+ `])), docSearchJS);
583
+ }
578
584
  return docSearchJS;
579
585
  }
580
586
  function getTransformItems() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/docpress",
3
- "version": "0.5.10",
3
+ "version": "0.5.11",
4
4
  "scripts": {
5
5
  "// Check types while developing": "",
6
6
  "types": "tsc --noEmit --watch",