@ozdao/prometheus-framework 0.2.230 → 0.2.232

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ozdao/prometheus-framework",
3
- "version": "0.2.230",
3
+ "version": "0.2.232",
4
4
  "description": "Web3 Framework focused on user experience and ease of development.",
5
5
  "author": "OZ DAO <hello@ozdao.dev>",
6
6
  "license": "GPL-3.0-or-later",
@@ -0,0 +1,36 @@
1
+ module.exports = `
2
+ <!DOCTYPE html>
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>NMS</title>
8
+
9
+ <script async src="https://www.googletagmanager.com/gtag/js?id={{googleTagId}}"></script>
10
+ <script>
11
+ window.dataLayer = window.dataLayer || [];
12
+ function gtag(){dataLayer.push(arguments);}
13
+ gtag('js', new Date());
14
+
15
+ gtag('config', '{{googleTagId}}');
16
+ </script>
17
+ <script>(function(){var s;(s=document.currentScript||document.scripts[document.scripts.length-1]).parentNode.removeChild(s);}());</script>
18
+
19
+ <link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png">
20
+ <link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
21
+ <link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png">
22
+ <link rel="manifest" href="/favicon/site.webmanifest">
23
+ <link rel="mask-icon" href="/favicon/safari-pinned-tab.svg" color="#5bbad5">
24
+
25
+ <link rel="stylesheet" type="text/css" href="/main.css">
26
+
27
+ <meta name="msapplication-TileColor" content="#000000">
28
+ <meta name="theme-color" content="#ffffff">
29
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
30
+ </head>
31
+ <body>
32
+ <div id="app"></div>
33
+ </body>
34
+ </body>
35
+ </html>
36
+ `;
@@ -36,7 +36,7 @@ module.exports = (projectRoot) => {
36
36
  }),
