@prodantix/sdk 0.7.0-beta.438 → 0.7.0-beta.440

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 (43) hide show
  1. package/dist/chat.cjs +5 -107
  2. package/dist/chat.d.cts +93 -8
  3. package/dist/chat.d.ts +93 -8
  4. package/dist/chat.js +5 -107
  5. package/dist/chunk-L4P6GMBC.js +2 -0
  6. package/dist/client-Cz7M6XJC.d.ts +477 -0
  7. package/dist/client-vogZuHfD.d.cts +477 -0
  8. package/dist/{config-C9Njc6-j.d.ts → config-Dmk59mPh.d.ts} +40 -2
  9. package/dist/{config-CpfUyEw8.d.cts → config-Dxf1vAMu.d.cts} +40 -2
  10. package/dist/consent.iife.js +20 -0
  11. package/dist/ctas.iife.js +37 -0
  12. package/dist/forms.iife.js +16 -0
  13. package/dist/guides.iife.js +3 -0
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.d.cts +5 -4
  16. package/dist/index.d.ts +5 -4
  17. package/dist/index.js +1 -1
  18. package/dist/messenger-help.iife.js +1 -1
  19. package/dist/messenger-tickets.iife.js +3 -0
  20. package/dist/messenger.cjs +1 -1
  21. package/dist/messenger.d.cts +1 -1
  22. package/dist/messenger.d.ts +1 -1
  23. package/dist/messenger.iife.js +5 -107
  24. package/dist/messenger.js +1 -1
  25. package/dist/node.cjs +1 -1
  26. package/dist/node.d.cts +3 -2
  27. package/dist/node.d.ts +3 -2
  28. package/dist/node.js +1 -1
  29. package/dist/pages.iife.js +2 -0
  30. package/dist/prodantix-push-sw.js +3 -0
  31. package/dist/surveys.iife.js +2 -0
  32. package/dist/{transport-DKFvkfX4.d.ts → transport-C4mkCaix.d.ts} +1 -1
  33. package/dist/{transport-DN9pXyrX.d.cts → transport-C9C4hqlF.d.cts} +1 -1
  34. package/dist/{types-Q2VNlJbG.d.cts → types-BUXFV_aE.d.cts} +11 -0
  35. package/dist/{types-Q2VNlJbG.d.ts → types-BUXFV_aE.d.ts} +11 -0
  36. package/dist/web.cjs +36 -1
  37. package/dist/web.d.cts +185 -4
  38. package/dist/web.d.ts +185 -4
  39. package/dist/web.js +36 -1
  40. package/package.json +1 -1
  41. package/dist/chunk-D6PMLUYA.js +0 -2
  42. package/dist/client-CL6Xvhay.d.cts +0 -135
  43. package/dist/client-QyKW0LFW.d.ts +0 -135
