@sunsteel/contracts 0.90.0 → 0.92.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.
package/dist/index.cjs CHANGED
@@ -116,8 +116,10 @@ __export(index_exports, {
116
116
  MEASURABLE_GOAL_TYPES: () => MEASURABLE_GOAL_TYPES,
117
117
  MESSAGES_PAGE_SIZE: () => MESSAGES_PAGE_SIZE,
118
118
  MESSAGES_PER_MINUTE_MAX: () => MESSAGES_PER_MINUTE_MAX,
119
+ MESSAGE_ATTACHMENT_KINDS: () => MESSAGE_ATTACHMENT_KINDS,
119
120
  MESSAGE_BODY_MAX: () => MESSAGE_BODY_MAX,
120
121
  MESSAGE_PERMISSIONS: () => MESSAGE_PERMISSIONS,
122
+ MESSAGE_PUSH_DELAY_SECONDS: () => MESSAGE_PUSH_DELAY_SECONDS,
121
123
  MESSAGE_REPORT_CONTEXT_BEFORE: () => MESSAGE_REPORT_CONTEXT_BEFORE,
122
124
  MESSAGE_REQUEST_DECLINE_COOLDOWN_DAYS: () => MESSAGE_REQUEST_DECLINE_COOLDOWN_DAYS,
123
125
  MINUTES_IN_DAY: () => MINUTES_IN_DAY,
@@ -307,6 +309,7 @@ __export(index_exports, {
307
309
  lpWorkingSets: () => lpWorkingSets,
308
310
  matchesDeletionConfirmation: () => matchesDeletionConfirmation,
309
311
  messageBodyLength: () => messageBodyLength,
312
+ messageNote: () => messageNote,
310
313
  normalizeDashboardLayout: () => normalizeDashboardLayout,
311
314
  normalizeExerciseLinks: () => normalizeExerciseLinks,
312
315
  normalizeExerciseName: () => normalizeExerciseName,
@@ -1637,7 +1640,7 @@ var ROUTINE_VISIBILITY_VALUES = [
1637
1640
  "PUBLIC"
1638
1641
  ];
1639
1642
  var ROUTINE_SHARE_MAX_ACTIVE_LINKS = 10;
1640
- var SHARED_ROUTINE_SOURCES = ["LINK", "VISIBILITY"];
1643
+ var SHARED_ROUTINE_SOURCES = ["LINK", "VISIBILITY", "MESSAGE"];
1641
1644
  var CLONE_ROUTINE_REFUSALS = {
1642
1645
  /** Neither `token` nor `routineId`, or both at once. */
1643
1646
  SOURCE_REQUIRED: "SOURCE_REQUIRED",
@@ -1805,7 +1808,8 @@ var PUSH_PAYLOAD_KINDS = [
1805
1808
  "TRAINING_REMINDER",
1806
1809
  "STREAK_AT_RISK",
1807
1810
  "TRAINING_PARTNER_SESSION",
1808
- "TRAINING_PARTNER_ACHIEVEMENT"
1811
+ "TRAINING_PARTNER_ACHIEVEMENT",
1812
+ "MESSAGE"
1809
1813
  ];
1810
1814
  var REST_ALERT_MAX_LEAD_SECONDS = 3600;
1811
1815
  var REST_ALERT_MIN_LEAD_SECONDS = 5;
@@ -1828,7 +1832,9 @@ var NOTIFICATION_CATEGORIES = [
1828
1832
  "TRAINING_REMINDER",
1829
1833
  "STREAK_AT_RISK",
1830
1834
  "TRAINING_PARTNER_SESSION",
1831
- "TRAINING_PARTNER_ACHIEVEMENT"
1835
+ "TRAINING_PARTNER_ACHIEVEMENT",
1836
+ // MSG-08. On by default, like the training categories.
1837
+ "MESSAGE"
1832
1838
  ];
1833
1839
  var MINUTES_IN_DAY = 1440;
1834
1840
  function isWithinQuietHours(minuteOfDay, quietHours) {
@@ -1922,7 +1928,7 @@ var API_ERROR_MESSAGES = {
1922
1928
  EXERCISE_GROUP_TOO_LARGE: "A superset or circuit has at most {max} exercises",
1923
1929
  ROUTINE_ACTIVE_SESSION: "Finish the active session before changing the routine structure",
1924
1930
  ROUTINE_SHARE_LINKS_MAX: "A routine keeps at most {max} active links.",
1925
- CLONE_SOURCE_REQUIRED: "SOURCE_REQUIRED: send either a share token or a routine id",
1931
+ CLONE_SOURCE_REQUIRED: "SOURCE_REQUIRED: send one of a share token, a routine id or a message id",
1926
1932
  CLONE_UNKNOWN_EXERCISE: "UNKNOWN_EXERCISE: an exercise in this routine is no longer in the catalog",
1927
1933
  ROUTINE_VERSIONS_MAX: "A routine keeps at most {max} versions; delete one first",
1928
1934
  ROUTINE_VERSION_EXERCISE_GONE: "An exercise in this version is no longer in the catalog",
@@ -2141,8 +2147,16 @@ function normalizeMessageBody(body) {
2141
2147
  }
2142
2148
  return text;
2143
2149
  }
2150
+ var MESSAGE_ATTACHMENT_KINDS = ["ROUTINE"];
2151
+ function messageNote(body, hasAttachment) {
2152
+ if ((body ?? "").trim().length === 0) {
2153
+ return hasAttachment ? null : void 0;
2154
+ }
2155
+ return normalizeMessageBody(body ?? "") ?? void 0;
2156
+ }
2144
2157
  var CONVERSATION_BOXES = ["INBOX", "REQUESTS"];
2145
2158
  var MESSAGE_REQUEST_DECLINE_COOLDOWN_DAYS = 30;
2159
+ var MESSAGE_PUSH_DELAY_SECONDS = 30;
2146
2160
  var MESSAGE_REPORT_CONTEXT_BEFORE = 5;
2147
2161
  function isMessagePermission(value) {
2148
2162
  return MESSAGE_PERMISSIONS.includes(value);
@@ -2245,8 +2259,10 @@ function isMessagePermission(value) {
2245
2259
  MEASURABLE_GOAL_TYPES,
2246
2260
  MESSAGES_PAGE_SIZE,
2247
2261
  MESSAGES_PER_MINUTE_MAX,
2262
+ MESSAGE_ATTACHMENT_KINDS,
2248
2263
  MESSAGE_BODY_MAX,
2249
2264
  MESSAGE_PERMISSIONS,
2265
+ MESSAGE_PUSH_DELAY_SECONDS,
2250
2266
  MESSAGE_REPORT_CONTEXT_BEFORE,
2251
2267
  MESSAGE_REQUEST_DECLINE_COOLDOWN_DAYS,
2252
2268
  MINUTES_IN_DAY,
@@ -2436,6 +2452,7 @@ function isMessagePermission(value) {
2436
2452
  lpWorkingSets,
2437
2453
  matchesDeletionConfirmation,
2438
2454
  messageBodyLength,
2455
+ messageNote,
2439
2456
  normalizeDashboardLayout,
2440
2457
  normalizeExerciseLinks,
2441
2458
  normalizeExerciseName,