@@ -133,12 +133,12 @@ const replaceHTMLContent = (type, html = '', email, data, language, domain) => {
133
133
if ( EXPLORERS [ data . currency ] ) {
134
134
EXPLORERS [ data . currency ] . forEach ( ( explorer ) => {
135
135
explorers += `<li><a href=${ explorer . baseUrl } ${ explorer . txPath } /${ data . transaction_id
136
- } >${ explorer . name } </a></li>`;
136
+ } >${ explorer . name } </a></li>`;
137
137
} ) ;
138
138
} else if ( EXPLORERS [ data . network ] ) {
139
139
EXPLORERS [ data . network ] . forEach ( ( explorer ) => {
140
140
explorers += `<li><a href=${ explorer . baseUrl } ${ explorer . txPath } /${ data . transaction_id
141
- } >${ explorer . name } </a></li>`;
141
+ } >${ explorer . name } </a></li>`;
142
142
} ) ;
143
143
}
144
144
}
@@ -150,16 +150,33 @@ const replaceHTMLContent = (type, html = '', email, data, language, domain) => {
150
150
html = html . replace ( / \$ \{ a m o u n t \} / g, data . amount || '' ) ;
151
151
html = html . replace ( / \$ \{ c o n f i r m a t i o n \} / g, confirmation || '' ) ;
152
152
html = html . replace ( / \$ \{ s t a t u s \} / g, data . status || '' ) ;
153
- html = html . replace ( / \$ \{ a d d r e s s \} / g, data . address || '' ) ;
153
+ if ( data . address ) {
154
+ html = html . replace ( / \$ \{ a d d r e s s \} / g, data . address || '' ) ;
155
+ } else {
156
+ html = html . replace (
157
+ / < d i v i d = ' a d d r e s s ' [ ^ > ] * > [ \s \S ] * ?< \/ d i v > / ,
158
+ '' // skip
159
+ ) ;
160
+ }
154
161
html = html . replace ( / \$ \{ t r a n s a c t i o n _ i d \} / g, data . transaction_id || '' ) ;
155
162
html = html . replace ( / \$ \{ f e e \} / g, data . fee || '0' ) ;
156
163
html = html . replace ( / \$ \{ d e s c r i p t i o n \} / g, data . description || '' ) ;
157
- html = html . replace ( / \$ \{ e x p l o r e r s \} / g, explorers || '' ) ;
164
+ if ( explorers && explorers . length > 0 ) {
165
+ html = html . replace ( / \$ \{ e x p l o r e r s \} / g, explorers || '' ) ;
166
+ } else {
167
+ html = html . replace (
168
+ / < d i v i d = ' e x p l o r e r s ' [ ^ > ] * > [ \s \S ] * ?< \/ d i v > / ,
169
+ '' // skip
170
+ ) ;
171
+ }
158
172
html = html . replace ( / \$ \{ a p i _ n a m e \} / g, API_NAME ( ) || '' ) ;
159
173
if ( data . network ) {
160
174
html = html . replace ( / \$ \{ n e t w o r k \} / g, data . network || '' ) ;
161
175
} else {
162
- html = html . replace ( / i d = " n e t w o r k " / g, 'style="display: none"' ) ;
176
+ html = html . replace (
177
+ / < d i v i d = ' n e t w o r k ' [ ^ > ] * > [ \s \S ] * ?< \/ d i v > / ,
178
+ '' // skip
179
+ ) ;
163
180
}
164
181
165
182
}
@@ -173,12 +190,12 @@ const replaceHTMLContent = (type, html = '', email, data, language, domain) => {
173
190
if ( EXPLORERS [ data . currency ] ) {
174
191
EXPLORERS [ data . currency ] . forEach ( ( explorer ) => {
175
192
explorers += `<li><a href=${ explorer . baseUrl } ${ explorer . txPath } /${ data . transaction_id
176
- } >${ explorer . name } </a></li>`;
193
+ } >${ explorer . name } </a></li>`;
177
194
} ) ;
178
195
} else if ( EXPLORERS [ data . network ] ) {
179
196
EXPLORERS [ data . network ] . forEach ( ( explorer ) => {
180
197
explorers += `<li><a href=${ explorer . baseUrl } ${ explorer . txPath } /${ data . transaction_id
181
- } >${ explorer . name } </a></li>`;
198
+ } >${ explorer . name } </a></li>`;
182
199
} ) ;
183
200
}
184
201
}
@@ -191,18 +208,34 @@ const replaceHTMLContent = (type, html = '', email, data, language, domain) => {
191
208
html = html . replace ( / \$ \{ a m o u n t \} / g, data . amount || '' ) ; //
192
209
html = html . replace ( / \$ \{ c o n f i r m a t i o n \} / g, confirmation || '' ) ;
193
210
html = html . replace ( / \$ \{ s t a t u s \} / g, data . status || '' ) ;
194
- html = html . replace ( / \$ \{ a d d r e s s \} / g, data . address || '' ) ;
211
+ if ( data . address ) {
212
+ html = html . replace ( / \$ \{ a d d r e s s \} / g, data . address || '' ) ;
213
+ } else {
214
+ html = html . replace (
215
+ / < d i v i d = ' a d d r e s s ' [ ^ > ] * > [ \s \S ] * ?< \/ d i v > / ,
216
+ '' // skip
217
+ ) ;
218
+ }
195
219
html = html . replace ( / \$ \{ t r a n s a c t i o n _ i d \} / g, data . transaction_id || '' ) ;
196
220
html = html . replace ( / \$ \{ f e e \} / g, data . fee || '0' ) ;
197
221
html = html . replace ( / \$ \{ d e s c r i p t i o n \} / g, data . description || '' ) ;
198
- html = html . replace ( / \$ \{ e x p l o r e r s \} / g, explorers || '' ) ;
222
+ if ( explorers && explorers . length > 0 ) {
223
+ html = html . replace ( / \$ \{ e x p l o r e r s \} / g, explorers || '' ) ;
224
+ } else {
225
+ html = html . replace (
226
+ / < d i v i d = ' e x p l o r e r s ' [ ^ > ] * > [ \s \S ] * ?< \/ d i v > / ,
227
+ '' // skip
228
+ ) ;
229
+ }
199
230
html = html . replace ( / \$ \{ a p i _ n a m e \} / g, API_NAME ( ) || '' ) ;
200
231
if ( data . network ) {
201
232
html = html . replace ( / \$ \{ n e t w o r k \} / g, data . network || '' ) ;
202
233
} else {
203
- html = html . replace ( / i d = " n e t w o r k " / g, 'style="display: none"' ) ;
234
+ html = html . replace (
235
+ / < d i v i d = ' n e t w o r k ' [ ^ > ] * > [ \s \S ] * ?< \/ d i v > / ,
236
+ '' // skip
237
+ ) ;
204
238
}
205
-
206
239
}
207
240
else if ( type === MAILTYPE . WITHDRAWAL_PENDING ) {
208
241
@@ -212,12 +245,12 @@ const replaceHTMLContent = (type, html = '', email, data, language, domain) => {
212
245
if ( EXPLORERS [ data . currency ] ) {
213
246
EXPLORERS [ data . currency ] . forEach ( ( explorer ) => {
214
247
explorers += `<li><a href=${ explorer . baseUrl } ${ explorer . txPath } /${ data . transaction_id
215
- } >${ explorer . name } </a></li>`;
248
+ } >${ explorer . name } </a></li>`;
216
249
} ) ;
217
250
} else if ( EXPLORERS [ data . network ] ) {
218
251
EXPLORERS [ data . network ] . forEach ( ( explorer ) => {
219
252
explorers += `<li><a href=${ explorer . baseUrl } ${ explorer . txPath } /${ data . transaction_id
220
- } >${ explorer . name } </a></li>`;
253
+ } >${ explorer . name } </a></li>`;
221
254
} ) ;
222
255
}
223
256
}
@@ -232,14 +265,31 @@ const replaceHTMLContent = (type, html = '', email, data, language, domain) => {
232
265
html = html . replace ( / \$ \{ a m o u n t \} / g, data . amount || '' ) ;
233
266
html = html . replace ( / \$ \{ f e e \} / g, data . fee || '0' ) ;
234
267
html = html . replace ( / \$ \{ s t a t u s \} / g, data . status || '' ) ;
235
- html = html . replace ( / \$ \{ a d d r e s s \} / g, data . address || '' ) ;
268
+ if ( data . address ) {
269
+ html = html . replace ( / \$ \{ a d d r e s s \} / g, data . address || '' ) ;
270
+ } else {
271
+ html = html . replace (
272
+ / < d i v i d = ' a d d r e s s ' [ ^ > ] * > [ \s \S ] * ?< \/ d i v > / ,
273
+ '' // skip
274
+ ) ;
275
+ }
236
276
html = html . replace ( / \$ \{ d e s c r i p t i o n \} / g, data . description || '' ) ;
237
- html = html . replace ( / \$ \{ e x p l o r e r s \} / g, explorers || '' ) ;
277
+ if ( explorers && explorers . length > 0 ) {
278
+ html = html . replace ( / \$ \{ e x p l o r e r s \} / g, explorers || '' ) ;
279
+ } else {
280
+ html = html . replace (
281
+ / < d i v i d = ' e x p l o r e r s ' [ ^ > ] * > [ \s \S ] * ?< \/ d i v > / ,
282
+ '' // skip
283
+ ) ;
284
+ }
238
285
html = html . replace ( / \$ \{ t r a n s a c t i o n _ i d \} / g, data . transaction_id || '' ) ;
239
286
if ( data . network ) {
240
287
html = html . replace ( / \$ \{ n e t w o r k \} / g, data . network || '' ) ;
241
288
} else {
242
- html = html . replace ( / i d = " n e t w o r k " / g, 'style="display: none"' ) ;
289
+ html = html . replace (
290
+ / < d i v i d = ' n e t w o r k ' [ ^ > ] * > [ \s \S ] * ?< \/ d i v > / ,
291
+ '' // skip
292
+ ) ;
243
293
}
244
294
}
245
295
else if ( type === MAILTYPE . WITHDRAWAL_COMPLETED ) {
@@ -250,12 +300,12 @@ const replaceHTMLContent = (type, html = '', email, data, language, domain) => {
250
300
if ( EXPLORERS [ data . currency ] ) {
251
301
EXPLORERS [ data . currency ] . forEach ( ( explorer ) => {
252
302
explorers += `<li><a href=${ explorer . baseUrl } ${ explorer . txPath } /${ data . transaction_id
253
- } >${ explorer . name } </a></li>`;
303
+ } >${ explorer . name } </a></li>`;
254
304
} ) ;
255
305
} else if ( EXPLORERS [ data . network ] ) {
256
306
EXPLORERS [ data . network ] . forEach ( ( explorer ) => {
257
307
explorers += `<li><a href=${ explorer . baseUrl } ${ explorer . txPath } /${ data . transaction_id
258
- } >${ explorer . name } </a></li>`;
308
+ } >${ explorer . name } </a></li>`;
259
309
} ) ;
260
310
}
261
311
}
@@ -269,14 +319,31 @@ const replaceHTMLContent = (type, html = '', email, data, language, domain) => {
269
319
html = html . replace ( / \$ \{ a m o u n t \} / g, data . amount || '' ) ;
270
320
html = html . replace ( / \$ \{ f e e \} / g, data . fee || '0' ) ;
271
321
html = html . replace ( / \$ \{ s t a t u s \} / g, data . status || '' ) ;
272
- html = html . replace ( / \$ \{ a d d r e s s \} / g, data . address || '' ) ;
322
+ if ( data . address ) {
323
+ html = html . replace ( / \$ \{ a d d r e s s \} / g, data . address || '' ) ;
324
+ } else {
325
+ html = html . replace (
326
+ / < d i v i d = ' a d d r e s s ' [ ^ > ] * > [ \s \S ] * ?< \/ d i v > / ,
327
+ '' // skip
328
+ ) ;
329
+ }
273
330
html = html . replace ( / \$ \{ d e s c r i p t i o n \} / g, data . description || '' ) ;
274
- html = html . replace ( / \$ \{ e x p l o r e r s \} / g, explorers || '' ) ;
331
+ if ( explorers && explorers . length > 0 ) {
332
+ html = html . replace ( / \$ \{ e x p l o r e r s \} / g, explorers || '' ) ;
333
+ } else {
334
+ html = html . replace (
335
+ / < d i v i d = ' e x p l o r e r s ' [ ^ > ] * > [ \s \S ] * ?< \/ d i v > / ,
336
+ '' // skip
337
+ ) ;
338
+ }
275
339
html = html . replace ( / \$ \{ t r a n s a c t i o n _ i d \} / g, data . transaction_id || '' ) ;
276
340
if ( data . network ) {
277
341
html = html . replace ( / \$ \{ n e t w o r k \} / g, data . network || '' ) ;
278
342
} else {
279
- html = html . replace ( / i d = " n e t w o r k " / g, 'style="display: none"' ) ;
343
+ html = html . replace (
344
+ / < d i v i d = ' n e t w o r k ' [ ^ > ] * > [ \s \S ] * ?< \/ d i v > / ,
345
+ '' // skip
346
+ ) ;
280
347
}
281
348
}
282
349
else if ( type === MAILTYPE . ACCOUNT_VERIFY ) { //ok
@@ -320,13 +387,23 @@ const replaceHTMLContent = (type, html = '', email, data, language, domain) => {
320
387
html = html . replace ( / \$ \{ a p i _ n a m e \} / g, API_NAME ( ) || '' ) ;
321
388
html = html . replace ( / \$ \{ a m o u n t \} / g, data . amount || '' ) ;
322
389
html = html . replace ( / \$ \{ f e e \} / g, data . fee || '0' ) ;
323
- html = html . replace ( / \$ \{ a d d r e s s \} / g, data . address || '' ) ;
390
+ if ( data . address ) {
391
+ html = html . replace ( / \$ \{ a d d r e s s \} / g, data . address || '' ) ;
392
+ } else {
393
+ html = html . replace (
394
+ / < d i v i d = ' a d d r e s s ' [ ^ > ] * > [ \s \S ] * ?< \/ d i v > / ,
395
+ '' // skip
396
+ ) ;
397
+ }
324
398
html = html . replace ( / \$ \{ i p \} / g, data . ip || '' ) ;
325
399
html = html . replace ( / \$ \{ l i n k \} / g, data . confirmation_link || `${ domain } /confirm-withdraw/${ data . transaction_id } ?currency=${ data . currency } &amount=${ data . amount } &address=${ data . address } &fee=${ data . fee } &fee_coin=${ data . fee_coin } &network=${ data . network } ` ) ;
326
400
if ( data . network ) {
327
401
html = html . replace ( / \$ \{ n e t w o r k \} / g, data . network || '' ) ;
328
402
} else {
329
- html = html . replace ( / i d = " n e t w o r k " / g, 'style="display: none"' ) ;
403
+ html = html . replace (
404
+ / < d i v i d = ' n e t w o r k ' [ ^ > ] * > [ \s \S ] * ?< \/ d i v > / ,
405
+ '' // skip
406
+ ) ;
330
407
}
331
408
}
332
409
else if ( type === MAILTYPE . INVALID_ADDRESS ) {
0 commit comments