(config: CopilotKitConfig)
| 72 | } |
| 73 | |
| 74 | function resolveLicense(config: CopilotKitConfig): ResolvedLicense { |
| 75 | const headerKey = config.headers?.[COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]; |
| 76 | const key = config.licenseKey ?? headerKey; |
| 77 | |
| 78 | if (!key) { |
| 79 | return { |
| 80 | valid: false, |
| 81 | warning: |
| 82 | "No CopilotCloud license key was found. A watermark will be shown until one is added.", |
| 83 | }; |
| 84 | } |
| 85 | |
| 86 | if (!COPILOT_CLOUD_PUBLIC_API_KEY_REGEX.test(key)) { |
| 87 | return { |
| 88 | key, |
| 89 | valid: false, |
| 90 | warning: |
| 91 | "Your CopilotCloud license key appears invalid. A watermark will be shown until a valid key is added.", |
| 92 | }; |
| 93 | } |
| 94 | |
| 95 | return { key, valid: true }; |
| 96 | } |
| 97 | |
| 98 | export const COPILOT_KIT_CONFIG = new InjectionToken<CopilotKitConfig>( |
| 99 | "COPILOT_KIT_CONFIG", |
no outgoing calls
no test coverage detected
searching dependent graphs…