@pocketping/widget 1.5.2 → 1.7.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/dist/index.d.cts CHANGED
@@ -45,6 +45,8 @@ interface PocketPingConfig {
45
45
  showDelay?: number;
46
46
  /** Auto-open chat after delay in ms (0 = disabled) */
47
47
  autoOpenDelay?: number;
48
+ /** Auto-open chat when operator sends a message (default: true) */
49
+ autoOpenOnMessage?: boolean;
48
50
  /** Play sound on new message */
49
51
  soundEnabled?: boolean;
50
52
  /** Show unread badge on toggle button */
@@ -109,6 +111,27 @@ interface Session {
109
111
  messages: Message[];
110
112
  /** User identity if identified via PocketPing.identify() */
111
113
  identity?: UserIdentity;
114
+ /** Pre-chat form configuration */
115
+ preChatForm?: PreChatFormConfig;
116
+ }
117
+ /** Pre-chat form configuration */
118
+ interface PreChatFormConfig {
119
+ /** Whether the form is enabled */
120
+ enabled: boolean;
121
+ /** Whether the form is required (can't skip) */
122
+ required: boolean;
123
+ /** When to show the form: 'before-first-message' | 'after-first-message' */
124
+ timing: 'before-first-message' | 'after-first-message';
125
+ /** What fields to collect: 'email-only' | 'phone-only' | 'email-or-phone' | 'email-and-phone' */
126
+ fields: 'email-only' | 'phone-only' | 'email-or-phone' | 'email-and-phone';
127
+ /** Whether the form was already completed for this session */
128
+ completed: boolean;
129
+ }
130
+ /** Pre-chat form submission data */
131
+ interface PreChatFormData {
132
+ email?: string;
133
+ phone?: string;
134
+ phoneCountry?: string;
112
135
  }
113
136
  interface PresenceResponse {
114
137
  online: boolean;
@@ -269,6 +292,11 @@ declare class PocketPingClient {
269
292
  * })
270
293
  */
271
294
  identify(identity: UserIdentity): Promise<void>;
295
+ /**
296
+ * Submit pre-chat form data (email and/or phone)
297
+ * @param data - Form data containing email and/or phone
298
+ */
299
+ submitPreChat(data: PreChatFormData): Promise<void>;
272
300
  /**
273
301
  * Reset the user identity and optionally start a new session
274
302
  * Call on user logout to clear user data
package/dist/index.d.ts CHANGED
@@ -45,6 +45,8 @@ interface PocketPingConfig {
45
45
  showDelay?: number;
46
46
  /** Auto-open chat after delay in ms (0 = disabled) */
47
47
  autoOpenDelay?: number;
48
+ /** Auto-open chat when operator sends a message (default: true) */
49
+ autoOpenOnMessage?: boolean;
48
50
  /** Play sound on new message */
49
51
  soundEnabled?: boolean;
50
52
  /** Show unread badge on toggle button */
@@ -109,6 +111,27 @@ interface Session {
109
111
  messages: Message[];
110
112
  /** User identity if identified via PocketPing.identify() */
111
113
  identity?: UserIdentity;
114
+ /** Pre-chat form configuration */
115
+ preChatForm?: PreChatFormConfig;
116
+ }
117
+ /** Pre-chat form configuration */
118
+ interface PreChatFormConfig {
119
+ /** Whether the form is enabled */
120
+ enabled: boolean;
121
+ /** Whether the form is required (can't skip) */
122
+ required: boolean;
123
+ /** When to show the form: 'before-first-message' | 'after-first-message' */
124
+ timing: 'before-first-message' | 'after-first-message';
125
+ /** What fields to collect: 'email-only' | 'phone-only' | 'email-or-phone' | 'email-and-phone' */
126
+ fields: 'email-only' | 'phone-only' | 'email-or-phone' | 'email-and-phone';
127
+ /** Whether the form was already completed for this session */
128
+ completed: boolean;
129
+ }
130
+ /** Pre-chat form submission data */
131
+ interface PreChatFormData {
132
+ email?: string;
133
+ phone?: string;
134
+ phoneCountry?: string;
112
135
  }
113
136
  interface PresenceResponse {
114
137
  online: boolean;
@@ -269,6 +292,11 @@ declare class PocketPingClient {
269
292
  * })
270
293
  */
271
294
  identify(identity: UserIdentity): Promise<void>;
295
+ /**
296
+ * Submit pre-chat form data (email and/or phone)
297
+ * @param data - Form data containing email and/or phone
298
+ */
299
+ submitPreChat(data: PreChatFormData): Promise<void>;
272
300
  /**
273
301
  * Reset the user identity and optionally start a new session
274
302
  * Call on user logout to clear user data