@adminide-stack/yantra-mobile 12.0.195 → 12.0.196-alpha.1
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/lib/components/CustomDrawer.js +17 -1
- package/lib/components/CustomDrawer.js.map +1 -1
- package/lib/compute.js +57 -1
- package/lib/compute.js.map +1 -1
- package/lib/config/env-config.js +11 -1
- package/lib/config/env-config.js.map +1 -1
- package/lib/features/agent-chat/NativeAgentChat.js +7 -0
- package/lib/features/agent-chat/NativeAgentChat.js.map +1 -1
- package/lib/features/canvas/extendVideo.js +5 -1
- package/lib/features/canvas/extendVideo.js.map +1 -1
- package/lib/features/canvas/workflow/StepSheet.js +18 -1
- package/lib/features/canvas/workflow/StepSheet.js.map +1 -1
- package/lib/features/canvas/workflow/workflowSteps.js +102 -31
- package/lib/features/canvas/workflow/workflowSteps.js.map +1 -1
- package/lib/features/chat/ComposerMicSend.js +35 -0
- package/lib/features/chat/ComposerMicSend.js.map +1 -0
- package/lib/features/chat/ComposerModeSwitch.js +64 -1
- package/lib/features/chat/ComposerModeSwitch.js.map +1 -1
- package/lib/features/chat/askUser.js +6 -1
- package/lib/features/chat/askUser.js.map +1 -1
- package/lib/features/connectors/ConnectorSheet.js +443 -0
- package/lib/features/connectors/ConnectorSheet.js.map +1 -0
- package/lib/features/connectors/ConnectorsPage.js +320 -0
- package/lib/features/connectors/ConnectorsPage.js.map +1 -0
- package/lib/features/connectors/connectConnector.js +278 -0
- package/lib/features/connectors/connectConnector.js.map +1 -0
- package/lib/features/connectors/connectorCatalog.js +222 -0
- package/lib/features/connectors/connectorCatalog.js.map +1 -0
- package/lib/features/connectors/useConnectorCatalog.js +153 -0
- package/lib/features/connectors/useConnectorCatalog.js.map +1 -0
- package/lib/features/home/needsYou/HomeNeedsYou.js +618 -0
- package/lib/features/home/needsYou/HomeNeedsYou.js.map +1 -0
- package/lib/features/home/needsYou/chatFollowUps.js +333 -0
- package/lib/features/home/needsYou/chatFollowUps.js.map +1 -0
- package/lib/features/home/needsYou/format.js +47 -0
- package/lib/features/home/needsYou/format.js.map +1 -0
- package/lib/features/home/needsYou/historyText.js +40 -0
- package/lib/features/home/needsYou/historyText.js.map +1 -0
- package/lib/features/home/needsYou/inboxHighlights.js +152 -0
- package/lib/features/home/needsYou/inboxHighlights.js.map +1 -0
- package/lib/features/home/needsYou/panelsSettings.js +71 -0
- package/lib/features/home/needsYou/panelsSettings.js.map +1 -0
- package/lib/features/home/needsYou/ported/commandConfirmProtocol.js +13 -0
- package/lib/features/home/needsYou/ported/commandConfirmProtocol.js.map +1 -0
- package/lib/features/home/needsYou/ported/paymentApprovalProtocol.js +91 -0
- package/lib/features/home/needsYou/ported/paymentApprovalProtocol.js.map +1 -0
- package/lib/features/home/needsYou/ported/resultCardModels.js +659 -0
- package/lib/features/home/needsYou/ported/resultCardModels.js.map +1 -0
- package/lib/features/home/needsYou/types.js +1 -0
- package/lib/features/home/needsYou/types.js.map +1 -0
- package/lib/features/home/needsYou/useChatFollowUps.js +149 -0
- package/lib/features/home/needsYou/useChatFollowUps.js.map +1 -0
- package/lib/features/home/needsYou/useHomeBriefing.js +68 -0
- package/lib/features/home/needsYou/useHomeBriefing.js.map +1 -0
- package/lib/features/home/needsYou/useInboxHighlights.js +173 -0
- package/lib/features/home/needsYou/useInboxHighlights.js.map +1 -0
- package/lib/features/home/needsYou/usePanelsSettings.js +105 -0
- package/lib/features/home/needsYou/usePanelsSettings.js.map +1 -0
- package/lib/features/shopping/DealCard.js +8 -1
- package/lib/features/shopping/DealCard.js.map +1 -1
- package/lib/features/shopping/DealRails.js +24 -7
- package/lib/features/shopping/DealRails.js.map +1 -1
- package/lib/features/shopping/DealsPanel.js +1 -1
- package/lib/features/shopping/DealsPanel.js.map +1 -1
- package/lib/features/shopping/HolidayDealsPanel.js +529 -0
- package/lib/features/shopping/HolidayDealsPanel.js.map +1 -0
- package/lib/features/shopping/HolidayDealsParts.js +954 -0
- package/lib/features/shopping/HolidayDealsParts.js.map +1 -0
- package/lib/features/shopping/HolidayOffers.js +351 -0
- package/lib/features/shopping/HolidayOffers.js.map +1 -0
- package/lib/features/shopping/ProductCard.js +80 -14
- package/lib/features/shopping/ProductCard.js.map +1 -1
- package/lib/features/shopping/ProductDetailSheet.js +22 -3
- package/lib/features/shopping/ProductDetailSheet.js.map +1 -1
- package/lib/features/shopping/SavedPanel.js +341 -5
- package/lib/features/shopping/SavedPanel.js.map +1 -1
- package/lib/features/shopping/SearchResults.js +8 -2
- package/lib/features/shopping/SearchResults.js.map +1 -1
- package/lib/features/shopping/ShoppingAgentChatPane.js +12 -0
- package/lib/features/shopping/ShoppingAgentChatPane.js.map +1 -1
- package/lib/features/shopping/ShoppingExperience.js +56 -19
- package/lib/features/shopping/ShoppingExperience.js.map +1 -1
- package/lib/features/shopping/TrendingSections.js +13 -4
- package/lib/features/shopping/TrendingSections.js.map +1 -1
- package/lib/features/shopping/WatchlistPanel.js +61 -5
- package/lib/features/shopping/WatchlistPanel.js.map +1 -1
- package/lib/features/shopping/catalog.js +41 -2
- package/lib/features/shopping/catalog.js.map +1 -1
- package/lib/features/shopping/chat/brainRouter.js +14 -0
- package/lib/features/shopping/chat/brainRouter.js.map +1 -1
- package/lib/features/shopping/chat/shoppingTurn.js +88 -16
- package/lib/features/shopping/chat/shoppingTurn.js.map +1 -1
- package/lib/features/shopping/hooks/useHolidayDeals.js +388 -0
- package/lib/features/shopping/hooks/useHolidayDeals.js.map +1 -0
- package/lib/features/shopping/hooks/useProductMedia.js +33 -6
- package/lib/features/shopping/hooks/useProductMedia.js.map +1 -1
- package/lib/features/shopping/hooks/useShoppingHistorySync.js +8 -4
- package/lib/features/shopping/hooks/useShoppingHistorySync.js.map +1 -1
- package/lib/features/shopping/hooks/useTrendingProducts.js +11 -3
- package/lib/features/shopping/hooks/useTrendingProducts.js.map +1 -1
- package/lib/features/shopping/savedProducts.js +76 -6
- package/lib/features/shopping/savedProducts.js.map +1 -1
- package/lib/features/shopping/services/aiRelevance.js +212 -0
- package/lib/features/shopping/services/aiRelevance.js.map +1 -0
- package/lib/features/shopping/services/blackFriday.js +301 -0
- package/lib/features/shopping/services/blackFriday.js.map +1 -0
- package/lib/features/shopping/services/blackFridayBrowserSites.js +137 -0
- package/lib/features/shopping/services/blackFridayBrowserSites.js.map +1 -0
- package/lib/features/shopping/services/catalogProductSearch.js +21 -3
- package/lib/features/shopping/services/catalogProductSearch.js.map +1 -1
- package/lib/features/shopping/services/holidayDeals.js +143 -0
- package/lib/features/shopping/services/holidayDeals.js.map +1 -0
- package/lib/features/shopping/services/mediaShape.js +7 -0
- package/lib/features/shopping/services/mediaShape.js.map +1 -0
- package/lib/features/shopping/services/modelStep.js +95 -0
- package/lib/features/shopping/services/modelStep.js.map +1 -0
- package/lib/features/shopping/services/modelWords.js +14 -0
- package/lib/features/shopping/services/modelWords.js.map +1 -0
- package/lib/features/shopping/services/productAvailability.js +5 -1
- package/lib/features/shopping/services/productAvailability.js.map +1 -1
- package/lib/features/shopping/services/productFilters.js +2 -2
- package/lib/features/shopping/services/productFilters.js.map +1 -1
- package/lib/features/shopping/services/productMedia.js +103 -18
- package/lib/features/shopping/services/productMedia.js.map +1 -1
- package/lib/features/shopping/services/retailerUrl.js +11 -8
- package/lib/features/shopping/services/retailerUrl.js.map +1 -1
- package/lib/features/shopping/services/salesDealsStore.js +3 -2
- package/lib/features/shopping/services/salesDealsStore.js.map +1 -1
- package/lib/features/shopping/services/savedReads.js +82 -0
- package/lib/features/shopping/services/savedReads.js.map +1 -0
- package/lib/features/shopping/services/searchCardFields.js +2 -0
- package/lib/features/shopping/services/searchCardFields.js.map +1 -1
- package/lib/features/shopping/services/searchRelevance.js +154 -24
- package/lib/features/shopping/services/searchRelevance.js.map +1 -1
- package/lib/features/shopping/services/secondHand.js +12 -0
- package/lib/features/shopping/services/secondHand.js.map +1 -0
- package/lib/features/shopping/services/shoppingProductSearch.js +82 -10
- package/lib/features/shopping/services/shoppingProductSearch.js.map +1 -1
- package/lib/features/shopping/services/shoppingSearchConnectorClient.js +14 -1
- package/lib/features/shopping/services/shoppingSearchConnectorClient.js.map +1 -1
- package/lib/features/shopping/services/shoppingSubgraph.js +2 -1
- package/lib/features/shopping/services/shoppingSubgraph.js.map +1 -1
- package/lib/features/shopping/services/storedGalleries.js +130 -0
- package/lib/features/shopping/services/storedGalleries.js.map +1 -0
- package/lib/features/shopping/services/usedSites.js +263 -0
- package/lib/features/shopping/services/usedSites.js.map +1 -0
- package/lib/features/shopping/services/verifyProducts.js +3 -3
- package/lib/features/shopping/services/verifyProducts.js.map +1 -1
- package/lib/features/shopping/services/watchDeal.js +61 -0
- package/lib/features/shopping/services/watchDeal.js.map +1 -0
- package/lib/features/shopping/shoppingRuntime.js +7 -2
- package/lib/features/shopping/shoppingRuntime.js.map +1 -1
- package/lib/features/shopping/state/accountCaches.js +20 -0
- package/lib/features/shopping/state/accountCaches.js.map +1 -0
- package/lib/features/shopping/state/holidayDealsRequest.js +22 -0
- package/lib/features/shopping/state/holidayDealsRequest.js.map +1 -0
- package/lib/features/shopping/tutorials/ShoppingTutorialDock.js +1 -1
- package/lib/features/shopping/tutorials/ShoppingTutorialDock.js.map +1 -1
- package/lib/features/shopping/tutorials/shoppingTutorials.js +2 -0
- package/lib/features/shopping/tutorials/shoppingTutorials.js.map +1 -1
- package/lib/features/shopping/useShoppingSearch.js +74 -18
- package/lib/features/shopping/useShoppingSearch.js.map +1 -1
- package/lib/features/team-chat/TeamChatExperience.js +474 -0
- package/lib/features/team-chat/TeamChatExperience.js.map +1 -0
- package/lib/features/team-chat/api/client.js +198 -0
- package/lib/features/team-chat/api/client.js.map +1 -0
- package/lib/features/team-chat/api/live.js +160 -0
- package/lib/features/team-chat/api/live.js.map +1 -0
- package/lib/features/team-chat/api/ops.js +241 -0
- package/lib/features/team-chat/api/ops.js.map +1 -0
- package/lib/features/team-chat/app.js +12 -0
- package/lib/features/team-chat/app.js.map +1 -0
- package/lib/features/team-chat/components/Avatar.js +107 -0
- package/lib/features/team-chat/components/Avatar.js.map +1 -0
- package/lib/features/team-chat/components/Composer.js +641 -0
- package/lib/features/team-chat/components/Composer.js.map +1 -0
- package/lib/features/team-chat/components/Dialogs.js +598 -0
- package/lib/features/team-chat/components/Dialogs.js.map +1 -0
- package/lib/features/team-chat/components/EmojiPicker.js +165 -0
- package/lib/features/team-chat/components/EmojiPicker.js.map +1 -0
- package/lib/features/team-chat/components/MessageItem.js +658 -0
- package/lib/features/team-chat/components/MessageItem.js.map +1 -0
- package/lib/features/team-chat/components/MessageList.js +248 -0
- package/lib/features/team-chat/components/MessageList.js.map +1 -0
- package/lib/features/team-chat/components/Mrkdwn.js +228 -0
- package/lib/features/team-chat/components/Mrkdwn.js.map +1 -0
- package/lib/features/team-chat/components/QuickSwitcher.js +215 -0
- package/lib/features/team-chat/components/QuickSwitcher.js.map +1 -0
- package/lib/features/team-chat/components/ui.js +662 -0
- package/lib/features/team-chat/components/ui.js.map +1 -0
- package/lib/features/team-chat/nativeTeamChatRegistry.js +15 -0
- package/lib/features/team-chat/nativeTeamChatRegistry.js.map +1 -0
- package/lib/features/team-chat/state/fetched.js +39 -0
- package/lib/features/team-chat/state/fetched.js.map +1 -0
- package/lib/features/team-chat/state/lists.js +230 -0
- package/lib/features/team-chat/state/lists.js.map +1 -0
- package/lib/features/team-chat/state/store.js +1108 -0
- package/lib/features/team-chat/state/store.js.map +1 -0
- package/lib/features/team-chat/state/useChannelDirectory.js +21 -0
- package/lib/features/team-chat/state/useChannelDirectory.js.map +1 -0
- package/lib/features/team-chat/theme.js +77 -0
- package/lib/features/team-chat/theme.js.map +1 -0
- package/lib/features/team-chat/utils/composeText.js +72 -0
- package/lib/features/team-chat/utils/composeText.js.map +1 -0
- package/lib/features/team-chat/utils/emoji.js +369 -0
- package/lib/features/team-chat/utils/emoji.js.map +1 -0
- package/lib/features/team-chat/utils/format.js +109 -0
- package/lib/features/team-chat/utils/format.js.map +1 -0
- package/lib/features/team-chat/utils/messageRows.js +24 -0
- package/lib/features/team-chat/utils/messageRows.js.map +1 -0
- package/lib/features/team-chat/utils/mrkdwn.js +222 -0
- package/lib/features/team-chat/utils/mrkdwn.js.map +1 -0
- package/lib/features/team-chat/utils/notify.js +47 -0
- package/lib/features/team-chat/utils/notify.js.map +1 -0
- package/lib/features/team-chat/utils/pickFiles.js +81 -0
- package/lib/features/team-chat/utils/pickFiles.js.map +1 -0
- package/lib/features/team-chat/views/ActivityView.js +235 -0
- package/lib/features/team-chat/views/ActivityView.js.map +1 -0
- package/lib/features/team-chat/views/BrowseView.js +179 -0
- package/lib/features/team-chat/views/BrowseView.js.map +1 -0
- package/lib/features/team-chat/views/ChannelView.js +475 -0
- package/lib/features/team-chat/views/ChannelView.js.map +1 -0
- package/lib/features/team-chat/views/DetailsPane.js +816 -0
- package/lib/features/team-chat/views/DetailsPane.js.map +1 -0
- package/lib/features/team-chat/views/DraftsView.js +212 -0
- package/lib/features/team-chat/views/DraftsView.js.map +1 -0
- package/lib/features/team-chat/views/FilesView.js +152 -0
- package/lib/features/team-chat/views/FilesView.js.map +1 -0
- package/lib/features/team-chat/views/NewMessageView.js +286 -0
- package/lib/features/team-chat/views/NewMessageView.js.map +1 -0
- package/lib/features/team-chat/views/PeopleView.js +118 -0
- package/lib/features/team-chat/views/PeopleView.js.map +1 -0
- package/lib/features/team-chat/views/ProfilePane.js +220 -0
- package/lib/features/team-chat/views/ProfilePane.js.map +1 -0
- package/lib/features/team-chat/views/SavedView.js +113 -0
- package/lib/features/team-chat/views/SavedView.js.map +1 -0
- package/lib/features/team-chat/views/SearchView.js +307 -0
- package/lib/features/team-chat/views/SearchView.js.map +1 -0
- package/lib/features/team-chat/views/Sidebar.js +368 -0
- package/lib/features/team-chat/views/Sidebar.js.map +1 -0
- package/lib/features/team-chat/views/ThreadPane.js +139 -0
- package/lib/features/team-chat/views/ThreadPane.js.map +1 -0
- package/lib/features/team-chat/views/ThreadsView.js +157 -0
- package/lib/features/team-chat/views/ThreadsView.js.map +1 -0
- package/lib/features/webbuilder/WebBuilderExperience.js +276 -42
- package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -1
- package/lib/features/webbuilder/buildFragments.js +10 -4
- package/lib/features/webbuilder/buildFragments.js.map +1 -1
- package/lib/features/webbuilder/components/AssetChips.js +61 -0
- package/lib/features/webbuilder/components/AssetChips.js.map +1 -0
- package/lib/features/webbuilder/components/AssetSiteChooser.js +100 -0
- package/lib/features/webbuilder/components/AssetSiteChooser.js.map +1 -0
- package/lib/features/webbuilder/components/CommentsLayer.js +485 -0
- package/lib/features/webbuilder/components/CommentsLayer.js.map +1 -0
- package/lib/features/webbuilder/components/Composer.js +16 -2
- package/lib/features/webbuilder/components/Composer.js.map +1 -1
- package/lib/features/webbuilder/components/ComposerModeSwitch.js +71 -0
- package/lib/features/webbuilder/components/ComposerModeSwitch.js.map +1 -0
- package/lib/features/webbuilder/components/MyAssetsPicker.js +500 -0
- package/lib/features/webbuilder/components/MyAssetsPicker.js.map +1 -0
- package/lib/features/webbuilder/components/PlanDocument.js +165 -0
- package/lib/features/webbuilder/components/PlanDocument.js.map +1 -0
- package/lib/features/webbuilder/components/PlanDraftCard.js +205 -0
- package/lib/features/webbuilder/components/PlanDraftCard.js.map +1 -0
- package/lib/features/webbuilder/components/PlanView.js +788 -0
- package/lib/features/webbuilder/components/PlanView.js.map +1 -0
- package/lib/features/webbuilder/components/PreviewConsoleSheet.js +334 -0
- package/lib/features/webbuilder/components/PreviewConsoleSheet.js.map +1 -0
- package/lib/features/webbuilder/components/PreviewFrame.js +45 -3
- package/lib/features/webbuilder/components/PreviewFrame.js.map +1 -1
- package/lib/features/webbuilder/components/PreviewScreen.js +94 -10
- package/lib/features/webbuilder/components/PreviewScreen.js.map +1 -1
- package/lib/features/webbuilder/components/ProjectChat.js +84 -14
- package/lib/features/webbuilder/components/ProjectChat.js.map +1 -1
- package/lib/features/webbuilder/components/StudioHome.js +69 -6
- package/lib/features/webbuilder/components/StudioHome.js.map +1 -1
- package/lib/features/webbuilder/components/StyleDirectionsSheet.js +291 -0
- package/lib/features/webbuilder/components/StyleDirectionsSheet.js.map +1 -0
- package/lib/features/webbuilder/components/VersionChangesView.js +574 -0
- package/lib/features/webbuilder/components/VersionChangesView.js.map +1 -0
- package/lib/features/webbuilder/components/VersionPreviewView.js +186 -0
- package/lib/features/webbuilder/components/VersionPreviewView.js.map +1 -0
- package/lib/features/webbuilder/components/VersionsSheet.js +673 -16
- package/lib/features/webbuilder/components/VersionsSheet.js.map +1 -1
- package/lib/features/webbuilder/connectorTemplates.js +6 -1
- package/lib/features/webbuilder/connectorTemplates.js.map +1 -1
- package/lib/features/webbuilder/myAssets.js +101 -0
- package/lib/features/webbuilder/myAssets.js.map +1 -0
- package/lib/features/webbuilder/planChat.js +146 -0
- package/lib/features/webbuilder/planChat.js.map +1 -0
- package/lib/features/webbuilder/planDocument.js +89 -0
- package/lib/features/webbuilder/planDocument.js.map +1 -0
- package/lib/features/webbuilder/planStore.js +55 -0
- package/lib/features/webbuilder/planStore.js.map +1 -0
- package/lib/features/webbuilder/previewCommentsScript.js +218 -0
- package/lib/features/webbuilder/previewCommentsScript.js.map +1 -0
- package/lib/features/webbuilder/previewConsoleScript.js +39 -0
- package/lib/features/webbuilder/previewConsoleScript.js.map +1 -0
- package/lib/features/webbuilder/styleDirections.js +85 -0
- package/lib/features/webbuilder/styleDirections.js.map +1 -0
- package/lib/features/webbuilder/useCanvasComments.js +335 -0
- package/lib/features/webbuilder/useCanvasComments.js.map +1 -0
- package/lib/features/webbuilder/useCatalogTemplates.js +37 -0
- package/lib/features/webbuilder/useCatalogTemplates.js.map +1 -0
- package/lib/features/webbuilder/usePlanMode.js +145 -0
- package/lib/features/webbuilder/usePlanMode.js.map +1 -0
- package/lib/features/webbuilder/useStyleDirections.js +112 -0
- package/lib/features/webbuilder/useStyleDirections.js.map +1 -0
- package/lib/features/webbuilder/web/assets/assetsApi.js +174 -0
- package/lib/features/webbuilder/web/assets/assetsApi.js.map +1 -0
- package/lib/features/webbuilder/web/assets/assetsApi.ts +173 -0
- package/lib/features/webbuilder/web/assets/myAssets.js +341 -0
- package/lib/features/webbuilder/web/assets/myAssets.js.map +1 -0
- package/lib/features/webbuilder/web/assets/myAssets.ts +396 -0
- package/lib/features/webbuilder/web/canvas/elementName.js +46 -0
- package/lib/features/webbuilder/web/canvas/elementName.js.map +1 -0
- package/lib/features/webbuilder/web/canvas/visualEditorBridge.js +95 -0
- package/lib/features/webbuilder/web/canvas/visualEditorBridge.js.map +1 -0
- package/lib/features/webbuilder/web/chat/agentTurn.js +24 -0
- package/lib/features/webbuilder/web/chat/agentTurn.js.map +1 -0
- package/lib/features/webbuilder/web/chat/planMode.js +164 -0
- package/lib/features/webbuilder/web/chat/planMode.js.map +1 -0
- package/lib/features/webbuilder/web/chat/realPlans.js +66 -0
- package/lib/features/webbuilder/web/chat/realPlans.js.map +1 -0
- package/lib/features/webbuilder/web/comments/comments.js +336 -0
- package/lib/features/webbuilder/web/comments/comments.js.map +1 -0
- package/lib/features/webbuilder/web/comments/commentsApi.js +59 -0
- package/lib/features/webbuilder/web/comments/commentsApi.js.map +1 -0
- package/lib/features/webbuilder/web/components/planView.js +21 -0
- package/lib/features/webbuilder/web/components/planView.js.map +1 -0
- package/lib/features/webbuilder/web/console/consolePanel.js +43 -0
- package/lib/features/webbuilder/web/console/consolePanel.js.map +1 -0
- package/lib/features/webbuilder/web/console/previewConsole.js +256 -0
- package/lib/features/webbuilder/web/console/previewConsole.js.map +1 -0
- package/lib/features/webbuilder/web/console/usePreviewConsole.js +147 -0
- package/lib/features/webbuilder/web/console/usePreviewConsole.js.map +1 -0
- package/lib/features/webbuilder/web/design/directions.js +419 -1
- package/lib/features/webbuilder/web/design/directions.js.map +1 -1
- package/lib/features/webbuilder/web/history/diffActions.js +222 -0
- package/lib/features/webbuilder/web/history/diffActions.js.map +1 -0
- package/lib/features/webbuilder/web/history/diffHighlight.js +18 -0
- package/lib/features/webbuilder/web/history/diffHighlight.js.map +1 -0
- package/lib/features/webbuilder/web/history/versionActions.js +272 -0
- package/lib/features/webbuilder/web/history/versionActions.js.map +1 -0
- package/lib/features/webbuilder/web/history/versionDiff.js +338 -0
- package/lib/features/webbuilder/web/history/versionDiff.js.map +1 -0
- package/lib/features/webbuilder/web/history/versionPreview.js +83 -0
- package/lib/features/webbuilder/web/history/versionPreview.js.map +1 -0
- package/lib/features/webbuilder/web/history/versionPreviewMachine.js +150 -0
- package/lib/features/webbuilder/web/history/versionPreviewMachine.js.map +1 -0
- package/lib/features/webbuilder/web/history/versions.js +326 -1
- package/lib/features/webbuilder/web/history/versions.js.map +1 -1
- package/lib/features/webbuilder/web/hosted/hostedTurn.js +36 -0
- package/lib/features/webbuilder/web/hosted/hostedTurn.js.map +1 -0
- package/lib/features/webbuilder/web/studio/brandKit.js +25 -0
- package/lib/features/webbuilder/web/studio/brandKit.js.map +1 -0
- package/lib/features/webbuilder/web/utils/promptSafe.js +15 -0
- package/lib/features/webbuilder/web/utils/promptSafe.js.map +1 -0
- package/lib/features/webbuilder/web/webServices.js +3 -1
- package/lib/features/webbuilder/web/webServices.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/routes.json +55 -0
- package/lib/screens/Account/index.js +13 -5
- package/lib/screens/Account/index.js.map +1 -1
- package/lib/screens/Chat/index.js +16 -0
- package/lib/screens/Chat/index.js.map +1 -1
- package/lib/screens/Home/HomeScreen.js +202 -39
- package/lib/screens/Home/HomeScreen.js.map +1 -1
- package/lib/screens/Home/components/HomeHero.js +52 -38
- package/lib/screens/Home/components/HomeHero.js.map +1 -1
- package/lib/screens/Home/components/homeCatalog.js +8 -1
- package/lib/screens/Home/components/homeCatalog.js.map +1 -1
- package/lib/screens/TeamChat/index.js +41 -0
- package/lib/screens/TeamChat/index.js.map +1 -0
- package/lib/screens/WebBuilder/nativeWebBuilderRedirect.js +9 -2
- package/lib/screens/WebBuilder/nativeWebBuilderRedirect.js.map +1 -1
- package/lib/screens/WebBuilderNative/index.js +13 -3
- package/lib/screens/WebBuilderNative/index.js.map +1 -1
- package/lib/screens/WebBuilderNative/useConnectorTemplates.js +2 -2
- package/lib/screens/WebBuilderNative/useConnectorTemplates.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import {useRef,useState,useCallback,useEffect}from'react';import {AppState}from'react-native';import {ConsoleRing,entryFromBridge,SERVER_LOG_COMMAND,maskSecrets,readServerLogOutput,newLogLines,parseServerLines,SERVER_LOG_POLL_MS}from'./previewConsole.js';var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
function useAppActive() {
|
|
21
|
+
const [active, setActive] = useState(() => AppState.currentState !== "background");
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const sub = AppState.addEventListener("change", (state) => setActive(state === "active"));
|
|
24
|
+
return () => sub.remove();
|
|
25
|
+
}, []);
|
|
26
|
+
return active;
|
|
27
|
+
}
|
|
28
|
+
function usePreviewConsole(opts) {
|
|
29
|
+
const logs = useRef(/* @__PURE__ */ new Map());
|
|
30
|
+
const [, setVersion] = useState(0);
|
|
31
|
+
const bump = useCallback(() => setVersion((n) => n + 1), []);
|
|
32
|
+
const logFor = useCallback((key) => {
|
|
33
|
+
let log = logs.current.get(key);
|
|
34
|
+
if (!log) {
|
|
35
|
+
log = {
|
|
36
|
+
ring: new ConsoleRing(),
|
|
37
|
+
prevLines: []
|
|
38
|
+
};
|
|
39
|
+
logs.current.set(key, log);
|
|
40
|
+
}
|
|
41
|
+
return log;
|
|
42
|
+
}, []);
|
|
43
|
+
const {
|
|
44
|
+
buildKey
|
|
45
|
+
} = opts;
|
|
46
|
+
const buildKeyRef = useRef(buildKey);
|
|
47
|
+
buildKeyRef.current = buildKey;
|
|
48
|
+
const addBridgeMessage = useCallback((msg) => {
|
|
49
|
+
const entry = entryFromBridge(msg, Date.now());
|
|
50
|
+
if (!entry) return;
|
|
51
|
+
logFor(buildKeyRef.current).ring.push(entry);
|
|
52
|
+
bump();
|
|
53
|
+
}, [bump, logFor]);
|
|
54
|
+
const clear = useCallback(() => {
|
|
55
|
+
logFor(buildKeyRef.current).ring.clear();
|
|
56
|
+
bump();
|
|
57
|
+
}, [bump, logFor]);
|
|
58
|
+
const [server, setServer] = useState({
|
|
59
|
+
state: "off",
|
|
60
|
+
path: null
|
|
61
|
+
});
|
|
62
|
+
const visible = useAppActive();
|
|
63
|
+
const runRef = useRef(opts.run);
|
|
64
|
+
runRef.current = opts.run;
|
|
65
|
+
const sandboxId = String(opts.sandboxId || "").trim();
|
|
66
|
+
const polling = Boolean(opts.run) && Boolean(sandboxId) && opts.live && opts.open && visible;
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (!polling) {
|
|
69
|
+
setServer((s) => s.state === "off" ? s : __spreadProps(__spreadValues({}, s), {
|
|
70
|
+
state: "off"
|
|
71
|
+
}));
|
|
72
|
+
return void 0;
|
|
73
|
+
}
|
|
74
|
+
let alive = true;
|
|
75
|
+
let timer;
|
|
76
|
+
const key = buildKey;
|
|
77
|
+
setServer((s) => s.state === "ok" ? s : {
|
|
78
|
+
state: "loading",
|
|
79
|
+
path: s.path
|
|
80
|
+
});
|
|
81
|
+
const tick = async () => {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
const run = runRef.current;
|
|
84
|
+
if (!run) return;
|
|
85
|
+
try {
|
|
86
|
+
const r = await run("WEBBUILDER_RUN_COMMAND", {
|
|
87
|
+
sandbox_id: sandboxId,
|
|
88
|
+
command: SERVER_LOG_COMMAND,
|
|
89
|
+
timeoutMs: 15e3
|
|
90
|
+
}, {
|
|
91
|
+
timeoutMs: 3e4
|
|
92
|
+
});
|
|
93
|
+
if (!alive) return;
|
|
94
|
+
if (!r.successful) {
|
|
95
|
+
setServer((s) => ({
|
|
96
|
+
state: "error",
|
|
97
|
+
path: s.path,
|
|
98
|
+
error: maskSecrets(r.error || "The server log could not be read.").slice(0, 300)
|
|
99
|
+
}));
|
|
100
|
+
} else {
|
|
101
|
+
const read = readServerLogOutput(String((_b = (_a = r.data) == null ? void 0 : _a.stdout) != null ? _b : ""));
|
|
102
|
+
const log = logFor(key);
|
|
103
|
+
const fresh = newLogLines(log.prevLines, read.lines);
|
|
104
|
+
log.prevLines = read.lines;
|
|
105
|
+
if (fresh.length) {
|
|
106
|
+
log.ring.push(...parseServerLines(fresh, Date.now()));
|
|
107
|
+
bump();
|
|
108
|
+
}
|
|
109
|
+
setServer({
|
|
110
|
+
state: read.path ? "ok" : "none",
|
|
111
|
+
path: read.path,
|
|
112
|
+
updatedAt: Date.now()
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
} catch (err) {
|
|
116
|
+
if (!alive) return;
|
|
117
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
118
|
+
setServer((s) => ({
|
|
119
|
+
state: "error",
|
|
120
|
+
path: s.path,
|
|
121
|
+
error: maskSecrets(message).slice(0, 300)
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
if (alive) timer = setTimeout(() => tick().catch(() => void 0), SERVER_LOG_POLL_MS);
|
|
125
|
+
};
|
|
126
|
+
tick().catch(() => void 0);
|
|
127
|
+
return () => {
|
|
128
|
+
alive = false;
|
|
129
|
+
if (timer) clearTimeout(timer);
|
|
130
|
+
};
|
|
131
|
+
}, [polling, buildKey, sandboxId, logFor, bump]);
|
|
132
|
+
const {
|
|
133
|
+
ring
|
|
134
|
+
} = logFor(buildKey);
|
|
135
|
+
const entries = ring.entries();
|
|
136
|
+
let errorCount = 0;
|
|
137
|
+
entries.forEach((e) => {
|
|
138
|
+
if (e.level === "error") errorCount += 1;
|
|
139
|
+
});
|
|
140
|
+
return {
|
|
141
|
+
entries,
|
|
142
|
+
errorCount,
|
|
143
|
+
addBridgeMessage,
|
|
144
|
+
clear,
|
|
145
|
+
server
|
|
146
|
+
};
|
|
147
|
+
}export{usePreviewConsole};//# sourceMappingURL=usePreviewConsole.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePreviewConsole.js","sources":["../../../../../src/features/webbuilder/web/console/usePreviewConsole.ts"],"sourcesContent":["/**\n * The preview console's state: one buffer per build (the page's errors from the bridge and the\n * dev-server log), and the server log polled with WEBBUILDER_RUN_COMMAND while the console shows.\n * Web `console/usePreviewConsole.ts` (0.20.20); the page's visibility is the app's (AppState) here.\n *\n * Sandbox lease: every command renews the sandbox's lease, so the log is read only while the console is\n * open, the preview is up (`live`: never a sleeping sandbox) and the app is in front - as on the web.\n */\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { AppState } from 'react-native';\nimport type { BridgeInbound } from '../canvas/visualEditorBridge';\nimport type { RunSandboxAction } from '../history/versionActions';\nimport {\n ConsoleRing,\n SERVER_LOG_COMMAND,\n SERVER_LOG_POLL_MS,\n entryFromBridge,\n maskSecrets,\n newLogLines,\n parseServerLines,\n readServerLogOutput,\n type ConsoleEntry,\n} from './previewConsole';\n\nexport interface ServerLogStatus {\n state: 'off' | 'loading' | 'ok' | 'none' | 'error';\n path: string | null;\n error?: string;\n updatedAt?: number;\n}\n\nexport interface PreviewConsole {\n entries: readonly ConsoleEntry[];\n errorCount: number;\n addBridgeMessage: (msg: BridgeInbound) => void;\n clear: () => void;\n server: ServerLogStatus;\n}\n\ninterface BuildLog {\n ring: ConsoleRing;\n prevLines: string[];\n}\n\nfunction useAppActive(): boolean {\n const [active, setActive] = useState(() => AppState.currentState !== 'background');\n useEffect(() => {\n const sub = AppState.addEventListener('change', (state) => setActive(state === 'active'));\n return () => sub.remove();\n }, []);\n return active;\n}\n\nexport function usePreviewConsole(opts: {\n /** One buffer per build. */\n buildKey: string;\n /** Sandbox access (RUN_COMMAND); absent -> browser entries only. */\n run?: RunSandboxAction;\n sandboxId?: string | null;\n /** The preview is up. */\n live: boolean;\n /** The console is showing: the server log is polled only then. */\n open: boolean;\n}): PreviewConsole {\n const logs = useRef(new Map<string, BuildLog>());\n const [, setVersion] = useState(0);\n const bump = useCallback(() => setVersion((n) => n + 1), []);\n const logFor = useCallback((key: string): BuildLog => {\n let log = logs.current.get(key);\n if (!log) {\n log = { ring: new ConsoleRing(), prevLines: [] };\n logs.current.set(key, log);\n }\n return log;\n }, []);\n const { buildKey } = opts;\n const buildKeyRef = useRef(buildKey);\n buildKeyRef.current = buildKey;\n\n const addBridgeMessage = useCallback(\n (msg: BridgeInbound) => {\n const entry = entryFromBridge(msg, Date.now());\n if (!entry) return;\n logFor(buildKeyRef.current).ring.push(entry);\n bump();\n },\n [bump, logFor],\n );\n const clear = useCallback(() => {\n logFor(buildKeyRef.current).ring.clear();\n bump();\n }, [bump, logFor]);\n\n const [server, setServer] = useState<ServerLogStatus>({ state: 'off', path: null });\n const visible = useAppActive();\n const runRef = useRef(opts.run);\n runRef.current = opts.run;\n const sandboxId = String(opts.sandboxId || '').trim();\n const polling = Boolean(opts.run) && Boolean(sandboxId) && opts.live && opts.open && visible;\n\n useEffect(() => {\n if (!polling) {\n setServer((s) => (s.state === 'off' ? s : { ...s, state: 'off' }));\n return undefined;\n }\n let alive = true;\n let timer: ReturnType<typeof setTimeout> | undefined;\n const key = buildKey;\n setServer((s) => (s.state === 'ok' ? s : { state: 'loading', path: s.path }));\n const tick = async () => {\n const run = runRef.current;\n if (!run) return;\n try {\n const r = await run(\n 'WEBBUILDER_RUN_COMMAND',\n { sandbox_id: sandboxId, command: SERVER_LOG_COMMAND, timeoutMs: 15_000 },\n { timeoutMs: 30_000 },\n );\n if (!alive) return;\n if (!r.successful) {\n setServer((s) => ({\n state: 'error',\n path: s.path,\n error: maskSecrets(r.error || 'The server log could not be read.').slice(0, 300),\n }));\n } else {\n const read = readServerLogOutput(String(r.data?.stdout ?? ''));\n const log = logFor(key);\n const fresh = newLogLines(log.prevLines, read.lines);\n log.prevLines = read.lines;\n if (fresh.length) {\n log.ring.push(...parseServerLines(fresh, Date.now()));\n bump();\n }\n setServer({ state: read.path ? 'ok' : 'none', path: read.path, updatedAt: Date.now() });\n }\n } catch (err) {\n if (!alive) return;\n const message = err instanceof Error ? err.message : String(err);\n setServer((s) => ({ state: 'error', path: s.path, error: maskSecrets(message).slice(0, 300) }));\n }\n if (alive) timer = setTimeout(() => tick().catch(() => undefined), SERVER_LOG_POLL_MS);\n };\n tick().catch(() => undefined);\n return () => {\n alive = false;\n if (timer) clearTimeout(timer);\n };\n }, [polling, buildKey, sandboxId, logFor, bump]);\n\n const { ring } = logFor(buildKey);\n const entries = ring.entries();\n let errorCount = 0;\n entries.forEach((e) => {\n if (e.level === 'error') errorCount += 1;\n });\n return { entries, errorCount, addBridgeMessage, clear, server };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AA8BA,SAAS,YAAwB,GAAA;AAC/B,EAAM,MAAA,CAAC,QAAQ,SAAS,CAAA,GAAI,SAAS,MAAM,QAAA,CAAS,iBAAiB,YAAY,CAAA;AACjF,EAAA,SAAA,CAAU,MAAM;AACd,IAAM,MAAA,GAAA,GAAM,SAAS,gBAAiB,CAAA,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K,CAAA,KAAA;AACnB,IAAI,IAAA,CAAA,CAAE,KAAU,KAAA,OAAA,EAAuB,UAAA,IAAA,CAAA;AAAA,GACxC,CAAA;AACD,EAAO,OAAA;AAAA,IACL,OAAA;AAAA,IACA,UAAA;AAAA,IACA,gBAAA;AAAA,IACA,KAAA;AAAA,IACA;AAAA,GACF;AACF"}
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1
20
|
const PALETTE_ROLES = ["background", "surface", "text", "muted", "primary", "accent"];
|
|
2
21
|
const RADIUS_STYLES = ["none", "sm", "md", "lg", "full"];
|
|
3
22
|
const DENSITY_STYLES = ["compact", "comfortable", "airy"];
|
|
@@ -262,6 +281,9 @@ function ensureContrastOn(color, backgrounds, min = AA_CONTRAST) {
|
|
|
262
281
|
}
|
|
263
282
|
return worst("#000000") >= worst("#ffffff") ? "#000000" : "#ffffff";
|
|
264
283
|
}
|
|
284
|
+
function onColor(bg) {
|
|
285
|
+
return contrastRatio("#ffffff", bg) >= contrastRatio("#000000", bg) ? "#ffffff" : "#000000";
|
|
286
|
+
}
|
|
265
287
|
const isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
266
288
|
function cleanLine(v, max) {
|
|
267
289
|
if (typeof v !== "string") return "";
|
|
@@ -340,4 +362,400 @@ function validateDirection(raw) {
|
|
|
340
362
|
function toDesignDirection(raw) {
|
|
341
363
|
const r = validateDirection(raw);
|
|
342
364
|
return r.ok ? r.direction : null;
|
|
343
|
-
}
|
|
365
|
+
}
|
|
366
|
+
const CURATED_DIRECTIONS = [{
|
|
367
|
+
id: "quiet-minimal",
|
|
368
|
+
name: "Quiet Minimal",
|
|
369
|
+
mood: "Calm, precise and spacious - lots of white space and confident type.",
|
|
370
|
+
palette: {
|
|
371
|
+
background: "#ffffff",
|
|
372
|
+
surface: "#f5f5f4",
|
|
373
|
+
text: "#1c1917",
|
|
374
|
+
muted: "#57534e",
|
|
375
|
+
primary: "#1c1917",
|
|
376
|
+
accent: "#a8a29e"
|
|
377
|
+
},
|
|
378
|
+
fonts: {
|
|
379
|
+
heading: "Manrope",
|
|
380
|
+
body: "Inter"
|
|
381
|
+
},
|
|
382
|
+
radius: "sm",
|
|
383
|
+
density: "airy",
|
|
384
|
+
imagery: "minimal",
|
|
385
|
+
keywords: ["minimal", "clean", "simple", "portfolio", "architect", "architecture", "studio", "photographer", "photography", "designer", "resume", "cv"]
|
|
386
|
+
}, {
|
|
387
|
+
id: "golden-hour",
|
|
388
|
+
name: "Golden Hour",
|
|
389
|
+
mood: "Warm and welcoming, like late-afternoon light in a neighbourhood cafe.",
|
|
390
|
+
palette: {
|
|
391
|
+
background: "#fdf6ec",
|
|
392
|
+
surface: "#f6e7d3",
|
|
393
|
+
text: "#3b2a1e",
|
|
394
|
+
muted: "#6b5444",
|
|
395
|
+
primary: "#c2410c",
|
|
396
|
+
accent: "#e9a23b"
|
|
397
|
+
},
|
|
398
|
+
fonts: {
|
|
399
|
+
heading: "Fraunces",
|
|
400
|
+
body: "Nunito Sans"
|
|
401
|
+
},
|
|
402
|
+
radius: "lg",
|
|
403
|
+
density: "comfortable",
|
|
404
|
+
imagery: "photo",
|
|
405
|
+
keywords: ["bakery", "cafe", "coffee", "restaurant", "food", "recipe", "recipes", "kitchen", "family", "home", "wedding", "bnb", "catering", "warm"]
|
|
406
|
+
}, {
|
|
407
|
+
id: "loud-and-clear",
|
|
408
|
+
name: "Loud & Clear",
|
|
409
|
+
mood: "High-energy and bold - big type, hard edges, strong contrast.",
|
|
410
|
+
palette: {
|
|
411
|
+
background: "#0a0a0a",
|
|
412
|
+
surface: "#1a1a1a",
|
|
413
|
+
text: "#fafafa",
|
|
414
|
+
muted: "#a3a3a3",
|
|
415
|
+
primary: "#facc15",
|
|
416
|
+
accent: "#ef4444"
|
|
417
|
+
},
|
|
418
|
+
fonts: {
|
|
419
|
+
heading: "Archivo Black",
|
|
420
|
+
body: "Archivo"
|
|
421
|
+
},
|
|
422
|
+
radius: "none",
|
|
423
|
+
density: "compact",
|
|
424
|
+
imagery: "geometric",
|
|
425
|
+
keywords: ["fitness", "gym", "sport", "sports", "event", "festival", "music", "band", "launch", "streetwear", "bold", "conference", "marathon"]
|
|
426
|
+
}, {
|
|
427
|
+
id: "broadsheet",
|
|
428
|
+
name: "Broadsheet",
|
|
429
|
+
mood: "Editorial and literate - classic serif headlines with a newspaper rhythm.",
|
|
430
|
+
palette: {
|
|
431
|
+
background: "#fbfaf7",
|
|
432
|
+
surface: "#f0ede6",
|
|
433
|
+
text: "#111111",
|
|
434
|
+
muted: "#555048",
|
|
435
|
+
primary: "#9f1239",
|
|
436
|
+
accent: "#1e3a8a"
|
|
437
|
+
},
|
|
438
|
+
fonts: {
|
|
439
|
+
heading: "Playfair Display",
|
|
440
|
+
body: "Libre Franklin"
|
|
441
|
+
},
|
|
442
|
+
radius: "none",
|
|
443
|
+
density: "comfortable",
|
|
444
|
+
imagery: "photo",
|
|
445
|
+
keywords: ["blog", "magazine", "news", "journal", "writer", "writing", "book", "books", "author", "publication", "newsletter", "podcast", "editorial", "essay"]
|
|
446
|
+
}, {
|
|
447
|
+
id: "candy-pop",
|
|
448
|
+
name: "Candy Pop",
|
|
449
|
+
mood: "Playful and friendly - round shapes, bright color and a wink of fun.",
|
|
450
|
+
palette: {
|
|
451
|
+
background: "#fff7fb",
|
|
452
|
+
surface: "#ffe4f1",
|
|
453
|
+
text: "#2e1065",
|
|
454
|
+
muted: "#5b4a7a",
|
|
455
|
+
primary: "#db2777",
|
|
456
|
+
accent: "#22c55e"
|
|
457
|
+
},
|
|
458
|
+
fonts: {
|
|
459
|
+
heading: "Fredoka",
|
|
460
|
+
body: "Nunito"
|
|
461
|
+
},
|
|
462
|
+
radius: "full",
|
|
463
|
+
density: "comfortable",
|
|
464
|
+
imagery: "illustration",
|
|
465
|
+
keywords: ["kids", "children", "child", "game", "games", "toy", "toys", "party", "pet", "pets", "school", "fun", "candy", "ice", "playful", "daycare"]
|
|
466
|
+
}, {
|
|
467
|
+
id: "noir-gold",
|
|
468
|
+
name: "Noir & Gold",
|
|
469
|
+
mood: "Luxurious and refined - deep darks, gold accents and elegant serifs.",
|
|
470
|
+
palette: {
|
|
471
|
+
background: "#0f0e0c",
|
|
472
|
+
surface: "#1c1a16",
|
|
473
|
+
text: "#f5f0e6",
|
|
474
|
+
muted: "#b5ab98",
|
|
475
|
+
primary: "#c9a227",
|
|
476
|
+
accent: "#8c6d1f"
|
|
477
|
+
},
|
|
478
|
+
fonts: {
|
|
479
|
+
heading: "Cormorant Garamond",
|
|
480
|
+
body: "Montserrat"
|
|
481
|
+
},
|
|
482
|
+
radius: "none",
|
|
483
|
+
density: "airy",
|
|
484
|
+
imagery: "photo",
|
|
485
|
+
keywords: ["luxury", "jewelry", "jewellery", "fashion", "hotel", "wine", "watch", "watches", "premium", "boutique", "estate", "perfume", "cocktail", "elegant"]
|
|
486
|
+
}, {
|
|
487
|
+
id: "terminal-grid",
|
|
488
|
+
name: "Terminal Grid",
|
|
489
|
+
mood: "Technical and sharp - dark UI, crisp grids and a hint of neon.",
|
|
490
|
+
palette: {
|
|
491
|
+
background: "#0b1020",
|
|
492
|
+
surface: "#131a2e",
|
|
493
|
+
text: "#e2e8f0",
|
|
494
|
+
muted: "#94a3b8",
|
|
495
|
+
primary: "#22d3ee",
|
|
496
|
+
accent: "#a78bfa"
|
|
497
|
+
},
|
|
498
|
+
fonts: {
|
|
499
|
+
heading: "Space Grotesk",
|
|
500
|
+
body: "IBM Plex Sans"
|
|
501
|
+
},
|
|
502
|
+
radius: "md",
|
|
503
|
+
density: "compact",
|
|
504
|
+
imagery: "gradient",
|
|
505
|
+
keywords: ["saas", "ai", "developer", "developers", "api", "crypto", "dashboard", "tech", "software", "analytics", "data", "devtools", "cloud", "startup"]
|
|
506
|
+
}, {
|
|
507
|
+
id: "field-and-fern",
|
|
508
|
+
name: "Field & Fern",
|
|
509
|
+
mood: "Organic and grounded - earthy greens, natural textures, unhurried.",
|
|
510
|
+
palette: {
|
|
511
|
+
background: "#f4f1ea",
|
|
512
|
+
surface: "#e6e2d3",
|
|
513
|
+
text: "#23301f",
|
|
514
|
+
muted: "#4f5b48",
|
|
515
|
+
primary: "#3f6212",
|
|
516
|
+
accent: "#b45309"
|
|
517
|
+
},
|
|
518
|
+
fonts: {
|
|
519
|
+
heading: "DM Serif Display",
|
|
520
|
+
body: "Karla"
|
|
521
|
+
},
|
|
522
|
+
radius: "lg",
|
|
523
|
+
density: "airy",
|
|
524
|
+
imagery: "texture",
|
|
525
|
+
keywords: ["garden", "gardening", "farm", "organic", "eco", "plant", "plants", "nature", "sustainable", "outdoor", "florist", "flowers", "hiking", "camping"]
|
|
526
|
+
}, {
|
|
527
|
+
id: "clear-blue",
|
|
528
|
+
name: "Clear Blue",
|
|
529
|
+
mood: "Trustworthy and professional - clean layout, confident blue, no noise.",
|
|
530
|
+
palette: {
|
|
531
|
+
background: "#ffffff",
|
|
532
|
+
surface: "#f1f5f9",
|
|
533
|
+
text: "#0f172a",
|
|
534
|
+
muted: "#475569",
|
|
535
|
+
primary: "#2563eb",
|
|
536
|
+
accent: "#0ea5e9"
|
|
537
|
+
},
|
|
538
|
+
fonts: {
|
|
539
|
+
heading: "Plus Jakarta Sans",
|
|
540
|
+
body: "Inter"
|
|
541
|
+
},
|
|
542
|
+
radius: "md",
|
|
543
|
+
density: "comfortable",
|
|
544
|
+
imagery: "photo",
|
|
545
|
+
keywords: ["consulting", "consultant", "finance", "law", "lawyer", "legal", "clinic", "medical", "dentist", "insurance", "bank", "accounting", "business", "agency", "corporate"]
|
|
546
|
+
}, {
|
|
547
|
+
id: "sunset-diner",
|
|
548
|
+
name: "Sunset Diner",
|
|
549
|
+
mood: "Retro and characterful - chunky display type and sun-faded color.",
|
|
550
|
+
palette: {
|
|
551
|
+
background: "#fff4e0",
|
|
552
|
+
surface: "#ffe3b3",
|
|
553
|
+
text: "#3d1f0f",
|
|
554
|
+
muted: "#6e4630",
|
|
555
|
+
primary: "#c2410c",
|
|
556
|
+
accent: "#0b7285"
|
|
557
|
+
},
|
|
558
|
+
fonts: {
|
|
559
|
+
heading: "Abril Fatface",
|
|
560
|
+
body: "Work Sans"
|
|
561
|
+
},
|
|
562
|
+
radius: "md",
|
|
563
|
+
density: "comfortable",
|
|
564
|
+
imagery: "illustration",
|
|
565
|
+
keywords: ["diner", "retro", "vintage", "barber", "records", "vinyl", "brewery", "beer", "burger", "pizza", "taco", "food truck", "arcade"]
|
|
566
|
+
}, {
|
|
567
|
+
id: "soft-sage",
|
|
568
|
+
name: "Soft Sage",
|
|
569
|
+
mood: "Calm and restorative - muted sage, gentle serif headings, room to breathe.",
|
|
570
|
+
palette: {
|
|
571
|
+
background: "#f6f8f5",
|
|
572
|
+
surface: "#e7eee6",
|
|
573
|
+
text: "#1f2d27",
|
|
574
|
+
muted: "#4d5f56",
|
|
575
|
+
primary: "#3f6b5c",
|
|
576
|
+
accent: "#d4a373"
|
|
577
|
+
},
|
|
578
|
+
fonts: {
|
|
579
|
+
heading: "Lora",
|
|
580
|
+
body: "Mulish"
|
|
581
|
+
},
|
|
582
|
+
radius: "lg",
|
|
583
|
+
density: "airy",
|
|
584
|
+
imagery: "photo",
|
|
585
|
+
keywords: ["wellness", "yoga", "spa", "therapy", "therapist", "meditation", "health", "coach", "coaching", "skincare", "massage", "mindfulness", "calm"]
|
|
586
|
+
}, {
|
|
587
|
+
id: "neon-night",
|
|
588
|
+
name: "Neon Night",
|
|
589
|
+
mood: "Futuristic and electric - deep night tones lit by violet and pink glows.",
|
|
590
|
+
palette: {
|
|
591
|
+
background: "#09090f",
|
|
592
|
+
surface: "#15152a",
|
|
593
|
+
text: "#f4f4ff",
|
|
594
|
+
muted: "#a1a1c2",
|
|
595
|
+
primary: "#8b5cf6",
|
|
596
|
+
accent: "#ec4899"
|
|
597
|
+
},
|
|
598
|
+
fonts: {
|
|
599
|
+
heading: "Sora",
|
|
600
|
+
body: "Outfit"
|
|
601
|
+
},
|
|
602
|
+
radius: "lg",
|
|
603
|
+
density: "comfortable",
|
|
604
|
+
imagery: "gradient",
|
|
605
|
+
keywords: ["gaming", "gamer", "nightclub", "club", "esports", "nft", "web3", "dj", "synth", "futuristic", "nightlife", "vr"]
|
|
606
|
+
}];
|
|
607
|
+
const DEFAULT_ORDER = ["quiet-minimal", "golden-hour", "terminal-grid", "broadsheet", "candy-pop", "noir-gold", "field-and-fern", "loud-and-clear", "clear-blue", "soft-sage", "neon-night", "sunset-diner"];
|
|
608
|
+
function keywordScore(d, brief) {
|
|
609
|
+
let score = 0;
|
|
610
|
+
for (const k of d.keywords) {
|
|
611
|
+
const re = new RegExp(`\\b${k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}s?\\b`, "i");
|
|
612
|
+
if (re.test(brief)) score += 1;
|
|
613
|
+
}
|
|
614
|
+
return score;
|
|
615
|
+
}
|
|
616
|
+
function rankDirectionsForBrief(brief) {
|
|
617
|
+
const text = String(brief != null ? brief : "");
|
|
618
|
+
const order = new Map(DEFAULT_ORDER.map((id, i) => [id, i]));
|
|
619
|
+
return [...CURATED_DIRECTIONS].map((d) => ({
|
|
620
|
+
d,
|
|
621
|
+
score: keywordScore(d, text)
|
|
622
|
+
})).sort((a, b) => {
|
|
623
|
+
var _a, _b;
|
|
624
|
+
return b.score - a.score || ((_a = order.get(a.d.id)) != null ? _a : 99) - ((_b = order.get(b.d.id)) != null ? _b : 99);
|
|
625
|
+
}).map((x) => x.d);
|
|
626
|
+
}
|
|
627
|
+
function asDirection(d) {
|
|
628
|
+
const {
|
|
629
|
+
id,
|
|
630
|
+
name,
|
|
631
|
+
mood,
|
|
632
|
+
palette,
|
|
633
|
+
fonts,
|
|
634
|
+
radius,
|
|
635
|
+
density,
|
|
636
|
+
imagery
|
|
637
|
+
} = d;
|
|
638
|
+
return {
|
|
639
|
+
id,
|
|
640
|
+
name,
|
|
641
|
+
mood,
|
|
642
|
+
palette: __spreadValues({}, palette),
|
|
643
|
+
fonts: __spreadValues({}, fonts),
|
|
644
|
+
radius,
|
|
645
|
+
density,
|
|
646
|
+
imagery
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
function pickDirectionsForBrief(brief, exclude = []) {
|
|
650
|
+
const ranked = rankDirectionsForBrief(brief);
|
|
651
|
+
const skip = new Set(exclude);
|
|
652
|
+
const fresh = ranked.filter((d) => !skip.has(d.id));
|
|
653
|
+
const pool = fresh.length >= 3 ? fresh : [...fresh, ...ranked.filter((d) => skip.has(d.id))];
|
|
654
|
+
return pool.slice(0, 3).map(asDirection);
|
|
655
|
+
}
|
|
656
|
+
const DIRECTIONS_SESSION_KEY = "webbuilder-design-directions";
|
|
657
|
+
const DIRECTIONS_TIMEOUT_MS = 12e3;
|
|
658
|
+
function directionsSessionKey(channelId) {
|
|
659
|
+
const id = String(channelId != null ? channelId : "").trim().replace(/[^A-Za-z0-9_-]/g, "").slice(0, 80);
|
|
660
|
+
return id ? `${DIRECTIONS_SESSION_KEY}-${id}` : DIRECTIONS_SESSION_KEY;
|
|
661
|
+
}
|
|
662
|
+
function buildDirectionsPrompt(brief) {
|
|
663
|
+
return ["You are an art director proposing visual style directions for a website BEFORE it is built.", "Do NOT write code, do NOT build anything, do NOT ask questions, do NOT call any tool or connector.", "Propose exactly 3 clearly DIFFERENT directions that fit the request below.", "Reply with ONLY one JSON object, no prose and no code fence, in exactly this shape:", '{"directions":[{"name":"2-3 words","mood":"one sentence, max 140 characters","palette":{"background":"#rrggbb","surface":"#rrggbb","text":"#rrggbb","muted":"#rrggbb","primary":"#rrggbb","accent":"#rrggbb"},"fonts":{"heading":"<font>","body":"<font>"},"radius":"<radius>","density":"<density>","imagery":"<imagery>"}]}', `Fonts must be exact names from this list: ${Object.keys(GOOGLE_FONTS).join(", ")}.`, `radius: one of ${RADIUS_STYLES.join(", ")}. density: one of ${DENSITY_STYLES.join(", ")}. imagery: one of ${IMAGERY_STYLES.join(", ")}.`, "The text and muted colours must have at least 4.5:1 contrast on both the background and the surface. Links use the text colour with an underline; primary is a button fill.", "", `Website request:
|
|
664
|
+
${String(brief != null ? brief : "").trim().slice(0, 2e3)}`].join("\n");
|
|
665
|
+
}
|
|
666
|
+
function parseDirectionsReply(reply) {
|
|
667
|
+
let t = String(reply != null ? reply : "").trim();
|
|
668
|
+
const fenced = /```(?:json)?\s*\n?([\s\S]*?)```/i.exec(t);
|
|
669
|
+
if (fenced) t = fenced[1].trim();
|
|
670
|
+
const start = t.search(/[[{]/);
|
|
671
|
+
if (start < 0) return [];
|
|
672
|
+
const end = Math.max(t.lastIndexOf("}"), t.lastIndexOf("]"));
|
|
673
|
+
if (end <= start) return [];
|
|
674
|
+
let data;
|
|
675
|
+
try {
|
|
676
|
+
data = JSON.parse(t.slice(start, end + 1));
|
|
677
|
+
} catch (e) {
|
|
678
|
+
return [];
|
|
679
|
+
}
|
|
680
|
+
const list = Array.isArray(data) ? data : isObj(data) && Array.isArray(data.directions) ? data.directions : [];
|
|
681
|
+
const out = [];
|
|
682
|
+
const seen = /* @__PURE__ */ new Set();
|
|
683
|
+
for (const item of list.slice(0, 6)) {
|
|
684
|
+
const d = toDesignDirection(item);
|
|
685
|
+
if (!d || seen.has(d.name.toLowerCase())) continue;
|
|
686
|
+
seen.add(d.name.toLowerCase());
|
|
687
|
+
out.push(__spreadProps(__spreadValues({}, d), {
|
|
688
|
+
id: `ai-${d.id}`.slice(0, 40)
|
|
689
|
+
}));
|
|
690
|
+
}
|
|
691
|
+
return out.slice(0, 3);
|
|
692
|
+
}
|
|
693
|
+
async function resolveDirections(brief, suggest, opts = {}) {
|
|
694
|
+
var _a, _b;
|
|
695
|
+
const curated = () => ({
|
|
696
|
+
directions: pickDirectionsForBrief(brief),
|
|
697
|
+
source: "curated"
|
|
698
|
+
});
|
|
699
|
+
if (!suggest) return curated();
|
|
700
|
+
const ctrl = new AbortController();
|
|
701
|
+
const onAbort = () => ctrl.abort();
|
|
702
|
+
(_a = opts.signal) == null ? void 0 : _a.addEventListener("abort", onAbort, {
|
|
703
|
+
once: true
|
|
704
|
+
});
|
|
705
|
+
let timer;
|
|
706
|
+
try {
|
|
707
|
+
const timeout = new Promise((resolve) => {
|
|
708
|
+
var _a2;
|
|
709
|
+
timer = setTimeout(() => {
|
|
710
|
+
ctrl.abort();
|
|
711
|
+
resolve(null);
|
|
712
|
+
}, (_a2 = opts.timeoutMs) != null ? _a2 : DIRECTIONS_TIMEOUT_MS);
|
|
713
|
+
});
|
|
714
|
+
const reply = await Promise.race([suggest(buildDirectionsPrompt(brief), {
|
|
715
|
+
signal: ctrl.signal
|
|
716
|
+
}).catch(() => null), timeout]);
|
|
717
|
+
const ai = reply ? parseDirectionsReply(reply) : [];
|
|
718
|
+
if (!ai.length) return curated();
|
|
719
|
+
const names = new Set(ai.map((d) => d.name.toLowerCase()));
|
|
720
|
+
const fill = rankDirectionsForBrief(brief).filter((d) => !names.has(d.name.toLowerCase())).slice(0, 3 - ai.length).map(asDirection);
|
|
721
|
+
return {
|
|
722
|
+
directions: [...ai, ...fill],
|
|
723
|
+
source: "ai"
|
|
724
|
+
};
|
|
725
|
+
} catch (e) {
|
|
726
|
+
return curated();
|
|
727
|
+
} finally {
|
|
728
|
+
if (timer) clearTimeout(timer);
|
|
729
|
+
(_b = opts.signal) == null ? void 0 : _b.removeEventListener("abort", onAbort);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
function withTailoredDirections(state, result) {
|
|
733
|
+
const next = __spreadProps(__spreadValues({}, state), {
|
|
734
|
+
loading: false
|
|
735
|
+
});
|
|
736
|
+
if (result.source !== "ai" || !result.directions.length) return next;
|
|
737
|
+
if (state.touched) return __spreadProps(__spreadValues({}, next), {
|
|
738
|
+
tailored: result.directions
|
|
739
|
+
});
|
|
740
|
+
return __spreadProps(__spreadValues({}, next), {
|
|
741
|
+
directions: result.directions,
|
|
742
|
+
source: "ai",
|
|
743
|
+
tailored: void 0
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
function showTailoredDirections(state) {
|
|
747
|
+
var _a;
|
|
748
|
+
if (!((_a = state.tailored) == null ? void 0 : _a.length)) return state;
|
|
749
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
750
|
+
directions: state.tailored,
|
|
751
|
+
source: "ai",
|
|
752
|
+
tailored: void 0
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
const RADIUS_PX = {
|
|
756
|
+
none: 0,
|
|
757
|
+
sm: 6,
|
|
758
|
+
md: 12,
|
|
759
|
+
lg: 20,
|
|
760
|
+
full: 9999
|
|
761
|
+
};export{AA_CONTRAST,CURATED_DIRECTIONS,DENSITY_STYLES,DIRECTIONS_SESSION_KEY,DIRECTIONS_TIMEOUT_MS,GOOGLE_FONTS,IMAGERY_STYLES,MAX_MOOD_CHARS,MAX_NAME_CHARS,PALETTE_ROLES,RADIUS_PX,RADIUS_STYLES,asDirection,buildDirectionsPrompt,canonicalFont,cleanLine,contrastRatio,directionsSessionKey,ensureContrastOn,normalizeHex,onColor,parseDirectionsReply,pickDirectionsForBrief,rankDirectionsForBrief,relativeLuminance,resolveDirections,showTailoredDirections,slugify,toDesignDirection,validateDirection,withTailoredDirections};//# sourceMappingURL=directions.js.map
|