vue-instantsearch 4.4.1 → 4.4.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/CHANGELOG.md +10 -0
- package/package.json +1 -1
- package/src/components/SearchBox.vue +9 -0
- package/src/components/VoiceSearch.vue +10 -0
- package/vue2/cjs/index.js +1 -1
- package/vue2/cjs/index.js.map +1 -1
- package/vue2/es/package.json.js +1 -1
- package/vue2/es/src/components/SearchBox.vue.js +1 -1
- package/vue2/es/src/components/SearchBox.vue.js.map +1 -1
- package/vue2/es/src/components/VoiceSearch.vue.js +1 -1
- package/vue2/es/src/components/VoiceSearch.vue.js.map +1 -1
- package/vue2/umd/index.js +1 -1
- package/vue2/umd/index.js.map +1 -1
- package/vue3/cjs/index.js +1 -1
- package/vue3/cjs/index.js.map +1 -1
- package/vue3/es/package.json.js +1 -1
- package/vue3/es/src/components/SearchBox.vue_vue&type=script&lang.js +1 -1
- package/vue3/es/src/components/SearchBox.vue_vue&type=script&lang.js.map +1 -1
- package/vue3/es/src/components/SearchBox.vue_vue&type=template&id=27029d83&lang.js.map +1 -1
- package/vue3/es/src/components/VoiceSearch.vue_vue&type=script&lang.js +1 -1
- package/vue3/es/src/components/VoiceSearch.vue_vue&type=script&lang.js.map +1 -1
- package/vue3/es/src/components/VoiceSearch.vue_vue&type=template&id=24b0f67a&lang.js.map +1 -1
- package/vue3/umd/index.js +1 -1
- package/vue3/umd/index.js.map +1 -1
package/vue2/es/package.json.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var r="4.4.
|
|
1
|
+
var r="4.4.2";export{r as version};
|
|
2
2
|
//# sourceMappingURL=package.json.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createSuitMixin as e}from"../mixins/suit.js";import{isVue2 as t,isVue3 as i}from"../util/vue-compat/index-vue2.js";import{createWidgetMixin as n}from"../mixins/widget.js";import{connectSearchBox as
|
|
1
|
+
import{createSuitMixin as e}from"../mixins/suit.js";import{isVue2 as t,isVue3 as i}from"../util/vue-compat/index-vue2.js";import{createWidgetMixin as n}from"../mixins/widget.js";import{connectSearchBox as o}from"instantsearch.js/es/connectors/index.js";import s from"./SearchInput.vue.js";export default{render:function(){var e=this,t=e.$createElement,i=e._self._c||t;return e.state?i("div",{class:e.suit()},[e._t("default",[i("search-input",{ref:"searchInput",attrs:{placeholder:e.placeholder,autofocus:e.autofocus,"show-loading-indicator":e.showLoadingIndicator,"should-show-loading-indicator":e.state.isSearchStalled,"submit-title":e.submitTitle,"reset-title":e.resetTitle,"class-names":e.classNames},on:{focus:function(t){return e.$emit("focus",t)},blur:function(t){return e.$emit("blur",t)},reset:function(t){return e.$emit("reset")}},scopedSlots:e._u([e.isVue3?{key:"loading-indicator",fn:function(t){return[e._t("loading-indicator")]}}:null,e.isVue3?{key:"submit-icon",fn:function(t){return[e._t("submit-icon")]}}:null,e.isVue3?{key:"reset-icon",fn:function(t){return[e._t("reset-icon")]}}:null],!0),model:{value:e.currentRefinement,callback:function(t){e.currentRefinement=t},expression:"currentRefinement"}},[e._v(" "),e.isVue2?e._t("loading-indicator",null,{slot:"loading-indicator"}):e._e(),e._v(" "),e._v(" "),e.isVue2?e._t("submit-icon",null,{slot:"submit-icon"}):e._e(),e._v(" "),e._v(" "),e.isVue2?e._t("reset-icon",null,{slot:"reset-icon"}):e._e()],2)],{currentRefinement:e.currentRefinement,isSearchStalled:e.state.isSearchStalled,refine:e.state.refine})],2):e._e()},staticRenderFns:[],name:"AisSearchBox",mixins:[n({connector:o},{$$widgetType:"ais.searchBox"}),e({name:"SearchBox"})],components:{SearchInput:s},props:{placeholder:{type:String,default:"Search here…"},autofocus:{type:Boolean,default:!1},showLoadingIndicator:{type:Boolean,default:!1},submitTitle:{type:String,default:"Search"},resetTitle:{type:String,default:"Clear"},value:{type:String,default:void 0},modelValue:{type:String,default:void 0},queryHook:{type:Function,default:void 0}},data:function(){return{localValue:"",isVue2:t,isVue3:i}},computed:{widgetParams:function(){return{queryHook:this.queryHook}},isControlled:function(){return void 0!==this.value||void 0!==this.modelValue},model:function(){return this.value||this.modelValue},currentRefinement:{get:function(){this.isControlled&&this.model!==this.localValue&&(this.localValue=this.model,this.$emit("input",this.model),this.$emit("update:modelValue",this.model),this.state.refine(this.model));var e=this.$refs.searchInput;return e&&e.isFocused()?this.localValue:this.model||this.state.query||""},set:function(e){this.localValue=e,this.state.refine(e),this.isControlled&&(this.$emit("input",e),this.$emit("update:modelValue",e))}}}};
|
|
2
2
|
//# sourceMappingURL=SearchBox.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBox.vue.js","sources":["../../../../src/components/SearchBox.vue"],"sourcesContent":["<template>\n <div\n v-if=\"state\"\n :class=\"suit()\"\n >\n <slot\n :current-refinement=\"currentRefinement\"\n :is-search-stalled=\"state.isSearchStalled\"\n :refine=\"state.refine\"\n >\n <search-input\n @focus=\"$emit('focus', $event)\"\n @blur=\"$emit('blur', $event)\"\n @reset=\"$emit('reset')\"\n :placeholder=\"placeholder\"\n :autofocus=\"autofocus\"\n :show-loading-indicator=\"showLoadingIndicator\"\n :should-show-loading-indicator=\"state.isSearchStalled\"\n :submit-title=\"submitTitle\"\n :reset-title=\"resetTitle\"\n :class-names=\"classNames\"\n v-model=\"currentRefinement\"\n ref=\"searchInput\"\n >\n <template\n v-slot:loading-indicator\n v-if=\"isVue3\"\n >\n <slot\n name=\"loading-indicator\"\n />\n </template>\n <slot\n v-if=\"isVue2\"\n name=\"loading-indicator\"\n slot=\"loading-indicator\"\n />\n\n <template\n v-slot:submit-icon\n v-if=\"isVue3\"\n >\n <slot\n name=\"submit-icon\"\n />\n </template>\n <slot\n v-if=\"isVue2\"\n name=\"submit-icon\"\n slot=\"submit-icon\"\n />\n\n <template\n v-slot:reset-icon\n v-if=\"isVue3\"\n >\n <slot\n name=\"reset-icon\"\n />\n </template>\n <slot\n v-if=\"isVue2\"\n name=\"reset-icon\"\n slot=\"reset-icon\"\n />\n </search-input>\n </slot>\n </div>\n</template>\n\n<script>\nimport { connectSearchBox } from 'instantsearch.js/es/connectors';\nimport { createSuitMixin } from '../mixins/suit';\nimport { createWidgetMixin } from '../mixins/widget';\nimport { isVue3, isVue2 } from '../util/vue-compat';\nimport SearchInput from './SearchInput.vue';\n\nexport default {\n name: 'AisSearchBox',\n mixins: [\n createWidgetMixin(\n {\n connector: connectSearchBox,\n },\n {\n $$widgetType: 'ais.searchBox',\n }\n ),\n createSuitMixin({ name: 'SearchBox' }),\n ],\n components: {\n SearchInput,\n },\n props: {\n placeholder: {\n type: String,\n default: 'Search here…',\n },\n autofocus: {\n type: Boolean,\n default: false,\n },\n showLoadingIndicator: {\n type: Boolean,\n default: false,\n },\n submitTitle: {\n type: String,\n default: 'Search',\n },\n resetTitle: {\n type: String,\n default: 'Clear',\n },\n value: {\n type: String,\n default: undefined,\n },\n modelValue: {\n type: String,\n default: undefined,\n },\n },\n data() {\n return {\n localValue: '',\n isVue2,\n isVue3,\n };\n },\n computed: {\n isControlled() {\n return (\n typeof this.value !== 'undefined' ||\n typeof this.modelValue !== 'undefined'\n );\n },\n model() {\n return this.value || this.modelValue;\n },\n currentRefinement: {\n get() {\n // if the input is controlled, but not up to date\n // this means it didn't search, and we should pretend it was `set`\n if (this.isControlled && this.model !== this.localValue) {\n // eslint-disable-next-line vue/no-side-effects-in-computed-properties\n this.localValue = this.model;\n this.$emit('input', this.model);\n this.$emit('update:modelValue', this.model);\n this.state.refine(this.model);\n }\n\n // we return the local value if the input is focused to avoid\n // concurrent updates when typing\n const { searchInput } = this.$refs;\n if (searchInput && searchInput.isFocused()) {\n return this.localValue;\n }\n\n return this.model || this.state.query || '';\n },\n set(val) {\n this.localValue = val;\n this.state.refine(val);\n if (this.isControlled) {\n this.$emit('input', val);\n this.$emit('update:modelValue', val);\n }\n },\n },\n },\n};\n</script>\n"],"names":["render","name","mixins","createWidgetMixin","connector","connectSearchBox","$$widgetType","createSuitMixin","components","SearchInput","props","placeholder","type","String","default","autofocus","Boolean","showLoadingIndicator","submitTitle","resetTitle","value","undefined","modelValue","data","localValue","isVue2","isVue3","computed","
|
|
1
|
+
{"version":3,"file":"SearchBox.vue.js","sources":["../../../../src/components/SearchBox.vue"],"sourcesContent":["<template>\n <div\n v-if=\"state\"\n :class=\"suit()\"\n >\n <slot\n :current-refinement=\"currentRefinement\"\n :is-search-stalled=\"state.isSearchStalled\"\n :refine=\"state.refine\"\n >\n <search-input\n @focus=\"$emit('focus', $event)\"\n @blur=\"$emit('blur', $event)\"\n @reset=\"$emit('reset')\"\n :placeholder=\"placeholder\"\n :autofocus=\"autofocus\"\n :show-loading-indicator=\"showLoadingIndicator\"\n :should-show-loading-indicator=\"state.isSearchStalled\"\n :submit-title=\"submitTitle\"\n :reset-title=\"resetTitle\"\n :class-names=\"classNames\"\n v-model=\"currentRefinement\"\n ref=\"searchInput\"\n >\n <template\n v-slot:loading-indicator\n v-if=\"isVue3\"\n >\n <slot\n name=\"loading-indicator\"\n />\n </template>\n <slot\n v-if=\"isVue2\"\n name=\"loading-indicator\"\n slot=\"loading-indicator\"\n />\n\n <template\n v-slot:submit-icon\n v-if=\"isVue3\"\n >\n <slot\n name=\"submit-icon\"\n />\n </template>\n <slot\n v-if=\"isVue2\"\n name=\"submit-icon\"\n slot=\"submit-icon\"\n />\n\n <template\n v-slot:reset-icon\n v-if=\"isVue3\"\n >\n <slot\n name=\"reset-icon\"\n />\n </template>\n <slot\n v-if=\"isVue2\"\n name=\"reset-icon\"\n slot=\"reset-icon\"\n />\n </search-input>\n </slot>\n </div>\n</template>\n\n<script>\nimport { connectSearchBox } from 'instantsearch.js/es/connectors';\nimport { createSuitMixin } from '../mixins/suit';\nimport { createWidgetMixin } from '../mixins/widget';\nimport { isVue3, isVue2 } from '../util/vue-compat';\nimport SearchInput from './SearchInput.vue';\n\nexport default {\n name: 'AisSearchBox',\n mixins: [\n createWidgetMixin(\n {\n connector: connectSearchBox,\n },\n {\n $$widgetType: 'ais.searchBox',\n }\n ),\n createSuitMixin({ name: 'SearchBox' }),\n ],\n components: {\n SearchInput,\n },\n props: {\n placeholder: {\n type: String,\n default: 'Search here…',\n },\n autofocus: {\n type: Boolean,\n default: false,\n },\n showLoadingIndicator: {\n type: Boolean,\n default: false,\n },\n submitTitle: {\n type: String,\n default: 'Search',\n },\n resetTitle: {\n type: String,\n default: 'Clear',\n },\n value: {\n type: String,\n default: undefined,\n },\n modelValue: {\n type: String,\n default: undefined,\n },\n queryHook: {\n type: Function,\n default: undefined,\n },\n },\n data() {\n return {\n localValue: '',\n isVue2,\n isVue3,\n };\n },\n computed: {\n widgetParams() {\n return {\n queryHook: this.queryHook,\n };\n },\n isControlled() {\n return (\n typeof this.value !== 'undefined' ||\n typeof this.modelValue !== 'undefined'\n );\n },\n model() {\n return this.value || this.modelValue;\n },\n currentRefinement: {\n get() {\n // if the input is controlled, but not up to date\n // this means it didn't search, and we should pretend it was `set`\n if (this.isControlled && this.model !== this.localValue) {\n // eslint-disable-next-line vue/no-side-effects-in-computed-properties\n this.localValue = this.model;\n this.$emit('input', this.model);\n this.$emit('update:modelValue', this.model);\n this.state.refine(this.model);\n }\n\n // we return the local value if the input is focused to avoid\n // concurrent updates when typing\n const { searchInput } = this.$refs;\n if (searchInput && searchInput.isFocused()) {\n return this.localValue;\n }\n\n return this.model || this.state.query || '';\n },\n set(val) {\n this.localValue = val;\n this.state.refine(val);\n if (this.isControlled) {\n this.$emit('input', val);\n this.$emit('update:modelValue', val);\n }\n },\n },\n },\n};\n</script>\n"],"names":["render","name","mixins","createWidgetMixin","connector","connectSearchBox","$$widgetType","createSuitMixin","components","SearchInput","props","placeholder","type","String","default","autofocus","Boolean","showLoadingIndicator","submitTitle","resetTitle","value","undefined","modelValue","queryHook","Function","data","localValue","isVue2","isVue3","computed","widgetParams","this","isControlled","model","currentRefinement","get","$emit","state","refine","$refs","searchInput","isFocused","query","set","val"],"mappings":"+SA6Ee,CAACA,mxCACdC,KAAM,eACNC,OAAQ,CACNC,EACE,CACEC,UAAWC,GAEb,CACEC,aAAc,kBAGlBC,EAAgB,CAAEN,KAAM,eAE1BO,WAAY,aACVC,GAEFC,MAAO,CACLC,YAAa,CACXC,KAAMC,OACNC,QAAS,gBAEXC,UAAW,CACTH,KAAMI,QACNF,SAAS,GAEXG,qBAAsB,CACpBL,KAAMI,QACNF,SAAS,GAEXI,YAAa,CACXN,KAAMC,OACNC,QAAS,UAEXK,WAAY,CACVP,KAAMC,OACNC,QAAS,SAEXM,MAAO,CACLR,KAAMC,OACNC,aAASO,GAEXC,WAAY,CACVV,KAAMC,OACNC,aAASO,GAEXE,UAAW,CACTX,KAAMY,SACNV,aAASO,IAGbI,sBACS,CACLC,WAAY,UACZC,SACAC,IAGJC,SAAU,CACRC,8BACS,CACLP,UAAWQ,KAAKR,YAGpBS,oCAE0B,IAAfD,KAAKX,YACe,IAApBW,KAAKT,YAGhBW,wBACSF,KAAKX,OAASW,KAAKT,YAE5BY,kBAAmB,CACjBC,eAGMJ,KAAKC,cAAgBD,KAAKE,QAAUF,KAAKL,kBAEtCA,WAAaK,KAAKE,WAClBG,MAAM,QAASL,KAAKE,YACpBG,MAAM,oBAAqBL,KAAKE,YAChCI,MAAMC,OAAOP,KAAKE,cAKDF,KAAKQ,yBACzBC,GAAeA,EAAYC,YACtBV,KAAKL,WAGPK,KAAKE,OAASF,KAAKM,MAAMK,OAAS,IAE3CC,aAAIC,QACGlB,WAAakB,OACbP,MAAMC,OAAOM,GACdb,KAAKC,oBACFI,MAAM,QAASQ,QACfR,MAAM,oBAAqBQ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createSuitMixin as t}from"../mixins/suit.js";import{createWidgetMixin as e}from"../mixins/widget.js";import{connectVoiceSearch as
|
|
1
|
+
import{createSuitMixin as t}from"../mixins/suit.js";import{createWidgetMixin as e}from"../mixins/widget.js";import{connectVoiceSearch as i}from"instantsearch.js/es/connectors/index.js";export default{render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return t.state?i("div",{class:t.suit()},[t._t("default",[i("button",{class:t.suit("button"),attrs:{type:"button",title:t.state.isBrowserSupported?t.buttonTitle:t.disabledButtonTitle,disabled:!t.state.isBrowserSupported},on:{click:t.handleClick}},[t._t("buttonText",[t.errorNotAllowed?i("svg",t._b({},"svg",t.buttonSvgAttrs,!1),[i("line",{attrs:{x1:"1",y1:"1",x2:"23",y2:"23"}}),t._v(" "),i("path",{attrs:{d:"M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"}}),t._v(" "),i("path",{attrs:{d:"M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23"}}),t._v(" "),i("line",{attrs:{x1:"12",y1:"19",x2:"12",y2:"23"}}),t._v(" "),i("line",{attrs:{x1:"8",y1:"23",x2:"16",y2:"23"}})]):i("svg",t._b({},"svg",t.buttonSvgAttrs,!1),[i("path",{attrs:{d:"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z",fill:t.state.isListening?"currentColor":"none"}}),t._v(" "),i("path",{attrs:{d:"M19 10v2a7 7 0 0 1-14 0v-2"}}),t._v(" "),i("line",{attrs:{x1:"12",y1:"19",x2:"12",y2:"23"}}),t._v(" "),i("line",{attrs:{x1:"8",y1:"23",x2:"16",y2:"23"}})])],null,t.innerSlotProps)],2),t._v(" "),i("div",{class:t.suit("status")},[t._t("status",[i("p",[t._v(t._s(t.state.voiceListeningState.transcript))])],null,t.innerSlotProps)],2)],null,t.rootSlotProps)],2):t._e()},staticRenderFns:[],name:"AisVoiceSearch",mixins:[e({connector:i},{$$widgetType:"ais.voiceSearch"}),t({name:"VoiceSearch"})],props:{searchAsYouSpeak:{type:Boolean,required:!1,default:void 0},language:{type:String,default:void 0},additionalQueryParameters:{type:Object,default:void 0},buttonTitle:{type:String,required:!1,default:"Search by voice"},disabledButtonTitle:{type:String,required:!1,default:"Search by voice (not supported on this browser)"}},data:function(){return{buttonSvgAttrs:{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}}},computed:{widgetParams:function(){return{searchAsYouSpeak:this.searchAsYouSpeak,language:this.language,additionalQueryParameters:this.additionalQueryParameters}},errorNotAllowed:function(){return"error"===this.state.voiceListeningState.status&&"not-allowed"===this.state.voiceListeningState.errorCode},rootSlotProps:function(){return{isBrowserSupported:this.state.isBrowserSupported,isListening:this.state.isListening,toggleListening:this.state.toggleListening,voiceListeningState:this.state.voiceListeningState}},innerSlotProps:function(){return{status:this.state.voiceListeningState.status,errorCode:this.state.voiceListeningState.errorCode,isListening:this.state.isListening,transcript:this.state.voiceListeningState.transcript,isSpeechFinal:this.state.voiceListeningState.isSpeechFinal,isBrowserSupported:this.state.isBrowserSupported}}},methods:{handleClick:function(t){t.currentTarget.blur(),this.state.toggleListening()}}};
|
|
2
2
|
//# sourceMappingURL=VoiceSearch.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoiceSearch.vue.js","sources":["../../../../src/components/VoiceSearch.vue"],"sourcesContent":["<template>\n <div\n v-if=\"state\"\n :class=\"suit()\"\n >\n <slot v-bind=\"rootSlotProps\">\n <button\n type=\"button\"\n :class=\"suit('button')\"\n :title=\"state.isBrowserSupported ? buttonTitle : disabledButtonTitle\"\n :disabled=\"!state.isBrowserSupported\"\n @click=\"handleClick\"\n >\n <slot\n name=\"buttonText\"\n v-bind=\"innerSlotProps\"\n >\n <svg\n v-bind=\"buttonSvgAttrs\"\n v-if=\"errorNotAllowed\"\n >\n <line\n x1=\"1\"\n y1=\"1\"\n x2=\"23\"\n y2=\"23\"\n />\n <path d=\"M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6\" />\n <path d=\"M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23\" />\n <line\n x1=\"12\"\n y1=\"19\"\n x2=\"12\"\n y2=\"23\"\n />\n <line\n x1=\"8\"\n y1=\"23\"\n x2=\"16\"\n y2=\"23\"\n />\n </svg>\n <svg\n v-bind=\"buttonSvgAttrs\"\n v-else\n >\n <path\n d=\"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z\"\n :fill=\"state.isListening ? 'currentColor' : 'none'\"\n />\n <path d=\"M19 10v2a7 7 0 0 1-14 0v-2\" />\n <line\n x1=\"12\"\n y1=\"19\"\n x2=\"12\"\n y2=\"23\"\n />\n <line\n x1=\"8\"\n y1=\"23\"\n x2=\"16\"\n y2=\"23\"\n />\n </svg>\n </slot>\n </button>\n <div :class=\"suit('status')\">\n <slot\n name=\"status\"\n v-bind=\"innerSlotProps\"\n >\n <p>{{ state.voiceListeningState.transcript }}</p>\n </slot>\n </div>\n </slot>\n </div>\n</template>\n\n<script>\nimport { connectVoiceSearch } from 'instantsearch.js/es/connectors';\nimport { createSuitMixin } from '../mixins/suit';\nimport { createWidgetMixin } from '../mixins/widget';\n\nexport default {\n name: 'AisVoiceSearch',\n mixins: [\n createWidgetMixin(\n {\n connector: connectVoiceSearch,\n },\n {\n $$widgetType: 'ais.voiceSearch',\n }\n ),\n createSuitMixin({ name: 'VoiceSearch' }),\n ],\n props: {\n searchAsYouSpeak: {\n type: Boolean,\n required: false,\n default: undefined,\n },\n buttonTitle: {\n type: String,\n required: false,\n default: 'Search by voice',\n },\n disabledButtonTitle: {\n type: String,\n required: false,\n default: 'Search by voice (not supported on this browser)',\n },\n },\n data() {\n return {\n buttonSvgAttrs: {\n xmlns: 'http://www.w3.org/2000/svg',\n width: '16',\n height: '16',\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: '2',\n strokeLinecap: 'round',\n strokeLinejoin: 'round',\n },\n };\n },\n computed: {\n widgetParams() {\n return {\n searchAsYouSpeak: this.searchAsYouSpeak,\n };\n },\n errorNotAllowed() {\n return (\n this.state.voiceListeningState.status === 'error' &&\n this.state.voiceListeningState.errorCode === 'not-allowed'\n );\n },\n rootSlotProps() {\n return {\n isBrowserSupported: this.state.isBrowserSupported,\n isListening: this.state.isListening,\n toggleListening: this.state.toggleListening,\n voiceListeningState: this.state.voiceListeningState,\n };\n },\n innerSlotProps() {\n return {\n status: this.state.voiceListeningState.status,\n errorCode: this.state.voiceListeningState.errorCode,\n isListening: this.state.isListening,\n transcript: this.state.voiceListeningState.transcript,\n isSpeechFinal: this.state.voiceListeningState.isSpeechFinal,\n isBrowserSupported: this.state.isBrowserSupported,\n };\n },\n },\n methods: {\n handleClick(event) {\n event.currentTarget.blur();\n this.state.toggleListening();\n },\n },\n};\n</script>\n"],"names":["render","name","mixins","createWidgetMixin","connector","connectVoiceSearch","$$widgetType","createSuitMixin","props","searchAsYouSpeak","type","Boolean","required","default","undefined","
|
|
1
|
+
{"version":3,"file":"VoiceSearch.vue.js","sources":["../../../../src/components/VoiceSearch.vue"],"sourcesContent":["<template>\n <div\n v-if=\"state\"\n :class=\"suit()\"\n >\n <slot v-bind=\"rootSlotProps\">\n <button\n type=\"button\"\n :class=\"suit('button')\"\n :title=\"state.isBrowserSupported ? buttonTitle : disabledButtonTitle\"\n :disabled=\"!state.isBrowserSupported\"\n @click=\"handleClick\"\n >\n <slot\n name=\"buttonText\"\n v-bind=\"innerSlotProps\"\n >\n <svg\n v-bind=\"buttonSvgAttrs\"\n v-if=\"errorNotAllowed\"\n >\n <line\n x1=\"1\"\n y1=\"1\"\n x2=\"23\"\n y2=\"23\"\n />\n <path d=\"M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6\" />\n <path d=\"M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23\" />\n <line\n x1=\"12\"\n y1=\"19\"\n x2=\"12\"\n y2=\"23\"\n />\n <line\n x1=\"8\"\n y1=\"23\"\n x2=\"16\"\n y2=\"23\"\n />\n </svg>\n <svg\n v-bind=\"buttonSvgAttrs\"\n v-else\n >\n <path\n d=\"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z\"\n :fill=\"state.isListening ? 'currentColor' : 'none'\"\n />\n <path d=\"M19 10v2a7 7 0 0 1-14 0v-2\" />\n <line\n x1=\"12\"\n y1=\"19\"\n x2=\"12\"\n y2=\"23\"\n />\n <line\n x1=\"8\"\n y1=\"23\"\n x2=\"16\"\n y2=\"23\"\n />\n </svg>\n </slot>\n </button>\n <div :class=\"suit('status')\">\n <slot\n name=\"status\"\n v-bind=\"innerSlotProps\"\n >\n <p>{{ state.voiceListeningState.transcript }}</p>\n </slot>\n </div>\n </slot>\n </div>\n</template>\n\n<script>\nimport { connectVoiceSearch } from 'instantsearch.js/es/connectors';\nimport { createSuitMixin } from '../mixins/suit';\nimport { createWidgetMixin } from '../mixins/widget';\n\nexport default {\n name: 'AisVoiceSearch',\n mixins: [\n createWidgetMixin(\n {\n connector: connectVoiceSearch,\n },\n {\n $$widgetType: 'ais.voiceSearch',\n }\n ),\n createSuitMixin({ name: 'VoiceSearch' }),\n ],\n props: {\n searchAsYouSpeak: {\n type: Boolean,\n required: false,\n default: undefined,\n },\n language: {\n type: String,\n default: undefined,\n },\n additionalQueryParameters: {\n type: Object,\n default: undefined,\n },\n buttonTitle: {\n type: String,\n required: false,\n default: 'Search by voice',\n },\n disabledButtonTitle: {\n type: String,\n required: false,\n default: 'Search by voice (not supported on this browser)',\n },\n },\n data() {\n return {\n buttonSvgAttrs: {\n xmlns: 'http://www.w3.org/2000/svg',\n width: '16',\n height: '16',\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: '2',\n strokeLinecap: 'round',\n strokeLinejoin: 'round',\n },\n };\n },\n computed: {\n widgetParams() {\n return {\n searchAsYouSpeak: this.searchAsYouSpeak,\n language: this.language,\n additionalQueryParameters: this.additionalQueryParameters,\n };\n },\n errorNotAllowed() {\n return (\n this.state.voiceListeningState.status === 'error' &&\n this.state.voiceListeningState.errorCode === 'not-allowed'\n );\n },\n rootSlotProps() {\n return {\n isBrowserSupported: this.state.isBrowserSupported,\n isListening: this.state.isListening,\n toggleListening: this.state.toggleListening,\n voiceListeningState: this.state.voiceListeningState,\n };\n },\n innerSlotProps() {\n return {\n status: this.state.voiceListeningState.status,\n errorCode: this.state.voiceListeningState.errorCode,\n isListening: this.state.isListening,\n transcript: this.state.voiceListeningState.transcript,\n isSpeechFinal: this.state.voiceListeningState.isSpeechFinal,\n isBrowserSupported: this.state.isBrowserSupported,\n };\n },\n },\n methods: {\n handleClick(event) {\n event.currentTarget.blur();\n this.state.toggleListening();\n },\n },\n};\n</script>\n"],"names":["render","name","mixins","createWidgetMixin","connector","connectVoiceSearch","$$widgetType","createSuitMixin","props","searchAsYouSpeak","type","Boolean","required","default","undefined","language","String","additionalQueryParameters","Object","buttonTitle","disabledButtonTitle","data","buttonSvgAttrs","xmlns","width","height","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","computed","widgetParams","this","errorNotAllowed","state","voiceListeningState","status","errorCode","rootSlotProps","isBrowserSupported","isListening","toggleListening","innerSlotProps","transcript","isSpeechFinal","methods","handleClick","event","currentTarget","blur"],"mappings":"uMAmFe,CAACA,+yCACdC,KAAM,iBACNC,OAAQ,CACNC,EACE,CACEC,UAAWC,GAEb,CACEC,aAAc,oBAGlBC,EAAgB,CAAEN,KAAM,iBAE1BO,MAAO,CACLC,iBAAkB,CAChBC,KAAMC,QACNC,UAAU,EACVC,aAASC,GAEXC,SAAU,CACRL,KAAMM,OACNH,aAASC,GAEXG,0BAA2B,CACzBP,KAAMQ,OACNL,aAASC,GAEXK,YAAa,CACXT,KAAMM,OACNJ,UAAU,EACVC,QAAS,mBAEXO,oBAAqB,CACnBV,KAAMM,OACNJ,UAAU,EACVC,QAAS,oDAGbQ,sBACS,CACLC,eAAgB,CACdC,MAAO,6BACPC,MAAO,KACPC,OAAQ,KACRC,QAAS,YACTC,KAAM,OACNC,OAAQ,eACRC,YAAa,IACbC,cAAe,QACfC,eAAgB,WAItBC,SAAU,CACRC,8BACS,CACLxB,iBAAkByB,KAAKzB,iBACvBM,SAAUmB,KAAKnB,SACfE,0BAA2BiB,KAAKjB,4BAGpCkB,iCAE8C,UAA1CD,KAAKE,MAAMC,oBAAoBC,QACc,gBAA7CJ,KAAKE,MAAMC,oBAAoBE,WAGnCC,+BACS,CACLC,mBAAoBP,KAAKE,MAAMK,mBAC/BC,YAAaR,KAAKE,MAAMM,YACxBC,gBAAiBT,KAAKE,MAAMO,gBAC5BN,oBAAqBH,KAAKE,MAAMC,sBAGpCO,gCACS,CACLN,OAAQJ,KAAKE,MAAMC,oBAAoBC,OACvCC,UAAWL,KAAKE,MAAMC,oBAAoBE,UAC1CG,YAAaR,KAAKE,MAAMM,YACxBG,WAAYX,KAAKE,MAAMC,oBAAoBQ,WAC3CC,cAAeZ,KAAKE,MAAMC,oBAAoBS,cAC9CL,mBAAoBP,KAAKE,MAAMK,sBAIrCM,QAAS,CACPC,qBAAYC,GACVA,EAAMC,cAAcC,YACff,MAAMO"}
|