signalbird 1.9.2 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,11 +5,11 @@ kodla da yapılabilir.
5
5
 
6
6
  | Yüzey | Ne yapar | Anahtar | Nerede |
7
7
  |---|---|---|---|
8
- | **Telsiz** (Radio) | projenizden bir **kanala** log/olay yazar | `sbr_live_…` / `sbr_pub_…` | sunucu / tarayıcı |
8
+ | **Telsiz** (Radio) | projenizden bir **kanala** log/olay yazar | `sb_secret_live_…` / `sb_public_live_…` | sunucu / tarayıcı |
9
9
  | **Gönderim** (Messaging) | e-posta, SMS, push gönderir; kişi, liste, kampanya yönetir; mesaj durumu okur; webhook imzası doğrular | `sb_…` | yalnız sunucu |
10
10
  | **Yönetim** (Management) | Telsiz projesi/kanalı açar, olay akışını okur, **sohbet gelen kutusunu** işler, uygulama ve cihaz yönetir | `sb_…` + scope | yalnız sunucu |
11
- | **Uygulama** (App) | müşterinizin **son kullanıcısına** canlı sohbet + push cihaz kaydı | `sbw_pub_…` | web, iOS, Android |
12
- | **Partner** | Signalbird'ü kendi ürününde satan **sözleşmeli platform** müşterisini sağlar ve yetkilendirir | `sbp_live_…` | yalnız sunucu |
11
+ | **Uygulama** (App) | müşterinizin **son kullanıcısına** canlı sohbet + push cihaz kaydı | `sb_public_live_…` | web, iOS, Android |
12
+ | **Partner** | Signalbird'ü kendi ürününde satan **sözleşmeli platform** müşterisini sağlar ve yetkilendirir | `sb_secret_live_…` | yalnız sunucu |
13
13
 
14
14
  Bir seçenek daha var ve kod yazmaz: hazır sohbet widget'ı
15
15
  (`signalbird.js`), siteye tek `<script>` ile gömülür.
@@ -59,7 +59,7 @@ olay → tek bir kayıt
59
59
  `.env` dosyanıza **bir satır** yazarsınız:
60
60
 
61
61
  ```
62
- SIGNALBIRD_KEY=sb_
62
+ SIGNALBIRD_DOMAIN_KEY=sb_secret_live_
63
63
  ```
64
64
 
65
65
  Takım anahtarı (`sb_…`) her şeyi kapsar: e-posta, SMS, push, kişi ve kampanya,
@@ -75,8 +75,8 @@ ve gizli olmadıkları için ayrı durmak zorundadırlar:
75
75
 
76
76
  | Anahtar | Nerede | Ne yapar |
77
77
  |---|---|---|
78
- | `sbw_pub_…` | `<script data-app-key>` | sohbet widget'ı, push cihaz kaydı |
79
- | `sbr_pub_…` | tarayıcı log istemcisi | yalnız izinli alan adlarından, yalnız izinli kanala |
78
+ | `sb_public_live_…` | `<script data-key data-channel>` | sohbet widget'ı, push cihaz kaydı |
79
+ | `sb_public_live_…` | tarayıcı log istemcisi | yalnız izinli alan adlarından |
80
80
 
81
81
  Gizli anahtar tarayıcıya **gömülemez**: sunucu, `Origin` başlığı taşıyan bir
82
82
  istekte gizli anahtarı reddeder (`SECRET_KEY_IN_BROWSER`). Bu bir kolaylık
@@ -94,8 +94,8 @@ değil, kasıtlı bir duvardır — anahtar bir kez istemciye indiğinde herkesi
94
94
  | Go | `go get github.com/Pariette-Inc/signalbird.sdk` |
95
95
  | .NET, ASP.NET Core | `dotnet add package Signalbird.Sdk` |
96
96
  | Swift (iOS, macOS) | SPM: `https://github.com/Pariette-Inc/signalbird.sdk` |
97
- | Kotlin (Android) | `implementation("io.signalbird:signalbird-sdk:1.9.2")` |
98
- | Canlı sohbet widget'ı (herhangi bir site) | `<script async src="https://signalbird.io/sdk/v1/signalbird.js" data-app-key="sbw_pub_…"></script>` |
97
+ | Kotlin (Android) | `implementation("io.signalbird:signalbird-sdk:2.0.1")` |
98
+ | Canlı sohbet widget'ı (herhangi bir site) | `<script async src="https://signalbird.io/sdk/v1/signalbird.js" data-key="sb_public_live_…" data-channel="destek"></script>` |
99
99
 
