@tapni/auth 1.0.7 → 1.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapni/auth",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "type": "module",
5
5
  "main": "./dist/TapniAuth.umd.js",
6
6
  "module": "./dist/TapniAuth.es.js",
@@ -24,7 +24,6 @@
24
24
  "dependencies": {
25
25
  "@braintree/sanitize-url": "^7.1.0",
26
26
  "@capacitor-community/apple-sign-in": "^6.0.0",
27
- "@capacitor-community/facebook-login": "^6.0.0",
28
27
  "@capacitor/app": "^6.0.2",
29
28
  "@capacitor/browser": "^6.0.4",
30
29
  "@capacitor/core": "^6.2.0",
@@ -42,18 +42,10 @@ export default {
42
42
  data.device_id = deviceID
43
43
  return api().post('/users/google', data)
44
44
  },
45
- facebook (data) {
46
- data.device_id = deviceID
47
- return api().post('/users/facebook', data)
48
- },
49
45
  googleSDK (data) {
50
46
  data.device_id = deviceID
51
47
  return api().post('/users/google/sdk', data)
52
48
  },
53
- facebookSDK (data) {
54
- data.device_id = deviceID
55
- return api().post('/users/facebook/sdk', data)
56
- },
57
49
  appleSDK (data) {
58
50
  data.device_id = deviceID
59
51
  return api().post('/users/apple/sdk', data)
@@ -152,27 +152,6 @@
152
152
  <span v-else class="button--loading-black button__loader"></span>
153
153
  </a>
154
154
 
155
- <!-- Facebook Login Button -->
156
- <a
157
- @click="facebookLogin"
158
- v-if="displayFacebookLogin"
159
- class="button-center button button-90 google-button pointer"
160
- >
161
- <img
162
- src="https://cdn.tapni.co/icons/facebook-blue.png"
163
- style="
164
- position: absolute;
165
- margin-left: -9px;
166
- padding: 10px 0;
167
- height: 100%;
168
- "
169
- />
170
- <span v-if="!facebookLoad"
171
- >{{ ssoLang[appLanguage].sign_in_with }} Facebook</span
172
- >
173
- <span v-else class="button--loading-black button__loader"></span>
174
- </a>
175
-
176
155
  <!-- Microsoft Login Button -->
177
156
  <a
178
157
  @click="microsoftLogin"
@@ -314,7 +293,6 @@
314
293
 
315
294
  <script>
316
295
  import GoogleMixin from "../mixins/google.mixin";
317
- import FacebookMixin from "../mixins/facebook.mixin";
318
296
  import AppleMixin from "../mixins/apple.mixin";
319
297
  import MicrosoftMixin from "../mixins/microsoft.mixin";
320
298
  import OktaMixin from "../mixins/okta.mixin";
@@ -325,7 +303,7 @@ import { EventBus } from "../store/event-bus";
325
303
  import to from "await-to-js";
326
304
  export default {
327
305
  name: "AuthLogin",
328
- mixins: [GoogleMixin, FacebookMixin, AppleMixin, MicrosoftMixin, OktaMixin, SamlMixin, AuthMixin, QRAuthMixin],
306
+ mixins: [GoogleMixin, AppleMixin, MicrosoftMixin, OktaMixin, SamlMixin, AuthMixin, QRAuthMixin],
329
307
  data() {
330
308
  return {
331
309
  loading: true,
@@ -66,15 +66,6 @@
66
66
  <span v-else class="button--loading-black button__loader"></span>
67
67
  </a>
68
68
 
69
- <!-- Facebook Login Button -->
70
- <a v-if="displayFacebookLogin"
71
- @click="facebookLogin"
72
- class="button-center button button-90 google-button pointer">
73
- <img src="https://cdn.tapni.co/icons/facebook-blue.png" style="position: absolute; margin-left: -10px; padding: 10px 0; height: 100%;"/>
74
- <span v-if="!facebookLoad">{{ssoLang[this.appLanguage].sign_up_with}} Facebook</span>
75
- <span v-else class="button--loading-black button__loader"></span>
76
- </a>
77
-
78
69
  <!-- Email Login Button -->
79
70
  <a @click="emailLogin = true" v-if="!emailLogin"
80
71
  class="button-center button button-90 google-button pointer">
@@ -103,14 +94,13 @@
103
94
 
104
95
  <script>
105
96
  import GoogleMixin from '../mixins/google.mixin'
106
- import FacebookMixin from '../mixins/facebook.mixin'
107
97
  import AppleMixin from '../mixins/apple.mixin'
108
98
  import MicrosoftMixin from '../mixins/microsoft.mixin'
109
99
  import {EventBus} from "../store/event-bus";
110
100
  import AuthMixin from "../mixins/auth.mixin";
111
101
  export default {
112
102
  name: 'AuthRegister',
113
- mixins: [GoogleMixin, FacebookMixin, AppleMixin, MicrosoftMixin, AuthMixin],
103
+ mixins: [GoogleMixin, AppleMixin, MicrosoftMixin, AuthMixin],
114
104
  props: {
115
105
  isModal: {
116
106
  type: Boolean,
@@ -1,92 +0,0 @@
1
- import { WebPlugin as i } from "@capacitor/core";
2
- class u extends i {
3
- async initialize(e) {
4
- const n = { version: "v17.0" };
5
- return await this.loadScript(e.locale), FB.init(Object.assign(Object.assign({}, n), e));
6
- }
7
- loadScript(e) {
8
- if (typeof document > "u")
9
- return Promise.reject("document global not found");
10
- const n = "fb";
11
- if (document.getElementById(n))
12
- return Promise.resolve();
13
- const r = document.getElementsByTagName("head")[0], s = document.createElement("script");
14
- return new Promise((o) => {
15
- s.onload = () => o(), s.defer = !0, s.async = !0, s.id = n, s.src = `https://connect.facebook.net/${e ?? "en_US"}/sdk.js`, r.appendChild(s);
16
- });
17
- }
18
- async login(e) {
19
- return new Promise((n, t) => {
20
- FB.login((r) => {
21
- r.status === "connected" ? n({
22
- accessToken: {
23
- token: r.authResponse.accessToken
24
- }
25
- }) : t({
26
- accessToken: {
27
- token: null
28
- }
29
- });
30
- }, { scope: e.permissions.join(",") });
31
- });
32
- }
33
- async logout() {
34
- return new Promise((e) => FB.logout(() => e()));
35
- }
36
- async reauthorize() {
37
- return new Promise((e) => FB.reauthorize((n) => e(n)));
38
- }
39
- async getCurrentAccessToken() {
40
- return new Promise((e, n) => {
41
- FB.getLoginStatus((t) => {
42
- if (t.status === "connected") {
43
- const r = {
44
- accessToken: {
45
- applicationId: void 0,
46
- declinedPermissions: [],
47
- expires: void 0,
48
- isExpired: void 0,
49
- lastRefresh: void 0,
50
- permissions: [],
51
- token: t.authResponse.accessToken,
52
- userId: t.authResponse.userID
53
- }
54
- };
55
- e(r);
56
- } else
57
- n({
58
- accessToken: {
59
- token: null
60
- }
61
- });
62
- });
63
- });
64
- }
65
- async getProfile(e) {
66
- const n = e.fields.join(",");
67
- return new Promise((t, r) => {
68
- FB.api("/me", { fields: n }, (s) => {
69
- if (s.error) {
70
- r(s.error.message);
71
- return;
72
- }
73
- t(s);
74
- });
75
- });
76
- }
77
- async logEvent() {
78
- return Promise.resolve();
79
- }
80
- async setAutoLogAppEventsEnabled() {
81
- return Promise.resolve();
82
- }
83
- async setAdvertiserTrackingEnabled() {
84
- return Promise.resolve();
85
- }
86
- async setAdvertiserIDCollectionEnabled() {
87
- return Promise.resolve();
88
- }
89
- }
90
- export {
91
- u as FacebookLoginWeb
92
- };
@@ -1,78 +0,0 @@
1
- import to from 'await-to-js'
2
- import AuthService from '../services/AuthService'
3
- import { FacebookLogin } from '@capacitor-community/facebook-login';
4
- import {EventBus} from "../store/event-bus";
5
-
6
- window.fbAsyncInit = function () {
7
- // eslint-disable-next-line no-undef
8
- FB.init({
9
- appId: '202577611527680',
10
- cookie: true, // enable cookies to allow the server to access the session
11
- xfbml: true, // parse social plugins on this page
12
- version: 'v16.0' // use graph api current version
13
- })
14
- };
15
-
16
- // Load the SDK asynchronously
17
- (function (d, s, id) {
18
- // eslint-disable-next-line one-var
19
- var js, fjs = d.getElementsByTagName(s)[0]
20
- if (d.getElementById(id)) return
21
- js = d.createElement(s); js.id = id
22
- js.src = 'https://connect.facebook.net/en_US/sdk.js'
23
- fjs.parentNode.insertBefore(js, fjs)
24
- }(document, 'script', 'facebook-jssdk'))
25
-
26
- export default {
27
- data () {
28
- return {
29
- facebookLoad: false
30
- }
31
- },
32
- computed: {
33
- fbLoginUrl () {
34
- return 'https://www.facebook.com/v16.0/dialog/oauth?client_id=202577611527680&state={"oauth":"facebook"}&response_type=code%20granted_scopes&scope=email&redirect_uri=https://' + window.location.host + '/login'
35
- },
36
- displayFacebookLogin () {
37
- return false;
38
- }
39
- },
40
- methods: {
41
- async facebookLogin () {
42
- this.facebookLoad = true
43
- const FACEBOOK_PERMISSIONS = ['email']
44
- const [errAuth, user] = await to(FacebookLogin.login({permissions: FACEBOOK_PERMISSIONS}))
45
- if (errAuth) return this.facebookLoad = false
46
-
47
- // Track Referrals
48
- if (this.referral) user.ref = this.referral;
49
-
50
- if (this.display === 'popup') user.response_type = 'code';
51
-
52
- if (user && user.accessToken) {
53
-
54
- const [err, response] = await to(AuthService.facebookSDK(user, this.$storex))
55
- if (err) {
56
- this.facebookLoad = false
57
- EventBus.$emit('ssoEvent', {name: 'setLoading', data: false})
58
- return this.errorHandler(err)
59
- }
60
- if (response.data.success) {
61
- if (this.display === 'popup') {
62
- return window.parent?.postMessage({ code: response.data.auth_code, state: this.$route.query.state }, '*');
63
- }
64
- await this.loginSetup(response)
65
- await this.getLoggedInAccounts()
66
- this.$router.push('/' + response.data.data.username + '#edit')
67
- setTimeout(() => {
68
- this.facebookLoad = false
69
- EventBus.$emit('ssoEvent', {name: 'setLoading', data: false})
70
- }, 1000)
71
- } else this.errorSnack(this.ssoLang[this.appLanguage].unexpected_err)
72
- } else {
73
- this.facebookLoad = false
74
- EventBus.$emit('ssoEvent', {name: 'setLoading', data: false})
75
- }
76
- }
77
- }
78
- }