payload-intl 1.0.0 → 1.1.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.
Files changed (87) hide show
  1. package/dist/const.js +14 -0
  2. package/dist/const.js.map +1 -0
  3. package/dist/endpoints/get-messages.js +9 -9
  4. package/dist/endpoints/get-messages.js.map +1 -1
  5. package/dist/endpoints/set-messages.js +28 -28
  6. package/dist/endpoints/set-messages.js.map +1 -1
  7. package/dist/requests/fetchMessages.js +30 -21
  8. package/dist/requests/fetchMessages.js.map +1 -1
  9. package/package.json +2 -4
  10. package/dist/components/MessageController.d.ts +0 -15
  11. package/dist/components/MessageController.d.ts.map +0 -1
  12. package/dist/components/MessagesForm.d.ts +0 -11
  13. package/dist/components/MessagesForm.d.ts.map +0 -1
  14. package/dist/components/actions/JsonImport.d.ts +0 -2
  15. package/dist/components/actions/JsonImport.d.ts.map +0 -1
  16. package/dist/components/actions/Move.d.ts +0 -2
  17. package/dist/components/actions/Move.d.ts.map +0 -1
  18. package/dist/components/inputs/InputWrapper.d.ts +0 -8
  19. package/dist/components/inputs/InputWrapper.d.ts.map +0 -1
  20. package/dist/components/inputs/LexicalInput.d.ts +0 -20
  21. package/dist/components/inputs/LexicalInput.d.ts.map +0 -1
  22. package/dist/components/inputs/MessageInput.d.ts +0 -11
  23. package/dist/components/inputs/MessageInput.d.ts.map +0 -1
  24. package/dist/components/inputs/variables/VariableChip.d.ts +0 -3
  25. package/dist/components/inputs/variables/VariableChip.d.ts.map +0 -1
  26. package/dist/components/inputs/variables/VariableIcon.d.ts +0 -7
  27. package/dist/components/inputs/variables/VariableIcon.d.ts.map +0 -1
  28. package/dist/components/inputs/variables/VariableSuggestion.d.ts +0 -9
  29. package/dist/components/inputs/variables/VariableSuggestion.d.ts.map +0 -1
  30. package/dist/components/inputs/variables/editors/DateVariableEditor.d.ts +0 -10
  31. package/dist/components/inputs/variables/editors/DateVariableEditor.d.ts.map +0 -1
  32. package/dist/components/inputs/variables/editors/PluralVariableEditor.d.ts +0 -10
  33. package/dist/components/inputs/variables/editors/PluralVariableEditor.d.ts.map +0 -1
  34. package/dist/components/inputs/variables/editors/SelectVariableEditor.d.ts +0 -7
  35. package/dist/components/inputs/variables/editors/SelectVariableEditor.d.ts.map +0 -1
  36. package/dist/components/inputs/variables/editors/TagVariableEditor.d.ts +0 -7
  37. package/dist/components/inputs/variables/editors/TagVariableEditor.d.ts.map +0 -1
  38. package/dist/components/inputs/variables/editors/TimeVariableEditor.d.ts +0 -10
  39. package/dist/components/inputs/variables/editors/TimeVariableEditor.d.ts.map +0 -1
  40. package/dist/components/inputs/variables/extension.d.ts +0 -4
  41. package/dist/components/inputs/variables/extension.d.ts.map +0 -1
  42. package/dist/components/inputs/variables/pickers/NumericVariablePicker.d.ts +0 -7
  43. package/dist/components/inputs/variables/pickers/NumericVariablePicker.d.ts.map +0 -1
  44. package/dist/components/inputs/variables/pickers/TemporalElementEditor.d.ts +0 -7
  45. package/dist/components/inputs/variables/pickers/TemporalElementEditor.d.ts.map +0 -1
  46. package/dist/components/layout/MessageField.d.ts +0 -10
  47. package/dist/components/layout/MessageField.d.ts.map +0 -1
  48. package/dist/components/layout/MessagesTabs.d.ts +0 -9
  49. package/dist/components/layout/MessagesTabs.d.ts.map +0 -1
  50. package/dist/components/layout/MessagesTree.d.ts +0 -10
  51. package/dist/components/layout/MessagesTree.d.ts.map +0 -1
  52. package/dist/context/messages-form.d.ts +0 -29
  53. package/dist/context/messages-form.d.ts.map +0 -1
  54. package/dist/endpoints/get-messages.d.ts +0 -3
  55. package/dist/endpoints/get-messages.d.ts.map +0 -1
  56. package/dist/endpoints/set-messages.d.ts +0 -3
  57. package/dist/endpoints/set-messages.d.ts.map +0 -1
  58. package/dist/exports/link.d.ts +0 -8
  59. package/dist/exports/link.d.ts.map +0 -1
  60. package/dist/exports/rsc.d.ts +0 -3
  61. package/dist/exports/rsc.d.ts.map +0 -1
  62. package/dist/exports/view.d.ts +0 -10
  63. package/dist/exports/view.d.ts.map +0 -1
  64. package/dist/index.d.ts +0 -6
  65. package/dist/index.d.ts.map +0 -1
  66. package/dist/requests/fetchMessages.d.ts +0 -4
  67. package/dist/requests/fetchMessages.d.ts.map +0 -1
  68. package/dist/types.d.ts +0 -41
  69. package/dist/types.d.ts.map +0 -1
  70. package/dist/utils/cn.d.ts +0 -3
  71. package/dist/utils/cn.d.ts.map +0 -1
  72. package/dist/utils/config.d.ts +0 -12
  73. package/dist/utils/config.d.ts.map +0 -1
  74. package/dist/utils/error-handling.d.ts +0 -2
  75. package/dist/utils/error-handling.d.ts.map +0 -1
  76. package/dist/utils/format.d.ts +0 -4
  77. package/dist/utils/format.d.ts.map +0 -1
  78. package/dist/utils/guards.d.ts +0 -6
  79. package/dist/utils/guards.d.ts.map +0 -1
  80. package/dist/utils/icu-tranform.d.ts +0 -31
  81. package/dist/utils/icu-tranform.d.ts.map +0 -1
  82. package/dist/utils/sanitize.d.ts +0 -16
  83. package/dist/utils/sanitize.d.ts.map +0 -1
  84. package/dist/utils/schema.d.ts +0 -10
  85. package/dist/utils/schema.d.ts.map +0 -1
  86. package/dist/utils/validate.d.ts +0 -6
  87. package/dist/utils/validate.d.ts.map +0 -1
