@convep_mobilogy/react-native-qms-plugin 0.9.4 → 0.10.2

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.
Files changed (22) hide show
  1. package/android/build.gradle +1 -1
  2. package/ios/QmsPlugin/QmsDashboardViewManager.mm +72 -1
  3. package/ios/QmsPlugin/UIViewController+QmsAnalytics.m +81 -0
  4. package/ios/QmsPluginFramework.xcframework/Info.plist +5 -5
  5. package/ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/Assets.car +0 -0
  6. package/ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/QmsPluginFramework +0 -0
  7. package/ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/_CodeSignature/CodeResources +2 -2
  8. package/ios/QmsPluginFramework.xcframework/ios-arm64_x86_64-simulator/QmsPluginFramework.framework/Assets.car +0 -0
  9. package/ios/QmsPluginFramework.xcframework/ios-arm64_x86_64-simulator/QmsPluginFramework.framework/QmsPluginFramework +0 -0
  10. package/ios/QmsPluginFramework.xcframework/ios-arm64_x86_64-simulator/QmsPluginFramework.framework/_CodeSignature/CodeResources +2 -2
  11. package/lib/module/QmsDashboardView.android.js +62 -4
  12. package/lib/module/QmsDashboardView.android.js.map +1 -1
  13. package/lib/module/QmsDashboardView.ios.js +23 -5
  14. package/lib/module/QmsDashboardView.ios.js.map +1 -1
  15. package/lib/typescript/src/QmsDashboardView.android.d.ts.map +1 -1
  16. package/lib/typescript/src/QmsDashboardView.ios.d.ts.map +1 -1
  17. package/lib/typescript/src/QmsDashboardView.types.d.ts +10 -0
  18. package/lib/typescript/src/QmsDashboardView.types.d.ts.map +1 -1
  19. package/package.json +1 -1
  20. package/src/QmsDashboardView.android.tsx +111 -3
  21. package/src/QmsDashboardView.ios.tsx +36 -4
  22. package/src/QmsDashboardView.types.ts +13 -0
@@ -75,7 +75,7 @@ dependencies {
75
75
  implementation "com.facebook.react:react-android"
76
76
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
77
77
  implementation 'com.facebook.react:react-native:+'
78
- implementation "com.convep.qms:qms-plugin:1.11.7"
78
+ implementation "com.convep.qms:qms-plugin:1.12.1"
79
79
 
80
80
  implementation 'androidx.appcompat:appcompat:1.6.1'
81
81
 
@@ -10,8 +10,14 @@
10
10
  @property (nonatomic, copy) NSString *ClientID;
11
11
  @property (nonatomic, copy) NSString *ClientCode;
12
12
  @property (nonatomic, copy) NSString *user_token;
13
+ @property (nonatomic, copy) NSString *headerTextColor;
14
+ @property (nonatomic, copy) NSString *headerIconColor;
15
+ @property (nonatomic, copy) NSString *accentColor;
16
+ @property (nonatomic, copy) NSString *fontFamily;
13
17
 
14
18
  @property (nonatomic, copy) RCTDirectEventBlock onClose;
19
+ @property (nonatomic, copy) RCTDirectEventBlock onAnalyticsScreen;
20
+ @property (nonatomic, copy) RCTDirectEventBlock onAnalyticsEvent;
15
21
  @end
16
22
 
17
23
  @implementation QmsDashboardView
@@ -27,6 +33,14 @@
27
33
  selector:@selector(handleDashboardClose:)
28
34
  name:@"QmsDashboardDidCloseNotification"
29
35
  object:nil];
36
+ [[NSNotificationCenter defaultCenter] addObserver:self
37
+ selector:@selector(handleAnalyticsScreen:)
38
+ name:@"QmsAnalyticsScreenNotification"
39
+ object:nil];
40
+ [[NSNotificationCenter defaultCenter] addObserver:self
41
+ selector:@selector(handleAnalyticsEvent:)
42
+ name:@"QmsAnalyticsEventNotification"
43
+ object:nil];
30
44
  }
31
45
  return self;
32
46
  }
@@ -63,6 +77,18 @@
63
77
  [self cleanupDashboard];
64
78
  }
65
79
 
80
+ - (void)handleAnalyticsScreen:(NSNotification *)note {
81
+ if (self.onAnalyticsScreen) {
82
+ self.onAnalyticsScreen(note.userInfo ?: @{});
83
+ }
84
+ }
85
+
86
+ - (void)handleAnalyticsEvent:(NSNotification *)note {
87
+ if (self.onAnalyticsEvent) {
88
+ self.onAnalyticsEvent(note.userInfo ?: @{});
89
+ }
90
+ }
91
+
66
92
  - (void)cleanupDashboard {
67
93
  if (!_dashboardVC) return;
68
94
 
@@ -90,6 +116,25 @@
90
116
  [self forwardProp:@"user_token" value:_user_token];
91
117
  }
92
118
 
119
+ - (void)setHeaderTextColor:(NSString *)headerTextColor {
120
+ _headerTextColor = [headerTextColor copy];
121
+ [self forwardProp:@"headerTextColor" value:_headerTextColor];
122
+ }
123
+
124
+ - (void)setHeaderIconColor:(NSString *)headerIconColor {
125
+ _headerIconColor = [headerIconColor copy];
126
+ [self forwardProp:@"headerIconColor" value:_headerIconColor];
127
+ }
128
+
129
+ - (void)setAccentColor:(NSString *)accentColor {
130
+ _accentColor = [accentColor copy];
131
+ [self forwardProp:@"accentColor" value:_accentColor];
132
+ }
133
+
134
+ - (void)setFontFamily:(NSString *)fontFamily {
135
+ _fontFamily = [fontFamily copy];
136
+ [self forwardProp:@"fontFamily" value:_fontFamily];
137
+ }
93
138
  #pragma mark - Forward Props via KVC
