soundbip 2.2.0 → 2.4.0
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/index.js +77 -29
- package/package.json +3 -2
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@ const https = require('https');
|
|
|
4
4
|
// child_process used in openBrowser()
|
|
5
5
|
|
|
6
6
|
const API_URL = 'api.dltpays.com';
|
|
7
|
-
const VERSION = '2.
|
|
7
|
+
const VERSION = '2.4.0';
|
|
8
8
|
|
|
9
9
|
// Colors
|
|
10
10
|
const c = {
|
|
@@ -411,9 +411,10 @@ async function main() {
|
|
|
411
411
|
console.log(` ${c.white}5.${c.reset} Governed by the laws of ${c.bold}Guernsey${c.reset}`);
|
|
412
412
|
console.log('');
|
|
413
413
|
console.log(` ${c.dim}Full terms: ${c.cyan}https://soundbip.com/terms${c.reset}`);
|
|
414
|
+
console.log(` ${c.dim}Privacy policy: ${c.cyan}https://soundbip.com/privacy${c.reset}`);
|
|
414
415
|
console.log('');
|
|
415
416
|
|
|
416
|
-
const termsAccepted = await ask(`${c.cyan} Do you accept the Vendor Terms
|
|
417
|
+
const termsAccepted = await ask(`${c.cyan} Do you accept the Vendor Terms & Privacy Policy? [y/n]: ${c.reset}`);
|
|
417
418
|
if (termsAccepted.trim().toLowerCase() !== 'y' && termsAccepted.trim().toLowerCase() !== 'yes') {
|
|
418
419
|
console.log(`\n${c.yellow} Registration cancelled. You must accept the terms to continue.${c.reset}\n`);
|
|
419
420
|
rl.close();
|
|
@@ -423,26 +424,26 @@ async function main() {
|
|
|
423
424
|
|
|
424
425
|
// Store details with validation
|
|
425
426
|
section('🏪', 'Business Details');
|
|
426
|
-
|
|
427
|
+
let storeName = await askWithValidation(
|
|
427
428
|
`${c.cyan} Store name: ${c.reset}`,
|
|
428
429
|
(name) => name.length >= 2,
|
|
429
430
|
'Store name must be at least 2 characters'
|
|
430
431
|
);
|
|
431
432
|
|
|
432
|
-
|
|
433
|
+
let storeUrl = await askWithValidation(
|
|
433
434
|
`${c.cyan} Website URL: ${c.reset}`,
|
|
434
435
|
isValidUrl,
|
|
435
436
|
'Please enter a valid URL (e.g. mystore.com or https://mystore.com)',
|
|
436
437
|
normalizeUrl
|
|
437
438
|
);
|
|
438
439
|
|
|
439
|
-
|
|
440
|
+
let email = await askWithValidation(
|
|
440
441
|
`${c.cyan} Email: ${c.reset}`,
|
|
441
442
|
isValidEmail,
|
|
442
443
|
'Please enter a valid email address'
|
|
443
444
|
);
|
|
444
445
|
|
|
445
|
-
|
|
446
|
+
let ownerName = await askWithValidation(
|
|
446
447
|
`${c.cyan} Owner / contact name: ${c.reset}`,
|
|
447
448
|
(name) => name.length >= 2 && name.length <= 100,
|
|
448
449
|
'Name must be 2-100 characters'
|
|
@@ -503,13 +504,13 @@ async function main() {
|
|
|
503
504
|
section('📝', 'Additional Details');
|
|
504
505
|
console.log('');
|
|
505
506
|
|
|
506
|
-
|
|
507
|
+
let registrationNumber = await askWithValidation(
|
|
507
508
|
`${c.cyan} Guernsey registration number: ${c.reset}`,
|
|
508
509
|
(n) => /^\d{4,10}$/.test(n.trim()),
|
|
509
510
|
'Must be a valid numeric registration number (4-10 digits)'
|
|
510
511
|
);
|
|
511
512
|
|
|
512
|
-
|
|
513
|
+
let description = await ask(`${c.cyan} Describe your business (optional, max 250 chars): ${c.reset}`);
|
|
513
514
|
|
|
514
515
|
// Referral code (optional)
|
|
515
516
|
const referralCode = await ask(`${c.cyan} Referral code (optional): ${c.reset}`);
|
|
@@ -539,27 +540,66 @@ async function main() {
|
|
|
539
540
|
console.log(`${c.red} ✗ Please enter a number between 1 and 7${c.reset}`);
|
|
540
541
|
}
|
|
541
542
|
|
|
542
|
-
// Review before submitting
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
543
|
+
// Review before submitting — allow edits
|
|
544
|
+
let reviewDone = false;
|
|
545
|
+
while (!reviewDone) {
|
|
546
|
+
section('✅', 'Review Your Details');
|
|
547
|
+
console.log('');
|
|
548
|
+
info('[1] Business', storeName);
|
|
549
|
+
info('[2] Website', storeUrl);
|
|
550
|
+
info('[3] Email', email);
|
|
551
|
+
info('[4] Owner', ownerName);
|
|
552
|
+
info('[5] Address', cleanStreet);
|
|
553
|
+
info('[6] Parish', addressCity);
|
|
554
|
+
info('[7] Postcode', addressPostcode);
|
|
555
|
+
info('[8] Reg Number', registrationNumber.trim());
|
|
556
|
+
if (description.trim()) info('[9] Description', description.trim());
|
|
557
|
+
else info('[9] Description', `${c.dim}(none)${c.reset}`);
|
|
558
|
+
info(' Platform', platform.name);
|
|
559
|
+
if (referred_by_store) info(' Referral', '✓ Applied');
|
|
560
|
+
console.log('');
|
|
557
561
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
562
|
+
const confirmReg = await ask(`${c.cyan} Everything correct? [y] confirm, [1-9] edit a field, [n] cancel: ${c.reset}`);
|
|
563
|
+
const choice = confirmReg.trim().toLowerCase();
|
|
564
|
+
|
|
565
|
+
if (choice === 'y' || choice === 'yes') {
|
|
566
|
+
reviewDone = true;
|
|
567
|
+
} else if (choice === 'n' || choice === 'no') {
|
|
568
|
+
console.log(`\n${c.yellow} Registration cancelled. Run npx soundbip again to start over.${c.reset}\n`);
|
|
569
|
+
rl.close();
|
|
570
|
+
return;
|
|
571
|
+
} else if (choice === '1') {
|
|
572
|
+
storeName = await askWithValidation(`${c.cyan} New business name: ${c.reset}`, (n) => n.length >= 2, 'Must be at least 2 characters');
|
|
573
|
+
} else if (choice === '2') {
|
|
574
|
+
storeUrl = await askWithValidation(`${c.cyan} New website URL: ${c.reset}`, isValidUrl, 'Please enter a valid URL', normalizeUrl);
|
|
575
|
+
} else if (choice === '3') {
|
|
576
|
+
email = await askWithValidation(`${c.cyan} New email: ${c.reset}`, isValidEmail, 'Please enter a valid email address');
|
|
577
|
+
} else if (choice === '4') {
|
|
578
|
+
ownerName = await askWithValidation(`${c.cyan} New owner name: ${c.reset}`, (n) => n.length >= 2 && n.length <= 100, 'Name must be 2-100 characters');
|
|
579
|
+
} else if (choice === '5') {
|
|
580
|
+
cleanStreet = await askWithValidation(`${c.cyan} New address: ${c.reset}`, (s) => s.length >= 2, 'Address is required');
|
|
581
|
+
} else if (choice === '6') {
|
|
582
|
+
console.log('');
|
|
583
|
+
Object.entries(PARISHES).forEach(([num, name]) => {
|
|
584
|
+
console.log(`${c.dim} ${c.reset}${c.cyan}[${num.padStart(2)}]${c.reset} ${name}`);
|
|
585
|
+
});
|
|
586
|
+
console.log('');
|
|
587
|
+
while (true) {
|
|
588
|
+
const pc = await ask(`${c.cyan} Select parish [1-10]: ${c.reset}`);
|
|
589
|
+
const picked = PARISHES[pc.trim()];
|
|
590
|
+
if (picked) { addressCity = picked; break; }
|
|
591
|
+
console.log(`${c.red} ✗ Please enter a number between 1 and 10${c.reset}`);
|
|
592
|
+
}
|
|
593
|
+
} else if (choice === '7') {
|
|
594
|
+
addressPostcode = await askWithValidation(`${c.cyan} New postcode: ${c.reset}`, (pc) => /^GY\d{1,2}\s?\d[A-Z]{2}$/i.test(pc.trim()), 'Must be a valid Guernsey postcode', (pc) => pc.trim().toUpperCase());
|
|
595
|
+
} else if (choice === '8') {
|
|
596
|
+
registrationNumber = await askWithValidation(`${c.cyan} New registration number: ${c.reset}`, (n) => /^\d{4,10}$/.test(n.trim()), 'Must be a valid numeric registration number (4-10 digits)');
|
|
597
|
+
} else if (choice === '9') {
|
|
598
|
+
const newDesc = await ask(`${c.cyan} New description (max 250 chars): ${c.reset}`);
|
|
599
|
+
description = newDesc.slice(0, 250);
|
|
600
|
+
} else {
|
|
601
|
+
console.log(`${c.red} ✗ Enter y, n, or 1-9 to edit a field${c.reset}`);
|
|
602
|
+
}
|
|
563
603
|
}
|
|
564
604
|
|
|
565
605
|
const spin = spinner('Registering your store...');
|
|
@@ -597,8 +637,16 @@ async function main() {
|
|
|
597
637
|
|
|
598
638
|
stopSpinner(spin);
|
|
599
639
|
|
|
640
|
+
// Handle errors (duplicate name, email, URL, address, etc.)
|
|
641
|
+
if (result?.error) {
|
|
642
|
+
console.log(`\n${c.red} ✗ ${result.error}${c.reset}`);
|
|
643
|
+
console.log(`${c.dim} Please go back and change the field, or run npx soundbip again.${c.reset}\n`);
|
|
644
|
+
rl.close();
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
|
|
600
648
|
if (!result || !result.store_id) {
|
|
601
|
-
console.log(`\n${c.red} ✗
|
|
649
|
+
console.log(`\n${c.red} ✗ Registration failed — unexpected server response${c.reset}\n`);
|
|
602
650
|
rl.close();
|
|
603
651
|
return;
|
|
604
652
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "soundbip",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "CLI for SoundBip POS - instant affiliate commissions on XRPL",
|
|
5
5
|
"bin": {
|
|
6
6
|
"soundbip": "./index.js"
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
27
|
-
"url": "git+https://github.com/TokenCanvasIO/
|
|
27
|
+
"url": "git+https://github.com/TokenCanvasIO/soundbip-nextjs.git",
|
|
28
|
+
"directory": "cli"
|
|
28
29
|
},
|
|
29
30
|
"homepage": "https://soundbip.com"
|
|
30
31
|
}
|