@namphuongtechnologi/np-hub 0.1.11 → 0.2.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 +51 -51
- package/dist/{chunk-Y7JSRJAC.js → chunk-C5WUIBKX.js} +210 -42
- package/dist/chunk-C5WUIBKX.js.map +1 -0
- package/dist/index.cjs +209 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/np-hub.min.global.js +445 -104
- package/dist/react.cjs +209 -41
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/register.cjs +209 -41
- package/dist/register.cjs.map +1 -1
- package/dist/register.js +1 -1
- package/dist/{support-widget.element-ByuF6TAw.d.cts → support-widget.element-BlSyAC7w.d.cts} +8 -0
- package/dist/{support-widget.element-ByuF6TAw.d.ts → support-widget.element-BlSyAC7w.d.ts} +8 -0
- package/docs/DEVELOPER_GUIDE.md +47 -47
- package/package.json +1 -1
- package/dist/chunk-Y7JSRJAC.js.map +0 -1
package/README.md
CHANGED
|
@@ -121,21 +121,21 @@ export default function App() {
|
|
|
121
121
|
|
|
122
122
|
### `setConfig` / React props
|
|
123
123
|
|
|
124
|
-
| Name | Required | Default
|
|
125
|
-
| --------------- | -------- |
|
|
126
|
-
| `projectId` | No | —
|
|
127
|
-
| `isDev` | No | `false`
|
|
128
|
-
| `priority` | No | `0`
|
|
129
|
-
| `coordinators` | No | `[]`
|
|
130
|
-
| `emailContacts` | No | `[]`
|
|
131
|
-
| `toastDuration` | No | `4000`
|
|
124
|
+
| Name | Required | Default | Description |
|
|
125
|
+
| --------------- | -------- | ------- | ---------------------------------------------- |
|
|
126
|
+
| `projectId` | No | — | Project code forwarded to the API |
|
|
127
|
+
| `isDev` | No | `false` | `true` → Development API; otherwise Production |
|
|
128
|
+
| `priority` | No | `0` | Request priority |
|
|
129
|
+
| `coordinators` | No | `[]` | Coordinator email list |
|
|
130
|
+
| `emailContacts` | No | `[]` | Contact emails that receive the notification |
|
|
131
|
+
| `toastDuration` | No | `4000` | Toast auto-close delay in milliseconds |
|
|
132
132
|
|
|
133
133
|
### Prefill (optional)
|
|
134
134
|
|
|
135
|
-
| Name
|
|
136
|
-
|
|
|
137
|
-
| User
|
|
138
|
-
| Form content
|
|
135
|
+
| Name | Method / prop | Description |
|
|
136
|
+
| ------------ | -------------------------------- | --------------------------------------------------------------------------- |
|
|
137
|
+
| User | `setUser` / `user` | Prefills name, email, phone. Form UI still requires these fields on submit. |
|
|
138
|
+
| Form content | `setFormPrefill` / `formPrefill` | Prefills `content` and `attachments`. |
|
|
139
139
|
|
|
140
140
|
```js
|
|
141
141
|
// Web Component
|
|
@@ -171,11 +171,11 @@ widget.setFormPrefill({
|
|
|
171
171
|
|
|
172
172
|
Default: **65×65px**, anchored **20px** from the bottom-right corner.
|
|
173
173
|
|
|
174
|
-
| Attribute / prop
|
|
175
|
-
|
|
|
176
|
-
| `width` / `height`
|
|
177
|
-
| `right` / `bottom`
|
|
178
|
-
| `left` / `top`
|
|
174
|
+
| Attribute / prop | Description |
|
|
175
|
+
| ------------------ | --------------------------------------------------- |
|
|
176
|
+
| `width` / `height` | Launcher size (default `65`) |
|
|
177
|
+
| `right` / `bottom` | Offset from bottom-right (default `20`) |
|
|
178
|
+
| `left` / `top` | Use instead of `right` / `bottom` for other corners |
|
|
179
179
|
|
|
180
180
|
Numeric values from React props are treated as pixels. After the user drags the launcher, the stored `localStorage` position takes precedence.
|
|
181
181
|
|
|
@@ -192,13 +192,13 @@ widget.setAttribute("bottom", "24");
|
|
|
192
192
|
|
|
193
193
|
After a successful API submit or an API/exception failure, the widget shows a **centered toast** with the result message.
|
|
194
194
|
|
|
195
|
-
| Behavior
|
|
196
|
-
|
|
|
197
|
-
| When shown
|
|
198
|
-
| When hidden
|
|
199
|
-
| Auto-close
|
|
200
|
-
| Manual close
|
|
201
|
-
| Success follow-up | Modal closes automatically ~1.2s after success
|
|
195
|
+
| Behavior | Detail |
|
|
196
|
+
| ----------------- | -------------------------------------------------------- |
|
|
197
|
+
| When shown | Submit success, or API / runtime error |
|
|
198
|
+
| When hidden | Missing required fields (only inline field highlighting) |
|
|
199
|
+
| Auto-close | After `toastDuration` ms (default `4000`) |
|
|
200
|
+
| Manual close | User can dismiss via the `×` button |
|
|
201
|
+
| Success follow-up | Modal closes automatically ~1.2s after success |
|
|
202
202
|
|
|
203
203
|
```js
|
|
204
204
|
widget.setConfig({
|
|
@@ -217,53 +217,53 @@ widget.setConfig({
|
|
|
217
217
|
|
|
218
218
|
### Events (Web Component)
|
|
219
219
|
|
|
220
|
-
| Event | When
|
|
221
|
-
| ----------------------- |
|
|
222
|
-
| `np-hub-open` | Modal opens
|
|
223
|
-
| `np-hub-close` | Modal closes
|
|
224
|
-
| `np-hub-submit-success` | API accepted the support request
|
|
225
|
-
| `np-hub-submit-error` | Validation or API failure
|
|
220
|
+
| Event | When |
|
|
221
|
+
| ----------------------- | -------------------------------- |
|
|
222
|
+
| `np-hub-open` | Modal opens |
|
|
223
|
+
| `np-hub-close` | Modal closes |
|
|
224
|
+
| `np-hub-submit-success` | API accepted the support request |
|
|
225
|
+
| `np-hub-submit-error` | Validation or API failure |
|
|
226
226
|
|
|
227
227
|
React equivalent props: `onOpen`, `onClose`, `onSubmitSuccess`, `onSubmitError`.
|
|
228
228
|
|
|
229
229
|
### Methods (Web Component)
|
|
230
230
|
|
|
231
|
-
| Method | Description
|
|
232
|
-
| ---------------------- |
|
|
233
|
-
| `setConfig(config)` | Apply project / API settings
|
|
234
|
-
| `setUser(user)` | Prefill requester fields
|
|
235
|
-
| `setFormPrefill(data)` | Prefill content / attachments
|
|
236
|
-
| `open()` / `close()` | Open or close the modal
|
|
231
|
+
| Method | Description |
|
|
232
|
+
| ---------------------- | ----------------------------- |
|
|
233
|
+
| `setConfig(config)` | Apply project / API settings |
|
|
234
|
+
| `setUser(user)` | Prefill requester fields |
|
|
235
|
+
| `setFormPrefill(data)` | Prefill content / attachments |
|
|
236
|
+
| `open()` / `close()` | Open or close the modal |
|
|
237
237
|
|
|
238
238
|
---
|
|
239
239
|
|
|
240
240
|
## API environments
|
|
241
241
|
|
|
242
|
-
| Environment
|
|
243
|
-
|
|
|
244
|
-
| Production (default)
|
|
245
|
-
| Development (`isDev` / `is-dev`)
|
|
242
|
+
| Environment | Base URL |
|
|
243
|
+
| -------------------------------- | --------------------------------------------- |
|
|
244
|
+
| Production (default) | `https://namphuong-api.azurewebsites.net` |
|
|
245
|
+
| Development (`isDev` / `is-dev`) | `https://namphuong-api-dev.azurewebsites.net` |
|
|
246
246
|
|
|
247
247
|
---
|
|
248
248
|
|
|
249
249
|
## Troubleshooting
|
|
250
250
|
|
|
251
|
-
| Error
|
|
252
|
-
|
|
|
253
|
-
| `projectId cannot be empty.`
|
|
254
|
-
| `user.name/email/phoneNumber is required.`
|
|
255
|
-
| `Content is required.`
|
|
256
|
-
| API call fails in local testing
|
|
251
|
+
| Error | Resolution |
|
|
252
|
+
| ------------------------------------------ | ------------------------------------------------------------------ |
|
|
253
|
+
| `projectId cannot be empty.` | If provided, `projectId` / `project-id` must be a non-empty string |
|
|
254
|
+
| `user.name/email/phoneNumber is required.` | Requester fields are required on submit; `user` only prefills |
|
|
255
|
+
| `Content is required.` | User must enter message content before submit |
|
|
256
|
+
| API call fails in local testing | Set `isDev` / `is-dev` when targeting the Development environment |
|
|
257
257
|
|
|
258
258
|
---
|
|
259
259
|
|
|
260
260
|
## Documentation
|
|
261
261
|
|
|
262
|
-
| Document
|
|
263
|
-
|
|
|
264
|
-
| [Usage (static & React)](./docs/USAGE_STATIC_REACT.md) | Integrators
|
|
265
|
-
| [Developer guide](./docs/DEVELOPER_GUIDE.md)
|
|
266
|
-
| [Public release](./docs/PUBLIC_RELEASE.md)
|
|
262
|
+
| Document | Audience |
|
|
263
|
+
| ------------------------------------------------------ | ------------ |
|
|
264
|
+
| [Usage (static & React)](./docs/USAGE_STATIC_REACT.md) | Integrators |
|
|
265
|
+
| [Developer guide](./docs/DEVELOPER_GUIDE.md) | Contributors |
|
|
266
|
+
| [Public release](./docs/PUBLIC_RELEASE.md) | Maintainers |
|
|
267
267
|
|
|
268
268
|
---
|
|
269
269
|
|