xertica-ui 2.1.2 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/README.md +1 -1
- package/assets/xertica-logo.svg +37 -37
- package/assets/xertica-x-logo.svg +20 -20
- package/bin/cli.ts +1 -1
- package/bin/generate-tokens.ts +13 -7
- package/components/assistant/index.ts +6 -6
- package/components/assistant/xertica-assistant/index.ts +2 -0
- package/components/assistant/xertica-assistant/use-assistant.ts +564 -0
- package/components/assistant/xertica-assistant/xertica-assistant.stories.tsx +200 -0
- package/components/assistant/xertica-assistant/xertica-assistant.tsx +183 -474
- package/components/blocks/card-patterns/ActivityCard.tsx +72 -72
- package/components/blocks/card-patterns/FeatureCard.tsx +100 -100
- package/components/blocks/card-patterns/NotificationCard.tsx +127 -127
- package/components/blocks/card-patterns/ProfileCard.tsx +84 -84
- package/components/blocks/card-patterns/ProjectCard.tsx +89 -89
- package/components/blocks/card-patterns/QuickActionCard.tsx +62 -62
- package/components/blocks/card-patterns/card-patterns.stories.tsx +445 -445
- package/components/blocks/card-patterns/index.ts +17 -17
- package/components/blocks/index.ts +1 -1
- package/components/brand/index.ts +6 -6
- package/components/brand/xertica-provider/XerticaProvider.tsx +48 -48
- package/components/brand/xertica-provider/xertica-provider.mdx +61 -61
- package/components/brand/xertica-provider/xertica-provider.test.tsx +52 -52
- package/components/examples/MapExamples.tsx +282 -282
- package/components/examples/SimpleFilterableMap.tsx +191 -191
- package/components/examples/index.ts +51 -51
- package/components/figma/ImageWithFallback.tsx +27 -27
- package/components/hooks/index.ts +7 -7
- package/components/index.ts +5 -5
- package/components/layout/header/header.test.tsx +8 -8
- package/components/layout/header/header.tsx +4 -4
- package/components/layout/index.ts +2 -2
- package/components/layout/sidebar/index.ts +2 -0
- package/components/layout/sidebar/sidebar.mdx +1 -1
- package/components/layout/sidebar/sidebar.stories.tsx +160 -8
- package/components/layout/sidebar/sidebar.test.tsx +11 -11
- package/components/layout/sidebar/sidebar.tsx +610 -471
- package/components/layout/sidebar/use-sidebar.ts +113 -0
- package/components/media/FloatingMediaWrapper.tsx +11 -11
- package/components/media/audio-player/AudioPlayer.tsx +22 -22
- package/components/media/index.ts +3 -3
- package/components/pages/home-content/HomeContent.tsx +7 -7
- package/components/pages/home-content/home-content.mdx +62 -62
- package/components/pages/home-page/HomePage.stories.tsx +39 -39
- package/components/pages/home-page/HomePage.tsx +1 -1
- package/components/pages/home-page/home-page.mdx +53 -53
- package/components/pages/index.ts +8 -8
- package/components/pages/template-content/TemplateContent.tsx +5 -5
- package/components/pages/template-content/template-content.mdx +61 -61
- package/components/pages/template-page/TemplatePage.stories.tsx +39 -39
- package/components/pages/template-page/TemplatePage.tsx +5 -5
- package/components/pages/template-page/template-page.mdx +53 -53
- package/components/public-api-smoke.test.tsx +52 -52
- package/components/shared/assistant-utils.ts +43 -43
- package/components/shared/layout-constants.ts +1 -1
- package/components/ui/accordion/accordion.mdx +8 -8
- package/components/ui/accordion/accordion.stories.tsx +53 -53
- package/components/ui/alert/alert.mdx +8 -8
- package/components/ui/alert-dialog/alert-dialog.mdx +8 -8
- package/components/ui/aspect-ratio/aspect-ratio.mdx +8 -8
- package/components/ui/assistant-chart/assistant-chart.mdx +8 -8
- package/components/ui/avatar/avatar.mdx +8 -8
- package/components/ui/badge/badge.mdx +8 -8
- package/components/ui/badge/badge.tsx +9 -9
- package/components/ui/breadcrumb/breadcrumb.mdx +8 -8
- package/components/ui/button/button.mdx +8 -8
- package/components/ui/calendar/calendar.mdx +8 -8
- package/components/ui/calendar/calendar.tsx +258 -258
- package/components/ui/card/card.mdx +8 -8
- package/components/ui/card/card.stories.tsx +245 -245
- package/components/ui/carousel/carousel.mdx +8 -8
- package/components/ui/chart/chart.mdx +8 -8
- package/components/ui/chart/chart.stories.tsx +1303 -344
- package/components/ui/chart/chart.test.tsx +154 -154
- package/components/ui/chart/chart.tsx +2367 -1494
- package/components/ui/checkbox/checkbox.mdx +8 -8
- package/components/ui/checkbox/checkbox.stories.tsx +20 -20
- package/components/ui/collapsible/collapsible.mdx +8 -8
- package/components/ui/command/command.mdx +8 -8
- package/components/ui/context-menu/context-menu.mdx +8 -8
- package/components/ui/dialog/dialog.mdx +8 -8
- package/components/ui/drawer/drawer.mdx +8 -8
- package/components/ui/dropdown-menu/dropdown-menu.mdx +8 -8
- package/components/ui/empty/empty.mdx +8 -8
- package/components/ui/file-upload/file-upload.mdx +8 -8
- package/components/ui/file-upload/file-upload.stories.tsx +100 -0
- package/components/ui/file-upload/file-upload.tsx +14 -74
- package/components/ui/file-upload/index.ts +1 -0
- package/components/ui/file-upload/use-file-upload.ts +181 -0
- package/components/ui/google-maps-loader/google-maps-loader.tsx +2 -2
- package/components/ui/hover-card/hover-card.mdx +8 -8
- package/components/ui/input/input.mdx +8 -8
- package/components/ui/input-otp/input-otp.mdx +8 -8
- package/components/ui/input-otp/input-otp.stories.tsx +6 -6
- package/components/ui/label/label.mdx +8 -8
- package/components/ui/map/map.mdx +8 -8
- package/components/ui/map/map.stories.tsx +51 -51
- package/components/ui/map/map.tsx +2 -2
- package/components/ui/menubar/menubar.mdx +8 -8
- package/components/ui/navigation-menu/navigation-menu.mdx +8 -8
- package/components/ui/notification-badge/notification-badge.mdx +8 -8
- package/components/ui/pagination/index.ts +2 -0
- package/components/ui/pagination/pagination.mdx +8 -8
- package/components/ui/pagination/pagination.stories.tsx +94 -0
- package/components/ui/pagination/use-pagination.ts +194 -0
- package/components/ui/popover/popover.mdx +8 -8
- package/components/ui/progress/progress.mdx +8 -8
- package/components/ui/progress/progress.tsx +68 -68
- package/components/ui/radio-group/radio-group.mdx +8 -8
- package/components/ui/rating/rating.mdx +8 -8
- package/components/ui/resizable/resizable.mdx +8 -8
- package/components/ui/rich-text-editor/index.ts +2 -0
- package/components/ui/rich-text-editor/rich-text-editor.stories.tsx +129 -1
- package/components/ui/rich-text-editor/rich-text-editor.tsx +86 -305
- package/components/ui/rich-text-editor/use-rich-text-editor.ts +439 -0
- package/components/ui/route-map/route-map.mdx +8 -8
- package/components/ui/route-map/route-map.stories.tsx +54 -54
- package/components/ui/route-map/route-map.tsx +2 -2
- package/components/ui/scroll-area/scroll-area.mdx +8 -8
- package/components/ui/search/search.mdx +8 -8
- package/components/ui/select/select.mdx +8 -8
- package/components/ui/select/select.stories.tsx +9 -9
- package/components/ui/separator/separator.mdx +8 -8
- package/components/ui/sheet/sheet.mdx +8 -8
- package/components/ui/sheet/sheet.stories.tsx +95 -95
- package/components/ui/simple-map/simple-map.mdx +8 -8
- package/components/ui/simple-map/simple-map.stories.tsx +48 -48
- package/components/ui/skeleton/skeleton.mdx +8 -8
- package/components/ui/slider/slider.mdx +8 -8
- package/components/ui/sonner/sonner.mdx +8 -8
- package/components/ui/stats-card/stats-card.mdx +8 -8
- package/components/ui/stepper/index.ts +3 -1
- package/components/ui/stepper/stepper.mdx +8 -8
- package/components/ui/stepper/stepper.stories.tsx +116 -0
- package/components/ui/stepper/stepper.tsx +4 -4
- package/components/ui/stepper/use-stepper.ts +137 -0
- package/components/ui/switch/switch.mdx +8 -8
- package/components/ui/switch/switch.stories.tsx +20 -20
- package/components/ui/table/table.mdx +8 -8
- package/components/ui/tabs/tabs.mdx +8 -8
- package/components/ui/tabs/tabs.stories.tsx +26 -26
- package/components/ui/textarea/textarea.mdx +8 -8
- package/components/ui/timeline/timeline.mdx +8 -8
- package/components/ui/toggle/toggle.mdx +8 -8
- package/components/ui/toggle-group/toggle-group.mdx +8 -8
- package/components/ui/tooltip/tooltip.mdx +8 -8
- package/components/ui/tree-view/index.ts +4 -1
- package/components/ui/tree-view/tree-view.mdx +8 -8
- package/components/ui/tree-view/tree-view.stories.tsx +110 -4
- package/components/ui/tree-view/tree-view.tsx +17 -125
- package/components/ui/tree-view/use-tree-view.ts +229 -0
- package/components.json +1512 -1512
- package/contexts/ApiKeyContext.tsx +72 -72
- package/contexts/BrandColorsContext.tsx +26 -26
- package/contexts/LanguageContext.tsx +13 -13
- package/contexts/LayoutContext.test.tsx +11 -11
- package/contexts/LayoutContext.tsx +29 -29
- package/contexts/ThemeContext.tsx +26 -26
- package/contexts/theme-data.ts +4 -4
- package/dist/{AssistantChart-CVzmmhx4.js → AssistantChart-C_hwFRRr.js} +4 -4
- package/dist/{AssistantChart-BAx9VQvb.cjs → AssistantChart-CldVCVDe.cjs} +311 -94
- package/dist/{AssistantChart-CVko2A1W.js → AssistantChart-Cu3m7RBo.js} +314 -97
- package/dist/{AssistantChart-9w31gdAb.cjs → AssistantChart-DoZCyS5r.cjs} +4 -4
- package/dist/AudioPlayer-B1lt5cPl.cjs +989 -0
- package/dist/AudioPlayer-BZ7bibzU.cjs +982 -0
- package/dist/AudioPlayer-C12BjQBV.cjs +997 -0
- package/dist/AudioPlayer-DMcG_c7L.js +990 -0
- package/dist/AudioPlayer-DcFKRJE_.js +998 -0
- package/dist/AudioPlayer-e8LfNoqO.js +983 -0
- package/dist/{xertica-assistant-Qp3ydksa.cjs → CodeBlock-7TTgmdGG.cjs} +263 -51
- package/dist/{xertica-assistant-gnCJdcZY.js → CodeBlock-BeSt1h5P.js} +219 -7
- package/dist/CodeBlock-BgfYL_rD.cjs +2094 -0
- package/dist/CodeBlock-BlcqlA9M.cjs +2094 -0
- package/dist/CodeBlock-Bnmeu5ez.cjs +2094 -0
- package/dist/CodeBlock-BtfPlbAI.js +2078 -0
- package/dist/CodeBlock-CIySIuYr.js +2078 -0
- package/dist/CodeBlock-CuPtUM-7.cjs +2094 -0
- package/dist/CodeBlock-D6ffWXgc.js +2078 -0
- package/dist/CodeBlock-D8dcwbit.cjs +2094 -0
- package/dist/CodeBlock-DMZrFnlw.cjs +2094 -0
- package/dist/CodeBlock-DlBehYN8.js +2078 -0
- package/dist/CodeBlock-DnYNI8rQ.js +2078 -0
- package/dist/CodeBlock-DvKWbSnE.cjs +2094 -0
- package/dist/CodeBlock-DwMCfkFY.js +2078 -0
- package/dist/CodeBlock-Dy6CNYyj.js +2078 -0
- package/dist/CodeBlock-U1pPOQI7.cjs +2094 -0
- package/dist/CodeBlock-f_GpNhEB.js +2078 -0
- package/dist/CodeBlock-oB6u8nI1.js +2078 -0
- package/dist/CodeBlock-tZC31B73.cjs +2094 -0
- package/dist/ImageWithFallback-CGtidP6B.cjs +4542 -0
- package/dist/ImageWithFallback-lsg3pdFg.js +4508 -0
- package/dist/LanguageSelector-B5YfbHra.js +231 -0
- package/dist/LanguageSelector-D6uacAIM.cjs +230 -0
- package/dist/LayoutContext-BAql6ZRY.js +97 -0
- package/dist/LayoutContext-BvK-ggDa.cjs +96 -0
- package/dist/ThemeContext-BoH4NLfN.js +734 -0
- package/dist/{ThemeContext-BbBNoFTG.js → ThemeContext-C2EwAPDt.js} +2 -2
- package/dist/ThemeContext-r69W20Xg.cjs +733 -0
- package/dist/{ThemeContext-Cmr8Ex8H.cjs → ThemeContext-vTjumZeM.cjs} +2 -2
- package/dist/{VerifyEmailPage-BE-L9mB7.js → VerifyEmailPage-C0c2e5n0.js} +7 -7
- package/dist/{VerifyEmailPage-DMBh4NM9.cjs → VerifyEmailPage-CYXtbKi3.cjs} +1 -1
- package/dist/{VerifyEmailPage-CR7kb5df.cjs → VerifyEmailPage-Cwi3kbol.cjs} +7 -7
- package/dist/{VerifyEmailPage-CdYPSJoO.js → VerifyEmailPage-DvMLZgFt.js} +1 -1
- package/dist/XerticaOrbe-KL1RBHzw.cjs +1354 -0
- package/dist/XerticaOrbe-zwS1p2a8.js +1355 -0
- package/dist/XerticaProvider-6btlAlzc.js +17 -0
- package/dist/XerticaProvider-BNoNOxQ5.cjs +16 -0
- package/dist/XerticaProvider-BlY2limY.cjs +38 -0
- package/dist/{XerticaProvider-BITjgC5p.js → XerticaProvider-CEoWMTxu.js} +2 -2
- package/dist/{XerticaProvider-By8q3Roe.cjs → XerticaProvider-CllrbMEJ.cjs} +2 -2
- package/dist/XerticaProvider-DDuiIcKo.js +39 -0
- package/dist/XerticaProvider-cI9hSs27.cjs +38 -0
- package/dist/XerticaProvider-hSwhNQex.js +39 -0
- package/dist/{alert-dialog-yckpaOpy.cjs → alert-dialog-DSKByiKZ.cjs} +3 -3
- package/dist/{alert-dialog-iDe5VE5o.js → alert-dialog-s-vmNkJ_.js} +3 -3
- package/dist/assistant.cjs.js +2 -1
- package/dist/assistant.es.js +3 -2
- package/dist/brand.cjs.js +1 -1
- package/dist/brand.es.js +1 -1
- package/dist/breadcrumb-CqJ7bHY5.js +161 -0
- package/dist/breadcrumb-m9Hb2_XN.cjs +177 -0
- package/dist/cli.js +14 -8
- package/dist/components/assistant/xertica-assistant/index.d.ts +2 -0
- package/dist/components/assistant/xertica-assistant/use-assistant.d.ts +126 -0
- package/dist/components/assistant/xertica-assistant/xertica-assistant.d.ts +7 -2
- package/dist/components/blocks/audio-player/AudioPlayer.d.ts +35 -0
- package/dist/components/blocks/audio-player/index.d.ts +1 -0
- package/dist/components/blocks/document-editor/DocumentEditor.d.ts +26 -0
- package/dist/components/blocks/document-editor/index.d.ts +1 -0
- package/dist/components/blocks/podcast-player/PodcastPlayer.d.ts +41 -0
- package/dist/components/blocks/podcast-player/index.d.ts +1 -0
- package/dist/components/layout/sidebar/index.d.ts +2 -0
- package/dist/components/layout/sidebar/sidebar.d.ts +80 -0
- package/dist/components/layout/sidebar/use-sidebar.d.ts +22 -0
- package/dist/components/shared/layout-constants.d.ts +1 -1
- package/dist/components/ui/button/button.d.ts +1 -1
- package/dist/components/ui/chart/chart.d.ts +162 -5
- package/dist/components/ui/file-upload/file-upload.d.ts +2 -0
- package/dist/components/ui/file-upload/index.d.ts +1 -0
- package/dist/components/ui/file-upload/use-file-upload.d.ts +49 -0
- package/dist/components/ui/pagination/index.d.ts +2 -0
- package/dist/components/ui/pagination/use-pagination.d.ts +78 -0
- package/dist/components/ui/rich-text-editor/index.d.ts +2 -0
- package/dist/components/ui/rich-text-editor/use-rich-text-editor.d.ts +107 -0
- package/dist/components/ui/stepper/index.d.ts +3 -1
- package/dist/components/ui/stepper/stepper.d.ts +2 -2
- package/dist/components/ui/stepper/use-stepper.d.ts +60 -0
- package/dist/components/ui/tree-view/index.d.ts +4 -1
- package/dist/components/ui/tree-view/tree-view.d.ts +4 -6
- package/dist/components/ui/tree-view/use-tree-view.d.ts +60 -0
- package/dist/dropdown-menu-BDB5CmQs.cjs +247 -0
- package/dist/dropdown-menu-DQidbKBD.js +231 -0
- package/dist/google-maps-loader-BFWp6VPd.js +287 -0
- package/dist/{google-maps-loader-t2IlYBzw.js → google-maps-loader-CTYySAun.js} +4 -0
- package/dist/{google-maps-loader-BqsYL48U.cjs → google-maps-loader-Y-QkD-Li.cjs} +5 -0
- package/dist/google-maps-loader-eS3uQ5TA.cjs +287 -0
- package/dist/header-Cgy6vYPk.cjs +731 -0
- package/dist/header-DRlT4jgI.js +715 -0
- package/dist/header-Dux00SI4.cjs +731 -0
- package/dist/header-EkGKXPsD.js +715 -0
- package/dist/header-WfEywpyc.cjs +731 -0
- package/dist/header-tifNQn2U.js +715 -0
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.es.js +1 -1
- package/dist/index-BhapVLVj.js +8 -0
- package/dist/{index-D3RLKRAs.cjs → index-COtD8bRW.cjs} +1 -1
- package/dist/index-D6fxYEY8.cjs +7 -0
- package/dist/index-DW5tYe26.js +8 -0
- package/dist/index.cjs.js +19 -8
- package/dist/index.es.js +39 -28
- package/dist/index.umd.js +1043 -470
- package/dist/input-2R4loU86.js +127 -0
- package/dist/input-DWANSKGb.cjs +145 -0
- package/dist/layout.cjs.js +89 -1
- package/dist/layout.es.js +90 -2
- package/dist/pages.cjs.js +1 -1
- package/dist/pages.es.js +1 -1
- package/dist/rich-text-editor-0mraWT5y.cjs +2376 -0
- package/dist/rich-text-editor-B6jMRLzk.cjs +1939 -0
- package/dist/rich-text-editor-B8_oYcIR.js +1730 -0
- package/dist/rich-text-editor-B9UbSXNb.js +1203 -0
- package/dist/rich-text-editor-BYuRBNBU.js +2373 -0
- package/dist/rich-text-editor-Bb9pySTs.cjs +2374 -0
- package/dist/rich-text-editor-BcL6L3cm.cjs +2374 -0
- package/dist/rich-text-editor-BoVZYtTs.cjs +2391 -0
- package/dist/rich-text-editor-CPV1lEPH.cjs +1748 -0
- package/dist/rich-text-editor-CoKqbCtu.cjs +1799 -0
- package/dist/rich-text-editor-Cw56T_mB.js +2356 -0
- package/dist/rich-text-editor-Cyt8qs2b.js +1921 -0
- package/dist/rich-text-editor-D6H84OcX.cjs +1220 -0
- package/dist/rich-text-editor-D76gD-QI.js +2328 -0
- package/dist/rich-text-editor-DKkokOnA.js +1781 -0
- package/dist/rich-text-editor-DNsdpN64.cjs +2359 -0
- package/dist/rich-text-editor-DfG8bCyY.js +2358 -0
- package/dist/rich-text-editor-DgF8s7xW.js +2949 -0
- package/dist/rich-text-editor-Dxjw31Z4.js +2341 -0
- package/dist/rich-text-editor-DzP0Epmb.js +2356 -0
- package/dist/rich-text-editor-mWoaSCE4.cjs +2966 -0
- package/dist/rich-text-editor-skplNlBM.cjs +2345 -0
- package/dist/select-Bkbr0f-Z.cjs +162 -0
- package/dist/select-CvIVdX2n.js +145 -0
- package/dist/sidebar-CK_0ZQHj.cjs +803 -0
- package/dist/sidebar-CUuOvYhK.js +787 -0
- package/dist/slider-Bc5Hd0y1.js +56 -0
- package/dist/slider-N7hFFj6X.cjs +73 -0
- package/dist/tooltip-Ded96neP.cjs +137 -0
- package/dist/tooltip-HDOoD2-0.js +120 -0
- package/dist/ui.cjs.js +14 -4
- package/dist/ui.es.js +26 -16
- package/dist/use-mobile-B0hNy_Y6.cjs +4303 -0
- package/dist/use-mobile-BXuYROXM.js +4202 -0
- package/dist/use-mobile-Bbd51ASU.cjs +4392 -0
- package/dist/use-mobile-Bk6CX-TC.js +4359 -0
- package/dist/use-mobile-BvYdisLP.js +4202 -0
- package/dist/use-mobile-BzuxjzNX.cjs +4392 -0
- package/dist/use-mobile-CG2-SdXV.cjs +4235 -0
- package/dist/use-mobile-CKb5pqTs.js +4269 -0
- package/dist/use-mobile-CYuAuGDl.js +4202 -0
- package/dist/use-mobile-CaENcqm-.js +4508 -0
- package/dist/use-mobile-CbrYgJGJ.js +4203 -0
- package/dist/use-mobile-DMOvImGQ.cjs +4542 -0
- package/dist/use-mobile-DRB3BQgD.cjs +4235 -0
- package/dist/use-mobile-DZvv7QMR.js +4359 -0
- package/dist/use-mobile-DdI_TXam.cjs +4235 -0
- package/dist/use-mobile-DlceKf8a.js +4359 -0
- package/dist/use-mobile-DsOnow1o.cjs +4236 -0
- package/dist/use-mobile-Kcj6jSnK.cjs +4392 -0
- package/dist/use-mobile-bnKcua_i.js +4202 -0
- package/dist/use-mobile-ncXBeE2z.cjs +4235 -0
- package/dist/{xertica-assistant-B1IaHXnB.cjs → xertica-assistant-dyP7KHM5.cjs} +533 -392
- package/dist/{xertica-assistant-DPsESB6t.js → xertica-assistant-yX1CFBBo.js} +535 -394
- package/dist/xertica-ui.css +2 -2
- package/docs/ai-usage.md +28 -10
- package/docs/architecture.md +76 -0
- package/docs/components/assistant.md +159 -0
- package/docs/components/calendar.md +154 -154
- package/docs/components/card-patterns.md +337 -337
- package/docs/components/card.md +235 -235
- package/docs/components/chart.md +354 -39
- package/docs/components/file-upload.md +119 -2
- package/docs/components/map.md +84 -84
- package/docs/components/pagination.md +187 -0
- package/docs/components/rich-text-editor.md +164 -0
- package/docs/components/sidebar.md +153 -4
- package/docs/components/stepper.md +157 -12
- package/docs/components/tree-view.md +164 -6
- package/docs/components/xertica-provider.md +24 -24
- package/docs/decision-tree.md +287 -287
- package/docs/getting-started.md +1 -1
- package/docs/guidelines.md +14 -8
- package/docs/layout.md +2 -2
- package/docs/llms.md +4 -4
- package/guidelines/Guidelines.md +252 -250
- package/hooks/useTheme.ts +3 -3
- package/imports/Podcast.tsx +388 -388
- package/imports/XerticaAi.tsx +45 -45
- package/imports/XerticaX.tsx +19 -19
- package/imports/svg-aueiaqngck.ts +11 -11
- package/imports/svg-v9krss1ozd.ts +16 -16
- package/imports/svg-vhrdofe3qe.ts +5 -5
- package/llms-compact.txt +327 -327
- package/llms.txt +160 -160
- package/package.json +203 -203
- package/styles/xertica/app-overrides/chat.css +61 -61
- package/styles/xertica/app-overrides/scrollbar.css +33 -33
- package/styles/xertica/integrations/google-maps.css +76 -76
- package/styles/xertica/integrations/sonner.css +73 -73
- package/styles/xertica/tokens.css +41 -12
- package/templates/CLAUDE.md +182 -172
- package/templates/guidelines/Guidelines.md +325 -313
- package/templates/package.json +3 -3
- package/templates/src/features/auth/index.ts +4 -4
- package/templates/src/features/auth/ui/AuthPageShell.tsx +34 -34
- package/templates/src/features/auth/ui/ForgotPasswordContent.tsx +70 -70
- package/templates/src/features/auth/ui/LoginContent.tsx +90 -90
- package/templates/src/features/auth/ui/ResetPasswordContent.tsx +151 -151
- package/templates/src/features/auth/ui/SocialLoginButtons.tsx +59 -59
- package/templates/src/features/auth/ui/VerifyEmailContent.tsx +82 -82
- package/templates/src/features/home/index.ts +1 -1
- package/templates/src/features/home/ui/HomeContent.tsx +100 -100
- package/templates/src/features/template/index.ts +5 -5
- package/templates/src/features/template/ui/CrudTemplate.tsx +3 -3
- package/templates/src/features/template/ui/DashboardTemplate.tsx +3 -3
- package/templates/src/features/template/ui/FormTemplate.tsx +120 -120
- package/templates/src/features/template/ui/LoginTemplate.tsx +3 -3
- package/templates/src/pages/AssistantPage.tsx +328 -328
- package/templates/src/pages/ForgotPasswordPage.tsx +6 -6
- package/templates/src/pages/HomePage.tsx +57 -57
- package/templates/src/pages/LoginPage.tsx +10 -10
- package/templates/src/pages/ResetPasswordPage.tsx +6 -6
- package/templates/src/pages/TemplatePage.tsx +30 -30
- package/templates/src/pages/VerifyEmailPage.tsx +6 -6
- package/templates/src/shared/config/navigation.ts +20 -20
- package/templates/src/shared/lib/auth.ts +20 -20
- package/templates/src/shared/types/auth.ts +3 -3
- package/templates/src/styles/xertica/tokens.css +39 -10
- package/templates/tsconfig.json +5 -5
- package/utils/gemini.ts +140 -140
- package/dist/VerifyEmailPage-Bae2cBXT.cjs +0 -2827
- package/dist/VerifyEmailPage-CbgjOF0v.js +0 -2828
- package/dist/index-CkTUgOwX.js +0 -8
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useState, useRef, useEffect } from "react";
|
|
3
|
+
const GOOGLE_MAPS_LIBRARIES = ["marker", "places", "geometry", "drawing", "maps"];
|
|
4
|
+
const GOOGLE_MAPS_ID = "xertica-google-map-script";
|
|
5
|
+
const __vite_import_meta_env__ = {};
|
|
6
|
+
const GoogleMapsContext = createContext({
|
|
7
|
+
isLoaded: false,
|
|
8
|
+
loadError: void 0,
|
|
9
|
+
load: () => Promise.resolve()
|
|
10
|
+
});
|
|
11
|
+
function getInitialApiKey() {
|
|
12
|
+
if (typeof import.meta !== "undefined" && __vite_import_meta_env__ && "AIzaSyCj19NndSgZOb8057q24UbJtSsfVJiyVdo") {
|
|
13
|
+
return "AIzaSyCj19NndSgZOb8057q24UbJtSsfVJiyVdo";
|
|
14
|
+
}
|
|
15
|
+
if (typeof window === "undefined") return void 0;
|
|
16
|
+
const savedKey = localStorage.getItem("xertica-googlemaps-api-key");
|
|
17
|
+
if (savedKey && savedKey.trim().length > 0) {
|
|
18
|
+
return savedKey;
|
|
19
|
+
}
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
function removeExistingScript() {
|
|
23
|
+
var _a;
|
|
24
|
+
if (typeof window === "undefined") return;
|
|
25
|
+
if (window.__googleMapsCallback) {
|
|
26
|
+
delete window.__googleMapsCallback;
|
|
27
|
+
}
|
|
28
|
+
const existingScript = document.querySelector(`script[src*="maps.googleapis.com/maps/api/js"]`);
|
|
29
|
+
if (existingScript) {
|
|
30
|
+
existingScript.remove();
|
|
31
|
+
}
|
|
32
|
+
if ((_a = window.google) == null ? void 0 : _a.maps) {
|
|
33
|
+
delete window.google.maps;
|
|
34
|
+
}
|
|
35
|
+
if (window.__XERTICA_GOOGLE_MAPS_LOADER__) {
|
|
36
|
+
window.__XERTICA_GOOGLE_MAPS_LOADER__.isLoaded = false;
|
|
37
|
+
window.__XERTICA_GOOGLE_MAPS_LOADER__.loadError = void 0;
|
|
38
|
+
window.__XERTICA_GOOGLE_MAPS_LOADER__.scriptElement = void 0;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function isGoogleMapsAlreadyLoaded() {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
if (typeof window === "undefined") return false;
|
|
44
|
+
return ((_b = (_a = window.google) == null ? void 0 : _a.maps) == null ? void 0 : _b.version) !== void 0;
|
|
45
|
+
}
|
|
46
|
+
function isMarkerLibraryLoaded() {
|
|
47
|
+
var _a, _b, _c;
|
|
48
|
+
if (typeof window === "undefined") return false;
|
|
49
|
+
return ((_c = (_b = (_a = window.google) == null ? void 0 : _a.maps) == null ? void 0 : _b.marker) == null ? void 0 : _c.AdvancedMarkerElement) !== void 0;
|
|
50
|
+
}
|
|
51
|
+
function loadGoogleMapsScript(apiKey) {
|
|
52
|
+
return new Promise((resolve, reject) => {
|
|
53
|
+
if (typeof window === "undefined") {
|
|
54
|
+
reject(new Error("Window is undefined"));
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (!apiKey || apiKey.length < 10) {
|
|
58
|
+
reject(new Error("Invalid or missing Google Maps API key. Please configure your API key in Settings."));
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (isGoogleMapsAlreadyLoaded() && isMarkerLibraryLoaded()) {
|
|
62
|
+
const existingScript = document.querySelector(`script[src*="maps.googleapis.com/maps/api/js"]`);
|
|
63
|
+
if (existingScript && existingScript.src.includes(`key=${apiKey}`)) {
|
|
64
|
+
resolve();
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const existing = document.querySelector(`script[src*="maps.googleapis.com/maps/api/js"]`);
|
|
69
|
+
if (existing) {
|
|
70
|
+
if (!existing.src.includes(`key=${apiKey}`)) {
|
|
71
|
+
console.warn("[GoogleMapsLoader] API key changed, but Google Maps cannot be reloaded without a full page refresh because custom elements are already defined.");
|
|
72
|
+
resolve();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (isGoogleMapsAlreadyLoaded() && isMarkerLibraryLoaded()) {
|
|
76
|
+
resolve();
|
|
77
|
+
} else {
|
|
78
|
+
existing.addEventListener("load", () => {
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
if (isMarkerLibraryLoaded()) {
|
|
81
|
+
resolve();
|
|
82
|
+
} else {
|
|
83
|
+
reject(new Error("Marker library failed to load"));
|
|
84
|
+
}
|
|
85
|
+
}, 100);
|
|
86
|
+
});
|
|
87
|
+
existing.addEventListener("error", () => reject(new Error("Failed to load Google Maps")));
|
|
88
|
+
}
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (typeof customElements !== "undefined" && customElements.get("gmp-map")) {
|
|
92
|
+
console.warn("[GoogleMapsLoader] gmp-map is already defined in customElements. Skipping script injection.");
|
|
93
|
+
resolve();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const script = document.createElement("script");
|
|
97
|
+
const params = new URLSearchParams({
|
|
98
|
+
key: apiKey,
|
|
99
|
+
// SEMPRE incluir a API key
|
|
100
|
+
callback: "__googleMapsCallback",
|
|
101
|
+
libraries: GOOGLE_MAPS_LIBRARIES.join(","),
|
|
102
|
+
v: "quarterly",
|
|
103
|
+
// Usar 'quarterly' para versão estável ao invés de 'weekly'
|
|
104
|
+
loading: "async"
|
|
105
|
+
});
|
|
106
|
+
script.src = `https://maps.googleapis.com/maps/api/js?${params.toString()}`;
|
|
107
|
+
script.async = true;
|
|
108
|
+
script.defer = true;
|
|
109
|
+
script.id = GOOGLE_MAPS_ID;
|
|
110
|
+
window.__googleMapsCallback = () => {
|
|
111
|
+
delete window.__googleMapsCallback;
|
|
112
|
+
setTimeout(() => {
|
|
113
|
+
if (isMarkerLibraryLoaded()) {
|
|
114
|
+
resolve();
|
|
115
|
+
} else {
|
|
116
|
+
reject(new Error("Marker library failed to load"));
|
|
117
|
+
}
|
|
118
|
+
}, 100);
|
|
119
|
+
};
|
|
120
|
+
script.addEventListener("error", () => {
|
|
121
|
+
delete window.__googleMapsCallback;
|
|
122
|
+
reject(new Error("Failed to load Google Maps script. Please check your API key and ensure Maps JavaScript API is enabled."));
|
|
123
|
+
});
|
|
124
|
+
document.head.appendChild(script);
|
|
125
|
+
const singleton = getOrCreateSingleton();
|
|
126
|
+
if (singleton) {
|
|
127
|
+
singleton.scriptElement = script;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function getOrCreateSingleton() {
|
|
132
|
+
if (typeof window === "undefined") return null;
|
|
133
|
+
if (!window.__XERTICA_GOOGLE_MAPS_LOADER__) {
|
|
134
|
+
const isPreloaded = isGoogleMapsAlreadyLoaded();
|
|
135
|
+
window.__XERTICA_GOOGLE_MAPS_LOADER__ = {
|
|
136
|
+
isLoaded: isPreloaded,
|
|
137
|
+
loadError: void 0,
|
|
138
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
139
|
+
scriptElement: void 0
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
return window.__XERTICA_GOOGLE_MAPS_LOADER__;
|
|
143
|
+
}
|
|
144
|
+
function updateSingleton(state) {
|
|
145
|
+
const singleton = getOrCreateSingleton();
|
|
146
|
+
if (!singleton) return;
|
|
147
|
+
if (state.isLoaded !== void 0) singleton.isLoaded = state.isLoaded;
|
|
148
|
+
if (state.loadError !== void 0) singleton.loadError = state.loadError;
|
|
149
|
+
const newState = {
|
|
150
|
+
isLoaded: singleton.isLoaded,
|
|
151
|
+
loadError: singleton.loadError,
|
|
152
|
+
load: async (apiKey) => {
|
|
153
|
+
if (singleton.isLoaded) return;
|
|
154
|
+
try {
|
|
155
|
+
await loadGoogleMapsScript(apiKey);
|
|
156
|
+
updateSingleton({ isLoaded: true, loadError: void 0 });
|
|
157
|
+
} catch (error) {
|
|
158
|
+
updateSingleton({ isLoaded: false, loadError: error });
|
|
159
|
+
throw error;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
singleton.listeners.forEach((listener) => listener(newState));
|
|
164
|
+
}
|
|
165
|
+
const SingletonLoaderWrapper = ({ children }) => {
|
|
166
|
+
const [state, setState] = useState(() => {
|
|
167
|
+
const singleton = getOrCreateSingleton();
|
|
168
|
+
const loadFn = async (apiKey) => {
|
|
169
|
+
if (singleton == null ? void 0 : singleton.isLoaded) return;
|
|
170
|
+
try {
|
|
171
|
+
await loadGoogleMapsScript(apiKey);
|
|
172
|
+
updateSingleton({ isLoaded: true, loadError: void 0 });
|
|
173
|
+
} catch (error) {
|
|
174
|
+
updateSingleton({ isLoaded: false, loadError: error });
|
|
175
|
+
throw error;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
if (!singleton) return { isLoaded: false, loadError: void 0, load: loadFn };
|
|
179
|
+
return {
|
|
180
|
+
isLoaded: singleton.isLoaded,
|
|
181
|
+
loadError: singleton.loadError,
|
|
182
|
+
load: loadFn
|
|
183
|
+
};
|
|
184
|
+
});
|
|
185
|
+
useEffect(() => {
|
|
186
|
+
const singleton = getOrCreateSingleton();
|
|
187
|
+
if (!singleton) return;
|
|
188
|
+
const listener = (newState) => {
|
|
189
|
+
setState(newState);
|
|
190
|
+
};
|
|
191
|
+
singleton.listeners.add(listener);
|
|
192
|
+
listener({
|
|
193
|
+
isLoaded: singleton.isLoaded,
|
|
194
|
+
loadError: singleton.loadError,
|
|
195
|
+
load: state.load
|
|
196
|
+
});
|
|
197
|
+
return () => {
|
|
198
|
+
singleton.listeners.delete(listener);
|
|
199
|
+
};
|
|
200
|
+
}, []);
|
|
201
|
+
return /* @__PURE__ */ jsx(GoogleMapsContext.Provider, { value: state, children });
|
|
202
|
+
};
|
|
203
|
+
const LoaderInitializer = ({ apiKey }) => {
|
|
204
|
+
const hasInitializedRef = useRef(false);
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
if (hasInitializedRef.current) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const singleton = getOrCreateSingleton();
|
|
210
|
+
if (!singleton) return;
|
|
211
|
+
if (isGoogleMapsAlreadyLoaded() && isMarkerLibraryLoaded()) {
|
|
212
|
+
updateSingleton({ isLoaded: true, loadError: void 0 });
|
|
213
|
+
hasInitializedRef.current = true;
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
hasInitializedRef.current = true;
|
|
217
|
+
const keyToUse = apiKey || getInitialApiKey();
|
|
218
|
+
if (!keyToUse) {
|
|
219
|
+
updateSingleton({
|
|
220
|
+
isLoaded: false,
|
|
221
|
+
loadError: void 0
|
|
222
|
+
// Não definir erro quando não há API key
|
|
223
|
+
});
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
loadGoogleMapsScript(keyToUse).then(() => {
|
|
227
|
+
updateSingleton({ isLoaded: true, loadError: void 0 });
|
|
228
|
+
}).catch((error) => {
|
|
229
|
+
updateSingleton({ isLoaded: false, loadError: error });
|
|
230
|
+
});
|
|
231
|
+
}, [apiKey]);
|
|
232
|
+
return null;
|
|
233
|
+
};
|
|
234
|
+
const GoogleMapsLoaderProvider = ({ children, apiKey }) => {
|
|
235
|
+
const [shouldInitialize] = useState(() => {
|
|
236
|
+
const singleton = getOrCreateSingleton();
|
|
237
|
+
if (!singleton) return false;
|
|
238
|
+
if (singleton.isLoaded || isGoogleMapsAlreadyLoaded() || isMarkerLibraryLoaded()) {
|
|
239
|
+
singleton.isLoaded = true;
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
return true;
|
|
243
|
+
});
|
|
244
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
245
|
+
shouldInitialize && /* @__PURE__ */ jsx(LoaderInitializer, { apiKey }),
|
|
246
|
+
/* @__PURE__ */ jsx(SingletonLoaderWrapper, { children })
|
|
247
|
+
] });
|
|
248
|
+
};
|
|
249
|
+
const useGoogleMapsLoader = () => useContext(GoogleMapsContext);
|
|
250
|
+
function reloadGoogleMaps(newApiKey) {
|
|
251
|
+
return new Promise((resolve, reject) => {
|
|
252
|
+
if (typeof window === "undefined") {
|
|
253
|
+
reject(new Error("Window is undefined"));
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
if (!newApiKey || newApiKey.length < 10) {
|
|
257
|
+
reject(new Error("Invalid or missing Google Maps API key"));
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
const existingScript = document.querySelector(`script[src*="maps.googleapis.com/maps/api/js"]`);
|
|
261
|
+
if (existingScript && existingScript.src.includes(`key=${newApiKey}`)) {
|
|
262
|
+
resolve();
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
if (typeof customElements !== "undefined" && customElements.get("gmp-map")) {
|
|
266
|
+
console.warn("[GoogleMapsLoader] Cannot reload map API dynamically because custom elements (gmp-map) are already registered. A full page reload is required to apply the new API key.");
|
|
267
|
+
resolve();
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
removeExistingScript();
|
|
271
|
+
updateSingleton({ isLoaded: false, loadError: void 0 });
|
|
272
|
+
loadGoogleMapsScript(newApiKey).then(() => {
|
|
273
|
+
updateSingleton({ isLoaded: true, loadError: void 0 });
|
|
274
|
+
resolve();
|
|
275
|
+
}).catch((error) => {
|
|
276
|
+
updateSingleton({ isLoaded: false, loadError: error });
|
|
277
|
+
reject(error);
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
const GoogleMapsProvider = GoogleMapsLoaderProvider;
|
|
282
|
+
export {
|
|
283
|
+
GoogleMapsLoaderProvider as G,
|
|
284
|
+
GoogleMapsProvider as a,
|
|
285
|
+
reloadGoogleMaps as r,
|
|
286
|
+
useGoogleMapsLoader as u
|
|
287
|
+
};
|
|
@@ -2,6 +2,7 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { createContext, useContext, useState, useRef, useEffect } from "react";
|
|
3
3
|
const GOOGLE_MAPS_LIBRARIES = ["marker", "places", "geometry", "drawing", "maps"];
|
|
4
4
|
const GOOGLE_MAPS_ID = "xertica-google-map-script";
|
|
5
|
+
const __vite_import_meta_env__ = {};
|
|
5
6
|
const GoogleMapsContext = createContext({
|
|
6
7
|
isLoaded: false,
|
|
7
8
|
loadError: void 0,
|
|
@@ -9,6 +10,9 @@ const GoogleMapsContext = createContext({
|
|
|
9
10
|
});
|
|
10
11
|
function getInitialApiKey() {
|
|
11
12
|
var _a;
|
|
13
|
+
if (typeof import.meta !== "undefined" && __vite_import_meta_env__ && "AIzaSyCj19NndSgZOb8057q24UbJtSsfVJiyVdo") {
|
|
14
|
+
return "AIzaSyCj19NndSgZOb8057q24UbJtSsfVJiyVdo";
|
|
15
|
+
}
|
|
12
16
|
if (typeof window === "undefined") return void 0;
|
|
13
17
|
const savedKey = (_a = window.localStorage) == null ? void 0 : _a.getItem("xertica-googlemaps-api-key");
|
|
14
18
|
if (savedKey && savedKey.trim().length > 0) {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const React = require("react");
|
|
4
|
+
var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
|
|
4
5
|
const GOOGLE_MAPS_LIBRARIES = ["marker", "places", "geometry", "drawing", "maps"];
|
|
5
6
|
const GOOGLE_MAPS_ID = "xertica-google-map-script";
|
|
7
|
+
const __vite_import_meta_env__ = {};
|
|
6
8
|
const GoogleMapsContext = React.createContext({
|
|
7
9
|
isLoaded: false,
|
|
8
10
|
loadError: void 0,
|
|
@@ -10,6 +12,9 @@ const GoogleMapsContext = React.createContext({
|
|
|
10
12
|
});
|
|
11
13
|
function getInitialApiKey() {
|
|
12
14
|
var _a;
|
|
15
|
+
if (typeof { url: typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("google-maps-loader-Y-QkD-Li.cjs", document.baseURI).href } !== "undefined" && __vite_import_meta_env__ && "AIzaSyCj19NndSgZOb8057q24UbJtSsfVJiyVdo") {
|
|
16
|
+
return "AIzaSyCj19NndSgZOb8057q24UbJtSsfVJiyVdo";
|
|
17
|
+
}
|
|
13
18
|
if (typeof window === "undefined") return void 0;
|
|
14
19
|
const savedKey = (_a = window.localStorage) == null ? void 0 : _a.getItem("xertica-googlemaps-api-key");
|
|
15
20
|
if (savedKey && savedKey.trim().length > 0) {
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const React = require("react");
|
|
4
|
+
var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
|
|
5
|
+
const GOOGLE_MAPS_LIBRARIES = ["marker", "places", "geometry", "drawing", "maps"];
|
|
6
|
+
const GOOGLE_MAPS_ID = "xertica-google-map-script";
|
|
7
|
+
const __vite_import_meta_env__ = {};
|
|
8
|
+
const GoogleMapsContext = React.createContext({
|
|
9
|
+
isLoaded: false,
|
|
10
|
+
loadError: void 0,
|
|
11
|
+
load: () => Promise.resolve()
|
|
12
|
+
});
|
|
13
|
+
function getInitialApiKey() {
|
|
14
|
+
if (typeof { url: typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("google-maps-loader-eS3uQ5TA.cjs", document.baseURI).href } !== "undefined" && __vite_import_meta_env__ && "AIzaSyCj19NndSgZOb8057q24UbJtSsfVJiyVdo") {
|
|
15
|
+
return "AIzaSyCj19NndSgZOb8057q24UbJtSsfVJiyVdo";
|
|
16
|
+
}
|
|
17
|
+
if (typeof window === "undefined") return void 0;
|
|
18
|
+
const savedKey = localStorage.getItem("xertica-googlemaps-api-key");
|
|
19
|
+
if (savedKey && savedKey.trim().length > 0) {
|
|
20
|
+
return savedKey;
|
|
21
|
+
}
|
|
22
|
+
return void 0;
|
|
23
|
+
}
|
|
24
|
+
function removeExistingScript() {
|
|
25
|
+
var _a;
|
|
26
|
+
if (typeof window === "undefined") return;
|
|
27
|
+
if (window.__googleMapsCallback) {
|
|
28
|
+
delete window.__googleMapsCallback;
|
|
29
|
+
}
|
|
30
|
+
const existingScript = document.querySelector(`script[src*="maps.googleapis.com/maps/api/js"]`);
|
|
31
|
+
if (existingScript) {
|
|
32
|
+
existingScript.remove();
|
|
33
|
+
}
|
|
34
|
+
if ((_a = window.google) == null ? void 0 : _a.maps) {
|
|
35
|
+
delete window.google.maps;
|
|
36
|
+
}
|
|
37
|
+
if (window.__XERTICA_GOOGLE_MAPS_LOADER__) {
|
|
38
|
+
window.__XERTICA_GOOGLE_MAPS_LOADER__.isLoaded = false;
|
|
39
|
+
window.__XERTICA_GOOGLE_MAPS_LOADER__.loadError = void 0;
|
|
40
|
+
window.__XERTICA_GOOGLE_MAPS_LOADER__.scriptElement = void 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function isGoogleMapsAlreadyLoaded() {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
if (typeof window === "undefined") return false;
|
|
46
|
+
return ((_b = (_a = window.google) == null ? void 0 : _a.maps) == null ? void 0 : _b.version) !== void 0;
|
|
47
|
+
}
|
|
48
|
+
function isMarkerLibraryLoaded() {
|
|
49
|
+
var _a, _b, _c;
|
|
50
|
+
if (typeof window === "undefined") return false;
|
|
51
|
+
return ((_c = (_b = (_a = window.google) == null ? void 0 : _a.maps) == null ? void 0 : _b.marker) == null ? void 0 : _c.AdvancedMarkerElement) !== void 0;
|
|
52
|
+
}
|
|
53
|
+
function loadGoogleMapsScript(apiKey) {
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
if (typeof window === "undefined") {
|
|
56
|
+
reject(new Error("Window is undefined"));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (!apiKey || apiKey.length < 10) {
|
|
60
|
+
reject(new Error("Invalid or missing Google Maps API key. Please configure your API key in Settings."));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (isGoogleMapsAlreadyLoaded() && isMarkerLibraryLoaded()) {
|
|
64
|
+
const existingScript = document.querySelector(`script[src*="maps.googleapis.com/maps/api/js"]`);
|
|
65
|
+
if (existingScript && existingScript.src.includes(`key=${apiKey}`)) {
|
|
66
|
+
resolve();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const existing = document.querySelector(`script[src*="maps.googleapis.com/maps/api/js"]`);
|
|
71
|
+
if (existing) {
|
|
72
|
+
if (!existing.src.includes(`key=${apiKey}`)) {
|
|
73
|
+
console.warn("[GoogleMapsLoader] API key changed, but Google Maps cannot be reloaded without a full page refresh because custom elements are already defined.");
|
|
74
|
+
resolve();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (isGoogleMapsAlreadyLoaded() && isMarkerLibraryLoaded()) {
|
|
78
|
+
resolve();
|
|
79
|
+
} else {
|
|
80
|
+
existing.addEventListener("load", () => {
|
|
81
|
+
setTimeout(() => {
|
|
82
|
+
if (isMarkerLibraryLoaded()) {
|
|
83
|
+
resolve();
|
|
84
|
+
} else {
|
|
85
|
+
reject(new Error("Marker library failed to load"));
|
|
86
|
+
}
|
|
87
|
+
}, 100);
|
|
88
|
+
});
|
|
89
|
+
existing.addEventListener("error", () => reject(new Error("Failed to load Google Maps")));
|
|
90
|
+
}
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (typeof customElements !== "undefined" && customElements.get("gmp-map")) {
|
|
94
|
+
console.warn("[GoogleMapsLoader] gmp-map is already defined in customElements. Skipping script injection.");
|
|
95
|
+
resolve();
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const script = document.createElement("script");
|
|
99
|
+
const params = new URLSearchParams({
|
|
100
|
+
key: apiKey,
|
|
101
|
+
// SEMPRE incluir a API key
|
|
102
|
+
callback: "__googleMapsCallback",
|
|
103
|
+
libraries: GOOGLE_MAPS_LIBRARIES.join(","),
|
|
104
|
+
v: "quarterly",
|
|
105
|
+
// Usar 'quarterly' para versão estável ao invés de 'weekly'
|
|
106
|
+
loading: "async"
|
|
107
|
+
});
|
|
108
|
+
script.src = `https://maps.googleapis.com/maps/api/js?${params.toString()}`;
|
|
109
|
+
script.async = true;
|
|
110
|
+
script.defer = true;
|
|
111
|
+
script.id = GOOGLE_MAPS_ID;
|
|
112
|
+
window.__googleMapsCallback = () => {
|
|
113
|
+
delete window.__googleMapsCallback;
|
|
114
|
+
setTimeout(() => {
|
|
115
|
+
if (isMarkerLibraryLoaded()) {
|
|
116
|
+
resolve();
|
|
117
|
+
} else {
|
|
118
|
+
reject(new Error("Marker library failed to load"));
|
|
119
|
+
}
|
|
120
|
+
}, 100);
|
|
121
|
+
};
|
|
122
|
+
script.addEventListener("error", () => {
|
|
123
|
+
delete window.__googleMapsCallback;
|
|
124
|
+
reject(new Error("Failed to load Google Maps script. Please check your API key and ensure Maps JavaScript API is enabled."));
|
|
125
|
+
});
|
|
126
|
+
document.head.appendChild(script);
|
|
127
|
+
const singleton = getOrCreateSingleton();
|
|
128
|
+
if (singleton) {
|
|
129
|
+
singleton.scriptElement = script;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function getOrCreateSingleton() {
|
|
134
|
+
if (typeof window === "undefined") return null;
|
|
135
|
+
if (!window.__XERTICA_GOOGLE_MAPS_LOADER__) {
|
|
136
|
+
const isPreloaded = isGoogleMapsAlreadyLoaded();
|
|
137
|
+
window.__XERTICA_GOOGLE_MAPS_LOADER__ = {
|
|
138
|
+
isLoaded: isPreloaded,
|
|
139
|
+
loadError: void 0,
|
|
140
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
141
|
+
scriptElement: void 0
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
return window.__XERTICA_GOOGLE_MAPS_LOADER__;
|
|
145
|
+
}
|
|
146
|
+
function updateSingleton(state) {
|
|
147
|
+
const singleton = getOrCreateSingleton();
|
|
148
|
+
if (!singleton) return;
|
|
149
|
+
if (state.isLoaded !== void 0) singleton.isLoaded = state.isLoaded;
|
|
150
|
+
if (state.loadError !== void 0) singleton.loadError = state.loadError;
|
|
151
|
+
const newState = {
|
|
152
|
+
isLoaded: singleton.isLoaded,
|
|
153
|
+
loadError: singleton.loadError,
|
|
154
|
+
load: async (apiKey) => {
|
|
155
|
+
if (singleton.isLoaded) return;
|
|
156
|
+
try {
|
|
157
|
+
await loadGoogleMapsScript(apiKey);
|
|
158
|
+
updateSingleton({ isLoaded: true, loadError: void 0 });
|
|
159
|
+
} catch (error) {
|
|
160
|
+
updateSingleton({ isLoaded: false, loadError: error });
|
|
161
|
+
throw error;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
singleton.listeners.forEach((listener) => listener(newState));
|
|
166
|
+
}
|
|
167
|
+
const SingletonLoaderWrapper = ({ children }) => {
|
|
168
|
+
const [state, setState] = React.useState(() => {
|
|
169
|
+
const singleton = getOrCreateSingleton();
|
|
170
|
+
const loadFn = async (apiKey) => {
|
|
171
|
+
if (singleton == null ? void 0 : singleton.isLoaded) return;
|
|
172
|
+
try {
|
|
173
|
+
await loadGoogleMapsScript(apiKey);
|
|
174
|
+
updateSingleton({ isLoaded: true, loadError: void 0 });
|
|
175
|
+
} catch (error) {
|
|
176
|
+
updateSingleton({ isLoaded: false, loadError: error });
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
if (!singleton) return { isLoaded: false, loadError: void 0, load: loadFn };
|
|
181
|
+
return {
|
|
182
|
+
isLoaded: singleton.isLoaded,
|
|
183
|
+
loadError: singleton.loadError,
|
|
184
|
+
load: loadFn
|
|
185
|
+
};
|
|
186
|
+
});
|
|
187
|
+
React.useEffect(() => {
|
|
188
|
+
const singleton = getOrCreateSingleton();
|
|
189
|
+
if (!singleton) return;
|
|
190
|
+
const listener = (newState) => {
|
|
191
|
+
setState(newState);
|
|
192
|
+
};
|
|
193
|
+
singleton.listeners.add(listener);
|
|
194
|
+
listener({
|
|
195
|
+
isLoaded: singleton.isLoaded,
|
|
196
|
+
loadError: singleton.loadError,
|
|
197
|
+
load: state.load
|
|
198
|
+
});
|
|
199
|
+
return () => {
|
|
200
|
+
singleton.listeners.delete(listener);
|
|
201
|
+
};
|
|
202
|
+
}, []);
|
|
203
|
+
return /* @__PURE__ */ jsxRuntime.jsx(GoogleMapsContext.Provider, { value: state, children });
|
|
204
|
+
};
|
|
205
|
+
const LoaderInitializer = ({ apiKey }) => {
|
|
206
|
+
const hasInitializedRef = React.useRef(false);
|
|
207
|
+
React.useEffect(() => {
|
|
208
|
+
if (hasInitializedRef.current) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const singleton = getOrCreateSingleton();
|
|
212
|
+
if (!singleton) return;
|
|
213
|
+
if (isGoogleMapsAlreadyLoaded() && isMarkerLibraryLoaded()) {
|
|
214
|
+
updateSingleton({ isLoaded: true, loadError: void 0 });
|
|
215
|
+
hasInitializedRef.current = true;
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
hasInitializedRef.current = true;
|
|
219
|
+
const keyToUse = apiKey || getInitialApiKey();
|
|
220
|
+
if (!keyToUse) {
|
|
221
|
+
updateSingleton({
|
|
222
|
+
isLoaded: false,
|
|
223
|
+
loadError: void 0
|
|
224
|
+
// Não definir erro quando não há API key
|
|
225
|
+
});
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
loadGoogleMapsScript(keyToUse).then(() => {
|
|
229
|
+
updateSingleton({ isLoaded: true, loadError: void 0 });
|
|
230
|
+
}).catch((error) => {
|
|
231
|
+
updateSingleton({ isLoaded: false, loadError: error });
|
|
232
|
+
});
|
|
233
|
+
}, [apiKey]);
|
|
234
|
+
return null;
|
|
235
|
+
};
|
|
236
|
+
const GoogleMapsLoaderProvider = ({ children, apiKey }) => {
|
|
237
|
+
const [shouldInitialize] = React.useState(() => {
|
|
238
|
+
const singleton = getOrCreateSingleton();
|
|
239
|
+
if (!singleton) return false;
|
|
240
|
+
if (singleton.isLoaded || isGoogleMapsAlreadyLoaded() || isMarkerLibraryLoaded()) {
|
|
241
|
+
singleton.isLoaded = true;
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
return true;
|
|
245
|
+
});
|
|
246
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
247
|
+
shouldInitialize && /* @__PURE__ */ jsxRuntime.jsx(LoaderInitializer, { apiKey }),
|
|
248
|
+
/* @__PURE__ */ jsxRuntime.jsx(SingletonLoaderWrapper, { children })
|
|
249
|
+
] });
|
|
250
|
+
};
|
|
251
|
+
const useGoogleMapsLoader = () => React.useContext(GoogleMapsContext);
|
|
252
|
+
function reloadGoogleMaps(newApiKey) {
|
|
253
|
+
return new Promise((resolve, reject) => {
|
|
254
|
+
if (typeof window === "undefined") {
|
|
255
|
+
reject(new Error("Window is undefined"));
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
if (!newApiKey || newApiKey.length < 10) {
|
|
259
|
+
reject(new Error("Invalid or missing Google Maps API key"));
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
const existingScript = document.querySelector(`script[src*="maps.googleapis.com/maps/api/js"]`);
|
|
263
|
+
if (existingScript && existingScript.src.includes(`key=${newApiKey}`)) {
|
|
264
|
+
resolve();
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (typeof customElements !== "undefined" && customElements.get("gmp-map")) {
|
|
268
|
+
console.warn("[GoogleMapsLoader] Cannot reload map API dynamically because custom elements (gmp-map) are already registered. A full page reload is required to apply the new API key.");
|
|
269
|
+
resolve();
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
removeExistingScript();
|
|
273
|
+
updateSingleton({ isLoaded: false, loadError: void 0 });
|
|
274
|
+
loadGoogleMapsScript(newApiKey).then(() => {
|
|
275
|
+
updateSingleton({ isLoaded: true, loadError: void 0 });
|
|
276
|
+
resolve();
|
|
277
|
+
}).catch((error) => {
|
|
278
|
+
updateSingleton({ isLoaded: false, loadError: error });
|
|
279
|
+
reject(error);
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
const GoogleMapsProvider = GoogleMapsLoaderProvider;
|
|
284
|
+
exports.GoogleMapsLoaderProvider = GoogleMapsLoaderProvider;
|
|
285
|
+
exports.GoogleMapsProvider = GoogleMapsProvider;
|
|
286
|
+
exports.reloadGoogleMaps = reloadGoogleMaps;
|
|
287
|
+
exports.useGoogleMapsLoader = useGoogleMapsLoader;
|