mirror of
https://github.com/penpot/penpot.git
synced 2026-08-17 10:18:59 +00:00
* ✨ Add newsletter opt-in checkbox to registration validation form Add accept-newsletter-updates support through the full registration token flow. The newsletter checkbox is now available on the registration validation form, allowing users to opt-in during the email verification step. Backend changes: - Refactor prepare-register to consolidate UTM params and newsletter preference into props at token creation time - Add accept-newsletter-updates to prepare-register-profile and register-profile schemas - Handle newsletter-updates in register-profile by updating token claims props on second step Frontend changes: - Add newsletter-options component to register-validate-form - Add accept-newsletter-updates to validation schema - Fix subscription finalize/error handling in register form Signed-off-by: Andrey Antukh <niwi@niwi.nz> * ♻️ Refactor auth register components to modern style Migrate all components in app.main.ui.auth.register and app.main.ui.auth.login/demo-warning to use the modern * suffix convention, removing deprecated ::mf/props :obj metadata and updating all invocations from [:& name] to [:> name*] syntax. Components updated: - terms-and-privacy -> terms-and-privacy* - register-form -> register-form* - register-methods -> register-methods* - register-page -> register-page* - register-success-page -> register-success-page* - terms-register -> terms-register* - register-validate-form -> register-validate-form* - register-validate-page -> register-validate-page* - demo-warning -> demo-warning* Also remove unused old context-notification import in login.cljs. Signed-off-by: Andrey Antukh <niwi@niwi.nz> * 🔥 Remove unused onboarding-newsletter component The newsletter opt-in is now handled directly in the registration form via the newsletter-options* component, making the standalone onboarding-newsletter modal obsolete. Signed-off-by: Andrey Antukh <niwi@niwi.nz> * 🐛 Fix register test for UTM params to use prepare-register step UTM params are now extracted and stored in token props during the prepare-register step, not at register-profile time. Move utm_campaign and mtm_campaign from the register-profile call to the prepare-register-profile call in the test. Signed-off-by: Andrey Antukh <niwi@niwi.nz> --------- Signed-off-by: Andrey Antukh <niwi@niwi.nz>
82 lines
2.3 KiB
Clojure
82 lines
2.3 KiB
Clojure
;; This Source Code Form is subject to the terms of the Mozilla Public
|
|
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
;;
|
|
;; Copyright (c) KALEIDOS INC
|
|
|
|
(ns app.main.ui.auth
|
|
(:require-macros [app.main.style :as stl])
|
|
(:require
|
|
[app.common.data.macros :as dm]
|
|
[app.main.data.auth :as da]
|
|
[app.main.store :as st]
|
|
[app.main.ui.auth.login :refer [login-page]]
|
|
[app.main.ui.auth.recovery :refer [recovery-page]]
|
|
[app.main.ui.auth.recovery-request :refer [recovery-request-page]]
|
|
[app.main.ui.auth.register :refer [register-page* register-success-page* register-validate-page* terms-register*]]
|
|
[app.main.ui.icons :as deprecated-icon]
|
|
[app.util.dom :as dom]
|
|
[app.util.i18n :as i18n :refer [tr]]
|
|
[rumext.v2 :as mf]))
|
|
|
|
(mf/defc auth*
|
|
[{:keys [route]}]
|
|
(let [section
|
|
(dm/get-in route [:data :name])
|
|
|
|
is-register
|
|
(or (= section :auth-register)
|
|
(= section :auth-register-validate)
|
|
(= section :register-validate-page)
|
|
(= section :auth-register-success))
|
|
params
|
|
(:query-params route)
|
|
|
|
error
|
|
(:error params)]
|
|
|
|
(mf/with-effect []
|
|
(dom/set-html-title (tr "title.default")))
|
|
|
|
(mf/with-effect [error]
|
|
(when error
|
|
(st/emit! (da/show-redirect-error error))))
|
|
|
|
[:main {:class (stl/css-case
|
|
:auth-section true
|
|
:register is-register)}
|
|
[:h1 {:class (stl/css :logo-container)}
|
|
[:a {:href "#/" :title "Penpot" :class (stl/css :logo-btn)} deprecated-icon/logo]]
|
|
[:div {:class (stl/css :login-illustration)}
|
|
[:img {:src "images/registration-illustration.png"}]]
|
|
|
|
[:section {:class (stl/css :auth-content)}
|
|
|
|
(case section
|
|
:auth-register
|
|
[:> register-page* {:params params}]
|
|
|
|
:auth-register-success
|
|
[:> register-success-page* {:params params}]
|
|
|
|
:auth-register-validate
|
|
[:> register-validate-page* {:params params}]
|
|
|
|
:auth-login
|
|
[:& login-page {:params params}]
|
|
|
|
:auth-recovery-request
|
|
[:& recovery-request-page]
|
|
|
|
:auth-recovery
|
|
[:& recovery-page {:params params}])
|
|
|
|
(when (= section :auth-register)
|
|
[:> terms-register*])]]))
|
|
|
|
|
|
(mf/defc auth-page*
|
|
{::mf/lazy-load true}
|
|
[props]
|
|
[:> auth* props])
|