37
37
  new HtmlWebpackPlugin({
38
38
  templateContent: async () => {
39
- const template = require("../templates/page.js");
39
+ const template = require("../templates/screen.js");
40
40
 
41
41
  const meta = {
42
42
  htmlAttrs: 'lang="en"',
@@ -32,6 +32,8 @@ onUnmounted(async () => {
32
32
  })
33
33
 
34
34
  async function startScan() {
35
+ document.querySelector('body')?.classList.add('barcode-scanner-active');
36
+
35
37
  try {
36
38
  const { camera } = await BarcodeScanner.checkPermissions()
37
39
  if (camera !== 'granted') {
@@ -57,7 +59,7 @@ async function startScan() {
57
59
 
58
60
  async function stopScan() {
59
61
  try {
60
- document.querySelector('body')?.classList.remove('barcode-scanner-active')
62
+ document.querySelector('body')?.classList.remove('barcode-scanner-active');
61
63
  isScanning.value = false
62
64
  await BarcodeScanner.stopScan()
63
65
  await BarcodeScanner.removeAllListeners()
@@ -84,24 +86,19 @@ async function processBarcode(barcode) {
84
86
  </script>
85
87
 
86
88
  <style scoped>
89
+ body.barcode-scanner-active {
90
+ visibility: hidden;
91
+ --background: transparent;
92
+ --ion-background-color: transparent;
93
+ }
87
94
  .barcode-scanner-modal {
88
- position: fixed;
89
- top: 0;
90
- left: 0;
91
- right: 0;
92
- bottom: 0;
93
- background: rgba(0, 0, 0, 0.8);
94
- display: flex;
95
- justify-content: center;
96
- align-items: center;
95
+ visibility: visible;
97
96
  }
98
97
 
99
- .stop-scan-button {
100
- position: absolute;
101
- bottom: 20px;
102
- left: 50%;
103
- transform: translateX(-50%);
98
+ @media (prefers-color-scheme: dark) {
99
+ .barcode-scanner-modal {
100
+ --background: transparent;
101
+ --ion-background-color: transparent;
102
+ }
104
103
  }
105
-
106
- /* Existing styles can stay unchanged */
107
104
  </style>
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <div>
3
+ <Button @click="startScan" class="bg-main button-small radius-extra button">
4
+ Check Tickets
5
+ </Button>
6
+ <div v-if="isScanning" class="barcode-scanner-modal">
7
+ <!-- Add any UI elements for the scanner here -->
8
+ <Button @click="stopScan" class="stop-scan-button">Stop Scan</Button>
9
+ </div>
10
+ </div>
11
+ </template>
12
+
13
+ <script setup>
14
+ import { ref, onMounted, onUnmounted } from 'vue'
15
+ import { BarcodeScanner } from '@capacitor-mlkit/barcode-scanning'
16
+ import Button from '@pf/src/components/Button/Button.vue'
17
+ import * as tickets from '@pf/src/modules/events/store/tickets'
18
+
19
+ const emits = defineEmits(['qrcodecheck'])
20
+ const error = ref('')
21
+ const isScanning = ref(false)
22
+
23
+ onMounted(async () => {
24
+ const { supported } = await BarcodeScanner.isSupported()
25
+ if (!supported) {
26
+ error.value = 'Barcode scanning is not supported on this device'
27
+ }
28
+ })
29
+
30
+ onUnmounted(async () => {
31
+ await BarcodeScanner.removeAllListeners()
32
+ })
33
+
34
+ async function startScan() {
35
+ try {
36
+ const { camera } = await BarcodeScanner.checkPermissions()
37
+ if (camera !== 'granted') {
38
+ const { camera: newStatus } = await BarcodeScanner.requestPermissions()
39
+ if (newStatus !== 'granted') {
40
+ throw new Error('Camera permission is required to scan barcodes')
41
+ }
42
+ }
43
+
44
+ document.querySelector('body')?.classList.add('barcode-scanner-active')
45
+ isScanning.value = true
46
+
47
+ await BarcodeScanner.addListener('barcodeScanned', async (result) => {
48
+ await processBarcode(result.barcode)
49
+ })
50
+
51
+ await BarcodeScanner.startScan()
52
+ } catch (e) {
53
+ error.value = e.message
54
+ alert(`Error: ${error.value}`)
55
+ }
56
+ }
57
+
58
+ async function stopScan() {
59
+ try {
60
+ document.querySelector('body')?.classList.remove('barcode-scanner-active')
61
+ isScanning.value = false
62
+ await BarcodeScanner.stopScan()
63
+ await BarcodeScanner.removeAllListeners()
64
+ } catch (e) {
65
+ error.value = e.message
66
+ alert(`Error stopping scan: ${error.value}`)
67
+ }
68
+ }
69
+
70
+ async function processBarcode(barcode) {
71
+ try {
72
+ if (!barcode) {
73
+ throw new Error('Troubles with barcode reading')
74
+ }
75
+ const response = await tickets.actions.update({ _id: barcode, status: 'used', check: true })
76
+ alert("Ticket checked. And it's all right!")
77
+ } catch (e) {
78
+ alert(`Ticket is not found, already used or deactivated!`)
79
+ } finally {
80
+ emits('qrcodecheck')
81
+ await stopScan()
82
+ }
83
+ }
84
+ </script>
85
+
86
+ <style scoped>
87
+ .barcode-scanner-modal {
88
+ position: fixed;
89
+ top: 0;
90
+ left: 0;
91
+ right: 0;
92
+ bottom: 0;
93
+ background: rgba(0, 0, 0, 0.8);
94
+ display: flex;
95
+ justify-content: center;
96
+ align-items: center;
97
+ }
98
+
99
+ .stop-scan-button {
100
+ position: absolute;
101
+ bottom: 20px;
102
+ left: 50%;
103
+ transform: translateX(-50%);
104
+ }
105
+
106
+ /* Existing styles can stay unchanged */
107
+ </style>
@@ -0,0 +1,76 @@
1
+ <template>
2
+ <div>
3
+ <Button :submit="startScan" class="bg-main button-small radius-extra button">
4
+ Check Tickets
5
+ </Button>
6
+ <Popup
7
+ title="Scan QR Code"
8
+ @close-popup="closePublicationPopup"
9
+ :isPopupOpen="isPublicationPopup"
10
+ class="w-max-30r h-max-30r t-left pd-big bg-white radius-big"
11
+ >
12
+ <h3 class="mn-b-small">Scan QR Code</h3>
13
+ <div class="h-max">
14
+ <!-- Scanning will be handled by Capacitor, so we don't need a visual component here -->
15
+ </div>
16
+ </Popup>
17
+ </div>
18
+ </template>
19
+
20
+ <script setup>
21
+ import { ref } from 'vue'
22
+ import { BarcodeScanner } from '@capacitor-mlkit/barcode-scanning'
23
+ import Popup from '@pf/src/components/Popup/Popup.vue'
24
+ import Button from '@pf/src/components/Button/Button.vue'
25
+ import * as tickets from '@pf/src/modules/events/store/tickets'
26
+
27
+ const emits = defineEmits(['qrcodecheck'])
28
+ const isPublicationPopup = ref(false)
29
+ const error = ref('')
30
+
31
+ function openPublicationPopup() {
32
+ isPublicationPopup.value = true
33
+ }
34
+
35
+ function closePublicationPopup() {
36
+ isPublicationPopup.value = false
37
+ }
38
+
39
+ async function startScan() {
40
+ openPublicationPopup()
41
+
42
+ try {
43
+ await BarcodeScanner.isSupported()
44
+ const { barcodes } = await BarcodeScanner.scan()
45
+
46
+ if (barcodes.length > 0) {
47
+ await processBarcode(barcodes[0].rawValue)
48
+ } else {
49
+ throw new Error('No barcode detected')
50
+ }
51
+ } catch (e) {
52
+ error.value = e.message
53
+ alert(`Error: ${error.value}`)
54
+ } finally {
55
+ closePublicationPopup()
56
+ }
57
+ }
58
+
59
+ async function processBarcode(qrcode) {
60
+ try {
61
+ if (!qrcode) {
62
+ throw new Error('Troubles with qrcode reading')
63
+ }
64
+ const response = await tickets.actions.update({ _id: qrcode, status: 'used', check: true })
65
+ alert("Ticket checked. And it's all right!")
66
+ } catch (e) {
67
+ alert(`Ticket is not found, already used or deactivated!`)
68
+ } finally {
69
+ emits('qrcodecheck')
70
+ }
71
+ }
72
+ </script>
73
+
74
+ <style scoped>
75
+ /* Existing styles can stay unchanged */
76
+ </style>