@designcrowd/fe-shared-lib 1.4.7-jj-2 → 1.4.7-jj-3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designcrowd/fe-shared-lib",
3
- "version": "1.4.7-jj-2",
3
+ "version": "1.4.7-jj-3",
4
4
  "scripts": {
5
5
  "start": "run-p storybook watch:translation",
6
6
  "build": "npm run build:css --production",
@@ -87,6 +87,35 @@ export const PublishWithSelectedDomain = () => {
87
87
 
88
88
  PublishWithSelectedDomain.loaders = [loadTranslationAsync];
89
89
 
90
+ export const SetSlug = () => {
91
+ return {
92
+ components: {
93
+ PublishBrandPageModal,
94
+ },
95
+ data() {
96
+ return {
97
+ domains,
98
+ };
99
+ },
100
+ methods: {},
101
+ template: `
102
+ <PublishBrandPageModal
103
+ visible
104
+ is-brand-page-slug-edit-mode
105
+ is-published
106
+ should-publish
107
+ :domains="domains"
108
+ brand-page-display-name='Website'
109
+ brand-page-base-url="https://brand.site"
110
+ brand-page-slug='test-slug'
111
+ :show-radio-buttons="domains.length > 0"
112
+ />
113
+ `,
114
+ };
115
+ };
116
+
117
+ SetSlug.loaders = [loadTranslationAsync];
118
+
90
119
  export const Published = () => {
91
120
  return {
92
121
  components: {
@@ -66,25 +66,20 @@
66
66
  @on-select-domain="onSelectDomain"
67
67
  @internal-publish-brand-page="onInternalPublishBrandPage"
68
68
  />
69
- <!-- <InitialPublishView
70
- v-if="isNotPublished || isSlugEditMode"
71
- :radio-value="radioValue"
72
- :domains="domains"
69
+ <SetUrlView
70
+ v-if="isSlugEditMode"
73
71
  :brand-page-base-url="brandPageBaseUrl"
74
72
  :brand-page-slug="brandPageSlug"
75
- :custom-domain="customDomain"
76
73
  :slug-validation-error="slugValidationError"
77
- :brand-page-display-name="brandPageDisplayName"
78
74
  :error-message="errorMessage"
79
75
  :publish-error-message="publishErrorMessage"
80
- :is-published="isPublished"
81
76
  :is-publishing="isPublishing"
82
- :should-publish="shouldPublish"
83
77
  :is-design-com="isDesignCom"
84
- :show-radio-buttons="showRadioButtons"
85
- :is-brand-page-slug-edit-mode="isBrandPageSlugEditMode"
86
78
  :brand-page-type="brandPageType"
87
- /> -->
79
+ @close-modal="onCloseModal"
80
+ @on-slug-changed="onSlugChanged"
81
+ @internal-publish-brand-page="onInternalPublishBrandPage"
82
+ />
88
83
  <PublishedView
89
84
  v-if="!isNotPublished && !isSlugEditMode"
90
85
  :brand-page-url="brandPageUrl"
@@ -126,7 +121,7 @@ import Events, { sitePublishedModal } from '../../constants/event-constants';
126
121
  import mediaQueryMixin from '../../mixins/mediaQueryMixin';
127
122
  import { publishBrandPageModalTr } from '../../../useSharedLibTranslate';
128
123
  import PublishedView from './views/PublishedView.vue';
129
- // import InitialPublishView from './views/InitialPublishView.vue';
124
+ import SetUrlView from './views/SetUrlView.vue';
130
125
  import PublishWhenNoDomainsView from './views/PublishWhenNoDomainsView.vue';
131
126
  import PublishWhenHasDomainsView from './views/PublishWhenHasDomainsView.vue';
132
127
 
@@ -143,7 +138,7 @@ export default {
143
138
  Modal,
144
139
  SellDomainNameListModal,
145
140
  PublishedView,
146
- // InitialPublishView,
141
+ SetUrlView,
147
142
  PublishWhenNoDomainsView,
148
143
  PublishWhenHasDomainsView,
149
144
  },
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div :class="{ 'tw-mb-8': true }">
2
+ <div>
3
3
  <div class="tw-mt-4">
4
4
  <PublishBrandPageCard
5
5
  :img-url="iconUrl"
@@ -0,0 +1,155 @@
1
+ <template>
2
+ <div>
3
+ <div class="tw-mt-4">
4
+ <div>
5
+ <TextInput
6
+ v-model="internalSlug"
7
+ element-classes="tw-mb-0 !tw-rounded-l-none tw-text-lg"
8
+ :prefix-text="`${brandPageBaseUrlWithoutHttps}/`"
9
+ :error="!!slugValidationError"
10
+ :disabled="isInputEnabled"
11
+ :placeholder="getPlaceHolder"
12
+ data-test-brand-page-slug-input
13
+ :attrs="{ 'data-test-set-url-text-field': '' }"
14
+ @input="onSlugChanged"
15
+ />
16
+ <div v-if="slugErrorMessage" class="tw-mt-2 tw-text-sm tw-text-left tw-text-error-500 tw-font-normal">
17
+ {{ slugErrorMessage }}
18
+ </div>
19
+ </div>
20
+ </div>
21
+ <div class="tw-font-sans tw-text-center" :style="isMobile ? 'padding-left: 1.5rem; padding-right: 1.5rem;' : ''">
22
+ <Button
23
+ :label="setUrlLabel"
24
+ :variant="isDesignCom ? 'primary' : 'primary-with-icon'"
25
+ icon="chevron-right-wide"
26
+ :disabled="isPublishingDisabled"
27
+ class="tw-my-4"
28
+ :full-width="isMobile"
29
+ data-test-brand-page-publish-button
30
+ @on-click="onPublish"
31
+ />
32
+ <Button
33
+ :label="hasAlreadyPurchasedDomainCloseButtonLabel"
34
+ variant="no-border"
35
+ size="large"
36
+ class="tw-my-4"
37
+ :full-width="isMobile"
38
+ @on-click="onCloseModal"
39
+ />
40
+ </div>
41
+ </div>
42
+ </template>
43
+ <script>
44
+ import TextInput from '../../../../atoms/components/TextInput/TextInput.vue';
45
+ import Button from '../../../../atoms/components/Button/Button.vue';
46
+ import mediaQueryMixin from '../../../mixins/mediaQueryMixin';
47
+ import { publishBrandPageModalTr } from '../../../../useSharedLibTranslate';
48
+
49
+ export default {
50
+ components: {
51
+ TextInput,
52
+ Button,
53
+ },
54
+ mixins: [mediaQueryMixin],
55
+ props: {
56
+ brandPageBaseUrl: {
57
+ type: String,
58
+ required: true,
59
+ default: undefined,
60
+ },
61
+ brandPageSlug: {
62
+ type: String,
63
+ required: true,
64
+ default: undefined,
65
+ },
66
+ slugValidationError: {
67
+ type: String,
68
+ required: true,
69
+ default: undefined,
70
+ },
71
+ errorMessage: {
72
+ type: String,
73
+ required: false,
74
+ default: undefined,
75
+ },
76
+ publishErrorMessage: {
77
+ type: String,
78
+ required: false,
79
+ default: undefined,
80
+ },
81
+ isPublishing: {
82
+ type: Boolean,
83
+ required: true,
84
+ default: false,
85
+ },
86
+ isDesignCom: {
87
+ type: Boolean,
88
+ required: true,
89
+ default: false,
90
+ },
91
+ brandPageType: {
92
+ type: String,
93
+ required: true,
94
+ default: '',
95
+ },
96
+ },
97
+ emits: ['close-modal', 'internal-publish-brand-page', 'on-slug-changed'],
98
+ setup() {
99
+ return {
100
+ publishBrandPageModalTr,
101
+ slugInputPlaceholderYourNameLabel: publishBrandPageModalTr('slugInputPlaceholderYourNameLabel'),
102
+ slugInputPlaceholderYourBusinessNameLabel: publishBrandPageModalTr('slugInputPlaceholderYourBusinessNameLabel'),
103
+ setUrlLabel: publishBrandPageModalTr('setUrlLabel'),
104
+ hasAlreadyPurchasedDomainCloseButtonLabel: publishBrandPageModalTr('hasAlreadyPurchasedDomainCloseButtonLabel'),
105
+ };
106
+ },
107
+ data() {
108
+ return {
109
+ domainTypeValue: this.radioValue,
110
+ internalSlug: this.brandPageSlug,
111
+ };
112
+ },
113
+ computed: {
114
+ brandPageBaseUrlWithoutHttps() {
115
+ return this.brandPageBaseUrl.replace('https://', '');
116
+ },
117
+ allowPublish() {
118
+ return this.internalSlug && !this.slugValidationError;
119
+ },
120
+ slugErrorMessage() {
121
+ return this.slugValidationError ? this.slugValidationError : this.publishErrorMessage;
122
+ },
123
+ isInputEnabled() {
124
+ return this.isPublishing;
125
+ },
126
+ isPublishingDisabled() {
127
+ return !this.allowPublish || this.isPublishing;
128
+ },
129
+ getPlaceHolder() {
130
+ return this.brandPageType === 'brandContact'
131
+ ? this.slugInputPlaceholderYourNameLabel
132
+ : this.slugInputPlaceholderYourBusinessNameLabel;
133
+ },
134
+ },
135
+ watch: {
136
+ brandPageSlug(slug) {
137
+ this.internalSlug = slug;
138
+ },
139
+ },
140
+ mounted() {
141
+ this.internalSlug = this.brandPageSlug;
142
+ },
143
+ methods: {
144
+ onCloseModal() {
145
+ this.$emit('close-modal');
146
+ },
147
+ onSlugChanged(e) {
148
+ this.$emit('on-slug-changed', e);
149
+ },
150
+ onPublish() {
151
+ this.$emit('internal-publish-brand-page', this.internalSlug, undefined);
152
+ },
153
+ },
154
+ };
155
+ </script>
@@ -1,323 +0,0 @@
1
- <template>
2
- <div :class="{ 'tw-mb-8': !hasPurchasedDomains }">
3
- <div
4
- v-if="!isSlugEditMode"
5
- class="tw-flex tw-items-center tw-mr-2 tw-mb-1"
6
- @click="onDomainTypeRadioButtonClick(DOMAIN_TYPES.slug)"
7
- >
8
- <input
9
- v-if="showRadioButtons"
10
- type="radio"
11
- class="tw-w-6 tw-h-8 tw-cursor-pointer tw-mb-0"
12
- :style="{ 'accent-color': 'rgb(242 27 63)' }"
13
- name="domainTypeValue"
14
- :checked="domainTypeValue === DOMAIN_TYPES.slug"
15
- :value="domainTypeValue === DOMAIN_TYPES.slug"
16
- />
17
- <label
18
- v-if="!isPublished && hasPurchasedDomains"
19
- for="domain-type"
20
- class="tw-font-sans tw-w-full tw-text-grayscale-600 tw-text-sm tw-cursor-pointer tw-ml-2"
21
- >
22
- <span class="tw-inline-block tw-rounded-full">{{ freeDomainLabel }}</span>
23
- </label>
24
- </div>
25
- <div v-if="isNotPublished || isSlugEditMode" class="tw-mt-4">
26
- <div v-if="hasPurchasedDomains">
27
- <TextInput
28
- v-model="internalSlug"
29
- element-classes="tw-mb-0 !tw-rounded-l-none tw-text-lg"
30
- :prefix-text="`${brandPageBaseUrlWithoutHttps}/`"
31
- :error="!!slugValidationError"
32
- :disabled="isInputEnabled"
33
- :placeholder="getPlaceHolder"
34
- data-test-brand-page-slug-input
35
- :attrs="{ 'data-test-set-url-text-field': '' }"
36
- @input="onSlugChanged"
37
- />
38
- <div v-if="slugErrorMessage" class="tw-mt-2 tw-text-sm tw-text-left tw-text-error-500 tw-font-normal">
39
- {{ slugErrorMessage }}
40
- </div>
41
- </div>
42
- </div>
43
- <div v-if="isNotPublished || !isSlugEditMode" class="tw-mt-4">
44
- <div v-if="showRadioButtons">
45
- <div
46
- class="tw-flex tw-items-center tw-mr-2 tw-mb-1"
47
- @click="onDomainTypeRadioButtonClick(DOMAIN_TYPES.purchased)"
48
- >
49
- <input
50
- type="radio"
51
- class="tw-w-6 tw-h-8 tw-cursor-pointer tw-mb-0"
52
- :style="{ 'accent-color': 'rgb(242 27 63)' }"
53
- name="domainTypeValue"
54
- :checked="domainTypeValue === DOMAIN_TYPES.purchased"
55
- :value="domainTypeValue === DOMAIN_TYPES.purchased"
56
- />
57
- <label
58
- for="domain-type"
59
- class="tw-font-sans tw-w-full tw-text-grayscale-600 tw-text-sm tw-cursor-pointer tw-ml-2"
60
- >
61
- <span class="tw-inline-block tw-rounded-full">{{ purchasedDomainLabel }}</span>
62
- </label>
63
- </div>
64
- <div class="tw-mt-4 domain-dropdown">
65
- <Dropdown
66
- v-if="domains"
67
- ref="dropdown"
68
- :element-classes="{
69
- 'tw-h-12': true,
70
- }"
71
- menu-element-classes="tw-w-full"
72
- :disabled="domainTypeValue === DOMAIN_TYPES.slug"
73
- :class="{
74
- 'tw-text-grayscale-600 tw-font-normal': !selectedCustomDomain,
75
- }"
76
- :title="(selectedCustomDomain && selectedCustomDomain.domainName) || selectDomainDropdownPlaceholder"
77
- >
78
- <DropdownItem
79
- v-for="purchasedDomain of domains"
80
- :key="purchasedDomain.domainName"
81
- class="tw-font-bold tw-break-all tw-flex tw-gap-2 tw-text-black"
82
- @click="onSelectPurchasedDomain(purchasedDomain)"
83
- >
84
- {{ purchasedDomain.domainName }}
85
- </DropdownItem>
86
- </Dropdown>
87
- </div>
88
- <div v-if="errorMessage" class="tw-mt-2 tw-text-sm tw-text-left tw-text-error-500 tw-font-normal">
89
- {{ errorMessage }}
90
- </div>
91
- </div>
92
- </div>
93
- <div
94
- v-if="hasPurchasedDomains"
95
- class="tw-font-sans tw-text-center"
96
- :style="isMobile ? 'padding-left: 1.5rem; padding-right: 1.5rem;' : ''"
97
- >
98
- <Button
99
- :label="isSlugEditMode ? setUrlLabel : publishLabel"
100
- :variant="isDesignCom ? 'primary' : 'primary-with-icon'"
101
- icon="chevron-right-wide"
102
- :disabled="isPublishingDisabled"
103
- class="tw-my-4"
104
- :full-width="isMobile"
105
- data-test-brand-page-publish-button
106
- @on-click="onPublish"
107
- />
108
- <Button
109
- :label="hasAlreadyPurchasedDomainCloseButtonLabel"
110
- variant="no-border"
111
- size="large"
112
- class="tw-my-4"
113
- :full-width="isMobile"
114
- @on-click="onCloseModal"
115
- />
116
- </div>
117
- </div>
118
- </template>
119
- <script>
120
- import TextInput from '../../../../atoms/components/TextInput/TextInput.vue';
121
- import Dropdown from '../../../../atoms/components/Dropdown/Dropdown.vue';
122
- import DropdownItem from '../../../../atoms/components/Dropdown/DropdownItem.vue';
123
- import Button from '../../../../atoms/components/Button/Button.vue';
124
- import mediaQueryMixin from '../../../mixins/mediaQueryMixin';
125
- import { publishBrandPageModalTr } from '../../../../useSharedLibTranslate';
126
-
127
- const DOMAIN_TYPES = {
128
- slug: 'slug',
129
- purchased: 'purchased',
130
- };
131
-
132
- const DCOM_IMG_FREE = 'https://brandcrowd-cdn.s3.amazonaws.com/public/assets/images/icons/publish/dcom-free-url.svg';
133
- const BC_IMG_FREE = 'https://brandcrowd-cdn.s3.amazonaws.com/public/assets/images/icons/publish/bc-free-url.svg';
134
-
135
- export default {
136
- components: {
137
- TextInput,
138
- Dropdown,
139
- DropdownItem,
140
- Button,
141
- },
142
- mixins: [mediaQueryMixin],
143
- props: {
144
- radioValue: {
145
- type: String,
146
- required: true,
147
- default: DOMAIN_TYPES.slug,
148
- },
149
- domains: {
150
- type: Array,
151
- required: true,
152
- default: undefined,
153
- },
154
- brandPageBaseUrl: {
155
- type: String,
156
- required: true,
157
- default: undefined,
158
- },
159
- brandPageSlug: {
160
- type: String,
161
- required: true,
162
- default: undefined,
163
- },
164
- customDomain: {
165
- type: Object,
166
- required: false,
167
- default: undefined,
168
- },
169
- slugValidationError: {
170
- type: String,
171
- required: true,
172
- default: undefined,
173
- },
174
- brandPageDisplayName: {
175
- type: String,
176
- required: true,
177
- default: undefined,
178
- },
179
- errorMessage: {
180
- type: String,
181
- required: false,
182
- default: undefined,
183
- },
184
- publishErrorMessage: {
185
- type: String,
186
- required: false,
187
- default: undefined,
188
- },
189
- isPublished: {
190
- type: Boolean,
191
- required: true,
192
- },
193
- isPublishing: {
194
- type: Boolean,
195
- required: true,
196
- default: false,
197
- },
198
- shouldPublish: {
199
- type: Boolean,
200
- required: true,
201
- default: false,
202
- },
203
- isDesignCom: {
204
- type: Boolean,
205
- required: true,
206
- default: false,
207
- },
208
- showRadioButtons: {
209
- type: Boolean,
210
- required: true,
211
- default: false,
212
- },
213
- isBrandPageSlugEditMode: {
214
- type: Boolean,
215
- required: true,
216
- default: false,
217
- },
218
- brandPageType: {
219
- type: String,
220
- required: true,
221
- default: '',
222
- },
223
- },
224
- emits: ['close-modal', 'radio-button-changed', 'internal-publish-brand-page', 'on-select-domain', 'on-slug-changed'],
225
- setup() {
226
- return {
227
- publishBrandPageModalTr,
228
- freePublishCardTitleLabel: publishBrandPageModalTr('freePublishCardTitleLabel'),
229
- freePublishCardDescriptionLabel: publishBrandPageModalTr('freePublishCardDescriptionLabel'),
230
- slugInputPlaceholderYourNameLabel: publishBrandPageModalTr('slugInputPlaceholderYourNameLabel'),
231
- slugInputPlaceholderYourBusinessNameLabel: publishBrandPageModalTr('slugInputPlaceholderYourBusinessNameLabel'),
232
- freeDomainLabel: publishBrandPageModalTr('freeDomainLabel'),
233
- purchasedDomainLabel: publishBrandPageModalTr('purchasedDomainLabel'),
234
- setUrlLabel: publishBrandPageModalTr('setUrlLabel'),
235
- publishLabel: publishBrandPageModalTr('publishLabel'),
236
- hasAlreadyPurchasedDomainCloseButtonLabel: publishBrandPageModalTr('hasAlreadyPurchasedDomainCloseButtonLabel'),
237
- selectDomainDropdownPlaceholder: publishBrandPageModalTr('selectDomainDropdownPlaceholder'),
238
- };
239
- },
240
- data() {
241
- return {
242
- DOMAIN_TYPES,
243
- domainTypeValue: this.radioValue,
244
- internalSlug: this.brandPageSlug,
245
- selectedCustomDomain: this.customDomain,
246
- };
247
- },
248
- computed: {
249
- brandPageBaseUrlWithoutHttps() {
250
- return this.brandPageBaseUrl.replace('https://', '');
251
- },
252
- allowPublish() {
253
- if (this.domainTypeValue === DOMAIN_TYPES.slug) {
254
- return this.internalSlug && !this.slugValidationError;
255
- }
256
- return this.selectedCustomDomain;
257
- },
258
- hasPurchasedDomains() {
259
- return this.domains && this.domains.length > 0;
260
- },
261
- slugErrorMessage() {
262
- return this.slugValidationError ? this.slugValidationError : this.publishErrorMessage;
263
- },
264
- isNotPublished() {
265
- return !this.isPublished || !this.shouldPublish;
266
- },
267
- isSlugEditMode() {
268
- return this.isPublished && this.shouldPublish && this.isBrandPageSlugEditMode;
269
- },
270
- iconUrl() {
271
- return this.isDesignCom ? DCOM_IMG_FREE : BC_IMG_FREE;
272
- },
273
- isInputEnabled() {
274
- return this.isPublishing || this.domainTypeValue === DOMAIN_TYPES.purchased;
275
- },
276
- isPublishingDisabled() {
277
- return !this.allowPublish || this.isPublishing;
278
- },
279
- getPlaceHolder() {
280
- return this.brandPageType === 'brandContact'
281
- ? this.slugInputPlaceholderYourNameLabel
282
- : this.slugInputPlaceholderYourBusinessNameLabel;
283
- },
284
- },
285
- watch: {
286
- brandPageSlug(slug) {
287
- this.internalSlug = slug;
288
- },
289
- customDomain(val) {
290
- this.selectedCustomDomain = val;
291
- },
292
- },
293
- mounted() {
294
- this.internalSlug = this.brandPageSlug;
295
- },
296
- methods: {
297
- onDomainTypeRadioButtonClick(domain) {
298
- this.domainTypeValue = domain;
299
- this.closePurchasedDomainDropdown();
300
- this.$emit('radio-button-changed', domain);
301
- },
302
- onCloseModal() {
303
- this.$emit('close-modal');
304
- },
305
- onSlugChanged(e) {
306
- this.$emit('on-slug-changed', e);
307
- },
308
- onPublish() {
309
- this.$emit('internal-publish-brand-page', this.internalSlug, this.selectedCustomDomain);
310
- },
311
- onSelectPurchasedDomain(newVal) {
312
- this.selectedCustomDomain = newVal;
313
- this.$emit('on-select-domain', newVal);
314
- this.closePurchasedDomainDropdown();
315
- },
316
- closePurchasedDomainDropdown() {
317
- if (this.$refs.dropdown?.hideMenu) {
318
- this.$refs.dropdown.hideMenu();
319
- }
320
- },
321
- },
322
- };
323
- </script>