94
139
  - (void)forwardProp:(NSString *)key value:(NSString *)value {
95
140
  if (_dashboardVC && [_dashboardVC respondsToSelector:NSSelectorFromString(key)]) {
@@ -105,6 +150,10 @@
105
150
  [self forwardProp:@"ClientID" value:_ClientID];
106
151
  [self forwardProp:@"ClientCode" value:_ClientCode];
107
152
  [self forwardProp:@"user_token" value:_user_token];
153
+ [self forwardProp:@"headerTextColor" value:_headerTextColor];
154
+ [self forwardProp:@"headerIconColor" value:_headerIconColor];
155
+ [self forwardProp:@"accentColor" value:_accentColor];
156
+ [self forwardProp:@"fontFamily" value:_fontFamily];
108
157
  }
109
158
 
110
159
  - (void)removeFromSuperview {
@@ -129,6 +178,12 @@ RCT_EXPORT_MODULE(QmsDashboardView)
129
178
  RCT_EXPORT_VIEW_PROPERTY(ClientID, NSString)
130
179
  RCT_EXPORT_VIEW_PROPERTY(ClientCode, NSString)
131
180
  RCT_EXPORT_VIEW_PROPERTY(user_token, NSString)
181
+ RCT_EXPORT_VIEW_PROPERTY(headerTextColor, NSString)
182
+ RCT_EXPORT_VIEW_PROPERTY(headerIconColor, NSString)
183
+ RCT_EXPORT_VIEW_PROPERTY(accentColor, NSString)
184
+ RCT_EXPORT_VIEW_PROPERTY(fontFamily, NSString)
185
+ RCT_EXPORT_VIEW_PROPERTY(onAnalyticsScreen, RCTDirectEventBlock)
186
+ RCT_EXPORT_VIEW_PROPERTY(onAnalyticsEvent, RCTDirectEventBlock)
132
187
 
133
188
  @end
134
189
 
@@ -158,12 +213,20 @@ RCT_EXPORT_MODULE();
158
213
  selector:@selector(handleDashboardClose:)
159
214
  name:@"QmsDashboardDidCloseNotification"
160
215
  object:nil];
216
+ [[NSNotificationCenter defaultCenter] addObserver:self
217
+ selector:@selector(handleAnalyticsScreen:)
218
+ name:@"QmsAnalyticsScreenNotification"
219
+ object:nil];
220
+ [[NSNotificationCenter defaultCenter] addObserver:self
221
+ selector:@selector(handleAnalyticsEvent:)
222
+ name:@"QmsAnalyticsEventNotification"
223
+ object:nil];
161
224
  }
162
225
  return self;
163
226
  }
164
227
 
165
228
  - (NSArray<NSString *> *)supportedEvents {
166
- return @[@"onClose"];
229
+ return @[@"onClose", @"onAnalyticsScreen", @"onAnalyticsEvent"];
167
230
  }
168
231
 
169
232
  - (void)handleDashboardClose:(NSNotification *)note {
@@ -171,6 +234,14 @@ RCT_EXPORT_MODULE();
171
234
  [self sendEventWithName:@"onClose" body:note.userInfo];
172
235
  }
173
236
 
237
+ - (void)handleAnalyticsScreen:(NSNotification *)note {
238
+ [self sendEventWithName:@"onAnalyticsScreen" body:note.userInfo];
239
+ }
240
+
241
+ - (void)handleAnalyticsEvent:(NSNotification *)note {
242
+ [self sendEventWithName:@"onAnalyticsEvent" body:note.userInfo];
243
+ }
244
+
174
245
  - (void)dealloc {
175
246
  [[NSNotificationCenter defaultCenter] removeObserver:self];
176
247
  }
@@ -0,0 +1,81 @@
1
+ #import <Foundation/Foundation.h>
2
+ #import <UIKit/UIKit.h>
3
+ #import <objc/runtime.h>
4
+
5
+ static NSString * const QmsAnalyticsScreenNotification = @"QmsAnalyticsScreenNotification";
6
+ static NSString * const QmsAnalyticsEventNotification = @"QmsAnalyticsEventNotification";
7
+
8
+ @interface UIViewController (QmsAnalytics)
9
+ @end
10
+
11
+ @implementation UIViewController (QmsAnalytics)
12
+
13
+ + (void)load {
14
+ static dispatch_once_t onceToken;
15
+ dispatch_once(&onceToken, ^{
16
+ Class class = [self class];
17
+ SEL originalSelector = @selector(viewDidAppear:);
18
+ SEL swizzledSelector = @selector(qms_viewDidAppear:);
19
+
20
+ Method originalMethod = class_getInstanceMethod(class, originalSelector);
21
+ Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
22
+
23
+ BOOL didAddMethod =
24
+ class_addMethod(class,
25
+ originalSelector,
26
+ method_getImplementation(swizzledMethod),
27
+ method_getTypeEncoding(swizzledMethod));
28
+ if (didAddMethod) {
29
+ class_replaceMethod(class,
30
+ swizzledSelector,
31
+ method_getImplementation(originalMethod),
32
+ method_getTypeEncoding(originalMethod));
33
+ } else {
34
+ method_exchangeImplementations(originalMethod, swizzledMethod);
35
+ }
36
+ });
37
+ }
38
+
39
+ - (void)qms_viewDidAppear:(BOOL)animated {
40
+ [self qms_viewDidAppear:animated];
41
+
42
+ if (![self qms_shouldTrackAnalytics]) {
43
+ return;
44
+ }
45
+
46
+ NSString *screenName = NSStringFromClass([self class]);
47
+ NSString *screenClass = screenName;
48
+
49
+ NSDictionary *screenInfo = @{
50
+ @"screenName": screenName ?: @"",
51
+ @"screenClass": screenClass ?: @""
52
+ };
53
+ [[NSNotificationCenter defaultCenter] postNotificationName:QmsAnalyticsScreenNotification
54
+ object:nil
55
+ userInfo:screenInfo];
56
+
57
+ NSDictionary *eventParams = @{
58
+ @"currentPage": screenName ?: @"",
59
+ @"subCategory": @"Initial"
60
+ };
61
+ NSDictionary *eventInfo = @{
62
+ @"eventName": @"ScreenAt",
63
+ @"params": eventParams
64
+ };
65
+ [[NSNotificationCenter defaultCenter] postNotificationName:QmsAnalyticsEventNotification
66
+ object:nil
67
+ userInfo:eventInfo];
68
+ }
69
+
70
+ - (BOOL)qms_shouldTrackAnalytics {
71
+ NSBundle *bundle = [NSBundle bundleForClass:[self class]];
72
+ NSString *bundleId = bundle.bundleIdentifier ?: @"";
73
+ NSString *bundlePath = bundle.bundlePath ?: @"";
74
+ if ([bundleId containsString:@"QmsPluginFramework"] ||
75
+ [bundlePath containsString:@"QmsPluginFramework.framework"]) {
76
+ return YES;
77
+ }
78
+ return NO;
79
+ }
80
+
81
+ @end
@@ -8,32 +8,32 @@
8
8
  <key>BinaryPath</key>
