whatsapp-pi 1.0.38 → 1.0.40

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whatsapp-pi",
3
- "version": "1.0.38",
3
+ "version": "1.0.40",
4
4
  "type": "module",
5
5
  "description": "WhatsApp integration extension for Pi",
6
6
  "main": "whatsapp-pi.ts",
@@ -3,9 +3,11 @@ import { SessionManager, type Contact } from '../services/session.manager.js';
3
3
  import { validatePhoneNumber, type RecentConversationSummary } from '../models/whatsapp.types.js';
4
4
  import { RecentsService } from '../services/recents.service.js';
5
5
  import * as qrcode from 'qrcode-terminal';
6
- import { copyToClipboard, type ExtensionCommandContext } from '@mariozechner/pi-coding-agent';
6
+ import type { ExtensionCommandContext } from '@mariozechner/pi-coding-agent';
7
7
 
8
8
  export class MenuHandler {
9
+ private readonly printedAllowedNumbers: string[] = [];
10
+
9
11
  constructor(
10
12
  private readonly whatsappService: WhatsAppService,
11
13
  private readonly sessionManager: SessionManager,
@@ -107,7 +109,7 @@ export class MenuHandler {
107
109
 
108
110
  private async manageAllowedContact(ctx: ExtensionCommandContext, contact: Contact) {
109
111
  const displayName = this.formatAllowedContactOption(contact);
110
- const options = ['Send Message', 'History', 'Copy Number'];
112
+ const options = ['Send Message', 'Print Number', 'History'];
111
113
  if (contact.name) {
112
114
  options.push('Remove Alias');
113
115
  } else {
@@ -129,8 +131,8 @@ export class MenuHandler {
129
131
  return;
130
132
  }
131
133
 
132
- if (choice === 'Copy Number') {
133
- await this.copyAllowedNumber(ctx, contact);
134
+ if (choice === 'Print Number') {
135
+ this.printAllowedNumber(ctx, contact.number);
134
136
  await this.manageAllowedContact(ctx, contact);
135
137
  return;
136
138
  }
@@ -171,13 +173,9 @@ export class MenuHandler {
171
173
  await this.manageAllowList(ctx);
172
174
  }
173
175
 
174
- private async copyAllowedNumber(ctx: ExtensionCommandContext, contact: Contact) {
175
- try {
176
- await copyToClipboard(contact.number);
177
- ctx.ui.notify(`Copied ${contact.number} to clipboard`, 'info');
178
- } catch {
179
- ctx.ui.notify(`Failed to copy ${contact.number} to clipboard`, 'error');
180
- }
176
+ private printAllowedNumber(ctx: ExtensionCommandContext, number: string) {
177
+ this.printedAllowedNumbers.push(number);
178
+ ctx.ui.notify(this.printedAllowedNumbers.join('\n'), 'info');
181
179
  }
182
180
 
183
181
  private async manageBlockList(ctx: ExtensionCommandContext) {