@edgedev/create-edge-app 1.1.25 → 1.1.26
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/README.md +55 -20
- package/{agent.md → agents.md} +2 -0
- package/bin/cli.js +6 -6
- package/edge/components/auth/login.vue +384 -0
- package/edge/components/auth/register.vue +396 -0
- package/edge/components/auth.vue +108 -0
- package/edge/components/autoFileUpload.vue +215 -0
- package/edge/components/billing.vue +8 -0
- package/edge/components/buttonDivider.vue +14 -0
- package/edge/components/chip.vue +34 -0
- package/edge/components/clipboardButton.vue +42 -0
- package/edge/components/cms/block.vue +529 -0
- package/edge/components/cms/blockApi.vue +212 -0
- package/edge/components/cms/blockEditor.vue +725 -0
- package/edge/components/cms/blockInput.vue +66 -0
- package/edge/components/cms/blockPicker.vue +486 -0
- package/edge/components/cms/blockRender.vue +78 -0
- package/edge/components/cms/blockSheetContent.vue +28 -0
- package/edge/components/cms/codeEditor.vue +466 -0
- package/edge/components/cms/fontUpload.vue +327 -0
- package/edge/components/cms/htmlContent.vue +807 -0
- package/edge/components/cms/init_blocks/api_with_subarrays.html +17 -0
- package/edge/components/cms/init_blocks/array_with_collection.html +7 -0
- package/edge/components/cms/init_blocks/array_with_objects.html +7 -0
- package/edge/components/cms/init_blocks/carousel.html +103 -0
- package/edge/components/cms/init_blocks/contact_us.html +69 -0
- package/edge/components/cms/init_blocks/content_with_left_image.html +27 -0
- package/edge/components/cms/init_blocks/footer.html +24 -0
- package/edge/components/cms/init_blocks/header_divider.html +7 -0
- package/edge/components/cms/init_blocks/hero.html +35 -0
- package/edge/components/cms/init_blocks/hero_carousel.html +52 -0
- package/edge/components/cms/init_blocks/newsletter.html +117 -0
- package/edge/components/cms/init_blocks/post_content.html +7 -0
- package/edge/components/cms/init_blocks/post_title_header.html +21 -0
- package/edge/components/cms/init_blocks/posts_list.html +20 -0
- package/edge/components/cms/init_blocks/properties_showcase.html +100 -0
- package/edge/components/cms/init_blocks/property_carousel.html +59 -0
- package/edge/components/cms/init_blocks/property_detail.html +112 -0
- package/edge/components/cms/init_blocks/property_detail_header.html +34 -0
- package/edge/components/cms/init_blocks/property_results.html +137 -0
- package/edge/components/cms/init_blocks/property_search.html +75 -0
- package/edge/components/cms/init_blocks/simple_array.html +7 -0
- package/edge/components/cms/mediaCard.vue +116 -0
- package/edge/components/cms/mediaManager.vue +386 -0
- package/edge/components/cms/menu.vue +1103 -0
- package/edge/components/cms/optionsSelect.vue +107 -0
- package/edge/components/cms/page.vue +1785 -0
- package/edge/components/cms/posts.vue +1083 -0
- package/edge/components/cms/site.vue +1298 -0
- package/edge/components/cms/themeDefaultMenu.vue +548 -0
- package/edge/components/cms/themeEditor.vue +426 -0
- package/edge/components/dashboard.vue +776 -0
- package/edge/components/editor.vue +671 -0
- package/edge/components/fileTree.vue +72 -0
- package/edge/components/files.vue +89 -0
- package/edge/components/formSubtypes/myOrgs.vue +214 -0
- package/edge/components/formSubtypes/users.vue +336 -0
- package/edge/components/functionChips.vue +57 -0
- package/edge/components/gError.vue +98 -0
- package/edge/components/gHelper.vue +67 -0
- package/edge/components/gInput.vue +1331 -0
- package/edge/components/loggingIn.vue +41 -0
- package/edge/components/menu.vue +137 -0
- package/edge/components/menuContent.vue +132 -0
- package/edge/components/myAccount.vue +317 -0
- package/edge/components/myOrganizations.vue +75 -0
- package/edge/components/myProfile.vue +122 -0
- package/edge/components/orgSwitcher.vue +25 -0
- package/edge/components/organizationMembers.vue +522 -0
- package/edge/components/organizationSettings.vue +271 -0
- package/edge/components/shad/breadcrumbs.vue +35 -0
- package/edge/components/shad/button.vue +43 -0
- package/edge/components/shad/checkbox.vue +73 -0
- package/edge/components/shad/combobox.vue +238 -0
- package/edge/components/shad/datepicker.vue +184 -0
- package/edge/components/shad/dialog.vue +32 -0
- package/edge/components/shad/dropdownMenu.vue +54 -0
- package/edge/components/shad/dropdownMenuItem.vue +21 -0
- package/edge/components/shad/form.vue +59 -0
- package/edge/components/shad/html.vue +877 -0
- package/edge/components/shad/input.vue +139 -0
- package/edge/components/shad/number.vue +109 -0
- package/edge/components/shad/select.vue +151 -0
- package/edge/components/shad/selectTags.vue +278 -0
- package/edge/components/shad/switch.vue +67 -0
- package/edge/components/shad/tags.vue +137 -0
- package/edge/components/shad/textarea.vue +102 -0
- package/edge/components/shad/typeMoney.vue +167 -0
- package/edge/components/sideBar.vue +288 -0
- package/edge/components/sideBarContent.vue +268 -0
- package/edge/components/sidebarProvider.vue +33 -0
- package/edge/components/tooltip.vue +16 -0
- package/edge/components/userMenu.vue +148 -0
- package/edge/components/v/alert.vue +59 -0
- package/edge/components/v/alertTitle.vue +18 -0
- package/edge/components/v/card.vue +53 -0
- package/edge/components/v/cardActions.vue +18 -0
- package/edge/components/v/cardText.vue +18 -0
- package/edge/components/v/cardTitle.vue +20 -0
- package/edge/components/v/col.vue +56 -0
- package/edge/components/v/list.vue +46 -0
- package/edge/components/v/listItem.vue +26 -0
- package/edge/components/v/listItemTitle.vue +18 -0
- package/edge/components/v/row.vue +42 -0
- package/edge/components/v/toolbar.vue +24 -0
- package/edge/composables/global.ts +519 -0
- package/edge-pull.sh +2 -0
- package/edge-push.sh +1 -0
- package/edge-status.sh +14 -0
- package/package.json +1 -1
- package/edge-components-install.sh +0 -1
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { toTypedSchema } from '@vee-validate/zod'
|
|
3
|
+
import * as z from 'zod'
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
registrationCode: {
|
|
6
|
+
type: String,
|
|
7
|
+
default: '',
|
|
8
|
+
},
|
|
9
|
+
providers: {
|
|
10
|
+
type: Array,
|
|
11
|
+
default: () => ['email', 'microsoft'],
|
|
12
|
+
},
|
|
13
|
+
title: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: 'Organization',
|
|
16
|
+
},
|
|
17
|
+
joinMessage: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: 'Join an existing organization',
|
|
20
|
+
},
|
|
21
|
+
termsLinks: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: '',
|
|
24
|
+
},
|
|
25
|
+
singleOrganization: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false,
|
|
28
|
+
},
|
|
29
|
+
showRequestedOrgId: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false,
|
|
32
|
+
},
|
|
33
|
+
requestedOrgIdLabel: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: '',
|
|
36
|
+
},
|
|
37
|
+
primaryButtonClasses: {
|
|
38
|
+
type: String,
|
|
39
|
+
required: false,
|
|
40
|
+
},
|
|
41
|
+
secondaryButtonClasses: {
|
|
42
|
+
type: String,
|
|
43
|
+
reactive: false,
|
|
44
|
+
},
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
const multipleProviders = computed(() => props.providers.length > 1)
|
|
48
|
+
|
|
49
|
+
const router = useRouter()
|
|
50
|
+
|
|
51
|
+
const route = useRoute()
|
|
52
|
+
const edgeFirebase = inject('edgeFirebase')
|
|
53
|
+
// const edgeGlobal = inject('edgeGlobal')
|
|
54
|
+
|
|
55
|
+
const state = reactive({
|
|
56
|
+
registering: false,
|
|
57
|
+
passwordVisible: false,
|
|
58
|
+
passwordShow: false,
|
|
59
|
+
terms: false,
|
|
60
|
+
form: true,
|
|
61
|
+
provider: '',
|
|
62
|
+
error: { error: false, message: '' },
|
|
63
|
+
registrationCode: '',
|
|
64
|
+
showRegistrationCode: false,
|
|
65
|
+
phone: '',
|
|
66
|
+
phoneConfirmDialog: false,
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const register = reactive({
|
|
70
|
+
meta: { name: '' },
|
|
71
|
+
email: '',
|
|
72
|
+
password: '',
|
|
73
|
+
registrationCode: props.registrationCode, // TODO - This should come from .env since it will be different on production
|
|
74
|
+
dynamicDocumentFieldValue: '',
|
|
75
|
+
phoneNumber: null,
|
|
76
|
+
phoneCode: '',
|
|
77
|
+
requestedOrgId: '',
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
const onSubmit = async () => {
|
|
81
|
+
state.registering = true
|
|
82
|
+
|
|
83
|
+
if (props.singleOrganization) {
|
|
84
|
+
register.dynamicDocumentFieldValue = register.meta.name
|
|
85
|
+
}
|
|
86
|
+
if (state.provider === 'phone') {
|
|
87
|
+
register.phoneNumber = await edgeFirebase.sendPhoneCode(`${state.phone}`)
|
|
88
|
+
if (register.phoneNumber !== false) {
|
|
89
|
+
state.phoneConfirmDialog = true
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else if (state.provider === 'emailLink') {
|
|
93
|
+
const flattenRegister = {
|
|
94
|
+
...state,
|
|
95
|
+
...register,
|
|
96
|
+
...register.meta,
|
|
97
|
+
}
|
|
98
|
+
delete flattenRegister.meta
|
|
99
|
+
delete flattenRegister.error
|
|
100
|
+
|
|
101
|
+
const queryString = Object.keys(flattenRegister).map(key => `${key}=${encodeURIComponent(flattenRegister[key])}`).join('&')
|
|
102
|
+
const url = `/app/signup?${queryString}`
|
|
103
|
+
router.push(url)
|
|
104
|
+
|
|
105
|
+
// state.phoneConfirmDialog = true
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
if (state.showRegistrationCode || !props.registrationCode) {
|
|
109
|
+
register.registrationCode = state.registrationCode
|
|
110
|
+
}
|
|
111
|
+
const result = await edgeFirebase.registerUser(register, state.provider)
|
|
112
|
+
state.error.error = !result.success
|
|
113
|
+
if (result.message === `${props.requestedOrgIdLabel} already exists.`) {
|
|
114
|
+
let orgLabel = props.requestedOrgIdLabel
|
|
115
|
+
if (!orgLabel) {
|
|
116
|
+
orgLabel = props.title
|
|
117
|
+
}
|
|
118
|
+
result.message = `${orgLabel} already exists. Please choose another.`
|
|
119
|
+
}
|
|
120
|
+
state.error.message = result.message.code ? result.message.code : result.message
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
state.registering = false
|
|
124
|
+
}
|
|
125
|
+
onMounted(() => {
|
|
126
|
+
state.provider = props.providers[0]
|
|
127
|
+
const regCode = route.query['reg-code'] ? route.query['reg-code'] : ''
|
|
128
|
+
state.registrationCode = regCode
|
|
129
|
+
if (regCode) {
|
|
130
|
+
state.showRegistrationCode = true
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
const phoneRegister = async () => {
|
|
135
|
+
const result = await edgeFirebase.registerUser(register, state.provider)
|
|
136
|
+
state.error.error = !result.success
|
|
137
|
+
state.error.message = result.message.code
|
|
138
|
+
state.phoneConfirmDialog = false
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const providerNames = {
|
|
142
|
+
email: 'With email and password',
|
|
143
|
+
phone: 'With phone number',
|
|
144
|
+
emailLink: 'With email link',
|
|
145
|
+
microsoft: 'With Microsoft',
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const phoneCodeSchema = toTypedSchema(z.object({
|
|
149
|
+
phoneCode: z.string({
|
|
150
|
+
required_error: 'Confirmation code is required',
|
|
151
|
+
}).min(1, { message: 'Confirmation code is required' }),
|
|
152
|
+
}))
|
|
153
|
+
|
|
154
|
+
const schema = computed(() => {
|
|
155
|
+
const baseSchema = {
|
|
156
|
+
name: z.string({
|
|
157
|
+
required_error: 'Name is required',
|
|
158
|
+
}).min(1, { message: 'Registration code is required' }),
|
|
159
|
+
terms: z.boolean({
|
|
160
|
+
required_error: 'You must agree to the terms and conditions',
|
|
161
|
+
}).refine(value => value, {
|
|
162
|
+
message: 'You must agree to the terms and conditions',
|
|
163
|
+
}),
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (state.provider === 'email') {
|
|
167
|
+
const passwordPattern = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\w\s]).{8,50}$/
|
|
168
|
+
|
|
169
|
+
baseSchema.email = z.string({
|
|
170
|
+
required_error: 'Email is required',
|
|
171
|
+
})
|
|
172
|
+
.email({ message: 'Invalid email address' })
|
|
173
|
+
.min(6, { message: 'Email must be at least 6 characters long' })
|
|
174
|
+
.max(50, { message: 'Email must be less than 50 characters long' })
|
|
175
|
+
|
|
176
|
+
baseSchema.password = z.string({
|
|
177
|
+
required_error: 'Password is required',
|
|
178
|
+
}).superRefine((value, ctx) => {
|
|
179
|
+
if (!passwordPattern.test(value)) {
|
|
180
|
+
ctx.addIssue({
|
|
181
|
+
code: z.ZodIssueCode.custom,
|
|
182
|
+
message:
|
|
183
|
+
'Password must be 8–50 characters and include at least one uppercase letter, one lowercase letter, one number, and one special character (e.g., !@#$%^&*).',
|
|
184
|
+
})
|
|
185
|
+
}
|
|
186
|
+
})
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (props.showRequestedOrgId) {
|
|
190
|
+
baseSchema.requestedOrgId = z.string({
|
|
191
|
+
required_error: `${props.requestedOrgIdLabel} is required`,
|
|
192
|
+
}).min(1, { message: `${props.requestedOrgIdLabel} is required` })
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (state.provider === 'phone') {
|
|
196
|
+
baseSchema.phone = z.string({
|
|
197
|
+
required_error: 'Phone number is required',
|
|
198
|
+
}).min(14, { message: 'Not a valid phone number' }).max(14, { message: 'Not a valid phone number' })
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (state.showRegistrationCode || !props.registrationCode) {
|
|
202
|
+
baseSchema.registrationCode = z.string({
|
|
203
|
+
required_error: 'Registration code is required',
|
|
204
|
+
}).min(1, { message: 'Registration code is required' })
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (!state.showRegistrationCode) {
|
|
208
|
+
if (!props.singleOrganization) {
|
|
209
|
+
baseSchema.dynamicDocumentFieldValue = z.string({
|
|
210
|
+
required_error: `${props.title} is required`,
|
|
211
|
+
}).min(1, { message: `${props.title} is required` })
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return toTypedSchema(z.object(baseSchema))
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
watch(schema, async () => {
|
|
219
|
+
state.terms = false
|
|
220
|
+
state.form = false
|
|
221
|
+
await nextTick()
|
|
222
|
+
state.form = true
|
|
223
|
+
})
|
|
224
|
+
|
|
225
|
+
const customMaskOptions = {
|
|
226
|
+
mask(value) {
|
|
227
|
+
const pattern = /^[a-zA-Z0-9_]*$/
|
|
228
|
+
return value.split('').filter(char => pattern.test(char)).join('')
|
|
229
|
+
},
|
|
230
|
+
}
|
|
231
|
+
</script>
|
|
232
|
+
|
|
233
|
+
<template>
|
|
234
|
+
<div v-if="edgeFirebase.user.loggingIn || edgeFirebase.user.loggedIn">
|
|
235
|
+
<edge-logging-in />
|
|
236
|
+
</div>
|
|
237
|
+
<Card v-else class="max-w-md">
|
|
238
|
+
<slot />
|
|
239
|
+
<CardContent>
|
|
240
|
+
<span v-if="multipleProviders">Choose a login method:</span>
|
|
241
|
+
<div v-if="multipleProviders">
|
|
242
|
+
<template v-for="provider in props.providers" :key="provider">
|
|
243
|
+
<edge-shad-button :class="props.secondaryButtonClasses" @click="state.provider = provider">
|
|
244
|
+
<Check v-if="state.provider === provider" class="w-4 h-4 mr-2" />
|
|
245
|
+
{{ providerNames[provider] }}
|
|
246
|
+
</edge-shad-button>
|
|
247
|
+
<Separator
|
|
248
|
+
class="my-2 dark:bg-slate-600"
|
|
249
|
+
/>
|
|
250
|
+
</template>
|
|
251
|
+
</div>
|
|
252
|
+
<edge-shad-form
|
|
253
|
+
v-if="state.form"
|
|
254
|
+
:schema="schema"
|
|
255
|
+
@submit="onSubmit"
|
|
256
|
+
>
|
|
257
|
+
<div class="grid gap-4">
|
|
258
|
+
<div class="grid gap-2">
|
|
259
|
+
<edge-shad-input
|
|
260
|
+
v-if="state.provider === 'email'"
|
|
261
|
+
v-model="register.email"
|
|
262
|
+
name="email"
|
|
263
|
+
type="email"
|
|
264
|
+
label="Email"
|
|
265
|
+
placeholder="m@example.com"
|
|
266
|
+
/>
|
|
267
|
+
</div>
|
|
268
|
+
<div class="grid gap-2">
|
|
269
|
+
<edge-shad-input
|
|
270
|
+
v-if="state.provider === 'email'"
|
|
271
|
+
v-model="register.password"
|
|
272
|
+
name="password"
|
|
273
|
+
type="password"
|
|
274
|
+
label="Password"
|
|
275
|
+
/>
|
|
276
|
+
</div>
|
|
277
|
+
<div class="grid gap-2">
|
|
278
|
+
<edge-shad-input
|
|
279
|
+
v-if="state.provider === 'phone'"
|
|
280
|
+
v-model="state.phone"
|
|
281
|
+
name="phone"
|
|
282
|
+
type="tel"
|
|
283
|
+
label="Phone Number"
|
|
284
|
+
placeholder="(555) 555-5555"
|
|
285
|
+
:mask-options="{ mask: '(###) ###-####' }"
|
|
286
|
+
/>
|
|
287
|
+
</div>
|
|
288
|
+
<div class="grid gap-2">
|
|
289
|
+
<edge-shad-input
|
|
290
|
+
v-model="register.meta.name"
|
|
291
|
+
name="name"
|
|
292
|
+
type="text"
|
|
293
|
+
label="Name"
|
|
294
|
+
/>
|
|
295
|
+
</div>
|
|
296
|
+
<edge-shad-input
|
|
297
|
+
v-if="props.showRequestedOrgId"
|
|
298
|
+
v-model="register.requestedOrgId"
|
|
299
|
+
:label="props.requestedOrgIdLabel"
|
|
300
|
+
name="requestedOrgId"
|
|
301
|
+
type="text"
|
|
302
|
+
description="Once submitted, this cannot be changed. Only use letters, numbers, and underscores."
|
|
303
|
+
:mask-options="customMaskOptions"
|
|
304
|
+
/>
|
|
305
|
+
<edge-shad-checkbox
|
|
306
|
+
v-if="!props.singleOrganization"
|
|
307
|
+
v-model="state.showRegistrationCode"
|
|
308
|
+
name="showRegistrationCode"
|
|
309
|
+
>
|
|
310
|
+
{{ props.joinMessage }}
|
|
311
|
+
</edge-shad-checkbox>
|
|
312
|
+
|
|
313
|
+
<template v-if="!props.singleOrganization">
|
|
314
|
+
<edge-shad-input
|
|
315
|
+
v-if="state.showRegistrationCode || !props.registrationCode"
|
|
316
|
+
v-model="state.registrationCode"
|
|
317
|
+
label="Registration Code"
|
|
318
|
+
name="registrationCode"
|
|
319
|
+
/>
|
|
320
|
+
<edge-shad-input
|
|
321
|
+
v-else
|
|
322
|
+
v-model="register.dynamicDocumentFieldValue"
|
|
323
|
+
:label="props.title"
|
|
324
|
+
name="dynamicDocumentFieldValue"
|
|
325
|
+
/>
|
|
326
|
+
</template>
|
|
327
|
+
<edge-shad-input
|
|
328
|
+
v-if="!props.registrationCode"
|
|
329
|
+
v-model="state.registrationCode"
|
|
330
|
+
label="Registration Code"
|
|
331
|
+
name="registrationCode"
|
|
332
|
+
/>
|
|
333
|
+
|
|
334
|
+
<edge-shad-checkbox
|
|
335
|
+
v-model="state.terms"
|
|
336
|
+
name="terms"
|
|
337
|
+
>
|
|
338
|
+
I agree to site <a v-if="props.termsLinks" :href="props.termsLinks" class="mt-0 mx-auto underline hover:no-underline" target="_blank">
|
|
339
|
+
terms and conditions
|
|
340
|
+
</a>
|
|
341
|
+
<span v-else>terms and conditions</span>
|
|
342
|
+
</edge-shad-checkbox>
|
|
343
|
+
|
|
344
|
+
<edge-shad-button type="submit" :disabled="state.registering" :class="props.primaryButtonClasses">
|
|
345
|
+
<Loader2 v-if="state.registering" class="w-4 h-4 mr-2 animate-spin" />
|
|
346
|
+
<span v-if="state.registering">Registering...</span>
|
|
347
|
+
<span v-else>Submit</span>
|
|
348
|
+
</edge-shad-button>
|
|
349
|
+
</div>
|
|
350
|
+
</edge-shad-form>
|
|
351
|
+
<edge-g-error v-if="edgeFirebase.user.logInError" :error="edgeFirebase.user.logInErrorMessage" />
|
|
352
|
+
<edge-g-error v-if="state.error.error" :error="state.error.message" />
|
|
353
|
+
|
|
354
|
+
<Separator
|
|
355
|
+
class="my-4 dark:bg-slate-600"
|
|
356
|
+
/>
|
|
357
|
+
Already have an account?
|
|
358
|
+
<edge-shad-button class="bg-secondary text-secondary-foreground" :class="props.secondaryButtonClasses" to="/app/login">
|
|
359
|
+
Sign in here.
|
|
360
|
+
</edge-shad-button>
|
|
361
|
+
<edge-shad-dialog
|
|
362
|
+
v-model="state.phoneConfirmDialog"
|
|
363
|
+
>
|
|
364
|
+
<DialogContent>
|
|
365
|
+
<DialogHeader>
|
|
366
|
+
<DialogTitle>Enter Confirmation Code</DialogTitle>
|
|
367
|
+
<DialogDescription class="text-left mb-2">
|
|
368
|
+
Please enter the confirmation code that you received via text message. This code is used to verify your phone number. If you did not receive a text message, please confirm that your phone number is correct and request a new code.
|
|
369
|
+
</DialogDescription>
|
|
370
|
+
</DialogHeader>
|
|
371
|
+
<edge-shad-form
|
|
372
|
+
:schema="phoneCodeSchema"
|
|
373
|
+
@submit="phoneRegister"
|
|
374
|
+
>
|
|
375
|
+
<edge-shad-input
|
|
376
|
+
v-model="register.phoneCode"
|
|
377
|
+
label="Confirmation Code"
|
|
378
|
+
name="phoneCode"
|
|
379
|
+
/>
|
|
380
|
+
<DialogFooter>
|
|
381
|
+
<edge-shad-button variant="destructive" @click="state.phoneConfirmDialog = false">
|
|
382
|
+
Cancel
|
|
383
|
+
</edge-shad-button>
|
|
384
|
+
<edge-shad-button
|
|
385
|
+
type="submit"
|
|
386
|
+
:class="props.primaryButtonClasses"
|
|
387
|
+
>
|
|
388
|
+
Submit
|
|
389
|
+
</edge-shad-button>
|
|
390
|
+
</DialogFooter>
|
|
391
|
+
</edge-shad-form>
|
|
392
|
+
</DialogContent>
|
|
393
|
+
</edge-shad-dialog>
|
|
394
|
+
</CardContent>
|
|
395
|
+
</Card>
|
|
396
|
+
</template>
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { defineProps, inject, onBeforeMount, watch } from 'vue'
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
type: {
|
|
5
|
+
type: String,
|
|
6
|
+
default: 'login',
|
|
7
|
+
},
|
|
8
|
+
registrationCode: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: '',
|
|
11
|
+
},
|
|
12
|
+
providers: {
|
|
13
|
+
type: Array,
|
|
14
|
+
default: () => ['email'],
|
|
15
|
+
},
|
|
16
|
+
title: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: 'Organization',
|
|
19
|
+
},
|
|
20
|
+
joinMessage: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: 'Join an existing organization',
|
|
23
|
+
},
|
|
24
|
+
termsLinks: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: '',
|
|
27
|
+
},
|
|
28
|
+
singleOrganization: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false,
|
|
31
|
+
},
|
|
32
|
+
showRequestedOrgId: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false,
|
|
35
|
+
},
|
|
36
|
+
requestedOrgIdLabel: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: 'Organization ID',
|
|
39
|
+
},
|
|
40
|
+
primaryButtonClasses: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: '',
|
|
43
|
+
},
|
|
44
|
+
secondaryButtonClasses: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: 'w-full',
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
const emit = defineEmits(['update:auth'])
|
|
51
|
+
|
|
52
|
+
const edgeFirebase = inject('edgeFirebase')
|
|
53
|
+
// const edgeGlobal = inject('edgeGlobal')
|
|
54
|
+
|
|
55
|
+
const doLogin = async () => {
|
|
56
|
+
edgeGlobal.edgeState.user = edgeFirebase.user
|
|
57
|
+
emit('update:auth', edgeFirebase.user)
|
|
58
|
+
if (edgeFirebase.user.loggedIn) {
|
|
59
|
+
await edgeGlobal.getOrganizations(edgeFirebase)
|
|
60
|
+
const storedOrganization = localStorage.getItem('organizationID')
|
|
61
|
+
if (storedOrganization && edgeGlobal.edgeState.organizations.some(org => org.docId === storedOrganization)) {
|
|
62
|
+
await edgeGlobal.setOrganization(storedOrganization, edgeFirebase)
|
|
63
|
+
}
|
|
64
|
+
else if (edgeGlobal.edgeState.currentOrganization) {
|
|
65
|
+
await edgeGlobal.setOrganization(edgeGlobal.edgeState.currentOrganization, edgeFirebase)
|
|
66
|
+
}
|
|
67
|
+
else if (edgeGlobal.edgeState.organizations.length > 0) {
|
|
68
|
+
await edgeGlobal.setOrganization(edgeGlobal.edgeState.organizations[0].docId, edgeFirebase)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
onBeforeMount(() => {
|
|
73
|
+
doLogin()
|
|
74
|
+
})
|
|
75
|
+
watch(edgeFirebase.user, async () => {
|
|
76
|
+
doLogin()
|
|
77
|
+
})
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<template>
|
|
81
|
+
<edge-auth-login
|
|
82
|
+
v-if="props.type === 'login'"
|
|
83
|
+
:providers="props.providers"
|
|
84
|
+
:primary-button-classes="props.primaryButtonClasses"
|
|
85
|
+
:secondary-button-classes="props.secondaryButtonClasses"
|
|
86
|
+
>
|
|
87
|
+
<slot />
|
|
88
|
+
</edge-auth-login>
|
|
89
|
+
<edge-auth-register
|
|
90
|
+
v-else-if="props.type === 'register'"
|
|
91
|
+
:single-organization="props.singleOrganization"
|
|
92
|
+
:registration-code="props.registrationCode"
|
|
93
|
+
:title="props.title"
|
|
94
|
+
:join-message="props.joinMessage"
|
|
95
|
+
:providers="props.providers"
|
|
96
|
+
:terms-links="props.termsLinks"
|
|
97
|
+
:show-requested-org-id="props.showRequestedOrgId"
|
|
98
|
+
:requested-org-id-label="props.requestedOrgIdLabel"
|
|
99
|
+
:primary-button-classes="props.primaryButtonClasses"
|
|
100
|
+
:secondary-button-classes="props.secondaryButtonClasses"
|
|
101
|
+
>
|
|
102
|
+
<slot />
|
|
103
|
+
</edge-auth-register>
|
|
104
|
+
</template>
|
|
105
|
+
|
|
106
|
+
<style lang="scss" scoped>
|
|
107
|
+
|
|
108
|
+
</style>
|