hevy-shared 1.0.998 → 1.0.1000

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/built/index.d.ts CHANGED
@@ -1620,13 +1620,18 @@ export interface UserMetadataResponse {
1620
1620
  export interface NetworkInfoRequest {
1621
1621
  networkType: NetworkType;
1622
1622
  }
1623
- export type Gym = {
1623
+ export type CommercialGym = {
1624
+ type: 'commercial';
1624
1625
  id: string;
1625
1626
  name: string;
1626
1627
  fullAddress: string;
1627
1628
  city: string;
1628
1629
  distanceM: number;
1629
1630
  };
1631
+ export type HomeGym = {
1632
+ type: 'home';
1633
+ };
1634
+ export type Gym = CommercialGym | HomeGym;
1630
1635
  export interface StripePrice {
1631
1636
  product_id: string;
1632
1637
  billing_period: 'month' | 'year' | 'pay-once';
@@ -370,11 +370,14 @@ describe('utils', () => {
370
370
  });
371
371
  describe('formatDurationInput', () => {
372
372
  it('Returns a string in the format of NN:NN or NN:NN:NN', () => {
373
+ expect((0, utils_1.formatDurationInput)('')).toBe('');
373
374
  expect((0, utils_1.formatDurationInput)('0')).toBe('');
374
375
  expect((0, utils_1.formatDurationInput)('1')).toBe('00:01');
375
376
  expect((0, utils_1.formatDurationInput)('60')).toBe(undefined);
376
377
  expect((0, utils_1.formatDurationInput)('61')).toBe(undefined);
377
378
  expect((0, utils_1.formatDurationInput)('99:99')).toBe('99:99');
379
+ expect((0, utils_1.formatDurationInput)('1:00:00')).toBe('01:00:00');
380
+ expect((0, utils_1.formatDurationInput)('9:59:59')).toBe('09:59:59');
378
381
  });
379
382
  });
380
383
  describe('getEstimatedExercisesDurationSeconds', () => {
package/built/utils.js CHANGED
@@ -217,12 +217,12 @@ exports.isValidFormattedTime = isValidFormattedTime;
217
217
  const formatDurationInput = (value) => {
218
218
  if ((0, exports.isValidFormattedTime)(value))
219
219
  return value;
220
- if (!/^[0-9:]+$/i.test(value)) {
221
- return undefined;
222
- }
223
220
  if (value.length === 0) {
224
221
  return value;
225
222
  }
223
+ if (!/^[0-9:]+$/i.test(value)) {
224
+ return undefined;
225
+ }
226
226
  if (value === '0') {
227
227
  return '';
228
228
  }
@@ -245,6 +245,10 @@ const formatDurationInput = (value) => {
245
245
  // 01:234 -> 12:34
246
246
  return `${value[1]}${value[3]}:${value[4]}${value[5]}`;
247
247
  }
248
+ // x:xx:xx (hour+ with no leading zero)
249
+ if (/^[0-9]:[0-9]{2}:[0-9]{2}$/.test(value)) {
250
+ return `0${value}`;
251
+ }
248
252
  if (value.length === 7 && value[0] === '0') {
249
253
  // backspace
250
254
  // 01:23:4 -> 12:34
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hevy-shared",
3
- "version": "1.0.998",
3
+ "version": "1.0.1000",
4
4
  "description": "",
5
5
  "main": "built/index.js",
6
6
  "types": "built/index.d.ts",