react-native-srschat 0.1.58 → 0.1.60
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/lib/commonjs/components/input.js +33 -3
- package/lib/commonjs/components/input.js.map +1 -1
- package/lib/commonjs/components/productCard.js +26 -8
- package/lib/commonjs/components/productCard.js.map +1 -1
- package/lib/commonjs/components/testing.js +8 -35
- package/lib/commonjs/components/testing.js.map +1 -1
- package/lib/commonjs/components/voice.js +23 -3
- package/lib/commonjs/components/voice.js.map +1 -1
- package/lib/commonjs/components/welcomeInput.js +29 -2
- package/lib/commonjs/components/welcomeInput.js.map +1 -1
- package/lib/commonjs/layout/window.js +101 -93
- package/lib/commonjs/layout/window.js.map +1 -1
- package/lib/commonjs/utils/audioRecorder.js +129 -38
- package/lib/commonjs/utils/audioRecorder.js.map +1 -1
- package/lib/module/components/input.js +33 -3
- package/lib/module/components/input.js.map +1 -1
- package/lib/module/components/productCard.js +26 -8
- package/lib/module/components/productCard.js.map +1 -1
- package/lib/module/components/testing.js +9 -36
- package/lib/module/components/testing.js.map +1 -1
- package/lib/module/components/voice.js +23 -3
- package/lib/module/components/voice.js.map +1 -1
- package/lib/module/components/welcomeInput.js +29 -2
- package/lib/module/components/welcomeInput.js.map +1 -1
- package/lib/module/layout/window.js +101 -93
- package/lib/module/layout/window.js.map +1 -1
- package/lib/module/utils/audioRecorder.js +129 -38
- package/lib/module/utils/audioRecorder.js.map +1 -1
- package/lib/typescript/components/input.d.ts.map +1 -1
- package/lib/typescript/components/testing.d.ts.map +1 -1
- package/lib/typescript/components/voice.d.ts +3 -1
- package/lib/typescript/components/voice.d.ts.map +1 -1
- package/lib/typescript/components/welcomeInput.d.ts.map +1 -1
- package/lib/typescript/layout/window.d.ts.map +1 -1
- package/lib/typescript/utils/audioRecorder.d.ts +1 -1
- package/lib/typescript/utils/audioRecorder.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/input.js +30 -3
- package/src/components/productCard.js +19 -4
- package/src/components/testing.js +14 -45
- package/src/components/voice.js +33 -14
- package/src/components/welcomeInput.js +26 -1
- package/src/layout/window.js +16 -6
- package/src/utils/audioRecorder.js +131 -35
- package/lib/commonjs/components/testProductCard.js +0 -60
- package/lib/commonjs/components/testProductCard.js.map +0 -1
- package/lib/module/components/testProductCard.js +0 -52
- package/lib/module/components/testProductCard.js.map +0 -1
- package/lib/typescript/components/testProductCard.d.ts +0 -3
- package/lib/typescript/components/testProductCard.d.ts.map +0 -1
- package/src/components/testProductCard.js +0 -55
|
@@ -6,10 +6,13 @@ import { check, PERMISSIONS, request, RESULTS } from 'react-native-permissions';
|
|
|
6
6
|
import useAsyncStorage from '../hooks/useAsyncStorage';
|
|
7
7
|
|
|
8
8
|
let resultCallback = null;
|
|
9
|
+
let partialResultCallback = null;
|
|
9
10
|
let silenceTimer = null;
|
|
10
11
|
let isCurrentlyRecording = false;
|
|
11
12
|
let finalResult = '';
|
|
13
|
+
let lastPartialResultTime = 0;
|
|
12
14
|
const SILENCE_DURATION = 1500; // 1.5 seconds of silence before stopping
|
|
15
|
+
const PARTIAL_RESULT_THROTTLE = 100; // Throttle partial results to every 100ms
|
|
13
16
|
|
|
14
17
|
// Add this constant for AsyncStorage key
|
|
15
18
|
const PERMISSION_STORAGE_KEY = '@voice_permission_status';
|
|
@@ -25,9 +28,10 @@ export function setPermissionStatusHandlers(getter, setter) {
|
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
// Initialize Voice handlers
|
|
28
|
-
export async function initVoice(onResult) {
|
|
31
|
+
export async function initVoice(onResult, onPartialResult = null) {
|
|
29
32
|
try {
|
|
30
33
|
resultCallback = onResult;
|
|
34
|
+
partialResultCallback = onPartialResult;
|
|
31
35
|
finalResult = '';
|
|
32
36
|
|
|
33
37
|
// Check if Voice module is available
|
|
@@ -42,6 +46,18 @@ export async function initVoice(onResult) {
|
|
|
42
46
|
console.error('Speech recognition is not available on this device');
|
|
43
47
|
return false;
|
|
44
48
|
}
|
|
49
|
+
|
|
50
|
+
// Check if another recognition session is active
|
|
51
|
+
try {
|
|
52
|
+
const isRecognizing = await Voice.isRecognizing();
|
|
53
|
+
if (isRecognizing) {
|
|
54
|
+
console.log('Another recognition session is active, cleaning up...');
|
|
55
|
+
await Voice.destroy();
|
|
56
|
+
await new Promise(resolve => setTimeout(resolve, 300));
|
|
57
|
+
}
|
|
58
|
+
} catch (e) {
|
|
59
|
+
// Ignore errors checking recognition state
|
|
60
|
+
}
|
|
45
61
|
|
|
46
62
|
// Set up all event listeners
|
|
47
63
|
Voice.onSpeechStart = (e) => {
|
|
@@ -53,6 +69,9 @@ export async function initVoice(onResult) {
|
|
|
53
69
|
clearTimeout(silenceTimer);
|
|
54
70
|
silenceTimer = null;
|
|
55
71
|
}
|
|
72
|
+
|
|
73
|
+
// Start initial silence detection
|
|
74
|
+
handleSilenceDetection();
|
|
56
75
|
};
|
|
57
76
|
|
|
58
77
|
Voice.onSpeechRecognized = (e) => {
|
|
@@ -71,40 +90,54 @@ export async function initVoice(onResult) {
|
|
|
71
90
|
silenceTimer = null;
|
|
72
91
|
}
|
|
73
92
|
|
|
74
|
-
//
|
|
75
|
-
if (isCurrentlyRecording) {
|
|
76
|
-
|
|
93
|
+
// On iOS, onSpeechEnd can fire multiple times, so check if we're still recording
|
|
94
|
+
if (isCurrentlyRecording && finalResult) {
|
|
95
|
+
// Don't call handleFinalResult here on iOS as it causes the error
|
|
96
|
+
// Instead, just mark that speech ended and let silence detection handle it
|
|
97
|
+
if (Platform.OS === 'ios') {
|
|
98
|
+
console.log('iOS: Speech ended, waiting for silence detection to handle cleanup');
|
|
99
|
+
} else {
|
|
100
|
+
await handleFinalResult();
|
|
101
|
+
}
|
|
77
102
|
}
|
|
78
103
|
};
|
|
79
104
|
|
|
80
105
|
Voice.onSpeechError = async (e) => {
|
|
81
|
-
|
|
106
|
+
console.error('onSpeechError: ', e);
|
|
82
107
|
|
|
83
108
|
if (silenceTimer) {
|
|
84
109
|
clearTimeout(silenceTimer);
|
|
85
110
|
silenceTimer = null;
|
|
86
111
|
}
|
|
87
112
|
|
|
88
|
-
// Check for
|
|
113
|
+
// Check for specific error types
|
|
89
114
|
const isNoSpeechError = e.error?.code === "recognition_fail" &&
|
|
90
115
|
e.error?.message?.includes("No speech detected");
|
|
91
116
|
|
|
117
|
+
// iOS error 1101 is often transient and related to service availability
|
|
118
|
+
const isTransientIOSError = Platform.OS === 'ios' &&
|
|
119
|
+
(e.error?.code === "1101" ||
|
|
120
|
+
e.error?.message?.includes("kAFAssistantErrorDomain"));
|
|
121
|
+
|
|
92
122
|
await cleanupVoiceSession();
|
|
93
123
|
|
|
94
|
-
// Only send error to callback
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
124
|
+
// Only send error to callback for non-transient errors
|
|
125
|
+
if (!isNoSpeechError && !isTransientIOSError && resultCallback) {
|
|
126
|
+
resultCallback(null, e.error?.message || 'Speech recognition error');
|
|
127
|
+
} else if (isTransientIOSError) {
|
|
128
|
+
console.log('Transient iOS speech recognition error, attempting to recover');
|
|
129
|
+
// Send the final result if we have one
|
|
130
|
+
if (finalResult && resultCallback) {
|
|
131
|
+
resultCallback(finalResult);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
102
134
|
};
|
|
103
135
|
|
|
104
136
|
Voice.onSpeechResults = (e) => {
|
|
105
137
|
console.log('onSpeechResults: ', e);
|
|
106
138
|
if (e.value && e.value.length > 0) {
|
|
107
139
|
finalResult = e.value[0];
|
|
140
|
+
// Also trigger silence detection for final results
|
|
108
141
|
handleSilenceDetection();
|
|
109
142
|
}
|
|
110
143
|
};
|
|
@@ -118,6 +151,14 @@ export async function initVoice(onResult) {
|
|
|
118
151
|
|
|
119
152
|
if (e.value && e.value.length > 0) {
|
|
120
153
|
finalResult = e.value[0];
|
|
154
|
+
|
|
155
|
+
// Throttle partial results to prevent overwhelming the UI and speech service
|
|
156
|
+
const now = Date.now();
|
|
157
|
+
if (partialResultCallback && (now - lastPartialResultTime) > PARTIAL_RESULT_THROTTLE) {
|
|
158
|
+
partialResultCallback(e.value[0]);
|
|
159
|
+
lastPartialResultTime = now;
|
|
160
|
+
}
|
|
161
|
+
|
|
121
162
|
handleSilenceDetection();
|
|
122
163
|
}
|
|
123
164
|
};
|
|
@@ -141,7 +182,8 @@ const handleSilenceDetection = () => {
|
|
|
141
182
|
}
|
|
142
183
|
|
|
143
184
|
silenceTimer = setTimeout(async () => {
|
|
144
|
-
|
|
185
|
+
console.log('Silence detected, stopping recording...');
|
|
186
|
+
if (isCurrentlyRecording && finalResult) {
|
|
145
187
|
await handleFinalResult();
|
|
146
188
|
}
|
|
147
189
|
}, SILENCE_DURATION);
|
|
@@ -150,15 +192,27 @@ const handleSilenceDetection = () => {
|
|
|
150
192
|
const handleFinalResult = async () => {
|
|
151
193
|
if (!isCurrentlyRecording) return;
|
|
152
194
|
|
|
153
|
-
|
|
195
|
+
// Set flag immediately to prevent race conditions
|
|
196
|
+
isCurrentlyRecording = false;
|
|
197
|
+
|
|
198
|
+
// Clear silence timer first
|
|
199
|
+
if (silenceTimer) {
|
|
200
|
+
clearTimeout(silenceTimer);
|
|
201
|
+
silenceTimer = null;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Send result if we have one
|
|
205
|
+
if (finalResult && resultCallback) {
|
|
154
206
|
resultCallback(finalResult);
|
|
155
207
|
}
|
|
156
208
|
|
|
157
|
-
//
|
|
158
|
-
|
|
209
|
+
// Give iOS time to finish processing before cleanup
|
|
210
|
+
if (Platform.OS === 'ios') {
|
|
211
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
212
|
+
}
|
|
159
213
|
|
|
160
|
-
//
|
|
161
|
-
await
|
|
214
|
+
// Stop recording with proper sequence
|
|
215
|
+
await stopRecording();
|
|
162
216
|
};
|
|
163
217
|
|
|
164
218
|
const cleanupVoiceSession = async () => {
|
|
@@ -229,6 +283,9 @@ export async function startRecording() {
|
|
|
229
283
|
return false;
|
|
230
284
|
}
|
|
231
285
|
|
|
286
|
+
// Reset throttle timer
|
|
287
|
+
lastPartialResultTime = 0;
|
|
288
|
+
|
|
232
289
|
await Voice.start('en-US');
|
|
233
290
|
isCurrentlyRecording = true;
|
|
234
291
|
return true;
|
|
@@ -241,7 +298,21 @@ export async function startRecording() {
|
|
|
241
298
|
|
|
242
299
|
export async function stopRecording() {
|
|
243
300
|
try {
|
|
244
|
-
if (!
|
|
301
|
+
if (!Voice) return;
|
|
302
|
+
|
|
303
|
+
// Already stopped
|
|
304
|
+
if (!isCurrentlyRecording) {
|
|
305
|
+
// Still try to clean up any lingering session
|
|
306
|
+
try {
|
|
307
|
+
const isRecognizing = await Voice.isRecognizing();
|
|
308
|
+
if (isRecognizing) {
|
|
309
|
+
await Voice.stop();
|
|
310
|
+
}
|
|
311
|
+
} catch (e) {
|
|
312
|
+
// Ignore errors checking recognition state
|
|
313
|
+
}
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
245
316
|
|
|
246
317
|
// Set this first to prevent race conditions
|
|
247
318
|
isCurrentlyRecording = false;
|
|
@@ -251,21 +322,46 @@ export async function stopRecording() {
|
|
|
251
322
|
silenceTimer = null;
|
|
252
323
|
}
|
|
253
324
|
|
|
254
|
-
//
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
325
|
+
// For iOS, use a more careful approach
|
|
326
|
+
if (Platform.OS === 'ios') {
|
|
327
|
+
try {
|
|
328
|
+
// First cancel any ongoing recognition
|
|
329
|
+
await Voice.cancel();
|
|
330
|
+
await new Promise(resolve => setTimeout(resolve, 50));
|
|
331
|
+
} catch (error) {
|
|
332
|
+
// Ignore cancel errors
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
try {
|
|
336
|
+
// Then stop
|
|
337
|
+
await Voice.stop();
|
|
338
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
339
|
+
} catch (error) {
|
|
340
|
+
console.log('Error stopping Voice (expected on iOS):', error);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
try {
|
|
344
|
+
// Finally destroy
|
|
345
|
+
await Voice.destroy();
|
|
346
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
347
|
+
} catch (error) {
|
|
348
|
+
console.log('Error destroying Voice (expected on iOS):', error);
|
|
349
|
+
}
|
|
350
|
+
} else {
|
|
351
|
+
// Android can handle the normal sequence
|
|
352
|
+
try {
|
|
353
|
+
await Voice.stop();
|
|
354
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
355
|
+
} catch (error) {
|
|
356
|
+
console.error('Error stopping Voice:', error);
|
|
357
|
+
}
|
|
262
358
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
359
|
+
try {
|
|
360
|
+
await Voice.destroy();
|
|
361
|
+
await new Promise(resolve => setTimeout(resolve, 300));
|
|
362
|
+
} catch (error) {
|
|
363
|
+
console.error('Error destroying Voice:', error);
|
|
364
|
+
}
|
|
269
365
|
}
|
|
270
366
|
|
|
271
367
|
// Final cleanup
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.TestProductCard = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _productCard = require("./productCard");
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
const mockProduct = {
|
|
12
|
-
"part_number": "AEQO177",
|
|
13
|
-
"inventory_info": {
|
|
14
|
-
"default_uom": "EA",
|
|
15
|
-
"is_valid": true,
|
|
16
|
-
"info_by_uom": {
|
|
17
|
-
"EA": {
|
|
18
|
-
"gross_price": 7.83,
|
|
19
|
-
"net_price": 7.83,
|
|
20
|
-
"is_on_sale": false,
|
|
21
|
-
"quantity_available": 0,
|
|
22
|
-
"discounts": null,
|
|
23
|
-
"min_pack_qty": 1.5
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"product_details": {
|
|
28
|
-
"product_name": "Aladdin Hayward SPX1600S SuperPump Lid Gasket | O-177-2",
|
|
29
|
-
"part_number": "AEQO177",
|
|
30
|
-
"manufacturer_id": "O-177-2",
|
|
31
|
-
"heritage_link": "https://www.heritagepoolplus.com/aeqo177-aladdin-o-ring-o-177-o-177-2-o-177-2",
|
|
32
|
-
"image_url": "https://media.heritageplus.com/image/upload/v1668157956/image/AEQO177_0.jpg"
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const TestProductCard = () => {
|
|
36
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.ScrollView, {
|
|
37
|
-
style: styles.container
|
|
38
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
39
|
-
style: styles.title
|
|
40
|
-
}, "Test Product Card"), /*#__PURE__*/_react.default.createElement(_productCard.ProductCard, {
|
|
41
|
-
prod: mockProduct,
|
|
42
|
-
onFocusQuantityInput: partNumber => console.log('Focus on:', partNumber),
|
|
43
|
-
messageId: "test-message-123"
|
|
44
|
-
}));
|
|
45
|
-
};
|
|
46
|
-
exports.TestProductCard = TestProductCard;
|
|
47
|
-
const styles = _reactNative.StyleSheet.create({
|
|
48
|
-
container: {
|
|
49
|
-
flex: 1,
|
|
50
|
-
backgroundColor: '#f6f6f6',
|
|
51
|
-
padding: 16
|
|
52
|
-
},
|
|
53
|
-
title: {
|
|
54
|
-
fontSize: 18,
|
|
55
|
-
fontWeight: 'bold',
|
|
56
|
-
marginBottom: 16,
|
|
57
|
-
textAlign: 'center'
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
//# sourceMappingURL=testProductCard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_productCard","e","__esModule","default","mockProduct","TestProductCard","createElement","ScrollView","style","styles","container","Text","title","ProductCard","prod","onFocusQuantityInput","partNumber","console","log","messageId","exports","StyleSheet","create","flex","backgroundColor","padding","fontSize","fontWeight","marginBottom","textAlign"],"sourceRoot":"../../../src","sources":["components/testProductCard.js"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAA4C,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE5C,MAAMG,WAAW,GAAG;EAClB,aAAa,EAAE,SAAS;EACxB,gBAAgB,EAAE;IAChB,aAAa,EAAE,IAAI;IACnB,UAAU,EAAE,IAAI;IAChB,aAAa,EAAE;MACb,IAAI,EAAE;QACJ,aAAa,EAAE,IAAI;QACnB,WAAW,EAAE,IAAI;QACjB,YAAY,EAAE,KAAK;QACnB,oBAAoB,EAAE,CAAC;QACvB,WAAW,EAAE,IAAI;QACjB,cAAc,EAAE;MAClB;IACF;EACF,CAAC;EACD,iBAAiB,EAAE;IACjB,cAAc,EAAE,yDAAyD;IACzE,aAAa,EAAE,SAAS;IACxB,iBAAiB,EAAE,SAAS;IAC5B,eAAe,EAAE,+EAA+E;IAChG,WAAW,EAAE;EACf;AACF,CAAC;AAEM,MAAMC,eAAe,GAAGA,CAAA,KAAM;EACnC,oBACET,MAAA,CAAAO,OAAA,CAAAG,aAAA,CAACP,YAAA,CAAAQ,UAAU;IAACC,KAAK,EAAEC,MAAM,CAACC;EAAU,gBAClCd,MAAA,CAAAO,OAAA,CAAAG,aAAA,CAACP,YAAA,CAAAY,IAAI;IAACH,KAAK,EAAEC,MAAM,CAACG;EAAM,GAAC,mBAAuB,CAAC,eACnDhB,MAAA,CAAAO,OAAA,CAAAG,aAAA,CAACN,YAAA,CAAAa,WAAW;IACVC,IAAI,EAAEV,WAAY;IAClBW,oBAAoB,EAAGC,UAAU,IAAKC,OAAO,CAACC,GAAG,CAAC,WAAW,EAAEF,UAAU,CAAE;IAC3EG,SAAS,EAAC;EAAkB,CAC7B,CACS,CAAC;AAEjB,CAAC;AAACC,OAAA,CAAAf,eAAA,GAAAA,eAAA;AAEF,MAAMI,MAAM,GAAGY,uBAAU,CAACC,MAAM,CAAC;EAC/BZ,SAAS,EAAE;IACTa,IAAI,EAAE,CAAC;IACPC,eAAe,EAAE,SAAS;IAC1BC,OAAO,EAAE;EACX,CAAC;EACDb,KAAK,EAAE;IACLc,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,MAAM;IAClBC,YAAY,EAAE,EAAE;IAChBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View, ScrollView, StyleSheet, Text } from 'react-native';
|
|
3
|
-
import { ProductCard } from './productCard';
|
|
4
|
-
const mockProduct = {
|
|
5
|
-
"part_number": "AEQO177",
|
|
6
|
-
"inventory_info": {
|
|
7
|
-
"default_uom": "EA",
|
|
8
|
-
"is_valid": true,
|
|
9
|
-
"info_by_uom": {
|
|
10
|
-
"EA": {
|
|
11
|
-
"gross_price": 7.83,
|
|
12
|
-
"net_price": 7.83,
|
|
13
|
-
"is_on_sale": false,
|
|
14
|
-
"quantity_available": 0,
|
|
15
|
-
"discounts": null,
|
|
16
|
-
"min_pack_qty": 1.5
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"product_details": {
|
|
21
|
-
"product_name": "Aladdin Hayward SPX1600S SuperPump Lid Gasket | O-177-2",
|
|
22
|
-
"part_number": "AEQO177",
|
|
23
|
-
"manufacturer_id": "O-177-2",
|
|
24
|
-
"heritage_link": "https://www.heritagepoolplus.com/aeqo177-aladdin-o-ring-o-177-o-177-2-o-177-2",
|
|
25
|
-
"image_url": "https://media.heritageplus.com/image/upload/v1668157956/image/AEQO177_0.jpg"
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
export const TestProductCard = () => {
|
|
29
|
-
return /*#__PURE__*/React.createElement(ScrollView, {
|
|
30
|
-
style: styles.container
|
|
31
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
32
|
-
style: styles.title
|
|
33
|
-
}, "Test Product Card"), /*#__PURE__*/React.createElement(ProductCard, {
|
|
34
|
-
prod: mockProduct,
|
|
35
|
-
onFocusQuantityInput: partNumber => console.log('Focus on:', partNumber),
|
|
36
|
-
messageId: "test-message-123"
|
|
37
|
-
}));
|
|
38
|
-
};
|
|
39
|
-
const styles = StyleSheet.create({
|
|
40
|
-
container: {
|
|
41
|
-
flex: 1,
|
|
42
|
-
backgroundColor: '#f6f6f6',
|
|
43
|
-
padding: 16
|
|
44
|
-
},
|
|
45
|
-
title: {
|
|
46
|
-
fontSize: 18,
|
|
47
|
-
fontWeight: 'bold',
|
|
48
|
-
marginBottom: 16,
|
|
49
|
-
textAlign: 'center'
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
//# sourceMappingURL=testProductCard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","ScrollView","StyleSheet","Text","ProductCard","mockProduct","TestProductCard","createElement","style","styles","container","title","prod","onFocusQuantityInput","partNumber","console","log","messageId","create","flex","backgroundColor","padding","fontSize","fontWeight","marginBottom","textAlign"],"sourceRoot":"../../../src","sources":["components/testProductCard.js"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,UAAU,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AACjE,SAASC,WAAW,QAAQ,eAAe;AAE3C,MAAMC,WAAW,GAAG;EAClB,aAAa,EAAE,SAAS;EACxB,gBAAgB,EAAE;IAChB,aAAa,EAAE,IAAI;IACnB,UAAU,EAAE,IAAI;IAChB,aAAa,EAAE;MACb,IAAI,EAAE;QACJ,aAAa,EAAE,IAAI;QACnB,WAAW,EAAE,IAAI;QACjB,YAAY,EAAE,KAAK;QACnB,oBAAoB,EAAE,CAAC;QACvB,WAAW,EAAE,IAAI;QACjB,cAAc,EAAE;MAClB;IACF;EACF,CAAC;EACD,iBAAiB,EAAE;IACjB,cAAc,EAAE,yDAAyD;IACzE,aAAa,EAAE,SAAS;IACxB,iBAAiB,EAAE,SAAS;IAC5B,eAAe,EAAE,+EAA+E;IAChG,WAAW,EAAE;EACf;AACF,CAAC;AAED,OAAO,MAAMC,eAAe,GAAGA,CAAA,KAAM;EACnC,oBACEP,KAAA,CAAAQ,aAAA,CAACN,UAAU;IAACO,KAAK,EAAEC,MAAM,CAACC;EAAU,gBAClCX,KAAA,CAAAQ,aAAA,CAACJ,IAAI;IAACK,KAAK,EAAEC,MAAM,CAACE;EAAM,GAAC,mBAAuB,CAAC,eACnDZ,KAAA,CAAAQ,aAAA,CAACH,WAAW;IACVQ,IAAI,EAAEP,WAAY;IAClBQ,oBAAoB,EAAGC,UAAU,IAAKC,OAAO,CAACC,GAAG,CAAC,WAAW,EAAEF,UAAU,CAAE;IAC3EG,SAAS,EAAC;EAAkB,CAC7B,CACS,CAAC;AAEjB,CAAC;AAED,MAAMR,MAAM,GAAGP,UAAU,CAACgB,MAAM,CAAC;EAC/BR,SAAS,EAAE;IACTS,IAAI,EAAE,CAAC;IACPC,eAAe,EAAE,SAAS;IAC1BC,OAAO,EAAE;EACX,CAAC;EACDV,KAAK,EAAE;IACLW,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,MAAM;IAClBC,YAAY,EAAE,EAAE;IAChBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"testProductCard.d.ts","sourceRoot":"","sources":["../../../src/components/testProductCard.js"],"names":[],"mappings":"AA6BO,qDAWN;kBAxCiB,OAAO"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View, ScrollView, StyleSheet, Text } from 'react-native';
|
|
3
|
-
import { ProductCard } from './productCard';
|
|
4
|
-
|
|
5
|
-
const mockProduct = {
|
|
6
|
-
"part_number": "AEQO177",
|
|
7
|
-
"inventory_info": {
|
|
8
|
-
"default_uom": "EA",
|
|
9
|
-
"is_valid": true,
|
|
10
|
-
"info_by_uom": {
|
|
11
|
-
"EA": {
|
|
12
|
-
"gross_price": 7.83,
|
|
13
|
-
"net_price": 7.83,
|
|
14
|
-
"is_on_sale": false,
|
|
15
|
-
"quantity_available": 0,
|
|
16
|
-
"discounts": null,
|
|
17
|
-
"min_pack_qty": 1.5
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
"product_details": {
|
|
22
|
-
"product_name": "Aladdin Hayward SPX1600S SuperPump Lid Gasket | O-177-2",
|
|
23
|
-
"part_number": "AEQO177",
|
|
24
|
-
"manufacturer_id": "O-177-2",
|
|
25
|
-
"heritage_link": "https://www.heritagepoolplus.com/aeqo177-aladdin-o-ring-o-177-o-177-2-o-177-2",
|
|
26
|
-
"image_url": "https://media.heritageplus.com/image/upload/v1668157956/image/AEQO177_0.jpg"
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const TestProductCard = () => {
|
|
31
|
-
return (
|
|
32
|
-
<ScrollView style={styles.container}>
|
|
33
|
-
<Text style={styles.title}>Test Product Card</Text>
|
|
34
|
-
<ProductCard
|
|
35
|
-
prod={mockProduct}
|
|
36
|
-
onFocusQuantityInput={(partNumber) => console.log('Focus on:', partNumber)}
|
|
37
|
-
messageId="test-message-123"
|
|
38
|
-
/>
|
|
39
|
-
</ScrollView>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const styles = StyleSheet.create({
|
|
44
|
-
container: {
|
|
45
|
-
flex: 1,
|
|
46
|
-
backgroundColor: '#f6f6f6',
|
|
47
|
-
padding: 16,
|
|
48
|
-
},
|
|
49
|
-
title: {
|
|
50
|
-
fontSize: 18,
|
|
51
|
-
fontWeight: 'bold',
|
|
52
|
-
marginBottom: 16,
|
|
53
|
-
textAlign: 'center',
|
|
54
|
-
},
|
|
55
|
-
});
|