whatsapp-pi 1.0.37 → 1.0.38

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.37",
3
+ "version": "1.0.38",
4
4
  "type": "module",
5
5
  "description": "WhatsApp integration extension for Pi",
6
6
  "main": "whatsapp-pi.ts",
@@ -3,7 +3,7 @@ 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 type { ExtensionCommandContext } from '@mariozechner/pi-coding-agent';
6
+ import { copyToClipboard, type ExtensionCommandContext } from '@mariozechner/pi-coding-agent';
7
7
 
8
8
  export class MenuHandler {
9
9
  constructor(
@@ -107,7 +107,7 @@ export class MenuHandler {
107
107
 
108
108
  private async manageAllowedContact(ctx: ExtensionCommandContext, contact: Contact) {
109
109
  const displayName = this.formatAllowedContactOption(contact);
110
- const options = ['Send Message', 'History'];
110
+ const options = ['Send Message', 'History', 'Copy Number'];
111
111
  if (contact.name) {
112
112
  options.push('Remove Alias');
113
113
  } else {
@@ -129,6 +129,12 @@ export class MenuHandler {
129
129
  return;
130
130
  }
131
131
 
132
+ if (choice === 'Copy Number') {
133
+ await this.copyAllowedNumber(ctx, contact);
134
+ await this.manageAllowedContact(ctx, contact);
135
+ return;
136
+ }
137
+
132
138
  if (choice === 'Add Alias') {
133
139
  const alias = await ctx.ui.input(`Enter alias for ${contact.number}:`);
134
140
  const trimmedAlias = alias?.trim() || '';
@@ -165,6 +171,15 @@ export class MenuHandler {
165
171
  await this.manageAllowList(ctx);
166
172
  }
167
173
 
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
+ }
181
+ }
182
+
168
183
  private async manageBlockList(ctx: ExtensionCommandContext) {
169
184
  const list = [...this.sessionManager.getIgnoredNumbers()].reverse();
170
185