cuoral-ionic 0.0.7 → 0.0.9

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 (44) hide show
  1. package/CuoralIonic.podspec +17 -0
  2. package/README.md +22 -0
  3. package/android/build/.transforms/bb54161301273cf9b5b94a21c0fb3f23/transformed/classes/classes_dex/classes.dex +0 -0
  4. package/android/build/.transforms/f1aabffcd8b03aa664e77a79b3e1de5d/transformed/debug/debug_dex/com/cuoral/ionic/CuoralPlugin$4.dex +0 -0
  5. package/android/build/.transforms/f1aabffcd8b03aa664e77a79b3e1de5d/transformed/debug/debug_dex/com/cuoral/ionic/CuoralPlugin$5.dex +0 -0
  6. package/android/build/.transforms/f1aabffcd8b03aa664e77a79b3e1de5d/transformed/debug/debug_dex/com/cuoral/ionic/CuoralPlugin$6.dex +0 -0
  7. package/android/build/.transforms/f1aabffcd8b03aa664e77a79b3e1de5d/transformed/debug/debug_dex/com/cuoral/ionic/CuoralPlugin.dex +0 -0
  8. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  9. package/android/build/intermediates/javac/debug/classes/com/cuoral/ionic/CuoralPlugin$4.class +0 -0
  10. package/android/build/intermediates/javac/debug/classes/com/cuoral/ionic/CuoralPlugin$5.class +0 -0
  11. package/android/build/intermediates/javac/debug/classes/com/cuoral/ionic/CuoralPlugin$6.class +0 -0
  12. package/android/build/intermediates/javac/debug/classes/com/cuoral/ionic/CuoralPlugin.class +0 -0
  13. package/android/build/intermediates/runtime_library_classes_dir/debug/com/cuoral/ionic/CuoralPlugin$4.class +0 -0
  14. package/android/build/intermediates/runtime_library_classes_dir/debug/com/cuoral/ionic/CuoralPlugin$5.class +0 -0
  15. package/android/build/intermediates/runtime_library_classes_dir/debug/com/cuoral/ionic/CuoralPlugin$6.class +0 -0
  16. package/android/build/intermediates/runtime_library_classes_dir/debug/com/cuoral/ionic/CuoralPlugin.class +0 -0
  17. package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  18. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{CuoralPlugin$1.class.uniqueId1 → CuoralPlugin$1.class.uniqueId2} +0 -0
  19. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{CuoralPlugin$2.class.uniqueId2 → CuoralPlugin$2.class.uniqueId5} +0 -0
  20. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/CuoralPlugin$3.class.uniqueId3 +0 -0
  21. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/CuoralPlugin$4.class.uniqueId6 +0 -0
  22. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/CuoralPlugin$5.class.uniqueId4 +0 -0
  23. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/CuoralPlugin$6.class.uniqueId8 +0 -0
  24. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/CuoralPlugin$InitiateCallback.class.uniqueId0 +0 -0
  25. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/CuoralPlugin$UploadCallback.class.uniqueId7 +0 -0
  26. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/CuoralPlugin.class.uniqueId1 +0 -0
  27. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  28. package/android/src/main/java/com/cuoral/ionic/CuoralPlugin.java +38 -35
  29. package/dist/bridge.d.ts.map +1 -1
  30. package/dist/cuoral.d.ts.map +1 -1
  31. package/dist/cuoral.js +31 -6
  32. package/dist/index.esm.js +75 -43
  33. package/dist/index.esm.js.map +1 -1
  34. package/dist/index.js +75 -43
  35. package/dist/index.js.map +1 -1
  36. package/dist/plugin.d.ts +2 -2
  37. package/dist/plugin.d.ts.map +1 -1
  38. package/dist/plugin.js +43 -39
  39. package/ios/Plugin/CuoralPlugin.swift +3 -3
  40. package/package.json +3 -2
  41. package/src/bridge.ts +1 -0
  42. package/src/cuoral.ts +33 -6
  43. package/src/plugin.ts +43 -38
  44. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/CuoralPlugin.class.uniqueId0 +0 -0
