@getlupa/client 1.18.3 → 1.19.0
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/lupaSearch.iife.js +610 -76
- package/dist/lupaSearch.js +610 -76
- package/dist/lupaSearch.mjs +610 -76
- package/dist/lupaSearch.umd.js +610 -76
- package/dist/src/modules/pluginManager/PluginConfigurationMerger.d.ts +1 -0
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/lupaSearch.mjs
CHANGED
|
@@ -12586,7 +12586,7 @@ const getNormalizedString = (str) => {
|
|
|
12586
12586
|
return "";
|
|
12587
12587
|
}
|
|
12588
12588
|
const transformedStr = typeof str === "string" ? str : str.toString();
|
|
12589
|
-
return transformedStr.normalize === void 0 ? (_a = transformedStr.toLocaleLowerCase()) == null ? void 0 : _a.trim() : (_b = transformedStr.toLocaleLowerCase().normalize("NFKD").replace(/[^\
|
|
12589
|
+
return transformedStr.normalize === void 0 ? (_a = transformedStr.toLocaleLowerCase()) == null ? void 0 : _a.trim() : (_b = transformedStr.toLocaleLowerCase().normalize("NFKD").replace(/[^\p{L}\p{N}\s]/gu, "")) == null ? void 0 : _b.trim();
|
|
12590
12590
|
};
|
|
12591
12591
|
const getTransformedString = (str) => {
|
|
12592
12592
|
var _a, _b;
|
|
@@ -12617,6 +12617,11 @@ const getRandomString = (length) => {
|
|
|
12617
12617
|
}
|
|
12618
12618
|
return result2;
|
|
12619
12619
|
};
|
|
12620
|
+
const getSocketClientId = () => {
|
|
12621
|
+
const timestamp = Date.now().toString(36);
|
|
12622
|
+
const randomString = getRandomString(8);
|
|
12623
|
+
return `${timestamp}-${randomString}`;
|
|
12624
|
+
};
|
|
12620
12625
|
const toFixedIfNecessary = (value, precision = 2) => {
|
|
12621
12626
|
return (+parseFloat(value).toFixed(precision)).toString();
|
|
12622
12627
|
};
|
|
@@ -12731,6 +12736,10 @@ const DEFAULT_SEARCH_BOX_OPTIONS$1 = {
|
|
|
12731
12736
|
links: {
|
|
12732
12737
|
searchResults: "/search"
|
|
12733
12738
|
},
|
|
12739
|
+
voiceSearch: {
|
|
12740
|
+
enabled: false,
|
|
12741
|
+
queryKey: ""
|
|
12742
|
+
},
|
|
12734
12743
|
panels: [
|
|
12735
12744
|
{
|
|
12736
12745
|
type: "suggestion",
|
|
@@ -14312,6 +14321,387 @@ const useSearchBoxStore = defineStore("searchBox", () => {
|
|
|
14312
14321
|
resetHighlightIndex
|
|
14313
14322
|
};
|
|
14314
14323
|
});
|
|
14324
|
+
const Env = {
|
|
14325
|
+
production: "https://api.lupasearch.com/v1/",
|
|
14326
|
+
staging: "https://api.staging.lupasearch.com/v1/"
|
|
14327
|
+
};
|
|
14328
|
+
const VoiceServiceEnv = {
|
|
14329
|
+
production: "wss://voice.lupasearch.com",
|
|
14330
|
+
staging: "wss://voice.lupasearch.dev"
|
|
14331
|
+
};
|
|
14332
|
+
const DEFAULT_REQUEST_CONFIG = {
|
|
14333
|
+
method: "POST",
|
|
14334
|
+
headers: { "Content-Type": "application/json" }
|
|
14335
|
+
};
|
|
14336
|
+
const DEFAULT_HEADERS = DEFAULT_REQUEST_CONFIG.headers;
|
|
14337
|
+
const getVoiceServiceApiUrl = (environment, customVoiceServiceUrl) => {
|
|
14338
|
+
if (customVoiceServiceUrl) {
|
|
14339
|
+
return customVoiceServiceUrl;
|
|
14340
|
+
}
|
|
14341
|
+
return VoiceServiceEnv[environment] || VoiceServiceEnv["production"];
|
|
14342
|
+
};
|
|
14343
|
+
const getApiUrl = (environment, customBaseUrl) => {
|
|
14344
|
+
if (customBaseUrl) {
|
|
14345
|
+
return customBaseUrl;
|
|
14346
|
+
}
|
|
14347
|
+
return Env[environment] || Env["production"];
|
|
14348
|
+
};
|
|
14349
|
+
const _sfc_main$1z = /* @__PURE__ */ defineComponent({
|
|
14350
|
+
__name: "VoiceSearchProgressCircle",
|
|
14351
|
+
props: {
|
|
14352
|
+
isRecording: { type: Boolean },
|
|
14353
|
+
timesliceLimit: {},
|
|
14354
|
+
timeSliceLength: {}
|
|
14355
|
+
},
|
|
14356
|
+
setup(__props, { expose: __expose }) {
|
|
14357
|
+
const props = __props;
|
|
14358
|
+
const progressBar = ref(null);
|
|
14359
|
+
const getProgressBarColor = (progressBarStyle) => {
|
|
14360
|
+
if (!progressBarStyle.backgroundImage.startsWith("conic-gradient")) {
|
|
14361
|
+
return progressBarStyle.backgroundColor;
|
|
14362
|
+
}
|
|
14363
|
+
const colorStops = progressBarStyle.backgroundImage.replace(/conic-gradient\(|\)$/g, "").split(")");
|
|
14364
|
+
if (colorStops.length > 1) {
|
|
14365
|
+
return `${colorStops[0]})`;
|
|
14366
|
+
} else {
|
|
14367
|
+
return progressBarStyle.backgroundColor;
|
|
14368
|
+
}
|
|
14369
|
+
};
|
|
14370
|
+
const startProgressBar = () => {
|
|
14371
|
+
if (!progressBar.value) {
|
|
14372
|
+
return;
|
|
14373
|
+
}
|
|
14374
|
+
const duration = props.timesliceLimit * props.timeSliceLength;
|
|
14375
|
+
const progressBarStyle = window.getComputedStyle(progressBar.value);
|
|
14376
|
+
const progressBarColor = getProgressBarColor(progressBarStyle);
|
|
14377
|
+
progressBar.value.style.background = `conic-gradient(${progressBarColor} 0%, transparent 0%)`;
|
|
14378
|
+
let startTime = null;
|
|
14379
|
+
function updateProgress(timestamp) {
|
|
14380
|
+
if (!progressBar.value || !props.isRecording) {
|
|
14381
|
+
return;
|
|
14382
|
+
}
|
|
14383
|
+
if (!startTime)
|
|
14384
|
+
startTime = timestamp;
|
|
14385
|
+
const elapsed = timestamp - startTime;
|
|
14386
|
+
const progress = Math.min(elapsed / duration, 1) * 100;
|
|
14387
|
+
progressBar.value.style.background = `conic-gradient(${progressBarColor} ${progress}%, transparent ${progress}%)`;
|
|
14388
|
+
if (elapsed < duration) {
|
|
14389
|
+
requestAnimationFrame(updateProgress);
|
|
14390
|
+
}
|
|
14391
|
+
}
|
|
14392
|
+
requestAnimationFrame(updateProgress);
|
|
14393
|
+
};
|
|
14394
|
+
const stopProgressBar = () => {
|
|
14395
|
+
if (!progressBar.value) {
|
|
14396
|
+
return;
|
|
14397
|
+
}
|
|
14398
|
+
progressBar.value.style.background = "";
|
|
14399
|
+
};
|
|
14400
|
+
__expose({
|
|
14401
|
+
startProgressBar,
|
|
14402
|
+
stopProgressBar
|
|
14403
|
+
});
|
|
14404
|
+
return (_ctx, _cache) => {
|
|
14405
|
+
return openBlock(), createElementBlock("div", {
|
|
14406
|
+
ref_key: "progressBar",
|
|
14407
|
+
ref: progressBar,
|
|
14408
|
+
class: "lupa-progress-circle"
|
|
14409
|
+
}, null, 512);
|
|
14410
|
+
};
|
|
14411
|
+
}
|
|
14412
|
+
});
|
|
14413
|
+
const buildSocketMessageFrameHeader = (event, payloadLength) => {
|
|
14414
|
+
const headerObj = { event, length: payloadLength };
|
|
14415
|
+
const headerJson = JSON.stringify(headerObj);
|
|
14416
|
+
const headerBytes = new TextEncoder().encode(headerJson);
|
|
14417
|
+
const headerLength = new Uint32Array([headerBytes.length]);
|
|
14418
|
+
const headerLengthBytes = new Uint8Array(headerLength.buffer);
|
|
14419
|
+
const result2 = new Uint8Array(4 + headerBytes.length);
|
|
14420
|
+
result2.set(headerLengthBytes, 0);
|
|
14421
|
+
result2.set(headerBytes, 4);
|
|
14422
|
+
return result2;
|
|
14423
|
+
};
|
|
14424
|
+
function useVoiceRecorder(options) {
|
|
14425
|
+
const socket = ref(null);
|
|
14426
|
+
const mediaStream = ref(null);
|
|
14427
|
+
const mediaRecorder = ref(null);
|
|
14428
|
+
const isRecording = ref(false);
|
|
14429
|
+
const isSocketReady = ref(false);
|
|
14430
|
+
const errorRef = ref(null);
|
|
14431
|
+
const transcription = ref("");
|
|
14432
|
+
const timeSliceLength = computed(() => {
|
|
14433
|
+
var _a;
|
|
14434
|
+
return (_a = options.timesliceLength) != null ? _a : 1e3;
|
|
14435
|
+
});
|
|
14436
|
+
onBeforeUnmount(() => {
|
|
14437
|
+
closeSocket();
|
|
14438
|
+
stopRecording();
|
|
14439
|
+
});
|
|
14440
|
+
const initSocket = (url, onMessage) => {
|
|
14441
|
+
socket.value = new WebSocket(url);
|
|
14442
|
+
socket.value.onmessage = (event) => __async2(this, null, function* () {
|
|
14443
|
+
var _a;
|
|
14444
|
+
try {
|
|
14445
|
+
const msg = JSON.parse(event.data);
|
|
14446
|
+
if (msg.event === "ready") {
|
|
14447
|
+
if (((_a = mediaRecorder.value) == null ? void 0 : _a.state) !== "recording") {
|
|
14448
|
+
try {
|
|
14449
|
+
isSocketReady.value = true;
|
|
14450
|
+
yield startRecording();
|
|
14451
|
+
} catch (error) {
|
|
14452
|
+
console.error("Recording failed to start:", error);
|
|
14453
|
+
closeSocket();
|
|
14454
|
+
}
|
|
14455
|
+
}
|
|
14456
|
+
} else if (msg.event === "transcription") {
|
|
14457
|
+
transcription.value = msg.transcription;
|
|
14458
|
+
onMessage == null ? void 0 : onMessage(msg.transcription);
|
|
14459
|
+
stopSocketConnection();
|
|
14460
|
+
} else if (msg.event === "error") {
|
|
14461
|
+
errorRef.value = msg.message || "An error occurred during transcription";
|
|
14462
|
+
isSocketReady.value = false;
|
|
14463
|
+
stopRecording();
|
|
14464
|
+
closeSocket();
|
|
14465
|
+
}
|
|
14466
|
+
} catch (error) {
|
|
14467
|
+
console.error("Error processing WebSocket message:", error);
|
|
14468
|
+
}
|
|
14469
|
+
});
|
|
14470
|
+
socket.value.onclose = (event) => {
|
|
14471
|
+
if (event.code === 4001) {
|
|
14472
|
+
errorRef.value = event.reason || "Connection closed by server";
|
|
14473
|
+
}
|
|
14474
|
+
stopRecording();
|
|
14475
|
+
};
|
|
14476
|
+
socket.value.onerror = () => {
|
|
14477
|
+
errorRef.value = "Service connection error";
|
|
14478
|
+
stopRecording();
|
|
14479
|
+
};
|
|
14480
|
+
};
|
|
14481
|
+
const onMediaRecorderDataAvailable = (event) => __async2(this, null, function* () {
|
|
14482
|
+
var _a, _b;
|
|
14483
|
+
if (!isSocketReady.value || ((_a = socket.value) == null ? void 0 : _a.readyState) !== WebSocket.OPEN) {
|
|
14484
|
+
console.warn("Skipping audio chunk: socket not ready.");
|
|
14485
|
+
return;
|
|
14486
|
+
}
|
|
14487
|
+
const audioBuffer = yield event.data.arrayBuffer();
|
|
14488
|
+
const header = buildSocketMessageFrameHeader("audio-chunk", audioBuffer.byteLength);
|
|
14489
|
+
const buffer = new Uint8Array(header.length + audioBuffer.byteLength);
|
|
14490
|
+
buffer.set(header, 0);
|
|
14491
|
+
buffer.set(new Uint8Array(audioBuffer), header.length);
|
|
14492
|
+
(_b = socket.value) == null ? void 0 : _b.send(buffer);
|
|
14493
|
+
});
|
|
14494
|
+
const startRecording = () => __async2(this, null, function* () {
|
|
14495
|
+
var _a, _b;
|
|
14496
|
+
try {
|
|
14497
|
+
mediaStream.value = yield navigator.mediaDevices.getUserMedia({
|
|
14498
|
+
video: false,
|
|
14499
|
+
audio: {
|
|
14500
|
+
channelCount: 1,
|
|
14501
|
+
echoCancellation: true,
|
|
14502
|
+
sampleRate: options.sampleRate || 16e3
|
|
14503
|
+
}
|
|
14504
|
+
});
|
|
14505
|
+
mediaRecorder.value = new MediaRecorder(mediaStream.value, {
|
|
14506
|
+
mimeType: "audio/webm; codecs=opus"
|
|
14507
|
+
});
|
|
14508
|
+
mediaRecorder.value.ondataavailable = onMediaRecorderDataAvailable;
|
|
14509
|
+
mediaRecorder.value.start(timeSliceLength.value);
|
|
14510
|
+
isRecording.value = true;
|
|
14511
|
+
} catch (error) {
|
|
14512
|
+
if (error.name === "NotAllowedError") {
|
|
14513
|
+
errorRef.value = ((_a = options.labels) == null ? void 0 : _a.microphoneNotAllowed) || "Microphone access denied. Please allow microphone access in your browser settings.";
|
|
14514
|
+
} else if (error.name === "NotFoundError") {
|
|
14515
|
+
errorRef.value = ((_b = options.labels) == null ? void 0 : _b.microphoneNotFound) || "No microphone found. Please connect a microphone and try again.";
|
|
14516
|
+
}
|
|
14517
|
+
}
|
|
14518
|
+
});
|
|
14519
|
+
const stopRecording = () => {
|
|
14520
|
+
var _a, _b;
|
|
14521
|
+
(_a = mediaRecorder.value) == null ? void 0 : _a.stop();
|
|
14522
|
+
(_b = mediaStream.value) == null ? void 0 : _b.getTracks().forEach((track2) => {
|
|
14523
|
+
track2.stop();
|
|
14524
|
+
});
|
|
14525
|
+
isRecording.value = false;
|
|
14526
|
+
};
|
|
14527
|
+
const stopSocketConnection = () => {
|
|
14528
|
+
if (socket.value && socket.value.readyState === WebSocket.OPEN) {
|
|
14529
|
+
const endHeader = buildSocketMessageFrameHeader("audio-chunk-end", 0);
|
|
14530
|
+
socket.value.send(endHeader);
|
|
14531
|
+
setTimeout(() => {
|
|
14532
|
+
closeSocket();
|
|
14533
|
+
}, 1e3);
|
|
14534
|
+
}
|
|
14535
|
+
};
|
|
14536
|
+
const closeSocket = () => {
|
|
14537
|
+
var _a;
|
|
14538
|
+
(_a = socket.value) == null ? void 0 : _a.close();
|
|
14539
|
+
socket.value = null;
|
|
14540
|
+
isSocketReady.value = false;
|
|
14541
|
+
};
|
|
14542
|
+
const reset = () => {
|
|
14543
|
+
stopRecording();
|
|
14544
|
+
closeSocket();
|
|
14545
|
+
transcription.value = "";
|
|
14546
|
+
errorRef.value = null;
|
|
14547
|
+
isRecording.value = false;
|
|
14548
|
+
isSocketReady.value = false;
|
|
14549
|
+
};
|
|
14550
|
+
return {
|
|
14551
|
+
isRecording,
|
|
14552
|
+
isSocketReady,
|
|
14553
|
+
transcription,
|
|
14554
|
+
errorRef,
|
|
14555
|
+
initSocket,
|
|
14556
|
+
startRecording,
|
|
14557
|
+
stopRecording,
|
|
14558
|
+
stopSocketConnection,
|
|
14559
|
+
reset,
|
|
14560
|
+
closeSocket
|
|
14561
|
+
};
|
|
14562
|
+
}
|
|
14563
|
+
const _hoisted_1$1l = {
|
|
14564
|
+
key: 0,
|
|
14565
|
+
class: "lupa-dialog-overlay"
|
|
14566
|
+
};
|
|
14567
|
+
const _hoisted_2$W = { class: "lupa-dialog-content" };
|
|
14568
|
+
const _hoisted_3$F = { class: "lupa-listening-text" };
|
|
14569
|
+
const _hoisted_4$v = { class: "lupa-mic-button-wrapper" };
|
|
14570
|
+
const _sfc_main$1y = /* @__PURE__ */ defineComponent({
|
|
14571
|
+
__name: "VoiceSearchDialog",
|
|
14572
|
+
props: {
|
|
14573
|
+
isOpen: { type: Boolean },
|
|
14574
|
+
options: {}
|
|
14575
|
+
},
|
|
14576
|
+
emits: [
|
|
14577
|
+
"close",
|
|
14578
|
+
"transcript-update",
|
|
14579
|
+
"stop-recognize"
|
|
14580
|
+
],
|
|
14581
|
+
setup(__props, { expose: __expose, emit: emit2 }) {
|
|
14582
|
+
const props = __props;
|
|
14583
|
+
const optionsStore = useOptionsStore();
|
|
14584
|
+
const {
|
|
14585
|
+
isRecording,
|
|
14586
|
+
isSocketReady,
|
|
14587
|
+
transcription,
|
|
14588
|
+
errorRef,
|
|
14589
|
+
initSocket,
|
|
14590
|
+
stopSocketConnection,
|
|
14591
|
+
reset
|
|
14592
|
+
} = useVoiceRecorder(props.options);
|
|
14593
|
+
const clientId = ref(null);
|
|
14594
|
+
const voiceSearchProgressBar = ref(null);
|
|
14595
|
+
const timesliceLimit = computed(() => {
|
|
14596
|
+
var _a;
|
|
14597
|
+
return (_a = props.options.timesliceLimit) != null ? _a : 4;
|
|
14598
|
+
});
|
|
14599
|
+
const timeSliceLength = computed(() => {
|
|
14600
|
+
var _a;
|
|
14601
|
+
return (_a = props.options.timesliceLength) != null ? _a : 1e3;
|
|
14602
|
+
});
|
|
14603
|
+
const stopDelay = computed(() => {
|
|
14604
|
+
var _a;
|
|
14605
|
+
return (_a = props.options.stopDelay) != null ? _a : 700;
|
|
14606
|
+
});
|
|
14607
|
+
const labels = computed(() => {
|
|
14608
|
+
var _a;
|
|
14609
|
+
return (_a = props.options.labels) != null ? _a : {};
|
|
14610
|
+
});
|
|
14611
|
+
const description = computed(() => {
|
|
14612
|
+
var _a, _b;
|
|
14613
|
+
if (errorRef.value) {
|
|
14614
|
+
return errorRef.value;
|
|
14615
|
+
}
|
|
14616
|
+
if (!isSocketReady.value || !isRecording.value) {
|
|
14617
|
+
return (_a = labels.value.connecting) != null ? _a : "Connecting...";
|
|
14618
|
+
}
|
|
14619
|
+
return (_b = labels.value.listening) != null ? _b : "Listening...";
|
|
14620
|
+
});
|
|
14621
|
+
watch(transcription, (newValue) => {
|
|
14622
|
+
emit2("transcript-update", newValue);
|
|
14623
|
+
});
|
|
14624
|
+
watch(isRecording, (newVal) => {
|
|
14625
|
+
var _a, _b;
|
|
14626
|
+
if (newVal === true) {
|
|
14627
|
+
(_a = voiceSearchProgressBar.value) == null ? void 0 : _a.startProgressBar();
|
|
14628
|
+
} else {
|
|
14629
|
+
(_b = voiceSearchProgressBar.value) == null ? void 0 : _b.stopProgressBar();
|
|
14630
|
+
}
|
|
14631
|
+
});
|
|
14632
|
+
const handleRecordingButtonClick = () => {
|
|
14633
|
+
var _a;
|
|
14634
|
+
if (isRecording.value) {
|
|
14635
|
+
setTimeout(() => {
|
|
14636
|
+
stopSocketConnection();
|
|
14637
|
+
handleOnStopEvent();
|
|
14638
|
+
}, stopDelay.value);
|
|
14639
|
+
return;
|
|
14640
|
+
}
|
|
14641
|
+
const voiceServiceUrl = getVoiceServiceApiUrl(
|
|
14642
|
+
optionsStore.envOptions.environment,
|
|
14643
|
+
props.options.customVoiceServiceUrl
|
|
14644
|
+
);
|
|
14645
|
+
const socketUrl = `${voiceServiceUrl}?clientId=${clientId.value}&queryKey=${props.options.queryKey}&languageCode=${(_a = props.options.language) != null ? _a : "en-US"}&connectionType=write-first`;
|
|
14646
|
+
initSocket(socketUrl);
|
|
14647
|
+
setTimeout(() => {
|
|
14648
|
+
stopSocketConnection();
|
|
14649
|
+
handleOnStopEvent();
|
|
14650
|
+
}, timesliceLimit.value * timeSliceLength.value);
|
|
14651
|
+
};
|
|
14652
|
+
const handleOnStopEvent = () => {
|
|
14653
|
+
var _a;
|
|
14654
|
+
setTimeout(() => {
|
|
14655
|
+
if (errorRef.value)
|
|
14656
|
+
return;
|
|
14657
|
+
emit2("stop-recognize", transcription.value);
|
|
14658
|
+
}, 1500);
|
|
14659
|
+
(_a = voiceSearchProgressBar.value) == null ? void 0 : _a.stopProgressBar();
|
|
14660
|
+
};
|
|
14661
|
+
onMounted(() => {
|
|
14662
|
+
clientId.value = getSocketClientId();
|
|
14663
|
+
});
|
|
14664
|
+
onBeforeUnmount(() => {
|
|
14665
|
+
clientId.value = null;
|
|
14666
|
+
});
|
|
14667
|
+
const dialogReset = () => {
|
|
14668
|
+
var _a;
|
|
14669
|
+
reset();
|
|
14670
|
+
(_a = voiceSearchProgressBar.value) == null ? void 0 : _a.stopProgressBar();
|
|
14671
|
+
};
|
|
14672
|
+
__expose({
|
|
14673
|
+
handleRecordingButtonClick,
|
|
14674
|
+
reset: dialogReset
|
|
14675
|
+
});
|
|
14676
|
+
return (_ctx, _cache) => {
|
|
14677
|
+
return openBlock(), createElementBlock("div", null, [
|
|
14678
|
+
props.isOpen ? (openBlock(), createElementBlock("div", _hoisted_1$1l, [
|
|
14679
|
+
createBaseVNode("button", {
|
|
14680
|
+
class: "lupa-dialog-box-close-button",
|
|
14681
|
+
onClick: _cache[0] || (_cache[0] = () => emit2("close"))
|
|
14682
|
+
}),
|
|
14683
|
+
createBaseVNode("div", _hoisted_2$W, [
|
|
14684
|
+
createBaseVNode("p", _hoisted_3$F, toDisplayString(description.value), 1),
|
|
14685
|
+
createBaseVNode("div", _hoisted_4$v, [
|
|
14686
|
+
createBaseVNode("button", {
|
|
14687
|
+
class: normalizeClass(["lupa-mic-button", { recording: unref(isRecording) }]),
|
|
14688
|
+
onClick: handleRecordingButtonClick
|
|
14689
|
+
}, null, 2),
|
|
14690
|
+
createVNode(_sfc_main$1z, {
|
|
14691
|
+
ref_key: "voiceSearchProgressBar",
|
|
14692
|
+
ref: voiceSearchProgressBar,
|
|
14693
|
+
class: "lupa-progress-circle",
|
|
14694
|
+
isRecording: unref(isRecording),
|
|
14695
|
+
timesliceLimit: timesliceLimit.value,
|
|
14696
|
+
timeSliceLength: timeSliceLength.value
|
|
14697
|
+
}, null, 8, ["isRecording", "timesliceLimit", "timeSliceLength"])
|
|
14698
|
+
])
|
|
14699
|
+
])
|
|
14700
|
+
])) : createCommentVNode("", true)
|
|
14701
|
+
]);
|
|
14702
|
+
};
|
|
14703
|
+
}
|
|
14704
|
+
});
|
|
14315
14705
|
const _hoisted_1$1k = { id: "lupa-search-box-input-container" };
|
|
14316
14706
|
const _hoisted_2$V = { class: "lupa-input-clear" };
|
|
14317
14707
|
const _hoisted_3$E = { id: "lupa-search-box-input" };
|
|
@@ -14325,6 +14715,7 @@ const _hoisted_8$3 = {
|
|
|
14325
14715
|
key: 0,
|
|
14326
14716
|
class: "lupa-close-label"
|
|
14327
14717
|
};
|
|
14718
|
+
const _hoisted_9$3 = { key: 1 };
|
|
14328
14719
|
const _sfc_main$1x = /* @__PURE__ */ defineComponent({
|
|
14329
14720
|
__name: "SearchBoxInput",
|
|
14330
14721
|
props: {
|
|
@@ -14340,6 +14731,8 @@ const _sfc_main$1x = /* @__PURE__ */ defineComponent({
|
|
|
14340
14731
|
const searchBoxStore = useSearchBoxStore();
|
|
14341
14732
|
const { query } = storeToRefs(paramStore);
|
|
14342
14733
|
const mainInput = ref(null);
|
|
14734
|
+
const voiceDialogOverlay = ref(null);
|
|
14735
|
+
const isVoiceDialogOpen = ref(false);
|
|
14343
14736
|
const emitInputOnFocus = computed(() => {
|
|
14344
14737
|
var _a;
|
|
14345
14738
|
return (_a = props.emitInputOnFocus) != null ? _a : true;
|
|
@@ -14350,6 +14743,10 @@ const _sfc_main$1x = /* @__PURE__ */ defineComponent({
|
|
|
14350
14743
|
return (_a = props.suggestedValue) != null ? _a : { value: "", override: false, item: { suggestion: "" } };
|
|
14351
14744
|
}
|
|
14352
14745
|
);
|
|
14746
|
+
const isVoiceSearchEnabled = computed(() => {
|
|
14747
|
+
var _a, _b;
|
|
14748
|
+
return (_b = (_a = props.options.voiceSearch) == null ? void 0 : _a.enabled) != null ? _b : false;
|
|
14749
|
+
});
|
|
14353
14750
|
const labels = computed(() => props.options.labels);
|
|
14354
14751
|
const input2 = ref("");
|
|
14355
14752
|
const inputValue = computed({
|
|
@@ -14373,6 +14770,12 @@ const _sfc_main$1x = /* @__PURE__ */ defineComponent({
|
|
|
14373
14770
|
var _a;
|
|
14374
14771
|
return (_a = labels.value.searchInputAriaLabel) != null ? _a : "Search input";
|
|
14375
14772
|
});
|
|
14773
|
+
onMounted(() => {
|
|
14774
|
+
document.addEventListener("click", handleClickOutsideVoiceDialogOverlay);
|
|
14775
|
+
});
|
|
14776
|
+
onBeforeUnmount(() => {
|
|
14777
|
+
document.removeEventListener("click", handleClickOutsideVoiceDialogOverlay);
|
|
14778
|
+
});
|
|
14376
14779
|
watch(suggestedValue, () => {
|
|
14377
14780
|
if (suggestedValue.value.override) {
|
|
14378
14781
|
input2.value = suggestedValue.value.item.suggestion;
|
|
@@ -14407,6 +14810,37 @@ const _sfc_main$1x = /* @__PURE__ */ defineComponent({
|
|
|
14407
14810
|
}
|
|
14408
14811
|
(_a = mainInput == null ? void 0 : mainInput.value) == null ? void 0 : _a.focus();
|
|
14409
14812
|
};
|
|
14813
|
+
const openVoiceSearchDialog = () => {
|
|
14814
|
+
var _a;
|
|
14815
|
+
isVoiceDialogOpen.value = true;
|
|
14816
|
+
(_a = voiceDialogOverlay.value) == null ? void 0 : _a.handleRecordingButtonClick();
|
|
14817
|
+
};
|
|
14818
|
+
const closeDialog = () => {
|
|
14819
|
+
var _a;
|
|
14820
|
+
isVoiceDialogOpen.value = false;
|
|
14821
|
+
(_a = voiceDialogOverlay.value) == null ? void 0 : _a.reset();
|
|
14822
|
+
};
|
|
14823
|
+
const handleVoiceSearchOutput = (transcription) => {
|
|
14824
|
+
inputValue.value = transcription;
|
|
14825
|
+
handleSubmit();
|
|
14826
|
+
};
|
|
14827
|
+
const stopRecognition = (trascription) => {
|
|
14828
|
+
setTimeout(() => {
|
|
14829
|
+
isVoiceDialogOpen.value = false;
|
|
14830
|
+
handleVoiceSearchOutput(trascription);
|
|
14831
|
+
}, 500);
|
|
14832
|
+
};
|
|
14833
|
+
const handleClickOutsideVoiceDialogOverlay = (event) => {
|
|
14834
|
+
if (event.target.classList.contains("lupa-voice-search-button")) {
|
|
14835
|
+
return;
|
|
14836
|
+
}
|
|
14837
|
+
if (voiceDialogOverlay.value && voiceDialogOverlay.value.$el.contains(event.target)) {
|
|
14838
|
+
return;
|
|
14839
|
+
}
|
|
14840
|
+
if (isVoiceDialogOpen.value) {
|
|
14841
|
+
closeDialog();
|
|
14842
|
+
}
|
|
14843
|
+
};
|
|
14410
14844
|
__expose({ focus });
|
|
14411
14845
|
return (_ctx, _cache) => {
|
|
14412
14846
|
return openBlock(), createElementBlock("div", _hoisted_1$1k, [
|
|
@@ -14450,7 +14884,23 @@ const _sfc_main$1x = /* @__PURE__ */ defineComponent({
|
|
|
14450
14884
|
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("close"))
|
|
14451
14885
|
}, [
|
|
14452
14886
|
labels.value.close ? (openBlock(), createElementBlock("span", _hoisted_8$3, toDisplayString(labels.value.close), 1)) : createCommentVNode("", true)
|
|
14453
|
-
])) : createCommentVNode("", true)
|
|
14887
|
+
])) : createCommentVNode("", true),
|
|
14888
|
+
isVoiceSearchEnabled.value ? (openBlock(), createElementBlock("div", _hoisted_9$3, [
|
|
14889
|
+
createBaseVNode("button", {
|
|
14890
|
+
onClick: openVoiceSearchDialog,
|
|
14891
|
+
class: "lupa-voice-search-button"
|
|
14892
|
+
})
|
|
14893
|
+
])) : createCommentVNode("", true),
|
|
14894
|
+
isVoiceSearchEnabled.value ? (openBlock(), createBlock(_sfc_main$1y, {
|
|
14895
|
+
key: 2,
|
|
14896
|
+
ref_key: "voiceDialogOverlay",
|
|
14897
|
+
ref: voiceDialogOverlay,
|
|
14898
|
+
isOpen: isVoiceDialogOpen.value,
|
|
14899
|
+
options: props.options.voiceSearch,
|
|
14900
|
+
onClose: closeDialog,
|
|
14901
|
+
onTranscriptUpdate: handleVoiceSearchOutput,
|
|
14902
|
+
onStopRecognize: stopRecognition
|
|
14903
|
+
}, null, 8, ["isOpen", "options"])) : createCommentVNode("", true)
|
|
14454
14904
|
]);
|
|
14455
14905
|
};
|
|
14456
14906
|
}
|
|
@@ -23876,6 +24326,15 @@ const processDisplayCondition = (displayCondition, doc2 = {}) => {
|
|
|
23876
24326
|
return false;
|
|
23877
24327
|
}
|
|
23878
24328
|
};
|
|
24329
|
+
function shouldDisplay(displayOpt, doc2) {
|
|
24330
|
+
if (!displayOpt)
|
|
24331
|
+
return true;
|
|
24332
|
+
if (typeof displayOpt === "function") {
|
|
24333
|
+
return displayOpt(doc2);
|
|
24334
|
+
}
|
|
24335
|
+
const rules = Array.isArray(displayOpt) ? displayOpt : [displayOpt];
|
|
24336
|
+
return rules.every((rule2) => processDisplayCondition(rule2, doc2));
|
|
24337
|
+
}
|
|
23879
24338
|
const checkHasFullImageUrl = (imageUrl) => typeof imageUrl === "string" && (imageUrl.indexOf("http://") === 0 || imageUrl.indexOf("https://") === 0);
|
|
23880
24339
|
const computeImageUrl = (imageUrl, rootImageUrl) => {
|
|
23881
24340
|
const mainUrl = Array.isArray(imageUrl) ? imageUrl[0] : imageUrl;
|
|
@@ -24692,7 +25151,7 @@ const _sfc_main$1g = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
|
|
|
24692
25151
|
if (!element.display) {
|
|
24693
25152
|
return true;
|
|
24694
25153
|
}
|
|
24695
|
-
return
|
|
25154
|
+
return shouldDisplay(element.display, item);
|
|
24696
25155
|
});
|
|
24697
25156
|
const enhancedItem = computed(() => {
|
|
24698
25157
|
var _a, _b, _c, _d;
|
|
@@ -25015,7 +25474,7 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
|
|
|
25015
25474
|
if (!element.display) {
|
|
25016
25475
|
return true;
|
|
25017
25476
|
}
|
|
25018
|
-
return
|
|
25477
|
+
return shouldDisplay(element.display, item);
|
|
25019
25478
|
};
|
|
25020
25479
|
const badges = computed(() => {
|
|
25021
25480
|
if (!props.options.elements) {
|
|
@@ -25093,10 +25552,6 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
|
25093
25552
|
const badgeOptions = computed(() => {
|
|
25094
25553
|
return __spreadProps2(__spreadValues2({}, props.panelOptions.badges), { product: props.item });
|
|
25095
25554
|
});
|
|
25096
|
-
const imageElements = computed(() => {
|
|
25097
|
-
var _a, _b;
|
|
25098
|
-
return (_b = (_a = props.panelOptions.elements) == null ? void 0 : _a.filter((e2) => e2.type === DocumentElementType.IMAGE)) != null ? _b : [];
|
|
25099
|
-
});
|
|
25100
25555
|
const mainImageElement = computed(() => {
|
|
25101
25556
|
return imageElements.value[0];
|
|
25102
25557
|
});
|
|
@@ -25116,12 +25571,6 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
|
25116
25571
|
minWidth: widthOverride.value ? `${widthOverride.value + 10}px` : void 0
|
|
25117
25572
|
} : {};
|
|
25118
25573
|
});
|
|
25119
|
-
const detailElements = computed(() => {
|
|
25120
|
-
var _a, _b;
|
|
25121
|
-
return (_b = (_a = props.panelOptions.elements) == null ? void 0 : _a.filter(
|
|
25122
|
-
(e2) => e2.type !== DocumentElementType.IMAGE && e2.type !== DocumentElementType.ADDTOCART
|
|
25123
|
-
)) != null ? _b : [];
|
|
25124
|
-
});
|
|
25125
25574
|
const addToCartElement = computed(() => {
|
|
25126
25575
|
var _a;
|
|
25127
25576
|
return (_a = props.panelOptions.elements) == null ? void 0 : _a.find((e2) => e2.type === DocumentElementType.ADDTOCART);
|
|
@@ -25140,12 +25589,42 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
|
25140
25589
|
onMounted(() => {
|
|
25141
25590
|
checkIfIsInStock();
|
|
25142
25591
|
});
|
|
25143
|
-
const processIsInStock = () => {
|
|
25144
|
-
|
|
25145
|
-
|
|
25592
|
+
const processIsInStock = computed(() => {
|
|
25593
|
+
const raw = props.panelOptions.isInStock;
|
|
25594
|
+
if (!raw)
|
|
25595
|
+
return true;
|
|
25596
|
+
const rules = Array.isArray(raw) ? raw : [raw];
|
|
25597
|
+
return rules.every((rule2) => shouldDisplay(rule2, props.item));
|
|
25598
|
+
});
|
|
25146
25599
|
const checkIfIsInStock = () => __async2(this, null, function* () {
|
|
25147
|
-
isInStock.value = props.panelOptions.isInStock ? processIsInStock
|
|
25600
|
+
isInStock.value = props.panelOptions.isInStock ? processIsInStock.value : true;
|
|
25148
25601
|
});
|
|
25602
|
+
const imageElements = computed(
|
|
25603
|
+
() => {
|
|
25604
|
+
var _a, _b;
|
|
25605
|
+
return (_b = (_a = props.panelOptions.elements) == null ? void 0 : _a.filter((e2) => e2.type === DocumentElementType.IMAGE && !e2.group)) != null ? _b : [];
|
|
25606
|
+
}
|
|
25607
|
+
);
|
|
25608
|
+
const detailElements = computed(
|
|
25609
|
+
() => {
|
|
25610
|
+
var _a, _b;
|
|
25611
|
+
return (_b = (_a = props.panelOptions.elements) == null ? void 0 : _a.filter(
|
|
25612
|
+
(e2) => e2.type !== DocumentElementType.IMAGE && e2.type !== DocumentElementType.ADDTOCART && !e2.group
|
|
25613
|
+
)) != null ? _b : [];
|
|
25614
|
+
}
|
|
25615
|
+
);
|
|
25616
|
+
const elementGroups = computed(
|
|
25617
|
+
() => {
|
|
25618
|
+
var _a;
|
|
25619
|
+
return Array.from(
|
|
25620
|
+
new Set((_a = props.panelOptions.elements) == null ? void 0 : _a.map((e2) => e2.group).filter((g) => Boolean(g)))
|
|
25621
|
+
);
|
|
25622
|
+
}
|
|
25623
|
+
);
|
|
25624
|
+
function getGroupElements(group) {
|
|
25625
|
+
var _a, _b;
|
|
25626
|
+
return (_b = (_a = props.panelOptions.elements) == null ? void 0 : _a.filter((e2) => e2.group === group)) != null ? _b : [];
|
|
25627
|
+
}
|
|
25149
25628
|
return (_ctx, _cache) => {
|
|
25150
25629
|
return openBlock(), createElementBlock("a", mergeProps({
|
|
25151
25630
|
class: ["lupa-search-box-product", { "lupa-search-box-product-highlighted": _ctx.highlighted }],
|
|
@@ -25161,9 +25640,9 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
|
25161
25640
|
(openBlock(true), createElementBlock(Fragment, null, renderList(imageElements.value, (element) => {
|
|
25162
25641
|
return openBlock(), createBlock(_sfc_main$1g, {
|
|
25163
25642
|
class: "lupa-search-box-product-element",
|
|
25643
|
+
key: element.key,
|
|
25164
25644
|
item: _ctx.item,
|
|
25165
25645
|
element,
|
|
25166
|
-
key: element.key,
|
|
25167
25646
|
labels: _ctx.labels,
|
|
25168
25647
|
link: link.value
|
|
25169
25648
|
}, null, 8, ["item", "element", "labels", "link"]);
|
|
@@ -25173,14 +25652,14 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
|
25173
25652
|
(openBlock(true), createElementBlock(Fragment, null, renderList(detailElements.value, (element) => {
|
|
25174
25653
|
var _a;
|
|
25175
25654
|
return openBlock(), createBlock(_sfc_main$1g, {
|
|
25176
|
-
key: element.key,
|
|
25177
25655
|
class: "lupa-search-box-product-element",
|
|
25656
|
+
key: element.key,
|
|
25178
25657
|
item: _ctx.item,
|
|
25179
25658
|
element,
|
|
25180
25659
|
labels: _ctx.labels,
|
|
25181
25660
|
link: link.value
|
|
25182
25661
|
}, createSlots({ _: 2 }, [
|
|
25183
|
-
|
|
25662
|
+
((_a = badgeOptions.value) == null ? void 0 : _a.anchorElementKey) === element.key ? {
|
|
25184
25663
|
name: "badges",
|
|
25185
25664
|
fn: withCtx(() => [
|
|
25186
25665
|
createVNode(_sfc_main$19, {
|
|
@@ -25193,6 +25672,24 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
|
25193
25672
|
]), 1032, ["item", "element", "labels", "link"]);
|
|
25194
25673
|
}), 128))
|
|
25195
25674
|
]),
|
|
25675
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(elementGroups.value, (group) => {
|
|
25676
|
+
return openBlock(), createElementBlock("div", {
|
|
25677
|
+
key: group,
|
|
25678
|
+
class: normalizeClass(`lupa-search-box-group-${group}`)
|
|
25679
|
+
}, [
|
|
25680
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(getGroupElements(group), (element) => {
|
|
25681
|
+
return openBlock(), createBlock(_sfc_main$1g, {
|
|
25682
|
+
class: "lupa-search-box-product-element",
|
|
25683
|
+
key: element.key,
|
|
25684
|
+
item: _ctx.item,
|
|
25685
|
+
element,
|
|
25686
|
+
labels: _ctx.labels,
|
|
25687
|
+
link: link.value,
|
|
25688
|
+
isInStock: isInStock.value
|
|
25689
|
+
}, null, 8, ["item", "element", "labels", "link", "isInStock"]);
|
|
25690
|
+
}), 128))
|
|
25691
|
+
], 2);
|
|
25692
|
+
}), 128)),
|
|
25196
25693
|
addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_3$z, [
|
|
25197
25694
|
createVNode(_sfc_main$1g, {
|
|
25198
25695
|
class: "lupa-search-box-product-element",
|
|
@@ -25989,7 +26486,8 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
|
|
|
25989
26486
|
"labels",
|
|
25990
26487
|
"links",
|
|
25991
26488
|
"inputAttributes",
|
|
25992
|
-
"showSubmitButton"
|
|
26489
|
+
"showSubmitButton",
|
|
26490
|
+
"voiceSearch"
|
|
25993
26491
|
])
|
|
25994
26492
|
);
|
|
25995
26493
|
const panelOptions = computed(
|
|
@@ -26573,22 +27071,42 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
|
|
|
26573
27071
|
emits: ["remove"],
|
|
26574
27072
|
setup(__props, { emit: emit2 }) {
|
|
26575
27073
|
const props = __props;
|
|
26576
|
-
const facetKeyClass = computed(() => {
|
|
26577
|
-
|
|
27074
|
+
const facetKeyClass = computed(() => `lupa-facet-active-filter-${props.filter.key}`);
|
|
27075
|
+
const { searchResultOptions } = storeToRefs(useOptionsStore());
|
|
27076
|
+
const units = computed(() => {
|
|
27077
|
+
var _a, _b, _c, _d, _e;
|
|
27078
|
+
return (_e = (_d = (_c = (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.filters) == null ? void 0 : _b.facets) == null ? void 0 : _c.stats) == null ? void 0 : _d.units) != null ? _e : {};
|
|
26578
27079
|
});
|
|
26579
|
-
|
|
27080
|
+
function handleClick() {
|
|
26580
27081
|
emit2("remove", { filter: props.filter });
|
|
26581
|
-
}
|
|
27082
|
+
}
|
|
27083
|
+
function formatFilterValue(filter2) {
|
|
27084
|
+
const unit = units.value[filter2.key] || "";
|
|
27085
|
+
let min, max;
|
|
27086
|
+
if (Array.isArray(filter2.value)) {
|
|
27087
|
+
[min, max] = filter2.value.map(String);
|
|
27088
|
+
} else if (typeof filter2.value === "string" && filter2.value.includes("-")) {
|
|
27089
|
+
const parts = filter2.value.split("-").map((s) => s.trim());
|
|
27090
|
+
if (parts.length === 2)
|
|
27091
|
+
[min, max] = parts;
|
|
27092
|
+
}
|
|
27093
|
+
if (min != null && max != null) {
|
|
27094
|
+
return `${min} ${unit} – ${max} ${unit}`;
|
|
27095
|
+
}
|
|
27096
|
+
return `${filter2.value} ${unit}`.trim();
|
|
27097
|
+
}
|
|
26582
27098
|
return (_ctx, _cache) => {
|
|
26583
27099
|
return openBlock(), createElementBlock("div", {
|
|
26584
|
-
class: normalizeClass(["lupa-search-result-filter-value",
|
|
27100
|
+
class: normalizeClass(["lupa-search-result-filter-value", [facetKeyClass.value]]),
|
|
27101
|
+
"data-cy": "lupa-current-filter-item"
|
|
26585
27102
|
}, [
|
|
26586
27103
|
createBaseVNode("div", {
|
|
26587
27104
|
class: "lupa-current-filter-action",
|
|
26588
|
-
onClick: handleClick
|
|
26589
|
-
|
|
27105
|
+
onClick: handleClick,
|
|
27106
|
+
"aria-label": "Remove filter"
|
|
27107
|
+
}, " ⨉ "),
|
|
26590
27108
|
createBaseVNode("div", _hoisted_1$U, toDisplayString(_ctx.filter.label) + ": ", 1),
|
|
26591
|
-
createBaseVNode("div", _hoisted_2$F, toDisplayString(
|
|
27109
|
+
createBaseVNode("div", _hoisted_2$F, toDisplayString(formatFilterValue(props.filter)), 1)
|
|
26592
27110
|
], 2);
|
|
26593
27111
|
};
|
|
26594
27112
|
}
|
|
@@ -26610,6 +27128,14 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
|
|
|
26610
27128
|
expandable: { type: Boolean }
|
|
26611
27129
|
},
|
|
26612
27130
|
setup(__props) {
|
|
27131
|
+
const optionsStore = useOptionsStore();
|
|
27132
|
+
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
27133
|
+
const units = computed(
|
|
27134
|
+
() => {
|
|
27135
|
+
var _a, _b, _c, _d, _e;
|
|
27136
|
+
return (_e = (_d = (_c = (_b = (_a = searchResultOptions == null ? void 0 : searchResultOptions.value) == null ? void 0 : _a.filters) == null ? void 0 : _b.facets) == null ? void 0 : _c.stats) == null ? void 0 : _d.units) != null ? _e : {};
|
|
27137
|
+
}
|
|
27138
|
+
);
|
|
26613
27139
|
const isOpen = ref(false);
|
|
26614
27140
|
const paramsStore = useParamsStore();
|
|
26615
27141
|
const optionStore = useOptionsStore();
|
|
@@ -26691,8 +27217,9 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
|
|
|
26691
27217
|
return openBlock(), createBlock(_sfc_main$_, {
|
|
26692
27218
|
key: filter2.key + "_" + filter2.value,
|
|
26693
27219
|
filter: filter2,
|
|
27220
|
+
units: units.value,
|
|
26694
27221
|
onRemove: handleRemove
|
|
26695
|
-
}, null, 8, ["filter"]);
|
|
27222
|
+
}, null, 8, ["filter", "units"]);
|
|
26696
27223
|
}), 128))
|
|
26697
27224
|
]),
|
|
26698
27225
|
createBaseVNode("div", {
|
|
@@ -28016,15 +28543,17 @@ const _hoisted_4$j = {
|
|
|
28016
28543
|
const _hoisted_5$d = { class: "lupa-stats-from" };
|
|
28017
28544
|
const _hoisted_6$7 = ["max", "min", "pattern", "aria-label"];
|
|
28018
28545
|
const _hoisted_7$5 = { key: 0 };
|
|
28019
|
-
const _hoisted_8$1 =
|
|
28020
|
-
const _hoisted_9$1 = {
|
|
28546
|
+
const _hoisted_8$1 = { key: 1 };
|
|
28547
|
+
const _hoisted_9$1 = /* @__PURE__ */ createBaseVNode("div", { class: "lupa-stats-separator" }, null, -1);
|
|
28548
|
+
const _hoisted_10 = {
|
|
28021
28549
|
key: 0,
|
|
28022
28550
|
class: "lupa-stats-range-label"
|
|
28023
28551
|
};
|
|
28024
|
-
const
|
|
28025
|
-
const
|
|
28026
|
-
const
|
|
28027
|
-
const
|
|
28552
|
+
const _hoisted_11 = { class: "lupa-stats-to" };
|
|
28553
|
+
const _hoisted_12 = ["max", "min", "pattern", "aria-label"];
|
|
28554
|
+
const _hoisted_13 = { key: 0 };
|
|
28555
|
+
const _hoisted_14 = { key: 1 };
|
|
28556
|
+
const _hoisted_15 = {
|
|
28028
28557
|
key: 2,
|
|
28029
28558
|
class: "lupa-stats-slider-wrapper"
|
|
28030
28559
|
};
|
|
@@ -28091,7 +28620,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
28091
28620
|
if (!value || value > facetMax.value) {
|
|
28092
28621
|
return;
|
|
28093
28622
|
}
|
|
28094
|
-
innerSliderRange.value = [
|
|
28623
|
+
innerSliderRange.value = [sliderRange.value[1], value];
|
|
28095
28624
|
handleInputChange();
|
|
28096
28625
|
}
|
|
28097
28626
|
});
|
|
@@ -28147,7 +28676,18 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
28147
28676
|
});
|
|
28148
28677
|
const statsSummary = computed(() => {
|
|
28149
28678
|
const [min, max] = sliderRange.value;
|
|
28150
|
-
|
|
28679
|
+
if (isPrice.value) {
|
|
28680
|
+
return formatPriceSummary(
|
|
28681
|
+
[min, max],
|
|
28682
|
+
currency.value,
|
|
28683
|
+
separator.value,
|
|
28684
|
+
currencyTemplate.value
|
|
28685
|
+
);
|
|
28686
|
+
}
|
|
28687
|
+
if (unit.value) {
|
|
28688
|
+
return `${min} ${unit.value} - ${max} ${unit.value}`;
|
|
28689
|
+
}
|
|
28690
|
+
return formatRange({ gte: min, lte: max });
|
|
28151
28691
|
});
|
|
28152
28692
|
const separator = computed(() => {
|
|
28153
28693
|
var _a, _b, _c;
|
|
@@ -28208,6 +28748,12 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
28208
28748
|
const handleDragging = (value) => {
|
|
28209
28749
|
innerSliderRange.value = value;
|
|
28210
28750
|
};
|
|
28751
|
+
const unit = computed(
|
|
28752
|
+
() => {
|
|
28753
|
+
var _a, _b, _c, _d, _e;
|
|
28754
|
+
return (_e = (_d = (_a = props.options.stats) == null ? void 0 : _a.units) == null ? void 0 : _d[(_c = (_b = props.facet) == null ? void 0 : _b.key) != null ? _c : ""]) != null ? _e : "";
|
|
28755
|
+
}
|
|
28756
|
+
);
|
|
28211
28757
|
return (_ctx, _cache) => {
|
|
28212
28758
|
return openBlock(), createElementBlock("div", _hoisted_1$P, [
|
|
28213
28759
|
!isInputVisible.value ? (openBlock(), createElementBlock("div", _hoisted_2$B, toDisplayString(statsSummary.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$s, [
|
|
@@ -28230,13 +28776,14 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
28230
28776
|
{ lazy: true }
|
|
28231
28777
|
]
|
|
28232
28778
|
]),
|
|
28233
|
-
isPrice.value ? (openBlock(), createElementBlock("span", _hoisted_7$5, toDisplayString(currency.value), 1)) : createCommentVNode("", true)
|
|
28779
|
+
isPrice.value ? (openBlock(), createElementBlock("span", _hoisted_7$5, toDisplayString(currency.value), 1)) : createCommentVNode("", true),
|
|
28780
|
+
unit.value ? (openBlock(), createElementBlock("span", _hoisted_8$1, toDisplayString(unit.value), 1)) : createCommentVNode("", true)
|
|
28234
28781
|
])
|
|
28235
28782
|
]),
|
|
28236
|
-
|
|
28783
|
+
_hoisted_9$1,
|
|
28237
28784
|
createBaseVNode("div", null, [
|
|
28238
|
-
rangeLabelTo.value ? (openBlock(), createElementBlock("div",
|
|
28239
|
-
createBaseVNode("div",
|
|
28785
|
+
rangeLabelTo.value ? (openBlock(), createElementBlock("div", _hoisted_10, toDisplayString(rangeLabelTo.value), 1)) : createCommentVNode("", true),
|
|
28786
|
+
createBaseVNode("div", _hoisted_11, [
|
|
28240
28787
|
withDirectives(createBaseVNode("input", {
|
|
28241
28788
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => toValue.value = $event),
|
|
28242
28789
|
type: "text",
|
|
@@ -28245,7 +28792,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
28245
28792
|
min: facetMin.value,
|
|
28246
28793
|
pattern: sliderInputFormat.value,
|
|
28247
28794
|
"aria-label": ariaLabelTo.value
|
|
28248
|
-
}, null, 8,
|
|
28795
|
+
}, null, 8, _hoisted_12), [
|
|
28249
28796
|
[
|
|
28250
28797
|
vModelText,
|
|
28251
28798
|
toValue.value,
|
|
@@ -28253,11 +28800,12 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
28253
28800
|
{ lazy: true }
|
|
28254
28801
|
]
|
|
28255
28802
|
]),
|
|
28256
|
-
isPrice.value ? (openBlock(), createElementBlock("span",
|
|
28803
|
+
isPrice.value ? (openBlock(), createElementBlock("span", _hoisted_13, toDisplayString(currency.value), 1)) : createCommentVNode("", true),
|
|
28804
|
+
unit.value ? (openBlock(), createElementBlock("span", _hoisted_14, toDisplayString(unit.value), 1)) : createCommentVNode("", true)
|
|
28257
28805
|
])
|
|
28258
28806
|
])
|
|
28259
28807
|
])),
|
|
28260
|
-
isSliderVisible.value ? (openBlock(), createElementBlock("div",
|
|
28808
|
+
isSliderVisible.value ? (openBlock(), createElementBlock("div", _hoisted_15, [
|
|
28261
28809
|
createVNode(unref(m), {
|
|
28262
28810
|
class: "slider",
|
|
28263
28811
|
tooltips: false,
|
|
@@ -30138,14 +30686,9 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
|
|
|
30138
30686
|
const enhancementData = (_d = (_c = dynamicDataIdMap.value) == null ? void 0 : _c[(_b = props.item) == null ? void 0 : _b.id]) != null ? _d : {};
|
|
30139
30687
|
return __spreadValues2(__spreadValues2({}, props.item), enhancementData);
|
|
30140
30688
|
});
|
|
30141
|
-
const displayElement = computed(
|
|
30142
|
-
|
|
30143
|
-
|
|
30144
|
-
if (!element.display) {
|
|
30145
|
-
return true;
|
|
30146
|
-
}
|
|
30147
|
-
return typeof element.display === "function" ? element.display(item) : processDisplayCondition(element.display, item);
|
|
30148
|
-
});
|
|
30689
|
+
const displayElement = computed(
|
|
30690
|
+
() => shouldDisplay(props.element.display, enhancedItem.value)
|
|
30691
|
+
);
|
|
30149
30692
|
const dynamicAttributes = computed(() => {
|
|
30150
30693
|
return getDynamicAttributes(props.element.dynamicAttributes, enhancedItem.value);
|
|
30151
30694
|
});
|
|
@@ -30273,15 +30816,21 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
30273
30816
|
var _a, _b;
|
|
30274
30817
|
return (_b = (_a = props.options.elements) == null ? void 0 : _a.filter((e2) => e2.group === group)) != null ? _b : [];
|
|
30275
30818
|
};
|
|
30276
|
-
const
|
|
30277
|
-
|
|
30819
|
+
const shouldShowInStock = () => {
|
|
30820
|
+
const raw = props.options.isInStock;
|
|
30821
|
+
if (!raw)
|
|
30822
|
+
return true;
|
|
30823
|
+
const rules = Array.isArray(raw) ? raw : [raw];
|
|
30824
|
+
return rules.every(
|
|
30825
|
+
(rule2) => typeof rule2 === "function" ? rule2(props.product) : processDisplayCondition(rule2, props.product)
|
|
30826
|
+
);
|
|
30827
|
+
};
|
|
30828
|
+
const checkIfIsInStock = () => {
|
|
30829
|
+
isInStock.value = shouldShowInStock();
|
|
30278
30830
|
};
|
|
30279
30831
|
onMounted(() => {
|
|
30280
30832
|
checkIfIsInStock();
|
|
30281
30833
|
});
|
|
30282
|
-
const checkIfIsInStock = () => __async2(this, null, function* () {
|
|
30283
|
-
isInStock.value = props.options.isInStock ? yield processIsInStock() : true;
|
|
30284
|
-
});
|
|
30285
30834
|
const handleClick = () => {
|
|
30286
30835
|
var _a, _b, _c, _d;
|
|
30287
30836
|
const event = {
|
|
@@ -33160,21 +33709,6 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
33160
33709
|
};
|
|
33161
33710
|
}
|
|
33162
33711
|
});
|
|
33163
|
-
const Env = {
|
|
33164
|
-
production: "https://api.lupasearch.com/v1/",
|
|
33165
|
-
staging: "https://api.staging.lupasearch.com/v1/"
|
|
33166
|
-
};
|
|
33167
|
-
const DEFAULT_REQUEST_CONFIG = {
|
|
33168
|
-
method: "POST",
|
|
33169
|
-
headers: { "Content-Type": "application/json" }
|
|
33170
|
-
};
|
|
33171
|
-
const DEFAULT_HEADERS = DEFAULT_REQUEST_CONFIG.headers;
|
|
33172
|
-
const getApiUrl = (environment, customBaseUrl) => {
|
|
33173
|
-
if (customBaseUrl) {
|
|
33174
|
-
return customBaseUrl;
|
|
33175
|
-
}
|
|
33176
|
-
return Env[environment] || Env["production"];
|
|
33177
|
-
};
|
|
33178
33712
|
const suggestSearchChatPhrases = (options, request, chatSettings) => __async2(void 0, null, function* () {
|
|
33179
33713
|
var _a, _b, _c;
|
|
33180
33714
|
const { environment, customBaseUrl } = options;
|
|
@@ -33681,7 +34215,7 @@ const _hoisted_4 = {
|
|
|
33681
34215
|
key: 0,
|
|
33682
34216
|
class: "lupasearch-chat-content"
|
|
33683
34217
|
};
|
|
33684
|
-
const _sfc_main$
|
|
34218
|
+
const _sfc_main$1A = /* @__PURE__ */ defineComponent({
|
|
33685
34219
|
__name: "ChatContainer",
|
|
33686
34220
|
props: {
|
|
33687
34221
|
options: {}
|
|
@@ -40335,7 +40869,7 @@ const chat = (options, mountOptions) => {
|
|
|
40335
40869
|
const instance = createVue(
|
|
40336
40870
|
options.displayOptions.containerSelector,
|
|
40337
40871
|
mountOptions == null ? void 0 : mountOptions.mountingBehavior,
|
|
40338
|
-
_sfc_main$
|
|
40872
|
+
_sfc_main$1A,
|
|
40339
40873
|
{
|
|
40340
40874
|
options
|
|
40341
40875
|
}
|