Sfoglia il codice sorgente

Add page for free trial

master
Immanuel Onyeka 7 mesi fa
parent
commit
586533ec5c
9 ha cambiato i file con 53 aggiunte e 19 eliminazioni
  1. +3
    -3
      components/app.vue
  2. +2
    -1
      components/update-billing/billing.vue
  3. +9
    -9
      grav-admin/user/data/feed/21232f297a57a5a743894a0e4a801fc3.yaml
  4. +1
    -1
      grav-admin/user/data/flex/indexes/pages.json
  5. +1
    -1
      grav-admin/user/data/notifications/21232f297a57a5a743894a0e4a801fc3.yaml
  6. +12
    -2
      grav-admin/user/js/registration/registration.vue
  7. +7
    -0
      grav-admin/user/pages/08.free-trial/registration.md
  8. +12
    -0
      grav-admin/user/themes/quark/templates/free-trial.twig
  9. +6
    -2
      skouter.go

+ 3
- 3
components/app.vue Vedi File

@@ -41,7 +41,7 @@ v-else-if="active == 4" />

<biller v-if="invalidSub" :user="user"/>

<sign-out :user="user" v-else-if="active == 5" />
<sign-out :user="user" v-if="active == 5" />

</template>

@@ -238,11 +238,11 @@ function start() {
this.refreshToken()
fetchUser().then( u => {
if (u.sub.customerId &&
validStatuses.includes(u.sub.paymentStatus)) {
validStatuses.includes(u.sub.paymentStatus) &&
this.user.status != "Unsubscribed") {
return
}
// Payment must be updated
console.log("paying...")
this.invalidSub = true
})
}


+ 2
- 1
components/update-billing/billing.vue Vedi File

@@ -23,12 +23,13 @@ function submit() {
//`Elements` instance that was used to create the Payment Element
elements,
confirmParams: {
return_url: "https://skouter.net/register",
return_url: `https://${process.env.SKOUTER_DOMAIN}`,
}
})
}

onMounted(() => {
console.log(process.env.SKOUTER_DOMAIN)
payEl.mount("#payment-element")
})
</script>


+ 9
- 9
grav-admin/user/data/feed/21232f297a57a5a743894a0e4a801fc3.yaml Vedi File

@@ -1,30 +1,30 @@
last_checked: 1710870233
last_checked: 1716916759
data:
-
title: 'macOS 14.0 Sonoma Apache Setup: Upgrading Homebrew'
url: 'https://getgrav.org/blog/macos-ventura-apache-upgrade-homebrew'
date: 1697803200
nicetime: '5 months ago'
nicetime: '7 months ago'
-
title: 'macOS 14.0 Sonoma Apache Setup: LetsEncrypt SSL'
url: 'https://getgrav.org/blog/macos-sonoma-apache-ssl'
date: 1697799780
nicetime: '5 months ago'
nicetime: '7 months ago'
-
title: 'macOS 14.0 Sonoma Apache Setup: MySQL, Xdebug & More...'
url: 'https://getgrav.org/blog/macos-sonoma-apache-mysql-vhost-apc'
date: 1697799600
nicetime: '5 months ago'
nicetime: '7 months ago'
-
title: 'macOS 14.0 Sonoma Apache Setup: Multiple PHP Versions'
url: 'https://getgrav.org/blog/macos-sonoma-apache-multiple-php-versions'
date: 1697796000
nicetime: '5 months ago'
nicetime: '7 months ago'
-
title: 'Big changes for Email plugin'
url: 'https://getgrav.org/blog/new-email-plugin'
date: 1665048600
nicetime: '1 years ago'
nicetime: '2 years ago'
-
title: 'Skeleton Build Automation'
url: 'https://getgrav.org/blog/skeletons-build-automation'
@@ -46,7 +46,7 @@ data:
date: 1611050100
nicetime: '3 years ago'
-
title: 'Grav Premium Focus: NextGen Editor'
url: 'https://getgrav.org/blog/premium-focus-nextgen-editor'
date: 1610713140
title: 'Grav 1.7 Stable Release - One week away!'
url: 'https://getgrav.org/blog/grav-17-stable-imminent'
date: 1610457780
nicetime: '3 years ago'

+ 1
- 1
grav-admin/user/data/flex/indexes/pages.json Vedi File

