@oursprivacy/platform-sdk 1.47.0 → 1.48.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.
@@ -2,13 +2,257 @@ import { APIResource } from "../core/resource.js";
2
2
  import { APIPromise } from "../core/api-promise.js";
3
3
  import { RequestOptions } from "../internal/request-options.js";
4
4
  export declare class TranslationWidgets extends APIResource {
5
+ /**
6
+ * List every translation widget configured on the account, including the domains
7
+ * it runs on, its appearance settings, and the languages it offers. Not paginated
8
+ * — widgets are capped by the account's translation widget limit. Requires scope:
9
+ * translationWidget:list
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const translationWidgets =
14
+ * await client.translationWidgets.list();
15
+ * ```
16
+ */
17
+ list(options?: RequestOptions): APIPromise<TranslationWidgetListResponse>;
18
+ /**
19
+ * Create a translation widget. Every field is optional — anything omitted comes
20
+ * back as `null` and the widget falls back to its built-in appearance, and
21
+ * omitting `enabledLanguages` offers every supported language. Returns the full
22
+ * widget, including its id, so it can be installed without a follow-up request.
23
+ * Requires scope: translationWidget:create
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * const translationWidget =
28
+ * await client.translationWidgets.create();
29
+ * ```
30
+ */
31
+ create(body: TranslationWidgetCreateParams, options?: RequestOptions): APIPromise<TranslationWidgetCreateResponse>;
32
+ /**
33
+ * Fetch one translation widget by its id. Returns 404 when it does not exist.
34
+ * Requires scope: translationWidget:find
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const translationWidget =
39
+ * await client.translationWidgets.retrieve(
40
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
41
+ * );
42
+ * ```
43
+ */
44
+ retrieve(id: string, options?: RequestOptions): APIPromise<TranslationWidgetRetrieveResponse>;
5
45
  /**
6
46
  * Return usage totals and language, host, and page breakdowns for one translation
7
47
  * widget over the requested date range. Requires scope:
8
48
  * report:translation-analytics
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * const response = await client.translationWidgets.analytics(
53
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
54
+ * { from: '2019-12-27', to: '2019-12-27' },
55
+ * );
56
+ * ```
9
57
  */
10
58
  analytics(id: string, query: TranslationWidgetAnalyticsParams, options?: RequestOptions): APIPromise<TranslationWidgetAnalyticsResponse>;
11
59
  }