100
100
  > Hepsi **bu repodan** çıkar ve **aynı sürümü** taşır — ayrı SDK reposu ya da
101
101
  > dil başına sürüm yoktur.
@@ -105,7 +105,7 @@ değil, kasıtlı bir duvardır — anahtar bir kez istemciye indiğinde herkesi
105
105
  ```ts
106
106
  import { signalbird } from 'signalbird'
107
107
 
108
- // SIGNALBIRD_KEY ortam değişkeninden okunur
108
+ // SIGNALBIRD_DOMAIN_KEY ortam değişkeninden okunur
109
109
  await signalbird().critical('critical', 'ödeme servisi yanıt vermiyor', {
110
110
  service: 'iyzico',
111
111
  attempt: 3,
@@ -120,7 +120,7 @@ Kendi istemcinizi kurmak isterseniz:
120
120
  import { SignalbirdClient } from 'signalbird'
121
121
 
122
122
  const sb = new SignalbirdClient({
123
- apiKey: process.env.SIGNALBIRD_KEY!,
123
+ domainKey: process.env.SIGNALBIRD_DOMAIN_KEY!,
124
124
  source: 'api-01', // hangi sunucudan geldiği
125
125
  throwOnError: false, // üretimde kapalı kalmalı
126
126
  })
@@ -172,7 +172,7 @@ export async function POST(req: Request) {
172
172
  import { initSignalbird } from 'signalbird/browser'
173
173
 
174
174
  const sb = initSignalbird({
175
- publicKey: 'sbr_pub_…',
175
+ publicKey: 'sb_public_live_…',
176
176
  source: 'web',
177
177
  })
178
178
 
@@ -187,7 +187,7 @@ kapanırken `sendBeacon` ile boşaltılır.
187
187
 
188
188
  ```tsx
189
189
  useEffect(() => {
190
- const sb = initSignalbird({ publicKey: process.env.NEXT_PUBLIC_SIGNALBIRD_KEY! })
190
+ const sb = initSignalbird({ publicKey: process.env.NEXT_PUBLIC_SIGNALBIRD_DOMAIN_KEY! })
191
191
  return sb.captureErrors()
192
192
  }, [])
193
193
  ```
@@ -195,7 +195,7 @@ useEffect(() => {
195
195
  **Vue** — `main.ts`:
196
196
 
197
197
  ```ts
198
- const sb = initSignalbird({ publicKey: import.meta.env.VITE_SIGNALBIRD_KEY })
198
+ const sb = initSignalbird({ publicKey: import.meta.env.VITE_SIGNALBIRD_DOMAIN_KEY })
199
199
  app.config.errorHandler = (err) => sb.error('browser', String(err))
200
200
  ```
201
201
 
@@ -228,7 +228,7 @@ Signalbird::info('info', 'ahmet@x.com yeni hesap oluşturdu');
228
228
  `.env`:
229
229
 
230
230
  ```
231
- SIGNALBIRD_KEY=sbr_live_
231
+ SIGNALBIRD_DOMAIN_KEY=sb_secret_live_
232
232
  SIGNALBIRD_SOURCE=api-01
233
233
  ```
234
234
 
@@ -251,7 +251,7 @@ Laravel dışı PHP:
251
251
  ```php
252
252
  use Signalbird\Sdk\Signalbird;
253
253
 
254
- Signalbird::configure('sbr_live_…');
254
+ Signalbird::configure('sb_secret_live_…');
255
255
  Signalbird::error('api', 'veritabanı bağlantısı koptu');
256
256
  ```
257
257
 
@@ -280,7 +280,7 @@ Node:
280
280
  ```ts
281
281
  import { SignalbirdMessaging } from 'signalbird'
282
282
 
283
- const sb = new SignalbirdMessaging({ apiKey: process.env.SIGNALBIRD_MESSAGING_KEY! })
283
+ const sb = new SignalbirdMessaging({ domainKey: process.env.SIGNALBIRD_DOMAIN_KEY! })
284
284
 
