@opens/gateways 1.16.24 → 1.17.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.
@@ -1,3 +1,5 @@
1
+ export { C as CreateScreenRuleDTO, a as ScreenRuleBodyComponent, S as ScreenRuleHeaderComponent } from '../../_screen-rule-FlIJzVXA.js';
2
+
1
3
  /** Available provider options in the Chat Config API. */
2
4
  type ProviderName = 'whatsapp' | 'gmail' | 'outlook' | 'messenger' | 'direct' | 'yunique';
3
5
  interface Provider {
@@ -151,43 +153,84 @@ interface ProviderDisplayInfoResponse {
151
153
  channel: string | null;
152
154
  }
153
155
 
154
- /** A provider entity nested within a configuration response. */
156
+ /**
157
+ * Provider entity nested in `GET /config/provider/:providerId` via the
158
+ * Sequelize association `providers` (`Configs.belongsTo(Providers)`).
159
+ * `id` is the integer primary key of the `Providers` table.
160
+ */
155
161
  interface ConfigProvider {
156
- id: string;
162
+ /** Provider primary key (`Providers.id`, integer). */
163
+ id: number | string;
164
+ /** Provider name (e.g. `whatsapp`, `gmail`, `outlook`, `messenger`, `direct`, `yunique`). */
157
165
  name: string;
166
+ /** Provider channel type (e.g. `chat`, `email`). */
158
167
  type: string;
168
+ /** Default session TTL in seconds. */
159
169
  defaultSession: number;
170
+ /** JSON schema describing provider-specific `configurations` fields, when available. */
160
171
  configurationsSchema: Record<string, unknown> | null;
161
172
  createdAt: string;
162
173
  updatedAt: string;
163
174
  }
164
- /** A configuration entity returned by the Chat Config API. */
175
+ /**
176
+ * A configuration row from the `Configs` table.
177
+ * Returned by `GET /config/:configId` and inside
178
+ * `GET /config/provider/:providerId` (`{ configurations: Config[] }`).
179
+ * When listed by provider, each item includes the nested `providers` association.
180
+ */
165
181
  interface Config {
182
+ /** Configuration UUID (`Configs.id`). */
166
183
  id: string;
167
184
  isAssistanceEnabled: boolean;
168
185
  rewind: number | null;
186
+ /** Company UUID resolved from the auth token on list-by-provider. */
169
187
  companyId: string;
170
188
  active: boolean;
189
+ /** Provider-specific settings JSON (shape varies by provider). */
171
190
  configurations: Record<string, unknown>;
172
191
  priority: number | null;
192
+ /** Foreign key to `Providers.id`. */
193
+ providerId: number | string;
173
194
  inbound: boolean;
174
195
  outbound: boolean;
175
196
  deletedAt: string | null;
197
+ csatConditionalRulesEnabled: boolean;
198
+ csatFeedbackTTL: number | null;
199
+ createdAt: string;
200
+ updatedAt: string;
201
+ /** Nested provider loaded by `GET /config/provider/:providerId`. */
176
202
  providers: ConfigProvider;
177
203
  }
178
- /** Response returned by the Chat Config API when listing configurations by provider. */
204
+ /**
205
+ * Response of `GET /config/provider/:providerId`.
206
+ * Always wrapped as `{ configurations }` (empty array when none match).
207
+ */
179
208
  interface ConfigListByProviderResponse {
180
209
  configurations: Config[];
181
210
  }
182
- /** Query parameters for filtering configurations by provider. */
211
+ /**
212
+ * Optional query filters for `GET /config/provider/:providerId`.
213
+ * Filters map to `Configs` columns, except `providerType` / `providerName`
214
+ * which filter the nested `providers` association (`type` / `name`).
215
+ * The backend applies filters with truthiness checks, so `false` / `0` values
216
+ * are ignored and do not filter.
217
+ */
183
218
  interface GetConfigsByProviderParams {
219
+ /** Filter by `Configs.isAssistanceEnabled`. */
184
220
  isAssistanceEnabled?: boolean;
221
+ /** Filter by `Configs.rewind`. */
185
222
  rewind?: number;
223
+ /** Filter by `Configs.active`. */
186
224
  active?: boolean;
225
+ /** Filter by `Configs.priority`. */
187
226
  priority?: number;
227
+ /** Filter by `Configs.inbound` (e.g. inbound WhatsApp channels). */
188
228
  inbound?: boolean;
229
+ /** Filter by `Configs.outbound`. */
189
230
  outbound?: boolean;
231
+ /** Filter by nested `providers.type` (e.g. `chat`, `email`). */
190
232
  providerType?: string;
233
+ /** Filter by nested `providers.name` (e.g. `whatsapp`). */
191
234
  providerName?: string;
192
235
  }
193
236
 
@@ -0,0 +1,25 @@
1
+ import { C as CreateScreenRuleDTO } from '../../_screen-rule-FlIJzVXA.mjs';
2
+
3
+ /** Value object representing a complete screen-rule payload. */
4
+ declare class ScreenRuleVO {
5
+ readonly payload: CreateScreenRuleDTO;
6
+ /**
7
+ * Creates a screen-rule value object from a complete payload.
8
+ * @param payload - The screen-rule payload to snapshot.
9
+ */
10
+ constructor(payload: CreateScreenRuleDTO);
11
+ /**
12
+ * Creates a value object from its JSON representation.
13
+ * @param payload - The screen-rule JSON payload.
14
+ * @returns A screen-rule value object containing a defensive snapshot.
15
+ */
16
+ static fromJSON(payload: CreateScreenRuleDTO): ScreenRuleVO;
17
+ /**
18
+ * Converts a screen-rule value object to JSON.
19
+ * @param screenRuleVO - The screen-rule value object to serialize.
20
+ * @returns A defensive copy of the screen-rule payload.
21
+ */
22
+ static toJSON(screenRuleVO: ScreenRuleVO): CreateScreenRuleDTO;
23
+ }
24
+
25
+ export { ScreenRuleVO };
@@ -0,0 +1,25 @@
1
+ import { C as CreateScreenRuleDTO } from '../../_screen-rule-FlIJzVXA.js';
2
+
3
+ /** Value object representing a complete screen-rule payload. */
4
+ declare class ScreenRuleVO {
5
+ readonly payload: CreateScreenRuleDTO;
6
+ /**
7
+ * Creates a screen-rule value object from a complete payload.
8
+ * @param payload - The screen-rule payload to snapshot.
9
+ */
10
+ constructor(payload: CreateScreenRuleDTO);
11
+ /**
12
+ * Creates a value object from its JSON representation.
13
+ * @param payload - The screen-rule JSON payload.
14
+ * @returns A screen-rule value object containing a defensive snapshot.
15
+ */
16
+ static fromJSON(payload: CreateScreenRuleDTO): ScreenRuleVO;
17
+ /**
18
+ * Converts a screen-rule value object to JSON.
19
+ * @param screenRuleVO - The screen-rule value object to serialize.
20
+ * @returns A defensive copy of the screen-rule payload.
21
+ */
22
+ static toJSON(screenRuleVO: ScreenRuleVO): CreateScreenRuleDTO;
23
+ }
24
+
25
+ export { ScreenRuleVO };
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/chat-config/value-objects/index.ts
21
+ var value_objects_exports = {};
22
+ __export(value_objects_exports, {
23
+ ScreenRuleVO: () => ScreenRuleVO
24
+ });
25
+ module.exports = __toCommonJS(value_objects_exports);
26
+
27
+ // src/chat-config/value-objects/_screen-rule.ts
28
+ var clonePayload = (payload) => ({
29
+ name: payload.name,
30
+ action: "screen",
31
+ settings: {
32
+ ...payload.settings.header !== void 0 ? { header: { ...payload.settings.header } } : {},
33
+ ...payload.settings.body !== void 0 ? { body: { ...payload.settings.body } } : {}
34
+ }
35
+ });
36
+ var ScreenRuleVO = class _ScreenRuleVO {
37
+ payload;
38
+ /**
39
+ * Creates a screen-rule value object from a complete payload.
40
+ * @param payload - The screen-rule payload to snapshot.
41
+ */
42
+ constructor(payload) {
43
+ this.payload = clonePayload(payload);
44
+ }
45
+ /**
46
+ * Creates a value object from its JSON representation.
47
+ * @param payload - The screen-rule JSON payload.
48
+ * @returns A screen-rule value object containing a defensive snapshot.
49
+ */
50
+ static fromJSON(payload) {
51
+ return new _ScreenRuleVO(payload);
52
+ }
53
+ /**
54
+ * Converts a screen-rule value object to JSON.
55
+ * @param screenRuleVO - The screen-rule value object to serialize.
56
+ * @returns A defensive copy of the screen-rule payload.
57
+ */
58
+ static toJSON(screenRuleVO) {
59
+ return clonePayload(screenRuleVO.payload);
60
+ }
61
+ };
62
+ // Annotate the CommonJS export names for ESM import in node:
63
+ 0 && (module.exports = {
64
+ ScreenRuleVO
65
+ });
66
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/chat-config/value-objects/index.ts","../../../src/chat-config/value-objects/_screen-rule.ts"],"sourcesContent":["export * from './_screen-rule';\n","import type { CreateScreenRuleDTO } from '../contracts';\n\nconst clonePayload = (payload: CreateScreenRuleDTO): CreateScreenRuleDTO => ({\n name: payload.name,\n action: 'screen',\n settings: {\n ...(payload.settings.header !== undefined ? { header: { ...payload.settings.header } } : {}),\n ...(payload.settings.body !== undefined ? { body: { ...payload.settings.body } } : {}),\n },\n});\n\n/** Value object representing a complete screen-rule payload. */\nexport class ScreenRuleVO {\n readonly payload: CreateScreenRuleDTO;\n\n /**\n * Creates a screen-rule value object from a complete payload.\n * @param payload - The screen-rule payload to snapshot.\n */\n constructor(payload: CreateScreenRuleDTO) {\n this.payload = clonePayload(payload);\n }\n\n /**\n * Creates a value object from its JSON representation.\n * @param payload - The screen-rule JSON payload.\n * @returns A screen-rule value object containing a defensive snapshot.\n */\n static fromJSON(payload: CreateScreenRuleDTO): ScreenRuleVO {\n return new ScreenRuleVO(payload);\n }\n\n /**\n * Converts a screen-rule value object to JSON.\n * @param screenRuleVO - The screen-rule value object to serialize.\n * @returns A defensive copy of the screen-rule payload.\n */\n static toJSON(screenRuleVO: ScreenRuleVO): CreateScreenRuleDTO {\n return clonePayload(screenRuleVO.payload);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,IAAM,eAAe,CAAC,aAAuD;AAAA,EAC3E,MAAM,QAAQ;AAAA,EACd,QAAQ;AAAA,EACR,UAAU;AAAA,IACR,GAAI,QAAQ,SAAS,WAAW,SAAY,EAAE,QAAQ,EAAE,GAAG,QAAQ,SAAS,OAAO,EAAE,IAAI,CAAC;AAAA,IAC1F,GAAI,QAAQ,SAAS,SAAS,SAAY,EAAE,MAAM,EAAE,GAAG,QAAQ,SAAS,KAAK,EAAE,IAAI,CAAC;AAAA,EACtF;AACF;AAGO,IAAM,eAAN,MAAM,cAAa;AAAA,EACf;AAAA;AAAA;AAAA;AAAA;AAAA,EAMT,YAAY,SAA8B;AACxC,SAAK,UAAU,aAAa,OAAO;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,SAAS,SAA4C;AAC1D,WAAO,IAAI,cAAa,OAAO;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,OAAO,cAAiD;AAC7D,WAAO,aAAa,aAAa,OAAO;AAAA,EAC1C;AACF;","names":[]}
@@ -0,0 +1,39 @@
1
+ // src/chat-config/value-objects/_screen-rule.ts
2
+ var clonePayload = (payload) => ({
3
+ name: payload.name,
4
+ action: "screen",
5
+ settings: {
6
+ ...payload.settings.header !== void 0 ? { header: { ...payload.settings.header } } : {},
7
+ ...payload.settings.body !== void 0 ? { body: { ...payload.settings.body } } : {}
8
+ }
9
+ });
10
+ var ScreenRuleVO = class _ScreenRuleVO {
11
+ payload;
12
+ /**
13
+ * Creates a screen-rule value object from a complete payload.
14
+ * @param payload - The screen-rule payload to snapshot.
15
+ */
16
+ constructor(payload) {
17
+ this.payload = clonePayload(payload);
18
+ }
19
+ /**
20
+ * Creates a value object from its JSON representation.
21
+ * @param payload - The screen-rule JSON payload.
22
+ * @returns A screen-rule value object containing a defensive snapshot.
23
+ */
24
+ static fromJSON(payload) {
25
+ return new _ScreenRuleVO(payload);
26
+ }
27
+ /**
28
+ * Converts a screen-rule value object to JSON.
29
+ * @param screenRuleVO - The screen-rule value object to serialize.
30
+ * @returns A defensive copy of the screen-rule payload.
31
+ */
32
+ static toJSON(screenRuleVO) {
33
+ return clonePayload(screenRuleVO.payload);
34
+ }
35
+ };
36
+ export {
37
+ ScreenRuleVO
38
+ };
39
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/chat-config/value-objects/_screen-rule.ts"],"sourcesContent":["import type { CreateScreenRuleDTO } from '../contracts';\n\nconst clonePayload = (payload: CreateScreenRuleDTO): CreateScreenRuleDTO => ({\n name: payload.name,\n action: 'screen',\n settings: {\n ...(payload.settings.header !== undefined ? { header: { ...payload.settings.header } } : {}),\n ...(payload.settings.body !== undefined ? { body: { ...payload.settings.body } } : {}),\n },\n});\n\n/** Value object representing a complete screen-rule payload. */\nexport class ScreenRuleVO {\n readonly payload: CreateScreenRuleDTO;\n\n /**\n * Creates a screen-rule value object from a complete payload.\n * @param payload - The screen-rule payload to snapshot.\n */\n constructor(payload: CreateScreenRuleDTO) {\n this.payload = clonePayload(payload);\n }\n\n /**\n * Creates a value object from its JSON representation.\n * @param payload - The screen-rule JSON payload.\n * @returns A screen-rule value object containing a defensive snapshot.\n */\n static fromJSON(payload: CreateScreenRuleDTO): ScreenRuleVO {\n return new ScreenRuleVO(payload);\n }\n\n /**\n * Converts a screen-rule value object to JSON.\n * @param screenRuleVO - The screen-rule value object to serialize.\n * @returns A defensive copy of the screen-rule payload.\n */\n static toJSON(screenRuleVO: ScreenRuleVO): CreateScreenRuleDTO {\n return clonePayload(screenRuleVO.payload);\n }\n}\n"],"mappings":";AAEA,IAAM,eAAe,CAAC,aAAuD;AAAA,EAC3E,MAAM,QAAQ;AAAA,EACd,QAAQ;AAAA,EACR,UAAU;AAAA,IACR,GAAI,QAAQ,SAAS,WAAW,SAAY,EAAE,QAAQ,EAAE,GAAG,QAAQ,SAAS,OAAO,EAAE,IAAI,CAAC;AAAA,IAC1F,GAAI,QAAQ,SAAS,SAAS,SAAY,EAAE,MAAM,EAAE,GAAG,QAAQ,SAAS,KAAK,EAAE,IAAI,CAAC;AAAA,EACtF;AACF;AAGO,IAAM,eAAN,MAAM,cAAa;AAAA,EACf;AAAA;AAAA;AAAA;AAAA;AAAA,EAMT,YAAY,SAA8B;AACxC,SAAK,UAAU,aAAa,OAAO;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,SAAS,SAA4C;AAC1D,WAAO,IAAI,cAAa,OAAO;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,OAAO,cAAiD;AAC7D,WAAO,aAAa,aAAa,OAAO;AAAA,EAC1C;AACF;","names":[]}
package/dist/index.d.mts CHANGED
@@ -26,6 +26,7 @@ export { AccessGroup, AccessPackageGroup } from './access-hub/contracts/index.mj
26
26
  import { GetSystemNotificationsParams, GetSystemNotificationsResponse, GetUserDevicesParams, GetUserDevicesResponse, RegisterUserDeviceRequest, RegisterUserDeviceResponse, DeleteUserDeviceResponse, GetUserPreferencesParams, UserPreference, CreateUserPreferenceRequest, DeleteUserPreferenceParams, DeleteUserPreferenceResponse } from './notifications/contracts/index.mjs';
27
27
  export { DeviceType, SystemNotification, SystemNotificationType, UserDevice, UserPreferenceDevice, UserPreferenceSystemNotification } from './notifications/contracts/index.mjs';
28
28
  export { Event } from './rh/contracts/index.mjs';
29
+ export { C as CreateScreenRuleDTO, a as ScreenRuleBodyComponent, S as ScreenRuleHeaderComponent } from './_screen-rule-FlIJzVXA.mjs';
29
30
 
30
31
  /**
31
32
  * Gateway for interacting with the Customer Service API.
@@ -270,12 +271,14 @@ declare class ChatConfigGateway {
270
271
  */
271
272
  getProviderDisplayInfo(params: GetProviderDisplayInfoParams): Promise<ProviderDisplayInfoResponse>;
272
273
  /**
273
- * Retrieves configurations filtered by provider.
274
- * @param providerId - The unique identifier of the provider.
275
- * @param params - Optional query parameters for filtering configurations.
276
- * @returns The configurations for the given provider.
274
+ * Lists configurations for a provider (`GET /config/provider/:providerId`).
275
+ * Scoped to the authenticated company's `companyId` from the token.
276
+ * Each item includes the nested `providers` association.
277
+ * @param providerId - Provider primary key (`Providers.id`, e.g. `1` for WhatsApp).
278
+ * @param params - Optional filters on config columns and nested provider fields.
279
+ * @returns `{ configurations }` for the given provider (empty array when none match).
277
280
  */
278
- getConfigsByProvider(providerId: string, params?: GetConfigsByProviderParams): Promise<ConfigListByProviderResponse>;
281
+ getConfigsByProvider(providerId: string | number, params?: GetConfigsByProviderParams): Promise<ConfigListByProviderResponse>;
279
282
  /**
280
283
  * Retrieves a queue by its ID.
281
284
  * @param queueId - The unique identifier of the queue.
package/dist/index.d.ts CHANGED
@@ -26,6 +26,7 @@ export { AccessGroup, AccessPackageGroup } from './access-hub/contracts/index.js
26
26
  import { GetSystemNotificationsParams, GetSystemNotificationsResponse, GetUserDevicesParams, GetUserDevicesResponse, RegisterUserDeviceRequest, RegisterUserDeviceResponse, DeleteUserDeviceResponse, GetUserPreferencesParams, UserPreference, CreateUserPreferenceRequest, DeleteUserPreferenceParams, DeleteUserPreferenceResponse } from './notifications/contracts/index.js';
27
27
  export { DeviceType, SystemNotification, SystemNotificationType, UserDevice, UserPreferenceDevice, UserPreferenceSystemNotification } from './notifications/contracts/index.js';
28
28
  export { Event } from './rh/contracts/index.js';
29
+ export { C as CreateScreenRuleDTO, a as ScreenRuleBodyComponent, S as ScreenRuleHeaderComponent } from './_screen-rule-FlIJzVXA.js';
29
30
 
30
31
  /**
31
32
  * Gateway for interacting with the Customer Service API.
@@ -270,12 +271,14 @@ declare class ChatConfigGateway {
270
271
  */
271
272
  getProviderDisplayInfo(params: GetProviderDisplayInfoParams): Promise<ProviderDisplayInfoResponse>;
272
273
  /**
273
- * Retrieves configurations filtered by provider.
274
- * @param providerId - The unique identifier of the provider.
275
- * @param params - Optional query parameters for filtering configurations.
276
- * @returns The configurations for the given provider.
274
+ * Lists configurations for a provider (`GET /config/provider/:providerId`).
275
+ * Scoped to the authenticated company's `companyId` from the token.
276
+ * Each item includes the nested `providers` association.
277
+ * @param providerId - Provider primary key (`Providers.id`, e.g. `1` for WhatsApp).
278
+ * @param params - Optional filters on config columns and nested provider fields.
279
+ * @returns `{ configurations }` for the given provider (empty array when none match).
277
280
  */
278
- getConfigsByProvider(providerId: string, params?: GetConfigsByProviderParams): Promise<ConfigListByProviderResponse>;
281
+ getConfigsByProvider(providerId: string | number, params?: GetConfigsByProviderParams): Promise<ConfigListByProviderResponse>;
279
282
  /**
280
283
  * Retrieves a queue by its ID.
281
284
  * @param queueId - The unique identifier of the queue.
package/dist/index.js CHANGED
@@ -460,10 +460,12 @@ var ChatConfigGateway = class {
460
460
  return data;
461
461
  }
462
462
  /**
463
- * Retrieves configurations filtered by provider.
464
- * @param providerId - The unique identifier of the provider.
465
- * @param params - Optional query parameters for filtering configurations.
466
- * @returns The configurations for the given provider.
463
+ * Lists configurations for a provider (`GET /config/provider/:providerId`).
464
+ * Scoped to the authenticated company's `companyId` from the token.
465
+ * Each item includes the nested `providers` association.
466
+ * @param providerId - Provider primary key (`Providers.id`, e.g. `1` for WhatsApp).
467
+ * @param params - Optional filters on config columns and nested provider fields.
468
+ * @returns `{ configurations }` for the given provider (empty array when none match).
467
469
  */
468
470
  async getConfigsByProvider(providerId, params) {
469
471
  const { data } = await this.httpClient.get(