@designcrowd/fe-shared-lib 1.2.18-kp-3 → 1.2.18-ml-currency

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 (27) hide show
  1. package/Dockerfile +1 -1
  2. package/dist/css/tailwind-brandCrowd.css +2459 -0
  3. package/dist/css/tailwind-brandPage.css +2147 -0
  4. package/dist/css/tailwind-crazyDomains.css +2459 -0
  5. package/dist/css/tailwind-designCom.css +2459 -0
  6. package/dist/css/tailwind-designCrowd.css +2459 -0
  7. package/package.json +1 -1
  8. package/public/css/tailwind-brandCrowd.css +10 -3
  9. package/public/css/tailwind-brandPage.css +10 -3
  10. package/public/css/tailwind-crazyDomains.css +10 -3
  11. package/public/css/tailwind-designCom.css +10 -3
  12. package/public/css/tailwind-designCrowd.css +10 -3
  13. package/src/atoms/components/Price/Price.fixtures.js +63 -3
  14. package/src/atoms/components/Price/Price.stories.js +127 -5
  15. package/src/atoms/components/Price/Price.vue +24 -3
  16. package/src/bundles/bundled-translations.de-DE.json +1 -3
  17. package/src/bundles/bundled-translations.es-ES.json +1 -3
  18. package/src/bundles/bundled-translations.fr-FR.json +1 -3
  19. package/src/bundles/bundled-translations.json +1 -3
  20. package/src/bundles/bundled-translations.pt-PT.json +1 -3
  21. package/src/experiences/components/PublishBrandPageModal/PublishBrandPageModal.vue +1 -14
  22. package/src/experiences/components/PublishBrandPageModal/i18n/publish-brand-page-modal.de-DE.json +2 -4
  23. package/src/experiences/components/PublishBrandPageModal/i18n/publish-brand-page-modal.es-ES.json +2 -4
  24. package/src/experiences/components/PublishBrandPageModal/i18n/publish-brand-page-modal.fr-FR.json +2 -4
  25. package/src/experiences/components/PublishBrandPageModal/i18n/publish-brand-page-modal.json +21 -23
  26. package/src/experiences/components/PublishBrandPageModal/i18n/publish-brand-page-modal.pt-PT.json +2 -4
  27. package/src/useSharedLibTranslate.js +42 -0
@@ -1,24 +1,22 @@
1
1
  {
2
- "publishBrandPageModal": {
3
- "firstTimePublishHeaderLabel": "Set the URL for {{brandPageDisplayName}}",
4
- "sitePublishedLabel": "Site published!",
5
- "publishSuccessLabel": "Your {{brandPageDisplayName}} is live! Start using your link:",
6
- "freePublishCardTitleLabel": "Free Address",
7
- "freePublishCardDescriptionLabel": "Choose a free address to publish now. You can always edit the URL later",
8
- "slugInputPlaceholderYourNameLabel": "your-name",
9
- "slugInputPlaceholderYourBusinessNameLabel": "your-business-name",
10
- "freeDomainLabel": "Free domain",
11
- "purchasedDomainLabel": "Purchased domain",
12
- "setUrlLabel": "Set URL",
13
- "publishLabel": "Publish",
14
- "viewMoreDomainLabel": "VIEW MORE DOMAINS",
15
- "viewMyWebsiteLabel": "View {{brandPageDisplayName}}",
16
- "copyLabel": "Copy",
17
- "copySuccessLabel": "Copied!",
18
- "publishedSuccessDescriptionLabel": "Buy matching domain name for your brand",
19
- "hasAlreadyPurchasedDomainCloseButtonLabel": "No thanks, maybe later",
20
- "selectDomainDropdownPlaceholder": "Select domain name",
21
- "websiteFriendlyName": "Website",
22
- "digitalBusinessCardFriendlyName": "Digital Business Card"
23
- }
24
- }
2
+ "publishBrandPageModal": {
3
+ "firstTimePublishHeaderLabel": "Set the URL for {{brandPageDisplayName}}",
4
+ "sitePublishedLabel": "Site published!",
5
+ "publishSuccessLabel": "Your {{brandPageDisplayName}} is live! Start using your link:",
6
+ "freePublishCardTitleLabel": "Free Address",
7
+ "freePublishCardDescriptionLabel": "Choose a free address to publish now. You can always edit the URL later",
8
+ "slugInputPlaceholderYourNameLabel": "your-name",
9
+ "slugInputPlaceholderYourBusinessNameLabel": "your-business-name",
10
+ "freeDomainLabel": "Free domain",
11
+ "purchasedDomainLabel": "Purchased domain",
12
+ "setUrlLabel": "Set URL",
13
+ "publishLabel": "Publish",
14
+ "viewMoreDomainLabel": "VIEW MORE DOMAINS",
15
+ "viewMyWebsiteLabel": "View {{brandPageDisplayName}}",
16
+ "copyLabel": "Copy",
17
+ "copySuccessLabel": "Copied!",
18
+ "publishedSuccessDescriptionLabel": "Buy matching domain name for your brand",
19
+ "hasAlreadyPurchasedDomainCloseButtonLabel": "No thanks, maybe later",
20
+ "selectDomainDropdownPlaceholder": "Select domain name"
21
+ }
22
+ }
@@ -17,8 +17,6 @@
17
17
  "copySuccessLabel" : "Copiado!",