9
9
  <string>QmsPluginFramework.framework/QmsPluginFramework</string>
10
10
  <key>LibraryIdentifier</key>
11
- <string>ios-arm64</string>
11
+ <string>ios-arm64_x86_64-simulator</string>
12
12
  <key>LibraryPath</key>
13
13
  <string>QmsPluginFramework.framework</string>
14
14
  <key>SupportedArchitectures</key>
15
15
  <array>
16
16
  <string>arm64</string>
17
+ <string>x86_64</string>
17
18
  </array>
18
19
  <key>SupportedPlatform</key>
19
20
  <string>ios</string>
21
+ <key>SupportedPlatformVariant</key>
22
+ <string>simulator</string>
20
23
  </dict>
21
24
  <dict>
22
25
  <key>BinaryPath</key>
23
26
  <string>QmsPluginFramework.framework/QmsPluginFramework</string>
24
27
  <key>LibraryIdentifier</key>
25
- <string>ios-arm64_x86_64-simulator</string>
28
+ <string>ios-arm64</string>
26
29
  <key>LibraryPath</key>
27
30
  <string>QmsPluginFramework.framework</string>
28
31
  <key>SupportedArchitectures</key>
29
32
  <array>
30
33
  <string>arm64</string>
31
- <string>x86_64</string>
32
34
  </array>
33
35
  <key>SupportedPlatform</key>
34
36
  <string>ios</string>
35
- <key>SupportedPlatformVariant</key>
36
- <string>simulator</string>
37
37
  </dict>
38
38
  </array>
39
39
  <key>CFBundlePackageType</key>
@@ -6,7 +6,7 @@
6
6
  <dict>
7
7
  <key>Assets.car</key>
8
8
  <data>
9
- MjrQTJ/Pj/FV95FoHaSNuTrq9xA=
9
+ 1i2tuf6x04oClRQdI25h80iAWww=
10
10
  </data>
11
11
  <key>Headers/QmsPlugin.h</key>
12
12
  <data>
@@ -31,7 +31,7 @@
31
31
  <dict>
32
32
  <key>hash2</key>
33
33
  <data>
34
- v29scRUPGBT5tlsITnQbh7t+nJC3WkaqCESMQxlW8GE=
34
+ 1mZEAflZoNOaTXIhGRR7gPGBZ99fx2jFZ147Fkro4WM=
35
35
  </data>
36
36
  </dict>
37
37
  <key>Headers/QmsPlugin.h</key>
@@ -6,7 +6,7 @@
6
6
  <dict>
7
7
  <key>Assets.car</key>
8
8
  <data>
9
- MjrQTJ/Pj/FV95FoHaSNuTrq9xA=
9
+ 1i2tuf6x04oClRQdI25h80iAWww=
10
10
  </data>
11
11
  <key>Headers/QmsPlugin.h</key>
12
12
  <data>
@@ -31,7 +31,7 @@
31
31
  <dict>
32
32
  <key>hash2</key>
33
33
  <data>
34
- v29scRUPGBT5tlsITnQbh7t+nJC3WkaqCESMQxlW8GE=
34
+ 1mZEAflZoNOaTXIhGRR7gPGBZ99fx2jFZ147Fkro4WM=
35
35
  </data>
36
36
  </dict>
37
37
  <key>Headers/QmsPlugin.h</key>
