signalbird 1.6.0 → 1.7.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 CHANGED
@@ -94,7 +94,7 @@ 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.5.0")` |
97
+ | Kotlin (Android) | `implementation("io.signalbird:signalbird-sdk:1.7.0")` |
98
98
  | Canlı sohbet widget'ı (herhangi bir site) | `<script async src="https://signalbird.io/sdk/v1/signalbird.js" data-app-key="sbw_pub_…"></script>` |
99
99
 
100
100
  > Hepsi **bu repodan** çıkar ve **aynı sürümü** taşır — ayrı SDK reposu ya da
@@ -398,6 +398,16 @@ for (const conversation of inbox.data?.data ?? []) {
398
398
  }
399
399
  ```
400
400
 
401
+ Signalbird ekranını **kendi panelinizde** göstermek isterseniz gömme jetonu:
402
+
403
+ ```ts
404
+ const { data } = await management().embedToken({ module: 'chat' })
405
+ // data.url → 120 saniyelik, TEK KULLANIMLIK adres; doğrudan <iframe>'e verin
406
+ ```
407
+
408
+ Anahtar `embed:issue` kapsamı ister — jeton 60 dakikalık bir panel oturumuna
409
+ çevrildiği için bu kapsam bilerek ayrıdır.
410
+
401
411
  Aynısı PHP, Python, Go ve .NET'te birebir aynı metot adlarıyla:
402
412
 
403
413
  ```php
