@tiddh/brave-vue 1.93.282 → 1.93.283

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,555 @@
1
+ <template>
2
+ <div class="preview-full">
3
+ <!-- <div class="top-bar-area" :dir="dir" v-if="isLoaded">
4
+ <TopBar
5
+ :breadcrumbs="breadcrumbs"
6
+ :steps="steps"
7
+ :isMobile="isMobile"
8
+ :have_button="true"
9
+ :color="isMobile ? '#afa2ba' : '#afa2ba'"
10
+ :preview_color="'transparent'"
11
+ :dir="dir"
12
+ :colors="colors"
13
+ @click="changeRoute"
14
+ @clickContinue="changeRouteContinue"
15
+ />
16
+ </div> -->
17
+
18
+ <div class="preview-desktop-area" v-if="isLoaded && !isMobile">
19
+ <PreviewSnippetHorizontal
20
+ :uuid="uuid"
21
+ :pages="pages"
22
+ :book_format="book_format"
23
+ :product_id="product_id"
24
+ :preview_color="preview_color"
25
+ :typeLanguage="typeLanguage"
26
+ :goToPage="currentPage"
27
+ :dedication_page="dedication_page"
28
+ :builder_apk="builder_apk"
29
+ @updateCurrentPage="updateCurrentPage"
30
+ />
31
+ </div>
32
+
33
+ <div class="preview-mobile-area" v-if="isLoaded && isMobile">
34
+ <PreviewSnippetVertical
35
+ :uuid="uuid"
36
+ :pages="pages"
37
+ :book_format="book_format"
38
+ :product_id="product_id"
39
+ :goToPage="currentPage"
40
+ :dedication_page="dedication_page"
41
+ :typeLanguage="typeLanguage"
42
+ :builder_apk="builder_apk"
43
+ />
44
+ </div>
45
+
46
+ <!-- <div class="preview-mobile-tools" :class="!isLoaded ? 'invisible' : ''">
47
+ <PreviewTools
48
+ v-show="isLoaded && have_tools"
49
+ :dedication_text="dedication_text"
50
+ :uuid="uuid"
51
+ :slug="slug"
52
+ :character_id="character_id"
53
+ :have_dedication="have_dedication"
54
+ :product_id="product_id"
55
+ :gender="gender"
56
+ :typeLanguage="typeLanguage"
57
+ :language="language"
58
+ :languages="languages"
59
+ :layout="currentLayout"
60
+ :layouts="layouts"
61
+ :preview_color="preview_color"
62
+ :character_position_id="character_position_id"
63
+ :typeRead="typeRead"
64
+ :custom_mes="custom_mes"
65
+ :custom_numero="custom_numero"
66
+ :is_created="is_created"
67
+ @isLoadingMethod="isLoadingMethod"
68
+ @changeUuid="changeUuid"
69
+ @changeName="changeName"
70
+ @changeDedication="changeDedication"
71
+ @changeBirthday="changeBirthday"
72
+ @clickContinue="changeRouteContinue"
73
+ />
74
+ </div> -->
75
+
76
+ <!-- <div class="bottom-bar-area" :dir="dir" v-if="!isMobile">
77
+ <BottomBar
78
+ v-if="isLoaded"
79
+ :uuid="uuid"
80
+ :book_brand="book_brand"
81
+ :book_name="book_name"
82
+ :preview_color="preview_color"
83
+ :book_format="book_format"
84
+ :typeLanguage="typeLanguage"
85
+ :dir="dir"
86
+ @changeUrl="changeUrl"
87
+ />
88
+ </div> -->
89
+ </div>
90
+ </template>
91
+
92
+ <script>
93
+ import { getLanguage, DEFAULT_LOCALE } from "../../locale/config";
94
+
95
+ // import Preview from "./Preview.vue";
96
+ // import PreviewMobile from "./PreviewMobile.vue";
97
+ // import PreviewTools from "./PreviewTools.vue";
98
+ // import TopBar from "../../Navigation/TopBar.vue";
99
+ // import BottomBar from "./../BottomBar.vue";
100
+
101
+ import PreviewSnippetHorizontal from "./PreviewSnippetHorizontal.vue";
102
+ import PreviewSnippetVertical from "./PreviewSnippetVertical.vue";
103
+
104
+ //const $ = jQuery
105
+ const axios = require("axios");
106
+
107
+ export default {
108
+ name: "PreviewSnippet",
109
+ components: { PreviewSnippetHorizontal, PreviewSnippetVertical },
110
+ props: {
111
+ /** Força formato horizontal (desktop/tablet) */
112
+ forceHorizontal: {
113
+ type: Boolean,
114
+ required: false,
115
+ default: false,
116
+ },
117
+ dedication_text: {
118
+ type: String,
119
+ required: false,
120
+ },
121
+
122
+ /** Product id of Builder. `595` */
123
+ product_id: {
124
+ type: Number,
125
+ required: true,
126
+ },
127
+ /** Character id of Builder. `57` */
128
+ character_id: {
129
+ type: Number,
130
+ required: true,
131
+ },
132
+
133
+ /** Character id of Builder. `906` */
134
+ character_position_id: {
135
+ type: [Number, String],
136
+ required: false,
137
+ },
138
+
139
+ /** Type id of Gender. `89` */
140
+ gender: {
141
+ type: String,
142
+ required: true,
143
+ },
144
+ /** Slug of product on builder `bb-a-grande-viagem` */
145
+ slug: {
146
+ type: String,
147
+ required: true,
148
+ },
149
+ /** Character uuid. `ddh5e177ff920f15` */
150
+ uuid: {
151
+ type: String,
152
+ required: true,
153
+ },
154
+
155
+ /** Show edit name. */
156
+ have_tools: {
157
+ type: Boolean,
158
+ required: true,
159
+ default: true,
160
+ },
161
+
162
+ /** Character uuid. `ddh5e177ff920f15` */
163
+ preview_color: {
164
+ type: String,
165
+ default: "#16D3DB",
166
+ required: false,
167
+ },
168
+
169
+ typeRead: {
170
+ type: Boolean,
171
+ required: false,
172
+ default: false,
173
+ },
174
+
175
+ have_dedication: {
176
+ type: Boolean,
177
+ required: false,
178
+ default: true,
179
+ },
180
+
181
+ /** Show edit name. */
182
+ custom_numero: {
183
+ type: String,
184
+ required: false,
185
+ },
186
+
187
+ /** Show edit name. */
188
+ custom_mes: {
189
+ type: String,
190
+ required: false,
191
+ },
192
+
193
+ typeLanguage: {
194
+ type: String,
195
+ required: false,
196
+ default: DEFAULT_LOCALE,
197
+ },
198
+
199
+ language: {
200
+ type: String,
201
+ required: false,
202
+ },
203
+
204
+ languages: {
205
+ type: Array,
206
+ required: false,
207
+ },
208
+
209
+ layout: {
210
+ type: Number,
211
+ required: false,
212
+ },
213
+
214
+ layouts: {
215
+ type: Array,
216
+ required: false,
217
+ },
218
+
219
+ book_name: {
220
+ type: String,
221
+ required: false,
222
+ },
223
+
224
+ book_brand: {
225
+ type: String,
226
+ required: false,
227
+ },
228
+
229
+ breadcrumbs: {
230
+ type: Array,
231
+ required: false,
232
+ },
233
+
234
+ steps: {
235
+ type: Array,
236
+ required: false,
237
+ },
238
+
239
+ is_created: {
240
+ type: Boolean,
241
+ required: false,
242
+ default: false,
243
+ },
244
+
245
+ dir: {
246
+ type: String,
247
+ default: "ltr",
248
+ required: false,
249
+ },
250
+
251
+ colors: {
252
+ type: [Object],
253
+ required: false,
254
+ default: {
255
+ text: "#AFA2BA",
256
+ textActive: "#FFFFFF",
257
+ color: "#FFFFFF",
258
+ colorHover: "#F8F6FF",
259
+ colorActive: "#16d3db",
260
+ },
261
+ },
262
+
263
+ /** APK do builder (opcional) */
264
+ builder_apk: {
265
+ type: String,
266
+ required: false,
267
+ },
268
+ },
269
+ data() {
270
+ return {
271
+ isLoaded: false,
272
+ isMobile: false,
273
+ pages: 0,
274
+ book_format: "a4",
275
+ lang: null,
276
+ currentPage: 0,
277
+ dedication_page: null,
278
+ currentLayout: null,
279
+ //sidebarActive: false,
280
+ };
281
+ },
282
+ mounted() {
283
+ const self = this;
284
+
285
+ self.isMobile = self.detectSize();
286
+
287
+ window.addEventListener("resize", function (e) {
288
+ self.isMobile = self.detectSize();
289
+ });
290
+
291
+ self.lang = getLanguage(self.typeLanguage);
292
+ self.getProductInfo();
293
+
294
+ if (self.layout) {
295
+ self.currentLayout = self.layout;
296
+ }
297
+ },
298
+
299
+ methods: {
300
+ updateCurrentPage(payload) {
301
+ const self = this;
302
+ this.currentPage = payload;
303
+ },
304
+
305
+ getProductInfo() {
306
+ const self = this;
307
+ let url = this.lang.urlBuilder + "/api/products/info/" + self.product_id;
308
+ if (self.builder_apk) {
309
+ url += `?apk=${encodeURIComponent(self.builder_apk)}`;
310
+ }
311
+ axios
312
+ .get(url)
313
+ .then(function (response) {
314
+ self.pages = response.data.product.pages;
315
+ if (response.data.product.extra && response.data.product.extra.size) {
316
+ self.book_format = response.data.product.extra.size;
317
+ }
318
+
319
+ if (response.data.product.layout && self.layout) {
320
+ response.data.product.layout.forEach((layout, index) => {
321
+ if (layout.id === self.layout) {
322
+ //this.customizations.splice(index, 1);
323
+ if (
324
+ layout.dedication_pages &&
325
+ layout.dedication_pages.length > 0
326
+ ) {
327
+ self.dedication_page = parseInt(
328
+ response.data.product.layout[0].dedication_pages[0]
329
+ );
330
+ }
331
+ }
332
+ });
333
+ }
334
+
335
+ if (
336
+ !self.dedication_page &&
337
+ response.data.product.layout &&
338
+ response.data.product.layout[0].id &&
339
+ response.data.product.layout[0].dedication_pages[0]
340
+ ) {
341
+ self.currentLayout = response.data.product.layout[0].id;
342
+ self.dedication_page = parseInt(
343
+ response.data.product.layout[0].dedication_pages[0]
344
+ );
345
+ }
346
+
347
+ self.isLoaded = true;
348
+ })
349
+
350
+ .catch(function (error) {
351
+ console.log(error);
352
+ });
353
+ },
354
+
355
+ detectSize() {
356
+ // Se a prop forceHorizontal estiver ativada, sempre retorna falso (desktop/horizontal)
357
+ if (this.forceHorizontal) {
358
+ return false;
359
+ }
360
+ // Detecta orientação da tela: vertical (portrait) ou horizontal (landscape)
361
+ if (window.matchMedia("(orientation: portrait)").matches) {
362
+ // Vertical (mobile)
363
+ return true;
364
+ } else {
365
+ // Horizontal (desktop/tablet)
366
+ return false;
367
+ }
368
+
369
+ // var menuStatus = false;
370
+ // if (window.innerWidth < 990) {
371
+ // menuStatus = true;
372
+ // }
373
+ // return menuStatus;
374
+ },
375
+
376
+ isLoadingMethod(payload) {
377
+ const self = this;
378
+ //self.isLoaded = payload;
379
+ },
380
+
381
+ changeUuid(payload) {
382
+ //console.log("uuid", payload)
383
+ const self = this;
384
+ self.isLoaded = false;
385
+ self.completed(payload);
386
+
387
+ this.$nextTick(() => {
388
+ self.isLoaded = true;
389
+ });
390
+ },
391
+
392
+ changeName(payload) {
393
+ const self = this;
394
+ self.isLoaded = false;
395
+ self.completed(payload);
396
+
397
+ this.$nextTick(() => {
398
+ self.isLoaded = true;
399
+ });
400
+
401
+ // setTimeout(() => {
402
+ // self.currentPage = 1;
403
+ // }, 4000);
404
+
405
+ self.completedName(payload);
406
+ },
407
+
408
+ changeDedication(payload) {
409
+ const self = this;
410
+
411
+ self.currentPage = 0;
412
+
413
+ self.completed(payload);
414
+
415
+ //alert("salvou");
416
+ setTimeout(() => {
417
+ //alert("Atualizou dedicas");
418
+ self.currentPage = 3;
419
+ }, 500);
420
+
421
+ self.completedDedication(payload);
422
+ },
423
+
424
+ changeUrl(payload) {
425
+ this.$emit("changeUrl", payload);
426
+ },
427
+
428
+ changeRoute(payload) {
429
+ console.log("changeRoute");
430
+ this.$emit("changeRoute", payload);
431
+ },
432
+
433
+ changeRouteContinue(payload) {
434
+ console.log("changeRouteContinue");
435
+ this.$emit("changeRouteContinue", payload);
436
+ },
437
+
438
+ changeBirthday(payload) {
439
+ // this.$emit("completedBirthday", payload);
440
+ this.completedBirthday(payload);
441
+ },
442
+
443
+ completed(payload) {
444
+ const self = this;
445
+
446
+ /**
447
+ * Função disparada ao ser finalizada customização. Recebe um objeto.
448
+ */
449
+ //self.completed(payload);
450
+ this.$emit("completed", payload);
451
+ },
452
+
453
+ completedName(payload) {
454
+ /**
455
+ * Função disparada ao ser finalizada customização. Recebe um objeto.
456
+ */
457
+ this.$emit("completedName", payload);
458
+ },
459
+
460
+ completedDedication(payload) {
461
+ /**
462
+ * Função disparada ao ser finalizada customização. Recebe um objeto.
463
+ */
464
+ this.$emit("completedDedication", payload);
465
+ },
466
+
467
+ completedBirthday(payload) {
468
+ /**
469
+ * Função disparada ao ser finalizada customização. Recebe um objeto.
470
+ */
471
+ this.$emit("completedBirthday", payload);
472
+ },
473
+ },
474
+ };
475
+ </script>
476
+
477
+ <style lang="scss">
478
+ @import "./node_modules/@tiddh/brave-tokens/dist/styles/style.scss";
479
+
480
+ .top-bar-area {
481
+ position: absolute;
482
+ width: 100%;
483
+ top: 0px;
484
+ left: 0px;
485
+
486
+ @media (max-width: 990px) {
487
+ position: relative;
488
+ background-color: white;
489
+ }
490
+ }
491
+
492
+ body {
493
+ margin: 0px;
494
+ }
495
+ .storybook {
496
+ &-6 {
497
+ width: columns("lg", 6);
498
+ }
499
+ &-12 {
500
+ width: columns("lg", 12);
501
+ }
502
+ &-25 {
503
+ width: columns("lg", 25);
504
+ }
505
+ }
506
+
507
+ .invisible {
508
+ opacity: 0;
509
+ }
510
+
511
+ .preview-full {
512
+ height: 100vh;
513
+ background-color: #ece6ee;
514
+ overflow-y: hidden;
515
+
516
+ @media (max-width: 990px) {
517
+ overflow-y: auto;
518
+ height: auto;
519
+ }
520
+ //neutral medium + $opacity-intense
521
+ }
522
+
523
+ .preview-mobile-area {
524
+ width: 100%;
525
+ position: relative;
526
+ }
527
+
528
+ .preview-desktop-area {
529
+ position: relative;
530
+ z-index: 4;
531
+ height: 100vh;
532
+ //height: 100%;
533
+ display: flex;
534
+ justify-content: center;
535
+ }
536
+
537
+ .preview-mobile-tools {
538
+ // width: 100vw;
539
+ // position: fixed;
540
+ // height: 100vh;
541
+ // top: 0px;
542
+ // left: 0px;
543
+ // z-index: 3;
544
+
545
+ @media (max-width: 990px) {
546
+ position: relative;
547
+ z-index: 20;
548
+ }
549
+ }
550
+
551
+ .custom-properties {
552
+ position: absolute;
553
+ top: 30px;
554
+ }
555
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiddh/brave-vue",
3
- "version": "1.93.282",
3
+ "version": "1.93.283",
4
4
  "private": false,
5
5
  "main": "dist/brave-vue.ssr.js",
6
6
  "browser": "dist/brave-vue.esm.js",