diff --git a/src/App.vue b/src/App.vue index 86b3680..848e1ec 100644 --- a/src/App.vue +++ b/src/App.vue @@ -152,6 +152,7 @@ const copiedKey = ref('') const memberSigninError = ref('') const isMemberSigninLoading = ref(false) const isRemoteSignerLoading = ref(false) +const isCreatingMembership = ref(false) const formError = ref('') const signatureCanvas = ref(null) const signatureHasInk = ref(false) @@ -372,14 +373,8 @@ const pwaInstallTitle = computed(() => { return 'Install L484 on this device' }) const pwaInstallCopy = computed(() => { - if (isPwaStandalone.value) return 'You are already using the installed app. Continue signup from here.' if (installPlatform.value === 'ios') return 'Use Safari, tap Share, then Add to Home Screen. Reopen L484 from the new app icon to continue signup.' - if (installPlatform.value === 'android') return deferredInstallPrompt.value - ? 'Install the app when prompted, then continue signup inside L484.' - : 'Open Chrome menu, choose Install app or Add to Home screen, then launch L484 from the app icon.' - return deferredInstallPrompt.value - ? 'Use the browser install prompt to install L484, then continue signup.' - : 'Install L484 using the browser install icon in the address bar. The install prompt appears here when the browser makes it available.' + return 'Press Install app to open the browser install prompt.' }) const pwaInstallPrimaryLabel = computed(() => { if (isPwaStandalone.value) return 'Continue signup' @@ -819,7 +814,7 @@ const handlePwaInstallPrimary = async () => { } if (installPlatform.value === 'desktop') { - formError.value = 'The browser install prompt is not available yet. Use the install icon in the address bar, or refresh once and press Install app again.' + formError.value = 'The browser install prompt is not available yet. Refresh once, then press Install app again.' return } @@ -828,6 +823,22 @@ const handlePwaInstallPrimary = async () => { : 'Install L484 from your browser menu or address bar, then reopen the installed app to continue.' } +const startSignup = async () => { + formError.value = '' + refreshPwaStandalone() + installPlatform.value = detectInstallPlatform() + if (isPwaStandalone.value) { + signupStep.value = 2 + return + } + if (installPlatform.value === 'desktop' || installPlatform.value === 'android') { + signupStep.value = 1 + await handlePwaInstallPrimary() + return + } + signupStep.value = 1 +} + const openSignup = () => { isSignupOpen.value = true loadBitcoinPrice() @@ -885,6 +896,7 @@ const signOutMember = () => { isSignupOpen.value = false isMemberSigninOpen.value = false isRemoteSignerLoading.value = false + isCreatingMembership.value = false isMemberSigninLoading.value = false memberSigninError.value = '' localStorage.removeItem(CURRENT_MEMBER_KEY) @@ -1025,12 +1037,23 @@ const handleSignerCompletion = async () => { const createMembership = async () => { formError.value = '' sanitizeForm() + isCreatingMembership.value = true if (!validateApplicant()) { + isCreatingMembership.value = false return } if (!canContinue.value) { formError.value = 'Please sign the agreement before creating your membership.' + isCreatingMembership.value = false + return + } + + try { + await subscribeToNotifications() + } catch (error) { + formError.value = error instanceof Error ? error.message : 'Could not enable notifications.' + isCreatingMembership.value = false return } @@ -1083,6 +1106,8 @@ const createMembership = async () => { }, 2400) } catch (error) { formError.value = error instanceof Error ? error.message : 'Could not save membership.' + } finally { + isCreatingMembership.value = false } } @@ -3429,7 +3454,7 @@ watch(mobileMenuOpen, (open) => {
{{ pwaInstallCopy }}
-