@designcrowd/fe-shared-lib 1.5.34 → 1.5.36

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 (36) hide show
  1. package/dist/css/tailwind-brandCrowd.css +2 -65
  2. package/dist/css/tailwind-brandPage.css +3 -54
  3. package/dist/css/tailwind-crazyDomains.css +2 -65
  4. package/dist/css/tailwind-designCom.css +2 -65
  5. package/dist/css/tailwind-designCrowd.css +2 -65
  6. package/docs/plans/DY-957-plan-phase-2-fe-shared-lib.md +382 -0
  7. package/package.json +1 -1
  8. package/public/css/tailwind-brandCrowd.css +2472 -0
  9. package/public/css/tailwind-brandPage.css +2156 -0
  10. package/public/css/tailwind-crazyDomains.css +2472 -0
  11. package/public/css/tailwind-designCom.css +2472 -0
  12. package/public/css/tailwind-designCrowd.css +2472 -0
  13. package/src/atoms/components/Icon/Icon.vue +4 -0
  14. package/src/atoms/components/Icon/icons/history.vue +12 -0
  15. package/src/atoms/components/Icon/icons/save.vue +6 -0
  16. package/src/bundles/bundled-translations.de-DE.json +3 -1
  17. package/src/bundles/bundled-translations.es-ES.json +3 -1
  18. package/src/bundles/bundled-translations.fr-CA.json +3 -1
  19. package/src/bundles/bundled-translations.fr-FR.json +3 -1
  20. package/src/bundles/bundled-translations.json +3 -1
  21. package/src/bundles/bundled-translations.pt-BR.json +3 -1
  22. package/src/bundles/bundled-translations.pt-PT.json +3 -1
  23. package/src/experiences/clients/brand-crowd-api.client.js +18 -0
  24. package/src/experiences/components/UploadYourLogoApplication/UploadYourLogoApplication.stories.js +49 -0
  25. package/src/experiences/components/UploadYourLogoApplication/UploadYourLogoApplication.vue +28 -0
  26. package/src/experiences/components/UploadYourLogoOnBoarding/LogoKeywords.stories.js +65 -0
  27. package/src/experiences/components/UploadYourLogoOnBoarding/LogoKeywords.vue +156 -0
  28. package/src/experiences/components/UploadYourLogoOnBoarding/UploadYourLogoOnBoarding.vue +61 -9
  29. package/src/experiences/components/UploadYourLogoOnBoarding/i18n/upload-your-logo.de-DE.json +34 -31
  30. package/src/experiences/components/UploadYourLogoOnBoarding/i18n/upload-your-logo.es-ES.json +34 -31
  31. package/src/experiences/components/UploadYourLogoOnBoarding/i18n/upload-your-logo.fr-CA.json +34 -31
  32. package/src/experiences/components/UploadYourLogoOnBoarding/i18n/upload-your-logo.fr-FR.json +34 -31
  33. package/src/experiences/components/UploadYourLogoOnBoarding/i18n/upload-your-logo.json +3 -1
  34. package/src/experiences/components/UploadYourLogoOnBoarding/i18n/upload-your-logo.pt-BR.json +34 -31
  35. package/src/experiences/components/UploadYourLogoOnBoarding/i18n/upload-your-logo.pt-PT.json +34 -31
  36. package/src/experiences/constants/api.js +1 -0
@@ -138,6 +138,7 @@ import IconHamburger2 from './icons/hamburger-2.vue';
138
138
  import IconHamburger3 from './icons/hamburger-3.vue';
139
139
  import IconHamburger4 from './icons/hamburger-4.vue';
140
140
  import IconHamburger from './icons/hamburger.vue';
141
+ import IconHistory from './icons/history.vue';
141
142
  import IconHome from './icons/home.vue';
142
143
  import IconImageGalleryCarousel from './icons/image-gallery-carousel.vue';
143
144
  import IconImageGalleryGrid from './icons/image-gallery-grid.vue';
@@ -264,6 +265,7 @@ import IconReload from './icons/reload.vue';
264
265
  import IconReorderable from './icons/reorderable.vue';
265
266
  import IconRequestPayment from './icons/request-payment.vue';
266
267
  import IconResize from './icons/resize.vue';
268
+ import IconSave from './icons/save.vue';
267
269
  import IconSearch from './icons/search.vue';
268
270
  import IconSecure from './icons/secure.vue';
269
271
  import IconSend from './icons/send.vue';
