@mixd-id/web-scaffold 0.1.230406223 → 0.1.230406225

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.230406223",
4
+ "version": "0.1.230406225",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -0,0 +1,93 @@
1
+ <template>
2
+ <button type="button" @click="login">
3
+ <slot>
4
+ Login with Facebook
5
+ </slot>
6
+ </button>
7
+ </template>
8
+
9
+ <script>
10
+
11
+ export default{
12
+
13
+ emits: [ 'login' ],
14
+
15
+ props: {
16
+
17
+ appId: String,
18
+
19
+ scope: {
20
+ type: String,
21
+ default: 'public_profile,email'
22
+ },
23
+
24
+ version: {
25
+ type: String,
26
+ default: 'v18.0'
27
+ }
28
+
29
+ },
30
+
31
+ data(){
32
+ return {
33
+ text: '',
34
+ }
35
+ },
36
+
37
+ mounted() {
38
+ this.loadScript();
39
+ },
40
+
41
+ methods: {
42
+
43
+ onResponse(){
44
+ FB.api('/me', { fields:'name,email' }, function(response){
45
+ console.log('#11', response)
46
+ this.$emit('login', response)
47
+ });
48
+ },
49
+
50
+ login(){
51
+ FB.getLoginStatus((response) => {
52
+ if(response.status === 'connected'){
53
+ this.onResponse(response)
54
+ }
55
+ else{
56
+ FB.login((response) => {
57
+ if(response.status === 'connected'){
58
+ this.onResponse(response)
59
+ }
60
+ },
61
+ { scope: this.scope }
62
+ );
63
+ }
64
+ });
65
+ },
66
+
67
+ loadScript(){
68
+ if('FB' in window) return
69
+
70
+ (function(d, s, id){
71
+ var js, fjs = d.getElementsByTagName(s)[0];
72
+ if (d.getElementById(id)) {return;}
73
+ js = d.createElement(s); js.id = id;
74
+ js.src = "https://connect.facebook.net/en_US/sdk.js";
75
+ fjs.parentNode.insertBefore(js, fjs);
76
+ }(document, 'script', 'facebook-jssdk')
77
+ );
78
+
79
+ window.fbAsyncInit = () => {
80
+ FB.init({
81
+ appId: this.appId,
82
+ xfbml: true,
83
+ version: this.version
84
+ });
85
+ };
86
+ }
87
+
88
+
89
+ }
90
+
91
+ }
92
+
93
+ </script>
@@ -0,0 +1,95 @@
1
+ <template>
2
+ <button type="button" @click="login">
3
+ <slot>
4
+ Sign In with Google
5
+ </slot>
6
+ </button>
7
+ </template>
8
+
9
+ <script>
10
+
11
+ export default{
12
+
13
+ emits: [ 'login' ],
14
+
15
+ props: {
16
+
17
+ apiKey: String
18
+
19
+ },
20
+
21
+ mounted() {
22
+ this.loadScript();
23
+ },
24
+
25
+ data(){
26
+ return {
27
+ auth2: null
28
+ }
29
+ },
30
+
31
+ methods: {
32
+
33
+ async loadScript(){
34
+ if("gapi" in window) return
35
+
36
+ /*await new Promise(api_ready => document.head.append(Object.assign(
37
+ document.createElement('script'),
38
+ {
39
+ src: 'https://apis.google.com/js/api.js',
40
+ onload: api_ready,
41
+ })));
42
+
43
+ await new Promise(auth2_ready => gapi.load('auth2', auth2_ready));
44
+
45
+ const googleAuth = await new Promise(init_done => gapi.auth2.init({
46
+ client_id: this.apiKey,
47
+ scope: 'profile email',
48
+ }).then(googleAuthWithThen => init_done(Object.assign(googleAuthWithThen, {
49
+ then: undefined,
50
+ }))));
51
+
52
+ console.log('googleAuth =', googleAuth);*/
53
+
54
+ const script = document.createElement('script')
55
+ script.src = 'https://apis.google.com/js/api:client.js'
56
+ document.head.appendChild(script)
57
+ script.addEventListener('load', () => {
58
+ window.gapi.load('auth2', () => {
59
+ var authObj = {
60
+ client_id: this.apiKey,
61
+ scope: 'profile email',
62
+ cookiepolicy: 'single_host_origin'
63
+ };
64
+ console.log(authObj)
65
+ window.gapi.auth2.init(authObj)
66
+ .then(function(gAuth){
67
+ console.log('gAuth', gAuth)
68
+ })
69
+ })
70
+ })
71
+ },
72
+
73
+ login(){
74
+ gapi.auth2.getAuthInstance().signIn()
75
+ .then((googleUser) => {
76
+ console.log('googleUser', googleUser)
77
+ var profile = googleUser.getBasicProfile();
78
+ var idToken = googleUser.getAuthResponse().id_token;
79
+ const name = profile.getName()
80
+ const imageUrl = profile.getImageUrl()
81
+ const email = profile.getEmail()
82
+ this.$emit('login', {
83
+ idToken,
84
+ name,
85
+ imageUrl,
86
+ email
87
+ })
88
+ })
89
+ }
90
+
91
+ }
92
+
93
+ }
94
+
95
+ </script>
@@ -106,7 +106,7 @@ import axios from "axios";
106
106
 
107
107
  export default{
108
108
 
109
- emit: [ 'complete' ],
109
+ emits: [ 'complete' ],
110
110
 
111
111
  inject: [ 'socketEmit', 'socket', 'toast' ],
112
112
 
@@ -124,6 +124,8 @@ export default{
124
124
 
125
125
  urlImport: { type: String },
126
126
 
127
+ useHttp: [ Boolean, String, Number ],
128
+
127
129
  completeDescription: { type: String, default: "" },
128
130
 
129
131
  warningFile: { type: String, default: "warning.txt" },
@@ -144,6 +144,8 @@ export default{
144
144
  },
145
145
 
146
146
  handleScroll: throttle(function(){
147
+ if(!this.$refs.scroller) return
148
+
147
149
  this.scrollTop = this.$el.scrollTop
148
150
 
149
151
  if(this.scrollTop > this.$refs.scroller.offsetHeight - this.$el.clientHeight - this.itemHeight){
package/src/index.js CHANGED
@@ -4,7 +4,7 @@ import throttle from "lodash/throttle"
4
4
 
5
5
  let _UNIQID = 0
6
6
  const uniqid = (additionalKey = '') => {
7
- return '_c' + additionalKey + (new Date().getTime()).toString().substring(8) + _UNIQID++
7
+ return 'u' + Math.random().toString(36).substr(2) + Date.now().toString(36)
8
8
  }
9
9
 
10
10
  const mediaBreakpoints = {
@@ -432,6 +432,8 @@ export default{
432
432
  app.component('YoutubeVideo', defineAsyncComponent(() => import("./components/YoutubeVideo.vue")))
433
433
  app.component('Svg', defineAsyncComponent(() => import("./components/Svg.vue")))
434
434
  app.component('ConversationBuilder', defineAsyncComponent(() => import("./components/ConversationBuilder.vue")))
435
+ //app.component('FBLogin', defineAsyncComponent(() => import("./components/FBLogin.vue")))
436
+ //app.component('GSignIn', defineAsyncComponent(() => import("./components/GSignIn.vue")))
435
437
 
436
438
  app.component('AhrefSetting', defineAsyncComponent(() => import("./widgets/AhrefSetting.vue")))
437
439
  app.component('ArticleSetting', defineAsyncComponent(() => import("./widgets/ArticleSetting.vue")))