@tapni/auth 0.0.1

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.
Files changed (69) hide show
  1. package/.env.development +5 -0
  2. package/.env.production +8 -0
  3. package/.env.staging +8 -0
  4. package/.env.standalone +4 -0
  5. package/.vscode/extensions.json +3 -0
  6. package/README.md +29 -0
  7. package/index.html +35 -0
  8. package/jsconfig.json +8 -0
  9. package/package.json +46 -0
  10. package/public/.gitkeep +0 -0
  11. package/public/.well-known/apple-app-site-association +11 -0
  12. package/public/.well-known/assetlinks.json +12 -0
  13. package/public/.well-known/microsoft-identity-association.json +7 -0
  14. package/public/android-chrome-192x192.png +0 -0
  15. package/public/android-chrome-512x512.png +0 -0
  16. package/public/apple-touch-icon.png +0 -0
  17. package/public/favicon-16x16.png +0 -0
  18. package/public/favicon-32x32.png +0 -0
  19. package/public/favicon.ico +0 -0
  20. package/public/icon.png +0 -0
  21. package/public/site.webmanifest +1 -0
  22. package/src/App.vue +269 -0
  23. package/src/components/Language.vue +158 -0
  24. package/src/components/LinkIcon.vue +288 -0
  25. package/src/components/ModalOverlay.vue +67 -0
  26. package/src/components/SSO.vue +126 -0
  27. package/src/components/SSOPick.vue +166 -0
  28. package/src/install.js +8 -0
  29. package/src/main.js +96 -0
  30. package/src/mixins/apple.mixin.js +60 -0
  31. package/src/mixins/auth.mixin.js +525 -0
  32. package/src/mixins/facebook.mixin.js +78 -0
  33. package/src/mixins/global.mixin.js +110 -0
  34. package/src/mixins/google.mixin.js +61 -0
  35. package/src/mixins/microsoft.mixin.js +88 -0
  36. package/src/mixins/okta.mixin.js +132 -0
  37. package/src/mixins/qr-auth.mixin.js +112 -0
  38. package/src/mixins/saml.mixin.js +84 -0
  39. package/src/router/index.js +9 -0
  40. package/src/routes.js +55 -0
  41. package/src/services/Api.js +55 -0
  42. package/src/services/AuthService.js +71 -0
  43. package/src/services/CompanyService.js +13 -0
  44. package/src/services/DeviceService.js +10 -0
  45. package/src/services/UserService.js +49 -0
  46. package/src/services/UtilService.js +221 -0
  47. package/src/store/constants.js +8 -0
  48. package/src/store/event-bus.js +30 -0
  49. package/src/store/locales/cn.js +462 -0
  50. package/src/store/locales/de.js +528 -0
  51. package/src/store/locales/en.js +514 -0
  52. package/src/store/locales/es.js +536 -0
  53. package/src/store/locales/fr.js +520 -0
  54. package/src/store/locales/it.js +518 -0
  55. package/src/store/locales/kr.js +496 -0
  56. package/src/store/locales/lang.js +47 -0
  57. package/src/store/locales/sr.js +497 -0
  58. package/src/store/locales/tr.js +491 -0
  59. package/src/styles/framework.css +4012 -0
  60. package/src/styles/inter.ttf +0 -0
  61. package/src/styles/style.css +618 -0
  62. package/src/views/Callback.vue +47 -0
  63. package/src/views/Login.vue +389 -0
  64. package/src/views/QR.vue +39 -0
  65. package/src/views/Register.vue +217 -0
  66. package/src/views/Reset.vue +155 -0
  67. package/src/views/Verify.vue +170 -0
  68. package/src/views/Welcome.vue +69 -0
  69. package/vite.config.js +58 -0
