cordova-plugin-pushizo 0.0.0-stage → 0.2.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,402 @@
1
- # Temporary Holding Version
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>
2
11
 
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.
12
+ ## English
13
+
14
+ **Pushizo Cordova plugin** — Cordova plugin that wraps the native Pushizo Android and iOS SDKs through cordova.exec.
15
+
16
+ ```bash
17
+ cordova plugin add cordova-plugin-pushizo
18
+ ```
19
+
20
+ The detailed guide below is in Turkish; code samples are language-neutral. Full documentation:
21
+ [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).
22
+
23
+ ## Türkçe
24
+ <!-- /pushizo:header -->
25
+
26
+ # cordova-plugin-pushizo
27
+
28
+ 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.
29
+
30
+ - cordova ≥ 12, cordova-android ≥ 12 (minSdk 24), cordova-ios ≥ 7 (iOS 15+)
31
+ - Push aboneliği (FCM/APNs), izin istemi ve izin gözlemcisi
32
+ - Bildirim tıklaması (soğuk başlatma dahil), ön plan gösterimini engelleme/erteleme
33
+ - Kullanıcı: `login`/`logout` (`identityHash`), tag, alias, dil, e-posta ve SMS aboneliği
34
+ - In-app mesajlar (tetik, ekran, duraklatma, tıklama ve yaşam döngüsü olayları; native çizim)
35
+ - Konum paylaşımı (yalnızca ön plan, açıklama + izin istemi) ve arka plan bölge izleme
36
+ - Özellik bayrakları (`FeatureFlags`) ve gömülü yerleşimler (`Placements`)
37
+ - Bildirim kutusu, özel olay, KVKK/GDPR gizlilik onayı, günlük seviyesi, bildirim tepsisini temizleme
38
+
39
+ ## Kurulum
40
+
41
+ ```bash
42
+ cordova plugin add cordova-plugin-pushizo
43
+ # monorepo içinden:
44
+ cordova plugin add ../../sdk/cordova
45
+ ```
46
+
47
+ Eklenti JS'i `window.Pushizo` ve `window.plugins.Pushizo` olarak yüklenir. TypeScript için tipler pakettedir (`types/index.d.ts`).
48
+
49
+ ## Kullanım
50
+
51
+ ```js
52
+ document.addEventListener('deviceready', async () => {
53
+ // Tıklama dinleyicisini erken ekleyin; uygulama bildirimden açıldıysa tıklama ilk dinleyiciye teslim edilir.
54
+ Pushizo.Notifications.addClickListener((event) => {
55
+ console.log(event.notification.title, event.result.actionId, event.result.url);
56
+ });
57
+
58
+ await Pushizo.initialize('app_xxx', { apiUrl: 'https://api.pushizo.com', logLevel: 'warn' });
59
+ await Pushizo.Notifications.requestPermission();
60
+ await Pushizo.login('user_42'); // identity verification açıksa: login('user_42', identityHash)
61
+ await Pushizo.User.addTags({ plan: 'pro', level: 3 });
62
+ await Pushizo.User.addEmail('ali@pushizo.com');
63
+ await Pushizo.Session.sendEvent('purchase', { sku: 'A1' }, 49.9);
64
+ });
65
+ ```
66
+
67
+ 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.
68
+
69
+ ### JWT ile kimlik doğrulama
70
+
71
+ App ayarlarında kimlik doğrulama kipi (`identity_verification_mode`) `jwt` veya `both` ise kullanıcı, sunucunuzda
72
+ 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).
73
+
74
+ ```js
75
+ await Pushizo.login('user_42', { jwt: jwtFromBackend }); // yalnızca JWT
76
+ await Pushizo.login('user_42', { identityHash: hmac, jwt: jwtFromBackend }); // both kipinde ikisi birlikte
77
+ await Pushizo.updateUserJwt(refreshedJwt); // süresi dolmadan yenileyin
78
+ await Pushizo.logout();
79
+ ```
80
+
81
+ - JWT yerel SDK'da identity hash ile aynı kalıcı depoda saklanır ve tüm `/sdk/v1/...` isteklerinde
82
+ `Authorization: Bearer <jwt>` başlığıyla gider; gövdeye/URL'ye yazılmaz, loglanmaz. `logout` belirteci siler.
83
+ - `/config` yanıtında `identity_verification_required` true ise login öncesi kanıt denetlenir: `jwt` kipinde JWT, `hmac`
84
+ kipinde `identityHash` zorunludur, `both` kipinde biri yeter; eksikse `login` `NOT_READY` ile reddedilir. Alan gelmeyen
85
+ eski sunucularda kip `hmac` sayılır; ikinci argümanı metin olan eski `login(id, identityHash)` çağrıları aynen çalışır.
86
+ - `updateUserJwt` giriş yapılmamışsa `NOT_READY` ile reddedilir; başarıda kuyrukta bekleyen işlemler yeni belirteçle
87
+ yeniden denenir.
88
+
89
+ ### Live Activities (iOS)
90
+
91
+ 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;
92
+ yerel başlatma iOS 16.1+ ister.
93
+
94
+ ```js
95
+ await Pushizo.initialize('app_xxx');
96
+ await Pushizo.LiveActivities.setupDefaultLiveActivity(); // her açılışta: belirteçler sunucuya kaydedilir
97
+ await Pushizo.LiveActivities.startDefaultLiveActivity(
98
+ 'order_42', // 1-100 karakter: harf, rakam, _ . : -
99
+ { title: 'Sipariş #42' }, // attributes ('pushizo' anahtarı ayrılmıştır)
100
+ { status: 'Yolda', eta: 12 }, // contentState
101
+ );
102
+ ```
103
+
104
+ - Değerler metin, sonlu sayı veya boolean; anahtarlar 1-64 karakter. Kurala uymayan girdi köprüye gitmeden `TypeError`/
105
+ `RangeError` fırlatır.
106
+ - Hata kodları (`PushizoError.code`): `PLATFORM_NOT_SUPPORTED` (iOS 16.1 öncesi; Android'de her zaman), `NOT_READY`
107
+ (`initialize` yok), `INVALID_ARGUMENT`, `LIVE_ACTIVITY_FAILED` (Live Activities kapalı, `NSSupportsLiveActivities` yok,
108
+ sistem sınırı).
109
+ - Xcode: uygulamanın Info.plist'ine `NSSupportsLiveActivities = YES` ekleyin; **Widget Extension** hedefi oluşturun ve
110
+ hedefe SPM'de `PushizoExtension` ürününü (`import PushizoExtension`), CocoaPods'ta `pod 'Pushizo/Extension'`
111
+ (`import Pushizo`) ekleyin:
112
+
113
+ ```swift
114
+ ActivityConfiguration(for: PushizoDefaultLiveActivityAttributes.self) { context in
115
+ VStack {
116
+ Text(context.attributes.data["title"]?.stringValue ?? "")
117
+ Text(context.state.data["status"]?.description ?? "")
118
+ }
119
+ } dynamicIsland: { context in
120
+ DynamicIsland { DynamicIslandExpandedRegion(.center) { Text(context.state.data["status"]?.description ?? "") } }
121
+ compactLeading: { EmptyView() } compactTrailing: { Text(context.state.data["eta"]?.description ?? "") } minimal: { EmptyView() }
122
+ }
123
+ ```
124
+
125
+ - Dashboard'da (**Live Activities**) veya API'de tür adı tam olarak `PushizoDefaultLiveActivityAttributes` olmalıdır.
126
+ Sunucu: `POST /v1/apps/{appId}/live-activities/PushizoDefaultLiveActivityAttributes/start` (`activity_id`,
127
+ `attributes`, `content_state`, `target`), `…/update` ve `…/end` (`activity_id`, `content_state`).
128
+ - Tip-güvenli kendi türünüz için native tarafta `Pushizo.LiveActivities.register(MyAttributes.self)` kullanın.
129
+
130
+ ### Canlı sohbet
131
+
132
+ ```ts
133
+ await Pushizo.Chat.start({ name: 'Ali' });
134
+ const config = await Pushizo.Chat.getConfig(); // online, offlineMessage, ek sınırları
135
+ const { messages } = await Pushizo.Chat.getMessages();
136
+ Pushizo.Chat.addEventListener('message', ({ message }) => render(message));
137
+ Pushizo.Chat.addEventListener('open', ({ conversationId }) => openChat(conversationId)); // bildirime tıklama
138
+ await Pushizo.Chat.startListening(); // ekran açıkken; ayrılınca stopListening()
139
+ await Pushizo.Chat.sendMessage('Merhaba'); // bot hızlı yanıtı: sendMessage(label, { optionId })
140
+ await Pushizo.Chat.sendAttachment({ base64 }, { fileName: 'a.png', mimeType: 'image/png' });
141
+ await Pushizo.Chat.markRead(messages[messages.length - 1].seq);
142
+ ```
143
+
144
+ Ziyaretçi kimliği, çevrimdışı kuyruk (aynı `client_message_id` ile yeniden deneme), canlı akış (SSE; koparsa üstel
145
+ geri çekilme + `after_seq` yoklaması) ve push ile gelen temsilci mesajları (`pushizo_chat`) yerel Android/iOS SDK'sındadır;
146
+ `start` sonrası login/logout ve push aboneliği değişince bağlama yerel SDK'da yenilenir, logout ziyaretçiyi sıfırlar.
147
+ Mesajlar `seq` ile sıralanır; ağ yokken gönderilen mesaj `pending` döner ve gönderilince olayla sunucu kopyası gelir.
148
+ Ayrıntı: [android rehberi](https://docs.pushizo.com/docs/sdk/android) / [ios rehberi](https://docs.pushizo.com/docs/sdk/ios) → "Canlı sohbet".
149
+
150
+ ### Konum
151
+
152
+ Kullanıcı izin verirse cihazın konumu push aboneliğine yazılır; segmentlerde konuma göre hedefleme için
153
+ kullanılır. Paylaşım **yalnızca ön planda** çalışır (arka plan konumu yok): native SDK konumu oturum başında ve uygulama
154
+ ön plana döndüğünde en sık 5 dakikada bir gönderir. İzin yoksa veya gizlilik onayı (`requiresPrivacyConsent`)
155
+ verilmemişse hiçbir şey gönderilmez; tercih kalıcıdır.
156
+
157
+ ```js
158
+ const granted = await Pushizo.Location.requestPermission('Yakındaki mağazaları göstermek için konumunuzu kullanırız.');
159
+ if (granted) await Pushizo.Location.setShared(true);
160
+ const shared = await Pushizo.Location.isShared(); // kalıcı tercih (izin durumundan bağımsız)
161
+ await Pushizo.Location.setShared(false); // paylaşımı kapatır, sunucudaki konumu siler
162
+ ```
163
+
164
+ - `requestPermission(rationale?)`: izin yoksa önce açıklama gösterilir (`rationale`; verilmezse SDK'nın Türkçe/İngilizce
165
+ varsayılan metni), kullanıcı "Şimdi değil" derse sistem istemi açılmaz. İzin varsa veya verildiyse `true`; reddedildiyse,
166
+ uygulama izni tanımlamadıysa ya da vazgeçildiyse `false`. `isShared()` native SDK'daki özelliğin asenkron karşılığıdır.
167
+ - `initialize` öncesinde `setShared`/`requestPermission` `NOT_READY` koduyla reddedilir.
168
+ - **KVKK:** sunucuya ulaşan ilk konum açık rıza kaydı olarak saklanır. Kullanıcıya konumun neden kullanıldığını
169
+ açıklayın ve paylaşımı yalnızca onayıyla açın. `setShared(false)` sunucuya `location: null` gönderir; konum ve rıza
170
+ kaydı silinir, henüz gönderilmemiş konum atılır.
171
+ - **iOS:** `Info.plist` dosyasına `NSLocationWhenInUseUsageDescription` ekleyin (yoksa `requestPermission` `false` döner);
172
+ `config.xml` içinde `<platform name="ios">` altına
173
+ `<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
174
+ sorulamaz, kullanıcı Ayarlar'a yönlendirilmelidir.
175
+ - **Android:** eklenti konum iznini manifest'e **otomatik eklemez**; uygulamanın `config.xml` dosyasına kendiniz ekleyin
176
+ (yaklaşık konum yeterlidir, hassas konum isteğe bağlıdır; `<widget>` öğesinde
177
+ `xmlns:android="http://schemas.android.com/apk/res/android"` tanımlı olmalıdır):
178
+
179
+ ```xml
180
+ <platform name="android">
181
+ <config-file target="AndroidManifest.xml" parent="/manifest">
182
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
183
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
184
+ </config-file>
185
+ </platform>
186
+ ```
187
+
188
+ 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
189
+ string kaynaklarını kullanır; sistem izni `cordova.requestPermissions` ile (`Pushizo.Location.PERMISSION_REQUEST_CODE`)
190
+ istenir ve sonuç SDK'ya iletilir.
191
+
192
+ ### Arka plan bölge izleme
193
+
194
+ Dashboard'da tanımlı coğrafi bölgelere giriş/çıkışı uygulama kapalıyken de yakalar ([ADR-0065](https://github.com/pushizo/pushizo/blob/main/docs/adr/0065-arka-plan-bolge-izleme.md)).
195
+ İzlemeyi işletim sistemi yapar; sunucuya koordinat gitmez, yalnızca giriş/çıkış olayı bildirilir. Varsayılan **kapalıdır**.
196
+
197
+ ```js
198
+ await Pushizo.Location.setGeofencingEnabled(true); // kalıcı tercih
199
+ const on = await Pushizo.Location.isGeofencingEnabled();
200
+ ```
201
+
202
+ - Üç koşul birlikte gerekir: `setGeofencingEnabled(true)`, `setShared(true)` ve arka plan konum izni (iOS "Her Zaman",
203
+ Android `ACCESS_BACKGROUND_LOCATION`). Köprü bu izni **istemez** ve manifest/Info.plist'e **eklemez**; `Info.plist`'e `NSLocationAlwaysAndWhenInUseUsageDescription`, Android manifest'ine `ACCESS_BACKGROUND_LOCATION` eklemek
204
+ (`config.xml` `<config-file>`/`<edit-config>`) ve izni istemek uygulamanın işidir.
205
+ Mağaza beyanları ve aydınlatma metni uygulama geliştiricisinin sorumluluğundadır.
206
+ - `initialize` öncesinde `setGeofencingEnabled` `NOT_READY` ile reddedilir. `setShared(false)` veya gizlilik onayının geri
207
+ alınması kayıtlı bölgeleri kaldırır; tercih korunur.
208
+ - **Android:** uygulamada `com.google.android.gms:play-services-location` bağımlılığı bulunmalıdır; yoksa yerel SDK uyarı
209
+ loglar ve izleme başlamaz.
210
+
211
+ ### Özellik bayrakları
212
+
213
+ Bir özelliği yeni sürüm yayımlamadan açıp kapatın, kademeli yayın yapın veya metin/sayı/JSON değerleri uzaktan yönetin
214
+ ([rehber](https://docs.pushizo.com/docs/guides/feature-flags)). Değerler yerel SDK'da oturum başında yenilenir ve cihazda
215
+ saklanır; ağ yoksa son değer, hiç alınmadıysa koddaki varsayılan döner. Gizlilik onayı beklenirken istek gönderilmez.
216
+
217
+ ```js
218
+ if (await Pushizo.FeatureFlags.isEnabled('yeni_sepet')) showNewCart();
219
+ const limit = await Pushizo.FeatureFlags.getValue('sepet_limiti', 10); // metin, sayı, boolean, nesne veya dizi
220
+ const refreshed = await Pushizo.FeatureFlags.refresh(); // yeni değerler alındıysa true
221
+ ```
222
+
223
+ `isEnabled(key, default = false)` ve `getValue(key, default = null)` yerel önbellekten okur; köprü asenkron olduğundan
224
+ Promise döndürürler. Boş anahtar `TypeError` ile reddedilir.
225
+
226
+ ### Gömülü yerleşimler
227
+
228
+ Uygulamanın ayırdığı bir alana (ana sayfa afişi, liste arası kart) dashboard'dan içerik gönderin
229
+ ([ADR-0068](https://github.com/pushizo/pushizo/blob/main/docs/adr/0068-gomulu-yerlesimler.md)). Köprü yalnızca modeli
230
+ döndürür; çizim uygulamanındır.
231
+
232
+ ```js
233
+ const messages = await Pushizo.Placements.list('home_banner', { limit: 2 }); // InAppMessage[]
234
+ for (const message of messages) {
235
+ render(message.display.blocks); // title/body/image/button/carousel blokları veya display.html
236
+ await Pushizo.Placements.reportImpression(message); // içerik ekrana gelince
237
+ }
238
+ await Pushizo.Placements.reportClick(message, buttonId); // düğme tıklanınca (buttonId: blok/kart düğmesinin id'si)
239
+ await Pushizo.Placements.reportDismiss(message); // kullanıcı kapatınca
240
+ ```
241
+
242
+ - Anahtar `^[a-z][a-z0-9_.-]{0,63}$` kalıbına uymalı, `limit` 1-10 olmalıdır; aksi halde çağrı köprüye gitmeden
243
+ `TypeError`/`RangeError` ile reddedilir. Abonelik yoksa veya gizlilik onayı bekleniyorsa liste boştur.
244
+ - `InAppMessage` alanları yerel modelle aynıdır (`id`, `priority`, `triggers`, `triggerGroups`, `variantId`, `display`,
245
+ `remainingImpressions`, `minIntervalSeconds`, `stopAfterInteraction`, `lastImpressionAt`, `endAt`, `language`); zamanlar
246
+ epoch milisaniyedir. Düğme aksiyonları (`url`, `deeplink`, `tags`, `push_prompt`, `outcome`, `dismiss`) uygulama
247
+ tarafından yürütülür.
248
+ - Rapor çağrıları yerel tarafta son `list` yanıtlarındaki mesajı kimliğiyle bulur (en çok 50 mesaj saklanır); listeden
249
+ gelmeyen bir mesaj için rapor sessizce yok sayılır (debug log).
250
+ - Ağ/sunucu hatasında Android boş liste döndürür; iOS çağrıyı hata koduyla reddeder.
251
+
252
+ ### Olaylar
253
+
254
+ ```js
255
+ Pushizo.Notifications.addForegroundLifecycleListener((event) => {
256
+ event.preventDefault(); // ön planda gösterme; sonra göstermek için: event.display()
257
+ });
258
+ Pushizo.Notifications.addPermissionObserver(({ permission }) => {});
259
+ Pushizo.User.pushSubscription.addObserver((state) => {}); // { id, token, optedIn, permission }
260
+ Pushizo.InAppMessages.addClickListener((e) => {}); // { message: { id }, result: { actionId, url } }
261
+ Pushizo.InAppMessages.addLifecycleListener({ willDisplay() {}, didDismiss() {} });
262
+ ```
263
+
264
+ `addPermissionObserver` olayları yerel Android/iOS SDK izin gözlemcisinden gelir (izin isteği sonucu ve uygulama ön plana
265
+ döndüğünde ayarlardan yapılan değişiklik; yalnızca gerçek değişiklikte).
266
+
267
+ 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.
268
+
269
+ ### In-app, bildirim kutusu ve diğerleri
270
+
271
+ ```js
272
+ await Pushizo.InAppMessages.addTrigger('level', 5);
273
+ await Pushizo.InAppMessages.setScreen('checkout');
274
+ await Pushizo.InAppMessages.setPaused(false);
275
+
276
+ const page = await Pushizo.Inbox.list({ limit: 20 }); // { items, unreadCount, nextCursor, hasMore }
277
+ await Pushizo.Inbox.markRead(page.items[0].id);
278
+ await Pushizo.Inbox.markAllRead();
279
+ await Pushizo.Inbox.archive(page.items[0].id);
280
+
281
+ // Tercihler (kategori × kanal opt-in; channel verilmezse tüm kanallar). Abonelik yoksa NOT_READY.
282
+ const { preferences, categories } = await Pushizo.User.getPreferences();
283
+ await Pushizo.User.setPreferences([
284
+ { category: 'promo', optedIn: false },
285
+ { category: 'news', channel: 'email', optedIn: true },
286
+ ]); // güncel listeyi döndürür
287
+
288
+ await Pushizo.Notifications.clearAll();
289
+ await Pushizo.Notifications.removeGroupedNotifications('orders');
290
+ await Pushizo.Notifications.removeNotification(id); // Android: notification.androidNotificationId; iOS: UNNotificationRequest.identifier (metin)
291
+ await Pushizo.setConsentGiven(true); // requiresPrivacyConsent: true ile başlatıldıysa
292
+ await Pushizo.Debug.setLogLevel('debug');
293
+ await Pushizo.logout();
294
+ ```
295
+
296
+ ### HTML in-app ve carousel
297
+
298
+ In-app mesajları yerel Android/iOS SDK'sı çizer; bu paket köprüdür. HTML in-app (sandbox'lı WebView, köprü
299
+ `close`/`click`/`addTag`/`trackEvent`) ve carousel blokları yerel SDK'dan olduğu gibi devralınır: ek kod veya
300
+ yapılandırma gerekmez, tıklama ve yaşam döngüsü olayları mevcut in-app dinleyicilerine gelir. Yetenek bildirimi
301
+ (`supports=html,carousel`) yerel SDK tarafından yapılır; desteklemeyen eski yerel sürümlere sunucu HTML mesaj göndermez
302
+ ve carousel bloklarını çıkarır.
303
+
304
+ ## Android kurulumu (FCM)
305
+
306
+ 1. Firebase konsolunda Android uygulaması ekleyin; `google-services.json` dosyasını proje köküne koyun ve `config.xml` içine ekleyin:
307
+
308
+ ```xml
309
+ <platform name="android">
310
+ <preference name="GradlePluginKotlinEnabled" value="true" />
311
+ <preference name="GradlePluginGoogleServicesEnabled" value="true" />
312
+ <preference name="GradlePluginGoogleServicesVersion" value="4.4.2" />
313
+ <preference name="android-compileSdkVersion" value="35" />
314
+ <resource-file src="google-services.json" target="app/google-services.json" />
315
+ </platform>
316
+ ```
317
+
318
+ Köprü Kotlin ile yazıldığından `GradlePluginKotlinEnabled` zorunludur. Yerel SDK 0.2.1'in `androidx.work` bağımlılığı
319
+ `compileSdk` 35 ister; cordova-android 13'ün varsayılanı 34 olduğundan `android-compileSdkVersion` tercihi gerekir.
320
+ 2. Pushizo dashboard'unda Firebase servis hesabı JSON'unu yükleyin (kurulum sihirbazında **Cordova** seçilebilir); kayıt sonrası otomatik doğrulanır.
321
+ 3. Eklenti `com.pushizo:pushizo-android:0.2.1` artefaktına bağlıdır (özellik bayrakları, yerleşimler ve bölge izleme bu sürümle gelir). Maven Central yayınına kadar `sdk/android` içinde `gradle :pushizo:publishToMavenLocal` çalıştırın; eklenti `mavenLocal()` deposunu ekler.
322
+ 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.
323
+
324
+ 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.
325
+
326
+ ## iOS kurulumu (APNs)
327
+
328
+ 1. `config.xml`:
329
+
330
+ ```xml
331
+ <platform name="ios">
332
+ <preference name="deployment-target" value="15.0" />
333
+ <preference name="SwiftVersion" value="5" />
334
+ </platform>
335
+ ```
336
+
337
+ 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.
338
+ 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.
339
+ 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.
340
+ 5. Pushizo SDK'sı `UNUserNotificationCenter` delegesini üstlenir; başka bir push eklentisiyle (ör. `cordova-plugin-firebasex`) birlikte kullanmayın.
341
+
342
+ ### Notification Service Extension (zengin medya, teslim bildirimi)
343
+
344
+ 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:
345
+
346
+ ```ruby
347
+ target 'PushizoNSE' do
348
+ pod 'Pushizo/Extension', :path => '<repo>/sdk/ios'
349
+ end
350
+ ```
351
+
352
+ ve `NotificationService.swift` dosyasını SDK yardımcısına devredin:
353
+
354
+ ```swift
355
+ import UserNotifications
356
+ import Pushizo
357
+
358
+ class NotificationService: UNNotificationServiceExtension {
359
+ let hs = PushizoNotificationServiceExtension(appId: "app_xxx", apiUrl: "https://api.pushizo.com",
360
+ appGroup: "group.com.pushizo.app.pushizo")
361
+
362
+ override func didReceive(_ request: UNNotificationRequest, withContentHandler handler: @escaping (UNNotificationContent) -> Void) {
363
+ hs.didReceive(request, withContentHandler: handler)
364
+ }
365
+
366
+ override func serviceExtensionTimeWillExpire() { hs.serviceExtensionTimeWillExpire() }
367
+ }
368
+ ```
369
+
370
+ 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.
371
+
372
+ ## Geliştirme
373
+
374
+ ```bash
375
+ npm install
376
+ npm run typecheck
377
+ npm test # vitest: cephe, cordova.exec köprüsü ve native sözleşme denetimi
378
+ npm run build # src/*.ts → www/*.js (eklentiyle birlikte yayınlanır, depoda tutulur)
379
+ ```
380
+
381
+ Adım adım kurulum ve örnek kod: [cordova rehberi](https://docs.pushizo.com/docs/sdk/cordova).
382
+
383
+ <!-- pushizo:footer -->
384
+ ---
385
+
386
+ ## Support · Destek
387
+
388
+ - **Guide · Rehber:** [docs.pushizo.com/docs/sdk/cordova](https://docs.pushizo.com/docs/sdk/cordova)
389
+ - **API reference & OpenAPI · API referansı ve OpenAPI:** [docs.pushizo.com/docs/api](https://docs.pushizo.com/docs/api) ·
390
+ [pushizo-openapi](https://github.com/pushizo/pushizo-openapi)
391
+ - **Bugs & ideas · Hata ve öneri:** [Issues](https://github.com/pushizo/pushizo-cordova/issues)
392
+ - **Security · Güvenlik:** please do not open public issues; email [security@pushizo.com](mailto:security@pushizo.com) ·
393
+ herkese açık issue açmayın, bu adrese yazın.
394
+ - **Help · Destek:** [support@pushizo.com](mailto:support@pushizo.com)
395
+
396
+ This repository is mirrored automatically from the Pushizo main repository on every release. Please open an issue
397
+ instead of a pull request; fixes land in the main repository and ship with the next release.
398
+ Bu depo her sürümde Pushizo ana deposundan otomatik yansıtılır. Pull request yerine issue açın; düzeltmeler ana depoda
399
+ yapılır ve bir sonraki sürümle buraya gelir.
400
+
401
+ Released under the MIT License · MIT lisanslıdır — [LICENSE](https://github.com/pushizo/pushizo-cordova/blob/main/LICENSE).
402
+ <!-- /pushizo:footer -->
package/package.json CHANGED
@@ -1,6 +1,57 @@
1
1
  {
2
2
  "name": "cordova-plugin-pushizo",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.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.2.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.2.1" />
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.2" />
93
+ </pods>
94
+ </podspec>
95
+ </platform>
96
+ </plugin>