@designcrowd/fe-shared-lib 1.4.3 → 1.4.4-promocardv0

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.
@@ -0,0 +1,265 @@
1
+ import PromoCard from './PromoCard.vue';
2
+
3
+ export default {
4
+ title: 'Components/PromoCard',
5
+ component: PromoCard,
6
+ };
7
+
8
+ export const Standard = {
9
+ render: (args) => {
10
+ return {
11
+ components: {
12
+ PromoCard,
13
+ },
14
+ setup() {
15
+ return { args };
16
+ },
17
+ template: `
18
+ <PromoCard
19
+ v-bind="args"
20
+ @button-clicked="handleButtonClick"
21
+ />
22
+ `,
23
+ methods: {
24
+ handleButtonClick() {
25
+ console.log('Button clicked!');
26
+ },
27
+ },
28
+ };
29
+ },
30
+ args: {
31
+ title: 'Special Offer',
32
+ description: 'Get 20% off your next purchase. Limited time offer!',
33
+ imageUrl: 'https://bcassetcdn.com/assets/images/promo/brandpage-design-support.png',
34
+ altText: 'Promotional image',
35
+ buttonLabel: 'Learn More',
36
+ horizontalLayout: false,
37
+ scaleImageDown: false,
38
+ imageWidthFull: false,
39
+ shouldShowImageOnTop: false,
40
+ },
41
+ };
42
+
43
+ export const HorizontalLayout = {
44
+ render: (args) => {
45
+ return {
46
+ components: {
47
+ PromoCard,
48
+ },
49
+ setup() {
50
+ return { args };
51
+ },
52
+ template: `
53
+ <PromoCard
54
+ v-bind="args"
55
+ @button-clicked="handleButtonClick"
56
+ />
57
+ `,
58
+ methods: {
59
+ handleButtonClick() {
60
+ console.log('Button clicked!');
61
+ },
62
+ },
63
+ };
64
+ },
65
+ args: {
66
+ title: 'Premium Package',
67
+ description: 'Upgrade to premium and unlock exclusive features today.',
68
+ imageUrl: 'https://bcassetcdn.com/assets/images/promo/brandpage-design-support.png',
69
+ altText: 'Premium package image',
70
+ buttonLabel: 'Upgrade Now',
71
+ horizontalLayout: true,
72
+ scaleImageDown: false,
73
+ imageWidthFull: false,
74
+ shouldShowImageOnTop: false,
75
+ },
76
+ };
77
+
78
+ export const ImageOnTop = {
79
+ render: (args) => {
80
+ return {
81
+ components: {
82
+ PromoCard,
83
+ },
84
+ setup() {
85
+ return { args };
86
+ },
87
+ template: `
88
+ <PromoCard
89
+ v-bind="args"
90
+ @button-clicked="handleButtonClick"
91
+ />
92
+ `,
93
+ methods: {
94
+ handleButtonClick() {
95
+ console.log('Button clicked!');
96
+ },
97
+ },
98
+ };
99
+ },
100
+ args: {
101
+ title: 'Mobile Friendly',
102
+ description: 'This layout works great on mobile devices with the image displayed on top.',
103
+ imageUrl: 'https://bcassetcdn.com/assets/images/promo/brandpage-design-support.png',
104
+ altText: 'Mobile friendly layout',
105
+ buttonLabel: 'Try It',
106
+ horizontalLayout: false,
107
+ scaleImageDown: false,
108
+ imageWidthFull: false,
109
+ shouldShowImageOnTop: true,
110
+ },
111
+ };
112
+
113
+ export const ScaledDownImage = {
114
+ render: (args) => {
115
+ return {
116
+ components: {
117
+ PromoCard,
118
+ },
119
+ setup() {
120
+ return { args };
121
+ },
122
+ template: `
123
+ <PromoCard
124
+ v-bind="args"
125
+ @button-clicked="handleButtonClick"
126
+ />
127
+ `,
128
+ methods: {
129
+ handleButtonClick() {
130
+ console.log('Button clicked!');
131
+ },
132
+ },
133
+ };
134
+ },
135
+ args: {
136
+ title: 'Logo Showcase',
137
+ description: 'Display your logo with proper spacing and scaling.',
138
+ imageUrl: 'https://via.placeholder.com/120x120',
139
+ altText: 'Logo showcase',
140
+ buttonLabel: 'View More',
141
+ horizontalLayout: false,
142
+ scaleImageDown: true,
143
+ imageWidthFull: false,
144
+ shouldShowImageOnTop: false,
145
+ },
146
+ };
147
+
148
+ export const FullWidthImage = {
149
+ render: (args) => {
150
+ return {
151
+ components: {
152
+ PromoCard,
153
+ },
154
+ setup() {
155
+ return { args };
156
+ },
157
+ template: `
158
+ <PromoCard
159
+ v-bind="args"
160
+ @button-clicked="handleButtonClick"
161
+ />
162
+ `,
163
+ methods: {
164
+ handleButtonClick() {
165
+ console.log('Button clicked!');
166
+ },
167
+ },
168
+ };
169
+ },
170
+ args: {
171
+ title: 'Full Width Banner',
172
+ description: 'Images that stretch to fill the available space.',
173
+ imageUrl: 'https://bcassetcdn.com/assets/images/promo/brandpage-design-support.png',
174
+ altText: 'Full width banner',
175
+ buttonLabel: 'Explore',
176
+ horizontalLayout: false,
177
+ scaleImageDown: false,
178
+ imageWidthFull: true,
179
+ shouldShowImageOnTop: false,
180
+ },
181
+ };
182
+
183
+ export const AllOptions = {
184
+ render: (args) => {
185
+ return {
186
+ components: {
187
+ PromoCard,
188
+ },
189
+ setup() {
190
+ return { args };
191
+ },
192
+ template: `
193
+ <div class="tw-space-y-4">
194
+ <div>
195
+ <h3 class="tw-mb-2 tw-font-bold">Standard Layout</h3>
196
+ <PromoCard
197
+ title="Standard Promo"
198
+ description="This is the default vertical layout with image on the left."
199
+ imageUrl="https://bcassetcdn.com/assets/images/promo/brandpage-design-support.png"
200
+ altText="Standard layout"
201
+ buttonLabel="Click Me"
202
+ @button-clicked="handleButtonClick"
203
+ />
204
+ </div>
205
+
206
+ <div>
207
+ <h3 class="tw-mb-2 tw-font-bold">Horizontal Layout</h3>
208
+ <PromoCard
209
+ title="Horizontal Promo"
210
+ description="This layout is better for desktop with content side by side."
211
+ imageUrl="https://bcassetcdn.com/assets/images/promo/brandpage-design-support.png"
212
+ altText="Horizontal layout"
213
+ buttonLabel="Click Me"
214
+ :horizontal-layout="true"
215
+ @button-clicked="handleButtonClick"
216
+ />
217
+ </div>
218
+
219
+ <div>
220
+ <h3 class="tw-mb-2 tw-font-bold">Image On Top</h3>
221
+ <PromoCard
222
+ title="Mobile Optimized"
223
+ description="Perfect for mobile views with image stacked on top."
224
+ imageUrl="https://bcassetcdn.com/assets/images/promo/brandpage-design-support.png"
225
+ altText="Image on top"
226
+ buttonLabel="Click Me"
227
+ :should-show-image-on-top="true"
228
+ @button-clicked="handleButtonClick"
229
+ />
230
+ </div>
231
+ </div>
232
+ `,
233
+ methods: {
234
+ handleButtonClick() {
235
+ console.log('Button clicked!');
236
+ },
237
+ },
238
+ };
239
+ },
240
+ args: {},
241
+ };
242
+
243
+ Standard.story = {
244
+ name: 'PromoCard - Standard',
245
+ };
246
+
247
+ HorizontalLayout.story = {
248
+ name: 'PromoCard - Horizontal Layout',
249
+ };
250
+
251
+ ImageOnTop.story = {
252
+ name: 'PromoCard - Image On Top',
253
+ };
254
+
255
+ ScaledDownImage.story = {
256
+ name: 'PromoCard - Scaled Down Image',
257
+ };
258
+
259
+ FullWidthImage.story = {
260
+ name: 'PromoCard - Full Width Image',
261
+ };
262
+
263
+ AllOptions.story = {
264
+ name: 'PromoCard - All Variants',
265
+ };
@@ -0,0 +1,89 @@
1
+ <template>
2
+ <div class="tw-flex" :class="shouldShowImageOnTop ? 'tw-flex-col' : 'tw-flex-row'">
3
+ <div
4
+ class="tw-flex tw-justify-center tw-items-center tw-bg-grayscale-400 tw-w-60 tw-p-1 dcom-rounded-tl dcom-rounded-bl"
5
+ :class="{
6
+ 'tw-w-full tw-px-8 md:tw-px-12 lg:tw-px-20 tw-py-4': shouldShowImageOnTop,
7
+ 'tw-px-4': !shouldShowImageOnTop,
8
+ }"
9
+ >
10
+ <img :src="imageUrl" :alt="altText" />
11
+ </div>
12
+ <div
13
+ class="tw-flex tw-bg-white tw-w-full tw-p-4 tw-grow dcom-rounded-tr dcom-rounded-br tw-flex-col tw-justify-between"
14
+ :class="{
15
+ 'lg:tw-flex-row lg:tw-items-center lg:tw-justify-normal': horizontalLayout,
16
+ }"
17
+ >
18
+ <div class="tw-text-left tw-overflow-hidden tw-text-ellipsis" :class="lineClampStyle">
19
+ <div class="tw-font-bold tw-text-black tw-mb-0.5">
20
+ {{ title }}
21
+ </div>
22
+ <p>
23
+ {{ description }}
24
+ </p>
25
+ </div>
26
+ <Button
27
+ variant="primary"
28
+ size="small"
29
+ :full-width="!horizontalLayout"
30
+ class="tw-text-left tw-mt-4"
31
+ :class="horizontalLayout ? 'tw-w-full tw-mr-2 md:tw-mt-0 md:tw-w-auto' : ''"
32
+ :label="buttonLabel"
33
+ @on-click="buttonClicked"
34
+ />
35
+ </div>
36
+ </div>
37
+ </template>
38
+ <script>
39
+ import Button from '../Button/Button.vue';
40
+
41
+ export default {
42
+ components: { Button },
43
+ props: {
44
+ title: {
45
+ type: String,
46
+ required: true,
47
+ },
48
+ description: {
49
+ type: String,
50
+ required: true,
51
+ },
52
+ imageUrl: { type: String, required: true },
53
+ altText: { type: String, default: '' },
54
+ buttonLabel: {
55
+ type: String,
56
+ required: true,
57
+ },
58
+ horizontalLayout: {
59
+ type: Boolean,
60
+ default: false,
61
+ },
62
+ shouldShowImageOnTop: {
63
+ type: Boolean,
64
+ default: false,
65
+ },
66
+ textLineClamp: {
67
+ type: Number,
68
+ default: 0, // 0 is infinite
69
+ },
70
+ },
71
+ computed: {
72
+ shouldUseHorizontalLayout() {
73
+ // when in desktop view, display horizontal mode
74
+ return this.horizontalLayout;
75
+ },
76
+ lineClampStyle() {
77
+ if (this.textLineClamp > 0) {
78
+ return `tw-line-clamp-${this.textLineClamp}`;
79
+ }
80
+ return 'tw-line-clamp-none';
81
+ },
82
+ },
83
+ methods: {
84
+ buttonClicked() {
85
+ this.$emit('button-clicked');
86
+ },
87
+ },
88
+ };
89
+ </script>
@@ -12,10 +12,21 @@ const getAxios = () => {
12
12
  return internalAxios || axios;
13
13
  };