@@ -0,0 +1,477 @@
1
+ import { F as FetchLike } from './http-BCh716Vs.cjs';
2
+ import { e as EventProperties, P as ProdantixConfig, b as Consent, f as FlagVariant, I as InboxMessage } from './types-BUXFV_aE.cjs';
3
+
4
+ type CtaKind = 'banner' | 'embedded' | 'popup' | 'slide_in';
5
+ type CtaPlacement = 'bottom' | 'bottom_left' | 'bottom_right' | 'top';
6
+ type CtaButtonAction = {
7
+ kind: 'dismiss';
8
+ } | {
9
+ kind: 'form';
10
+ value: string;
11
+ } | {
12
+ kind: 'messenger';
13
+ } | {
14
+ kind: 'url';
15
+ value: string;
16
+ };
17
+ interface CtaButton {
18
+ action: CtaButtonAction;
19
+ label: string;
20
+ }
21
+ interface CtaContent {
22
+ body: string;
23
+ buttons: CtaButton[];
24
+ heading: string;
25
+ image: string;
26
+ imageAlt: string;
27
+ }
28
+ interface CtaStyle {
29
+ background: string;
30
+ button: string;
31
+ buttonText: string;
32
+ radius: number;
33
+ text: string;
34
+ }
35
+ type CtaTrigger = {
36
+ kind: 'click';
37
+ value: string;
38
+ } | {
39
+ kind: 'delay';
40
+ value: number;
41
+ } | {
42
+ kind: 'exit';
43
+ } | {
44
+ kind: 'load';
45
+ } | {
46
+ kind: 'scroll';
47
+ value: number;
48
+ };
49
+ type CtaFrequency = {
50
+ kind: 'days';
51
+ value: number;
52
+ } | {
53
+ kind: 'once';
54
+ } | {
55
+ kind: 'session';
56
+ };
57
+ interface ServedCta {
58
+ flag: {
59
+ key: string;
60
+ variant?: string | null;
61
+ } | null;
62
+ frequency: CtaFrequency;
63
+ goalEvent: string | null;
64
+ id: string;
65
+ kind: CtaKind;
66
+ placement: CtaPlacement;
67
+ /** Whether the CTA carries the "Powered by Prodantix" line. */
68
+ poweredBy: boolean;
69
+ trigger: CtaTrigger;
70
+ /** The one variant this visitor is shown. */
71
+ variant: {
72
+ content: CtaContent;
73
+ key: string;
74
+ style: CtaStyle;
75
+ };
76
+ version: number;
77
+ }
78
+ type CtaDevice = 'desktop' | 'mobile' | 'tablet';
79
+
80
+ type FormFieldKind = 'checkbox' | 'checkboxes' | 'date' | 'dropdown' | 'email' | 'file' | 'hidden' | 'number' | 'phone' | 'radio' | 'rich_text' | 'text' | 'textarea';
81
+ interface FormOption {
82
+ archived?: boolean;
83
+ label: string;
84
+ value: string;
85
+ }
86
+ interface FormCondition {
87
+ field: string;
88
+ op: 'equals' | 'is_set' | 'one_of';
89
+ values: string[];
90
+ }
91
+ interface FormFieldRules {
92
+ maxLength?: number | null;
93
+ maximum?: number | null;
94
+ minLength?: number | null;
95
+ minimum?: number | null;
96
+ }
97
+ type FormHidden = {
98
+ source: 'cookie';
99
+ value: string;
100
+ } | {
101
+ source: 'fixed';
102
+ value: string;
103
+ } | {
104
+ source: 'query';
105
+ value: string;
106
+ };
107
+ interface FormField {
108
+ condition?: FormCondition | null;
109
+ help: string;
110
+ hidden?: FormHidden | null;
111
+ key: string;
112
+ kind: FormFieldKind;
113
+ label: string;
114
+ options: FormOption[];
115
+ placeholder: string;
116
+ required: boolean;
117
+ rules: FormFieldRules;
118
+ }
119
+ interface FormStep {
120
+ fields: FormField[];
121
+ title: string;
122
+ }
123
+ type FormAfterSubmit = {
124
+ kind: 'message';
125
+ value: string;
126
+ } | {
127
+ kind: 'redirect';
128
+ value: string;
129
+ };
130
+ interface FormConsentPurpose {
131
+ key: string;
132
+ label: string;
133
+ notice: string;
134
+ }
135
+ interface FormConsent {
136
+ processing?: string | null;
137
+ purposes: FormConsentPurpose[];
138
+ }
139
+ interface FormStyle {
140
+ background: string;
141
+ button: string;
142
+ buttonText: string;
143
+ fieldBackground: string;
144
+ fieldText: string;
145
+ font: string;
146
+ radius: number;
147
+ text: string;
148
+ width: number;
149
+ }
150
+ interface FormChallenge {
151
+ difficulty: number;
152
+ issuedAt: number;
153
+ nonce: string;
154
+ signature: string;
155
+ }
156
+ interface ServedForm {
157
+ /** Whether the form takes responses this month under the plan. */
158
+ accepting: boolean;
159
+ afterSubmit: FormAfterSubmit;
160
+ challenge: FormChallenge | null;
161
+ consent: FormConsent;
162
+ honeypot: string;
163
+ id: string;
164
+ /** Whether the form carries the "Powered by Prodantix" line. */
165
+ poweredBy: boolean;
166
+ steps: FormStep[];
167
+ style: FormStyle;
168
+ version: number;
169
+ }
170
+
171
+ declare const SURVEY_SHOWN = "$survey_shown";
172
+ declare const SURVEY_DISMISSED = "$survey_dismissed";
173
+ declare const SURVEY_SENT = "$survey_sent";
174
+ type SurveyQuestionKind = 'emoji' | 'link' | 'multiple' | 'nps' | 'open' | 'rating' | 'single';
175
+ interface SurveyBranch {
176
+ choice?: string | null;
177
+ maxScore?: number | null;
178
+ minScore?: number | null;
179
+ next?: string | null;
180
+ }
181
+ interface SurveyQuestion {
182
+ branches: SurveyBranch[];
183
+ choices: string[];
184
+ description?: string | null;
185
+ highLabel?: string | null;
186
+ id: string;
187
+ kind: SurveyQuestionKind;
188
+ link?: string | null;
189
+ lowLabel?: string | null;
190
+ optional: boolean;
191
+ prompt: string;
192
+ scale?: number | null;
193
+ }
194
+ interface SurveyUrlRule {
195
+ matches: 'contains' | 'exact' | 'starts_with';
196
+ value: string;
197
+ }
198
+ interface SurveyAppearance {
199
+ accent?: string | null;
200
+ placement: 'bottom_center' | 'bottom_left' | 'bottom_right';
201
+ submitLabel?: string | null;
202
+ thankYou?: string | null;
203
+ }
204
+ interface Survey {
205
+ appearance: SurveyAppearance;
206
+ choiceLabels?: Record<string, string[]>;
207
+ event?: string | null;
208
+ id: string;
209
+ iteration: number;
210
+ kind: 'api' | 'popover';
211
+ name: string;
212
+ questions: SurveyQuestion[];
213
+ showOnce: boolean;
214
+ urls: SurveyUrlRule[];
215
+ waitDays: number;
216
+ }
217
+ type SurveyAnswer = number | string | string[];
218
+ interface SurveyMemory {
219
+ lastShownAt?: number;
220
+ settled: string[];
221
+ }
222
+ interface SurveysClientOptions {
223
+ fetch?: FetchLike;
224
+ host: string;
225
+ projectKey: string;
226
+ requestTimeoutMs?: number;
227
+ }
228
+ declare class SurveysClient {
229
+ private readonly fetch?;
230
+ private readonly host;
231
+ private readonly projectKey;
232
+ private readonly requestTimeoutMs;
233
+ constructor(options: SurveysClientOptions);
234
+ surveys(distinctId: string, language?: string): Promise<Survey[]>;
235
+ }
236
+ declare const settledKey: (survey: Pick<Survey, "id" | "iteration">) => string;
237
+ declare function urlMatches(rules: SurveyUrlRule[], href: string): boolean;
238
+ declare function isDue(survey: Survey, memory: SurveyMemory, href: string, now: number, event?: string): boolean;
239
+ declare function nextQuestion(survey: Survey, question: SurveyQuestion, answer: SurveyAnswer | undefined): string | null;
240
+ declare function responseProperties(survey: Survey, answers: Record<string, SurveyAnswer>): EventProperties;
241
+
242
+ declare const GUIDE_SHOWN = "$guide_shown";
243
+ declare const GUIDE_STEP_VIEWED = "$guide_step_viewed";
244
+ declare const GUIDE_STEP_MISSED = "$guide_step_missed";
245
+ declare const GUIDE_COMPLETED = "$guide_completed";
246
+ declare const GUIDE_DISMISSED = "$guide_dismissed";
247
+ declare const CHECKLIST_TASK_DONE = "$checklist_task_done";
248
+ type GuideKind = 'checklist' | 'tooltip' | 'tour';
249
+ type GuideStepPlacement = 'auto' | 'bottom' | 'center' | 'left' | 'right' | 'top';
250
+ interface GuideStep {
251
+ anchor?: string | null;
252
+ body?: string | null;
253
+ event?: string | null;
254
+ id: string;
255
+ image?: string | null;
256
+ link?: string | null;
257
+ placement: GuideStepPlacement;
258
+ selector?: string | null;
259
+ title: string;
260
+ }
261
+ interface GuideAppearance {
262
+ accent?: string | null;
263
+ doneLabel?: string | null;
264
+ launcher: 'bottom_left' | 'bottom_right';
265
+ nextLabel?: string | null;
266
+ }
267
+ interface Guide {
268
+ appearance: GuideAppearance;
269
+ event?: string | null;
270
+ id: string;
271
+ iteration: number;
272
+ kind: GuideKind;
273
+ name: string;
274
+ showOnce: boolean;
275
+ steps: GuideStep[];
276
+ urls: SurveyUrlRule[];
277
+ waitDays: number;
278
+ }
279
+ interface GuideMemory {
280
+ done: string[];
281
+ lastShownAt?: number;
282
+ settled: string[];
283
+ }
284
+ interface GuidesClientOptions {
285
+ fetch?: FetchLike;
286
+ host: string;
287
+ projectKey: string;
288
+ requestTimeoutMs?: number;
289
+ }
290
+ declare class GuidesClient {
291
+ private readonly fetch?;
292
+ private readonly host;
293
+ private readonly projectKey;
294
+ private readonly requestTimeoutMs;
295
+ constructor(options: GuidesClientOptions);
296
+ guides(distinctId: string): Promise<Guide[]>;
297
+ }
298
+ declare const guideKey: (guide: Pick<Guide, "id" | "iteration">) => string;
299
+ declare const taskKey: (guide: Pick<Guide, "id" | "iteration">, stepId: string) => string;
300
+ declare function isGuideDue(guide: Guide, memory: GuideMemory, href: string, now: number, event?: string): boolean;
301
+ declare const tasksDone: (guide: Guide, memory: GuideMemory) => string[];
302
+ declare const taskFor: (guide: Guide, eventName: string) => GuideStep | undefined;
303
+ declare function guideProperties(guide: Guide, stepId?: string): EventProperties;
304
+
305
+ interface LocalFlagContext {
306
+ attributes?: EventProperties;
307
+ /** The cohorts the current distinct id belongs to. When omitted and the
308
+ * snapshot names a cohort, the client fetches them once per distinct id. */
309
+ cohorts?: string[];
310
+ properties?: EventProperties;
311
+ }
312
+ interface CaptureOptions {
313
+ /** Speak for someone other than this client's own identity. A server has no
314
+ * visitor of its own to lend an event, so an event it sends on a browser's
315
+ * behalf names the person directly. */
316
+ distinctId?: string;
317
+ element?: unknown;
318
+ properties?: EventProperties;
319
+ sessionId?: string;
320
+ timestamp?: Date;
321
+ }
322
+ /**
323
+ * The profile keys the platform itself understands.
324
+ *
325
+ * They are ordinary properties on the wire; the only thing that makes them
326
+ * special is the `$` prefix, which is how this platform marks a name it owns
327
+ * rather than one the caller chose. Passing them through `traits` means never
328
+ * having to remember whether the console reads `email` or `$email`: an
329
+ * unprefixed `email` is a property of your own and stays one, and would never
330
+ * reach the Email column.
331
+ */
332
+ interface PersonTraits {
333
+ avatar?: string;
334
+ email?: string;
335
+ name?: string;
336
+ phone?: string;
337
+ }
338
+ interface IdentifyOptions {
339
+ /** Arbitrary profile properties your own code defines. */
340
+ set?: EventProperties;
341
+ /** The reserved traits the console renders as fields. */
342
+ traits?: PersonTraits;
343
+ }
344
+ declare class ProdantixClient {
345
+ private readonly config;
346
+ private readonly identity;
347
+ private readonly session?;
348
+ private readonly queue;
349
+ private readonly transport;
350
+ private readonly flagsClient;
351
+ private readonly messagesClient;
352
+ private readonly surveysClient;
353
+ private readonly guidesClient;
354
+ private readonly captureListeners;
355
+ private readonly formsClient;
356
+ private readonly ctasClient;
357
+ private readonly context;
358
+ private flushTimer?;
359
+ private flushing;
360
+ private cachedFlags?;
361
+ private cachedSnapshot?;
362
+ private membershipCache?;
363
+ private stream?;
364
+ private shutDown;
365
+ /** One `$feature_flag_called` per (distinct id, flag, response) per client
366
+ * lifetime: the experiment engine attributes on the FIRST exposure, so a
367
+ * second event for the same answer would only cost the project an event. */
368
+ private readonly exposures;
369
+ private readonly gates;
370
+ private cookielessId?;
371
+ private readonly storageListeners;
372
+ constructor(config: ProdantixConfig);
373
+ get distinctId(): string;
374
+ get anonymousId(): string;
375
+ /** Whether this client still holds a person, from the persisted distinct id,
376
+ * so a fresh page load answers the same as the load that identified them.
377
+ * Public because a surface that has resolved to nobody must reset the client
378
+ * only when there is someone to reset: a sign-out is a hard navigation on a
379
+ * BFF surface, so no value-to-null transition ever renders. */
380
+ get isIdentified(): boolean;
381
+ get sessionId(): string | undefined;
382
+ get sessionStartedAt(): number | undefined;
383
+ capture(eventName: string, options?: CaptureOptions): void;
384
+ onCapture(listener: (eventName: string) => void): () => void;
385
+ identify(distinctId: string, options?: IdentifyOptions): void;
386
+ /**
387
+ * Join a browser's anonymous trail to a person from a server. A sign-in that
388
+ * completes in a redirect renders no page, so the browser's own `identify`
389
+ * never runs there; this sends the one `$identify` it would have sent, for
390
+ * the ids given, and leaves this client's own identity as it was.
391
+ */
392
+ link(distinctId: string, anonymousId: string, traits?: PersonTraits): void;
393
+ /**
394
+ * Record the visitor's answer about the join. It rides the shared store, so
395
+ * every subdomain and the login's server read the same one, and it takes
396
+ * effect on the next identify and the next decorated click; nothing already
397
+ * joined is unjoined.
398
+ */
399
+ setConsent(consent: Consent): void;
400
+ /** Whether the visitor is counted without anything kept on the device. */
401
+ isCookieless(): boolean;
402
+ /** Counts a cookieless visitor under the edge's id for the day. */
403
+ takeCookielessId(anonymousId: string): void;
404
+ /** Keeps the visitor's id on the device from now on, under a new id, so
405
+ * nothing counted before is joined to them. */
406
+ allowStorage(): void;
407
+ /** Calls `listener` once storage is allowed, for what waits on consent. */
408
+ onStorageAllowed(listener: () => void): () => void;
409
+ /** Stops keeping anything on the device and counts the visitor under the
410
+ * day's cookieless id again. */
411
+ forbidStorage(): void;
412
+ /** The visitor's answer, or null when they have not been asked. */
413
+ consent(): Consent | null;
414
+ alias(alias: string): void;
415
+ group(groupType: string, groupKey: string, properties?: EventProperties): void;
416
+ setPersonProperties(set?: EventProperties, setOnce?: EventProperties): void;
417
+ /**
418
+ * Attach the reserved traits to whoever is current, without an identify.
419
+ *
420
+ * This does NOT make the person identified: only `identify()` does that, so a
421
+ * trait set on an anonymous visitor leaves them anonymous and carrying an
422
+ * address, which is exactly what a newsletter signup before login looks like.
423
+ */
424
+ setPersonTraits(traits: PersonTraits): void;
425
+ getAllFlags(): Promise<Record<string, boolean>>;
426
+ isFeatureEnabled(key: string): Promise<boolean>;
427
+ /** The assigned variation for one flag, or null when the flag is unknown or
428
+ * carries no variations. Records the exposure either way. */
429
+ getVariant(key: string): Promise<FlagVariant | null>;
430
+ getVariantLocal(key: string, context?: LocalFlagContext): Promise<FlagVariant | null>;
431
+ private recordExposure;
432
+ getCachedFlag(key: string): boolean | undefined;
433
+ getLocalFlags(context?: LocalFlagContext): Promise<Record<string, boolean>>;
434
+ isFeatureEnabledLocal(key: string, context?: LocalFlagContext): Promise<boolean>;
435
+ /** The evaluation context for a local read. Memberships come from the caller
436
+ * when supplied, else from the server once per distinct id per snapshot
437
+ * TTL, and only when the snapshot names a cohort at all. */
438
+ private localContext;
439
+ private flagSnapshot;
440
+ /** Opens the flag stream once, when streaming was asked for and the snapshot
441
+ * names a gateway. A pushed change drops the cached snapshot and refetches
442
+ * it; a refused handshake stays closed, a dropped one reopens. */
443
+ private maybeStream;
444
+ getInbox(): Promise<InboxMessage[]>;
445
+ markMessageRead(messageId: string): Promise<void>;
446
+ getSurveys(language?: string): Promise<Survey[]>;
447
+ captureSurveyShown(survey: Survey): void;
448
+ captureSurveyDismissed(survey: Survey): void;
449
+ captureSurveySent(survey: Survey, answers: Record<string, SurveyAnswer>): void;
450
+ getGuides(): Promise<Guide[]>;
451
+ captureGuide(eventName: string, guide: Guide, stepId?: string): void;
452
+ /** A published form, resolved for this visitor's known properties. */
453
+ getForm(formId: string): Promise<ServedForm>;
454
+ /** Submits a form's answers as this visitor, identifying them by the email
455
+ * answered while they are anonymous. */
456
+ submitForm(formId: string, answers: Record<string, unknown>, challenge: FormChallenge, solution: string): Promise<FormAfterSubmit>;
457
+ /** The live CTAs a page may show this visitor, each with their variant. */
458
+ getCtas(page: {
459
+ device: CtaDevice;
460
+ language: string;
461
+ url: string;
462
+ }): Promise<ServedCta[]>;
463
+ /** Sends a CTA's view, click or dismiss, with the button for a click. */
464
+ captureCta(eventName: string, cta: ServedCta, button?: number): void;
465
+ flush(): Promise<void>;
466
+ reset(): void;
467
+ shutdown(): Promise<void>;
468
+ private enqueue;
469
+ private persistQueue;
470
+ private restoreQueue;
471
+ private startTimer;
472
+ private stopTimer;
473
+ private persistKey;
474
+ }
475
+ declare function createClient(config: ProdantixConfig): ProdantixClient;
476
+
477
+ export { isDue as A, isGuideDue as B, CHECKLIST_TASK_DONE as C, nextQuestion as D, responseProperties as E, settledKey as F, GUIDE_COMPLETED as G, taskFor as H, type IdentifyOptions as I, taskKey as J, tasksDone as K, type LocalFlagContext as L, urlMatches as M, type ServedForm as N, type FormChallenge as O, ProdantixClient as P, type FormAfterSubmit as Q, type ServedCta as R, SURVEY_DISMISSED as S, type CtaDevice as T, type CaptureOptions as a, GUIDE_DISMISSED as b, GUIDE_SHOWN as c, GUIDE_STEP_MISSED as d, GUIDE_STEP_VIEWED as e, type Guide as f, type GuideAppearance as g, type GuideKind as h, type GuideMemory as i, type GuideStep as j, type GuideStepPlacement as k, GuidesClient as l, SURVEY_SENT as m, SURVEY_SHOWN as n, type Survey as o, type SurveyAnswer as p, type SurveyAppearance as q, type SurveyBranch as r, type SurveyMemory as s, type SurveyQuestion as t, type SurveyQuestionKind as u, type SurveyUrlRule as v, SurveysClient as w, createClient as x, guideKey as y, guideProperties as z };
@@ -36,7 +36,14 @@ interface ArticleHit {
36
36
  trail: string[];
37
37
  url: string;
38
38
  embedUrl: string;
39
+ pageId: string;
40
+ language: string;
39
41
  }