60
+ export interface TranslationWidgetListResponse {
61
+ /**
62
+ * Every translation widget on the account. Not paginated — widgets are capped by
63
+ * the account's translation widget limit, so the full set always fits in one
64
+ * response.
65
+ */
66
+ entities: Array<TranslationWidgetListResponse.Entity>;
67
+ }
68
+ export declare namespace TranslationWidgetListResponse {
69
+ interface Entity {
70
+ /**
71
+ * Unique identifier for the translation widget.
72
+ */
73
+ id: string;
74
+ /**
75
+ * ISO-8601 timestamp when the widget was created.
76
+ */
77
+ createdAt: string;
78
+ /**
79
+ * Accent colour for the widget button and modal, as a hex value — `#RGB`,
80
+ * `#RRGGBB`, or `#RRGGBBAA`.
81
+ */
82
+ brandColor?: string | null;
83
+ /**
84
+ * Custom domain used to serve the widget script (e.g. `translate.example.com`).
85
+ * Leave null to use the default Ours Privacy domain. Send the bare host — no
86
+ * scheme, port, or path.
87
+ */
88
+ customDomain?: string | null;
89
+ /**
90
+ * Languages offered in the widget, as ISO codes such as `en`, `es`, `fr`, `zh-TW`.
91
+ * Omit or send an empty array to offer every supported language. An unrecognised
92
+ * code is rejected with 400 rather than silently ignored.
93
+ */
94
+ enabledLanguages?: Array<string> | null;
95
+ /**
96
+ * Layout of the language-selection modal: `standard` list, `grid` of languages, or
97
+ * a `dropdown`.
98
+ */
99
+ modalVariant?: 'standard' | 'grid' | 'dropdown' | null;
100
+ /**
101
+ * Terms the widget keeps in their original form in every language — brand names,
102
+ * product names, and the like. Up to 500 terms of 200 characters each; duplicates
103
+ * and purely numeric terms are dropped.
104
+ */
105
+ noTranslateTerms?: Array<string> | null;
106
+ /**
107
+ * Corner of the viewport the widget button is anchored to.
108
+ */
109
+ position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | null;
110
+ /**
111
+ * Colour scheme the widget renders in.
112
+ */
113
+ theme?: 'light' | 'dark' | null;
114
+ /**
115
+ * ISO-8601 timestamp of the most recent change. Matches `createdAt` on a widget
116
+ * that has never been edited.
117
+ */
118
+ updatedAt?: string | null;
119
+ /**
120
+ * Domains where this widget is allowed to run. The widget refuses to load anywhere
121
+ * else, so a missing host means the widget never appears. Send bare hosts — no
122
+ * scheme, port, or path.
123
+ */
124
+ whitelistedDomains?: Array<string> | null;
125
+ /**
126
+ * Visual style of the widget button: `compact` for an icon-sized button,
127
+ * `extended` for a labelled button, `minimal` for the least intrusive treatment.
128
+ */
129
+ widgetVariant?: 'compact' | 'extended' | 'minimal' | null;
130
+ }
131
+ }
132
+ export interface TranslationWidgetCreateResponse {
133
+ /**
134
+ * Unique identifier for the translation widget.
135
+ */
136
+ id: string;
137
+ /**
138
+ * ISO-8601 timestamp when the widget was created.
139
+ */
140
+ createdAt: string;
141
+ /**
142
+ * Accent colour for the widget button and modal, as a hex value — `#RGB`,
143
+ * `#RRGGBB`, or `#RRGGBBAA`.
144
+ */
145
+ brandColor?: string | null;
146
+ /**
147
+ * Custom domain used to serve the widget script (e.g. `translate.example.com`).
148
+ * Leave null to use the default Ours Privacy domain. Send the bare host — no
149
+ * scheme, port, or path.
150
+ */
151
+ customDomain?: string | null;
152
+ /**
153
+ * Languages offered in the widget, as ISO codes such as `en`, `es`, `fr`, `zh-TW`.
154
+ * Omit or send an empty array to offer every supported language. An unrecognised
155
+ * code is rejected with 400 rather than silently ignored.
156
+ */
157
+ enabledLanguages?: Array<string> | null;
158
+ /**
159
+ * Layout of the language-selection modal: `standard` list, `grid` of languages, or
160
+ * a `dropdown`.
161
+ */
162
+ modalVariant?: 'standard' | 'grid' | 'dropdown' | null;
163
+ /**
164
+ * Terms the widget keeps in their original form in every language — brand names,
165
+ * product names, and the like. Up to 500 terms of 200 characters each; duplicates
166
+ * and purely numeric terms are dropped.
167
+ */
168
+ noTranslateTerms?: Array<string> | null;
169
+ /**
170
+ * Corner of the viewport the widget button is anchored to.
171
+ */
172
+ position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | null;
173
+ /**
174
+ * Colour scheme the widget renders in.
175
+ */
176
+ theme?: 'light' | 'dark' | null;
177
+ /**
178
+ * ISO-8601 timestamp of the most recent change. Matches `createdAt` on a widget
179
+ * that has never been edited.
180
+ */
181
+ updatedAt?: string | null;
182
+ /**
183
+ * Domains where this widget is allowed to run. The widget refuses to load anywhere
184
+ * else, so a missing host means the widget never appears. Send bare hosts — no
185
+ * scheme, port, or path.
186
+ */
187
+ whitelistedDomains?: Array<string> | null;
188
+ /**
189
+ * Visual style of the widget button: `compact` for an icon-sized button,
190
+ * `extended` for a labelled button, `minimal` for the least intrusive treatment.
191
+ */
192
+ widgetVariant?: 'compact' | 'extended' | 'minimal' | null;
193
+ }
194
+ export interface TranslationWidgetRetrieveResponse {
195
+ /**
196
+ * Unique identifier for the translation widget.
197
+ */
198
+ id: string;
199
+ /**
200
+ * ISO-8601 timestamp when the widget was created.
201
+ */
202
+ createdAt: string;
203
+ /**
204
+ * Accent colour for the widget button and modal, as a hex value — `#RGB`,
205
+ * `#RRGGBB`, or `#RRGGBBAA`.
206
+ */
207
+ brandColor?: string | null;
208
+ /**
209
+ * Custom domain used to serve the widget script (e.g. `translate.example.com`).
210
+ * Leave null to use the default Ours Privacy domain. Send the bare host — no
211
+ * scheme, port, or path.
212
+ */
213
+ customDomain?: string | null;
214
+ /**
215
+ * Languages offered in the widget, as ISO codes such as `en`, `es`, `fr`, `zh-TW`.
216
+ * Omit or send an empty array to offer every supported language. An unrecognised
217
+ * code is rejected with 400 rather than silently ignored.
218
+ */
219
+ enabledLanguages?: Array<string> | null;
220
+ /**
221
+ * Layout of the language-selection modal: `standard` list, `grid` of languages, or
222
+ * a `dropdown`.
223
+ */
224
+ modalVariant?: 'standard' | 'grid' | 'dropdown' | null;
225
+ /**
226
+ * Terms the widget keeps in their original form in every language — brand names,
227
+ * product names, and the like. Up to 500 terms of 200 characters each; duplicates
228
+ * and purely numeric terms are dropped.
229
+ */
230
+ noTranslateTerms?: Array<string> | null;
231
+ /**
232
+ * Corner of the viewport the widget button is anchored to.
233
+ */
234
+ position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | null;
235
+ /**
236
+ * Colour scheme the widget renders in.
237
+ */
238
+ theme?: 'light' | 'dark' | null;
239
+ /**
240
+ * ISO-8601 timestamp of the most recent change. Matches `createdAt` on a widget
241
+ * that has never been edited.
242
+ */
243
+ updatedAt?: string | null;
244
+ /**
245
+ * Domains where this widget is allowed to run. The widget refuses to load anywhere
246
+ * else, so a missing host means the widget never appears. Send bare hosts — no
247
+ * scheme, port, or path.
248
+ */
249
+ whitelistedDomains?: Array<string> | null;
250
+ /**
251
+ * Visual style of the widget button: `compact` for an icon-sized button,
252
+ * `extended` for a labelled button, `minimal` for the least intrusive treatment.
253
+ */
254
+ widgetVariant?: 'compact' | 'extended' | 'minimal' | null;
255
+ }
12
256
  export interface TranslationWidgetAnalyticsResponse {
13
257
  byHost: Array<TranslationWidgetAnalyticsResponse.ByHost>;
14
258
  byLanguage: Array<TranslationWidgetAnalyticsResponse.ByLanguage>;
@@ -42,6 +286,55 @@ export declare namespace TranslationWidgetAnalyticsResponse {
42
286
  }
43
287
  }