14
14
 
15
- const uploadLogoAndGetDetails = async (logoFile) => {
15
+ /**
16
+ * @param {File} logoFile
17
+ * @param {Object} data
18
+ * @returns Promise<{ success: boolean, response: any, error: any }>
19
+ */
20
+ const uploadLogoAndGetDetails = async (logoFile, data) => {
16
21
  const formData = new FormData();
17
22
  formData.append('logoImage', logoFile && logoFile.file);
18
23
 
24
+ if (data && Object.keys(data).length > 0) {
25
+ Object.keys(data).forEach((key) => {
26
+ formData.append(key, data[key]);
27
+ });
28
+ }
29
+
19
30
  try {
20
31
  const response = await getAxios()({
21
32
  method: 'post',
@@ -3,6 +3,7 @@
3
3
  <UploadYourLogoOnBoarding
4
4
  v-if="active"
5
5
  :logo-file="logoData.logoFile"
6
+ :custom-upload-data="customUploadData"
6
7
  :use-dropzone="useDropzone"
7
8
  :is-post-purchase-user-upload="isPostPurchaseUserUpload"
8
9
  @on-exit="onExit"
@@ -36,6 +37,11 @@ export default {
36
37
  required: false,
37
38
  default: false,
38
39
  },
40
+ customUploadData: {
41
+ type: Object,
42
+ required: false,
43
+ default: null,
44
+ },
39
45
  },
40
46
  data() {
41
47
  return {
@@ -19,6 +19,11 @@ export default {
19
19
  required: true,
20
20
  default: undefined,
21
21
  },
22
+ customUploadData: {
23
+ type: Object,
24
+ required: false,
25
+ default: null,
26
+ },
22
27
  eventCategory: {
23
28
  type: String,
24
29
  required: true,
@@ -50,7 +55,7 @@ export default {
50
55
  duration = Date.now() - start;
51
56
  }, 1);
52
57
 
53
- const result = await brandCrowdClient.uploadLogoAndGetDetails(this.logoFile);
58
+ const result = await brandCrowdClient.uploadLogoAndGetDetails(this.logoFile, this.customUploadData);
54
59
 
55
60
  clearInterval(intervalTimer);
56
61
  this.isRunning = false;
@@ -20,6 +20,7 @@
20
20
  <LogoUploader
21
21
  v-if="logoFile && !isAttemptingToExit && !hasError && currentStep === 1"
22
22
  :logo-file="logoFile"
23
+ :custom-upload-data="customUploadData"
23
24
  :event-category="eventCategory"
24
25
  @on-upload-success="onUploadSuccess"
25
26
  @on-upload-error="onUploadError"
@@ -127,6 +128,11 @@ export default {
127
128
  required: false,
128
129
  default: false,
129
130
  },
131
+ customUploadData: {
132
+ type: Object,
133
+ required: false,
134
+ default: undefined,
135
+ },
130
136
  },
131
137
  setup() {
132
138
  return {
@@ -1,9 +1,9 @@
1
- const bcTheme = require("./src/themes/bc");
2
- const bpTheme = require("./src/themes/bp");
3
- const dcTheme = require("./src/themes/dc");
4
- const cdTheme = require("./src/themes/cd");
5
- const dcomTheme = require("./src/themes/dcom");
6
- const viewports = require("./src/viewports");
1
+ const bcTheme = require('./src/themes/bc');
2
+ const bpTheme = require('./src/themes/bp');
3
+ const dcTheme = require('./src/themes/dc');
4
+ const cdTheme = require('./src/themes/cd');
5
+ const dcomTheme = require('./src/themes/dcom');
6
+ const viewports = require('./src/viewports');
7
7
 
8
8
  const designSystemConfig = {
9
9
  themes: {
@@ -20,7 +20,7 @@ const theme = designSystemConfig.themes[process.env.tailwindTheme]; // use the e
20
20
  module.exports = {
21
21
  prefix: 'tw-',
22
22
  content: ['./src/**/components/**/*.vue'],
23
- safelist: [{ pattern: /^!tw-p-/ }, { pattern: /^tw-overflow-y-auto$/ }],
23
+ safelist: [{ pattern: /^!tw-p-/ }, { pattern: /^tw-overflow-y-auto$/ }, { pattern: /^tw-line-clamp-/ }],
24
24
  theme: {
25
25
  ...theme,
26
26
  extend: {
@@ -34,4 +34,3 @@ module.exports = {
34
34
  preflight: true,
35
35
  },
36
36
  };
37
-