ssovee-os-web-ui 0.1.39 → 0.1.41
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/dist/index.cjs +43 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +43 -9
- package/dist/index.js.map +1 -1
- package/dist/sdk.cjs +43 -9
- package/dist/sdk.cjs.map +1 -1
- package/dist/sdk.d.cts +1 -1
- package/dist/sdk.d.ts +1 -1
- package/dist/sdk.js +44 -10
- package/dist/sdk.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3258,24 +3258,58 @@ var swipe_tone_default = "data:audio/wave;base64,UklGRuzOAgBXQVZFZm10IBAAAAABAAI
|
|
|
3258
3258
|
// src/hooks/useSound.tsx
|
|
3259
3259
|
var soundMap = {
|
|
3260
3260
|
click: click_tone_default,
|
|
3261
|
-
alert: error_tone_default,
|
|
3262
|
-
notification: notification_tone_default,
|
|
3263
3261
|
error: error_tone_default,
|
|
3264
3262
|
success: success_tone_default,
|
|
3263
|
+
alert: error_tone_default,
|
|
3264
|
+
notification: notification_tone_default,
|
|
3265
3265
|
swipe: swipe_tone_default
|
|
3266
3266
|
};
|
|
3267
|
+
var DEFAULT_SOUND_TYPE = "click";
|
|
3268
|
+
var isSoundType = (type) => {
|
|
3269
|
+
return type in soundMap;
|
|
3270
|
+
};
|
|
3267
3271
|
var useSound = () => {
|
|
3272
|
+
const audioCache = React22.useRef({});
|
|
3268
3273
|
const playSound = React22.useCallback((type) => {
|
|
3269
|
-
if (typeof window === "undefined"
|
|
3274
|
+
if (typeof window === "undefined") {
|
|
3270
3275
|
return;
|
|
3271
3276
|
}
|
|
3272
|
-
const
|
|
3273
|
-
const
|
|
3274
|
-
|
|
3275
|
-
console.error(
|
|
3276
|
-
|
|
3277
|
+
const requestedType = isSoundType(type) ? type : DEFAULT_SOUND_TYPE;
|
|
3278
|
+
const src = soundMap[requestedType];
|
|
3279
|
+
if (!src) {
|
|
3280
|
+
console.error(
|
|
3281
|
+
`Sound playback failed: no source found for "${requestedType}"`
|
|
3282
|
+
);
|
|
3283
|
+
return;
|
|
3284
|
+
}
|
|
3285
|
+
try {
|
|
3286
|
+
let audio = audioCache.current[requestedType];
|
|
3287
|
+
if (!audio) {
|
|
3288
|
+
audio = new Audio(src);
|
|
3289
|
+
audio.preload = "auto";
|
|
3290
|
+
audioCache.current[requestedType] = audio;
|
|
3291
|
+
}
|
|
3292
|
+
audio.pause();
|
|
3293
|
+
audio.currentTime = 0;
|
|
3294
|
+
const playPromise = audio.play();
|
|
3295
|
+
if (playPromise !== void 0) {
|
|
3296
|
+
playPromise.catch((error) => {
|
|
3297
|
+
console.error(
|
|
3298
|
+
`Sound playback failed for "${requestedType}":`,
|
|
3299
|
+
error
|
|
3300
|
+
);
|
|
3301
|
+
});
|
|
3302
|
+
}
|
|
3303
|
+
} catch (error) {
|
|
3304
|
+
console.error(
|
|
3305
|
+
`Sound playback failed for "${requestedType}":`,
|
|
3306
|
+
error
|
|
3307
|
+
);
|
|
3308
|
+
}
|
|
3277
3309
|
}, []);
|
|
3278
|
-
return {
|
|
3310
|
+
return {
|
|
3311
|
+
playSound
|
|
3312
|
+
};
|
|
3279
3313
|
};
|
|
3280
3314
|
|
|
3281
3315
|
exports.Accordion = Accordion_default;
|