soundbip 2.0.1 → 2.1.1

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/index.js +149 -39
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -4,6 +4,7 @@ const https = require('https');
4
4
  const { exec } = require('child_process');
5
5
 
6
6
  const API_URL = 'api.dltpays.com';
7
+ const VERSION = '2.1.1';
7
8
 
8
9
  // Colors
9
10
  const c = {
@@ -23,6 +24,39 @@ const c = {
23
24
  gray: '\x1b[90m'
24
25
  };
25
26
 
27
+ // Handle --help and --version
28
+ const args = process.argv.slice(2);
29
+ if (args.includes('--help') || args.includes('-h')) {
30
+ console.log(`
31
+ ${c.bold}soundbip${c.reset} v${VERSION}
32
+
33
+ Register your store with SoundBip and start paying affiliates instantly on XRPL.
34
+
35
+ ${c.bold}Usage:${c.reset}
36
+ npx soundbip Interactive store setup
37
+ npx soundbip --help Show this help
38
+ npx soundbip --version Show version
39
+
40
+ ${c.bold}What happens:${c.reset}
41
+ 1. Enter your store name, URL, and email
42
+ 2. Choose your platform (WooCommerce, Shopify, etc.)
43
+ 3. Get your API credentials and setup instructions
44
+ 4. Connect your wallet via the vendor dashboard
45
+
46
+ ${c.bold}Requirements:${c.reset}
47
+ - A website or online store
48
+ - An email address
49
+
50
+ ${c.dim}https://soundbip.com | support@soundbip.com${c.reset}
51
+ `);
52
+ process.exit(0);
53
+ }
54
+
55
+ if (args.includes('--version') || args.includes('-v')) {
56
+ console.log(`soundbip v${VERSION}`);
57
+ process.exit(0);
58
+ }
59
+
26
60
  const rl = readline.createInterface({
27
61
  input: process.stdin,
28
62
  output: process.stdout
@@ -127,6 +161,7 @@ function banner() {
127
161
  console.log('');
128
162
  console.log(`${c.bold}${c.white} ⚡ POS & Affiliate Commissions on XRPL ⚡${c.reset}`);
129
163
  console.log(`${c.dim} Pay affiliates in seconds, not months${c.reset}`);
164
+ console.log(`${c.dim} v${VERSION}${c.reset}`);
130
165
  console.log('');
131
166
  console.log(`${c.gray} ════════════════════════════════════════════════════════════════════════════════════${c.reset}`);
132
167
  console.log('');
@@ -206,20 +241,20 @@ function getWooCommerceInstructions(storeId, apiSecret) {
206
241
  ${c.bold}${c.green} WooCommerce Setup (Easiest - 2 minutes)${c.reset}
207
242
 
208
243
  ${c.bold}Step 1:${c.reset} Download the plugin
209
- ${c.cyan}https://github.com/TokenCanvasIO/YesAllofUs-wordpress/releases/download/v1.0.0/YesAllofUs.zip${c.reset}
244
+ ${c.cyan}https://github.com/TokenCanvasIO/soundbip-wordpress/releases/latest/download/soundbip.zip${c.reset}
210
245
 
211
246
  ${c.bold}Step 2:${c.reset} Install in WordPress
212
247
  ${c.dim}WordPress Admin → Plugins → Add New → Upload Plugin → Select the .zip${c.reset}
213
248
 
214
249
  ${c.bold}Step 3:${c.reset} Activate & Configure
215
- ${c.dim}Go to Settings → YesAllofUs and enter your API credentials${c.reset}
250
+ ${c.dim}Go to Settings → SoundBip and enter your API credentials${c.reset}
216
251
 
217
252
  ${c.bold}What you get:${c.reset}
218
- ${c.green}✓${c.reset} Affiliate signup page ${c.dim}[yesallofus_affiliate_signup]${c.reset}
219
- ${c.green}✓${c.reset} Affiliate dashboard ${c.dim}[yesallofus_affiliate_dashboard]${c.reset}
253
+ ${c.green}✓${c.reset} Affiliate signup page ${c.dim}[soundbip_affiliate_signup]${c.reset}
254
+ ${c.green}✓${c.reset} Affiliate dashboard ${c.dim}[soundbip_affiliate_dashboard]${c.reset}
220
255
  ${c.green}✓${c.reset} Auto commission tracking ${c.dim}on every WooCommerce order${c.reset}
221
256
  ${c.green}✓${c.reset} Store admin dashboard ${c.dim}manage affiliates & payouts${c.reset}
222
- ${c.green}✓${c.reset} Instant RLUSD payouts ${c.dim}via Xaman or Crossmark auto-sign${c.reset}
257
+ ${c.green}✓${c.reset} Instant RLUSD payouts ${c.dim}via Social Login or Crossmark auto-sign${c.reset}
223
258
  `;
224
259
  }
225
260
 
@@ -234,7 +269,7 @@ ${c.blue} <script>
234
269
  (function() {
235
270
  const ref = new URLSearchParams(window.location.search).get('ref');
236
271
  if (ref) {
237
- document.cookie = 'yesallofus_ref=' + ref + ';path=/;max-age=2592000';
272
+ document.cookie = 'soundbip_ref=' + ref + ';path=/;max-age=2592000';
238
273
  }
239
274
  })();
240
275
  </script>${c.reset}
@@ -288,7 +323,7 @@ ${c.bold}${c.blue} Stripe Checkout Integration${c.reset}
288
323
  ${c.blue} const session = await stripe.checkout.sessions.create({
289
324
  // ... your config
290
325
  metadata: {
291
- referral_code: req.cookies.yesallofus_ref || ''
326
+ referral_code: req.cookies.soundbip_ref || ''
292
327
  }
293
328
  });${c.reset}
294
329
 
@@ -367,6 +402,65 @@ async function main() {
367
402
  'Please enter a valid email address'
368
403
  );
369
404
 
405
+ const ownerName = await askWithValidation(
406
+ `${c.cyan} Owner / contact name: ${c.reset}`,
407
+ (name) => name.length >= 2 && name.length <= 100,
408
+ 'Name must be 2-100 characters'
409
+ );
410
+
411
+ // Business address
412
+ section('📍', 'Business Address (Guernsey)');
413
+ console.log('');
414
+
415
+ const PARISHES = {
416
+ '1': 'Castel', '2': 'Forest', '3': 'St Andrew', '4': 'St Martin',
417
+ '5': 'St Peter Port', '6': 'St Pierre du Bois', '7': 'St Sampson',
418
+ '8': 'St Saviour', '9': 'Torteval', '10': 'Vale'
419
+ };
420
+
421
+ const addressStreet = await askWithValidation(
422
+ `${c.cyan} Address: ${c.reset}`,
423
+ (s) => s.length >= 2,
424
+ 'Address is required'
425
+ );
426
+
427
+ // Auto-extract postcode from address if present
428
+ const postcodeMatch = addressStreet.match(/GY\d{1,2}\s?\d[A-Z]{2}/i);
429
+ let addressPostcode;
430
+ if (postcodeMatch) {
431
+ addressPostcode = postcodeMatch[0].trim().toUpperCase();
432
+ success(`Postcode detected: ${addressPostcode}`);
433
+ } else {
434
+ addressPostcode = await askWithValidation(
435
+ `${c.cyan} Postcode (e.g. GY1 1AA): ${c.reset}`,
436
+ (pc) => /^GY\d{1,2}\s?\d[A-Z]{2}$/i.test(pc.trim()),
437
+ 'Must be a valid Guernsey postcode (e.g. GY1 1AA)',
438
+ (pc) => pc.trim().toUpperCase()
439
+ );
440
+ }
441
+
442
+ // Parish selection
443
+ console.log('');
444
+ console.log(`${c.bold} Parish:${c.reset}`);
445
+ Object.entries(PARISHES).forEach(([num, name]) => {
446
+ console.log(`${c.dim} ${c.reset}${c.cyan}[${num.padStart(2)}]${c.reset} ${name}`);
447
+ });
448
+ console.log('');
449
+ const parishChoice = await ask(`${c.cyan} Select parish [1-10]: ${c.reset}`);
450
+ const addressCity = PARISHES[parishChoice.trim()] || parishChoice.trim();
451
+
452
+ // Optional fields
453
+ section('📝', 'Additional Details');
454
+ console.log('');
455
+
456
+ const registrationNumber = await askWithValidation(
457
+ `${c.cyan} Guernsey registration number: ${c.reset}`,
458
+ (n) => n.length >= 3,
459
+ 'Registration number is required'
460
+ );
461
+
462
+ const description = await ask(`${c.cyan} Describe your business (optional, max 250 chars): ${c.reset}`);
463
+
370
464
  // Referral code (optional)
371
465
  const referralCode = await ask(`${c.cyan} Referral code (optional): ${c.reset}`);
372
466
 
@@ -375,7 +469,7 @@ async function main() {
375
469
  const lookupResult = await apiCall('GET', `/store/lookup-referral/${referralCode.trim()}`);
376
470
  if (lookupResult.success) {
377
471
  referred_by_store = lookupResult.store_id;
378
- console.log(`${c.green} ✓ Referred by: ${lookupResult.store_name} (50% off first month!)${c.reset}`);
472
+ console.log(`${c.green} ✓ Referred by: ${lookupResult.store_name}${c.reset}`);
379
473
  } else {
380
474
  console.log(`${c.yellow} ⚠ Referral code not found - continuing without referral${c.reset}`);
381
475
  }
@@ -388,37 +482,52 @@ async function main() {
388
482
 
389
483
  const spin = spinner('Registering your store...');
390
484
 
391
- const result = await apiCall('POST', '/store/register', {
485
+ const registerBody = {
392
486
  store_name: storeName,
393
487
  store_url: storeUrl,
394
488
  email: email,
395
- platform: platform.key,
396
- referred_by_store: referred_by_store
397
- });
489
+ owner_name: ownerName,
490
+ business_address: {
491
+ street: addressStreet,
492
+ city: addressCity,
493
+ postcode: addressPostcode
494
+ },
495
+ platform_type: platform.key,
496
+ referred_by_store: referred_by_store,
497
+ terms_accepted: true,
498
+ terms_accepted_at: new Date().toISOString()
499
+ };
500
+
501
+ registerBody.registration_number = registrationNumber.trim();
502
+ if (description.trim() && description.trim().length <= 250) {
503
+ registerBody.description = description.trim();
504
+ }
505
+
506
+ const result = await apiCall('POST', '/store/register', registerBody);
398
507
 
399
508
  stopSpinner(spin);
400
509
 
401
- if (result.error) {
402
- console.log(`\n${c.red} ✗ Error: ${result.error}${c.reset}\n`);
403
- rl.close();
404
- return;
405
- }
510
+ if (result.error) {
511
+ console.log(`\n${c.red} ✗ Error: ${result.error}${c.reset}\n`);
512
+ rl.close();
513
+ return;
514
+ }
406
515
 
407
- if (result.reconnected) {
408
- console.log('');
409
- console.log(`${c.yellow} ⚠ Store already registered for ${storeUrl}${c.reset}`);
410
- console.log('');
411
- console.log(`${c.bold} Log in to your vendor dashboard:${c.reset}`);
412
- console.log(`${c.cyan} https://soundbip.com/partner-login${c.reset}`);
413
- console.log('');
414
- console.log(`${c.dim} Need a new API secret? Regenerate it from the dashboard.${c.reset}`);
415
- console.log('');
416
- rl.close();
417
- return;
418
- }
516
+ if (result.reconnected) {
517
+ console.log('');
518
+ console.log(`${c.yellow} ⚠ Store already registered for ${storeUrl}${c.reset}`);
519
+ console.log('');
520
+ console.log(`${c.bold} Log in to your vendor dashboard:${c.reset}`);
521
+ console.log(`${c.cyan} https://soundbip.com/partner-login${c.reset}`);
522
+ console.log('');
523
+ console.log(`${c.dim} Need a new API secret? Regenerate it from the dashboard.${c.reset}`);
524
+ console.log('');
525
+ rl.close();
526
+ return;
527
+ }
419
528
 
420
- console.log('');
421
- success('Store registered successfully!');
529
+ console.log('');
530
+ success('Store registered successfully!');
422
531
 
423
532
  // Credentials
424
533
  section('🔐', 'Your Credentials');
@@ -463,7 +572,7 @@ success('Store registered successfully!');
463
572
  if (platform.key === 'woocommerce') {
464
573
  console.log('');
465
574
  console.log(`${c.dim} Or use the shortcode on any WordPress page:${c.reset}`);
466
- console.log(`${c.blue} [yesallofus_affiliate_signup]${c.reset}`);
575
+ console.log(`${c.blue} [soundbip_affiliate_signup]${c.reset}`);
467
576
  }
468
577
 
469
578
  // Resources
@@ -477,23 +586,24 @@ success('Store registered successfully!');
477
586
  console.log(`${c.gray} ════════════════════════════════════════════════════════════════════════════════════${c.reset}`);
478
587
  console.log('');
479
588
  console.log(`${c.bold}${c.green} 🚀 You're ready to pay affiliates instantly!${c.reset}`);
480
- console.log(`${c.dim} Lagos to London, same speed. That's the future.${c.reset}`);
481
589
  console.log('');
482
590
 
483
591
  // Wallet connection
484
592
  section('👛', 'Connect Your Wallet');
485
- console.log('');
486
- console.log(`${c.dim} Payout options:${c.reset}`);
487
- console.log(`${c.white} • Google${c.reset} ${c.dim}- Easiest setup, automatic 24/7 payouts${c.reset}`);
488
- console.log(`${c.blue} • Crossmark${c.reset} ${c.dim}- Automatic 24/7 payouts (browser extension)${c.reset}`);
593
+ console.log('');
594
+ console.log(`${c.dim} Payout options:${c.reset}`);
595
+ console.log(`${c.white} • Social Login (Google, Apple, etc.)${c.reset} ${c.dim}- Easiest, automatic 24/7 payouts${c.reset}`);
596
+ console.log(`${c.blue} • Crossmark${c.reset} ${c.dim}- Browser extension, automatic 24/7 payouts${c.reset}`);
489
597
  console.log('');
490
598
 
491
599
  const dashboardUrl = `https://soundbip.com/partner-login?claim=${result.claim_token}`;
492
600
 
493
- console.log(`${c.bold} Open this URL to connect your wallet and access your vendor dashboard:${c.reset}`);
494
- console.log('');
601
+ console.log(`${c.bold} Opening your vendor dashboard...${c.reset}`);
495
602
  console.log(`${c.cyan} ${dashboardUrl}${c.reset}`);
496
603
  console.log('');
604
+
605
+ openBrowser(dashboardUrl);
606
+
497
607
  console.log(`${c.yellow} 💡 Use Chrome or Brave for best experience (required for Crossmark)${c.reset}`)
498
608
 
499
609
  console.log('');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soundbip",
3
- "version": "2.0.1",
3
+ "version": "2.1.1",
4
4
  "description": "CLI for SoundBip POS - instant affiliate commissions on XRPL",
5
5
  "bin": {
6
6
  "soundbip": "./index.js"