@tapni/auth 1.0.6 → 1.0.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.
@@ -21,13 +21,13 @@ class g extends c {
21
21
  if (typeof window > "u")
22
22
  return;
23
23
  const t = (s = document.getElementsByName("google-signin-client_id")[0]) === null || s === void 0 ? void 0 : s.content, i = e.clientId || t || "";
24
- i || console.warn("GoogleAuthPlugin - clientId is empty"), this.options = {
24
+ return i || console.warn("GoogleAuthPlugin - clientId is empty"), this.options = {
25
25
  clientId: i,
26
26
  grantOfflineAccess: (n = e.grantOfflineAccess) !== null && n !== void 0 ? n : !1,
27
27
  scopes: e.scopes || []
28
28
  }, this.gapiLoaded = new Promise((o) => {
29
29
  window.gapiResolve = o, this.loadScript();
30
- }), this.addUserChangeListener();
30
+ }), this.addUserChangeListener(), this.gapiLoaded;
31
31
  }
32
32
  platformJsLoaded() {
33
33
  gapi.load("auth2", () => {
@@ -0,0 +1,121 @@
1
+ import { WebPlugin as j } from "@capacitor/core";
2
+ var w = { exports: {} };
3
+ /*!
4
+ * $script.js JS loader & dependency manager
5
+ * https://github.com/ded/script.js
6
+ * (c) Dustin Diaz 2014 | License MIT
7
+ */
8
+ (function(y) {
9
+ (function(i, p) {
10
+ y.exports ? y.exports = p() : this[i] = p();
11
+ })("$script", function() {
12
+ var i = document, p = i.getElementsByTagName("head")[0], I = !1, m = "push", S = "readyState", A = "onreadystatechange", s = {}, o = {}, d = {}, f, v;
13
+ function g(e, t) {
14
+ for (var n = 0, u = e.length; n < u; ++n) if (!t(e[n])) return I;
15
+ return 1;
16
+ }
17
+ function h(e, t) {
18
+ g(e, function(n) {
19
+ return t(n), 1;
20
+ });
21
+ }
22
+ function l(e, t, n) {
23
+ e = e[m] ? e : [e];
24
+ var u = t && t.call, r = u ? t : n, N = u ? e.join("") : t, U = e.length;
25
+ function b(c) {
26
+ return c.call ? c() : s[c];
27
+ }
28
+ function _() {
29
+ if (!--U) {
30
+ s[N] = 1, r && r();
31
+ for (var c in o)
32
+ g(c.split("|"), b) && !h(o[c], b) && (o[c] = []);
33
+ }
34
+ }
35
+ return setTimeout(function() {
36
+ h(e, function c(a, W) {
37
+ if (a === null) return _();
38
+ if (!W && !/^https?:\/\//.test(a) && f && (a = a.indexOf(".js") === -1 ? f + a + ".js" : f + a), d[a])
39
+ return d[a] == 2 ? _() : setTimeout(function() {
40
+ c(a, !0);
41
+ }, 0);
42
+ d[a] = 1, x(a, _);
43
+ });
44
+ }, 0), l;
45
+ }
46
+ function x(e, t) {
47
+ var n = i.createElement("script"), u;
48
+ n.onload = n.onerror = n[A] = function() {
49
+ n[S] && !/^c|loade/.test(n[S]) || u || (n.onload = n[A] = null, u = 1, d[e] = 2, t());
50
+ }, n.async = 1, n.src = v ? e + (e.indexOf("?") === -1 ? "?" : "&") + v : e, p.insertBefore(n, p.lastChild);
51
+ }
52
+ return l.get = x, l.order = function(e, t, n) {
53
+ (function u(r) {
54
+ r = e.shift(), e.length ? l(r, u) : l(r, t, n);
55
+ })();
56
+ }, l.path = function(e) {
57
+ f = e;
58
+ }, l.urlArgs = function(e) {
59
+ v = e;
60
+ }, l.ready = function(e, t, n) {
61
+ e = e[m] ? e : [e];
62
+ var u = [];
63
+ return !h(e, function(r) {
64
+ s[r] || u[m](r);
65
+ }) && g(e, function(r) {
66
+ return s[r];
67
+ }) ? t() : function(r) {
68
+ o[r] = o[r] || [], o[r][m](t), n && n(u);
69
+ }(e.join("|")), l;
70
+ }, l.done = function(e) {
71
+ l([null], e);
72
+ }, l;
73
+ });
74
+ })(w);
75
+ var z = w.exports;
76
+ class P extends j {
77
+ constructor() {
78
+ super({
79
+ name: "SignInWithApple",
80
+ platforms: ["web"]
81
+ }), this.appleScriptUrl = "https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js", this.isAppleScriptLoaded = !1;
82
+ }
83
+ async authorize(i) {
84
+ return new Promise((p, I) => {
85
+ i ? this.loadSignInWithAppleJS().then((m) => {
86
+ var S, A, s;
87
+ this.isAppleScriptLoaded = m, this.isAppleScriptLoaded ? (AppleID.auth.init({
88
+ clientId: i.clientId,
89
+ redirectURI: i.redirectURI,
90
+ scope: (S = i.scopes) !== null && S !== void 0 ? S : void 0,
91
+ state: (A = i.state) !== null && A !== void 0 ? A : void 0,
92
+ nonce: (s = i.nonce) !== null && s !== void 0 ? s : void 0,
93
+ usePopup: !0
94
+ }), AppleID.auth.signIn().then((o) => {
95
+ var d, f, v, g, h;
96
+ const l = {
97
+ response: {
98
+ user: null,
99
+ email: (d = o.user) === null || d === void 0 ? void 0 : d.email,
100
+ givenName: (v = (f = o.user) === null || f === void 0 ? void 0 : f.name) === null || v === void 0 ? void 0 : v.firstName,
101
+ familyName: (h = (g = o.user) === null || g === void 0 ? void 0 : g.name) === null || h === void 0 ? void 0 : h.lastName,
102
+ identityToken: o.authorization.id_token,
103
+ authorizationCode: o.authorization.code
104
+ }
105
+ };
106
+ p(l);
107
+ }).catch((o) => {
108
+ I(o);
109
+ })) : I("Unable to load Sign in with Apple JS framework.");
110
+ }) : I("No options were provided.");
111
+ });
112
+ }
113
+ loadSignInWithAppleJS() {
114
+ return new Promise((i) => {
115
+ this.isAppleScriptLoaded ? i(!0) : typeof window !== void 0 ? z.get(this.appleScriptUrl, () => i(!0)) : i(!1);
116
+ });
117
+ }
118
+ }
119
+ export {
120
+ P as SignInWithAppleWeb
121
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapni/auth",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "type": "module",
5
5
  "main": "./dist/TapniAuth.umd.js",
6
6
  "module": "./dist/TapniAuth.es.js",
@@ -30,7 +30,7 @@
30
30
  "@capacitor/core": "^6.2.0",
31
31
  "@capacitor/device": "^6.0.2",
32
32
  "@capacitor/preferences": "^6.0.3",
33
- "@codetrix-studio/capacitor-google-auth": "^3.3.6",
33
+ "@codetrix-studio/capacitor-google-auth": "^3.4.0-rc.4",
34
34
  "@otplib/preset-browser": "^12.0.1",
35
35
  "@recognizebv/capacitor-plugin-msauth": "^3.6.1",
36
36
  "@tapni/capacitor-reactive-localstorage-vue3": "^0.0.17",
@@ -51,7 +51,7 @@
51
51
  "@rollup/plugin-inject": "^5.0.5",
52
52
  "@vitejs/plugin-vue": "^5.2.1",
53
53
  "office-addin-dev-certs": "^1.13.5",
54
- "vite": "^6.0.1",
54
+ "vite": "^5.4.11",
55
55
  "vite-plugin-node-polyfills": "^0.22.0"
56
56
  }
57
57
  }
@@ -1,124 +0,0 @@
1
- import { WebPlugin as z } from "@capacitor/core";
2
- var _ = { exports: {} };
3
- /*!
4
- * $script.js JS loader & dependency manager
5
- * https://github.com/ded/script.js
6
- * (c) Dustin Diaz 2014 | License MIT
7
- */
8
- var N;
9
- function L() {
10
- return N || (N = 1, function(x) {
11
- (function(i, p) {
12
- x.exports ? x.exports = p() : this[i] = p();
13
- })("$script", function() {
14
- var i = document, p = i.getElementsByTagName("head")[0], I = !1, m = "push", S = "readyState", A = "onreadystatechange", s = {}, o = {}, d = {}, f, v;
15
- function h(e, t) {
16
- for (var n = 0, u = e.length; n < u; ++n) if (!t(e[n])) return I;
17
- return 1;
18
- }
19
- function g(e, t) {
20
- h(e, function(n) {
21
- return t(n), 1;
22
- });
23
- }
24
- function l(e, t, n) {
25
- e = e[m] ? e : [e];
26
- var u = t && t.call, r = u ? t : n, U = u ? e.join("") : t, W = e.length;
27
- function w(c) {
28
- return c.call ? c() : s[c];
29
- }
30
- function y() {
31
- if (!--W) {
32
- s[U] = 1, r && r();
33
- for (var c in o)
34
- h(c.split("|"), w) && !g(o[c], w) && (o[c] = []);
35
- }
36
- }
37
- return setTimeout(function() {
38
- g(e, function c(a, j) {
39
- if (a === null) return y();
40
- if (!j && !/^https?:\/\//.test(a) && f && (a = a.indexOf(".js") === -1 ? f + a + ".js" : f + a), d[a])
41
- return d[a] == 2 ? y() : setTimeout(function() {
42
- c(a, !0);
43
- }, 0);
44
- d[a] = 1, b(a, y);
45
- });
46
- }, 0), l;
47
- }
48
- function b(e, t) {
49
- var n = i.createElement("script"), u;
50
- n.onload = n.onerror = n[A] = function() {
51
- n[S] && !/^c|loade/.test(n[S]) || u || (n.onload = n[A] = null, u = 1, d[e] = 2, t());
52
- }, n.async = 1, n.src = v ? e + (e.indexOf("?") === -1 ? "?" : "&") + v : e, p.insertBefore(n, p.lastChild);
53
- }
54
- return l.get = b, l.order = function(e, t, n) {
55
- (function u(r) {
56
- r = e.shift(), e.length ? l(r, u) : l(r, t, n);
57
- })();
58
- }, l.path = function(e) {
59
- f = e;
60
- }, l.urlArgs = function(e) {
61
- v = e;
62
- }, l.ready = function(e, t, n) {
63
- e = e[m] ? e : [e];
64
- var u = [];
65
- return !g(e, function(r) {
66
- s[r] || u[m](r);
67
- }) && h(e, function(r) {
68
- return s[r];
69
- }) ? t() : function(r) {
70
- o[r] = o[r] || [], o[r][m](t), n && n(u);
71
- }(e.join("|")), l;
72
- }, l.done = function(e) {
73
- l([null], e);
74
- }, l;
75
- });
76
- }(_)), _.exports;
77
- }
78
- var P = L();
79
- class k extends z {
80
- constructor() {
81
- super({
82
- name: "SignInWithApple",
83
- platforms: ["web"]
84
- }), this.appleScriptUrl = "https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js", this.isAppleScriptLoaded = !1;
85
- }
86
- async authorize(i) {
87
- return new Promise((p, I) => {
88
- i ? this.loadSignInWithAppleJS().then((m) => {
89
- var S, A, s;
90
- this.isAppleScriptLoaded = m, this.isAppleScriptLoaded ? (AppleID.auth.init({
91
- clientId: i.clientId,
92
- redirectURI: i.redirectURI,
93
- scope: (S = i.scopes) !== null && S !== void 0 ? S : void 0,
94
- state: (A = i.state) !== null && A !== void 0 ? A : void 0,
95
- nonce: (s = i.nonce) !== null && s !== void 0 ? s : void 0,
96
- usePopup: !0
97
- }), AppleID.auth.signIn().then((o) => {
98
- var d, f, v, h, g;
99
- const l = {
100
- response: {
101
- user: null,
102
- email: (d = o.user) === null || d === void 0 ? void 0 : d.email,
103
- givenName: (v = (f = o.user) === null || f === void 0 ? void 0 : f.name) === null || v === void 0 ? void 0 : v.firstName,
104
- familyName: (g = (h = o.user) === null || h === void 0 ? void 0 : h.name) === null || g === void 0 ? void 0 : g.lastName,
105
- identityToken: o.authorization.id_token,
106
- authorizationCode: o.authorization.code
107
- }
108
- };
109
- p(l);
110
- }).catch((o) => {
111
- I(o);
112
- })) : I("Unable to load Sign in with Apple JS framework.");
113
- }) : I("No options were provided.");
114
- });
115
- }
116
- loadSignInWithAppleJS() {
117
- return new Promise((i) => {
118
- this.isAppleScriptLoaded ? i(!0) : typeof window !== void 0 ? P.get(this.appleScriptUrl, () => i(!0)) : i(!1);
119
- });
120
- }
121
- }
122
- export {
123
- k as SignInWithAppleWeb
124
- };
File without changes