@tiddh/brave-vue 1.93.268 → 1.93.270

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 (430) hide show
  1. package/README.md +23 -23
  2. package/dist/brave-vue.esm.css +1 -0
  3. package/dist/brave-vue.esm.js +831 -1312
  4. package/dist/brave-vue.min.js +2 -2
  5. package/dist/brave-vue.ssr.css +1 -0
  6. package/dist/brave-vue.ssr.js +795 -1271
  7. package/dist/src/App.vue +28 -28
  8. package/dist/src/Avatar/Avatar.stories.js +236 -238
  9. package/dist/src/Avatar/Avatar.vue +427 -500
  10. package/dist/src/Avatar/elements/CategoryCustomizations.vue +554 -558
  11. package/dist/src/Avatar/elements/CustomizationPanel.vue +1301 -1327
  12. package/dist/src/Avatar/elements/CustomizationPreview.vue +180 -180
  13. package/dist/src/Avatar/elements/CustomizationView.vue +850 -846
  14. package/dist/src/Avatar/elements/ToggleColor.vue +128 -128
  15. package/dist/src/Avatar/elements/ToggleSubcategory.vue +154 -155
  16. package/dist/src/Avatar/elements/scss/avatar-vfx.scss +717 -717
  17. package/dist/src/Avatar/utils.js +20 -149
  18. package/dist/src/Avatar.stories.js +236 -238
  19. package/dist/src/Avatar.vue +427 -500
  20. package/dist/src/Book/Preview.vue +1311 -1291
  21. package/dist/src/Book/PreviewBook.vue +484 -484
  22. package/dist/src/Book/PreviewFull.vue +196 -195
  23. package/dist/src/Book/PreviewMobile.vue +1271 -1271
  24. package/dist/src/Book/PreviewTools.vue +3892 -3937
  25. package/dist/src/Book/css/flipbook.scss +166 -166
  26. package/dist/src/Book/flipbook.js +47 -0
  27. package/dist/src/Book/js/turn.min.js +68 -68
  28. package/dist/src/Book/js/zoom.min.js +26 -26
  29. package/dist/src/BottomBar.vue +445 -443
  30. package/dist/src/Brand.stories.js +275 -275
  31. package/dist/src/Brand.vue +364 -364
  32. package/dist/src/Brands/Brand.stories.js +275 -275
  33. package/dist/src/Brands/Brand.vue +364 -364
  34. package/dist/src/Breadcrumb.stories.js +82 -82
  35. package/dist/src/Breadcrumb.vue +206 -206
  36. package/dist/src/Button.vue +1886 -1886
  37. package/dist/src/ButtonWithIcon.stories.js +133 -133
  38. package/dist/src/Buttons/Button.vue +1886 -1886
  39. package/dist/src/Buttons/ButtonWithIcon.stories.js +133 -133
  40. package/dist/src/Buttons/Ghost.stories.js +78 -78
  41. package/dist/src/Buttons/Link.stories.js +77 -77
  42. package/dist/src/Buttons/Loading.stories.js +107 -107
  43. package/dist/src/Buttons/Primary.stories.js +79 -79
  44. package/dist/src/Buttons/ProgressiveLoading.stories.js +94 -94
  45. package/dist/src/Buttons/Secondary.stories.js +79 -79
  46. package/dist/src/Caption.stories.js +27 -27
  47. package/dist/src/Caption.vue +63 -63
  48. package/dist/src/Card/Card.stories.js +37 -37
  49. package/dist/src/Card/Card.vue +131 -131
  50. package/dist/src/Card/CardLink.stories.js +44 -44
  51. package/dist/src/Card/CardLink.vue +233 -233
  52. package/dist/src/Card/CardOption.stories.js +47 -47
  53. package/dist/src/Card/CardOption.vue +274 -274
  54. package/dist/src/Card/CardProduct.stories.js +133 -133
  55. package/dist/src/Card/CardProduct.vue +1031 -1031
  56. package/dist/src/Card/CatalogProduct.stories.js +154 -154
  57. package/dist/src/Card/CatalogProduct.vue +898 -898
  58. package/dist/src/Card/CoverProduct.stories.js +134 -134
  59. package/dist/src/Card/CoverProduct.vue +526 -526
  60. package/dist/src/Card.stories.js +37 -37
  61. package/dist/src/Card.vue +131 -131
  62. package/dist/src/CardLink.stories.js +44 -44
  63. package/dist/src/CardLink.vue +233 -233
  64. package/dist/src/CardOption.stories.js +47 -47
  65. package/dist/src/CardOption.vue +274 -274
  66. package/dist/src/CardProduct.stories.js +133 -133
  67. package/dist/src/CardProduct.vue +1031 -1031
  68. package/dist/src/CatalogProduct.stories.js +154 -154
  69. package/dist/src/CatalogProduct.vue +898 -898
  70. package/dist/src/CategoryCustomizations.vue +554 -558
  71. package/dist/src/Checkbox.stories.js +39 -39
  72. package/dist/src/Checkbox.vue +205 -205
  73. package/dist/src/CoverProduct.stories.js +134 -134
  74. package/dist/src/CoverProduct.vue +526 -526
  75. package/dist/src/CustomizationPanel.vue +1301 -1327
  76. package/dist/src/CustomizationPreview.vue +180 -180
  77. package/dist/src/CustomizationView.vue +850 -846
  78. package/dist/src/Feedback.vue +320 -320
  79. package/dist/src/Form/Checkbox.stories.js +39 -39
  80. package/dist/src/Form/Checkbox.vue +205 -205
  81. package/dist/src/Form/GenderSelect.stories.js +61 -60
  82. package/dist/src/Form/GenderSelect.vue +302 -302
  83. package/dist/src/Form/Input.stories.js +555 -555
  84. package/dist/src/Form/Input.vue +951 -951
  85. package/dist/src/Form/InputAddress.vue +702 -702
  86. package/dist/src/Form/InputAddressBilling.vue +633 -633
  87. package/dist/src/Form/InputAddressNumber.vue +634 -634
  88. package/dist/src/Form/InputCardNumber.vue +653 -653
  89. package/dist/src/Form/InputEdit.vue +235 -235
  90. package/dist/src/Form/InputEmail.vue +240 -240
  91. package/dist/src/Form/InputName.vue +352 -352
  92. package/dist/src/Form/Options.stories.js +94 -94
  93. package/dist/src/Form/Options.vue +398 -398
  94. package/dist/src/Form/Picker.stories.js +43 -43
  95. package/dist/src/Form/PickerBirthday.vue +631 -631
  96. package/dist/src/Form/Radius.stories.js +49 -49
  97. package/dist/src/Form/Radius.vue +160 -160
  98. package/dist/src/Form/Select.stories.js +97 -97
  99. package/dist/src/Form/Select.vue +404 -404
  100. package/dist/src/Form/SelectBirthday.vue +419 -419
  101. package/dist/src/Form/TextArea.stories.js +52 -52
  102. package/dist/src/Form/TextArea.vue +277 -277
  103. package/dist/src/GenderSelect.stories.js +61 -60
  104. package/dist/src/GenderSelect.vue +302 -302
  105. package/dist/src/Ghost.stories.js +78 -78
  106. package/dist/src/HR.vue +68 -68
  107. package/dist/src/Heading.stories.js +34 -34
  108. package/dist/src/Heading.vue +102 -102
  109. package/dist/src/HelloWorld.vue +59 -59
  110. package/dist/src/Icon.stories.js +1155 -1155
  111. package/dist/src/Icon.vue +364 -364
  112. package/dist/src/Icons/Icon.stories.js +1155 -1155
  113. package/dist/src/Icons/Icon.vue +364 -364
  114. package/dist/src/Images/Images.stories.js +25 -25
  115. package/dist/src/Images/Images.vue +51 -51
  116. package/dist/src/Images.stories.js +25 -25
  117. package/dist/src/Images.vue +51 -51
  118. package/dist/src/Input.stories.js +555 -555
  119. package/dist/src/Input.vue +951 -951
  120. package/dist/src/InputAddress.vue +702 -702
  121. package/dist/src/InputAddressBilling.vue +633 -633
  122. package/dist/src/InputAddressNumber.vue +634 -634
  123. package/dist/src/InputCardNumber.vue +653 -653
  124. package/dist/src/InputEdit.vue +235 -235
  125. package/dist/src/InputEmail.vue +240 -240
  126. package/dist/src/InputName.vue +352 -352
  127. package/dist/src/Link.stories.js +77 -77
  128. package/dist/src/Loading/Loading.stories.js +25 -25
  129. package/dist/src/Loading/Loading.vue +103 -103
  130. package/dist/src/Loading.stories.js +25 -25
  131. package/dist/src/Loading.vue +103 -103
  132. package/dist/src/MenuNavigation.stories.js +87 -87
  133. package/dist/src/MenuNavigation.vue +227 -227
  134. package/dist/src/Modal/Modal.stories.js +56 -56
  135. package/dist/src/Modal/Modal.vue +469 -469
  136. package/dist/src/Modal/Sidebar.stories.js +64 -64
  137. package/dist/src/Modal/Sidebar.vue +649 -649
  138. package/dist/src/Modal.stories.js +56 -56
  139. package/dist/src/Modal.vue +469 -469
  140. package/dist/src/Navigation/Breadcrumb.stories.js +82 -82
  141. package/dist/src/Navigation/Breadcrumb.vue +206 -206
  142. package/dist/src/Navigation/MenuNavigation.stories.js +87 -87
  143. package/dist/src/Navigation/MenuNavigation.vue +227 -227
  144. package/dist/src/Navigation/Stepper.stories.js +82 -82
  145. package/dist/src/Navigation/Stepper.vue +222 -222
  146. package/dist/src/Navigation/Tabs.stories.js +124 -124
  147. package/dist/src/Navigation/Tabs.vue +192 -192
  148. package/dist/src/Navigation/TabsLine.vue +407 -407
  149. package/dist/src/Navigation/TopBar.stories.js +217 -217
  150. package/dist/src/Navigation/TopBar.vue +370 -370
  151. package/dist/src/Options.stories.js +94 -94
  152. package/dist/src/Options.vue +398 -398
  153. package/dist/src/Paragraph.stories.js +33 -33
  154. package/dist/src/Paragraph.vue +85 -85
  155. package/dist/src/Picker.stories.js +43 -43
  156. package/dist/src/PickerBirthday.vue +631 -631
  157. package/dist/src/Poster/PreviewPoster.vue +740 -740
  158. package/dist/src/Preview/Book/Preview.vue +1311 -1291
  159. package/dist/src/Preview/Book/PreviewBook.vue +484 -484
  160. package/dist/src/Preview/Book/PreviewFull.vue +196 -195
  161. package/dist/src/Preview/Book/PreviewMobile.vue +1271 -1271
  162. package/dist/src/Preview/Book/PreviewTools.vue +3892 -3937
  163. package/dist/src/Preview/Book/css/flipbook.scss +166 -166
  164. package/dist/src/Preview/Book/flipbook.js +47 -0
  165. package/dist/src/Preview/Book/js/turn.min.js +68 -68
  166. package/dist/src/Preview/Book/js/zoom.min.js +26 -26
  167. package/dist/src/Preview/BottomBar.vue +445 -443
  168. package/dist/src/Preview/Poster/PreviewPoster.vue +740 -740
  169. package/dist/src/Preview/Preview.stories.js +518 -678
  170. package/dist/src/Preview/Preview.vue +633 -619
  171. package/dist/src/Preview/PreviewStories_bkp.js +588 -588
  172. package/dist/src/Preview/Snippet/PreviewSnippet.vue +555 -555
  173. package/dist/src/Preview/Snippet/PreviewSnippetHorizontal.vue +1330 -1310
  174. package/dist/src/Preview/Snippet/PreviewSnippetVertical.vue +1359 -1339
  175. package/dist/src/Preview/Wallpaper/PreviewWallpaper.vue +730 -730
  176. package/dist/src/Preview.stories.js +518 -678
  177. package/dist/src/Preview.vue +1311 -1291
  178. package/dist/src/PreviewBook.vue +484 -484
  179. package/dist/src/PreviewFull.vue +196 -195
  180. package/dist/src/PreviewMobile.vue +1271 -1271
  181. package/dist/src/PreviewPoster.vue +740 -740
  182. package/dist/src/PreviewSnippet.vue +555 -0
  183. package/dist/src/PreviewSnippetHorizontal.vue +1330 -1310
  184. package/dist/src/PreviewSnippetVertical.vue +1359 -1339
  185. package/dist/src/PreviewStories_bkp.js +588 -588
  186. package/dist/src/PreviewTools.vue +3892 -3937
  187. package/dist/src/PreviewWallpaper.vue +730 -730
  188. package/dist/src/Primary.stories.js +79 -79
  189. package/dist/src/ProgressiveLoading.stories.js +94 -94
  190. package/dist/src/Radius.stories.js +49 -49
  191. package/dist/src/Radius.vue +160 -160
  192. package/dist/src/Secondary.stories.js +79 -79
  193. package/dist/src/Select.stories.js +97 -97
  194. package/dist/src/Select.vue +404 -404
  195. package/dist/src/SelectBirthday.vue +419 -419
  196. package/dist/src/Sidebar.stories.js +64 -64
  197. package/dist/src/Sidebar.vue +649 -649
  198. package/dist/src/Snippet/PreviewSnippet.vue +555 -555
  199. package/dist/src/Snippet/PreviewSnippetHorizontal.vue +1330 -1310
  200. package/dist/src/Snippet/PreviewSnippetVertical.vue +1359 -1339
  201. package/dist/src/Spinner.vue +89 -89
  202. package/dist/src/Stepper.stories.js +82 -82
  203. package/dist/src/Stepper.vue +222 -222
  204. package/dist/src/Tabs.stories.js +124 -124
  205. package/dist/src/Tabs.vue +192 -192
  206. package/dist/src/TabsLine.vue +407 -407
  207. package/dist/src/TextArea.stories.js +52 -52
  208. package/dist/src/TextArea.vue +277 -277
  209. package/dist/src/ToggleColor.vue +128 -128
  210. package/dist/src/ToggleSubcategory.vue +154 -155
  211. package/dist/src/Tooltip/Tooltip.stories.js +51 -51
  212. package/dist/src/Tooltip/Tooltip.vue +185 -185
  213. package/dist/src/Tooltip.stories.js +51 -51
  214. package/dist/src/Tooltip.vue +185 -185
  215. package/dist/src/TopBar.stories.js +217 -217
  216. package/dist/src/TopBar.vue +370 -370
  217. package/dist/src/Typography/Caption.stories.js +27 -27
  218. package/dist/src/Typography/Caption.vue +63 -63
  219. package/dist/src/Typography/Heading.stories.js +34 -34
  220. package/dist/src/Typography/Heading.vue +102 -102
  221. package/dist/src/Typography/Paragraph.stories.js +33 -33
  222. package/dist/src/Typography/Paragraph.vue +85 -85
  223. package/dist/src/Utils/Feedback.vue +320 -320
  224. package/dist/src/Utils/HR.vue +68 -68
  225. package/dist/src/Utils/Spinner.vue +89 -89
  226. package/dist/src/Utils/feedback.stories.js +44 -44
  227. package/dist/src/Utils/hr-primary.stories.js +37 -37
  228. package/dist/src/Utils/spinner.stories.js +23 -23
  229. package/dist/src/Wallpaper/PreviewWallpaper.vue +730 -730
  230. package/dist/src/avatar-vfx.scss +717 -717
  231. package/dist/src/components/Avatar/Avatar.stories.js +236 -238
  232. package/dist/src/components/Avatar/Avatar.vue +427 -500
  233. package/dist/src/components/Avatar/elements/CategoryCustomizations.vue +554 -558
  234. package/dist/src/components/Avatar/elements/CustomizationPanel.vue +1301 -1327
  235. package/dist/src/components/Avatar/elements/CustomizationPreview.vue +180 -180
  236. package/dist/src/components/Avatar/elements/CustomizationView.vue +850 -846
  237. package/dist/src/components/Avatar/elements/ToggleColor.vue +128 -128
  238. package/dist/src/components/Avatar/elements/ToggleSubcategory.vue +154 -155
  239. package/dist/src/components/Avatar/elements/scss/avatar-vfx.scss +717 -717
  240. package/dist/src/components/Avatar/utils.js +20 -149
  241. package/dist/src/components/Brands/Brand.stories.js +275 -275
  242. package/dist/src/components/Brands/Brand.vue +364 -364
  243. package/dist/src/components/Buttons/Button.vue +1886 -1886
  244. package/dist/src/components/Buttons/ButtonWithIcon.stories.js +133 -133
  245. package/dist/src/components/Buttons/Ghost.stories.js +78 -78
  246. package/dist/src/components/Buttons/Link.stories.js +77 -77
  247. package/dist/src/components/Buttons/Loading.stories.js +107 -107
  248. package/dist/src/components/Buttons/Primary.stories.js +79 -79
  249. package/dist/src/components/Buttons/ProgressiveLoading.stories.js +94 -94
  250. package/dist/src/components/Buttons/Secondary.stories.js +79 -79
  251. package/dist/src/components/Card/Card.stories.js +37 -37
  252. package/dist/src/components/Card/Card.vue +131 -131
  253. package/dist/src/components/Card/CardLink.stories.js +44 -44
  254. package/dist/src/components/Card/CardLink.vue +233 -233
  255. package/dist/src/components/Card/CardOption.stories.js +47 -47
  256. package/dist/src/components/Card/CardOption.vue +274 -274
  257. package/dist/src/components/Card/CardProduct.stories.js +133 -133
  258. package/dist/src/components/Card/CardProduct.vue +1031 -1031
  259. package/dist/src/components/Card/CatalogProduct.stories.js +154 -154
  260. package/dist/src/components/Card/CatalogProduct.vue +898 -898
  261. package/dist/src/components/Card/CoverProduct.stories.js +134 -134
  262. package/dist/src/components/Card/CoverProduct.vue +526 -526
  263. package/dist/src/components/Form/Checkbox.stories.js +39 -39
  264. package/dist/src/components/Form/Checkbox.vue +205 -205
  265. package/dist/src/components/Form/GenderSelect.stories.js +61 -60
  266. package/dist/src/components/Form/GenderSelect.vue +302 -302
  267. package/dist/src/components/Form/Input.stories.js +555 -555
  268. package/dist/src/components/Form/Input.vue +951 -951
  269. package/dist/src/components/Form/InputAddress.vue +702 -702
  270. package/dist/src/components/Form/InputAddressBilling.vue +633 -633
  271. package/dist/src/components/Form/InputAddressNumber.vue +634 -634
  272. package/dist/src/components/Form/InputCardNumber.vue +653 -653
  273. package/dist/src/components/Form/InputEdit.vue +235 -235
  274. package/dist/src/components/Form/InputEmail.vue +240 -240
  275. package/dist/src/components/Form/InputName.vue +352 -352
  276. package/dist/src/components/Form/Options.stories.js +94 -94
  277. package/dist/src/components/Form/Options.vue +398 -398
  278. package/dist/src/components/Form/Picker.stories.js +43 -43
  279. package/dist/src/components/Form/PickerBirthday.vue +631 -631
  280. package/dist/src/components/Form/Radius.stories.js +49 -49
  281. package/dist/src/components/Form/Radius.vue +160 -160
  282. package/dist/src/components/Form/Select.stories.js +97 -97
  283. package/dist/src/components/Form/Select.vue +404 -404
  284. package/dist/src/components/Form/SelectBirthday.vue +419 -419
  285. package/dist/src/components/Form/TextArea.stories.js +52 -52
  286. package/dist/src/components/Form/TextArea.vue +277 -277
  287. package/dist/src/components/HelloWorld.vue +59 -59
  288. package/dist/src/components/Icons/Icon.stories.js +1155 -1155
  289. package/dist/src/components/Icons/Icon.vue +364 -364
  290. package/dist/src/components/Images/Images.stories.js +25 -25
  291. package/dist/src/components/Images/Images.vue +51 -51
  292. package/dist/src/components/Loading/Loading.stories.js +25 -25
  293. package/dist/src/components/Loading/Loading.vue +103 -103
  294. package/dist/src/components/Modal/Modal.stories.js +56 -56
  295. package/dist/src/components/Modal/Modal.vue +469 -469
  296. package/dist/src/components/Modal/Sidebar.stories.js +64 -64
  297. package/dist/src/components/Modal/Sidebar.vue +649 -649
  298. package/dist/src/components/Navigation/Breadcrumb.stories.js +82 -82
  299. package/dist/src/components/Navigation/Breadcrumb.vue +206 -206
  300. package/dist/src/components/Navigation/MenuNavigation.stories.js +87 -87
  301. package/dist/src/components/Navigation/MenuNavigation.vue +227 -227
  302. package/dist/src/components/Navigation/Stepper.stories.js +82 -82
  303. package/dist/src/components/Navigation/Stepper.vue +222 -222
  304. package/dist/src/components/Navigation/Tabs.stories.js +124 -124
  305. package/dist/src/components/Navigation/Tabs.vue +192 -192
  306. package/dist/src/components/Navigation/TabsLine.vue +407 -407
  307. package/dist/src/components/Navigation/TopBar.stories.js +217 -217
  308. package/dist/src/components/Navigation/TopBar.vue +370 -370
  309. package/dist/src/components/Preview/Book/Preview.vue +1311 -1291
  310. package/dist/src/components/Preview/Book/PreviewBook.vue +484 -484
  311. package/dist/src/components/Preview/Book/PreviewFull.vue +196 -195
  312. package/dist/src/components/Preview/Book/PreviewMobile.vue +1271 -1271
  313. package/dist/src/components/Preview/Book/PreviewTools.vue +3892 -3937
  314. package/dist/src/components/Preview/Book/css/flipbook.scss +166 -166
  315. package/dist/src/components/Preview/Book/flipbook.js +47 -0
  316. package/dist/src/components/Preview/Book/js/turn.min.js +68 -68
  317. package/dist/src/components/Preview/Book/js/zoom.min.js +26 -26
  318. package/dist/src/components/Preview/BottomBar.vue +445 -443
  319. package/dist/src/components/Preview/Poster/PreviewPoster.vue +740 -740
  320. package/dist/src/components/Preview/Preview.stories.js +518 -678
  321. package/dist/src/components/Preview/Preview.vue +633 -619
  322. package/dist/src/components/Preview/PreviewStories_bkp.js +588 -588
  323. package/dist/src/components/Preview/Snippet/PreviewSnippet.vue +555 -555
  324. package/dist/src/components/Preview/Snippet/PreviewSnippetHorizontal.vue +1330 -1310
  325. package/dist/src/components/Preview/Snippet/PreviewSnippetVertical.vue +1359 -1339
  326. package/dist/src/components/Preview/Wallpaper/PreviewWallpaper.vue +730 -730
  327. package/dist/src/components/Tooltip/Tooltip.stories.js +51 -51
  328. package/dist/src/components/Tooltip/Tooltip.vue +185 -185
  329. package/dist/src/components/Typography/Caption.stories.js +27 -27
  330. package/dist/src/components/Typography/Caption.vue +63 -63
  331. package/dist/src/components/Typography/Heading.stories.js +34 -34
  332. package/dist/src/components/Typography/Heading.vue +102 -102
  333. package/dist/src/components/Typography/Paragraph.stories.js +33 -33
  334. package/dist/src/components/Typography/Paragraph.vue +85 -85
  335. package/dist/src/components/Utils/Feedback.vue +320 -320
  336. package/dist/src/components/Utils/HR.vue +68 -68
  337. package/dist/src/components/Utils/Spinner.vue +89 -89
  338. package/dist/src/components/Utils/feedback.stories.js +44 -44
  339. package/dist/src/components/Utils/hr-primary.stories.js +37 -37
  340. package/dist/src/components/Utils/spinner.stories.js +23 -23
  341. package/dist/src/components/index.js +42 -42
  342. package/dist/src/components/locale/config.js +145 -0
  343. package/dist/src/components/locale/language.json +686 -317
  344. package/dist/src/components/locale/storybook-i18n.js +44 -0
  345. package/dist/src/config.js +145 -0
  346. package/dist/src/css/flipbook.scss +166 -166
  347. package/dist/src/elements/CategoryCustomizations.vue +554 -558
  348. package/dist/src/elements/CustomizationPanel.vue +1301 -1327
  349. package/dist/src/elements/CustomizationPreview.vue +180 -180
  350. package/dist/src/elements/CustomizationView.vue +850 -846
  351. package/dist/src/elements/ToggleColor.vue +128 -128
  352. package/dist/src/elements/ToggleSubcategory.vue +154 -155
  353. package/dist/src/elements/scss/avatar-vfx.scss +717 -717
  354. package/dist/src/entry.js +36 -36
  355. package/dist/src/feedback.stories.js +44 -44
  356. package/dist/src/flipbook.js +47 -0
  357. package/dist/src/flipbook.scss +166 -166
  358. package/dist/src/hr-primary.stories.js +37 -37
  359. package/dist/src/index.js +42 -42
  360. package/dist/src/js/turn.min.js +68 -68
  361. package/dist/src/js/zoom.min.js +26 -26
  362. package/dist/src/language.json +686 -317
  363. package/dist/src/locale/config.js +145 -0
  364. package/dist/src/locale/language.json +686 -317
  365. package/dist/src/locale/storybook-i18n.js +44 -0
  366. package/dist/src/main.js +8 -8
  367. package/dist/src/scss/avatar-vfx.scss +717 -717
  368. package/dist/src/serve-dev.js +8 -8
  369. package/dist/src/serve-dev.vue +17 -17
  370. package/dist/src/spinner.stories.js +23 -23
  371. package/dist/src/storybook-i18n.js +44 -0
  372. package/dist/src/styles/styles.scss +9 -9
  373. package/dist/src/styles.scss +9 -9
  374. package/dist/src/turn.min.js +68 -68
  375. package/dist/src/utils.js +20 -149
  376. package/dist/src/wrapper.js +69 -69
  377. package/dist/src/zoom.min.js +26 -26
  378. package/package.json +126 -125
  379. package/dist/css/app.fe0bf874.css +0 -1
  380. package/dist/favicon.ico +0 -0
  381. package/dist/images/a3-poster-lg.png +0 -0
  382. package/dist/images/a3-poster-lg@2x.png +0 -0
  383. package/dist/images/book-cover-overlay.png +0 -0
  384. package/dist/images/brands/branding.svg +0 -9
  385. package/dist/images/brands/payment-agiplan.svg +0 -5
  386. package/dist/images/brands/payment-amex.svg +0 -4
  387. package/dist/images/brands/payment-boleto.svg +0 -6
  388. package/dist/images/brands/payment-diners.svg +0 -4
  389. package/dist/images/brands/payment-elo.svg +0 -11
  390. package/dist/images/brands/payment-hipercard.svg +0 -11
  391. package/dist/images/brands/payment-jcb.svg +0 -7
  392. package/dist/images/brands/payment-mastercard.svg +0 -6
  393. package/dist/images/brands/payment-pix.svg +0 -4
  394. package/dist/images/brands/payment-visa.svg +0 -4
  395. package/dist/images/brands/payment-zcredez.svg +0 -4
  396. package/dist/images/brands/social-facebook.svg +0 -3
  397. package/dist/images/brands/social-google.svg +0 -8
  398. package/dist/images/mochila-biscoito.png +0 -0
  399. package/dist/images/mochila-biscoito.webp +0 -0
  400. package/dist/images/mochila-biscoito@2x.png +0 -0
  401. package/dist/images/mochila-biscoito@2x.webp +0 -0
  402. package/dist/images/mochila-fofilha.png +0 -0
  403. package/dist/images/mochila-fofilha.webp +0 -0
  404. package/dist/images/mochila-fofilha@2x.png +0 -0
  405. package/dist/images/mochila-fofilha@2x.webp +0 -0
  406. package/dist/images/placeholder-a4.jpg +0 -0
  407. package/dist/images/placeholder-load-frame_a3-loading.jpg +0 -0
  408. package/dist/images/placeholder-poster-loading.jpg +0 -0
  409. package/dist/images/placeholder-square.jpg +0 -0
  410. package/dist/images/placeholder-wallpaper-loading.jpg +0 -0
  411. package/dist/images/product-type-a3-frame-poster@2x.png +0 -0
  412. package/dist/images/product-type-a3-frame.png +0 -0
  413. package/dist/images/product-type-a3-frame@2x.png +0 -0
  414. package/dist/images/product-type-wallpaper-loading-wallpaper@2x.png +0 -0
  415. package/dist/images/product-type-wallpaper-loading.png +0 -0
  416. package/dist/images/product-type-wallpaper-placeholder-wallpaper@2x.png +0 -0
  417. package/dist/images/product-type-wallpaper-wallpaper@2x.png +0 -0
  418. package/dist/images/wallpaper-preview-lg.png +0 -0
  419. package/dist/images/wallpaper-preview-lg@2x.jpg +0 -0
  420. package/dist/images/wallpaper-preview-lg@2x.png +0 -0
  421. package/dist/images/wallpaper-preview-sm.jpg +0 -0
  422. package/dist/images/wallpaper-preview-sm.png +0 -0
  423. package/dist/images/wallpaper-preview-sm@2x.jpg +0 -0
  424. package/dist/images/wallpaper-preview-sm@2x.png +0 -0
  425. package/dist/img/logo.82b9c7a5.png +0 -0
  426. package/dist/index.html +0 -1
  427. package/dist/js/app.e6b95826.js +0 -2
  428. package/dist/js/app.e6b95826.js.map +0 -1
  429. package/dist/js/chunk-vendors.266ecd85.js +0 -8
  430. package/dist/js/chunk-vendors.266ecd85.js.map +0 -1
