@designcrowd/fe-shared-lib 1.2.18 → 1.2.19-ast-upsell-2

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/index.js +4 -0
  2. package/package.json +1 -1
  3. package/src/atoms/components/Modal/Modal.vue +6 -1
  4. package/src/atoms/components/Price/Price.fixtures.js +63 -3
  5. package/src/atoms/components/Price/Price.stories.js +124 -5
  6. package/src/atoms/components/Price/Price.vue +24 -3
  7. package/src/atoms/components/Upsell/DigitalBusinessCard.vue +63 -0
  8. package/src/atoms/components/Upsell/LinkInBio.vue +62 -0
  9. package/src/atoms/components/Upsell/UpgradeWebsite.vue +60 -0
  10. package/src/atoms/components/Upsell/WebDesignSupport.vue +63 -0
  11. package/src/atoms/components/Upsell/i18n/upsell-modal-components.de-DE.json +17 -0
  12. package/src/atoms/components/Upsell/i18n/upsell-modal-components.es-ES.json +17 -0
  13. package/src/atoms/components/Upsell/i18n/upsell-modal-components.fr-FR.json +17 -0
  14. package/src/atoms/components/Upsell/i18n/upsell-modal-components.json +17 -0
  15. package/src/atoms/components/Upsell/i18n/upsell-modal-components.pt-PT.json +17 -0
  16. package/src/bundles/bundled-translations.de-DE.json +15 -0
  17. package/src/bundles/bundled-translations.es-ES.json +15 -0
  18. package/src/bundles/bundled-translations.fr-FR.json +15 -0
  19. package/src/bundles/bundled-translations.json +15 -0
  20. package/src/bundles/bundled-translations.pt-PT.json +15 -0
  21. package/src/experiences/components/PublishBrandPageModal/PublishBrandPageModal.stories.js +41 -0
  22. package/src/experiences/components/PublishBrandPageModal/PublishBrandPageModal.vue +47 -25
  23. package/src/experiences/components/SellDomainNameSearchWithResults/SellDomainNameSearchWithResults.vue +24 -0
  24. package/src/useSharedLibTranslate.js +40 -0
package/index.js CHANGED
@@ -54,3 +54,7 @@ export { default as HashRouteModal } from './src/atoms/components/Modal/HashRout
54
54
  export { default as Select } from './src/atoms/components/Select/Select.vue';
55
55
  export { default as NumberStepper } from './src/atoms/components/NumberStepper/NumberStepper.vue';
56
56
  export { default as CopyToClipboardText } from './src/atoms/components/CopyToClipboardText/CopyToClipboardText.vue';
