@mixd-id/web-scaffold 0.1.230406224 → 0.1.230406226

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.230406224",
4
+ "version": "0.1.230406226",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -146,7 +146,7 @@ export default {
146
146
  }
147
147
 
148
148
  .indicator{
149
- @apply w-[21px] h-[21px] border-[1px] rounded-lg border-text-200 bg-base-50;
149
+ @apply w-[21px] h-[21px] rounded-lg border-[1px] border-text-200 bg-base-50;
150
150
  @apply flex items-center justify-center overflow-hidden;
151
151
  transition: border 300ms cubic-bezier(0.25, 1, 0.5, 1);
152
152
  }
@@ -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>
@@ -91,7 +91,7 @@ export default{
91
91
  return this.customClass ?? [
92
92
  this.$style.textarea,
93
93
  this.$style['state-' + this.computedState],
94
- this.isActive ? this.$style.active : '',
94
+ this.isActive && !this.readonly ? this.$style.active : '',
95
95
  this.align ? this.$style['align-' + this.align] : '',
96
96
  this.readonly ? this.$style.readonly : '',
97
97
  this.size ? this.$style['size-' + this.size] : ''
@@ -153,7 +153,7 @@ export default{
153
153
  @apply text-text-200;
154
154
  }
155
155
  .textarea.readonly{
156
- @apply bg-text-50;
156
+ @apply bg-transparent;
157
157
  }
158
158
 
159
159
  .size-sm{ @apply min-h-[var(--h-cp-sm)]; }
@@ -175,7 +175,7 @@ export default{
175
175
  <style module>
176
176
 
177
177
  .textbox{
178
- @apply flex items-center border-[1px] border-text-200;
178
+ @apply flex items-center border-[1px] border-text-200 bg-base-50;
179
179
  @apply rounded-lg overflow-hidden;
180
180
  }
181
181
 
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")))