ab-ecosystem-cpass 1.0.11 → 1.0.13
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 +1 -0
- package/dist/client.d.ts +6 -0
- package/dist/client.js +7 -0
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/embedded-signup.d.ts +46 -0
- package/dist/internal/embedded-signup.js +318 -0
- package/dist/internal/embedded-signup.js.map +1 -0
- package/dist/resources/channels/onboarding.d.ts +89 -0
- package/dist/resources/channels/onboarding.js +96 -0
- package/dist/resources/channels/onboarding.js.map +1 -0
- package/dist/types/campaign.d.ts +8 -0
- package/dist/types/channels.d.ts +129 -0
- package/dist/types/channels.js.map +1 -1
- package/docs/audience/canned-replies.md +3 -0
- package/docs/audience/contact-tags.md +4 -0
- package/docs/audience/contacts.md +30 -1
- package/docs/audience/crm-triggers.md +3 -0
- package/docs/audience/custom-fields.md +23 -0
- package/docs/audience/exports.md +6 -0
- package/docs/audience/imports.md +7 -0
- package/docs/audience/notifications.md +11 -0
- package/docs/audience/scheduled-messages.md +5 -0
- package/docs/audience/segments.md +4 -0
- package/docs/audience/webhooks.md +7 -0
- package/docs/campaign/campaigns.md +27 -0
- package/docs/channels/activity.md +3 -0
- package/docs/channels/billing.md +2 -0
- package/docs/channels/channel-props.md +19 -0
- package/docs/channels/channels.md +35 -2
- package/docs/channels/onboarding.md +530 -0
- package/docs/channels/templates.md +22 -0
- package/docs/channels/wallet.md +2 -0
- package/docs/channels/webhooks.md +6 -0
- package/docs/data-store.md +18 -0
- package/docs/inbox/connection.md +88 -0
- package/package.json +1 -1
package/docs/inbox/connection.md
CHANGED
|
@@ -132,6 +132,8 @@ try {
|
|
|
132
132
|
|---|---|---|
|
|
133
133
|
| 401 | `unauthorized` | The handshake's token did not verify. |
|
|
134
134
|
| 403 | `forbidden` | The action is beyond this member's permissions. |
|
|
135
|
+
| 403 | `A403` | The role does not hold the permission the action needs. |
|
|
136
|
+
| 403 | `E403` | The account's plan does not include the feature. `details.feature` names it. |
|
|
135
137
|
| 404 | `not_found` | No such chat or message **for this account**. |
|
|
136
138
|
| 422 | `validation_failed` | Payload rejected. `details` names the fields. |
|
|
137
139
|
| 500 | `internal_error` | Server fault. Nothing further is disclosed. |
|
|
@@ -146,6 +148,29 @@ Every read and write is scoped to the account the token identifies, the same way
|
|
|
146
148
|
the REST contact endpoints are. Quoting another account's chat or message id
|
|
147
149
|
produces `404`, not that account's data.
|
|
148
150
|
|
|
151
|
+
Which account that is depends on who signed in. The token's `act` claim says:
|
|
152
|
+
|
|
153
|
+
| `act` | The account | Who you are |
|
|
154
|
+
|---|---|---|
|
|
155
|
+
| `owner` (or absent) | your own `psuid` | the account holder |
|
|
156
|
+
| `member` | the `accountId` claim | someone the holder granted access to |
|
|
157
|
+
|
|
158
|
+
A member works inside the owner's account — the owner's chats, contacts and
|
|
159
|
+
channels, counted against the owner's plan. How much of it they see is the
|
|
160
|
+
role's `data_scope`:
|
|
161
|
+
|
|
162
|
+
| `data_scope` | Sees |
|
|
163
|
+
|---|---|
|
|
164
|
+
| `own` (or absent) | the chats and contacts assigned to them |
|
|
165
|
+
| `all` | everything in the account |
|
|
166
|
+
|
|
167
|
+
Absent means `own`: a role the server could not read narrows rather than opens.
|
|
168
|
+
Nothing distinguishes an owner from a member in a request — the same events, the
|
|
169
|
+
same payloads — and a chat nobody assigned you simply is not there. A chat
|
|
170
|
+
assigned to nobody at all is the account's, not everybody's, so an `own`-scoped
|
|
171
|
+
member does not see it either; `live_chat.unassigned.*` below is how that is
|
|
172
|
+
granted.
|
|
173
|
+
|
|
149
174
|
## Permissions
|
|
150
175
|
|
|
151
176
|
Visibility inside an account is gated on inbox permissions, not API scopes. An
|
|
@@ -160,6 +185,69 @@ owner or a manager is never gated; a team member needs the permission named.
|
|
|
160
185
|
A team member without these is narrowed to their own chats rather than refused —
|
|
161
186
|
and the reply says so. See [chats.md](https://github.com/udghatan-dev/crm-sdk/blob/main/packages/sdk-js/docs/inbox/chats.md#the-applied-filter).
|
|
162
187
|
|
|
188
|
+
The token carries a `roleId` rather than a list of permissions. The server
|
|
189
|
+
resolves it against the SSO at connect — once per role version, cached — and the
|
|
190
|
+
grants it returns are what the table above is checked against. A role that
|
|
191
|
+
grants none of these names leaves the member in the narrow case: their assigned
|
|
192
|
+
chats, no unassigned queue, no sending as somebody else. So does a role the SSO
|
|
193
|
+
cannot be asked about, which is deliberate — an SSO outage narrows a member, it
|
|
194
|
+
never opens an account.
|
|
195
|
+
|
|
196
|
+
Permissions are read once, at connect. A role edited mid-session takes effect on
|
|
197
|
+
the next reconnect, the same way an upgraded plan does. A member's `role` is
|
|
198
|
+
`team_member` unless the token says `manager`.
|
|
199
|
+
|
|
200
|
+
### Permission keys, per event
|
|
201
|
+
|
|
202
|
+
`CRM.CHAT` governs the inbox, and every event names a verb of it. There is no
|
|
203
|
+
router here, so the check runs in the dispatcher in the position route
|
|
204
|
+
middleware would occupy — before the handler, after the payload is validated.
|
|
205
|
+
|
|
206
|
+
| Event | Key |
|
|
207
|
+
| --- | --- |
|
|
208
|
+
| `contact.list`, `ctwa.list` | `CRM.CHAT.LIST` |
|
|
209
|
+
| `contact.fetch`, `chat_session.list`, `message.list`, `message.fetch`, `message.retry_download` | `CRM.CHAT.READ` |
|
|
210
|
+
| `message.send` | `CRM.CHAT.SEND` |
|
|
211
|
+
| `message.delete` | `CRM.CHAT.DELETE` |
|
|
212
|
+
| `contact.update`, `contact.done`, `contact.bot_assign` | `CRM.CHAT.UPDATE` |
|
|
213
|
+
| `chat.action` | **depends on the action** |
|
|
214
|
+
| `ping` | none — it is a liveness probe |
|
|
215
|
+
|
|
216
|
+
`chat.action` carries thirteen actions under one event name, and they are not one
|
|
217
|
+
capability: `transfer` and `bulk_transfer` need `CRM.CHAT.TRANSFER`, `delete`
|
|
218
|
+
needs `CRM.CHAT.DELETE`, and the state changes — archive, unarchive, close, done,
|
|
219
|
+
block, mark read/unread, pause/resume automation, pause timer — need
|
|
220
|
+
`CRM.CHAT.UPDATE`. The key is resolved from the validated payload, so a client
|
|
221
|
+
that may archive but not delete gets `A403` on the second and nothing changes.
|
|
222
|
+
|
|
223
|
+
`contact.bot_assign` is `UPDATE`, not `ASSIGN`: it hands a conversation to
|
|
224
|
+
automation rather than to a colleague, and the catalogue's `ASSIGN` implies
|
|
225
|
+
`TEAM.LIST` because choosing a person means seeing the team.
|
|
226
|
+
|
|
227
|
+
A refusal arrives as the same `A403` / `E403` the REST API returns, in the
|
|
228
|
+
acknowledgement callback and as an `error` emit.
|
|
229
|
+
|
|
230
|
+
### `live_chat.*` is a separate, older vocabulary
|
|
231
|
+
|
|
232
|
+
The three permissions in the table above this section are **not in the SSO's
|
|
233
|
+
catalogue**. A role can only grant what the catalogue publishes, so nothing can
|
|
234
|
+
currently grant `live_chat.unassigned.ALL` — the way to give a member the whole
|
|
235
|
+
account's inbox is `data_scope: all` on their role, which `CRM.CHAT` is marked
|
|
236
|
+
**scopable** for. The three names are kept because the inbox still checks them.
|
|
237
|
+
|
|
238
|
+
### Two different refusals
|
|
239
|
+
|
|
240
|
+
Beyond the inbox's own visibility rules, an action can be refused for either of
|
|
241
|
+
two reasons, and the codes are distinct because the answers are:
|
|
242
|
+
|
|
243
|
+
- **`A403`** — the role does not hold the permission. Ask the account owner.
|
|
244
|
+
- **`E403`** — the account's plan does not cover the feature. Upgrade.
|
|
245
|
+
`details.feature` names the feature, so the client can say which.
|
|
246
|
+
|
|
247
|
+
An owner is never refused for `A403` — there is no role to check them against —
|
|
248
|
+
but an owner *is* refused for `E403`: a feature outside the plan is outside it
|
|
249
|
+
for everybody on the account.
|
|
250
|
+
|
|
163
251
|
## Modules
|
|
164
252
|
|
|
165
253
|
| Page | Actions |
|