geer-builder 1.2.950 → 1.2.951

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.
Files changed (2) hide show
  1. package/GReferralLink.vue +55 -3
  2. package/package.json +2 -1
package/GReferralLink.vue CHANGED
@@ -7,18 +7,33 @@
7
7
  <div v-else-if="change_label_1">{{change_label_1}}</div>
8
8
  <div v-else>Copy Referral Link</div>
9
9
  </q-btn>
10
+ <!-- QR Code Section -->
11
+ <div v-if="show_qr && qr_data_url" class="q-mt-md" style="text-align: center;">
12
+ <img :src="qr_data_url" alt="QR Code" style="max-width: 250px;" />
13
+ <div class="q-mt-sm">
14
+ <q-btn @click="downloadQR()" color="primary" outline size="sm" class="q-mr-sm">
15
+ <q-icon name="fas fa-download" size="14px" class="q-mr-xs"></q-icon>
16
+ Download QR
17
+ </q-btn>
18
+ <q-btn @click="shareQR()" color="primary" outline size="sm">
19
+ <q-icon name="fas fa-share-alt" size="14px" class="q-mr-xs"></q-icon>
20
+ Share
21
+ </q-btn>
22
+ </div>
23
+ </div>
10
24
  <input style="opacity: 0" v-model="replicated_link" id="referral_link" type="text">
11
25
  </div>
12
26
  </template>
13
27
  <script>
14
28
  import GlobalMixins from './mixins/global_mixins';
29
+ import QRCode from 'qrcode';
15
30
 
16
31
  export default
17
32
  {
18
33
  name: "GReferralLinkComponent",
19
34
  components: {},
20
35
  mixins: [GlobalMixins],
21
- props: ['ref_link', 'is_company_ultrapro','change_label_1'],
36
+ props: ['ref_link', 'is_company_ultrapro', 'change_label_1', 'show_qr'],
22
37
  filters: {},
23
38
  data: () => (
24
39
  {
@@ -27,6 +42,7 @@ export default
27
42
  public_settings: {},
28
43
  link: '',
29
44
  settings_link: false,
45
+ qr_data_url: '',
30
46
  }),
31
47
  async mounted() {
32
48
  await this.$_getSlotInfo();
@@ -43,6 +59,13 @@ export default
43
59
  this.replicated_link = `https://${window.location.host}/#/invite/${replace_space}`;
44
60
  }
45
61
  this.loading = false;
62
+
63
+ // Generate QR code if show_qr prop is enabled
64
+ if (this.show_qr) {
65
+ QRCode.toDataURL(this.replicated_link, { width: 250, margin: 2 })
66
+ .then(function(url) { this.qr_data_url = url; }.bind(this))
67
+ .catch(function(err) { console.error('QR generation failed:', err); });
68
+ }
46
69
  },
47
70
  methods:
48
71
  {
@@ -77,10 +100,39 @@ export default
77
100
  color: 'black'
78
101
  });
79
102
  }
103
+ },
104
+ downloadQR() {
105
+ var link = document.createElement('a');
106
+ link.download = 'referral-qr-code.png';
107
+ link.href = this.qr_data_url;
108
+ link.click();
109
+ },
110
+ shareQR() {
111
+ var self = this;
112
+ if (navigator.share) {
113
+ fetch(this.qr_data_url)
114
+ .then(function(response) { return response.blob(); })
115
+ .then(function(blob) {
116
+ var file = new File([blob], 'referral-qr-code.png', { type: 'image/png' });
117
+ return navigator.share({
118
+ title: 'My Referral Link',
119
+ text: self.replicated_link,
120
+ files: [file]
121
+ });
122
+ })
123
+ .catch(function() {
124
+ // Fallback: just share the link text
125
+ if (navigator.share) {
126
+ navigator.share({ title: 'My Referral Link', text: self.replicated_link });
127
+ }
128
+ });
129
+ } else {
130
+ // Desktop fallback: copy link
131
+ this.copyLink();
132
+ }
80
133
  }
81
-
82
134
  },
83
135
  computed: {}
84
136
  }
85
137
  </script>
86
- <style lang="scss" scoped></style>
138
+ <style lang="scss" scoped></style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geer-builder",
3
- "version": "1.2.950",
3
+ "version": "1.2.951",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -19,6 +19,7 @@
19
19
  "lodash": "^4.17.21",
20
20
  "moment-timezone": "^0.5.33",
21
21
  "philippine-location-json-for-geer": "^1.1.11",
22
+ "qrcode": "^1.5.3",
22
23
  "soap": "^0.43.0",
23
24
  "sweetalert": "^2.1.2",
24
25
  "validator": "^13.5.2",