@bottlebooks/valid-values 1.1.0 → 1.2.1

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 (93) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/core/translate.d.ts +3 -0
  3. package/dist/core/translate.d.ts.map +1 -0
  4. package/dist/core/translate.js +42 -0
  5. package/dist/index.d.ts +1 -2
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +9 -10
  8. package/dist/main.js +23 -17
  9. package/dist/validValues/award.d.ts +6 -2
  10. package/dist/validValues/award.d.ts.map +1 -1
  11. package/dist/validValues/award.js +29 -236
  12. package/dist/validValues/awardMedal.d.ts +1 -1
  13. package/dist/validValues/beerStyle.d.ts +1 -1
  14. package/dist/validValues/certification.d.ts +1 -1
  15. package/dist/validValues/country.d.ts +7 -2
  16. package/dist/validValues/country.d.ts.map +1 -1
  17. package/dist/validValues/country.js +2 -149
  18. package/dist/validValues/designation.d.ts +0 -115
  19. package/dist/validValues/designation.d.ts.map +1 -1
  20. package/dist/validValues/ingredient.d.ts +1 -1
  21. package/dist/validValues/ingredient.d.ts.map +1 -1
  22. package/dist/validValues/ingredient.js +37 -33
  23. package/dist/validValues/packagingCertification.d.ts +1 -1
  24. package/dist/validValues/productType.d.ts +6 -2
  25. package/dist/validValues/productType.d.ts.map +1 -1
  26. package/dist/validValues/productType.js +39 -78
  27. package/dist/validValues/productionMethod.d.ts +1 -1
  28. package/dist/validValues/region.d.ts +14 -17
  29. package/dist/validValues/region.d.ts.map +1 -1
  30. package/dist/validValues/region.js +4804 -5250
  31. package/dist/validValues/responsibleConsumptionLogo.d.ts +1 -1
  32. package/dist/validValues/subregion.d.ts +10 -17
  33. package/dist/validValues/subregion.d.ts.map +1 -1
  34. package/dist/validValues/subregion.js +11115 -13852
  35. package/dist/validValues/types/ProductType.d.ts.map +1 -1
  36. package/dist/validValues/types/ValidValueDefinition.d.ts +1 -1
  37. package/dist/validValues/types/ValidValueDefinition.d.ts.map +1 -1
  38. package/dist/validValues/types/award_p85_100.d.ts +3 -0
  39. package/dist/validValues/types/award_p85_100.d.ts.map +1 -0
  40. package/dist/validValues/types/award_p85_100.js +9 -0
  41. package/dist/validValues/types/productTypesSpirit.d.ts +4 -0
  42. package/dist/validValues/types/productTypesSpirit.d.ts.map +1 -0
  43. package/dist/validValues/types/productTypesSpirit.js +9 -0
  44. package/dist/validValues/types/productTypesWine.d.ts +4 -0
  45. package/dist/validValues/types/productTypesWine.d.ts.map +1 -0
  46. package/dist/validValues/types/productTypesWine.js +9 -0
  47. package/dist/validValues/utils/createValidValues.d.ts +1 -1
  48. package/dist/validValues/utils/createValidValues.d.ts.map +1 -1
  49. package/dist/validValues/utils/createValidValues.js +50 -53
  50. package/dist/validValues/varietyName.d.ts +1 -1
  51. package/dist/validValues/wineColor.d.ts +1 -1
  52. package/dist/validValues/wineType.d.ts +1 -1
  53. package/package.json +2 -2
  54. package/region.ts +0 -0
  55. package/src/core/translate.ts +40 -0
  56. package/src/index.ts +1 -6
  57. package/src/locales/po/bg.po +2110 -2110
  58. package/src/locales/po/de.po +2110 -2110
  59. package/src/locales/po/ee.po +2110 -2110
  60. package/src/locales/po/en.po +2110 -2110
  61. package/src/locales/po/es.po +2110 -2110
  62. package/src/locales/po/fi.po +2110 -2110
  63. package/src/locales/po/fr.po +2110 -2110
  64. package/src/locales/po/hr.po +2110 -2110
  65. package/src/locales/po/hu.po +2110 -2110
  66. package/src/locales/po/it.po +2110 -2110
  67. package/src/locales/po/lt.po +2110 -2110
  68. package/src/locales/po/lv.po +2110 -2110
  69. package/src/locales/po/mt.po +2110 -2110
  70. package/src/locales/po/nl.po +2110 -2110
  71. package/src/locales/po/pl.po +2110 -2110
  72. package/src/locales/po/pt.po +2110 -2110
  73. package/src/locales/po/ro.po +2110 -2110
  74. package/src/locales/po/se.po +2110 -2110
  75. package/src/locales/po/si.po +2110 -2110
  76. package/src/locales/po/sk.po +2110 -2110
  77. package/src/main.ts +39 -29
  78. package/src/validValues/award.ts +242 -709
  79. package/src/validValues/country.ts +7 -148
  80. package/src/validValues/designation.ts +0 -5
  81. package/src/validValues/ingredient.ts +35 -343
  82. package/src/validValues/productType.ts +7 -40
  83. package/src/validValues/region.ts +514 -479
  84. package/src/validValues/subregion.ts +1429 -2775
  85. package/src/validValues/types/ProductType.ts +0 -1
  86. package/src/validValues/types/ValidValueDefinition.ts +1 -1
  87. package/src/validValues/types/award_p85_100.ts +19 -0
  88. package/src/validValues/types/productTypesSpirit.ts +38 -0
  89. package/src/validValues/types/productTypesWine.ts +10 -0
  90. package/src/validValues/utils/createValidValues.ts +52 -50
  91. package/dist/validValues/types/Country.js +0 -5
  92. package/src/validValues/types/Award.ts +0 -39
  93. package/src/validValues/types/Country.ts +0 -39
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.2.1](https://github.com/bottlebooks/bottlebooks/compare/@bottlebooks/valid-values@1.2.0...@bottlebooks/valid-values@1.2.1) (2022-11-23)
7
+
8
+ ### Bug Fixes
9
+
10
+ - valid-values translate logic ([8aa9b48](https://github.com/bottlebooks/bottlebooks/commit/8aa9b486193f6bdc9711e92a81373069fa7016e6))
11
+
12
+ # [1.2.0](https://github.com/bottlebooks/bottlebooks/compare/@bottlebooks/valid-values@1.1.0...@bottlebooks/valid-values@1.2.0) (2022-11-23)
13
+
14
+ ### Features
15
+
16
+ - add byCountry and listByCountry to region; ([34cbef7](https://github.com/bottlebooks/bottlebooks/commit/34cbef7cf4b1560c9a382208233c5748701f8b93))
17
+
6
18
  # 1.1.0 (2022-11-17)
7
19
 
8
20
  ### Bug Fixes
@@ -0,0 +1,3 @@
1
+ import { MessageDescriptor } from '@lingui/core';
2
+ export declare function translate(title: MessageDescriptor | string, locale?: string): string;
3
+ //# sourceMappingURL=translate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translate.d.ts","sourceRoot":"","sources":["../../src/core/translate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEvD,wBAAgB,SAAS,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,UAqC3E"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.translate = translate;
7
+
8
+ var _core = require("@lingui/core");
9
+
10
+ function translate(title, locale) {
11
+ // if (typeof title === 'string') {
12
+ // return title;
13
+ // }
14
+ var messageId = typeof title === 'string' ? title : title === null || title === void 0 ? void 0 : title.id;
15
+
16
+ if (!messageId) {
17
+ console.log('%c' + "ERROR: messageId_missing:".concat(JSON.stringify(title)), 'color: #d0011b;');
18
+ return '';
19
+ }
20
+
21
+ if (!locale) {
22
+ locale = 'en';
23
+ } // else {
24
+ // i18n.activate('en');
25
+ // }
26
+
27
+
28
+ _core.i18n.activate(locale);
29
+
30
+ var translation = _core.i18n._(messageId);
31
+
32
+ if (translation === messageId) {
33
+ if (messageId.includes('validValues.')) {
34
+ console.log('%c' + "ERROR: translation_missing:".concat(messageId, ":").concat(locale), 'color: #d0011b;');
35
+ return '';
36
+ }
37
+
38
+ console.log('%c' + "WARNING: translation==messageId:".concat(messageId, ":").concat(locale), 'color: #d0011b;');
39
+ }
40
+
41
+ return translation;
42
+ }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { MessageDescriptor } from '@lingui/core';
1
+ export { translate } from './core/translate';
2
2
  export * from './validValues';
3
3
  export declare const allSupportedLocales: string[];
4
- export declare function translate(message: MessageDescriptor, locale: string): string;
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGvD,cAAc,eAAe,CAAC;AAC9B,eAAO,MAAM,mBAAmB,UAA6B,CAAC;AAE9D,wBAAgB,SAAS,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,UAGnE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,cAAc,eAAe,CAAC;AAC9B,eAAO,MAAM,mBAAmB,UAA6B,CAAC"}
package/dist/index.js CHANGED
@@ -8,12 +8,17 @@ var _exportNames = {
8
8
  translate: true
9
9
  };
10
10
  exports.allSupportedLocales = void 0;
11
- exports.translate = translate;
12
-
13
- var _core = require("@lingui/core");
11
+ Object.defineProperty(exports, "translate", {
12
+ enumerable: true,
13
+ get: function get() {
14
+ return _translate.translate;
15
+ }
16
+ });
14
17
 
15
18
  var _locales = require("./locales/locales.js");
16
19
 
20
+ var _translate = require("./core/translate");
21
+
17
22
  var _validValues = require("./validValues");
18
23
 
19
24
  Object.keys(_validValues).forEach(function (key) {
@@ -28,10 +33,4 @@ Object.keys(_validValues).forEach(function (key) {
28
33
  });
29
34
  });
30
35
  var allSupportedLocales = Object.keys(_locales.allLocaleData);
31
- exports.allSupportedLocales = allSupportedLocales;
32
-
33
- function translate(message, locale) {
34
- _core.i18n.activate(locale);
35
-
36
- return _core.i18n._(message);
37
- }
36
+ exports.allSupportedLocales = allSupportedLocales;
package/dist/main.js CHANGED
@@ -6,6 +6,8 @@ require("./style.css");
6
6
 
7
7
  var validValues = _interopRequireWildcard(require("./validValues.js"));
8
8
 
9
+ var _translate = require("./core/translate");
10
+
9
11
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
10
12
 
11
13
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -30,23 +32,27 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
30
32
 
31
33
  document.querySelector('#app').innerHTML = "\n <div>\n <h1>ValidValues</h1>\n ".concat(Object.entries(validValues).map(function (_ref) {
32
34
  var _ref2 = _slicedToArray(_ref, 2),
33
- key = _ref2[0],
35
+ validValueCategory = _ref2[0],
34
36
  values = _ref2[1];
35
37
 
36
- if (values.list) {
37
- var list = values.list;
38
- return "<h2>".concat(key, "</h2>\n <pre>").concat(list().map(function (item, i) {
39
- return i === 0 ? JSON.stringify(_objectSpread(_objectSpread({
40
- // @ts-ignore
41
- id: item.id,
42
- 'title(en)': item.getTitle('en'),
43
- 'title(de)': item.getTitle('de'),
44
- titles: item.getTitles(['de', 'en', 'es', 'fr'])
45
- }, item), {}, {
46
- form: item.form && _objectSpread({}, item.form)
47
- }), undefined, 2) : '';
48
- }), "</pre>\n ");
49
- }
50
-
51
- return "<h2>".concat(key, "</h2>\n <pre>").concat(JSON.stringify(values, undefined, 2), "</pre>\n ");
38
+ var list = values.list;
39
+ var content = "<h2>".concat(validValueCategory, "</h2>"); // if (['designation'].includes(validValueCategory)) {
40
+ // return '';
41
+ // }
42
+
43
+ return "".concat(content, "\n <pre>").concat(list.map(function (item, i) {
44
+ var key = item.key,
45
+ title = item.title,
46
+ form = item.form; // const message = { id: item.id } as MessageDescriptor;
47
+
48
+ return i === 0 ? JSON.stringify(_objectSpread(_objectSpread({
49
+ // @ts-ignore
50
+ id: item.id,
51
+ 'title(en)': (0, _translate.translate)(title, 'en'),
52
+ 'title(de)': (0, _translate.translate)(title, 'de')
53
+ }, item), {}, {
54
+ form: item.form ? item.form && _objectSpread({}, item.form) : null
55
+ }), undefined, 2) : '';
56
+ }), "</pre>\n ");
57
+ return "<h2>".concat(validValueCategory, "</h2>\n <pre>").concat(JSON.stringify(values, undefined, 2), "</pre>\n ");
52
58
  }).join(''), "</pre></code>\n </div>\n");
@@ -1,6 +1,10 @@
1
- import { Award } from './types/Award';
1
+ interface Award {
2
+ key: string;
3
+ title: string;
4
+ medals?: string[];
5
+ }
2
6
  declare const _default: {
3
- list: () => ({
7
+ list: ({
4
8
  id: string;
5
9
  } & Award & {
6
10
  getTitle: (locale?: "de" | "en" | "es" | "fr" | "it" | "pt" | "sk" | "bg" | "hr" | "nl" | "ee" | "fi" | "hu" | "lv" | "lt" | "mt" | "pl" | "ro" | "si" | "se" | undefined) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"award.d.ts","sourceRoot":"","sources":["../../src/validValues/award.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;;;;;;;;;;;;;;;;;;;AACtC,wBAs7EG"}
1
+ {"version":3,"file":"award.d.ts","sourceRoot":"","sources":["../../src/validValues/award.ts"],"names":[],"mappings":"AAEA,UAAU,KAAK;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;;;;;;;;;;;;;;;;;;;AAED,wBA89DG"}