@telegram-login-ultimate/react 1.1.0 → 1.1.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/cjs/hooks/index.js +1 -1
- package/dist/cjs/hooks/use-telegram-login.js +2 -2
- package/dist/cjs/hooks/use-telegram-login.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/hooks/index.js +1 -1
- package/dist/esm/hooks/use-telegram-login.js +2 -2
- package/dist/esm/hooks/use-telegram-login.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/index.d.ts +35 -4
- package/package.json +1 -1
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @telegram-login-ultimate/react v1.
|
|
2
|
-
"use strict";var t=require("react");function r(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function e(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function n(){n=function(){return r};var t,r={},e=Object.prototype,o=e.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function
|
|
1
|
+
/* @license @telegram-login-ultimate/react v1.1.2 */
|
|
2
|
+
"use strict";var t=require("react");function r(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function e(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function n(){n=function(){return r};var t,r={},e=Object.prototype,o=e.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function s(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{s({},"")}catch(t){s=function(t,r,e){return t[r]=e}}function h(t,r,e,n){var o=r&&r.prototype instanceof m?r:m,a=Object.create(o.prototype),u=new F(n||[]);return i(a,"_invoke",{value:S(t,e,u)}),a}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var p="suspendedStart",d="suspendedYield",v="executing",y="completed",g={};function m(){}function w(){}function b(){}var x={};s(x,u,(function(){return this}));var L=Object.getPrototypeOf,E=L&&L(L(k([])));E&&E!==e&&o.call(E,u)&&(x=E);var _=b.prototype=m.prototype=Object.create(x);function O(t){["next","throw","return"].forEach((function(r){s(t,r,(function(t){return this._invoke(r,t)}))}))}function j(t,r){function e(n,i,a,u){var c=f(t[n],t,i);if("throw"!==c.type){var l=c.arg,s=l.value;return s&&"object"==typeof s&&o.call(s,"__await")?r.resolve(s.__await).then((function(t){e("next",t,a,u)}),(function(t){e("throw",t,a,u)})):r.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return e("throw",t,a,u)}))}u(c.arg)}var n;i(this,"_invoke",{value:function(t,o){function i(){return new r((function(r,n){e(t,o,r,n)}))}return n=n?n.then(i,i):i()}})}function S(r,e,n){var o=p;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=I(u,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var l=f(r,e,n);if("normal"===l.type){if(o=n.done?y:d,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=y,n.method="throw",n.arg=l.arg)}}}function I(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,I(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=f(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,g;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,g):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function T(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function P(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function F(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(r){if(r||""===r){var e=r[u];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var n=-1,i=function e(){for(;++n<r.length;)if(o.call(r,n))return e.value=r[n],e.done=!1,e;return e.value=t,e.done=!0,e};return i.next=i}}throw new TypeError(typeof r+" is not iterable")}return w.prototype=b,i(_,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:w,configurable:!0}),w.displayName=s(b,l,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===w||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,s(t,l,"GeneratorFunction")),t.prototype=Object.create(_),t},r.awrap=function(t){return{__await:t}},O(j.prototype),s(j.prototype,c,(function(){return this})),r.AsyncIterator=j,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new j(h(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(_),s(_,l,"Generator"),s(_,u,(function(){return this})),s(_,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=k,F.prototype={constructor:F,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!r)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(n,o){return u.type="throw",u.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=o.call(a,"catchLoc"),l=o.call(a,"finallyLoc");if(c&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),g},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),P(e),g}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;P(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:k(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),g}},r}function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(e=e.call(t)).next,0===r);else for(;!(c=(n=i.call(e)).done)&&(u.push(n.value),u.length!==r);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return r(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var i="https://oauth.telegram.org";exports.useTelegramLogin=function(r){var a=r.botId,u=r.onFail,c=r.onSuccess,l=o(t.useState(!1),2),s=l[0],h=l[1],f=t.useRef({});return[function(){var t=Math.max(0,(screen.width-550)/2)+screen.availWidth,r=Math.max(0,(screen.height-470)/2)+screen.availHeight,o=i+"/auth?bot_id="+encodeURIComponent(a)+"&origin="+encodeURIComponent(location.origin||location.protocol+"//"+location.hostname)+"&return_to="+encodeURIComponent(location.href),l=window.open(o,"telegram_oauth_bot"+a,"width=550,height=470,left="+t+",top="+r+",status=0,location=0,menubar=0,toolbar=0");function s(t){if(t.source===f.current[a].window&&a in f.current){var r=JSON.parse(t.data);"auth_result"===r.event&&p(r.result)}}function p(t){a in f.current&&(f.current[a].authFinished||(t?null==c||c(t):null==u||u(),h(!1),f.current[a].authFinished=!0,window.removeEventListener("message",s)))}function d(){var t;return t=n().mark((function t(r){var e,o,a;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=i+"/auth/get?bot_id="+encodeURIComponent(r.botId),o={"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8","X-Requested-With":"XMLHttpRequest"},t.next=4,fetch(e,{method:"POST",headers:o,credentials:"include"});case 4:return a=t.sent,t.abrupt("return",a.json());case 6:case"end":return t.stop()}}),t)})),d=function(){var r=this,n=arguments;return new Promise((function(o,i){var a=t.apply(r,n);function u(t){e(a,o,i,u,c,"next",t)}function c(t){e(a,o,i,u,c,"throw",t)}u(void 0)}))},d.apply(this,arguments)}f.current[a]={window:l,authFinished:!1},l&&(h(!0),window.addEventListener("message",s),l.focus(),function t(r){if(!(r in f.current))return;var e=f.current[r];if(!e.window||e.window.closed)return function(t){return d.apply(this,arguments)}({botId:r}).then((function(t){p("user"in t&&t.user)})).catch((function(){h(!1),null==u||u()}));setTimeout((function(){return t(r)}),100)}(a))},{isPending:s}]};
|
|
3
3
|
//# sourceMappingURL=use-telegram-login.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-telegram-login.js","sources":["../../../src/hooks/use-telegram-login.ts"],"sourcesContent":["import { useRef, useState } from 'react'\n\nconst POPUP_WIDTH = 550\nconst POPUP_HEIGHT = 470\nconst POPUP_ORIGIN = 'https://oauth.telegram.org'\n\nexport interface TelegramLoginData {\n
|
|
1
|
+
{"version":3,"file":"use-telegram-login.js","sources":["../../../src/hooks/use-telegram-login.ts"],"sourcesContent":["import { useRef, useState } from 'react'\n\nconst POPUP_WIDTH = 550\nconst POPUP_HEIGHT = 470\nconst POPUP_ORIGIN = 'https://oauth.telegram.org'\n\nexport interface TelegramLoginData {\n /**\n * Unix timestamp indicating when the authentication occurred.\n */\n auth_date: number\n /**\n * User's first name.\n */\n first_name: string\n /**\n * Data hash for verification of the authentication data integrity.\n */\n hash: string\n /**\n * Unique identifier for the user.\n */\n id: number\n /**\n * User's last name, if available.\n */\n last_name?: string\n /**\n * URL of the user's profile photo, if available.\n */\n photo_url?: string\n /**\n * User's username, if available.\n */\n username?: string\n}\n\nexport interface UseTelegramLoginOptions {\n /**\n * The unique identifier of the Telegram bot. You can obtain it from the https://t.me/username_to_id_bot.\n */\n botId: number\n\n /**\n * Optional callback function that will be called when the login process completes successfully.\n * @param {TelegramUserData} data - The authentication data returned from Telegram.\n */\n onSuccess?: (data: TelegramLoginData) => unknown\n\n /**\n * Optional callback function that will be called if an error occurs during the login process.\n */\n onFail?: () => unknown\n}\n\nexport const useTelegramLogin = ({\n botId,\n onFail,\n onSuccess,\n}: UseTelegramLoginOptions) => {\n const [isPending, setIsPending] = useState(false)\n const popups = useRef<\n Record<number, { window: Window | null; authFinished: boolean }>\n >({})\n\n return [\n () => {\n const width = POPUP_WIDTH\n const height = POPUP_HEIGHT\n const left = Math.max(0, (screen.width - width) / 2) + screen.availWidth\n const top = Math.max(0, (screen.height - height) / 2) + screen.availHeight\n\n const popupUrl =\n POPUP_ORIGIN +\n '/auth?bot_id=' +\n encodeURIComponent(botId) +\n '&origin=' +\n encodeURIComponent(\n location.origin || location.protocol + '//' + location.hostname,\n ) +\n '&return_to=' +\n encodeURIComponent(location.href)\n\n const popup = window.open(\n popupUrl,\n 'telegram_oauth_bot' + botId,\n 'width=' +\n width +\n ',height=' +\n height +\n ',left=' +\n left +\n ',top=' +\n top +\n ',status=0,location=0,menubar=0,toolbar=0',\n )\n\n popups.current[botId] = {\n window: popup,\n authFinished: false,\n }\n\n if (popup) {\n setIsPending(true)\n window.addEventListener('message', onMessage)\n popup.focus()\n checkClose(botId)\n }\n\n function onMessage(event: MessageEvent<string>) {\n if (event.source !== popups.current[botId].window) return\n if (!(botId in popups.current)) return\n\n const data: { event: string; result: TelegramLoginData | false } =\n JSON.parse(event.data)\n\n if (data.event === 'auth_result') {\n onAuth(data.result)\n }\n }\n\n function onAuth(authData: TelegramLoginData | false) {\n if (!(botId in popups.current)) return\n if (popups.current[botId].authFinished) return\n\n if (authData) {\n onSuccess?.(authData)\n } else {\n onFail?.()\n }\n\n setIsPending(false)\n popups.current[botId].authFinished = true\n window.removeEventListener('message', onMessage)\n }\n\n function checkClose(botId: number) {\n if (!(botId in popups.current)) return\n\n const currentPopup = popups.current[botId]\n\n if (!currentPopup.window || currentPopup.window.closed) {\n return getAuthData({ botId })\n .then((res) => {\n if ('user' in res) {\n onAuth(res.user)\n } else {\n onAuth(false)\n }\n })\n .catch(() => {\n setIsPending(false)\n onFail?.()\n })\n }\n\n setTimeout(() => checkClose(botId), 100)\n }\n\n async function getAuthData(options: { botId: number }): Promise<\n ({ user: TelegramLoginData } | { error: string }) & {\n html: string\n origin: string\n }\n > {\n const url =\n POPUP_ORIGIN +\n '/auth/get' +\n '?bot_id=' +\n encodeURIComponent(options.botId)\n\n const headers = {\n 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',\n 'X-Requested-With': 'XMLHttpRequest',\n }\n\n const response = await fetch(url, {\n method: 'POST',\n headers,\n credentials: 'include',\n })\n\n return response.json()\n }\n },\n { isPending },\n ] as const\n}\n"],"names":["POPUP_ORIGIN","_ref","botId","onFail","onSuccess","_useState2","_slicedToArray","useState","isPending","setIsPending","popups","useRef","left","Math","max","screen","width","availWidth","top","height","availHeight","popupUrl","encodeURIComponent","location","origin","protocol","hostname","href","popup","window","open","onMessage","event","source","current","data","JSON","parse","onAuth","result","authData","authFinished","removeEventListener","_getAuthData","_regeneratorRuntime","mark","_callee","options","url","headers","response","wrap","_context","prev","next","fetch","method","credentials","sent","abrupt","json","stop","apply","this","arguments","addEventListener","focus","checkClose","currentPopup","closed","_x","getAuthData","then","res","user","setTimeout"],"mappings":";s+OAEA,IAEMA,EAAe,sDAmDW,SAAHC,GAIE,IAH7BC,EAAKD,EAALC,MACAC,EAAMF,EAANE,OACAC,EAASH,EAATG,UAEiDC,EAAAC,EAAfC,EAAAA,UAAS,GAAM,GAA1CC,EAASH,EAAA,GAAEI,EAAYJ,EAAA,GACxBK,EAASC,EAAAA,OAEb,IAEF,MAAO,CACL,WACE,IAEMC,EAAOC,KAAKC,IAAI,GAAIC,OAAOC,MAnEnB,KAmEoC,GAAKD,OAAOE,WACxDC,EAAML,KAAKC,IAAI,GAAIC,OAAOI,OAnEjB,KAmEoC,GAAKJ,OAAOK,YAEzDC,EACJrB,EACA,gBACAsB,mBAAmBpB,GACnB,WACAoB,mBACEC,SAASC,QAAUD,SAASE,SAAW,KAAOF,SAASG,UAEzD,cACAJ,mBAAmBC,SAASI,MAExBC,EAAQC,OAAOC,KACnBT,EACA,qBAAuBnB,EACvB,6BAKEU,EACA,QACAM,EACA,4CAeJ,SAASa,EAAUC,GACjB,GAAIA,EAAMC,SAAWvB,EAAOwB,QAAQhC,GAAO2B,QACrC3B,KAASQ,EAAOwB,QAAtB,CAEA,IAAMC,EACJC,KAAKC,MAAML,EAAMG,MAEA,gBAAfA,EAAKH,OACPM,EAAOH,EAAKI,OANkB,CAQlC,CAEA,SAASD,EAAOE,GACRtC,KAASQ,EAAOwB,UAClBxB,EAAOwB,QAAQhC,GAAOuC,eAEtBD,EACFpC,SAAAA,EAAYoC,GAEZrC,SAAAA,IAGFM,GAAa,GACbC,EAAOwB,QAAQhC,GAAOuC,cAAe,EACrCZ,OAAOa,oBAAoB,UAAWX,IACxC,CAyB0B,SAAAY,UAwBzB,SAxByBC,IAAAC,MAA1B,SAAAC,EAA2BC,GAA0B,IAAAC,EAAAC,EAAAC,EAAA,OAAAN,IAAAO,MAAA,SAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAelD,OATKN,EACJhD,sBAGAsB,mBAAmByB,EAAQ7C,OAEvB+C,EAAU,CACd,eAAgB,mDAChB,mBAAoB,kBACrBG,EAAAE,KAAA,EAEsBC,MAAMP,EAAK,CAChCQ,OAAQ,OACRP,QAAAA,EACAQ,YAAa,YACb,KAAA,EAJY,OAARP,EAAQE,EAAAM,KAAAN,EAAAO,OAAA,SAMPT,EAASU,QAAM,KAAA,EAAA,IAAA,MAAA,OAAAR,EAAAS,OAAA,GAAAf,EAAA,IAvBEH,gLAwBzBA,EAAAmB,MAAAC,KAAAC,UAAA,CAtFDtD,EAAOwB,QAAQhC,GAAS,CACtB2B,OAAQD,EACRa,cAAc,GAGZb,IACFnB,GAAa,GACboB,OAAOoC,iBAAiB,UAAWlC,GACnCH,EAAMsC,QA+BR,SAASC,EAAWjE,GAClB,KAAMA,KAASQ,EAAOwB,SAAU,OAEhC,IAAMkC,EAAe1D,EAAOwB,QAAQhC,GAEpC,IAAKkE,EAAavC,QAAUuC,EAAavC,OAAOwC,OAC9C,OAeH,SAEyBC,GAAA,OAAA3B,EAAAmB,MAAAC,KAAAC,UAAA,CAjBfO,CAAY,CAAErE,MAAAA,IAClBsE,MAAK,SAACC,GAEHnC,EADE,SAAUmC,GACLA,EAAIC,KAIf,IAAE,OACK,WACLjE,GAAa,GACbN,SAAAA,GACF,IAGJwE,YAAW,WAAA,OAAMR,EAAWjE,EAAM,GAAE,IACtC,CAnDEiE,CAAWjE,GA8Ef,EACA,CAAEM,UAAAA,GAEN"}
|
package/dist/cjs/index.js
CHANGED
package/dist/esm/hooks/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @license @telegram-login-ultimate/react v1.
|
|
2
|
-
import{useState as t,useRef as r}from"react";function e(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function n(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function o(){o=function(){return r};var t,r={},e=Object.prototype,n=e.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function h(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{h({},"")}catch(t){h=function(t,r,e){return t[r]=e}}function
|
|
1
|
+
/* @license @telegram-login-ultimate/react v1.1.2 */
|
|
2
|
+
import{useState as t,useRef as r}from"react";function e(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function n(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function o(){o=function(){return r};var t,r={},e=Object.prototype,n=e.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function h(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{h({},"")}catch(t){h=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var o=r&&r.prototype instanceof m?r:m,a=Object.create(o.prototype),u=new F(n||[]);return i(a,"_invoke",{value:S(t,e,u)}),a}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=s;var p="suspendedStart",d="suspendedYield",y="executing",v="completed",g={};function m(){}function w(){}function b(){}var x={};h(x,u,(function(){return this}));var L=Object.getPrototypeOf,E=L&&L(L(k([])));E&&E!==e&&n.call(E,u)&&(x=E);var _=b.prototype=m.prototype=Object.create(x);function O(t){["next","throw","return"].forEach((function(r){h(t,r,(function(t){return this._invoke(r,t)}))}))}function j(t,r){function e(o,i,a,u){var c=f(t[o],t,i);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==typeof h&&n.call(h,"__await")?r.resolve(h.__await).then((function(t){e("next",t,a,u)}),(function(t){e("throw",t,a,u)})):r.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return e("throw",t,a,u)}))}u(c.arg)}var o;i(this,"_invoke",{value:function(t,n){function i(){return new r((function(r,o){e(t,n,r,o)}))}return o=o?o.then(i,i):i()}})}function S(r,e,n){var o=p;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=I(u,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=f(r,e,n);if("normal"===l.type){if(o=n.done?v:d,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,n.method="throw",n.arg=l.arg)}}}function I(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,I(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=f(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,g;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,g):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function P(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function T(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function F(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function k(r){if(r||""===r){var e=r[u];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,i=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return i.next=i}}throw new TypeError(typeof r+" is not iterable")}return w.prototype=b,i(_,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:w,configurable:!0}),w.displayName=h(b,l,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===w||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,h(t,l,"GeneratorFunction")),t.prototype=Object.create(_),t},r.awrap=function(t){return{__await:t}},O(j.prototype),h(j.prototype,c,(function(){return this})),r.AsyncIterator=j,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new j(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(_),h(_,l,"Generator"),h(_,u,(function(){return this})),h(_,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=k,F.prototype={constructor:F,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function o(n,o){return u.type="throw",u.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(c&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),g},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),T(e),g}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;T(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:k(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),g}},r}function i(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(e=e.call(t)).next,0===r);else for(;!(c=(n=i.call(e)).done)&&(u.push(n.value),u.length!==r);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,r)||function(t,r){if(t){if("string"==typeof t)return e(t,r);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var a="https://oauth.telegram.org",u=function(e){var u=e.botId,c=e.onFail,l=e.onSuccess,h=i(t(!1),2),s=h[0],f=h[1],p=r({});return[function(){var t=Math.max(0,(screen.width-550)/2)+screen.availWidth,r=Math.max(0,(screen.height-470)/2)+screen.availHeight,e=a+"/auth?bot_id="+encodeURIComponent(u)+"&origin="+encodeURIComponent(location.origin||location.protocol+"//"+location.hostname)+"&return_to="+encodeURIComponent(location.href),i=window.open(e,"telegram_oauth_bot"+u,"width=550,height=470,left="+t+",top="+r+",status=0,location=0,menubar=0,toolbar=0");function h(t){if(t.source===p.current[u].window&&u in p.current){var r=JSON.parse(t.data);"auth_result"===r.event&&s(r.result)}}function s(t){u in p.current&&(p.current[u].authFinished||(t?null==l||l(t):null==c||c(),f(!1),p.current[u].authFinished=!0,window.removeEventListener("message",h)))}function d(){var t;return t=o().mark((function t(r){var e,n,i;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=a+"/auth/get?bot_id="+encodeURIComponent(r.botId),n={"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8","X-Requested-With":"XMLHttpRequest"},t.next=4,fetch(e,{method:"POST",headers:n,credentials:"include"});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t)})),d=function(){var r=this,e=arguments;return new Promise((function(o,i){var a=t.apply(r,e);function u(t){n(a,o,i,u,c,"next",t)}function c(t){n(a,o,i,u,c,"throw",t)}u(void 0)}))},d.apply(this,arguments)}p.current[u]={window:i,authFinished:!1},i&&(f(!0),window.addEventListener("message",h),i.focus(),function t(r){if(!(r in p.current))return;var e=p.current[r];if(!e.window||e.window.closed)return function(t){return d.apply(this,arguments)}({botId:r}).then((function(t){s("user"in t&&t.user)})).catch((function(){f(!1),null==c||c()}));setTimeout((function(){return t(r)}),100)}(u))},{isPending:s}]};export{u as useTelegramLogin};
|
|
3
3
|
//# sourceMappingURL=use-telegram-login.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-telegram-login.js","sources":["../../../src/hooks/use-telegram-login.ts"],"sourcesContent":["import { useRef, useState } from 'react'\n\nconst POPUP_WIDTH = 550\nconst POPUP_HEIGHT = 470\nconst POPUP_ORIGIN = 'https://oauth.telegram.org'\n\nexport interface TelegramLoginData {\n
|
|
1
|
+
{"version":3,"file":"use-telegram-login.js","sources":["../../../src/hooks/use-telegram-login.ts"],"sourcesContent":["import { useRef, useState } from 'react'\n\nconst POPUP_WIDTH = 550\nconst POPUP_HEIGHT = 470\nconst POPUP_ORIGIN = 'https://oauth.telegram.org'\n\nexport interface TelegramLoginData {\n /**\n * Unix timestamp indicating when the authentication occurred.\n */\n auth_date: number\n /**\n * User's first name.\n */\n first_name: string\n /**\n * Data hash for verification of the authentication data integrity.\n */\n hash: string\n /**\n * Unique identifier for the user.\n */\n id: number\n /**\n * User's last name, if available.\n */\n last_name?: string\n /**\n * URL of the user's profile photo, if available.\n */\n photo_url?: string\n /**\n * User's username, if available.\n */\n username?: string\n}\n\nexport interface UseTelegramLoginOptions {\n /**\n * The unique identifier of the Telegram bot. You can obtain it from the https://t.me/username_to_id_bot.\n */\n botId: number\n\n /**\n * Optional callback function that will be called when the login process completes successfully.\n * @param {TelegramUserData} data - The authentication data returned from Telegram.\n */\n onSuccess?: (data: TelegramLoginData) => unknown\n\n /**\n * Optional callback function that will be called if an error occurs during the login process.\n */\n onFail?: () => unknown\n}\n\nexport const useTelegramLogin = ({\n botId,\n onFail,\n onSuccess,\n}: UseTelegramLoginOptions) => {\n const [isPending, setIsPending] = useState(false)\n const popups = useRef<\n Record<number, { window: Window | null; authFinished: boolean }>\n >({})\n\n return [\n () => {\n const width = POPUP_WIDTH\n const height = POPUP_HEIGHT\n const left = Math.max(0, (screen.width - width) / 2) + screen.availWidth\n const top = Math.max(0, (screen.height - height) / 2) + screen.availHeight\n\n const popupUrl =\n POPUP_ORIGIN +\n '/auth?bot_id=' +\n encodeURIComponent(botId) +\n '&origin=' +\n encodeURIComponent(\n location.origin || location.protocol + '//' + location.hostname,\n ) +\n '&return_to=' +\n encodeURIComponent(location.href)\n\n const popup = window.open(\n popupUrl,\n 'telegram_oauth_bot' + botId,\n 'width=' +\n width +\n ',height=' +\n height +\n ',left=' +\n left +\n ',top=' +\n top +\n ',status=0,location=0,menubar=0,toolbar=0',\n )\n\n popups.current[botId] = {\n window: popup,\n authFinished: false,\n }\n\n if (popup) {\n setIsPending(true)\n window.addEventListener('message', onMessage)\n popup.focus()\n checkClose(botId)\n }\n\n function onMessage(event: MessageEvent<string>) {\n if (event.source !== popups.current[botId].window) return\n if (!(botId in popups.current)) return\n\n const data: { event: string; result: TelegramLoginData | false } =\n JSON.parse(event.data)\n\n if (data.event === 'auth_result') {\n onAuth(data.result)\n }\n }\n\n function onAuth(authData: TelegramLoginData | false) {\n if (!(botId in popups.current)) return\n if (popups.current[botId].authFinished) return\n\n if (authData) {\n onSuccess?.(authData)\n } else {\n onFail?.()\n }\n\n setIsPending(false)\n popups.current[botId].authFinished = true\n window.removeEventListener('message', onMessage)\n }\n\n function checkClose(botId: number) {\n if (!(botId in popups.current)) return\n\n const currentPopup = popups.current[botId]\n\n if (!currentPopup.window || currentPopup.window.closed) {\n return getAuthData({ botId })\n .then((res) => {\n if ('user' in res) {\n onAuth(res.user)\n } else {\n onAuth(false)\n }\n })\n .catch(() => {\n setIsPending(false)\n onFail?.()\n })\n }\n\n setTimeout(() => checkClose(botId), 100)\n }\n\n async function getAuthData(options: { botId: number }): Promise<\n ({ user: TelegramLoginData } | { error: string }) & {\n html: string\n origin: string\n }\n > {\n const url =\n POPUP_ORIGIN +\n '/auth/get' +\n '?bot_id=' +\n encodeURIComponent(options.botId)\n\n const headers = {\n 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',\n 'X-Requested-With': 'XMLHttpRequest',\n }\n\n const response = await fetch(url, {\n method: 'POST',\n headers,\n credentials: 'include',\n })\n\n return response.json()\n }\n },\n { isPending },\n ] as const\n}\n"],"names":["POPUP_ORIGIN","useTelegramLogin","_ref","botId","onFail","onSuccess","_useState2","_slicedToArray","useState","isPending","setIsPending","popups","useRef","left","Math","max","screen","width","availWidth","top","height","availHeight","popupUrl","encodeURIComponent","location","origin","protocol","hostname","href","popup","window","open","onMessage","event","source","current","data","JSON","parse","onAuth","result","authData","authFinished","removeEventListener","_getAuthData","_regeneratorRuntime","mark","_callee","options","url","headers","response","wrap","_context","prev","next","fetch","method","credentials","sent","abrupt","json","stop","apply","this","arguments","addEventListener","focus","checkClose","currentPopup","closed","_x","getAuthData","then","res","user","setTimeout"],"mappings":";++OAEA,IAEMA,EAAe,6BAmDRC,EAAmB,SAAHC,GAIE,IAH7BC,EAAKD,EAALC,MACAC,EAAMF,EAANE,OACAC,EAASH,EAATG,UAEiDC,EAAAC,EAAfC,GAAS,GAAM,GAA1CC,EAASH,EAAA,GAAEI,EAAYJ,EAAA,GACxBK,EAASC,EAEb,IAEF,MAAO,CACL,WACE,IAEMC,EAAOC,KAAKC,IAAI,GAAIC,OAAOC,MAnEnB,KAmEoC,GAAKD,OAAOE,WACxDC,EAAML,KAAKC,IAAI,GAAIC,OAAOI,OAnEjB,KAmEoC,GAAKJ,OAAOK,YAEzDC,EACJtB,EACA,gBACAuB,mBAAmBpB,GACnB,WACAoB,mBACEC,SAASC,QAAUD,SAASE,SAAW,KAAOF,SAASG,UAEzD,cACAJ,mBAAmBC,SAASI,MAExBC,EAAQC,OAAOC,KACnBT,EACA,qBAAuBnB,EACvB,6BAKEU,EACA,QACAM,EACA,4CAeJ,SAASa,EAAUC,GACjB,GAAIA,EAAMC,SAAWvB,EAAOwB,QAAQhC,GAAO2B,QACrC3B,KAASQ,EAAOwB,QAAtB,CAEA,IAAMC,EACJC,KAAKC,MAAML,EAAMG,MAEA,gBAAfA,EAAKH,OACPM,EAAOH,EAAKI,OANkB,CAQlC,CAEA,SAASD,EAAOE,GACRtC,KAASQ,EAAOwB,UAClBxB,EAAOwB,QAAQhC,GAAOuC,eAEtBD,EACFpC,SAAAA,EAAYoC,GAEZrC,SAAAA,IAGFM,GAAa,GACbC,EAAOwB,QAAQhC,GAAOuC,cAAe,EACrCZ,OAAOa,oBAAoB,UAAWX,IACxC,CAyB0B,SAAAY,UAwBzB,SAxByBC,IAAAC,MAA1B,SAAAC,EAA2BC,GAA0B,IAAAC,EAAAC,EAAAC,EAAA,OAAAN,IAAAO,MAAA,SAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAelD,OATKN,EACJjD,sBAGAuB,mBAAmByB,EAAQ7C,OAEvB+C,EAAU,CACd,eAAgB,mDAChB,mBAAoB,kBACrBG,EAAAE,KAAA,EAEsBC,MAAMP,EAAK,CAChCQ,OAAQ,OACRP,QAAAA,EACAQ,YAAa,YACb,KAAA,EAJY,OAARP,EAAQE,EAAAM,KAAAN,EAAAO,OAAA,SAMPT,EAASU,QAAM,KAAA,EAAA,IAAA,MAAA,OAAAR,EAAAS,OAAA,GAAAf,EAAA,IAvBEH,gLAwBzBA,EAAAmB,MAAAC,KAAAC,UAAA,CAtFDtD,EAAOwB,QAAQhC,GAAS,CACtB2B,OAAQD,EACRa,cAAc,GAGZb,IACFnB,GAAa,GACboB,OAAOoC,iBAAiB,UAAWlC,GACnCH,EAAMsC,QA+BR,SAASC,EAAWjE,GAClB,KAAMA,KAASQ,EAAOwB,SAAU,OAEhC,IAAMkC,EAAe1D,EAAOwB,QAAQhC,GAEpC,IAAKkE,EAAavC,QAAUuC,EAAavC,OAAOwC,OAC9C,OAeH,SAEyBC,GAAA,OAAA3B,EAAAmB,MAAAC,KAAAC,UAAA,CAjBfO,CAAY,CAAErE,MAAAA,IAClBsE,MAAK,SAACC,GAEHnC,EADE,SAAUmC,GACLA,EAAIC,KAIf,IAAE,OACK,WACLjE,GAAa,GACbN,SAAAA,GACF,IAGJwE,YAAW,WAAA,OAAMR,EAAWjE,EAAM,GAAE,IACtC,CAnDEiE,CAAWjE,GA8Ef,EACA,CAAEM,UAAAA,GAEN"}
|
package/dist/esm/index.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,46 @@
|
|
|
1
1
|
interface TelegramLoginData {
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Unix timestamp indicating when the authentication occurred.
|
|
4
|
+
*/
|
|
5
|
+
auth_date: number;
|
|
6
|
+
/**
|
|
7
|
+
* User's first name.
|
|
8
|
+
*/
|
|
3
9
|
first_name: string;
|
|
10
|
+
/**
|
|
11
|
+
* Data hash for verification of the authentication data integrity.
|
|
12
|
+
*/
|
|
13
|
+
hash: string;
|
|
14
|
+
/**
|
|
15
|
+
* Unique identifier for the user.
|
|
16
|
+
*/
|
|
17
|
+
id: number;
|
|
18
|
+
/**
|
|
19
|
+
* User's last name, if available.
|
|
20
|
+
*/
|
|
4
21
|
last_name?: string;
|
|
5
|
-
|
|
22
|
+
/**
|
|
23
|
+
* URL of the user's profile photo, if available.
|
|
24
|
+
*/
|
|
6
25
|
photo_url?: string;
|
|
7
|
-
|
|
8
|
-
|
|
26
|
+
/**
|
|
27
|
+
* User's username, if available.
|
|
28
|
+
*/
|
|
29
|
+
username?: string;
|
|
9
30
|
}
|
|
10
31
|
interface UseTelegramLoginOptions {
|
|
32
|
+
/**
|
|
33
|
+
* The unique identifier of the Telegram bot. You can obtain it from the https://t.me/username_to_id_bot.
|
|
34
|
+
*/
|
|
11
35
|
botId: number;
|
|
36
|
+
/**
|
|
37
|
+
* Optional callback function that will be called when the login process completes successfully.
|
|
38
|
+
* @param {TelegramUserData} data - The authentication data returned from Telegram.
|
|
39
|
+
*/
|
|
12
40
|
onSuccess?: (data: TelegramLoginData) => unknown;
|
|
41
|
+
/**
|
|
42
|
+
* Optional callback function that will be called if an error occurs during the login process.
|
|
43
|
+
*/
|
|
13
44
|
onFail?: () => unknown;
|
|
14
45
|
}
|
|
15
46
|
declare const useTelegramLogin: ({ botId, onFail, onSuccess, }: UseTelegramLoginOptions) => readonly [() => void, {
|
package/package.json
CHANGED