mirror of
https://github.com/penpot/penpot.git
synced 2025-07-28 05:59:23 +02:00
✨ Add subscription events (#6563)
* ✨ Add subscription events * 📎 Fixes PR feedback * 📎 Fixes PR feedback
This commit is contained in:
parent
f84ffc3562
commit
878952f7b5
2 changed files with 19 additions and 8 deletions
|
@ -5,6 +5,7 @@
|
||||||
(:require
|
(:require
|
||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
[app.config :as cf]
|
[app.config :as cf]
|
||||||
|
[app.main.data.event :as ev]
|
||||||
[app.main.router :as rt]
|
[app.main.router :as rt]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.main.ui.components.dropdown-menu :refer [dropdown-menu-item*]]
|
[app.main.ui.components.dropdown-menu :refer [dropdown-menu-item*]]
|
||||||
|
@ -14,6 +15,7 @@
|
||||||
[app.util.i18n :as i18n :refer [tr]]
|
[app.util.i18n :as i18n :refer [tr]]
|
||||||
[app.util.keyboard :as kbd]
|
[app.util.keyboard :as kbd]
|
||||||
[lambdaisland.uri :as u]
|
[lambdaisland.uri :as u]
|
||||||
|
[potok.v2.core :as ptk]
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]))
|
||||||
|
|
||||||
(mf/defc cta-power-up*
|
(mf/defc cta-power-up*
|
||||||
|
@ -86,7 +88,9 @@
|
||||||
go-to-manage-subscription
|
go-to-manage-subscription
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(fn []
|
(fn []
|
||||||
;; TODO add event tracking
|
(st/emit! (ptk/event ::ev/event {::ev/name "open-subscription-management"
|
||||||
|
::ev/origin "dashboard"
|
||||||
|
:section "team-settings"}))
|
||||||
(let [href (-> (rt/get-current-href)
|
(let [href (-> (rt/get-current-href)
|
||||||
(rt/encode-url))
|
(rt/encode-url))
|
||||||
href (str "payments/subscriptions/show?returnUrl=" href)]
|
href (str "payments/subscriptions/show?returnUrl=" href)]
|
||||||
|
|
|
@ -59,7 +59,9 @@
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps min-members)
|
(mf/deps min-members)
|
||||||
(fn []
|
(fn []
|
||||||
;; TODO add event tracking subscribe trial unlimited
|
(st/emit! (ptk/event ::ev/event {::ev/name "create-trial-subscription"
|
||||||
|
:type "unlimited"
|
||||||
|
:quantity min-members}))
|
||||||
(let [current-href (rt/get-current-href)
|
(let [current-href (rt/get-current-href)
|
||||||
returnUrl (js/encodeURIComponent current-href)
|
returnUrl (js/encodeURIComponent current-href)
|
||||||
href (dm/str "payments/subscriptions/create?type=unlimited&quantity=" min-members "&returnUrl=" returnUrl)]
|
href (dm/str "payments/subscriptions/create?type=unlimited&quantity=" min-members "&returnUrl=" returnUrl)]
|
||||||
|
@ -67,14 +69,17 @@
|
||||||
|
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(fn []
|
(fn []
|
||||||
;; TODO add event tracking subscribe trial enterprise
|
(st/emit! (ptk/event ::ev/event {::ev/name "create-trial-subscription"
|
||||||
|
:type "enterprise"}))
|
||||||
(let [current-href (rt/get-current-href)
|
(let [current-href (rt/get-current-href)
|
||||||
returnUrl (js/encodeURIComponent current-href)
|
returnUrl (js/encodeURIComponent current-href)
|
||||||
href (dm/str "payments/subscriptions/create?type=enterprise&returnUrl=" returnUrl)]
|
href (dm/str "payments/subscriptions/create?type=enterprise&returnUrl=" returnUrl)]
|
||||||
(st/emit! (rt/nav-raw :href href))))))
|
(st/emit! (rt/nav-raw :href href))))))
|
||||||
handle-accept-dialog (mf/use-callback
|
handle-accept-dialog (mf/use-callback
|
||||||
(fn []
|
(fn []
|
||||||
;; TODO add event subscribe to another subscription
|
(st/emit! (ptk/event ::ev/event {::ev/name "open-subscription-management"
|
||||||
|
::ev/origin "profile"
|
||||||
|
:section "subscription-management-modal"}))
|
||||||
(let [current-href (rt/get-current-href)
|
(let [current-href (rt/get-current-href)
|
||||||
returnUrl (js/encodeURIComponent current-href)
|
returnUrl (js/encodeURIComponent current-href)
|
||||||
href (dm/str "payments/subscriptions/show?returnUrl=" returnUrl)]
|
href (dm/str "payments/subscriptions/show?returnUrl=" returnUrl)]
|
||||||
|
@ -82,7 +87,7 @@
|
||||||
(modal/hide!)))
|
(modal/hide!)))
|
||||||
handle-close-dialog (mf/use-callback
|
handle-close-dialog (mf/use-callback
|
||||||
(fn []
|
(fn []
|
||||||
;; TODO add event tracking close modal/cancel subscription
|
(st/emit! (ptk/event ::ev/event {::ev/name "close-subscription-modal"}))
|
||||||
(modal/hide!)))]
|
(modal/hide!)))]
|
||||||
|
|
||||||
[:div {:class (stl/css :modal-overlay)}
|
[:div {:class (stl/css :modal-overlay)}
|
||||||
|
@ -147,7 +152,7 @@
|
||||||
|
|
||||||
(let [handle-close-dialog (mf/use-callback
|
(let [handle-close-dialog (mf/use-callback
|
||||||
(fn []
|
(fn []
|
||||||
;; TODO add event tracking close modal
|
(st/emit! (ptk/event ::ev/event {::ev/name "subscription-success"}))
|
||||||
(modal/hide!)))]
|
(modal/hide!)))]
|
||||||
|
|
||||||
[:div {:class (stl/css :modal-overlay)}
|
[:div {:class (stl/css :modal-overlay)}
|
||||||
|
@ -192,7 +197,9 @@
|
||||||
(dom/open-new-window "https://penpot.app/pricing")))
|
(dom/open-new-window "https://penpot.app/pricing")))
|
||||||
go-to-payments (mf/use-fn
|
go-to-payments (mf/use-fn
|
||||||
(fn []
|
(fn []
|
||||||
;; TODO add event tracking manage subscription in stripe
|
(st/emit! (ptk/event ::ev/event {::ev/name "open-subscription-management"
|
||||||
|
::ev/origin "profile"
|
||||||
|
:section "subscription"}))
|
||||||
(let [current-href (rt/get-current-href)
|
(let [current-href (rt/get-current-href)
|
||||||
returnUrl (js/encodeURIComponent current-href)
|
returnUrl (js/encodeURIComponent current-href)
|
||||||
href (dm/str "payments/subscriptions/show?returnUrl=" returnUrl)]
|
href (dm/str "payments/subscriptions/show?returnUrl=" returnUrl)]
|
||||||
|
@ -200,7 +207,7 @@
|
||||||
open-subscription-modal (mf/use-fn
|
open-subscription-modal (mf/use-fn
|
||||||
(mf/deps teams)
|
(mf/deps teams)
|
||||||
(fn [subscription-name]
|
(fn [subscription-name]
|
||||||
;; TODO add event tracking open modal to try trial
|
(st/emit! (ptk/event ::ev/event {::ev/name "open-subscription-modal"}))
|
||||||
(st/emit!
|
(st/emit!
|
||||||
(modal/show :management-dialog
|
(modal/show :management-dialog
|
||||||
{:subscription-name subscription-name
|
{:subscription-name subscription-name
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue