@designcrowd/fe-shared-lib 1.2.1 → 1.2.2-data-id-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 (24) hide show
  1. package/Dockerfile +2 -0
  2. package/index.js +2 -0
  3. package/nodemon.translation.json +7 -0
  4. package/package.json +7 -2
  5. package/{dist → public}/css/tailwind-brandCrowd.css +501 -608
  6. package/{dist → public}/css/tailwind-brandPage.css +425 -528
  7. package/{dist → public}/css/tailwind-crazyDomains.css +501 -608
  8. package/{dist → public}/css/tailwind-designCom.css +501 -608
  9. package/{dist → public}/css/tailwind-designCrowd.css +501 -608
  10. package/src/atoms/components/Icon/Icon.vue +4 -3
  11. package/src/bundleTranslation.js +89 -0
  12. package/src/bundles/bundled-translations.de-DE.json +5 -0
  13. package/src/bundles/bundled-translations.es-ES.json +5 -0
  14. package/src/bundles/bundled-translations.fr-FR.json +5 -0
  15. package/src/bundles/bundled-translations.json +5 -0
  16. package/src/bundles/bundled-translations.pt-PT.json +5 -0
  17. package/src/experiences/components/PaymentConfigList/PaymentConfig.mixin.js +1 -1
  18. package/src/experiences/components/PublishBrandPageModal/PublishBrandPageModal.vue +16 -8
  19. package/src/experiences/components/PublishBrandPageModal/i18n/publish-modal.de-DE.json +5 -0
  20. package/src/experiences/components/PublishBrandPageModal/i18n/publish-modal.es-ES.json +5 -0
  21. package/src/experiences/components/PublishBrandPageModal/i18n/publish-modal.fr-FR.json +5 -0
  22. package/src/experiences/components/PublishBrandPageModal/i18n/publish-modal.json +5 -0
  23. package/src/experiences/components/PublishBrandPageModal/i18n/publish-modal.pt-PT.json +5 -0
  24. package/src/useSharedLibTranslate.js +38 -0
@@ -19,9 +19,10 @@
19
19
  role="graphics-symbol"
20
20
  aria-labelledby="title"
21
21
  aria-describedby="desc"
22
+ :data-id="`${name}-${id}-title`"
22
23
  >
23
- <title :id="`${name}-${id}-title`" lang="en">{{ title }}</title>
24
- <desc :id="`${name}-${id}-desc`" lang="en">{{ description }}</desc>
24
+ <title v-if="title" :id="`${name}-${id}-title`" lang="en">{{ title }}</title>
25
+ <desc v-if="description" :id="`${name}-${id}-desc`" lang="en">{{ description }}</desc>
25
26
  <component :is="`icon-${iconName}`"></component>
26
27
  </svg>
27
28
  </div>
@@ -799,7 +800,7 @@ export default {
799
800
  return css || null;
800
801
  },
801
802
  title() {
802
- return this.altText || `${this.titleCase(this.name)}`;
803
+ return this.altText;
803
804
  },