@@ -9,6 +9,9 @@ const {
9
9
  export const QmsDashboardView = ({
10
10
  style,
11
11
  onClose,
12
+ onLogout,
13
+ onAnalyticsScreen,
14
+ onAnalyticsEvent,
12
15
  clientID,
13
16
  clientCode,
14
17
  ClientID,
@@ -17,30 +20,85 @@ export const QmsDashboardView = ({
17
20
  token,
18
21
  userToken,
19
22
  autoShow = true,
20
- themeColor
23
+ themeColor,
24
+ headerThemeColor,
25
+ headerTextColor,
26
+ headerIconColor,
27
+ accentColor,
28
+ fontFamily,
29
+ isOrigin = false,
30
+ payload
21
31
  }) => {
22
32
  useEffect(() => {
23
33
  const resolvedClientID = clientID ?? ClientID ?? '';
24
34
  const resolvedClientCode = clientCode ?? ClientCode ?? '';
25
35
  const resolvedToken = user_token ?? token ?? userToken ?? '';
36
+ const hasPayload = payload != null && Object.keys(payload).length > 0;
26
37
  if (autoShow && QmsModule?.showQms) {
27
38
  if (themeColor && QmsModule?.setPrimaryColor) {
28
39
  QmsModule.setPrimaryColor(themeColor);
29
40
  }
41
+ const resolvedHeaderColor = headerThemeColor ?? headerTextColor;
42
+ if (resolvedHeaderColor && QmsModule?.setHeaderTextColor) {
43
+ QmsModule.setHeaderTextColor(resolvedHeaderColor);
44
+ }
45
+ const resolvedHeaderIconColor = headerThemeColor ?? headerIconColor;
46
+ if (resolvedHeaderIconColor && QmsModule?.setHeaderIconColor) {
47
+ QmsModule.setHeaderIconColor(resolvedHeaderIconColor);
48
+ }
49
+ if (accentColor && QmsModule?.setAccentColor) {
50
+ QmsModule.setAccentColor(accentColor);
51
+ }
52
+ if (QmsModule?.setFontFamily) {
53
+ QmsModule.setFontFamily(fontFamily ?? '');
54
+ }
30
55
  // map props to native method args
31
- QmsModule.showQms(resolvedToken, resolvedClientID, resolvedClientCode);
56
+ if (hasPayload && QmsModule?.showQmsWithPayload) {
57
+ QmsModule.showQmsWithPayload(resolvedToken, resolvedClientID, resolvedClientCode, isOrigin, payload);
58
+ } else {
59
+ QmsModule.showQms(resolvedToken, resolvedClientID, resolvedClientCode, isOrigin);
60
+ }
32
61
  }
33
- }, [clientID, clientCode, ClientID, ClientCode, user_token, token, userToken, autoShow, themeColor]);
62
+ }, [clientID, clientCode, ClientID, ClientCode, user_token, token, userToken, autoShow, themeColor, headerThemeColor, headerTextColor, headerIconColor, accentColor, fontFamily, isOrigin, payload]);
34
63
  useEffect(() => {
35
64
  if (themeColor && QmsModule?.setPrimaryColor) {
36
65
  QmsModule.setPrimaryColor(themeColor);
37
66
  }
38
- }, [themeColor]);
67
+ const resolvedHeaderColor = headerThemeColor ?? headerTextColor;
68
+ if (resolvedHeaderColor && QmsModule?.setHeaderTextColor) {
69
+ QmsModule.setHeaderTextColor(resolvedHeaderColor);
70
+ }
71
+ const resolvedHeaderIconColor = headerThemeColor ?? headerIconColor;
72
+ if (resolvedHeaderIconColor && QmsModule?.setHeaderIconColor) {
73
+ QmsModule.setHeaderIconColor(resolvedHeaderIconColor);
74
+ }
75
+ if (accentColor && QmsModule?.setAccentColor) {
76
+ QmsModule.setAccentColor(accentColor);
77
+ }
78
+ if (QmsModule?.setFontFamily) {
79
+ QmsModule.setFontFamily(fontFamily ?? '');
80
+ }
81
+ }, [themeColor, headerThemeColor, headerTextColor, headerIconColor, accentColor, fontFamily]);
39
82
  useEffect(() => {
40
83
  if (!onClose) return;
41
84
  const subscription = DeviceEventEmitter.addListener('QmsSdkOnClose', () => onClose());
42
85
  return () => subscription.remove();
43
86
  }, [onClose]);
87
+ useEffect(() => {
88
+ if (!onLogout) return;
89
+ const subscription = DeviceEventEmitter.addListener('QmsSdkOnLogout', () => onLogout());
90
+ return () => subscription.remove();
91
+ }, [onLogout]);
92
+ useEffect(() => {
93
+ if (!onAnalyticsScreen) return;
94
+ const subscription = DeviceEventEmitter.addListener('QmsSdkOnAnalyticsScreen', event => onAnalyticsScreen(event?.screenName, event?.screenClass));
95
+ return () => subscription.remove();
96
+ }, [onAnalyticsScreen]);
97
+ useEffect(() => {
98
+ if (!onAnalyticsEvent) return;
99
+ const subscription = DeviceEventEmitter.addListener('QmsSdkOnAnalyticsEvent', event => onAnalyticsEvent(event?.eventName, event?.params ?? null));
100
+ return () => subscription.remove();
101
+ }, [onAnalyticsEvent]);
44
102
 
45
103
  // Android doesn’t need to show native UI as a "view" here,
