nodebb-plugin-niki-loyalty 1.0.21 → 1.0.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.
@@ -1,35 +1,164 @@
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
+
1
4
  <div class="niki-wallet-wrapper">
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">
5
+ <div class="niki-header-bg"></div>
6
+
7
+ <div class="niki-wallet-content">
8
+ <div class="niki-wallet-avatar">
9
+ <img src="https://i.imgur.com/kXUe4M6.png" alt="Niki">
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
+ <div id="niki-rewards" style="margin-top:16px;"></div>
38
+
39
+ <div class="niki-daily-stats" style="margin-top:18px;">
40
+ <div style="display:flex; justify-content:space-between; font-size:12px; color:#888; font-weight:700;">
41
+ <span>Günlük Kazanım</span>
42
+ <span>{dailyScore} / {dailyCap}</span>
43
+ </div>
44
+
45
+ <div class="niki-progress-track">
46
+ <div class="niki-progress-fill" style="width: {dailyPercent}%;"></div>
47
+ </div>
48
+
49
+ <div style="font-size:11px; color:#aaa;">
50
+ Bugün daha fazla çalışarak limitini doldurabilirsin!
51
+ </div>
52
+ </div>
53
+
54
+ <p style="font-size:12px; color:#ccc; margin-top:15px;">
55
+ Niki The Cat Coffee &copy; Loyalty Program
56
+ </p>
57
+ </div>
58
+ </div>
59
+
60
+ <!-- ✅ QR MODAL (2 dk) -->
61
+ <div id="modal-qr" class="qr-overlay">
62
+ <div class="ticket-card">
63
+ <div class="close-circle" onclick="closeQR()"><i class="fa fa-times"></i></div>
64
+
65
+ <div id="view-code">
66
+ <div class="ticket-top" id="ticket-title">KASAYA GÖSTERİNİZ</div>
67
+ <div class="ticket-body">
68
+ <div id="qrcode"></div>
69
+
70
+ <div style="font-size:14px; font-weight:800; color:#1a1a1a; margin-top:6px;" id="ticket-sub">
71
+ QR hazır — kasada okut.
7
72
  </div>
8
73
 
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>
74
+ <div class="timer-wrapper"><div class="timer-bar" id="time-bar"></div></div>
75
+ <div class="timer-text" id="timer-txt">2:00</div>
76
+
77
+ <div style="margin-top:10px; font-size:11px; color:#888;">
78
+ Okutma işlemi tamamlanınca otomatik onay ekranına geçer.
25
79
  </div>
80
+ </div>
81
+ </div>
26
82
 
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 &copy; Loyalty Program
33
- </p>
83
+ <div id="view-success" class="success-view">
84
+ <div class="success-icon"><i class="fa fa-check"></i></div>
85
+ <h2 style="font-size:24px; color:#1a1a1a; margin-bottom:10px;">AFİYET OLSUN!</h2>
86
+ <p style="color:#888; font-size:14px; margin-bottom:20px;">Kasa onayı alındı, puanın güncellendi.</p>
87
+ <button class="niki-btn" onclick="closeQR()" style="padding:15px; font-size:14px;">
88
+ TAMAM
89
+ </button>
34
90
  </div>
35
- </div>
91
+ </div>
92
+ </div>
93
+
94
+ <style>
95
+ @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');
96
+
97
+ .niki-reward-stats{ margin-top: 14px; }
98
+ .niki-reward-track{ height: 12px; border-radius: 999px; overflow: visible; }
99
+ #niki-reward-fill{ height: 100%; border-radius: 999px; }
100
+
101
+ .niki-ms-dot{
102
+ position:absolute; top:50%;
103
+ transform: translate(-50%, -50%);
104
+ width: 12px; height: 12px; border-radius: 999px;
105
+ background: rgba(255,255,255,.18);
106
+ border: 1px solid rgba(255,255,255,.28);
107
+ box-shadow: 0 6px 14px rgba(0,0,0,.25);
108
+ }
109
+ .niki-ms-dot.on{
110
+ background: rgba(255,255,255,.95);
111
+ border-color: rgba(255,255,255,.95);
112
+ }
113
+ </style>
114
+
115
+ <script>
116
+ // ✅ sadece bar/dot görsel güncelleme (client.js wallet-data çekince zaten id'leri update ediyor)
117
+ (function(){
118
+ function applyRewardBar(data){
119
+ try{
120
+ const points = Number(data.points || 0);
121
+ const barMax = Number(data.barMax || 250);
122
+ const pct = Math.min(100, (points / barMax) * 100);
123
+
124
+ const fill = document.getElementById('niki-reward-fill');
125
+ if (fill) fill.style.width = pct + '%';
126
+
127
+ const bp = document.getElementById('niki-bar-points');
128
+ if (bp) bp.textContent = points;
129
+
130
+ const bm = document.getElementById('niki-bar-max');
131
+ if (bm) bm.textContent = barMax;
132
+
133
+ document.querySelectorAll('.niki-ms-dot').forEach(dot=>{
134
+ const at = Number(dot.getAttribute('data-at') || 0);
135
+ if (points >= at) dot.classList.add('on');
136
+ else dot.classList.remove('on');
137
+ });
138
+ }catch(e){}
139
+ }
140
+
141
+ // client.js her refreshte window.__NIKI_WALLET_DATA__ set ediyorsa kullan
142
+ if (window.__NIKI_WALLET_DATA__) applyRewardBar(window.__NIKI_WALLET_DATA__);
143
+
144
+ $(window).on('action:ajaxify.end', function(){
145
+ if (window.__NIKI_WALLET_DATA__) applyRewardBar(window.__NIKI_WALLET_DATA__);
146
+ });
147
+
148
+ // client.js QR oluşturunca şu event’i basıyor:
149
+ // $(window).trigger('niki:qr.open', [{ token, title }])
150
+ // Ben client.js’te bunu basmıyorum çünkü modalı direkt client.js açıyor.
151
+ // Ama olur da event’le açmak istersen aşağıyı kullanabilirsin:
152
+ $(window).on('niki:qr.open', function(_, payload){
153
+ if(!payload || !payload.token) return;
154
+ if(typeof window.openQRWithToken === 'function'){
155
+ window.openQRWithToken(payload.token, payload.title || 'Ödül');
156
+ }
157
+ });
158
+ })();
159
+
160
+ // ✅ client.js modalı açıyor ama tpl tarafında closeQR global kalsın
161
+ window.closeQR = window.closeQR || function(){
162
+ $('#modal-qr').fadeOut(200);
163
+ };
164
+ </script>