mango-cms 0.1.21 → 0.1.23
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/cli.js +9 -1
- package/default/package.json +33 -32
- package/default/src/helpers/Mango.vue +0 -100
- package/default/src/helpers/email.js +36 -0
- package/default/src/helpers/mango.js +2 -2
- package/default/src/main.js +1 -8
- package/default/vite.config.js +2 -0
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -168,9 +168,17 @@ program
|
|
|
168
168
|
console.log('Error reading settings file:', error.message);
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
// Convert project name to lowercase and remove spaces for domain/DB names
|
|
172
|
+
const projectSlug = answers.projectName.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
173
|
+
|
|
171
174
|
settings = {
|
|
172
175
|
...settings,
|
|
173
|
-
license: answers.license
|
|
176
|
+
license: answers.license,
|
|
177
|
+
siteName: answers.projectName,
|
|
178
|
+
siteDomain: `${projectSlug}.com`,
|
|
179
|
+
domain: `api.${projectSlug}.com`,
|
|
180
|
+
database: `${projectSlug}`,
|
|
181
|
+
s3Bucket: `${projectSlug}`
|
|
174
182
|
};
|
|
175
183
|
fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
|
|
176
184
|
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
package/default/package.json
CHANGED
|
@@ -2,40 +2,41 @@
|
|
|
2
2
|
"name": "mango-front",
|
|
3
3
|
"version": "0.0.0",
|
|
4
4
|
"scripts": {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
"dev": "vite",
|
|
6
|
+
"build": "vite build",
|
|
7
|
+
"preview": "vite preview",
|
|
8
|
+
"mango": "mango"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
11
|
+
"@headlessui/vue": "^1.6.7",
|
|
12
|
+
"@mapbox/mapbox-gl-geocoder": "^5.0.0",
|
|
13
|
+
"@sweetalert2/theme-dark": "^5.0.10",
|
|
14
|
+
"@tinymce/tinymce-vue": "^4",
|
|
15
|
+
"@vitejs/plugin-vue": "^5.2.3",
|
|
16
|
+
"@vueup/vue-quill": "^1.0.0-beta.7",
|
|
17
|
+
"@vueuse/motion": "^2.0.0-beta.12",
|
|
18
|
+
"algoliasearch": "^4.12.0",
|
|
19
|
+
"axios": "^0.24.0",
|
|
20
|
+
"canvas-confetti": "^1.5.1",
|
|
21
|
+
"datebook": "^7.0.8",
|
|
22
|
+
"dayjs": "^1.10.7",
|
|
23
|
+
"express": "^4.18.1",
|
|
24
|
+
"google-maps": "^4.3.3",
|
|
25
|
+
"mango-cms": "^0.1.20",
|
|
26
|
+
"mapbox-gl": "^2.7.0",
|
|
27
|
+
"sweetalert2": "^11.4.0",
|
|
28
|
+
"vite": "^6.2.2",
|
|
29
|
+
"vue": "^3.2.37",
|
|
30
|
+
"vue-router": "4",
|
|
31
|
+
"vue-slider-component": "^4.0.0-beta.4",
|
|
32
|
+
"vue-upload-component": "^3.1.2",
|
|
33
|
+
"vue3-clipboard": "^1.0.0",
|
|
34
|
+
"vue3-touch-events": "^4.1.0",
|
|
35
|
+
"vuedraggable": "^4.1.0"
|
|
34
36
|
},
|
|
35
37
|
"devDependencies": {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"vite": "^4.5.9"
|
|
38
|
+
"autoprefixer": "^10.4.0",
|
|
39
|
+
"postcss": "^8.4.5",
|
|
40
|
+
"tailwindcss": "^3.0.2"
|
|
40
41
|
}
|
|
41
|
-
|
|
42
|
+
}
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
<script setup>
|
|
8
8
|
import Mango from './mango'
|
|
9
9
|
import { siteName } from '@config/config/settings.json'
|
|
10
|
-
import rws from './reconnecting-websocket'
|
|
11
10
|
import { ref, watch, computed, nextTick, onUnmounted } from 'vue'
|
|
12
11
|
import { useRoute } from 'vue-router'
|
|
13
12
|
|
|
@@ -245,105 +244,6 @@ async function init() {
|
|
|
245
244
|
|
|
246
245
|
}
|
|
247
246
|
|
|
248
|
-
const GQL = {
|
|
249
|
-
CONNECTION_INIT: 'connection_init',
|
|
250
|
-
CONNECTION_ACK: 'connection_ack',
|
|
251
|
-
CONNECTION_ERROR: 'connection_error',
|
|
252
|
-
CONNECTION_KEEP_ALIVE: 'ka',
|
|
253
|
-
START: 'start',
|
|
254
|
-
STOP: 'stop',
|
|
255
|
-
CONNECTION_TERMINATE: 'connection_terminate',
|
|
256
|
-
DATA: 'data',
|
|
257
|
-
ERROR: 'error',
|
|
258
|
-
COMPLETE: 'complete'
|
|
259
|
-
}
|
|
260
|
-
function subscribe(collection, id) {
|
|
261
|
-
|
|
262
|
-
webSocket = new rws(Mango.ws, 'graphql-ws')
|
|
263
|
-
|
|
264
|
-
webSocket.onopen = event => {
|
|
265
|
-
|
|
266
|
-
webSocket.send(JSON.stringify({
|
|
267
|
-
type: GQL.CONNECTION_INIT,
|
|
268
|
-
payload: {}
|
|
269
|
-
}))
|
|
270
|
-
|
|
271
|
-
webSocket.send(JSON.stringify({
|
|
272
|
-
type: GQL.START,
|
|
273
|
-
id: Date.now(),
|
|
274
|
-
payload: {
|
|
275
|
-
query: `
|
|
276
|
-
subscription {
|
|
277
|
-
${collection}(id: "${id}") {
|
|
278
|
-
id
|
|
279
|
-
settings {
|
|
280
|
-
clueTimeLimit
|
|
281
|
-
guessTimeLimit
|
|
282
|
-
}
|
|
283
|
-
guesses {
|
|
284
|
-
word
|
|
285
|
-
playerId
|
|
286
|
-
time
|
|
287
|
-
}
|
|
288
|
-
clue {
|
|
289
|
-
text
|
|
290
|
-
number
|
|
291
|
-
time
|
|
292
|
-
team
|
|
293
|
-
words
|
|
294
|
-
guesses
|
|
295
|
-
}
|
|
296
|
-
words {
|
|
297
|
-
value
|
|
298
|
-
color
|
|
299
|
-
guessed
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}`,
|
|
303
|
-
variables: {},
|
|
304
|
-
operationName: null
|
|
305
|
-
}
|
|
306
|
-
}))
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
webSocket.onmessage = event => {
|
|
310
|
-
const response = JSON.parse(event.data)
|
|
311
|
-
switch (response.type) {
|
|
312
|
-
case GQL.CONNECTION_ACK: {
|
|
313
|
-
console.log('success')
|
|
314
|
-
break
|
|
315
|
-
}
|
|
316
|
-
case GQL.CONNECTION_ERROR: {
|
|
317
|
-
console.error(response.payload)
|
|
318
|
-
break
|
|
319
|
-
}
|
|
320
|
-
case GQL.CONNECTION_KEEP_ALIVE: {
|
|
321
|
-
break
|
|
322
|
-
}
|
|
323
|
-
case GQL.DATA: {
|
|
324
|
-
console.log(response.id, response.payload.errors, response.payload.data)
|
|
325
|
-
if (response.payload.data) {
|
|
326
|
-
data.value = response.payload.data[collection]
|
|
327
|
-
emit('update:data', data.value)
|
|
328
|
-
}
|
|
329
|
-
break
|
|
330
|
-
}
|
|
331
|
-
case GQL.COMPLETE: {
|
|
332
|
-
console.log('completed', response.id)
|
|
333
|
-
break
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
onUnmounted(() => {
|
|
340
|
-
if (webSocket?.send) {
|
|
341
|
-
webSocket.send(JSON.stringify({
|
|
342
|
-
type: GQL.CONNECTION_TERMINATE
|
|
343
|
-
}))
|
|
344
|
-
}
|
|
345
|
-
})
|
|
346
|
-
|
|
347
247
|
// init()
|
|
348
248
|
// await init()
|
|
349
249
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import Swal from "sweetalert2"
|
|
2
|
+
import axios from "axios"
|
|
3
|
+
|
|
4
|
+
function validateEmail(email) {
|
|
5
|
+
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
6
|
+
return re.test(String(email.trim()).toLowerCase());
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async function subscribeToMailChimp({ email, list, source, alert }) {
|
|
10
|
+
|
|
11
|
+
let lists = {
|
|
12
|
+
master: '816047355d',
|
|
13
|
+
devotional: '5fbac827f8'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let listId = lists[list]
|
|
17
|
+
|
|
18
|
+
if (!listId) return console.error(`"${list}" is not a valid email list`)
|
|
19
|
+
if (!source) return console.error(`You must provide a subscription source`)
|
|
20
|
+
|
|
21
|
+
if (!validateEmail(email)) {
|
|
22
|
+
new Swal('Invalid Email', `"${email}" is not a valid email address`, 'warning')
|
|
23
|
+
return console.error(`"${email}" is not a valid email address`)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
await axios.post(`https://churchandfamilylife.us2.list-manage.com/subscribe/post?u=12eae89c5f8969e490844c75a&id=${listId}`, { EMAIL: email, MMERGE3: source })
|
|
28
|
+
.then(response => { if (alert) new Swal('Subscribed!', 'Thank you for subscribing.', 'success') })
|
|
29
|
+
// MC apparently doesn't give a proper error message we can read at the time of writing this...
|
|
30
|
+
.catch(response => { if (alert) new Swal('Subscribed!', 'Thank you for subscribing.', 'success') })
|
|
31
|
+
} catch (e) {
|
|
32
|
+
console.log(e)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { subscribeToMailChimp, validateEmail }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// import collections from '../../../mango/config/.collections.json'
|
|
2
2
|
// import { algoliaAppId, algoliaSearchKey, algoliaIndex, port, domain } from '../../../mango/config/settings'
|
|
3
|
-
import collections from '@
|
|
4
|
-
import { algoliaAppId, algoliaSearchKey, algoliaIndex, port, domain } from '@
|
|
3
|
+
import collections from '@collections'
|
|
4
|
+
import { algoliaAppId, algoliaSearchKey, algoliaIndex, port, domain } from '@settings'
|
|
5
5
|
import axios from "axios";
|
|
6
6
|
import { ref } from 'vue'
|
|
7
7
|
import algoliasearch from 'algoliasearch/lite'
|
package/default/src/main.js
CHANGED
|
@@ -2,8 +2,7 @@ import axios from 'axios'
|
|
|
2
2
|
import { computed, createApp, defineAsyncComponent, reactive, ref } from 'vue'
|
|
3
3
|
import { createRouter, createWebHistory } from 'vue-router'
|
|
4
4
|
import { MotionPlugin } from '@vueuse/motion'
|
|
5
|
-
|
|
6
|
-
import { port, domain } from '../../config/config/settings'
|
|
5
|
+
import { port, domain } from '@settings'
|
|
7
6
|
import VueClipboard from 'vue3-clipboard'
|
|
8
7
|
import Vue3TouchEvents from "vue3-touch-events";
|
|
9
8
|
import App from './App.vue'
|
|
@@ -62,12 +61,9 @@ Global Properties
|
|
|
62
61
|
|
|
63
62
|
*/
|
|
64
63
|
|
|
65
|
-
import breakpoints from './helpers/breakpoints'
|
|
66
64
|
import darkMode from './helpers/darkMode'
|
|
67
|
-
import formatPhone from './helpers/formatPhone'
|
|
68
65
|
import { initUser } from './helpers/user';
|
|
69
66
|
|
|
70
|
-
app.provide('breakpoints', breakpoints().breakpoints)
|
|
71
67
|
app.provide('darkMode', darkMode().darkMode)
|
|
72
68
|
|
|
73
69
|
const user = initUser()
|
|
@@ -90,7 +86,6 @@ app.provide('store', store)
|
|
|
90
86
|
app.provide('axios', axios)
|
|
91
87
|
|
|
92
88
|
app.provide('mode', import.meta.env.MODE)
|
|
93
|
-
app.provide('formatPhone', formatPhone)
|
|
94
89
|
|
|
95
90
|
|
|
96
91
|
/*
|
|
@@ -102,12 +97,10 @@ Global Components
|
|
|
102
97
|
import Mango from './helpers/Mango.vue'
|
|
103
98
|
import Spinner from './components/layout/spinner.vue'
|
|
104
99
|
import Modal from './components/layout/modal.vue'
|
|
105
|
-
import Button from './components/partials/button.vue'
|
|
106
100
|
|
|
107
101
|
app.component('Mango', Mango)
|
|
108
102
|
app.component('Spinner', Spinner)
|
|
109
103
|
app.component('Modal', Modal)
|
|
110
|
-
app.component('btn', Button)
|
|
111
104
|
// app.component('resource', defineAsyncComponent(Layouter.vue')))
|
|
112
105
|
|
|
113
106
|
/*
|
package/default/vite.config.js
CHANGED
|
@@ -27,6 +27,8 @@ export default defineConfig({
|
|
|
27
27
|
resolve: {
|
|
28
28
|
alias: {
|
|
29
29
|
'@config': configPath,
|
|
30
|
+
'@settings': path.resolve(configPath, 'config/settings.json'),
|
|
31
|
+
'@collections': path.resolve(configPath, 'config/.collections.json'),
|
|
30
32
|
'@plugins': path.resolve(configPath, 'plugins'),
|
|
31
33
|
'vue': path.resolve(__dirname, 'node_modules/vue'),
|
|
32
34
|
}
|