@@ -1 +1 @@
{"version":"1.5","timestamp":1710880035,"count":13,"index":{"":{"key":"","storage_key":"","template":null,"storage_timestamp":1710880035,"children":{"01.home":1704396086,"02.about":1704398516,"04.pricing":1704400398,"05.blog":1703638467,"06.register":1710878689,"07.app":1710874534},"checksum":"1fd7a2a72c57a3f77d8d7016060b50de"},"01.home":{"key":"home","storage_key":"01.home","template":"modular","storage_timestamp":1704396086,"markdown":{"":{"modular":1703631506}},"children":{"01._hero":1703718436,"02._features":1703720151,"03._example":1703716188,"04._comparison-pdf":1703719134,"05._info":1703720014,"06._any_device":1704396086},"checksum":"dbbcfea030db5994b105e013be94b15c"},"01.home\/01._hero":{"key":"home\/_hero","storage_key":"01.home\/01._hero","template":"hero","storage_timestamp":1703718436,"markdown":{"":{"hero":1703718436}},"checksum":"45dc2f4a454b5f0609cbe09cfda09790"},"01.home\/02._features":{"key":"home\/_features","storage_key":"01.home\/02._features","template":"features","storage_timestamp":1703720151,"markdown":{"":{"features":1703720151}},"checksum":"ed7be750188fc4ed50ebcdc060f6fb53"},"01.home\/03._example":{"key":"home\/_example","storage_key":"01.home\/03._example","template":"text","storage_timestamp":1703716188,"markdown":{"":{"text":1703713545}},"checksum":"48b2ea373eba19040584a991b21c083c"},"01.home\/04._comparison-pdf":{"key":"home\/_comparison-pdf","storage_key":"01.home\/04._comparison-pdf","template":"text","storage_timestamp":1703719134,"markdown":{"":{"text":1703719134}},"checksum":"f323d6050403b0102c73c174d74b2f0a"},"01.home\/05._info":{"key":"home\/_info","storage_key":"01.home\/05._info","template":"features","storage_timestamp":1703720014,"markdown":{"":{"features":1703720014}},"checksum":"35c9bee0f74fe81449a491e31bf81bcb"},"01.home\/06._any_device":{"key":"home\/_any_device","storage_key":"01.home\/06._any_device","template":"text","storage_timestamp":1704397975,"markdown":{"":{"text":1704397975}},"checksum":"aabfe01503028954e8557c5bff37048d"},"02.about":{"key":"about","storage_key":"02.about","template":"default","storage_timestamp":1704398516,"markdown":{"":{"default":1704398516}},"checksum":"3d12d8cc95786aef7316b6c379752aa0"},"04.pricing":{"key":"pricing","storage_key":"04.pricing","template":"default","storage_timestamp":1704400398,"markdown":{"":{"default":1704400398}},"checksum":"76ddfc1dafa27268dca3f24db2ffa05a"},"05.blog":{"key":"blog","storage_key":"05.blog","template":"blog","storage_timestamp":1703638467,"markdown":{"":{"blog":1703636303}},"checksum":"88a8e8a7109dc2957e9dc3e1fd81fa85"},"06.register":{"key":"register","storage_key":"06.register","template":"registration","storage_timestamp":1710878689,"markdown":{"":{"registration":1710878540}},"checksum":"983a354c44dd4836c96f7a5a0a7b74f1"},"07.app":{"key":"app","storage_key":"07.app","template":"app","storage_timestamp":1710874534,"markdown":{"":{"app":1710874534}},"checksum":"f0e4e99804d225d38720b9454d7b342b"}}}
{"version":"1.5","timestamp":1716921308,"count":14,"index":{"":{"key":"","storage_key":"","template":null,"storage_timestamp":1716919287,"children":{"01.home":1704396086,"02.about":1704398516,"04.pricing":1704400398,"05.blog":1703638467,"06.register":1710878689,"07.app":1710874534,"08.free-trial":1716919287},"checksum":"8f0440315a1e597fd62bd7c941c51caa"},"01.home":{"key":"home","storage_key":"01.home","template":"modular","storage_timestamp":1704396086,"markdown":{"":{"modular":1703631506}},"children":{"01._hero":1703718436,"02._features":1703720151,"03._example":1703716188,"04._comparison-pdf":1703719134,"05._info":1703720014,"06._any_device":1704396086},"checksum":"dbbcfea030db5994b105e013be94b15c"},"01.home\/01._hero":{"key":"home\/_hero","storage_key":"01.home\/01._hero","template":"hero","storage_timestamp":1703718436,"markdown":{"":{"hero":1703718436}},"checksum":"45dc2f4a454b5f0609cbe09cfda09790"},"01.home\/02._features":{"key":"home\/_features","storage_key":"01.home\/02._features","template":"features","storage_timestamp":1703720151,"markdown":{"":{"features":1703720151}},"checksum":"ed7be750188fc4ed50ebcdc060f6fb53"},"01.home\/03._example":{"key":"home\/_example","storage_key":"01.home\/03._example","template":"text","storage_timestamp":1703716188,"markdown":{"":{"text":1703713545}},"checksum":"48b2ea373eba19040584a991b21c083c"},"01.home\/04._comparison-pdf":{"key":"home\/_comparison-pdf","storage_key":"01.home\/04._comparison-pdf","template":"text","storage_timestamp":1703719134,"markdown":{"":{"text":1703719134}},"checksum":"f323d6050403b0102c73c174d74b2f0a"},"01.home\/05._info":{"key":"home\/_info","storage_key":"01.home\/05._info","template":"features","storage_timestamp":1703720014,"markdown":{"":{"features":1703720014}},"checksum":"35c9bee0f74fe81449a491e31bf81bcb"},"01.home\/06._any_device":{"key":"home\/_any_device","storage_key":"01.home\/06._any_device","template":"text","storage_timestamp":1704397975,"markdown":{"":{"text":1704397975}},"checksum":"aabfe01503028954e8557c5bff37048d"},"02.about":{"key":"about","storage_key":"02.about","template":"default","storage_timestamp":1704398516,"markdown":{"":{"default":1704398516}},"checksum":"3d12d8cc95786aef7316b6c379752aa0"},"04.pricing":{"key":"pricing","storage_key":"04.pricing","template":"default","storage_timestamp":1704400398,"markdown":{"":{"default":1704400398}},"checksum":"76ddfc1dafa27268dca3f24db2ffa05a"},"05.blog":{"key":"blog","storage_key":"05.blog","template":"blog","storage_timestamp":1703638467,"markdown":{"":{"blog":1703636303}},"checksum":"88a8e8a7109dc2957e9dc3e1fd81fa85"},"06.register":{"key":"register","storage_key":"06.register","template":"registration","storage_timestamp":1710878689,"markdown":{"":{"registration":1710878540}},"checksum":"983a354c44dd4836c96f7a5a0a7b74f1"},"07.app":{"key":"app","storage_key":"07.app","template":"app","storage_timestamp":1710874534,"markdown":{"":{"app":1710874534}},"checksum":"f0e4e99804d225d38720b9454d7b342b"},"08.free-trial":{"key":"free-trial","storage_key":"08.free-trial","template":"registration","storage_timestamp":1716921308,"markdown":{"":{"registration":1716921308}},"checksum":"bcd1eb947a8e3dc202432d9a9e08ac14"}}}

