mirror of
https://github.com/penpot/penpot.git
synced 2026-06-09 08:52:05 +00:00
✨ Inherit subscriptions perks to Nitrate
This commit is contained in:
parent
06c9a18ab0
commit
7bf519a127
@ -22,7 +22,8 @@
|
||||
(and (= "unlimited" type) (not (contains? canceled-status status)))
|
||||
(ct/duration {:days 30})
|
||||
|
||||
(and (= "enterprise" type) (not (contains? canceled-status status)))
|
||||
(and (contains? #{"enterprise" "nitrate"} type)
|
||||
(not (contains? canceled-status status)))
|
||||
(ct/duration {:days 90})
|
||||
|
||||
:else
|
||||
|
||||
36
backend/test/backend_tests/logical_deletion_test.clj
Normal file
36
backend/test/backend_tests/logical_deletion_test.clj
Normal file
@ -0,0 +1,36 @@
|
||||
;; 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 backend-tests.logical-deletion-test
|
||||
(:require
|
||||
[app.common.time :as ct]
|
||||
[app.config :as cf]
|
||||
[app.features.logical-deletion :as ldel]
|
||||
[clojure.test :as t]))
|
||||
|
||||
(t/deftest get-deletion-delay-for-active-subscriptions
|
||||
(t/is (= (ct/duration {:days 30})
|
||||
(ldel/get-deletion-delay {:subscription {:type "unlimited"
|
||||
:status "active"}})))
|
||||
|
||||
(t/is (= (ct/duration {:days 90})
|
||||
(ldel/get-deletion-delay {:subscription {:type "enterprise"
|
||||
:status "active"}})))
|
||||
|
||||
(t/is (= (ct/duration {:days 90})
|
||||
(ldel/get-deletion-delay {:subscription {:type "nitrate"
|
||||
:status "active"}}))))
|
||||
|
||||
(t/deftest get-deletion-delay-for-canceled-subscriptions
|
||||
(let [fallback (ct/duration {:days 5})]
|
||||
(with-redefs [cf/get-deletion-delay (fn [] fallback)]
|
||||
(t/is (= fallback
|
||||
(ldel/get-deletion-delay {:subscription {:type "nitrate"
|
||||
:status "canceled"}})))
|
||||
|
||||
(t/is (= fallback
|
||||
(ldel/get-deletion-delay {:subscription {:type "enterprise"
|
||||
:status "unpaid"}}))))))
|
||||
@ -570,7 +570,7 @@
|
||||
[:h3 {:class (stl/css :plan-section-title)} (tr "subscription.settings.section-plan")]
|
||||
(if nitrate?
|
||||
;; TODO add translations for this texts when we have the definitive ones
|
||||
[:> plan-card* {:card-title "Business Nitrate"
|
||||
[:> plan-card* {:card-title "Enterprise"
|
||||
:card-title-icon i/character-b
|
||||
:cancel-at (when (:cancel-at nitrate-license)
|
||||
(tr "nitrate.subscription.active-until" (ct/format-inst (:cancel-at nitrate-license) "d MMMM, yyyy")))
|
||||
@ -719,7 +719,7 @@
|
||||
|
||||
;; TODO add translations for this texts when we have the definitive ones
|
||||
(when (and (contains? cf/flags :nitrate) (not nitrate?))
|
||||
[:> plan-card* {:card-title "Business Nitrate"
|
||||
[:> plan-card* {:card-title "Enterprise"
|
||||
:card-title-icon i/character-n
|
||||
:price-value "$25"
|
||||
:price-period (tr "subscription.settings.organization-member-month")
|
||||
@ -757,7 +757,7 @@
|
||||
[:> icon* {:icon-id "close"
|
||||
:size "m"}]]
|
||||
[:div {:class (stl/css :modal-title :subscription-title :nitrate-subscription)}
|
||||
"Subcribe to the Business Nitrate plan"]
|
||||
"Subscribe to the Enterprise plan"]
|
||||
|
||||
(if (and online? (not show-contact-sales-option))
|
||||
[:div {:class (stl/css :modal-content)}
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cfg]
|
||||
[app.main.data.event :as ev]
|
||||
[app.main.data.nitrate :as dnt]
|
||||
[app.main.data.workspace.versions :as dwv]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
@ -36,9 +37,14 @@
|
||||
(l/derived :workspace-versions st/state))
|
||||
|
||||
(defn- get-versions-stored-days
|
||||
[team]
|
||||
(let [subscription-type (get-subscription-type (:subscription team))]
|
||||
[team profile]
|
||||
(let [subscription-type (get-subscription-type (:subscription team))
|
||||
nitrate-type (dm/get-in profile [:subscription :type])
|
||||
nitrate-active? (dnt/is-valid-license? profile)]
|
||||
(cond
|
||||
(and nitrate-active?
|
||||
(contains? #{"enterprise" "nitrate"} nitrate-type)) 90
|
||||
|
||||
(= subscription-type "unlimited") 30
|
||||
(= subscription-type "enterprise") 90
|
||||
:else 7)))
|
||||
@ -454,7 +460,7 @@
|
||||
|
||||
nil))])
|
||||
|
||||
[:> cta* {:title (tr "workspace.versions.warning.text" (get-versions-stored-days team))}
|
||||
[:> cta* {:title (tr "workspace.versions.warning.text" (get-versions-stored-days team profile))}
|
||||
[:> i18n/tr-html*
|
||||
{:tag-name "div"
|
||||
:class (stl/css :cta)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user