@websolutespa/payload-plugin-bowl 1.10.1 → 1.10.3

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,19 @@
1
1
  # @websolutespa/payload-plugin-bowl
2
2
 
3
+ ## 1.10.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Added: IApp global
8
+ - Updated dependencies
9
+ - @websolutespa/bom-core@1.8.24
10
+
11
+ ## 1.10.2
12
+
13
+ ### Patch Changes
14
+
15
+ - Added: Redirects example csv
16
+
3
17
  ## 1.10.1
4
18
 
5
19
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -213,9 +213,10 @@ type IImportItem = Record<string, string | number | boolean | Date>;
213
213
 
214
214
  type ImportExportListProps<T = any> = Props$2 & {
215
215
  parser?: (items: IImportItem[]) => T[];
216
+ exampleCSV?: string;
216
217
  };
217
218
  declare const ImportExportList: React__default.FC<ImportExportListProps>;
218
- declare function importExportListWithParser<T>(parser: (items: IImportItem[]) => T[]): React__default.FC<Props$2>;
219
+ declare function importExportListWithParser<T>(parser: (items: IImportItem[]) => T[], exampleCSV?: string): React__default.FC<Props$2>;
219
220
 
220
221
  declare const redirectParser: (items: IImportItem[]) => any[];
221
222
  declare const ImportExportRedirectList: React__default.FC<ImportExportListProps>;
@@ -1264,6 +1265,7 @@ type BowlSlug = {
1264
1265
  label: string;
1265
1266
  locale: string;
1266
1267
  market: string;
1268
+ app: string;
1267
1269
  menu: string;
1268
1270
  redirect: string;
1269
1271
  template: string;
package/dist/index.js CHANGED
@@ -865,6 +865,7 @@ var translations = {
865
865
  }
866
866
  },
867
867
  global: {
868
+ app: "App",
868
869
  locale: "Locales"
869
870
  },
