@graph8/sdk 0.362.0 → 0.373.0
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/README.md +33 -10
- package/blocks/_foundation/README.md +78 -1
- package/blocks/_foundation/block.json +123 -6
- package/blocks/_foundation/components/api-error.tsx +9 -7
- package/blocks/_foundation/components/brand-provider.tsx +23 -0
- package/blocks/_foundation/components/confirm-spend-dialog.tsx +15 -8
- package/blocks/_foundation/components/confirmed-action.tsx +90 -0
- package/blocks/_foundation/components/connect-graph8.tsx +280 -0
- package/blocks/_foundation/components/empty-state.tsx +5 -2
- package/blocks/_foundation/components/list-select.tsx +112 -0
- package/blocks/_foundation/components/paging-notices.tsx +55 -0
- package/blocks/_foundation/components/screen/detail-panel.tsx +2 -1
- package/blocks/_foundation/components/screen/filter-controls.tsx +92 -0
- package/blocks/_foundation/components/screen/index.ts +2 -0
- package/blocks/_foundation/components/screen/record-link.tsx +76 -0
- package/blocks/_foundation/components/screen/split-view.tsx +1 -1
- package/blocks/_foundation/components/screen/time-series-chart-recharts.tsx +65 -0
- package/blocks/_foundation/components/screen/time-series-chart.tsx +15 -97
- package/blocks/_foundation/components/screen/time-series-format.ts +57 -0
- package/blocks/_foundation/hooks/use-all-pages.ts +54 -0
- package/blocks/_foundation/hooks/use-brand.ts +52 -0
- package/blocks/_foundation/hooks/use-g8-mutation.ts +23 -0
- package/blocks/_foundation/hooks/use-g8-query.ts +127 -1
- package/blocks/_foundation/hooks/use-load-more-list.ts +61 -0
- package/blocks/_foundation/hooks/use-paginated.ts +120 -0
- package/blocks/_foundation/hooks/use-row-activation.ts +57 -0
- package/blocks/_foundation/hooks/use-url-filters.ts +93 -0
- package/blocks/_foundation/lib/g8-cache.ts +454 -0
- package/blocks/_foundation/lib/g8-client.ts +1 -1
- package/blocks/_foundation/lib/paging.ts +57 -0
- package/blocks/_foundation/lib/plural.ts +23 -0
- package/blocks/_foundation/lib/use-debounced-value.ts +13 -0
- package/blocks/_foundation/server/connect-route.ts +15 -0
- package/blocks/_foundation/server/connect.ts +127 -0
- package/blocks/_foundation/server/local-key.ts +70 -0
- package/blocks/_foundation/server/proxy.ts +103 -3
- package/blocks/_foundation/server/route.ts +16 -4
- package/blocks/agents/README.md +93 -2
- package/blocks/agents/block.json +343 -2
- package/blocks/agents/components/agent-activity.tsx +112 -0
- package/blocks/agents/components/agent-approvals.tsx +135 -0
- package/blocks/agents/components/agent-builder.tsx +29 -10
- package/blocks/agents/components/agent-conversations.tsx +143 -0
- package/blocks/agents/components/agent-knowledge-panel.tsx +4 -3
- package/blocks/agents/components/agent-operators.tsx +164 -0
- package/blocks/agents/components/agent-run-detail.tsx +119 -0
- package/blocks/agents/components/agent-runs.tsx +19 -10
- package/blocks/agents/components/agent-skills-panel.tsx +7 -7
- package/blocks/agents/components/agent-test-history.tsx +121 -0
- package/blocks/agents/components/agents-screen.tsx +226 -0
- package/blocks/agents/components/assistant-sessions.tsx +150 -0
- package/blocks/agents/components/duplicate-agent-button.tsx +42 -0
- package/blocks/agents/components/from-template-button.tsx +65 -0
- package/blocks/agents/components/knowledge-browser.tsx +107 -0
- package/blocks/agents/components/knowledge-detail.tsx +156 -0
- package/blocks/agents/components/knowledge-form.tsx +69 -0
- package/blocks/agents/components/name-dialog.tsx +32 -0
- package/blocks/agents/components/receptionist-button.tsx +46 -0
- package/blocks/agents/components/save-as-template-button.tsx +32 -0
- package/blocks/agents/components/skill-editor.tsx +147 -0
- package/blocks/agents/components/skill-library.tsx +111 -0
- package/blocks/agents/lib/agent-types.ts +7 -1
- package/blocks/agents/lib/facts.tsx +13 -0
- package/blocks/agents/lib/knowledge-utils.ts +49 -0
- package/blocks/agents/lib/load-more.tsx +141 -0
- package/blocks/agents/lib/skill-utils.ts +91 -0
- package/blocks/agents/recipes/create-agent-and-attach-skill.ts +1 -1
- package/blocks/analytics/README.md +13 -0
- package/blocks/analytics/block.json +45 -1
- package/blocks/analytics/components/analytics-screen.tsx +222 -0
- package/blocks/analytics/components/kpi-tiles.tsx +1 -1
- package/blocks/analytics/components/leaderboard.tsx +14 -7
- package/blocks/analytics/components/report-builder.tsx +38 -11
- package/blocks/analytics/components/report-detail.tsx +84 -0
- package/blocks/analytics/components/trend-chart.tsx +62 -0
- package/blocks/appointments/README.md +6 -0
- package/blocks/appointments/block.json +33 -2
- package/blocks/appointments/components/availability-editor.tsx +17 -5
- package/blocks/appointments/components/booking-page.tsx +2 -2
- package/blocks/appointments/components/event-type-editor.tsx +2 -1
- package/blocks/appointments/components/event-type-related.tsx +4 -2
- package/blocks/appointments/components/meeting-contact-links.tsx +49 -0
- package/blocks/appointments/components/meeting-detail.tsx +2 -2
- package/blocks/appointments/components/meeting-list.tsx +38 -18
- package/blocks/appointments/components/meetings-screen.tsx +7 -4
- package/blocks/appointments/components/record-meetings-tab.tsx +92 -0
- package/blocks/appointments/components/scheduling-screen.tsx +2 -1
- package/blocks/block.schema.json +18 -0
- package/blocks/block.types.ts +17 -0
- package/blocks/campaigns/README.md +41 -11
- package/blocks/campaigns/block.json +105 -42
- package/blocks/campaigns/components/campaign-assets.tsx +17 -6
- package/blocks/campaigns/components/campaign-launch-step.tsx +114 -26
- package/blocks/campaigns/components/campaign-list.tsx +7 -3
- package/blocks/campaigns/components/campaign-metrics.tsx +1 -1
- package/blocks/campaigns/components/campaign-wizard.tsx +52 -14
- package/blocks/campaigns/components/campaigns-screen.tsx +267 -0
- package/blocks/campaigns/components/icp-detail.tsx +163 -0
- package/blocks/campaigns/components/icp-editor.tsx +22 -17
- package/blocks/campaigns/components/persona-detail.tsx +181 -0
- package/blocks/campaigns/components/persona-editor.tsx +19 -11
- package/blocks/campaigns/lib/campaigns-utils.ts +138 -5
- package/blocks/campaigns/recipes/attach-audience-and-launch.ts +16 -3
- package/blocks/campaigns/recipes/generate-ideas-and-create-campaign.ts +8 -4
- package/blocks/coach/README.md +10 -0
- package/blocks/coach/block.json +16 -1
- package/blocks/coach/components/call-scorecard.tsx +7 -7
- package/blocks/coach/components/coach-screen.tsx +222 -0
- package/blocks/company-intelligence/README.md +132 -0
- package/blocks/company-intelligence/block.json +318 -0
- package/blocks/company-intelligence/components/company-intelligence-screen.tsx +114 -0
- package/blocks/company-intelligence/components/company-intelligence-tab.tsx +88 -0
- package/blocks/company-intelligence/components/company-profile.tsx +68 -0
- package/blocks/company-intelligence/components/intelligence-sources.tsx +63 -0
- package/blocks/company-intelligence/components/report-detail.tsx +189 -0
- package/blocks/company-intelligence/components/research-reports.tsx +136 -0
- package/blocks/company-intelligence/components/research-run.tsx +161 -0
- package/blocks/company-intelligence/components/source-detail.tsx +117 -0
- package/blocks/company-intelligence/components/source-view.tsx +274 -0
- package/blocks/company-intelligence/components/wiki-document-detail.tsx +116 -0
- package/blocks/company-intelligence/components/wiki-documents.tsx +66 -0
- package/blocks/company-intelligence/hooks/use-intelligence.ts +173 -0
- package/blocks/company-intelligence/lib/intelligence-types.ts +230 -0
- package/blocks/company-intelligence/lib/safe-markdown.tsx +150 -0
- package/blocks/company-intelligence/recipes/read-competitors-and-news.ts +33 -0
- package/blocks/company-intelligence/recipes/research-your-website.ts +43 -0
- package/blocks/company-intelligence/recipes/write-the-research-reports.ts +54 -0
- package/blocks/copilot/README.md +13 -0
- package/blocks/copilot/block.json +14 -1
- package/blocks/copilot/components/copilot-memory.tsx +6 -2
- package/blocks/copilot/components/copilot-panel.tsx +14 -5
- package/blocks/copilot/components/copilot-screen.tsx +148 -0
- package/blocks/copilot/components/copilot-team-chat.tsx +13 -6
- package/blocks/crm/README.md +34 -0
- package/blocks/crm/block.json +107 -2
- package/blocks/crm/components/companies-screen.tsx +359 -0
- package/blocks/crm/components/company-detail.tsx +10 -8
- package/blocks/crm/components/company-table.tsx +11 -4
- package/blocks/crm/components/contact-detail.tsx +10 -7
- package/blocks/crm/components/contact-lookup-link.tsx +44 -0
- package/blocks/crm/components/contact-table.tsx +10 -3
- package/blocks/crm/components/contacts-screen.tsx +377 -0
- package/blocks/crm/components/dedupe-review.tsx +13 -6
- package/blocks/crm/components/import-wizard.tsx +7 -9
- package/blocks/crm/components/list-select.tsx +20 -0
- package/blocks/crm/components/notes-panel.tsx +4 -4
- package/blocks/crm/components/record-engagement-tab.tsx +103 -0
- package/blocks/crm/components/record-form.tsx +6 -4
- package/blocks/crm/components/task-list.tsx +4 -4
- package/blocks/crm/components/tasks-screen.tsx +399 -0
- package/blocks/crm/hooks/use-all-lists.ts +18 -0
- package/blocks/crm/hooks/use-custom-fields.ts +6 -1
- package/blocks/crm/hooks/use-page-query.ts +9 -1
- package/blocks/crm/lib/crm-types.ts +26 -2
- package/blocks/crm/lib/read-lists.ts +16 -0
- package/blocks/crm/lib/screen-parts.tsx +105 -0
- package/blocks/deals/README.md +24 -6
- package/blocks/deals/block.json +160 -5
- package/blocks/deals/components/close-deal-dialog.tsx +169 -0
- package/blocks/deals/components/deal-contacts-editor.tsx +134 -0
- package/blocks/deals/components/deal-detail.tsx +25 -13
- package/blocks/deals/components/deal-filters.tsx +65 -0
- package/blocks/deals/components/deal-line-items.tsx +120 -0
- package/blocks/deals/components/deal-notes-tab.tsx +97 -0
- package/blocks/deals/components/deal-related.tsx +31 -10
- package/blocks/deals/components/deal-tasks-tab.tsx +88 -0
- package/blocks/deals/components/deals-screen.tsx +66 -26
- package/blocks/deals/components/forecast-view.tsx +4 -4
- package/blocks/deals/components/pipeline-board.tsx +8 -6
- package/blocks/deals/components/pipeline-editor.tsx +132 -0
- package/blocks/deals/components/record-deals-tab.tsx +62 -0
- package/blocks/deals/components/stage-editor.tsx +5 -5
- package/blocks/deals/hooks/use-pipeline-deals.ts +21 -4
- package/blocks/deals/hooks/use-pipelines.ts +1 -1
- package/blocks/deals/lib/deal-extras.ts +156 -0
- package/blocks/dialer/README.md +45 -4
- package/blocks/dialer/block.json +84 -3
- package/blocks/dialer/components/call-contact-button.tsx +269 -0
- package/blocks/dialer/components/call-log-screen.tsx +208 -0
- package/blocks/dialer/components/call-log.tsx +23 -7
- package/blocks/dialer/components/call-queue.tsx +4 -4
- package/blocks/dialer/components/dialer-screen.tsx +361 -0
- package/blocks/dialer/components/dialer-session-detail.tsx +153 -0
- package/blocks/dialer/components/disposition-panel.tsx +1 -1
- package/blocks/dialer/components/live-calls-table.tsx +7 -3
- package/blocks/dialer/components/record-calls-tab.tsx +101 -0
- package/blocks/dialer/components/session-start-form.tsx +61 -12
- package/blocks/dialer/components/softphone.tsx +4 -2
- package/blocks/enrichment/README.md +29 -7
- package/blocks/enrichment/block.json +49 -9
- package/blocks/enrichment/components/bulk-enrich-panel.tsx +83 -29
- package/blocks/enrichment/components/email-verify-badge.tsx +31 -11
- package/blocks/enrichment/components/enrich-button.tsx +32 -9
- package/blocks/enrichment/components/enrichment-job-detail.tsx +78 -0
- package/blocks/enrichment/components/enrichment-screen.tsx +341 -0
- package/blocks/enrichment/components/waterfall-config.tsx +66 -17
- package/blocks/enrichment/lib/enrichment-types.ts +39 -0
- package/blocks/enrichment/recipes/bulk-enrich-and-poll.ts +15 -4
- package/blocks/enrichment/recipes/waterfall-pipeline.ts +3 -2
- package/blocks/forms/README.md +8 -0
- package/blocks/forms/block.json +139 -18
- package/blocks/forms/components/form-activity.tsx +71 -0
- package/blocks/forms/components/form-backfill.tsx +108 -0
- package/blocks/forms/components/form-builder.tsx +4 -2
- package/blocks/forms/components/form-embed.tsx +4 -2
- package/blocks/forms/components/form-groups.tsx +151 -0
- package/blocks/forms/components/form-mapping-editor.tsx +6 -9
- package/blocks/forms/components/form-route-history.tsx +72 -0
- package/blocks/forms/components/form-saved-views.tsx +81 -0
- package/blocks/forms/components/forms-screen.tsx +56 -19
- package/blocks/forms/components/more-rows.tsx +30 -0
- package/blocks/forms/components/submissions-export.tsx +67 -0
- package/blocks/forms/components/submissions-table.tsx +17 -6
- package/blocks/forms/lib/forms-extra.ts +67 -0
- package/blocks/inbox/README.md +32 -3
- package/blocks/inbox/block.json +29 -2
- package/blocks/inbox/components/inbox-list.tsx +7 -3
- package/blocks/inbox/components/inbox-screen.tsx +294 -27
- package/blocks/inbox/components/record-conversations-tab.tsx +154 -0
- package/blocks/inbox/components/reply-composer.tsx +65 -9
- package/blocks/inbox/components/tag-and-assign.tsx +4 -2
- package/blocks/inbox/components/thread-badge.tsx +2 -2
- package/blocks/inbox/components/thread-view.tsx +1 -1
- package/blocks/inbox/hooks/use-inbox-thread.ts +1 -1
- package/blocks/inbox/hooks/use-inbox-threads.ts +1 -0
- package/blocks/inbox/lib/inbox-types.ts +47 -1
- package/blocks/inbox/recipes/01-triage-and-reply.ts +12 -2
- package/blocks/integrations/README.md +63 -1
- package/blocks/integrations/block.json +234 -15
- package/blocks/integrations/components/ad-accounts.tsx +82 -0
- package/blocks/integrations/components/connection-health.tsx +59 -0
- package/blocks/integrations/components/crm-detail.tsx +119 -0
- package/blocks/integrations/components/crm-records.tsx +103 -0
- package/blocks/integrations/components/field-mappings.tsx +61 -0
- package/blocks/integrations/components/integration-list.tsx +13 -8
- package/blocks/integrations/components/integrations-screen.tsx +152 -0
- package/blocks/integrations/components/migration-panel.tsx +133 -0
- package/blocks/integrations/components/sugarcrm-connect.tsx +95 -0
- package/blocks/integrations/components/sync-status.tsx +11 -9
- package/blocks/integrations/components/sync-triggers.tsx +134 -0
- package/blocks/integrations/components/webhook-detail.tsx +179 -0
- package/blocks/integrations/components/webhook-manager.tsx +43 -25
- package/blocks/integrations/components/workspace-tools.tsx +127 -0
- package/blocks/integrations/lib/crm-utils.ts +39 -0
- package/blocks/integrations/lib/facts.tsx +13 -0
- package/blocks/integrations/lib/integrations-utils.ts +11 -1
- package/blocks/integrations/lib/load-more.tsx +141 -0
- package/blocks/intent/README.md +14 -0
- package/blocks/intent/block.json +27 -1
- package/blocks/intent/components/account-intent-score.tsx +5 -5
- package/blocks/intent/components/intent-feed.tsx +13 -10
- package/blocks/intent/components/intent-keyword-manager.tsx +16 -12
- package/blocks/intent/components/intent-screen.tsx +265 -0
- package/blocks/intent/components/keyword-detail.tsx +124 -0
- package/blocks/intent/lib/intent-utils.ts +4 -4
- package/blocks/lifecycle/block.json +13 -8
- package/blocks/lifecycle/components/account-related.tsx +8 -1
- package/blocks/lifecycle/components/churn-list.tsx +5 -2
- package/blocks/lifecycle/components/customer-table.tsx +1 -1
- package/blocks/lifecycle/components/lifecycle-board.tsx +3 -1
- package/blocks/lifecycle/components/lifecycle-screen.tsx +3 -1
- package/blocks/lifecycle/lib/lifecycle.ts +1 -1
- package/blocks/lists/README.md +20 -1
- package/blocks/lists/block.json +69 -3
- package/blocks/lists/components/add-company-people-to-list-button.tsx +73 -0
- package/blocks/lists/components/add-to-list-button.tsx +20 -9
- package/blocks/lists/components/list-picker.tsx +17 -3
- package/blocks/lists/components/list-table.tsx +12 -6
- package/blocks/lists/components/lists-screen.tsx +346 -0
- package/blocks/lists/components/record-lists-tab.tsx +99 -0
- package/blocks/lists/components/suppression-manager.tsx +33 -8
- package/blocks/lists/components/suppressions-screen.tsx +264 -0
- package/blocks/mailboxes/README.md +17 -0
- package/blocks/mailboxes/block.json +69 -17
- package/blocks/mailboxes/components/connect-mailbox.tsx +32 -21
- package/blocks/mailboxes/components/domain-detail.tsx +148 -0
- package/blocks/mailboxes/components/domain-purchase.tsx +20 -14
- package/blocks/mailboxes/components/mailbox-detail.tsx +157 -0
- package/blocks/mailboxes/components/mailbox-list.tsx +8 -3
- package/blocks/mailboxes/components/mailboxes-screen.tsx +228 -0
- package/blocks/mailboxes/components/warmup-health.tsx +24 -22
- package/blocks/mailboxes/lib/mailboxes-utils.ts +26 -5
- package/blocks/mailboxes/lib/use-provider-domains.ts +23 -0
- package/blocks/newsletter/README.md +12 -0
- package/blocks/newsletter/block.json +157 -24
- package/blocks/newsletter/components/issue-scheduler.tsx +4 -3
- package/blocks/newsletter/components/issue-versions.tsx +93 -0
- package/blocks/newsletter/components/more-rows.tsx +30 -0
- package/blocks/newsletter/components/newsletter-editor.tsx +1 -1
- package/blocks/newsletter/components/newsletter-list-syncs.tsx +121 -0
- package/blocks/newsletter/components/newsletter-screen.tsx +39 -14
- package/blocks/newsletter/components/newsletter-settings.tsx +211 -0
- package/blocks/newsletter/components/newsletter-stats.tsx +2 -2
- package/blocks/newsletter/components/newsletter-templates.tsx +133 -0
- package/blocks/newsletter/components/subscriber-table.tsx +5 -7
- package/blocks/newsletter/components/subscriber-timeline.tsx +65 -0
- package/blocks/newsletter/lib/newsletter-extra.ts +60 -0
- package/blocks/nurture/block.json +28 -14
- package/blocks/nurture/components/nurture-builder.tsx +13 -3
- package/blocks/nurture/components/nurture-enroll.tsx +12 -10
- package/blocks/nurture/components/nurture-form.tsx +27 -10
- package/blocks/nurture/components/nurture-screen.tsx +26 -11
- package/blocks/nurture/components/nurture-stats.tsx +5 -4
- package/blocks/nurture/lib/nurture-types.ts +1 -1
- package/blocks/objects/README.md +18 -1
- package/blocks/objects/block.json +42 -21
- package/blocks/objects/components/attribute-field-input.tsx +14 -1
- package/blocks/objects/components/object-not-found.tsx +3 -1
- package/blocks/objects/components/object-record-detail.tsx +10 -2
- package/blocks/objects/components/object-schema-editor.tsx +4 -2
- package/blocks/objects/components/object-table.tsx +13 -3
- package/blocks/objects/components/objects-screen.tsx +147 -0
- package/blocks/objects/components/record-roles-panel.tsx +15 -5
- package/blocks/objects/lib/object-types.ts +1 -1
- package/blocks/pages/README.md +14 -0
- package/blocks/pages/block.json +140 -23
- package/blocks/pages/components/brand-kit-editor.tsx +5 -2
- package/blocks/pages/components/content-library.tsx +9 -4
- package/blocks/pages/components/more-rows.tsx +30 -0
- package/blocks/pages/components/page-ai-tools.tsx +196 -0
- package/blocks/pages/components/page-analytics.tsx +176 -0
- package/blocks/pages/components/page-clone.tsx +99 -0
- package/blocks/pages/components/page-domains.tsx +167 -0
- package/blocks/pages/components/page-editor.tsx +1 -1
- package/blocks/pages/components/page-generation-status.tsx +48 -0
- package/blocks/pages/components/page-list.tsx +2 -1
- package/blocks/pages/components/page-tracking.tsx +137 -0
- package/blocks/pages/components/pages-screen.tsx +57 -16
- package/blocks/pages/components/seo-report.tsx +6 -1
- package/blocks/pages/lib/studio.ts +7 -0
- package/blocks/phone-numbers/README.md +74 -0
- package/blocks/phone-numbers/block.json +262 -0
- package/blocks/phone-numbers/components/a2p-registration.tsx +230 -0
- package/blocks/phone-numbers/components/assign-number.tsx +104 -0
- package/blocks/phone-numbers/components/number-search.tsx +239 -0
- package/blocks/phone-numbers/components/number-settings.tsx +134 -0
- package/blocks/phone-numbers/components/number-usage.tsx +97 -0
- package/blocks/phone-numbers/components/phone-number-detail.tsx +84 -0
- package/blocks/phone-numbers/components/phone-number-list.tsx +110 -0
- package/blocks/phone-numbers/components/phone-numbers-screen.tsx +201 -0
- package/blocks/phone-numbers/components/register-owned-number.tsx +98 -0
- package/blocks/phone-numbers/components/release-number.tsx +126 -0
- package/blocks/phone-numbers/hooks/use-phone-numbers.ts +58 -0
- package/blocks/phone-numbers/lib/phone-numbers-utils.ts +202 -0
- package/blocks/phone-numbers/recipes/01-search-and-buy-number.ts +49 -0
- package/blocks/phone-numbers/recipes/02-assign-number-to-rep.ts +25 -0
- package/blocks/phone-numbers/recipes/03-audit-numbers.ts +36 -0
- package/blocks/phone-numbers/recipes/04-register-text-messaging.ts +39 -0
- package/blocks/pickers/README.md +23 -0
- package/blocks/pickers/block.json +103 -0
- package/blocks/pickers/components/company-picker.tsx +90 -0
- package/blocks/pickers/components/contact-picker.tsx +131 -0
- package/blocks/pickers/components/member-picker.tsx +99 -0
- package/blocks/pickers/components/search-picker.tsx +98 -0
- package/blocks/pickers/hooks/use-current-member.ts +104 -0
- package/blocks/pickers/hooks/use-picker-pages.ts +73 -0
- package/blocks/pickers/lib/use-debounced.ts +13 -0
- package/blocks/quotes/README.md +13 -0
- package/blocks/quotes/block.json +65 -13
- package/blocks/quotes/components/create-quote-from-deal.tsx +48 -0
- package/blocks/quotes/components/product-picker.tsx +3 -1
- package/blocks/quotes/components/quote-builder.tsx +1 -1
- package/blocks/quotes/components/quote-lifecycle-actions.tsx +146 -0
- package/blocks/quotes/components/quote-list.tsx +5 -3
- package/blocks/quotes/components/quote-related.tsx +8 -4
- package/blocks/quotes/components/quote-viewer.tsx +7 -2
- package/blocks/quotes/components/record-quotes-tab.tsx +90 -0
- package/blocks/radar/README.md +10 -0
- package/blocks/radar/block.json +41 -1
- package/blocks/radar/components/competitor-battle-card.tsx +1 -1
- package/blocks/radar/components/competitor-detail.tsx +117 -0
- package/blocks/radar/components/competitor-tracker.tsx +3 -1
- package/blocks/radar/components/radar-overview.tsx +4 -4
- package/blocks/radar/components/radar-report.tsx +4 -2
- package/blocks/radar/components/radar-screen.tsx +214 -0
- package/blocks/radar/components/report-detail.tsx +104 -0
- package/blocks/search/README.md +10 -0
- package/blocks/search/block.json +16 -1
- package/blocks/search/components/filter-builder.tsx +3 -3
- package/blocks/search/components/prospect-results.tsx +5 -3
- package/blocks/search/components/prospect-search-screen.tsx +235 -0
- package/blocks/search/components/saved-searches.tsx +4 -1
- package/blocks/search/hooks/use-filter-options.ts +20 -6
- package/blocks/search/lib/search-types.ts +2 -0
- package/blocks/sequencer/README.md +55 -9
- package/blocks/sequencer/block.json +126 -19
- package/blocks/sequencer/components/add-to-sequence-button.tsx +82 -0
- package/blocks/sequencer/components/enroll-dialog.tsx +11 -5
- package/blocks/sequencer/components/record-sequences-tab.tsx +126 -0
- package/blocks/sequencer/components/sequence-builder.tsx +224 -60
- package/blocks/sequencer/components/sequence-detail.tsx +261 -0
- package/blocks/sequencer/components/sequence-enrollments.tsx +116 -0
- package/blocks/sequencer/components/sequence-list.tsx +34 -9
- package/blocks/sequencer/components/sequence-stats.tsx +11 -10
- package/blocks/sequencer/components/sequence-steps-panel.tsx +103 -0
- package/blocks/sequencer/components/sequences-screen.tsx +162 -0
- package/blocks/sequencer/components/step-editor.tsx +14 -12
- package/blocks/sequencer/lib/sequencer-utils.ts +133 -10
- package/blocks/sequencer/recipes/create-multichannel-sequence.ts +33 -5
- package/blocks/sequencer/recipes/launch-and-enroll.ts +19 -2
- package/blocks/social-ads/README.md +19 -0
- package/blocks/social-ads/block.json +233 -1
- package/blocks/social-ads/components/ad-campaign-list.tsx +9 -5
- package/blocks/social-ads/components/ads-screen.tsx +152 -0
- package/blocks/social-ads/components/audience-sync-detail.tsx +194 -0
- package/blocks/social-ads/components/audience-sync.tsx +17 -9
- package/blocks/social-ads/components/campaign-ads.tsx +166 -0
- package/blocks/social-ads/components/campaign-detail.tsx +138 -0
- package/blocks/social-ads/components/campaign-editor.tsx +134 -0
- package/blocks/social-ads/components/creative-concepts.tsx +74 -0
- package/blocks/social-ads/components/creative-detail.tsx +155 -0
- package/blocks/social-ads/components/creative-gallery.tsx +35 -7
- package/blocks/social-ads/components/creative-revisions.tsx +57 -0
- package/blocks/social-ads/components/creative-tools.tsx +176 -0
- package/blocks/social-ads/components/post-composer.tsx +7 -3
- package/blocks/social-ads/components/post-detail.tsx +163 -0
- package/blocks/social-ads/components/social-ideas.tsx +64 -0
- package/blocks/social-ads/components/social-performance.tsx +80 -0
- package/blocks/social-ads/components/social-post-list.tsx +11 -3
- package/blocks/social-ads/components/social-screen.tsx +187 -0
- package/blocks/social-ads/lib/ads-extra.ts +67 -0
- package/blocks/surveys/README.md +91 -0
- package/blocks/surveys/block.json +299 -0
- package/blocks/surveys/components/account-nps.tsx +69 -0
- package/blocks/surveys/components/contact-survey-history.tsx +52 -0
- package/blocks/surveys/components/org-summary.tsx +82 -0
- package/blocks/surveys/components/sending-domains.tsx +113 -0
- package/blocks/surveys/components/survey-form.tsx +126 -0
- package/blocks/surveys/components/survey-responses.tsx +145 -0
- package/blocks/surveys/components/survey-results.tsx +72 -0
- package/blocks/surveys/components/survey-send-history.tsx +58 -0
- package/blocks/surveys/components/survey-send.tsx +162 -0
- package/blocks/surveys/components/survey-triggers.tsx +166 -0
- package/blocks/surveys/components/surveys-screen.tsx +234 -0
- package/blocks/surveys/lib/surveys-types.ts +228 -0
- package/blocks/surveys/recipes/create-an-nps-survey.ts +22 -0
- package/blocks/surveys/recipes/send-a-survey-and-follow-it.ts +27 -0
- package/blocks/surveys/recipes/survey-score-report.ts +27 -0
- package/blocks/visitors/README.md +10 -0
- package/blocks/visitors/block.json +25 -1
- package/blocks/visitors/components/snippet-install.tsx +21 -10
- package/blocks/visitors/components/traffic-chart.tsx +4 -4
- package/blocks/visitors/components/visitor-company-card.tsx +26 -16
- package/blocks/visitors/components/visitor-detail.tsx +105 -0
- package/blocks/visitors/components/visitor-feed.tsx +16 -7
- package/blocks/visitors/components/visitors-screen.tsx +166 -0
- package/blocks/webchat/README.md +10 -0
- package/blocks/webchat/block.json +21 -7
- package/blocks/webchat/components/chat-widget-config.tsx +8 -5
- package/blocks/webchat/components/conversation-list.tsx +8 -4
- package/blocks/webchat/components/webchat-screen.tsx +245 -0
- package/blocks/workbench/README.md +11 -0
- package/blocks/workbench/block.json +48 -1
- package/blocks/workbench/components/column-recipe-editor.tsx +5 -3
- package/blocks/workbench/components/run-progress.tsx +1 -1
- package/blocks/workbench/components/workbench-grid.tsx +10 -4
- package/blocks/workbench/components/workbench-row-detail.tsx +104 -0
- package/blocks/workbench/components/workbench-screen.tsx +202 -0
- package/blocks/workbench/components/workbench-sources.tsx +194 -0
- package/blocks/workbench/components/workbench-table-list.tsx +14 -2
- package/blocks/workflows/README.md +13 -0
- package/blocks/workflows/block.json +28 -9
- package/blocks/workflows/components/run-history.tsx +31 -9
- package/blocks/workflows/components/trigger-config.tsx +3 -1
- package/blocks/workflows/components/workflow-editor.tsx +4 -2
- package/blocks/workflows/components/workflow-list.tsx +13 -6
- package/blocks/workflows/components/workflows-screen.tsx +193 -0
- package/dist/cli.js +3109 -1977
- package/dist/errors.d.mts +34 -0
- package/dist/errors.d.ts +34 -0
- package/dist/errors.js +46 -0
- package/dist/errors.js.map +1 -0
- package/dist/errors.mjs +21 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/index.browser.js +11 -5
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +11 -5
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.d.mts +164 -25
- package/dist/index.d.ts +164 -25
- package/dist/index.js +11 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -5
- package/dist/index.mjs.map +1 -1
- package/dist/react.browser.js +10 -4
- package/dist/react.browser.js.map +1 -1
- package/dist/react.browser.mjs +10 -4
- package/dist/react.browser.mjs.map +1 -1
- package/dist/react.d.mts +142 -5
- package/dist/react.d.ts +142 -5
- package/dist/react.js +10 -4
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +10 -4
- package/dist/react.mjs.map +1 -1
- package/dist/types/blocks/add.d.ts +11 -4
- package/dist/types/blocks/brand.d.ts +122 -0
- package/dist/types/blocks/compose.d.ts +53 -0
- package/dist/types/blocks/create.d.ts +27 -20
- package/dist/types/blocks/doctor.d.ts +6 -1
- package/dist/types/blocks/flows.d.ts +7 -1
- package/dist/types/blocks/navfile.d.ts +35 -0
- package/dist/types/blocks/orgBrand.d.ts +34 -0
- package/dist/types/blocks/paths.d.ts +4 -0
- package/dist/types/blocks/prefixes.d.ts +37 -0
- package/dist/types/blocks/registry.d.ts +17 -0
- package/dist/types/blocks/screens.d.ts +53 -0
- package/dist/types/cli.d.ts +5 -0
- package/dist/types/errors.d.ts +33 -0
- package/dist/types/http.d.ts +2 -18
- package/dist/types/version.d.ts +2 -2
- package/docs/agents.md +15 -4
- package/docs/api/README.md +2 -2
- package/docs/api/by-path.md +1 -0
- package/docs/api/desk.d.ts +98 -2
- package/docs/api/desk.md +123 -1
- package/docs/api/inbox.d.ts +10 -2
- package/docs/api/inbox.md +10 -2
- package/docs/api/seo.d.ts +19 -1
- package/docs/api/seo.md +24 -1
- package/package.json +16 -2
- package/stacks/6sense/pages/companies.tsx.tmpl +21 -0
- package/stacks/6sense/pages/contacts.tsx.tmpl +19 -0
- package/stacks/6sense/pages/tasks.tsx.tmpl +19 -0
- package/stacks/6sense.json +55 -17
- package/stacks/apollo/pages/calls.tsx.tmpl +23 -0
- package/stacks/apollo/pages/companies.tsx.tmpl +33 -0
- package/stacks/apollo/pages/contacts.tsx.tmpl +51 -0
- package/stacks/apollo/pages/deals.tsx.tmpl +17 -0
- package/stacks/apollo/pages/inbox-contact.tsx.tmpl +13 -0
- package/stacks/apollo/pages/lists.tsx.tmpl +12 -0
- package/stacks/apollo/pages/meetings.tsx.tmpl +13 -0
- package/stacks/apollo/pages/sequences.tsx.tmpl +12 -0
- package/stacks/apollo/pages/tasks.tsx.tmpl +20 -0
- package/stacks/apollo.json +147 -37
- package/stacks/calendly/pages/companies.tsx.tmpl +19 -0
- package/stacks/calendly/pages/contacts.tsx.tmpl +21 -0
- package/stacks/calendly/pages/meetings.tsx.tmpl +13 -0
- package/stacks/calendly/pages/tasks.tsx.tmpl +19 -0
- package/stacks/calendly.json +64 -0
- package/stacks/clay/pages/companies.tsx.tmpl +31 -0
- package/stacks/clay/pages/contacts.tsx.tmpl +31 -0
- package/stacks/clay/pages/lists.tsx.tmpl +12 -0
- package/stacks/clay/pages/tasks.tsx.tmpl +19 -0
- package/stacks/clay.json +73 -27
- package/stacks/gong/pages/calls.tsx.tmpl +23 -0
- package/stacks/gong/pages/companies.tsx.tmpl +22 -0
- package/stacks/gong/pages/contacts.tsx.tmpl +32 -0
- package/stacks/gong/pages/lists.tsx.tmpl +12 -0
- package/stacks/gong/pages/meetings.tsx.tmpl +13 -0
- package/stacks/gong/pages/tasks.tsx.tmpl +19 -0
- package/stacks/gong.json +98 -35
- package/stacks/hootsuite/pages/companies.tsx.tmpl +22 -0
- package/stacks/hootsuite/pages/contacts.tsx.tmpl +28 -0
- package/stacks/hootsuite/pages/lists.tsx.tmpl +12 -0
- package/stacks/hootsuite/pages/tasks.tsx.tmpl +19 -0
- package/stacks/hootsuite.json +104 -0
- package/stacks/hubspot/pages/companies.tsx.tmpl +26 -0
- package/stacks/hubspot/pages/contacts.tsx.tmpl +45 -0
- package/stacks/hubspot/pages/deals.tsx.tmpl +20 -0
- package/stacks/hubspot/pages/inbox.tsx.tmpl +103 -0
- package/stacks/hubspot/pages/lifecycle.tsx.tmpl +23 -0
- package/stacks/hubspot/pages/lists.tsx.tmpl +12 -0
- package/stacks/hubspot/pages/meetings.tsx.tmpl +13 -0
- package/stacks/hubspot/pages/quotes.tsx.tmpl +11 -0
- package/stacks/hubspot/pages/sequences.tsx.tmpl +12 -0
- package/stacks/hubspot/pages/tasks.tsx.tmpl +20 -0
- package/stacks/hubspot.json +181 -64
- package/stacks/intercom/pages/companies.tsx.tmpl +19 -0
- package/stacks/intercom/pages/contacts.tsx.tmpl +21 -0
- package/stacks/intercom/pages/inbox-contact.tsx.tmpl +13 -0
- package/stacks/intercom/pages/tasks.tsx.tmpl +19 -0
- package/stacks/intercom.json +52 -20
- package/stacks/mailchimp/pages/companies.tsx.tmpl +22 -0
- package/stacks/mailchimp/pages/contacts.tsx.tmpl +28 -0
- package/stacks/mailchimp/pages/lists.tsx.tmpl +12 -0
- package/stacks/mailchimp/pages/tasks.tsx.tmpl +19 -0
- package/stacks/mailchimp.json +68 -34
- package/stacks/outreach/pages/calls.tsx.tmpl +23 -0
- package/stacks/outreach/pages/companies.tsx.tmpl +22 -0
- package/stacks/outreach/pages/contacts.tsx.tmpl +46 -0
- package/stacks/outreach/pages/inbox-contact.tsx.tmpl +13 -0
- package/stacks/outreach/pages/lists.tsx.tmpl +12 -0
- package/stacks/outreach/pages/meetings.tsx.tmpl +13 -0
- package/stacks/outreach/pages/sequences.tsx.tmpl +12 -0
- package/stacks/outreach/pages/tasks.tsx.tmpl +19 -0
- package/stacks/outreach.json +106 -25
- package/stacks/pipedrive/pages/companies.tsx.tmpl +23 -0
- package/stacks/pipedrive/pages/contacts.tsx.tmpl +27 -0
- package/stacks/pipedrive/pages/deals.tsx.tmpl +20 -0
- package/stacks/pipedrive/pages/inbox.tsx.tmpl +103 -0
- package/stacks/pipedrive/pages/meetings.tsx.tmpl +13 -0
- package/stacks/pipedrive/pages/quotes.tsx.tmpl +11 -0
- package/stacks/pipedrive/pages/tasks.tsx.tmpl +20 -0
- package/stacks/pipedrive.json +117 -0
- package/stacks/salesforce/pages/companies.tsx.tmpl +26 -0
- package/stacks/salesforce/pages/contacts.tsx.tmpl +32 -0
- package/stacks/salesforce/pages/deals.tsx.tmpl +20 -0
- package/stacks/salesforce/pages/lifecycle.tsx.tmpl +23 -0
- package/stacks/salesforce/pages/lists.tsx.tmpl +12 -0
- package/stacks/salesforce/pages/quotes.tsx.tmpl +11 -0
- package/stacks/salesforce/pages/tasks.tsx.tmpl +20 -0
- package/stacks/salesforce.json +85 -31
- package/stacks/zoominfo/pages/companies.tsx.tmpl +31 -0
- package/stacks/zoominfo/pages/contacts.tsx.tmpl +31 -0
- package/stacks/zoominfo/pages/lists.tsx.tmpl +12 -0
- package/stacks/zoominfo/pages/tasks.tsx.tmpl +19 -0
- package/stacks/zoominfo.json +115 -0
- package/styles/styles.css +1 -1
- package/templates/next-app/README.md.tmpl +40 -9
- package/templates/next-app/app/globals.css.tmpl +349 -64
- package/templates/next-app/app/layout.tsx.tmpl +7 -2
- package/templates/next-app/components/app-shell.tsx.tmpl +104 -88
- package/templates/next-app/components/shell/quick-jump.tsx.tmpl +4 -0
- package/templates/next-app/dot-gitignore.tmpl +2 -0
- package/templates/next-app/package.json.tmpl +1 -1
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
* Never overwrites a file that differs from the template unless `--force`;
|
|
8
8
|
* prints a diff summary instead. Re-running is a no-op.
|
|
9
9
|
*/
|
|
10
|
+
import { installedRel } from "./paths";
|
|
10
11
|
import { type Block, type Registry } from "./registry";
|
|
11
|
-
export declare const ADD_USAGE = "Usage: npx @graph8/sdk add <block>[/<Component>] [options]\n\nCopy a graph8 block (components, hooks, recipes) into your app. The block's\ndependencies (always including `foundation`) are added first.\n --dir <path> project root (default: current directory)\n --target <path> where to copy, relative to --dir (default: components/g8)\n --dry-run print what would change, write and install nothing\n --force overwrite files that differ from the template\n --no-install do not install missing peer dependencies\nExisting files are never overwritten without --force. Installed blocks are\nrecorded in graph8.json so re-runs do nothing.";
|
|
12
|
+
export declare const ADD_USAGE = "Usage: npx @graph8/sdk add <block>[/<Component>] [options]\n\nCopy a graph8 block (components, hooks, recipes) into your app. The block's\ndependencies (always including `foundation`) are added first.\n --dir <path> project root (default: current directory)\n --target <path> where to copy, relative to --dir (default: components/g8)\n --dry-run print what would change, write and install nothing\n --force overwrite files that differ from the template\n --no-install do not install missing peer dependencies\n --routes also add the block's screens as routes and sidebar entries (lib/nav.ts, plus the\n lucide-react icon dependency). Automatic in apps made with `create --blocks`; off by\n default in apps made from a named stack (create apollo, starter, ...), where running it once opts the\n app in, so later add calls wire routes without the flag\nExisting files are never overwritten without --force. Installed blocks are\nrecorded in graph8.json so re-runs do nothing.";
|
|
12
13
|
export interface AddOptions {
|
|
13
14
|
spec: string;
|
|
14
15
|
dir: string;
|
|
@@ -16,6 +17,10 @@ export interface AddOptions {
|
|
|
16
17
|
dryRun: boolean;
|
|
17
18
|
force: boolean;
|
|
18
19
|
install: boolean;
|
|
20
|
+
/** Inside an app made by `create`: also add the block's screens as routes and nav entries. Default true. */
|
|
21
|
+
wireScreens?: boolean;
|
|
22
|
+
/** `--routes`: opt in to route + nav wiring in a created app that was not made with `create --blocks` (a named stack). */
|
|
23
|
+
routes?: boolean;
|
|
19
24
|
}
|
|
20
25
|
export declare function parseAddArgs(argv: string[]): AddOptions;
|
|
21
26
|
export type PackageManager = "pnpm" | "yarn" | "bun" | "npm";
|
|
@@ -29,9 +34,12 @@ export interface AddIO {
|
|
|
29
34
|
err: (line: string) => void;
|
|
30
35
|
/** Run a command in `cwd`; returns the exit code. */
|
|
31
36
|
spawn: (cmd: string, args: string[], cwd: string) => number;
|
|
37
|
+
/** Directory holding `next-app/` (the package's `templates/`); needed to write screen routes. */
|
|
38
|
+
templatesRoot?: string;
|
|
39
|
+
/** The package's own package.json (for the lucide-react range of nav icons). */
|
|
40
|
+
sdkPackageJson?: string;
|
|
32
41
|
}
|
|
33
|
-
|
|
34
|
-
export declare function installedRel(rel: string): string | null;
|
|
42
|
+
export { installedRel };
|
|
35
43
|
interface RewriteCtx {
|
|
36
44
|
reg: Registry;
|
|
37
45
|
targetAbs: string;
|
|
@@ -50,4 +58,3 @@ export declare function rewriteImports(content: string, ctx: RewriteCtx): string
|
|
|
50
58
|
export declare function diffSummary(before: string, after: string): string;
|
|
51
59
|
/** Run `add`. Returns the process exit code. */
|
|
52
60
|
export declare function runAdd(opts: AddOptions, reg: Registry, io: AddIO, cwd: string): number;
|
|
53
|
-
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `graph8-sdk brand` (and the brand flags of `create`): give a generated app its own name, colour and logo, and
|
|
3
|
+
* white-label every graph8 link-out in its blocks.
|
|
4
|
+
*
|
|
5
|
+
* - g8.config.ts `export const brand = { name, appUrl, linkLabel, logo }`, read by the app shell
|
|
6
|
+
* (name, logo) and, through <BrandProvider>, by every block (link-out label and URL)
|
|
7
|
+
* - app/globals.css a generated region with --brand, --brand-foreground, --brand-50..900 and --primary,
|
|
8
|
+
* light and dark, each foreground checked for WCAG AA (4.5:1) and adjusted if needed
|
|
9
|
+
* - public/brand/ the logo, copied
|
|
10
|
+
*
|
|
11
|
+
* Every write is a marker region or a whole file the CLI owns, so running it again with the same input changes
|
|
12
|
+
* nothing. Node only; no new dependencies.
|
|
13
|
+
*/
|
|
14
|
+
export type Rgb = [number, number, number];
|
|
15
|
+
/** `#abc` / `#aabbcc` (any case, `#` optional) -> `#aabbcc`, or null. */
|
|
16
|
+
export declare function normalizeHex(input: string): string | null;
|
|
17
|
+
export declare function hexToRgb(hex: string): Rgb;
|
|
18
|
+
export declare function rgbToHex([r, g, b]: Rgb): string;
|
|
19
|
+
/** WCAG 2 relative luminance. */
|
|
20
|
+
export declare function luminance(hex: string): number;
|
|
21
|
+
/** WCAG 2 contrast ratio, 1 to 21. */
|
|
22
|
+
export declare function contrast(a: string, b: string): number;
|
|
23
|
+
/** Mix `hex` toward `toward` by `amount` (0 keeps hex, 1 gives toward), in sRGB. */
|
|
24
|
+
export declare function mix(hex: string, toward: string, amount: number): string;
|
|
25
|
+
/** The app's canvases and ink (templates/next-app/app/globals.css). */
|
|
26
|
+
export declare const CANVAS: {
|
|
27
|
+
readonly light: "#ffffff";
|
|
28
|
+
readonly dark: "#111110";
|
|
29
|
+
};
|
|
30
|
+
export declare const INK: {
|
|
31
|
+
readonly light: "#16140f";
|
|
32
|
+
readonly dark: "#f2efe9";
|
|
33
|
+
};
|
|
34
|
+
/** WCAG AA: 4.5:1 for text on the brand colour; 3:1 for the brand colour against the canvas (UI components). */
|
|
35
|
+
export declare const AA_TEXT = 4.5;
|
|
36
|
+
export declare const AA_UI = 3;
|
|
37
|
+
export interface BrandSwatch {
|
|
38
|
+
/** The brand colour as used (adjusted when the input could not carry readable text). */
|
|
39
|
+
brand: string;
|
|
40
|
+
/** Text on the brand colour: always at least 4.5:1 against `brand`. */
|
|
41
|
+
foreground: string;
|
|
42
|
+
/** 50..900 tints and shades; 500 is `brand`. */
|
|
43
|
+
scale: Record<string, string>;
|
|
44
|
+
/** brand against the canvas. */
|
|
45
|
+
canvasContrast: number;
|
|
46
|
+
}
|
|
47
|
+
export interface BrandTheme {
|
|
48
|
+
light: BrandSwatch;
|
|
49
|
+
dark: BrandSwatch;
|
|
50
|
+
/** What was adjusted or is worth knowing, for the CLI to print. */
|
|
51
|
+
notes: string[];
|
|
52
|
+
}
|
|
53
|
+
/** Light and dark swatches from a brand colour (and an optional explicit dark one). Throws on a bad hex. */
|
|
54
|
+
export declare function brandTheme(color: string, darkColor?: string): BrandTheme;
|
|
55
|
+
export declare const CSS_START = "/* graph8:brand:start */";
|
|
56
|
+
export declare const CSS_END = "/* graph8:brand:end */";
|
|
57
|
+
/** The generated CSS region (markers included). */
|
|
58
|
+
export declare function brandCss(theme: BrandTheme, source: {
|
|
59
|
+
color: string;
|
|
60
|
+
dark?: string;
|
|
61
|
+
}): string;
|
|
62
|
+
/** `css` with the brand region replaced, or appended (after the app's own token blocks, so it wins). */
|
|
63
|
+
export declare function applyCssRegion(css: string, region: string): string;
|
|
64
|
+
export interface BrandFields {
|
|
65
|
+
name: string;
|
|
66
|
+
appUrl: string;
|
|
67
|
+
linkLabel: string;
|
|
68
|
+
logo?: string;
|
|
69
|
+
}
|
|
70
|
+
export declare const DEFAULT_FIELDS: Omit<BrandFields, "name">;
|
|
71
|
+
export declare const CONFIG_FILE = "g8.config.ts";
|
|
72
|
+
/** The whole g8.config.ts a created app starts with. */
|
|
73
|
+
export declare function renderBrandConfig(f: BrandFields): string;
|
|
74
|
+
/** The values in a g8.config.ts region (best effort), or null when the file has no region. */
|
|
75
|
+
export declare function readBrandConfig(source: string): Partial<BrandFields> | null;
|
|
76
|
+
/** The config with its region rewritten, or null when the user owns the file (no markers). */
|
|
77
|
+
export declare function applyBrandConfig(source: string, f: BrandFields): string | null;
|
|
78
|
+
export declare const BRAND_USAGE = "Usage: npx @graph8/sdk brand [options]\n\nBrand an app made by `create` (run it in the app's root). Every option is optional; values you leave out stay.\n --name <text> the app's name (sidebar, page title)\n --brand-color <hex> primary colour, e.g. \"#0f62fe\": writes --brand, a 50-900 scale and --primary into\n app/globals.css, with button text checked for WCAG AA (adjusted when needed)\n --dark-brand-color <hex> the colour in dark mode (default: derived from --brand-color, lightened if too dark)\n --logo <path> an svg, png, jpg, webp or gif (max 512 KB), copied to public/brand/ and shown in the sidebar\n --app-url <url> white-label: where link-outs go (default https://app.graph8.com)\n --link-label <text> white-label: what the platform is called in copy and links (default graph8)\n --from-org fill in what you did not pass from the organization's Brand Kit (needs G8_API_KEY in the\n environment or .env.local): name, primary colour, logo. Running brand with no options\n does the same when the kit has something. Values you pass always win; they replace what the app has now.\n --no-org-brand never read the Brand Kit\n --dir <path> the app's root (default: current directory)\n --dry-run print what would change, write nothing\nRunning it again with the same options changes nothing.";
|
|
79
|
+
export interface BrandOptions {
|
|
80
|
+
dir: string;
|
|
81
|
+
name?: string;
|
|
82
|
+
color?: string;
|
|
83
|
+
darkColor?: string;
|
|
84
|
+
logo?: string;
|
|
85
|
+
appUrl?: string;
|
|
86
|
+
linkLabel?: string;
|
|
87
|
+
dryRun?: boolean;
|
|
88
|
+
/** `--from-org`, or a bare `brand`: fill the gaps from the org's Brand Kit. */
|
|
89
|
+
fromOrg?: boolean;
|
|
90
|
+
/** `--no-org-brand`. */
|
|
91
|
+
noOrgBrand?: boolean;
|
|
92
|
+
}
|
|
93
|
+
/** The brand flags (shared with `create`). Returns true when `argv[i]` was one; `next()` consumes its value. */
|
|
94
|
+
export declare function takeBrandFlag(o: Partial<BrandOptions>, flag: string, next: () => string): boolean;
|
|
95
|
+
export declare function hasBrandInput(o: Partial<BrandOptions>): boolean;
|
|
96
|
+
export declare function parseBrandArgs(argv: string[]): BrandOptions;
|
|
97
|
+
export declare const LOGO_TYPES: string[];
|
|
98
|
+
export declare const MAX_LOGO_BYTES: number;
|
|
99
|
+
export type OrgBrandValues = Pick<BrandOptions, "name" | "color" | "logo">;
|
|
100
|
+
/** Explicit options win per field; org values fill only what the user left out. */
|
|
101
|
+
export declare function mergeOrgBrand<T extends Partial<BrandOptions>>(explicit: T | undefined, org: OrgBrandValues, skip?: {
|
|
102
|
+
name?: boolean;
|
|
103
|
+
}): T;
|
|
104
|
+
export interface BrandIO {
|
|
105
|
+
out: (line: string) => void;
|
|
106
|
+
err: (line: string) => void;
|
|
107
|
+
}
|
|
108
|
+
interface Planned {
|
|
109
|
+
rel: string;
|
|
110
|
+
content: string | Buffer | null;
|
|
111
|
+
note?: string;
|
|
112
|
+
}
|
|
113
|
+
/** Why these brand options cannot be applied, or null. `create` checks this before it writes anything. */
|
|
114
|
+
export declare function brandProblem(o: Omit<BrandOptions, "dir">, cwd: string): string | null;
|
|
115
|
+
/** Plan every write `brand` makes. Pure apart from reading files. */
|
|
116
|
+
export declare function planBrand(o: BrandOptions, root: string, cwd: string, fallbackName?: string): {
|
|
117
|
+
files: Planned[];
|
|
118
|
+
notes: string[];
|
|
119
|
+
};
|
|
120
|
+
/** Run `brand`. Returns the exit code. */
|
|
121
|
+
export declare function runBrand(given: BrandOptions, io: BrandIO, cwd: string, fallbackName?: string, org?: OrgBrandValues): number;
|
|
122
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Screens as routes: which pages and sidebar entries an app gets for a set of blocks.
|
|
3
|
+
*
|
|
4
|
+
* A block declares them in `block.json` `screens` (optional). Without it they are derived from the
|
|
5
|
+
* components named `<Name>Screen` (`ContactsScreen` -> `/contacts`, "Contacts"). A block with no Screen at all
|
|
6
|
+
* falls back to its first component that needs no props, the way stacks always did, and `fallback` marks it so
|
|
7
|
+
* `create` and `doctor` can warn. Used by `create --blocks`, `add` (inside a created app) and `doctor`.
|
|
8
|
+
*
|
|
9
|
+
* Node only. Reads block sources (to find which components take required props); writes nothing.
|
|
10
|
+
*/
|
|
11
|
+
import { type Block, type Registry, type Stack } from "./registry";
|
|
12
|
+
export interface ResolvedScreen {
|
|
13
|
+
block: string;
|
|
14
|
+
component: string;
|
|
15
|
+
/** Unique across the app once passed through `composeNav`. */
|
|
16
|
+
path: string;
|
|
17
|
+
label: string;
|
|
18
|
+
icon: string;
|
|
19
|
+
group: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
/** True when the block ships no `*Screen`: this is its first component that needs no props. */
|
|
22
|
+
fallback: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** lucide-react icon per block id (all verified to exist by the test suite); a screen can override it. */
|
|
25
|
+
export declare const BLOCK_ICONS: Record<string, string>;
|
|
26
|
+
export declare const FALLBACK_ICON = "LayoutGrid";
|
|
27
|
+
/**
|
|
28
|
+
* Whether the component can render with no props. Conservative: anything it cannot read (an imported props type,
|
|
29
|
+
* a re-export, an unusual signature) counts as "needs props", so a fallback never picks a component that would crash.
|
|
30
|
+
*/
|
|
31
|
+
export declare function takesNoRequiredProps(source: string, name: string): boolean;
|
|
32
|
+
/** The screens of one block (declared, else derived, else the no-props fallback). Never throws on odd manifests. */
|
|
33
|
+
export declare function screensOf(block: Block): ResolvedScreen[];
|
|
34
|
+
/** True when the block ships a finished screen (declared or a `*Screen` component), not just the fallback. */
|
|
35
|
+
export declare const hasRealScreen: (block: Block) => boolean;
|
|
36
|
+
export interface ComposeOptions {
|
|
37
|
+
/** Include the (no-`Screen`) fallback pages of dependency blocks too. Default false. */
|
|
38
|
+
withDepsScreens?: boolean;
|
|
39
|
+
/** Include no dependency screens at all. Default false. */
|
|
40
|
+
noDepsScreens?: boolean;
|
|
41
|
+
title?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface Composed {
|
|
44
|
+
stack: Stack;
|
|
45
|
+
screens: ResolvedScreen[];
|
|
46
|
+
/** Plain-language problems the person should know about (blocks with only a fallback page, none at all). */
|
|
47
|
+
warnings: string[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The app for `ids`: requested blocks first (in the order given), then the screens of their dependencies that are
|
|
51
|
+
* user-facing. `home` is the analytics screen when there is one, else the first screen.
|
|
52
|
+
*/
|
|
53
|
+
export declare function composeApp(reg: Registry, ids: string[], opts?: ComposeOptions): Composed;
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* Node only. Reads `templates/next-app/**` (shipped in the package) and the
|
|
8
8
|
* block registry; writes only inside `<dir>`.
|
|
9
9
|
*/
|
|
10
|
+
import { type OrgBrandValues, type BrandOptions } from "./brand";
|
|
10
11
|
import { type AddIO, type PackageManager } from "./add";
|
|
12
|
+
import { componentImportPath, navParts, navUsesExtras, pageFileFor, render } from "./navfile";
|
|
11
13
|
import { type Registry, type Stack, type StackNav } from "./registry";
|
|
12
|
-
export declare const CREATE_USAGE = "Usage: npx @graph8/sdk create <stack> <dir> [options]\n\nScaffold a Next.js (App Router, TypeScript, Tailwind CSS v4) app for a stack and\ninstall the stack's blocks into it. Run `graph8-sdk list` to see the stacks.\n --package-manager <npm|pnpm|yarn|bun> default: the one running the command, else npm\n --no-install write the files and blocks, do not install dependencies\n --dry-run print what would be written, write and install nothing\n --force allow a non-empty <dir> (template files are overwritten, and graph8.json\n is reset: blocks you added to that app earlier are no longer recorded)\nThen:
|
|
14
|
+
export declare const CREATE_USAGE = "Usage: npx @graph8/sdk create <stack> <dir> [options]\n\nScaffold a Next.js (App Router, TypeScript, Tailwind CSS v4) app for a stack and\ninstall the stack's blocks into it. Run `graph8-sdk list` to see the stacks.\n --package-manager <npm|pnpm|yarn|bun> default: the one running the command, else npm\n --no-install write the files and blocks, do not install dependencies\n --dry-run print what would be written, write and install nothing\n --force allow a non-empty <dir> (template files are overwritten, and graph8.json\n is reset: blocks you added to that app earlier are no longer recorded)\nThen: `npm run dev` in <dir>, open http://localhost:3000 and paste a graph8 API key (local preview), and run\n`npx @graph8/sdk doctor --stack <stack>` (add --production before going live).\n\nOr pick the features yourself, for any app (also: `create custom --blocks ...`):\n npx @graph8/sdk create --blocks <id,id,...> [--title \"Acme CRM\"] <dir> [options]\nEvery requested block's dependencies come with it. The app gets one route and one sidebar entry per finished\nScreen of the requested blocks, plus the user-facing Screens of their dependencies (asking for deals also gives\nyou crm's screens). `/` opens the analytics screen if you asked for one, else the first screen.\n --title <text> the app's name (default: graph8 app)\n --with-deps-screens also add the plain fallback page of dependency blocks that have no Screen\n --no-deps-screens add screens only for the blocks you named\nRun `graph8-sdk list` to see each block and which have Screens.\n\nBrand it (any stack or --blocks; the same as running `graph8-sdk brand` in the new app afterwards):\n --name <text> the app's name (with --blocks, the same as --title)\n --brand-color <hex> primary colour, AA-checked; --dark-brand-color <hex> for dark mode\n --logo <path> svg/png/jpg/webp/gif, shown in the sidebar\n --app-url <url> white-label: where \"Open in graph8\" links go; --link-label <text>: what they call it\nWith a graph8 API key (G8_API_KEY in the environment or .env.local) the org's Brand Kit fills in what you did not\npass: the app name, the primary colour and the logo (downloaded into public/brand/). No key, no kit or an error:\nthe default look, one info line, never a failure. --no-org-brand skips it.\nA directory literally named `custom` would read as the alias: pass `--blocks crm ./custom`.";
|
|
13
15
|
export interface CreateOptions {
|
|
14
16
|
stack: string;
|
|
15
17
|
dir: string;
|
|
@@ -17,8 +19,27 @@ export interface CreateOptions {
|
|
|
17
19
|
install: boolean;
|
|
18
20
|
dryRun: boolean;
|
|
19
21
|
force: boolean;
|
|
22
|
+
/** `create --blocks a,b`: a custom app from these blocks instead of a named stack (`stack` is then "custom"). */
|
|
23
|
+
blocks?: string[];
|
|
24
|
+
title?: string;
|
|
25
|
+
/** Dependency-block screens: `default` (their finished Screens), `with` (plus fallback pages) or `none`. */
|
|
26
|
+
depsScreens?: "default" | "with" | "none";
|
|
27
|
+
/** `--name`, `--brand-color`, `--logo`, ...: applied with `graph8-sdk brand` once the app is written. */
|
|
28
|
+
brand?: Omit<BrandOptions, "dir" | "dryRun">;
|
|
29
|
+
/** false with `--no-org-brand`: do not pull the org's Brand Kit. */
|
|
30
|
+
orgBrand?: false;
|
|
20
31
|
}
|
|
21
32
|
export declare function parseCreateArgs(argv: string[]): CreateOptions;
|
|
33
|
+
/** What `graph8.json` records about a custom app, so `add` and `doctor` know its routes. */
|
|
34
|
+
export interface AppRecord {
|
|
35
|
+
title: string;
|
|
36
|
+
blocks: string[];
|
|
37
|
+
screens: {
|
|
38
|
+
block: string;
|
|
39
|
+
component: string;
|
|
40
|
+
path: string;
|
|
41
|
+
}[];
|
|
42
|
+
}
|
|
22
43
|
export interface CreateIO extends AddIO {
|
|
23
44
|
/** Directory holding `next-app/` (the package's `templates/`). */
|
|
24
45
|
templatesRoot: string;
|
|
@@ -26,35 +47,21 @@ export interface CreateIO extends AddIO {
|
|
|
26
47
|
sdkPackageJson?: string;
|
|
27
48
|
/** npm_config_user_agent, to default the package manager. */
|
|
28
49
|
userAgent?: string;
|
|
50
|
+
/** Name, colour and logo pulled from the org's Brand Kit (see orgBrand.ts); explicit brand flags win. */
|
|
51
|
+
orgBrand?: OrgBrandValues;
|
|
29
52
|
}
|
|
30
53
|
export declare function packageManagerFromUserAgent(ua: string | undefined): PackageManager;
|
|
31
54
|
/** A valid npm package name from a directory name. */
|
|
32
55
|
export declare function appNameFor(dir: string): string;
|
|
33
|
-
/** Replace `{{key}}`; a placeholder with no value is a template bug, not something to ship. */
|
|
34
|
-
export declare function render(template: string, vars: Record<string, string>): string;
|
|
35
56
|
interface OutFile {
|
|
36
57
|
rel: string;
|
|
37
58
|
content: string;
|
|
38
59
|
}
|
|
39
|
-
/** Route file for a nav path: `/` -> app/page.tsx, `/a/b` -> app/a/b/page.tsx. */
|
|
40
|
-
export declare function pageFileFor(navPath: string): string;
|
|
41
60
|
/** Why this stack cannot be scaffolded, or null. */
|
|
42
61
|
export declare function stackProblem(reg: Registry, stack: Stack): string | null;
|
|
43
62
|
/** Absolute path of a nav entry's hand-written page template, or null when it uses the generic route page. */
|
|
44
63
|
export declare function stackPageFile(reg: Registry, stack: Stack, n: StackNav): string | null;
|
|
45
|
-
|
|
46
|
-
export declare function navUsesExtras(stack: Stack): boolean;
|
|
47
|
-
/**
|
|
48
|
-
* The three pieces of `lib/nav.ts`. A stack that uses none of the optional nav fields gets exactly the
|
|
49
|
-
* plain `{ label, path }[]` file it always did; otherwise a typed `NavItem[]` whose icons are real
|
|
50
|
-
* lucide-react imports (only the ones used).
|
|
51
|
-
*/
|
|
52
|
-
export declare function navParts(stack: Stack): {
|
|
53
|
-
navImports: string;
|
|
54
|
-
navType: string;
|
|
55
|
-
navJson: string;
|
|
56
|
-
};
|
|
57
|
-
export declare function planCreate(reg: Registry, stack: Stack, appName: string, pm: PackageManager, io: CreateIO): OutFile[];
|
|
64
|
+
export declare function planCreate(reg: Registry, stack: Stack, appName: string, pm: PackageManager, io: CreateIO, app?: AppRecord): OutFile[];
|
|
58
65
|
/** Run `create`. Returns the process exit code. */
|
|
59
|
-
export declare function runCreate(
|
|
60
|
-
export {};
|
|
66
|
+
export declare function runCreate(given: CreateOptions, reg: Registry, io: CreateIO, cwd: string): number;
|
|
67
|
+
export { componentImportPath, navParts, navUsesExtras, pageFileFor, render };
|
|
@@ -7,12 +7,16 @@
|
|
|
7
7
|
* never printed, not even in an error.
|
|
8
8
|
*/
|
|
9
9
|
import { type Registry } from "./registry";
|
|
10
|
-
export declare const DOCTOR_USAGE = "Usage: npx @graph8/sdk doctor [--stack <id>] [--blocks a,b] [--dir <path>] [--strict]\n\nCheck that this project is ready for graph8 blocks:\n - G8_API_KEY (env or .env.local) is valid\n - the key's scopes cover the blocks you chose\n - the organization's subscription is active\n - a checklist of in-app setup each block needs\nWith --stack it also lists \"Flows\": block components that no page of the stack reaches\n(a warning; --strict makes them fail the run).\nWith no --stack/--blocks, the blocks recorded in graph8.json are checked.\nOptional G8_API_URL points at a non-default API. Exit code 0 when all checks\npass, 1 otherwise.";
|
|
10
|
+
export declare const DOCTOR_USAGE = "Usage: npx @graph8/sdk doctor [--stack <id>] [--blocks a,b] [--dir <path>] [--strict] [--production] [--fix-prefixes]\n\nCheck that this project is ready for graph8 blocks:\n - G8_API_KEY (env or .env.local) is valid\n - the key's scopes cover the blocks you chose\n - the organization's subscription is active\n - a checklist of in-app setup each block needs\nWith --stack it also lists \"Flows\": block components that no page of the stack reaches\n(a warning; --strict makes them fail the run).\nWith no --stack/--blocks, the blocks recorded in graph8.json are checked.\nIt also reads the proxy route (app/api/g8/[...path]/route.ts) and warns about what is left before going live:\n --production fail instead: no `authorize` (local preview would be the only gate), no allowedPrefixes,\n or a dangerouslyAllow* switch on; and the key must come from the environment\n --fix-prefixes rewrite the route's generated allowedPrefixes from the installed blocks (graph8.json), then exit\n (no network). A route written before 0.367.0 is upgraded only if its list is still the default.\nOptional G8_API_URL points at a non-default API. Exit code 0 when all checks\npass, 1 otherwise.";
|
|
11
11
|
export interface DoctorOptions {
|
|
12
12
|
stack?: string;
|
|
13
13
|
blocks: string[];
|
|
14
14
|
dir: string;
|
|
15
15
|
strict?: boolean;
|
|
16
|
+
/** Going-live gate: route problems fail the run instead of warning. */
|
|
17
|
+
production?: boolean;
|
|
18
|
+
/** Rewrite the route's generated allowedPrefixes and exit. */
|
|
19
|
+
fixPrefixes?: boolean;
|
|
16
20
|
}
|
|
17
21
|
export declare function parseDoctorArgs(argv: string[]): DoctorOptions;
|
|
18
22
|
export interface DoctorIO {
|
|
@@ -21,6 +25,7 @@ export interface DoctorIO {
|
|
|
21
25
|
env: Record<string, string | undefined>;
|
|
22
26
|
fetch?: typeof fetch;
|
|
23
27
|
}
|
|
28
|
+
export declare function readSetting(name: string, root: string, env: DoctorIO["env"]): string | undefined;
|
|
24
29
|
/** Same rules as the server's `key_has_scope`. */
|
|
25
30
|
export declare function scopeGranted(granted: string[], required: string): boolean;
|
|
26
31
|
/** Run doctor. Returns the exit code: 0 when every check passes. */
|
|
@@ -14,7 +14,13 @@ export interface UnreachedComponent {
|
|
|
14
14
|
component: string;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Library blocks hold shared building blocks that other blocks import, not pages of their own: the foundation's shared
|
|
18
|
+
* UI and the pickers. A stack installs them whole but each screen uses only some, so they are never "unreached".
|
|
19
|
+
* Every other block is judged component by component.
|
|
20
|
+
*/
|
|
21
|
+
export declare const LIBRARY_BLOCKS: ReadonlySet<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Components of the stack's own blocks (library blocks are exempt) that no
|
|
18
24
|
* generated page reaches, directly or through a Screen that imports them.
|
|
19
25
|
*/
|
|
20
26
|
export declare function unreachedComponents(reg: Registry, stack: Stack): UnreachedComponent[];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pieces of a created app that `create` and `add` both write: route page files, `lib/nav.ts` and
|
|
3
|
+
* template rendering. Shared so a screen added later looks exactly like one generated up front.
|
|
4
|
+
*/
|
|
5
|
+
import type { Block, Stack } from "./registry";
|
|
6
|
+
/** Replace `{{key}}`; a placeholder with no value is a template bug, not something to ship. */
|
|
7
|
+
export declare function render(template: string, vars: Record<string, string>): string;
|
|
8
|
+
/** Route file for a nav path: `/` -> app/page.tsx, `/a/b` -> app/a/b/page.tsx. */
|
|
9
|
+
export declare function pageFileFor(navPath: string): string;
|
|
10
|
+
export declare function componentImportPath(block: Block, file: string): string;
|
|
11
|
+
/** The nav fields `lib/nav.ts` carries. */
|
|
12
|
+
export interface NavEntry {
|
|
13
|
+
label: string;
|
|
14
|
+
path: string;
|
|
15
|
+
icon?: string;
|
|
16
|
+
group?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
}
|
|
19
|
+
/** True when any nav entry uses `icon`, `group` or `description`. */
|
|
20
|
+
export declare function navUsesExtras(nav: NavEntry[]): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The three pieces of `lib/nav.ts`. A stack that uses none of the optional nav fields gets exactly the
|
|
23
|
+
* plain `{ label, path }[]` file it always did; otherwise a typed `NavItem[]` whose icons are real
|
|
24
|
+
* lucide-react imports (only the ones used).
|
|
25
|
+
*/
|
|
26
|
+
export declare function navPartsFor(nav: NavEntry[]): {
|
|
27
|
+
navImports: string;
|
|
28
|
+
navType: string;
|
|
29
|
+
navJson: string;
|
|
30
|
+
};
|
|
31
|
+
export declare function navParts(stack: Stack): {
|
|
32
|
+
navImports: string;
|
|
33
|
+
navType: string;
|
|
34
|
+
navJson: string;
|
|
35
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pull the organization's Brand Kit into a new app: `create` and `brand --from-org`.
|
|
3
|
+
*
|
|
4
|
+
* Reads two Developer API operations with the project's key (the same resolution `doctor` uses: G8_API_KEY from
|
|
5
|
+
* the environment, then .env.local; G8_API_URL for a non-default API):
|
|
6
|
+
* - get_brand_kit_overview_brand_kit_get -> logo_url, design_tokens.colors, source_url (scope campaigns:read)
|
|
7
|
+
* - describe_current_key_me_get -> org_name
|
|
8
|
+
* The kit has ONE logo URL (no light/dark/icon variant), a measured colour palette and fonts, a tagline and voice
|
|
9
|
+
* traits. Only the name, the primary colour and the logo map onto the brand inputs; fonts, tagline and voice have no
|
|
10
|
+
* SDK brand input and are ignored.
|
|
11
|
+
*
|
|
12
|
+
* Never fails the caller: no key, a 4xx/5xx, a network error, a timeout or an empty kit all give `{}` plus one info
|
|
13
|
+
* line. The key is never printed or written. The logo is downloaded to a temp file (https or data: URL, an image type,
|
|
14
|
+
* at most 512 KB) so `brand` copies it into public/brand/ like any `--logo` file: nothing is hot-linked.
|
|
15
|
+
*/
|
|
16
|
+
import { mergeOrgBrand, type OrgBrandValues } from "./brand";
|
|
17
|
+
export { mergeOrgBrand, type OrgBrandValues };
|
|
18
|
+
export interface OrgBrandPull {
|
|
19
|
+
values: OrgBrandValues;
|
|
20
|
+
/** One line for the CLI to print. */
|
|
21
|
+
info: string;
|
|
22
|
+
/** Remove the temp logo file. */
|
|
23
|
+
cleanup: () => void;
|
|
24
|
+
}
|
|
25
|
+
export interface OrgBrandIO {
|
|
26
|
+
env: Record<string, string | undefined>;
|
|
27
|
+
fetch?: typeof fetch;
|
|
28
|
+
}
|
|
29
|
+
/** The primary colour of the kit's measured tokens, or null. */
|
|
30
|
+
export declare function pickColor(tokens: unknown): string | null;
|
|
31
|
+
/** A display name that is safe to write into generated files. */
|
|
32
|
+
export declare function cleanName(v: unknown): string | null;
|
|
33
|
+
/** Pull name, primary colour and logo from the org's Brand Kit. Never throws. */
|
|
34
|
+
export declare function pullOrgBrand(io: OrgBrandIO, root: string): Promise<OrgBrandPull>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Tiny path helpers shared by `add`, `create` and the screen wiring (kept free of imports to avoid cycles). */
|
|
2
|
+
export declare const posix: (p: string) => string;
|
|
3
|
+
/** Where a file at `rel` (inside the block dir) lands, relative to the block's install dir. */
|
|
4
|
+
export declare function installedRel(rel: string): string | null;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The proxy route's `allowedPrefixes`, derived instead of hand-written: the first path segment of every contract
|
|
3
|
+
* operation the installed blocks declare (`GET /contacts/{id}` -> "contacts"). Never wider than what the blocks
|
|
4
|
+
* declare. `create` and `add` write them between two marker comments in `app/api/g8/[...path]/route.ts`;
|
|
5
|
+
* `doctor --fix-prefixes` rewrites them; `doctor` reads the route to say what is still open before going live.
|
|
6
|
+
*
|
|
7
|
+
* Pure string functions (no file system), so they are easy to test.
|
|
8
|
+
*/
|
|
9
|
+
import type { Block } from "./registry";
|
|
10
|
+
export declare const PREFIX_START = "// graph8:allowed-prefixes:start";
|
|
11
|
+
export declare const PREFIX_END = "// graph8:allowed-prefixes:end";
|
|
12
|
+
/** "contacts" for `/contacts/{id}`; null for an unknown operation or a path that starts with a parameter. */
|
|
13
|
+
export declare function prefixOf(operationId: string): string | null;
|
|
14
|
+
/** Sorted, distinct prefixes of every operation the blocks declare. */
|
|
15
|
+
export declare function derivePrefixes(blocks: readonly Pick<Block, "operations">[]): string[];
|
|
16
|
+
/** `["a", "b", ...]` wrapped at about 110 columns, as the TypeScript expression of the generated line. */
|
|
17
|
+
export declare function formatPrefixes(prefixes: readonly string[]): string;
|
|
18
|
+
/** The generated region, markers included. */
|
|
19
|
+
export declare function prefixRegion(prefixes: readonly string[]): string;
|
|
20
|
+
/** True when the route file has the generated region. */
|
|
21
|
+
export declare function hasPrefixRegion(source: string): boolean;
|
|
22
|
+
/** The route with its generated region replaced, or null when it has no region (the user owns the list). */
|
|
23
|
+
export declare function applyPrefixes(source: string, prefixes: readonly string[]): string | null;
|
|
24
|
+
/** A pre-0.367 route whose allowedPrefixes line is still the untouched `undefined` default, upgraded to a region. */
|
|
25
|
+
export declare function upgradeLegacyRoute(source: string, prefixes: readonly string[]): string | null;
|
|
26
|
+
export interface RouteFacts {
|
|
27
|
+
/** `authorize` is set (not commented out). */
|
|
28
|
+
authorize: boolean;
|
|
29
|
+
localPreview: boolean;
|
|
30
|
+
dangerouslyAllowUnauthenticated: boolean;
|
|
31
|
+
dangerouslyAllowAllPaths: boolean;
|
|
32
|
+
/** The literal list, undefined when it is `undefined`, "custom" when it is not a literal list. */
|
|
33
|
+
prefixes: string[] | undefined | "custom";
|
|
34
|
+
generated: boolean;
|
|
35
|
+
}
|
|
36
|
+
/** What a route file configures, read from its source (best effort, for `doctor`). */
|
|
37
|
+
export declare function inspectRoute(source: string): RouteFacts;
|
|
@@ -38,6 +38,21 @@ export interface BlockPrerequisite {
|
|
|
38
38
|
where: "app" | "api";
|
|
39
39
|
verify?: string;
|
|
40
40
|
}
|
|
41
|
+
/** Optional `block.json` `screens` entry: how a finished screen appears as a route and a sidebar entry in a created app. */
|
|
42
|
+
export interface BlockScreen {
|
|
43
|
+
/** A component of this block. */
|
|
44
|
+
component: string;
|
|
45
|
+
/** Route path (`/contacts`). Must be static; made unique across an app by prefixing the block id. */
|
|
46
|
+
path: string;
|
|
47
|
+
label: string;
|
|
48
|
+
/** lucide-react export name. */
|
|
49
|
+
icon?: string;
|
|
50
|
+
/** Sidebar section (default: the block title). */
|
|
51
|
+
group?: string;
|
|
52
|
+
description?: string;
|
|
53
|
+
/** Sort position inside the block (lower first). */
|
|
54
|
+
order?: number;
|
|
55
|
+
}
|
|
41
56
|
export interface BlockManifest {
|
|
42
57
|
id: string;
|
|
43
58
|
title: string;
|
|
@@ -46,6 +61,8 @@ export interface BlockManifest {
|
|
|
46
61
|
dependsOn: string[];
|
|
47
62
|
operations: string[];
|
|
48
63
|
components: BlockComponent[];
|
|
64
|
+
/** Optional route metadata; absent means derive it from the components named `*Screen`. */
|
|
65
|
+
screens?: BlockScreen[];
|
|
49
66
|
hooks: BlockHook[];
|
|
50
67
|
lib: {
|
|
51
68
|
file: string;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `graph8-sdk add <block>` inside an app that `create` made: give the new block's finished screens a route and a
|
|
3
|
+
* sidebar entry too, so the app the person asked for keeps working as they grow it.
|
|
4
|
+
*
|
|
5
|
+
* Idempotent and conservative: a page whose content differs from what we would generate is never touched (the
|
|
6
|
+
* person edited it), a nav entry for an existing path is never duplicated, and a `lib/nav.ts` we cannot read
|
|
7
|
+
* back (hand-edited beyond the generated shape) is left alone with the entries printed instead.
|
|
8
|
+
*
|
|
9
|
+
* Node only. Pure planning: returns the files to write; the caller prints and writes them.
|
|
10
|
+
*/
|
|
11
|
+
import { type NavEntry } from "./navfile";
|
|
12
|
+
import type { Block, Registry } from "./registry";
|
|
13
|
+
export interface WiredFile {
|
|
14
|
+
rel: string;
|
|
15
|
+
content: string;
|
|
16
|
+
action: "create" | "update" | "unchanged";
|
|
17
|
+
}
|
|
18
|
+
export interface ScreenWiring {
|
|
19
|
+
files: WiredFile[];
|
|
20
|
+
/** Plain lines to print after the file list ("kept your edited app/x/page.tsx", manual nav entries). */
|
|
21
|
+
notes: string[];
|
|
22
|
+
/** Screens now recorded in graph8.json (existing ones are not repeated). */
|
|
23
|
+
screens: {
|
|
24
|
+
block: string;
|
|
25
|
+
component: string;
|
|
26
|
+
path: string;
|
|
27
|
+
}[];
|
|
28
|
+
/** True when an icon import was written, so `lucide-react` must be installed. */
|
|
29
|
+
usesIcons: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface WireInput {
|
|
32
|
+
reg: Registry;
|
|
33
|
+
root: string;
|
|
34
|
+
/** Install directory relative to the project root (`components/g8`). */
|
|
35
|
+
target: string;
|
|
36
|
+
/** Blocks to wire, dependencies first; the last one is the block the person asked for. */
|
|
37
|
+
blocks: Block[];
|
|
38
|
+
templatesRoot: string;
|
|
39
|
+
/** The ledger's stack id, written into the generated page comment ("custom" for `create --blocks` apps). */
|
|
40
|
+
stackId: string;
|
|
41
|
+
/** Screens already recorded in graph8.json, to stay idempotent. */
|
|
42
|
+
recorded: {
|
|
43
|
+
block: string;
|
|
44
|
+
component: string;
|
|
45
|
+
path: string;
|
|
46
|
+
}[];
|
|
47
|
+
}
|
|
48
|
+
/** Parse the generated `lib/nav.ts` back into entries, or null when it is not in the generated shape. */
|
|
49
|
+
export declare function parseNavFile(text: string): {
|
|
50
|
+
header: string;
|
|
51
|
+
items: NavEntry[];
|
|
52
|
+
} | null;
|
|
53
|
+
export declare function planScreenWiring(input: WireInput): ScreenWiring | null;
|
package/dist/types/cli.d.ts
CHANGED
|
@@ -4,10 +4,13 @@
|
|
|
4
4
|
* npx @graph8/sdk init-agent [--claude] [--codex] [--cursor] [--dry-run]
|
|
5
5
|
* npx @graph8/sdk list | search <text> | add <block>[/<Component>] | doctor
|
|
6
6
|
* npx @graph8/sdk create <stack> <dir>
|
|
7
|
+
* npx @graph8/sdk create --blocks <ids> [--title "Acme CRM"] <dir>
|
|
8
|
+
* npx @graph8/sdk brand [--name "Acme"] [--brand-color "#0f62fe"] [--logo ./logo.svg] [--app-url ...] [--link-label ...]
|
|
7
9
|
*
|
|
8
10
|
* Node only. Built as a separate entry (dist/cli.js), so nothing here reaches
|
|
9
11
|
* the browser bundle or the package's main exports.
|
|
10
12
|
*/
|
|
13
|
+
import type { OrgBrandValues } from "./blocks/brand";
|
|
11
14
|
export interface CliIO {
|
|
12
15
|
cwd: string;
|
|
13
16
|
out: (line: string) => void;
|
|
@@ -24,6 +27,8 @@ export interface CliIO {
|
|
|
24
27
|
env?: Record<string, string | undefined>;
|
|
25
28
|
/** fetch for `doctor`. Default: global fetch. */
|
|
26
29
|
fetch?: typeof fetch;
|
|
30
|
+
/** Name, colour and logo pulled from the org's Brand Kit by `runCliAsync` for `create` and `brand`. */
|
|
31
|
+
orgBrand?: OrgBrandValues;
|
|
27
32
|
}
|
|
28
33
|
export declare function runCli(argv: string[], io: CliIO): number;
|
|
29
34
|
/** Like `runCli`, plus the commands that talk to the network (`doctor`). */
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `G8Error`: the one error class every graph8 call throws (server SDK and the browser block client).
|
|
3
|
+
*
|
|
4
|
+
* It lives in its own tiny entry, `@graph8/sdk/errors`, so browser code that only needs the error class
|
|
5
|
+
* (the blocks' `g8-client`, `ApiError`) does not pull the whole SDK into a page bundle.
|
|
6
|
+
*
|
|
7
|
+
* One identity everywhere: the class is registered on `globalThis` under a well-known symbol, and the
|
|
8
|
+
* first copy loaded wins. `@graph8/sdk` and `@graph8/sdk/errors` are separate bundles with their own copy
|
|
9
|
+
* of this file, so without the registry `err instanceof G8Error` would depend on which entry created the
|
|
10
|
+
* error. With it, both entries export the very same class.
|
|
11
|
+
*/
|
|
12
|
+
declare class G8ErrorClass extends Error {
|
|
13
|
+
readonly status: number;
|
|
14
|
+
readonly type: string;
|
|
15
|
+
readonly code?: string;
|
|
16
|
+
readonly requestId?: string;
|
|
17
|
+
readonly detail?: unknown;
|
|
18
|
+
/** True when the failure class is transient (429/5xx/network). */
|
|
19
|
+
readonly retryable: boolean;
|
|
20
|
+
constructor(args: {
|
|
21
|
+
message: string;
|
|
22
|
+
status: number;
|
|
23
|
+
type: string;
|
|
24
|
+
code?: string;
|
|
25
|
+
requestId?: string;
|
|
26
|
+
detail?: unknown;
|
|
27
|
+
retryable?: boolean;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/** Thrown on any failed graph8 call: `status`, `type`, `code`, `requestId`, `detail`, `retryable`. */
|
|
31
|
+
export declare const G8Error: typeof G8ErrorClass;
|
|
32
|
+
export type G8Error = G8ErrorClass;
|
|
33
|
+
export {};
|
package/dist/types/http.d.ts
CHANGED
|
@@ -18,24 +18,8 @@
|
|
|
18
18
|
* `fetch` and `sleep` are injectable so the retry/backoff logic is
|
|
19
19
|
* deterministically unit-testable without real timers or network.
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
readonly type: string;
|
|
24
|
-
readonly code?: string;
|
|
25
|
-
readonly requestId?: string;
|
|
26
|
-
readonly detail?: unknown;
|
|
27
|
-
/** True when the failure class is transient (429/5xx/network). */
|
|
28
|
-
readonly retryable: boolean;
|
|
29
|
-
constructor(args: {
|
|
30
|
-
message: string;
|
|
31
|
-
status: number;
|
|
32
|
-
type: string;
|
|
33
|
-
code?: string;
|
|
34
|
-
requestId?: string;
|
|
35
|
-
detail?: unknown;
|
|
36
|
-
retryable?: boolean;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
21
|
+
import { G8Error } from "./errors";
|
|
22
|
+
export { G8Error };
|
|
39
23
|
/** 429 and 5xx are the transient classes worth retrying. */
|
|
40
24
|
export declare function isRetryableStatus(status: number): boolean;
|
|
41
25
|
/**
|