@@ -580,6 +582,7 @@ export default {
580
582
  IconFooterCentered,
581
583
  IconFooterLeft,
582
584
 
585
+ IconHistory,
583
586
  IconHome,
584
587
  IconHomeOutline,
585
588
  IconHomeCrazyDomains,
@@ -664,6 +667,7 @@ export default {
664
667
  IconRequestPayment,
665
668
  IconShieldTick,
666
669
  IconShop,
670
+ IconSave,
667
671
  IconSearch,
668
672
  IconSecure,
669
673
  IconSend,
@@ -0,0 +1,12 @@
1
+ <template>
2
+ <g fill="none" transform="translate(0.25, 1.5) scale(1.1)">
3
+ <path d="M0.500244 3.85742L1.50022 6.35742" stroke="currentColor" stroke-linecap="round" />
4
+ <path d="M1.50031 6.3574L4.00037 5.35742" stroke="currentColor" stroke-linecap="round" />
5
+ <path
6
+ d="M7.46411 0C10.9158 0 13.7139 2.79836 13.7141 6.25C13.7141 9.70178 10.9159 12.5 7.46411 12.5C5.66342 12.4999 4.04145 11.7379 2.9014 10.5192C2.46116 10.0485 2.84585 9.35742 3.4903 9.35742C3.73353 9.35742 3.96191 9.46606 4.13532 9.63662C4.9923 10.4795 6.16711 10.9999 7.46411 11C10.0875 11 12.2141 8.87335 12.2141 6.25C12.2139 3.62679 10.0874 1.5 7.46411 1.5C4.84108 1.50026 2.71428 3.62695 2.71411 6.25C2.71411 6.30896 2.66854 6.35742 2.60957 6.35742H1.32451C1.26487 6.35742 1.21411 6.30964 1.21411 6.25C1.21428 2.79852 4.01266 0.000262284 7.46411 0Z"
7
+ fill="currentColor"
8
+ />
9
+ <path d="M7.00024 4.35742V6.85742" stroke="currentColor" stroke-linecap="round" />
10
+ <line x1="7.00024" y1="6.85742" x2="9.00024" y2="6.85742" stroke="currentColor" stroke-linecap="round" />
11
+ </g>
12
+ </template>
@@ -0,0 +1,6 @@
1
+ <template>
2
+ <path
3
+ d="M9.32715 8.01665C9.32689 8.01352 9.32545 8.01066 9.3252 8.00786C9.32271 8.00764 9.32012 8.00711 9.31738 8.00689C9.23966 8.00054 9.13128 8.00005 8.93359 8.00005H4.40039C4.20271 8.00005 4.09433 8.00054 4.0166 8.00689C4.0135 8.00714 4.01058 8.00761 4.00781 8.00786C4.00756 8.01063 4.00709 8.01355 4.00684 8.01665C4.00049 8.09437 4 8.20276 4 8.40044V12H9.33398V8.40044C9.33398 8.20276 9.3335 8.09437 9.32715 8.01665ZM0 3.86724C0 3.31819 0.000292534 2.86602 0.0302734 2.49907C0.0608946 2.12439 0.126173 1.77963 0.291016 1.4561C0.546643 0.954538 0.954488 0.546693 1.45605 0.291066C1.77958 0.126223 2.12434 0.0609446 2.49902 0.0303234C2.7322 0.0112719 2.99977 0.00535884 3.30469 0.00297968C3.31432 0.00256653 3.32425 4.99914e-05 3.33398 4.99914e-05C3.34251 5.40638e-05 3.35092 0.00265814 3.35938 0.00297968C3.51849 0.00200758 3.68774 4.99914e-05 3.86719 4.99914e-05H8.4502C8.74443 4.81347e-05 9.00014 -0.00377018 9.24805 0.0557141C9.45204 0.104689 9.64728 0.185377 9.82617 0.294972C10.0436 0.42821 10.2216 0.612265 10.4297 0.820363L12.5137 2.90435C12.7218 3.11244 12.9058 3.29044 13.0391 3.50786C13.1487 3.68675 13.2293 3.88199 13.2783 4.08599C13.3378 4.3339 13.334 4.58961 13.334 4.88384V9.46685C13.334 10.0159 13.3337 10.4681 13.3037 10.835C13.2731 11.2097 13.2078 11.5545 13.043 11.878C12.7873 12.3795 12.3795 12.7874 11.8779 13.043C11.5544 13.2079 11.2096 13.2731 10.835 13.3038C10.6015 13.3228 10.3336 13.3287 10.0283 13.3311C10.019 13.3315 10.0094 13.334 10 13.334C9.99114 13.334 9.98241 13.3315 9.97363 13.3311C9.8148 13.3321 9.64588 13.334 9.4668 13.334H3.86719C3.68774 13.334 3.51849 13.3321 3.35938 13.3311C3.35092 13.3314 3.34251 13.334 3.33398 13.334C3.32425 13.334 3.31432 13.3315 3.30469 13.3311C2.99977 13.3287 2.7322 13.3228 2.49902 13.3038C2.12434 13.2731 1.77958 13.2079 1.45605 13.043C0.954488 12.7874 0.546643 12.3795 0.291016 11.878C0.126173 11.5545 0.0608946 11.2097 0.0302734 10.835C0.000292534 10.4681 0 10.0159 0 9.46685V3.86724ZM1.33398 9.46685C1.33398 10.0379 1.33388 10.4266 1.3584 10.7266C1.38228 11.0187 1.42542 11.1683 1.47852 11.2725C1.60635 11.5234 1.81064 11.7277 2.06152 11.8555C2.16576 11.9086 2.31537 11.9518 2.60742 11.9756C2.62679 11.9772 2.64687 11.9772 2.66699 11.9786V8.40044C2.66699 8.22476 2.6669 8.05287 2.67871 7.90825C2.69116 7.75586 2.7203 7.57553 2.8125 7.39458C2.94027 7.14405 3.14401 6.94032 3.39453 6.81255C3.57548 6.72035 3.75581 6.69121 3.9082 6.67876C4.05282 6.66695 4.22471 6.66704 4.40039 6.66704H8.93359C9.10928 6.66704 9.28117 6.66695 9.42578 6.67876C9.57818 6.69121 9.7585 6.72035 9.93945 6.81255C10.19 6.94032 10.3937 7.14405 10.5215 7.39458C10.6137 7.57553 10.6428 7.75586 10.6553 7.90825C10.6671 8.05287 10.667 8.22476 10.667 8.40044V11.9786C10.6871 11.9772 10.7072 11.9772 10.7266 11.9756C11.0186 11.9518 11.1682 11.9086 11.2725 11.8555C11.5233 11.7277 11.7276 11.5234 11.8555 11.2725C11.9086 11.1683 11.9517 11.0187 11.9756 10.7266C12.0001 10.4266 12 10.0379 12 9.46685V4.88384C12 4.52686 11.9955 4.45631 11.9814 4.39751C11.9651 4.32949 11.9389 4.2638 11.9023 4.20415C11.8707 4.15253 11.8233 4.09975 11.5703 3.84673L10.666 2.94243C10.666 3.11508 10.6669 3.28361 10.6553 3.42583C10.6428 3.57823 10.6137 3.75856 10.5215 3.9395C10.3937 4.19003 10.19 4.39377 9.93945 4.52153C9.7585 4.61373 9.57818 4.64287 9.42578 4.65532C9.28117 4.66714 9.10928 4.66704 8.93359 4.66704H4.40039C4.22471 4.66704 4.05282 4.66714 3.9082 4.65532C3.75581 4.64287 3.57548 4.61373 3.39453 4.52153C3.14401 4.39377 2.94027 4.19003 2.8125 3.9395C2.7203 3.75856 2.69116 3.57823 2.67871 3.42583C2.6669 3.28122 2.66699 3.10933 2.66699 2.93364V1.35454C2.64684 1.35593 2.62681 1.35686 2.60742 1.35845C2.31537 1.38233 2.16576 1.42547 2.06152 1.47857C1.81064 1.6064 1.60635 1.81069 1.47852 2.06157C1.42542 2.16581 1.38228 2.31542 1.3584 2.60747C1.33388 2.90753 1.33398 3.29618 1.33398 3.86724V9.46685ZM4.00684 3.31743C4.00706 3.32017 4.00759 3.32276 4.00781 3.32525C4.01061 3.3255 4.01347 3.32694 4.0166 3.3272C4.09433 3.33355 4.20271 3.33403 4.40039 3.33403H8.93359C9.13128 3.33403 9.23966 3.33355 9.31738 3.3272C9.32016 3.32697 9.32269 3.32547 9.3252 3.32525C9.32542 3.32274 9.32692 3.32021 9.32715 3.31743C9.3335 3.23971 9.33398 3.13133 9.33398 2.93364V1.61333C9.20748 1.48941 9.16893 1.45562 9.12988 1.43169C9.07023 1.39514 9.00455 1.36892 8.93652 1.35259C8.87773 1.33852 8.80717 1.33404 8.4502 1.33403H4V2.93364C4 3.13133 4.00049 3.23971 4.00684 3.31743Z"
4
+ fill="currentColor"
5
+ />
6
+ </template>
@@ -96,7 +96,9 @@
96
96
  "dropYourFileHere": "Legen Sie Ihre Datei hier ab oder",
97
97
  "clickToUpload": "Klicken zum Hochladen",
98
98
  "acceptedFiles": "Wir akzeptieren PNG-, JPG-, SVG- und EPS-Dateien bis zu 25 MB.",
99
- "wrongUploadType": "Sie können Dateien dieses Typs nicht hochladen."
99
+ "wrongUploadType": "Sie können Dateien dieses Typs nicht hochladen.",
100
+ "keywords": "Schlüsselwörter",
101
+ "keywordsDescription": "Fügen Sie Schlüsselwörter hinzu, die relevant für Ihr Unternehmen und Ihr Logo sind"
100
102
  },
101
103
  "uploadLogoSearchResultCard": {
102
104
  "replace": "Ersetzen",
@@ -96,7 +96,9 @@
96
96
  "dropYourFileHere": "Suelta el archivo aquí o",
97
97
  "clickToUpload": "haz clic para subirlo",
98
98
  "acceptedFiles": "Aceptamos archivos PNG, JPG, SVG o EPS de hasta 25 MB",
99
- "wrongUploadType": "No puedes subir archivos de este tipo."
99
+ "wrongUploadType": "No puedes subir archivos de este tipo.",
100
+ "keywords": "Palabras clave",
101
+ "keywordsDescription": "Añade palabras clave relacionadas con tu negocio y logo"
100
102
  },
101
103
  "uploadLogoSearchResultCard": {
102
104
  "replace": "Sustituir",
@@ -96,7 +96,9 @@
96
96
  "dropYourFileHere": "Déposez votre fichier ici ou",
97
97
  "clickToUpload": "cliquez pour télécharger",
98
98
  "acceptedFiles": "Nous acceptons les fichiers PNG, JPG, SVG ou EPS jusqu'à 25 Mo",
99
- "wrongUploadType": "Vous ne pouvez pas télécharger des fichiers de ce type."
99
+ "wrongUploadType": "Vous ne pouvez pas télécharger des fichiers de ce type.",
100
+ "keywords": "Mots-clés",
101
+ "keywordsDescription": "Ajoutez des mots-clés liés à votre entreprise et à votre logo."
100
102
  },
101
103
  "uploadLogoSearchResultCard": {
102
104
  "replace": "Remplacer",
@@ -96,7 +96,9 @@
96
96
  "dropYourFileHere": "Déposez votre fichier ici ou",
97
97
  "clickToUpload": "cliquez pour télécharger",
98
98
  "acceptedFiles": "Nous acceptons les fichiers PNG, JPG, SVG ou EPS jusqu'à 25 Mo",
99
- "wrongUploadType": "Vous ne pouvez pas télécharger des fichiers de ce type."
99
+ "wrongUploadType": "Vous ne pouvez pas télécharger des fichiers de ce type.",
100
+ "keywords": "Mots-clés",
101
+ "keywordsDescription": "Ajoutez des mots-clés liés à votre entreprise et à votre logo"
100
102
  },
101
103
  "uploadLogoSearchResultCard": {
102
104
  "replace": "Remplacer",
@@ -96,7 +96,9 @@
96
96
  "dropYourFileHere": "Drop your file here or",
97
97
  "clickToUpload": "click to upload",
98
98
  "acceptedFiles": "We accept PNG, JPG, SVG or EPS files up to 25MB",
99
- "wrongUploadType": "You can't upload files of this type."
99
+ "wrongUploadType": "You can't upload files of this type.",
100
+ "keywords": "Keywords",
101
+ "keywordsDescription": "Add keywords related to your business and logo"
100
102
  },
101
103
  "uploadLogoSearchResultCard": {
102
104
  "replace": "Replace",
@@ -96,7 +96,9 @@
96
96
  "dropYourFileHere": "Arraste o seu ficheiro aqui ou",
97
97
  "clickToUpload": "clique para carregar",
98
98
  "acceptedFiles": "Aceitamos arquivos PNG, JPG, SVG ou EPS de até 25 MB",
99
- "wrongUploadType": "Você não pode baixar arquivos deste tipo."
99
+ "wrongUploadType": "Você não pode baixar arquivos deste tipo.",
100
+ "keywords": "Palavras-chave",
101
+ "keywordsDescription": "Adicione palavras-chave associadas à sua empresa e logotipo"
100
102
  },
101
103
  "uploadLogoSearchResultCard": {
102
104
  "replace": "Substituir",
@@ -96,7 +96,9 @@
96
96
  "dropYourFileHere": "Arraste o seu ficheiro aqui ou",
97
97
  "clickToUpload": "clique para carregar",
98
98
  "acceptedFiles": "Aceitamos ficheiros PNG, JPG, SVG ou EPS até 25 MB",
99
- "wrongUploadType": "Não pode carregar ficheiros deste tipo."
99
+ "wrongUploadType": "Não pode carregar ficheiros deste tipo.",
100
+ "keywords": "Palavras-chave",
101
+ "keywordsDescription": "Adicione palavras-chave relacionadas com a sua empresa e logótipo"
100
102
  },
101
103
  "uploadLogoSearchResultCard": {
102
104
  "replace": "Substituir",
@@ -116,9 +116,27 @@ const searchDomainNamesByKeywordAsync = async ({
116
116
  }
117
117
  };
118
118
 
119
+ const getKeywordSuggestionsAsync = async ({ businessName, templateType, antiForgeryToken }) => {
120
+ try {
121
+ const response = await getAxios()({
122
+ method: 'post',
123
+ url: API.KEYWORD_SUGGESTIONS_API_URL,
124
+ data: { businessName, templateType },
125
+ headers: {
126
+ RequestVerificationToken: antiForgeryToken,
127
+ 'Accept-Language': getCurrentLocale(),
128
+ },
129
+ });
130
+ return response.data;
131
+ } catch (error) {
132
+ return false;
133
+ }
134
+ };
135
+
119
136
  export default {
120
137
  setBrandCrowdApiClientAxios,
121
138
  uploadLogoAndGetDetails,
122
139
  createUserLogo,
123
140
  searchDomainNamesByKeywordAsync,
141
+ getKeywordSuggestionsAsync,
124
142
  };
@@ -134,6 +134,55 @@ export const SuccessSvg = () => {
134
134
  };
135
135
  };
136
136
 
137
+ export const SuccessWithKeywords = () => {
138
+ const mock = new MockAdapter(axios, { delayResponse: MOCK_RESPONSE_DELAY, onNoMatch: 'passthrough' });
139
+ mock.onPost(API.BYO_LOGO_API_URL + API.BYO_LOGO_API_UPLOAD_LOGO_ENDPOINT).reply(200, UPLOAD_SUCCESS_RESPONSE);
140
+
141
+ mock.onPost(API.BYO_LOGO_API_URL + API.BYO_LOGO_API_SAVE_ENDPOINT).reply(200, {
142
+ success: true,
143
+ });
144
+
145
+ mock.onGet(new RegExp(API.KEYWORD_SUGGESTIONS_API_URL)).reply(200, {
146
+ keywords: ['professional', 'modern'],
147
+ });
148
+
149
+ return {
150
+ components: {
151
+ UploadYourLogoApplication,
152
+ },
153
+ template: `
154
+ <div>
155
+ <input type="file" @change="onFileInputChange" accept=".png,.svg,.eps" />
156
+ <UploadYourLogoApplication
157
+ :use-dropzone="true"
158
+ :show-keywords-step="true"
159
+ template-type="business card"
160
+ @on-save-keywords="onSaveKeywords"
161
+ @on-finish="onFinish"
162
+ />
163
+ </div>
164
+ `,
165
+ methods: {
166
+ onFileInputChange(e) {
167
+ if (e.target.files.length) {
168
+ window.dispatchEvent(
169
+ new CustomEvent(Events.BeginUploadLogoExperience, {
170
+ detail: { file: e.target.files[0] },
171
+ }),
172
+ );
173
+ }
174
+ },
175
+ onSaveKeywords(e) {
176
+ console.log('on-save-keywords', e);
177
+ },
178
+ onFinish(e) {
179
+ alert('on finish');
180
+ console.log(e);
181
+ },
182
+ },
183
+ };
184
+ };
185
+
137
186
  export const FailOnUpload = () => {
138
187
  const mock = new MockAdapter(axios, { delayResponse: MOCK_RESPONSE_DELAY });
139
188
  mock
@@ -7,6 +7,10 @@
7
7
  :use-dropzone="useDropzone"
8
8
  :is-post-purchase-user-upload="isPostPurchaseUserUpload"
9
9
  :is-ai-powered="isAiPowered"
10
+ :show-keywords-step="showKeywordsStep"
11
+ :template-type="templateType"
12
+ :anti-forgery-token="antiForgeryToken"
13
+ :refresh-anti-forgery-token="refreshAntiForgeryToken"
10
14
  @on-exit="onExit"
11
15
  @on-upload-error="onUploadError"
12
16
  @on-file-change="onFileChange"
@@ -16,6 +20,7 @@
16
20
  @on-brand-colors-save="onBrandColorsSave"
17
21
  @on-back="onBack"
18
22
  @on-logo-upload-success="onLogoUploadSuccess"
23
+ @on-save-keywords="onSaveKeywords"
19
24
  />
20
25
  </div>
21
26
  </template>
@@ -44,6 +49,26 @@ export default {
44
49
  type: Boolean,
45
50
  default: false,
46
51
  },
52
+ showKeywordsStep: {
53
+ type: Boolean,
54
+ required: false,
55
+ default: false,
56
+ },
57
+ templateType: {
58
+ type: String,
59
+ required: false,
60
+ default: null,
61
+ },
62
+ antiForgeryToken: {
63
+ type: String,
64
+ required: false,
65
+ default: '',
66
+ },
67
+ refreshAntiForgeryToken: {
68
+ type: Function,
69
+ required: false,
70
+ default: null,
71
+ },
47
72
  },
48
73
  data() {
49
74
  return {
@@ -130,6 +155,9 @@ export default {
130
155
  onLogoUploadSuccess() {
131
156
  this.$emit('on-logo-upload-success');
132
157
  },
158
+ onSaveKeywords(payload) {
159
+ this.$emit('on-save-keywords', payload);
160
+ },
133
161
  },
134
162
  };
135
163
  </script>
@@ -0,0 +1,65 @@
1
+ import LogoKeywords from './LogoKeywords.vue';
2
+
3
+ export default {
4
+ title: 'Components/LogoKeywords',
5
+ component: LogoKeywords,
6
+ };
7
+
8
+ export const Loading = () => {
9
+ return {
10
+ components: {
11
+ LogoKeywords,
12
+ },
13
+ template: `
14
+ <div style="max-width: 500px;">
15
+ <LogoKeywords
16
+ progress-label="Step 3 of 5"
17
+ event-category="BYO-PrePurchase"
18
+ business-name="My Business"
19
+ template-type="business card"
20
+ anti-forgery-token="mock-anti-forgery-token"
21
+ />
22
+ </div>
23
+ `,
24
+ };
25
+ };
26
+
27
+ export const Populated = () => {
28
+ return {
29
+ components: {
30
+ LogoKeywords,
31
+ },
32
+ template: `
33
+ <div style="max-width: 500px;">
34
+ <LogoKeywords
35
+ progress-label="Step 3 of 5"
36
+ event-category="BYO-PrePurchase"
37
+ saved-keywords="modern, professional, creative, bold"
38
+ business-name="My Business"
39
+ template-type="business card"
40
+ anti-forgery-token="mock-anti-forgery-token"
41
+ />
42
+ </div>
43
+ `,
44
+ };
45
+ };
46
+
47
+ export const Empty = () => {
48
+ return {
49
+ components: {
50
+ LogoKeywords,
51
+ },
52
+ template: `
53
+ <div style="max-width: 500px;">
54
+ <LogoKeywords
55
+ progress-label="Step 3 of 5"
56
+ event-category="BYO-PrePurchase"
57
+ saved-keywords=""
58
+ business-name=""
59
+ template-type="business card"
60
+ anti-forgery-token="mock-anti-forgery-token"
61
+ />
62
+ </div>
63
+ `,
64
+ };
65
+ };
@@ -0,0 +1,156 @@
1
+ <template>
2
+ <div class="tw-w-full tw-flex tw-flex-col tw-h-full lg:tw-h-auto">
3
+ <div class="tw-h-full tw-pb-24 lg:tw-pb-0">
4
+ <div class="tw-pb-8">
5
+ <p class="tw-text-grayscale-600 tw-font-bold tw-text-xs tw-mb-2 tw-uppercase">
6
+ {{ progressLabel }}
7
+ </p>
8
+ <h2 class="tw-mb-4 tw-text-4xl tw-text-black tw-font-bold">{{ uploadYourLogoTr('keywords') }}</h2>
9
+ <p class="tw-mt-0">{{ uploadYourLogoTr('keywordsDescription') }}</p>
10
+ </div>
11
+
12
+ <div class="tw-pb-8 tw-px-8">
13
+ <div class="tw-relative">
14
+ <input
15
+ v-model="keywordsText"
16
+ :disabled="isLoading"
17
+ class="tw-w-full tw-py-3.5 tw-px-4 tw-rounded tw-box-border tw-border tw-border-solid tw-border-grayscale-500 tw-text-grayscale-600"
18
+ @keyup="onKeywordsKeyUp"
19
+ />
20
+ <div
21
+ v-if="isLoading"
22
+ class="tw-absolute tw-inset-0 tw-flex tw-items-center tw-justify-center tw-bg-white/50 tw-rounded"
23
+ >
24
+ <div class="tw-animate-spin tw-h-5 tw-w-5 tw-border-2 tw-border-grayscale-500 tw-border-t-transparent tw-rounded-full" />
25
+ </div>
26
+ </div>
27
+ </div>
28
+ </div>
29
+
30
+ <div
31
+ class="tw-fixed tw-rounded-b tw-bottom-0 tw-left-0 tw-z-10 tw-bg-grayscale-200 lg:tw-static tw-flex tw-w-full tw-items-center tw-justify-center tw-border-0 tw-border-t tw-border-black/10 tw-border-solid tw-py-4 tw-px-8 tw-box-border"
32
+ >
33
+ <Button
34
+ :label="uploadYourLogoTr('back')"
35
+ size="large"
36
+ variant="outline"
37
+ container-classes="tw-mx-2"
38
+ data-test-back-btn
39
+ @on-click="back"
40
+ />
41
+ <Button
42
+ :label="uploadYourLogoTr('continue')"
43
+ size="large"
44
+ variant="primary-with-icon"
45
+ icon="chevron-right-wide"
46
+ container-classes="tw-mx-2"
47
+ data-test-continue-btn
48
+ :disabled="isLoading"
49
+ @on-click="save"
50
+ />
51
+ </div>
52
+ </div>
53
+ </template>
54
+ <script>
55
+ import Button from '../../../atoms/components/Button/Button.vue';
56
+ import brandCrowdClient from '../../clients/brand-crowd-api.client';
57
+ import trackEvent from '../../helpers/tracking';
58
+ import { uploadYourLogoTr } from '../../../useSharedLibTranslate';
59
+
60
+ export default {
61
+ components: {
62
+ Button,
63
+ },
64
+ props: {
65
+ progressLabel: {
66
+ type: String,
67
+ required: true,
68
+ },
69
+ eventCategory: {
70
+ type: String,
71
+ required: true,
72
+ },
73
+ savedKeywords: {
74
+ type: String,
75
+ required: false,
76
+ default: null,
77
+ },
78
+ businessName: {
79
+ type: String,
80
+ required: false,
81
+ default: '',
82
+ },
83
+ templateType: {
84
+ type: String,
85
+ required: true,
86
+ },
87
+ antiForgeryToken: {
88
+ type: String,
89
+ required: true,
90
+ },
91
+ refreshAntiForgeryToken: {
92
+ type: Function,
93
+ required: false,
94
+ default: null,
95
+ },
96
+ },
97
+ setup() {
98
+ return {
99
+ uploadYourLogoTr,
100
+ };
101
+ },
102
+ data() {
103
+ return {
104
+ keywordsText: '',
105
+ isLoading: false,
106
+ };
107
+ },
108
+ async mounted() {
109
+ if (this.savedKeywords !== null) {
110
+ this.keywordsText = this.savedKeywords;
111
+ return;
112
+ }
113
+ if (!this.businessName) {
114
+ return;
115
+ }
116
+ this.isLoading = true;
117
+ try {
118
+ const token = this.refreshAntiForgeryToken ? await this.refreshAntiForgeryToken() : this.antiForgeryToken;
119
+ const result = await brandCrowdClient.getKeywordSuggestionsAsync({
120
+ businessName: this.businessName,
121
+ templateType: this.templateType,
122
+ antiForgeryToken: token,
123
+ });
124
+ if (result && result.keywords && result.keywords.length > 0) {
125
+ this.keywordsText = result.keywords.join(', ');
126
+ }
127
+ } finally {
128
+ this.isLoading = false;
129
+ }
130
+ },
131
+ methods: {
132
+ back() {
133
+ this.$emit('on-go-back');
134
+ },
135
+ save() {
136
+ if (this.isLoading) return;
137
+
138
+ trackEvent({
139
+ eventCategory: this.eventCategory,
140
+ eventAction: 'keywords',
141
+ eventLabel: 'Clicked_Continue',
142
+ event: 'click',
143
+ });
144
+
145
+ this.$emit('on-save', {
146
+ keywords: this.keywordsText,
147
+ });
148
+ },
149
+ onKeywordsKeyUp(e) {
150
+ if (e.key === 'Enter' && !this.isLoading) {
151
+ this.save();
152
+ }
153
+ },
154
+ },
155
+ };
156
+ </script>
@@ -55,13 +55,26 @@
55
55
  @on-save="onSaveBusinessText"
56
56
  />
57
57
 
58
+ <LogoKeywords
59
+ v-if="showKeywordsStep && !isAttemptingToExit && currentStep === 4 && uploadedLogoData"
60
+ :progress-label="currentStepProgressLabel"
61
+ :event-category="eventCategory"
62
+ :saved-keywords="savedKeywords"
63
+ :business-name="(savedBusinessText && savedBusinessText.businessText) || ''"
64
+ :template-type="templateType"
65
+ :anti-forgery-token="antiForgeryToken"
66
+ :refresh-anti-forgery-token="refreshAntiForgeryToken"
67
+ @on-go-back="onGoBackToBusinessText"
68
+ @on-save="onSaveKeywords"
69
+ />
70
+
58
71
  <LogoBusinessBrandColours
59
- v-if="!isAttemptingToExit && currentStep === 4 && uploadedLogoData && !isCurrentlySaving"
72
+ v-if="!isAttemptingToExit && currentStep === brandColoursStep && uploadedLogoData && !isCurrentlySaving"
60
73
  :logo-data="uploadedLogoData"
61
74
  :cropped-logo-image="croppedImageBoxDataUrl"
62
75
  :total-num-steps="totalNumSteps"
63
76
  :event-category="eventCategory"
64
- @on-go-back="onGoBackToBusinessText"
77
+ @on-go-back="onGoBackFromBrandColours"
65
78
  @on-save="onBrandColoursSave"
66
79
  />
67
80
 
@@ -102,6 +115,7 @@ import LogoCropper from './LogoCropper.vue';
102
115
  import LogoPreview from './LogoPreview.vue';
103
116
  import LogoBusinessText from './LogoBusinessText.vue';
104
117
  import LogoBusinessBrandColours from './LogoBusinessBrandColours.vue';
118
+ import LogoKeywords from './LogoKeywords.vue';
105
119
  import LogoUploadingLoader from './LogoUploadingLoader.vue';
106
120
 
107
121
  export default {
@@ -115,6 +129,7 @@ export default {
115
129
  LogoPreview,
116
130
  LogoBusinessText,
117
131
  LogoBusinessBrandColours,
132
+ LogoKeywords,
118
133
  LogoUploadingLoader,
119
134
  },
120
135
  props: {
@@ -142,6 +157,26 @@ export default {
142
157
  type: Boolean,
143
158
  default: false,
144
159
  },
160
+ showKeywordsStep: {
161
+ type: Boolean,
162
+ required: false,
163
+ default: false,
164
+ },
165
+ templateType: {
166
+ type: String,
167
+ required: false,
168
+ default: null,
169
+ },
170
+ antiForgeryToken: {
171
+ type: String,
172
+ required: false,
173
+ default: '',
174
+ },
175
+ refreshAntiForgeryToken: {
176
+ type: Function,
177
+ required: false,
178
+ default: null,
179
+ },
145
180
  },
146
181
  setup() {
147
182
  return {
@@ -152,12 +187,13 @@ export default {
152
187
  return {
153
188
  currentStep: this.useDropzone ? 0 : 1,
154
189
  includeDropzoneInModal: this.useDropzone,
155
- totalNumSteps: this.useDropzone ? 5 : 4,
190
+ totalNumSteps: 4 + (this.useDropzone ? 1 : 0) + (this.showKeywordsStep ? 1 : 0),
156
191
  errorMessage: null,
157
192
  isAttemptingToExit: false,
158
193
  uploadedLogoData: null,
159
194
  croppedImageBoxBounds: null,
160
195
  savedBusinessText: null,
196
+ savedKeywords: null,
161
197
  brandColourData: null,
162
198
  isCurrentlySaving: false,
163
199
  };
@@ -166,9 +202,9 @@ export default {
166
202
  currentStepProgressLabel() {
167
203
  if (this.includeDropzoneInModal) {
168
204
  const currentStepDisplay = this.currentStep === 0 ? 1 : this.currentStep;
169
- return this.uploadYourLogoTr('stepOf', { CURRENT: currentStepDisplay, TOTAL: 5 });
205
+ return this.uploadYourLogoTr('stepOf', { CURRENT: currentStepDisplay, TOTAL: this.totalNumSteps });
170
206
  }
171
- return this.uploadYourLogoTr('stepOf', { CURRENT: this.currentStep - 1, TOTAL: 4 });
207
+ return this.uploadYourLogoTr('stepOf', { CURRENT: this.currentStep - 1, TOTAL: this.totalNumSteps });
172
208
  },
173
209
  hasError() {
174
210
  return !!this.errorMessage;
@@ -178,11 +214,17 @@ export default {
178
214
  },
179
215
  currentStepTrackingLabel() {
180
216
  const stepTwoLabel = this.currentStep === 2 && !this.canCropImage ? 'previewLogo' : 'cropLogo';
181
-
182
- const steps = ['logoUploader', stepTwoLabel, 'businessName', 'brandColors'];
183
-
217
+ const steps = this.showKeywordsStep
218
+ ? ['logoUploader', stepTwoLabel, 'businessName', 'keywords', 'brandColors']
219
+ : ['logoUploader', stepTwoLabel, 'businessName', 'brandColors'];
184
220
  return steps[this.currentStep - 1];
185
221
  },
222
+ keywordsStep() {
223
+ return 4;
224
+ },
225
+ brandColoursStep() {
226
+ return this.showKeywordsStep ? 5 : 4;
227
+ },
186
228
  eventCategory() {
187
229
  if (this.isPostPurchaseUserUpload) {
188
230
  return 'BYO-PostPurchase';
@@ -257,10 +299,19 @@ export default {
257
299
  this.$emit('on-back', { currentStepTrackingLabel: this.currentStepTrackingLabel });
258
300
  this.currentStep = 3;
259
301
  },
302
+ onSaveKeywords(payload) {
303
+ this.$emit('on-save-keywords', { keywords: payload.keywords });
304
+ this.savedKeywords = payload.keywords;
305
+ this.currentStep = this.brandColoursStep;
306
+ },
307
+ onGoBackFromBrandColours() {
308
+ this.$emit('on-back', { currentStepTrackingLabel: this.currentStepTrackingLabel });
309
+ this.currentStep = this.showKeywordsStep ? this.keywordsStep : 3;
310
+ },
260
311
  onSaveBusinessText(payload) {
261
312
  this.$emit('on-save-business-text', { businessText: payload.businessText });
262
313
  this.savedBusinessText = payload;
263
- this.currentStep = 4;
314
+ this.currentStep = this.showKeywordsStep ? this.keywordsStep : this.brandColoursStep;
264
315
  },
265
316
  onBrandColoursSave(payload) {
266
317
  this.$emit('on-brand-colors-save', {
@@ -304,6 +355,7 @@ export default {
304
355
  this.uploadedLogoData = null;
305
356
  this.croppedImageBoxBounds = null;
306
357
  this.savedBusinessText = null;
358
+ this.savedKeywords = null;
307
359
  this.brandColourData = null;
308
360
  },
309
361
  },