@live-change/billing-frontend 0.8.87 → 0.8.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nx/cache/file-map.json +261 -0
- package/.nx/cache/nx_files.nxt +0 -0
- package/.nx/cache/project-graph.json +6 -0
- package/front/locales/en.js +6 -0
- package/front/locales/en.json +3 -0
- package/front/src/App.vue +7 -1
- package/front/src/Index.vue +0 -21
- package/front/src/components/BillingBalance.vue +37 -20
- package/front/src/components/CostDisplay.vue +62 -0
- package/front/src/pages/Billing.vue +94 -0
- package/front/src/pages/TopUp.vue +48 -0
- package/front/src/router.js +8 -8
- package/index.js +7 -1
- package/package.json +38 -38
- package/server/app.config.js +28 -1
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "6.0",
|
|
3
|
+
"nxVersion": "18.0.6",
|
|
4
|
+
"deps": {
|
|
5
|
+
"@codemirror/language": "6.10.1",
|
|
6
|
+
"@dotenvx/dotenvx": "0.27.0",
|
|
7
|
+
"@fortawesome/fontawesome-free": "^6.5.2",
|
|
8
|
+
"@live-change/access-control-frontend": "0.8.88",
|
|
9
|
+
"@live-change/access-control-service": "0.8.88",
|
|
10
|
+
"@live-change/backup-service": "0.8.88",
|
|
11
|
+
"@live-change/blog-frontend": "0.8.88",
|
|
12
|
+
"@live-change/blog-service": "0.8.88",
|
|
13
|
+
"@live-change/cli": "0.8.88",
|
|
14
|
+
"@live-change/content-frontend": "0.8.88",
|
|
15
|
+
"@live-change/content-service": "0.8.88",
|
|
16
|
+
"@live-change/dao": "0.8.88",
|
|
17
|
+
"@live-change/dao-vue3": "0.8.88",
|
|
18
|
+
"@live-change/dao-websocket": "0.8.88",
|
|
19
|
+
"@live-change/db-client": "0.8.88",
|
|
20
|
+
"@live-change/email-service": "0.8.88",
|
|
21
|
+
"@live-change/framework": "0.8.88",
|
|
22
|
+
"@live-change/frontend-auto-form": "0.8.88",
|
|
23
|
+
"@live-change/frontend-base": "0.8.88",
|
|
24
|
+
"@live-change/geoip-service": "0.8.88",
|
|
25
|
+
"@live-change/image-frontend": "0.8.88",
|
|
26
|
+
"@live-change/locale-settings-service": "0.8.88",
|
|
27
|
+
"@live-change/password-authentication-service": "0.8.88",
|
|
28
|
+
"@live-change/prosemirror-service": "0.8.88",
|
|
29
|
+
"@live-change/secret-code-service": "0.8.88",
|
|
30
|
+
"@live-change/secret-link-service": "0.8.88",
|
|
31
|
+
"@live-change/session-service": "0.8.88",
|
|
32
|
+
"@live-change/task-service": "0.8.88",
|
|
33
|
+
"@live-change/upload-frontend": "0.8.88",
|
|
34
|
+
"@live-change/url-frontend": "0.8.88",
|
|
35
|
+
"@live-change/url-service": "0.8.88",
|
|
36
|
+
"@live-change/user-frontend": "0.8.88",
|
|
37
|
+
"@live-change/user-identification-service": "0.8.88",
|
|
38
|
+
"@live-change/user-service": "0.8.88",
|
|
39
|
+
"@live-change/vote-service": "0.8.88",
|
|
40
|
+
"@live-change/vue3-components": "0.8.88",
|
|
41
|
+
"@live-change/vue3-ssr": "0.8.88",
|
|
42
|
+
"@live-change/wysiwyg-frontend": "0.8.88",
|
|
43
|
+
"@vueuse/core": "^10.11.0",
|
|
44
|
+
"codeceptjs-assert": "^0.0.5",
|
|
45
|
+
"compression": "^1.7.4",
|
|
46
|
+
"cross-env": "^7.0.3",
|
|
47
|
+
"get-port-sync": "1.0.1",
|
|
48
|
+
"pica": "^9.0.1",
|
|
49
|
+
"pretty-bytes": "^6.1.1",
|
|
50
|
+
"primeflex": "^3.3.1",
|
|
51
|
+
"primeicons": "^7.0.0",
|
|
52
|
+
"primevue": "^3.52.0",
|
|
53
|
+
"rollup-plugin-node-builtins": "^2.1.2",
|
|
54
|
+
"rollup-plugin-visualizer": "5.12.0",
|
|
55
|
+
"serialize-javascript": "^6.0.2",
|
|
56
|
+
"serve-static": "^1.15.0",
|
|
57
|
+
"v-shared-element": "3.1.1",
|
|
58
|
+
"vue": "^3.4.29",
|
|
59
|
+
"vue-i18n": "^9.10.1",
|
|
60
|
+
"vue-router": "^4.3.3",
|
|
61
|
+
"vue3-scroll-border": "0.1.6",
|
|
62
|
+
"@live-change/codeceptjs-helper": "0.8.88",
|
|
63
|
+
"codeceptjs": "^3.6.5",
|
|
64
|
+
"generate-password": "1.7.1",
|
|
65
|
+
"playwright": "^1.41.2",
|
|
66
|
+
"random-profile-generator": "^2.3.0",
|
|
67
|
+
"txtgen": "^3.0.6",
|
|
68
|
+
"webdriverio": "^8.40.2"
|
|
69
|
+
},
|
|
70
|
+
"pathMappings": {},
|
|
71
|
+
"nxJsonPlugins": [],
|
|
72
|
+
"fileMap": {
|
|
73
|
+
"projectFileMap": {},
|
|
74
|
+
"nonProjectFiles": [
|
|
75
|
+
{
|
|
76
|
+
"file": ".gitignore",
|
|
77
|
+
"hash": "16528976885761916170"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"file": "Dockerfile",
|
|
81
|
+
"hash": "2886431590462419165"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"file": "LICENSE",
|
|
85
|
+
"hash": "10221119794387200971"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"file": "dev.Dockerfile",
|
|
89
|
+
"hash": "6907505572289099967"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"file": "docker/app.initd.sh",
|
|
93
|
+
"hash": "5689466769238316025"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"file": "docker/build-and-upload.sh",
|
|
97
|
+
"hash": "9432915210479550333"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"file": "docker/build-docker-and-upload.sh",
|
|
101
|
+
"hash": "9817365185106032741"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"file": "docker/commit-new-version.sh",
|
|
105
|
+
"hash": "5160018103227051012"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"file": "docker/k8s-rsync-helper.sh",
|
|
109
|
+
"hash": "12840580596915123557"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"file": "docker/onlyDependencies.js",
|
|
113
|
+
"hash": "13135394580253028435"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"file": "docker/parse-args-and-config.sh",
|
|
117
|
+
"hash": "11641932740456140593"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"file": "docker/restore-backup-with-service.sh",
|
|
121
|
+
"hash": "10918919254951884109"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"file": "docker/restore-backup.sh",
|
|
125
|
+
"hash": "17157081294258412437"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"file": "docker/start-service.sh",
|
|
129
|
+
"hash": "13107251553503965386"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"file": "docker/upload-backup-and-restore.sh",
|
|
133
|
+
"hash": "16296194178343837935"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"file": "front/index.html",
|
|
137
|
+
"hash": "3170363056965810468"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"file": "front/locales/en.js",
|
|
141
|
+
"hash": "14300349897341705412"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"file": "front/locales/en.json",
|
|
145
|
+
"hash": "15258292997269530563"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"file": "front/public/favicon.ico",
|
|
149
|
+
"hash": "11176796980188620760"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"file": "front/public/images/empty-photo.svg",
|
|
153
|
+
"hash": "9393138513813369674"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"file": "front/public/images/empty-user-photo.svg",
|
|
157
|
+
"hash": "17548039285248668212"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"file": "front/public/images/logo.svg",
|
|
161
|
+
"hash": "5934164668360941413"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"file": "front/public/images/logo128.png",
|
|
165
|
+
"hash": "4924117807669085214"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"file": "front/src/App.vue",
|
|
169
|
+
"hash": "14494941636299148591"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"file": "front/src/Index.vue",
|
|
173
|
+
"hash": "9149832618455200014"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"file": "front/src/analytics/index.js",
|
|
177
|
+
"hash": "492811393913301668"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"file": "front/src/components/BillingBalance.vue",
|
|
181
|
+
"hash": "6172267945206104179"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"file": "front/src/components/CostDisplay.vue",
|
|
185
|
+
"hash": "16713018681450577688"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"file": "front/src/config.js",
|
|
189
|
+
"hash": "4208481022464725661"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"file": "front/src/entry-client.js",
|
|
193
|
+
"hash": "1218837904372604167"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"file": "front/src/entry-server.js",
|
|
197
|
+
"hash": "406370987563099630"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"file": "front/src/pages/Billing.vue",
|
|
201
|
+
"hash": "557182052453475785"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"file": "front/src/pages/TopUp.vue",
|
|
205
|
+
"hash": "2268022077224666193"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"file": "front/src/router.js",
|
|
209
|
+
"hash": "6234528570160583983"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"file": "front/tsconfig.json",
|
|
213
|
+
"hash": "6166366661637344199"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"file": "front/tsconfig.node.json",
|
|
217
|
+
"hash": "4208030242441905014"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"file": "front/vite.config.ts",
|
|
221
|
+
"hash": "15687322672441490123"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"file": "index.js",
|
|
225
|
+
"hash": "16040471848007891839"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"file": "package.json",
|
|
229
|
+
"hash": "9453980767101443698"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"file": "server/app.config.js",
|
|
233
|
+
"hash": "15772384815040622922"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"file": "server/init.js",
|
|
237
|
+
"hash": "10527942683746245757"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"file": "server/page.documentType.js",
|
|
241
|
+
"hash": "4319267302010918354"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"file": "server/security.config.js",
|
|
245
|
+
"hash": "6483730663450187822"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"file": "server/services.list.js",
|
|
249
|
+
"hash": "988759750602058652"
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"file": "server/start.js",
|
|
253
|
+
"hash": "3387118482182040319"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"file": "start-dev-docker.sh",
|
|
257
|
+
"hash": "1356997101209839594"
|
|
258
|
+
}
|
|
259
|
+
]
|
|
260
|
+
}
|
|
261
|
+
}
|
|
Binary file
|
package/front/locales/en.js
CHANGED
package/front/locales/en.json
CHANGED
package/front/src/App.vue
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import { ViewRoot, NavBar, UpdateBanner } from "@live-change/frontend-base"
|
|
19
19
|
|
|
20
|
-
import { computed } from 'vue'
|
|
20
|
+
import { computed, provide } from 'vue'
|
|
21
21
|
import { useHead } from '@vueuse/head'
|
|
22
22
|
|
|
23
23
|
import { useI18n } from 'vue-i18n'
|
|
@@ -56,6 +56,12 @@
|
|
|
56
56
|
StyleModule.mount(window.document, defaultHighlightStyle.module)
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
provide('currencyI18nConfig:credits', {
|
|
60
|
+
format(value) {
|
|
61
|
+
return i18n.n(value, 'credits') + ' ' + i18n.t('currency.credits', value)
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
|
|
59
65
|
import "./analytics"
|
|
60
66
|
|
|
61
67
|
</script>
|
package/front/src/Index.vue
CHANGED
|
@@ -6,27 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
<script setup>
|
|
8
8
|
|
|
9
|
-
import InputText from "primevue/inputtext"
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
defineProps, defineEmits, defineModel, toRefs, computed, watch, ref, watchEffect, onUnmounted,
|
|
13
|
-
getCurrentInstance, unref
|
|
14
|
-
} from 'vue'
|
|
15
|
-
|
|
16
|
-
import { usePath, live, useClient, useActions, reverseRange, useTimeSynchronization } from '@live-change/vue3-ssr'
|
|
17
|
-
const path = usePath()
|
|
18
|
-
const actions = useActions()
|
|
19
|
-
|
|
20
|
-
const allBalancesPath = computed(() => path.balanceTest.allBalances({}))
|
|
21
|
-
|
|
22
|
-
const [allBalances] = await Promise.all([
|
|
23
|
-
live(allBalancesPath)
|
|
24
|
-
])
|
|
25
|
-
|
|
26
|
-
async function deleteBalance(balance) {
|
|
27
|
-
await actions.balanceTest.deleteBalance({ name: balance.owner })
|
|
28
|
-
}
|
|
29
|
-
|
|
30
9
|
</script>
|
|
31
10
|
|
|
32
11
|
<style scoped>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
</
|
|
2
|
+
<span>
|
|
3
|
+
<CurrencyDisplay :value="value"
|
|
4
|
+
:i18nConfig="i18nConfig" :i18nDefaultConfig="i18nDefaultConfig"
|
|
5
|
+
:currency="settings.currency" :denomination="settings.denomination" />
|
|
6
|
+
</span>
|
|
7
7
|
</template>
|
|
8
8
|
|
|
9
9
|
<script setup>
|
|
10
|
-
import {
|
|
10
|
+
import { CurrencyDisplay } from '@live-change/balance-frontend'
|
|
11
11
|
|
|
12
12
|
import { defineProps, toRefs, computed, inject } from 'vue'
|
|
13
13
|
|
|
@@ -19,25 +19,37 @@
|
|
|
19
19
|
user: {
|
|
20
20
|
type: String,
|
|
21
21
|
default: null
|
|
22
|
-
}
|
|
22
|
+
},
|
|
23
|
+
i18nConfig: {
|
|
24
|
+
type: Object,
|
|
25
|
+
default: () => undefined
|
|
26
|
+
},
|
|
27
|
+
i18nDefaultConfig: {
|
|
28
|
+
type: Object,
|
|
29
|
+
default: () => undefined
|
|
30
|
+
},
|
|
23
31
|
})
|
|
24
|
-
const { available, user } = toRefs(props)
|
|
25
|
-
|
|
26
|
-
const billingSettings = inject('billingSettings', (billing) => ({
|
|
27
|
-
currency: 'usd',
|
|
28
|
-
denomination: 2
|
|
29
|
-
}))
|
|
32
|
+
const { available, user, i18nConfig, i18nDefaultConfig } = toRefs(props)
|
|
30
33
|
|
|
31
|
-
import { usePath, live, useClient } from '@live-change/vue3-ssr'
|
|
34
|
+
import { usePath, live, useClient, useApi } from '@live-change/vue3-ssr'
|
|
32
35
|
const path = usePath()
|
|
33
36
|
const client = useClient()
|
|
37
|
+
const api = useApi()
|
|
34
38
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
const billingClientConfig = api.getServiceDefinition('billing')?.clientConfig
|
|
40
|
+
|
|
41
|
+
const billingSettings = inject('billingSettings', (billing) => ({
|
|
42
|
+
currency: billingClientConfig?.currency ?? 'usd',
|
|
43
|
+
denomination: billingClientConfig?.denomination ?? 100
|
|
44
|
+
}))
|
|
45
|
+
|
|
46
|
+
const billingPath = computed(() =>
|
|
47
|
+
(user.value ? path.billing.userOwnedBilling({ user }) : path.billing.myUserBilling({}))
|
|
48
|
+
.with(billing => path.balance.ownerOwnedBalance({
|
|
49
|
+
ownerType: 'billing_Billing',
|
|
50
|
+
owner: billing.id
|
|
51
|
+
}).bind('balance'))
|
|
52
|
+
)
|
|
41
53
|
|
|
42
54
|
const [ billing ] = await Promise.all([
|
|
43
55
|
live(billingPath)
|
|
@@ -45,6 +57,11 @@
|
|
|
45
57
|
|
|
46
58
|
const settings = computed(() => billingSettings( billing ))
|
|
47
59
|
|
|
60
|
+
const value = computed(() => available.value
|
|
61
|
+
? billing?.balance?.value?.available ?? 0
|
|
62
|
+
: billing?.balance?.value?.amount ?? 0
|
|
63
|
+
)
|
|
64
|
+
|
|
48
65
|
</script>
|
|
49
66
|
|
|
50
67
|
<style scoped>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<span class="mr-1">Cost:</span>
|
|
4
|
+
<span :class="{
|
|
5
|
+
'text-red-500': cost > available
|
|
6
|
+
}">
|
|
7
|
+
<CurrencyDisplay
|
|
8
|
+
:value="cost"
|
|
9
|
+
:currency="settings.currency"
|
|
10
|
+
:denomination="settings.denomination" />
|
|
11
|
+
</span>
|
|
12
|
+
<span v-if="cost > available" class="text-red-500 text-sm"> (Insufficient funds)</span>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup>
|
|
17
|
+
import { CurrencyDisplay } from '@live-change/balance-frontend'
|
|
18
|
+
|
|
19
|
+
import { defineProps, toRefs, computed, inject } from 'vue'
|
|
20
|
+
|
|
21
|
+
const props = defineProps({
|
|
22
|
+
cost: {
|
|
23
|
+
type: Number,
|
|
24
|
+
required: true
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
const { cost } = toRefs(props)
|
|
28
|
+
|
|
29
|
+
import { usePath, live, useClient, useApi } from '@live-change/vue3-ssr'
|
|
30
|
+
const path = usePath()
|
|
31
|
+
const client = useClient()
|
|
32
|
+
const api = useApi()
|
|
33
|
+
|
|
34
|
+
const billingClientConfig = api.getServiceDefinition('billing')?.clientConfig
|
|
35
|
+
|
|
36
|
+
const billingSettings = inject('billingSettings', (billing) => ({
|
|
37
|
+
currency: billingClientConfig?.currency ?? 'usd',
|
|
38
|
+
denomination: billingClientConfig?.denomination ?? 100
|
|
39
|
+
}))
|
|
40
|
+
|
|
41
|
+
const billingPath = computed(() =>
|
|
42
|
+
path.billing.myUserBilling({})
|
|
43
|
+
.with(billing => path.balance.ownerOwnedBalance({
|
|
44
|
+
ownerType: 'billing_Billing',
|
|
45
|
+
owner: billing.id
|
|
46
|
+
}).bind('balance'))
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
const [ billing ] = await Promise.all([
|
|
50
|
+
live(billingPath)
|
|
51
|
+
])
|
|
52
|
+
|
|
53
|
+
const settings = computed(() => billingSettings( billing ))
|
|
54
|
+
|
|
55
|
+
const balance = computed(() => billing.value?.balance)
|
|
56
|
+
const available = computed(() => balance.value?.available || 0)
|
|
57
|
+
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<style scoped>
|
|
61
|
+
|
|
62
|
+
</style>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="w-full lg:w-6 md:w-9">
|
|
3
|
+
<div class="surface-card border-round shadow-1 p-3">
|
|
4
|
+
<div class="flex flex-row flex-wrap">
|
|
5
|
+
<div class="flex-1">
|
|
6
|
+
<div>
|
|
7
|
+
<div class="text-lg">
|
|
8
|
+
Available Funds:
|
|
9
|
+
</div>
|
|
10
|
+
<div class="text-2xl text-800 font-semibold">
|
|
11
|
+
<BillingBalance />
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
<div v-if="availableDifferent">
|
|
15
|
+
<span class="text-xs">
|
|
16
|
+
All funds:
|
|
17
|
+
</span>
|
|
18
|
+
<span class="text-sm" >
|
|
19
|
+
<BillingBalance :available="false" />
|
|
20
|
+
</span>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="flex-1">
|
|
24
|
+
<div v-for="offer of billingClientConfig.topUpOffers" :key="'offer'+JSON.stringify(offer)">
|
|
25
|
+
<router-link :to="{ name: 'billing:topUp', params: {
|
|
26
|
+
value: offer.value, price: offer.price, currency: offer.currency
|
|
27
|
+
} }"
|
|
28
|
+
class="flex flex-row no-underline hover:underline">
|
|
29
|
+
<span class="mr-1">Add</span>
|
|
30
|
+
<CurrencyDisplay class="font-semibold"
|
|
31
|
+
:value="offer.value" :currency="settings.currency" :denomination="settings.denomination" />
|
|
32
|
+
<span class="mx-1">for</span>
|
|
33
|
+
<CurrencyDisplay class="font-medium"
|
|
34
|
+
:value="offer.price" :currency="offer.currency" :denomination="offer.denomination" />
|
|
35
|
+
</router-link>
|
|
36
|
+
</div>
|
|
37
|
+
<!-- <div v-if="billingClientConfig.anyTopUpPrices?.length">
|
|
38
|
+
{{billingClientConfig.anyTopUpPrices}}
|
|
39
|
+
TODO: currency input
|
|
40
|
+
</div>-->
|
|
41
|
+
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script setup>
|
|
49
|
+
import BillingBalance from '../components/BillingBalance.vue'
|
|
50
|
+
|
|
51
|
+
import { CurrencyDisplay } from '@live-change/balance-frontend'
|
|
52
|
+
|
|
53
|
+
import { defineProps, toRefs, computed, inject } from 'vue'
|
|
54
|
+
|
|
55
|
+
const props = defineProps({
|
|
56
|
+
user: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: null
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
const { user } = toRefs(props)
|
|
62
|
+
|
|
63
|
+
import { usePath, live, useClient, useApi } from '@live-change/vue3-ssr'
|
|
64
|
+
const path = usePath()
|
|
65
|
+
const client = useClient()
|
|
66
|
+
const api = useApi()
|
|
67
|
+
|
|
68
|
+
const billingClientConfig = api.getServiceDefinition('billing')?.clientConfig
|
|
69
|
+
|
|
70
|
+
const billingSettings = inject('billingSettings', (billing) => ({
|
|
71
|
+
currency: billingClientConfig?.currency ?? 'usd',
|
|
72
|
+
denomination: billingClientConfig?.denomination ?? 100
|
|
73
|
+
}))
|
|
74
|
+
|
|
75
|
+
const billingPath = computed(() =>
|
|
76
|
+
(user.value ? path.billing.userOwnedBilling({ user }) : path.billing.myUserBilling({}))
|
|
77
|
+
.with(billing => path.balance.ownerOwnedBalance({
|
|
78
|
+
ownerType: 'billing_Billing',
|
|
79
|
+
owner: billing.id
|
|
80
|
+
}).bind('balance'))
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
const [ billing ] = await Promise.all([
|
|
84
|
+
live(billingPath)
|
|
85
|
+
])
|
|
86
|
+
|
|
87
|
+
const availableDifferent = computed(() => billing.value?.balance?.available !== billing.value?.balance?.all)
|
|
88
|
+
|
|
89
|
+
const settings = computed(() => billingSettings( billing ))
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<style scoped>
|
|
93
|
+
|
|
94
|
+
</style>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<h1>{{ offer}}</h1>
|
|
3
|
+
<h2>{{ anyTopUpPrice }}</h2>
|
|
4
|
+
<pre>{{ billingClientConfig.topUpOffers }}</pre>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
8
|
+
import { CurrencyDisplay } from '@live-change/balance-frontend'
|
|
9
|
+
|
|
10
|
+
import { defineProps, toRefs, computed, inject } from 'vue'
|
|
11
|
+
|
|
12
|
+
const props = defineProps({
|
|
13
|
+
value: {
|
|
14
|
+
type: Number,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
price: {
|
|
18
|
+
type: Number,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
currency: {
|
|
22
|
+
type: String,
|
|
23
|
+
required: true
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
const { value, price, currency } = toRefs(props)
|
|
27
|
+
|
|
28
|
+
import { usePath, live, useClient, useApi } from '@live-change/vue3-ssr'
|
|
29
|
+
const path = usePath()
|
|
30
|
+
const client = useClient()
|
|
31
|
+
const api = useApi()
|
|
32
|
+
|
|
33
|
+
const billingClientConfig = api.getServiceDefinition('billing')?.clientConfig
|
|
34
|
+
|
|
35
|
+
const offer = computed(() => billingClientConfig?.topUpOffers
|
|
36
|
+
?.find(offer =>
|
|
37
|
+
(offer.currency === currency.value) && (offer.price === +price.value) && (offer.value === +value.value)
|
|
38
|
+
))
|
|
39
|
+
|
|
40
|
+
const anyTopUpPrice = computed(() => billingClientConfig?.anyTopUpPrices
|
|
41
|
+
?.find(price => price.currency === currency.value))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<style scoped>
|
|
47
|
+
|
|
48
|
+
</style>
|
package/front/src/router.js
CHANGED
|
@@ -13,14 +13,13 @@ import { userRoutes } from "@live-change/user-frontend"
|
|
|
13
13
|
import { catchAllPagesRoute, contentEditRoutes, pagesSitemap } from "@live-change/content-frontend"
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
export function
|
|
16
|
+
export function billingRoutes(config = {}) {
|
|
17
17
|
const { prefix = '/', route = (r) => r } = config
|
|
18
18
|
return [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
route({ name: 'billing:billing', path: prefix + 'billing', props: true,
|
|
20
|
+
component: () => import("./pages/Billing.vue") }),
|
|
21
|
+
route({ name: 'billing:topUp', path: prefix + 'billing/topUp/:value/:price/:currency', props: true,
|
|
22
|
+
component: () => import("./pages/TopUp.vue") }),
|
|
24
23
|
]
|
|
25
24
|
}
|
|
26
25
|
|
|
@@ -36,14 +35,15 @@ import { client as useClient } from '@live-change/vue3-ssr'
|
|
|
36
35
|
export function createRouter(app, config) {
|
|
37
36
|
const client = useClient(app._context)
|
|
38
37
|
|
|
38
|
+
const prefix = config?.prefix || '/'
|
|
39
|
+
|
|
39
40
|
const router = _createRouter({
|
|
40
41
|
// use appropriate history implementation for server/client
|
|
41
42
|
// import.meta.env.SSR is injected by Vite.
|
|
42
43
|
history: import.meta.env.SSR ? createMemoryHistory() : createWebHistory(),
|
|
43
44
|
routes: [
|
|
44
45
|
...userRoutes({ ...config, prefix: prefix + 'user/' }),
|
|
45
|
-
|
|
46
|
-
...balanceRoutes(config),
|
|
46
|
+
...billingRoutes(config),
|
|
47
47
|
|
|
48
48
|
{
|
|
49
49
|
name: 'index', path: '/', meta: { },
|
package/index.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
import { billingRoutes } from './front/src/router.js'
|
|
3
|
+
export { billingRoutes }
|
|
4
|
+
|
|
5
|
+
import BillingBalance from './front/src/components/BillingBalance.vue'
|
|
6
|
+
import CostDisplay from './front/src/components/CostDisplay.vue'
|
|
7
|
+
|
|
8
|
+
export { BillingBalance, CostDisplay }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/billing-frontend",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.89",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"memDev": "node server/start.js memDev --enableSessions --initScript ./init.js --dbAccess",
|
|
6
6
|
"localDevInit": "rm tmp.db; node server/start.js localDev --enableSessions --initScript ./init.js",
|
|
@@ -35,41 +35,41 @@
|
|
|
35
35
|
"@codemirror/language": "6.10.1",
|
|
36
36
|
"@dotenvx/dotenvx": "0.27.0",
|
|
37
37
|
"@fortawesome/fontawesome-free": "^6.5.2",
|
|
38
|
-
"@live-change/access-control-frontend": "^0.8.
|
|
39
|
-
"@live-change/access-control-service": "^0.8.
|
|
40
|
-
"@live-change/backup-service": "^0.8.
|
|
41
|
-
"@live-change/blog-frontend": "^0.8.
|
|
42
|
-
"@live-change/blog-service": "^0.8.
|
|
43
|
-
"@live-change/cli": "^0.8.
|
|
44
|
-
"@live-change/content-frontend": "^0.8.
|
|
45
|
-
"@live-change/content-service": "^0.8.
|
|
46
|
-
"@live-change/dao": "^0.8.
|
|
47
|
-
"@live-change/dao-vue3": "^0.8.
|
|
48
|
-
"@live-change/dao-websocket": "^0.8.
|
|
49
|
-
"@live-change/db-client": "^0.8.
|
|
50
|
-
"@live-change/email-service": "^0.8.
|
|
51
|
-
"@live-change/framework": "^0.8.
|
|
52
|
-
"@live-change/frontend-auto-form": "^0.8.
|
|
53
|
-
"@live-change/frontend-base": "^0.8.
|
|
54
|
-
"@live-change/geoip-service": "^0.8.
|
|
55
|
-
"@live-change/image-frontend": "^0.8.
|
|
56
|
-
"@live-change/locale-settings-service": "^0.8.
|
|
57
|
-
"@live-change/password-authentication-service": "^0.8.
|
|
58
|
-
"@live-change/prosemirror-service": "^0.8.
|
|
59
|
-
"@live-change/secret-code-service": "^0.8.
|
|
60
|
-
"@live-change/secret-link-service": "^0.8.
|
|
61
|
-
"@live-change/session-service": "^0.8.
|
|
62
|
-
"@live-change/task-service": "^0.8.
|
|
63
|
-
"@live-change/upload-frontend": "^0.8.
|
|
64
|
-
"@live-change/url-frontend": "^0.8.
|
|
65
|
-
"@live-change/url-service": "^0.8.
|
|
66
|
-
"@live-change/user-frontend": "^0.8.
|
|
67
|
-
"@live-change/user-identification-service": "^0.8.
|
|
68
|
-
"@live-change/user-service": "^0.8.
|
|
69
|
-
"@live-change/vote-service": "^0.8.
|
|
70
|
-
"@live-change/vue3-components": "^0.8.
|
|
71
|
-
"@live-change/vue3-ssr": "^0.8.
|
|
72
|
-
"@live-change/wysiwyg-frontend": "^0.8.
|
|
38
|
+
"@live-change/access-control-frontend": "^0.8.89",
|
|
39
|
+
"@live-change/access-control-service": "^0.8.89",
|
|
40
|
+
"@live-change/backup-service": "^0.8.89",
|
|
41
|
+
"@live-change/blog-frontend": "^0.8.89",
|
|
42
|
+
"@live-change/blog-service": "^0.8.89",
|
|
43
|
+
"@live-change/cli": "^0.8.89",
|
|
44
|
+
"@live-change/content-frontend": "^0.8.89",
|
|
45
|
+
"@live-change/content-service": "^0.8.89",
|
|
46
|
+
"@live-change/dao": "^0.8.89",
|
|
47
|
+
"@live-change/dao-vue3": "^0.8.89",
|
|
48
|
+
"@live-change/dao-websocket": "^0.8.89",
|
|
49
|
+
"@live-change/db-client": "^0.8.89",
|
|
50
|
+
"@live-change/email-service": "^0.8.89",
|
|
51
|
+
"@live-change/framework": "^0.8.89",
|
|
52
|
+
"@live-change/frontend-auto-form": "^0.8.89",
|
|
53
|
+
"@live-change/frontend-base": "^0.8.89",
|
|
54
|
+
"@live-change/geoip-service": "^0.8.89",
|
|
55
|
+
"@live-change/image-frontend": "^0.8.89",
|
|
56
|
+
"@live-change/locale-settings-service": "^0.8.89",
|
|
57
|
+
"@live-change/password-authentication-service": "^0.8.89",
|
|
58
|
+
"@live-change/prosemirror-service": "^0.8.89",
|
|
59
|
+
"@live-change/secret-code-service": "^0.8.89",
|
|
60
|
+
"@live-change/secret-link-service": "^0.8.89",
|
|
61
|
+
"@live-change/session-service": "^0.8.89",
|
|
62
|
+
"@live-change/task-service": "^0.8.89",
|
|
63
|
+
"@live-change/upload-frontend": "^0.8.89",
|
|
64
|
+
"@live-change/url-frontend": "^0.8.89",
|
|
65
|
+
"@live-change/url-service": "^0.8.89",
|
|
66
|
+
"@live-change/user-frontend": "^0.8.89",
|
|
67
|
+
"@live-change/user-identification-service": "^0.8.89",
|
|
68
|
+
"@live-change/user-service": "^0.8.89",
|
|
69
|
+
"@live-change/vote-service": "^0.8.89",
|
|
70
|
+
"@live-change/vue3-components": "^0.8.89",
|
|
71
|
+
"@live-change/vue3-ssr": "^0.8.89",
|
|
72
|
+
"@live-change/wysiwyg-frontend": "^0.8.89",
|
|
73
73
|
"@vueuse/core": "^10.11.0",
|
|
74
74
|
"codeceptjs-assert": "^0.0.5",
|
|
75
75
|
"compression": "^1.7.4",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"vue3-scroll-border": "0.1.6"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
|
-
"@live-change/codeceptjs-helper": "^0.8.
|
|
94
|
+
"@live-change/codeceptjs-helper": "^0.8.89",
|
|
95
95
|
"codeceptjs": "^3.6.5",
|
|
96
96
|
"generate-password": "1.7.1",
|
|
97
97
|
"playwright": "^1.41.2",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"author": "Michał Łaszczewski <michal@laszczewski.pl>",
|
|
103
103
|
"license": "ISC",
|
|
104
104
|
"description": "",
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "15d4b3dc445480608c993e4057be208192e97023"
|
|
106
106
|
}
|
package/server/app.config.js
CHANGED
|
@@ -97,7 +97,34 @@ app.config = {
|
|
|
97
97
|
name: 'balance',
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
|
-
name: 'billing'
|
|
100
|
+
name: 'billing',
|
|
101
|
+
currency: 'credits',
|
|
102
|
+
denomination: 1,
|
|
103
|
+
minimumTopUp: 1000,
|
|
104
|
+
anyTopUpPrices: [
|
|
105
|
+
{
|
|
106
|
+
value: 1000,
|
|
107
|
+
price: 1233,
|
|
108
|
+
currency: 'usd'
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
topUpOffers: [
|
|
112
|
+
{
|
|
113
|
+
value: 1000,
|
|
114
|
+
price: 1200,
|
|
115
|
+
currency: 'usd'
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
value: 2300,
|
|
119
|
+
price: 2450,
|
|
120
|
+
currency: 'usd'
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
value: 10000,
|
|
124
|
+
price: 11000,
|
|
125
|
+
currency: 'usd'
|
|
126
|
+
},
|
|
127
|
+
]
|
|
101
128
|
},
|
|
102
129
|
{
|
|
103
130
|
name: 'backup',
|