@@ -0,0 +1,288 @@
1
+ <template>
2
+ <a
3
+ class="disable-select"
4
+ :class="linkStyle + (disabled ? ' opacity-50' : '')"
5
+ :style="
6
+ (editing ? 'cursor: move' : 'cursor: pointer') +
7
+ '!important; overflow: visible;'
8
+ "
9
+ >
10
+
11
+ <span
12
+ :class="{
13
+ 'user-link-img': true,
14
+ 'pulse pulse-border': pulse,
15
+ 'link-drag': editing,
16
+ }"
17
+ :style="{ ...customLinkStyle?.linkIcon }"
18
+ >
19
+ <img
20
+ v-if="!data.custom_icon && data.type !== 'customlink'"
21
+ :src="'https://cdn.tapni.co/icons/' + data.type + '.png'"
22
+ class="responsive-image"
23
+ :alt="data.text"
24
+ @load="$emit('loaded')"
25
+ @error="$emit('loaded')"
26
+ />
27
+ <img
28
+ v-else-if="
29
+ !data.custom_icon && data.type === 'customlink' && linkAdding
30
+ "
31
+ :src="'https://cdn.tapni.co/icons/custom-icon-128.gif'"
32
+ class="responsive-image"
33
+ :alt="data.text"
34
+ @load="$emit('loaded')"
35
+ @error="$emit('loaded')"
36
+ />
37
+ <img
38
+ v-else-if="
39
+ !data.custom_icon && data.type === 'customlink' && !linkAdding
40
+ "
41
+ :src="'https://cdn.tapni.co/icons/customlink.png'"
42
+ class="responsive-image"
43
+ :alt="data.text"
44
+ @load="$emit('loaded')"
45
+ @error="$emit('loaded')"
46
+ />
47
+ <img
48
+ v-else
49
+ :src="data.style.custom_icon"
50
+ style="border-radius: 22.46%"
51
+ class="responsive-image"
52
+ :alt="data.text"
53
+ @load="$emit('loaded')"
54
+ @error="$emit('loaded')"
55
+ />
56
+ </span>
57
+
58
+ <span
59
+ class="link-text link-drag color-black"
60
+ :style="{ color: customLinkStyle?.color }"
61
+ >
62
+ {{ linkText }}
63
+ </span>
64
+ </a>
65
+ </template>
66
+
67
+ <script>
68
+ import AuthMixin from '../mixins/auth.mixin';
69
+
70
+ export default {
71
+ name: "LinkIcon",
72
+ mixins: [AuthMixin],
73
+ props: {
74
+ linkAdding: {
75
+ type: Boolean,
76
+ required: false,
77
+ default: false,
78
+ },
79
+ hideExternalIcon: {
80
+ type: Boolean,
81
+ required: false,
82
+ default: false,
83
+ },
84
+ switching: {
85
+ type: Boolean,
86
+ required: false,
87
+ default: false,
88
+ },
89
+ pulse: {
90
+ type: Boolean,
91
+ required: false,
92
+ default: false,
93
+ },
94
+ editing: {
95
+ type: Boolean,
96
+ required: false,
97
+ default: true,
98
+ },
99
+ directPick: {
100
+ type: Boolean,
101
+ required: false,
102
+ default: false,
103
+ },
104
+ disabled: {
105
+ type: Boolean,
106
+ required: false,
107
+ default: false,
108
+ },
109
+ to: {
110
+ type: String,
111
+ required: false,
112
+ default: "",
113
+ },
114
+ linkStyle: {
115
+ type: String,
116
+ required: false,
117
+ default: "link-grid",
118
+ },
119
+ data: {
120
+ type: Object,
121
+ required: true,
122
+ },
123
+ customLinkStyle: {
124
+ type: Object,
125
+ required: false,
126
+ default: () => {},
127
+ },
128
+ shareIconStyle: {
129
+ type: Object,
130
+ required: false,
131
+ default: () => {},
132
+ },
133
+ },
134
+ computed: {
135
+ linkText() {
136
+ if (this.appLang !== "en" && this.data.text) {
137
+ return (
138
+ this.ssoLang[this.appLang][
139
+ "link_text_" +
140
+ this.data.text.toLowerCase().trim().replace(/ /g, "_")
141
+ ] || this.data.text
142
+ );
143
+ }
144
+ return this.data.text;
145
+ },
146
+ },
147
+ methods: {
148
+ },
149
+ };
150
+ </script>
151
+
152
+ <style>
153
+ /* ********* */
154
+ /* Link Grid */
155
+ /* ********* */
156
+ .link-grid,
157
+ .user-link-img {
158
+ width: 100%;
159
+ display: inline-table;
160
+ position: relative;
161
+ }
162
+
163
+ .link-grid {
164
+ width: 30%;
165
+ margin: 1.6%;
166
+ padding: 1.6%;
167
+ }
168
+
169
+ .link-grid .user-link-img img {
170
+ /* box-shadow: 0px 2px 10px rgba(200,200,200,0.8); */
171
+ /* border: 1px solid #e8e8e8; */
172
+ border-radius: 25% !important;
173
+ }
174
+
175
+ .link-grid .edit-icon {
176
+ border-radius: 20px;
177
+ right: -3%;
178
+ top: -3%;
179
+ position: absolute;
180
+ z-index: 3;
181
+ max-width: 23%;
182
+ overflow: hidden;
183
+ min-width: 30px;
184
+ }
185
+
186
+ .link-grid .direct-icon {
187
+ border-radius: 20px;
188
+ left: -3%;
189
+ top: -3%;
190
+ position: absolute;
191
+ z-index: 555;
192
+ max-width: 23%;
193
+ overflow: hidden;
194
+ min-width: 30px;
195
+ }
196
+
197
+ .link-grid .link-text {
198
+ min-height: 20px;
199
+ margin-top: 3px !important;
200
+ display: block;
201
+ text-align: center;
202
+ line-height: normal;
203
+ overflow-wrap: anywhere;
204
+ }
205
+
206
+ /* ********* */
207
+ /* Link List */
208
+ /* ********* */
209
+ .link-list {
210
+ width: 93%;
211
+ max-height: 67px !important;
212
+ margin: 0px auto;
213
+ display: flex;
214
+ border-radius: 15px !important;
215
+ background-color: #ffffff;
216
+ /* box-shadow: 0px 2px 5px rgba(0,0,0,0.15); */
217
+ border: solid 1px #e8e8e8;
218
+ position: relative;
219
+ align-items: center;
220
+ }
221
+
222
+ .link-list .user-link-img {
223
+ display: inline-block;
224
+ width: 65px;
225
+ /* box-shadow: 0px 3px 6px rgba(0,0,0,0.16); */
226
+ border-radius: 25% !important;
227
+ }
228
+
229
+ .link-list .link-text {
230
+ display: inline-block;
231
+ padding: 18px 0% 17px 10%;
232
+ font-size: 15px;
233
+ font-weight: 500;
234
+ white-space: nowrap;
235
+ text-overflow: ellipsis;
236
+ overflow: hidden;
237
+ flex: 1;
238
+ text-align: left;
239
+ border-radius: 15px !important;
240
+ }
241
+
242
+ .link-list .edit-icon {
243
+ border-radius: 20px;
244
+ right: 7%;
245
+ top: 30%;
246
+ position: absolute;
247
+ z-index: 3;
248
+ width: 26px;
249
+ overflow: hidden;
250
+ }
251
+
252
+ .link-list .switching {
253
+ width: 45px;
254
+ }
255
+
256
+ .link-list .direct-icon {
257
+ border-radius: 20px;
258
+ left: -2%;
259
+ top: -13%;
260
+ position: absolute;
261
+ z-index: 555;
262
+ width: 26px;
263
+ overflow: hidden;
264
+ }
265
+ /* ********* */
266
+
267
+ .small {
268
+ width: 22% !important;
269
+ margin: 2% 4% 0%;
270
+ padding: 0%;
271
+ }
272
+ .small .link-text {
273
+ margin-top: 0px !important;
274
+ font-size: 13px;
275
+ }
276
+
277
+ .linkExternal {
278
+ margin-right: 20px;
279
+ width: 20px;
280
+ display: inline-block !important;
281
+ height: 20px;
282
+ background: black;
283
+ -webkit-mask: url(https://cdn.tapni.co/icons/link-external.svg) no-repeat
284
+ center;
285
+ mask: url(https://cdn.tapni.co/icons/link-external.svg) no-repeat center;
286
+ transform: scale(1.5);
287
+ }
288
+ </style>
@@ -0,0 +1,67 @@
1
+ <template>
2
+ <div
3
+ :class="{ 'pointer delete-menu': true, 'delete-menu-active': toggle }"
4
+ @click="toggleEmit"
5
+ ></div>
6
+
7
+ <!--
8
+ <transition name="fade">
9
+ <div v-if="toggle" class="pointer delete-menu" @click="toggleEmit"></div>
10
+ </transition>
11
+ -->
12
+ </template>
13
+
14
+ <script>
15
+ import { EventBus } from "../store/event-bus";
16
+ import AuthMixin from "../mixins/auth.mixin";
17
+
18
+ export default {
19
+ name: "ModalOverlay",
20
+ mixins: [AuthMixin],
21
+ data() {
22
+ return {
23
+ toggle: false,
24
+ };
25
+ },
26
+ mounted() {
27
+ EventBus.$on("closeModal", () => {
28
+ this.toggle = false;
29
+ window.document.body.style.overflow = "auto";
30
+ window.document.body.style.height = "auto";
31
+ });
32
+ EventBus.$on("openModalOverlay", () => {
33
+ this.toggle = true;
34
+ });
35
+ // EventBus.$on('togglePasswordModal', this.toggleModal)
36
+ // EventBus.$on('toggleAddAccountModal', this.toggleModal)
37
+ // EventBus.$on("toggleAccountSettingsModal", this.toggleModal);
38
+ EventBus.$on("toggleLanguageModal", this.toggleModal);
39
+ EventBus.$on("toggleSSOModal", this.toggleModal);
40
+ EventBus.$on("toggleSSOPickModal", this.toggleModal);
41
+ },
42
+ methods: {
43
+ toggleModal(shouldToggle = true) {
44
+ if (shouldToggle) {
45
+ this.toggle = !this.toggle;
46
+ if (this.toggle) {
47
+ window.document.body.style.overflow = "hidden";
48
+ window.document.body.style.height = "100vh";
49
+ } else {
50
+ window.document.body.style.overflow = "auto";
51
+ window.document.body.style.height = "auto";
52
+ }
53
+ }
54
+ },
55
+ toggleEmit() {
56
+ if(!this.isLoggedIn && this.user?.lead_form?.forceFilling) return;
57
+ EventBus.$emit("closeModal");
58
+ },
59
+ },
60
+ };
61
+ </script>
62
+
63
+ <style scoped>
64
+ .fade-enter-to /* .fade-leave-active below version 2.1.8 */ {
65
+ opacity: 1;
66
+ }
67
+ </style>
@@ -0,0 +1,126 @@
1
+ <template>
2
+ <form
3
+ @submit.prevent="submit"
4
+ class="menu-wrapper menu-light menu-modal center-text activate-page"
5
+ :class="{ 'active-menu': toggle }"
6
+ style="height: auto; margin-top: -172.5px"
7
+ >
8
+ <a
9
+ @click="forceClose"
10
+ class="color-black pull-right pointer"
11
+ style="margin-top: 5px; position: absolute; right: 5px"
12
+ >
13
+ <i class="font-17 color-black">
14
+ <img
15
+ src="https://cdn.tapni.co/icons/down-arrow.png"
16
+ class="responsive-image"
17
+ style="width: 45%"
18
+ />
19
+ </i>
20
+ </a>
21
+ <h3 class="bold center-text color-black half-top half-bottom">
22
+ {{ ssoLang[appLang].enter_company_email }}
23
+ </h3>
24
+ <div>
25
+ <input
26
+ type="text"
27
+ v-model="email"
28
+ :placeholder="ssoLang[this.appLang].email"
29
+ autocomplete="off"
30
+ autocorrect="off"
31
+ autocapitalize="off"
32
+ spellcheck="false"
33
+ class="edit-input h-40 lh-40"
34
+ style="width: 80%"
35
+ required
36
+ @keydown.space.prevent
37
+ />
38
+ </div>
39
+
40
+ <button
41
+ type="submit"
42
+ class="button black-button white-button button-full"
43
+ style="margin: 0 auto; margin-top: 25px; margin-bottom: 30px"
44
+ >
45
+ <span v-if="!loading">{{ ssoLang[appLang].continue }} </span>
46
+ <span v-else class="button--loading button__loader"></span>
47
+ </button>
48
+ </form>
49
+ </template>
50
+
51
+ <script>
52
+ import { EventBus } from "../store/event-bus";
53
+ import MicrosoftMixin from "../mixins/microsoft.mixin";
54
+ import OktaMixin from "../mixins/okta.mixin";
55
+ import SamlMixin from "../mixins/saml.mixin";
56
+ import AuthMixin from "../mixins/auth.mixin";
57
+ export default {
58
+ name: "SSO",
59
+ mixins: [MicrosoftMixin, OktaMixin, SamlMixin, AuthMixin],
60
+ data() {
61
+ return {
62
+ toggle: false,
63
+ email: "",
64
+ loading: false,
65
+ };
66
+ },
67
+ mounted() {
68
+ EventBus.$on("toggleSSOModal", this.toggleModal);
69
+ EventBus.$on("closeModal", () => {
70
+ this.toggle = false;
71
+ });
72
+ },
73
+ beforeDestroy() {
74
+ EventBus["_events"]["toggleSSOModal"].pop();
75
+ },
76
+ methods: {
77
+ forceClose() {
78
+ EventBus.$emit("closeModal");
79
+ },
80
+ close() {
81
+ this.toggleModal();
82
+ },
83
+ async submit() {
84
+ this.loading = true;
85
+ const response = await this.getCompanyBySSOEmail({ email: this.email });
86
+ this.loading = false;
87
+ let ssoTypes;
88
+ if (!response || response.error) return;
89
+ else {
90
+ ssoTypes = Object.keys(response.sso);
91
+ if (!ssoTypes.length) {
92
+ this.forceClose();
93
+ return this.errorSnack(this.ssoLang[this.appLang].no_sso_logins);
94
+ } else if (ssoTypes.length <= 1) {
95
+ if (ssoTypes[0] === "azure")
96
+ this.microsoftLogin("sso", response.sso.azure.sso);
97
+ if (ssoTypes[0] === "okta") this.oktaLogin(response.sso.okta.sso);
98
+ if (ssoTypes[0] === "saml")
99
+ this.samlLogin(response.sso.saml.sso.loginUrl);
100
+ } else {
101
+ this.forceClose();
102
+ EventBus.$emit("toggleSSOPickModal", {
103
+ sso: response.sso,
104
+ email: this.email,
105
+ });
106
+ }
107
+ }
108
+ },
109
+ toggleModal() {
110
+ this.toggle = !this.toggle;
111
+ },
112
+ },
113
+ };
114
+ </script>
115
+
116
+ <style scoped>
117
+ .sso-img {
118
+ margin: 0 auto;
119
+ margin-top: 2px;
120
+ width: 35px;
121
+ }
122
+ input {
123
+ margin: 0 auto;
124
+ height: 25px;
125
+ }
126
+ </style>
@@ -0,0 +1,166 @@
1
+ <template>
2
+ <form
3
+ @submit.prevent
4
+ class="menu-wrapper menu-light menu-modal center-text activate-page"
5
+ :class="{ 'active-menu': toggle }"
6
+ style="height: auto; margin-top: -172.5px"
7
+ >
8
+ <a
9
+ @click="forceClose"
10
+ class="color-black pull-right pointer"
11
+ style="margin-top: 5px; position: absolute; right: 5px"
12
+ >
13
+ <i class="font-17 color-black">
14
+ <img
15
+ src="https://cdn.tapni.co/icons/down-arrow.png"
16
+ class="responsive-image"
17
+ style="width: 45%"
18
+ />
19
+ </i>
20
+ </a>
21
+ <h3 class="bold center-text color-black half-top half-bottom">
22
+ {{ ssoLang[appLang].select_sign_method }}
23
+ </h3>
24
+
25
+ <!-- Azure Login Button -->
26
+ <a
27
+ v-if="sso?.azure"
28
+ @click="ssoLogin('azure')"
29
+ class="button-center button black-button button-90 google-button pointer"
30
+ >
31
+ <img
32
+ src="https://cdn.tapni.co/icons/azure.png"
33
+ style="
34
+ position: absolute;
35
+ margin-left: -11px;
36
+ padding: 8px 0;
37
+ height: 100%;
38
+ "
39
+ />
40
+ <span v-if="!azureLoad"
41
+ >{{ ssoLang[appLang].sign_in_with }} Azure</span
42
+ >
43
+ <span v-else class="button--loading button__loader"></span>
44
+ </a>
45
+
46
+ <!-- Okta Login Button -->
47
+ <a
48
+ v-if="sso?.okta"
49
+ @click="ssoLogin('okta')"
50
+ class="button-center button black-button button-90 google-button pointer"
51
+ >
52
+ <img
53
+ src="https://cdn.tapni.co/icons/okta.png"
54
+ style="
55
+ position: absolute;
56
+ margin-left: -11px;
57
+ padding: 8px 0;
58
+ height: 100%;
59
+ "
60
+ />
61
+ <span v-if="!oktaLoad"
62
+ >{{ ssoLang[appLang].sign_in_with }} Okta</span
63
+ >
64
+ <span v-else class="button--loading button__loader"></span>
65
+ </a>
66
+
67
+ <!-- SAML Login Button -->
68
+ <a
69
+ v-if="sso?.saml"
70
+ @click="ssoLogin('saml')"
71
+ class="button-center button black-button button-90 google-button pointer"
72
+ >
73
+ <img
74
+ src="https://cdn.tapni.co/icons/saml.png"
75
+ style="
76
+ position: absolute;
77
+ margin-left: -11px;
78
+ padding: 8px 0;
79
+ height: 100%;
80
+ "
81
+ />
82
+ <span v-if="!samlLoad"
83
+ >{{ ssoLang[appLang].sign_in_with }} SAML</span
84
+ >
85
+ <span v-else class="button--loading button__loader"></span>
86
+ </a>
87
+ </form>
88
+ </template>
89
+
90
+ <script>
91
+ import { EventBus } from "../store/event-bus";
92
+ import MicrosoftMixin from "../mixins/microsoft.mixin";
93
+ import OktaMixin from "../mixins/okta.mixin";
94
+ import SamlMixin from "../mixins/saml.mixin";
95
+ import AuthMixin from "../mixins/auth.mixin";
96
+ export default {
97
+ name: "SSOPick",
98
+ mixins: [MicrosoftMixin, OktaMixin, SamlMixin, AuthMixin],
99
+ data() {
100
+ return {
101
+ toggle: false,
102
+ sso: null,
103
+ email: null,
104
+ azureLoad: false,
105
+ oktaLoad: false,
106
+ samlLoad: false,
107
+ };
108
+ },
109
+ mounted() {
110
+ EventBus.$on("toggleSSOPickModal", this.toggleModal);
111
+ EventBus.$on("closeModal", () => {
112
+ this.toggle = false;
113
+ });
114
+ },
115
+ beforeDestroy() {
116
+ EventBus["_events"]["toggleSSOPickModal"].pop();
117
+ },
118
+ methods: {
119
+ forceClose() {
120
+ EventBus.$emit("closeModal");
121
+ },
122
+ close() {
123
+ this.toggleModal();
124
+ },
125
+ async ssoLogin(type) {
126
+ if (type === "azure") {
127
+ this.microsoftLogin("sso", this.sso.azure.sso);
128
+ this.azureLoad = true;
129
+ }
130
+ if (type === "okta") {
131
+ this.oktaLogin(this.sso.okta.sso);
132
+ this.oktaLoad = true;
133
+ }
134
+ if (type === "saml") {
135
+ this.samlLogin(this.sso.saml.sso.loginUrl);
136
+ this.samlLoad = true;
137
+ }
138
+ },
139
+ toggleModal(data) {
140
+ this.azureLoad = false;
141
+ this.oktaLoad = false;
142
+ this.samlLoad = false;
143
+ this.sso = null;
144
+ this.email = null;
145
+
146
+ if (data) {
147
+ this.sso = data.sso;
148
+ this.email = data.email;
149
+ }
150
+ this.toggle = !this.toggle;
151
+ },
152
+ },
153
+ };
154
+ </script>
155
+
156
+ <style scoped>
157
+ .sso-img {
158
+ margin: 0 auto;
159
+ margin-top: 2px;
160
+ width: 35px;
161
+ }
162
+ input {
163
+ margin: 0 auto;
164
+ height: 25px;
165
+ }
166
+ </style>
package/src/install.js ADDED
@@ -0,0 +1,8 @@
1
+ import App from "./App.vue";
2
+
3
+ // Export the component by default
4
+ export default {
5
+ install: (app, options) => {
6
+ app.component('TapniAuth', App)
7
+ }
8
+ };