57
+ export { default as WebDesignSupportUpsell } from './src/atoms/components/Upsell/WebDesignSupport.vue';
58
+ export { default as DigitalBusinessCardUpsell } from './src/atoms/components/Upsell/DigitalBusinessCard.vue';
59
+ export { default as LinkInBioUpsell } from './src/atoms/components/Upsell/LinkInBio.vue';
60
+ export { default as UpgradeWebsiteUpsell } from './src/atoms/components/Upsell/UpgradeWebsite.vue';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designcrowd/fe-shared-lib",
3
- "version": "1.2.18",
3
+ "version": "1.2.19-ast-upsell-2",
4
4
  "scripts": {
5
5
  "start": "run-p storybook watch:translation",
6
6
  "build": "npm run build:css --production",
@@ -15,7 +15,7 @@
15
15
  :class="[
16
16
  {
17
17
  'tw-w-full': !isImageMode,
18
- 'tw-p-4': !simple,
18
+ 'tw-p-4': !removeHorizontalPadding && !simple,
19
19
  'tw-max-w-md': size === 'md',
20
20
  'tw-max-w-xl': size === 'xl',
21
21
  'tw-max-w-2xl': !size && !isImageMode,
@@ -91,6 +91,11 @@ export default {
91
91
  required: false,
92
92
  default: false,
93
93
  },
94
+ removeHorizontalPadding: {
95
+ type: Boolean,
96
+ required: false,
97
+ default: false,
98
+ },
94
99
  visible: {
95
100
  type: Boolean,
96
101
  required: false,
@@ -11,15 +11,75 @@ export const audCurrency = {
11
11
  name: 'Australian Dollars',
12
12
  iso4127Code: 'AUD',
13
13
  symbol: '$',
14
- abbreviation: 'AU',
14
+ abbreviation: 'A',
15
+ };
16
+
17
+ export const gbpCurrency = {
18
+ id: 3,
19
+ name: 'British Pound',
20
+ iso4127Code: 'GBP',
21
+ symbol: '£',
22
+ abbreviation: 'UK',
15
23
  };
16
24
 
17
25
  export const euroCurrency = {
18
- id: 999,
26
+ id: 4,
19
27
  name: 'Euro',
20
28
  iso4127Code: 'EUR',
21
29
  symbol: '€',
22
30
  abbreviation: 'EU',
23
31
  };
24
32
 
25
- export const currencies = [usdCurrency, audCurrency, euroCurrency];
33
+ export const inrCurrency = {
34
+ id: 5,
35
+ name: 'Indian Rupee',
36
+ iso4127Code: 'INR',
37
+ symbol: '₹',
38
+ abbreviation: 'IN',
39
+ };
40
+
41
+ export const phpCurrency = {
42
+ id: 6,
43
+ name: 'Philippine Peso',
44
+ iso4127Code: 'PHP',
45
+ symbol: '₱',
46
+ abbreviation: 'PH',
47
+ };
48
+
49
+ export const brlCurrency = {
50
+ id: 7,
51
+ name: 'Brazilian Real',
52
+ iso4127Code: 'BRL',
53
+ symbol: 'R$',
54
+ abbreviation: 'R',
55
+ };
56
+
57
+ export const mxnCurrency = {
58
+ id: 8,
59
+ name: 'Mexican Peso',
60
+ iso4127Code: 'MXN',
61
+ symbol: 'MX$',
62
+ abbreviation: 'MX',
63
+ };
64
+
65
+ export const zarCurrency = {
66
+ id: 9,
67
+ name: 'South African Rand',
68
+ iso4127Code: 'ZAR',
69
+ symbol: 'R',
70
+ abbreviation: 'R',
71
+ };
72
+
73
+ export const currencies = [
74
+ usdCurrency,
75
+ audCurrency,
76
+ gbpCurrency,
77
+ euroCurrency,
78
+ inrCurrency,
79
+ phpCurrency,
80
+ brlCurrency,
81
+ mxnCurrency,
82
+ zarCurrency,
83
+ ];
84
+
85
+ export const locales = [ 'en-US', 'fr-FR', 'es-ES', 'pt-PT', 'de-DE']
@@ -1,5 +1,9 @@
1
1
  import Price from './Price.vue';
2
- import { currencies } from './Price.fixtures';
2
+ import { currencies, locales } from './Price.fixtures';
3
+ import { setSharedLibLocaleAsync } from "../../../useSharedLibTranslate";
4
+ import { defineComponent } from "vue";
5
+
6
+ await setSharedLibLocaleAsync();
3
7
 
4
8
  // noinspection JSUnusedGlobalSymbols
5
9
  export default {
@@ -7,6 +11,7 @@ export default {
7
11
  component: Price,
8
12
  args: {
9
13
  currencyName: currencies[0].name,
14
+ locale: locales[0]
10
15
  },
11
16
  argTypes: {
12
17
  amount: {
@@ -16,6 +21,10 @@ export default {
16
21
  control: { type: 'select' },
17
22
  options: currencies.map((x) => x.name),
18
23
  },
24
+ locale: {
25
+ control: { type: 'select' },
26
+ options: locales,
27
+ },
19
28
  },
20
29
  };
21
30
 
@@ -31,12 +40,16 @@ export const Sample = {
31
40
  selectedCurrency() {
32
41
  return currencies.find((x) => x.name === this.args.currencyName);
33
42
  },
43
+ selectedLocale() {
44
+ return locales.find((x) => x === this.args.locale);
45
+ },
34
46
  },
35
47
  template: `
36
48
  <span>
37
49
  <price
38
50
  v-bind="args"
39
51
  :currency="selectedCurrency"
52
+ :locale="selectedLocale"
40
53
  />
41
54
  </span>
42
55
  `,
@@ -59,6 +72,9 @@ export const WithFraction = {
59
72
  selectedCurrency() {
60
73
  return currencies.find((x) => x.name === this.args.currencyName);
61
74
  },
75
+ selectedLocale() {
76
+ return locales.find((x) => x === this.args.locale);
77
+ },
62
78
  },
63
79
  template: `
64
80
  <span>
@@ -66,7 +82,7 @@ export const WithFraction = {
66
82
  v-bind="args"
67
83
  :currency="selectedCurrency"
68
84
  fraction="2"
69
- :show-abbreviation="true"
85
+ :locale="selectedLocale"
70
86
  />
71
87
  </span>
72
88
  `,
@@ -89,6 +105,9 @@ export const AlwaysShowFractionOn = {
89
105
  selectedCurrency() {
90
106
  return currencies.find((x) => x.name === this.args.currencyName);
91
107
  },
108
+ selectedLocale() {
109
+ return locales.find((x) => x === this.args.locale);
110
+ },
92
111
  },
93
112
  template: `
94
113
  <span>
@@ -97,7 +116,7 @@ export const AlwaysShowFractionOn = {
97
116
  :always-show-fraction="true"
98
117
  :currency="selectedCurrency"
99
118
  fraction="2"
100
- :show-abbreviation="true"
119
+ :locale="selectedLocale"
101
120
  />
102
121
  </span>
103
122
  `,
@@ -128,7 +147,7 @@ export const AlwaysShowFractionOff = {
128
147
  :always-show-fraction="false"
129
148
  :currency="selectedCurrency"
130
149
  fraction="2"
131
- :show-abbreviation="true"
150
+ :locale="selectedLocale"
132
151
  />
133
152
  </span>
134
153
  `,
@@ -151,6 +170,9 @@ export const WithSuffix = {
151
170
  selectedCurrency() {
152
171
  return currencies.find((x) => x.name === this.args.currencyName);
153
172
  },
173
+ selectedLocale() {
174
+ return locales.find((x) => x === this.args.locale);
175
+ },
154
176
  },
155
177
  template: `
156
178
  <span>
@@ -159,8 +181,8 @@ export const WithSuffix = {
159
181
  :always-show-fraction="true"
160
182
  :currency="selectedCurrency"
161
183
  fraction="2"
162
- :show-abbreviation="true"
163
184
  :suffix="suffix"
185
+ :locale="selectedLocale"
164
186
  />
165
187
  </span>
166
188
  `,
@@ -171,3 +193,100 @@ export const WithSuffix = {
171
193
  suffix: '/yr',
172
194
  },
173
195
  };
196
+
197
+ export const WithLocale = {
198
+ render: (args, { argTypes }) => {
199
+ return {
200
+ components: { Price },
201
+ props: Object.keys(argTypes),
202
+ setup() {
203
+ return { args };
204
+ },
205
+ computed: {
206
+ selectedCurrency() {
207
+ return currencies.find((x) => x.name === this.args.currencyName);
208
+ },
209
+ selectedLocale() {
210
+ return locales.find((x) => x === this.args.locale);
211
+ },
212
+ },
213
+ template: `
214
+ <span>
215
+ <price
216
+ v-bind="args"
217
+ :currency="selectedCurrency"
218
+ :locale="selectedLocale"
219
+ />
220
+ </span>
221
+ `,
222
+ };
223
+ },
224
+ args: {
225
+ amount: 22.0,
226
+ },
227
+ };
228
+
229
+ export const AllLocalesAndCurrencies = (args, { argTypes }) => {
230
+ return {
231
+ components: {
232
+ StorybookPriceComponent,
233
+ },
234
+ props: Object.keys(argTypes),
235
+ data() {
236
+ const combos = new Array(locales.length).fill(0);
237
+ combos.forEach((item, index) => {
238
+ combos[index] = new Array(currencies.length).fill(0).map((item2, index2) => ({"locale": locales[index], "currency": currencies[index2]}));
239
+ })
240
+ return {
241
+ variants: combos,
242
+ };
243
+ },
244
+ template: `
245
+ <StorybookPriceComponent
246
+ :variants="variants"/>
247
+ <StorybookPriceComponent
248
+ :variants="variants"
249
+ :show-abbreviation="true"
250
+ />
251
+ `,
252
+ };
253
+ };
254
+
255
+ const StorybookPriceComponent = defineComponent({
256
+ components: {
257
+ Price,
258
+ },
259
+ props: {
260
+ variants: {
261
+ type: Array,
262
+ required: true,
263
+ },
264
+ showAbbreviation: {
265
+ type: Boolean,
266
+ default: false,
267
+ },
268
+ },
269
+ template: `
270
+ <table class="tw-w-full">
271
+ <thead>
272
+ <tr>
273
+ <th class="tw-text-left tw-p-4 tw-bg-grayscale-400 tw-font-sans">Price</th>
274
+ </tr>
275
+ </thead>
276
+ <tbody>
277
+ <tr v-for="locale in variants" class="tw-bg-grayscale-200">
278
+ <td>{{ locale[0].locale }}</td>
279
+ <td v-for="item in locale" class="tw-p-4">
280
+ <price
281
+ :amount=10.00
282
+ :currency="item.currency"
283
+ :locale="item.locale"
284
+ :show-abbreviation="showAbbreviation"
285
+ fraction="2"
286
+ />
287
+ </td>
288
+ </tr>
289
+ </tbody>
290
+ </table>
291
+ `,
292
+ });
@@ -5,7 +5,8 @@
5
5
  </span>
6
6
  </template>
7
7
  <script>
8
- import { priceTr } from '../../../useSharedLibTranslate';
8
+
9
+ import { priceTr, formatCurrency } from "../../../useSharedLibTranslate";
9
10
 
10
11
  export default {
11
12
  props: {
@@ -24,6 +25,11 @@ export default {
24
25
  required: false,
25
26
  default: null,
26
27
  },
28
+ locale: {
29
+ type: String,
30
+ required: false,
31
+ default: null,
32
+ },
27
33
  fraction: {
28
34
  type: [Number, String],
29
35
  required: false,
@@ -66,6 +72,21 @@ export default {
66
72
  return this.free;
67
73
  }
68
74
 
75
+ if (this.locale != null)
76
+ {
77
+ const formattedCurrency = formatCurrency(
78
+ this.amount,
79
+ this.locale,
80
+ this.currency,
81
+ this.fraction,
82
+ this.showAbbreviation
83
+ );
84
+
85
+ if (formattedCurrency) {
86
+ return formattedCurrency;
87
+ }
88
+ }
89
+
69
90
  const parsedAmount = Number.parseFloat(this.amount);
70
91
 
71
92
  if (Number.isNaN(parsedAmount)) {
@@ -81,10 +102,10 @@ export default {
81
102
  return parsedAmount.toFixed(this.fraction);
82
103
  },
83
104
  currencyAbbreviation() {
84
- return this.showAbbreviation && this.amount > 0 ? this.currency?.abbreviation?.trim() : '';
105
+ return this.showAbbreviation && this.amount && !this.locale ? this.currency?.abbreviation?.trim() : '';
85
106
  },
86
107
  currencySymbol() {
87
- if (!this.amount || this.amount === 0) {
108
+ if (!this.amount || this.amount === 0 || this.locale) {
88
109
  return '';
89
110
  }
90
111
 
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <div>
3
+ <h3 class="tw-text-center tw-text-2xl tw-font-bold tw-mb-2">
4
+ {{ title }}
5
+ </h3>
6
+ <div class="tw-flex tw-justify-center tw-items-center">
7
+ <figure
8
+ class="tw-relative tw-block tw-overflow-hidden tw-max-h-full group-hover:tw-scale-105 tw-transition-all tw-h-full group-hover:tw-shadow tw-w-72"
9
+ >
10
+ <img :src="imageUrl" alt="" loading="lazy" class="tw-w-full tw-rounded-md tw-h-full" />
11
+ </figure>
12
+ </div>
13
+ <div class="tw-text-center tw-mb-5 tw-text-grayscale-600 tw-mt-2">
14
+ {{ subtitle }}
15
+ </div>
16
+ <div v-if="buttonUrl" class="tw-flex tw-gap-4 tw-mt-5">
17
+ <Button full-width variant="primary" :label="buttonLabel" classes="tw-flex-1" @click="onClick" />
18
+ </div>
19
+ </div>
20
+ </template>
21
+ <script>
22
+ import Button from '../../../atoms/components/Button/Button.vue';
23
+ import { upsellModalComponentsTr, getCurrentLocale } from '../../../useSharedLibTranslate';
24
+
25
+ export default {
26
+ components: {
27
+ Button,
28
+ },
29
+ props: {
30
+ buttonUrl: {
31
+ type: String,
32
+ required: true,
33
+ },
34
+ },
35
+ computed: {
36
+ title() {
37
+ return upsellModalComponentsTr('digitalBusinessCardTitle') || 'Create your digital business card';
38
+ },
39
+ subtitle() {
40
+ return (
41
+ upsellModalComponentsTr('digitalBusinessCardSubtitle') ||
42
+ 'Launch a digital business card that drives connections and elevates your brand'
43
+ );
44
+ },
45
+ imageUrl() {
46
+ const locale = getCurrentLocale().toLowerCase();
47
+ return `https://bcassetcdn.com/assets/images/modal/website-xsell-digital-business-card@2x.${locale}.png`;
48
+ },
49
+ buttonLabel() {
50
+ return upsellModalComponentsTr('getStartedLabel') || 'Get Started';
51
+ },
52
+ },
53
+ methods: {
54
+ onClick() {
55
+ this.$emit('on-button-click');
56
+
57
+ if (this.buttonUrl) {
58
+ window.location.href = this.buttonUrl;
59
+ }
60
+ },
61
+ },
62
+ };
63
+ </script>
@@ -0,0 +1,62 @@
1
+ <template>
2
+ <div>
3
+ <h3 class="tw-text-center tw-text-2xl tw-font-bold tw-mb-2">
4
+ {{ title }}
5
+ </h3>
6
+ <div class="tw-flex tw-justify-center tw-items-center">
7
+ <figure
8
+ class="tw-relative tw-block tw-overflow-hidden tw-max-h-full group-hover:tw-scale-105 tw-transition-all tw-h-full group-hover:tw-shadow tw-w-72"
9
+ >
10
+ <img :src="imageUrl" alt="" loading="lazy" class="tw-w-full tw-rounded-md tw-h-full" />
11
+ </figure>
12
+ </div>
13
+ <div class="tw-text-center tw-mb-5 tw-text-grayscale-600 tw-mt-2">
14
+ {{ subtitle }}
15
+ </div>
16
+ <div v-if="buttonUrl" class="tw-flex tw-gap-4 tw-mt-5">
17
+ <Button full-width variant="primary" :label="buttonLabel" classes="tw-flex-1" @click="onClick" />
18
+ </div>
19
+ </div>
20
+ </template>
21
+ <script>
22
+ import Button from '../../../atoms/components/Button/Button.vue';
23
+ import { upsellModalComponentsTr, getCurrentLocale } from '../../../useSharedLibTranslate';
24
+
25
+ export default {
26
+ components: {
27
+ Button,
28
+ },
29
+ props: {
30
+ buttonUrl: {
31
+ type: String,
32
+ required: true,
33
+ },
34
+ },
35
+ computed: {
36
+ title() {
37
+ return upsellModalComponentsTr('linkInBioTitle') || 'Create your Link in Bio';
38
+ },
39
+ subtitle() {
40
+ return (
41
+ upsellModalComponentsTr('linkInBioSubtitle') || 'Launch a link in bio that drives connections and elevates'
42
+ );
43
+ },
44
+ imageUrl() {
45
+ const locale = getCurrentLocale().toLowerCase();
46
+ return `https://bcassetcdn.com/assets/images/modal/website-xsell-link-in-bio@2x.${locale}.png`;
47
+ },
48
+ buttonLabel() {
49
+ return upsellModalComponentsTr('getStartedLabel') || 'Get Started';
50
+ },
51
+ },
52
+ methods: {
53
+ onClick() {
54
+ this.$emit('on-button-click');
55
+
56
+ if (this.buttonUrl) {
57
+ window.location.href = this.buttonUrl;
58
+ }
59
+ },
60
+ },
61
+ };
62
+ </script>
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <div>
3
+ <h3 class="tw-text-center tw-text-2xl tw-font-bold tw-mb-2">
4
+ {{ title }}
5
+ </h3>
6
+ <div class="tw-flex tw-justify-center tw-items-center">
7
+ <figure
8
+ class="tw-relative tw-block tw-overflow-hidden tw-max-h-full group-hover:tw-scale-105 tw-transition-all tw-h-full group-hover:tw-shadow tw-w-72"
9
+ >
10
+ <img :src="imageUrl" alt="" loading="lazy" class="tw-w-full tw-rounded-md tw-h-full" />
11
+ </figure>
12
+ </div>
13
+ <div class="tw-text-center tw-mb-5 tw-text-grayscale-600 tw-mt-2">
14
+ {{ subtitle }}
15
+ </div>
16
+ <div v-if="buttonUrl" class="tw-flex tw-gap-4 tw-mt-5">
17
+ <Button full-width variant="primary" :label="buttonLabel" classes="tw-flex-1" @click="onClick" />
18
+ </div>
19
+ </div>
20
+ </template>
21
+ <script>
22
+ import Button from '../../../atoms/components/Button/Button.vue';
23
+ import { upsellModalComponentsTr, getCurrentLocale } from '../../../useSharedLibTranslate';
24
+
25
+ export default {
26
+ components: {
27
+ Button,
28
+ },
29
+ props: {
30
+ buttonUrl: {
31
+ type: String,
32
+ required: true,
33
+ },
34
+ },
35
+ computed: {
36
+ title() {
37
+ return upsellModalComponentsTr('upgradeWebsiteTitle') || 'Upgrade to premium website';
38
+ },
39
+ subtitle() {
40
+ return upsellModalComponentsTr('upgradeWebsiteSubtitle') || 'Unlock all advanced features for more flexibility';
41
+ },
42
+ imageUrl() {
43
+ const locale = getCurrentLocale().toLowerCase();
44
+ return `https://bcassetcdn.com/assets/images/modal/onboarding-upsell-website@2x.${locale}.png`;
45
+ },
46
+ buttonLabel() {
47
+ return upsellModalComponentsTr('upgradeNowLabel') || 'Upgrade Now';
48
+ },
49
+ },
50
+ methods: {
51
+ onClick() {
52
+ this.$emit('on-button-click');
53
+
54
+ if (this.buttonUrl) {
55
+ window.location.href = this.buttonUrl;
56
+ }
57
+ },
58
+ },
59
+ };
60
+ </script>
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <div>
3
+ <h3 class="tw-text-center tw-text-2xl tw-font-bold tw-mb-2">
4
+ {{ title }}
5
+ </h3>
6
+ <div class="tw-flex tw-justify-center tw-items-center">
7
+ <figure
8
+ class="tw-relative tw-block tw-overflow-hidden tw-max-h-full group-hover:tw-scale-105 tw-transition-all tw-h-full group-hover:tw-shadow tw-w-72"
9
+ >
10
+ <img :src="imageUrl" alt="" loading="lazy" class="tw-w-full tw-rounded-md tw-h-full" />
11
+ </figure>
12
+ </div>
13
+ <div class="tw-text-center tw-mb-5 tw-text-grayscale-600 tw-mt-2">
14
+ {{ subtitle }}
15
+ </div>
16
+ <div v-if="buttonUrl" class="tw-flex tw-gap-4 tw-mt-5">
17
+ <Button full-width variant="primary" :label="buttonLabel" classes="tw-flex-1" @click="onClick" />
18
+ </div>
19
+ </div>
20
+ </template>
21
+ <script>
22
+ import Button from '../../../atoms/components/Button/Button.vue';
23
+ import { upsellModalComponentsTr, getCurrentLocale } from '../../../useSharedLibTranslate';
24
+
25
+ export default {
26
+ components: {
27
+ Button,
28
+ },
29
+ props: {
30
+ buttonUrl: {
31
+ type: String,
32
+ required: true,
33
+ },
34
+ },
35
+ computed: {
36
+ title() {
37
+ return upsellModalComponentsTr('webSupportTitle') || 'Get Professional Web Design Support';
38
+ },
39
+ subtitle() {
40
+ return (
41
+ upsellModalComponentsTr('webSupportSubtitle') ||
42
+ 'Our professional web design team will help you build and get the most out of your website'
43
+ );
44
+ },
45
+ imageUrl() {
46
+ const locale = getCurrentLocale().toLowerCase();
47
+ return `https://bcassetcdn.com/assets/images/modal/brandpage-design-support@2x.${locale}.png`;
48
+ },
49
+ buttonLabel() {
50
+ return upsellModalComponentsTr('webDesignButtonLabel') || 'Get Web Design Support';
51
+ },
52
+ },
53
+ methods: {
54
+ onClick() {
55
+ this.$emit('on-button-click');
56
+
57
+ if (this.buttonUrl) {
58
+ window.location.href = this.buttonUrl;
59
+ }
60
+ },
61
+ },
62
+ };
63
+ </script>
@@ -0,0 +1,17 @@
1
+ {
2
+ "upsellModalComponents" : {
3
+ "getStartedLabel" : "Los geht’s",
4
+ "upgradeNowLabel" : "Jetzt upgraden",
5
+ "linkInBioTitle" : "BIO-LINK-SEITE ERSTELLEN",
6
+ "linkInBioSubtitle" : "Erstellen Sie einen Bio-Link, mit dem Sie neue Kontakte knüpfen und Ihre Marke stärken",
7
+ "webSupportTitle" : "Professionelle Unterstützung für Webdesign anfordern",
8
+ "webSupportSubtitle" : "Unser professionelles Webdesign-Team unterstützt Sie beim Aufbau und der Optimierung Ihrer Website",
9
+ "webDesignButtonLabel" : "Webdesign-Unterstützung anfordern",
10
+ "digitalBusinessCardTitle" : "Erstellen Sie Ihre digitale Visitenkarte",
11
+ "digitalBusinessCardSubtitle" : "Erstellen Sie eine digitale Visitenkarte, mit der Sie neue Kontakte knüpfen und Ihre Marke stärken",
12
+ "upgradeWebsiteTitle" : "Auf Premium-Website upgraden",
13
+ "upgradeWebsiteSubtitle" : "Schalten Sie alle erweiterten Funktionen für mehr Flexibilität frei",
14
+ "legalZoomTitle" : "Launchen Sie kostenlos Ihre eigene LLC",
15
+ "legalZoomSubtitle" : "In Zusammenarbeit mit LegalZoom können Sie jetzt kostenlos eine eigene LLC gründen."
16
+ }
17
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "upsellModalComponents" : {
3
+ "getStartedLabel" : "Comienza",
4
+ "upgradeNowLabel" : "Hazte prémium ya",
5
+ "linkInBioTitle" : "CREA TU ENLACE A LA BIO",
6
+ "linkInBioSubtitle" : "Lanza un enlace en tu biografía que impulse las conexiones y eleve tu presencia",
7
+ "webSupportTitle" : "Obtén soporte profesional en diseño web",
8
+ "webSupportSubtitle" : "Nuestro equipo profesional de diseño web te ayudará a crear y sacar el máximo partido a tu sitio web",
9
+ "webDesignButtonLabel" : "Obtén soporte de diseño web",
10
+ "digitalBusinessCardTitle" : "Crea tu tarjeta de visita digital",
11
+ "digitalBusinessCardSubtitle" : "Lanza una tarjeta de visita digital que impulse las conexiones y eleve tu marca",
12
+ "upgradeWebsiteTitle" : "Pásate a un sitio web prémium",
13
+ "upgradeWebsiteSubtitle" : "Accede a todas las funciones avanzadas para disfrutar de mayor flexibilidad",
14
+ "legalZoomTitle" : "Inicia tu LLC gratis",
15
+ "legalZoomSubtitle" : "En colaboración con LegalZoom, inicia tu LLC gratis"
16
+ }
17
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "upsellModalComponents" : {
3
+ "getStartedLabel" : "Commencez",
4
+ "upgradeNowLabel" : "Mettre à niveau maintenant",
5
+ "linkInBioTitle" : "CRÉEZ VOTRE LIEN DANS LA BIO",
6
+ "linkInBioSubtitle" : "Lancez un lien dans la bio qui favorise les connexions et booste",
7
+ "webSupportTitle" : "Profitez d'une assistance professionnelle à la conception de sites Web",
8
+ "webSupportSubtitle" : "Notre équipe professionnelle de conception de sites Web vous aidera à créer votre site Web et à en tirer le meilleur parti.",
9
+ "webDesignButtonLabel" : "Assistance Web",
10
+ "digitalBusinessCardTitle" : "Créez votre carte de visite numérique",
11
+ "digitalBusinessCardSubtitle" : "Profitez d'une carte de visite numérique qui favorise les connexions et booste votre marque",
12
+ "upgradeWebsiteTitle" : "Passez à un site Web premium",
13
+ "upgradeWebsiteSubtitle" : "Débloquez toutes les fonctionnalités avancées pour plus de flexibilité",
14
+ "legalZoomTitle" : "Créez votre entreprise gratuitement",
15
+ "legalZoomSubtitle" : "En partenariat avec LegalZoom, créez votre entreprise gratuitement"
16
+ }
17
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "upsellModalComponents": {
3
+ "getStartedLabel": "Get Started",
4
+ "upgradeNowLabel": "Upgrade Now",
5
+ "linkInBioTitle": "Create your Link in Bio",
6
+ "linkInBioSubtitle": "Launch a link in bio that drives connections and elevates",
7
+ "webSupportTitle": "Get Professional Web Design Support",
8
+ "webSupportSubtitle": "Our professional web design team will help you build and get the most out of your website",
9
+ "webDesignButtonLabel": "Get Web Design Support",
10
+ "digitalBusinessCardTitle": "Create your digital business card",
11
+ "digitalBusinessCardSubtitle": "Launch a digital business card that drives connections and elevates your brand",
12
+ "upgradeWebsiteTitle": "Upgrade to premium website",
13
+ "upgradeWebsiteSubtitle": "Unlock all advanced features for more flexibility",
14
+ "legalZoomTitle": "Start your LLC for free",
15
+ "legalZoomSubtitle": "In partnership with LegalZoom, kickstart your LLC for free"
16
+ }
17
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "upsellModalComponents" : {
3
+ "getStartedLabel" : "Comece",
4
+ "upgradeNowLabel" : "Faça upgrade agora",
5
+ "linkInBioTitle" : "CRIAR LINK NA BIOGRAFIA",
6
+ "linkInBioSubtitle" : "Lance um link na bio que promova ligações e eleve",
7
+ "webSupportTitle" : "Obter apoio profissional ao web design",
8
+ "webSupportSubtitle" : "A nossa equipa profissional de design Web design vai ajudar a construir e a tirar o máximo partido do seu website.",
9
+ "webDesignButtonLabel" : "Obter apoio ao web design",
10
+ "digitalBusinessCardTitle" : "Crie o seu Cartão de Visita Digital",
11
+ "digitalBusinessCardSubtitle" : "Lance um cartão de visita digital que promove ligações e eleva a sua marca",
12
+ "upgradeWebsiteTitle" : "Upgrade para Website premium",
13
+ "upgradeWebsiteSubtitle" : "Desbloqueie todas as funcionalidades avançadas para maior flexibilidade",
14
+ "legalZoomTitle" : "Crie a sua sociedade gratuitamente",
15
+ "legalZoomSubtitle" : "Em parceria com a LegalZoom, crie a sua sociedade gratuitamente"
16
+ }
17
+ }
@@ -3,6 +3,21 @@
3
3
  "domainCreditUsed": "Verwendetes Domain-Guthaben",
4
4
  "free": "Kostenlos"
5
5
  },
6
+ "upsellModalComponents": {
7
+ "getStartedLabel": "Los geht’s",
8
+ "upgradeNowLabel": "Jetzt upgraden",
9
+ "linkInBioTitle": "BIO-LINK-SEITE ERSTELLEN",
10
+ "linkInBioSubtitle": "Erstellen Sie einen Bio-Link, mit dem Sie neue Kontakte knüpfen und Ihre Marke stärken",
11
+ "webSupportTitle": "Professionelle Unterstützung für Webdesign anfordern",
12
+ "webSupportSubtitle": "Unser professionelles Webdesign-Team unterstützt Sie beim Aufbau und der Optimierung Ihrer Website",
13
+ "webDesignButtonLabel": "Webdesign-Unterstützung anfordern",
14
+ "digitalBusinessCardTitle": "Erstellen Sie Ihre digitale Visitenkarte",
15
+ "digitalBusinessCardSubtitle": "Erstellen Sie eine digitale Visitenkarte, mit der Sie neue Kontakte knüpfen und Ihre Marke stärken",
16
+ "upgradeWebsiteTitle": "Auf Premium-Website upgraden",
17
+ "upgradeWebsiteSubtitle": "Schalten Sie alle erweiterten Funktionen für mehr Flexibilität frei",
18
+ "legalZoomTitle": "Launchen Sie kostenlos Ihre eigene LLC",
19
+ "legalZoomSubtitle": "In Zusammenarbeit mit LegalZoom können Sie jetzt kostenlos eine eigene LLC gründen."
20
+ },
6
21
  "sharedPaymentConfig": {
7
22
  "onboardingIncomplete": "Das Onboarding wurde noch nicht abgeschlossen.",
8
23
  "pendingVerification": "Ausstehende Verifizierung",
@@ -3,6 +3,21 @@
3
3
  "domainCreditUsed": "Crédito del dominio usado",
4
4
  "free": "Gratis"
5
5
  },
6
+ "upsellModalComponents": {
7
+ "getStartedLabel": "Comienza",
8
+ "upgradeNowLabel": "Hazte prémium ya",
9
+ "linkInBioTitle": "CREA TU ENLACE A LA BIO",
10
+ "linkInBioSubtitle": "Lanza un enlace en tu biografía que impulse las conexiones y eleve tu presencia",
11
+ "webSupportTitle": "Obtén soporte profesional en diseño web",
12
+ "webSupportSubtitle": "Nuestro equipo profesional de diseño web te ayudará a crear y sacar el máximo partido a tu sitio web",
13
+ "webDesignButtonLabel": "Obtén soporte de diseño web",
14
+ "digitalBusinessCardTitle": "Crea tu tarjeta de visita digital",
15
+ "digitalBusinessCardSubtitle": "Lanza una tarjeta de visita digital que impulse las conexiones y eleve tu marca",
16
+ "upgradeWebsiteTitle": "Pásate a un sitio web prémium",
17
+ "upgradeWebsiteSubtitle": "Accede a todas las funciones avanzadas para disfrutar de mayor flexibilidad",
18
+ "legalZoomTitle": "Inicia tu LLC gratis",
19
+ "legalZoomSubtitle": "En colaboración con LegalZoom, inicia tu LLC gratis"
20
+ },
6
21
  "sharedPaymentConfig": {
7
22
  "onboardingIncomplete": "Incorporación incompleta",
8
23
  "pendingVerification": "Pendiente de verificación",
@@ -3,6 +3,21 @@
3
3
  "domainCreditUsed": "Crédit de domaine utilisé",
4
4
  "free": "Gratuit"
5
5
  },
6
+ "upsellModalComponents": {
7
+ "getStartedLabel": "Commencez",
8
+ "upgradeNowLabel": "Mettre à niveau maintenant",
9
+ "linkInBioTitle": "CRÉEZ VOTRE LIEN DANS LA BIO",
10
+ "linkInBioSubtitle": "Lancez un lien dans la bio qui favorise les connexions et booste",
11
+ "webSupportTitle": "Profitez d'une assistance professionnelle à la conception de sites Web",
12
+ "webSupportSubtitle": "Notre équipe professionnelle de conception de sites Web vous aidera à créer votre site Web et à en tirer le meilleur parti.",
13
+ "webDesignButtonLabel": "Assistance Web",
14
+ "digitalBusinessCardTitle": "Créez votre carte de visite numérique",
15
+ "digitalBusinessCardSubtitle": "Profitez d'une carte de visite numérique qui favorise les connexions et booste votre marque",
16
+ "upgradeWebsiteTitle": "Passez à un site Web premium",
17
+ "upgradeWebsiteSubtitle": "Débloquez toutes les fonctionnalités avancées pour plus de flexibilité",
18
+ "legalZoomTitle": "Créez votre entreprise gratuitement",
19
+ "legalZoomSubtitle": "En partenariat avec LegalZoom, créez votre entreprise gratuitement"
20
+ },
6
21
  "sharedPaymentConfig": {
7
22
  "onboardingIncomplete": "Inscription incomplète",
8
23
  "pendingVerification": "Vérification en attente",
@@ -3,6 +3,21 @@
3
3
  "domainCreditUsed": "Domain credit used",
4
4
  "free": "Free"
5
5
  },
6
+ "upsellModalComponents": {
7
+ "getStartedLabel": "Get Started",
8
+ "upgradeNowLabel": "Upgrade Now",
9
+ "linkInBioTitle": "Create your Link in Bio",
10
+ "linkInBioSubtitle": "Launch a link in bio that drives connections and elevates",
11
+ "webSupportTitle": "Get Professional Web Design Support",
12
+ "webSupportSubtitle": "Our professional web design team will help you build and get the most out of your website",
13
+ "webDesignButtonLabel": "Get Web Design Support",
14
+ "digitalBusinessCardTitle": "Create your digital business card",
15
+ "digitalBusinessCardSubtitle": "Launch a digital business card that drives connections and elevates your brand",
16
+ "upgradeWebsiteTitle": "Upgrade to premium website",
17
+ "upgradeWebsiteSubtitle": "Unlock all advanced features for more flexibility",
18
+ "legalZoomTitle": "Start your LLC for free",
19
+ "legalZoomSubtitle": "In partnership with LegalZoom, kickstart your LLC for free"
20
+ },
6
21
  "sharedPaymentConfig": {
7
22
  "onboardingIncomplete": "Onboarding Incomplete",
8
23
  "pendingVerification": "Pending Verification",
@@ -3,6 +3,21 @@
3
3
  "domainCreditUsed": "Crédito de domínio utilizado",
4
4
  "free": "Grátis"
5
5
  },
6
+ "upsellModalComponents": {
7
+ "getStartedLabel": "Comece",
8
+ "upgradeNowLabel": "Faça upgrade agora",
9
+ "linkInBioTitle": "CRIAR LINK NA BIOGRAFIA",
10
+ "linkInBioSubtitle": "Lance um link na bio que promova ligações e eleve",
11
+ "webSupportTitle": "Obter apoio profissional ao web design",
12
+ "webSupportSubtitle": "A nossa equipa profissional de design Web design vai ajudar a construir e a tirar o máximo partido do seu website.",
13
+ "webDesignButtonLabel": "Obter apoio ao web design",
14
+ "digitalBusinessCardTitle": "Crie o seu Cartão de Visita Digital",
15
+ "digitalBusinessCardSubtitle": "Lance um cartão de visita digital que promove ligações e eleva a sua marca",
16
+ "upgradeWebsiteTitle": "Upgrade para Website premium",
17
+ "upgradeWebsiteSubtitle": "Desbloqueie todas as funcionalidades avançadas para maior flexibilidade",
18
+ "legalZoomTitle": "Crie a sua sociedade gratuitamente",
19
+ "legalZoomSubtitle": "Em parceria com a LegalZoom, crie a sua sociedade gratuitamente"
20
+ },
6
21
  "sharedPaymentConfig": {
7
22
  "onboardingIncomplete": "Integração incompleta",
8
23
  "pendingVerification": "Verificação Pendente",
@@ -1,5 +1,6 @@
1
1
  import Card from './PublishBrandPageCard.vue';
2
2
  import PublishBrandPageModal from './PublishBrandPageModal.vue';
3
+ import UpgradeWebsite from '../../../atoms/components/Upsell/UpgradeWebsite.vue';
3
4
  import { domains } from './__fixtures__/data';
4
5
  import { setSharedLibLocaleAsync } from '../../../useSharedLibTranslate';
5
6
 
@@ -224,3 +225,43 @@ export const Free = () => {
224
225
  };
225
226
 
226
227
  Free.loaders = [loadTranslationAsync];
228
+
229
+ export const PublishedNoDomainsABtestUpgrade = () => {
230
+ return {
231
+ components: {
232
+ PublishBrandPageModal,
233
+ UpgradeWebsite
234
+ },
235
+ data() {
236
+ return {
237
+ domains: [],
238
+ upgradeProps: {
239
+ title: 'Upgrade to premium website',
240
+ subtitle: 'Unlock all advanced features for more flexibility',
241
+ imageUrl: 'https://bcassetcdn.com/assets/images/modal/onboarding-upsell-website@2x.en-us.png',
242
+ },
243
+ };
244
+ },
245
+ template: `
246
+ <PublishBrandPageModal
247
+ visible
248
+ :is-design-com="false"
249
+ is-published
250
+ should-publish
251
+ :domains="domains"
252
+ brand-page-display-name='Website'
253
+ brand-page-slug='test-slug'
254
+ brand-page-base-url="https://brand.site"
255
+ radio-value="slug"
256
+ show-upsell-rotation
257
+ brand-page-url="https://brand.site/test-slug">
258
+ <template #upsellContainer>
259
+ <UpgradeWebsite
260
+ button-url="https://example.com/upgrade"
261
+ />
262
+ </PublishBrandPageModal>
263
+ `,
264
+ };
265
+ };
266
+
267
+ PublishedNoDomainsABtestUpgrade.loaders = [loadTranslationAsync];
@@ -1,26 +1,38 @@
1
1
  <template>
2
2
  <div class="publish-bp--container">
3
3
  <Modal
4
- classes="publish-bp--modal tw-px-2 md:tw-px-8"
4
+ classes="publish-bp--modal tw-pt-4"
5
5
  close-on-esc
6
6
  :visible="visible"
7
7
  :hide-scrollbar="false"
8
8
  :show-modal-background-image="showModalBackgroundImage"
9
9
  :content-classes="isBusy ? ['tw-overflow-y-hidden'] : []"
10
+ :remove-horizontal-padding="showUpsellRotation && !isCustomDomainActive && !hasPurchasedDomains"
11
+ :class="{
12
+ 'tw-px-2 md:tw-px-8': !showUpsellRotation && isCustomDomainActive && hasPurchasedDomains,
13
+ }"
10
14
  @close-modal="onCloseModal"
11
15
  >
12
16
  <template #header>
13
17
  <div v-if="isNotPublished || isSlugEditMode" class="tw-text-center tw-font-bold tw-mb-8 tw-mt-8 tw-text-4xl">
14
18
  <span>{{ firstTimePublishHeaderLabel }}</span>
15
19
  </div>
16
- <div v-if="isPublished && !isSlugEditMode" class="tw-text-center tw-font-bold tw-mb-8 tw-mt-8">
20
+ <div
21
+ v-if="isPublished && !isSlugEditMode"
22
+ class="tw-text-center tw-font-bold tw-mt-8"
23
+ :class="{
24
+ 'tw-mb-8 ': !showUpsellRotation,
25
+ }"
26
+ >
17
27
  <p class="tw-font-bold tw-text-black tw-mb-2 tw-text-4xl">{{ sitePublishedLabel }}</p>
18
- <p v-if="hasPurchasedDomains || isCustomDomainActive" class="tw-text-grayscale-600 tw-mb-8">
19
- {{ publishSuccessLabel }}
20
- </p>
21
- <p v-else class="tw-text-grayscale-600 tw-mb-8 tw-font-normal">
22
- {{ publishedSuccessDescriptionLabel }}
23
- </p>
28
+ <div v-if="!showUpsellRotation">
29
+ <p v-if="hasPurchasedDomains || isCustomDomainActive" class="tw-text-grayscale-600 tw-mb-8">
30
+ {{ publishSuccessLabel }}
31
+ </p>
32
+ <p v-else class="tw-text-grayscale-600 tw-mb-8 tw-font-normal">
33
+ {{ publishedSuccessDescriptionLabel }}
34
+ </p>
35
+ </div>
24
36
  </div>
25
37
  </template>
26
38
  <template #default>
@@ -188,24 +200,21 @@
188
200
  </div>
189
201
  <div v-else class="tw-font-sans">
190
202
  <div v-if="!isCustomDomainActive && !hasPurchasedDomains" class="tw-mb-6 tw-text-left">
191
- <div class="tw-mb-6">
192
- <SellDomainNameSearchWithResults
193
- :is-design-com="isDesignCom"
194
- :initial-search-term="searchText"
195
- :currency="userCurrency"
196
- :display-result-limit="4"
197
- :domain-search-location="sitePublishedModal"
198
- @on-change-search="onSearchTextChanged"
199
- @on-buy-now-click="onBuyNowClick"
200
- />
203
+ <div v-if="!showUpsellRotation">
204
+ <div class="tw-mb-6">
205
+ <SellDomainNameSearchWithResults
206
+ :is-design-com="isDesignCom"
207
+ :initial-search-term="searchText"
208
+ :currency="userCurrency"
209
+ :display-result-limit="4"
210
+ :domain-search-location="sitePublishedModal"
211
+ show-view-more-button
212
+ @on-change-search="onSearchTextChanged"
213
+ @on-buy-now-click="onBuyNowClick"
214
+ @on-view-more="onViewMore"
215
+ />
216
+ </div>
201
217
  </div>
202
- <Button
203
- :label="viewMoreDomainLabel"
204
- variant="no-border"
205
- size="small-medium"
206
- class="tw-text-center"
207
- @on-click="onViewMore"
208
- />
209
218
  </div>
210
219
  <div class="tw-px-4 tw-text-center" :class="{ 'lg:tw-px-20': hasPurchasedDomains }">
211
220
  <TextCopyField
@@ -230,6 +239,9 @@
230
239
  @on-click="onBrandPageUrlClick"
231
240
  />
232
241
  </div>
242
+ <div v-if="showUpsellRotation" class="tw-border-t tw-border-solid tw-border-grayscale-500 tw-p-5">
243
+ <slot name="upsellContainer" />
244
+ </div>
233
245
  </div>
234
246
  </template>
235
247
  </Modal>
@@ -403,6 +415,16 @@ export default {
403
415
  required: true,
404
416
  default: '',
405
417
  },
418
+ showUpsellRotation: {
419
+ type: Boolean,
420
+ required: true,
421
+ default: false,
422
+ },
423
+ selectedUpsellProp: {
424
+ type: Object,
425
+ required: true,
426
+ default: null,
427
+ },
406
428
  },
407
429
  emits: [
408
430
  'close-modal',
@@ -22,6 +22,14 @@
22
22
  :domain-search-location="domainSearchLocation"
23
23
  @on-buy-now-click="onBuyNowClick"
24
24
  />
25
+ <Button
26
+ v-if="showViewMoreButton"
27
+ :label="viewMoreDomainLabel"
28
+ variant="no-border"
29
+ size="small-medium"
30
+ class="tw-text-center tw-pt-6"
31
+ @on-click="onViewMore"
32
+ />
25
33
  </div>
26
34
  </template>
27
35
  <script>
@@ -30,6 +38,8 @@ import SellDomainNameSearchResult from '../SellDomainNameSearchResult/SellDomain
30
38
 
31
39
  import brandCrowdApiClient from '../../clients/brand-crowd-api.client';
32
40
  import Events from '../../constants/event-constants';
41
+ import { publishBrandPageModalTr } from '../../../useSharedLibTranslate';
42
+ import Button from '../../../atoms/components/Button/Button.vue';
33
43
 
34
44
  const TEXT_CHANGED_PARAM = 'textChanged';
35
45
 
@@ -37,6 +47,7 @@ export default {
37
47
  components: {
38
48
  SellDomainNameSearch,
39
49
  SellDomainNameSearchResult,
50
+ Button,
40
51
  },
41
52
  props: {
42
53
  currency: {
@@ -101,6 +112,16 @@ export default {
101
112
  type: Number,
102
113
  default: undefined,
103
114
  },
115
+ showViewMoreButton: {
116
+ type: Boolean,
117
+ default: false,
118
+ },
119
+ },
120
+ setup() {
121
+ return {
122
+ publishBrandPageModalTr,
123
+ viewMoreDomainLabel: publishBrandPageModalTr('viewMoreDomainLabel'),
124
+ };
104
125
  },
105
126
  data: () => ({
106
127
  domainNameItems: undefined,
@@ -184,6 +205,9 @@ export default {
184
205
  const urlParams = new URLSearchParams(window.location.search);
185
206
  return urlParams.get(TEXT_CHANGED_PARAM)?.toUpperCase() === 'TRUE' || false;
186
207
  },
208
+ onViewMore() {
209
+ this.$emit('on-view-more');
210
+ },
187
211
  },
188
212
  };
189
213
  </script>
@@ -63,10 +63,48 @@ const sharedPaymentConfigTr = (key, valuesToInterpolate = {}) => tr(`sharedPayme
63
63
 
64
64
  const priceTr = (key, valuesToInterpolate = {}) => tr(`price.${key}`, valuesToInterpolate);
65
65
 
66
+ const upsellModalComponentsTr = (key, valuesToInterpolate = {}) => tr(`upsellModalComponents.${key}`, valuesToInterpolate);
67
+
66
68
  const getCurrentLocale = () => {
67
69
  return i18next.language || 'en-US';
68
70
  };
69
71
 
72
+ const formatCurrency = (amount, locale, currency, fraction = 0, showAbbreviation = false) => {
73
+ let localeAmount = i18next.t('{{val, currency}}', {
74
+ ns: 'fe-shared-lib',
75
+ val: amount,
76
+ currency: currency.iso4127Code,
77
+ locale: locale,
78
+ maximumFractionDigits: fraction,
79
+ useGrouping: false,
80
+ });
81
+
82
+ const abbreviationTrimmed = currency.abbreviation.trim();
83
+ const symbolTrimmed = currency.symbol.trim();
84
+
85
+ // i18next always uses iso code for some locale/currency combos like ZAR, prefer symbol over iso code
86
+ if (localeAmount.includes(currency.iso4127Code)) {
87
+ localeAmount = localeAmount.replace(currency.iso4127Code, symbolTrimmed);
88
+ }
89
+
90
+ // show abbreviation locale logic
91
+ // note: showAbbreviation is only passed as true for symbol = "$"
92
+ if (currency.symbol.trim() !== '$') {
93
+ return localeAmount;
94
+ }
95
+
96
+ const altAudAbbreviation = 'AU';
97
+ if (showAbbreviation && !localeAmount.includes(abbreviationTrimmed)) {
98
+ return localeAmount.replace(symbolTrimmed, `${abbreviationTrimmed}${symbolTrimmed}`);
99
+ } else if (!showAbbreviation && localeAmount.includes(altAudAbbreviation)) {
100
+ return localeAmount.replace(altAudAbbreviation, '');
101
+ } else if (!showAbbreviation && localeAmount.includes(abbreviationTrimmed)) {
102
+ return localeAmount.replace(abbreviationTrimmed, '');
103
+ }
104
+
105
+ return localeAmount;
106
+ }
107
+
70
108
  export {
71
109
  setSharedLibLocaleAsync,
72
110
  getCurrentLocale,
@@ -81,4 +119,6 @@ export {
81
119
  uploadYourLogoTr,
82
120
  sharedPaymentConfigTr,
83
121
  priceTr,
122
+ upsellModalComponentsTr,
123
+ formatCurrency,
84
124
  };