cordova-plugin-pushizo 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pushizo contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,350 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ <!-- pushizo:header -->
2
+ <p align="center">
3
+ <a href="https://pushizo.com"><img src="https://raw.githubusercontent.com/pushizo/.github/main/profile/assets/mark.svg" alt="Pushizo" width="56" height="56"></a>
4
+ </p>
5
+ <p align="center">
6
+ <a href="https://docs.pushizo.com/docs/sdk/cordova"><img src="https://img.shields.io/badge/docs-docs.pushizo.com-5b4bdb" alt="Docs"></a>
7
+ <a href="https://docs.pushizo.com/docs/api"><img src="https://img.shields.io/badge/API-reference-b44fc4" alt="API reference"></a>
8
+ <a href="https://github.com/pushizo/pushizo-cordova/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-16130f" alt="License: MIT"></a>
9
+ </p>
10
+ <p align="center"><a href="#english">English</a> · <a href="#türkçe">Türkçe</a></p>
11
+
12
+ ## English
13
+
14
+ **Pushizo Cordova plugin** — Cordova plugin that wraps the native Pushizo Android and iOS SDKs through cordova.exec.
15
+
16
+ > **Status:** Publishing to npm is in progress.<br>
17
+ > **Durum:** npm yayını hazırlanıyor.
18
+
19
+ **Install from GitHub until then · O zamana kadar GitHub'dan kurulum:**
20
+
21
+ ```bash
22
+ cordova plugin add https://github.com/pushizo/pushizo-cordova.git#v0.1.0
23
+ ```
24
+
25
+ **After publication · Yayından sonra:**
26
+
27
+ ```bash
28
+ cordova plugin add cordova-plugin-pushizo
29
+ ```
30
+
31
+ The detailed guide below is in Turkish; code samples are language-neutral. Full documentation:
32
+ [docs.pushizo.com/docs/sdk/cordova](https://docs.pushizo.com/docs/sdk/cordova) · API reference: [docs.pushizo.com/docs/api](https://docs.pushizo.com/docs/api).
33
+
34
+ ## Türkçe
35
+ <!-- /pushizo:header -->
36
+
37
+ # cordova-plugin-pushizo
38
+
39
+ Pushizo'nun Cordova eklentisi. Native Pushizo Android (`com.pushizo:pushizo-android`) ve iOS (`Pushizo` pod) SDK'larını `cordova.exec` köprüsüyle sarar. API yüzeyi plan 06 §6.1, eski sağlayıcı v5 ve `@pushizo/capacitor` ile aynıdır.
40
+
41
+ - cordova ≥ 12, cordova-android ≥ 12 (minSdk 24), cordova-ios ≥ 7 (iOS 15+)
42
+ - Push aboneliği (FCM/APNs), izin istemi ve izin gözlemcisi
43
+ - Bildirim tıklaması (soğuk başlatma dahil), ön plan gösterimini engelleme/erteleme
44
+ - Kullanıcı: `login`/`logout` (`identityHash`), tag, alias, dil, e-posta ve SMS aboneliği
45
+ - In-app mesajlar (tetik, ekran, duraklatma, tıklama ve yaşam döngüsü olayları; native çizim)
46
+ - Konum paylaşımı (yalnızca ön plan, açıklama + izin istemi)
47
+ - Bildirim kutusu, özel olay, KVKK/GDPR gizlilik onayı, günlük seviyesi, bildirim tepsisini temizleme
48
+
49
+ ## Kurulum
50
+
51
+ ```bash
52
+ cordova plugin add cordova-plugin-pushizo
53
+ # monorepo içinden:
54
+ cordova plugin add ../../sdk/cordova
55
+ ```
56
+
57
+ Eklenti JS'i `window.Pushizo` ve `window.plugins.Pushizo` olarak yüklenir. TypeScript için tipler pakettedir (`types/index.d.ts`).
58
+
59
+ ## Kullanım
60
+
61
+ ```js
62
+ document.addEventListener('deviceready', async () => {
63
+ // Tıklama dinleyicisini erken ekleyin; uygulama bildirimden açıldıysa tıklama ilk dinleyiciye teslim edilir.
64
+ Pushizo.Notifications.addClickListener((event) => {
65
+ console.log(event.notification.title, event.result.actionId, event.result.url);
66
+ });
67
+
68
+ await Pushizo.initialize('app_xxx', { apiUrl: 'https://api.pushizo.com', logLevel: 'warn' });
69
+ await Pushizo.Notifications.requestPermission();
70
+ await Pushizo.login('user_42'); // identity verification açıksa: login('user_42', identityHash)
71
+ await Pushizo.User.addTags({ plan: 'pro', level: 3 });
72
+ await Pushizo.User.addEmail('ali@pushizo.com');
73
+ await Pushizo.Session.sendEvent('purchase', { sku: 'A1' }, 49.9);
74
+ });
75
+ ```
76
+
77
+ Tüm metotlar Promise döndürür. Hatalar `PushizoError` örneğidir ve `code` alanı taşır: `INVALID_ARGUMENT`, `NOT_READY`, `NOT_FOUND`, `NOT_IMPLEMENTED` veya sunucu hata kodu.
78
+
79
+ ### JWT ile kimlik doğrulama
80
+
81
+ App ayarlarında kimlik doğrulama kipi (`identity_verification_mode`) `jwt` veya `both` ise kullanıcı, sunucunuzda
82
+ imzalanmış kısa ömürlü bir ES256 JWT ile kimliklendirilir (talepler: `sub` = external_id, `aud` = app_id, `exp`/`iat` zorunlu, en çok 24 saat, yalnızca ES256).
83
+
84
+ ```js
85
+ await Pushizo.login('user_42', { jwt: jwtFromBackend }); // yalnızca JWT
86
+ await Pushizo.login('user_42', { identityHash: hmac, jwt: jwtFromBackend }); // both kipinde ikisi birlikte
87
+ await Pushizo.updateUserJwt(refreshedJwt); // süresi dolmadan yenileyin
88
+ await Pushizo.logout();
89
+ ```
90
+
91
+ - JWT yerel SDK'da identity hash ile aynı kalıcı depoda saklanır ve tüm `/sdk/v1/...` isteklerinde
92
+ `Authorization: Bearer <jwt>` başlığıyla gider; gövdeye/URL'ye yazılmaz, loglanmaz. `logout` belirteci siler.
93
+ - `/config` yanıtında `identity_verification_required` true ise login öncesi kanıt denetlenir: `jwt` kipinde JWT, `hmac`
94
+ kipinde `identityHash` zorunludur, `both` kipinde biri yeter; eksikse `login` `NOT_READY` ile reddedilir. Alan gelmeyen
95
+ eski sunucularda kip `hmac` sayılır; ikinci argümanı metin olan eski `login(id, identityHash)` çağrıları aynen çalışır.
96
+ - `updateUserJwt` giriş yapılmamışsa `NOT_READY` ile reddedilir; başarıda kuyrukta bekleyen işlemler yeni belirteçle
97
+ yeniden denenir.
98
+
99
+ ### Live Activities (iOS)
100
+
101
+ Köprü, iOS SDK'nın genel `PushizoDefaultLiveActivityAttributes` türünü kullanır "Live Activities"). Sunucu etkinliği uzaktan başlatır (push-to-start, iOS 17.2+), günceller ve bitirir;
102
+ yerel başlatma iOS 16.1+ ister.
103
+
104
+ ```js
105
+ await Pushizo.initialize('app_xxx');
106
+ await Pushizo.LiveActivities.setupDefaultLiveActivity(); // her açılışta: belirteçler sunucuya kaydedilir
107
+ await Pushizo.LiveActivities.startDefaultLiveActivity(
108
+ 'order_42', // 1-100 karakter: harf, rakam, _ . : -
109
+ { title: 'Sipariş #42' }, // attributes ('pushizo' anahtarı ayrılmıştır)
110
+ { status: 'Yolda', eta: 12 }, // contentState
111
+ );
112
+ ```
113
+
114
+ - Değerler metin, sonlu sayı veya boolean; anahtarlar 1-64 karakter. Kurala uymayan girdi köprüye gitmeden `TypeError`/
115
+ `RangeError` fırlatır.
116
+ - Hata kodları (`PushizoError.code`): `PLATFORM_NOT_SUPPORTED` (iOS 16.1 öncesi; Android'de her zaman), `NOT_READY`
117
+ (`initialize` yok), `INVALID_ARGUMENT`, `LIVE_ACTIVITY_FAILED` (Live Activities kapalı, `NSSupportsLiveActivities` yok,
118
+ sistem sınırı).
119
+ - Xcode: uygulamanın Info.plist'ine `NSSupportsLiveActivities = YES` ekleyin; **Widget Extension** hedefi oluşturun ve
120
+ hedefe SPM'de `PushizoExtension` ürününü (`import PushizoExtension`), CocoaPods'ta `pod 'Pushizo/Extension'`
121
+ (`import Pushizo`) ekleyin:
122
+
123
+ ```swift
124
+ ActivityConfiguration(for: PushizoDefaultLiveActivityAttributes.self) { context in
125
+ VStack {
126
+ Text(context.attributes.data["title"]?.stringValue ?? "")
127
+ Text(context.state.data["status"]?.description ?? "")
128
+ }
129
+ } dynamicIsland: { context in
130
+ DynamicIsland { DynamicIslandExpandedRegion(.center) { Text(context.state.data["status"]?.description ?? "") } }
131
+ compactLeading: { EmptyView() } compactTrailing: { Text(context.state.data["eta"]?.description ?? "") } minimal: { EmptyView() }
132
+ }
133
+ ```
134
+
135
+ - Dashboard'da (**Live Activities**) veya API'de tür adı tam olarak `PushizoDefaultLiveActivityAttributes` olmalıdır.
136
+ Sunucu: `POST /v1/apps/{appId}/live-activities/PushizoDefaultLiveActivityAttributes/start` (`activity_id`,
137
+ `attributes`, `content_state`, `target`), `…/update` ve `…/end` (`activity_id`, `content_state`).
138
+ - Tip-güvenli kendi türünüz için native tarafta `Pushizo.LiveActivities.register(MyAttributes.self)` kullanın.
139
+
140
+ ### Canlı sohbet
141
+
142
+ ```ts
143
+ await Pushizo.Chat.start({ name: 'Ali' });
144
+ const config = await Pushizo.Chat.getConfig(); // online, offlineMessage, ek sınırları
145
+ const { messages } = await Pushizo.Chat.getMessages();
146
+ Pushizo.Chat.addEventListener('message', ({ message }) => render(message));
147
+ Pushizo.Chat.addEventListener('open', ({ conversationId }) => openChat(conversationId)); // bildirime tıklama
148
+ await Pushizo.Chat.startListening(); // ekran açıkken; ayrılınca stopListening()
149
+ await Pushizo.Chat.sendMessage('Merhaba'); // bot hızlı yanıtı: sendMessage(label, { optionId })
150
+ await Pushizo.Chat.sendAttachment({ base64 }, { fileName: 'a.png', mimeType: 'image/png' });
151
+ await Pushizo.Chat.markRead(messages[messages.length - 1].seq);
152
+ ```
153
+
154
+ Ziyaretçi kimliği, çevrimdışı kuyruk (aynı `client_message_id` ile yeniden deneme), canlı akış (SSE; koparsa üstel
155
+ geri çekilme + `after_seq` yoklaması) ve push ile gelen temsilci mesajları (`pushizo_chat`) yerel Android/iOS SDK'sındadır;
156
+ `start` sonrası login/logout ve push aboneliği değişince bağlama yerel SDK'da yenilenir, logout ziyaretçiyi sıfırlar.
157
+ Mesajlar `seq` ile sıralanır; ağ yokken gönderilen mesaj `pending` döner ve gönderilince olayla sunucu kopyası gelir.
158
+ Ayrıntı: [android rehberi](https://docs.pushizo.com/docs/sdk/android) / [ios rehberi](https://docs.pushizo.com/docs/sdk/ios) → "Canlı sohbet".
159
+
160
+ ### Konum
161
+
162
+ Kullanıcı izin verirse cihazın konumu push aboneliğine yazılır; segmentlerde konuma göre hedefleme için
163
+ kullanılır. Paylaşım **yalnızca ön planda** çalışır (arka plan konumu yok): native SDK konumu oturum başında ve uygulama
164
+ ön plana döndüğünde en sık 5 dakikada bir gönderir. İzin yoksa veya gizlilik onayı (`requiresPrivacyConsent`)
165
+ verilmemişse hiçbir şey gönderilmez; tercih kalıcıdır.
166
+
167
+ ```js
168
+ const granted = await Pushizo.Location.requestPermission('Yakındaki mağazaları göstermek için konumunuzu kullanırız.');
169
+ if (granted) await Pushizo.Location.setShared(true);
170
+ const shared = await Pushizo.Location.isShared(); // kalıcı tercih (izin durumundan bağımsız)
171
+ await Pushizo.Location.setShared(false); // paylaşımı kapatır, sunucudaki konumu siler
172
+ ```
173
+
174
+ - `requestPermission(rationale?)`: izin yoksa önce açıklama gösterilir (`rationale`; verilmezse SDK'nın Türkçe/İngilizce
175
+ varsayılan metni), kullanıcı "Şimdi değil" derse sistem istemi açılmaz. İzin varsa veya verildiyse `true`; reddedildiyse,
176
+ uygulama izni tanımlamadıysa ya da vazgeçildiyse `false`. `isShared()` native SDK'daki özelliğin asenkron karşılığıdır.
177
+ - `initialize` öncesinde `setShared`/`requestPermission` `NOT_READY` koduyla reddedilir.
178
+ - **KVKK:** sunucuya ulaşan ilk konum açık rıza kaydı olarak saklanır. Kullanıcıya konumun neden kullanıldığını
179
+ açıklayın ve paylaşımı yalnızca onayıyla açın. `setShared(false)` sunucuya `location: null` gönderir; konum ve rıza
180
+ kaydı silinir, henüz gönderilmemiş konum atılır.
181
+ - **iOS:** `Info.plist` dosyasına `NSLocationWhenInUseUsageDescription` ekleyin (yoksa `requestPermission` `false` döner);
182
+ `config.xml` içinde `<platform name="ios">` altına
183
+ `<edit-config file="*-Info.plist" target="NSLocationWhenInUseUsageDescription" mode="merge"><string>…</string></edit-config>`. Yalnızca "Uygulamayı Kullanırken" izni istenir; "Her Zaman" istenmez. Reddedilmiş izin yeniden
184
+ sorulamaz, kullanıcı Ayarlar'a yönlendirilmelidir.
185
+ - **Android:** eklenti konum iznini manifest'e **otomatik eklemez**; uygulamanın `config.xml` dosyasına kendiniz ekleyin
186
+ (yaklaşık konum yeterlidir, hassas konum isteğe bağlıdır; `<widget>` öğesinde
187
+ `xmlns:android="http://schemas.android.com/apk/res/android"` tanımlı olmalıdır):
188
+
189
+ ```xml
190
+ <platform name="android">
191
+ <config-file target="AndroidManifest.xml" parent="/manifest">
192
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
193
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
194
+ </config-file>
195
+ </platform>
196
+ ```
197
+
198
+ Yalnızca manifest'te tanımlı izinler istenir; hiçbiri yoksa uyarı loglanır ve `false` döner. Açıklama diyaloğu SDK'nın
199
+ string kaynaklarını kullanır; sistem izni `cordova.requestPermissions` ile (`Pushizo.Location.PERMISSION_REQUEST_CODE`)
200
+ istenir ve sonuç SDK'ya iletilir.
201
+
202
+ ### Olaylar
203
+
204
+ ```js
205
+ Pushizo.Notifications.addForegroundLifecycleListener((event) => {
206
+ event.preventDefault(); // ön planda gösterme; sonra göstermek için: event.display()
207
+ });
208
+ Pushizo.Notifications.addPermissionObserver(({ permission }) => {});
209
+ Pushizo.User.pushSubscription.addObserver((state) => {}); // { id, token, optedIn, permission }
210
+ Pushizo.InAppMessages.addClickListener((e) => {}); // { message: { id }, result: { actionId, url } }
211
+ Pushizo.InAppMessages.addLifecycleListener({ willDisplay() {}, didDismiss() {} });
212
+ ```
213
+
214
+ `addPermissionObserver` olayları yerel Android/iOS SDK izin gözlemcisinden gelir (izin isteği sonucu ve uygulama ön plana
215
+ döndüğünde ayarlardan yapılan değişiklik; yalnızca gerçek değişiklikte).
216
+
217
+ Her `add…` çağrısı aboneliği kaldıran bir fonksiyon döndürür. Olaylar native taraftan tek bir `keepCallback` kanalıyla gelir; kanal açılmadan oluşan olaylar (ör. soğuk başlatma tıklaması) native tarafta tamponlanır.
218
+
219
+ ### In-app, bildirim kutusu ve diğerleri
220
+
221
+ ```js
222
+ await Pushizo.InAppMessages.addTrigger('level', 5);
223
+ await Pushizo.InAppMessages.setScreen('checkout');
224
+ await Pushizo.InAppMessages.setPaused(false);
225
+
226
+ const page = await Pushizo.Inbox.list({ limit: 20 }); // { items, unreadCount, nextCursor, hasMore }
227
+ await Pushizo.Inbox.markRead(page.items[0].id);
228
+ await Pushizo.Inbox.markAllRead();
229
+ await Pushizo.Inbox.archive(page.items[0].id);
230
+
231
+ // Tercihler (kategori × kanal opt-in; channel verilmezse tüm kanallar). Abonelik yoksa NOT_READY.
232
+ const { preferences, categories } = await Pushizo.User.getPreferences();
233
+ await Pushizo.User.setPreferences([
234
+ { category: 'promo', optedIn: false },
235
+ { category: 'news', channel: 'email', optedIn: true },
236
+ ]); // güncel listeyi döndürür
237
+
238
+ await Pushizo.Notifications.clearAll();
239
+ await Pushizo.Notifications.removeGroupedNotifications('orders');
240
+ await Pushizo.Notifications.removeNotification(id); // Android: notification.androidNotificationId; iOS: UNNotificationRequest.identifier (metin)
241
+ await Pushizo.setConsentGiven(true); // requiresPrivacyConsent: true ile başlatıldıysa
242
+ await Pushizo.Debug.setLogLevel('debug');
243
+ await Pushizo.logout();
244
+ ```
245
+
246
+ ### HTML in-app ve carousel
247
+
248
+ In-app mesajları yerel Android/iOS SDK'sı çizer; bu paket köprüdür. HTML in-app (sandbox'lı WebView, köprü
249
+ `close`/`click`/`addTag`/`trackEvent`) ve carousel blokları yerel SDK'dan olduğu gibi devralınır: ek kod veya
250
+ yapılandırma gerekmez, tıklama ve yaşam döngüsü olayları mevcut in-app dinleyicilerine gelir. Yetenek bildirimi
251
+ (`supports=html,carousel`) yerel SDK tarafından yapılır; desteklemeyen eski yerel sürümlere sunucu HTML mesaj göndermez
252
+ ve carousel bloklarını çıkarır.
253
+
254
+ ## Android kurulumu (FCM)
255
+
256
+ 1. Firebase konsolunda Android uygulaması ekleyin; `google-services.json` dosyasını proje köküne koyun ve `config.xml` içine ekleyin:
257
+
258
+ ```xml
259
+ <platform name="android">
260
+ <preference name="GradlePluginKotlinEnabled" value="true" />
261
+ <preference name="GradlePluginGoogleServicesEnabled" value="true" />
262
+ <preference name="GradlePluginGoogleServicesVersion" value="4.4.2" />
263
+ <resource-file src="google-services.json" target="app/google-services.json" />
264
+ </platform>
265
+ ```
266
+
267
+ Köprü Kotlin ile yazıldığından `GradlePluginKotlinEnabled` zorunludur.
268
+ 2. Pushizo dashboard'unda Firebase servis hesabı JSON'unu yükleyin (kurulum sihirbazında **Cordova** seçilebilir); kayıt sonrası otomatik doğrulanır.
269
+ 3. Eklenti `com.pushizo:pushizo-android` artefaktına bağlıdır. Maven Central yayınına kadar `sdk/android` içinde `gradle :pushizo:publishToMavenLocal` çalıştırın; eklenti `mavenLocal()` deposunu ekler.
270
+ 4. FCM servisi, `POST_NOTIFICATIONS` izni ve bildirim Activity'si SDK manifestinden birleşir. Bildirim ikonu için `AndroidManifest.xml` içinde `com.pushizo.sdk.default_notification_icon` meta-data'sı verilebilir.
271
+
272
+ Eklenti, JS ile yapılan `initialize` ayarlarını (yalnızca uygulama kimliği ve herkese açık ayarlar) saklar; süreç bildirim tıklaması veya FCM mesajıyla yeniden başladığında SDK WebView yüklenmeden başlatılır.
273
+
274
+ ## iOS kurulumu (APNs)
275
+
276
+ 1. `config.xml`:
277
+
278
+ ```xml
279
+ <platform name="ios">
280
+ <preference name="deployment-target" value="15.0" />
281
+ <preference name="SwiftVersion" value="5" />
282
+ </platform>
283
+ ```
284
+
285
+ 2. Eklenti Push Notifications yetkisini (`aps-environment`) ve `remote-notification` arka plan modunu ekler. Pushizo dashboard'unda APNs `.p8` anahtarını veya `.p12` sertifikasını yükleyin.
286
+ 3. `Pushizo` pod'u yayınlanana kadar `platforms/ios/Podfile` içinde `pod 'Pushizo', :path => '<repo>/sdk/ios'` kullanın ve `pod install` çalıştırın.
287
+ 4. APNs token geri çağrıları (`didRegisterForRemoteNotificationsWithDeviceToken`/`didFailToRegister…`) eklenti yüklenirken AppDelegate sınıfına çalışma zamanında eklenir; AppDelegate'te bu metotlar varsa önce SDK'ya iletilir, sonra sizin kodunuz çalışır.
288
+ 5. Pushizo SDK'sı `UNUserNotificationCenter` delegesini üstlenir; başka bir push eklentisiyle (ör. `cordova-plugin-firebasex`) birlikte kullanmayın.
289
+
290
+ ### Notification Service Extension (zengin medya, teslim bildirimi)
291
+
292
+ Resimli bildirimler, rozet artışı ve uygulama kapalıyken `received` bildirimi için Xcode'da (`platforms/ios/*.xcworkspace`) **File → New → Target → Notification Service Extension** ekleyin (iOS 15), Podfile'a hedefi ekleyin:
293
+
294
+ ```ruby
295
+ target 'PushizoNSE' do
296
+ pod 'Pushizo/Extension', :path => '<repo>/sdk/ios'
297
+ end
298
+ ```
299
+
300
+ ve `NotificationService.swift` dosyasını SDK yardımcısına devredin:
301
+
302
+ ```swift
303
+ import UserNotifications
304
+ import Pushizo
305
+
306
+ class NotificationService: UNNotificationServiceExtension {
307
+ let hs = PushizoNotificationServiceExtension(appId: "app_xxx", apiUrl: "https://api.pushizo.com",
308
+ appGroup: "group.com.pushizo.app.pushizo")
309
+
310
+ override func didReceive(_ request: UNNotificationRequest, withContentHandler handler: @escaping (UNNotificationContent) -> Void) {
311
+ hs.didReceive(request, withContentHandler: handler)
312
+ }
313
+
314
+ override func serviceExtensionTimeWillExpire() { hs.serviceExtensionTimeWillExpire() }
315
+ }
316
+ ```
317
+
318
+ Uygulama ve NSE hedeflerinde aynı App Group yeteneğini açın ve uygulamanın `Info.plist` dosyasına `PushizoAppGroup` anahtarıyla yazın (rozet sayacı paylaşımı). `cordova platform rm/add ios` Xcode projesini yeniden oluşturduğundan NSE hedefi yeniden eklenmelidir.
319
+
320
+ ## Geliştirme
321
+
322
+ ```bash
323
+ npm install
324
+ npm run typecheck
325
+ npm test # vitest: cephe, cordova.exec köprüsü ve native sözleşme denetimi
326
+ npm run build # src/*.ts → www/*.js (eklentiyle birlikte yayınlanır, depoda tutulur)
327
+ ```
328
+
329
+ Adım adım kurulum ve örnek kod: [cordova rehberi](https://docs.pushizo.com/docs/sdk/cordova).
330
+
331
+ <!-- pushizo:footer -->
332
+ ---
333
+
334
+ ## Support · Destek
335
+
336
+ - **Guide · Rehber:** [docs.pushizo.com/docs/sdk/cordova](https://docs.pushizo.com/docs/sdk/cordova)
337
+ - **API reference & OpenAPI · API referansı ve OpenAPI:** [docs.pushizo.com/docs/api](https://docs.pushizo.com/docs/api) ·
338
+ [pushizo-openapi](https://github.com/pushizo/pushizo-openapi)
339
+ - **Bugs & ideas · Hata ve öneri:** [Issues](https://github.com/pushizo/pushizo-cordova/issues)
340
+ - **Security · Güvenlik:** please do not open public issues; email [security@pushizo.com](mailto:security@pushizo.com) ·
341
+ herkese açık issue açmayın, bu adrese yazın.
342
+ - **Help · Destek:** [support@pushizo.com](mailto:support@pushizo.com)
343
+
344
+ This repository is mirrored automatically from the Pushizo main repository on every release. Please open an issue
345
+ instead of a pull request; fixes land in the main repository and ship with the next release.
346
+ Bu depo her sürümde Pushizo ana deposundan otomatik yansıtılır. Pull request yerine issue açın; düzeltmeler ana depoda
347
+ yapılır ve bir sonraki sürümle buraya gelir.
348
+
349
+ Released under the MIT License · MIT lisanslıdır — [LICENSE](https://github.com/pushizo/pushizo-cordova/blob/main/LICENSE).
350
+ <!-- /pushizo:footer -->
package/package.json CHANGED
@@ -1,6 +1,57 @@
1
- {
2
- "name": "cordova-plugin-pushizo",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "cordova-plugin-pushizo",
3
+ "version": "0.1.0",
4
+ "description": "Pushizo Cordova eklentisi: push bildirimi, kullanıcı/tag, e-posta/SMS, in-app mesaj ve bildirim kutusu (Android + iOS)",
5
+ "license": "MIT",
6
+ "author": "Pushizo <bildirim@pushizo.com>",
7
+ "homepage": "https://docs.pushizo.com/docs/sdk/cordova",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/pushizo/pushizo-cordova.git"
11
+ },
12
+ "keywords": [
13
+ "cordova",
14
+ "ecosystem:cordova",
15
+ "cordova-android",
16
+ "cordova-ios",
17
+ "push",
18
+ "notifications",
19
+ "pushizo"
20
+ ],
21
+ "types": "types/index.d.ts",
22
+ "files": [
23
+ "plugin.xml",
24
+ "www",
25
+ "src/android",
26
+ "src/ios",
27
+ "types/index.d.ts",
28
+ "README.md"
29
+ ],
30
+ "cordova": {
31
+ "id": "cordova-plugin-pushizo",
32
+ "platforms": [
33
+ "android",
34
+ "ios"
35
+ ]
36
+ },
37
+ "engines": {
38
+ "cordovaDependencies": {
39
+ "0.1.0": {
40
+ "cordova": ">=12.0.0",
41
+ "cordova-android": ">=12.0.0",
42
+ "cordova-ios": ">=7.0.0"
43
+ }
44
+ }
45
+ },
46
+ "scripts": {
47
+ "build": "tsc -p tsconfig.build.json",
48
+ "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p types/tsconfig.json --noEmit",
49
+ "test": "vitest run",
50
+ "prepack": "npm run build"
51
+ },
52
+ "devDependencies": {
53
+ "@types/node": "^22.20.5",
54
+ "typescript": "^5.9.3",
55
+ "vitest": "^5.0.3"
56
+ }
57
+ }
package/plugin.xml ADDED
@@ -0,0 +1,96 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- Pushizo Cordova eklentisi: native Pushizo Android/iOS SDK'larını cordova.exec ile sarar. -->
3
+ <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
4
+ xmlns:android="http://schemas.android.com/apk/res/android"
5
+ id="cordova-plugin-pushizo"
6
+ version="0.1.0">
7
+ <name>Pushizo</name>
8
+ <description>Push bildirimi, kullanıcı/tag, e-posta/SMS, in-app mesaj ve bildirim kutusu (Pushizo)</description>
9
+ <license>MIT</license>
10
+ <keywords>push,notifications,fcm,apns,in-app,inbox,pushizo</keywords>
11
+ <repo>https://github.com/pushizo/pushizo-cordova.git</repo>
12
+
13
+ <engines>
14
+ <engine name="cordova" version=">=12.0.0" />
15
+ <engine name="cordova-android" version=">=12.0.0" />
16
+ <engine name="cordova-ios" version=">=7.0.0" />
17
+ </engines>
18
+
19
+ <!-- JS katmanı (TypeScript kaynağı src/*.ts, `npm run build` ile www/ altına derlenir). -->
20
+ <js-module src="www/core.js" name="core" />
21
+ <js-module src="www/bridge.js" name="bridge" />
22
+ <js-module src="www/pushizo.js" name="Pushizo">
23
+ <clobbers target="Pushizo" />
24
+ <clobbers target="window.plugins.Pushizo" />
25
+ </js-module>
26
+
27
+ <platform name="android">
28
+ <config-file target="res/xml/config.xml" parent="/*">
29
+ <feature name="Pushizo">
30
+ <param name="android-package" value="com.pushizo.cordova.PushizoCordovaPlugin" />
31
+ <!-- Soğuk başlatma tıklamasının kaçmaması için eklenti uygulama açılışında yüklenir. -->
32
+ <param name="onload" value="true" />
33
+ </feature>
34
+ </config-file>
35
+
36
+ <!--
37
+ POST_NOTIFICATIONS, INTERNET, FCM servisi (com.google.firebase.MESSAGING_EVENT) ve bildirim açma
38
+ Activity'si Pushizo Android SDK (AAR) manifestinden Gradle manifest birleştirmesiyle eklenir.
39
+ -->
40
+ <config-file target="AndroidManifest.xml" parent="/manifest">
41
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
42
+ </config-file>
43
+ <config-file target="AndroidManifest.xml" parent="/manifest/application">
44
+ <provider
45
+ android:name="com.pushizo.cordova.PushizoInitProvider"
46
+ android:authorities="${applicationId}.pushizo-cordova-init"
47
+ android:exported="false" />
48
+ </config-file>
49
+
50
+ <source-file src="src/android/com/pushizo/cordova/PushizoCordovaPlugin.kt" target-dir="app/src/main/kotlin/com/pushizo/cordova" />
51
+ <source-file src="src/android/com/pushizo/cordova/PushizoBridgeCore.kt" target-dir="app/src/main/kotlin/com/pushizo/cordova" />
52
+ <source-file src="src/android/com/pushizo/cordova/PushizoConfigStore.kt" target-dir="app/src/main/kotlin/com/pushizo/cordova" />
53
+ <source-file src="src/android/com/pushizo/cordova/PushizoInitProvider.kt" target-dir="app/src/main/kotlin/com/pushizo/cordova" />
54
+
55
+ <framework src="src/android/pushizo.gradle" custom="true" type="gradleReference" />
56
+ <framework src="com.pushizo:pushizo-android:0.1.0" />
57
+ </platform>
58
+
59
+ <platform name="ios">
60
+ <config-file target="config.xml" parent="/*">
61
+ <feature name="Pushizo">
62
+ <param name="ios-package" value="PushizoCordovaPlugin" />
63
+ <param name="onload" value="true" />
64
+ </feature>
65
+ </config-file>
66
+
67
+ <!-- Arka plan (content-available) bildirimleri. -->
68
+ <config-file target="*-Info.plist" parent="UIBackgroundModes">
69
+ <array>
70
+ <string>remote-notification</string>
71
+ </array>
72
+ </config-file>
73
+
74
+ <!-- Push Notifications yeteneği (APNs ortamı derleme türüne göre). -->
75
+ <config-file target="*/Entitlements-Debug.plist" parent="aps-environment">
76
+ <string>development</string>
77
+ </config-file>
78
+ <config-file target="*/Entitlements-Release.plist" parent="aps-environment">
79
+ <string>production</string>
80
+ </config-file>
81
+
82
+ <source-file src="src/ios/PushizoCordovaPlugin.swift" />
83
+ <source-file src="src/ios/PushizoBridgeCore.swift" />
84
+ <source-file src="src/ios/PushizoAppDelegateHook.swift" />
85
+
86
+ <podspec>
87
+ <config>
88
+ <source url="https://cdn.cocoapods.org/" />
89
+ </config>
90
+ <pods use-frameworks="true">
91
+ <!-- Monorepo/yerel geliştirme: platforms/ios/Podfile içinde :path => '<repo>/sdk/ios' (README). -->
92
+ <pod name="Pushizo" spec="~> 0.1.0" />
93
+ </pods>
94
+ </podspec>
95
+ </platform>
96
+ </plugin>