46
104
  // we just render an empty container so JSX stays consistent.
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEffect","DeviceEventEmitter","NativeModules","View","jsx","_jsx","QmsModule","QmsDashboardView","style","onClose","clientID","clientCode","ClientID","ClientCode","user_token","token","userToken","autoShow","themeColor","resolvedClientID","resolvedClientCode","resolvedToken","showQms","setPrimaryColor","subscription","addListener","remove"],"sourceRoot":"../../src","sources":["QmsDashboardView.android.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,kBAAkB,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hB,OAAO,CAAC,CACV,CAAC;IACD,OAAO,MAAMe,YAAY,CAACE,MAAM,CAAC,CAAC;EACpC,CAAC,EAAE,CAACjB,OAAO,CAAC,CAAC;;EAEb;EACA;EACA,oBAAOJ,IAAA,CAACF,IAAI;IAACK,KAAK,EAAEA;EAAM,CAAE,CAAC;AAC/B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useEffect","DeviceEventEmitter","NativeModules","View","jsx","_jsx","QmsModule","QmsDashboardView","style","onClose","onLogout","onAnalyticsScreen","onAnalyticsEvent","clientID","clientCode","ClientID","ClientCode","user_token","token","userToken","autoShow","themeColor","headerThemeColor","headerTextColor","headerIconColor","accentColor","fontFamily","isOrigin","payload","resolvedClientID","resolvedClientCode","resolvedToken","hasPayload","Object","keys","length","showQms","setPrimaryColor","resolvedHeaderColor","setHeaderTextColor","resolvedHeaderIconColor","setHeaderIconColor","setAccentColor","setFontFamily","showQmsWithPayload","subscription","addListener","remove","event","screenName","screenClass","eventName","params"],"sourceRoot":"../../src","sources":["QmsDashboardView.android.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,kBAAkB,EAAEC,aAAa,EAAEC,IAAI,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGvE,MAAM;EAAEC;AAAU,CAAC,GAAGJ,aAqBrB;AAED,OAAO,MAAMK,gBAAiD,GAAGA,CAAC;EAChEC,KAAK;EACLC,OAAO;EACPC,QAAQ;EACRC,iBAAiB;EACjBC,gBAAgB;EAChBC,QAAQ;EACRC,UAAU;EACVC,QAAQ;EACRC,UAAU;EACVC,UAAU;EACVC,KAAK;EACLC,SAAS;EACTC,QAAQ,GAAG,IAAI;EACfC,UAAU;EACVC,gBAAgB;EAChBC,eAAe;EACfC,eAAe;EACfC,WAAW;EACXC,UAAU;EACVC,QAAQ,GAAG,KAAK;EAChBC;AACF,CAAC,KAAK;EACJ5B,SAAS,CAAC,MAAM;IACd,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;IACD,OAAO,MAAMoC,YAAY,CAACE,MAAM,CAAC,CAAC;EACpC,CAAC,EAAE,CAACtC,OAAO,CAAC,CAAC;EAEbT,SAAS,CAAC,MAAM;IACd,IAAI,CAACU,QAAQ,EAAE;IACf,MAAMmC,YAAY,GAAG5C,kBAAkB,CAAC6C,WAAW,CAAC,gBAAgB,EAAE,MACpEpC,QAAQ,CAAC,CACX,CAAC;IACD,OAAO,MAAMmC,YAAY,CAACE,MAAM,CAAC,CAAC;EACpC,CAAC,EAAE,CAACrC,QAAQ,CAAC,CAAC;EAEdV,SAAS,CAAC,MAAM;IACd,IAAI,CAACW,iBAAiB,EAAE;IACxB,MAAMkC,YAAY,GAAG5C,kBAAkB,CAAC6C,WAAW,CACjD,yBAAyB,EACxBE,KAAqD,IACpDrC,iBAAiB,CAACqC,KAAK,EAAEC,UAAU,EAAED,KAAK,EAAEE,WAAW,CAC3D,CAAC;IACD,OAAO,MAAML,YAAY,CAACE,MAAM,CAAC,CAAC;EACpC,CAAC,EAAE,CAACpC,iBAAiB,CAAC,CAAC;EAEvBX,SAAS,CAAC,MAAM;IACd,IAAI,CAACY,gBAAgB,EAAE;IACvB,MAAMiC,YAAY,GAAG5C,kBAAkB,CAAC6C,WAAW,CACjD,wBAAwB,EACvBE,KAAgE,IAC/DpC,gBAAgB,CAACoC,KAAK,EAAEG,SAAS,EAAEH,KAAK,EAAEI,MAAM,IAAI,IAAI,CAC5D,CAAC;IACD,OAAO,MAAMP,YAAY,CAACE,MAAM,CAAC,CAAC;EACpC,CAAC,EAAE,CAACnC,gBAAgB,CAAC,CAAC;;EAEtB;EACA;EACA,oBAAOP,IAAA,CAACF,IAAI;IAACK,KAAK,EAAEA;EAAM,CAAE,CAAC;AAC/B,CAAC","ignoreList":[]}
@@ -8,6 +8,9 @@ const NativeQmsDashboardView = requireNativeComponent('QmsDashboardView');
8
8
  export const QmsDashboardView = props => {
9
9
  const {
10
10
  onClose,
11
+ onAnalyticsScreen,
12
+ onAnalyticsEvent,
13
+ // onLogout,
11
14
  clientID,
12
15
  clientCode,
13
16
  ClientID,
@@ -15,25 +18,40 @@ export const QmsDashboardView = props => {
15
18
  user_token,
16
19
  userToken,
17
20
  token,
21
+ // isOrigin,
18
22
  // autoShow is Android-only; ignored on iOS
23
+ headerThemeColor,
24
+ headerTextColor,
25
+ headerIconColor,
19
26
  ...rest
20
27
  } = props;
21
28
  const resolvedClientID = clientID ?? ClientID ?? '';
22
29
  const resolvedClientCode = clientCode ?? ClientCode ?? '';
23
30
  const resolvedToken = user_token ?? token ?? userToken ?? '';
24
31
  useEffect(() => {
25
- if (!onClose) return;
32
+ if (!onClose && !onAnalyticsScreen && !onAnalyticsEvent) return;
26
33
  const nativeEmitterModule = NativeModules.QmsDashboardEmitter;
27
34
  if (!nativeEmitterModule) return;
28
35
  const emitter = new NativeEventEmitter(nativeEmitterModule);
29
- const subscription = emitter.addListener('onClose', onClose);
30
- return () => subscription.remove();
31
- }, [onClose]);
36
+ const subscriptions = [];
37
+ if (onClose) {
38
+ subscriptions.push(emitter.addListener('onClose', onClose));
39
+ }
40
+ if (onAnalyticsScreen) {
41
+ subscriptions.push(emitter.addListener('onAnalyticsScreen', payload => onAnalyticsScreen(payload?.screenName, payload?.screenClass)));
42
+ }
43
+ if (onAnalyticsEvent) {
44
+ subscriptions.push(emitter.addListener('onAnalyticsEvent', payload => onAnalyticsEvent(payload?.eventName, payload?.params ?? null)));
45
+ }
46
+ return () => subscriptions.forEach(sub => sub.remove());
47
+ }, [onClose, onAnalyticsScreen, onAnalyticsEvent]);
32
48
  return /*#__PURE__*/_jsx(NativeQmsDashboardView, {
33
49
  ...rest,
34
50
  ClientID: resolvedClientID,
35
51
  ClientCode: resolvedClientCode,
36
- user_token: resolvedToken
52
+ user_token: resolvedToken,
53
+ headerTextColor: headerThemeColor ?? headerTextColor,
54
+ headerIconColor: headerThemeColor ?? headerIconColor
37
55
  });
38
56
  };
