@tapni/auth 0.0.60 → 0.0.62

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.
@@ -0,0 +1,124 @@
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)
15
+ if (!t(e[n]))
16
+ return I;
17
+ return 1;
18
+ }
19
+ function h(e, t) {
20
+ g(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, N = u ? e.join("") : t, U = e.length;
27
+ function b(c) {
28
+ return c.call ? c() : s[c];
29
+ }
30
+ function _() {
31
+ if (!--U) {
32
+ s[N] = 1, r && r();
33
+ for (var c in o)
34
+ g(c.split("|"), b) && !h(o[c], b) && (o[c] = []);
35
+ }
36
+ }
37
+ return setTimeout(function() {
38
+ h(e, function c(a, W) {
39
+ if (a === null)
40
+ return _();
41
+ if (!W && !/^https?:\/\//.test(a) && f && (a = a.indexOf(".js") === -1 ? f + a + ".js" : f + a), d[a])
42
+ return d[a] == 2 ? _() : setTimeout(function() {
43
+ c(a, !0);
44
+ }, 0);
45
+ d[a] = 1, x(a, _);
46
+ });
47
+ }, 0), l;
48
+ }
49
+ function x(e, t) {
50
+ var n = i.createElement("script"), u;
51
+ n.onload = n.onerror = n[A] = function() {
52
+ n[S] && !/^c|loade/.test(n[S]) || u || (n.onload = n[A] = null, u = 1, d[e] = 2, t());
53
+ }, n.async = 1, n.src = v ? e + (e.indexOf("?") === -1 ? "?" : "&") + v : e, p.insertBefore(n, p.lastChild);
54
+ }
55
+ return l.get = x, l.order = function(e, t, n) {
56
+ (function u(r) {
57
+ r = e.shift(), e.length ? l(r, u) : l(r, t, n);
58
+ })();
59
+ }, l.path = function(e) {
60
+ f = e;
61
+ }, l.urlArgs = function(e) {
62
+ v = e;
63
+ }, l.ready = function(e, t, n) {
64
+ e = e[m] ? e : [e];
65
+ var u = [];
66
+ return !h(e, function(r) {
67
+ s[r] || u[m](r);
68
+ }) && g(e, function(r) {
69
+ return s[r];
70
+ }) ? t() : function(r) {
71
+ o[r] = o[r] || [], o[r][m](t), n && n(u);
72
+ }(e.join("|")), l;
73
+ }, l.done = function(e) {
74
+ l([null], e);
75
+ }, l;
76
+ });
77
+ })(w);
78
+ var z = w.exports;
79
+ class P extends j {
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, g, h;
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: (h = (g = o.user) === null || g === void 0 ? void 0 : g.name) === null || h === void 0 ? void 0 : h.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 ? z.get(this.appleScriptUrl, () => i(!0)) : i(!1);
119
+ });
120
+ }
121
+ }
122
+ export {
123
+ P as SignInWithAppleWeb
124
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapni/auth",
3
- "version": "0.0.60",
3
+ "version": "0.0.62",
4
4
  "type": "module",
5
5
  "main": "./dist/TapniAuth.umd.js",
6
6
  "module": "./dist/TapniAuth.es.js",