package/dist/const.js ADDED
@@ -0,0 +1,14 @@
1
+ const t = {
2
+ setMessages: {
3
+ path: "/intl-plugin",
4
+ method: "put"
5
+ },
6
+ getMessages: {
7
+ path: "/intl-plugin/:locale",
8
+ method: "get"
9
+ }
10
+ };
11
+ export {
12
+ t as ENDPOINT_CONFIG
13
+ };
14
+ //# sourceMappingURL=const.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"const.js","sources":["../src/const.ts"],"sourcesContent":["import type { Endpoint } from 'payload';\n\nexport const ENDPOINT_CONFIG = {\n setMessages: {\n path: '/intl-plugin',\n method: 'put',\n },\n getMessages: {\n path: '/intl-plugin/:locale',\n method: 'get',\n },\n} satisfies Record<string, Pick<Endpoint, 'path' | 'method'>>;\n"],"names":["ENDPOINT_CONFIG"],"mappings":"AAEO,MAAMA,IAAkB;AAAA,EAC7B,aAAa;AAAA,IACX,MAAM;AAAA,IACN,QAAQ;AAAA,EAAA;AAAA,EAEV,aAAa;AAAA,IACX,MAAM;AAAA,IACN,QAAQ;AAAA,EAAA;AAEZ;"}
@@ -1,13 +1,13 @@
1
- import { fetchMessages as a } from "../requests/fetchMessages.js";
2
- const n = {
3
- handler: async (e) => {
4
- const { locale: s } = e.routeParams, t = await a(e.payload, s);
5
- return Response.json(t);
6
- },
7
- method: "get",
8
- path: "/intl-plugin/:locale"
1
+ import { ENDPOINT_CONFIG as a } from "../const.js";
2
+ import { fetchMessages as t } from "../requests/fetchMessages.js";
3
+ const c = {
4
+ ...a.getMessages,
5
+ handler: async (s) => {
6
+ const { locale: e } = s.routeParams, o = await t(s.payload, e);
7
+ return Response.json(o);
8
+ }
9
9
  };
10
10
  export {
11
- n as getMessagesEndpoint
11
+ c as getMessagesEndpoint
12
12
  };
13
13
  //# sourceMappingURL=get-messages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-messages.js","sources":["../../src/endpoints/get-messages.ts"],"sourcesContent":["import type { Endpoint, PayloadRequest } from 'payload';\n\nimport { fetchMessages } from '../requests/fetchMessages';\n\nexport const getMessagesEndpoint: Endpoint = {\n handler: async (req: PayloadRequest) => {\n const { locale } = req.routeParams as { locale: string };\n const messages = await fetchMessages(req.payload, locale);\n return Response.json(messages);\n },\n method: 'get',\n path: '/intl-plugin/:locale',\n};\n"],"names":["getMessagesEndpoint","req","locale","messages","fetchMessages"],"mappings":";AAIO,MAAMA,IAAgC;AAAA,EAC3C,SAAS,OAAOC,MAAwB;AACtC,UAAM,EAAE,QAAAC,MAAWD,EAAI,aACjBE,IAAW,MAAMC,EAAcH,EAAI,SAASC,CAAM;AACxD,WAAO,SAAS,KAAKC,CAAQ;AAAA,EAC/B;AAAA,EACA,QAAQ;AAAA,EACR,MAAM;AACR;"}
1
+ {"version":3,"file":"get-messages.js","sources":["../../src/endpoints/get-messages.ts"],"sourcesContent":["import type { Endpoint, PayloadRequest } from 'payload';\nimport { ENDPOINT_CONFIG } from '@/const';\nimport { fetchMessages } from '../requests/fetchMessages';\n\nexport const getMessagesEndpoint: Endpoint = {\n ...ENDPOINT_CONFIG.getMessages,\n handler: async (req: PayloadRequest) => {\n const { locale } = req.routeParams as { locale: string };\n const messages = await fetchMessages(req.payload, locale);\n return Response.json(messages);\n },\n};\n"],"names":["getMessagesEndpoint","ENDPOINT_CONFIG","req","locale","messages","fetchMessages"],"mappings":";;AAIO,MAAMA,IAAgC;AAAA,EAC3C,GAAGC,EAAgB;AAAA,EACnB,SAAS,OAAOC,MAAwB;AACtC,UAAM,EAAE,QAAAC,MAAWD,EAAI,aACjBE,IAAW,MAAMC,EAAcH,EAAI,SAASC,CAAM;AACxD,WAAO,SAAS,KAAKC,CAAQ;AAAA,EAC/B;AACF;"}
@@ -1,47 +1,47 @@
1
- import { getSupportedLocales as p, getPluginContext as d } from "../utils/config.js";
2
- const f = {
3
- handler: async (a) => {
4
- const { user: c } = await a.payload.auth({ headers: a.headers });
1
+ import { ENDPOINT_CONFIG as d } from "../const.js";
2
+ import { getSupportedLocales as p, getPluginContext as f } from "../utils/config.js";
3
+ const g = {
4
+ ...d.setMessages,
5
+ handler: async (o) => {
6
+ const { user: c } = await o.payload.auth({ headers: o.headers });
5
7
  if (!c)
6
8
  throw new Error("Unauthorized");
7
- const e = await a.json?.();
8
- if (!e)
9
+ const t = await o.json?.();
10
+ if (!t)
9
11
  throw new Error("No data provided");
10
12
  const l = p(
11
- a.payload.config.localization
12
- ), { collectionSlug: n } = d(a.payload.config);
13
- for (const o of l) {
14
- const s = e[o];
15
- if (!s) continue;
16
- const t = new File(
17
- [JSON.stringify(s)],
18
- `${o}-${Date.now()}.json`,
13
+ o.payload.config.localization
14
+ ), { collectionSlug: s } = f(o.payload.config);
15
+ for (const a of l) {
16
+ const n = t[a];
17
+ if (!n) continue;
18
+ const e = new File(
19
+ [JSON.stringify(n)],
20
+ `${a}-${Date.now()}.json`,
19
21
  {
20
22
  type: "application/json"
21
23
  }
22
24
  ), i = {
23
- name: t.name,
24
- data: Buffer.from(await t.arrayBuffer()),
25
- mimetype: t.type,
26
- size: t.size
27
- }, { docs: r } = await a.payload.update({
28
- collection: n,
25
+ name: e.name,
26
+ data: Buffer.from(await e.arrayBuffer()),
27
+ mimetype: e.type,
28
+ size: e.size
29
+ }, { docs: r } = await o.payload.update({
30
+ collection: s,
29
31
  data: {},
30
32
  file: i,
31
- where: { locale: { equals: o } }
33
+ where: { locale: { equals: a } }
32
34
  });
33
- r.length === 0 && await a.payload.create({
34
- collection: n,
35
- data: { locale: o },
35
+ r.length === 0 && await o.payload.create({
36
+ collection: s,
37
+ data: { locale: a },
36
38
  file: i
37
39
  });
38
40
  }
39
41
  return Response.json({ success: !0 });
40
- },
41
- method: "put",
42
- path: "/intl-plugin"
42
+ }
43
43
  };
44
44
  export {
45
- f as setMessagesEndpoint
45
+ g as setMessagesEndpoint
46
46
  };
47
47
  //# sourceMappingURL=set-messages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"set-messages.js","sources":["../../src/endpoints/set-messages.ts"],"sourcesContent":["import type { Endpoint, File, PayloadRequest } from 'payload';\nimport type { Messages, Translations } from '@/types';\n\nimport { getPluginContext, getSupportedLocales } from '@/utils/config';\n\nexport const setMessagesEndpoint: Endpoint = {\n handler: async (req: PayloadRequest) => {\n const { user } = await req.payload.auth({ headers: req.headers });\n if (!user) {\n throw new Error('Unauthorized');\n }\n\n const data = (await req.json?.()) as Translations<Messages> | undefined;\n if (!data) {\n throw new Error('No data provided');\n }\n\n const supportedLocales = getSupportedLocales(\n req.payload.config.localization,\n );\n const { collectionSlug } = getPluginContext(req.payload.config);\n\n for (const locale of supportedLocales) {\n const messages = data[locale];\n if (!messages) continue;\n\n const rawFile = new File(\n [JSON.stringify(messages)],\n `${locale}-${Date.now()}.json`,\n {\n type: 'application/json',\n },\n );\n\n const file: File = {\n name: rawFile.name,\n data: Buffer.from(await rawFile.arrayBuffer()),\n mimetype: rawFile.type,\n size: rawFile.size,\n };\n\n const { docs } = await req.payload.update({\n collection: collectionSlug,\n data: {},\n file,\n where: { locale: { equals: locale } },\n });\n if (docs.length === 0) {\n await req.payload.create({\n collection: collectionSlug,\n data: { locale },\n file,\n });\n }\n }\n\n return Response.json({ success: true });\n },\n method: 'put',\n path: '/intl-plugin',\n};\n"],"names":["setMessagesEndpoint","req","user","data","supportedLocales","getSupportedLocales","collectionSlug","getPluginContext","locale","messages","rawFile","file","docs"],"mappings":";AAKO,MAAMA,IAAgC;AAAA,EAC3C,SAAS,OAAOC,MAAwB;AACtC,UAAM,EAAE,MAAAC,MAAS,MAAMD,EAAI,QAAQ,KAAK,EAAE,SAASA,EAAI,SAAS;AAChE,QAAI,CAACC;AACH,YAAM,IAAI,MAAM,cAAc;AAGhC,UAAMC,IAAQ,MAAMF,EAAI,OAAA;AACxB,QAAI,CAACE;AACH,YAAM,IAAI,MAAM,kBAAkB;AAGpC,UAAMC,IAAmBC;AAAA,MACvBJ,EAAI,QAAQ,OAAO;AAAA,IAAA,GAEf,EAAE,gBAAAK,EAAA,IAAmBC,EAAiBN,EAAI,QAAQ,MAAM;AAE9D,eAAWO,KAAUJ,GAAkB;AACrC,YAAMK,IAAWN,EAAKK,CAAM;AAC5B,UAAI,CAACC,EAAU;AAEf,YAAMC,IAAU,IAAI;AAAA,QAClB,CAAC,KAAK,UAAUD,CAAQ,CAAC;AAAA,QACzB,GAAGD,CAAM,IAAI,KAAK,KAAK;AAAA,QACvB;AAAA,UACE,MAAM;AAAA,QAAA;AAAA,MACR,GAGIG,IAAa;AAAA,QACjB,MAAMD,EAAQ;AAAA,QACd,MAAM,OAAO,KAAK,MAAMA,EAAQ,aAAa;AAAA,QAC7C,UAAUA,EAAQ;AAAA,QAClB,MAAMA,EAAQ;AAAA,MAAA,GAGV,EAAE,MAAAE,EAAA,IAAS,MAAMX,EAAI,QAAQ,OAAO;AAAA,QACxC,YAAYK;AAAA,QACZ,MAAM,CAAA;AAAA,QACN,MAAAK;AAAA,QACA,OAAO,EAAE,QAAQ,EAAE,QAAQH,IAAO;AAAA,MAAE,CACrC;AACD,MAAII,EAAK,WAAW,KAClB,MAAMX,EAAI,QAAQ,OAAO;AAAA,QACvB,YAAYK;AAAA,QACZ,MAAM,EAAE,QAAAE,EAAA;AAAA,QACR,MAAAG;AAAA,MAAA,CACD;AAAA,IAEL;AAEA,WAAO,SAAS,KAAK,EAAE,SAAS,IAAM;AAAA,EACxC;AAAA,EACA,QAAQ;AAAA,EACR,MAAM;AACR;"}
1
+ {"version":3,"file":"set-messages.js","sources":["../../src/endpoints/set-messages.ts"],"sourcesContent":["import type { Endpoint, File, PayloadRequest } from 'payload';\nimport { ENDPOINT_CONFIG } from '@/const';\nimport type { Messages, Translations } from '@/types';\nimport { getPluginContext, getSupportedLocales } from '@/utils/config';\n\nexport const setMessagesEndpoint: Endpoint = {\n ...ENDPOINT_CONFIG.setMessages,\n handler: async (req: PayloadRequest) => {\n const { user } = await req.payload.auth({ headers: req.headers });\n if (!user) {\n throw new Error('Unauthorized');\n }\n\n const data = (await req.json?.()) as Translations<Messages> | undefined;\n if (!data) {\n throw new Error('No data provided');\n }\n\n const supportedLocales = getSupportedLocales(\n req.payload.config.localization,\n );\n const { collectionSlug } = getPluginContext(req.payload.config);\n\n for (const locale of supportedLocales) {\n const messages = data[locale];\n if (!messages) continue;\n\n const rawFile = new File(\n [JSON.stringify(messages)],\n `${locale}-${Date.now()}.json`,\n {\n type: 'application/json',\n },\n );\n\n const file: File = {\n name: rawFile.name,\n data: Buffer.from(await rawFile.arrayBuffer()),\n mimetype: rawFile.type,\n size: rawFile.size,\n };\n\n const { docs } = await req.payload.update({\n collection: collectionSlug,\n data: {},\n file,\n where: { locale: { equals: locale } },\n });\n if (docs.length === 0) {\n await req.payload.create({\n collection: collectionSlug,\n data: { locale },\n file,\n });\n }\n }\n\n return Response.json({ success: true });\n },\n};\n"],"names":["setMessagesEndpoint","ENDPOINT_CONFIG","req","user","data","supportedLocales","getSupportedLocales","collectionSlug","getPluginContext","locale","messages","rawFile","file","docs"],"mappings":";;AAKO,MAAMA,IAAgC;AAAA,EAC3C,GAAGC,EAAgB;AAAA,EACnB,SAAS,OAAOC,MAAwB;AACtC,UAAM,EAAE,MAAAC,MAAS,MAAMD,EAAI,QAAQ,KAAK,EAAE,SAASA,EAAI,SAAS;AAChE,QAAI,CAACC;AACH,YAAM,IAAI,MAAM,cAAc;AAGhC,UAAMC,IAAQ,MAAMF,EAAI,OAAA;AACxB,QAAI,CAACE;AACH,YAAM,IAAI,MAAM,kBAAkB;AAGpC,UAAMC,IAAmBC;AAAA,MACvBJ,EAAI,QAAQ,OAAO;AAAA,IAAA,GAEf,EAAE,gBAAAK,EAAA,IAAmBC,EAAiBN,EAAI,QAAQ,MAAM;AAE9D,eAAWO,KAAUJ,GAAkB;AACrC,YAAMK,IAAWN,EAAKK,CAAM;AAC5B,UAAI,CAACC,EAAU;AAEf,YAAMC,IAAU,IAAI;AAAA,QAClB,CAAC,KAAK,UAAUD,CAAQ,CAAC;AAAA,QACzB,GAAGD,CAAM,IAAI,KAAK,KAAK;AAAA,QACvB;AAAA,UACE,MAAM;AAAA,QAAA;AAAA,MACR,GAGIG,IAAa;AAAA,QACjB,MAAMD,EAAQ;AAAA,QACd,MAAM,OAAO,KAAK,MAAMA,EAAQ,aAAa;AAAA,QAC7C,UAAUA,EAAQ;AAAA,QAClB,MAAMA,EAAQ;AAAA,MAAA,GAGV,EAAE,MAAAE,EAAA,IAAS,MAAMX,EAAI,QAAQ,OAAO;AAAA,QACxC,YAAYK;AAAA,QACZ,MAAM,CAAA;AAAA,QACN,MAAAK;AAAA,QACA,OAAO,EAAE,QAAQ,EAAE,QAAQH,IAAO;AAAA,MAAE,CACrC;AACD,MAAII,EAAK,WAAW,KAClB,MAAMX,EAAI,QAAQ,OAAO;AAAA,QACvB,YAAYK;AAAA,QACZ,MAAM,EAAE,QAAAE,EAAA;AAAA,QACR,MAAAG;AAAA,MAAA,CACD;AAAA,IAEL;AAEA,WAAO,SAAS,KAAK,EAAE,SAAS,IAAM;AAAA,EACxC;AACF;"}
@@ -1,32 +1,41 @@
1
- import { getPluginContext as i } from "../utils/config.js";
2
- import { getErrorMessage as c } from "../utils/error-handling.js";
3
- async function l(r, o) {
4
- if (!r.config.serverURL)
5
- throw new Error(
6
- "serverURL is required in your payload.config.ts file for payload-intl to work."
1
+ import { ENDPOINT_CONFIG as u } from "../const.js";
2
+ import { getPluginContext as h } from "../utils/config.js";
3
+ import { getErrorMessage as w } from "../utils/error-handling.js";
4
+ async function N(t, e) {
5
+ if ("serverUrl" in t) {
6
+ const { serverUrl: r, apiRoute: l = "api" } = t, f = l.replace(/^\/|\/$/g, ""), g = u.getMessages.path.replace(/^\/|\/$/g, "").replace(":locale", e), p = `/${f}/${g}`, c = new URL(p, r);
7
+ console.debug(
8
+ `PAYLOAD_INTL: Fetching messages from API: ${c.toString()}`
7
9
  );
8
- const {
9
- docs: [t]
10
- } = await r.find({
11
- collection: i(r.config).collectionSlug,
12
- where: { locale: { equals: o } }
10
+ const i = await fetch(c.toString());
11
+ if (!i.ok)
12
+ throw new Error(`Failed to fetch messages for locale ${e}`);
13
+ return await i.json();
14
+ }
15
+ const s = t, {
16
+ docs: [n]
17
+ } = await s.find({
18
+ collection: h(s.config).collectionSlug,
19
+ where: { locale: { equals: e } }
13
20
  });
14
- if (!t)
15
- return console.warn(`No messages found for locale ${o}`), {};
16
- const { url: n } = t, e = await fetch(n);
17
- if (!e.ok) {
18
- const s = await c(e);
21
+ if (!n)
22
+ return console.warn(`No messages found for locale ${e}`), {};
23
+ const { url: a } = n;
24
+ console.debug(`PAYLOAD_INTL: Fetching messages from stroage: ${a}`);
25
+ const o = await fetch(a);
26
+ if (!o.ok) {
27
+ const r = await w(o);
19
28
  throw new Error(
20
- `Could not fetch messages for locale "${o}": ${s}`
29
+ `Could not fetch messages for locale "${e}": ${r}`
21
30
  );
22
31
  }
23
- if (e.headers.get("content-type") !== "application/json")
32
+ if (o.headers.get("content-type") !== "application/json")
24
33
  throw new Error(
25
- `Could not fetch messages for locale "${o}": The page did not return a JSON file.`
34
+ `Could not fetch messages for locale "${e}": The page did not return a JSON file.`
26
35
  );
27
- return await e.json();
36
+ return await o.json();
28
37
  }
29
38
  export {
30
- l as fetchMessages
39
+ N as fetchMessages
31
40
  };
32
41
  //# sourceMappingURL=fetchMessages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchMessages.js","sources":["../../src/requests/fetchMessages.ts"],"sourcesContent":["import type { BasePayload } from 'payload';\n\nimport { getPluginContext } from '@/utils/config';\nimport { getErrorMessage } from '@/utils/error-handling';\n\nimport type { Messages } from '../types';\n\nexport async function fetchMessages(\n payload: BasePayload,\n locale: string,\n): Promise<Messages> {\n if (!payload.config.serverURL) {\n throw new Error(\n 'serverURL is required in your payload.config.ts file for payload-intl to work.',\n );\n }\n\n const {\n docs: [doc],\n } = await payload.find({\n collection: getPluginContext(payload.config).collectionSlug,\n where: { locale: { equals: locale } },\n });\n\n if (!doc) {\n console.warn(`No messages found for locale ${locale}`);\n return {};\n }\n\n const { url } = doc as unknown as { url: string };\n\n const response = await fetch(url);\n\n if (!response.ok) {\n const error = await getErrorMessage(response);\n throw new Error(\n `Could not fetch messages for locale \"${locale}\": ${error}`,\n );\n }\n\n if (response.headers.get('content-type') !== 'application/json') {\n throw new Error(\n `Could not fetch messages for locale \"${locale}\": The page did not return a JSON file.`,\n );\n }\n\n return await response.json();\n}\n\n/*\ntry {\n const response = await fetch(endpointUrl, {\n method: \"PUT\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(changes),\n });\n\n if (!response.ok) {\n const error = await response.json().catch(() => ({}));\n throw new Error(\n \"message\" in error ? error.message : \"Unknown error\"\n );\n }\n\n form.reset(currentValues);\n toast.success(\"Saved\", { id: toastId });\n } catch (error) {\n toast.error(\n `Failed to save: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n { id: toastId },\n );\n }\n };\n\n*/\n"],"names":["fetchMessages","payload","locale","doc","getPluginContext","url","response","error","getErrorMessage"],"mappings":";;AAOA,eAAsBA,EACpBC,GACAC,GACmB;AACnB,MAAI,CAACD,EAAQ,OAAO;AAClB,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAIJ,QAAM;AAAA,IACJ,MAAM,CAACE,CAAG;AAAA,EAAA,IACR,MAAMF,EAAQ,KAAK;AAAA,IACrB,YAAYG,EAAiBH,EAAQ,MAAM,EAAE;AAAA,IAC7C,OAAO,EAAE,QAAQ,EAAE,QAAQC,IAAO;AAAA,EAAE,CACrC;AAED,MAAI,CAACC;AACH,mBAAQ,KAAK,gCAAgCD,CAAM,EAAE,GAC9C,CAAA;AAGT,QAAM,EAAE,KAAAG,MAAQF,GAEVG,IAAW,MAAM,MAAMD,CAAG;AAEhC,MAAI,CAACC,EAAS,IAAI;AAChB,UAAMC,IAAQ,MAAMC,EAAgBF,CAAQ;AAC5C,UAAM,IAAI;AAAA,MACR,wCAAwCJ,CAAM,MAAMK,CAAK;AAAA,IAAA;AAAA,EAE7D;AAEA,MAAID,EAAS,QAAQ,IAAI,cAAc,MAAM;AAC3C,UAAM,IAAI;AAAA,MACR,wCAAwCJ,CAAM;AAAA,IAAA;AAIlD,SAAO,MAAMI,EAAS,KAAA;AACxB;"}
1
+ {"version":3,"file":"fetchMessages.js","sources":["../../src/requests/fetchMessages.ts"],"sourcesContent":["import type { BasePayload } from 'payload';\nimport { ENDPOINT_CONFIG } from '@/const';\nimport { getPluginContext } from '@/utils/config';\nimport { getErrorMessage } from '@/utils/error-handling';\nimport type { Messages } from '../types';\n\ninterface MessagesRequestConfig {\n serverUrl: string;\n /**\n * If defined a custom api route in your payload.config.ts (`routes.api`), add them same here.\n * @default 'api'\n */\n apiRoute?: string;\n}\n\nexport async function fetchMessages(\n config: MessagesRequestConfig,\n locale: string,\n): Promise<Messages>;\nexport async function fetchMessages(\n payload: BasePayload,\n locale: string,\n): Promise<Messages>;\nexport async function fetchMessages(\n configOrPayload: MessagesRequestConfig | BasePayload,\n locale: string,\n): Promise<Messages> {\n if ('serverUrl' in configOrPayload) {\n const { serverUrl, apiRoute = 'api' } = configOrPayload;\n\n const cleanApiRoute = apiRoute.replace(/^\\/|\\/$/g, '');\n\n const relativePath = ENDPOINT_CONFIG.getMessages.path\n .replace(/^\\/|\\/$/g, '')\n .replace(':locale', locale);\n\n const fullPath = `/${cleanApiRoute}/${relativePath}`;\n\n const url = new URL(fullPath, serverUrl);\n\n console.debug(\n `PAYLOAD_INTL: Fetching messages from API: ${url.toString()}`,\n );\n\n const response = await fetch(url.toString());\n if (!response.ok) {\n throw new Error(`Failed to fetch messages for locale ${locale}`);\n }\n return await response.json();\n }\n\n const payload = configOrPayload;\n\n const {\n docs: [doc],\n } = await payload.find({\n collection: getPluginContext(payload.config).collectionSlug,\n where: { locale: { equals: locale } },\n });\n\n if (!doc) {\n console.warn(`No messages found for locale ${locale}`);\n return {};\n }\n\n const { url } = doc as unknown as { url: string };\n\n console.debug(`PAYLOAD_INTL: Fetching messages from stroage: ${url}`);\n\n const response = await fetch(url);\n\n if (!response.ok) {\n const error = await getErrorMessage(response);\n throw new Error(\n `Could not fetch messages for locale \"${locale}\": ${error}`,\n );\n }\n\n if (response.headers.get('content-type') !== 'application/json') {\n throw new Error(\n `Could not fetch messages for locale \"${locale}\": The page did not return a JSON file.`,\n );\n }\n\n return await response.json();\n}\n"],"names":["fetchMessages","configOrPayload","locale","serverUrl","apiRoute","cleanApiRoute","relativePath","ENDPOINT_CONFIG","fullPath","url","response","payload","doc","getPluginContext","error","getErrorMessage"],"mappings":";;;AAuBA,eAAsBA,EACpBC,GACAC,GACmB;AACnB,MAAI,eAAeD,GAAiB;AAClC,UAAM,EAAE,WAAAE,GAAW,UAAAC,IAAW,MAAA,IAAUH,GAElCI,IAAgBD,EAAS,QAAQ,YAAY,EAAE,GAE/CE,IAAeC,EAAgB,YAAY,KAC9C,QAAQ,YAAY,EAAE,EACtB,QAAQ,WAAWL,CAAM,GAEtBM,IAAW,IAAIH,CAAa,IAAIC,CAAY,IAE5CG,IAAM,IAAI,IAAID,GAAUL,CAAS;AAEvC,YAAQ;AAAA,MACN,6CAA6CM,EAAI,UAAU;AAAA,IAAA;AAG7D,UAAMC,IAAW,MAAM,MAAMD,EAAI,UAAU;AAC3C,QAAI,CAACC,EAAS;AACZ,YAAM,IAAI,MAAM,uCAAuCR,CAAM,EAAE;AAEjE,WAAO,MAAMQ,EAAS,KAAA;AAAA,EACxB;AAEA,QAAMC,IAAUV,GAEV;AAAA,IACJ,MAAM,CAACW,CAAG;AAAA,EAAA,IACR,MAAMD,EAAQ,KAAK;AAAA,IACrB,YAAYE,EAAiBF,EAAQ,MAAM,EAAE;AAAA,IAC7C,OAAO,EAAE,QAAQ,EAAE,QAAQT,IAAO;AAAA,EAAE,CACrC;AAED,MAAI,CAACU;AACH,mBAAQ,KAAK,gCAAgCV,CAAM,EAAE,GAC9C,CAAA;AAGT,QAAM,EAAE,KAAAO,MAAQG;AAEhB,UAAQ,MAAM,iDAAiDH,CAAG,EAAE;AAEpE,QAAMC,IAAW,MAAM,MAAMD,CAAG;AAEhC,MAAI,CAACC,EAAS,IAAI;AAChB,UAAMI,IAAQ,MAAMC,EAAgBL,CAAQ;AAC5C,UAAM,IAAI;AAAA,MACR,wCAAwCR,CAAM,MAAMY,CAAK;AAAA,IAAA;AAAA,EAE7D;AAEA,MAAIJ,EAAS,QAAQ,IAAI,cAAc,MAAM;AAC3C,UAAM,IAAI;AAAA,MACR,wCAAwCR,CAAM;AAAA,IAAA;AAIlD,SAAO,MAAMQ,EAAS,KAAA;AACxB;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payload-intl",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Payload Plugin for I18N using ICU Messages",
5
5
  "keywords": [
6
6
  "payload",
@@ -99,10 +99,8 @@
99
99
  "pnpm": "^9 || ^10"
100
100
  },
101
101
  "publishConfig": {
102
- "access": "public",
103
- "provenance": true
102
+ "access": "public"
104
103
  },
105
- "registry": "https://registry.npmjs.org/",
106
104
  "scripts": {
107
105
  "prebuild": "pnpm typecheck",
108
106
  "build": "vite build",
@@ -1,15 +0,0 @@
1
- import { TemplateVariable } from '../types';
2
- import { MessageType } from '../utils/schema';
3
- import { MessageValidator } from '../utils/validate';
4
- interface MessageControllerProps {
5
- type: MessageType;
6
- label?: string;
7
- locale: string;
8
- name: string;
9
- className?: string;
10
- variables: TemplateVariable[];
11
- validate: MessageValidator;
12
- }
13
- export declare function MessageController({ type, name, variables, label, locale, validate, className, }: MessageControllerProps): React.ReactNode;
14
- export {};
15
- //# sourceMappingURL=MessageController.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MessageController.d.ts","sourceRoot":"","sources":["../../src/components/MessageController.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIzD,UAAU,sBAAsB;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,QAAQ,EAAE,gBAAgB,CAAC;CAC5B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,GACV,EAAE,sBAAsB,GAAG,KAAK,CAAC,SAAS,CAgD1C"}
@@ -1,11 +0,0 @@
1
- import { DeepPartial, Locales, Messages, MessagesSchema, Translations } from '../types';
2
- interface MessagesFormProps {
3
- locales: Locales;
4
- schema: MessagesSchema;
5
- tabs?: boolean;
6
- values: Translations<DeepPartial<Messages>>;
7
- endpointUrl: string;
8
- }
9
- export declare function MessagesForm({ locales, schema, tabs, values, endpointUrl, }: MessagesFormProps): React.ReactNode;
10
- export {};
11
- //# sourceMappingURL=MessagesForm.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MessagesForm.d.ts","sourceRoot":"","sources":["../../src/components/MessagesForm.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,WAAW,EACX,OAAO,EACP,QAAQ,EACR,cAAc,EACd,YAAY,EACb,MAAM,SAAS,CAAC;AAQjB,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,cAAc,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5C,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,MAAM,EACN,IAAY,EACZ,MAAM,EACN,WAAW,GACZ,EAAE,iBAAiB,GAAG,KAAK,CAAC,SAAS,CA6GrC"}
@@ -1,2 +0,0 @@
1
- export declare function JsonImport(): import("react/jsx-runtime").JSX.Element;
2
- //# sourceMappingURL=JsonImport.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"JsonImport.d.ts","sourceRoot":"","sources":["../../../src/components/actions/JsonImport.tsx"],"names":[],"mappings":"AAMA,wBAAgB,UAAU,4CAiEzB"}
@@ -1,2 +0,0 @@
1
- export declare function Move(): import("react/jsx-runtime").JSX.Element;
2
- //# sourceMappingURL=Move.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Move.d.ts","sourceRoot":"","sources":["../../../src/components/actions/Move.tsx"],"names":[],"mappings":"AAMA,wBAAgB,IAAI,4CA4BnB"}
@@ -1,8 +0,0 @@
1
- import { FieldError } from 'react-hook-form';
2
- export interface InputWrapperProps {
3
- label?: string;
4
- error: FieldError | undefined;
5
- className?: string;
6
- }
7
- export declare function InputWrapper({ label, error, className, children, }: React.PropsWithChildren<InputWrapperProps>): import("react/jsx-runtime").JSX.Element;
8
- //# sourceMappingURL=InputWrapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InputWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/InputWrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAIlD,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,UAAU,GAAG,SAAS,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,KAAK,EACL,SAAS,EACT,QAAQ,GACT,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,2CAqB5C"}
@@ -1,20 +0,0 @@
1
- import { DefaultNodeTypes, TypedEditorState } from '@payloadcms/richtext-lexical';
2
- import { SerializedEditorState } from '@payloadcms/richtext-lexical/lexical';
3
- import { InputWrapperProps } from './InputWrapper';
4
- export interface LexicalInputProps extends InputWrapperProps {
5
- lang: string;
6
- value: string;
7
- onChange: (value: string) => void;
8
- onBlur: () => void;
9
- }
10
- export declare function LexicalInput({ error, label, value, onChange, className, }: LexicalInputProps): React.ReactNode;
11
- interface UseHtmlLexicalAdapterProps {
12
- html: string;
13
- onChange: (html: string) => void;
14
- }
15
- export declare function useHtmlLexicalAdapter({ html, onChange, }: UseHtmlLexicalAdapterProps): {
16
- value: TypedEditorState<DefaultNodeTypes>;
17
- setValue: (serializedState: SerializedEditorState) => void;
18
- };
19
- export {};
20
- //# sourceMappingURL=LexicalInput.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LexicalInput.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/LexicalInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAWtC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AASlF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGxD,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,KAAK,EACL,KAAK,EACL,QAAQ,EACR,SAAS,GACV,EAAE,iBAAiB,GAAG,KAAK,CAAC,SAAS,CAoBrC;AAID,UAAU,0BAA0B;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED,wBAAgB,qBAAqB,CAAC,EACpC,IAAI,EACJ,QAAQ,GACT,EAAE,0BAA0B;WAiEF,gBAAgB,CAAC,gBAAgB,CAAC;gCAjBvC,qBAAqB;EAkB1C"}
@@ -1,11 +0,0 @@
1
- import { TemplateVariable } from '../../types';
2
- import { InputWrapperProps } from './InputWrapper';
3
- export interface MessageInputProps extends InputWrapperProps {
4
- value: string;
5
- lang: string;
6
- variables: TemplateVariable[];
7
- onChange: (value: string) => void;
8
- onBlur: () => void;
9
- }
10
- export declare function MessageInput({ label, value, lang, error, variables, onChange, onBlur, className, }: MessageInputProps): import("react/jsx-runtime").JSX.Element;
11
- //# sourceMappingURL=MessageInput.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MessageInput.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/MessageInput.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAIhD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIxD,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAKD,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,KAAK,EACL,IAAI,EACJ,KAAK,EACL,SAAS,EACT,QAAQ,EACR,MAAM,EACN,SAAS,GACV,EAAE,iBAAiB,2CAkBnB"}
@@ -1,3 +0,0 @@
1
- import { ReactNodeViewProps } from '@tiptap/react';
2
- export declare function VariableChip({ node, updateAttributes, }: ReactNodeViewProps<HTMLElement>): import("react/jsx-runtime").JSX.Element;
3
- //# sourceMappingURL=VariableChip.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VariableChip.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/variables/VariableChip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AA0BxD,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,gBAAgB,GACjB,EAAE,kBAAkB,CAAC,WAAW,CAAC,2CAiEjC"}
@@ -1,7 +0,0 @@
1
- import { TYPE } from '@formatjs/icu-messageformat-parser';
2
- import { IconProps } from '@tabler/icons-react';
3
- export interface VariableIconProps extends Omit<IconProps, 'type'> {
4
- type: TYPE;
5
- }
6
- export declare function VariableIcon({ type, ...props }: VariableIconProps): import("react/jsx-runtime").JSX.Element | null;
7
- //# sourceMappingURL=VariableIcon.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VariableIcon.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/variables/VariableIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAUrD,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC;IAChE,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,kDAmBjE"}
@@ -1,9 +0,0 @@
1
- import { SuggestionKeyDownProps, SuggestionProps } from '@tiptap/suggestion';
2
- import { VariableMentionNodeAttrs } from '../../../types';
3
- export interface VariableSuggestionProps extends SuggestionProps<VariableMentionNodeAttrs, VariableMentionNodeAttrs> {
4
- ref: React.RefObject<{
5
- onKeyDown: (props: SuggestionKeyDownProps) => boolean;
6
- }>;
7
- }
8
- export declare function VariableSuggestion({ items, command, ref, }: VariableSuggestionProps): import("react/jsx-runtime").JSX.Element;
9
- //# sourceMappingURL=VariableSuggestion.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VariableSuggestion.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/variables/VariableSuggestion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAIxD,MAAM,WAAW,uBACf,SAAQ,eAAe,CAAC,wBAAwB,EAAE,wBAAwB,CAAC;IAC3E,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC;QACnB,SAAS,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,OAAO,CAAC;KACvD,CAAC,CAAC;CACJ;AAED,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,OAAO,EACP,GAAG,GACJ,EAAE,uBAAuB,2CAiEzB"}
@@ -1,10 +0,0 @@
1
- import { DateElement } from '../../../../types';
2
- export interface DateVariableEditorProps {
3
- name: string;
4
- element: DateElement | undefined;
5
- ref: React.Ref<{
6
- getValue: () => string;
7
- }>;
8
- }
9
- export declare function DateVariableEditor({ name, element, ref, }: DateVariableEditorProps): import("react/jsx-runtime").JSX.Element;
10
- //# sourceMappingURL=DateVariableEditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DateVariableEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/inputs/variables/editors/DateVariableEditor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,WAAW,GAAG,SAAS,CAAC;IACjC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;QAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;KAAE,CAAC,CAAC;CAC5C;AAED,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,OAAO,EACP,GAAG,GACJ,EAAE,uBAAuB,2CASzB"}
@@ -1,10 +0,0 @@
1
- import { PluralElement } from '../../../../types';
2
- export interface PluralVariableEditorProps {
3
- variableName: string;
4
- element: PluralElement | undefined;
5
- ref: React.Ref<{
6
- getValue: () => string;
7
- }>;
8
- }
9
- export declare function PluralVariableEditor({ variableName, element, ref, }: PluralVariableEditorProps): import("react/jsx-runtime").JSX.Element;
10
- //# sourceMappingURL=PluralVariableEditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PluralVariableEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/inputs/variables/editors/PluralVariableEditor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAO7C,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,aAAa,GAAG,SAAS,CAAC;IACnC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;QAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;KAAE,CAAC,CAAC;CAC5C;AAID,wBAAgB,oBAAoB,CAAC,EACnC,YAAY,EACZ,OAAO,EACP,GAAG,GACJ,EAAE,yBAAyB,2CA8K3B"}
@@ -1,7 +0,0 @@
1
- import { SelectElement } from '../../../../types';
2
- export interface SelectVariableEditorProps {
3
- element: SelectElement;
4
- onUpdate: (value: string) => void;
5
- }
6
- export declare function SelectVariableEditor({ element, onUpdate, }: SelectVariableEditorProps): import("react/jsx-runtime").JSX.Element;
7
- //# sourceMappingURL=SelectVariableEditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectVariableEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/inputs/variables/editors/SelectVariableEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAI7C,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,QAAQ,GACT,EAAE,yBAAyB,2CAwD3B"}
@@ -1,7 +0,0 @@
1
- import { TagElement } from '../../../../types';
2
- export interface TagVariableEditorProps {
3
- element: TagElement;
4
- onUpdate: (value: string) => void;
5
- }
6
- export declare function TagVariableEditor({ element, onUpdate, }: TagVariableEditorProps): import("react/jsx-runtime").JSX.Element;
7
- //# sourceMappingURL=TagVariableEditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TagVariableEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/inputs/variables/editors/TagVariableEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,UAAU,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,QAAQ,GACT,EAAE,sBAAsB,2CA+BxB"}
@@ -1,10 +0,0 @@
1
- import { TimeElement } from '../../../../types';
2
- export interface TimeElementEditorProps {
3
- name: string;
4
- element: TimeElement | undefined;
5
- ref: React.Ref<{
6
- getValue: () => string;
7
- }>;
8
- }
9
- export declare function TimeElementEditor({ name, element, ref, }: TimeElementEditorProps): import("react/jsx-runtime").JSX.Element;
10
- //# sourceMappingURL=TimeVariableEditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TimeVariableEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/inputs/variables/editors/TimeVariableEditor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,WAAW,GAAG,SAAS,CAAC;IACjC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;QAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;KAAE,CAAC,CAAC;CAC5C;AAED,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,OAAO,EACP,GAAG,GACJ,EAAE,sBAAsB,2CASxB"}
@@ -1,4 +0,0 @@
1
- import { MentionOptions } from '@tiptap/extension-mention';
2
- import { TemplateVariable, VariableMentionNodeAttrs } from '../../../types';
3
- export declare function VariableMention(variables: TemplateVariable[]): import('@tiptap/core').Node<MentionOptions<VariableMentionNodeAttrs, VariableMentionNodeAttrs>, any>;
4
- //# sourceMappingURL=extension.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/variables/extension.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAShE,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAS1E,wBAAgB,eAAe,CAAC,SAAS,EAAE,gBAAgB,EAAE,wGA6B5D"}
@@ -1,7 +0,0 @@
1
- import { NumberElement, PluralElement } from '../../../../types';
2
- export interface NumericVariablePickerProps {
3
- element: NumberElement | PluralElement;
4
- onUpdate: (value: string) => void;
5
- }
6
- export declare function NumericVariablePicker({ element, onUpdate, }: NumericVariablePickerProps): import("react/jsx-runtime").JSX.Element;
7
- //# sourceMappingURL=NumericVariablePicker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NumericVariablePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/inputs/variables/pickers/NumericVariablePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAc5D,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,aAAa,GAAG,aAAa,CAAC;IACvC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,wBAAgB,qBAAqB,CAAC,EACpC,OAAO,EACP,QAAQ,GACT,EAAE,0BAA0B,2CA8C5B"}
@@ -1,7 +0,0 @@
1
- import { DateElement, TimeElement } from '../../../../types';
2
- export interface TemporalElementEditorProps {
3
- element: DateElement | TimeElement;
4
- onUpdate: (value: string) => void;
5
- }
6
- export declare function TemporalElementEditor({ element, onUpdate, }: TemporalElementEditorProps): import("react/jsx-runtime").JSX.Element;
7
- //# sourceMappingURL=TemporalElementEditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TemporalElementEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/inputs/variables/pickers/TemporalElementEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAWxD,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,WAAW,GAAG,WAAW,CAAC;IACnC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,wBAAgB,qBAAqB,CAAC,EACpC,OAAO,EACP,QAAQ,GACT,EAAE,0BAA0B,2CAqD5B"}
@@ -1,10 +0,0 @@
1
- import { MessageSchema } from '../../types';
2
- interface MessageFieldProps {
3
- schema: MessageSchema;
4
- messageKey: string;
5
- path: string;
6
- className?: string;
7
- }
8
- export declare function MessageField({ schema, messageKey, path, className, }: MessageFieldProps): React.ReactNode;
9
- export {};
10
- //# sourceMappingURL=MessageField.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MessageField.d.ts","sourceRoot":"","sources":["../../../src/components/layout/MessageField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAO7C,UAAU,iBAAiB;IACzB,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,UAAU,EACV,IAAI,EACJ,SAAS,GACV,EAAE,iBAAiB,GAAG,KAAK,CAAC,SAAS,CA8CrC"}
@@ -1,9 +0,0 @@
1
- import { MessagesSchema } from '../../types';
2
- interface MessagesTabsProps {
3
- schema: MessagesSchema;
4
- activeTab: string | undefined;
5
- setActiveTab: (tab: string) => void;
6
- }
7
- export declare function MessagesTabs({ schema, activeTab, setActiveTab, }: MessagesTabsProps): React.ReactNode;
8
- export {};
9
- //# sourceMappingURL=MessagesTabs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MessagesTabs.d.ts","sourceRoot":"","sources":["../../../src/components/layout/MessagesTabs.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI9C,UAAU,iBAAiB;IACzB,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAGD,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,SAAS,EACT,YAAY,GACb,EAAE,iBAAiB,GAAG,KAAK,CAAC,SAAS,CAqCrC"}
@@ -1,10 +0,0 @@
1
- import { Messages } from '../../types';
2
- interface MessagesTreeProps {
3
- path: string;
4
- nestingLevel: number;
5
- schema: Messages;
6
- className?: string;
7
- }
8
- export declare function MessagesTree({ path, schema, nestingLevel, className, }: MessagesTreeProps): React.ReactNode;
9
- export {};
10
- //# sourceMappingURL=MessagesTree.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MessagesTree.d.ts","sourceRoot":"","sources":["../../../src/components/layout/MessagesTree.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAMxC,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,QAAQ,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,MAAM,EACN,YAAgB,EAChB,SAAS,GACV,EAAE,iBAAiB,GAAG,KAAK,CAAC,SAAS,CAyDrC"}
@@ -1,29 +0,0 @@
1
- import { UseFormReturn } from 'react-hook-form';
2
- import { Locales, Messages, Translations } from '../types';
3
- export type FormValues = Translations<Messages>;
4
- interface MessagesFormProviderProps {
5
- locales: Locales;
6
- form: UseFormReturn<FormValues>;
7
- }
8
- export declare function MessagesFormProvider({ locales, form, children, }: React.PropsWithChildren<MessagesFormProviderProps>): import("react/jsx-runtime").JSX.Element;
9
- export declare const useMessagesForm: () => {
10
- watch: import('react-hook-form').UseFormWatch<FormValues>;
11
- getValues: import('react-hook-form').UseFormGetValues<FormValues>;
12
- getFieldState: import('react-hook-form').UseFormGetFieldState<FormValues>;
13
- setError: import('react-hook-form').UseFormSetError<FormValues>;
14
- clearErrors: import('react-hook-form').UseFormClearErrors<FormValues>;
15
- setValue: import('react-hook-form').UseFormSetValue<FormValues>;
16
- trigger: import('react-hook-form').UseFormTrigger<FormValues>;
17
- formState: import('react-hook-form').FormState<FormValues>;
18
- resetField: import('react-hook-form').UseFormResetField<FormValues>;
19
- reset: import('react-hook-form').UseFormReset<FormValues>;
20
- handleSubmit: import('react-hook-form').UseFormHandleSubmit<FormValues, FormValues>;
21
- unregister: import('react-hook-form').UseFormUnregister<FormValues>;
22
- control: import('react-hook-form').Control<FormValues, any, FormValues>;
23
- register: import('react-hook-form').UseFormRegister<FormValues>;
24
- setFocus: import('react-hook-form').UseFormSetFocus<FormValues>;
25
- subscribe: import('react-hook-form').UseFormSubscribe<FormValues>;
26
- locales: Locales;
27
- };
28
- export {};
29
- //# sourceMappingURL=messages-form.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"messages-form.d.ts","sourceRoot":"","sources":["../../src/context/messages-form.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE/D,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;AAQhD,UAAU,yBAAyB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;CACjC;AAED,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,IAAI,EACJ,QAAQ,GACT,EAAE,KAAK,CAAC,iBAAiB,CAAC,yBAAyB,CAAC,2CAMpD;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;aAtBjB,OAAO;CA6BjB,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Endpoint } from 'payload';
2
- export declare const getMessagesEndpoint: Endpoint;
3
- //# sourceMappingURL=get-messages.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-messages.d.ts","sourceRoot":"","sources":["../../src/endpoints/get-messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAkB,MAAM,SAAS,CAAC;AAIxD,eAAO,MAAM,mBAAmB,EAAE,QAQjC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Endpoint } from 'payload';
2
- export declare const setMessagesEndpoint: Endpoint;
3
- //# sourceMappingURL=set-messages.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"set-messages.d.ts","sourceRoot":"","sources":["../../src/endpoints/set-messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAwB,MAAM,SAAS,CAAC;AAK9D,eAAO,MAAM,mBAAmB,EAAE,QAuDjC,CAAC"}
@@ -1,8 +0,0 @@
1
- import { PayloadRequest } from 'payload';
2
- import { MessagesGuard } from '../types';
3
- export interface MessagesLinkProps {
4
- access?: MessagesGuard;
5
- req: PayloadRequest;
6
- }
7
- export declare function MessagesLink({ access, req, }: MessagesLinkProps): Promise<import("react/jsx-runtime").JSX.Element | null>;
8
- //# sourceMappingURL=link.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/exports/link.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,GAAG,EAAE,cAAc,CAAC;CACrB;AAED,wBAAsB,YAAY,CAAC,EACjC,MAAmB,EACnB,GAAG,GACJ,EAAE,iBAAiB,2DAanB"}
@@ -1,3 +0,0 @@
1
- export { MessagesLink } from './link';
2
- export { MessagesView } from './view';
3
- //# sourceMappingURL=rsc.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rsc.d.ts","sourceRoot":"","sources":["../../src/exports/rsc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC"}
@@ -1,10 +0,0 @@
1
- import { AdminViewServerProps } from 'payload';
2
- import { Locales, Messages, MessagesGuard } from '../types';
3
- export interface MessagesViewProps {
4
- locales: Locales;
5
- schema: Messages;
6
- tabs: boolean | undefined;
7
- access: MessagesGuard;
8
- }
9
- export declare function MessagesView({ access, initPageResult, locales, params, payload, schema, searchParams, tabs, }: AdminViewServerProps & MessagesViewProps): Promise<import("react/jsx-runtime").JSX.Element>;
10
- //# sourceMappingURL=view.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/exports/view.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,EAEV,OAAO,EACP,QAAQ,EACR,aAAa,EAEd,MAAM,SAAS,CAAC;AAOjB,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,QAAQ,CAAC;IACjB,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,wBAAsB,YAAY,CAAC,EACjC,MAAM,EACN,cAAc,EACd,OAAO,EACP,MAAM,EACN,OAAO,EACP,MAAM,EACN,YAAY,EACZ,IAAY,GACb,EAAE,oBAAoB,GAAG,iBAAiB,oDA6C1C"}
package/dist/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { Plugin } from 'payload';
2
- import { MessagesPluginConfig } from './types.ts';
3
- export declare const intlPlugin: ({ schema, tabs, collectionSlug, hooks, editorAccess, }: MessagesPluginConfig) => Plugin;
4
- export { fetchMessages } from './requests/fetchMessages';
5
- export type { Messages, MessagesPluginConfig, MessagesSchema, } from './types.ts';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB,OAAO,KAAK,EAGV,MAAM,EACP,MAAM,SAAS,CAAC;AAIjB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGvD,eAAO,MAAM,UAAU,2DAOlB,oBAAoB,KAAG,MAwFzB,CAAC;AAEJ,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,YAAY,EACV,QAAQ,EACR,oBAAoB,EACpB,cAAc,GACf,MAAM,YAAY,CAAC"}
@@ -1,4 +0,0 @@
1
- import { BasePayload } from 'payload';
2
- import { Messages } from '../types';
3
- export declare function fetchMessages(payload: BasePayload, locale: string): Promise<Messages>;
4
- //# sourceMappingURL=fetchMessages.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetchMessages.d.ts","sourceRoot":"","sources":["../../src/requests/fetchMessages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAK3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,wBAAsB,aAAa,CACjC,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,QAAQ,CAAC,CAqCnB"}
package/dist/types.d.ts DELETED
@@ -1,41 +0,0 @@
1
- import { LiteralElement, MessageFormatElement, PoundElement } from '@formatjs/icu-messageformat-parser';
2
- import { CollectionConfig, PayloadRequest } from 'payload';
3
- import { DeepPartial } from 'react-hook-form';
4
- export interface MessagesPluginConfig {
5
- schema: MessagesSchema;
6
- /**
7
- * The slug of the collection to use for the messages.
8
- *
9
- * @default `messages`
10
- */
11
- collectionSlug?: string;
12
- /**
13
- * Access control for allowing to edit the messages.
14
- *
15
- * @default `(req) => req.user !== null // Authenticated users only`
16
- */
17
- editorAccess?: MessagesGuard;
18
- hooks?: MessagesHooks;
19
- tabs?: boolean;
20
- }
21
- export type MessagesHooks = {
22
- afterUpdate?: () => Promise<void> | void;
23
- } & CollectionConfig['hooks'];
24
- export type MessagesGuard = (req: PayloadRequest) => boolean | Promise<boolean>;
25
- type Locale = string;
26
- export type Locales = [Locale, ...Locale[]];
27
- export type Translations<T> = Record<Locale, T>;
28
- export type Messages<T = string> = {
29
- [key: string]: Messages<T> | T;
30
- };
31
- export type MessageSchema = (string & {}) | '$RICH$';
32
- export type MessagesSchema = Messages<MessageSchema>;
33
- export interface VariableMentionNodeAttrs {
34
- name: string;
35
- label: string;
36
- icu: string;
37
- }
38
- export type { DeepPartial };
39
- export type TemplateVariable = Exclude<MessageFormatElement, LiteralElement | PoundElement>;
40
- export type { ArgumentElement, DateElement, LiteralElement, NumberElement, PluralElement, SelectElement, TagElement, TimeElement, } from '@formatjs/icu-messageformat-parser';
41
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,YAAY,EACb,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,cAAc,CAAC;IACvB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC1C,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAE9B,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,cAAc,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAIhF,KAAK,MAAM,GAAG,MAAM,CAAC;AACrB,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;AAE5C,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAEhD,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,MAAM,IAAI;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC;AACrD,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;AAErD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,MAAM,MAAM,gBAAgB,GAAG,OAAO,CACpC,oBAAoB,EACpB,cAAc,GAAG,YAAY,CAC9B,CAAC;AAEF,YAAY,EACV,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,GACZ,MAAM,oCAAoC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { ClassValue } from 'clsx';
2
- export declare function cn(...inputs: ClassValue[]): string;
3
- //# sourceMappingURL=cn.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/utils/cn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvC,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
@@ -1,12 +0,0 @@
1
- import { Config, LocalizationConfig, SanitizedConfig } from 'payload';
2
- import { z } from 'zod/v4-mini';
3
- import { Locales } from '../types';
4
- export declare const getSupportedLocales: (localization: false | LocalizationConfig | undefined) => Locales;
5
- declare const pluginContextSchema: z.ZodMiniObject<{
6
- collectionSlug: z.ZodMiniString<string>;
7
- }, z.core.$strip>;
8
- type PluginContext = z.infer<typeof pluginContextSchema>;
9
- export declare const attachPluginContext: (config: Config, context: PluginContext) => void;
10
- export declare const getPluginContext: (config: SanitizedConfig) => PluginContext;
11
- export {};
12
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,eAAO,MAAM,mBAAmB,iBAChB,KAAK,GAAG,kBAAkB,GAAG,SAAS,KACnD,OAeF,CAAC;AAGF,QAAA,MAAM,mBAAmB;;iBAEvB,CAAC;AACH,KAAK,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEzD,eAAO,MAAM,mBAAmB,WAAY,MAAM,WAAW,aAAa,SAGzE,CAAC;AAEF,eAAO,MAAM,gBAAgB,WAAY,eAAe,KAAG,aACH,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function getErrorMessage(response: Response): Promise<string>;
2
- //# sourceMappingURL=error-handling.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../src/utils/error-handling.ts"],"names":[],"mappings":"AAEA,wBAAsB,eAAe,CAAC,QAAQ,EAAE,QAAQ,mBAUvD"}
@@ -1,4 +0,0 @@
1
- import { TemplateVariable } from '../types';
2
- export declare const toWords: (inputString: string, joinWords?: boolean) => string;
3
- export declare const formatVariableLabel: (variable: TemplateVariable) => string;
4
- //# sourceMappingURL=format.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAIhD,eAAO,MAAM,OAAO,gBAAiB,MAAM,0BAAsB,MAkBhE,CAAC;AAEF,eAAO,MAAM,mBAAmB,aAAc,gBAAgB,WAK7D,CAAC"}
@@ -1,6 +0,0 @@
1
- import { DateElement, MessageFormatElement, NumberElement, PluralElement, TimeElement, isArgumentElement, isDateElement, isLiteralElement, isNumberElement, isPluralElement, isSelectElement, isTagElement, isTimeElement } from '@formatjs/icu-messageformat-parser';
2
- export declare const isNumericElement: (element: MessageFormatElement) => element is NumberElement | PluralElement;
3
- export declare const isTemporalElement: (element: MessageFormatElement) => element is DateElement | TimeElement;
4
- export { isLiteralElement, isArgumentElement, isNumberElement, isSelectElement, isPluralElement, isDateElement, isTimeElement, isTagElement, };
5
- export declare const uncaughtSwitchCase: (value: never) => never;
6
- //# sourceMappingURL=guards.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/utils/guards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,WAAW,EACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,eAAe,EACf,YAAY,EACZ,aAAa,EACd,MAAM,oCAAoC,CAAC;AAE5C,eAAO,MAAM,gBAAgB,YAClB,oBAAoB,KAC5B,OAAO,IAAI,aAAa,GAAG,aACwB,CAAC;AAEvD,eAAO,MAAM,iBAAiB,YACnB,oBAAoB,KAC5B,OAAO,IAAI,WAAW,GAAG,WACsB,CAAC;AAEnD,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,eAAe,EACf,aAAa,EACb,aAAa,EACb,YAAY,GACb,CAAC;AAEF,eAAO,MAAM,kBAAkB,UAAW,KAAK,UAE9C,CAAC"}
@@ -1,31 +0,0 @@
1
- import { MessageFormatElement } from '@formatjs/icu-messageformat-parser';
2
- import { VariableMentionNodeAttrs } from '../types';
3
- /**
4
- * Parse an ICU message string into a AST array
5
- */
6
- export declare const parseICUMessage: (message: string) => MessageFormatElement[];
7
- /**
8
- * Serialize an ICU message AST array into a ICU message string
9
- */
10
- export declare const serializeICUMessage: (elements: MessageFormatElement[]) => string;
11
- type TextContent = {
12
- type: 'text';
13
- text: string;
14
- };
15
- type VariableContent = {
16
- type: 'variable';
17
- attrs: VariableMentionNodeAttrs;
18
- };
19
- type ProseMirrorJSONRepresentation = {
20
- type: 'doc';
21
- content: {
22
- type: 'paragraph';
23
- content: (TextContent | VariableContent)[];
24
- }[];
25
- };
26
- /**
27
- * Parse an ICU message string into a ProseMirror JSON representation
28
- */
29
- export declare const parseIcuToProseMirrorJSON: (icuMessage: string) => ProseMirrorJSONRepresentation;
30
- export {};
31
- //# sourceMappingURL=icu-tranform.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"icu-tranform.d.ts","sourceRoot":"","sources":["../../src/utils/icu-tranform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE/E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAKxD;;GAEG;AACH,eAAO,MAAM,eAAe,YAAa,MAAM,KAAG,oBAAoB,EACtD,CAAC;AAEjB;;GAEG;AACH,eAAO,MAAM,mBAAmB,aAAc,oBAAoB,EAAE,KAAG,MA8C1D,CAAC;AAkBd,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,wBAAwB,CAAC;CACjC,CAAC;AAEF,KAAK,6BAA6B,GAAG;IACnC,IAAI,EAAE,KAAK,CAAC;IACZ,OAAO,EAAE;QACP,IAAI,EAAE,WAAW,CAAC;QAClB,OAAO,EAAE,CAAC,WAAW,GAAG,eAAe,CAAC,EAAE,CAAC;KAC5C,EAAE,CAAC;CACL,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,eACxB,MAAM,KACjB,6BAoEF,CAAC"}
@@ -1,16 +0,0 @@
1
- import { DeepPartial, Messages } from '../types';
2
- /**
3
- * Sanitize messages data to match the schema.
4
- * Stored messages might contain keys that are not in the config.
5
- * This happens when messages in the config were (re)moved.
6
- *
7
- * Keep exactly the keys from `shape`, fill values from `source` when present.
8
- * - Leaf present as string -> included
9
- * - Leaf missing/non-string -> omitted
10
- * - Empty nested groups -> omitted
11
- */
12
- /**
13
-
14
- */
15
- export declare function sanitizeMessages(config: Messages, data: unknown): DeepPartial<Messages>;
16
- //# sourceMappingURL=sanitize.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../src/utils/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAErD;;;;;;;;;GASG;AAEH;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,QAAQ,EAChB,IAAI,EAAE,OAAO,GACZ,WAAW,CAAC,QAAQ,CAAC,CAwBvB"}
@@ -1,10 +0,0 @@
1
- import { MessageSchema, TemplateVariable } from '../types';
2
- export declare const parseMessageSchema: (schema: MessageSchema) => MessageConfig;
3
- export declare const extractTemplateVariables: (schema: MessageSchema) => TemplateVariable[];
4
- export type MessageType = 'icu';
5
- export type MessageConfig = {
6
- description: string | undefined;
7
- type: MessageType;
8
- variables: TemplateVariable[];
9
- };
10
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/utils/schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE/D,eAAO,MAAM,kBAAkB,WAAY,aAAa,KAAG,aAY1D,CAAC;AAEF,eAAO,MAAM,wBAAwB,WAC3B,aAAa,KACpB,gBAAgB,EAA6C,CAAC;AAgCjE,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC;AAChC,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,gBAAgB,EAAE,CAAC;CAC/B,CAAC"}
@@ -1,6 +0,0 @@
1
- import { ValidateResult } from 'react-hook-form';
2
- import { TemplateVariable } from '../types';
3
- export declare const validateMessage: (value: unknown, variables: TemplateVariable[]) => ValidateResult;
4
- export declare const createValidator: (variables: TemplateVariable[]) => MessageValidator;
5
- export type MessageValidator = (value: unknown) => ValidateResult;
6
- //# sourceMappingURL=validate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/utils/validate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAKhD,eAAO,MAAM,eAAe,UACnB,OAAO,aACH,gBAAgB,EAAE,KAC5B,cA6DF,CAAC;AAEF,eAAO,MAAM,eAAe,cACd,gBAAgB,EAAE,KAAG,gBAEE,CAAC;AAEtC,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,cAAc,CAAC"}