nodebb-plugin-niki-loyalty 1.0.24 → 1.0.26
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/library.js +183 -506
- package/package.json +1 -1
- package/static/lib/client.js +104 -448
- package/templates/niki-wallet.tpl +29 -164
|
@@ -1,170 +1,35 @@
|
|
|
1
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
|
|
2
|
-
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.6.0/dist/confetti.browser.min.js"></script>
|
|
3
|
-
|
|
4
1
|
<div class="niki-wallet-wrapper">
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
</div>
|
|
11
|
-
|
|
12
|
-
<div class="niki-balance-label">Toplam Bakiye</div>
|
|
13
|
-
<div class="niki-balance-big" id="niki-wallet-points">{points}</div>
|
|
14
|
-
|
|
15
|
-
<!-- ✅ ÖDÜL BARI -->
|
|
16
|
-
<div class="niki-reward-stats">
|
|
17
|
-
<div style="display:flex; justify-content:space-between; font-size:12px; color:#bdbdbd; font-weight:700;">
|
|
18
|
-
<span>Ödül Barı</span>
|
|
19
|
-
<span><span id="niki-bar-points">{points}</span> / <span id="niki-bar-max">250</span></span>
|
|
20
|
-
</div>
|
|
21
|
-
|
|
22
|
-
<div class="niki-progress-track niki-reward-track" style="position:relative;">
|
|
23
|
-
<div class="niki-progress-fill" id="niki-reward-fill" style="width: 0%;"></div>
|
|
24
|
-
|
|
25
|
-
<span class="niki-ms-dot" data-at="60" style="left:24%;" title="60 • Ücretsiz Kurabiye"></span>
|
|
26
|
-
<span class="niki-ms-dot" data-at="120" style="left:48%;" title="120 • %35 İndirimli Kahve"></span>
|
|
27
|
-
<span class="niki-ms-dot" data-at="180" style="left:72%;" title="180 • %60 İndirimli Kahve"></span>
|
|
28
|
-
<span class="niki-ms-dot" data-at="250" style="left:100%;" title="250 • Ücretsiz Kahve"></span>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<div style="font-size:11px; color:#a7a7a7; margin-top:6px;">
|
|
32
|
-
QR oluşturduktan sonra <b style="color:#fff;">kasada okutulunca</b> puanın düşer. (QR 2 dakika geçerli)
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<!-- ✅ REWARD KARTLARI (client.js buraya basacak: QR OLUŞTUR butonları) -->
|
|
37
|
-
<button id="btn-qr-auto" class="niki-btn">
|
|
38
|
-
<i class="fa fa-qrcode"></i> QR OLUŞTUR
|
|
39
|
-
</button>
|
|
40
|
-
|
|
41
|
-
<div style="font-size:11px; color:#888; margin-top:10px;">
|
|
42
|
-
QR oluşturduktan sonra <b>kasada okutulunca</b> puanın düşer. (QR 2 dakika geçerli)
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
<div class="niki-daily-stats" style="margin-top:18px;">
|
|
46
|
-
<div style="display:flex; justify-content:space-between; font-size:12px; color:#888; font-weight:700;">
|
|
47
|
-
<span>Günlük Kazanım</span>
|
|
48
|
-
<span>{dailyScore} / {dailyCap}</span>
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
<div class="niki-progress-track">
|
|
52
|
-
<div class="niki-progress-fill" style="width: {dailyPercent}%;"></div>
|
|
53
|
-
</div>
|
|
54
|
-
|
|
55
|
-
<div style="font-size:11px; color:#aaa;">
|
|
56
|
-
Bugün daha fazla çalışarak limitini doldurabilirsin!
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
|
|
60
|
-
<p style="font-size:12px; color:#ccc; margin-top:15px;">
|
|
61
|
-
Niki The Cat Coffee © Loyalty Program
|
|
62
|
-
</p>
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
|
|
66
|
-
<!-- ✅ QR MODAL (2 dk) -->
|
|
67
|
-
<div id="modal-qr" class="qr-overlay">
|
|
68
|
-
<div class="ticket-card">
|
|
69
|
-
<div class="close-circle" onclick="closeQR()"><i class="fa fa-times"></i></div>
|
|
70
|
-
|
|
71
|
-
<div id="view-code">
|
|
72
|
-
<div class="ticket-top" id="ticket-title">KASAYA GÖSTERİNİZ</div>
|
|
73
|
-
<div class="ticket-body">
|
|
74
|
-
<div id="qrcode"></div>
|
|
75
|
-
|
|
76
|
-
<div style="font-size:14px; font-weight:800; color:#1a1a1a; margin-top:6px;" id="ticket-sub">
|
|
77
|
-
QR hazır — kasada okut.
|
|
2
|
+
<div class="niki-header-bg"></div>
|
|
3
|
+
|
|
4
|
+
<div class="niki-wallet-content">
|
|
5
|
+
<div class="niki-wallet-avatar">
|
|
6
|
+
<img src="https://i.imgur.com/kXUe4M6.png" alt="Niki">
|
|
78
7
|
</div>
|
|
79
8
|
|
|
80
|
-
<div class="
|
|
81
|
-
<div class="
|
|
82
|
-
|
|
83
|
-
<div
|
|
84
|
-
|
|
9
|
+
<div class="niki-balance-label">Toplam Bakiye</div>
|
|
10
|
+
<div class="niki-balance-big">{points}</div>
|
|
11
|
+
|
|
12
|
+
<div class="niki-daily-stats">
|
|
13
|
+
<div style="display:flex; justify-content:space-between; font-size:12px; color:#888; font-weight:600;">
|
|
14
|
+
<span>Günlük Kazanım</span>
|
|
15
|
+
<span>{dailyScore} / {dailyCap}</span>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="niki-progress-track">
|
|
19
|
+
<div class="niki-progress-fill" style="width: {dailyPercent}%;"></div>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<div style="font-size:11px; color:#aaa;">
|
|
23
|
+
Bugün daha fazla çalışarak limitini doldurabilirsin!
|
|
24
|
+
</div>
|
|
85
25
|
</div>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
26
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
27
|
+
<button class="niki-btn-action">
|
|
28
|
+
<i class="fa fa-qrcode"></i> KAHVE AL (QR OLUŞTUR)
|
|
29
|
+
</button>
|
|
30
|
+
|
|
31
|
+
<p style="font-size:12px; color:#ccc; margin-top:15px;">
|
|
32
|
+
Niki The Cat Coffee © Loyalty Program
|
|
33
|
+
</p>
|
|
96
34
|
</div>
|
|
97
|
-
|
|
98
|
-
</div>
|
|
99
|
-
|
|
100
|
-
<style>
|
|
101
|
-
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');
|
|
102
|
-
|
|
103
|
-
.niki-reward-stats{ margin-top: 14px; }
|
|
104
|
-
.niki-reward-track{ height: 12px; border-radius: 999px; overflow: visible; }
|
|
105
|
-
#niki-reward-fill{ height: 100%; border-radius: 999px; }
|
|
106
|
-
|
|
107
|
-
.niki-ms-dot{
|
|
108
|
-
position:absolute; top:50%;
|
|
109
|
-
transform: translate(-50%, -50%);
|
|
110
|
-
width: 12px; height: 12px; border-radius: 999px;
|
|
111
|
-
background: rgba(255,255,255,.18);
|
|
112
|
-
border: 1px solid rgba(255,255,255,.28);
|
|
113
|
-
box-shadow: 0 6px 14px rgba(0,0,0,.25);
|
|
114
|
-
}
|
|
115
|
-
.niki-ms-dot.on{
|
|
116
|
-
background: rgba(255,255,255,.95);
|
|
117
|
-
border-color: rgba(255,255,255,.95);
|
|
118
|
-
}
|
|
119
|
-
</style>
|
|
120
|
-
|
|
121
|
-
<script>
|
|
122
|
-
// ✅ sadece bar/dot görsel güncelleme (client.js wallet-data çekince zaten id'leri update ediyor)
|
|
123
|
-
(function(){
|
|
124
|
-
function applyRewardBar(data){
|
|
125
|
-
try{
|
|
126
|
-
const points = Number(data.points || 0);
|
|
127
|
-
const barMax = Number(data.barMax || 250);
|
|
128
|
-
const pct = Math.min(100, (points / barMax) * 100);
|
|
129
|
-
|
|
130
|
-
const fill = document.getElementById('niki-reward-fill');
|
|
131
|
-
if (fill) fill.style.width = pct + '%';
|
|
132
|
-
|
|
133
|
-
const bp = document.getElementById('niki-bar-points');
|
|
134
|
-
if (bp) bp.textContent = points;
|
|
135
|
-
|
|
136
|
-
const bm = document.getElementById('niki-bar-max');
|
|
137
|
-
if (bm) bm.textContent = barMax;
|
|
138
|
-
|
|
139
|
-
document.querySelectorAll('.niki-ms-dot').forEach(dot=>{
|
|
140
|
-
const at = Number(dot.getAttribute('data-at') || 0);
|
|
141
|
-
if (points >= at) dot.classList.add('on');
|
|
142
|
-
else dot.classList.remove('on');
|
|
143
|
-
});
|
|
144
|
-
}catch(e){}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// client.js her refreshte window.__NIKI_WALLET_DATA__ set ediyorsa kullan
|
|
148
|
-
if (window.__NIKI_WALLET_DATA__) applyRewardBar(window.__NIKI_WALLET_DATA__);
|
|
149
|
-
|
|
150
|
-
$(window).on('action:ajaxify.end', function(){
|
|
151
|
-
if (window.__NIKI_WALLET_DATA__) applyRewardBar(window.__NIKI_WALLET_DATA__);
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
// client.js QR oluşturunca şu event’i basıyor:
|
|
155
|
-
// $(window).trigger('niki:qr.open', [{ token, title }])
|
|
156
|
-
// Ben client.js’te bunu basmıyorum çünkü modalı direkt client.js açıyor.
|
|
157
|
-
// Ama olur da event’le açmak istersen aşağıyı kullanabilirsin:
|
|
158
|
-
$(window).on('niki:qr.open', function(_, payload){
|
|
159
|
-
if(!payload || !payload.token) return;
|
|
160
|
-
if(typeof window.openQRWithToken === 'function'){
|
|
161
|
-
window.openQRWithToken(payload.token, payload.title || 'Ödül');
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
})();
|
|
165
|
-
|
|
166
|
-
// ✅ client.js modalı açıyor ama tpl tarafında closeQR global kalsın
|
|
167
|
-
window.closeQR = window.closeQR || function(){
|
|
168
|
-
$('#modal-qr').fadeOut(200);
|
|
169
|
-
};
|
|
170
|
-
</script>
|
|
35
|
+
</div>
|