285
285
  const r = await sb.sendEmail({
286
286
  to: 'ali@example.com',
@@ -321,7 +321,7 @@ $r = Signalbird::messaging()->sendEmail([
321
321
  if (! $r['ok']) { Log::warning($r['code'], $r); }
322
322
  ```
323
323
 
324
- `.env`: `SIGNALBIRD_MESSAGING_KEY=sb_…` (isteğe bağlı `SIGNALBIRD_MESSAGING_URL`,
324
+ `.env`: `SIGNALBIRD_DOMAIN_KEY=sb_secret_live_…` (isteğe bağlı `SIGNALBIRD_MESSAGING_URL`,
325
325
  `SIGNALBIRD_MESSAGING_TIMEOUT`). Laravel dışı PHP:
326
326
  `Signalbird::configureMessaging('sb_…')` ya da `new MessagingClient('sb_…')`.
327
327
 
@@ -371,7 +371,7 @@ import { management } from 'signalbird'
371
371
  const { data } = await management().createRadioProject({ name: 'ödeme-servisi' })
372
372
 
373
373
  // `secret` YALNIZ burada döner — sunucuda yalnız özeti saklanır
374
- await vault.write('SIGNALBIRD_KEY', data!.secret)
374
+ await vault.write('SIGNALBIRD_DOMAIN_KEY', data!.secret)
375
375
 
376
376
  await management().createRadioChannel(data!.project.id, {
377
377
  key: 'odeme',
@@ -437,7 +437,7 @@ alındığında modül açar ve panel ekranını kendi sayfanıza gömersiniz.
437
437
  ```ts
438
438
  import { SignalbirdPartner } from 'signalbird'
439
439
 
440
- const partner = new SignalbirdPartner({ apiKey: process.env.SIGNALBIRD_PARTNER_KEY! })
440
+ const partner = new SignalbirdPartner({ domainKey: process.env.SIGNALBIRD_DOMAIN_KEY! })
441
441
 
442
442
  // Müşteri açıldı — idempotent: aynı external_id ikinci kez yeni hesap AÇMAZ
443
443
  const { data } = await partner.createCompany({
@@ -491,7 +491,7 @@ gönderim yapabilirsiniz. Gereken tek şey **kendi takım anahtarınızdır**
491
491
  ```ts
492
492
  import { SignalbirdMessaging } from 'signalbird'
493
493
 
494
- const sb = new SignalbirdMessaging({ apiKey: process.env.SIGNALBIRD_KEY! })
494
+ const sb = new SignalbirdMessaging({ domainKey: process.env.SIGNALBIRD_DOMAIN_KEY! })
495
495
 
496
496
  // İşlemsel: sipariş bildirimi, şifre sıfırlama. İYS'ye tabi DEĞİLDİR.
497
497
  await sb.sendEmail({
@@ -509,7 +509,7 @@ await sb.sendEmail({ to: '…', class: 'commercial', subject: '…', body: '…'
509
509
  ```php
510
510
  // Laravel: tek satır konfigürasyonla UYGULAMANIN TAMAMI buradan çıkar
511
511
  // config/mail.php → 'signalbird' => ['transport' => 'signalbird', 'class' => 'transactional']
512
- // .env → MAIL_MAILER=signalbird, SIGNALBIRD_KEY=sb_
512
+ // .env → MAIL_MAILER=signalbird, SIGNALBIRD_DOMAIN_KEY=sb_secret_live_
513
513
  Mail::to($user)->send(new SiparisBildirimi($order)); // hiçbir Mailable değişmez
514
514
 
515
515
  // Gövde PANELDE duruyorsa (şablon + değişken), zincirlenebilir yüz:
@@ -535,13 +535,13 @@ istemiyorsanız ikincisi.
535
535
  (`bildirim@<takım>.sendsignalbird.com`) hesapla birlikte gelir; kendi alan
536
536
  adınızı bağlamak için DKIM/SPF/MX kayıtlarını yayınlamanız gerekir.
537
537
  3. **Anahtar sunucuda kalır.** Tarayıcıya ya da mobil uygulamaya konmaz;
538
- oralar için açık uygulama anahtarı (`sbw_pub_…`) vardır.
538
+ oralar için açık uygulama anahtarı (`sb_public_live_…`) vardır.
539
539
 
540
540
  ## Uygulama (App) — kendi sohbet arayüzünüz
541
541
 
542
542
  Hazır widget yerine kendi arayüzünüzü yazmak, ya da sohbeti **mobil
543
543
  uygulamanıza** koymak istiyorsanız bu yüzey içindir. Açık uygulama anahtarı
544
- (`sbw_pub_…`) kullanır ve yalnız ziyaretçinin kendi verisine dokunur.
544
+ (`sb_public_live_…`) kullanır ve yalnız ziyaretçinin kendi verisine dokunur.
545
545
 
546
546
  **React / Next.js**
547
547
 
@@ -550,7 +550,7 @@ import { SignalbirdProvider, useChat } from 'signalbird/react'
550
550
 
551
551
  export function App() {
552
552
  return (
553
- <SignalbirdProvider appKey={process.env.NEXT_PUBLIC_SIGNALBIRD_APP_KEY!}>
553
+ <SignalbirdProvider publicKey={process.env.NEXT_PUBLIC_SIGNALBIRD_APP_KEY!}>
554
554
  <Chat />
555
555
  </SignalbirdProvider>
556
556
  )
@@ -572,7 +572,7 @@ function Chat() {
572
572
  **Vue 3**
573
573
 
574
574
  ```ts
575
- app.use(signalbirdPlugin, { appKey: import.meta.env.VITE_SIGNALBIRD_APP_KEY })
575
+ app.use(signalbirdPlugin, { publicKey: import.meta.env.VITE_SIGNALBIRD_APP_KEY })
576
576
 
577
577
  const { state, send } = useChat({ open: isOpen })
578
578
  ```
@@ -580,7 +580,7 @@ const { state, send } = useChat({ open: isOpen })
580
580
  **Angular**
581
581
 
582
582
  ```ts
583
- bootstrapApplication(App, { providers: [provideSignalbird({ appKey })] })
583
+ bootstrapApplication(App, { providers: [provideSignalbird({ publicKey, chatKey })] })
584
584
 
585
585
  // bileşende
586
586
  chat$ = inject(SignalbirdService).chat$()
@@ -593,7 +593,7 @@ import AsyncStorage from '@react-native-async-storage/async-storage'
593
593
  import { createSignalbirdApp, asyncStorageAdapter, useNativeChat } from 'signalbird/react-native'
594
594
 
595
595
  // Depoyu vermek ZORUNLU: sır cihazda kalmazsa geçmiş her açılışta kaybolur
596
- const client = createSignalbirdApp({ appKey, storage: asyncStorageAdapter(AsyncStorage) })
596
+ const client = createSignalbirdApp({ publicKey, chatKey, storage: asyncStorageAdapter(AsyncStorage) })
597
597
 
598
598
  const { messages, send } = useNativeChat(client, { open: true, isForeground })
599
599
  ```
@@ -601,7 +601,7 @@ const { messages, send } = useNativeChat(client, { open: true, isForeground })
601
601
  **Swift (iOS)**
602
602
 
603
603
  ```swift
604
- let client = try SignalbirdApp(config: .init(appKey: "sbw_pub_…"))
604
+ let client = try SignalbirdApp(config: .init(publicKey: "sb_public_live_…"))
605
605
 
606
606
  try await client.startSession(["name": "Ayşe"])
607
607
  try await client.startConversation(body: "Kargom nerede?")
@@ -611,7 +611,7 @@ try await client.registerDevice(token: apnsToken)
611
611
  **Kotlin (Android)**
612
612
 
613
613
  ```kotlin
614
- val client = SignalbirdApp(SignalbirdAppConfig(appKey = "sbw_pub_…", storage = prefsStorage))
614
+ val client = SignalbirdApp(SignalbirdAppConfig(publicKey = "sb_public_live_…", storage = prefsStorage))
615
615
 
616
616
  client.startSession(mapOf("name" to "Ayşe"))
617
617
  client.startConversation("Kargom nerede?")
@@ -623,10 +623,10 @@ Tam liste (17 metot) ve yoklama merdiveni: `docs/CONTRACT.md § 11`.
623
623
  ## Widget (canlı sohbet)
624
624
 
625
625
  Panelde **Gelen Kutusu → Ayarlar → Uygulamalar**'dan bir uygulama açın; verilen
626
- `sbw_pub_…` anahtarını sitenize gömün:
626
+ `sb_public_live_…` anahtarını sitenize gömün:
627
627
 
628
628
  ```html
629
- <script async src="https://signalbird.io/sdk/v1/signalbird.js" data-app-key="sbw_pub_…"></script>
629
+ <script async src="https://signalbird.io/sdk/v1/signalbird.js" data-key="sb_public_live_…" data-channel="destek"></script>
630
630
  ```
631
631
 
632
632
  Bu kadar. Sohbet modülü açıksa balon görünür; renk, konum, karşılama, ön-form,
@@ -640,7 +640,7 @@ Signalbird.push.register({ token, platform: 'web', provider: 'fcm' })
640
640
  Signalbird.destroy()
641
641
  ```
642
642
 
643
- `data-app-key` yerine `Signalbird.init({ appKey, baseUrl?, locale? })` da
643
+ `data-key`/`data-channel` yerine `Signalbird.init({ publicKey, chatKey, baseUrl?, locale? })` da
644
644
  çağrılabilir. Widget ev sahibi sayfaya asla hata fırlatmaz; Shadow DOM içinde
645
645
  çalışır, sayfanızın CSS'iyle çakışmaz; < 20 KB gzip. Ayrıntı:
646
646
  `docs/CONTRACT.md § 9` ve https://signalbird.io/sdk/widget.
@@ -46,7 +46,7 @@ declare class SignalbirdService {
46
46
  destroy(): void;
47
47
  }
48
48
  /**
49
- * `bootstrapApplication(App, { providers: [provideSignalbird({ appKey })] })`
49
+ * `bootstrapApplication(App, { providers: [provideSignalbird({ publicKey })] })`
50
50
  *
51
51
  * Dönen nesne Angular'ın `Provider` biçimindedir ama tipi buraya gömülmez —
52
52
  * paket Angular'a derleme zamanı bağımlılık taşımaz.
package/dist/angular.d.ts CHANGED
@@ -46,7 +46,7 @@ declare class SignalbirdService {
46
46
  destroy(): void;
47
47
  }
48
48
  /**
49
- * `bootstrapApplication(App, { providers: [provideSignalbird({ appKey })] })`
49
+ * `bootstrapApplication(App, { providers: [provideSignalbird({ publicKey })] })`
50
50
  *
51
51
  * Dönen nesne Angular'ın `Provider` biçimindedir ama tipi buraya gömülmez —
52
52
  * paket Angular'a derleme zamanı bağımlılık taşımaz.
package/dist/angular.js CHANGED
@@ -39,12 +39,12 @@ var SignalbirdApp = class {
39
39
  this.config = config;
40
40
  this.visitor = null;
41
41
  this.loaded = false;
42
- if (!config?.appKey) {
43
- throw new Error("Signalbird: appKey zorunlu (sbw_pub_\u2026).");
42
+ if (!config?.publicKey) {
43
+ throw new Error("Signalbird: publicKey zorunlu (sb_public_live_\u2026).");
44
44
  }
45
- if (!config.appKey.startsWith("sbw_pub_")) {
45
+ if (!config.publicKey.startsWith("sb_public_live_")) {
46
46
  throw new Error(
47
- "Signalbird: uygulama istemcisi a\xE7\u0131k uygulama anahtar\u0131 ister (sbw_pub_\u2026). Tak\u0131m anahtar\u0131n\u0131 (sb_\u2026) istemci koduna KOYMAYIN."
47
+ "Signalbird: uygulama istemcisi a\xE7\u0131k domain anahtar\u0131 ister (sb_public_live_\u2026). Tak\u0131m anahtar\u0131n\u0131 (sb_\u2026) istemci koduna KOYMAYIN."
48
48
  );
49
49
  }
50
50
  this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
@@ -80,7 +80,7 @@ var SignalbirdApp = class {
80
80
  await this.storeVisitor({
81
81
  id: visitor.id,
82
82
  secret: visitor.secret,
83
- appKey: this.config.appKey,
83
+ publicKey: this.config.publicKey,
84
84
  name: visitor.name ?? null,
85
85
  email: visitor.email ?? null
86
86
  });
@@ -218,8 +218,10 @@ var SignalbirdApp = class {
218
218
  const isForm = typeof FormData !== "undefined" && body instanceof FormData;
219
219
  const headers = {
220
220
  Accept: "application/json",
221
- "X-Signalbird-App-Key": this.config.appKey
221
+ "X-Signalbird-Key": this.config.publicKey
222
222
  };
223
+ const moduleKey = path.startsWith("/v1/sdk/devices") || path.startsWith("/v1/sdk/push") ? this.config.pushKey : this.config.chatKey;
224
+ if (moduleKey) headers["X-Signalbird-Module-Key"] = moduleKey;
223
225
  if (stored?.secret) headers["X-Signalbird-Visitor"] = stored.secret;
224
226
  if (body !== void 0 && !isForm) headers["Content-Type"] = "application/json";
225
227
  if (this.config.locale) headers["X-Locale"] = this.config.locale;
@@ -278,7 +280,7 @@ var SignalbirdApp = class {
278
280
  const raw = await this.storage.getItem(STORAGE_KEY);
279
281
  if (!raw) return null;
280
282
  const parsed = JSON.parse(raw);
281
- if (!parsed?.secret || parsed.appKey !== this.config.appKey) return null;
283
+ if (!parsed?.secret || parsed.publicKey !== this.config.publicKey) return null;
282
284
  this.visitor = parsed;
283
285
  } catch {
284
286
  this.visitor = null;