@developer_tribe/react-native-comnyx 0.15.0 → 0.16.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/Comnyx.podspec +10 -2
- package/README.md +50 -0
- package/android/build.gradle +1 -0
- package/android/consumer-rules.pro +23 -0
- package/android/generated/java/com/comnyx/NativeComnyxSpec.java +46 -0
- package/android/generated/jni/RNComnyxSpec-generated.cpp +23 -1
- package/android/generated/jni/RNComnyxSpec.h +7 -0
- package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI-generated.cpp +21 -0
- package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI.h +70 -0
- package/android/src/main/AndroidManifest.xml +11 -1
- package/android/src/main/AndroidManifestNew.xml +11 -1
- package/android/src/main/java/com/comnyx/ComnyxMediaPickerModule.kt +91 -51
- package/android/src/main/java/com/comnyx/ComnyxModule.kt +7 -0
- package/android/src/main/java/com/comnyx/src/messaging/firebase/FirebaseMessagingService.kt +4 -6
- package/android/src/main/res/xml/comnyx_file_paths.xml +12 -0
- package/ios/APNService.swift +9 -9
- package/ios/Comnyx.swift +17 -8
- package/ios/ComnyxMediaPicker.swift +47 -26
- package/ios/ComnyxMessaging.swift +2 -0
- package/ios/PrivacyInfo.xcprivacy +32 -0
- package/ios/comnyx_post_install.rb +25 -0
- package/ios/generated/RCTAppDependencyProvider.h +25 -0
- package/ios/generated/RCTAppDependencyProvider.mm +55 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.mm +23 -0
- package/ios/generated/RNComnyxSpec/RNComnyxSpec-generated.mm +53 -0
- package/ios/generated/RNComnyxSpec/RNComnyxSpec.h +67 -0
- package/ios/generated/RNComnyxSpecJSI-generated.cpp +38 -0
- package/ios/generated/RNComnyxSpecJSI.h +89 -0
- package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
- package/lib/commonjs/NativeComnyxMediaPicker.js +19 -0
- package/lib/commonjs/NativeComnyxMediaPicker.js.map +1 -1
- package/lib/commonjs/api/conversations.js +6 -6
- package/lib/commonjs/api/conversations.js.map +1 -1
- package/lib/commonjs/api/customers.js +3 -2
- package/lib/commonjs/api/customers.js.map +1 -1
- package/lib/commonjs/api/media.js +20 -6
- package/lib/commonjs/api/media.js.map +1 -1
- package/lib/commonjs/api/messages.js +3 -2
- package/lib/commonjs/api/messages.js.map +1 -1
- package/lib/commonjs/components/ChatList.js +132 -90
- package/lib/commonjs/components/ChatList.js.map +1 -1
- package/lib/commonjs/components/ComnyxErrorBoundary.js +92 -0
- package/lib/commonjs/components/ComnyxErrorBoundary.js.map +1 -0
- package/lib/commonjs/components/CustomerForm.js +7 -3
- package/lib/commonjs/components/CustomerForm.js.map +1 -1
- package/lib/commonjs/components/InitFailed.js +77 -21
- package/lib/commonjs/components/InitFailed.js.map +1 -1
- package/lib/commonjs/components/MediaMessageItem.js +37 -10
- package/lib/commonjs/components/MediaMessageItem.js.map +1 -1
- package/lib/commonjs/components/MediaViewerModal.js +16 -3
- package/lib/commonjs/components/MediaViewerModal.js.map +1 -1
- package/lib/commonjs/components/MessageInput.js +83 -15
- package/lib/commonjs/components/MessageInput.js.map +1 -1
- package/lib/commonjs/components/MessageItem.js +1 -1
- package/lib/commonjs/components/MessageItem.js.map +1 -1
- package/lib/commonjs/hooks/usePolling.js +30 -21
- package/lib/commonjs/hooks/usePolling.js.map +1 -1
- package/lib/commonjs/hooks/useThemeColors.js +12 -1
- package/lib/commonjs/hooks/useThemeColors.js.map +1 -1
- package/lib/commonjs/index.js +6 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/notifications/initializeNotifications.js +19 -16
- package/lib/commonjs/notifications/initializeNotifications.js.map +1 -1
- package/lib/commonjs/register/Accumulator.js +19 -6
- package/lib/commonjs/register/Accumulator.js.map +1 -1
- package/lib/commonjs/register/collectData.js +1 -1
- package/lib/commonjs/register/collectData.js.map +1 -1
- package/lib/commonjs/register/login.js +5 -0
- package/lib/commonjs/register/login.js.map +1 -1
- package/lib/commonjs/store/store.js +6 -0
- package/lib/commonjs/store/store.js.map +1 -1
- package/lib/commonjs/support/ComnyxSupport.js +77 -16
- package/lib/commonjs/support/ComnyxSupport.js.map +1 -1
- package/lib/commonjs/support/SupportConfigContext.js +66 -0
- package/lib/commonjs/support/SupportConfigContext.js.map +1 -0
- package/lib/commonjs/support/index.js +7 -0
- package/lib/commonjs/support/index.js.map +1 -1
- package/lib/commonjs/types/Theme.js +30 -2
- package/lib/commonjs/types/Theme.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/NativeComnyxMediaPicker.js +18 -0
- package/lib/module/NativeComnyxMediaPicker.js.map +1 -1
- package/lib/module/api/conversations.js +6 -6
- package/lib/module/api/conversations.js.map +1 -1
- package/lib/module/api/customers.js +3 -2
- package/lib/module/api/customers.js.map +1 -1
- package/lib/module/api/media.js +21 -6
- package/lib/module/api/media.js.map +1 -1
- package/lib/module/api/messages.js +3 -2
- package/lib/module/api/messages.js.map +1 -1
- package/lib/module/components/ChatList.js +133 -91
- package/lib/module/components/ChatList.js.map +1 -1
- package/lib/module/components/ComnyxErrorBoundary.js +87 -0
- package/lib/module/components/ComnyxErrorBoundary.js.map +1 -0
- package/lib/module/components/CustomerForm.js +7 -3
- package/lib/module/components/CustomerForm.js.map +1 -1
- package/lib/module/components/InitFailed.js +79 -23
- package/lib/module/components/InitFailed.js.map +1 -1
- package/lib/module/components/MediaMessageItem.js +37 -11
- package/lib/module/components/MediaMessageItem.js.map +1 -1
- package/lib/module/components/MediaViewerModal.js +15 -3
- package/lib/module/components/MediaViewerModal.js.map +1 -1
- package/lib/module/components/MessageInput.js +84 -16
- package/lib/module/components/MessageInput.js.map +1 -1
- package/lib/module/components/MessageItem.js +1 -1
- package/lib/module/components/MessageItem.js.map +1 -1
- package/lib/module/hooks/usePolling.js +30 -21
- package/lib/module/hooks/usePolling.js.map +1 -1
- package/lib/module/hooks/useThemeColors.js +13 -2
- package/lib/module/hooks/useThemeColors.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/notifications/initializeNotifications.js +19 -16
- package/lib/module/notifications/initializeNotifications.js.map +1 -1
- package/lib/module/register/Accumulator.js +19 -6
- package/lib/module/register/Accumulator.js.map +1 -1
- package/lib/module/register/collectData.js +1 -1
- package/lib/module/register/collectData.js.map +1 -1
- package/lib/module/register/login.js +5 -0
- package/lib/module/register/login.js.map +1 -1
- package/lib/module/store/store.js +6 -0
- package/lib/module/store/store.js.map +1 -1
- package/lib/module/support/ComnyxSupport.js +79 -18
- package/lib/module/support/ComnyxSupport.js.map +1 -1
- package/lib/module/support/SupportConfigContext.js +59 -0
- package/lib/module/support/SupportConfigContext.js.map +1 -0
- package/lib/module/support/index.js +1 -0
- package/lib/module/support/index.js.map +1 -1
- package/lib/module/types/Theme.js +30 -2
- package/lib/module/types/Theme.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/src/NativeComnyxMediaPicker.d.ts +9 -0
- package/lib/typescript/src/NativeComnyxMediaPicker.d.ts.map +1 -1
- package/lib/typescript/src/api/conversations.d.ts +2 -2
- package/lib/typescript/src/api/conversations.d.ts.map +1 -1
- package/lib/typescript/src/api/customers.d.ts +1 -1
- package/lib/typescript/src/api/customers.d.ts.map +1 -1
- package/lib/typescript/src/api/media.d.ts +3 -3
- package/lib/typescript/src/api/media.d.ts.map +1 -1
- package/lib/typescript/src/api/messages.d.ts +1 -1
- package/lib/typescript/src/api/messages.d.ts.map +1 -1
- package/lib/typescript/src/components/ChatList.d.ts.map +1 -1
- package/lib/typescript/src/components/ComnyxErrorBoundary.d.ts +18 -0
- package/lib/typescript/src/components/ComnyxErrorBoundary.d.ts.map +1 -0
- package/lib/typescript/src/components/CustomerForm.d.ts.map +1 -1
- package/lib/typescript/src/components/InitFailed.d.ts +5 -2
- package/lib/typescript/src/components/InitFailed.d.ts.map +1 -1
- package/lib/typescript/src/components/MediaMessageItem.d.ts.map +1 -1
- package/lib/typescript/src/components/MediaViewerModal.d.ts.map +1 -1
- package/lib/typescript/src/components/MessageInput.d.ts.map +1 -1
- package/lib/typescript/src/components/MessageItem.d.ts.map +1 -1
- package/lib/typescript/src/hooks/usePolling.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useThemeColors.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/notifications/initializeNotifications.d.ts.map +1 -1
- package/lib/typescript/src/register/Accumulator.d.ts.map +1 -1
- package/lib/typescript/src/register/collectData.d.ts +4 -1
- package/lib/typescript/src/register/collectData.d.ts.map +1 -1
- package/lib/typescript/src/register/login.d.ts.map +1 -1
- package/lib/typescript/src/store/store.d.ts +6 -2
- package/lib/typescript/src/store/store.d.ts.map +1 -1
- package/lib/typescript/src/support/ComnyxSupport.d.ts +80 -3
- package/lib/typescript/src/support/ComnyxSupport.d.ts.map +1 -1
- package/lib/typescript/src/support/SupportConfigContext.d.ts +98 -0
- package/lib/typescript/src/support/SupportConfigContext.d.ts.map +1 -0
- package/lib/typescript/src/support/index.d.ts +2 -0
- package/lib/typescript/src/support/index.d.ts.map +1 -1
- package/lib/typescript/src/types/Conversation.d.ts +2 -2
- package/lib/typescript/src/types/Conversation.d.ts.map +1 -1
- package/lib/typescript/src/types/Customer.d.ts +1 -1
- package/lib/typescript/src/types/Customer.d.ts.map +1 -1
- package/lib/typescript/src/types/MessageResponse.d.ts +7 -4
- package/lib/typescript/src/types/MessageResponse.d.ts.map +1 -1
- package/lib/typescript/src/types/Theme.d.ts +26 -0
- package/lib/typescript/src/types/Theme.d.ts.map +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +19 -30
- package/src/NativeComnyxMediaPicker.ts +18 -0
- package/src/api/conversations.ts +6 -4
- package/src/api/customers.ts +3 -1
- package/src/api/media.ts +32 -10
- package/src/api/messages.ts +3 -1
- package/src/components/ChatList.tsx +147 -99
- package/src/components/ComnyxErrorBoundary.tsx +91 -0
- package/src/components/CustomerForm.tsx +7 -3
- package/src/components/InitFailed.tsx +80 -16
- package/src/components/MediaMessageItem.tsx +48 -11
- package/src/components/MediaViewerModal.tsx +21 -8
- package/src/components/MessageInput.tsx +108 -17
- package/src/components/MessageItem.tsx +12 -13
- package/src/hooks/usePolling.ts +26 -11
- package/src/hooks/useThemeColors.ts +11 -2
- package/src/index.ts +16 -0
- package/src/notifications/initializeNotifications.ts +22 -20
- package/src/register/Accumulator.ts +26 -9
- package/src/register/collectData.ts +10 -2
- package/src/register/login.ts +5 -0
- package/src/store/store.ts +11 -3
- package/src/support/ComnyxSupport.tsx +172 -23
- package/src/support/SupportConfigContext.tsx +157 -0
- package/src/support/index.ts +11 -0
- package/src/types/Conversation.ts +2 -2
- package/src/types/Customer.ts +1 -2
- package/src/types/MessageResponse.ts +4 -4
- package/src/types/Theme.ts +38 -0
- package/src/version.ts +1 -1
|
@@ -47,9 +47,10 @@ function changePermissionStatus(status) {
|
|
|
47
47
|
}
|
|
48
48
|
async function initializeNativeNotifications(options) {
|
|
49
49
|
const state = useAppStore.getState();
|
|
50
|
-
//
|
|
50
|
+
// Listeners are attached BEFORE nativeComnyx.initialize so that a
|
|
51
|
+
// synchronous TOKEN_INIT emission (e.g. cached APN token on iOS) is not
|
|
52
|
+
// lost between native resolve and JS subscription.
|
|
51
53
|
globalSubscriptions.subscriptionsForNotification = [ComnyxNotifications.addEventListener('TOKEN_INIT', data => {
|
|
52
|
-
console.log('TOKEN_INIT', data);
|
|
53
54
|
useAppStore.getState().setToken(data.token);
|
|
54
55
|
if (Platform.OS === 'ios') {
|
|
55
56
|
accumulator.add({
|
|
@@ -117,7 +118,11 @@ export async function initializeNotifications(params = {}) {
|
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
120
|
globalSubscriptions.subscriptionsForOptIn = AppState.addEventListener('change', async nextAppState => {
|
|
120
|
-
|
|
121
|
+
// AppState callbacks are fire-and-forget — any throw here becomes an
|
|
122
|
+
// unhandled rejection that can surface as a red-screen in the host app.
|
|
123
|
+
// Keep the whole body inside a guard.
|
|
124
|
+
try {
|
|
125
|
+
if (nextAppState !== 'active') return;
|
|
121
126
|
const permissionGivenInForeground = await ComnyxNotifications.checkOptIn();
|
|
122
127
|
changePermissionStatus(permissionGivenInForeground);
|
|
123
128
|
if (permissionGivenInForeground === NotificationPermissionStatus.GRANTED) {
|
|
@@ -125,20 +130,18 @@ export async function initializeNotifications(params = {}) {
|
|
|
125
130
|
if (!state.notificationInitialized) {
|
|
126
131
|
await initializeNativeNotifications(options);
|
|
127
132
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
}
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (!params.showOptInOnForeground) return;
|
|
136
|
+
const permissionResultInner = await ComnyxNotifications.optIn();
|
|
137
|
+
changePermissionStatus(permissionResultInner);
|
|
138
|
+
if (permissionResultInner === NotificationPermissionStatus.GRANTED) {
|
|
139
|
+
await initializeNativeNotifications(options);
|
|
140
|
+
} else if (permissionResultInner === NotificationPermissionStatus.BLOCKED && params.linkToSettings) {
|
|
141
|
+
showAlertDialog();
|
|
141
142
|
}
|
|
143
|
+
} catch (err) {
|
|
144
|
+
console.warn('[Comnyx] AppState handler failed', err);
|
|
142
145
|
}
|
|
143
146
|
});
|
|
144
147
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Alert","AppState","Platform","ComnyxNotifications","nativeComnyx","NotificationPermissionStatus","useAppStore","isInitCalled","isLoginCalled","localize","accumulator","globalSubscriptions","subscriptionsForNotification","subscriptionsForOptIn","isAlertShowing","showAlertDialog","OS","alert","text","style","onPress","linkToSettings","changePermissionStatus","status","state","getState","GRANTED","permissionGiven","setPermissionGiven","add","allow_notifications","initializeNativeNotifications","options","addEventListener","data","
|
|
1
|
+
{"version":3,"names":["Alert","AppState","Platform","ComnyxNotifications","nativeComnyx","NotificationPermissionStatus","useAppStore","isInitCalled","isLoginCalled","localize","accumulator","globalSubscriptions","subscriptionsForNotification","subscriptionsForOptIn","isAlertShowing","showAlertDialog","OS","alert","text","style","onPress","linkToSettings","changePermissionStatus","status","state","getState","GRANTED","permissionGiven","setPermissionGiven","add","allow_notifications","initializeNativeNotifications","options","addEventListener","data","setToken","token","apnsToken","fcmToken","console","error","sendOptions","initialize","then","res","setNotificationInitialized","success","platform","country","language","timezone","initializeNotifications","params","Error","logLevel","result","length","forEach","subscription","remove","permissionResult","checkOptIn","showOptIn","DENIED","permissionResultAfterDenied","optIn","BLOCKED","nextAppState","permissionGivenInForeground","notificationInitialized","showOptInOnForeground","permissionResultInner","err","warn"],"sourceRoot":"../../../src","sources":["notifications/initializeNotifications.ts"],"mappings":";;AAAA,SACEA,KAAK,EACLC,QAAQ,EAGRC,QAAQ,QACH,cAAc;AACrB,SAASC,mBAAmB,QAAQ,YAAG;AACvC,SACEC,YAAY,EACZC,4BAA4B,QAEvB,oBAAiB;AACxB,SAASC,WAAW,QAAQ,mBAAgB;AAC5C,SAASC,YAAY,EAAEC,aAAa,QAAQ,eAAY;AACxD,SAASC,QAAQ,QAAQ,yBAAsB;AAC/C,SAASC,WAAW,QAAQ,4BAAyB;AAErD,IAAIC,mBAAmB,GAAG;EACxBC,4BAA4B,EAAE,EAA2B;EACzDC,qBAAqB,EAAE;AACzB,CAAC;AAED,IAAIC,cAAc,GAAG,KAAK;AAS1B,SAASC,eAAeA,CAAA,EAAG;EACzB,IAAIb,QAAQ,CAACc,EAAE,KAAK,KAAK,IAAIF,cAAc,EAAE;IAC3C;EACF;EAEAA,cAAc,GAAG,IAAI;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E,QAAQ,EACR,MAAOkC,YAAY,IAAK;IACtB;IACA;IACA;IACA,IAAI;MACF,IAAIA,YAAY,KAAK,QAAQ,EAAE;MAC/B,MAAMC,2BAA2B,GAC/B,MAAMjE,mBAAmB,CAAC0D,UAAU,CAAC,CAAC;MACxCvC,sBAAsB,CAAC8C,2BAA2B,CAAC;MACnD,IACEA,2BAA2B,KAAK/D,4BAA4B,CAACqB,OAAO,EACpE;QACA,MAAMF,KAAK,GAAGlB,WAAW,CAACmB,QAAQ,CAAC,CAAC;QACpC,IAAI,CAACD,KAAK,CAAC6C,uBAAuB,EAAE;UAClC,MAAMtC,6BAA6B,CAACC,OAAO,CAAC;QAC9C;QACA;MACF;MACA,IAAI,CAACoB,MAAM,CAACkB,qBAAqB,EAAE;MACnC,MAAMC,qBAAqB,GAAG,MAAMpE,mBAAmB,CAAC8D,KAAK,CAAC,CAAC;MAC/D3C,sBAAsB,CAACiD,qBAAqB,CAAC;MAC7C,IAAIA,qBAAqB,KAAKlE,4BAA4B,CAACqB,OAAO,EAAE;QAClE,MAAMK,6BAA6B,CAACC,OAAO,CAAC;MAC9C,CAAC,MAAM,IACLuC,qBAAqB,KAAKlE,4BAA4B,CAAC6D,OAAO,IAC9Dd,MAAM,CAAC/B,cAAc,EACrB;QACAN,eAAe,CAAC,CAAC;MACnB;IACF,CAAC,CAAC,OAAOyD,GAAG,EAAE;MACZjC,OAAO,CAACkC,IAAI,CAAC,kCAAkC,EAAED,GAAG,CAAC;IACvD;EACF,CACF,CAAC;EAED,OAAOjB,MAAM;AACf","ignoreList":[]}
|
|
@@ -17,7 +17,11 @@ export class Accumulator {
|
|
|
17
17
|
}
|
|
18
18
|
add(data) {
|
|
19
19
|
if (!this.registerData) {
|
|
20
|
-
|
|
20
|
+
// Late events (push token callbacks, AppState changes) may arrive
|
|
21
|
+
// after logout() or before login(). Ignore silently instead of
|
|
22
|
+
// throwing so the host app is not crashed by SDK-internal races.
|
|
23
|
+
console.warn('[Comnyx] add() called before register/after logout — ignored');
|
|
24
|
+
return;
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
// First, create a map of existing custom parameters by name
|
|
@@ -51,10 +55,17 @@ export class Accumulator {
|
|
|
51
55
|
}
|
|
52
56
|
async flush() {
|
|
53
57
|
if (!this.registerData) {
|
|
54
|
-
|
|
58
|
+
console.warn('[Comnyx] flush() called before register/after logout — ignored');
|
|
59
|
+
return;
|
|
55
60
|
}
|
|
56
61
|
if (this.listener) {
|
|
57
|
-
|
|
62
|
+
try {
|
|
63
|
+
await this.listener(this.registerData);
|
|
64
|
+
} catch (err) {
|
|
65
|
+
console.error('[Comnyx] flush listener error', err);
|
|
66
|
+
this.reset();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
58
69
|
this.registerData = {
|
|
59
70
|
...this.registerData,
|
|
60
71
|
customParameters: []
|
|
@@ -65,12 +76,14 @@ export class Accumulator {
|
|
|
65
76
|
}
|
|
66
77
|
debounce() {
|
|
67
78
|
if (!this.registerData) {
|
|
68
|
-
|
|
79
|
+
return;
|
|
69
80
|
}
|
|
70
81
|
this.reset();
|
|
71
82
|
this.__select_time = setTimeout(() => {
|
|
72
|
-
if (this.listener) {
|
|
73
|
-
this.listener(this.registerData)
|
|
83
|
+
if (this.listener && this.registerData) {
|
|
84
|
+
Promise.resolve(this.listener(this.registerData)).catch(err => {
|
|
85
|
+
console.error('[Comnyx] debounce listener error', err);
|
|
86
|
+
});
|
|
74
87
|
this.registerData = {
|
|
75
88
|
...this.registerData,
|
|
76
89
|
customParameters: []
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ACCUMULATOR_DEBOUNCE_TIME_IN_MS","Accumulator","registerData","__select_time","undefined","listener","_isListenerCalledOnce","constructor","register","customParameters","integrationParameters","debounce","add","data","
|
|
1
|
+
{"version":3,"names":["ACCUMULATOR_DEBOUNCE_TIME_IN_MS","Accumulator","registerData","__select_time","undefined","listener","_isListenerCalledOnce","constructor","register","customParameters","integrationParameters","debounce","add","data","console","warn","customParamsMap","Map","forEach","param","set","name","value","mergedCustomParameters","Array","from","entries","map","flush","err","error","reset","setTimeout","Promise","resolve","catch","clearTimeout","clear","empty","get","isListenerCalledOnce","accumulator"],"sourceRoot":"../../../src","sources":["register/Accumulator.ts"],"mappings":";;AAEA,MAAMA,+BAA+B,GAAG,IAAI;AAE5C,OAAO,MAAMC,WAAW,CAAC;EACfC,YAAY,GAAiC,IAAI;EACjDC,aAAa,GAA8CC,SAAS;EACpEC,QAAQ,GACd,IAAI;EACEC,qBAAqB,GAAY,KAAK;EAC9CC,WAAWA,CAAA,EAAG,CAAC;EAEfC,QAAQA,CAACH,QAAwD,EAAE;IACjE,IAAI,CAACH,YAAY,GAAG;MAClBO,gBAAgB,EAAE,EAAE;MACpBC,qBAAqB,EAAE,CAAC;IAC1B,CAAC;IACD,IAAI,CAACL,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACM,QAAQ,CAAC,CAAC;EACjB;EAEAC,GAAGA,CAACC,IAAwD,EAAE;IAC5D,IAAI,CAAC,IAAI,CAACX,YAAY,EAAE;MACtB;MACA;MACA;MACAY,OAAO,CAACC,IAAI,CACV,8DACF,CAAC;MACD;IACF;;IAEA;IACA,MAAMC,eAAe,GAAG,IAAIC,GAAG,CAAmC,CAAC;;IAEnE;IACA,CAAC,IAAI,CAACf,YAAY,CAACO,gBAAgB,IAAI,EAAE,EAAES,OAAO,CAAEC,KAAK,IAAK;MAC5DH,eAAe,CAACI,GAAG,CAACD,KAAK,CAACE,IAAI,EAAEF,KAAK,CAACG,KAAK,CAAC;IAC9C,CAAC,CAAC;;IAEF;IACA,CAACT,IAAI,CAACJ,gBAAgB,IAAI,EAAE,EAAES,OAAO,CAAEC,KAAK,IAAK;MAC/CH,eAAe,CAACI,GAAG,CAACD,KAAK,CAACE,IAAI,EAAEF,KAAK,CAACG,KAAK,CAAC;IAC9C,CAAC,CAAC;;IAEF;IACA,MAAMC,sBAAsB,GAAGC,KAAK,CAACC,IAAI,CAACT,e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Y,EAAE;QACtC+B,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC7B,QAAQ,CAAC,IAAI,CAACH,YAAY,CAAC,CAAC,CAACiC,KAAK,CAAEN,GAAG,IAAK;UAC/Df,OAAO,CAACgB,KAAK,CAAC,kCAAkC,EAAED,GAAG,CAAC;QACxD,CAAC,CAAC;QACF,IAAI,CAAC3B,YAAY,GAAG;UAClB,GAAG,IAAI,CAACA,YAAY;UACpBO,gBAAgB,EAAE;QACpB,CAAC;QACD,IAAI,CAACH,qBAAqB,GAAG,IAAI;MACnC;IACF,CAAC,EAAEN,+BAA+B,CAAC;EACrC;EAEA+B,KAAKA,CAAA,EAAG;IACN,IAAI,IAAI,CAAC5B,aAAa,EAAE;MACtBiC,YAAY,CAAC,IAAI,CAACjC,aAAa,CAAC;IAClC;EACF;EAEAkC,KAAKA,CAAA,EAAG;IACN,IAAI,CAACnC,YAAY,GAAG,IAAI;IACxB,IAAI,IAAI,CAACC,aAAa,EAAE;MACtBiC,YAAY,CAAC,IAAI,CAACjC,aAAa,CAAC;IAClC;IACA,IAAI,CAACG,qBAAqB,GAAG,KAAK;EACpC;EACA;EACAgC,KAAKA,CAAA,EAAG;IACN,IAAI,CAACpC,YAAY,GAAG,CAAC,CAAC;EACxB;EAEAqC,GAAGA,CAAA,EAAG;IACJ,OAAO,IAAI,CAACrC,YAAY;EAC1B;EAEAsC,oBAAoBA,CAAA,EAAG;IACrB,OAAO,IAAI,CAAClC,qBAAqB;EACnC;AACF;AAEA,OAAO,MAAMmC,WAAW,GAAG,IAAIxC,WAAW,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["accumulator","collectData","key","value","add","customParameters","name","registerOneSignalForComnyx","external_id","integrationParameters","onesignal"],"sourceRoot":"../../../src","sources":["register/collectData.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["accumulator","collectData","key","value","add","customParameters","name","registerOneSignalForComnyx","external_id","integrationParameters","onesignal"],"sourceRoot":"../../../src","sources":["register/collectData.ts"],"mappings":";;AACA,SAASA,WAAW,QAAQ,kBAAe;AAM3C,OAAO,SAASC,WAAWA,CACzBC,GAA4D,EAC5DC,KAAgC,EAChC;EACA,IAAI,OAAOD,GAAG,KAAK,QAAQ,EAAE;IAC3BF,WAAW,CAACI,GAAG,CAAC;MACdC,gBAAgB,EAAE,CAChB;QACEC,IAAI,EAAEJ,GAAG;QACTC,KAAK,EAAEA,KAAK,IAAI;MAClB,CAAC;IAEL,CAAC,CAAC;EACJ,CAAC,MAAM;IACLH,WAAW,CAACI,GAAG,CAACF,GAAG,CAAC;EACtB;AACF;;AAEA;AACA,OAAO,SAASK,0BAA0BA,CAACC,WAAmB,EAAE;EAC9DR,WAAW,CAACI,GAAG,CAAC;IACdK,qBAAqB,EAAE;MACrBC,SAAS,EAAE;QACTF;MACF;IACF;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ import { accumulator } from "./Accumulator.js";
|
|
|
4
4
|
import { isInitCalled, setLoginForAxios } from "../api/api.js";
|
|
5
5
|
import { useAppStore } from "../store/store.js";
|
|
6
6
|
import { updateCustomer } from "../api/customers.js";
|
|
7
|
+
import { reportSupportError } from "../support/SupportConfigContext.js";
|
|
7
8
|
export function login(loginOptions) {
|
|
8
9
|
if (!isInitCalled()) {
|
|
9
10
|
throw new Error('Please initialize the Comnyx SDK first');
|
|
@@ -20,6 +21,10 @@ export function login(loginOptions) {
|
|
|
20
21
|
useAppStore.getState().setCustomer(data.customer);
|
|
21
22
|
} catch (error) {
|
|
22
23
|
console.error('[Comnyx] Error in login', error);
|
|
24
|
+
reportSupportError(error, {
|
|
25
|
+
section: 'init',
|
|
26
|
+
recoverable: false
|
|
27
|
+
});
|
|
23
28
|
}
|
|
24
29
|
});
|
|
25
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["accumulator","isInitCalled","setLoginForAxios","useAppStore","updateCustomer","login","loginOptions","Error","externalId","clear","getState","setRegistered","register","accumulatedData","data","setCustomer","customer","error","console"],"sourceRoot":"../../../src","sources":["register/login.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,kBAAe;AAC3C,SAASC,YAAY,EAAEC,gBAAgB,QAAQ,eAAY;AAE3D,SAASC,WAAW,QAAQ,mBAAgB;AAC5C,SAASC,cAAc,QAAQ,qBAAkB;
|
|
1
|
+
{"version":3,"names":["accumulator","isInitCalled","setLoginForAxios","useAppStore","updateCustomer","reportSupportError","login","loginOptions","Error","externalId","clear","getState","setRegistered","register","accumulatedData","data","setCustomer","customer","error","console","section","recoverable"],"sourceRoot":"../../../src","sources":["register/login.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,kBAAe;AAC3C,SAASC,YAAY,EAAEC,gBAAgB,QAAQ,eAAY;AAE3D,SAASC,WAAW,QAAQ,mBAAgB;AAC5C,SAASC,cAAc,QAAQ,qBAAkB;AACjD,SAASC,kBAAkB,QAAQ,oCAAiC;AAMpE,OAAO,SAASC,KAAKA,CAACC,YAA0B,EAAE;EAChD,IAAI,CAACN,YAAY,CAAC,CAAC,EAAE;IACnB,MAAM,IAAIO,KAAK,CAAC,wCAAwC,CAAC;EAC3D;EACA,IAAI,CAACD,YAAY,CAACE,UAAU,EAAE;IAC5B,MAAM,IAAID,KAAK,CAAC,4CAA4C,CAAC;EAC/D;EACAN,gBAAgB,CAACK,YAAY,CAACE,UAAU,CAAC;EACzCT,WAAW,CAACU,KAAK,CAAC,CAAC;EACnBP,WAAW,CAACQ,QAAQ,CAAC,CAAC,CAACC,aAAa,CAAC,IAAI,CAAC;EAC1CZ,WAAW,CAACa,QAAQ,CAAC,MAAOC,eAAsC,IAAK;IACrE,IAAI;MACF,MAAMC,IAAI,GAAG,MAAMX,cAAc,CAC/BU,eAAe,EACfP,YAAY,CAACE,UACf,CAAC;MACDN,WAAW,CAACQ,QAAQ,CAAC,CAAC,CAACK,WAAW,CAACD,IAAI,CAACE,QAAQ,CAAC;IACnD,CAAC,CAAC,OAAOC,KAAK,EAAE;MACdC,OAAO,CAACD,KAAK,CAAC,yBAAyB,EAAEA,KAAK,CAAC;MAC/Cb,kBAAkB,CAACa,KAAK,EAAE;QACxBE,OAAO,EAAE,MAAM;QACfC,WAAW,EAAE;MACf,CAAC,CAAC;IACJ;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -14,6 +14,7 @@ export const storeCreator = (set, get) => ({
|
|
|
14
14
|
theme: 'light',
|
|
15
15
|
fake: false,
|
|
16
16
|
themes: {},
|
|
17
|
+
themeOverride: {},
|
|
17
18
|
firstMessage: null,
|
|
18
19
|
formSubmitted: false,
|
|
19
20
|
setData: cb => {
|
|
@@ -53,6 +54,11 @@ export const storeCreator = (set, get) => ({
|
|
|
53
54
|
themes
|
|
54
55
|
});
|
|
55
56
|
},
|
|
57
|
+
setThemeOverride: themeOverride => {
|
|
58
|
+
set({
|
|
59
|
+
themeOverride
|
|
60
|
+
});
|
|
61
|
+
},
|
|
56
62
|
updateBaseDimensions: ({
|
|
57
63
|
baseWidth,
|
|
58
64
|
baseHeight
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createJSONStorage","persist","shallow","createWithEqualityFn","mmkvStorage","storeCreator","set","get","baseWidth","baseHeight","initialized","customer","data","language","theme","fake","themes","firstMessage","formSubmitted","setData","cb","newData","setFirstMessage","message","setCustomer","createCustomerResponse","name","setLanguage","setTheme","setFake","setThemes","updateBaseDimensions","setForm","form","permissionGiven","setPermissionGiven","notificationInitialized","setNotificationInitialized","toastMessage","setToastMessage","token","setToken","registered","setRegistered","useAppStore","storage","skipHydration","partialize","state"],"sourceRoot":"../../../src","sources":["store/store.ts"],"mappings":";;AAAA,SAASA,iBAAiB,EAAEC,OAAO,QAAQ,oBAAoB;AAC/D,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,oBAAoB,QAAQ,qBAAqB;
|
|
1
|
+
{"version":3,"names":["createJSONStorage","persist","shallow","createWithEqualityFn","mmkvStorage","storeCreator","set","get","baseWidth","baseHeight","initialized","customer","data","language","theme","fake","themes","themeOverride","firstMessage","formSubmitted","setData","cb","newData","setFirstMessage","message","setCustomer","createCustomerResponse","name","setLanguage","setTheme","setFake","setThemes","setThemeOverride","updateBaseDimensions","setForm","form","permissionGiven","setPermissionGiven","notificationInitialized","setNotificationInitialized","toastMessage","setToastMessage","token","setToken","registered","setRegistered","useAppStore","storage","skipHydration","partialize","state"],"sourceRoot":"../../../src","sources":["store/store.ts"],"mappings":";;AAAA,SAASA,iBAAiB,EAAEC,OAAO,QAAQ,oBAAoB;AAC/D,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,oBAAoB,QAAQ,qBAAqB;AAQ1D,SAASC,WAAW,QAAQ,yBAAsB;AA2ClD,OAAO,MAAMC,YAAyC,GAAGA,CAACC,GAAG,EAAEC,GAAG,MAAM;EACtEC,SAAS,EAAE,GAAG;EACdC,UAAU,EAAE,GAAG;EACfC,WAAW,EAAE,KAAK;EAClBC,QAAQ,EAAE,IAAI;EACdC,IAAI,EAAE,IAAI;EACVC,QAAQ,EAAE,IAAI;EACdC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,KAAK;EACXC,MAAM,EAAE,CAAC,CAAC;EACVC,aAAa,EAAE,CAAC,CAAC;EACjBC,YAAY,EAAE,IAAI;EAClBC,aAAa,EAAE,KAAK;EACpBC,OAAO,EAAGC,EAAE,IAAK;IACf,MAAMC,OAAO,GAAGD,EAAE,CAACd,GAAG,CAAC,CAAC,CAACK,IAAI,CAAC;IAC9BN,GAAG,CAAC;MAAEM,IAAI,EAAEU;IAAQ,CAAC,CAAC;EACxB,CAAC;EACDC,eAAe,EAAGC,OAAO,IAAK;IAC5BlB,GAAG,CAAC;MAAEY,YAAY,EAAEM;IAAQ,CAAC,CAAC;EAChC,CAAC;EACDC,WAAW,EAAGC,sBAAuC,IAAK;IACxDpB,GAAG,CAAC;MACFK,QAAQ,EAAEe,sBAAsB;MAChCP,aAA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C3BpC,GAAG,CAAC;MAAEoC;IAAM,CAAC,CAAC;EAChB,CAAC;EACDE,UAAU,EAAE,KAAK;EACjBC,aAAa,EAAGD,UAAmB,IAAK;IACtCtC,GAAG,CAAC;MAAEsC;IAAW,CAAC,CAAC;EACrB;AACF,CAAC,CAAC;AAEF,OAAO,MAAME,WAAW,GAAG3C,oBAAoB,CAAgB,CAAC,CAC9DF,OAAO,CAACI,YAAY,EAAE;EACpBsB,IAAI,EAAE,oBAAoB;EAC1BoB,OAAO,EAAE/C,iBAAiB,CAAC,MAAMI,WAAW,CAAC;EAC7C4C,aAAa,EAAE,KAAK;EACpBC,UAAU,EAAGC,KAAK,KAAM;IACtBvC,QAAQ,EAAEuC,KAAK,CAACvC,QAAQ;IACxBQ,aAAa,EAAE+B,KAAK,CAAC/B,aAAa;IAClCiB,eAAe,EAAEc,KAAK,CAACd;EACzB,CAAC;AACH,CAAC,CAAC,EACFlC,OACF,CAAC","ignoreList":[]}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { View, TouchableOpacity, Image } from 'react-native';
|
|
3
|
+
import { View, TouchableOpacity, Image, Appearance } from 'react-native';
|
|
4
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
5
|
import { ChatList } from "../components/ChatList.js";
|
|
5
6
|
import { CustomerForm } from "../components/CustomerForm.js";
|
|
6
|
-
import { useEffect, useState } from 'react';
|
|
7
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
7
8
|
import { AppText } from "../components/AppText.js";
|
|
8
9
|
import { useThemeColors } from "../hooks/useThemeColors.js";
|
|
9
10
|
import { usePolling } from "../hooks/usePolling.js";
|
|
10
11
|
import { useAppStore } from "../store/store.js";
|
|
11
12
|
import { ScaledSheet } from "../components/ScaledSheet.js";
|
|
12
13
|
import { accumulator } from "../register/Accumulator.js";
|
|
14
|
+
import { SupportConfigProvider, setGlobalSupportErrorReporter, reportSupportError } from "./SupportConfigContext.js";
|
|
13
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
16
|
const closeIcon = require('../assets/x-close.png');
|
|
15
17
|
export function ComnyxSupport({
|
|
@@ -18,7 +20,14 @@ export function ComnyxSupport({
|
|
|
18
20
|
fake = false,
|
|
19
21
|
onBack,
|
|
20
22
|
themes,
|
|
21
|
-
|
|
23
|
+
themeOverride,
|
|
24
|
+
containerStyle,
|
|
25
|
+
renderHeader,
|
|
26
|
+
renderEmptyState,
|
|
27
|
+
renderErrorState,
|
|
28
|
+
renderMessage,
|
|
29
|
+
onBeforeSend,
|
|
30
|
+
onError
|
|
22
31
|
}) {
|
|
23
32
|
const {
|
|
24
33
|
customer,
|
|
@@ -29,13 +38,35 @@ export function ComnyxSupport({
|
|
|
29
38
|
}));
|
|
30
39
|
const [initLoading, setInitLoading] = useState(true);
|
|
31
40
|
const themeColors = useThemeColors();
|
|
41
|
+
const insets = useSafeAreaInsets();
|
|
32
42
|
usePolling();
|
|
43
|
+
const supportConfig = useMemo(() => ({
|
|
44
|
+
renderHeader,
|
|
45
|
+
renderEmptyState,
|
|
46
|
+
renderErrorState,
|
|
47
|
+
renderMessage,
|
|
48
|
+
onBeforeSend,
|
|
49
|
+
onError
|
|
50
|
+
}), [renderHeader, renderEmptyState, renderErrorState, renderMessage, onBeforeSend, onError]);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
setGlobalSupportErrorReporter(onError);
|
|
53
|
+
return () => {
|
|
54
|
+
setGlobalSupportErrorReporter(undefined);
|
|
55
|
+
};
|
|
56
|
+
}, [onError]);
|
|
33
57
|
useEffect(() => {
|
|
34
58
|
if (!accumulator.isListenerCalledOnce()) {
|
|
35
59
|
accumulator.flush().then(() => {
|
|
36
60
|
setTimeout(() => {
|
|
37
61
|
setInitLoading(false);
|
|
38
62
|
}, 100);
|
|
63
|
+
}).catch(err => {
|
|
64
|
+
console.error('[Comnyx] accumulator.flush failed', err);
|
|
65
|
+
reportSupportError(err, {
|
|
66
|
+
section: 'accumulator',
|
|
67
|
+
recoverable: true
|
|
68
|
+
});
|
|
69
|
+
setInitLoading(false);
|
|
39
70
|
});
|
|
40
71
|
} else {
|
|
41
72
|
setInitLoading(false);
|
|
@@ -49,24 +80,50 @@ export function ComnyxSupport({
|
|
|
49
80
|
}
|
|
50
81
|
}, [customer, customer?.external_id]);
|
|
51
82
|
useEffect(() => {
|
|
52
|
-
//TOOD: getState().initApp({language,theme,fake,rtlFix,themes})
|
|
53
83
|
useAppStore.getState().setLanguage(language);
|
|
54
|
-
useAppStore.getState().setTheme(theme);
|
|
55
84
|
useAppStore.getState().setFake(fake);
|
|
56
85
|
if (themes) {
|
|
57
86
|
useAppStore.getState().setThemes(themes);
|
|
58
87
|
}
|
|
59
|
-
|
|
88
|
+
if (themeOverride) {
|
|
89
|
+
useAppStore.getState().setThemeOverride(themeOverride);
|
|
90
|
+
}
|
|
91
|
+
}, [language, fake, themes, themeOverride]);
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
const setTheme = useAppStore.getState().setTheme;
|
|
94
|
+
if (theme !== 'system') {
|
|
95
|
+
setTheme(theme);
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
setTheme(Appearance.getColorScheme() === 'dark' ? 'dark' : 'light');
|
|
99
|
+
const sub = Appearance.addChangeListener(({
|
|
100
|
+
colorScheme
|
|
101
|
+
}) => {
|
|
102
|
+
setTheme(colorScheme === 'dark' ? 'dark' : 'light');
|
|
103
|
+
});
|
|
104
|
+
return () => sub.remove();
|
|
105
|
+
}, [theme]);
|
|
106
|
+
let body;
|
|
60
107
|
if (!customer) {
|
|
61
108
|
//NOTE: customer yoksa register hiç çalışmamış
|
|
62
|
-
|
|
109
|
+
body = /*#__PURE__*/_jsxs(View, {
|
|
63
110
|
style: [styles.container, {
|
|
64
111
|
backgroundColor: themeColors.background
|
|
65
112
|
}],
|
|
66
113
|
children: [/*#__PURE__*/_jsx(TouchableOpacity, {
|
|
67
114
|
activeOpacity: 1,
|
|
68
|
-
style: [styles.iconContainer
|
|
115
|
+
style: [styles.iconContainer, {
|
|
116
|
+
top: Math.max(insets.top, 16) + 16
|
|
117
|
+
}],
|
|
69
118
|
onPress: onBack,
|
|
119
|
+
accessibilityRole: "button",
|
|
120
|
+
accessibilityLabel: "Close support",
|
|
121
|
+
hitSlop: {
|
|
122
|
+
top: 12,
|
|
123
|
+
bottom: 12,
|
|
124
|
+
left: 12,
|
|
125
|
+
right: 12
|
|
126
|
+
},
|
|
70
127
|
children: /*#__PURE__*/_jsx(Image, {
|
|
71
128
|
source: closeIcon,
|
|
72
129
|
style: [styles.closeIcon, {
|
|
@@ -82,20 +139,25 @@ export function ComnyxSupport({
|
|
|
82
139
|
});
|
|
83
140
|
} else if (!formSubmitted) {
|
|
84
141
|
//NOTE: customer var ama forSubmitted false (name===null)
|
|
85
|
-
|
|
142
|
+
body = /*#__PURE__*/_jsx(CustomerForm, {
|
|
86
143
|
loading: initLoading,
|
|
87
144
|
onBack: onBack,
|
|
88
145
|
containerStyle: containerStyle
|
|
89
146
|
});
|
|
147
|
+
} else {
|
|
148
|
+
body = /*#__PURE__*/_jsx(View, {
|
|
149
|
+
style: [styles.container, {
|
|
150
|
+
backgroundColor: themeColors.background
|
|
151
|
+
}, containerStyle],
|
|
152
|
+
children: /*#__PURE__*/_jsx(ChatList, {
|
|
153
|
+
initLoading: initLoading,
|
|
154
|
+
onBack: onBack
|
|
155
|
+
})
|
|
156
|
+
});
|
|
90
157
|
}
|
|
91
|
-
return /*#__PURE__*/_jsx(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}, containerStyle],
|
|
95
|
-
children: /*#__PURE__*/_jsx(ChatList, {
|
|
96
|
-
initLoading: initLoading,
|
|
97
|
-
onBack: onBack
|
|
98
|
-
})
|
|
158
|
+
return /*#__PURE__*/_jsx(SupportConfigProvider, {
|
|
159
|
+
value: supportConfig,
|
|
160
|
+
children: body
|
|
99
161
|
});
|
|
100
162
|
}
|
|
101
163
|
const styles = ScaledSheet.create({
|
|
@@ -105,7 +167,6 @@ const styles = ScaledSheet.create({
|
|
|
105
167
|
},
|
|
106
168
|
iconContainer: {
|
|
107
169
|
position: 'absolute',
|
|
108
|
-
top: '60@vs',
|
|
109
170
|
left: '24@s'
|
|
110
171
|
},
|
|
111
172
|
closeIcon: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["View","TouchableOpacity","Image","ChatList","CustomerForm","useEffect","useState","AppText","useThemeColors","usePolling","useAppStore","ScaledSheet","accumulator","jsx","_jsx","jsxs","_jsxs","closeIcon","require","ComnyxSupport","language","theme","fake","onBack","themes","containerStyle","customer","formSubmitted","s","initLoading","setInitLoading","themeColors","isListenerCalledOnce","flush","then","setTimeout","external_id","setState","data","getState","setLanguage","setTheme","
|
|
1
|
+
{"version":3,"names":["View","TouchableOpacity","Image","Appearance","useSafeAreaInsets","ChatList","CustomerForm","useEffect","useMemo","useState","AppText","useThemeColors","usePolling","useAppStore","ScaledSheet","accumulator","SupportConfigProvider","setGlobalSupportErrorReporter","reportSupportError","jsx","_jsx","jsxs","_jsxs","closeIcon","require","ComnyxSupport","language","theme","fake","onBack","themes","themeOverride","containerStyle","renderHeader","renderEmptyState","renderErrorState","renderMessage","onBeforeSend","onError","customer","formSubmitted","s","initLoading","setInitLoading","themeColors","insets","supportConfig","undefined","isListenerCalledOnce","flush","then","setTimeout","catch","err","console","error","section","recoverable","external_id","setState","data","getState","setLanguage","setFake","setThemes","setThemeOverride","setTheme","getColorScheme","sub","addChangeListener","colorScheme","remove","body","style","styles","container","backgroundColor","background","children","activeOpacity","iconContainer","top","Math","max","onPress","accessibilityRole","accessibilityLabel","hitSlop","bottom","left","right","source","tintColor","text","textAlign","localization","loading","value","create","flex","justifyContent","position","width","height"],"sourceRoot":"../../../src","sources":["support/ComnyxSupport.tsx"],"mappings":";;AAAA,SACEA,IAAI,EACJC,gBAAgB,EAChBC,KAAK,EACLC,UAAU,QAGL,cAAc;AACrB,SAASC,iBA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AAA,EAAEN;EAAI,CAAwB,CAAC;AAE/E;AAEA,MAAME,MAAM,GAAG5D,WAAW,CAACoF,MAAM,CAAC;EAChCvB,SAAS,EAAE;IACTwB,IAAI,EAAE,CAAC;IACPC,cAAc,EAAE;EAClB,CAAC;EACDpB,aAAa,EAAE;IACbqB,QAAQ,EAAE,UAAU;IACpBZ,IAAI,EAAE;EACR,CAAC;EACDlE,SAAS,EAAE;IACT+E,KAAK,EAAE,OAAO;IACdC,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Where inside the SDK an error originated. Helpful for dashboard grouping
|
|
7
|
+
* and for deciding which errors are user-visible vs silent.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Called whenever the SDK catches an operational error it cannot surface
|
|
12
|
+
* itself. Wire this to your error tracker — for Bugsnag:
|
|
13
|
+
*
|
|
14
|
+
* ```tsx
|
|
15
|
+
* onError={(err, ctx) => {
|
|
16
|
+
* if (err instanceof Error) {
|
|
17
|
+
* Bugsnag.notify(err, (event) => event.addMetadata('comnyx', ctx));
|
|
18
|
+
* }
|
|
19
|
+
* }}
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* Render-time exceptions are intentionally NOT funnelled here — they bubble
|
|
23
|
+
* to the host's React error boundary so `@bugsnag/plugin-react` sees them.
|
|
24
|
+
*/
|
|
25
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
|
+
const EMPTY_CONFIG = {};
|
|
27
|
+
const SupportConfigContext = /*#__PURE__*/createContext(EMPTY_CONFIG);
|
|
28
|
+
export function SupportConfigProvider({
|
|
29
|
+
value,
|
|
30
|
+
children
|
|
31
|
+
}) {
|
|
32
|
+
return /*#__PURE__*/_jsx(SupportConfigContext.Provider, {
|
|
33
|
+
value: value,
|
|
34
|
+
children: children
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export function useSupportConfig() {
|
|
38
|
+
return useContext(SupportConfigContext);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Module-level error forwarder so hooks that run outside of a render pass
|
|
43
|
+
* (accumulator.flush, polling tick) can still report. Set once per mount.
|
|
44
|
+
*/
|
|
45
|
+
let globalErrorReporter;
|
|
46
|
+
export function setGlobalSupportErrorReporter(reporter) {
|
|
47
|
+
globalErrorReporter = reporter;
|
|
48
|
+
}
|
|
49
|
+
export function reportSupportError(error, context) {
|
|
50
|
+
if (globalErrorReporter) {
|
|
51
|
+
try {
|
|
52
|
+
globalErrorReporter(error, context);
|
|
53
|
+
} catch (reporterErr) {
|
|
54
|
+
// Never let a broken reporter take down the SDK.
|
|
55
|
+
console.error('[Comnyx] onError reporter threw:', reporterErr);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=SupportConfigContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","useContext","jsx","_jsx","EMPTY_CONFIG","SupportConfigContext","SupportConfigProvider","value","children","Provider","useSupportConfig","globalErrorReporter","setGlobalSupportErrorReporter","reporter","reportSupportError","error","context","reporterErr","console"],"sourceRoot":"../../../src","sources":["support/SupportConfigContext.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,UAAU,QAAwB,OAAO;;AA4BjE;AACA;AACA;AACA;;AAuBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,SAAAC,GAAA,IAAAC,IAAA;AAwDA,MAAMC,YAA2B,GAAG,CAAC,CAAC;AAEtC,MAAMC,oBAAoB,gBAAGL,aAAa,CAAgBI,YAAY,CAAC;AAEvE,OAAO,SAASE,qBAAqBA,CAAC;EACpCC,KAAK;EACLC;AAIF,CAAC,EAAE;EACD,oBACEL,IAAA,CAACE,oBAAoB,CAACI,QAAQ;IAACF,KAAK,EAAEA,KAAM;IAAAC,QAAA,EACzCA;EAAQ,CACoB,CAAC;AAEpC;AAEA,OAAO,SAASE,gBAAgBA,CAAA,EAAkB;EAChD,OAAOT,UAAU,CAACI,oBAAoB,CAAC;AACzC;;AAEA;AACA;AACA;AACA;AACA,IAAIM,mBAAqD;AAEzD,OAAO,SAASC,6BAA6BA,CAC3CC,QAA0C,EAC1C;EACAF,mBAAmB,GAAGE,QAAQ;AAChC;AAEA,OAAO,SAASC,kBAAkBA,CAChCC,KAAc,EACdC,OAA4B,EAC5B;EACA,IAAIL,mBAAmB,EAAE;IACvB,IAAI;MACFA,mBAAmB,CAACI,KAAK,EAAEC,OAAO,CAAC;IACrC,CAAC,CAAC,OAAOC,WAAW,EAAE;MACpB;MACAC,OAAO,CAACH,KAAK,CAAC,kCAAkC,EAAEE,WAAW,CAAC;IAChE;EACF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComnyxSupport"],"sourceRoot":"../../../src","sources":["support/index.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,oBAAiB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["ComnyxSupport","ComnyxErrorBoundary"],"sourceRoot":"../../../src","sources":["support/index.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,oBAAiB;AAW/C,SAASC,mBAAmB,QAAQ,sCAAmC","ignoreList":[]}
|
|
@@ -19,7 +19,12 @@ export const lightTheme = {
|
|
|
19
19
|
ghost: '#EFEFEF',
|
|
20
20
|
navy: '#191A21',
|
|
21
21
|
lavender: '#E0E0E0',
|
|
22
|
-
silver: '#C7C7C7'
|
|
22
|
+
silver: '#C7C7C7',
|
|
23
|
+
link: '#0066CC',
|
|
24
|
+
toastBackground: '#333333',
|
|
25
|
+
toastText: '#FFFFFF',
|
|
26
|
+
playIcon: '#FFFFFF',
|
|
27
|
+
videoPlaceholder: '#1A1A2E'
|
|
23
28
|
};
|
|
24
29
|
export const darkTheme = {
|
|
25
30
|
primary: '#4361EE',
|
|
@@ -40,6 +45,29 @@ export const darkTheme = {
|
|
|
40
45
|
ghost: '#202129',
|
|
41
46
|
navy: '#F5F5F5',
|
|
42
47
|
lavender: '#262730',
|
|
43
|
-
silver: '#44454D'
|
|
48
|
+
silver: '#44454D',
|
|
49
|
+
link: '#4D9FFF',
|
|
50
|
+
toastBackground: '#2A2A2A',
|
|
51
|
+
toastText: '#FFFFFF',
|
|
52
|
+
playIcon: '#FFFFFF',
|
|
53
|
+
videoPlaceholder: '#1A1A2E'
|
|
44
54
|
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Partial override for a single theme mode. Consumers can change one or more
|
|
58
|
+
* tokens without redeclaring the whole palette.
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Full override map accepted by `ComnyxSupport.themeOverride`. Any token not
|
|
63
|
+
* provided falls back to the built-in light/dark palette.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* <ComnyxSupport
|
|
67
|
+
* themeOverride={{
|
|
68
|
+
* light: { primary: '#FF6B6B', link: '#FF9999' },
|
|
69
|
+
* dark: { primary: '#FF9999' },
|
|
70
|
+
* }}
|
|
71
|
+
* />
|
|
72
|
+
*/
|
|
45
73
|
//# sourceMappingURL=Theme.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["lightTheme","primary","secondary","background","light_text","text","error","success","green","light_green","warning","info","border","dark_background","gainsboro","slate","ghost","navy","lavender","silver","darkTheme"],"sourceRoot":"../../../src","sources":["types/Theme.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["lightTheme","primary","secondary","background","light_text","text","error","success","green","light_green","warning","info","border","dark_background","gainsboro","slate","ghost","navy","lavender","silver","link","toastBackground","toastText","playIcon","videoPlaceholder","darkTheme"],"sourceRoot":"../../../src","sources":["types/Theme.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AS,EAAE,SAAS;EACpBC,QAAQ,EAAE,SAAS;EACnBC,gBAAgB,EAAE;AACpB,CAAC;;AAOD;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
package/lib/module/version.js
CHANGED
|
@@ -5,5 +5,14 @@ export declare function pickVideo(): Promise<MediaAsset[]>;
|
|
|
5
5
|
export declare function openVideo(uri: string): Promise<void>;
|
|
6
6
|
export declare function generateThumbnail(videoUrl: string): Promise<string | null>;
|
|
7
7
|
export declare function deleteTempFile(uri: string): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Android only. Converts a local file URI returned by the picker into a
|
|
10
|
+
* `content://` URI served by the Comnyx FileProvider, suitable for crossing
|
|
11
|
+
* process boundaries (e.g. sharing to another app, system ACTION_VIEW).
|
|
12
|
+
*
|
|
13
|
+
* On iOS, returns the input URI unchanged since iOS does not have the
|
|
14
|
+
* FileUriExposedException problem.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getShareableUri(fileUri: string): Promise<string>;
|
|
8
17
|
export declare function cleanupTempFiles(): Promise<void>;
|
|
9
18
|
//# sourceMappingURL=NativeComnyxMediaPicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeComnyxMediaPicker.d.ts","sourceRoot":"","sources":["../../../src/NativeComnyxMediaPicker.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAwBrD,wBAAsB,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAOvD;AAED,wBAAsB,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAOvD;AAED,wBAAsB,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAOvD;AAED,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAM1D;AAED,wBAAsB,iBAAiB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