rn-erxes-sdk 0.5.0 → 0.5.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 +122 -38
- package/android/build.gradle +13 -13
- package/android/src/main/java/com/erxessdk/RnErxesSdkModule.kt +59 -11
- package/lib/commonjs/ErxesMessenger.js +16 -6
- package/lib/commonjs/ErxesMessenger.js.map +1 -1
- package/lib/commonjs/nativeIos.js.map +1 -1
- package/lib/module/ErxesMessenger.js +16 -6
- package/lib/module/ErxesMessenger.js.map +1 -1
- package/lib/module/nativeIos.js.map +1 -1
- package/lib/typescript/ErxesMessenger.d.ts +12 -2
- package/lib/typescript/ErxesMessenger.d.ts.map +1 -1
- package/lib/typescript/nativeIos.d.ts +7 -1
- package/lib/typescript/nativeIos.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ErxesMessenger.tsx +29 -8
- package/src/nativeIos.ts +7 -1
package/README.md
CHANGED
|
@@ -106,25 +106,28 @@ Screenshots from the native [`erxes/erxes-ios-sdk`](https://github.com/erxes/erx
|
|
|
106
106
|
<img src="https://raw.githubusercontent.com/erxes/erxes-ios-sdk/main/screenshots/recent-chats.png" width="220" alt="Recent Chats">
|
|
107
107
|
</p>
|
|
108
108
|
|
|
109
|
-
### Android
|
|
109
|
+
### Android ✅ Available (chat mode)
|
|
110
110
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
Backed by the native [`erxes/erxes-android-sdk`](https://github.com/erxes/erxes-android-sdk).
|
|
112
|
+
Android currently implements **chat mode** (`displayMode: 'chat'`); the classic
|
|
113
|
+
floating launcher is iOS-only for now (`showLauncher`/`hideLauncher`/`hideMessenger`
|
|
114
|
+
are no-ops on Android). See [Requirements](#requirements).
|
|
114
115
|
|
|
115
116
|
## Roadmap
|
|
116
117
|
|
|
117
118
|
- [x] iOS native messenger (classic widget + chat mode)
|
|
118
|
-
- [
|
|
119
|
+
- [x] Android native messenger (chat mode)
|
|
120
|
+
- [ ] Android classic widget + floating launcher
|
|
119
121
|
|
|
120
122
|
---
|
|
121
123
|
|
|
122
124
|
# rn-erxes-sdk
|
|
123
125
|
|
|
124
|
-
A React Native bridge for the native SwiftUI
|
|
125
|
-
([`erxes/erxes-ios-sdk`](https://github.com/erxes/erxes-ios-sdk)
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
A React Native bridge for the native erxes messenger — SwiftUI on iOS
|
|
127
|
+
([`erxes/erxes-ios-sdk`](https://github.com/erxes/erxes-ios-sdk)) and Jetpack
|
|
128
|
+
Compose on Android ([`erxes/erxes-android-sdk`](https://github.com/erxes/erxes-android-sdk)).
|
|
129
|
+
iOS supports the classic widget and the full-screen **chat mode** (with voice
|
|
130
|
+
messages and header/drawer actions); Android supports chat mode.
|
|
128
131
|
|
|
129
132
|
```tsx
|
|
130
133
|
import { ErxesMessenger } from 'rn-erxes-sdk';
|
|
@@ -138,12 +141,13 @@ Two APIs are exported:
|
|
|
138
141
|
|
|
139
142
|
## Requirements
|
|
140
143
|
|
|
141
|
-
|
|
|
142
|
-
|
|
143
|
-
| iOS
|
|
144
|
-
| Swift
|
|
145
|
-
|
|
|
146
|
-
|
|
|
144
|
+
| | |
|
|
145
|
+
| ------------ | ----------------------------------------------------------- |
|
|
146
|
+
| iOS | 16.0+ |
|
|
147
|
+
| Swift | 5.9+ |
|
|
148
|
+
| Android | minSdk 24+, Java 17 |
|
|
149
|
+
| React Native | 0.81+ |
|
|
150
|
+
| Expo SDK | 53+ (development build or prebuild — Expo Go not supported) |
|
|
147
151
|
|
|
148
152
|
## Docs
|
|
149
153
|
|
|
@@ -180,6 +184,41 @@ cd ios && pod install
|
|
|
180
184
|
npx expo run:ios
|
|
181
185
|
```
|
|
182
186
|
|
|
187
|
+
### Android
|
|
188
|
+
|
|
189
|
+
Autolinking picks up the native module — no manual linking. Notes:
|
|
190
|
+
|
|
191
|
+
- **Chat mode only.** Use `displayMode="chat"`. `minSdk` must be `24+` and the app
|
|
192
|
+
compiles against Java 17.
|
|
193
|
+
- **Android SDK artifact.** The bridge depends on the native
|
|
194
|
+
`io.github.munkhorgilb:messenger-sdk:0.30.2`, resolved from Maven Central.
|
|
195
|
+
- **Action icons (optional).** To use Material icon names for `androidIcon` (e.g.
|
|
196
|
+
`"AccountCircle"`), add the full Compose Material icon set to your app:
|
|
197
|
+
|
|
198
|
+
```gradle
|
|
199
|
+
// android/app/build.gradle
|
|
200
|
+
dependencies {
|
|
201
|
+
implementation(platform("androidx.compose:compose-bom:2024.12.01"))
|
|
202
|
+
implementation("androidx.compose.material:material-icons-extended")
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
For release (R8/ProGuard) builds, keep the icon classes so name-based lookup
|
|
207
|
+
survives minification:
|
|
208
|
+
|
|
209
|
+
```pro
|
|
210
|
+
# android/app/proguard-rules.pro
|
|
211
|
+
-keep class androidx.compose.material.icons.filled.** { *; }
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Alternatively, use a drawable resource instead of a Material icon (no extra
|
|
215
|
+
dependency) — see [Action icons](#action-icons-ios--android).
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
npx expo prebuild --platform android
|
|
219
|
+
npx expo run:android
|
|
220
|
+
```
|
|
221
|
+
|
|
183
222
|
## Usage — `<ErxesMessenger />` (recommended)
|
|
184
223
|
|
|
185
224
|
Render the component where the messenger should be active. It configures the SDK on
|
|
@@ -193,7 +232,7 @@ import { ErxesMessenger } from 'rn-erxes-sdk';
|
|
|
193
232
|
integrationId="YOUR_INTEGRATION_ID"
|
|
194
233
|
subDomain="yourcompany.erxes.io"
|
|
195
234
|
user={{ name: 'Jane Doe', email: 'user@example.com' }}
|
|
196
|
-
|
|
235
|
+
/>;
|
|
197
236
|
```
|
|
198
237
|
|
|
199
238
|
### Example 1 — Classic floating launcher
|
|
@@ -236,14 +275,15 @@ const isFocused = useIsFocused();
|
|
|
236
275
|
{
|
|
237
276
|
id: 'profile',
|
|
238
277
|
title: 'Profile',
|
|
239
|
-
|
|
278
|
+
iosIcon: 'person.crop.circle', // SF Symbol (iOS)
|
|
279
|
+
androidIcon: 'AccountCircle', // Material icon name (Android)
|
|
240
280
|
onPress: async ({ hide }) => {
|
|
241
281
|
await hide();
|
|
242
282
|
navigation.navigate('Profile', { user: CURRENT_USER });
|
|
243
283
|
},
|
|
244
284
|
},
|
|
245
285
|
]}
|
|
246
|
-
|
|
286
|
+
/>;
|
|
247
287
|
```
|
|
248
288
|
|
|
249
289
|
`renderLoading` shows your own UI until the connection handshake completes
|
|
@@ -267,7 +307,8 @@ messenger and pops the screen.
|
|
|
267
307
|
{
|
|
268
308
|
id: 'close',
|
|
269
309
|
title: 'Close',
|
|
270
|
-
|
|
310
|
+
iosIcon: 'xmark', // SF Symbol (iOS)
|
|
311
|
+
androidIcon: 'Close', // Material icon name (Android)
|
|
271
312
|
onPress: async ({ hide }) => {
|
|
272
313
|
await hide();
|
|
273
314
|
navigation.goBack();
|
|
@@ -281,26 +322,55 @@ messenger and pops the screen.
|
|
|
281
322
|
|
|
282
323
|
### Props
|
|
283
324
|
|
|
284
|
-
| Prop
|
|
285
|
-
|
|
286
|
-
| `integrationId`
|
|
287
|
-
| `endpoint` / `serverUrl` / `subDomain`
|
|
288
|
-
| `displayMode`
|
|
289
|
-
| `user`
|
|
290
|
-
| `cachedCustomerId`
|
|
291
|
-
| `primaryColor`
|
|
292
|
-
| `visible`
|
|
293
|
-
| `autoOpen`
|
|
294
|
-
| `autoHideOnUnmount`
|
|
295
|
-
| `launcherVisible`
|
|
296
|
-
| `homeActions` / `drawerActions`
|
|
297
|
-
| `renderLoading`
|
|
298
|
-
| `onLoad` / `onReady` / `onOpen` / `onClose` / `onError` | callbacks
|
|
299
|
-
| `onLoadingChange`
|
|
300
|
-
| `onAction`
|
|
325
|
+
| Prop | Type | Notes |
|
|
326
|
+
| ------------------------------------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
327
|
+
| `integrationId` | `string` | Required. |
|
|
328
|
+
| `endpoint` / `serverUrl` / `subDomain` | `string` | Provide one. `subDomain` accepts `'company.erxes.io'`. |
|
|
329
|
+
| `displayMode` | `'classic' \| 'chat'` | Defaults to `'classic'`. |
|
|
330
|
+
| `user` | `ErxesUser` | `{ name?, email?, phone?, customData? }`. |
|
|
331
|
+
| `cachedCustomerId` | `string` | Reuse a cached customer. |
|
|
332
|
+
| `primaryColor` | `string` | Hex accent, e.g. `'#3f78d9'`. |
|
|
333
|
+
| `visible` | `boolean` | Controlled show/hide on change. |
|
|
334
|
+
| `autoOpen` | `boolean` | Open after configure. Defaults to `true` in chat mode. |
|
|
335
|
+
| `autoHideOnUnmount` | `boolean` | Hide on unmount. Defaults to `true`. |
|
|
336
|
+
| `launcherVisible` | `boolean` | Show/hide the floating launcher after configure. |
|
|
337
|
+
| `homeActions` / `drawerActions` | `ErxesAction[]` | `{ id, title, iosIcon?, androidIcon?, onPress? }`. Chat mode only. See [Action icons](#action-icons-ios--android). |
|
|
338
|
+
| `renderLoading` | `() => ReactNode` | Rendered while configuring (between `onLoad` and `onReady`/`onError`), e.g. a spinner. Defaults to nothing. |
|
|
339
|
+
| `onLoad` / `onReady` / `onOpen` / `onClose` / `onError` | callbacks | Lifecycle events. |
|
|
340
|
+
| `onLoadingChange` | `(loading: boolean) => void` | Fired when the loading state changes (`true` while configuring). |
|
|
341
|
+
| `onAction` | `(id, helpers) => void` | Fallback for tapped actions with no `onPress`. |
|
|
301
342
|
|
|
302
343
|
Action `onPress` (and `onAction`) receive `ErxesMessengerHelpers`:
|
|
303
344
|
`show`, `hide`, `showLauncher`, `hideLauncher`, `setUser`, `clearUser`.
|
|
345
|
+
On Android, `showLauncher`/`hideLauncher`/`hide` are no-ops (chat mode only).
|
|
346
|
+
|
|
347
|
+
### Action icons (iOS & Android)
|
|
348
|
+
|
|
349
|
+
Each `homeActions` / `drawerActions` entry takes platform-specific icon fields —
|
|
350
|
+
the platform you're not running on is ignored:
|
|
351
|
+
|
|
352
|
+
| Field | Platform | Value |
|
|
353
|
+
| ------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
354
|
+
| `iosIcon` | iOS | An [SF Symbol](https://developer.apple.com/sf-symbols/) name, e.g. `'person.crop.circle'`. |
|
|
355
|
+
| `androidIcon` | Android | A Compose **Material icon name** (e.g. `'AccountCircle'`, `'Search'`) **or** a **drawable resource name** in your app (e.g. `'ic_profile'`). |
|
|
356
|
+
|
|
357
|
+
```tsx
|
|
358
|
+
homeActions={[
|
|
359
|
+
{ id: 'profile', title: 'Profile', iosIcon: 'person.crop.circle', androidIcon: 'AccountCircle' },
|
|
360
|
+
]}
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
On Android `androidIcon` resolves in order: Material icon name → drawable resource
|
|
364
|
+
→ the messenger's default icon if neither matches.
|
|
365
|
+
|
|
366
|
+
- **Material icon names** are the Compose `Icons.Filled.*` names in PascalCase.
|
|
367
|
+
Only a few ship in `material-icons-core`; for the full set add
|
|
368
|
+
`material-icons-extended` (and a release keep rule) — see
|
|
369
|
+
[Android setup](#android).
|
|
370
|
+
- **Drawable resources** need no extra dependency: drop a vector/PNG under
|
|
371
|
+
`android/app/src/main/res/drawable/` and pass its file name (without extension).
|
|
372
|
+
|
|
373
|
+
> `systemIcon` is still accepted as a deprecated alias for `iosIcon`.
|
|
304
374
|
|
|
305
375
|
## Advanced — `ErxesNativeIOS` (low-level)
|
|
306
376
|
|
|
@@ -353,8 +423,22 @@ ErxesNativeIOS.configure({
|
|
|
353
423
|
integrationId: 'YOUR_INTEGRATION_ID',
|
|
354
424
|
subDomain: 'yourcompany.erxes.io',
|
|
355
425
|
displayMode: 'chat',
|
|
356
|
-
homeActions: [
|
|
357
|
-
|
|
426
|
+
homeActions: [
|
|
427
|
+
{
|
|
428
|
+
id: 'orders',
|
|
429
|
+
title: 'My Orders',
|
|
430
|
+
iosIcon: 'bag',
|
|
431
|
+
androidIcon: 'ShoppingBag',
|
|
432
|
+
},
|
|
433
|
+
],
|
|
434
|
+
drawerActions: [
|
|
435
|
+
{
|
|
436
|
+
id: 'settings',
|
|
437
|
+
title: 'Settings',
|
|
438
|
+
iosIcon: 'gearshape',
|
|
439
|
+
androidIcon: 'Settings',
|
|
440
|
+
},
|
|
441
|
+
],
|
|
358
442
|
});
|
|
359
443
|
|
|
360
444
|
const sub = ErxesNativeIOS.addActionListener((id) => {
|
package/android/build.gradle
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Android native module for rn-erxes-sdk. Bridges the erxes Android Messenger
|
|
2
|
-
// SDK (
|
|
2
|
+
// SDK (io.github.munkhorgilb:messenger-sdk) to React Native, mirroring the iOS bridge in
|
|
3
3
|
// `ios/RnErxesSdk.swift`. Android currently implements chat mode only.
|
|
4
4
|
//
|
|
5
5
|
// Plugins (Android Gradle Plugin, Kotlin) come from the consuming app's
|
|
@@ -48,13 +48,6 @@ android {
|
|
|
48
48
|
repositories {
|
|
49
49
|
google()
|
|
50
50
|
mavenCentral()
|
|
51
|
-
// The erxes Android SDK is not published to a remote Maven repo yet. For local
|
|
52
|
-
// development, install it with:
|
|
53
|
-
// ./gradlew :messenger-sdk:publishToMavenLocal (run in the android-sdk checkout)
|
|
54
|
-
// which drops com.erxes:messenger-sdk:<version> into ~/.m2. When the SDK is
|
|
55
|
-
// published remotely (e.g. JitPack/Maven Central), add that repo here and drop
|
|
56
|
-
// mavenLocal().
|
|
57
|
-
mavenLocal()
|
|
58
51
|
}
|
|
59
52
|
|
|
60
53
|
dependencies {
|
|
@@ -62,14 +55,21 @@ dependencies {
|
|
|
62
55
|
implementation "com.facebook.react:react-android"
|
|
63
56
|
|
|
64
57
|
// The erxes Android Messenger SDK (chat mode).
|
|
65
|
-
implementation "
|
|
58
|
+
implementation "io.github.munkhorgilb:messenger-sdk:0.30.5"
|
|
66
59
|
|
|
67
|
-
// Needed at compile time to
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
//
|
|
60
|
+
// Needed at compile time to reference the Compose types in the SDK's public API:
|
|
61
|
+
// `Color` for `Appearance(primaryColor)` (ui-graphics) and `ImageVector`, which
|
|
62
|
+
// `ActionItem`'s constructor defaults reference (ui). The SDK pulls these
|
|
63
|
+
// transitively at runtime but exposes them as `implementation` (not `api`), so we
|
|
64
|
+
// depend on them explicitly. No Compose compiler is needed — these are referenced
|
|
65
|
+
// only as data types; this module has no @Composable code.
|
|
71
66
|
implementation platform("androidx.compose:compose-bom:2024.12.01")
|
|
67
|
+
implementation "androidx.compose.ui:ui"
|
|
72
68
|
implementation "androidx.compose.ui:ui-graphics"
|
|
69
|
+
// For resolving Material icons by name (the `Icons.Filled` receiver). Only the
|
|
70
|
+
// core icon set is bundled here; hosts add `material-icons-extended` for the
|
|
71
|
+
// full set (see README / docs).
|
|
72
|
+
implementation "androidx.compose.material:material-icons-core"
|
|
73
73
|
|
|
74
74
|
// For the StateFlow (isReady) collector on the main dispatcher.
|
|
75
75
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0"
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
package com.erxessdk
|
|
2
2
|
|
|
3
|
+
import androidx.compose.material.icons.Icons
|
|
3
4
|
import androidx.compose.ui.graphics.Color
|
|
5
|
+
import androidx.compose.ui.graphics.vector.ImageVector
|
|
4
6
|
import com.erxes.messenger.ErxesMessenger
|
|
5
7
|
import com.erxes.messenger.config.ActionItem
|
|
6
8
|
import com.erxes.messenger.config.Appearance
|
|
@@ -21,7 +23,6 @@ import kotlinx.coroutines.CoroutineScope
|
|
|
21
23
|
import kotlinx.coroutines.Dispatchers
|
|
22
24
|
import kotlinx.coroutines.SupervisorJob
|
|
23
25
|
import kotlinx.coroutines.cancel
|
|
24
|
-
import kotlinx.coroutines.flow.distinctUntilChanged
|
|
25
26
|
import kotlinx.coroutines.flow.filter
|
|
26
27
|
import kotlinx.coroutines.launch
|
|
27
28
|
|
|
@@ -91,15 +92,15 @@ class RnErxesSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
// Forward the connect handshake to JS as `onErxesReady`. `isReady` is a
|
|
94
|
-
// StateFlow, so it replays its current value on collection
|
|
95
|
-
// after the SDK is already connected still notifies JS
|
|
96
|
-
//
|
|
95
|
+
// StateFlow, so it replays its current value on collection (a `configure()`
|
|
96
|
+
// after the SDK is already connected still notifies JS) and conflates
|
|
97
|
+
// duplicates, so `filter { it }` emits once per connection — mirroring the
|
|
98
|
+
// iOS Combine pipeline (`removeDuplicates().filter { $0 }`).
|
|
97
99
|
readyScope?.cancel()
|
|
98
100
|
val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
|
|
99
101
|
readyScope = scope
|
|
100
102
|
scope.launch {
|
|
101
103
|
ErxesMessenger.isReady
|
|
102
|
-
.distinctUntilChanged()
|
|
103
104
|
.filter { it }
|
|
104
105
|
.collect {
|
|
105
106
|
if (listenerCount > 0) {
|
|
@@ -112,6 +113,17 @@ class RnErxesSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
112
113
|
// callbacks, so run it on the main thread.
|
|
113
114
|
UiThreadUtil.runOnUiThread {
|
|
114
115
|
ErxesMessenger.configure(reactContext.applicationContext, config)
|
|
116
|
+
|
|
117
|
+
// Present chat mode immediately (mirroring iOS, where `configure()` auto-
|
|
118
|
+
// presents). The SDK's own auto-present only fires on the *next* activity
|
|
119
|
+
// resume, but React Native calls `configure()` after the host activity is
|
|
120
|
+
// already resumed — so that event never comes. Present from the current
|
|
121
|
+
// activity instead. If there's no activity yet, the SDK's lifecycle
|
|
122
|
+
// fallback still covers it on the next resume.
|
|
123
|
+
if (displayMode == DisplayMode.CHAT) {
|
|
124
|
+
reactContext.currentActivity?.let { ErxesMessenger.show(it) }
|
|
125
|
+
}
|
|
126
|
+
|
|
115
127
|
promise.resolve(null)
|
|
116
128
|
}
|
|
117
129
|
}
|
|
@@ -146,7 +158,7 @@ class RnErxesSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
146
158
|
|
|
147
159
|
@ReactMethod
|
|
148
160
|
fun showMessenger(promise: Promise) {
|
|
149
|
-
val activity = currentActivity
|
|
161
|
+
val activity = reactContext.currentActivity
|
|
150
162
|
if (activity == null) {
|
|
151
163
|
promise.reject("missing_presenter", "Unable to find an activity to present from")
|
|
152
164
|
return
|
|
@@ -222,10 +234,12 @@ class RnErxesSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
222
234
|
}
|
|
223
235
|
|
|
224
236
|
/**
|
|
225
|
-
* Parse `[{ id, title,
|
|
226
|
-
* without an `id` are skipped.
|
|
227
|
-
*
|
|
228
|
-
*
|
|
237
|
+
* Parse `[{ id, title, androidIcon }]` from JS into `[ActionItem]`. Entries
|
|
238
|
+
* without an `id` are skipped. `androidIcon` resolves, in order, to a Compose
|
|
239
|
+
* Material icon by name (e.g. `"AccountCircle"`, `"Search"`) or a host-app
|
|
240
|
+
* drawable resource name (e.g. `"ic_profile"`). When absent or unresolved, the
|
|
241
|
+
* messenger renders its default icon. The iOS `systemIcon` (an SF Symbol) has no
|
|
242
|
+
* Android equivalent and is ignored here.
|
|
229
243
|
*/
|
|
230
244
|
private fun actionItems(value: ReadableArray?): List<ActionItem> {
|
|
231
245
|
if (value == null) return emptyList()
|
|
@@ -233,11 +247,45 @@ class RnErxesSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
233
247
|
for (i in 0 until value.size()) {
|
|
234
248
|
val map = value.getMap(i) ?: continue
|
|
235
249
|
val id = map.stringOrNull("id") ?: continue
|
|
236
|
-
|
|
250
|
+
val iconName = map.stringOrNull("androidIcon")
|
|
251
|
+
val vector = materialIcon(iconName)
|
|
252
|
+
items.add(
|
|
253
|
+
ActionItem(
|
|
254
|
+
id = id,
|
|
255
|
+
title = map.stringOrNull("title") ?: "",
|
|
256
|
+
imageVector = vector,
|
|
257
|
+
drawableRes = if (vector == null) drawableRes(iconName) else null,
|
|
258
|
+
)
|
|
259
|
+
)
|
|
237
260
|
}
|
|
238
261
|
return items
|
|
239
262
|
}
|
|
240
263
|
|
|
264
|
+
/**
|
|
265
|
+
* Resolve a Compose Material (filled) icon by name, e.g. `"AccountCircle"` →
|
|
266
|
+
* `Icons.Filled.AccountCircle`. Only a handful of icons ship in
|
|
267
|
+
* `material-icons-core`; for the full set the host app must depend on
|
|
268
|
+
* `androidx.compose.material:material-icons-extended` (and keep these classes in
|
|
269
|
+
* release builds). Returns null if the name isn't a known Material icon.
|
|
270
|
+
*/
|
|
271
|
+
private fun materialIcon(name: String?): ImageVector? {
|
|
272
|
+
if (name.isNullOrEmpty()) return null
|
|
273
|
+
return try {
|
|
274
|
+
val cls = Class.forName("androidx.compose.material.icons.filled.${name}Kt")
|
|
275
|
+
val getter = cls.getMethod("get$name", Icons.Filled::class.java)
|
|
276
|
+
getter.invoke(null, Icons.Filled) as? ImageVector
|
|
277
|
+
} catch (t: Throwable) {
|
|
278
|
+
null
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/** Resolve a host-app drawable resource name to its id, or null if absent/unknown. */
|
|
283
|
+
private fun drawableRes(name: String?): Int? {
|
|
284
|
+
if (name.isNullOrEmpty()) return null
|
|
285
|
+
val id = reactContext.resources.getIdentifier(name, "drawable", reactContext.packageName)
|
|
286
|
+
return id.takeIf { it != 0 }
|
|
287
|
+
}
|
|
288
|
+
|
|
241
289
|
/** Parse a `#RGB`/`#RRGGBB`/`#RRGGBBAA` hex string into a Compose [Color]. */
|
|
242
290
|
private fun hexColor(value: String?): Color? {
|
|
243
291
|
var hex = value?.trim()?.removePrefix("#") ?: return null
|
|
@@ -25,17 +25,27 @@ var _nativeIos = require("./nativeIos");
|
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
|
-
* (
|
|
30
|
-
*
|
|
28
|
+
* Map to the data-only shape the native bridge understands, dropping `onPress`
|
|
29
|
+
* (React Native cannot send JS functions to native — taps are dispatched on the
|
|
30
|
+
* JS side via the action listener). `iosIcon` (falling back to the deprecated
|
|
31
|
+
* `systemIcon`) becomes the iOS `systemIcon`; `androidIcon` is forwarded for
|
|
32
|
+
* Android to resolve to a drawable.
|
|
31
33
|
*/
|
|
32
34
|
function stripActions(actions) {
|
|
33
35
|
return actions.map(_ref => {
|
|
34
36
|
let {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
id,
|
|
38
|
+
title,
|
|
39
|
+
iosIcon,
|
|
40
|
+
systemIcon,
|
|
41
|
+
androidIcon
|
|
37
42
|
} = _ref;
|
|
38
|
-
return
|
|
43
|
+
return {
|
|
44
|
+
id,
|
|
45
|
+
title,
|
|
46
|
+
systemIcon: iosIcon ?? systemIcon ?? '',
|
|
47
|
+
androidIcon
|
|
48
|
+
};
|
|
39
49
|
});
|
|
40
50
|
}
|
|
41
51
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","_nativeIos","stripActions","actions","map","_ref","
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_nativeIos","stripActions","actions","map","_ref","id","title","iosIcon","systemIcon","androidIcon","ErxesMessenger","_ref2","integrationId","endpoint","serverUrl","subDomain","displayMode","user","cachedCustomerId","primaryColor","visible","autoOpen","autoHideOnUnmount","launcherVisible","homeActions","drawerActions","renderLoading","onLoad","onReady","onOpen","onClose","onError","onAction","onLoadingChange","actionsRef","useRef","onActionRef","onLoadingChangeRef","shownRef","configured","setConfigured","useState","loading","setLoading","useEffect","current","_onLoadingChangeRef$c","call","Platform","OS","helpers","show","ErxesNativeIOS","showMessenger","hide","hideMessenger","showLauncher","hideLauncher","setUser","nextUser","clearUser","sub","addActionListener","_onActionRef$current","action","find","item","onPress","readySub","addReadyListener","setup","configure","shouldOpen","error","remove","undefined"],"sourceRoot":"../../src","sources":["ErxesMessenger.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AAMA;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KAAK;QACxBf,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAG,CAAC;MACb;IACF,CAAC;IACD;IACA;IACA;EACF,CAAC,EAAE,CAAClB,aAAa,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,SAAS,EAAEC,WAAW,CAAC,CAAC;EAEhE,IAAA4B,gBAAS,EAAC,MAAM;IACd;IACA;IACA;IACA,IACGI,qBAAQ,CAACC,EAAE,KAAK,KAAK,IAAID,qBAAQ,CAACC,EAAE,KAAK,SAAS,IACnD7B,OAAO,KAAKuD,SAAS,IACrB,CAACpC,UAAU,EACX;MACA;IACF;IAEA,IAAInB,OAAO,IAAI,CAACkB,QAAQ,CAACO,OAAO,EAAE;MAChCO,yBAAc,CAACC,aAAa,CAAC,CAAC;MAC9Bf,QAAQ,CAACO,OAAO,GAAG,IAAI;MACvBhB,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAG,CAAC;IACZ,CAAC,MAAM,IAAI,CAACT,OAAO,IAAIkB,QAAQ,CAACO,OAAO,EAAE;MACvCO,yBAAc,CAACG,aAAa,CAAC,CAAC;MAC9BjB,QAAQ,CAACO,OAAO,GAAG,KAAK;MACxBf,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAG,CAAC;IACb;IACA;EACF,CAAC,EAAE,CAACV,OAAO,EAAEmB,UAAU,CAAC,CAAC;EAEzB,IAAIG,OAAO,IAAIhB,aAAa,EAAE;IAC5B,OAAOA,aAAa,CAAC,CAAC;EACxB;EAEA,OAAO,IAAI;AACb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","ACTION_EVENT","READY_EVENT","LINKING_ERROR","Platform","OS","nativeModule","NativeModules","RnErxesSdk","getNativeModule","Error","ErxesNativeIOS","configure","options","setUser","customData","Object","fromEntries","entries","filter","_ref","value","undefined","map","_ref2","key","String","clearUser","showMessenger","showLauncher","hideLauncher","hideMessenger","addActionListener","handler","emitter","NativeEventEmitter","addListener","event","id","addReadyListener","exports"],"sourceRoot":"../../src","sources":["nativeIos.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQA;AACA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","ACTION_EVENT","READY_EVENT","LINKING_ERROR","Platform","OS","nativeModule","NativeModules","RnErxesSdk","getNativeModule","Error","ErxesNativeIOS","configure","options","setUser","customData","Object","fromEntries","entries","filter","_ref","value","undefined","map","_ref2","key","String","clearUser","showMessenger","showLauncher","hideLauncher","hideMessenger","addActionListener","handler","emitter","NativeEventEmitter","addListener","event","id","addReadyListener","exports"],"sourceRoot":"../../src","sources":["nativeIos.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQA;AACA;AACA;AACA;AACA;;AAiDA;AACA,MAAMC,YAAY,GAAG,eAAe;;AAEpC;AACA,MAAMC,WAAW,GAAG,cAAc;AAElC,MAAMC,aAAa,GACjBC,qBAAQ,CAACC,EAAE,KAAK,SAAS,GACrB,sHAAsH,GACtH,sHAAsH;AAE5H,MAAMC,YAAY,GAAGC,0BAAa,CAACC,UAAyC;AAE5E,SAASC,eAAeA,CAAA,EAAoB;EAC1C,IAAIL,qBAAQ,CAACC,EAAE,KAAK,KAAK,IAAID,qBAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;IACtD,MAAM,IAAIK,KAAK,CACb,8DACF,CAAC;EACH;EAEA,IAAI,CAACJ,YAAY,EAAE;IACjB,MAAM,IAAII,KAAK,CAACP,aAAa,CAAC;EAChC;EAEA,OAAOG,YAAY;AACrB;AAEO,MAAMK,cAAc,GAAG;EAC5BC,SAASA,CAACC,OAAwB,EAAE;IAClC,OAAOJ,eAAe,CAAC,CAAC,CAACG,SAAS,CAACC,OAAO,CAAC;EAC7C,CAAC;EACDC,OAAOA,CAACD,OAAsB,EAAE;IAC9B,MAAME,UAAU,GAAGC,MAAM,CAACC,WAAW,CACnCD,MAAM,CAACE,OAAO,CAACL,OAAO,CAACE,UAAU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ACzD,MAAMC,OAAO,GAAG,IAAIC,+BAAkB,CACpC1B,eAAe,CAAC,CAClB,CAAC;IACD,OAAOyB,OAAO,CAACE,WAAW,CAAClC,WAAW,EAAE,MAAM+B,OAAO,CAAC,CAAC,CAAC;EAC1D;AACF,CAAC;AAACO,OAAA,CAAA7B,cAAA,GAAAA,cAAA"}
|
|
@@ -20,17 +20,27 @@ import { ErxesNativeIOS } from './nativeIos';
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
* (
|
|
25
|
-
*
|
|
23
|
+
* Map to the data-only shape the native bridge understands, dropping `onPress`
|
|
24
|
+
* (React Native cannot send JS functions to native — taps are dispatched on the
|
|
25
|
+
* JS side via the action listener). `iosIcon` (falling back to the deprecated
|
|
26
|
+
* `systemIcon`) becomes the iOS `systemIcon`; `androidIcon` is forwarded for
|
|
27
|
+
* Android to resolve to a drawable.
|
|
26
28
|
*/
|
|
27
29
|
function stripActions(actions) {
|
|
28
30
|
return actions.map(_ref => {
|
|
29
31
|
let {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
id,
|
|
33
|
+
title,
|
|
34
|
+
iosIcon,
|
|
35
|
+
systemIcon,
|
|
36
|
+
androidIcon
|
|
32
37
|
} = _ref;
|
|
33
|
-
return
|
|
38
|
+
return {
|
|
39
|
+
id,
|
|
40
|
+
title,
|
|
41
|
+
systemIcon: iosIcon ?? systemIcon ?? '',
|
|
42
|
+
androidIcon
|
|
43
|
+
};
|
|
34
44
|
});
|
|
35
45
|
}
|
|
36
46
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","useState","Platform","ErxesNativeIOS","stripActions","actions","map","_ref","
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useState","Platform","ErxesNativeIOS","stripActions","actions","map","_ref","id","title","iosIcon","systemIcon","androidIcon","ErxesMessenger","_ref2","integrationId","endpoint","serverUrl","subDomain","displayMode","user","cachedCustomerId","primaryColor","visible","autoOpen","autoHideOnUnmount","launcherVisible","homeActions","drawerActions","renderLoading","onLoad","onReady","onOpen","onClose","onError","onAction","onLoadingChange","actionsRef","onActionRef","onLoadingChangeRef","shownRef","configured","setConfigured","loading","setLoading","current","_onLoadingChangeRef$c","call","OS","helpers","show","showMessenger","hide","hideMessenger","showLauncher","hideLauncher","setUser","nextUser","clearUser","sub","addActionListener","_onActionRef$current","action","find","item","onPress","readySub","addReadyListener","setup","configure","shouldOpen","error","remove","undefined"],"sourceRoot":"../../src","sources":["ErxesMessenger.tsx"],"mappings":"AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAwB,OAAO;AACnE,SAASC,QAAQ,QAAQ,cAAc;AAEvC,SACEC,cAAc,QAGT,aAAa;;AAEpB;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;;AAoFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,YAAYA,CAACC,OAAsB,EAAqB;EAC/D,OAAOA,OAAO,CAACC,GAAG,CAACC,IAAA;IAAA,IAAC;MAAEC,EAAE;MAAEC,KAAK;MAAEC,OAAO;MAAEC,UAAU;MAAEC;IAAY,CAAC,GAAAL,IAAA;IAAA,OAAM;MACvEC,EAAE;MACFC,KAAK;MACLE,UAAU,EAAED,OAAO,IAAIC,UAAU,IAAI,EAAE;MACvCC;IACF,CAAC;EAAA,CAAC,CAAC;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAAC,KAAA,EAuBN;EAAA,IAvBO;IAC7BC,aAAa;IACbC,QAAQ;IACRC,SAAS;IACTC,SAAS;IACTC,WAAW,GAAG,SAAS;IACvBC,IAAI;IACJC,gBAAgB;IAChBC,YAAY;IACZC,OAAO;IACPC,QAAQ,GAAGL,WAAW,KAAK,MAAM;IACjCM,iBAAiB,GAAG,IAAI;IACxBC,eAAe;IACfC,WAAW,GAAG,EAAE;I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F,CAAC,EAAE,CAACV,OAAO,EAAEkB,UAAU,CAAC,CAAC;EAEzB,IAAIE,OAAO,IAAId,aAAa,EAAE;IAC5B,OAAOA,aAAa,CAAC,CAAC;EACxB;EAEA,OAAO,IAAI;AACb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","NativeModules","Platform","ACTION_EVENT","READY_EVENT","LINKING_ERROR","OS","nativeModule","RnErxesSdk","getNativeModule","Error","ErxesNativeIOS","configure","options","setUser","customData","Object","fromEntries","entries","filter","_ref","value","undefined","map","_ref2","key","String","clearUser","showMessenger","showLauncher","hideLauncher","hideMessenger","addActionListener","handler","emitter","addListener","event","id","addReadyListener"],"sourceRoot":"../../src","sources":["nativeIos.ts"],"mappings":"AAAA,SACEA,kBAAkB,EAClBC,aAAa,EACbC,QAAQ,QAGH,cAAc;;AAErB;AACA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["NativeEventEmitter","NativeModules","Platform","ACTION_EVENT","READY_EVENT","LINKING_ERROR","OS","nativeModule","RnErxesSdk","getNativeModule","Error","ErxesNativeIOS","configure","options","setUser","customData","Object","fromEntries","entries","filter","_ref","value","undefined","map","_ref2","key","String","clearUser","showMessenger","showLauncher","hideLauncher","hideMessenger","addActionListener","handler","emitter","addListener","event","id","addReadyListener"],"sourceRoot":"../../src","sources":["nativeIos.ts"],"mappings":"AAAA,SACEA,kBAAkB,EAClBC,aAAa,EACbC,QAAQ,QAGH,cAAc;;AAErB;AACA;AACA;AACA;AACA;;AAiDA;AACA,MAAMC,YAAY,GAAG,eAAe;;AAEpC;AACA,MAAMC,WAAW,GAAG,cAAc;AAElC,MAAMC,aAAa,GACjBH,QAAQ,CAACI,EAAE,KAAK,SAAS,GACrB,sHAAsH,GACtH,sHAAsH;AAE5H,MAAMC,YAAY,GAAGN,aAAa,CAACO,UAAyC;AAE5E,SAASC,eAAeA,CAAA,EAAoB;EAC1C,IAAIP,QAAQ,CAACI,EAAE,KAAK,K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,CAAC,CAACqB,YAAY,CAAC,CAAC;EACzC,CAAC;EACDC,aAAaA,CAAA,EAAG;IACd,OAAOtB,eAAe,CAAC,CAAC,CAACsB,aAAa,CAAC,CAAC;EAC1C,CAAC;EACD;AACF;AACA;AACA;AACA;AACA;EACEC,iBAAiBA,CAACC,OAA6B,EAAuB;IACpE,MAAMC,OAAO,GAAG,IAAIlC,kBAAkB,CACpCS,eAAe,CAAC,CAClB,CAAC;IACD,OAAOyB,OAAO,CAACC,WAAW,CAAChC,YAAY,EAAGiC,KAAqB,IAC7DH,OAAO,CAACG,KAAK,CAACC,EAAE,CAClB,CAAC;EACH,CAAC;EACD;AACF;AACA;AACA;AACA;AACA;EACEC,gBAAgBA,CAACL,OAAmB,EAAuB;IACzD,MAAMC,OAAO,GAAG,IAAIlC,kBAAkB,CACpCS,eAAe,CAAC,CAClB,CAAC;IACD,OAAOyB,OAAO,CAACC,WAAW,CAAC/B,WAAW,EAAE,MAAM6B,OAAO,CAAC,CAAC,CAAC;EAC1D;AACF,CAAC"}
|
|
@@ -28,8 +28,18 @@ export type ErxesAction = {
|
|
|
28
28
|
id: string;
|
|
29
29
|
/** Display title (drawer rows / accessibility label for header icons). */
|
|
30
30
|
title: string;
|
|
31
|
-
/** SF Symbol name, e.g. "person.crop.circle". */
|
|
32
|
-
|
|
31
|
+
/** iOS SF Symbol name, e.g. "person.crop.circle". */
|
|
32
|
+
iosIcon?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Android drawable resource name in your app, e.g. `"ic_profile"`. Add the
|
|
35
|
+
* drawable under `android/app/src/main/res/drawable/`. When omitted or not
|
|
36
|
+
* found, the messenger renders its default icon.
|
|
37
|
+
*/
|
|
38
|
+
androidIcon?: string;
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated Use {@link iosIcon}. Kept as an alias for the iOS SF Symbol.
|
|
41
|
+
*/
|
|
42
|
+
systemIcon?: string;
|
|
33
43
|
/** Runs when this action is tapped. Receives imperative {@link ErxesMessengerHelpers}. */
|
|
34
44
|
onPress?: (helpers: ErxesMessengerHelpers) => void | Promise<void>;
|
|
35
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErxesMessenger.d.ts","sourceRoot":"","sources":["../../src/ErxesMessenger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGpE,OAAO,
|
|
1
|
+
{"version":3,"file":"ErxesMessenger.d.ts","sourceRoot":"","sources":["../../src/ErxesMessenger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGpE,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC;AAEtC;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,oEAAoE;IACpE,EAAE,EAAE,MAAM,CAAC;IACX,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0FAA0F;IAC1F,OAAO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C,EAAE,MAAM,IAAI,CAAC;IACrB,wCAAwC;IACxC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,CACT,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,qBAAqB,KAC3B,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B,CAAC;AAkBF;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAC7B,aAAa,EACb,QAAQ,EACR,SAAS,EACT,SAAS,EACT,WAAuB,EACvB,IAAI,EACJ,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,QAAiC,EACjC,iBAAwB,EACxB,eAAe,EACf,WAAgB,EAChB,aAAkB,EAClB,aAAa,EACb,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,OAAO,EACP,QAAQ,EACR,eAAe,GAChB,EAAE,mBAAmB,aAuLrB"}
|
|
@@ -9,8 +9,14 @@ type NativeIOSAction = {
|
|
|
9
9
|
id: string;
|
|
10
10
|
/** Display title (drawer rows / accessibility label for header icons). */
|
|
11
11
|
title: string;
|
|
12
|
-
/** SF Symbol name, e.g. "magnifyingglass". */
|
|
12
|
+
/** iOS SF Symbol name, e.g. "magnifyingglass". Ignored on Android. */
|
|
13
13
|
systemIcon: string;
|
|
14
|
+
/**
|
|
15
|
+
* Android drawable resource name in the host app (e.g. `"ic_profile"`),
|
|
16
|
+
* resolved to a drawable at runtime. Ignored on iOS. When omitted (or not
|
|
17
|
+
* found), the messenger renders its default icon.
|
|
18
|
+
*/
|
|
19
|
+
androidIcon?: string;
|
|
14
20
|
};
|
|
15
21
|
type NativeIOSConfig = {
|
|
16
22
|
integrationId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeIos.d.ts","sourceRoot":"","sources":["../../src/nativeIos.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,mBAAmB,EAEzB,MAAM,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AAO,MAAM,cAAc;uBACN,eAAe;qBAGjB,aAAa;;;;;;IA2B9B;;;;;OAKG;oCAC6B,MAAM,KAAK,IAAI,GAAG,mBAAmB;IAQrE;;;;;OAKG;8BACuB,MAAM,IAAI,GAAG,mBAAmB;CAM3D,CAAC;AAEF,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC"}
|
package/package.json
CHANGED
package/src/ErxesMessenger.tsx
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { useEffect, useRef, useState, type ReactNode } from 'react';
|
|
2
2
|
import { Platform } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ErxesNativeIOS,
|
|
6
|
+
type NativeIOSAction,
|
|
7
|
+
type NativeIOSUser,
|
|
8
|
+
} from './nativeIos';
|
|
5
9
|
|
|
6
10
|
/**
|
|
7
11
|
* The identified end user. Same shape the native bridge expects — passing
|
|
@@ -33,8 +37,18 @@ export type ErxesAction = {
|
|
|
33
37
|
id: string;
|
|
34
38
|
/** Display title (drawer rows / accessibility label for header icons). */
|
|
35
39
|
title: string;
|
|
36
|
-
/** SF Symbol name, e.g. "person.crop.circle". */
|
|
37
|
-
|
|
40
|
+
/** iOS SF Symbol name, e.g. "person.crop.circle". */
|
|
41
|
+
iosIcon?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Android drawable resource name in your app, e.g. `"ic_profile"`. Add the
|
|
44
|
+
* drawable under `android/app/src/main/res/drawable/`. When omitted or not
|
|
45
|
+
* found, the messenger renders its default icon.
|
|
46
|
+
*/
|
|
47
|
+
androidIcon?: string;
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated Use {@link iosIcon}. Kept as an alias for the iOS SF Symbol.
|
|
50
|
+
*/
|
|
51
|
+
systemIcon?: string;
|
|
38
52
|
/** Runs when this action is tapped. Receives imperative {@link ErxesMessengerHelpers}. */
|
|
39
53
|
onPress?: (helpers: ErxesMessengerHelpers) => void | Promise<void>;
|
|
40
54
|
};
|
|
@@ -102,12 +116,19 @@ export type ErxesMessengerProps = {
|
|
|
102
116
|
};
|
|
103
117
|
|
|
104
118
|
/**
|
|
105
|
-
*
|
|
106
|
-
* (
|
|
107
|
-
*
|
|
119
|
+
* Map to the data-only shape the native bridge understands, dropping `onPress`
|
|
120
|
+
* (React Native cannot send JS functions to native — taps are dispatched on the
|
|
121
|
+
* JS side via the action listener). `iosIcon` (falling back to the deprecated
|
|
122
|
+
* `systemIcon`) becomes the iOS `systemIcon`; `androidIcon` is forwarded for
|
|
123
|
+
* Android to resolve to a drawable.
|
|
108
124
|
*/
|
|
109
|
-
function stripActions(actions: ErxesAction[]) {
|
|
110
|
-
return actions.map(({
|
|
125
|
+
function stripActions(actions: ErxesAction[]): NativeIOSAction[] {
|
|
126
|
+
return actions.map(({ id, title, iosIcon, systemIcon, androidIcon }) => ({
|
|
127
|
+
id,
|
|
128
|
+
title,
|
|
129
|
+
systemIcon: iosIcon ?? systemIcon ?? '',
|
|
130
|
+
androidIcon,
|
|
131
|
+
}));
|
|
111
132
|
}
|
|
112
133
|
|
|
113
134
|
/**
|
package/src/nativeIos.ts
CHANGED
|
@@ -16,8 +16,14 @@ type NativeIOSAction = {
|
|
|
16
16
|
id: string;
|
|
17
17
|
/** Display title (drawer rows / accessibility label for header icons). */
|
|
18
18
|
title: string;
|
|
19
|
-
/** SF Symbol name, e.g. "magnifyingglass". */
|
|
19
|
+
/** iOS SF Symbol name, e.g. "magnifyingglass". Ignored on Android. */
|
|
20
20
|
systemIcon: string;
|
|
21
|
+
/**
|
|
22
|
+
* Android drawable resource name in the host app (e.g. `"ic_profile"`),
|
|
23
|
+
* resolved to a drawable at runtime. Ignored on iOS. When omitted (or not
|
|
24
|
+
* found), the messenger renders its default icon.
|
|
25
|
+
*/
|
|
26
|
+
androidIcon?: string;
|
|
21
27
|
};
|
|
22
28
|
|
|
23
29
|
type NativeIOSConfig = {
|