@askly/widget 2.6.1 → 2.8.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/README.md CHANGED
@@ -108,10 +108,11 @@ const hash = crypto
108
108
 
109
109
  Without a valid `hash` the traits are still used locally, but Askly will not link the accounts.
110
110
 
111
- > **Known limitation:** a signature is accepted for 5 minutes from its `timestamp`. On a page that
112
- > stays open longer, call `Askly.identify()` again with a freshly generated `hash` and `timestamp`
113
- > (for example on a timer, or before the user opens the chat). If `identify()` is rejected, the
114
- > reason is logged to the browser console.
111
+ The `hash` only has to be fresh at the moment `identify()` (or `init()`) runs: it is valid for 5
112
+ minutes from its `timestamp`. Once Askly has verified it, the widget holds a session for that user
113
+ and keeps renewing it, so a page that stays open for hours keeps working without a new hash. If
114
+ `identify()` is rejected, the reason is logged to the browser console and messages are sent as
115
+ the anonymous visitor.
115
116
 
116
117
  #### Logging out
117
118
 
@@ -140,6 +141,31 @@ instead of calling `identify()` separately:
140
141
  | `timestamp` | `number` | Signature timestamp. |
141
142
  | `signature` | `string` | HMAC request signature (same value as `hash` above). |
142
143
 
144
+ ### Greeting bubble
145
+
146
+ A few seconds after the page loads, the widget shows a short hello next to the launcher —
147
+ *"Hi, I'm Maya from Acme. How can I help?"* — with up to three of your FAQs as one-tap questions.
148
+ Clicking it opens the chat with that line as the first message.
149
+
150
+ Turn it on or off, and set the text and delay, on **Widget → Branding** in the portal. In the text,
151
+ `{ai_name}` and `{organizationName}` are filled in for you; if the AI is not answering, the default
152
+ greeting does not name one. A visitor who dismisses it, or opens the chat, does not see it again
153
+ that session. It is not shown with `autoOpen`.
154
+
155
+ To override per embed:
156
+
157
+ ```javascript
158
+ Askly.init({ appId: "YOUR_APP_ID", greeting: false }); // off on this site
159
+ Askly.init({ appId: "YOUR_APP_ID", greeting: { message: "Need a hand?", delayMs: 5000 } });
160
+ ```
161
+
162
+ ```html
163
+ <script src="…/widget.js" data-app-id="YOUR_APP_ID" data-greeting="false" async></script>
164
+ ```
165
+
166
+ The widget dispatches `askly:greeting:shown`, `askly:greeting:clicked` and
167
+ `askly:greeting:dismissed` on `window` for analytics.
168
+
143
169
  ### Asking visitors for their email
144
170
 
145
171
  Anonymous visitors can't be replied to once they close the tab — the answer just waits in a widget
package/dist/index.d.ts CHANGED
@@ -16,6 +16,10 @@ export interface AsklyConfig {
16
16
  buttonIcon?: string;
17
17
  buttonShape?: "round" | "square";
18
18
  autoOpen?: boolean;
19
+ greeting?: boolean | {
20
+ message?: string;
21
+ delayMs?: number;
22
+ };
19
23
  showTimestamp?: boolean;
20
24
  soundEnabled?: boolean;
21
25
  soundVolume?: number;