@@ -1,846 +1,850 @@
1
- <template>
2
- <div>
3
- <link
4
- rel="stylesheet"
5
- href="https://use.fontawesome.com/releases/v5.8.1/css/all.css"
6
- integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf"
7
- crossorigin="anonymous"
8
- />
9
- <div class="mobile-tooltip" @click="removeTooltip">
10
- <div class="tooltip">
11
- Lorem ipsum dolor sit amet, eum ne sale vidit epicuri, usu populo
12
- incorrupte ex. His falli intellegebat no.
13
- <i class="fas fa-times"></i>
14
- </div>
15
- </div>
16
- <CustomizationPreview
17
- :customizations="customizations"
18
- :selected-character="selectedCharacter"
19
- :character-height="characterHeight ? characterHeight : null"
20
- :gradient-colors="gradient_colors"
21
- :character-slug="custom_properties.slug"
22
- :characterHeight="1"
23
- :dir="dir"
24
- />
25
- <CustomizationPanel
26
- :builder-api="builder_api"
27
- :selected-character="selectedCharacter"
28
- :character-name="custom_properties.user_data.properties.nome.value"
29
- :subscription-id="'1'"
30
- :stack-id="'1'"
31
- :character-slug="custom_properties.slug"
32
- :character-id="characterId"
33
- :character-type-id="characterTypeId"
34
- :character-is-male="custom_properties.is_male"
35
- :categories-assets="categoriesAssets"
36
- :disabled-categories="disabledCategories"
37
- :customizations="customizations"
38
- :builder-product-id="
39
- builderProductId ? builderProductId : this.custom_properties.product_id
40
- "
41
- :userDataProperties="custom_properties.user_data.properties"
42
- :builderLayoutId="builderLayoutId"
43
- :language="language"
44
- :typeLanguage="typeLanguage"
45
- :dir="dir"
46
- :builder_apk="builder_apk"
47
- @update:customization="handleCustomization"
48
- @startedMethod="startedMethod"
49
- @completedMethod="completedMethod"
50
- />
51
- </div>
52
- </template>
53
-
54
- <script>
55
- const axios = require("axios");
56
- import sort from "array-sort";
57
- import CustomizationPanel from "./CustomizationPanel.vue";
58
- import CustomizationPreview from "./CustomizationPreview.vue";
59
-
60
- export default {
61
- name: "CustomizationView",
62
- components: {
63
- CustomizationPanel,
64
- CustomizationPreview,
65
- },
66
- props: {
67
- custom_properties: {
68
- type: Object,
69
- required: true,
70
- },
71
- builder_api: {
72
- type: String,
73
- default: "https://builder.dentrodahistoria.com.br/api",
74
- },
75
- is_subscription: {
76
- type: Boolean,
77
- default: false,
78
- },
79
- gradient_colors: {
80
- type: Object,
81
- required: false,
82
- },
83
- builderLayoutId: {
84
- type: [Number, String],
85
- required: false,
86
- },
87
- language: {
88
- type: String,
89
- required: false,
90
- },
91
- typeLanguage: {
92
- type: String,
93
- required: false,
94
- default: "pt",
95
- },
96
- dir: {
97
- type: String,
98
- default: "ltr",
99
- required: false,
100
- },
101
- builder_apk: {
102
- type: String,
103
- required: false,
104
- //default: "https://builder.dentrodahistoria.com.br/api",
105
- },
106
- },
107
- data() {
108
- return {
109
- categoriesAssets: {},
110
- customizations: [], // Velho e bom customizations
111
- requiredCategories: [], // Acumularás as customizações necessárias
112
- disabledCategories: [], // Acumulara as customizações que não podem ser customizadas
113
- isIniting: false,
114
- isLoading: false,
115
- selectedCharacter: {},
116
- characterId: "",
117
- characterTypeId: "",
118
- characterName: "",
119
- loadedCustomizations: [],
120
- characterIsMale: this.custom_properties.is_male,
121
- builderProductId: false,
122
- characterHeight: null,
123
- userDataProperties: this.custom_properties.user_data.properties,
124
- };
125
- },
126
- computed: {
127
- apkParameter() {
128
- return this.builder_apk ? `apk=${this.builder_apk}` : "";
129
- },
130
- },
131
- mounted() {
132
- this.isIniting = true;
133
- this.loadCustomizationTreeList()
134
- .then(() => {
135
- this.isIniting = false;
136
- this.isLoading = true;
137
- })
138
- // .then(this.fakeData)
139
- .then(this.parseCollection)
140
- .then(this.loadCustomizationCharacter)
141
- .then(this.initCustomizationCharacter)
142
- .then(this.initDisabledCategories)
143
- .then(() => {
144
- this.isLoading = false;
145
- });
146
- },
147
- methods: {
148
- startedMethod() {
149
- this.$emit("startedMethod");
150
- },
151
- completedMethod(payload) {
152
- if (payload.success) {
153
- this.$emit("completedMethod", {
154
- updatedCustomizations: payload.updatedCustomizations,
155
- updatedUuid: payload.updatedUuid,
156
- characterName: this.characterName,
157
- characterIsMale: this.custom_properties.is_male, //this.characterIsMale,
158
- categories: payload.categories,
159
- success: payload.success,
160
- });
161
- } else {
162
- this.$emit("completedMethod", {
163
- success: payload.success,
164
- });
165
- }
166
- },
167
- async loadCustomizationTreeList() {
168
- let res;
169
-
170
- //aaaa;
171
-
172
- if (this.treelist) {
173
- if (
174
- this.treelist.character_categories_assets &&
175
- this.treelist.character_categories_assets.length > 0
176
- ) {
177
- this.categoriesAssets = this.treelist.character_categories_assets[0];
178
- return;
179
- }
180
- }
181
-
182
- if (this.custom_properties.uuid) {
183
- let url = `${this.builder_api}/customs_characters/${this.custom_properties.uuid}`;
184
- if (this.builder_apk) {
185
- url += `?apk=${encodeURIComponent(this.builder_apk)}`;
186
- }
187
- const { data } = await axios.get(url);
188
-
189
- res = await axios.get(
190
- `${this.builder_api}/characters/${
191
- data.custom.character_id
192
- }/categories/assets/treelist?character_type_id=${
193
- data.custom.user_data.type
194
- }&subscription=${this.is_subscription}${
195
- this.language ? `&language=${this.language}` : ""
196
- }&product_id=${this.custom_properties.product_id}${
197
- this.builder_apk ? `&${this.apkParameter}` : ""
198
- }`
199
- );
200
- this.selectedCharacter.slug =
201
- res.data.character_categories_assets[0].type.code;
202
- this.characterId = data.custom.character_id;
203
- this.characterName = data.custom.user_data.properties.nome.value;
204
- this.characterIsMale = this.custom_properties.is_male; //res.data.character_categories_assets[0].type.code === 'menino' ? true : false
205
- this.builderProductId = this.custom_properties.product_id;
206
- this.characterTypeId = data.custom.user_data.type;
207
- this.loadedCustomizations = data.assets;
208
-
209
- if (
210
- data.custom.user_data.properties.dedicatoria &&
211
- data.custom.user_data.properties.dedicatoria.value &&
212
- data.custom.user_data.properties.dedicatoria.value.length > 0
213
- ) {
214
- this.userDataProperties.dedicatoria = {
215
- code: "dedicatoria",
216
- property_id:
217
- data.custom.user_data.properties.dedicatoria.property_id,
218
- value: data.custom.user_data.properties.dedicatoria.value,
219
- };
220
- }
221
- if (
222
- data.custom.user_data.properties.numero &&
223
- data.custom.user_data.properties.numero.value &&
224
- data.custom.user_data.properties.numero.value.length > 0
225
- ) {
226
- this.userDataProperties.numero = {
227
- code: "numero",
228
- property_id: data.custom.user_data.properties.numero.property_id,
229
- value: data.custom.user_data.properties.numero.value,
230
- };
231
- }
232
- if (
233
- data.custom.user_data.properties.mes &&
234
- data.custom.user_data.properties.mes.value &&
235
- data.custom.user_data.properties.mes.value.length > 0
236
- ) {
237
- this.userDataProperties.mes = {
238
- code: "mes",
239
- property_id: data.custom.user_data.properties.mes.property_id,
240
- value: data.custom.user_data.properties.mes.value,
241
- };
242
- }
243
- } else {
244
- res = await axios.get(
245
- `${this.builder_api}/characters/${
246
- this.custom_properties.character_id
247
- }/categories/assets/treelist?character_type_id=${
248
- this.custom_properties.type_id ? this.custom_properties.type_id : ""
249
- }&subscription=${this.is_subscription}${
250
- this.language
251
- ? `&language=${encodeURIComponent(this.language)}`
252
- : ""
253
- }&product_id=${this.custom_properties.product_id}${
254
- this.builder_apk ? `&${this.apkParameter}` : ""
255
- }`
256
- );
257
- this.characterTypeId = this.custom_properties.type_id;
258
- this.characterId = this.custom_properties.character_id;
259
- }
260
-
261
- this.selectedCharacter =
262
- res.data.character_categories_assets[0].character;
263
-
264
- this.categoriesAssets =
265
- res.data.character_categories_assets &&
266
- res.data.character_categories_assets.length
267
- ? res.data.character_categories_assets[0]
268
- : null;
269
- },
270
- /*
271
- * Essa função também preenche as informações de customização,
272
- * além do array de categorias obrigatórias e no caso do usuário possuir
273
- * customizationId ela também preenche as categorias desabilitadas
274
- */
275
- initCustomizationCharacter() {
276
- this.categoriesAssets.categories.forEach((c) => {
277
- // Populando a tabela com as customizações necessárias
278
- if (c.required) {
279
- this.requiredCategories.push({
280
- id: c.id,
281
- name: c.name,
282
- });
283
- }
284
- c.assets.subcategories = sort(c.assets.subcategories, "sort_order");
285
- });
286
-
287
- this.categoriesAssets.categories = sort(
288
- this.categoriesAssets.categories,
289
- "sort_order"
290
- );
291
-
292
- this.categoriesAssets.groups.forEach((g) => {
293
- g.assets.subcategories = sort(g.assets.subcategories, "sort_order");
294
- });
295
-
296
- this.categoriesAssets.groups = sort(
297
- this.categoriesAssets.groups,
298
- "sort_order"
299
- );
300
- },
301
- /*
302
- * Essa função inicializa as categorias desabilitadas
303
- */
304
- initDisabledCategories() {
305
- this.customizations.forEach((custom) => {
306
- let comparisonValue;
307
- let customCategory = this.categoriesAssets.categories.find(
308
- (c) => c.id === custom.categoryId
309
- );
310
-
311
- if (!customCategory) {
312
- // A diferença entre os objetos de group e categoria
313
- // não são relevantes para essa função
314
- customCategory = this.categoriesAssets.groups.find((g) => {
315
- g.groupedCategories.includes(custom.categoryId);
316
- });
317
- }
318
-
319
- if (customCategory) {
320
- // Caso a categoria dependa de outra descemos o nível da arvore
321
- // de assets para pegar apenas as subcategorias e cores dependêntes
322
- if (customCategory.depends_category) {
323
- const relatedCustomization = this.getCustomization(
324
- customCategory.depends_category
325
- );
326
- customCategory = customCategory.assets.categories.find((c) => {
327
- comparisonValue = relatedCustomization.optionId;
328
- return c.parent_id === comparisonValue;
329
- });
330
- }
331
-
332
- // Buscando a subbategoria com as informações a respeito das
333
- // categorias para desabilitar
334
- comparisonValue = custom.optionId;
335
-
336
- const customSubcategory = customCategory.assets.subcategories.find(
337
- (subcategory) => {
338
- if (
339
- subcategory.assets.colors &&
340
- subcategory.assets.colors.length
341
- ) {
342
- let found = false;
343
- subcategory.assets.colors.forEach((color) => {
344
- if (color.id === comparisonValue) {
345
- found = true;
346
- }
347
- });
348
- return found;
349
- }
350
- return subcategory.id === comparisonValue;
351
- }
352
- );
353
-
354
- if (customSubcategory)
355
- this.updateDisabledCategories(custom, customSubcategory.disable);
356
- }
357
- });
358
- },
359
- /*
360
- * Carregando nas customizações as informaçoes de categorias e subcategorias
361
- * definidas como default no builder
362
- */
363
- initDefaultCustomizationCharacter() {
364
- let customization;
365
- const categoriesWithDependency = [];
366
-
367
- /*
368
- * Definindo as customizações default das categorias sem
369
- * dependencia
370
- */
371
- this.categoriesAssets.categories.forEach((c) => {
372
- if (c.depends_category) {
373
- categoriesWithDependency.push(c);
374
- return;
375
- }
376
- customization = this.getCategoryDefaultCustomization(c);
377
-
378
- if (c.code.includes("mooner")) {
379
- console.log(c);
380
-
381
- // c.assets.subcategories[0].parent_id;
382
- // null
383
- // c.assets.subcategories[0].id;
384
- // c.assets.subcategories[0].name;
385
- // c.assets.subcategories[0].assets.asset;
386
- // null,
387
- // null,
388
- this.updateCustomizations(
389
- c.assets.subcategories[0].parent_id,
390
- null,
391
- c.assets.subcategories[0].id,
392
- c.assets.subcategories[0].name,
393
- c.assets.subcategories[0].assets.asset,
394
- null,
395
- null
396
- );
397
- }
398
- if (customization)
399
- this.updateCustomizations(
400
- customization.categoryId,
401
- customization.relatedCategoryId,
402
- customization.optionId,
403
- customization.optionName,
404
- customization.optionAsset,
405
- customization.optionZIndex,
406
- customization.categoryZIndex
407
- );
408
- });
409
-
410
- categoriesWithDependency.forEach((c) => {
411
- customization = this.getRelatedCategoryDefaultCustomization(c);
412
- if (customization)
413
- this.updateCustomizations(
414
- customization.categoryId,
415
- customization.relatedCategoryId,
416
- customization.optionId,
417
- customization.optionName,
418
- customization.optionAsset,
419
- customization.optionZIndex,
420
- customization.categoryZIndex
421
- );
422
- });
423
- },
424
- /*
425
- * Essa função carrega as informações de personalização do personagem
426
- * Caso a subscription já possui um customizationId ele vai no serviço
427
- * buscar tal informação, caso contrário ele seta as informações
428
- * default das categorias na personalização
429
- */
430
- async loadCustomizationCharacter() {
431
- this.initDefaultCustomizationCharacter();
432
-
433
- if (this.custom_properties.uuid) {
434
- this.customizations.forEach((custom) => {
435
- this.loadedCustomizations.forEach((el) => {
436
- if (
437
- custom.relatedCategoryId &&
438
- custom.categoryId === el.assets.category_id
439
- ) {
440
- let relatedCustomizationCategory = this.loadedCustomizations.find(
441
- (cr) => {
442
- return cr.id === custom.relatedCategoryId;
443
- }
444
- );
445
-
446
- this.categoriesAssets.categories.forEach((category) => {
447
- if (category.id === el.id) {
448
- category.assets.categories.forEach((c) => {
449
- if (
450
- c.parent_id === relatedCustomizationCategory.assets.id
451
- ) {
452
- c.assets.subcategories.forEach((s) => {
453
- s.assets.colors.forEach((color) => {
454
- if (el.assets.id === color.id) {
455
- this.updateCustomizations(
456
- custom.categoryId,
457
- custom.relatedCategoryId,
458
- el.assets.id,
459
- color.hexa,
460
- color.assets.asset,
461
- el.z_index,
462
- el.z_index
463
- );
464
- }
465
- });
466
- });
467
- }
468
- });
469
- }
470
- });
471
- } else if (custom.categoryId === el.assets.category_id) {
472
- this.updateCustomizations(
473
- custom.categoryId,
474
- custom.relatedCategoryId,
475
- el.assets.id,
476
- custom.name,
477
- el.assets.asset,
478
- el.z_index,
479
- el.z_index
480
- );
481
- }
482
- });
483
- });
484
-
485
- this.loadedCustomizations.forEach((el) => {
486
- let customCategory = this.customizations.find(
487
- (c) => c.categoryId === el.id
488
- );
489
- if (!customCategory) {
490
- this.updateCustomizations(
491
- el.assets.category_id,
492
- null,
493
- el.assets.id,
494
- el.name,
495
- el.assets.asset,
496
- el.z_index,
497
- el.z_index
498
- );
499
- }
500
- });
501
- }
502
- },
503
- loadRelatedSubcategory(customization) {},
504
-
505
- updateCustomizations(
506
- categoryId,
507
- relatedCategoryId,
508
- optionId,
509
- optionName,
510
- optionAsset,
511
- optionZIndex,
512
- categoryZIndex,
513
- removeGroup = false,
514
- firstGroup = false,
515
- removableCategory = false
516
- ) {
517
- let customization = this.customizations.find(
518
- (c) => c.categoryId === categoryId
519
- );
520
- if (!removeGroup) {
521
- if (customization) {
522
- customization.categoryId = categoryId;
523
- customization.relatedCategoryId = relatedCategoryId;
524
- customization.optionId = optionId;
525
- customization.optionName = optionName;
526
- customization.optionAsset = optionAsset;
527
- customization.optionZIndex = optionZIndex;
528
- customization.categoryZIndex = categoryZIndex;
529
- } else {
530
- customization = {
531
- categoryId: categoryId,
532
- relatedCategoryId: relatedCategoryId,
533
- optionId: optionId,
534
- optionName: optionName,
535
- optionAsset: optionAsset,
536
- optionZIndex: optionZIndex,
537
- categoryZIndex: categoryZIndex,
538
- firstGroup: firstGroup ? true : null,
539
- };
540
- this.customizations.push(customization);
541
- }
542
- return customization;
543
- } else {
544
- customization = this.customizations.find(
545
- (c) => c.categoryId === categoryId
546
- );
547
- this.customizations.forEach((obj, index) => {
548
- if (obj.categoryId === customization.categoryId) {
549
- this.customizations.splice(index, 1);
550
- }
551
- });
552
- }
553
- },
554
- updateDisabledCategories(customization, categoriesToDisable) {
555
- if (categoriesToDisable) {
556
- categoriesToDisable.forEach((idToDisable) => {
557
- this.customizations.forEach((el, index) => {
558
- if (idToDisable === el.categoryId) {
559
- this.customizations.splice(index, 1);
560
- }
561
- });
562
- });
563
- }
564
-
565
- if (!categoriesToDisable || categoriesToDisable.length === 0) {
566
- this.disabledCategories.forEach((dc) => {
567
- const i = dc.relatedCustomizations.indexOf(customization);
568
- if (i > -1) dc.relatedCustomizations.splice(i, 1);
569
- });
570
-
571
- this.disabledCategories = this.disabledCategories.filter(
572
- (dc) => dc.relatedCustomizations.length !== 0
573
- );
574
- } else {
575
- categoriesToDisable.forEach((categoryToDisableId) => {
576
- let dc = this.disabledCategories.find((dc) => {
577
- return dc.categoryId === categoryToDisableId;
578
- });
579
-
580
- if (dc) {
581
- if (!dc.relatedCustomizations.includes(customization))
582
- dc.relatedCustomizations.push(customization);
583
- } else {
584
- dc = {
585
- categoryId: categoryToDisableId,
586
- relatedCustomizations: [customization],
587
- };
588
- this.disabledCategories.push(dc);
589
- }
590
- });
591
- }
592
- },
593
- getCategoryDefaultCustomization(category) {
594
- const categoryId = category.id;
595
- const categoryZIndex = category.z_index;
596
- let optionId, optionName, optionAsset, optionZIndex, relatedCategoryId;
597
-
598
- category.assets.subcategories.forEach((s) => {
599
- if (s.is_default) {
600
- optionId = s.id;
601
- optionName = s.name;
602
-
603
- if (s.z_index != null && s.z_index >= 0) optionZIndex = s.z_index;
604
-
605
- if (s.assets.colors.length > 0) {
606
- const defaultColor = s.assets.colors.find((c) => c.is_default);
607
- if (defaultColor) {
608
- optionId = defaultColor.id;
609
- optionName = defaultColor.hexa;
610
- optionAsset = defaultColor.assets.asset;
611
- } else {
612
- optionId = s.assets.colors[0].id;
613
- optionName = s.assets.colors[0].hexa;
614
- optionAsset = s.assets.colors[0].assets.asset;
615
- }
616
- } else {
617
- optionAsset = s.assets.asset;
618
- }
619
- }
620
- });
621
-
622
- return optionAsset
623
- ? {
624
- categoryId,
625
- relatedCategoryId,
626
- optionId,
627
- optionName,
628
- optionAsset,
629
- categoryZIndex,
630
- optionZIndex,
631
- }
632
- : null;
633
- },
634
- getRelatedCategoryDefaultCustomization(category) {
635
- const categoryId = category.id;
636
- const relatedCategoryId = category.depends_category;
637
- const categoryZIndex = category.z_index;
638
- let optionId,
639
- optionName,
640
- optionAsset,
641
- optionZIndex,
642
- selectedRelatedSubCategory;
643
-
644
- const customization = this.getCustomization(category.depends_category);
645
- if (customization) selectedRelatedSubCategory = customization.optionId;
646
- else selectedRelatedSubCategory = "";
647
-
648
- category.assets.categories.forEach((rc) => {
649
- if (rc.parent_id === selectedRelatedSubCategory) {
650
- rc.assets.subcategories.forEach((s) => {
651
- if (s.is_default) {
652
- optionId = s.id;
653
- optionName = s.name;
654
- if (s.z_index != null && s.z_index >= 0) {
655
- optionZIndex = s.z_index;
656
- }
657
-
658
- if (s.assets.colors.length > 0) {
659
- const defaultColor = s.assets.colors.find((c) => c.is_default);
660
- if (defaultColor) {
661
- optionId = defaultColor.id;
662
- optionName = defaultColor.hexa;
663
- optionAsset = defaultColor.assets.asset;
664
- } else {
665
- optionId = s.assets.colors[0].id;
666
- optionName = s.assets.colors[0].hexa;
667
- optionAsset = s.assets.colors[0].assets.asset;
668
- }
669
- } else {
670
- optionAsset = s.assets.asset;
671
- }
672
- }
673
- });
674
- return false;
675
- }
676
- });
677
- return optionAsset
678
- ? {
679
- categoryId,
680
- relatedCategoryId,
681
- optionId,
682
- optionName,
683
- optionAsset,
684
- categoryZIndex,
685
- optionZIndex,
686
- }
687
- : null;
688
- },
689
- getCustomization(categoryId) {
690
- return this.customizations.find((c) => c.categoryId === categoryId);
691
- },
692
- handleCustomization({
693
- customization,
694
- categoriesToDisable,
695
- removeGroup = false,
696
- firstGroup = false,
697
- removableCategory = false,
698
- }) {
699
- // Verifica se há outra customização que deve ser atualizada
700
- // em função dessa atualização e atualiza essa customização
701
- // antes
702
-
703
- this.handleUpdateRelatedCategories(customization);
704
-
705
- const c = this.updateCustomizations(
706
- customization.categoryId,
707
- customization.relatedCategoryId,
708
- customization.optionId,
709
- customization.optionName,
710
- customization.optionAsset,
711
- customization.optionZIndex,
712
- customization.categoryZIndex,
713
- removeGroup,
714
- firstGroup,
715
- removableCategory
716
- );
717
- // Desabilitando categorias associadas a customização
718
- this.updateDisabledCategories(c, categoriesToDisable);
719
- },
720
- /**
721
- * Essa funçaão recebe a customização da categoria pai
722
- * e que por influência altera outras categorias. EX:
723
- * Essa função poderia receber as customizações de cor de pele
724
- * e automaticamente altera todos as outras categorias que
725
- * dependem da mesma
726
- */
727
- handleUpdateRelatedCategories(customization) {
728
- this.categoriesAssets.categories.forEach((c) => {
729
- if (c.depends_category === customization.categoryId) {
730
- // Pegando a customização da categoria relacionada
731
- // e recuperando a subcategoryId para atualizar depois
732
- // as informações de customização da categoria relacionada
733
- const relatedCustomization = this.getCustomization(c.id);
734
- let relatedCustomizationSubcategory = null;
735
- let relatedCustomizationCategory = null;
736
-
737
- if (!relatedCustomization) return;
738
- c.assets.categories.forEach((cr) => {
739
- cr.assets.subcategories.forEach((s) => {
740
- s.assets.colors.forEach((c) => {
741
- if (c.id === relatedCustomization.optionId) {
742
- relatedCustomizationSubcategory = s;
743
- }
744
- });
745
- });
746
- });
747
-
748
- // Procurando a nova subcategoria
749
- // já com a referência correta da categoria
750
- relatedCustomizationCategory = c.assets.categories.find((cr) => {
751
- return cr.parent_id === customization.optionId;
752
- });
753
-
754
- if (relatedCustomizationCategory) {
755
- relatedCustomizationCategory.assets.subcategories.forEach((s) => {
756
- if (s.id === relatedCustomizationSubcategory.id) {
757
- s.assets.colors.forEach((c) => {
758
- if (c.hexa === relatedCustomization.optionName) {
759
- relatedCustomization.optionId = c.id;
760
- relatedCustomization.optionName = c.hexa;
761
- relatedCustomization.optionAsset = c.assets.asset;
762
- relatedCustomization.optionZIndex = s.z_index;
763
- }
764
- });
765
- }
766
- });
767
- }
768
- }
769
- });
770
- },
771
- fakeData() {
772
- const categoryId = this.categoriesAssets.categories[0]
773
- ? this.categoriesAssets.categories[0].id
774
- : 0;
775
- const categoryId2 = this.categoriesAssets.categories[1]
776
- ? this.categoriesAssets.categories[1].id
777
- : 0;
778
- this.categoriesAssets.collections = [];
779
- this.categoriesAssets.collections.push({
780
- id: 10000,
781
- name: "Vestuario",
782
- icon: "https://dka04237waacy.cloudfront.net/uploads/turma-da-monica/tp-corpo-branco-3.png",
783
- categories: [categoryId, categoryId2],
784
- });
785
- },
786
- parseCollection() {
787
- if (
788
- this.categoriesAssets.collections &&
789
- this.categoriesAssets.collections[0]
790
- ) {
791
- this.categoriesAssets.collections[0].categories.forEach((el, index) => {
792
- this.categoriesAssets.collections[0].categories[index] = parseInt(el);
793
- });
794
- }
795
- },
796
- removeTooltip() {
797
- const tooltip = document.getElementsByClassName("mobile-tooltip")[0];
798
- tooltip.parentNode.removeChild(tooltip);
799
- },
800
- },
801
- };
802
- </script>
803
-
804
- <style lang="scss">
805
- @import "./node_modules/@tiddh/brave-tokens/dist/styles/style.scss";
806
-
807
- .mobile-tooltip {
808
- display: none;
809
- @media (max-width: 992px) {
810
- // display: flex;
811
- display: none;
812
- position: absolute;
813
- z-index: 90000000;
814
- height: calc(100vh - 59px);
815
- width: 100%;
816
- transition: all 0.3s;
817
- bottom: 0;
818
- .tooltip {
819
- border-radius: 5px;
820
- color: white;
821
- font-size: 14px;
822
- padding: 10px 36px 10px 16px;
823
- width: 350px;
824
- margin-left: 15px;
825
- box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.31);
826
- line-height: 1.5;
827
- position: relative;
828
- margin-top: auto;
829
- bottom: calc(var(--cp) + 25px);
830
- &:after {
831
- top: 100%;
832
- left: 5%;
833
- border: solid transparent;
834
- content: " ";
835
- position: absolute;
836
- border-width: 10px;
837
- }
838
- i {
839
- position: absolute;
840
- right: 10px;
841
- top: 10px;
842
- }
843
- }
844
- }
845
- }
846
- </style>
1
+ <template>
2
+ <div>
3
+ <link
4
+ rel="stylesheet"
5
+ href="https://use.fontawesome.com/releases/v5.8.1/css/all.css"
6
+ integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf"
7
+ crossorigin="anonymous"
8
+ />
9
+ <div class="mobile-tooltip" @click="removeTooltip">
10
+ <div class="tooltip">
11
+ Lorem ipsum dolor sit amet, eum ne sale vidit epicuri, usu populo
12
+ incorrupte ex. His falli intellegebat no.
13
+ <i class="fas fa-times"></i>
14
+ </div>
15
+ </div>
16
+ <CustomizationPreview
17
+ :customizations="customizations"
18
+ :selected-character="selectedCharacter"
19
+ :character-height="characterHeight ? characterHeight : null"
20
+ :gradient-colors="gradient_colors"
21
+ :character-slug="custom_properties.slug"
22
+ :characterHeight="1"
23
+ :dir="dir"
24
+ />
25
+ <CustomizationPanel
26
+ :builder-api="builder_api"
27
+ :selected-character="selectedCharacter"
28
+ :character-name="custom_properties.user_data.properties.nome.value"
29
+ :subscription-id="'1'"
30
+ :stack-id="'1'"
31
+ :character-slug="custom_properties.slug"
32
+ :character-id="characterId"
33
+ :character-type-id="characterTypeId"
34
+ :character-is-male="custom_properties.is_male"
35
+ :categories-assets="categoriesAssets"
36
+ :disabled-categories="disabledCategories"
37
+ :customizations="customizations"
38
+ :builder-product-id="
39
+ builderProductId ? builderProductId : this.custom_properties.product_id
40
+ "
41
+ :userDataProperties="custom_properties.user_data.properties"
42
+ :builderLayoutId="builderLayoutId"
43
+ :language="language"
44
+ :typeLanguage="typeLanguage"
45
+ :dir="dir"
46
+ :builder_apk="builder_apk"
47
+ @update:customization="handleCustomization"
48
+ @startedMethod="startedMethod"
49
+ @completedMethod="completedMethod"
50
+ />
51
+ </div>
52
+ </template>
53
+
54
+ <script>
55
+ const axios = require("axios");
56
+ import sort from "array-sort";
57
+ import { resolveBuilderLanguage, DEFAULT_LOCALE } from "../../locale/config";
58
+ import CustomizationPanel from "./CustomizationPanel.vue";
59
+ import CustomizationPreview from "./CustomizationPreview.vue";
60
+
61
+ export default {
62
+ name: "CustomizationView",
63
+ components: {
64
+ CustomizationPanel,
65
+ CustomizationPreview,
66
+ },
67
+ props: {
68
+ custom_properties: {
69
+ type: Object,
70
+ required: true,
71
+ },
72
+ builder_api: {
73
+ type: String,
74
+ default: "https://builder.dentrodahistoria.com.br/api",
75
+ },
76
+ is_subscription: {
77
+ type: Boolean,
78
+ default: false,
79
+ },
80
+ gradient_colors: {
81
+ type: Object,
82
+ required: false,
83
+ },
84
+ builderLayoutId: {
85
+ type: [Number, String],
86
+ required: false,
87
+ },
88
+ language: {
89
+ type: String,
90
+ required: false,
91
+ },
92
+ typeLanguage: {
93
+ type: String,
94
+ required: false,
95
+ default: DEFAULT_LOCALE,
96
+ },
97
+ dir: {
98
+ type: String,
99
+ default: "ltr",
100
+ required: false,
101
+ },
102
+ builder_apk: {
103
+ type: String,
104
+ required: false,
105
+ //default: "https://builder.dentrodahistoria.com.br/api",
106
+ },
107
+ },
108
+ data() {
109
+ return {
110
+ categoriesAssets: {},
111
+ customizations: [], // Velho e bom customizations
112
+ requiredCategories: [], // Acumularás as customizações necessárias
113
+ disabledCategories: [], // Acumulara as customizações que não podem ser customizadas
114
+ isIniting: false,
115
+ isLoading: false,
116
+ selectedCharacter: {},
117
+ characterId: "",
118
+ characterTypeId: "",
119
+ characterName: "",
120
+ loadedCustomizations: [],
121
+ characterIsMale: this.custom_properties.is_male,
122
+ builderProductId: false,
123
+ characterHeight: null,
124
+ userDataProperties: this.custom_properties.user_data.properties,
125
+ };
126
+ },
127
+ computed: {
128
+ apkParameter() {
129
+ return this.builder_apk ? `apk=${this.builder_apk}` : "";
130
+ },
131
+ builderLanguage() {
132
+ return resolveBuilderLanguage(this.typeLanguage, this.language);
133
+ },
134
+ },
135
+ mounted() {
136
+ this.isIniting = true;
137
+ this.loadCustomizationTreeList()
138
+ .then(() => {
139
+ this.isIniting = false;
140
+ this.isLoading = true;
141
+ })
142
+ // .then(this.fakeData)
143
+ .then(this.parseCollection)
144
+ .then(this.loadCustomizationCharacter)
145
+ .then(this.initCustomizationCharacter)
146
+ .then(this.initDisabledCategories)
147
+ .then(() => {
148
+ this.isLoading = false;
149
+ });
150
+ },
151
+ methods: {
152
+ startedMethod() {
153
+ this.$emit("startedMethod");
154
+ },
155
+ completedMethod(payload) {
156
+ if (payload.success) {
157
+ this.$emit("completedMethod", {
158
+ updatedCustomizations: payload.updatedCustomizations,
159
+ updatedUuid: payload.updatedUuid,
160
+ characterName: this.characterName,
161
+ characterIsMale: this.custom_properties.is_male, //this.characterIsMale,
162
+ categories: payload.categories,
163
+ success: payload.success,
164
+ });
165
+ } else {
166
+ this.$emit("completedMethod", {
167
+ success: payload.success,
168
+ });
169
+ }
170
+ },
171
+ async loadCustomizationTreeList() {
172
+ let res;
173
+
174
+ //aaaa;
175
+
176
+ if (this.treelist) {
177
+ if (
178
+ this.treelist.character_categories_assets &&
179
+ this.treelist.character_categories_assets.length > 0
180
+ ) {
181
+ this.categoriesAssets = this.treelist.character_categories_assets[0];
182
+ return;
183
+ }
184
+ }
185
+
186
+ if (this.custom_properties.uuid) {
187
+ let url = `${this.builder_api}/customs_characters/${this.custom_properties.uuid}`;
188
+ if (this.builder_apk) {
189
+ url += `?apk=${encodeURIComponent(this.builder_apk)}`;
190
+ }
191
+ const { data } = await axios.get(url);
192
+
193
+ res = await axios.get(
194
+ `${this.builder_api}/characters/${
195
+ data.custom.character_id
196
+ }/categories/assets/treelist?character_type_id=${
197
+ data.custom.user_data.type
198
+ }&subscription=${this.is_subscription}${
199
+ this.builderLanguage ? `&language=${this.builderLanguage}` : ""
200
+ }&product_id=${this.custom_properties.product_id}${
201
+ this.builder_apk ? `&${this.apkParameter}` : ""
202
+ }`
203
+ );
204
+ this.selectedCharacter.slug =
205
+ res.data.character_categories_assets[0].type.code;
206
+ this.characterId = data.custom.character_id;
207
+ this.characterName = data.custom.user_data.properties.nome.value;
208
+ this.characterIsMale = this.custom_properties.is_male; //res.data.character_categories_assets[0].type.code === 'menino' ? true : false
209
+ this.builderProductId = this.custom_properties.product_id;
210
+ this.characterTypeId = data.custom.user_data.type;
211
+ this.loadedCustomizations = data.assets;
212
+
213
+ if (
214
+ data.custom.user_data.properties.dedicatoria &&
215
+ data.custom.user_data.properties.dedicatoria.value &&
216
+ data.custom.user_data.properties.dedicatoria.value.length > 0
217
+ ) {
218
+ this.userDataProperties.dedicatoria = {
219
+ code: "dedicatoria",
220
+ property_id:
221
+ data.custom.user_data.properties.dedicatoria.property_id,
222
+ value: data.custom.user_data.properties.dedicatoria.value,
223
+ };
224
+ }
225
+ if (
226
+ data.custom.user_data.properties.numero &&
227
+ data.custom.user_data.properties.numero.value &&
228
+ data.custom.user_data.properties.numero.value.length > 0
229
+ ) {
230
+ this.userDataProperties.numero = {
231
+ code: "numero",
232
+ property_id: data.custom.user_data.properties.numero.property_id,
233
+ value: data.custom.user_data.properties.numero.value,
234
+ };
235
+ }
236
+ if (
237
+ data.custom.user_data.properties.mes &&
238
+ data.custom.user_data.properties.mes.value &&
239
+ data.custom.user_data.properties.mes.value.length > 0
240
+ ) {
241
+ this.userDataProperties.mes = {
242
+ code: "mes",
243
+ property_id: data.custom.user_data.properties.mes.property_id,
244
+ value: data.custom.user_data.properties.mes.value,
245
+ };
246
+ }
247
+ } else {
248
+ res = await axios.get(
249
+ `${this.builder_api}/characters/${
250
+ this.custom_properties.character_id
251
+ }/categories/assets/treelist?character_type_id=${
252
+ this.custom_properties.type_id ? this.custom_properties.type_id : ""
253
+ }&subscription=${this.is_subscription}${
254
+ this.builderLanguage
255
+ ? `&language=${encodeURIComponent(this.builderLanguage)}`
256
+ : ""
257
+ }&product_id=${this.custom_properties.product_id}${
258
+ this.builder_apk ? `&${this.apkParameter}` : ""
259
+ }`
260
+ );
261
+ this.characterTypeId = this.custom_properties.type_id;
262
+ this.characterId = this.custom_properties.character_id;
263
+ }
264
+
265
+ this.selectedCharacter =
266
+ res.data.character_categories_assets[0].character;
267
+
268
+ this.categoriesAssets =
269
+ res.data.character_categories_assets &&
270
+ res.data.character_categories_assets.length
271
+ ? res.data.character_categories_assets[0]
272
+ : null;
273
+ },
274
+ /*
275
+ * Essa função também preenche as informações de customização,
276
+ * além do array de categorias obrigatórias e no caso do usuário possuir
277
+ * customizationId ela também preenche as categorias desabilitadas
278
+ */
279
+ initCustomizationCharacter() {
280
+ this.categoriesAssets.categories.forEach((c) => {
281
+ // Populando a tabela com as customizações necessárias
282
+ if (c.required) {
283
+ this.requiredCategories.push({
284
+ id: c.id,
285
+ name: c.name,
286
+ });
287
+ }
288
+ c.assets.subcategories = sort(c.assets.subcategories, "sort_order");
289
+ });
290
+
291
+ this.categoriesAssets.categories = sort(
292
+ this.categoriesAssets.categories,
293
+ "sort_order"
294
+ );
295
+
296
+ this.categoriesAssets.groups.forEach((g) => {
297
+ g.assets.subcategories = sort(g.assets.subcategories, "sort_order");
298
+ });
299
+
300
+ this.categoriesAssets.groups = sort(
301
+ this.categoriesAssets.groups,
302
+ "sort_order"
303
+ );
304
+ },
305
+ /*
306
+ * Essa função inicializa as categorias desabilitadas
307
+ */
308
+ initDisabledCategories() {
309
+ this.customizations.forEach((custom) => {
310
+ let comparisonValue;
311
+ let customCategory = this.categoriesAssets.categories.find(
312
+ (c) => c.id === custom.categoryId
313
+ );
314
+
315
+ if (!customCategory) {
316
+ // A diferença entre os objetos de group e categoria
317
+ // não são relevantes para essa função
318
+ customCategory = this.categoriesAssets.groups.find((g) => {
319
+ g.groupedCategories.includes(custom.categoryId);
320
+ });
321
+ }
322
+
323
+ if (customCategory) {
324
+ // Caso a categoria dependa de outra descemos o nível da arvore
325
+ // de assets para pegar apenas as subcategorias e cores dependêntes
326
+ if (customCategory.depends_category) {
327
+ const relatedCustomization = this.getCustomization(
328
+ customCategory.depends_category
329
+ );
330
+ customCategory = customCategory.assets.categories.find((c) => {
331
+ comparisonValue = relatedCustomization.optionId;
332
+ return c.parent_id === comparisonValue;
333
+ });
334
+ }
335
+
336
+ // Buscando a subbategoria com as informações a respeito das
337
+ // categorias para desabilitar
338
+ comparisonValue = custom.optionId;
339
+
340
+ const customSubcategory = customCategory.assets.subcategories.find(
341
+ (subcategory) => {
342
+ if (
343
+ subcategory.assets.colors &&
344
+ subcategory.assets.colors.length
345
+ ) {
346
+ let found = false;
347
+ subcategory.assets.colors.forEach((color) => {
348
+ if (color.id === comparisonValue) {
349
+ found = true;
350
+ }
351
+ });
352
+ return found;
353
+ }
354
+ return subcategory.id === comparisonValue;
355
+ }
356
+ );
357
+
358
+ if (customSubcategory)
359
+ this.updateDisabledCategories(custom, customSubcategory.disable);
360
+ }
361
+ });
362
+ },
363
+ /*
364
+ * Carregando nas customizações as informaçoes de categorias e subcategorias
365
+ * definidas como default no builder
366
+ */
367
+ initDefaultCustomizationCharacter() {
368
+ let customization;
369
+ const categoriesWithDependency = [];
370
+
371
+ /*
372
+ * Definindo as customizações default das categorias sem
373
+ * dependencia
374
+ */
375
+ this.categoriesAssets.categories.forEach((c) => {
376
+ if (c.depends_category) {
377
+ categoriesWithDependency.push(c);
378
+ return;
379
+ }
380
+ customization = this.getCategoryDefaultCustomization(c);
381
+
382
+ if (c.code.includes("mooner")) {
383
+ console.log(c);
384
+
385
+ // c.assets.subcategories[0].parent_id;
386
+ // null
387
+ // c.assets.subcategories[0].id;
388
+ // c.assets.subcategories[0].name;
389
+ // c.assets.subcategories[0].assets.asset;
390
+ // null,
391
+ // null,
392
+ this.updateCustomizations(
393
+ c.assets.subcategories[0].parent_id,
394
+ null,
395
+ c.assets.subcategories[0].id,
396
+ c.assets.subcategories[0].name,
397
+ c.assets.subcategories[0].assets.asset,
398
+ null,
399
+ null
400
+ );
401
+ }
402
+ if (customization)
403
+ this.updateCustomizations(
404
+ customization.categoryId,
405
+ customization.relatedCategoryId,
406
+ customization.optionId,
407
+ customization.optionName,
408
+ customization.optionAsset,
409
+ customization.optionZIndex,
410
+ customization.categoryZIndex
411
+ );
412
+ });
413
+
414
+ categoriesWithDependency.forEach((c) => {
415
+ customization = this.getRelatedCategoryDefaultCustomization(c);
416
+ if (customization)
417
+ this.updateCustomizations(
418
+ customization.categoryId,
419
+ customization.relatedCategoryId,
420
+ customization.optionId,
421
+ customization.optionName,
422
+ customization.optionAsset,
423
+ customization.optionZIndex,
424
+ customization.categoryZIndex
425
+ );
426
+ });
427
+ },
428
+ /*
429
+ * Essa função carrega as informações de personalização do personagem
430
+ * Caso a subscription já possui um customizationId ele vai no serviço
431
+ * buscar tal informação, caso contrário ele seta as informações
432
+ * default das categorias na personalização
433
+ */
434
+ async loadCustomizationCharacter() {
435
+ this.initDefaultCustomizationCharacter();
436
+
437
+ if (this.custom_properties.uuid) {
438
+ this.customizations.forEach((custom) => {
439
+ this.loadedCustomizations.forEach((el) => {
440
+ if (
441
+ custom.relatedCategoryId &&
442
+ custom.categoryId === el.assets.category_id
443
+ ) {
444
+ let relatedCustomizationCategory = this.loadedCustomizations.find(
445
+ (cr) => {
446
+ return cr.id === custom.relatedCategoryId;
447
+ }
448
+ );
449
+
450
+ this.categoriesAssets.categories.forEach((category) => {
451
+ if (category.id === el.id) {
452
+ category.assets.categories.forEach((c) => {
453
+ if (
454
+ c.parent_id === relatedCustomizationCategory.assets.id
455
+ ) {
456
+ c.assets.subcategories.forEach((s) => {
457
+ s.assets.colors.forEach((color) => {
458
+ if (el.assets.id === color.id) {
459
+ this.updateCustomizations(
460
+ custom.categoryId,
461
+ custom.relatedCategoryId,
462
+ el.assets.id,
463
+ color.hexa,
464
+ color.assets.asset,
465
+ el.z_index,
466
+ el.z_index
467
+ );
468
+ }
469
+ });
470
+ });
471
+ }
472
+ });
473
+ }
474
+ });
475
+ } else if (custom.categoryId === el.assets.category_id) {
476
+ this.updateCustomizations(
477
+ custom.categoryId,
478
+ custom.relatedCategoryId,
479
+ el.assets.id,
480
+ custom.name,
481
+ el.assets.asset,
482
+ el.z_index,
483
+ el.z_index
484
+ );
485
+ }
486
+ });
487
+ });
488
+
489
+ this.loadedCustomizations.forEach((el) => {
490
+ let customCategory = this.customizations.find(
491
+ (c) => c.categoryId === el.id
492
+ );
493
+ if (!customCategory) {
494
+ this.updateCustomizations(
495
+ el.assets.category_id,
496
+ null,
497
+ el.assets.id,
498
+ el.name,
499
+ el.assets.asset,
500
+ el.z_index,
501
+ el.z_index
502
+ );
503
+ }
504
+ });
505
+ }
506
+ },
507
+ loadRelatedSubcategory(customization) {},
508
+
509
+ updateCustomizations(
510
+ categoryId,
511
+ relatedCategoryId,
512
+ optionId,
513
+ optionName,
514
+ optionAsset,
515
+ optionZIndex,
516
+ categoryZIndex,
517
+ removeGroup = false,
518
+ firstGroup = false,
519
+ removableCategory = false
520
+ ) {
521
+ let customization = this.customizations.find(
522
+ (c) => c.categoryId === categoryId
523
+ );
524
+ if (!removeGroup) {
525
+ if (customization) {
526
+ customization.categoryId = categoryId;
527
+ customization.relatedCategoryId = relatedCategoryId;
528
+ customization.optionId = optionId;
529
+ customization.optionName = optionName;
530
+ customization.optionAsset = optionAsset;
531
+ customization.optionZIndex = optionZIndex;
532
+ customization.categoryZIndex = categoryZIndex;
533
+ } else {
534
+ customization = {
535
+ categoryId: categoryId,
536
+ relatedCategoryId: relatedCategoryId,
537
+ optionId: optionId,
538
+ optionName: optionName,
539
+ optionAsset: optionAsset,
540
+ optionZIndex: optionZIndex,
541
+ categoryZIndex: categoryZIndex,
542
+ firstGroup: firstGroup ? true : null,
543
+ };
544
+ this.customizations.push(customization);
545
+ }
546
+ return customization;
547
+ } else {
548
+ customization = this.customizations.find(
549
+ (c) => c.categoryId === categoryId
550
+ );
551
+ this.customizations.forEach((obj, index) => {
552
+ if (obj.categoryId === customization.categoryId) {
553
+ this.customizations.splice(index, 1);
554
+ }
555
+ });
556
+ }
557
+ },
558
+ updateDisabledCategories(customization, categoriesToDisable) {
559
+ if (categoriesToDisable) {
560
+ categoriesToDisable.forEach((idToDisable) => {
561
+ this.customizations.forEach((el, index) => {
562
+ if (idToDisable === el.categoryId) {
563
+ this.customizations.splice(index, 1);
564
+ }
565
+ });
566
+ });
567
+ }
568
+
569
+ if (!categoriesToDisable || categoriesToDisable.length === 0) {
570
+ this.disabledCategories.forEach((dc) => {
571
+ const i = dc.relatedCustomizations.indexOf(customization);
572
+ if (i > -1) dc.relatedCustomizations.splice(i, 1);
573
+ });
574
+
575
+ this.disabledCategories = this.disabledCategories.filter(
576
+ (dc) => dc.relatedCustomizations.length !== 0
577
+ );
578
+ } else {
579
+ categoriesToDisable.forEach((categoryToDisableId) => {
580
+ let dc = this.disabledCategories.find((dc) => {
581
+ return dc.categoryId === categoryToDisableId;
582
+ });
583
+
584
+ if (dc) {
585
+ if (!dc.relatedCustomizations.includes(customization))
586
+ dc.relatedCustomizations.push(customization);
587
+ } else {
588
+ dc = {
589
+ categoryId: categoryToDisableId,
590
+ relatedCustomizations: [customization],
591
+ };
592
+ this.disabledCategories.push(dc);
593
+ }
594
+ });
595
+ }
596
+ },
597
+ getCategoryDefaultCustomization(category) {
598
+ const categoryId = category.id;
599
+ const categoryZIndex = category.z_index;
600
+ let optionId, optionName, optionAsset, optionZIndex, relatedCategoryId;
601
+
602
+ category.assets.subcategories.forEach((s) => {
603
+ if (s.is_default) {
604
+ optionId = s.id;
605
+ optionName = s.name;
606
+
607
+ if (s.z_index != null && s.z_index >= 0) optionZIndex = s.z_index;
608
+
609
+ if (s.assets.colors.length > 0) {
610
+ const defaultColor = s.assets.colors.find((c) => c.is_default);
611
+ if (defaultColor) {
612
+ optionId = defaultColor.id;
613
+ optionName = defaultColor.hexa;
614
+ optionAsset = defaultColor.assets.asset;
615
+ } else {
616
+ optionId = s.assets.colors[0].id;
617
+ optionName = s.assets.colors[0].hexa;
618
+ optionAsset = s.assets.colors[0].assets.asset;
619
+ }
620
+ } else {
621
+ optionAsset = s.assets.asset;
622
+ }
623
+ }
624
+ });
625
+
626
+ return optionAsset
627
+ ? {
628
+ categoryId,
629
+ relatedCategoryId,
630
+ optionId,
631
+ optionName,
632
+ optionAsset,
633
+ categoryZIndex,
634
+ optionZIndex,
635
+ }
636
+ : null;
637
+ },
638
+ getRelatedCategoryDefaultCustomization(category) {
639
+ const categoryId = category.id;
640
+ const relatedCategoryId = category.depends_category;
641
+ const categoryZIndex = category.z_index;
642
+ let optionId,
643
+ optionName,
644
+ optionAsset,
645
+ optionZIndex,
646
+ selectedRelatedSubCategory;
647
+
648
+ const customization = this.getCustomization(category.depends_category);
649
+ if (customization) selectedRelatedSubCategory = customization.optionId;
650
+ else selectedRelatedSubCategory = "";
651
+
652
+ category.assets.categories.forEach((rc) => {
653
+ if (rc.parent_id === selectedRelatedSubCategory) {
654
+ rc.assets.subcategories.forEach((s) => {
655
+ if (s.is_default) {
656
+ optionId = s.id;
657
+ optionName = s.name;
658
+ if (s.z_index != null && s.z_index >= 0) {
659
+ optionZIndex = s.z_index;
660
+ }
661
+
662
+ if (s.assets.colors.length > 0) {
663
+ const defaultColor = s.assets.colors.find((c) => c.is_default);
664
+ if (defaultColor) {
665
+ optionId = defaultColor.id;
666
+ optionName = defaultColor.hexa;
667
+ optionAsset = defaultColor.assets.asset;
668
+ } else {
669
+ optionId = s.assets.colors[0].id;
670
+ optionName = s.assets.colors[0].hexa;
671
+ optionAsset = s.assets.colors[0].assets.asset;
672
+ }
673
+ } else {
674
+ optionAsset = s.assets.asset;
675
+ }
676
+ }
677
+ });
678
+ return false;
679
+ }
680
+ });
681
+ return optionAsset
682
+ ? {
683
+ categoryId,
684
+ relatedCategoryId,
685
+ optionId,
686
+ optionName,
687
+ optionAsset,
688
+ categoryZIndex,
689
+ optionZIndex,
690
+ }
691
+ : null;
692
+ },
693
+ getCustomization(categoryId) {
694
+ return this.customizations.find((c) => c.categoryId === categoryId);
695
+ },
696
+ handleCustomization({
697
+ customization,
698
+ categoriesToDisable,
699
+ removeGroup = false,
700
+ firstGroup = false,
701
+ removableCategory = false,
702
+ }) {
703
+ // Verifica se há outra customização que deve ser atualizada
704
+ // em função dessa atualização e atualiza essa customização
705
+ // antes
706
+
707
+ this.handleUpdateRelatedCategories(customization);
708
+
709
+ const c = this.updateCustomizations(
710
+ customization.categoryId,
711
+ customization.relatedCategoryId,
712
+ customization.optionId,
713
+ customization.optionName,
714
+ customization.optionAsset,
715
+ customization.optionZIndex,
716
+ customization.categoryZIndex,
717
+ removeGroup,
718
+ firstGroup,
719
+ removableCategory
720
+ );
721
+ // Desabilitando categorias associadas a customização
722
+ this.updateDisabledCategories(c, categoriesToDisable);
723
+ },
724
+ /**
725
+ * Essa funçaão recebe a customização da categoria pai
726
+ * e que por influência altera outras categorias. EX:
727
+ * Essa função poderia receber as customizações de cor de pele
728
+ * e automaticamente altera todos as outras categorias que
729
+ * dependem da mesma
730
+ */
731
+ handleUpdateRelatedCategories(customization) {
732
+ this.categoriesAssets.categories.forEach((c) => {
733
+ if (c.depends_category === customization.categoryId) {
734
+ // Pegando a customização da categoria relacionada
735
+ // e recuperando a subcategoryId para atualizar depois
736
+ // as informações de customização da categoria relacionada
737
+ const relatedCustomization = this.getCustomization(c.id);
738
+ let relatedCustomizationSubcategory = null;
739
+ let relatedCustomizationCategory = null;
740
+
741
+ if (!relatedCustomization) return;
742
+ c.assets.categories.forEach((cr) => {
743
+ cr.assets.subcategories.forEach((s) => {
744
+ s.assets.colors.forEach((c) => {
745
+ if (c.id === relatedCustomization.optionId) {
746
+ relatedCustomizationSubcategory = s;
747
+ }
748
+ });
749
+ });
750
+ });
751
+
752
+ // Procurando a nova subcategoria
753
+ // já com a referência correta da categoria
754
+ relatedCustomizationCategory = c.assets.categories.find((cr) => {
755
+ return cr.parent_id === customization.optionId;
756
+ });
757
+
758
+ if (relatedCustomizationCategory) {
759
+ relatedCustomizationCategory.assets.subcategories.forEach((s) => {
760
+ if (s.id === relatedCustomizationSubcategory.id) {
761
+ s.assets.colors.forEach((c) => {
762
+ if (c.hexa === relatedCustomization.optionName) {
763
+ relatedCustomization.optionId = c.id;
764
+ relatedCustomization.optionName = c.hexa;
765
+ relatedCustomization.optionAsset = c.assets.asset;
766
+ relatedCustomization.optionZIndex = s.z_index;
767
+ }
768
+ });
769
+ }
770
+ });
771
+ }
772
+ }
773
+ });
774
+ },
775
+ fakeData() {
776
+ const categoryId = this.categoriesAssets.categories[0]
777
+ ? this.categoriesAssets.categories[0].id
778
+ : 0;
779
+ const categoryId2 = this.categoriesAssets.categories[1]
780
+ ? this.categoriesAssets.categories[1].id
781
+ : 0;
782
+ this.categoriesAssets.collections = [];
783
+ this.categoriesAssets.collections.push({
784
+ id: 10000,
785
+ name: "Vestuario",
786
+ icon: "https://dka04237waacy.cloudfront.net/uploads/turma-da-monica/tp-corpo-branco-3.png",
787
+ categories: [categoryId, categoryId2],
788
+ });
789
+ },
790
+ parseCollection() {
791
+ if (
792
+ this.categoriesAssets.collections &&
793
+ this.categoriesAssets.collections[0]
794
+ ) {
795
+ this.categoriesAssets.collections[0].categories.forEach((el, index) => {
796
+ this.categoriesAssets.collections[0].categories[index] = parseInt(el);
797
+ });
798
+ }
799
+ },
800
+ removeTooltip() {
801
+ const tooltip = document.getElementsByClassName("mobile-tooltip")[0];
802
+ tooltip.parentNode.removeChild(tooltip);
803
+ },
804
+ },
805
+ };
806
+ </script>
807
+
808
+ <style lang="scss">
809
+ @import "./node_modules/@tiddh/brave-tokens/dist/styles/style.scss";
810
+
811
+ .mobile-tooltip {
812
+ display: none;
813
+ @media (max-width: 992px) {
814
+ // display: flex;
815
+ display: none;
816
+ position: absolute;
817
+ z-index: 90000000;
818
+ height: calc(100vh - 59px);
819
+ width: 100%;
820
+ transition: all 0.3s;
821
+ bottom: 0;
822
+ .tooltip {
823
+ border-radius: 5px;
824
+ color: white;
825
+ font-size: 14px;
826
+ padding: 10px 36px 10px 16px;
827
+ width: 350px;
828
+ margin-left: 15px;
829
+ box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.31);
830
+ line-height: 1.5;
831
+ position: relative;
832
+ margin-top: auto;
833
+ bottom: calc(var(--cp) + 25px);
834
+ &:after {
835
+ top: 100%;
836
+ left: 5%;
837
+ border: solid transparent;
838
+ content: " ";
839
+ position: absolute;
840
+ border-width: 10px;
841
+ }
842
+ i {
843
+ position: absolute;
844
+ right: 10px;
845
+ top: 10px;
846
+ }
847
+ }
848
+ }
849
+ }
850
+ </style>