+ 1
- 1
grav-admin/user/data/notifications/21232f297a57a5a743894a0e4a801fc3.yaml Vedi File

@@ -1,4 +1,4 @@
last_checked: 1710888087
last_checked: 1716921278
data:
feed:
-


+ 12
- 2
grav-admin/user/js/registration/registration.vue Vedi File

@@ -2,7 +2,7 @@
<section class="shadowbox">
<h2>Register</h2>
<account v-if="step == 1" :err="err" @submit="create" />
<billing v-if="step == 2" :err="err" :sub="sub"/>
<billing v-if="step == 2 && !trial" :err="err" :sub="sub"/>
<completed v-if="step == 3" :err="err" :status="sub.paymentStatus"/>
</section>
</template>
@@ -19,6 +19,7 @@ const step = ref(1)
const token = ref("")
const user = ref(null)
const sub = ref(null)
const trial = ref(false)

const clientSecret = new URLSearchParams(window.location.search).get(
'payment_intent_client_secret'
@@ -70,8 +71,13 @@ function create(user) {
}

function intent(u) {
let path = `/api/user/subscribe`
return fetch(`/api/user/subscribe`,
if (trial.value) {
path = `/api/user/trial`
}
return fetch(path,
{method: 'POST',
body: JSON.stringify(u),
headers: {
@@ -101,6 +107,10 @@ function intent(u) {
}

onMounted(() => {
if (window.location.pathname == "/free-trial") {
trial.value = true
}
getUser().then( u => {
if (u) { user.value = u; intent(u) }
})


+ 7
- 0
grav-admin/user/pages/08.free-trial/registration.md Vedi File

@@ -0,0 +1,7 @@
---
title: 'Free trial'
visible: false
---

## 30 Day Free Trial
\* Renews at $49/month

+ 12
- 0
grav-admin/user/themes/quark/templates/free-trial.twig Vedi File

@@ -0,0 +1,12 @@
{% extends 'partials/base.html.twig' %}

{% block javascripts %}
{{ parent() }}
{% do assets.add('theme://js/bricklayer.min.js') %}
{% do assets.add('theme://assets/register.js', {group:'bottom'}) %}
{% endblock %}

{% block content %}
{{ page.content|raw }}
<div id="registration"></div>
{% endblock %}

+ 6
- 2
skouter.go Vedi File

@@ -1192,7 +1192,7 @@ func queryUser(db *sql.DB, id int) (User, error) {
u.role,
u.address,
u.phone,
s.id
coalesce(s.id, 0)
FROM user u
LEFT JOIN subscription s
ON s.user_id = u.id
@@ -1230,10 +1230,14 @@ func queryUser(db *sql.DB, id int) (User, error) {
return user, err
}
user.Sub, err = querySub(db, user.Sub.Id)
if user.Sub.Id > 0 {
user.Sub, err = querySub(db, user.Sub.Id)
}
if err != nil {
return user, err
}

if user.Branch.Id > 0 {
user.Branch, err = queryBranch(db, user.Branch.Id)


Loading…
Annulla
Salva