18
18
  "publishedSuccessDescriptionLabel" : "Compre um nome de domínio que corresponda à sua marca",
19
19
  "hasAlreadyPurchasedDomainCloseButtonLabel" : "Não, obrigado, talvez mais tarde",
20
- "selectDomainDropdownPlaceholder" : "Selecionar nome de domínio",
21
- "websiteFriendlyName" : "Website",
22
- "digitalBusinessCardFriendlyName" : "Cartão de visita digital"
20
+ "selectDomainDropdownPlaceholder" : "Selecionar nome de domínio"
23
21
  }
24
- }
22
+ }
@@ -67,6 +67,47 @@ const getCurrentLocale = () => {
67
67
  return i18next.language || 'en-US';
68
68
  };
69
69
 
70
+ const formatCurrency = (amount, locale, currency, fraction = 0, showAbbreviation = false) => {
71
+ let localeAmount = i18next.t('{{val, currency}}', {
72
+ ns: 'fe-shared-lib',
73
+ val: amount,
74
+ currency: currency.iso4127Code,
75
+ locale: locale,
76
+ maximumFractionDigits: fraction,
77
+ useGrouping: false,
78
+ });
79
+
80
+ const abbreviationTrimmed = currency.abbreviation.trim();
81
+ const symbolTrimmed = currency.symbol.trim();
82
+
83
+ // i18next always uses iso code for ZAR, prefer symbol over iso code
84
+ if (localeAmount.includes(currency.iso4127Code) && currency.iso4127Code === 'ZAR') {
85
+ return localeAmount.replace(currency.iso4127Code, symbolTrimmed);
86
+ }
87
+
88
+ // edge case
89
+ if (localeAmount.includes(currency.iso4127Code)) {
90
+ return localeAmount.replace(currency.iso4127Code, symbolTrimmed);
91
+ }
92
+
93
+ // show abbreviation locale logic
94
+ // note: showAbbreviation is only passed as true for symbol = "$"
95
+ if (currency.symbol.trim() !== '$') {
96
+ return localeAmount;
97
+ }
98
+
99
+ const altAudAbbreviation = 'AU';
100
+ if (showAbbreviation && !localeAmount.includes(abbreviationTrimmed)) {
101
+ return localeAmount.replace(symbolTrimmed,`${abbreviationTrimmed}${symbolTrimmed}`);
102
+ } else if (!showAbbreviation && localeAmount.includes(altAudAbbreviation)) {
103
+ return localeAmount.replace(altAudAbbreviation, '');
104
+ } else if (!showAbbreviation && localeAmount.includes(abbreviationTrimmed)) {
105
+ return localeAmount.replace(abbreviationTrimmed, '');
106
+ }
107
+
108
+ return localeAmount;
109
+ }
110
+
70
111
  export {
71
112
  setSharedLibLocaleAsync,
72
113
  getCurrentLocale,
@@ -81,4 +122,5 @@ export {
81
122
  uploadYourLogoTr,
82
123
  sharedPaymentConfigTr,
83
124
  priceTr,
125
+ formatCurrency,
84
126
  };