@simmalugnt-se/payload-consent 0.6.6 → 0.6.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.7
4
+
5
+ - The help under Site address and Scan every month stays out of the site's generated types. It
6
+ names the site's own address and scan day, so `payload-types.ts` differed by environment and
7
+ site, and changed when the types were generated elsewhere. The help is now a function, which
8
+ Payload renders in Admin but leaves out of the types; Admin shows the same text.
9
+
3
10
  ## 0.6.6
4
11
 
5
12
  - A scan without a Site address scans `scanner.callbackBaseUrl`, then `serverURL`. Before, it took
package/dist/global.js CHANGED
@@ -48,6 +48,12 @@ const necessaryOnly = {
48
48
  },
49
49
  condition: (data) => !hasOptional(data),
50
50
  };
51
+ /**
52
+ * A help text that depends on the site, such as its address or its scan day, as a function:
53
+ * Payload leaves functions out of the generated types, so `payload-types.ts` stays the same in
54
+ * every environment and on every site.
55
+ */
56
+ const siteDescription = (texts) => ({ i18n }) => i18n.language === "sv" ? texts.sv : texts.en;
51
57
  export function consentGlobal(options, { usersSlug, schedule }) {
52
58
  const time = `${String(schedule.hour).padStart(2, "0")}:${String(schedule.minute).padStart(2, "0")}`;
53
59
  const legal = options.legalPages;
@@ -202,7 +208,7 @@ export function consentGlobal(options, { usersSlug, schedule }) {
202
208
  label: { en: "Site address", sv: "Webbplatsens adress" },
203
209
  admin: {
204
210
  placeholder: fallbackAddress ?? "https://",
205
- description: fallbackAddress
211
+ description: siteDescription(fallbackAddress
206
212
  ? {
207
213
  en: `The published site's start page. Empty: ${fallbackAddress}, where the scanner sends its results.`,
208
214
  sv: `Den publicerade webbplatsens startsida. Tom: ${fallbackAddress}, dit scannern skickar resultaten.`,
@@ -210,7 +216,7 @@ export function consentGlobal(options, { usersSlug, schedule }) {
210
216
  : {
211
217
  en: "The published site's start page. Empty: Payload's serverURL.",
212
218
  sv: "Den publicerade webbplatsens startsida. Tom: Payloads serverURL.",
213
- },
219
+ }),
214
220
  },
215
221
  },
216
222
  {
@@ -219,10 +225,10 @@ export function consentGlobal(options, { usersSlug, schedule }) {
219
225
  defaultValue: true,
220
226
  label: { en: "Scan every month", sv: "Skanna varje månad" },
221
227
  admin: {
222
- description: {
228
+ description: siteDescription({
223
229
  en: `On day ${schedule.day} of each month, the first time the host's cron runs Payload's jobs after ${time} server time.`,
224
230
  sv: `Den ${schedule.day}:e varje månad, första gången värdens cron kör Payloads jobb efter kl. ${time} servertid.`,
225
- },
231
+ }),
226
232
  },
227
233
  },
228
234
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simmalugnt-se/payload-consent",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
4
4
  "description": "Cookie consent for Payload sites: banner texts, services and scans in Admin",
5
5
  "keywords": [
6
6
  "payload",