@instant-messengers/vk-teams-bridge 2.3.6 → 2.3.7

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/cjs/index.js CHANGED
@@ -144,6 +144,7 @@ var TeamsSendAction = /* @__PURE__ */ ((TeamsSendAction2) => {
144
144
  TeamsSendAction2["GetPlatformVersion"] = "GetPlatformVersion";
145
145
  TeamsSendAction2["GetMiniappConfig"] = "GetMiniappConfig";
146
146
  TeamsSendAction2["EnableLog"] = "EnableLog";
147
+ TeamsSendAction2["GetMiniappsSettings"] = "GetMiniappsSettings";
147
148
  return TeamsSendAction2;
148
149
  })(TeamsSendAction || {});
149
150
  var TeamsBridgeErrorCode = /* @__PURE__ */ ((TeamsBridgeErrorCode2) => {
@@ -175,6 +176,7 @@ var TeamsSubscribeAction = /* @__PURE__ */ ((TeamsSubscribeAction2) => {
175
176
  TeamsSubscribeAction2["Language"] = "Language";
176
177
  TeamsSubscribeAction2["BackButtonPressed"] = "BackButtonPressed";
177
178
  TeamsSubscribeAction2["ButtonPressed"] = "ButtonPressed";
179
+ TeamsSubscribeAction2["SettingChanged"] = "SettingChanged";
178
180
  return TeamsSubscribeAction2;
179
181
  })(TeamsSubscribeAction || {});
180
182
 
@@ -345,4 +347,7 @@ var Bridge = class {
345
347
  this.setupConsoleProxy();
346
348
  }
347
349
  }
350
+ sendNotification() {
351
+ new Notification("Hooray");
352
+ }
348
353
  };
package/dist/esm/index.js CHANGED
@@ -90,6 +90,7 @@ var TeamsSendAction = /* @__PURE__ */ ((TeamsSendAction2) => {
90
90
  TeamsSendAction2["GetPlatformVersion"] = "GetPlatformVersion";
91
91
  TeamsSendAction2["GetMiniappConfig"] = "GetMiniappConfig";
92
92
  TeamsSendAction2["EnableLog"] = "EnableLog";
93
+ TeamsSendAction2["GetMiniappsSettings"] = "GetMiniappsSettings";
93
94
  return TeamsSendAction2;
94
95
  })(TeamsSendAction || {});
95
96
  var TeamsBridgeErrorCode = /* @__PURE__ */ ((TeamsBridgeErrorCode2) => {
@@ -121,6 +122,7 @@ var TeamsSubscribeAction = /* @__PURE__ */ ((TeamsSubscribeAction2) => {
121
122
  TeamsSubscribeAction2["Language"] = "Language";
122
123
  TeamsSubscribeAction2["BackButtonPressed"] = "BackButtonPressed";
123
124
  TeamsSubscribeAction2["ButtonPressed"] = "ButtonPressed";
125
+ TeamsSubscribeAction2["SettingChanged"] = "SettingChanged";
124
126
  return TeamsSubscribeAction2;
125
127
  })(TeamsSubscribeAction || {});
126
128
 
@@ -290,6 +292,9 @@ var Bridge = class {
290
292
  }
291
293
  callBackReply(result);
292
294
  };
295
+ sendNotification() {
296
+ new Notification("Hooray");
297
+ }
293
298
  };