44
288
  }
289
+ export interface TranslationWidgetCreateParams {
290
+ /**
291
+ * Accent colour for the widget button and modal, as a hex value — `#RGB`,
292
+ * `#RRGGBB`, or `#RRGGBBAA`.
293
+ */
294
+ brandColor?: string | null;
295
+ /**
296
+ * Custom domain used to serve the widget script (e.g. `translate.example.com`).
297
+ * Leave null to use the default Ours Privacy domain. Send the bare host — no
298
+ * scheme, port, or path.
299
+ */
300
+ customDomain?: string | null;
301
+ /**
302
+ * Languages offered in the widget, as ISO codes such as `en`, `es`, `fr`, `zh-TW`.
303
+ * Omit or send an empty array to offer every supported language. An unrecognised
304
+ * code is rejected with 400 rather than silently ignored.
305
+ */
306
+ enabledLanguages?: Array<'af' | 'sq' | 'am' | 'ar' | 'hy' | 'az' | 'bn' | 'bs' | 'bg' | 'ca' | 'zh' | 'zh-TW' | 'hr' | 'cs' | 'da' | 'fa-AF' | 'nl' | 'en' | 'et' | 'fa' | 'tl' | 'fi' | 'fr' | 'fr-CA' | 'ka' | 'de' | 'el' | 'gu' | 'ht' | 'ha' | 'he' | 'hi' | 'hu' | 'is' | 'id' | 'ga' | 'it' | 'ja' | 'kn' | 'kk' | 'ko' | 'lv' | 'lt' | 'mk' | 'ms' | 'ml' | 'mt' | 'mr' | 'mn' | 'no' | 'ps' | 'pl' | 'pt' | 'pt-PT' | 'pa' | 'ro' | 'ru' | 'sr' | 'si' | 'sk' | 'sl' | 'so' | 'es' | 'es-MX' | 'sw' | 'sv' | 'ta' | 'te' | 'th' | 'tr' | 'uk' | 'ur' | 'uz' | 'vi' | 'cy'> | null;
307
+ /**
308
+ * Layout of the language-selection modal: `standard` list, `grid` of languages, or
309
+ * a `dropdown`.
310
+ */
311
+ modalVariant?: 'standard' | 'grid' | 'dropdown';
312
+ /**
313
+ * Terms the widget keeps in their original form in every language — brand names,
314
+ * product names, and the like. Up to 500 terms of 200 characters each; duplicates
315
+ * and purely numeric terms are dropped.
316
+ */
317
+ noTranslateTerms?: Array<string> | null;
318
+ /**
319
+ * Corner of the viewport the widget button is anchored to.
320
+ */
321
+ position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
322
+ /**
323
+ * Colour scheme the widget renders in.
324
+ */
325
+ theme?: 'light' | 'dark';
326
+ /**
327
+ * Domains where this widget is allowed to run. The widget refuses to load anywhere
328
+ * else, so a missing host means the widget never appears. Send bare hosts — no
329
+ * scheme, port, or path.
330
+ */
331
+ whitelistedDomains?: Array<string> | null;
332
+ /**
333
+ * Visual style of the widget button: `compact` for an icon-sized button,
334
+ * `extended` for a labelled button, `minimal` for the least intrusive treatment.
335
+ */
336
+ widgetVariant?: 'compact' | 'extended' | 'minimal';
337
+ }
45
338
  export interface TranslationWidgetAnalyticsParams {
46
339
  /**
47
340
  * Inclusive lower bound of the analytics window as `YYYY-MM-DD`.
@@ -57,6 +350,6 @@ export interface TranslationWidgetAnalyticsParams {
57
350
  limit?: number;
58
351
  }
59
352
  export declare namespace TranslationWidgets {
60
- export { type TranslationWidgetAnalyticsResponse as TranslationWidgetAnalyticsResponse, type TranslationWidgetAnalyticsParams as TranslationWidgetAnalyticsParams, };
353
+ export { type TranslationWidgetListResponse as TranslationWidgetListResponse, type TranslationWidgetCreateResponse as TranslationWidgetCreateResponse, type TranslationWidgetRetrieveResponse as TranslationWidgetRetrieveResponse, type TranslationWidgetAnalyticsResponse as TranslationWidgetAnalyticsResponse, type TranslationWidgetCreateParams as TranslationWidgetCreateParams, type TranslationWidgetAnalyticsParams as TranslationWidgetAnalyticsParams, };
61
354
  }
62
355
  //# sourceMappingURL=translation-widgets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"translation-widgets.d.ts","sourceRoot":"","sources":["../src/resources/translation-widgets.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4BAAyB;AAC/C,OAAO,EAAE,UAAU,EAAE,+BAA4B;AACjD,OAAO,EAAE,cAAc,EAAE,uCAAoC;AAG7D,qBAAa,kBAAmB,SAAQ,WAAW;IACjD;;;;OAIG;IACH,SAAS,CACP,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,gCAAgC,EACvC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,kCAAkC,CAAC;CAGlD;AAED,MAAM,WAAW,kCAAkC;IACjD,MAAM,EAAE,KAAK,CAAC,kCAAkC,CAAC,MAAM,CAAC,CAAC;IAEzD,UAAU,EAAE,KAAK,CAAC,kCAAkC,CAAC,UAAU,CAAC,CAAC;IAEjE,aAAa,EAAE,MAAM,CAAC;IAEtB,QAAQ,EAAE,KAAK,CAAC,kCAAkC,CAAC,OAAO,CAAC,CAAC;IAE5D,iBAAiB,EAAE,MAAM,CAAC;IAE1B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,yBAAiB,kCAAkC,CAAC;IAClD,UAAiB,MAAM;QACrB,IAAI,EAAE,MAAM,CAAC;QAEb,YAAY,EAAE,MAAM,CAAC;QAErB,WAAW,EAAE,MAAM,CAAC;KACrB;IAED,UAAiB,UAAU;QACzB,YAAY,EAAE,MAAM,CAAC;QAErB,YAAY,EAAE,MAAM,CAAC;QAErB,WAAW,EAAE,MAAM,CAAC;KACrB;IAED,UAAiB,OAAO;QACtB,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAEtC,YAAY,EAAE,MAAM,CAAC;QAErB,WAAW,EAAE,MAAM,CAAC;QAEpB,GAAG,EAAE,MAAM,CAAC;KACb;IAED,UAAiB,OAAO,CAAC;QACvB,UAAiB,UAAU;YACzB,YAAY,EAAE,MAAM,CAAC;YAErB,YAAY,EAAE,MAAM,CAAC;YAErB,WAAW,EAAE,MAAM,CAAC;SACrB;KACF;CACF;AAED,MAAM,WAAW,gCAAgC;IAC/C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,CAAC,OAAO,WAAW,kBAAkB,CAAC;IAC1C,OAAO,EACL,KAAK,kCAAkC,IAAI,kCAAkC,EAC7E,KAAK,gCAAgC,IAAI,gCAAgC,GAC1E,CAAC;CACH"}
1
+ {"version":3,"file":"translation-widgets.d.ts","sourceRoot":"","sources":["../src/resources/translation-widgets.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4BAAyB;AAC/C,OAAO,EAAE,UAAU,EAAE,+BAA4B;AACjD,OAAO,EAAE,cAAc,EAAE,uCAAoC;AAG7D,qBAAa,kBAAmB,SAAQ,WAAW;IACjD;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,cAAc,GAA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nE,KAAK,gCAAgC,IAAI,gCAAgC,GAC1E,CAAC;CACH"}
@@ -5,10 +5,64 @@ exports.TranslationWidgets = void 0;
5
5
  const resource_1 = require("../core/resource.js");
6
6
  const path_1 = require("../internal/utils/path.js");
7
7
  class TranslationWidgets extends resource_1.APIResource {
8
+ /**
9
+ * List every translation widget configured on the account, including the domains
10
+ * it runs on, its appearance settings, and the languages it offers. Not paginated
11
+ * — widgets are capped by the account's translation widget limit. Requires scope:
12
+ * translationWidget:list
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const translationWidgets =
17
+ * await client.translationWidgets.list();
18
+ * ```
19
+ */
20
+ list(options) {
21
+ return this._client.get('/rest/v1/translation-widgets', options);
22
+ }
23
+ /**
24
+ * Create a translation widget. Every field is optional — anything omitted comes
25
+ * back as `null` and the widget falls back to its built-in appearance, and
26
+ * omitting `enabledLanguages` offers every supported language. Returns the full
27
+ * widget, including its id, so it can be installed without a follow-up request.
28
+ * Requires scope: translationWidget:create
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const translationWidget =
33
+ * await client.translationWidgets.create();
34
+ * ```
35
+ */
36
+ create(body, options) {
37
+ return this._client.post('/rest/v1/translation-widgets', { body, ...options });
38
+ }
39
+ /**
40
+ * Fetch one translation widget by its id. Returns 404 when it does not exist.
41
+ * Requires scope: translationWidget:find
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const translationWidget =
46
+ * await client.translationWidgets.retrieve(
47
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
48
+ * );
49
+ * ```
50
+ */
51
+ retrieve(id, options) {
52
+ return this._client.get((0, path_1.path) `/rest/v1/translation-widgets/${id}`, options);
53
+ }
8
54
  /**
9
55
  * Return usage totals and language, host, and page breakdowns for one translation
10
56
  * widget over the requested date range. Requires scope:
11
57
  * report:translation-analytics
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * const response = await client.translationWidgets.analytics(
62
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
63
+ * { from: '2019-12-27', to: '2019-12-27' },
64
+ * );
65
+ * ```
12
66
  */
13
67
  analytics(id, query, options) {
14
68
  return this._client.get((0, path_1.path) `/rest/v1/translation-widgets/${id}/analytics`, { query, ...options });
@@ -1 +1 @@
1
- {"version":3,"file":"translation-widgets.js","sourceRoot":"","sources":["../src/resources/translation-widgets.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAA8C;AAE9C,MAAa,kBAAmB,SAAQ,sBAAW;IACjD;;;;OAIG;IACH,SAAS,CACP,EAAU,EACV,KAAuC,EACvC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,gCAAgC,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrG,CAAC;CACF;AAbD,gDAaC"}
1
+ {"version":3,"file":"translation-widgets.js","sourceRoot":"","sources":["../src/resources/translation-widgets.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAA8C;AAE9C,MAAa,kBAAmB,SAAQ,sBAAW;IACjD;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,MAAM,CACJ,IAAmC,EACnC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,8BAA8B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjF,CAAC;IAED;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,gCAAgC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,SAAS,CACP,EAAU,EACV,KAAuC,EACvC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,gCAAgC,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrG,CAAC;CACF;AAzED,gDAyEC"}
@@ -2,10 +2,64 @@
2
2
  import { APIResource } from "../core/resource.mjs";
3
3
  import { path } from "../internal/utils/path.mjs";
4
4
  export class TranslationWidgets extends APIResource {
5
+ /**
6
+ * List every translation widget configured on the account, including the domains
7
+ * it runs on, its appearance settings, and the languages it offers. Not paginated
8
+ * — widgets are capped by the account's translation widget limit. Requires scope:
9
+ * translationWidget:list
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const translationWidgets =
14
+ * await client.translationWidgets.list();
15
+ * ```
16
+ */
17
+ list(options) {
18
+ return this._client.get('/rest/v1/translation-widgets', options);
19
+ }
20
+ /**
21
+ * Create a translation widget. Every field is optional — anything omitted comes
22
+ * back as `null` and the widget falls back to its built-in appearance, and
23
+ * omitting `enabledLanguages` offers every supported language. Returns the full
24
+ * widget, including its id, so it can be installed without a follow-up request.
25
+ * Requires scope: translationWidget:create
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const translationWidget =
30
+ * await client.translationWidgets.create();
31
+ * ```
32
+ */
33
+ create(body, options) {
34
+ return this._client.post('/rest/v1/translation-widgets', { body, ...options });
35
+ }
36
+ /**
37
+ * Fetch one translation widget by its id. Returns 404 when it does not exist.
38
+ * Requires scope: translationWidget:find
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const translationWidget =
43
+ * await client.translationWidgets.retrieve(
44
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
45
+ * );
46
+ * ```
47
+ */
48
+ retrieve(id, options) {
49
+ return this._client.get(path `/rest/v1/translation-widgets/${id}`, options);
50
+ }
5
51
  /**
6
52
  * Return usage totals and language, host, and page breakdowns for one translation
7
53
  * widget over the requested date range. Requires scope:
8
54
  * report:translation-analytics
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const response = await client.translationWidgets.analytics(
59
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
60
+ * { from: '2019-12-27', to: '2019-12-27' },
61
+ * );
62
+ * ```
9
63
  */
10
64
  analytics(id, query, options) {
11
65
  return this._client.get(path `/rest/v1/translation-widgets/${id}/analytics`, { query, ...options });
@@ -1 +1 @@
1
- {"version":3,"file":"translation-widgets.mjs","sourceRoot":"","sources":["../src/resources/translation-widgets.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAG/C,OAAO,EAAE,IAAI,EAAE,mCAA+B;AAE9C,MAAM,OAAO,kBAAmB,SAAQ,WAAW;IACjD;;;;OAIG;IACH,SAAS,CACP,EAAU,EACV,KAAuC,EACvC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,gCAAgC,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrG,CAAC;CACF"}
1
+ {"version":3,"file":"translation-widgets.mjs","sourceRoot":"","sources":["../src/resources/translation-widgets.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAG/C,OAAO,EAAE,IAAI,EAAE,mCAA+B;AAE9C,MAAM,OAAO,kBAAmB,SAAQ,WAAW;IACjD;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,MAAM,CACJ,IAAmC,EACnC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,8BAA8B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjF,CAAC;IAED;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,gCAAgC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,SAAS,CACP,EAAU,EACV,KAAuC,EACvC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,gCAAgC,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrG,CAAC;CACF"}
package/src/client.ts CHANGED
@@ -355,6 +355,10 @@ import {
355
355
  import {
356
356
  TranslationWidgetAnalyticsParams,
357
357
  TranslationWidgetAnalyticsResponse,
358
+ TranslationWidgetCreateParams,
359
+ TranslationWidgetCreateResponse,
360
+ TranslationWidgetListResponse,
361
+ TranslationWidgetRetrieveResponse,
358
362
  TranslationWidgets,
359
363
  } from './resources/translation-widgets';
360
364
  import {
@@ -1640,7 +1644,11 @@ export declare namespace OursPrivacyPlatform {
1640
1644
 
1641
1645
  export {
1642
1646
  TranslationWidgets as TranslationWidgets,
1647
+ type TranslationWidgetListResponse as TranslationWidgetListResponse,
1648
+ type TranslationWidgetCreateResponse as TranslationWidgetCreateResponse,
1649
+ type TranslationWidgetRetrieveResponse as TranslationWidgetRetrieveResponse,
1643
1650
  type TranslationWidgetAnalyticsResponse as TranslationWidgetAnalyticsResponse,
1651
+ type TranslationWidgetCreateParams as TranslationWidgetCreateParams,
1644
1652
  type TranslationWidgetAnalyticsParams as TranslationWidgetAnalyticsParams,
1645
1653
  };
1646
1654
 
@@ -335,7 +335,11 @@ export {
335
335
  } from './tag-managers';
336
336
  export {
337
337
  TranslationWidgets,
338
+ type TranslationWidgetListResponse,
339
+ type TranslationWidgetCreateResponse,
340
+ type TranslationWidgetRetrieveResponse,
338
341
  type TranslationWidgetAnalyticsResponse,
342
+ type TranslationWidgetCreateParams,
339
343
  type TranslationWidgetAnalyticsParams,
340
344
  } from './translation-widgets';
341
345
  export {