sonic-widget 2.0.0 → 2.0.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.
- package/README.md +3 -3
- package/dist/index.js +1494 -1494
- package/dist/service-worker.js +145 -0
- package/package.json +3 -2
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// const CACHE_NAME = 'tensorflow-models-cache';
|
|
2
|
+
|
|
3
|
+
// self.addEventListener('install', event => {
|
|
4
|
+
// event.waitUntil(
|
|
5
|
+
// caches.open(CACHE_NAME).then(cache => {
|
|
6
|
+
// console.log("Opened cache");
|
|
7
|
+
// return cache.addAll([
|
|
8
|
+
// // coco ssd
|
|
9
|
+
// 'https://storage.googleapis.com/tfjs-models/savedmodel/ssdlite_mobilenet_v2/model.json',
|
|
10
|
+
// // document model
|
|
11
|
+
// "https://teachablemachine.withgoogle.com/models/ikFAYzyyu/model.json",
|
|
12
|
+
|
|
13
|
+
// // mask model
|
|
14
|
+
// "https://teachablemachine.withgoogle.com/models/_08Yck2dy/model.json",
|
|
15
|
+
|
|
16
|
+
// // blazeface
|
|
17
|
+
// 'https://tfhub.dev/tensorflow/tfjs-model/blazeface/1/default/1/model.json?tfjs-format=file',
|
|
18
|
+
|
|
19
|
+
// // handpose model
|
|
20
|
+
// "https://tfhub.dev/mediapipe/tfjs-model/handpose_3d/detector/full/1/model.json?tfjs-format=file",
|
|
21
|
+
// "https://tfhub.dev/mediapipe/tfjs-model/handpose_3d/landmark/full/1/model.json?tfjs-format=file"
|
|
22
|
+
// // Add more model files if necessary
|
|
23
|
+
// ]);
|
|
24
|
+
// })
|
|
25
|
+
// );
|
|
26
|
+
// });
|
|
27
|
+
|
|
28
|
+
// self.addEventListener('fetch', event => {
|
|
29
|
+
// event.respondWith(
|
|
30
|
+
// caches.match(event.request).then(response => {
|
|
31
|
+
// console.log("response from fetch request: ", {response});
|
|
32
|
+
// // Cache hit - return response
|
|
33
|
+
// if (response) {
|
|
34
|
+
// return response;
|
|
35
|
+
// }
|
|
36
|
+
// return fetch(event.request);
|
|
37
|
+
// })
|
|
38
|
+
// );
|
|
39
|
+
// });
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
const CACHE_NAME = 'tensorflow-models-cache-v1';
|
|
44
|
+
const urlsToCache = [
|
|
45
|
+
// coco ssd
|
|
46
|
+
'https://storage.googleapis.com/tfjs-models/savedmodel/ssdlite_mobilenet_v2/model.json',
|
|
47
|
+
// document model
|
|
48
|
+
"https://teachablemachine.withgoogle.com/models/ikFAYzyyu/model.json",
|
|
49
|
+
|
|
50
|
+
// mask model
|
|
51
|
+
"https://teachablemachine.withgoogle.com/models/_08Yck2dy/model.json",
|
|
52
|
+
|
|
53
|
+
// blazeface
|
|
54
|
+
'https://tfhub.dev/tensorflow/tfjs-model/blazeface/1/default/1/model.json?tfjs-format=file',
|
|
55
|
+
|
|
56
|
+
// handpose model
|
|
57
|
+
"https://tfhub.dev/mediapipe/tfjs-model/handpose_3d/detector/full/1/model.json?tfjs-format=file",
|
|
58
|
+
"https://tfhub.dev/mediapipe/tfjs-model/handpose_3d/landmark/full/1/model.json?tfjs-format=file"
|
|
59
|
+
// Add more model files if necessary
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
self.addEventListener('install', function(event) {
|
|
63
|
+
// Perform install steps
|
|
64
|
+
event.waitUntil(
|
|
65
|
+
caches.open(CACHE_NAME)
|
|
66
|
+
.then(function(cache) {
|
|
67
|
+
return cache.addAll(urlsToCache);
|
|
68
|
+
})
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
self.addEventListener('fetch', function(event) {
|
|
73
|
+
const request = event.request;
|
|
74
|
+
|
|
75
|
+
// Skip caching for requests from browser extensions
|
|
76
|
+
if (request.url.startsWith('chrome-extension://')) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
event.respondWith(
|
|
81
|
+
caches.match(request)
|
|
82
|
+
.then(function(response) {
|
|
83
|
+
// Cache hit - return response
|
|
84
|
+
if (response) {
|
|
85
|
+
return response;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Clone the request
|
|
89
|
+
const fetchRequest = request.clone();
|
|
90
|
+
|
|
91
|
+
return fetch(fetchRequest).then(
|
|
92
|
+
function(response) {
|
|
93
|
+
// Check if we received a valid response
|
|
94
|
+
if(!response || response.status !== 200 || response.type !== 'basic') {
|
|
95
|
+
return response;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Clone the response
|
|
99
|
+
const responseToCache = response.clone();
|
|
100
|
+
// Save the response for future matching
|
|
101
|
+
caches.open(CACHE_NAME)
|
|
102
|
+
.then(function(cache) {
|
|
103
|
+
cache.put(request, responseToCache);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
return response;
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
})
|
|
110
|
+
);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// self.addEventListener('fetch', function(event) {
|
|
114
|
+
// event.respondWith(
|
|
115
|
+
// caches.match(event.request)
|
|
116
|
+
// .then(function(response) {
|
|
117
|
+
// // Cache hit - return response
|
|
118
|
+
// if (response) {
|
|
119
|
+
// return response;
|
|
120
|
+
// }
|
|
121
|
+
// // Clone the request
|
|
122
|
+
// var fetchRequest = event.request.clone();
|
|
123
|
+
|
|
124
|
+
// return fetch(fetchRequest).then(
|
|
125
|
+
// function(response) {
|
|
126
|
+
// // Check if we received a valid response
|
|
127
|
+
// if(!response || response.status !== 200 || response.type !== 'basic') {
|
|
128
|
+
// return response;
|
|
129
|
+
// }
|
|
130
|
+
|
|
131
|
+
// // Clone the response
|
|
132
|
+
// var responseToCache = response.clone();
|
|
133
|
+
// // Save the response for future matching
|
|
134
|
+
// caches.open(CACHE_NAME)
|
|
135
|
+
// .then(function(cache) {
|
|
136
|
+
// // cache.put(event.request, responseToCache);
|
|
137
|
+
// cache.put(event.request, responseToCache);
|
|
138
|
+
// });
|
|
139
|
+
|
|
140
|
+
// return response;
|
|
141
|
+
// }
|
|
142
|
+
// );
|
|
143
|
+
// })
|
|
144
|
+
// );
|
|
145
|
+
// });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sonic-widget",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Sonic widget library for doing E-KYC",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@tensorflow/tfjs-converter": "^4.15.0",
|
|
36
36
|
"@tensorflow/tfjs-core": "^4.15.0",
|
|
37
37
|
"axios": "1.6.4",
|
|
38
|
-
"public-ip": "^6.0.1",
|
|
38
|
+
"public-ip": "^6.0.1",
|
|
39
39
|
"react": "^18.2.0",
|
|
40
40
|
"react-cropper": "^2.3.3",
|
|
41
41
|
"react-device-detect": "^2.2.3",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"react-speech-recognition": "^3.10.0",
|
|
48
48
|
"react-webcam": "^7.0.1",
|
|
49
49
|
"recordrtc": "^5.6.2",
|
|
50
|
+
"regenerator-runtime": "^0.14.1",
|
|
50
51
|
"speak-tts": "^2.0.8"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|