870
871
  field: {
@@ -875,8 +876,11 @@ var translations = {
875
876
  alpha3Code: "Alpha3 Code",
876
877
  alt: "Alt",
877
878
  appearance: "Appearance",
879
+ appName: "App Name",
878
880
  bcc: "BCC",
879
881
  blocks: "Blocks",
882
+ brand: "Brand",
883
+ businessName: "Business Name",
880
884
  category_index: "Index of Category",
881
885
  category: "Category",
882
886
  cc: "CC",
@@ -893,6 +897,7 @@ var translations = {
893
897
  continent: "Continent",
894
898
  countries: "Countries",
895
899
  country: "Country",
900
+ countryCode: "Country Code",
896
901
  countryZone: "Country Zone",
897
902
  customClass: "Custom Class",
898
903
  date: "Date",
@@ -922,6 +927,7 @@ var translations = {
922
927
  lat: "Latitude",
923
928
  legalNotice: "Legal Notice",
924
929
  link: "Link",
930
+ logo: "Logo",
925
931
  lng: "Longitude",
926
932
  marketingEmail: "Marketing Email",
927
933
  markets: "Markets",
@@ -939,22 +945,26 @@ var translations = {
939
945
  position: "Position",
940
946
  price: "Price",
941
947
  province: "Province",
948
+ provinceCode: "Province Code",
942
949
  reference: "Reference",
943
950
  region: "Region",
944
951
  revoked: "Revoked",
945
952
  revokedDate: "Revoked date",
946
953
  roles: "Roles",
947
954
  slug: "Slug",
955
+ social: "Social",
948
956
  status: "Status",
949
957
  streetNumber: "Street Number",
950
958
  subContinent: "Subcontinent",
951
959
  subject: "Subject",
952
960
  target: "Target",
961
+ telephone: "Telephone",
953
962
  template: "Template",
954
963
  tenants: "Tenants",
955
964
  text: "Text",
956
965
  title: "Title",
957
966
  to: "To",
967
+ twitterName: "Twitter",
958
968
  type: "Type",
959
969
  url: "Url",
960
970
  useSplat: "Use Splat",
@@ -968,6 +978,7 @@ var translations = {
968
978
  importExport: {
969
979
  importCSV: "Import CSV",
970
980
  exportCSV: "Export CSV",
981
+ exampleCSV: "Example CSV",
971
982
  modalTitle: "Import records",
972
983
  dropTitle: "Drop the files here ...",
973
984
  dropAbstract: "drop here a *.csv file, or click to select one",
@@ -1088,6 +1099,7 @@ var translations = {
1088
1099
  }
1089
1100
  },
1090
1101
  global: {
1102
+ app: "App",
1091
1103
  locale: "Localizzazioni"
1092
1104
  },
1093
1105
  field: {
@@ -1098,8 +1110,11 @@ var translations = {
1098
1110
  alpha3Code: "Codice Alpha3",
1099
1111
  alt: "Testo Alternativo",
1100
1112
  appearance: "Aspetto",
1113
+ appName: "Nome dell'applicazione",
1101
1114
  bcc: "CCN",
1102
1115
  blocks: "Blocchi",
1116
+ brand: "Brand",
1117
+ businessName: "Societ\xE0",
1103
1118
  category_index: "Indice di Categoria",
1104
1119
  category: "Categoria",
1105
1120
  cc: "CC",
@@ -1116,6 +1131,7 @@ var translations = {
1116
1131
  continent: "Continente",
1117
1132
  countries: "Nazioni",
1118
1133
  country: "Nazione",
1134
+ countryCode: "Codice Nazione",
1119
1135
  countryZone: "Area Nazionale",
1120
1136
  customClass: "Classe Custom",
1121
1137
  date: "Data",
@@ -1143,6 +1159,7 @@ var translations = {
1143
1159
  lat: "Latitudine",
1144
1160
  legalNotice: "Informativa Legale",
1145
1161
  link: "Link",
1162
+ logo: "Logo",
1146
1163
  lng: "Longitudine",
1147
1164
  marketingEmail: "Email marketing",
1148
1165
  markets: "Mercati",
@@ -1160,22 +1177,26 @@ var translations = {
1160
1177
  position: "Posizione",
1161
1178
  price: "Prezzo",
1162
1179
  province: "Provincia",
1180
+ provinceCode: "Codice Provincia",
1163
1181
  reference: "Riferimento",
1164
1182
  region: "Regione",
1165
1183
  revoked: "Revocato",
1166
1184
  revokedDate: "Data di Revoca",
1167
1185
  roles: "Ruoli",
1168
1186
  slug: "Slug",
1187
+ social: "Social",
1169
1188
  status: "Stato",
1170
1189
  streetNumber: "Numero civico",
1171
1190
  subContinent: "Subcontinente",
1172
1191
  subject: "Oggetto",
1173
1192
  target: "Target",
1193
+ telephone: "Telephone",
1174
1194
  template: "Template",
1175
1195
  tenants: "Tenants",
1176
1196
  text: "Testo",
1177
1197
  title: "Titolo",
1178
1198
  to: "A",
1199
+ twitterName: "Twitter",
1179
1200
  type: "Tipo",
1180
1201
  url: "Url",
1181
1202
  useSplat: "Utilizza Splat",
@@ -1189,6 +1210,7 @@ var translations = {
1189
1210
  importExport: {
1190
1211
  importCSV: "Importa CSV",
1191
1212
  exportCSV: "Esporta CSV",
1213
+ exampleCSV: "Esempio CSV",
1192
1214
  modalTitle: "Importazione",
1193
1215
  dropTitle: "Trascina un file qui...",
1194
1216
  dropAbstract: "trascina qui un file *.csv, o clicca per selezionare",
@@ -1232,6 +1254,7 @@ var rolesEndUser = [roles.User, roles.Guest];
1232
1254
  var defaultSlug = {
1233
1255
  // core
1234
1256
  address: "address",
1257
+ app: "app",
1235
1258
  category: "category",
1236
1259
  emailConfig: "email_config",
1237
1260
  label: "label",
@@ -3599,6 +3622,7 @@ var import_jsx_runtime8 = require("react/jsx-runtime");
3599
3622
  var baseClass3 = "import-export-list";
3600
3623
  var ImportExportList = /* @__PURE__ */ __name(({
3601
3624
  parser,
3625
+ exampleCSV = "",
3602
3626
  ...props
3603
3627
  }) => {
3604
3628
  const { t } = (0, import_react_i18next5.useTranslation)("importExport");
@@ -3609,6 +3633,16 @@ var ImportExportList = /* @__PURE__ */ __name(({
3609
3633
  const { openModal, isModalOpen } = (0, import_modal5.useModal)();
3610
3634
  const modalKey = `${slug}-import-modal`;
3611
3635
  const isModalOpened = isModalOpen(modalKey);
3636
+ const downloadExampleCSV = /* @__PURE__ */ __name(() => {
3637
+ const element = document.createElement("a");
3638
+ element.style.position = "absolute";
3639
+ const file = new Blob([exampleCSV], { type: "text/plain" });
3640
+ element.href = URL.createObjectURL(file);
3641
+ element.download = "example.csv";
3642
+ document.body.appendChild(element);
3643
+ element.click();
3644
+ element.remove();
3645
+ }, "downloadExampleCSV");
3612
3646
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3613
3647
  DecoratedList,
3614
3648
  {
@@ -3616,18 +3650,19 @@ var ImportExportList = /* @__PURE__ */ __name(({
3616
3650
  after: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
3617
3651
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "gutter--left gutter--right import-export-list__actions", children: [
3618
3652
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_components6.Button, { className: "pill pill--style-light pill--has-link pill--has-action", onClick: () => openModal(modalKey), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: t("importExport:importCSV") }) }),
3619
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("a", { className: "pill pill--style-light pill--has-link pill--has-action", href: exportUrl, download: `${slug}.csv`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: t("importExport:exportCSV") }) })
3653
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("a", { className: "pill pill--style-light pill--has-link pill--has-action", href: exportUrl, download: `${slug}.csv`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: t("importExport:exportCSV") }) }),
3654
+ exampleCSV && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_components6.Button, { className: "pill pill--style-light pill--has-link pill--has-action", onClick: () => downloadExampleCSV(), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: t("importExport:exampleCSV") }) })
3620
3655
  ] }),
3621
3656
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_modal5.Modal, { slug: modalKey, className: `${baseClass3}__modal`, children: isModalOpened && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ImportModal, { parser, props }) })
3622
3657
  ] })
3623
3658
  }
3624
3659
  );
3625
3660
  }, "ImportExportList");
3626
- function importExportListWithParser(parser) {
3661
+ function importExportListWithParser(parser, exampleCSV) {
3627
3662
  const WithParserImportExportList = /* @__PURE__ */ __name(({
3628
3663
  ...props
3629
3664
  }) => {
3630
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ImportExportList, { parser, ...props });
3665
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ImportExportList, { parser, exampleCSV, ...props });
3631
3666
  }, "WithParserImportExportList");
3632
3667
  WithParserImportExportList.displayName = "WithParserImportExportList(ImportExportList)";
3633
3668
  return WithParserImportExportList;
@@ -4881,6 +4916,11 @@ async function getStore_(req) {
4881
4916
  store[slug] = [];
4882
4917
  }
4883
4918
  }
4919
+ const app = await findGlobal(subRequest, "app");
4920
+ store.app = [{
4921
+ id: "app",
4922
+ ...app
4923
+ }];
4884
4924
  try {
4885
4925
  const localeCollection = await fetchCollection_(subRequest, "locale", { richText: false });
4886
4926
  store.locale = localeCollection.docs;
@@ -5244,6 +5284,7 @@ var encryptData = /* @__PURE__ */ __name((collectionConfig) => {
5244
5284
  }, "encryptData");
5245
5285
 
5246
5286
  // src/core/translations/translations.ts
5287
+ var import_bom_core10 = require("@websolutespa/bom-core");
5247
5288
  var missingTranslations = [];
5248
5289
  var locales = options.locales.map((x) => typeof x === "string" ? x : x.code);
5249
5290
  function getTranslation4(path3, defaultText, locale, node, fullPath) {
@@ -5255,10 +5296,14 @@ function getTranslation4(path3, defaultText, locale, node, fullPath) {
5255
5296
  path3 = paths.join(".");
5256
5297
  return getTranslation4(path3, defaultText, locale, node[key] || {}, fullPath);
5257
5298
  }
5258
- if (!node[path3] && missingTranslations.indexOf(fullPath) === -1) {
5259
- missingTranslations.push(fullPath);
5299
+ if (node[path3]) {
5300
+ return node[path3] || defaultText || "";
5301
+ } else {
5302
+ if (missingTranslations.indexOf(fullPath) === -1) {
5303
+ missingTranslations.push(fullPath);
5304
+ }
5305
+ return (0, import_bom_core10.toCharCase)(fullPath.split(".").pop(), " ");
5260
5306
  }
5261
- return node[path3] || defaultText || "";
5262
5307
  }
5263
5308
  __name(getTranslation4, "getTranslation");
5264
5309
  function getTranslations(path3, defaultText) {
@@ -5382,7 +5427,7 @@ function logMissingTranslations() {
5382
5427
  __name(logMissingTranslations, "logMissingTranslations");
5383
5428
 
5384
5429
  // src/core/utils/getPreviewURL.ts
5385
- var import_bom_core10 = require("@websolutespa/bom-core");
5430
+ var import_bom_core11 = require("@websolutespa/bom-core");
5386
5431
  function getPreviewPublicURL(qs2) {
5387
5432
  const PREVIEW_URL = process.env.PAYLOAD_PUBLIC_PREVIEW_URL || "https://localhost:3000";
5388
5433
  const queryString2 = Object.keys(qs2).map((x) => `${x}=${qs2[x]}`).join("&");
@@ -5393,9 +5438,9 @@ __name(getPreviewPublicURL, "getPreviewPublicURL");
5393
5438
  function getPreviewURL(doc, locale, _token) {
5394
5439
  const localeId = locale;
5395
5440
  const markets = doc.markets || [];
5396
- const market = markets.find((x) => x.defaultLanguage === localeId || (x.languages || []).findIndex((language) => (0, import_bom_core10.asEntityId)(language) === localeId) !== -1) || markets[0];
5441
+ const market = markets.find((x) => x.defaultLanguage === localeId || (x.languages || []).findIndex((language) => (0, import_bom_core11.asEntityId)(language) === localeId) !== -1) || markets[0];
5397
5442
  const marketId = market ? market.id : options.defaultMarket;
5398
- const templateId = (0, import_bom_core10.asEquatable)(doc.template) || doc.slug;
5443
+ const templateId = (0, import_bom_core11.asEquatable)(doc.template) || doc.slug;
5399
5444
  const _status = doc._status;
5400
5445
  const documentId = doc.id;
5401
5446
  return getPreviewPublicURL({ marketId, localeId, templateId, documentId, _status, _token });
@@ -7157,7 +7202,7 @@ var withMenu = /* @__PURE__ */ __name((config) => {
7157
7202
  }, "withMenu");
7158
7203
 
7159
7204
  // src/core/collections/withPage.ts
7160
- var import_bom_core11 = require("@websolutespa/bom-core");
7205
+ var import_bom_core12 = require("@websolutespa/bom-core");
7161
7206
  var import_payload_utils46 = require("@websolutespa/payload-utils");
7162
7207
  var PageDefault = {
7163
7208
  access: {
@@ -7184,7 +7229,7 @@ var PageDefault = {
7184
7229
  };
7185
7230
  var withPage = /* @__PURE__ */ __name((config) => {
7186
7231
  const pageConfig = (0, import_payload_utils46.deepMerge)(PageDefault, config);
7187
- if (!config.access?.read && (0, import_bom_core11.isObject)(pageConfig.versions) && pageConfig.versions.drafts) {
7232
+ if (!config.access?.read && (0, import_bom_core12.isObject)(pageConfig.versions) && pageConfig.versions.drafts) {
7188
7233
  pageConfig.access.read = isPageRole(roles.Admin, roles.Contributor, roles.Editor, roles.Guest, roles.User);
7189
7234
  }
7190
7235
  const defaultFields = [
@@ -8112,8 +8157,8 @@ var Province = /* @__PURE__ */ __name((options2) => ({
8112
8157
  }), "Province");
8113
8158
 
8114
8159
  // src/collections/Redirect.ts
8115
- var import_bom_core12 = require("@websolutespa/bom-core");
8116
- var RedirectStatusOptions = Object.entries(import_bom_core12.RedirectReason).map(([k, v]) => ({
8160
+ var import_bom_core13 = require("@websolutespa/bom-core");
8161
+ var RedirectStatusOptions = Object.entries(import_bom_core13.RedirectReason).map(([k, v]) => ({
8117
8162
  value: v,
8118
8163
  label: `${v} - ${k}`
8119
8164
  }));
@@ -8127,7 +8172,13 @@ var Redirect2 = /* @__PURE__ */ __name((options2) => ({
8127
8172
  components: {
8128
8173
  views: {
8129
8174
  // List: ImportExportRedirectList,
8130
- List: importExportListWithParser(redirectParser)
8175
+ List: importExportListWithParser(redirectParser, `from,to,status
8176
+ https://www.mydomain.com/some-path-to-redirect,https://www.mydomain.com/a-new-redirect-path,301
8177
+ https://www.mydomain.com/some-path-to-redirect-temporarily,https://www.mydomain.com/a-new-redirect-path,307
8178
+ https://www.mydomain.com/some-path-to-redirect-found-temporarily,https://www.mydomain.com/a-new-redirect-path,302
8179
+ https://www.mydomain.com/some-path-to-redirect-gone,,410
8180
+ https://www.mydomain.com/some-path-to-redirect-with-catchall/*,https://www.mydomain.com/a-new-redirect-path,301
8181
+ https://www.mydomain.com/some-path-to-redirect-with-catchall/*,https://www.mydomain.com/a-new-redirect-path-with-catchall/*,301`)
8131
8182
  }
8132
8183
  },
8133
8184
  hidden: (args) => !hasRole(args.user, roles.Admin, roles.Contributor)
@@ -8380,6 +8431,47 @@ function replaceCircularReference() {
8380
8431
  }
8381
8432
  __name(replaceCircularReference, "replaceCircularReference");
8382
8433
 
8434
+ // src/globals/App.ts
8435
+ var App = /* @__PURE__ */ __name((options2) => ({
8436
+ type: "withGlobal",
8437
+ slug: options2.slug.app,
8438
+ admin: {
8439
+ group: options2.group.config
8440
+ },
8441
+ access: {
8442
+ read: isRole(roles.Admin, roles.Contributor, roles.Editor, roles.Guest, roles.User),
8443
+ update: isRole(roles.Admin, roles.Contributor, roles.Editor)
8444
+ },
8445
+ fields: [
8446
+ {
8447
+ type: "group",
8448
+ name: "brand",
8449
+ fields: [
8450
+ { type: "text", name: "name", defaultValue: "Mixer", required: true },
8451
+ { type: "text", name: "businessName", defaultValue: "Mixer Spa" },
8452
+ { type: "text", name: "appName", defaultValue: "Mixer" },
8453
+ { type: "withMedia", name: "logo" },
8454
+ { type: "text", name: "email", defaultValue: "info@websolute.it" },
8455
+ { type: "text", name: "telephone", defaultValue: "+39 0721 411112" },
8456
+ { type: "text", name: "address", defaultValue: "Strada della Campanara, 15" },
8457
+ { type: "text", name: "city", defaultValue: "Pesaro" },
8458
+ { type: "text", name: "provinceCode", defaultValue: "PU" },
8459
+ { type: "text", name: "zipCode", defaultValue: "61122" },
8460
+ { type: "text", name: "countryCode", defaultValue: "IT" },
8461
+ { type: "text", name: "twitterName", defaultValue: "@websolute" },
8462
+ {
8463
+ type: "array",
8464
+ name: "social",
8465
+ fields: [
8466
+ { type: "text", name: "key" },
8467
+ { type: "text", name: "url" }
8468
+ ]
8469
+ }
8470
+ ]
8471
+ }
8472
+ ]
8473
+ }), "App");
8474
+
8383
8475
  // src/globals/Locale.ts
8384
8476
  var Locale = /* @__PURE__ */ __name((options2) => ({
8385
8477
  type: "withGlobal",
@@ -8616,6 +8708,7 @@ var bowl = /* @__PURE__ */ __name((sourceOptions = {}) => (sourceConfig) => {
8616
8708
  ].map((x) => x(options));
8617
8709
  const bowlGlobals = [
8618
8710
  // Admin
8711
+ App,
8619
8712
  Locale
8620
8713
  ].map((x) => x(options));
8621
8714
  const missingCollections = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/payload-plugin-bowl",
3
- "version": "1.10.1",
3
+ "version": "1.10.3",
4
4
  "description": "Bowl PayloadCms plugin of the BOM Repository",
5
5
  "keywords": [
6
6
  "payload",