@adminide-stack/yantra-mobile 12.0.166 → 12.0.167
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/assets/kinds/character.webp +0 -0
- package/lib/assets/kinds/image.webp +0 -0
- package/lib/assets/kinds/video.webp +0 -0
- package/lib/assets/kinds/website.webp +0 -0
- package/lib/bridge/handlers/NavigationBridgeHandler.js +3 -2
- package/lib/bridge/handlers/NavigationBridgeHandler.js.map +1 -1
- package/lib/components/CustomDrawer.js +6 -2
- package/lib/components/CustomDrawer.js.map +1 -1
- package/lib/features/agent-chat/NativeAgentChat.js +17 -3
- package/lib/features/agent-chat/NativeAgentChat.js.map +1 -1
- package/lib/features/chat/ApprovalCard.js +8 -2
- package/lib/features/chat/ApprovalCard.js.map +1 -1
- package/lib/features/chat/AskUserCard.js +5 -3
- package/lib/features/chat/AskUserCard.js.map +1 -1
- package/lib/features/chat/ComposerModeSwitch.js +147 -0
- package/lib/features/chat/ComposerModeSwitch.js.map +1 -0
- package/lib/features/templates/__tests__/buildKinds.test.ts +54 -0
- package/lib/features/templates/__tests__/buildTemplateCards.test.ts +58 -6
- package/lib/features/templates/__tests__/templateSuggestion.test.ts +30 -0
- package/lib/features/templates/buildKinds.js +114 -0
- package/lib/features/templates/buildKinds.js.map +1 -0
- package/lib/features/templates/buildKinds.ts +189 -0
- package/lib/features/templates/buildTemplateCards.js +63 -18
- package/lib/features/templates/buildTemplateCards.js.map +1 -1
- package/lib/features/templates/buildTemplateCards.ts +88 -18
- package/lib/features/templates/index.ts +2 -0
- package/lib/features/templates/templateSuggestion.js +34 -0
- package/lib/features/templates/templateSuggestion.js.map +1 -0
- package/lib/features/templates/templateSuggestion.ts +57 -0
- package/lib/features/webbuilder/WebBuilderExperience.js +188 -28
- package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -1
- package/lib/features/webbuilder/approvalsLink.js +6 -0
- package/lib/features/webbuilder/approvalsLink.js.map +1 -0
- package/lib/features/webbuilder/buildFragments.js +19 -4
- package/lib/features/webbuilder/buildFragments.js.map +1 -1
- package/lib/features/webbuilder/components/CloudSheet.js +18 -5
- package/lib/features/webbuilder/components/CloudSheet.js.map +1 -1
- package/lib/features/webbuilder/components/CodeView.js +7 -3
- package/lib/features/webbuilder/components/CodeView.js.map +1 -1
- package/lib/features/webbuilder/components/DomainFinder.js +263 -0
- package/lib/features/webbuilder/components/DomainFinder.js.map +1 -0
- package/lib/features/webbuilder/components/DraftsSheet.js +298 -0
- package/lib/features/webbuilder/components/DraftsSheet.js.map +1 -0
- package/lib/features/webbuilder/components/ImageEditPanel.js +266 -0
- package/lib/features/webbuilder/components/ImageEditPanel.js.map +1 -0
- package/lib/features/webbuilder/components/MentionMenu.js +155 -0
- package/lib/features/webbuilder/components/MentionMenu.js.map +1 -0
- package/lib/features/webbuilder/components/NotesSheet.js +138 -0
- package/lib/features/webbuilder/components/NotesSheet.js.map +1 -0
- package/lib/features/webbuilder/components/PreviewFrame.js.map +1 -1
- package/lib/features/webbuilder/components/ProjectChat.js +17 -3
- package/lib/features/webbuilder/components/ProjectChat.js.map +1 -1
- package/lib/features/webbuilder/components/PublishSheet.js +200 -15
- package/lib/features/webbuilder/components/PublishSheet.js.map +1 -1
- package/lib/features/webbuilder/components/ShareSheet.js +48 -6
- package/lib/features/webbuilder/components/ShareSheet.js.map +1 -1
- package/lib/features/webbuilder/components/SiteCopyProgress.js +169 -0
- package/lib/features/webbuilder/components/SiteCopyProgress.js.map +1 -0
- package/lib/features/webbuilder/components/SiteStatusSheet.js +145 -2
- package/lib/features/webbuilder/components/SiteStatusSheet.js.map +1 -1
- package/lib/features/webbuilder/drafts.js +167 -0
- package/lib/features/webbuilder/drafts.js.map +1 -0
- package/lib/features/webbuilder/maskPng.js +113 -0
- package/lib/features/webbuilder/maskPng.js.map +1 -0
- package/lib/features/webbuilder/previewProbe.js.map +1 -1
- package/lib/features/webbuilder/stepLabels.js +21 -1
- package/lib/features/webbuilder/stepLabels.js.map +1 -1
- package/lib/features/webbuilder/web/chat/mentions.js +106 -0
- package/lib/features/webbuilder/web/chat/mentions.js.map +1 -0
- package/lib/features/webbuilder/web/chat/siteCopy.js +121 -0
- package/lib/features/webbuilder/web/chat/siteCopy.js.map +1 -0
- package/lib/features/webbuilder/web/code/imageEdit.js +30 -0
- package/lib/features/webbuilder/web/code/imageEdit.js.map +1 -0
- package/lib/features/webbuilder/web/design/linkedDesign.js +26 -0
- package/lib/features/webbuilder/web/design/linkedDesign.js.map +1 -0
- package/lib/features/webbuilder/web/project/buildLink.js +3 -0
- package/lib/features/webbuilder/web/project/buildLink.js.map +1 -0
- package/lib/features/webbuilder/web/project/drafts.js +57 -0
- package/lib/features/webbuilder/web/project/drafts.js.map +1 -0
- package/lib/features/webbuilder/web/project/navHistory.js +7 -0
- package/lib/features/webbuilder/web/project/navHistory.js.map +1 -0
- package/lib/features/webbuilder/web/project/serverSettings.js +15 -4
- package/lib/features/webbuilder/web/project/serverSettings.js.map +1 -1
- package/lib/features/webbuilder/web/publish/domainShop.js +79 -0
- package/lib/features/webbuilder/web/publish/domainShop.js.map +1 -0
- package/lib/features/webbuilder/web/publish/publishRequest.js +11 -0
- package/lib/features/webbuilder/web/publish/publishRequest.js.map +1 -0
- package/lib/features/webbuilder/web/publish/review/freshness.js +13 -0
- package/lib/features/webbuilder/web/publish/review/freshness.js.map +1 -0
- package/lib/features/webbuilder/web/publish/review/ignores.js +94 -0
- package/lib/features/webbuilder/web/publish/review/ignores.js.map +1 -0
- package/lib/features/webbuilder/web/publish/review/seo.js +230 -0
- package/lib/features/webbuilder/web/publish/review/seo.js.map +1 -0
- package/lib/features/webbuilder/web/publish/siteHealth.js +27 -3
- package/lib/features/webbuilder/web/publish/siteHealth.js.map +1 -1
- package/lib/features/webbuilder/web/publish/siteInsights.js +120 -3
- package/lib/features/webbuilder/web/publish/siteInsights.js.map +1 -1
- package/lib/features/webbuilder/web/sharing/shareLink.js +9 -0
- package/lib/features/webbuilder/web/sharing/shareLink.js.map +1 -0
- package/lib/features/webbuilder/web/webServices.js +1 -1
- package/lib/features/webbuilder/web/webServices.js.map +1 -1
- package/lib/hooks/useMarketplaceTemplateCards.js +3 -4
- package/lib/hooks/useMarketplaceTemplateCards.js.map +1 -1
- package/lib/hooks/useMarketplaceTemplateGroups.js +12 -5
- package/lib/hooks/useMarketplaceTemplateGroups.js.map +1 -1
- package/lib/hooks/useTemplatesResourceUri.js +12 -0
- package/lib/hooks/useTemplatesResourceUri.js.map +1 -0
- package/lib/screens/Chat/index.js +4 -22
- package/lib/screens/Chat/index.js.map +1 -1
- package/lib/screens/Home/HomeScreen.js +165 -179
- package/lib/screens/Home/HomeScreen.js.map +1 -1
- package/lib/screens/Home/components/BuildKindPicker.js +248 -0
- package/lib/screens/Home/components/BuildKindPicker.js.map +1 -0
- package/lib/screens/Home/components/BuildTemplatesSection.js +556 -117
- package/lib/screens/Home/components/BuildTemplatesSection.js.map +1 -1
- package/lib/screens/Home/components/KindThumb.js +444 -0
- package/lib/screens/Home/components/KindThumb.js.map +1 -0
- package/lib/screens/Home/components/TemplateSuggestionBanner.js +73 -0
- package/lib/screens/Home/components/TemplateSuggestionBanner.js.map +1 -0
- package/lib/screens/Home/components/buildTheme.js +68 -0
- package/lib/screens/Home/components/buildTheme.js.map +1 -0
- package/lib/screens/WebBuilder/index.js +11 -1
- package/lib/screens/WebBuilder/index.js.map +1 -1
- package/lib/screens/WebBuilder/nativeWebBuilderRedirect.js +55 -0
- package/lib/screens/WebBuilder/nativeWebBuilderRedirect.js.map +1 -0
- package/lib/screens/WebBuilderNative/codeWorkspaceApi.js +4 -0
- package/lib/screens/WebBuilderNative/codeWorkspaceApi.js.map +1 -1
- package/lib/screens/WebBuilderNative/index.js +31 -4
- package/lib/screens/WebBuilderNative/index.js.map +1 -1
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js +1 -0
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
- package/lib/screens/WebBuilderNative/webbuilderTransport.js +5 -5
- package/lib/screens/WebBuilderNative/webbuilderTransport.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webServices.js","sources":["../../../../src/features/webbuilder/web/webServices.ts"],"sourcesContent":["/**\n * The web panels' services on the phone: Secrets (`secrets/secretsApi`), Cloud (`data/dataApi`) and\n * Integrations (web `integrations/useIntegrationsService`), built from the web's own modules over the\n * host's GraphQL seam. Each call is the web's request, unchanged. Pure (no React).\n */\nimport { createDataService, type WebBuilderDataService } from './data/dataApi';\nimport type { GraphqlTransport } from './data/graphql';\nimport { createSecretsService, type WebBuilderSecretsService } from './secrets/secretsApi';\nimport { SecretsCredentialStore } from './secrets/secretsStore';\nimport {\n API_KEY_CONNECT,\n INTEGRATION_CATALOG_QUERY,\n INTEGRATION_CREDENTIALS_QUERY,\n checkApiKey,\n connectorConnectUrl,\n parseCatalog,\n parseCredentials,\n withBuiltInEntries,\n type IntegrationCatalogEntry,\n type IntegrationCredential,\n} from './integrations/catalog';\nimport {\n appTokenStatusFromNames,\n createAppSecretsAdapter,\n mintAndStoreAppToken,\n type AppSecretsAdapter,\n type AppTokenStatus,\n} from './integrations/appToken';\nimport { enableSiteBilling } from './integrations/siteBilling';\nimport { disableSiteMail, enableSiteMail, siteMailStatus } from './integrations/siteMail';\nimport { createSharingService, type WebBuilderSharingService } from './sharing/sharingApi';\nimport {\n PROJECT_SETTINGS_QUERY,\n parseServerProjectSettings,\n type ProjectIntegration,\n type ServerProjectSettings,\n} from './project/serverSettings';\n\nexport interface WebScope {\n orgName: string;\n projectId: string;\n environmentTagId: string;\n}\n\n/** The agent a published site calls (`YANTRA_AGENT_URL`), as the web's hosted agent. */\nexport const SITE_AGENT_URL = 'https://cdecli-agent.cdebase.dev';\n\n/** surface-kit `connectApiKeyConnector`'s request: the connector entry plus the key, recorded `active`. */\nconst CREATE_CUSTOM_CONNECTOR = `\n mutation CreateCustomConnectorExtension($input: CreateCustomConnectorExtensionInput!) {\n createCustomConnectorExtension(input: $input) {\n success message credentialId authorizationUrl connectorType\n }\n }`;\n\nfunction credentialSafeName(raw: string): string {\n return (\n raw\n .replace(/[^A-Za-z0-9 _-]+/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim() || 'Credential'\n );\n}\n\nfunction newUuid(): string {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = Math.floor(Math.random() * 16);\n return (c === 'x' ? r : (r % 4) + 8).toString(16);\n });\n}\n\n/** surface-kit `buildCustomConnectorInput` for an api_key connector (the fields Stripe sends). */\nfunction apiKeyConnectorInput(\n connectorId: string,\n spec: (typeof API_KEY_CONNECT)[string],\n key: string,\n scope: WebScope,\n): Record<string, unknown> {\n const name = credentialSafeName(`${spec.label} web builder`);\n return {\n name,\n description: `Custom connector for ${connectorId}`,\n extensionUuid: newUuid(),\n orgName: scope.orgName,\n projectId: scope.projectId,\n environmentTag: scope.environmentTagId,\n publisher: scope.orgName,\n connectorType: 'app',\n provider: {\n id: connectorId,\n name,\n title: name,\n description: `${spec.label} credential`,\n baseUrl: spec.baseUrl,\n providerUrl: '',\n logo: '',\n categories: ['other'],\n category: 'other',\n authMethods: ['api_key'],\n authorizationUrl: '',\n tokenUrl: '',\n revocationUrl: '',\n mcpUrl: '',\n scopes: '',\n clientAuthMethod: 'client_secret_post',\n useBasicAuth: false,\n useCustomOAuthEndpoints: false,\n usePKCE: false,\n color: '',\n iconName: 'AiOutlineApi',\n iconFontSize: 'large',\n enabled: true,\n fields: [\n {\n defaultValue: '',\n description: '',\n enumValues: '',\n genericType: 'api_key',\n iconType: '',\n isConfigField: true,\n isSecret: true,\n label: spec.field.label,\n name: spec.field.name,\n placeholder: '',\n placement: 'none',\n placementKey: '',\n readOnly: false,\n required: false,\n scope: 4,\n secretKey: spec.field.secretKey,\n secretType: 'ENVIRONMENT_VAR',\n type: 'string',\n uiWidget: 'password',\n },\n ],\n },\n values: { authMethod: 'api_key', [spec.field.name]: key.trim() },\n };\n}\n\n/** A project as the web services read it. */\nexport interface WebProjectRef {\n channelId: string;\n projectId?: string | null;\n sandboxId?: string | null;\n templateId?: string | null;\n}\n\nexport interface WebIntegrationsService {\n loadCatalog: () => Promise<IntegrationCatalogEntry[]>;\n /** The person's connections in this workspace; null when they can't be read. */\n loadConnections: () => Promise<IntegrationCredential[] | null>;\n connectUrl: (connectorId: string) => string | null;\n /** The project's saved integrations (server settings); null when they can't be read. */\n projectIntegrations: (channelId: string) => Promise<ProjectIntegration[] | null>;\n appTokenStatus: (project: WebProjectRef) => Promise<AppTokenStatus>;\n createAppToken: (project: WebProjectRef) => Promise<{ ok: boolean; message?: string }>;\n enableSiteBilling: (\n project: WebProjectRef,\n stripeCredentialId: string,\n ) => Promise<{ ok: boolean; message?: string }>;\n connectApiKey: (connectorId: string, key: string) => Promise<{ ok: boolean; message?: string }>;\n siteMail: {\n enable: (project: WebProjectRef, domain: string, notifyTo: string) => ReturnType<typeof enableSiteMail>;\n status: (project: WebProjectRef, diagnose?: boolean) => ReturnType<typeof siteMailStatus>;\n disable: (project: WebProjectRef) => ReturnType<typeof disableSiteMail>;\n };\n}\n\nexport interface WebServices {\n data: WebBuilderDataService;\n secrets: WebBuilderSecretsService;\n appSecrets: AppSecretsAdapter;\n integrations: WebIntegrationsService;\n sharing: WebBuilderSharingService;\n /** The project's server settings (integrations, GitHub sync, database…); null when unreadable. */\n serverSettings: (channelId: string) => Promise<ServerProjectSettings | null>;\n}\n\nexport function createWebServices(opts: {\n transport: GraphqlTransport;\n scope: () => WebScope;\n appUrl?: string;\n}): WebServices {\n const { transport, scope } = opts;\n const data = createDataService(transport);\n const secrets = createSecretsService({\n transport,\n data,\n store: new SecretsCredentialStore(null),\n scope: () => {\n const s = scope();\n return { orgName: s.orgName, project: s.projectId };\n },\n });\n const appSecrets = createAppSecretsAdapter(secrets);\n // The web helpers type `errors` as a plain array; the seam's is read-only (same values).\n const gql = <T>(query: string, variables: Record<string, unknown>) =>\n transport.mutate<T>(query, variables) as Promise<{ data?: T; errors?: Array<{ message: string }> }>;\n /** The project's secrets credential is recorded on its settings (web `settingsSync.update`). */\n const keepCredential = async (channelId: string, credentialId?: string | null) => {\n if (!credentialId) return;\n const s = await data.getSettings(channelId);\n if (s.ok && s.value?.secretsCredentialId !== credentialId) {\n await data.updateSettings(channelId, { secretsCredentialId: credentialId });\n }\n };\n let catalog: Promise<IntegrationCatalogEntry[]> | null = null;\n\n const integrations: WebIntegrationsService = {\n loadCatalog: async () => {\n if (!catalog) {\n catalog = transport\n .query<{ integrationConnectors?: unknown }>(INTEGRATION_CATALOG_QUERY, {})\n .then((r) => {\n if (r.errors?.length && !r.data?.integrationConnectors) {\n catalog = null;\n throw new Error(r.errors[0].message || \"Couldn't load the integrations.\");\n }\n return withBuiltInEntries(parseCatalog(r.data?.integrationConnectors));\n });\n }\n return catalog;\n },\n loadConnections: async () => {\n const s = scope();\n if (!s.orgName || !s.projectId) return null;\n const r = await transport.query<{ formBuilderCredentials?: { data?: unknown } }>(\n INTEGRATION_CREDENTIALS_QUERY,\n {\n filter: {\n orgName: s.orgName,\n projectId: s.projectId,\n ...(s.environmentTagId ? { environmentTag: s.environmentTagId } : {}),\n },\n limit: 200,\n },\n );\n if (r.errors?.length && !r.data?.formBuilderCredentials) return null;\n return parseCredentials(r.data?.formBuilderCredentials?.data);\n },\n connectUrl: (connectorId) =>\n opts.appUrl ? connectorConnectUrl(opts.appUrl, connectorId, scope().projectId) : null,\n projectIntegrations: async (channelId) => {\n const r = await transport.query<{ aiCodeProjectSettings?: unknown }>(PROJECT_SETTINGS_QUERY, { channelId });\n if (r.errors?.length && r.data?.aiCodeProjectSettings === undefined) return null;\n return parseServerProjectSettings(r.data?.aiCodeProjectSettings)?.integrations ?? [];\n },\n appTokenStatus: async (project) => {\n if (!project.channelId) return 'unavailable';\n try {\n return appTokenStatusFromNames(\n await appSecrets.listSecretNames({\n channelId: project.channelId,\n projectId: project.projectId ?? undefined,\n }),\n );\n } catch {\n return 'unavailable';\n }\n },\n createAppToken: async (project) => {\n if (!project.channelId) return { ok: false, message: 'Open a project first.' };\n const r = await mintAndStoreAppToken({\n channelId: project.channelId,\n projectId: project.projectId ?? undefined,\n scope: scope(),\n agentUrl: SITE_AGENT_URL,\n secrets: appSecrets,\n gql,\n });\n // The web's result union, read without narrowing (native: no strict null checks).\n const minted = r as { ok: boolean; credentialId?: string; warning?: string; message?: string };\n if (!minted.ok) return { ok: false, message: minted.message };\n await keepCredential(project.channelId, minted.credentialId);\n return minted.warning ? { ok: true, message: minted.warning } : { ok: true };\n },\n enableSiteBilling: async (project, stripeCredentialId) => {\n if (!project.channelId) return { ok: false, message: 'Open a project first.' };\n const r = await enableSiteBilling({\n channelId: project.channelId,\n projectId: project.projectId ?? undefined,\n stripeCredentialId,\n secrets: appSecrets,\n gql,\n });\n const billed = r as { ok: boolean; credentialId?: string; message?: string };\n if (billed.ok) await keepCredential(project.channelId, billed.credentialId);\n return billed.ok ? { ok: true } : { ok: false, message: billed.message };\n },\n connectApiKey: async (connectorId, key) => {\n const spec = API_KEY_CONNECT[connectorId];\n if (!spec || !checkApiKey(connectorId, key).ok) {\n return { ok: false, message: `That doesn't look like a ${spec?.label ?? ''} secret key.` };\n }\n const s = scope();\n if (!s.orgName || !s.projectId || !s.environmentTagId) {\n return {\n ok: false,\n message: \"Can't tell which workspace to save the key in. Sign in again, then retry.\",\n };\n }\n const r = await transport.mutate<{\n createCustomConnectorExtension?: { credentialId?: string; message?: string };\n }>(CREATE_CUSTOM_CONNECTOR, { input: apiKeyConnectorInput(connectorId, spec, key, s) });\n const created = r.data?.createCustomConnectorExtension;\n if (!created?.credentialId) {\n return {\n ok: false,\n message: created?.message || r.errors?.[0]?.message || `${spec.label} couldn't be connected.`,\n };\n }\n return { ok: true };\n },\n siteMail: {\n enable: async (project, domain, notifyTo) => {\n const r = await enableSiteMail({\n channelId: project.channelId,\n projectId: project.projectId ?? undefined,\n domain,\n notifyTo,\n secrets: appSecrets,\n gql,\n });\n const mailed = r as { ok: boolean; credentialId?: string };\n if (mailed.ok) await keepCredential(project.channelId, mailed.credentialId);\n return r;\n },\n status: (project, diagnose) => siteMailStatus(gql, project.channelId, diagnose),\n disable: (project) => disableSiteMail(gql, project.channelId),\n },\n };\n\n // The web's sharing calls take one document runner: a mutation goes out as one, the rest as queries.\n const sharing = createSharingService((document, variables) =>\n /^\\s*mutation\\b/.test(document) ? transport.mutate(document, variables) : transport.query(document, variables),\n );\n\n const serverSettings = async (channelId: string) => {\n const r = await transport.query<{ aiCodeProjectSettings?: unknown }>(PROJECT_SETTINGS_QUERY, { channelId });\n if (r.errors?.length && r.data?.aiCodeProjectSettings === undefined) return null;\n return parseServerProjectSettings(r.data?.aiCodeProjectSettings);\n };\n\n return { data, secrets, appSecrets, integrations, sharing, serverSettings };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAsBO,MAAM,cAAiB,GAAA;AAG9B,MAAM,uBAA0B,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAAA,CAAA;AAMhC,SAAS,mBAAmB,GAAqB,EAAA;AAC/C,EAAO,OAAA,GAAA,CAAI,OAAQ,CAAA,mBAAA,EAAqB,GAAG,CAAA,CAAE,QAAQ,MAAQ,EAAA,GAAG,CAAE,CAAA,IAAA,EAAU,IAAA,YAAA;AAC9E;AACA,SAAS,OAAkB,GAAA;AACzB,EAAO,OAAA,sCAAA,CAAuC,OAAQ,CAAA,OAAA,EAAS,CAAK,CAAA,KAAA;AAClE,IAAA,MAAM,IAAI,IAAK,CAAA,KAAA,CAAM,IAAK,CAAA,MAAA,KAAW,EAAE,CAAA;AACvC,IAAA,OAAA,CAAQ,MAAM,GAAM,GAAA,CAAA,GAAI,IAAI,CAAI,GAAA,CAAA,EAAG,SAAS,EAAE,CAAA;AAAA,GAC/C,CAAA;AACH;AAGA,SAAS,oBAAqB,CAAA,WAAA,EAAqB,IAAwC,EAAA,GAAA,EAAa,KAA0C,EAAA;AAChJ,E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AU,oBAAqB,CAAA,CAAC,UAAU,SAAc,KAAA,gBAAA,CAAiB,KAAK,QAAQ,CAAA,GAAI,SAAU,CAAA,MAAA,CAAO,UAAU,SAAS,CAAA,GAAI,UAAU,KAAM,CAAA,QAAA,EAAU,SAAS,CAAC,CAAA;AAC5K,EAAM,MAAA,cAAA,GAAiB,OAAO,SAAsB,KAAA;AAxWtD,IAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA;AAyWI,IAAA,MAAM,CAAI,GAAA,MAAM,SAAU,CAAA,KAAA,CAEvB,sBAAwB,EAAA;AAAA,MACzB;AAAA,KACD,CAAA;AACD,IAAI,IAAA,CAAA,CAAA,EAAA,GAAA,CAAA,CAAE,WAAF,IAAU,GAAA,MAAA,GAAA,EAAA,CAAA,MAAA,KAAA,CAAA,CAAU,OAAE,IAAF,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAAQ,qBAA0B,MAAA,MAAA,EAAkB,OAAA,IAAA;AAC5E,IAAA,OAAO,0BAA2B,CAAA,CAAA,EAAA,GAAA,CAAA,CAAE,IAAF,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAAQ,qBAAqB,CAAA;AAAA,GACjE;AACA,EAAO,OAAA;AAAA,IACL,IAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,IACA,YAAA;AAAA,IACA,OAAA;AAAA,IACA;AAAA,GACF;AACF"}
|
|
1
|
+
{"version":3,"file":"webServices.js","sources":["../../../../src/features/webbuilder/web/webServices.ts"],"sourcesContent":["/**\n * The web panels' services on the phone: Secrets (`secrets/secretsApi`), Cloud (`data/dataApi`) and\n * Integrations (web `integrations/useIntegrationsService`), built from the web's own modules over the\n * host's GraphQL seam. Each call is the web's request, unchanged. Pure (no React).\n */\nimport { createDataService, type WebBuilderDataService } from './data/dataApi';\nimport type { GraphqlTransport } from './data/graphql';\nimport { createSecretsService, type WebBuilderSecretsService } from './secrets/secretsApi';\nimport { SecretsCredentialStore } from './secrets/secretsStore';\nimport {\n API_KEY_CONNECT,\n INTEGRATION_CATALOG_QUERY,\n INTEGRATION_CREDENTIALS_QUERY,\n checkApiKey,\n connectorConnectUrl,\n parseCatalog,\n parseCredentials,\n withBuiltInEntries,\n type IntegrationCatalogEntry,\n type IntegrationCredential,\n} from './integrations/catalog';\nimport {\n appTokenStatusFromNames,\n createAppSecretsAdapter,\n mintAndStoreAppToken,\n type AppSecretsAdapter,\n type AppTokenStatus,\n} from './integrations/appToken';\nimport { enableSiteBilling } from './integrations/siteBilling';\nimport { disableSiteMail, enableSiteMail, siteMailStatus } from './integrations/siteMail';\nimport { createSharingService, type WebBuilderSharingService } from './sharing/sharingApi';\nimport {\n PROJECT_SETTINGS_QUERY,\n parseServerProjectSettings,\n type ProjectIntegration,\n type ServerProjectSettings,\n} from './project/serverSettings';\n\nexport interface WebScope {\n orgName: string;\n projectId: string;\n environmentTagId: string;\n}\n\n/**\n * The agent a published site calls (`YANTRA_AGENT_URL`) when the host names none. The host passes the\n * agent of its own plane (web 0.10.1: prod must never fall back to the dev agent).\n */\nexport const SITE_AGENT_URL = 'https://cdecli-agent.cdebase.dev';\n\n/** surface-kit `connectApiKeyConnector`'s request: the connector entry plus the key, recorded `active`. */\nconst CREATE_CUSTOM_CONNECTOR = `\n mutation CreateCustomConnectorExtension($input: CreateCustomConnectorExtensionInput!) {\n createCustomConnectorExtension(input: $input) {\n success message credentialId authorizationUrl connectorType\n }\n }`;\n\nfunction credentialSafeName(raw: string): string {\n return (\n raw\n .replace(/[^A-Za-z0-9 _-]+/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim() || 'Credential'\n );\n}\n\nfunction newUuid(): string {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = Math.floor(Math.random() * 16);\n return (c === 'x' ? r : (r % 4) + 8).toString(16);\n });\n}\n\n/** surface-kit `buildCustomConnectorInput` for an api_key connector (the fields Stripe sends). */\nfunction apiKeyConnectorInput(\n connectorId: string,\n spec: (typeof API_KEY_CONNECT)[string],\n key: string,\n scope: WebScope,\n): Record<string, unknown> {\n const name = credentialSafeName(`${spec.label} web builder`);\n return {\n name,\n description: `Custom connector for ${connectorId}`,\n extensionUuid: newUuid(),\n orgName: scope.orgName,\n projectId: scope.projectId,\n environmentTag: scope.environmentTagId,\n publisher: scope.orgName,\n connectorType: 'app',\n provider: {\n id: connectorId,\n name,\n title: name,\n description: `${spec.label} credential`,\n baseUrl: spec.baseUrl,\n providerUrl: '',\n logo: '',\n categories: ['other'],\n category: 'other',\n authMethods: ['api_key'],\n authorizationUrl: '',\n tokenUrl: '',\n revocationUrl: '',\n mcpUrl: '',\n scopes: '',\n clientAuthMethod: 'client_secret_post',\n useBasicAuth: false,\n useCustomOAuthEndpoints: false,\n usePKCE: false,\n color: '',\n iconName: 'AiOutlineApi',\n iconFontSize: 'large',\n enabled: true,\n fields: [\n {\n defaultValue: '',\n description: '',\n enumValues: '',\n genericType: 'api_key',\n iconType: '',\n isConfigField: true,\n isSecret: true,\n label: spec.field.label,\n name: spec.field.name,\n placeholder: '',\n placement: 'none',\n placementKey: '',\n readOnly: false,\n required: false,\n scope: 4,\n secretKey: spec.field.secretKey,\n secretType: 'ENVIRONMENT_VAR',\n type: 'string',\n uiWidget: 'password',\n },\n ],\n },\n values: { authMethod: 'api_key', [spec.field.name]: key.trim() },\n };\n}\n\n/** A project as the web services read it. */\nexport interface WebProjectRef {\n channelId: string;\n projectId?: string | null;\n sandboxId?: string | null;\n templateId?: string | null;\n}\n\nexport interface WebIntegrationsService {\n loadCatalog: () => Promise<IntegrationCatalogEntry[]>;\n /** The person's connections in this workspace; null when they can't be read. */\n loadConnections: () => Promise<IntegrationCredential[] | null>;\n connectUrl: (connectorId: string) => string | null;\n /** The project's saved integrations (server settings); null when they can't be read. */\n projectIntegrations: (channelId: string) => Promise<ProjectIntegration[] | null>;\n appTokenStatus: (project: WebProjectRef) => Promise<AppTokenStatus>;\n createAppToken: (project: WebProjectRef) => Promise<{ ok: boolean; message?: string }>;\n enableSiteBilling: (\n project: WebProjectRef,\n stripeCredentialId: string,\n ) => Promise<{ ok: boolean; message?: string }>;\n connectApiKey: (connectorId: string, key: string) => Promise<{ ok: boolean; message?: string }>;\n siteMail: {\n enable: (project: WebProjectRef, domain: string, notifyTo: string) => ReturnType<typeof enableSiteMail>;\n status: (project: WebProjectRef, diagnose?: boolean) => ReturnType<typeof siteMailStatus>;\n disable: (project: WebProjectRef) => ReturnType<typeof disableSiteMail>;\n };\n}\n\nexport interface WebServices {\n data: WebBuilderDataService;\n secrets: WebBuilderSecretsService;\n appSecrets: AppSecretsAdapter;\n integrations: WebIntegrationsService;\n sharing: WebBuilderSharingService;\n /** The project's server settings (integrations, GitHub sync, database…); null when unreadable. */\n serverSettings: (channelId: string) => Promise<ServerProjectSettings | null>;\n}\n\nexport function createWebServices(opts: {\n transport: GraphqlTransport;\n scope: () => WebScope;\n appUrl?: string;\n /** The agent of the app's own plane (the build profile's CDECLI_AGENT_ENDPOINT). */\n agentUrl?: string;\n}): WebServices {\n const { transport, scope } = opts;\n const data = createDataService(transport);\n const secrets = createSecretsService({\n transport,\n data,\n store: new SecretsCredentialStore(null),\n scope: () => {\n const s = scope();\n return { orgName: s.orgName, project: s.projectId };\n },\n });\n const appSecrets = createAppSecretsAdapter(secrets);\n // The web helpers type `errors` as a plain array; the seam's is read-only (same values).\n const gql = <T>(query: string, variables: Record<string, unknown>) =>\n transport.mutate<T>(query, variables) as Promise<{ data?: T; errors?: Array<{ message: string }> }>;\n /** The project's secrets credential is recorded on its settings (web `settingsSync.update`). */\n const keepCredential = async (channelId: string, credentialId?: string | null) => {\n if (!credentialId) return;\n const s = await data.getSettings(channelId);\n if (s.ok && s.value?.secretsCredentialId !== credentialId) {\n await data.updateSettings(channelId, { secretsCredentialId: credentialId });\n }\n };\n let catalog: Promise<IntegrationCatalogEntry[]> | null = null;\n\n const integrations: WebIntegrationsService = {\n loadCatalog: async () => {\n if (!catalog) {\n catalog = transport\n .query<{ integrationConnectors?: unknown }>(INTEGRATION_CATALOG_QUERY, {})\n .then((r) => {\n if (r.errors?.length && !r.data?.integrationConnectors) {\n catalog = null;\n throw new Error(r.errors[0].message || \"Couldn't load the integrations.\");\n }\n return withBuiltInEntries(parseCatalog(r.data?.integrationConnectors));\n });\n }\n return catalog;\n },\n loadConnections: async () => {\n const s = scope();\n if (!s.orgName || !s.projectId) return null;\n const r = await transport.query<{ formBuilderCredentials?: { data?: unknown } }>(\n INTEGRATION_CREDENTIALS_QUERY,\n {\n filter: {\n orgName: s.orgName,\n projectId: s.projectId,\n ...(s.environmentTagId ? { environmentTag: s.environmentTagId } : {}),\n },\n limit: 200,\n },\n );\n if (r.errors?.length && !r.data?.formBuilderCredentials) return null;\n return parseCredentials(r.data?.formBuilderCredentials?.data);\n },\n connectUrl: (connectorId) =>\n opts.appUrl ? connectorConnectUrl(opts.appUrl, connectorId, scope().projectId) : null,\n projectIntegrations: async (channelId) => {\n const r = await transport.query<{ aiCodeProjectSettings?: unknown }>(PROJECT_SETTINGS_QUERY, { channelId });\n if (r.errors?.length && r.data?.aiCodeProjectSettings === undefined) return null;\n return parseServerProjectSettings(r.data?.aiCodeProjectSettings)?.integrations ?? [];\n },\n appTokenStatus: async (project) => {\n if (!project.channelId) return 'unavailable';\n try {\n return appTokenStatusFromNames(\n await appSecrets.listSecretNames({\n channelId: project.channelId,\n projectId: project.projectId ?? undefined,\n }),\n );\n } catch {\n return 'unavailable';\n }\n },\n createAppToken: async (project) => {\n if (!project.channelId) return { ok: false, message: 'Open a project first.' };\n const r = await mintAndStoreAppToken({\n channelId: project.channelId,\n projectId: project.projectId ?? undefined,\n scope: scope(),\n agentUrl: opts.agentUrl || SITE_AGENT_URL,\n secrets: appSecrets,\n gql,\n });\n // The web's result union, read without narrowing (native: no strict null checks).\n const minted = r as { ok: boolean; credentialId?: string; warning?: string; message?: string };\n if (!minted.ok) return { ok: false, message: minted.message };\n await keepCredential(project.channelId, minted.credentialId);\n return minted.warning ? { ok: true, message: minted.warning } : { ok: true };\n },\n enableSiteBilling: async (project, stripeCredentialId) => {\n if (!project.channelId) return { ok: false, message: 'Open a project first.' };\n const r = await enableSiteBilling({\n channelId: project.channelId,\n projectId: project.projectId ?? undefined,\n stripeCredentialId,\n secrets: appSecrets,\n gql,\n });\n const billed = r as { ok: boolean; credentialId?: string; message?: string };\n if (billed.ok) await keepCredential(project.channelId, billed.credentialId);\n return billed.ok ? { ok: true } : { ok: false, message: billed.message };\n },\n connectApiKey: async (connectorId, key) => {\n const spec = API_KEY_CONNECT[connectorId];\n if (!spec || !checkApiKey(connectorId, key).ok) {\n return { ok: false, message: `That doesn't look like a ${spec?.label ?? ''} secret key.` };\n }\n const s = scope();\n if (!s.orgName || !s.projectId || !s.environmentTagId) {\n return {\n ok: false,\n message: \"Can't tell which workspace to save the key in. Sign in again, then retry.\",\n };\n }\n const r = await transport.mutate<{\n createCustomConnectorExtension?: { credentialId?: string; message?: string };\n }>(CREATE_CUSTOM_CONNECTOR, { input: apiKeyConnectorInput(connectorId, spec, key, s) });\n const created = r.data?.createCustomConnectorExtension;\n if (!created?.credentialId) {\n return {\n ok: false,\n message: created?.message || r.errors?.[0]?.message || `${spec.label} couldn't be connected.`,\n };\n }\n return { ok: true };\n },\n siteMail: {\n enable: async (project, domain, notifyTo) => {\n const r = await enableSiteMail({\n channelId: project.channelId,\n projectId: project.projectId ?? undefined,\n domain,\n notifyTo,\n secrets: appSecrets,\n gql,\n });\n const mailed = r as { ok: boolean; credentialId?: string };\n if (mailed.ok) await keepCredential(project.channelId, mailed.credentialId);\n return r;\n },\n status: (project, diagnose) => siteMailStatus(gql, project.channelId, diagnose),\n disable: (project) => disableSiteMail(gql, project.channelId),\n },\n };\n\n // The web's sharing calls take one document runner: a mutation goes out as one, the rest as queries.\n const sharing = createSharingService((document, variables) =>\n /^\\s*mutation\\b/.test(document) ? transport.mutate(document, variables) : transport.query(document, variables),\n );\n\n const serverSettings = async (channelId: string) => {\n const r = await transport.query<{ aiCodeProjectSettings?: unknown }>(PROJECT_SETTINGS_QUERY, { channelId });\n if (r.errors?.length && r.data?.aiCodeProjectSettings === undefined) return null;\n return parseServerProjectSettings(r.data?.aiCodeProjectSettings);\n };\n\n return { data, secrets, appSecrets, integrations, sharing, serverSettings };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAyBO,MAAM,cAAiB,GAAA;AAG9B,MAAM,uBAA0B,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAAA,CAAA;AAMhC,SAAS,mBAAmB,GAAqB,EAAA;AAC/C,EAAO,OAAA,GAAA,CAAI,OAAQ,CAAA,mBAAA,EAAqB,GAAG,CAAA,CAAE,QAAQ,MAAQ,EAAA,GAAG,CAAE,CAAA,IAAA,EAAU,IAAA,YAAA;AAC9E;AACA,SAAS,OAAkB,GAAA;AACzB,EAAO,OAAA,sCAAA,CAAuC,OAAQ,CAAA,OAAA,EAAS,CAAK,CAAA,KAAA;AAClE,IAAA,MAAM,IAAI,IAAK,CAAA,KAAA,CAAM,IAAK,CAAA,MAAA,KAAW,EAAE,CAAA;AACvC,IAAA,OAAA,CAAQ,MAAM,GAAM,GAAA,CAAA,GAAI,IAAI,CAAI,GAAA,CAAA,EAAG,SAAS,EAAE,CAAA;AAAA,GAC/C,CAAA;AACH;AAGA,SAAS,oBAAqB,CAAA,WAAA,EAAqB,IAAwC,EAAA,GAAA,EAAa,KAA0C,EAAA;AAChJ,EAAA,MAAM,IAAO,GAAA,kBAAA,CAAmB,CAAG,EAAA,IAAA,CAAK,KAAK,CAAc,YAAA,CAAA,CAAA;AAC3D,EAAO,OAAA;AAAA,IACL,IAAA;AAAA,IACA,WAAA,EAAa,wBAAwB,WAAW,CAAA,CAAA;AAAA,IAChD,eAAe,OAAQ,EAAA;AAAA,IACvB,SAAS,KAAM,CAAA,OAAA;AAAA,IACf,WAAW,KAAM,CAAA,SAAA;AAAA,IACjB,gBAAgB,KAAM,CAAA,gBAAA;AAAA,IACtB,WA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,MAAM,SAAU,CAAA,KAAA,CAEvB,sBAAwB,EAAA;AAAA,MACzB;AAAA,KACD,CAAA;AACD,IAAI,IAAA,CAAA,CAAA,EAAA,GAAA,CAAA,CAAE,WAAF,IAAU,GAAA,MAAA,GAAA,EAAA,CAAA,MAAA,KAAA,CAAA,CAAU,OAAE,IAAF,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAAQ,qBAA0B,MAAA,MAAA,EAAkB,OAAA,IAAA;AAC5E,IAAA,OAAO,0BAA2B,CAAA,CAAA,EAAA,GAAA,CAAA,CAAE,IAAF,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAAQ,qBAAqB,CAAA;AAAA,GACjE;AACA,EAAO,OAAA;AAAA,IACL,IAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,IACA,YAAA;AAAA,IACA,OAAA;AAAA,IACA;AAAA,GACF;AACF"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {useSettings}from'@adminide-stack/platform-client';import {ConfigurationTarget,ContributionSchemaId}from'common';import {useMemo}from'react';import {extractGroupTemplateCards,resolveGroupTemplatesPayload}from'../features/templates/buildTemplateCards.js';import {
|
|
1
|
+
import {useSettings}from'@adminide-stack/platform-client';import {ConfigurationTarget,ContributionSchemaId}from'common';import {useMemo}from'react';import {extractGroupTemplateCards,resolveGroupTemplatesPayload}from'../features/templates/buildTemplateCards.js';import {useTemplatesResourceUri}from'./useTemplatesResourceUri.js';function useMarketplaceTemplateCards({
|
|
2
2
|
group = "",
|
|
3
3
|
orgName,
|
|
4
4
|
enabled = true
|
|
5
5
|
}) {
|
|
6
6
|
const selectedGroup = (group != null ? group : "").trim();
|
|
7
|
-
const
|
|
8
|
-
const canFetch =
|
|
9
|
-
const resourceUri = useMemo(() => canFetch ? settingsUriForOrg(slug) : void 0, [canFetch, slug]);
|
|
7
|
+
const resourceUri = useTemplatesResourceUri(orgName, enabled && Boolean(selectedGroup));
|
|
8
|
+
const canFetch = Boolean(resourceUri);
|
|
10
9
|
const {
|
|
11
10
|
data,
|
|
12
11
|
settings,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMarketplaceTemplateCards.js","sources":["../../src/hooks/useMarketplaceTemplateCards.ts"],"sourcesContent":["import { useSettings } from '@adminide-stack/platform-client';\nimport { ConfigurationTarget, ContributionSchemaId } from 'common';\nimport { useMemo } from 'react';\nimport {\n extractGroupTemplateCards,\n resolveGroupTemplatesPayload,\n type BuildTemplateCard,\n} from '../features/templates/buildTemplateCards';\nimport {
|
|
1
|
+
{"version":3,"file":"useMarketplaceTemplateCards.js","sources":["../../src/hooks/useMarketplaceTemplateCards.ts"],"sourcesContent":["import { useSettings } from '@adminide-stack/platform-client';\nimport { ConfigurationTarget, ContributionSchemaId } from 'common';\nimport { useMemo } from 'react';\nimport {\n extractGroupTemplateCards,\n resolveGroupTemplatesPayload,\n type BuildTemplateCard,\n} from '../features/templates/buildTemplateCards';\nimport { useTemplatesResourceUri } from './useTemplatesResourceUri';\n\nexport type UseMarketplaceTemplateCardsOptions = {\n /** Selected marketplace group key (e.g. `codeAssistant`). */\n group?: string | null;\n orgName?: string | null;\n enabled?: boolean;\n};\n\nexport type UseMarketplaceTemplateCardsReturn = {\n cards: BuildTemplateCard[];\n loading: boolean;\n error: unknown;\n};\n\n/**\n * Cards under `marketplace.templates.<group>` for Build mode — browser\n * `useDefaultFormTemplateCards` parity (includes `snapshotId` for webbuilder remix).\n */\nexport function useMarketplaceTemplateCards({\n group = '',\n orgName,\n enabled = true,\n}: UseMarketplaceTemplateCardsOptions): UseMarketplaceTemplateCardsReturn {\n const selectedGroup = (group ?? '').trim();\n const resourceUri = useTemplatesResourceUri(orgName, enabled && Boolean(selectedGroup));\n const canFetch = Boolean(resourceUri);\n\n const { data, settings, loading, error } = useSettings({\n resourceUri: resourceUri as never,\n skip: !canFetch || !resourceUri,\n options: {\n schemaId: ContributionSchemaId.UiLayout,\n configKey: `marketplace.templates.${selectedGroup}`,\n includeMarketplace: true,\n target: ConfigurationTarget.ORGANIZATION,\n },\n });\n\n // See useMarketplaceTemplateGroups — prefer scoped `data`, fall back to raw settings subtree.\n const payload = data ?? settings;\n\n const cards = useMemo(() => {\n if (!canFetch) return [];\n return extractGroupTemplateCards(resolveGroupTemplatesPayload(payload, selectedGroup));\n }, [canFetch, payload, selectedGroup]);\n\n return {\n cards,\n loading: canFetch ? loading : false,\n error: canFetch ? error : undefined,\n };\n}\n"],"names":[],"mappings":"wUAqBO,SAAS,2BAA4B,CAAA;AAAA,EAC1C,KAAQ,GAAA,EAAA;AAAA,EACR,OAAA;AAAA,EACA,OAAU,GAAA;AACZ,CAA0E,EAAA;AACxE,EAAM,MAAA,aAAA,GAAA,CAAiB,KAAS,IAAA,IAAA,GAAA,KAAA,GAAA,EAAA,EAAI,IAAK,EAAA;AACzC,EAAA,MAAM,cAAc,uBAAwB,CAAA,OAAA,EAAS,OAAW,IAAA,OAAA,CAAQ,aAAa,CAAC,CAAA;AACtF,EAAM,MAAA,QAAA,GAAW,QAAQ,WAAW,CAAA;AACpC,EAAM,MAAA;AAAA,IACJ,IAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,IACA;AAAA,MACE,WAAY,CAAA;AAAA,IACd,WAAA;AAAA,IACA,IAAA,EAAM,CAAC,QAAA,IAAY,CAAC,WAAA;AAAA,IACpB,OAAS,EAAA;AAAA,MACP,UAAU,oBAAqB,CAAA,QAAA;AAAA,MAC/B,SAAA,EAAW,yBAAyB,aAAa,CAAA,CAAA;AAAA,MACjD,kBAAoB,EAAA,IAAA;AAAA,MACpB,QAAQ,mBAAoB,CAAA;AAAA;AAC9B,GACD,CAAA;AAGD,EAAA,MAAM,UAAU,IAAQ,IAAA,IAAA,GAAA,IAAA,GAAA,QAAA;AACxB,EAAM,MAAA,KAAA,GAAQ,QAAQ,MAAM;AAC1B,IAAI,IAAA,CAAC,QAAU,EAAA,OAAO,EAAC;AACvB,IAAA,OAAO,yBAA0B,CAAA,4BAAA,CAA6B,OAAS,EAAA,aAAa,CAAC,CAAA;AAAA,GACpF,EAAA,CAAC,QAAU,EAAA,OAAA,EAAS,aAAa,CAAC,CAAA;AACrC,EAAO,OAAA;AAAA,IACL,KAAA;AAAA,IACA,OAAA,EAAS,WAAW,OAAU,GAAA,KAAA;AAAA,IAC9B,KAAA,EAAO,WAAW,KAAQ,GAAA;AAAA,GAC5B;AACF"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {useSettings}from'@adminide-stack/platform-client';import {ConfigurationTarget,ContributionSchemaId}from'common';import {useMemo
|
|
1
|
+
import {useSettings}from'@adminide-stack/platform-client';import {ConfigurationTarget,ContributionSchemaId}from'common';import {useRef,useMemo}from'react';import {extractMarketplaceTemplateGroups,unwrapSettingsPayload}from'../features/templates/buildTemplateCards.js';import {useTemplatesResourceUri}from'./useTemplatesResourceUri.js';function useMarketplaceTemplateGroups({
|
|
2
2
|
orgName,
|
|
3
3
|
enabled = true
|
|
4
4
|
}) {
|
|
5
|
-
const
|
|
6
|
-
const canFetch =
|
|
7
|
-
const resourceUri = useMemo(() => canFetch ? settingsUriForOrg(slug) : void 0, [canFetch, slug]);
|
|
5
|
+
const resourceUri = useTemplatesResourceUri(orgName, enabled);
|
|
6
|
+
const canFetch = Boolean(resourceUri);
|
|
8
7
|
const {
|
|
9
8
|
data,
|
|
10
9
|
settings,
|
|
@@ -27,10 +26,18 @@ import {useSettings}from'@adminide-stack/platform-client';import {ConfigurationT
|
|
|
27
26
|
const groups = useMemo(() => {
|
|
28
27
|
if (!canFetch) return [];
|
|
29
28
|
const next = extractMarketplaceTemplateGroups(payload);
|
|
29
|
+
if (__DEV__) {
|
|
30
|
+
const raw = unwrapSettingsPayload(payload);
|
|
31
|
+
console.log("[Build] template groups", {
|
|
32
|
+
resource: resourceUri == null ? void 0 : resourceUri.path,
|
|
33
|
+
received: raw ? Object.keys(raw) : null,
|
|
34
|
+
kept: next.map((group) => group.id)
|
|
35
|
+
});
|
|
36
|
+
}
|
|
30
37
|
if (next.length === 0) return groupsRef.current;
|
|
31
38
|
groupsRef.current = next;
|
|
32
39
|
return next;
|
|
33
|
-
}, [canFetch, payload]);
|
|
40
|
+
}, [canFetch, payload, resourceUri]);
|
|
34
41
|
return {
|
|
35
42
|
groups,
|
|
36
43
|
loading: canFetch && loading && groups.length === 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMarketplaceTemplateGroups.js","sources":["../../src/hooks/useMarketplaceTemplateGroups.ts"],"sourcesContent":["import { useSettings } from '@adminide-stack/platform-client';\nimport { ConfigurationTarget, ContributionSchemaId } from 'common';\nimport { useMemo, useRef } from 'react';\nimport {\n extractMarketplaceTemplateGroups,\n type MarketplaceTemplateGroup,\n} from '../features/templates/buildTemplateCards';\nimport {
|
|
1
|
+
{"version":3,"file":"useMarketplaceTemplateGroups.js","sources":["../../src/hooks/useMarketplaceTemplateGroups.ts"],"sourcesContent":["import { useSettings } from '@adminide-stack/platform-client';\nimport { ConfigurationTarget, ContributionSchemaId } from 'common';\nimport { useMemo, useRef } from 'react';\nimport {\n extractMarketplaceTemplateGroups,\n unwrapSettingsPayload,\n type MarketplaceTemplateGroup,\n} from '../features/templates/buildTemplateCards';\nimport { useTemplatesResourceUri } from './useTemplatesResourceUri';\n\nexport type UseMarketplaceTemplateGroupsOptions = {\n orgName?: string | null;\n enabled?: boolean;\n};\n\nexport type UseMarketplaceTemplateGroupsReturn = {\n groups: MarketplaceTemplateGroup[];\n loading: boolean;\n error: unknown;\n};\n\n/**\n * Lists marketplace template groups (`codeAssistant`, `mediaAssistant`, …)\n * for the Build-mode template picker — browser `useTemplates` parity.\n */\nexport function useMarketplaceTemplateGroups({\n orgName,\n enabled = true,\n}: UseMarketplaceTemplateGroupsOptions): UseMarketplaceTemplateGroupsReturn {\n const resourceUri = useTemplatesResourceUri(orgName, enabled);\n const canFetch = Boolean(resourceUri);\n\n const { data, settings, loading, error } = useSettings({\n resourceUri: resourceUri as never,\n skip: !canFetch || !resourceUri,\n options: {\n schemaId: ContributionSchemaId.UiLayout,\n configKey: 'marketplace.templates',\n includeMarketplace: true,\n // Group keys only — values collapse to `{}` (browser modal lists by key).\n depth: 1,\n target: ConfigurationTarget.ORGANIZATION,\n },\n });\n\n // `useSettings` does lodash get(settings, configKey). When pageSettings already returns the\n // configKey subtree as `settings` (depth comment: `{ codeAssistant: {} }`), that get is\n // undefined — fall back to the raw settings payload.\n const payload = data ?? settings;\n\n const groupsRef = useRef<MarketplaceTemplateGroup[]>([]);\n const groups = useMemo(() => {\n if (!canFetch) return [];\n const next = extractMarketplaceTemplateGroups(payload);\n if (__DEV__) {\n const raw = unwrapSettingsPayload(payload);\n console.log('[Build] template groups', {\n resource: (resourceUri as { path?: string } | undefined)?.path,\n received: raw ? Object.keys(raw) : null,\n kept: next.map((group) => group.id),\n });\n }\n // Shared cache can swap the group map for a group's contents after deselect/reopen.\n // Keep the last valid group list so the picker does not flip to nested templates.\n if (next.length === 0) return groupsRef.current;\n groupsRef.current = next;\n return next;\n }, [canFetch, payload, resourceUri]);\n\n return {\n groups,\n loading: canFetch && loading && groups.length === 0,\n error: canFetch ? error : undefined,\n };\n}\n"],"names":[],"mappings":"+UAmBO,SAAS,4BAA6B,CAAA;AAAA,EAC3C,OAAA;AAAA,EACA,OAAU,GAAA;AACZ,CAA4E,EAAA;AAC1E,EAAM,MAAA,WAAA,GAAc,uBAAwB,CAAA,OAAA,EAAS,OAAO,CAAA;AAC5D,EAAM,MAAA,QAAA,GAAW,QAAQ,WAAW,CAAA;AACpC,EAAM,MAAA;AAAA,IACJ,IAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,IACA;AAAA,MACE,WAAY,CAAA;AAAA,IACd,WAAA;AAAA,IACA,IAAA,EAAM,CAAC,QAAA,IAAY,CAAC,WAAA;AAAA,IACpB,OAAS,EAAA;AAAA,MACP,UAAU,oBAAqB,CAAA,QAAA;AAAA,MAC/B,SAAW,EAAA,uBAAA;AAAA,MACX,k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useMemo}from'react';import {isUnhydratedCdecodeUri,toUriInput,settingsUriForOrg}from'../utils/cdecodeUri.js';function useTemplatesResourceUri(orgName, enabled = true) {
|
|
2
|
+
const {
|
|
3
|
+
data: contextData
|
|
4
|
+
} = useContextData();
|
|
5
|
+
const cdecodeUri = contextData == null ? void 0 : contextData.cdecodeUri;
|
|
6
|
+
const slug = (orgName != null ? orgName : "").trim();
|
|
7
|
+
return useMemo(() => {
|
|
8
|
+
if (!enabled) return void 0;
|
|
9
|
+
if (!isUnhydratedCdecodeUri(cdecodeUri)) return toUriInput(cdecodeUri);
|
|
10
|
+
return slug ? settingsUriForOrg(slug) : void 0;
|
|
11
|
+
}, [enabled, cdecodeUri, slug]);
|
|
12
|
+
}export{useTemplatesResourceUri};//# sourceMappingURL=useTemplatesResourceUri.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTemplatesResourceUri.js","sources":["../../src/hooks/useTemplatesResourceUri.ts"],"sourcesContent":["import { useContextData } from '@adminide-stack/platform-client/lib/hooks/useContextData.js';\nimport { useMemo } from 'react';\nimport { isUnhydratedCdecodeUri, settingsUriForOrg, toUriInput, type SettingsUriInput } from '../utils/cdecodeUri';\n\n/**\n * The resource Build's template groups and cards are read from - the web's `useUiSettingsResourceUri`:\n * the signed-in context's `cdecodeUri`, which carries the org-scoped marketplace contributions (Designs,\n * Slides, Characters…). A `/<org>/` URI built from the resolved org slug answered only the built-in\n * groups (codeAssistant, aiTemplates), so Build showed Website and More alone. The org slug stays the\n * fallback until the context hydrates.\n */\nexport function useTemplatesResourceUri(orgName?: string | null, enabled = true): SettingsUriInput | undefined {\n const { data: contextData } = useContextData();\n const cdecodeUri = contextData?.cdecodeUri;\n const slug = (orgName ?? '').trim();\n return useMemo(() => {\n if (!enabled) return undefined;\n if (!isUnhydratedCdecodeUri(cdecodeUri)) return toUriInput(cdecodeUri);\n return slug ? settingsUriForOrg(slug) : undefined;\n }, [enabled, cdecodeUri, slug]);\n}\n"],"names":[],"mappings":"8MAWgB,SAAA,uBAAA,CAAwB,OAAyB,EAAA,OAAA,GAAU,IAAoC,EAAA;AAC7G,EAAM,MAAA;AAAA,IACJ,IAAM,EAAA;AAAA,MACJ,cAAe,EAAA;AACnB,EAAA,MAAM,aAAa,WAAa,IAAA,IAAA,GAAA,MAAA,GAAA,WAAA,CAAA,UAAA;AAChC,EAAM,MAAA,IAAA,GAAA,CAAQ,OAAW,IAAA,IAAA,GAAA,OAAA,GAAA,EAAA,EAAI,IAAK,EAAA;AAClC,EAAA,OAAO,QAAQ,MAAM;AACnB,IAAI,IAAA,CAAC,SAAgB,OAAA,MAAA;AACrB,IAAA,IAAI,CAAC,sBAAuB,CAAA,UAAU,CAAG,EAAA,OAAO,WAAW,UAAU,CAAA;AACrE,IAAO,OAAA,IAAA,GAAO,iBAAkB,CAAA,IAAI,CAAI,GAAA,MAAA;AAAA,GACvC,EAAA,CAAC,OAAS,EAAA,UAAA,EAAY,IAAI,CAAC,CAAA;AAChC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useMemo,useLayoutEffect,useState,useCallback,useRef,useEffect}from'react';import {useWindowDimensions,Keyboard,StyleSheet,View,Pressable}from'react-native';import {
|
|
1
|
+
import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useMemo,useLayoutEffect,useState,useCallback,useRef,useEffect}from'react';import {useWindowDimensions,Keyboard,StyleSheet,View,Pressable}from'react-native';import {Box,Text,InputToolBar}from'@admin-layout/gluestack-ui-mobile';import {ComposerModeSwitch,composerMode}from'../../features/chat/ComposerModeSwitch.js';import {useSafeAreaInsets,SafeAreaView}from'react-native-safe-area-context';import {useNavigation,useRoute,CommonActions}from'@react-navigation/native';import {MessageActionBar}from'../../features/chat/MessageActionBar.js';import {withTemporaryChat}from'../../features/chat/withTemporaryChat.js';import {ChatTranscript}from'../../features/chat/ChatTranscript.js';import {ChatLinkOpenerProvider}from'../../features/links/ChatLinkOpenerProvider.js';import {AskUserCard}from'../../features/chat/AskUserCard.js';import {pendingAskUser}from'../../features/chat/askUser.js';import {PendingConnectorConnectCard}from'../../features/chat/ConnectorConnectPrompt.js';import {QueuedFollowUps}from'../../features/chat/QueuedFollowUps.js';import {queuedFollowUpRows}from'../../features/chat/queuedFollowUpRows.js';import {displayConnectorConnectMessages,displayConnectorConnectText}from'common';import {splitPreResponse}from'../../features/chat/preResponse.js';import {FreeCreditsCard}from'../../features/credits/FreeCreditsCard.js';import {lockedTurnToResend}from'../../features/credits/freeCredits.js';import {useFreeCredits}from'../../features/credits/useFreeCredits.js';import'common/graphql';import'../../config/env-config.js';import'../../hooks/usePrerequisiteIds.js';import'@react-native-async-storage/async-storage';import'expo-secure-store';import'../../features/messaging/yantraChatOrg.js';import {useCdecliConnection}from'../../contexts/cdecliConnection.js';import'../../contexts/GatewayContext.js';import {useChatLiveStream}from'../../contexts/ChatLiveStreamContext.js';import {KeyboardAwareScreen,KeyboardComposerDock}from'../../components/KeyboardComposerDock.js';import {YantraBrandLoader,YANTRA_LOADER_SIZE_COMPACT}from'../../components/YantraBrandLoader.js';import ThinkingIndicator from'../../components/ThinkingIndicator.js';import {mobileTokens}from'../../theme/mobileTokens.js';import {useAppTheme}from'../../theme/AppThemeProvider.js';import DeepSearchModal from'../Home/components/DeepSearchModal.js';import {normalizeSummaryText,extractDeepSearchSources}from'../Home/deepSearchUtils.js';import {AudioRecorderPanel}from'../../features/audio-input/AudioRecorderPanel.js';import {NativeDictationBar}from'../../features/audio-input/NativeDictationBar.js';import {isNativeDictationAvailable}from'../../features/audio-input/nativeDictation.js';import {useImageAttachments}from'../../features/attachments/useImageAttachments.js';import {ComposerAttachmentBar}from'../../features/attachments/ComposerAttachmentBar.js';import {useComposerAttachMenu}from'../../features/attachments/ComposerAttachMenu.js';import {peekComposerAttachments,hasComposerAttachments,takeComposerAttachments}from'../../features/attachments/composerAttachmentHandoff.js';import {MicErrorBoundary}from'../../features/audio-input/MicErrorBoundary.js';import {requestMicPermission}from'../../features/audio-input/useAudioPermission.js';import {shouldRedirectToShop}from'../../features/shopping/chat/homeShoppingIntent.js';import {replaceWithShopNative,shopHandoffParams,pushShopNative}from'../../features/shopping/chat/openShopNative.js';import {resolveNativeHandoff,nativeRouteForConnectors}from'../../features/apps/nativeAppHandoff.js';import {parseToolActivity}from'../../features/chat/toolActivity.js';import {replaceWithNativeApp,nativeHandoffParams,pushNativeApp}from'../../features/apps/nativeAppNavigation.js';var __defProp = Object.defineProperty;
|
|
2
2
|
var __defProps = Object.defineProperties;
|
|
3
3
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -45,11 +45,6 @@ function normalizeRouteAttachments(attachments) {
|
|
|
45
45
|
} : {});
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
const PLACEHOLDER = {
|
|
49
|
-
"deep-search": "Research anything...",
|
|
50
|
-
build: "Describe an app to build...",
|
|
51
|
-
chat: "Ask anything..."
|
|
52
|
-
};
|
|
53
48
|
function ChatScreen() {
|
|
54
49
|
var _a, _b;
|
|
55
50
|
const navigation = useNavigation();
|
|
@@ -486,21 +481,8 @@ function ChatScreen() {
|
|
|
486
481
|
if (!deepSearchQuery || isStreaming || !channelId) return;
|
|
487
482
|
void sendMessage(deepSearchQuery, void 0, channelId);
|
|
488
483
|
}, [deepSearchQuery, isStreaming, channelId, sendMessage]);
|
|
489
|
-
const
|
|
490
|
-
|
|
491
|
-
active: activeMode === "chat",
|
|
492
|
-
onClick: () => handleModeSwitch("chat")
|
|
493
|
-
},
|
|
494
|
-
zap: {
|
|
495
|
-
active: activeMode === "deep-search",
|
|
496
|
-
onClick: () => handleModeSwitch("deep-search")
|
|
497
|
-
},
|
|
498
|
-
lightbulb: {
|
|
499
|
-
active: activeMode === "build",
|
|
500
|
-
onClick: () => handleModeSwitch("build")
|
|
501
|
-
}
|
|
502
|
-
}), [activeMode, handleModeSwitch]);
|
|
503
|
-
const inputPlaceholder = PLACEHOLDER[modeOf(isDeepSearchMode, isBuildMode)];
|
|
484
|
+
const modeSwitch = useMemo(() => /* @__PURE__ */ jsx(ComposerModeSwitch, { activeMode, onSelect: handleModeSwitch, isDark }), [activeMode, handleModeSwitch, isDark]);
|
|
485
|
+
const inputPlaceholder = composerMode(modeOf(isDeepSearchMode, isBuildMode)).placeholder;
|
|
504
486
|
const inputConfig = useMemo(() => ({
|
|
505
487
|
value,
|
|
506
488
|
onChange: handleValueChange,
|
|
@@ -585,7 +567,7 @@ function ChatScreen() {
|
|
|
585
567
|
} else {
|
|
586
568
|
composerBody = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
587
569
|
/* @__PURE__ */ jsx(ComposerAttachmentBar, { attachments: imageAttachments.pending, onRemove: imageAttachments.remove, isDark }),
|
|
588
|
-
/* @__PURE__ */ jsx(InputToolBar, { inputConfig,
|
|
570
|
+
/* @__PURE__ */ jsx(InputToolBar, { inputConfig, leftCustomRender: modeSwitch, rightItems, templateButton: null, templateModalConfig: null, micSendButton })
|
|
589
571
|
] });
|
|
590
572
|
}
|
|
591
573
|
return /* @__PURE__ */ jsxs(SafeAreaView, { edges: ["left", "right"], style: {
|