package/src/plugin.ts CHANGED
@@ -70,7 +70,7 @@ export class CuoralRecorder {
70
70
  /**
71
71
  * Start recording with automatic permission handling
72
72
  */
73
- async startRecording(options?: RecordingOptions): Promise<boolean> {
73
+ async startRecording(options?: RecordingOptions, sendMessages: boolean = true): Promise<boolean> {
74
74
  try {
75
75
  // Check if already recording
76
76
  if (this.isRecording) {
@@ -97,20 +97,24 @@ export class CuoralRecorder {
97
97
  this.isRecording = true;
98
98
  this.recordingStartTime = Date.now();
99
99
 
100
- // Post message to widget
101
- this.postMessage({
102
- type: CuoralMessageType.RECORDING_STARTED,
103
- payload: { timestamp: this.recordingStartTime },
104
- });
100
+ // Post message to widget only if enabled (disabled when called from widget handler)
101
+ if (sendMessages) {
102
+ this.postMessage({
103
+ type: CuoralMessageType.RECORDING_STARTED,
104
+ payload: { timestamp: this.recordingStartTime },
105
+ });
106
+ }
105
107
  } else {
106
108
  // Recording failed - reset state and notify widget
107
109
  this.isRecording = false;
108
110
  this.recordingStartTime = undefined;
109
111
 
110
- this.postMessage({
111
- type: CuoralMessageType.RECORDING_ERROR,
112
- payload: { error: 'Failed to start recording' },
113
- });
112
+ if (sendMessages) {
113
+ this.postMessage({
114
+ type: CuoralMessageType.RECORDING_ERROR,
115
+ payload: { error: 'Failed to start recording' },
116
+ });
117
+ }
114
118
  }
115
119
 
116
120
  return result.success;
@@ -119,10 +123,12 @@ export class CuoralRecorder {
119
123
  this.isRecording = false;
120
124
  this.recordingStartTime = undefined;
121
125
 
122
- this.postMessage({
123
- type: CuoralMessageType.RECORDING_ERROR,
124
- payload: { error: (error as Error).message },
125
- });
126
+ if (sendMessages) {
127
+ this.postMessage({
128
+ type: CuoralMessageType.RECORDING_ERROR,
129
+ payload: { error: (error as Error).message },
130
+ });
131
+ }
126
132
  return false;
127
133
  }
128
134
  }
@@ -135,14 +141,16 @@ export class CuoralRecorder {
135
141
  sessionId?: string;
136
142
  publicKey?: string;
137
143
  customerId?: string;
138
- }): Promise<{ filePath?: string; duration?: number; uploaded?: boolean } | null> {
144
+ }, sendMessages: boolean = true): Promise<{ filePath?: string; duration?: number; uploaded?: boolean } | null> {
139
145
  try {
140
146
  if (!this.isRecording) {
141
147
  // Send error message to widget so it can exit "stopping" state
142
- this.postMessage({
143
- type: CuoralMessageType.RECORDING_ERROR,
144
- payload: { error: 'Not recording' },
145
- });
148
+ if (sendMessages) {
149
+ this.postMessage({
150
+ type: CuoralMessageType.RECORDING_ERROR,
151
+ payload: { error: 'Not recording' },
152
+ });
153
+ }
146
154
  return null;
147
155
  }
148
156
 
@@ -153,22 +161,15 @@ export class CuoralRecorder {
153
161
  ? Math.floor((Date.now() - this.recordingStartTime) / 1000)
154
162
  : 0;
155
163
 
156
- // If uploaded, notify widget differently
157
- if (result.uploaded) {
158
- this.postMessage({
159
- type: CuoralMessageType.RECORDING_UPLOADED,
160
- payload: {
161
- duration: result.duration || duration,
162
- uploaded: true
163
- },
164
- });
165
- } else {
166
- // Post message to widget (old behavior)
164
+ // Send RECORDING_STOPPED message only if enabled
165
+ if (sendMessages) {
167
166
  this.postMessage({
168
167
  type: CuoralMessageType.RECORDING_STOPPED,
169
168
  payload: {
170
169
  filePath: result.filePath,
171
170
  duration: result.duration || duration,
171
+ uploaded: result.uploaded,
172
+ uploadedToBackend: result.uploaded,
172
173
  },
173
174
  });
174
175
  }
@@ -181,17 +182,21 @@ export class CuoralRecorder {
181
182
  }
182
183
 
183
184
  // If result.success is false, send error to widget
184
- this.postMessage({
185
- type: CuoralMessageType.RECORDING_ERROR,
186
- payload: { error: 'Failed to stop recording' },
187
- });
185
+ if (sendMessages) {
186
+ this.postMessage({
187
+ type: CuoralMessageType.RECORDING_ERROR,
188
+ payload: { error: 'Failed to stop recording' },
189
+ });
190
+ }
188
191
  return null;
189
192
  } catch (error) {
190
193
  console.error('[Cuoral] Failed to stop recording:', error);
191
- this.postMessage({
192
- type: CuoralMessageType.RECORDING_ERROR,
193
- payload: { error: (error as Error).message },
194
- });
194
+ if (sendMessages) {
195
+ this.postMessage({
196
+ type: CuoralMessageType.RECORDING_ERROR,
197
+ payload: { error: (error as Error).message },
198
+ });
199
+ }
195
200
  return null;
196
201
  }
197
202
  }