Lines 325-365javascript
325 if (position) data.position = position;
326 if (welcomeMessage) data.welcome_message = welcomeMessage;
327 if (primaryColor) data.primary_color = primaryColor;
329 return this.client.request('PATCH', `/bots/${botId}/widget`, data);
332 async getSettings(botId) {
333 return this.client.request('GET', `/bots/${botId}/widget`);
337// ════════════════════════════════════════════════════════════════════════════
338// NatureCoAuth — tek NatureCo hesabı (SSO). natureco.me Supabase Auth üstünde,
339// bağımlılıksız (Supabase REST + global fetch). CLI/terminal/portal aynı hesabı
340// paylaşır. Oturum ~/.natureco/auth.json'da saklanır (Node); tarayıcıda bellekte.
341// ════════════════════════════════════════════════════════════════════════════
343// natureco.me kimlik projesi — anon key PUBLIC (client'lara gömülür, gizli değil)
344const NC_SUPABASE_URL = 'https://mxnlehflfkesasclcldy.supabase.co';
345const NC_SUPABASE_ANON = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im14bmxlaGZsZmtlc2FzY2xjbGR5Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzY2NDA5MzEsImV4cCI6MjA5MjIxNjkzMX0.93aPOg6bVmgFaJvsM5jVZwiX2TTuFIyAzhP6BlhBkGU';
349 * @param {object} [options]
350 * @param {string} [options.url] Supabase URL (varsayılan natureco.me)
351 * @param {string} [options.anonKey] public anon key
352 * @param {object} [options.store] { load(): session|null, save(session), clear() } — özel oturum deposu
354 constructor(options = {}) {
355 this.url = options.url || NC_SUPABASE_URL;
356 this.anonKey = options.anonKey || NC_SUPABASE_ANON;
357 this.authBase = `${this.url}/auth/v1`;
358 this.store = options.store || _defaultStore();
359 this._session = this.store.load();
362 async _post(path, body, accessToken) {
363 const headers = { 'apikey': this.anonKey, 'Content-Type': 'application/json' };
364 if (accessToken) headers['Authorization'] = `Bearer ${accessToken}`;
365 const res = await fetch(`${this.authBase}${path}`, { method: 'POST', headers, body: JSON.stringify(body) });