@salutejs/client
Advanced tools
Comparing version 1.33.1 to 1.33.2--canary.198.26c4207fa73d180e28e31248a316508b4baf5cfe.0
@@ -269,3 +269,3 @@ import Long from 'long'; | ||
setHints: (hints: string) => void; | ||
setHeaderButtons?: (headerButtons: SystemMessageHeaderByttonsType) => void; | ||
setHeaderButtons?: (headerButtons: string) => void; | ||
} | ||
@@ -272,0 +272,0 @@ export interface AssistantWindow { |
@@ -208,4 +208,4 @@ import { e as __spreadArray, a as __rest, _ as __assign, b as __awaiter, f as createNanoObservable, d as createNanoEvents, c as __generator } from './common-ba25e019.js'; | ||
} | ||
if (/[a-zA-Z]/.test('1.33.1')) { | ||
console.info('%cPlease use the latest version of SaluteJS Client. Your version is 1.33.1', 'color: yellow; font-size: 14px'); | ||
if (/[a-zA-Z]/.test('1.33.2--canary.198.26c4207fa73d180e28e31248a316508b4baf5cfe.0')) { | ||
console.info('%cPlease use the latest version of SaluteJS Client. Your version is 1.33.2--canary.198.26c4207fa73d180e28e31248a316508b4baf5cfe.0', 'color: yellow; font-size: 14px'); | ||
} | ||
@@ -251,3 +251,6 @@ if (typeof window !== 'undefined' && inIframe()) { | ||
setHeaderButtons: function (headerButtons) { | ||
postMessage_1({ type: 'setHeaderButtons', payload: JSON.stringify(headerButtons) }); | ||
postMessage_1({ | ||
type: 'setHeaderButtons', | ||
payload: typeof headerButtons === 'string' ? headerButtons : JSON.stringify(headerButtons), | ||
}); | ||
}, | ||
@@ -545,3 +548,3 @@ }; | ||
} | ||
(_b = window.AssistantHost) === null || _b === void 0 ? void 0 : _b.setHeaderButtons(headerButtons); | ||
(_b = window.AssistantHost) === null || _b === void 0 ? void 0 : _b.setHeaderButtons(JSON.stringify(headerButtons)); | ||
}, | ||
@@ -553,5 +556,5 @@ ready: readyFn, | ||
// eslint-disable-next-line no-underscore-dangle | ||
window.__ASSISTANT_CLIENT__ = { version: '1.33.1' }; | ||
window.__ASSISTANT_CLIENT__ = { version: '1.33.2--canary.198.26c4207fa73d180e28e31248a316508b4baf5cfe.0' }; | ||
} | ||
export { createAssistant }; |
{ | ||
"name": "@salutejs/client", | ||
"version": "1.33.1", | ||
"version": "1.33.2--canary.198.26c4207fa73d180e28e31248a316508b4baf5cfe.0", | ||
"description": "Модуль взаимодействия с виртуальным ассистентом", | ||
@@ -5,0 +5,0 @@ "author": "Salute Frontend Team <salute.developers@gmail.com>", |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).assistant={})}(this,(function(t){"use strict";var n,e=function(){return e=Object.assign||function(t){for(var n,e=1,o=arguments.length;e<o;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t},e.apply(this,arguments)};function o(t,n,e,o){return new(e||(e=Promise))((function(i,a){function r(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var n;t.done?i(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(r,s)}u((o=o.apply(t,n||[])).next())}))}function i(t,n){var e,o,i,a,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(e)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(e=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=n.call(t,r)}catch(t){s=[6,t],o=0}finally{e=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function a(t,n,e){if(e||2===arguments.length)for(var o,i=0,a=n.length;i<a;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return t.concat(o||Array.prototype.slice.call(n))}var r=new Uint8Array(16);function s(){if(!n&&!(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(r)}var u=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var d=[],c=0;c<256;++c)d.push((c+256).toString(16).substr(1));function l(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=(d[t[n+0]]+d[t[n+1]]+d[t[n+2]]+d[t[n+3]]+"-"+d[t[n+4]]+d[t[n+5]]+"-"+d[t[n+6]]+d[t[n+7]]+"-"+d[t[n+8]]+d[t[n+9]]+"-"+d[t[n+10]]+d[t[n+11]]+d[t[n+12]]+d[t[n+13]]+d[t[n+14]]+d[t[n+15]]).toLowerCase();if(!function(t){return"string"==typeof t&&u.test(t)}(e))throw TypeError("Stringified UUID is invalid");return e}function f(t,n,e){var o=(t=t||{}).random||(t.rng||s)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,n){e=e||0;for(var i=0;i<16;++i)n[e+i]=o[i];return n}return l(o)}var p,v,y,w,m=function(){var t={},n=function(n,e){return(t[n]=t[n]||[]).push(e),function(){t[n]=t[n].filter((function(t){return t!==e}))}};return{events:t,emit:function(n){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];for(var i=0,a=t[n]||[];i<a.length;i++){a[i].apply(void 0,e)}},on:n,once:function(t,e){var o=n(t,(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];e.apply(void 0,t),o()}));return o},clear:function(){t={}}}},g=function(t,n){if("object"!=typeof t||null===t)return t===n;if(Array.isArray(t))return!(!Array.isArray(n)||t.length!==n.length)&&!t.some((function(t,e){return!g(t,n[e])}));if("object"!=typeof n||null===n)return!1;var e=Object.entries(t),o=Object.entries(n);return e.length===o.length&&!e.some((function(t){var e=t[0],o=t[1];return!(e in n&&g(o,n[e]))}))},_=function(t,n){return"character"===n.type?t.findIndex((function(t){return"character"===t.type&&t.character.id===n.character.id})):["insets","minimum_static_insets","maximum_static_insets","dynamic_insets"].includes(n.type)?t.findIndex((function(t){return t.type===n.type})):"app_context"===n.type?t.findIndex((function(t){return"app_context"===t.type})):t.findIndex((function(t){return g(t,n)}))},h=(p=!1,v=[],y=[],w=[],{pull:function(){return p=!0,v=a([],window.appInitialData||[]),a([],v)},get:function(){return a([],window.appInitialData||[])},commit:function(){y=a([],window.appInitialData||[]),w=!0===p?(window.appInitialData||[]).filter((function(t){return!(_(v,t)>=0)})):a([],window.appInitialData||[])},diff:function(){return a([],w)},isCommitted:function(t){var n=_(y,t),e=n>=0;return e&&y.splice(n,1),e},find:function(t){var n=t.type,e=t.command,o=a([],window.appInitialData||[]).find((function(t){return!(e||!n||n!==t.type)||(e&&"smart_app_data"in t?e===t.smart_app_data.command||e===t.smart_app_data.type:void 0)}));return o&&"smart_app_data"in o?o.smart_app_data:o}}),b=["A","AUDIO","BUTTON","INPUT","OPTION","SELECT","TEXTAREA","VIDEO"];if(/[a-zA-Z]/.test("1.33.1")&&console.info("%cPlease use the latest version of SaluteJS Client. Your version is 1.33.1","color: yellow; font-size: 14px"),"undefined"!=typeof window&&function(){try{return window.self!==window.parent}catch(t){return!0}}()){var S=function(t){var n;null===(n=window.parent)||void 0===n||n.postMessage(JSON.stringify(t),"*")},A=function(){var t=window.location.href;window.history.back(),setTimeout((function(){window.location.href===t&&S({type:"close"})}),500)};window.appInitialData=[],window.AssistantHost={sendDataContainer:function(t){S({type:"sendDataContainer",payload:t})},close:function(){S({type:"close"})},sendData:function(t){S({type:"sendData",payload:t})},setSuggests:function(t){S({type:"setSuggests",payload:t})},setHints:function(t){S({type:"setHints",payload:t})},ready:function(){S({type:"ready"})},sendText:function(t){S({type:"sendText",payload:t})},setHeaderButtons:function(t){S({type:"setHeaderButtons",payload:JSON.stringify(t)})}},window.addEventListener("message",(function(t){var n,e,o,i,a,r,s,u;try{if("string"==typeof t.data){var d=JSON.parse(t.data);switch(d.type){case"onBack":A();break;case"onData":null===(e=null===(n=window.AssistantClient)||void 0===n?void 0:n.onData)||void 0===e||e.call(n,d.payload);break;case"onRequestState":var c=null===(i=null===(o=window.AssistantClient)||void 0===o?void 0:o.onRequestState)||void 0===i?void 0:i.call(o);S({type:"state",payload:c,requestId:d.requestId});break;case"onRequestRecoveryState":var l=null===(r=null===(a=window.AssistantClient)||void 0===a?void 0:a.onRequestRecoveryState)||void 0===r?void 0:r.call(a);S({type:"recoveryState",payload:l});break;case"onStart":null===(u=null===(s=window.AssistantClient)||void 0===s?void 0:s.onStart)||void 0===u||u.call(s);break;default:console.error(t,"Unknown parsed message")}}}catch(t){console.error(t,"Unknown message")}})),window.addEventListener("keydown",(function(t){var n,e;switch(t.code){case"Enter":document.activeElement&&!b.includes(document.activeElement.tagName)&&(null===(e=(n=document.activeElement).click)||void 0===e||e.call(n));break;case"Escape":A()}}))}"undefined"!=typeof window&&(window.__ASSISTANT_CLIENT__={version:"1.33.1"}),t.createAssistant=function(t){var n,a,r=t.getState,s=t.getRecoveryState,u=t.ready,d=void 0===u||u,c=m(),l=c.on,p=c.emit,v=m(),y=v.on,w=v.emit,g=new Map,_=r,b=s,S=!1,A=0,I=function(t){return"smart_app_data"===t.type&&p("command",t.smart_app_data),"smart_app_error"===t.type&&p("error",t.smart_app_error),p("data",t)},T=void 0!==(null===(n=window.AssistantHost)||void 0===n?void 0:n.cancelTts)?function(){var t,n;null===(n=(t=window.AssistantHost).cancelTts)||void 0===n||n.call(t,"")}:void 0,x=function(t){void 0===window.__ASSISTANT_CLIENT__.firstSmartAppDataMid&&(window.__ASSISTANT_CLIENT__.firstSmartAppDataMid=t)};window.AssistantClient={onData:function(t){var n,o,i,a,r;if(!h.isCommitted(t)&&(w(t.type,t),"smart_app_data"===t.type&&"-1"!==((null===(n=t.sdk_meta)||void 0===n?void 0:n.mid)||"-1")&&x(null===(o=t.sdk_meta)||void 0===o?void 0:o.mid),"system"!==t.type||"BACK"!==(null===(a=null===(i=t.system)||void 0===i?void 0:i.command)||void 0===a?void 0:a.toUpperCase()))){if("tts_state_update"===t.type&&p("tts",{state:t.state,owner:t.owner}),("smart_app_data"===t.type||"smart_app_error"===t.type)&&(null===(r=t.sdk_meta)||void 0===r?void 0:r.requestId)&&g.has(t.sdk_meta.requestId)){var s=t.sdk_meta;s.requestId;var u=function(t,n){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&n.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(t);i<o.length;i++)n.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(t,o[i])&&(e[o[i]]=t[o[i]])}return e}(s,["requestId"]),d=g.get(t.sdk_meta.requestId)||{},c=d.requestId,l=d.next;(Object.keys(u).length>0||c)&&(t.sdk_meta=e({},u),c&&(t.sdk_meta={requestId:c})),null==l||l((t.type,t))}I(t)}},onRequestState:function(){return _()},onRequestRecoveryState:function(){if(b)return b()},onStart:function(){p("start"),S||(h.diff().forEach((function(t){return I(t)})),S=!0)}};var H=function(){return o(void 0,void 0,void 0,(function(){var t,n,e,o;return i(this,(function(i){return A+=1,"function"!=typeof(null===(n=window.AssistantHost)||void 0===n?void 0:n.ready)?[2,new Promise((function(t,n){var e;if(A>3)throw new Error('window.AssistantHost is not ready. The ready method has the type "'+typeof(null===(e=window.AssistantHost)||void 0===e?void 0:e.ready)+'"');window.setTimeout((function(){H().then(t,n)}),500)}))]:(t=(null===(o=null===(e=h.get().find((function(t){var n;return"smart_app_data"===t.type&&"-1"!==((null===(n=t.sdk_meta)||void 0===n?void 0:n.mid)||"-1")})))||void 0===e?void 0:e.sdk_meta)||void 0===o?void 0:o.mid)||"-1","-1"!==t&&x(t),h.commit(),window.AssistantHost.ready(),[2])}))}))};d&&window.setTimeout(H);var O=function(t,n){var e,o,i,a=t.action,r=t.name,s=t.requestId,u=t.mode;if(null===(e=window.AssistantHost)||void 0===e?void 0:e.sendDataContainer){if(null==n)return null===(o=window.AssistantHost)||void 0===o||o.sendDataContainer(JSON.stringify({data:a,message_name:r||"",requestId:s,mode:u})),function(){};if(s&&g.has(s))throw new Error("requestId должен быть уникальным");var d=s||f(),c=function(t){var n=m(),e=n.on,o=n.emit;return t({next:function(t){o("next",t)}}),{subscribe:function(t){var n=t.next;return{unsubscribe:e("next",n)}}}}((function(t){var n,e=t.next;null===(n=window.AssistantHost)||void 0===n||n.sendDataContainer(JSON.stringify({data:a,message_name:r||"",requestId:d,mode:u})),g.set(d,{next:e,requestId:s})})).subscribe,l=c({next:n}).unsubscribe;return function(){l(),g.delete(d)}}if(null!=n)throw new Error("Не поддерживается в данной версии клиента");return null===(i=window.AssistantHost)||void 0===i||i.sendData(JSON.stringify(a),r||null),function(){}},k=function(t,n,o,i){return void 0===i&&(i={}),O(e(e({},i),{action:t}),(function(t){"smart_app_data"===t.type&&(null==n||n(t.smart_app_data)),"smart_app_error"===t.type&&(null==o||o(t.smart_app_error))}))};return{cancelTts:T,close:function(){var t;return null===(t=window.AssistantHost)||void 0===t?void 0:t.close()},getGeo:void 0!==(null===(a=window.AssistantHost)||void 0===a?void 0:a.getGeo)?function(){var t,n;null===(n=(t=window.AssistantHost).getGeo)||void 0===n||n.call(t)}:void 0,getInitialData:h.pull,findInInitialData:h.find,getRecoveryState:function(){return window.appRecoveryState},on:l,subscribeToCommand:y,sendAction:k,sendData:O,sendActionPromisified:function(t,n){return void 0===n&&(n={}),new Promise((function(e,o){var i=k(t,(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];i(),e.apply(void 0,t)}),(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];i(),o.apply(void 0,t)}),n)}))},sendDataPromisified:function(t){return new Promise((function(n){var e=O(t,(function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];e(),n.apply(void 0,t)}))}))},setGetState:function(t){_=t},setGetRecoveryState:function(t){b=t},setSuggests:function(t){var n;null===(n=window.AssistantHost)||void 0===n||n.setSuggests(JSON.stringify({suggestions:{buttons:t}}))},setHints:function(t){var n;null===(n=window.AssistantHost)||void 0===n||n.setHints(JSON.stringify({hints:t}))},sendText:function(t){var n;return null===(n=window.AssistantHost)||void 0===n?void 0:n.sendText(t)},setHeaderButtons:function(t){var n,e;if(!(null===(n=window.AssistantHost)||void 0===n?void 0:n.setHeaderButtons))throw new Error("setHeaderButtons не поддерживается в данной версии клиента");null===(e=window.AssistantHost)||void 0===e||e.setHeaderButtons(t)},ready:H}}})); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).assistant={})}(this,(function(t){"use strict";var n,e=function(){return e=Object.assign||function(t){for(var n,e=1,o=arguments.length;e<o;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t},e.apply(this,arguments)};function o(t,n,e,o){return new(e||(e=Promise))((function(i,a){function r(t){try{u(o.next(t))}catch(t){a(t)}}function s(t){try{u(o.throw(t))}catch(t){a(t)}}function u(t){var n;t.done?i(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(r,s)}u((o=o.apply(t,n||[])).next())}))}function i(t,n){var e,o,i,a,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(e)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(e=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=n.call(t,r)}catch(t){s=[6,t],o=0}finally{e=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function a(t,n,e){if(e||2===arguments.length)for(var o,i=0,a=n.length;i<a;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return t.concat(o||Array.prototype.slice.call(n))}var r=new Uint8Array(16);function s(){if(!n&&!(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(r)}var u=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var d=[],c=0;c<256;++c)d.push((c+256).toString(16).substr(1));function l(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=(d[t[n+0]]+d[t[n+1]]+d[t[n+2]]+d[t[n+3]]+"-"+d[t[n+4]]+d[t[n+5]]+"-"+d[t[n+6]]+d[t[n+7]]+"-"+d[t[n+8]]+d[t[n+9]]+"-"+d[t[n+10]]+d[t[n+11]]+d[t[n+12]]+d[t[n+13]]+d[t[n+14]]+d[t[n+15]]).toLowerCase();if(!function(t){return"string"==typeof t&&u.test(t)}(e))throw TypeError("Stringified UUID is invalid");return e}function f(t,n,e){var o=(t=t||{}).random||(t.rng||s)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,n){e=e||0;for(var i=0;i<16;++i)n[e+i]=o[i];return n}return l(o)}var p,v,y,w,m=function(){var t={},n=function(n,e){return(t[n]=t[n]||[]).push(e),function(){t[n]=t[n].filter((function(t){return t!==e}))}};return{events:t,emit:function(n){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];for(var i=0,a=t[n]||[];i<a.length;i++){a[i].apply(void 0,e)}},on:n,once:function(t,e){var o=n(t,(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];e.apply(void 0,t),o()}));return o},clear:function(){t={}}}},g=function(t,n){if("object"!=typeof t||null===t)return t===n;if(Array.isArray(t))return!(!Array.isArray(n)||t.length!==n.length)&&!t.some((function(t,e){return!g(t,n[e])}));if("object"!=typeof n||null===n)return!1;var e=Object.entries(t),o=Object.entries(n);return e.length===o.length&&!e.some((function(t){var e=t[0],o=t[1];return!(e in n&&g(o,n[e]))}))},_=function(t,n){return"character"===n.type?t.findIndex((function(t){return"character"===t.type&&t.character.id===n.character.id})):["insets","minimum_static_insets","maximum_static_insets","dynamic_insets"].includes(n.type)?t.findIndex((function(t){return t.type===n.type})):"app_context"===n.type?t.findIndex((function(t){return"app_context"===t.type})):t.findIndex((function(t){return g(t,n)}))},h=(p=!1,v=[],y=[],w=[],{pull:function(){return p=!0,v=a([],window.appInitialData||[]),a([],v)},get:function(){return a([],window.appInitialData||[])},commit:function(){y=a([],window.appInitialData||[]),w=!0===p?(window.appInitialData||[]).filter((function(t){return!(_(v,t)>=0)})):a([],window.appInitialData||[])},diff:function(){return a([],w)},isCommitted:function(t){var n=_(y,t),e=n>=0;return e&&y.splice(n,1),e},find:function(t){var n=t.type,e=t.command,o=a([],window.appInitialData||[]).find((function(t){return!(e||!n||n!==t.type)||(e&&"smart_app_data"in t?e===t.smart_app_data.command||e===t.smart_app_data.type:void 0)}));return o&&"smart_app_data"in o?o.smart_app_data:o}}),b=["A","AUDIO","BUTTON","INPUT","OPTION","SELECT","TEXTAREA","VIDEO"];if(/[a-zA-Z]/.test("1.33.2--canary.198.26c4207fa73d180e28e31248a316508b4baf5cfe.0")&&console.info("%cPlease use the latest version of SaluteJS Client. Your version is 1.33.2--canary.198.26c4207fa73d180e28e31248a316508b4baf5cfe.0","color: yellow; font-size: 14px"),"undefined"!=typeof window&&function(){try{return window.self!==window.parent}catch(t){return!0}}()){var S=function(t){var n;null===(n=window.parent)||void 0===n||n.postMessage(JSON.stringify(t),"*")},A=function(){var t=window.location.href;window.history.back(),setTimeout((function(){window.location.href===t&&S({type:"close"})}),500)};window.appInitialData=[],window.AssistantHost={sendDataContainer:function(t){S({type:"sendDataContainer",payload:t})},close:function(){S({type:"close"})},sendData:function(t){S({type:"sendData",payload:t})},setSuggests:function(t){S({type:"setSuggests",payload:t})},setHints:function(t){S({type:"setHints",payload:t})},ready:function(){S({type:"ready"})},sendText:function(t){S({type:"sendText",payload:t})},setHeaderButtons:function(t){S({type:"setHeaderButtons",payload:"string"==typeof t?t:JSON.stringify(t)})}},window.addEventListener("message",(function(t){var n,e,o,i,a,r,s,u;try{if("string"==typeof t.data){var d=JSON.parse(t.data);switch(d.type){case"onBack":A();break;case"onData":null===(e=null===(n=window.AssistantClient)||void 0===n?void 0:n.onData)||void 0===e||e.call(n,d.payload);break;case"onRequestState":var c=null===(i=null===(o=window.AssistantClient)||void 0===o?void 0:o.onRequestState)||void 0===i?void 0:i.call(o);S({type:"state",payload:c,requestId:d.requestId});break;case"onRequestRecoveryState":var l=null===(r=null===(a=window.AssistantClient)||void 0===a?void 0:a.onRequestRecoveryState)||void 0===r?void 0:r.call(a);S({type:"recoveryState",payload:l});break;case"onStart":null===(u=null===(s=window.AssistantClient)||void 0===s?void 0:s.onStart)||void 0===u||u.call(s);break;default:console.error(t,"Unknown parsed message")}}}catch(t){console.error(t,"Unknown message")}})),window.addEventListener("keydown",(function(t){var n,e;switch(t.code){case"Enter":document.activeElement&&!b.includes(document.activeElement.tagName)&&(null===(e=(n=document.activeElement).click)||void 0===e||e.call(n));break;case"Escape":A()}}))}"undefined"!=typeof window&&(window.__ASSISTANT_CLIENT__={version:"1.33.2--canary.198.26c4207fa73d180e28e31248a316508b4baf5cfe.0"}),t.createAssistant=function(t){var n,a,r=t.getState,s=t.getRecoveryState,u=t.ready,d=void 0===u||u,c=m(),l=c.on,p=c.emit,v=m(),y=v.on,w=v.emit,g=new Map,_=r,b=s,S=!1,A=0,I=function(t){return"smart_app_data"===t.type&&p("command",t.smart_app_data),"smart_app_error"===t.type&&p("error",t.smart_app_error),p("data",t)},T=void 0!==(null===(n=window.AssistantHost)||void 0===n?void 0:n.cancelTts)?function(){var t,n;null===(n=(t=window.AssistantHost).cancelTts)||void 0===n||n.call(t,"")}:void 0,x=function(t){void 0===window.__ASSISTANT_CLIENT__.firstSmartAppDataMid&&(window.__ASSISTANT_CLIENT__.firstSmartAppDataMid=t)};window.AssistantClient={onData:function(t){var n,o,i,a,r;if(!h.isCommitted(t)&&(w(t.type,t),"smart_app_data"===t.type&&"-1"!==((null===(n=t.sdk_meta)||void 0===n?void 0:n.mid)||"-1")&&x(null===(o=t.sdk_meta)||void 0===o?void 0:o.mid),"system"!==t.type||"BACK"!==(null===(a=null===(i=t.system)||void 0===i?void 0:i.command)||void 0===a?void 0:a.toUpperCase()))){if("tts_state_update"===t.type&&p("tts",{state:t.state,owner:t.owner}),("smart_app_data"===t.type||"smart_app_error"===t.type)&&(null===(r=t.sdk_meta)||void 0===r?void 0:r.requestId)&&g.has(t.sdk_meta.requestId)){var s=t.sdk_meta;s.requestId;var u=function(t,n){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&n.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(t);i<o.length;i++)n.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(t,o[i])&&(e[o[i]]=t[o[i]])}return e}(s,["requestId"]),d=g.get(t.sdk_meta.requestId)||{},c=d.requestId,l=d.next;(Object.keys(u).length>0||c)&&(t.sdk_meta=e({},u),c&&(t.sdk_meta={requestId:c})),null==l||l((t.type,t))}I(t)}},onRequestState:function(){return _()},onRequestRecoveryState:function(){if(b)return b()},onStart:function(){p("start"),S||(h.diff().forEach((function(t){return I(t)})),S=!0)}};var H=function(){return o(void 0,void 0,void 0,(function(){var t,n,e,o;return i(this,(function(i){return A+=1,"function"!=typeof(null===(n=window.AssistantHost)||void 0===n?void 0:n.ready)?[2,new Promise((function(t,n){var e;if(A>3)throw new Error('window.AssistantHost is not ready. The ready method has the type "'+typeof(null===(e=window.AssistantHost)||void 0===e?void 0:e.ready)+'"');window.setTimeout((function(){H().then(t,n)}),500)}))]:(t=(null===(o=null===(e=h.get().find((function(t){var n;return"smart_app_data"===t.type&&"-1"!==((null===(n=t.sdk_meta)||void 0===n?void 0:n.mid)||"-1")})))||void 0===e?void 0:e.sdk_meta)||void 0===o?void 0:o.mid)||"-1","-1"!==t&&x(t),h.commit(),window.AssistantHost.ready(),[2])}))}))};d&&window.setTimeout(H);var O=function(t,n){var e,o,i,a=t.action,r=t.name,s=t.requestId,u=t.mode;if(null===(e=window.AssistantHost)||void 0===e?void 0:e.sendDataContainer){if(null==n)return null===(o=window.AssistantHost)||void 0===o||o.sendDataContainer(JSON.stringify({data:a,message_name:r||"",requestId:s,mode:u})),function(){};if(s&&g.has(s))throw new Error("requestId должен быть уникальным");var d=s||f(),c=function(t){var n=m(),e=n.on,o=n.emit;return t({next:function(t){o("next",t)}}),{subscribe:function(t){var n=t.next;return{unsubscribe:e("next",n)}}}}((function(t){var n,e=t.next;null===(n=window.AssistantHost)||void 0===n||n.sendDataContainer(JSON.stringify({data:a,message_name:r||"",requestId:d,mode:u})),g.set(d,{next:e,requestId:s})})).subscribe,l=c({next:n}).unsubscribe;return function(){l(),g.delete(d)}}if(null!=n)throw new Error("Не поддерживается в данной версии клиента");return null===(i=window.AssistantHost)||void 0===i||i.sendData(JSON.stringify(a),r||null),function(){}},k=function(t,n,o,i){return void 0===i&&(i={}),O(e(e({},i),{action:t}),(function(t){"smart_app_data"===t.type&&(null==n||n(t.smart_app_data)),"smart_app_error"===t.type&&(null==o||o(t.smart_app_error))}))};return{cancelTts:T,close:function(){var t;return null===(t=window.AssistantHost)||void 0===t?void 0:t.close()},getGeo:void 0!==(null===(a=window.AssistantHost)||void 0===a?void 0:a.getGeo)?function(){var t,n;null===(n=(t=window.AssistantHost).getGeo)||void 0===n||n.call(t)}:void 0,getInitialData:h.pull,findInInitialData:h.find,getRecoveryState:function(){return window.appRecoveryState},on:l,subscribeToCommand:y,sendAction:k,sendData:O,sendActionPromisified:function(t,n){return void 0===n&&(n={}),new Promise((function(e,o){var i=k(t,(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];i(),e.apply(void 0,t)}),(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];i(),o.apply(void 0,t)}),n)}))},sendDataPromisified:function(t){return new Promise((function(n){var e=O(t,(function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];e(),n.apply(void 0,t)}))}))},setGetState:function(t){_=t},setGetRecoveryState:function(t){b=t},setSuggests:function(t){var n;null===(n=window.AssistantHost)||void 0===n||n.setSuggests(JSON.stringify({suggestions:{buttons:t}}))},setHints:function(t){var n;null===(n=window.AssistantHost)||void 0===n||n.setHints(JSON.stringify({hints:t}))},sendText:function(t){var n;return null===(n=window.AssistantHost)||void 0===n?void 0:n.sendText(t)},setHeaderButtons:function(t){var n,e;if(!(null===(n=window.AssistantHost)||void 0===n?void 0:n.setHeaderButtons))throw new Error("setHeaderButtons не поддерживается в данной версии клиента");null===(e=window.AssistantHost)||void 0===e||e.setHeaderButtons(JSON.stringify(t))},ready:H}}})); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1726443
30785
2