eat-js-sdk 2.7.1 → 2.7.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/dist/interaction-builder.mjs +57 -33
- package/package.json +1 -1
|
@@ -7649,8 +7649,10 @@ function getStimulusTextMaxHeight(fileAlignment, stimulusTextAlignment, hasMedia
|
|
|
7649
7649
|
const hasDefaultAlignment = hasMedia && fileAlignment === ALIGNMENT.DEFAULT || hasText && stimulusTextAlignment === ALIGNMENT.DEFAULT;
|
|
7650
7650
|
return hasDefaultAlignment ? "max-h-[660px]" : "max-h-[470px]";
|
|
7651
7651
|
}
|
|
7652
|
-
function configureHtmlString(htmlString, maxHeight = "") {
|
|
7653
|
-
|
|
7652
|
+
function configureHtmlString(htmlString, maxHeight = "", tableAriaLabel) {
|
|
7653
|
+
const labelAttr = tableAriaLabel ? ` aria-label="${tableAriaLabel.replace(/"/g, """)}"` : "";
|
|
7654
|
+
const tableAriaHidden = tableAriaLabel ? ' aria-hidden="true"' : "";
|
|
7655
|
+
return htmlString.replace(/<table>/g, `<div class="table-container ${maxHeight}" tabindex="0"${labelAttr}><table${tableAriaHidden}>`).replace(/<\/table>/g, "</table></div>");
|
|
7654
7656
|
}
|
|
7655
7657
|
function PromptSection($$anchor, $$props) {
|
|
7656
7658
|
push($$props, true);
|
|
@@ -8693,12 +8695,33 @@ function getTranscriptionSRText(html2) {
|
|
|
8693
8695
|
return toTranscriptionReadableText(plain);
|
|
8694
8696
|
}).replace(/<[^>]+>/g, "").replace(/<\/?eat-transcription>/gi, "").replace(/\s{2,}/g, " ").trim();
|
|
8695
8697
|
}
|
|
8696
|
-
|
|
8698
|
+
const STRUCTURAL_TAG_RE = /^(table|thead|tbody|tfoot|tr|th|td|caption|p|br|ul|ol|li|h[1-6]|blockquote)$/i;
|
|
8699
|
+
function getTranscriptionSRHtml(html2) {
|
|
8700
|
+
if (!html2) return "";
|
|
8701
|
+
const normalized = normalizeTranscriptionTags(html2);
|
|
8702
|
+
EAT_TRANSCRIPTION_RE.lastIndex = 0;
|
|
8703
|
+
let result = normalized.replace(EAT_TRANSCRIPTION_RE, (_full, content) => {
|
|
8704
|
+
let processed = content.replace(/<u>(.*?)<\/u>/gi, (_m, t2) => `stressed: ${t2.replace(/<[^>]+>/g, "").trim()}`);
|
|
8705
|
+
const plain = processed.replace(/<[^>]+>/g, "").trim();
|
|
8706
|
+
return toTranscriptionReadableText(plain);
|
|
8707
|
+
});
|
|
8708
|
+
result = result.replace(/<\/?eat-transcription>/gi, "");
|
|
8709
|
+
result = result.replace(/<(\/?)([a-zA-Z][a-zA-Z0-9]*)\b([^>]*)>/g, (_match, slash, tag, attrs) => {
|
|
8710
|
+
if (!STRUCTURAL_TAG_RE.test(tag)) return "";
|
|
8711
|
+
if (/^(th|td)$/i.test(tag) && !slash) {
|
|
8712
|
+
const safeAttrs = (attrs.match(/(?:scope|colspan|rowspan)="[^"]*"/gi) ?? []).join(" ");
|
|
8713
|
+
return `<${tag}${safeAttrs ? " " + safeAttrs : ""}>`;
|
|
8714
|
+
}
|
|
8715
|
+
return `<${slash}${tag}>`;
|
|
8716
|
+
});
|
|
8717
|
+
return result.replace(/<p>\s*<\/p>/g, "").replace(/\s{2,}/g, " ").trim();
|
|
8718
|
+
}
|
|
8719
|
+
var root_5$6 = /* @__PURE__ */ from_html(`<div class="sr-only"><!></div>`);
|
|
8697
8720
|
var root_4$5 = /* @__PURE__ */ from_html(`<div data-testid="stimulus-txt-ctr"><!> <!></div>`);
|
|
8698
8721
|
var root_6$3 = /* @__PURE__ */ from_html(`<div data-testid="stimulus-img-ctr"><!></div>`);
|
|
8699
8722
|
var root_3$b = /* @__PURE__ */ from_html(`<!> <!>`, 1);
|
|
8700
8723
|
var root_8$6 = /* @__PURE__ */ from_html(`<div data-testid="stimulus-img-ctr"><!></div>`);
|
|
8701
|
-
var root_10$3 = /* @__PURE__ */ from_html(`<
|
|
8724
|
+
var root_10$3 = /* @__PURE__ */ from_html(`<div class="sr-only"><!></div>`);
|
|
8702
8725
|
var root_9$4 = /* @__PURE__ */ from_html(`<div data-testid="stimulus-txt-ctr"><!> <!></div>`);
|
|
8703
8726
|
var root_7$5 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
|
|
8704
8727
|
var root_1$i = /* @__PURE__ */ from_html(`<div class="stimulus-section flex flex-col w-full"><!> <div><!></div></div>`);
|
|
@@ -8718,11 +8741,12 @@ function StimulusSection($$anchor, $$props) {
|
|
|
8718
8741
|
let isInlineMedia = /* @__PURE__ */ user_derived(() => stimulusData().fileAlignment === ALIGNMENT.INLINE);
|
|
8719
8742
|
let isInlineText = /* @__PURE__ */ user_derived(() => stimulusData().stimulusTextAlignment === ALIGNMENT.INLINE);
|
|
8720
8743
|
let isTextFirst = /* @__PURE__ */ user_derived(() => stimulusData().stimulusLayoutOrder === LAYOUT_ORDER.TEXT_FIRST);
|
|
8721
|
-
let
|
|
8744
|
+
let hasTranscription = /* @__PURE__ */ user_derived(() => /<eat-transcription>/i.test(stimulusData().stimulusText ?? ""));
|
|
8745
|
+
let stimulusSRText = /* @__PURE__ */ user_derived(() => get$1(hasTranscription) ? getTranscriptionSRText(stimulusData().stimulusText ?? "") : void 0);
|
|
8746
|
+
let configuredStimulusText = /* @__PURE__ */ user_derived(() => configureHtmlString(stimulusData().stimulusText, getStimulusTextMaxHeight(stimulusData().fileAlignment, stimulusData().stimulusTextAlignment, stimulusData().hasMedia, stimulusData().hasText), get$1(stimulusSRText)));
|
|
8722
8747
|
let configuredLongDescription = /* @__PURE__ */ user_derived(() => configureHtmlString(stimulusData().longDescription, getStimulusTextMaxHeight(stimulusData().fileAlignment, stimulusData().stimulusTextAlignment, stimulusData().hasMedia, stimulusData().hasText)));
|
|
8723
8748
|
const { segmentAndAnnotate } = useLanguageAnnotator();
|
|
8724
|
-
let
|
|
8725
|
-
let stimulusSRText = /* @__PURE__ */ user_derived(() => get$1(hasTranscription) ? segmentAndAnnotate(getTranscriptionSRText(stimulusData().stimulusText ?? "")) : "");
|
|
8749
|
+
let stimulusSRHtml = /* @__PURE__ */ user_derived(() => get$1(hasTranscription) ? segmentAndAnnotate(getTranscriptionSRHtml(stimulusData().stimulusText ?? "")) : "");
|
|
8726
8750
|
const shouldShowText = /* @__PURE__ */ user_derived(() => stimulusData().hasText && (stimulusData().stimulusTextAlignment === stimulusAlignment() || stimulusData().stimulusTextAlignment !== stimulusAlignment() && windowWidth.value < BREAKPOINTS.LG) && (!stimulusType() || stimulusType() === "stimulus-text"));
|
|
8727
8751
|
const shouldShowMedia = /* @__PURE__ */ user_derived(() => stimulusData().hasMedia && (stimulusData().fileAlignment === stimulusAlignment() || stimulusData().fileAlignment !== stimulusAlignment() && windowWidth.value < BREAKPOINTS.LG) && (!stimulusType() || stimulusType() === "stimulus-media"));
|
|
8728
8752
|
let textContainerClass = /* @__PURE__ */ user_derived(() => `stimulus-text ${get$1(isInlineText) ? "inline-text" : "block-text"}`);
|
|
@@ -8812,18 +8836,18 @@ function StimulusSection($$anchor, $$props) {
|
|
|
8812
8836
|
var node_5 = sibling(node_4, 2);
|
|
8813
8837
|
{
|
|
8814
8838
|
var consequent_1 = ($$anchor5) => {
|
|
8815
|
-
var
|
|
8816
|
-
var node_6 = child(
|
|
8817
|
-
html(node_6, () => get$1(
|
|
8818
|
-
reset(
|
|
8819
|
-
append($$anchor5,
|
|
8839
|
+
var div_3 = root_5$6();
|
|
8840
|
+
var node_6 = child(div_3);
|
|
8841
|
+
html(node_6, () => get$1(stimulusSRHtml));
|
|
8842
|
+
reset(div_3);
|
|
8843
|
+
append($$anchor5, div_3);
|
|
8820
8844
|
};
|
|
8821
8845
|
if_block(node_5, ($$render) => {
|
|
8822
8846
|
if (get$1(hasTranscription)) $$render(consequent_1);
|
|
8823
8847
|
});
|
|
8824
8848
|
}
|
|
8825
8849
|
reset(div_2);
|
|
8826
|
-
template_effect(() => set_class(div_2, 1, `stimulus-txt-ctr ${get$1(textContainerClass) ?? ""}`));
|
|
8850
|
+
template_effect(() => set_class(div_2, 1, `relative stimulus-txt-ctr ${get$1(textContainerClass) ?? ""}`));
|
|
8827
8851
|
append($$anchor4, div_2);
|
|
8828
8852
|
};
|
|
8829
8853
|
if_block(node_3, ($$render) => {
|
|
@@ -8833,9 +8857,9 @@ function StimulusSection($$anchor, $$props) {
|
|
|
8833
8857
|
var node_7 = sibling(node_3, 2);
|
|
8834
8858
|
{
|
|
8835
8859
|
var consequent_3 = ($$anchor4) => {
|
|
8836
|
-
var
|
|
8860
|
+
var div_4 = root_6$3();
|
|
8837
8861
|
let classes_2;
|
|
8838
|
-
var node_8 = child(
|
|
8862
|
+
var node_8 = child(div_4);
|
|
8839
8863
|
CommonMedia(node_8, {
|
|
8840
8864
|
get fileUrl() {
|
|
8841
8865
|
return stimulusData().fileUrl;
|
|
@@ -8857,9 +8881,9 @@ function StimulusSection($$anchor, $$props) {
|
|
|
8857
8881
|
return onexpandImage();
|
|
8858
8882
|
}
|
|
8859
8883
|
});
|
|
8860
|
-
reset(
|
|
8861
|
-
template_effect(() => classes_2 = set_class(
|
|
8862
|
-
append($$anchor4,
|
|
8884
|
+
reset(div_4);
|
|
8885
|
+
template_effect(() => classes_2 = set_class(div_4, 1, `stimulus-img-ctr ${get$1(mediaContainerClass) ?? ""}`, null, classes_2, { hidden: !get$1(shouldShowMedia) }));
|
|
8886
|
+
append($$anchor4, div_4);
|
|
8863
8887
|
};
|
|
8864
8888
|
if_block(node_7, ($$render) => {
|
|
8865
8889
|
if (stimulusData().hasMedia) $$render(consequent_3);
|
|
@@ -8872,9 +8896,9 @@ function StimulusSection($$anchor, $$props) {
|
|
|
8872
8896
|
var node_9 = first_child(fragment_3);
|
|
8873
8897
|
{
|
|
8874
8898
|
var consequent_5 = ($$anchor4) => {
|
|
8875
|
-
var
|
|
8899
|
+
var div_5 = root_8$6();
|
|
8876
8900
|
let classes_3;
|
|
8877
|
-
var node_10 = child(
|
|
8901
|
+
var node_10 = child(div_5);
|
|
8878
8902
|
CommonMedia(node_10, {
|
|
8879
8903
|
get fileUrl() {
|
|
8880
8904
|
return stimulusData().fileUrl;
|
|
@@ -8896,9 +8920,9 @@ function StimulusSection($$anchor, $$props) {
|
|
|
8896
8920
|
return onexpandImage();
|
|
8897
8921
|
}
|
|
8898
8922
|
});
|
|
8899
|
-
reset(
|
|
8900
|
-
template_effect(() => classes_3 = set_class(
|
|
8901
|
-
append($$anchor4,
|
|
8923
|
+
reset(div_5);
|
|
8924
|
+
template_effect(() => classes_3 = set_class(div_5, 1, `stimulus-img-ctr ${get$1(mediaContainerClass) ?? ""}`, null, classes_3, { hidden: !get$1(shouldShowMedia) }));
|
|
8925
|
+
append($$anchor4, div_5);
|
|
8902
8926
|
};
|
|
8903
8927
|
if_block(node_9, ($$render) => {
|
|
8904
8928
|
if (stimulusData().hasMedia) $$render(consequent_5);
|
|
@@ -8907,8 +8931,8 @@ function StimulusSection($$anchor, $$props) {
|
|
|
8907
8931
|
var node_11 = sibling(node_9, 2);
|
|
8908
8932
|
{
|
|
8909
8933
|
var consequent_7 = ($$anchor4) => {
|
|
8910
|
-
var
|
|
8911
|
-
var node_12 = child(
|
|
8934
|
+
var div_6 = root_9$4();
|
|
8935
|
+
var node_12 = child(div_6);
|
|
8912
8936
|
CommonStringToHtml(node_12, {
|
|
8913
8937
|
get htmlString() {
|
|
8914
8938
|
return get$1(configuredStimulusText);
|
|
@@ -8923,19 +8947,19 @@ function StimulusSection($$anchor, $$props) {
|
|
|
8923
8947
|
var node_13 = sibling(node_12, 2);
|
|
8924
8948
|
{
|
|
8925
8949
|
var consequent_6 = ($$anchor5) => {
|
|
8926
|
-
var
|
|
8927
|
-
var node_14 = child(
|
|
8928
|
-
html(node_14, () => get$1(
|
|
8929
|
-
reset(
|
|
8930
|
-
append($$anchor5,
|
|
8950
|
+
var div_7 = root_10$3();
|
|
8951
|
+
var node_14 = child(div_7);
|
|
8952
|
+
html(node_14, () => get$1(stimulusSRHtml));
|
|
8953
|
+
reset(div_7);
|
|
8954
|
+
append($$anchor5, div_7);
|
|
8931
8955
|
};
|
|
8932
8956
|
if_block(node_13, ($$render) => {
|
|
8933
8957
|
if (get$1(hasTranscription)) $$render(consequent_6);
|
|
8934
8958
|
});
|
|
8935
8959
|
}
|
|
8936
|
-
reset(
|
|
8937
|
-
template_effect(() => set_class(
|
|
8938
|
-
append($$anchor4,
|
|
8960
|
+
reset(div_6);
|
|
8961
|
+
template_effect(() => set_class(div_6, 1, `relative stimulus-txt-ctr ${get$1(textContainerClass) ?? ""}`));
|
|
8962
|
+
append($$anchor4, div_6);
|
|
8939
8963
|
};
|
|
8940
8964
|
if_block(node_11, ($$render) => {
|
|
8941
8965
|
if (get$1(shouldShowText)) $$render(consequent_7);
|