39
57
  //# sourceMappingURL=QmsDashboardView.ios.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEffect","NativeEventEmitter","NativeModules","requireNativeComponent","jsx","_jsx","NativeQmsDashboardView","QmsDashboardView","props","onClose","clientID","clientCode","ClientID","ClientCode","user_token","userToken","token","rest","resolvedClientID","resolvedClientCode","resolvedToken","nativeEmitterModule","QmsDashboardEmitter","emitter","subscription","addListener","remove"],"sourceRoot":"../../src","sources":["QmsDashboardView.ios.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SACEC,kBAAkB,EAClBC,aAAa,EACbC,sBAAsB,QACjB,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGtB;AACA,MAAMC,sBAAsB,GAC1BH,sBAAsB,CAAwB,kBAAkB,CAAC;AAEnE,OAAO,MAAMI,gBAAiD,GAAIC,KAAK,IAAK;EAC1E,MAAM;IACJC,OAAO;IACPC,QAAQ;IACRC,UAAU;IACVC,QAAQ;IACRC,UAAU;IACVC,UAAU;IACVC,SAAS;IACTC,KAAK;IACL;IACA,GAAGC;EACL,CAAC,GAAGT,KAAK;EAET,MAAMU,gBAAgB,GAAGR,QAAQ,IAAIE,QAAQ,IAAI,EAAE;EACnD,MAAMO,kBAAkB,GAAGR,UAAU,IAAIE,UAAU,IAAI,EAAE;EACzD,MAAMO,aAAa,GAAGN,UAAU,IAAIE,KAAK,IAAID,SAAS,IAAI,EAAE;EAE5Df,SAAS,CAAC,MAAM;IACd,IAAI,CAACS,OAAO,EAAE;IACd,MAAMY,mBAAmB,GAAGnB,aAAa,CAACoB,mBAAmB;IAC7D,IAAI,CAACD,mBAAmB,EAAE;IAC1B,MAAME,OAAO,GAAG,IAAItB,kBAAkB,CAACoB,mBAAmB,CAAC;IAC3D,MAAMG,YAAY,GAAGD,OAAO,CAACE,WAAW,CAAC,SAAS,EAAEhB,OAAO,CAAC;IAC5D,OAAO,MAAMe,YAAY,CAACE,MAAM,CAAC,CAAC;EACpC,CAAC,EAAE,CAACjB,OAAO,CAAC,CAAC;EAEb,oBACEJ,IAAA,CAACC,sBAAsB;IAAA,GACjBW,IAAI;IACRL,QAAQ,EAAEM,gBAAiB;IAC3BL,UAAU,EAAEM,kBAAmB;IAC/BL,UAAU,EAAEM;EAAc,CAC3B,CAAC;AAEN,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useEffect","NativeEventEmitter","NativeModules","requireNativeComponent","jsx","_jsx","NativeQmsDashboardView","QmsDashboardView","props","onClose","onAnalyticsScreen","onAnalyticsEvent","clientID","clientCode","ClientID","ClientCode","user_token","userToken","token","headerThemeColor","headerTextColor","headerIconColor","rest","resolvedClientID","resolvedClientCode","resolvedToken","nativeEmitterModule","QmsDashboardEmitter","emitter","subscriptions","push","addListener","payload","screenName","screenClass","eventName","params","forEach","sub","remove"],"sourceRoot":"../../src","sources":["QmsDashboardView.ios.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SACEC,kBAAkB,EAClBC,aAAa,EACbC,sBAAsB,QACjB,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGtB;AACA,MAAMC,sBAAsB,GAC1BH,sBAAsB,CAAwB,kBAAkB,CAAC;AAEnE,OAAO,MAAMI,gBAAiD,GAAIC,KAAK,IAAK;EAC1E,MAAM;IACJC,OAAO;IACPC,iBAAiB;IACjBC,gBAAgB;IAChB;IACAC,QAAQ;IACRC,UAAU;IACVC,QAAQ;IACRC,UAAU;IACVC,UAAU;IACVC,SAAS;IACTC,KAAK;IACL;IACA;IACAC,gBAAgB;IAChBC,eAAe;IACfC,eAAe;IACf,GAAGC;EACL,CAAC,GAAGd,KAAK;EAET,MAAMe,gBAAgB,GAAGX,QAAQ,IAAIE,QAAQ,IAAI,EAAE;EACnD,MAAMU,kBAAkB,GAAGX,UAAU,IAAIE,UAAU,IAAI,EAAE;EACzD,MAAMU,aAAa,GAAGT,UAAU,IAAIE,KAAK,IAAID,SAAS,IAAI,EAAE;EAE5DjB,SAAS,CAA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 @@