804
805
  description() {
805
806
  return `${this.title} Icon`;
@@ -0,0 +1,89 @@
1
+ const path = require('path');
2
+ const fs = require('fs');
3
+
4
+ const localeSuffixes = ['.de-DE', '.fr-FR', '.es-ES', '.pt-PT', ''];
5
+
6
+ const findTranslationFiles = (dir, localeString) => {
7
+ const files = [];
8
+ const entries = fs.readdirSync(dir);
9
+
10
+ entries.forEach((entry) => {
11
+ const fullPath = path.join(dir, entry);
12
+
13
+ if (fs.statSync(fullPath).isDirectory()) {
14
+ if (entry === 'i18n') {
15
+ files.push(
16
+ ...fs
17
+ .readdirSync(fullPath)
18
+ .filter((file) => {
19
+ if (localeString === '') {
20
+ return (
21
+ !file.includes('.de-DE') &&
22
+ !file.includes('.fr-FR') &&
23
+ !file.includes('.es-ES') &&
24
+ !file.includes('.pt-PT')
25
+ );
26
+ }
27
+ return file.endsWith(`${localeString}.json`);
28
+ })
29
+ .map((file) => path.join(fullPath, file)),
30
+ );
31
+ } else {
32
+ // Recursively find translation files in nested folders
33
+ files.push(...findTranslationFiles(fullPath, localeString));
34
+ }
35
+ }
36
+ });
37
+
38
+ return files;
39
+ };
40
+
41
+ const bundle = () => {
42
+ console.log('Bundling translations...', __dirname);
43
+
44
+ const bundlesDir = path.resolve(__dirname, './bundles');
45
+
46
+ console.log('bundlesDir', bundlesDir);
47
+
48
+ if (!fs.existsSync(bundlesDir)) {
49
+ console.log('Creating bundles dir');
50
+ fs.mkdirSync(bundlesDir);
51
+ }
52
+
53
+ const rootDir = path.resolve(__dirname, '../src');
54
+
55
+ localeSuffixes.forEach((locale) => {
56
+ const outputFile = path.resolve(bundlesDir, `bundled-translations${locale}.json`);
57
+
58
+ const translationFiles = findTranslationFiles(rootDir, locale);
59
+
60
+ console.log(
61
+ `Found ${translationFiles.length} translation files in BrandPage for file prefix: ${`bundled-translations${locale}.json`}`,
62
+ );
63
+
64
+ const translations = {};
65
+
66
+ translationFiles.forEach((file) => {
67
+ const fileContent = fs.readFileSync(file, 'utf-8');
68
+
69
+ Object.assign(translations, JSON.parse(fileContent));
70
+ });
71
+
72
+ console.log(`Writing bundled translations to: ${outputFile}`);
73
+
74
+ try {
75
+ const potentiallyExistingFile = fs.readFileSync(outputFile, 'utf-8');
76
+
77
+ if (potentiallyExistingFile === JSON.stringify(translations, null, 2)) {
78
+ console.log('Current translations are the same as the existing file - skipping write');
79
+ } else {
80
+ fs.writeFileSync(outputFile, JSON.stringify(translations, null, 2));
81
+ }
82
+ } catch (e) {
83
+ console.log("Translation file doesn't exist, creating new one");
84
+ fs.writeFileSync(outputFile, JSON.stringify(translations, null, 2));
85
+ }
86
+ });
87
+ };
88
+
89
+ bundle();
@@ -0,0 +1,5 @@
1
+ {
2
+ "publishModal": {
3
+ "test": "DE-Publish Brand Page"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "publishModal": {
3
+ "test": "ES-Publish Brand Page"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "publishModal": {
3
+ "test": "FR-Publish Brand Page"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "publishModal": {
3
+ "test": "EN-Publish Brand Page"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "publishModal": {
3
+ "test": "PT-Publish Brand Page"
4
+ }
5
+ }
@@ -1,5 +1,5 @@
1
- import brandPageApiClient from '../../clients/brand-page-api.client';
2
1
  import vClickOutside from 'click-outside-vue3';
2
+ import brandPageApiClient from '../../clients/brand-page-api.client';
3
3
 
4
4
  export const paymentConfigStatuses = Object.freeze({
5
5
  active: 'Active',
@@ -50,7 +50,7 @@
50
50
  <div v-if="isNotPublished || isSlugEditMode" class="tw-mt-4">
51
51
  <PublishBrandPageCard
52
52
  v-if="!hasPurchasedDomains"
53
- :imgUrl="iconUrl"
53
+ :img-url="iconUrl"
54
54
  title="Free Address"
55
55
  description="Choose a free address to publish now. You can always edit the URL later"
56
56
  :is-design-com="isDesignCom"
@@ -84,11 +84,11 @@
84
84
  data-test-brand-page-publish-button
85
85
  variant="primary"
86
86
  size="small-medium"
87
- @on-click="onPublish"
88
87
  :full-width="isMobile"
89
88
  :class="{
90
89
  'tw-uppercase': !isDesignCom,
91
90
  }"
91
+ @on-click="onPublish"
92
92
  />
93
93
  </div>
94
94
  </template>
@@ -246,19 +246,21 @@
246
246
  </div>
247
247
  </template>
248
248
  <script>
249
- import Modal from '../../../../src/atoms/components/Modal/Modal.vue';
249
+ import { computed } from 'vue';
250
+ import Modal from '../../../atoms/components/Modal/Modal.vue';
250
251
  import PublishBrandPageCard from './PublishBrandPageCard.vue';
251
- import TextInput from '../../../../src/atoms/components/TextInput/TextInput.vue';
252
- import Dropdown from '../../../../src/atoms/components/Dropdown/Dropdown.vue';
253
- import DropdownItem from '../../../../src/atoms/components/Dropdown/DropdownItem.vue';
254
- import Button from '../../../../src/atoms/components/Button/Button.vue';
255
- import TextCopyField from '../../../../src/atoms/components/TextCopyField/TextCopyField.vue';
252
+ import TextInput from '../../../atoms/components/TextInput/TextInput.vue';
253
+ import Dropdown from '../../../atoms/components/Dropdown/Dropdown.vue';
254
+ import DropdownItem from '../../../atoms/components/Dropdown/DropdownItem.vue';
255
+ import Button from '../../../atoms/components/Button/Button.vue';
256
+ import TextCopyField from '../../../atoms/components/TextCopyField/TextCopyField.vue';
256
257
 
257
258
  import SellDomainNameSearchWithResults from '../SellDomainNameSearchWithResults/SellDomainNameSearchWithResults.vue';
258
259
  import SellDomainNameListModal from '../SellDomainNameListModal/SellDomainNameListModal.vue';
259
260
  import brandCrowdApiClient from '../../clients/brand-crowd-api.client';
260
261
  import Events, { sitePublishedModal } from '../../constants/event-constants';
261
262
  import mediaQueryMixin from '../../mixins/mediaQueryMixin';
263
+ import { tr } from '../../../useSharedLibTranslate';
262
264
 
263
265
  const headerSubtitle = 'Buy matching domain name for your brand';
264
266
 
@@ -413,6 +415,12 @@ export default {
413
415
  'on-view-more-domains',
414
416
  'on-slug-changed',
415
417
  ],
418
+ setup() {
419
+ return {
420
+ tr,
421
+ testMessage: computed(() => tr('publishModal.test')),
422
+ };
423
+ },
416
424
  data() {
417
425
  return {
418
426
  DOMAIN_TYPES,
@@ -0,0 +1,5 @@
1
+ {
2
+ "publishModal": {
3
+ "test": "DE-Publish Brand Page"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "publishModal": {
3
+ "test": "ES-Publish Brand Page"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "publishModal": {
3
+ "test": "FR-Publish Brand Page"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "publishModal": {
3
+ "test": "EN-Publish Brand Page"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "publishModal": {
3
+ "test": "PT-Publish Brand Page"
4
+ }
5
+ }
@@ -0,0 +1,38 @@
1
+ // eslint-disable-next-line import/no-extraneous-dependencies
2
+ import i18next from 'i18next';
3
+
4
+ const fallbackLocale = 'en-US';
5
+
6
+ const relativePathsToTranslationFiles = {
7
+ 'en-US': () => import('./bundles/bundled-translations.json'),
8
+ 'de-DE': () => import('./bundles/bundled-translations.de-DE.json'),
9
+ 'fr-FR': () => import('./bundles/bundled-translations.fr-FR.json'),
10
+ 'es-ES': () => import('./bundles/bundled-translations.es-ES.json'),
11
+ 'pt-PT': () => import('./bundles/bundled-translations.pt-PT.json'),
12
+ };
13
+
14
+ const setLocaleAsync = async (locale = 'en-US') => {
15
+ const localeToUse = locale;
16
+
17
+ if (!i18next.isInitialized) {
18
+ await i18next.init({
19
+ debug: false,
20
+ fallbackLng: fallbackLocale,
21
+ lng: localeToUse,
22
+ });
23
+ }
24
+
25
+ const languageFile = (await relativePathsToTranslationFiles[localeToUse]()).default;
26
+
27
+ await i18next.addResourceBundle(localeToUse, 'fe-shared-lib', {
28
+ ...languageFile,
29
+ });
30
+ };
31
+
32
+ const tr = (key, valuesToInterpolate = {}) => {
33
+ const translated = i18next.t(key, { ns: 'fe-shared-lib', ...valuesToInterpolate });
34
+
35
+ return translated;
36
+ };
37
+
38
+ export { setLocaleAsync, tr };