294
299
  export {
295
300
  BaseBridgeErrorCode,
@@ -1 +1 @@
1
- "use strict";var VKTBridge=(function(){var I=Object.defineProperty;var nt=Object.getOwnPropertyDescriptor;var ot=Object.getOwnPropertyNames;var at=Object.prototype.hasOwnProperty;var it=function(t,e){for(var o in e)I(t,o,{get:e[o],enumerable:!0})},ut=function(t,e,o,a){if(e&&typeof e=="object"||typeof e=="function")for(var r=ot(e),n=0,i=r.length,c;n<i;n++)c=r[n],!at.call(t,c)&&c!==o&&I(t,c,{get:function(f){return e[f]}.bind(null,c),enumerable:!(a=nt(e,c))||a.enumerable});return t};var ct=function(t){return ut(I({},"__esModule",{value:!0}),t)};var _t={};it(_t,{instance:function(){return A},send:function(){return ft},subscribe:function(){return st}});function F(t,e,o,a,r,n,i){try{var c=t[n](i),f=c.value}catch(u){o(u);return}c.done?e(f):Promise.resolve(f).then(a,r)}function N(t){return function(){var e=this,o=arguments;return new Promise(function(a,r){var n=t.apply(e,o);function i(f){F(n,a,r,i,c,"next",f)}function c(f){F(n,a,r,i,c,"throw",f)}i(void 0)})}}function d(t,e){return e!=null&&typeof Symbol!="undefined"&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):d(t,e)}function E(t,e){if(!d(t,e))throw new TypeError("Cannot call a class as a function")}function s(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function T(t){if(Array.isArray(t))return t}function M(t,e){var o=t==null?null:typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(o!=null){var a=[],r=!0,n=!1,i,c;try{for(o=o.call(t);!(r=(i=o.next()).done)&&(a.push(i.value),!(e&&a.length===e));r=!0);}catch(f){n=!0,c=f}finally{try{!r&&o.return!=null&&o.return()}finally{if(n)throw c}}return a}}function B(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function w(t,e){(e==null||e>t.length)&&(e=t.length);for(var o=0,a=new Array(e);o<e;o++)a[o]=t[o];return a}function x(t,e){if(t){if(typeof t=="string")return w(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);if(o==="Object"&&t.constructor&&(o=t.constructor.name),o==="Map"||o==="Set")return Array.from(o);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return w(t,e)}}function C(t,e){return T(t)||M(t,e)||x(t,e)||B()}function k(t){if(Array.isArray(t))return w(t)}function q(t){if(typeof Symbol!="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function K(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(t){return k(t)||q(t)||x(t)||K()}function m(t){"@swc/helpers - typeof";return t&&typeof Symbol!="undefined"&&t.constructor===Symbol?"symbol":typeof t}function S(t,e){var o={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},a,r,n,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=c(0),i.throw=c(1),i.return=c(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(u){return function(_){return f([u,_])}}function f(u){if(a)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(o=0)),o;)try{if(a=1,r&&(n=u[0]&2?r.return:u[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,u[1])).done)return n;switch(r=0,n&&(u=[u[0]&2,n.value]),u[0]){case 0:case 1:n=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(n=o.trys,!(n=n.length>0&&n[n.length-1])&&(u[0]===6||u[0]===2)){o=0;continue}if(u[0]===3&&(!n||u[1]>n[0]&&u[1]<n[3])){o.label=u[1];break}if(u[0]===6&&o.label<n[1]){o.label=n[1],n=u;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(u);break}n[2]&&o.ops.pop(),o.trys.pop();continue}u=e.call(t,o)}catch(_){u=[6,_],r=0}finally{a=n=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function y(t){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)},y(t)}function g(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(g=function(){return!!t})()}function V(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Y(t,e){return e&&(m(e)==="object"||typeof e=="function")?e:V(t)}function W(t,e,o){return e=y(e),Y(t,g()?Reflect.construct(e,o||[],y(t).constructor):e.apply(t,o))}function p(t,e){return p=Object.setPrototypeOf||function(a,r){return a.__proto__=r,a},p(t,e)}function H(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&p(t,e)}function O(t,e,o){return g()?O=Reflect.construct:O=function(r,n,i){var c=[null];c.push.apply(c,n);var f=Function.bind.apply(r,c),u=new f;return i&&p(u,i.prototype),u},O.apply(null,arguments)}function Q(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function R(t){var e=typeof Map=="function"?new Map:void 0;return R=function(a){if(a===null||!Q(a))return a;if(typeof a!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(a))return e.get(a);e.set(a,r)}function r(){return O(a,arguments,y(this).constructor)}return r.prototype=Object.create(a.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),p(r,a)},R(t)}var z="BRIDGE_ERROR_TYPE",J=function(t){"use strict";H(e,t);function e(o,a){E(this,e);var r;return r=W(this,e,["".concat(o,": ").concat(a)]),s(r,"_error_type_",z),s(r,"code",void 0),s(r,"reason",void 0),r.code=o,r.reason=a,r}return e}(R(Error)),L=function(t){return(t==null?void 0:t._error_type_)===z};var b;(function(t){t.BAD_REQUEST="BAD_REQUEST",t.NETWORK_ERROR="NETWORK_ERROR",t.INTERNAL_ERROR="INTERNAL_ERROR",t.UNKNOWN_SUBSCRIPTION_NAME="UNKNOWN_SUBSCRIPTION_NAME"})(b||(b={}));function j(){if("crypto"in window&&window.crypto.randomUUID)return window.crypto.randomUUID();for(var t=new Date().getTime(),e=97,o=122,a="",r=0;r<30;r++){var n=Math.floor(Math.random()*(o-e+1))+e,i=String.fromCharCode(n);a+=i}return"".concat(t).concat(a)}var X=function(t){return"[Bridge]: ".concat(t)},v={log:function(t){for(var e=arguments.length,o=new Array(e>1?e-1:0),a=1;a<e;a++)o[a-1]=arguments[a];var r;(r=console).log.apply(r,[X(t)].concat(h(o)))},warn:function(t){for(var e=arguments.length,o=new Array(e>1?e-1:0),a=1;a<e;a++)o[a-1]=arguments[a];var r;(r=console).warn.apply(r,[X(t)].concat(h(o)))}};var Z=function(t){return t.map(function(e){return(typeof e=="undefined"?"undefined":m(e))==="object"?JSON.stringify(e):String(e)}).join(" ")};var P;(function(t){t.LoadingCompleted="LoadingCompleted",t.OpenProfile="OpenProfile",t.OpenDialog="OpenDialog",t.OpenThread="OpenThread",t.ForwardTask="ForwardTask",t.SetTitle="SetTitle",t.SetBadge="SetBadge",t.OpenLink="OpenLink",t.ShowToast="ShowToast",t.GetThemeSettings="GetThemeSettings",t.GetMiniAppShareLink="GetMiniAppShareLink",t.GetLanguage="GetLanguage",t.OpenPopUp="OpenPopUp",t.StoragePut="StoragePut",t.StorageGet="StorageGet",t.StorageDelete="StorageDelete",t.StorageClear="StorageClear",t.StartAudioCall="StartAudioCall",t.StartVideoCall="StartVideoCall",t.OpenAuthModal="OpenAuthModal",t.SetCanGoBack="SetCanGoBack",t.SetCanNotGoBack="SetCanNotGoBack",t.OpenContactSelectionDialog="OpenContactSelectionDialog",t.SetButtonGroup="SetButtonGroup",t.GetSelfId="GetSelfId",t.DownloadFile="DownloadFile",t.CreateChat="CreateChat",t.ForwardSurvey="ForwardSurvey",t.GetAuth="GetAuth",t.GetPlatformVersion="GetPlatformVersion",t.GetMiniappConfig="GetMiniappConfig",t.EnableLog="EnableLog"})(P||(P={}));var $;(function(t){t.ALREADY_CALLED="ALREADY_CALLED",t.PROFILE_NOT_FOUND="PROFILE_NOT_FOUND",t.DIALOG_NOT_FOUND="DIALOG_NOT_FOUND",t.THREAD_NOT_FOUND="THREAD_NOT_FOUND",t.POPUP_CLOSED="POPUP_CLOSED",t.KEY_IS_TOO_LARGE="KEY_IS_TOO_LARGE",t.VALUE_IS_TOO_LARGE="VALUE_IS_TOO_LARGE",t.TOTAL_LIMIT_EXCEEDED="TOTAL_LIMIT_EXCEEDED",t.INVALID_KEY="INVALID_KEY",t.INVALID_VALUE="INVALID_VALUE",t.KEY_NOT_FOUND="KEY_NOT_FOUND",t.USER_NOT_FOUND="USER_NOT_FOUND",t.MODAL_CLOSED="MODAL_CLOSED",t.UNKNOWN_GROUP="UNKNOWN_GROUP",t.UNKNOWN_ICON="UNKNOWN_ICON",t.CALLBACK_DATA_TOO_LARGE="CALLBACK_DATA_TOO_LARGE",t.TOO_MANY_BUTTONS="TOO_MANY_BUTTONS",t.CREATE_FAILED="CREATE_FAILED",t.UNAUTHTORIZED="401",t.FORBIDDEN="403",t.SERVER_ERROR="500"})($||($={}));var tt;(function(t){t.ThemeSettings="ThemeSettings",t.Language="Language",t.BackButtonPressed="BackButtonPressed",t.ButtonPressed="ButtonPressed"})(tt||(tt={}));var et=function t(){"use strict";var e=this,o=this;E(this,t);var a=this;s(this,"subscriptions",{}),s(this,"promises",{}),s(this,"enableLog",!0),s(this,"callBackHandlers",{newEvent:function(r,n){var i=e.subscriptions[r];if(!i){v.warn("no subscription found with id ".concat(r));return}i(n)}}),s(this,"callFunction",function(r){for(var n=arguments.length,i=new Array(n>1?n-1:0),c=1;c<n;c++)i[c-1]=arguments[c];var f=j(),u={type:"functionCall",data:{reqId:f,name:r,args:i}};return window.parent.postMessage(u,"*"),new Promise(function(_,l){o.promises[f]=[_,l]})}),s(this,"send",function(r,n){return e.callFunction("send",r,n)}),s(this,"subscribe",function(){var r=N(function(n,i){var c,f,u=arguments;return S(this,function(_){switch(_.label){case 0:return c=u.length>2&&u[2]!==void 0?u[2]:null,[4,a.callFunction("subscribe",n,c)];case 1:return f=_.sent().subscriptionId,a.subscriptions[f]=i,[2,{unsubscribe:a.getUnsubscribe(f)}]}})});return function(n,i){return r.apply(this,arguments)}}()),s(this,"setupConsoleProxy",function(){var r=["log","warn","info","error"],n=e.sendLog.bind(e);r.forEach(function(i){window.console[i]=new Proxy(console[i],{apply:function(f,u,_){n({type:i,text:Z(_)}),Reflect.apply(f,u,h(_))}})})}),s(this,"sendLog",function(r){var n=r.text,i=r.type;if(e.enableLog){var c=j(),f={type:"sendLog",data:{reqId:c,name:"sendLog",logData:{text:n,type:i}}};window.parent.postMessage(f,"*")}}),s(this,"changeEnableLog",function(){var r=N(function(n){var i;return S(this,function(c){switch(c.label){case 0:return i=n.enabled,a.enableLog=i,[4,a.send(P.EnableLog,{active:i})];case 1:return c.sent(),[2]}})});return function(n){return r.apply(this,arguments)}}()),s(this,"getUnsubscribe",function(r){return function(){r in e.subscriptions&&delete e.subscriptions[r]}}),s(this,"handleMessage",function(r){var n=r.data;if((typeof n=="undefined"?"undefined":m(n))==="object")switch(n.type){case"functionCallReply":e.handleFunctionCallReply(n.data);break;case"callBack":e.handleCallBack(r,n.data);break}}),s(this,"handleFunctionCallReply",function(r){var n=e.promises[r.reqId];if(n){delete e.promises[r.reqId];var i=C(n,2),c=i[0],f=i[1];r.ok!==void 0?c(r.ok):(v.warn("rejecting req ".concat(r.reqId," promise: ").concat(JSON.stringify(r.err))),f(r.err))}else v.warn("got reply to unknown function call with id ".concat(r.reqId))}),s(this,"handleCallBack",function(r,n){var i=function(l){var U=l.ok,G=l.err,D;if(U===void 0==(G===void 0))return i({reqId:n.reqId,err:{code:b.INTERNAL_ERROR,reason:"callBack handler protocol violation"}});var rt={type:"callBackReply",data:{reqId:n.reqId,ok:U,err:G}};(D=r.source)===null||D===void 0||D.postMessage(rt,r.origin)},c={reqId:n.reqId};try{var f=e.callBackHandlers[n.name];if(!f){var u='got callBack request with unknown name "'.concat(n.name,'"');throw v.warn(u),new J(b.BAD_REQUEST,u)}c.ok=f.apply(void 0,h(n.args))||null}catch(l){var _=L(l)?l.reason:"callBack handler raised an exception";d(l,Error)&&(_+=' "'.concat(l.name,'": "').concat(l.message,'"')),c.err={code:L(l)?l.code:b.INTERNAL_ERROR,reason:_}}i(c)}),window.addEventListener("message",this.handleMessage),window.self!==window.parent&&this.setupConsoleProxy()};var A=new et,ft=A.send,st=A.subscribe;return ct(_t);})();
1
+ "use strict";var VKTBridge=(function(){var P=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var ot=Object.prototype.hasOwnProperty;var at=function(t,e){for(var o in e)P(t,o,{get:e[o],enumerable:!0})},it=function(t,e,o,r){if(e&&typeof e=="object"||typeof e=="function")for(var n=nt(e),a=0,u=n.length,c;a<u;a++)c=n[a],!ot.call(t,c)&&c!==o&&P(t,c,{get:function(f){return e[f]}.bind(null,c),enumerable:!(r=rt(e,c))||r.enumerable});return t};var ut=function(t){return it(P({},"__esModule",{value:!0}),t)};var st={};at(st,{instance:function(){return L},send:function(){return ct},subscribe:function(){return ft}});function U(t,e,o,r,n,a,u){try{var c=t[a](u),f=c.value}catch(i){o(i);return}c.done?e(f):Promise.resolve(f).then(r,n)}function N(t){return function(){var e=this,o=arguments;return new Promise(function(r,n){var a=t.apply(e,o);function u(f){U(a,r,n,u,c,"next",f)}function c(f){U(a,r,n,u,c,"throw",f)}u(void 0)})}}function y(t,e){return e!=null&&typeof Symbol!="undefined"&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):y(t,e)}function v(t,e){if(!y(t,e))throw new TypeError("Cannot call a class as a function")}function G(t,e){for(var o=0;o<e.length;o++){var r=e[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function F(t,e,o){return e&&G(t.prototype,e),o&&G(t,o),t}function s(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function M(t){if(Array.isArray(t))return t}function T(t,e){var o=t==null?null:typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(o!=null){var r=[],n=!0,a=!1,u,c;try{for(o=o.call(t);!(n=(u=o.next()).done)&&(r.push(u.value),!(e&&r.length===e));n=!0);}catch(f){a=!0,c=f}finally{try{!n&&o.return!=null&&o.return()}finally{if(a)throw c}}return r}}function B(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(t,e){(e==null||e>t.length)&&(e=t.length);for(var o=0,r=new Array(e);o<e;o++)r[o]=t[o];return r}function O(t,e){if(t){if(typeof t=="string")return m(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);if(o==="Object"&&t.constructor&&(o=t.constructor.name),o==="Map"||o==="Set")return Array.from(o);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return m(t,e)}}function C(t,e){return M(t)||T(t,e)||O(t,e)||B()}function k(t){if(Array.isArray(t))return m(t)}function K(t){if(typeof Symbol!="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function q(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(t){return k(t)||K(t)||O(t)||q()}function d(t){"@swc/helpers - typeof";return t&&typeof Symbol!="undefined"&&t.constructor===Symbol?"symbol":typeof t}function E(t,e){var o={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,n,a,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function c(i){return function(_){return f([i,_])}}function f(i){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,i[0]&&(o=0)),o;)try{if(r=1,n&&(a=i[0]&2?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[i[0]&2,a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(a=o.trys,!(a=a.length>0&&a[a.length-1])&&(i[0]===6||i[0]===2)){o=0;continue}if(i[0]===3&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(i[0]===6&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=e.call(t,o)}catch(_){i=[6,_],n=0}finally{r=a=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}function p(t){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)},p(t)}function b(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(b=function(){return!!t})()}function V(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Y(t,e){return e&&(d(e)==="object"||typeof e=="function")?e:V(t)}function W(t,e,o){return e=p(e),Y(t,b()?Reflect.construct(e,o||[],p(t).constructor):e.apply(t,o))}function l(t,e){return l=Object.setPrototypeOf||function(r,n){return r.__proto__=n,r},l(t,e)}function H(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}function w(t,e,o){return b()?w=Reflect.construct:w=function(n,a,u){var c=[null];c.push.apply(c,a);var f=Function.bind.apply(n,c),i=new f;return u&&l(i,u.prototype),i},w.apply(null,arguments)}function z(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function x(t){var e=typeof Map=="function"?new Map:void 0;return x=function(r){if(r===null||!z(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(r))return e.get(r);e.set(r,n)}function n(){return w(r,arguments,p(this).constructor)}return n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),l(n,r)},x(t)}var Q="BRIDGE_ERROR_TYPE",$=function(t){"use strict";H(e,t);function e(o,r){v(this,e);var n;return n=W(this,e,["".concat(o,": ").concat(r)]),s(n,"_error_type_",Q),s(n,"code",void 0),s(n,"reason",void 0),n.code=o,n.reason=r,n}return e}(x(Error)),I=function(t){return(t==null?void 0:t._error_type_)===Q};var R=function(t){return t.BAD_REQUEST="BAD_REQUEST",t.NETWORK_ERROR="NETWORK_ERROR",t.INTERNAL_ERROR="INTERNAL_ERROR",t.UNKNOWN_SUBSCRIPTION_NAME="UNKNOWN_SUBSCRIPTION_NAME",t}({});function D(){if("crypto"in window&&window.crypto.randomUUID)return window.crypto.randomUUID();for(var t=new Date().getTime(),e=97,o=122,r="",n=0;n<30;n++){var a=Math.floor(Math.random()*(o-e+1))+e,u=String.fromCharCode(a);r+=u}return"".concat(t).concat(r)}var J=function(t){return"[Bridge]: ".concat(t)},g={log:function(t){for(var e=arguments.length,o=new Array(e>1?e-1:0),r=1;r<e;r++)o[r-1]=arguments[r];var n;(n=console).log.apply(n,[J(t)].concat(h(o)))},warn:function(t){for(var e=arguments.length,o=new Array(e>1?e-1:0),r=1;r<e;r++)o[r-1]=arguments[r];var n;(n=console).warn.apply(n,[J(t)].concat(h(o)))}};var X=function(t){return t.map(function(e){return(typeof e=="undefined"?"undefined":d(e))==="object"?JSON.stringify(e):String(e)}).join(" ")};var Z=function(t){return t.LoadingCompleted="LoadingCompleted",t.OpenProfile="OpenProfile",t.OpenDialog="OpenDialog",t.OpenThread="OpenThread",t.ForwardTask="ForwardTask",t.SetTitle="SetTitle",t.SetBadge="SetBadge",t.OpenLink="OpenLink",t.ShowToast="ShowToast",t.GetThemeSettings="GetThemeSettings",t.GetMiniAppShareLink="GetMiniAppShareLink",t.GetLanguage="GetLanguage",t.OpenPopUp="OpenPopUp",t.StoragePut="StoragePut",t.StorageGet="StorageGet",t.StorageDelete="StorageDelete",t.StorageClear="StorageClear",t.StartAudioCall="StartAudioCall",t.StartVideoCall="StartVideoCall",t.OpenAuthModal="OpenAuthModal",t.SetCanGoBack="SetCanGoBack",t.SetCanNotGoBack="SetCanNotGoBack",t.OpenContactSelectionDialog="OpenContactSelectionDialog",t.SetButtonGroup="SetButtonGroup",t.GetSelfId="GetSelfId",t.DownloadFile="DownloadFile",t.CreateChat="CreateChat",t.ForwardSurvey="ForwardSurvey",t.GetAuth="GetAuth",t.GetPlatformVersion="GetPlatformVersion",t.GetMiniappConfig="GetMiniappConfig",t.EnableLog="EnableLog",t.GetMiniappsSettings="GetMiniappsSettings",t}({});var tt=function(){"use strict";function t(){var e=this,o=this;v(this,t),s(this,"subscriptions",{}),s(this,"promises",{}),s(this,"enableLog",!0),s(this,"callBackHandlers",{newEvent:function(r,n){var a=e.subscriptions[r];if(!a){g.warn("no subscription found with id ".concat(r));return}a(n)}}),s(this,"callFunction",function(r){for(var n=arguments.length,a=new Array(n>1?n-1:0),u=1;u<n;u++)a[u-1]=arguments[u];var c=D(),f={type:"functionCall",data:{reqId:c,name:r,args:a}};return window.parent.postMessage(f,"*"),new Promise(function(i,_){o.promises[c]=[i,_]})}),s(this,"send",function(r,n){return e.callFunction("send",r,n)}),s(this,"subscribe",function(r,n){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;return N(function(){var u;return E(this,function(c){switch(c.label){case 0:return[4,this.callFunction("subscribe",r,a)];case 1:return u=c.sent().subscriptionId,this.subscriptions[u]=n,[2,{unsubscribe:this.getUnsubscribe(u)}]}})}).call(o)}),s(this,"setupConsoleProxy",function(){var r=["log","warn","info","error"],n=e.sendLog.bind(e);r.forEach(function(a){window.console[a]=new Proxy(console[a],{apply:function(c,f,i){n({type:a,text:X(i)}),Reflect.apply(c,f,h(i))}})})}),s(this,"sendLog",function(r){var n=r.text,a=r.type;if(e.enableLog){var u=D(),c={type:"sendLog",data:{reqId:u,name:"sendLog",logData:{text:n,type:a}}};window.parent.postMessage(c,"*")}}),s(this,"changeEnableLog",function(r){var n=r.enabled;return N(function(){return E(this,function(a){switch(a.label){case 0:return this.enableLog=n,[4,this.send(Z.EnableLog,{active:n})];case 1:return a.sent(),[2]}})}).call(e)}),s(this,"getUnsubscribe",function(r){return function(){r in e.subscriptions&&delete e.subscriptions[r]}}),s(this,"handleMessage",function(r){var n=r.data;if((typeof n=="undefined"?"undefined":d(n))==="object")switch(n.type){case"functionCallReply":e.handleFunctionCallReply(n.data);break;case"callBack":e.handleCallBack(r,n.data);break}}),s(this,"handleFunctionCallReply",function(r){var n=e.promises[r.reqId];if(n){delete e.promises[r.reqId];var a=C(n,2),u=a[0],c=a[1];r.ok!==void 0?u(r.ok):(g.warn("rejecting req ".concat(r.reqId," promise: ").concat(JSON.stringify(r.err))),c(r.err))}else g.warn("got reply to unknown function call with id ".concat(r.reqId))}),s(this,"handleCallBack",function(r,n){var a=function(_){var j=_.ok,A=_.err,S;if(j===void 0==(A===void 0))return a({reqId:n.reqId,err:{code:R.INTERNAL_ERROR,reason:"callBack handler protocol violation"}});var et={type:"callBackReply",data:{reqId:n.reqId,ok:j,err:A}};(S=r.source)===null||S===void 0||S.postMessage(et,r.origin)},u={reqId:n.reqId};try{var c=e.callBackHandlers[n.name];if(!c){var f='got callBack request with unknown name "'.concat(n.name,'"');throw g.warn(f),new $(R.BAD_REQUEST,f)}u.ok=c.apply(void 0,h(n.args))||null}catch(_){var i=I(_)?_.reason:"callBack handler raised an exception";y(_,Error)&&(i+=' "'.concat(_.name,'": "').concat(_.message,'"')),u.err={code:I(_)?_.code:R.INTERNAL_ERROR,reason:i}}a(u)}),window.addEventListener("message",this.handleMessage),window.self!==window.parent&&this.setupConsoleProxy()}return F(t,[{key:"sendNotification",value:function(){new Notification("Hooray")}}]),t}();var L=new tt,ct=L.send,ft=L.subscribe;return ut(st);})();
@@ -24,4 +24,5 @@ export declare class Bridge<SubscribeAction extends string, SubscribeDescriptor
24
24
  private handleMessage;
25
25
  private handleFunctionCallReply;
26
26
  private readonly handleCallBack;
27
+ sendNotification(): void;
27
28
  }
@@ -63,7 +63,9 @@ export declare enum TeamsSendAction {
63
63
  /** Возвращает конфиг миниаппа */
64
64
  GetMiniappConfig = "GetMiniappConfig",
65
65
  /** Включить запись логов миниаппа */
66
- EnableLog = "EnableLog"
66
+ EnableLog = "EnableLog",
67
+ /** Получает настройки миниаппа от супераппа */
68
+ GetMiniappsSettings = "GetMiniappsSettings"
67
69
  }
68
70
  /** Специфичные коды ошибок */
69
71
  export declare enum TeamsBridgeErrorCode {
@@ -275,6 +277,7 @@ export type TTeamsSendActionsDescriptor = {
275
277
  [TeamsSendAction.GetPlatformVersion]: TGetPlatformVersion;
276
278
  [TeamsSendAction.GetMiniappConfig]: TGetMiniappConfig;
277
279
  [TeamsSendAction.EnableLog]: TEnableLog;
280
+ [TeamsSendAction.GetMiniappsSettings]: any;
278
281
  };
279
282
  export declare enum TeamsSubscribeAction {
280
283
  /** Изменились настройки темы */
@@ -284,7 +287,9 @@ export declare enum TeamsSubscribeAction {
284
287
  /** Пользователь нажал кнопку "Назад". */
285
288
  BackButtonPressed = "BackButtonPressed",
286
289
  /** Пользователь нажал на одну из кнопок, установленных при помощи метода SetButtonGroup */
287
- ButtonPressed = "ButtonPressed"
290
+ ButtonPressed = "ButtonPressed",
291
+ /** Изменение настроек миниаппа */
292
+ SettingChanged = "SettingChanged"
288
293
  }
289
294
  export type TThemeSettings = TSubscribeActionDescriptor<TGetThemeSettings['output']>;
290
295
  export type TLanguage = TSubscribeActionDescriptor<TGetLanguage['output']>;
@@ -0,0 +1 @@
1
+ {"root":["../../src/bridge.ts","../../src/error.ts","../../src/index.ts","../../src/teamstypes.ts","../../src/types.ts","../../src/helpers/getuniqueid.ts","../../src/helpers/logger.ts","../../src/helpers/logsutils.ts"],"version":"5.8.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instant-messengers/vk-teams-bridge",
3
- "version": "2.3.6",
3
+ "version": "2.3.7",
4
4
  "main": "dist/cjs/index.js",
5
5
  "browser": "dist/iife/index.min.js",
6
6
  "module": "dist/esm/index.js",