@rustrak/client 0.14.2 → 0.14.3

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/dist/index.cjs CHANGED
@@ -626,7 +626,21 @@ var userSchema = zod.z.object({
626
626
  id: zod.z.number().int().positive(),
627
627
  email: zod.z.string().email(),
628
628
  role: globalRoleSchema,
629
- is_admin: zod.z.boolean()
629
+ is_admin: zod.z.boolean(),
630
+ /**
631
+ * The dashboard language this user chose.
632
+ *
633
+ * `null` means they never chose one, which a consumer should treat as
634
+ * "infer it" rather than as English. Optional as well as nullable so a
635
+ * client stays compatible with a server predating the column.
636
+ */
637
+ language: zod.z.string().nullable().optional(),
638
+ /** The IANA timezone this user chose, `null` when they never chose one. */
639
+ timezone: zod.z.string().nullable().optional()
640
+ });
641
+ var updatePreferencesRequestSchema = zod.z.object({
642
+ language: zod.z.string().nullable().optional(),
643
+ timezone: zod.z.string().nullable().optional()
630
644
  });
631
645
  var authResponseSchema = zod.z.object({
632
646
  user: userSchema
@@ -1307,6 +1321,24 @@ var AuthResource = class extends BaseResource {
1307
1321
  async getCurrentUser() {
1308
1322
  return this.request(() => this.http.get("auth/me"), userSchema);
1309
1323
  }
1324
+ /**
1325
+ * Stores how this reader wants the dashboard presented to them.
1326
+ *
1327
+ * A key left out is left alone; a key sent as `null` is cleared. That is why
1328
+ * the request type is optional *and* nullable rather than one or the other:
1329
+ * "do not touch" and "forget my choice" are different instructions.
1330
+ */
1331
+ async updatePreferences(preferences) {
1332
+ const validatedInput = this.validateInput(
1333
+ preferences,
1334
+ updatePreferencesRequestSchema
1335
+ );
1336
+ if (!validatedInput.success) return validatedInput;
1337
+ return this.request(
1338
+ () => this.http.patch("auth/me", { json: validatedInput.data }),
1339
+ userSchema
1340
+ );
1341
+ }
1310
1342
  /**
1311
1343
  * Get the details of a pending invitation by its token (public endpoint)
1312
1344
  * Used by the accept-invitation page before the user has an account