@@ -501,8 +511,21 @@ await sb.sendEmail({ to: '…', class: 'commercial', subject: '…', body: '…'
501
511
  // config/mail.php → 'signalbird' => ['transport' => 'signalbird', 'class' => 'transactional']
502
512
  // .env → MAIL_MAILER=signalbird, SIGNALBIRD_KEY=sb_…
503
513
  Mail::to($user)->send(new SiparisBildirimi($order)); // hiçbir Mailable değişmez
514
+
515
+ // Gövde PANELDE duruyorsa (şablon + değişken), zincirlenebilir yüz:
516
+ Signalbird::mail()
517
+ ->to($user->email)
518
+ ->template('Sipariş Onayı') // panelde yazan ad ya da id
519
+ ->vars(['ad' => $user->name])
520
+ ->fromName('Penyu Destek')
521
+ ->transactional() // sınıf ZORUNLU, varsayılanı yok
522
+ ->send();
504
523
  ```
505
524
 
525
+ İkisinin farkı gövdenin nerede durduğudur: taşıyıcıda uygulamada (Blade),
526
+ `mail()`'de Signalbird panelinde. Metni değiştirmek için dağıtım beklemek
527
+ istemiyorsanız ikincisi.
528
+
506
529
  Üç şey bilinmeli:
507
530
 
508
531
  1. **Sınıfı siz seçmezsiniz, sistem belirler.** Kampanya arayüzünden çıkan her
package/dist/app.d.mts CHANGED
@@ -116,8 +116,26 @@ interface Message {
116
116
  read_at?: string | null;
117
117
  edited_at?: string | null;
118
118
  created_at?: string;
119
+ /**
120
+ * Anlık çeviri — ziyaretçinin diline. Arayüz varsa bunu gösterir; orijinal
121
+ * `body`'de durmaya devam eder.
122
+ */
123
+ translation?: {
124
+ lang: string;
125
+ body: string;
126
+ source?: string | null;
127
+ } | null;
119
128
  /** İyimser gönderimde yerel kopyayı sunucudakiyle eşleştirir. */
120
129
  client_id?: string | null;
130
+ /**
131
+ * Gönderilemedi (`ChatSession` yazar, sunucu DÖNMEZ).
132
+ *
133
+ * Tip listede yoktu ama oturum bu alanı yazıyordu: arayüz "gitmedi" hâlini
134
+ * çizmek istediğinde tipi zorlamak (`as`) zorunda kalıyordu. Bekleyen mesaj
135
+ * ayrıca işaretlenmez — sunucu yanıtı gelene kadar `id` ile `client_id`
136
+ * aynıdır ve bu, "henüz yolda" demenin en ucuz yoludur.
137
+ */
138
+ failed?: boolean;
121
139
  }
122
140
  interface Attachment {
123
141
  id?: string;
package/dist/app.d.ts CHANGED
@@ -116,8 +116,26 @@ interface Message {
116
116
  read_at?: string | null;
117
117
  edited_at?: string | null;
118
118
  created_at?: string;
119
+ /**
120
+ * Anlık çeviri — ziyaretçinin diline. Arayüz varsa bunu gösterir; orijinal
121
+ * `body`'de durmaya devam eder.
122
+ */
123
+ translation?: {
124
+ lang: string;
125
+ body: string;
126
+ source?: string | null;
127
+ } | null;
119
128
  /** İyimser gönderimde yerel kopyayı sunucudakiyle eşleştirir. */
120
129
  client_id?: string | null;
130
+ /**
131
+ * Gönderilemedi (`ChatSession` yazar, sunucu DÖNMEZ).
132
+ *
133
+ * Tip listede yoktu ama oturum bu alanı yazıyordu: arayüz "gitmedi" hâlini
134
+ * çizmek istediğinde tipi zorlamak (`as`) zorunda kalıyordu. Bekleyen mesaj
135
+ * ayrıca işaretlenmez — sunucu yanıtı gelene kadar `id` ile `client_id`
136
+ * aynıdır ve bu, "henüz yolda" demenin en ucuz yoludur.
137
+ */
138
+ failed?: boolean;
121
139
  }
122
140
  interface Attachment {
123
141
  id?: string;
package/dist/index.d.mts CHANGED
@@ -411,13 +411,165 @@ interface SbResult<T = unknown> {
411
411
  }
412
412
 
413
413
  /**
414
- * Yönetim (Management) yüzeyinin tipleri.
414
+ * Partner (beşinci yüzey) tipleri.
415
+ *
416
+ * Sözleşme: docs/CONTRACT.md § 12 ve
417
+ * signalbird.api/docs/PARTNER_PLATFORM_2026-08-20.md.
415
418
  *
416
- * Alan adları API ile BİREBİR aynıdır (snake_case). SDK yeniden adlandırmaz:
417
- * müşteri bir alanı belgede görüp kodda başka adla bulursa, kaybettiği zaman
418
- * SDK'nın kazandırdığı zamandan fazladır.
419
+ * Alan adları API ile birebir aynıdır (snake_case) SDK yeniden adlandırmaz.
419
420
  */
420
421
 
422
+ interface PartnerConfig {
423
+ /** `sbp_live_…` — sözleşmeli partner anahtarı. Tarayıcıya İNMEZ. */
424
+ apiKey: string;
425
+ baseUrl?: string;
426
+ timeout?: number;
427
+ throwOnError?: boolean;
428
+ debug?: boolean;
429
+ }
430
+ interface PartnerOwnerInput {
431
+ email: string;
432
+ name?: string;
433
+ /** Partner'ın kendi tarafındaki kullanıcı kimliği. */
434
+ external_id?: string;
435
+ locale?: string;
436
+ }
437
+ interface CreateCompanyInput {
438
+ /** Partner'ın kendi tarafındaki müşteri kimliği — idempotens anahtarı. */
439
+ external_id: string;
440
+ name: string;
441
+ owner: PartnerOwnerInput;
442
+ team_name?: string;
443
+ link_email?: string;
444
+ }
445
+ interface PartnerCompany {
446
+ id: number;
447
+ external_id: string;
448
+ name: string;
449
+ status: string;
450
+ billing_managed_by_partner: boolean;
451
+ modules: string[];
452
+ created_at: string | null;
453
+ }
454
+ interface CreateCompanyResult {
455
+ created: boolean;
456
+ company: PartnerCompany;
457
+ team: {
458
+ id: number | null;
459
+ name: string | null;
460
+ };
461
+ owner: {
462
+ id: number | null;
463
+ email: string | null;
464
+ name: string | null;
465
+ };
466
+ /** YALNIZ ilk oluşturmada döner. Kaybedilirse `rotateKey` yenisini üretir. */
467
+ keys?: {
468
+ api_key: string;
469
+ app_key: string;
470
+ };
471
+ }
472
+ interface DnsRecord {
473
+ host: string;
474
+ type: string;
475
+ value: string;
476
+ }
477
+ interface PartnerDomain {
478
+ id: number;
479
+ external_id: string;
480
+ domain: string;
481
+ verified_at: string | null;
482
+ /** `txt` | `partner` — partner beyanı kampanya için YETMEZ. */
483
+ verified_via: string | null;
484
+ can_send_campaigns: boolean;
485
+ is_active: boolean;
486
+ }
487
+ interface AddDomainInput {
488
+ external_id: string;
489
+ domain: string;
490
+ monitoring?: {
491
+ enabled?: boolean;
492
+ frequency?: number;
493
+ };
494
+ }
495
+ interface AddDomainResult {
496
+ created: boolean;
497
+ domain: PartnerDomain;
498
+ watcher: {
499
+ id: number;
500
+ frequency: number;
501
+ } | null;
502
+ dns: DnsRecord[];
503
+ note: string;
504
+ }
505
+ interface VerifyDomainResult {
506
+ verified: boolean;
507
+ domain: PartnerDomain;
508
+ dns: DnsRecord[];
509
+ }
510
+ interface UptimeIncident {
511
+ started_at: string;
512
+ ended_at: string | null;
513
+ duration_s: number;
514
+ reason: string | null;
515
+ }
516
+ interface UptimeReport {
517
+ domain?: string;
518
+ external_id?: string;
519
+ monitored?: boolean;
520
+ range: string;
521
+ /** Hiç kontrol yoksa `null` döner — %100 DEĞİL. */
522
+ uptime: number | null;
523
+ avg_response_ms: number | null;
524
+ checks: number;
525
+ status: string | null;
526
+ last_checked_at: string | null;
527
+ incidents: UptimeIncident[];
528
+ }
529
+ type UptimeRange = '24h' | '7d' | '30d';
530
+ interface ModuleEntitlement {
531
+ module: string;
532
+ limits: Record<string, number>;
533
+ source: string;
534
+ expires_at: string | null;
535
+ }
536
+ interface GrantModuleInput {
537
+ module: string;
538
+ limits?: Record<string, number>;
539
+ /** Aboneliğin bittiği tarih; yenilemede tazelenmezse modül kendi kapanır. */
540
+ expires_at?: string;
541
+ reason?: string;
542
+ }
543
+ interface PartnerUserInput {
544
+ external_id: string;
545
+ email: string;
546
+ name?: string;
547
+ role?: 'owner' | 'billing' | 'member';
548
+ team_role?: string;
549
+ permissions?: string[];
550
+ }
551
+ interface PartnerUser {
552
+ id: number;
553
+ external_id: string | null;
554
+ email: string;
555
+ name: string | null;
556
+ role: string | null;
557
+ }
558
+ type EmbedModule = 'chat' | 'monitoring' | 'campaigns' | 'contacts' | 'radio' | 'messages' | 'topics' | 'members';
559
+ interface EmbedTokenInput {
560
+ user_external_id: string;
561
+ module: EmbedModule;
562
+ locale?: string;
563
+ theme?: 'light' | 'dark';
564
+ accent?: string;
565
+ }
566
+ interface EmbedToken {
567
+ url: string;
568
+ token: string;
569
+ expires_at: string;
570
+ ttl: number;
571
+ }
572
+
421
573
  interface ManagementConfig {
422
574
  /** Takım API anahtarı (`sb_…`) — `radio:*`, `chat:*`, `apps:*` scope'larıyla. */
423
575
  apiKey: string;
@@ -729,6 +881,21 @@ interface ChatReport {
729
881
  };
730
882
  agents: ChatReportAgent[];
731
883
  }
884
+ /**
885
+ * Gömme jetonu isteği — MÜŞTERİNİN kendi paneli için.
886
+ *
887
+ * Partner sürümünden (`EmbedTokenInput`) tek farkı kimliğin nasıl verildiği:
888
+ * partner kendi sistemindeki dış kimliği (`user_external_id`) yollar, müşteri
889
+ * ise kendi takımındaki kullanıcıyı (`user_id`). Boş bırakılırsa anahtarın
890
+ * sahibi kullanılır.
891
+ */
892
+ interface TeamEmbedTokenInput {
893
+ module: EmbedModule;
894
+ user_id?: number | string;
895
+ locale?: string;
896
+ theme?: 'light' | 'dark';
897
+ accent?: string;
898
+ }
732
899
 
733
900
  /**
734
901
  * Yönetim (Management) istemcisi — sunucu tarafı.
@@ -871,169 +1038,16 @@ declare class SignalbirdManagement {
871
1038
  deleteApp(id: number | string): Promise<SbResult<unknown>>;
872
1039
  /** Açık anahtarı yeniler; siteye gömülü eski anahtar ANINDA çalışmaz olur. */
873
1040
  rotateAppKey(id: number | string): Promise<SbResult<AppRecord>>;
1041
+ /**
1042
+ * Gömme jetonu — Signalbird ekranını KENDİ panelinizde göstermek için.
1043
+ *
1044
+ * 120 saniye yaşar ve TEK KULLANIMLIKTIR: dönen `url`'i doğrudan bir
1045
+ * iframe'e verin, saklamayın. Anahtar `embed:issue` kapsamı ister.
1046
+ */
1047
+ embedToken(input: TeamEmbedTokenInput): Promise<SbResult<EmbedToken>>;
874
1048
  listAppDevices(id: number | string, query?: ListAppDevicesQuery): Promise<SbResult<Paginated<AppDevice>>>;
875
1049
  }
876
1050
 
877
- /**
878
- * Partner (beşinci yüzey) tipleri.
879
- *
880
- * Sözleşme: docs/CONTRACT.md § 12 ve
881
- * signalbird.api/docs/PARTNER_PLATFORM_2026-08-20.md.
882
- *
883
- * Alan adları API ile birebir aynıdır (snake_case) — SDK yeniden adlandırmaz.
884
- */
885
-
886
- interface PartnerConfig {
887
- /** `sbp_live_…` — sözleşmeli partner anahtarı. Tarayıcıya İNMEZ. */
888
- apiKey: string;
889
- baseUrl?: string;
890
- timeout?: number;
891
- throwOnError?: boolean;
892
- debug?: boolean;
893
- }
894
- interface PartnerOwnerInput {
895
- email: string;
896
- name?: string;
897
- /** Partner'ın kendi tarafındaki kullanıcı kimliği. */
898
- external_id?: string;
899
- locale?: string;
900
- }
901
- interface CreateCompanyInput {
902
- /** Partner'ın kendi tarafındaki müşteri kimliği — idempotens anahtarı. */
903
- external_id: string;
904
- name: string;
905
- owner: PartnerOwnerInput;
906
- team_name?: string;
907
- link_email?: string;
908
- }
909
- interface PartnerCompany {
910
- id: number;
911
- external_id: string;
912
- name: string;
913
- status: string;
914
- billing_managed_by_partner: boolean;
915
- modules: string[];
916
- created_at: string | null;
917
- }
918
- interface CreateCompanyResult {
919
- created: boolean;
920
- company: PartnerCompany;
921
- team: {
922
- id: number | null;
923
- name: string | null;
924
- };
925
- owner: {
926
- id: number | null;
927
- email: string | null;
928
- name: string | null;
929
- };
930
- /** YALNIZ ilk oluşturmada döner. Kaybedilirse `rotateKey` yenisini üretir. */
931
- keys?: {
932
- api_key: string;
933
- app_key: string;
934
- };
935
- }
936
- interface DnsRecord {
937
- host: string;
938
- type: string;
939
- value: string;
940
- }
941
- interface PartnerDomain {
942
- id: number;
943
- external_id: string;
944
- domain: string;
945
- verified_at: string | null;
946
- /** `txt` | `partner` — partner beyanı kampanya için YETMEZ. */
947
- verified_via: string | null;
948
- can_send_campaigns: boolean;
949
- is_active: boolean;
950
- }
951
- interface AddDomainInput {
952
- external_id: string;
953
- domain: string;
954
- monitoring?: {
955
- enabled?: boolean;
956
- frequency?: number;
957
- };
958
- }
959
- interface AddDomainResult {
960
- created: boolean;
961
- domain: PartnerDomain;
962
- watcher: {
963
- id: number;
964
- frequency: number;
965
- } | null;
966
- dns: DnsRecord[];
967
- note: string;
968
- }
969
- interface VerifyDomainResult {
970
- verified: boolean;
971
- domain: PartnerDomain;
972
- dns: DnsRecord[];
973
- }
974
- interface UptimeIncident {
975
- started_at: string;
976
- ended_at: string | null;
977
- duration_s: number;
978
- reason: string | null;
979
- }
980
- interface UptimeReport {
981
- domain?: string;
982
- external_id?: string;
983
- monitored?: boolean;
984
- range: string;
985
- /** Hiç kontrol yoksa `null` döner — %100 DEĞİL. */
986
- uptime: number | null;
987
- avg_response_ms: number | null;
988
- checks: number;
989
- status: string | null;
990
- last_checked_at: string | null;
991
- incidents: UptimeIncident[];
992
- }
993
- type UptimeRange = '24h' | '7d' | '30d';
994
- interface ModuleEntitlement {
995
- module: string;
996
- limits: Record<string, number>;
997
- source: string;
998
- expires_at: string | null;
999
- }
1000
- interface GrantModuleInput {
1001
- module: string;
1002
- limits?: Record<string, number>;
1003
- /** Aboneliğin bittiği tarih; yenilemede tazelenmezse modül kendi kapanır. */
1004
- expires_at?: string;
1005
- reason?: string;
1006
- }
1007
- interface PartnerUserInput {
1008
- external_id: string;
1009
- email: string;
1010
- name?: string;
1011
- role?: 'owner' | 'billing' | 'member';
1012
- team_role?: string;
1013
- permissions?: string[];
1014
- }
1015
- interface PartnerUser {
1016
- id: number;
1017
- external_id: string | null;
1018
- email: string;
1019
- name: string | null;
1020
- role: string | null;
1021
- }
1022
- type EmbedModule = 'chat' | 'monitoring' | 'campaigns' | 'contacts' | 'radio';
1023
- interface EmbedTokenInput {
1024
- user_external_id: string;
1025
- module: EmbedModule;
1026
- locale?: string;
1027
- theme?: 'light' | 'dark';
1028
- accent?: string;
1029
- }
1030
- interface EmbedToken {
1031
- url: string;
1032
- token: string;
1033
- expires_at: string;
1034
- ttl: number;
1035
- }
1036
-
1037
1051
  /**
1038
1052
  * Partner istemcisi — BEŞİNCİ yüzey.
1039
1053
  *
@@ -1189,4 +1203,4 @@ declare function management(config?: Partial<ManagementConfig>): SignalbirdManag
1189
1203
  /** Test ve sıcak yeniden yükleme için yönetim istemcisini sıfırlar. */
1190
1204
  declare function resetManagement(): void;
1191
1205
 
1192
- export { type AddDomainInput, type AddDomainResult, type AppDevice, type AppInput, type AppPlatform, type AppRecord, type Batch, type BatchResult, type BulkContactsInput, type BulkContactsResult, type CampaignCreateResult, type CampaignDetail, type CannedReply, type CannedReplyInput, type Channel, type ChatConversation, type ChatMessage, type ChatVisitor, type Contact, type ContactInput, type ContactList, type ConversationStatus, type CreateCampaignInput, type CreateCompanyInput, type CreateCompanyResult, type CreateContactListInput, type CreateRadioProjectInput, DEFAULT_BASE_URL, type DnsRecord, type EmbedModule, type EmbedToken, type EmbedTokenInput, type GrantModuleInput, type Level, type ListAppDevicesQuery, type ListCampaignMessagesQuery, type ListCampaignsQuery, type ListChatMessagesQuery, type ListContactsQuery, type ListConversationsQuery, type ListMessagesQuery, type ListRadioEventsQuery, type LogInput, type LogResult, type ManagementConfig, type Message, type MessageClass, type MessagingConfig, type MessagingErrorCode, type ModuleEntitlement, type Paginated$1 as Paginated, type PartnerCompany, type PartnerConfig, type PartnerDomain, type PartnerOwnerInput, type PartnerUser, type PartnerUserInput, type RadioChannel, type RadioChannelInput, type RadioEvent, type RadioLevel, type RadioProject, type RadioProjectCreated, type ReplyInput, type SbResult$1 as SbResult, type SendEmailInput, type SendPushInput, type SendResult, type SendSmsInput, SignalbirdClient, type SignalbirdConfig, SignalbirdError, SignalbirdManagement, SignalbirdMessaging, SignalbirdPartner, type SmsPreview, type StartConversationInput, type UpdateConversationInput, type UpdateRadioProjectInput, type UpdateVisitorInput, type UptimeIncident, type UptimeRange, type UptimeReport, type VerifyDomainResult, management, resetManagement, resetSignalbird, signalbird, verifyWebhook };
1206
+ export { type AddDomainInput, type AddDomainResult, type AppDevice, type AppInput, type AppPlatform, type AppRecord, type Batch, type BatchResult, type BulkContactsInput, type BulkContactsResult, type CampaignCreateResult, type CampaignDetail, type CannedReply, type CannedReplyInput, type Channel, type ChatConversation, type ChatMessage, type ChatVisitor, type Contact, type ContactInput, type ContactList, type ConversationStatus, type CreateCampaignInput, type CreateCompanyInput, type CreateCompanyResult, type CreateContactListInput, type CreateRadioProjectInput, DEFAULT_BASE_URL, type DnsRecord, type EmbedModule, type EmbedToken, type EmbedTokenInput, type GrantModuleInput, type Level, type ListAppDevicesQuery, type ListCampaignMessagesQuery, type ListCampaignsQuery, type ListChatMessagesQuery, type ListContactsQuery, type ListConversationsQuery, type ListMessagesQuery, type ListRadioEventsQuery, type LogInput, type LogResult, type ManagementConfig, type Message, type MessageClass, type MessagingConfig, type MessagingErrorCode, type ModuleEntitlement, type Paginated$1 as Paginated, type PartnerCompany, type PartnerConfig, type PartnerDomain, type PartnerOwnerInput, type PartnerUser, type PartnerUserInput, type RadioChannel, type RadioChannelInput, type RadioEvent, type RadioLevel, type RadioProject, type RadioProjectCreated, type ReplyInput, type SbResult$1 as SbResult, type SendEmailInput, type SendPushInput, type SendResult, type SendSmsInput, SignalbirdClient, type SignalbirdConfig, SignalbirdError, SignalbirdManagement, SignalbirdMessaging, SignalbirdPartner, type SmsPreview, type StartConversationInput, type TeamEmbedTokenInput, type UpdateConversationInput, type UpdateRadioProjectInput, type UpdateVisitorInput, type UptimeIncident, type UptimeRange, type UptimeReport, type VerifyDomainResult, management, resetManagement, resetSignalbird, signalbird, verifyWebhook };