42
+ interface ArticleRef {
43
+ pageId: string;
44
+ language: string;
45
+ }
46
+ type ArticleReaction = 'disappointed' | 'neutral' | 'smiley';
40
47
  interface ArticleCollection {
41
48
  title: string;
42
49
  articles: number;
@@ -78,6 +85,7 @@ declare class ChatClient {
78
85
  private readonly storage?;
79
86
  private handle;
80
87
  private identity;
88
+ private fromArticle;
81
89
  constructor(options: ChatClientOptions);
82
90
  get hasThread(): boolean;
83
91
  avatarUrl(url: string): string;
@@ -88,10 +96,15 @@ declare class ChatClient {
88
96
  } | null;
89
97
  identify(identity: ChatIdentity): void;
90
98
  ensureThread(subject?: string): Promise<boolean>;
99
+ cameFrom(article: ArticleRef): void;
91
100
  send(body: string, pageContext?: PageContext, attachmentIds?: string[]): Promise<ChatTurn | null>;
92
101
  upload(file: File): Promise<ChatUpload | null>;
93
102
  file(path: string): Promise<Blob | null>;
94
- helpCentre<T>(suffix: string, params: Record<string, string>): Promise<T | null>;
103
+ helpCentre<T>(suffix: string, params: Record<string, string>, body?: Record<string, string>): Promise<T | null>;
104
+ get visitor(): (ChatIdentity & {
105
+ distinctId: string;
106
+ }) | null;
107
+ edge<T>(path: string, body?: unknown, token?: string): Promise<T | null>;
95
108
  load(): Promise<ChatThread | null>;
96
109
  private readHandle;
97
110
  private fileRequest;
@@ -163,6 +176,7 @@ interface MessengerConfig extends AppearanceSettings {
163
176
  socketUrl: string;
164
177
  attachments?: MessengerAttachments;
165
178
  help?: MessengerHelp | null;
179
+ tickets?: MessengerTickets | null;
166
180
  poweredBy?: string | null;
167
181
  }
168
182
  interface HelpWords {
@@ -178,11 +192,35 @@ interface HelpWords {
178
192
  stillNeedHelp: string;
179
193
  messageUs: string;
180
194
  readOnSite: string;
195
+ wasItHelpful: string;
196
+ thanks: string;
197
+ smiley: string;
198
+ neutral: string;
199
+ disappointed: string;
200
+ rateArticle: string;
181
201
  }
182
202
  interface MessengerHelp {
183
203
  placement: 'first_view' | 'tab' | 'while_typing';
184
204
  words: HelpWords;
185
205
  }
206
+ interface TicketWords {
207
+ messagesTab: string;
208
+ ticketsTab: string;
209
+ yourTickets: string;
210
+ noTickets: string;
211
+ openTicket: string;
212
+ whatYouNeed: string;
213
+ subject: string;
214
+ choose: string;
215
+ send: string;
216
+ repliesHere: string;
217
+ reply: string;
218
+ back: string;
219
+ failed: string;
220
+ }
221
+ interface MessengerTickets {
222
+ words: TicketWords;
223
+ }
186
224
  interface MessengerAttachments {
187
225
  enabled: boolean;
188
226
  maxBytes: number;
@@ -202,4 +240,4 @@ declare const cacheKeyFor: (apiKey: string, locale: string | undefined) => strin
202
240
  declare function cachedMessengerConfig(storage: ChatStorage | undefined, apiKey: string, locale?: string): MessengerConfig | null;
203
241
  declare function fetchMessengerConfig(options: MessengerConfigOptions): Promise<MessengerConfig | null>;
204
242
 
205
- export { type ArticleHit as A, type BubbleFill as B, type ChatThread as C, DEFAULT_APPEARANCE_SETTINGS as D, localeCandidates as E, type FileFetchLike as F, type HelpWords as H, type LauncherContent as L, type MessengerAttachments as M, type NamePlacement as N, type PageContext as P, type StampContent as S, type ArticleCollection as a, type AppearanceSettings as b, type ChatTurn as c, type ChatUpload as d, type MessengerConfig as e, type ChatIdentity as f, type ChatClientOptions as g, type BubbleShape as h, type ChatAttachment as i, ChatClient as j, type ChatStorage as k, type ComposerShape as l, type FileResponseLike as m, type LauncherFill as n, type LauncherShape as o, type LauncherSize as p, type MessengerSkin as q, type StampPlacement as r, resolveAppearance as s, MESSENGER_CACHE_KEY as t, type MessengerConfigOptions as u, type MessengerHelp as v, type StarterPrompt as w, cacheKeyFor as x, cachedMessengerConfig as y, fetchMessengerConfig as z };
243
+ export { type ArticleRef as A, type BubbleFill as B, type ChatThread as C, DEFAULT_APPEARANCE_SETTINGS as D, cacheKeyFor as E, type FileFetchLike as F, cachedMessengerConfig as G, type HelpWords as H, fetchMessengerConfig as I, localeCandidates as J, type LauncherContent as L, type MessengerAttachments as M, type NamePlacement as N, type PageContext as P, type StampContent as S, type TicketWords as T, type ArticleReaction as a, type ArticleHit as b, type ArticleCollection as c, type AppearanceSettings as d, type ChatTurn as e, type ChatUpload as f, type ChatIdentity as g, type MessengerConfig as h, type ChatClientOptions as i, type BubbleShape as j, type ChatAttachment as k, ChatClient as l, type ChatStorage as m, type ComposerShape as n, type FileResponseLike as o, type LauncherFill as p, type LauncherShape as q, type LauncherSize as r, type MessengerSkin as s, type StampPlacement as t, resolveAppearance as u, MESSENGER_CACHE_KEY as v, type MessengerConfigOptions as w, type MessengerHelp as x, type MessengerTickets as y, type StarterPrompt as z };
@@ -36,7 +36,14 @@ interface ArticleHit {
36
36
  trail: string[];
37
37
  url: string;
38
38
  embedUrl: string;
39
+ pageId: string;
40
+ language: string;
39
41
  }
42
+ interface ArticleRef {
43
+ pageId: string;
44
+ language: string;
45
+ }
46
+ type ArticleReaction = 'disappointed' | 'neutral' | 'smiley';
40
47
  interface ArticleCollection {
41
48
  title: string;
42
49
  articles: number;
@@ -78,6 +85,7 @@ declare class ChatClient {
78
85
  private readonly storage?;
79
86
  private handle;
80
87
  private identity;
88
+ private fromArticle;
81
89
  constructor(options: ChatClientOptions);
82
90
  get hasThread(): boolean;
83
91
  avatarUrl(url: string): string;
@@ -88,10 +96,15 @@ declare class ChatClient {
88
96
  } | null;
89
97
  identify(identity: ChatIdentity): void;
90
98
  ensureThread(subject?: string): Promise<boolean>;
99
+ cameFrom(article: ArticleRef): void;
91
100
  send(body: string, pageContext?: PageContext, attachmentIds?: string[]): Promise<ChatTurn | null>;
92
101
  upload(file: File): Promise<ChatUpload | null>;
93
102
  file(path: string): Promise<Blob | null>;
94
- helpCentre<T>(suffix: string, params: Record<string, string>): Promise<T | null>;
103
+ helpCentre<T>(suffix: string, params: Record<string, string>, body?: Record<string, string>): Promise<T | null>;
104
+ get visitor(): (ChatIdentity & {
105
+ distinctId: string;
106
+ }) | null;
107
+ edge<T>(path: string, body?: unknown, token?: string): Promise<T | null>;
95
108
  load(): Promise<ChatThread | null>;
96
109
  private readHandle;
97
110
  private fileRequest;
@@ -163,6 +176,7 @@ interface MessengerConfig extends AppearanceSettings {
163
176
  socketUrl: string;
164
177
  attachments?: MessengerAttachments;
165
178
  help?: MessengerHelp | null;
179
+ tickets?: MessengerTickets | null;
166
180
  poweredBy?: string | null;
167
181
  }
168
182
  interface HelpWords {
@@ -178,11 +192,35 @@ interface HelpWords {
178
192
  stillNeedHelp: string;
179
193
  messageUs: string;
180
194
  readOnSite: string;
195
+ wasItHelpful: string;
196
+ thanks: string;
197
+ smiley: string;
198
+ neutral: string;
199
+ disappointed: string;
200
+ rateArticle: string;
181
201
  }
182
202
  interface MessengerHelp {
183
203
  placement: 'first_view' | 'tab' | 'while_typing';
184
204
  words: HelpWords;
185
205
  }
206
+ interface TicketWords {
207
+ messagesTab: string;
208
+ ticketsTab: string;
209
+ yourTickets: string;
210
+ noTickets: string;
211
+ openTicket: string;
212
+ whatYouNeed: string;
213
+ subject: string;
214
+ choose: string;
215
+ send: string;
216
+ repliesHere: string;
217
+ reply: string;
218
+ back: string;
219
+ failed: string;
220
+ }
221
+ interface MessengerTickets {
222
+ words: TicketWords;
223
+ }
186
224
  interface MessengerAttachments {
187
225
  enabled: boolean;
188
226
  maxBytes: number;
@@ -202,4 +240,4 @@ declare const cacheKeyFor: (apiKey: string, locale: string | undefined) => strin
202
240
  declare function cachedMessengerConfig(storage: ChatStorage | undefined, apiKey: string, locale?: string): MessengerConfig | null;
203
241
  declare function fetchMessengerConfig(options: MessengerConfigOptions): Promise<MessengerConfig | null>;
204
242
 
205
- export { type ArticleHit as A, type BubbleFill as B, type ChatThread as C, DEFAULT_APPEARANCE_SETTINGS as D, localeCandidates as E, type FileFetchLike as F, type HelpWords as H, type LauncherContent as L, type MessengerAttachments as M, type NamePlacement as N, type PageContext as P, type StampContent as S, type ArticleCollection as a, type AppearanceSettings as b, type ChatTurn as c, type ChatUpload as d, type MessengerConfig as e, type ChatIdentity as f, type ChatClientOptions as g, type BubbleShape as h, type ChatAttachment as i, ChatClient as j, type ChatStorage as k, type ComposerShape as l, type FileResponseLike as m, type LauncherFill as n, type LauncherShape as o, type LauncherSize as p, type MessengerSkin as q, type StampPlacement as r, resolveAppearance as s, MESSENGER_CACHE_KEY as t, type MessengerConfigOptions as u, type MessengerHelp as v, type StarterPrompt as w, cacheKeyFor as x, cachedMessengerConfig as y, fetchMessengerConfig as z };
243
+ export { type ArticleRef as A, type BubbleFill as B, type ChatThread as C, DEFAULT_APPEARANCE_SETTINGS as D, cacheKeyFor as E, type FileFetchLike as F, cachedMessengerConfig as G, type HelpWords as H, fetchMessengerConfig as I, localeCandidates as J, type LauncherContent as L, type MessengerAttachments as M, type NamePlacement as N, type PageContext as P, type StampContent as S, type TicketWords as T, type ArticleReaction as a, type ArticleHit as b, type ArticleCollection as c, type AppearanceSettings as d, type ChatTurn as e, type ChatUpload as f, type ChatIdentity as g, type MessengerConfig as h, type ChatClientOptions as i, type BubbleShape as j, type ChatAttachment as k, ChatClient as l, type ChatStorage as m, type ComposerShape as n, type FileResponseLike as o, type LauncherFill as p, type LauncherShape as q, type LauncherSize as r, type MessengerSkin as s, type StampPlacement as t, resolveAppearance as u, MESSENGER_CACHE_KEY as v, type MessengerConfigOptions as w, type MessengerHelp as x, type MessengerTickets as y, type StarterPrompt as z };