1
- {"version":3,"file":"QmsDashboardView.android.d.ts","sourceRoot":"","sources":["../../../src/QmsDashboardView.android.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAatE,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAsD5D,CAAC"}
1
+ {"version":3,"file":"QmsDashboardView.android.d.ts","sourceRoot":"","sources":["../../../src/QmsDashboardView.android.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAyBtE,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAsJ5D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"QmsDashboardView.ios.d.ts","sourceRoot":"","sources":["../../../src/QmsDashboardView.ios.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAMzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAMtE,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAmC5D,CAAC"}
1
+ {"version":3,"file":"QmsDashboardView.ios.d.ts","sourceRoot":"","sources":["../../../src/QmsDashboardView.ios.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAMzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAMtE,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAmE5D,CAAC"}
@@ -2,6 +2,9 @@ import type { StyleProp, ViewStyle } from 'react-native';
2
2
  export type QmsDashboardViewProps = {
3
3
  style?: StyleProp<ViewStyle>;
4
4
  onClose?: (event?: unknown) => void;
5
+ onLogout?: (event?: unknown) => void;
6
+ onAnalyticsScreen?: (screenName?: string, screenClass?: string) => void;
7
+ onAnalyticsEvent?: (eventName?: string, params?: Record<string, unknown> | null) => void;
5
8
  /**
6
9
  * Preferred camelCase props. Uppercase variants are kept for backwards compatibility
7
10
  * with the native iOS view manager prop names.
@@ -15,5 +18,12 @@ export type QmsDashboardViewProps = {
15
18
  token?: string;
16
19
  autoShow?: boolean;
17
20
  themeColor?: string;
21
+ headerThemeColor?: string;
22
+ headerTextColor?: string;
23
+ headerIconColor?: string;
24
+ accentColor?: string;
25
+ fontFamily?: string;
26
+ isOrigin?: boolean;
27
+ payload?: Record<string, unknown> | null;
18
28
  };
19
29
  //# sourceMappingURL=QmsDashboardView.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"QmsDashboardView.types.d.ts","sourceRoot":"","sources":["../../../src/QmsDashboardView.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACpC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC"}
1
+ {"version":3,"file":"QmsDashboardView.types.d.ts","sourceRoot":"","sources":["../../../src/QmsDashboardView.types.ts"],"names":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 -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@convep_mobilogy/react-native-qms-plugin",
3
- "version": "0.9.4",
3
+ "version": "0.10.2",
4
4
  "description": "To handle defect managment",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -7,15 +7,30 @@ const { QmsModule } = NativeModules as {
7
7
  showQms?: (
8
8
  userToken?: string,
9
9
  clientID?: string,
10
- clientCode?: string
10
+ clientCode?: string,
11
+ isOrigin?: boolean
12
+ ) => void;
13
+ showQmsWithPayload?: (
14
+ userToken?: string,
15
+ clientID?: string,
16
+ clientCode?: string,
17
+ isOrigin?: boolean,
18
+ payload?: Record<string, unknown> | null
11
19
  ) => void;
12
20
  setPrimaryColor?: (hexColor?: string) => void;
21
+ setHeaderTextColor?: (hexColor?: string) => void;
22
+ setHeaderIconColor?: (hexColor?: string) => void;
23
+ setAccentColor?: (hexColor?: string) => void;
24
+ setFontFamily?: (fontFamily?: string) => void;
13
25
  };
14
26
  };
15
27
 
16
28
  export const QmsDashboardView: React.FC<QmsDashboardViewProps> = ({
17
29
  style,
18
30
  onClose,
31
+ onLogout,
32
+ onAnalyticsScreen,
33
+ onAnalyticsEvent,
19
34
  clientID,
20
35
  clientCode,
21
36
  ClientID,
@@ -25,18 +40,55 @@ export const QmsDashboardView: React.FC<QmsDashboardViewProps> = ({
25
40
  userToken,
26
41
  autoShow = true,
27
42
  themeColor,
43
+ headerThemeColor,
44
+ headerTextColor,
45
+ headerIconColor,
46
+ accentColor,
47
+ fontFamily,
48
+ isOrigin = false,
49
+ payload,
28
50
  }) => {
29
51
  useEffect(() => {
30
52
  const resolvedClientID = clientID ?? ClientID ?? '';
31
53
  const resolvedClientCode = clientCode ?? ClientCode ?? '';
32
54
  const resolvedToken = user_token ?? token ?? userToken ?? '';
55
+ const hasPayload = payload != null && Object.keys(payload).length > 0;
33
56
 
34
57
  if (autoShow && QmsModule?.showQms) {
35
58
  if (themeColor && QmsModule?.setPrimaryColor) {
36
59
  QmsModule.setPrimaryColor(themeColor);
37
60
  }
61
+ const resolvedHeaderColor = headerThemeColor ?? headerTextColor;
62
+ if (resolvedHeaderColor && QmsModule?.setHeaderTextColor) {
63
+ QmsModule.setHeaderTextColor(resolvedHeaderColor);
64
+ }
65
+ const resolvedHeaderIconColor = headerThemeColor ?? headerIconColor;
66
+ if (resolvedHeaderIconColor && QmsModule?.setHeaderIconColor) {
67
+ QmsModule.setHeaderIconColor(resolvedHeaderIconColor);
68
+ }
69
+ if (accentColor && QmsModule?.setAccentColor) {
70
+ QmsModule.setAccentColor(accentColor);
71
+ }
72
+ if (QmsModule?.setFontFamily) {
73
+ QmsModule.setFontFamily(fontFamily ?? '');
74
+ }
38
75
  // map props to native method args
39
- QmsModule.showQms(resolvedToken, resolvedClientID, resolvedClientCode);
76
+ if (hasPayload && QmsModule?.showQmsWithPayload) {
77
+ QmsModule.showQmsWithPayload(
78
+ resolvedToken,
79
+ resolvedClientID,
80
+ resolvedClientCode,
81
+ isOrigin,
82
+ payload
83
+ );
84
+ } else {
85
+ QmsModule.showQms(
86
+ resolvedToken,
87
+ resolvedClientID,
88
+ resolvedClientCode,
89
+ isOrigin
90
+ );
91
+ }
40
92
  }
41
93
  }, [
42
94
  clientID,
@@ -48,13 +100,41 @@ export const QmsDashboardView: React.FC<QmsDashboardViewProps> = ({
48
100
  userToken,
49
101
  autoShow,
50
102
  themeColor,
103
+ headerThemeColor,
104
+ headerTextColor,
105
+ headerIconColor,
106
+ accentColor,
107
+ fontFamily,
108
+ isOrigin,
109
+ payload,
51
110
  ]);
52
111
 
53
112
  useEffect(() => {
54
113
  if (themeColor && QmsModule?.setPrimaryColor) {
55
114
  QmsModule.setPrimaryColor(themeColor);
56
115
  }
57
- }, [themeColor]);
116
+ const resolvedHeaderColor = headerThemeColor ?? headerTextColor;
117
+ if (resolvedHeaderColor && QmsModule?.setHeaderTextColor) {
118
+ QmsModule.setHeaderTextColor(resolvedHeaderColor);
119
+ }
120
+ const resolvedHeaderIconColor = headerThemeColor ?? headerIconColor;
121
+ if (resolvedHeaderIconColor && QmsModule?.setHeaderIconColor) {
122
+ QmsModule.setHeaderIconColor(resolvedHeaderIconColor);
123
+ }
124
+ if (accentColor && QmsModule?.setAccentColor) {
125
+ QmsModule.setAccentColor(accentColor);
126
+ }
127
+ if (QmsModule?.setFontFamily) {
128
+ QmsModule.setFontFamily(fontFamily ?? '');
129
+ }
130
+ }, [
131
+ themeColor,
132
+ headerThemeColor,
133
+ headerTextColor,
134
+ headerIconColor,
135
+ accentColor,
136
+ fontFamily,
137
+ ]);
58
138
 
59
139
  useEffect(() => {
60
140
  if (!onClose) return;
@@ -64,6 +144,34 @@ export const QmsDashboardView: React.FC<QmsDashboardViewProps> = ({
64
144
  return () => subscription.remove();
65
145
  }, [onClose]);
66
146
 
147
+ useEffect(() => {
148
+ if (!onLogout) return;
149
+ const subscription = DeviceEventEmitter.addListener('QmsSdkOnLogout', () =>
150
+ onLogout()
151
+ );
152
+ return () => subscription.remove();
153
+ }, [onLogout]);
154
+
155
+ useEffect(() => {
156
+ if (!onAnalyticsScreen) return;
157
+ const subscription = DeviceEventEmitter.addListener(
158
+ 'QmsSdkOnAnalyticsScreen',
159
+ (event?: { screenName?: string; screenClass?: string }) =>
160
+ onAnalyticsScreen(event?.screenName, event?.screenClass)
161
+ );
162
+ return () => subscription.remove();
163
+ }, [onAnalyticsScreen]);
164
+
165
+ useEffect(() => {
166
+ if (!onAnalyticsEvent) return;
167
+ const subscription = DeviceEventEmitter.addListener(
168
+ 'QmsSdkOnAnalyticsEvent',
169
+ (event?: { eventName?: string; params?: Record<string, unknown> }) =>
170
+ onAnalyticsEvent(event?.eventName, event?.params ?? null)
171
+ );
172
+ return () => subscription.remove();
173
+ }, [onAnalyticsEvent]);
174
+
67
175
  // Android doesn’t need to show native UI as a "view" here,
68
176
  // we just render an empty container so JSX stays consistent.
69
177
  return <View style={style} />;
@@ -13,6 +13,9 @@ const NativeQmsDashboardView =
13
13
  export const QmsDashboardView: React.FC<QmsDashboardViewProps> = (props) => {
14
14
  const {
15
15
  onClose,
16
+ onAnalyticsScreen,
17
+ onAnalyticsEvent,
18
+ // onLogout,
16
19
  clientID,
17
20
  clientCode,
18
21
  ClientID,
@@ -20,7 +23,11 @@ export const QmsDashboardView: React.FC<QmsDashboardViewProps> = (props) => {
20
23
  user_token,
21
24
  userToken,
22
25
  token,
26
+ // isOrigin,
23
27
  // autoShow is Android-only; ignored on iOS
28
+ headerThemeColor,
29
+ headerTextColor,
30
+ headerIconColor,
24
31
  ...rest
25
32
  } = props;
26
33
 
@@ -29,13 +36,36 @@ export const QmsDashboardView: React.FC<QmsDashboardViewProps> = (props) => {
29
36
  const resolvedToken = user_token ?? token ?? userToken ?? '';
30
37
 
31
38
  useEffect(() => {
32
- if (!onClose) return;
39
+ if (!onClose && !onAnalyticsScreen && !onAnalyticsEvent) return;
33
40
  const nativeEmitterModule = NativeModules.QmsDashboardEmitter;
34
41
  if (!nativeEmitterModule) return;
35
42
  const emitter = new NativeEventEmitter(nativeEmitterModule);
36
- const subscription = emitter.addListener('onClose', onClose);
37
- return () => subscription.remove();
38
- }, [onClose]);
43
+ const subscriptions: { remove: () => void }[] = [];
44
+ if (onClose) {
45
+ subscriptions.push(emitter.addListener('onClose', onClose));
46
+ }
47
+ if (onAnalyticsScreen) {
48
+ subscriptions.push(
49
+ emitter.addListener(
50
+ 'onAnalyticsScreen',
51
+ (payload?: { screenName?: string; screenClass?: string }) =>
52
+ onAnalyticsScreen(payload?.screenName, payload?.screenClass)
53
+ )
54
+ );
55
+ }
56
+ if (onAnalyticsEvent) {
57
+ subscriptions.push(
58
+ emitter.addListener(
59
+ 'onAnalyticsEvent',
60
+ (payload?: {
61
+ eventName?: string;
62
+ params?: Record<string, unknown>;
63
+ }) => onAnalyticsEvent(payload?.eventName, payload?.params ?? null)
64
+ )
65
+ );
66
+ }
67
+ return () => subscriptions.forEach((sub) => sub.remove());
68
+ }, [onClose, onAnalyticsScreen, onAnalyticsEvent]);
39
69
 
40
70
  return (
41
71
  <NativeQmsDashboardView
@@ -43,6 +73,8 @@ export const QmsDashboardView: React.FC<QmsDashboardViewProps> = (props) => {
43
73
  ClientID={resolvedClientID}
44
74
  ClientCode={resolvedClientCode}
45
75
  user_token={resolvedToken}
76
+ headerTextColor={headerThemeColor ?? headerTextColor}
77
+ headerIconColor={headerThemeColor ?? headerIconColor}
46
78
  />
47
79
  );
48
80
  };
@@ -3,6 +3,12 @@ import type { StyleProp, ViewStyle } from 'react-native';
3
3
  export type QmsDashboardViewProps = {
4
4
  style?: StyleProp<ViewStyle>;
5
5
  onClose?: (event?: unknown) => void;
6
+ onLogout?: (event?: unknown) => void;
7
+ onAnalyticsScreen?: (screenName?: string, screenClass?: string) => void;
8
+ onAnalyticsEvent?: (
9
+ eventName?: string,
10
+ params?: Record<string, unknown> | null
11
+ ) => void;
6
12
  /**
7
13
  * Preferred camelCase props. Uppercase variants are kept for backwards compatibility
8
14
  * with the native iOS view manager prop names.
@@ -16,4 +22,11 @@ export type QmsDashboardViewProps = {
16
22
  token?: string;
17
23
  autoShow?: boolean; // optional: Android uses this, iOS can ignore
18
24
  themeColor?: string;
25
+ headerThemeColor?: string;
26
+ headerTextColor?: string;
27
+ headerIconColor?: string;
28
+ accentColor?: string;
29
+ fontFamily?: string;
30
+ isOrigin?: boolean;
31
+ payload?: Record<string, unknown> | null;
19
32
  };