@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.
@@ -6,10 +6,70 @@ import { RequestOptions } from '../internal/request-options';
6
6
  import { path } from '../internal/utils/path';
7
7
 
8
8
  export class TranslationWidgets extends APIResource {
9
+ /**
10
+ * List every translation widget configured on the account, including the domains
11
+ * it runs on, its appearance settings, and the languages it offers. Not paginated
12
+ * — widgets are capped by the account's translation widget limit. Requires scope:
13
+ * translationWidget:list
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const translationWidgets =
18
+ * await client.translationWidgets.list();
19
+ * ```
20
+ */
21
+ list(options?: RequestOptions): APIPromise<TranslationWidgetListResponse> {
22
+ return this._client.get('/rest/v1/translation-widgets', options);
23
+ }
24
+
25
+ /**
26
+ * Create a translation widget. Every field is optional — anything omitted comes
27
+ * back as `null` and the widget falls back to its built-in appearance, and
28
+ * omitting `enabledLanguages` offers every supported language. Returns the full
29
+ * widget, including its id, so it can be installed without a follow-up request.
30
+ * Requires scope: translationWidget:create
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const translationWidget =
35
+ * await client.translationWidgets.create();
36
+ * ```
37
+ */
38
+ create(
39
+ body: TranslationWidgetCreateParams,
40
+ options?: RequestOptions,
41
+ ): APIPromise<TranslationWidgetCreateResponse> {
42
+ return this._client.post('/rest/v1/translation-widgets', { body, ...options });
43
+ }
44
+
45
+ /**
46
+ * Fetch one translation widget by its id. Returns 404 when it does not exist.
47
+ * Requires scope: translationWidget:find
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const translationWidget =
52
+ * await client.translationWidgets.retrieve(
53
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
54
+ * );
55
+ * ```
56
+ */
57
+ retrieve(id: string, options?: RequestOptions): APIPromise<TranslationWidgetRetrieveResponse> {
58
+ return this._client.get(path`/rest/v1/translation-widgets/${id}`, options);
59
+ }
60
+
9
61
  /**
10
62
  * Return usage totals and language, host, and page breakdowns for one translation
11
63
  * widget over the requested date range. Requires scope:
12
64
  * report:translation-analytics
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * const response = await client.translationWidgets.analytics(
69
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
70
+ * { from: '2019-12-27', to: '2019-12-27' },
71
+ * );
72
+ * ```
13
73
  */
14
74
  analytics(
15
75
  id: string,
@@ -20,6 +80,239 @@ export class TranslationWidgets extends APIResource {
20
80
  }
21
81
  }
22
82
 
83
+ export interface TranslationWidgetListResponse {
84
+ /**
85
+ * Every translation widget on the account. Not paginated — widgets are capped by
86
+ * the account's translation widget limit, so the full set always fits in one
87
+ * response.
88
+ */
89
+ entities: Array<TranslationWidgetListResponse.Entity>;
90
+ }
91
+
92
+ export namespace TranslationWidgetListResponse {
93
+ export interface Entity {
94
+ /**
95
+ * Unique identifier for the translation widget.
96
+ */
97
+ id: string;
98
+
99
+ /**
100
+ * ISO-8601 timestamp when the widget was created.
101
+ */
102
+ createdAt: string;
103
+
104
+ /**
105
+ * Accent colour for the widget button and modal, as a hex value — `#RGB`,
106
+ * `#RRGGBB`, or `#RRGGBBAA`.
107
+ */
108
+ brandColor?: string | null;
109
+
110
+ /**
111
+ * Custom domain used to serve the widget script (e.g. `translate.example.com`).
112
+ * Leave null to use the default Ours Privacy domain. Send the bare host — no
113
+ * scheme, port, or path.
114
+ */
115
+ customDomain?: string | null;
116
+
117
+ /**
118
+ * Languages offered in the widget, as ISO codes such as `en`, `es`, `fr`, `zh-TW`.
119
+ * Omit or send an empty array to offer every supported language. An unrecognised
120
+ * code is rejected with 400 rather than silently ignored.
121
+ */
122
+ enabledLanguages?: Array<string> | null;
123
+
124
+ /**
125
+ * Layout of the language-selection modal: `standard` list, `grid` of languages, or
126
+ * a `dropdown`.
127
+ */
128
+ modalVariant?: 'standard' | 'grid' | 'dropdown' | null;
129
+
130
+ /**
131
+ * Terms the widget keeps in their original form in every language — brand names,
132
+ * product names, and the like. Up to 500 terms of 200 characters each; duplicates
133
+ * and purely numeric terms are dropped.
134
+ */
135
+ noTranslateTerms?: Array<string> | null;
136
+
137
+ /**
138
+ * Corner of the viewport the widget button is anchored to.
139
+ */
140
+ position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | null;
141
+
142
+ /**
143
+ * Colour scheme the widget renders in.
144
+ */
145
+ theme?: 'light' | 'dark' | null;
146
+
147
+ /**
148
+ * ISO-8601 timestamp of the most recent change. Matches `createdAt` on a widget
149
+ * that has never been edited.
150
+ */
151
+ updatedAt?: string | null;
152
+
153
+ /**
154
+ * Domains where this widget is allowed to run. The widget refuses to load anywhere
155
+ * else, so a missing host means the widget never appears. Send bare hosts — no
156
+ * scheme, port, or path.
157
+ */
158
+ whitelistedDomains?: Array<string> | null;
159
+
160
+ /**
161
+ * Visual style of the widget button: `compact` for an icon-sized button,
162
+ * `extended` for a labelled button, `minimal` for the least intrusive treatment.
163
+ */
164
+ widgetVariant?: 'compact' | 'extended' | 'minimal' | null;
165
+ }
166
+ }
167
+
168
+ export interface TranslationWidgetCreateResponse {
169
+ /**
170
+ * Unique identifier for the translation widget.
171
+ */
172
+ id: string;
173
+
174
+ /**
175
+ * ISO-8601 timestamp when the widget was created.
176
+ */
177
+ createdAt: string;
178
+
179
+ /**
180
+ * Accent colour for the widget button and modal, as a hex value — `#RGB`,
181
+ * `#RRGGBB`, or `#RRGGBBAA`.
182
+ */
183
+ brandColor?: string | null;
184
+
185
+ /**
186
+ * Custom domain used to serve the widget script (e.g. `translate.example.com`).
187
+ * Leave null to use the default Ours Privacy domain. Send the bare host — no
188
+ * scheme, port, or path.
189
+ */
190
+ customDomain?: string | null;
191
+
192
+ /**
193
+ * Languages offered in the widget, as ISO codes such as `en`, `es`, `fr`, `zh-TW`.
194
+ * Omit or send an empty array to offer every supported language. An unrecognised
195
+ * code is rejected with 400 rather than silently ignored.
196
+ */
197
+ enabledLanguages?: Array<string> | null;
198
+
199
+ /**
200
+ * Layout of the language-selection modal: `standard` list, `grid` of languages, or
201
+ * a `dropdown`.
202
+ */
203
+ modalVariant?: 'standard' | 'grid' | 'dropdown' | null;
204
+
205
+ /**
206
+ * Terms the widget keeps in their original form in every language — brand names,
207
+ * product names, and the like. Up to 500 terms of 200 characters each; duplicates
208
+ * and purely numeric terms are dropped.
209
+ */
210
+ noTranslateTerms?: Array<string> | null;
211
+
212
+ /**
213
+ * Corner of the viewport the widget button is anchored to.
214
+ */
215
+ position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | null;
216
+
217
+ /**
218
+ * Colour scheme the widget renders in.
219
+ */
220
+ theme?: 'light' | 'dark' | null;
221
+
222
+ /**
223
+ * ISO-8601 timestamp of the most recent change. Matches `createdAt` on a widget
224
+ * that has never been edited.
225
+ */
226
+ updatedAt?: string | null;
227
+
228
+ /**
229
+ * Domains where this widget is allowed to run. The widget refuses to load anywhere
230
+ * else, so a missing host means the widget never appears. Send bare hosts — no
231
+ * scheme, port, or path.
232
+ */
233
+ whitelistedDomains?: Array<string> | null;
234
+
235
+ /**
236
+ * Visual style of the widget button: `compact` for an icon-sized button,
237
+ * `extended` for a labelled button, `minimal` for the least intrusive treatment.
238
+ */
239
+ widgetVariant?: 'compact' | 'extended' | 'minimal' | null;
240
+ }
241
+
242
+ export interface TranslationWidgetRetrieveResponse {
243
+ /**
244
+ * Unique identifier for the translation widget.
245
+ */
246
+ id: string;
247
+
248
+ /**
249
+ * ISO-8601 timestamp when the widget was created.
250
+ */
251
+ createdAt: string;
252
+
253
+ /**
254
+ * Accent colour for the widget button and modal, as a hex value — `#RGB`,
255
+ * `#RRGGBB`, or `#RRGGBBAA`.
256
+ */
257
+ brandColor?: string | null;
258
+
259
+ /**
260
+ * Custom domain used to serve the widget script (e.g. `translate.example.com`).
261
+ * Leave null to use the default Ours Privacy domain. Send the bare host — no
262
+ * scheme, port, or path.
263
+ */
264
+ customDomain?: string | null;
265
+
266
+ /**
267
+ * Languages offered in the widget, as ISO codes such as `en`, `es`, `fr`, `zh-TW`.
268
+ * Omit or send an empty array to offer every supported language. An unrecognised
269
+ * code is rejected with 400 rather than silently ignored.
270
+ */
271
+ enabledLanguages?: Array<string> | null;
272
+
273
+ /**
274
+ * Layout of the language-selection modal: `standard` list, `grid` of languages, or
275
+ * a `dropdown`.
276
+ */
277
+ modalVariant?: 'standard' | 'grid' | 'dropdown' | null;
278
+
279
+ /**
280
+ * Terms the widget keeps in their original form in every language — brand names,
281
+ * product names, and the like. Up to 500 terms of 200 characters each; duplicates
282
+ * and purely numeric terms are dropped.
283
+ */
284
+ noTranslateTerms?: Array<string> | null;
285
+
286
+ /**
287
+ * Corner of the viewport the widget button is anchored to.
288
+ */
289
+ position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | null;
290
+
291
+ /**
292
+ * Colour scheme the widget renders in.
293
+ */
294
+ theme?: 'light' | 'dark' | null;
295
+
296
+ /**
297
+ * ISO-8601 timestamp of the most recent change. Matches `createdAt` on a widget
298
+ * that has never been edited.
299
+ */
300
+ updatedAt?: string | null;
301
+
302
+ /**
303
+ * Domains where this widget is allowed to run. The widget refuses to load anywhere
304
+ * else, so a missing host means the widget never appears. Send bare hosts — no
305
+ * scheme, port, or path.
306
+ */
307
+ whitelistedDomains?: Array<string> | null;
308
+
309
+ /**
310
+ * Visual style of the widget button: `compact` for an icon-sized button,
311
+ * `extended` for a labelled button, `minimal` for the least intrusive treatment.
312
+ */
313
+ widgetVariant?: 'compact' | 'extended' | 'minimal' | null;
314
+ }
315
+
23
316
  export interface TranslationWidgetAnalyticsResponse {
24
317
  byHost: Array<TranslationWidgetAnalyticsResponse.ByHost>;
25
318
 
@@ -72,6 +365,140 @@ export namespace TranslationWidgetAnalyticsResponse {
72
365
  }
73
366
  }
74
367
 
368
+ export interface TranslationWidgetCreateParams {
369
+ /**
370
+ * Accent colour for the widget button and modal, as a hex value — `#RGB`,
371
+ * `#RRGGBB`, or `#RRGGBBAA`.
372
+ */
373
+ brandColor?: string | null;
374
+
375
+ /**
376
+ * Custom domain used to serve the widget script (e.g. `translate.example.com`).
377
+ * Leave null to use the default Ours Privacy domain. Send the bare host — no
378
+ * scheme, port, or path.
379
+ */
380
+ customDomain?: string | null;
381
+
382
+ /**
383
+ * Languages offered in the widget, as ISO codes such as `en`, `es`, `fr`, `zh-TW`.
384
+ * Omit or send an empty array to offer every supported language. An unrecognised
385
+ * code is rejected with 400 rather than silently ignored.
386
+ */
387
+ enabledLanguages?: Array<
388
+ | 'af'
389
+ | 'sq'
390
+ | 'am'
391
+ | 'ar'
392
+ | 'hy'
393
+ | 'az'
394
+ | 'bn'
395
+ | 'bs'
396
+ | 'bg'
397
+ | 'ca'
398
+ | 'zh'
399
+ | 'zh-TW'
400
+ | 'hr'
401
+ | 'cs'
402
+ | 'da'
403
+ | 'fa-AF'
404
+ | 'nl'
405
+ | 'en'
406
+ | 'et'
407
+ | 'fa'
408
+ | 'tl'
409
+ | 'fi'
410
+ | 'fr'
411
+ | 'fr-CA'
412
+ | 'ka'
413
+ | 'de'
414
+ | 'el'
415
+ | 'gu'
416
+ | 'ht'
417
+ | 'ha'
418
+ | 'he'
419
+ | 'hi'
420
+ | 'hu'
421
+ | 'is'
422
+ | 'id'
423
+ | 'ga'
424
+ | 'it'
425
+ | 'ja'
426
+ | 'kn'
427
+ | 'kk'
428
+ | 'ko'
429
+ | 'lv'
430
+ | 'lt'
431
+ | 'mk'
432
+ | 'ms'
433
+ | 'ml'
434
+ | 'mt'
435
+ | 'mr'
436
+ | 'mn'
437
+ | 'no'
438
+ | 'ps'
439
+ | 'pl'
440
+ | 'pt'
441
+ | 'pt-PT'
442
+ | 'pa'
443
+ | 'ro'
444
+ | 'ru'
445
+ | 'sr'
446
+ | 'si'
447
+ | 'sk'
448
+ | 'sl'
449
+ | 'so'
450
+ | 'es'
451
+ | 'es-MX'
452
+ | 'sw'
453
+ | 'sv'
454
+ | 'ta'
455
+ | 'te'
456
+ | 'th'
457
+ | 'tr'
458
+ | 'uk'
459
+ | 'ur'
460
+ | 'uz'
461
+ | 'vi'
462
+ | 'cy'
463
+ > | null;
464
+
465
+ /**
466
+ * Layout of the language-selection modal: `standard` list, `grid` of languages, or
467
+ * a `dropdown`.
468
+ */
469
+ modalVariant?: 'standard' | 'grid' | 'dropdown';
470
+
471
+ /**
472
+ * Terms the widget keeps in their original form in every language — brand names,
473
+ * product names, and the like. Up to 500 terms of 200 characters each; duplicates
474
+ * and purely numeric terms are dropped.
475
+ */
476
+ noTranslateTerms?: Array<string> | null;
477
+
478
+ /**
479
+ * Corner of the viewport the widget button is anchored to.
480
+ */
481
+ position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
482
+
483
+ /**
484
+ * Colour scheme the widget renders in.
485
+ */
486
+ theme?: 'light' | 'dark';
487
+
488
+ /**
489
+ * Domains where this widget is allowed to run. The widget refuses to load anywhere
490
+ * else, so a missing host means the widget never appears. Send bare hosts — no
491
+ * scheme, port, or path.
492
+ */
493
+ whitelistedDomains?: Array<string> | null;
494
+
495
+ /**
496
+ * Visual style of the widget button: `compact` for an icon-sized button,
497
+ * `extended` for a labelled button, `minimal` for the least intrusive treatment.
498
+ */
499
+ widgetVariant?: 'compact' | 'extended' | 'minimal';
500
+ }
501
+
75
502
  export interface TranslationWidgetAnalyticsParams {
76
503
  /**
77
504
  * Inclusive lower bound of the analytics window as `YYYY-MM-DD`.
@@ -91,7 +518,11 @@ export interface TranslationWidgetAnalyticsParams {
91
518
 
92
519
  export declare namespace TranslationWidgets {
93
520
  export {
521
+ type TranslationWidgetListResponse as TranslationWidgetListResponse,
522
+ type TranslationWidgetCreateResponse as TranslationWidgetCreateResponse,
523
+ type TranslationWidgetRetrieveResponse as TranslationWidgetRetrieveResponse,
94
524
  type TranslationWidgetAnalyticsResponse as TranslationWidgetAnalyticsResponse,
525
+ type TranslationWidgetCreateParams as TranslationWidgetCreateParams,
95
526
  type TranslationWidgetAnalyticsParams as TranslationWidgetAnalyticsParams,
96
527
  };
97
528
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.47.0'; // x-release-please-version
1
+ export const VERSION = '1.48.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.47.0";
1
+ export declare const VERSION = "1.48.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.47.0";
1
+ export declare const VERSION = "1.48.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.47.0'; // x-release-please-version
4
+ exports.VERSION = '1.48.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.47.0'; // x-release-please-version
1
+ export const VERSION = '1.48.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map