@kingstinct/react-native-healthkit 7.3.0 → 7.3.2

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.
Files changed (56) hide show
  1. package/ios/ReactNativeHealthkit.swift +34 -31
  2. package/lib/commonjs/hooks/useHealthkitAuthorization.js +5 -0
  3. package/lib/commonjs/hooks/useHealthkitAuthorization.js.map +1 -1
  4. package/lib/commonjs/hooks/useMostRecentCategorySample.js +3 -0
  5. package/lib/commonjs/hooks/useMostRecentCategorySample.js.map +1 -1
  6. package/lib/commonjs/hooks/useMostRecentQuantitySample.js +3 -0
  7. package/lib/commonjs/hooks/useMostRecentQuantitySample.js.map +1 -1
  8. package/lib/commonjs/hooks/useMostRecentWorkout.js +3 -0
  9. package/lib/commonjs/hooks/useMostRecentWorkout.js.map +1 -1
  10. package/lib/commonjs/index.ios.js +284 -3
  11. package/lib/commonjs/index.ios.js.map +1 -1
  12. package/lib/commonjs/index.js +7 -87
  13. package/lib/commonjs/index.js.map +1 -1
  14. package/lib/commonjs/index.native.js +251 -0
  15. package/lib/commonjs/index.native.js.map +1 -0
  16. package/lib/commonjs/index.web.js +24 -0
  17. package/lib/commonjs/index.web.js.map +1 -0
  18. package/lib/commonjs/utils/saveCategorySample.js +4 -0
  19. package/lib/commonjs/utils/saveCategorySample.js.map +1 -1
  20. package/lib/module/hooks/useHealthkitAuthorization.js +5 -0
  21. package/lib/module/hooks/useHealthkitAuthorization.js.map +1 -1
  22. package/lib/module/hooks/useMostRecentCategorySample.js +3 -0
  23. package/lib/module/hooks/useMostRecentCategorySample.js.map +1 -1
  24. package/lib/module/hooks/useMostRecentQuantitySample.js +3 -0
  25. package/lib/module/hooks/useMostRecentQuantitySample.js.map +1 -1
  26. package/lib/module/hooks/useMostRecentWorkout.js +3 -0
  27. package/lib/module/hooks/useMostRecentWorkout.js.map +1 -1
  28. package/lib/module/index.ios.js +7 -1
  29. package/lib/module/index.ios.js.map +1 -1
  30. package/lib/module/index.js +2 -83
  31. package/lib/module/index.js.map +1 -1
  32. package/lib/module/index.native.js +136 -0
  33. package/lib/module/index.native.js.map +1 -0
  34. package/lib/module/index.web.js +4 -0
  35. package/lib/module/index.web.js.map +1 -0
  36. package/lib/module/utils/saveCategorySample.js +4 -0
  37. package/lib/module/utils/saveCategorySample.js.map +1 -1
  38. package/lib/typescript/src/hooks/useHealthkitAuthorization.d.ts +5 -0
  39. package/lib/typescript/src/hooks/useMostRecentCategorySample.d.ts +3 -0
  40. package/lib/typescript/src/hooks/useMostRecentQuantitySample.d.ts +3 -0
  41. package/lib/typescript/src/hooks/useMostRecentWorkout.d.ts +3 -0
  42. package/lib/typescript/src/index.d.ts +3 -53
  43. package/lib/typescript/src/index.ios.d.ts +37 -0
  44. package/lib/typescript/src/index.native.d.ts +29 -0
  45. package/lib/typescript/src/index.web.d.ts +3 -0
  46. package/lib/typescript/src/utils/saveCategorySample.d.ts +4 -0
  47. package/package.json +1 -1
  48. package/src/hooks/useHealthkitAuthorization.ts +5 -0
  49. package/src/hooks/useMostRecentCategorySample.ts +3 -0
  50. package/src/hooks/useMostRecentQuantitySample.ts +3 -0
  51. package/src/hooks/useMostRecentWorkout.ts +3 -0
  52. package/src/index.ios.tsx +57 -0
  53. package/src/index.native.tsx +201 -0
  54. package/src/index.tsx +3 -97
  55. package/src/index.web.tsx +5 -0
  56. package/src/utils/saveCategorySample.ts +4 -0
@@ -673,42 +673,45 @@ class ReactNativeHealthkit: RCTEventEmitter {
673
673
  }
674
674
 
675
675
  let query = HKStatisticsQuery.init(quantityType: quantityType, quantitySamplePredicate: predicate, options: opts) { (_, stats: HKStatistics?, _: Error?) in
676
- if let gottenStats = stats {
677
- var dic = [String: [String: Any]?]()
678
- let unit = HKUnit.init(from: unitString)
679
- if let averageQuantity = gottenStats.averageQuantity() {
680
- dic.updateValue(serializeQuantity(unit: unit, quantity: averageQuantity), forKey: "averageQuantity")
681
- }
682
- if let maximumQuantity = gottenStats.maximumQuantity() {
683
- dic.updateValue(serializeQuantity(unit: unit, quantity: maximumQuantity), forKey: "maximumQuantity")
684
- }
685
- if let minimumQuantity = gottenStats.minimumQuantity() {
686
- dic.updateValue(serializeQuantity(unit: unit, quantity: minimumQuantity), forKey: "minimumQuantity")
687
- }
688
- if let sumQuantity = gottenStats.sumQuantity() {
689
- dic.updateValue(serializeQuantity(unit: unit, quantity: sumQuantity), forKey: "sumQuantity")
676
+ var dic = [String: [String: Any]?]()
677
+
678
+ guard let gottenStats = stats else {
679
+ return resolve(dic)
680
+ }
681
+
682
+ let unit = HKUnit.init(from: unitString)
683
+ if let averageQuantity = gottenStats.averageQuantity() {
684
+ dic.updateValue(serializeQuantity(unit: unit, quantity: averageQuantity), forKey: "averageQuantity")
685
+ }
686
+ if let maximumQuantity = gottenStats.maximumQuantity() {
687
+ dic.updateValue(serializeQuantity(unit: unit, quantity: maximumQuantity), forKey: "maximumQuantity")
688
+ }
689
+ if let minimumQuantity = gottenStats.minimumQuantity() {
690
+ dic.updateValue(serializeQuantity(unit: unit, quantity: minimumQuantity), forKey: "minimumQuantity")
691
+ }
692
+ if let sumQuantity = gottenStats.sumQuantity() {
693
+ dic.updateValue(serializeQuantity(unit: unit, quantity: sumQuantity), forKey: "sumQuantity")
694
+ }
695
+ if #available(iOS 12, *) {
696
+ if let mostRecent = gottenStats.mostRecentQuantity() {
697
+ dic.updateValue(serializeQuantity(unit: unit, quantity: mostRecent), forKey: "mostRecentQuantity")
690
698
  }
691
- if #available(iOS 12, *) {
692
- if let mostRecent = gottenStats.mostRecentQuantity() {
693
- dic.updateValue(serializeQuantity(unit: unit, quantity: mostRecent), forKey: "mostRecentQuantity")
694
- }
695
699
 
696
- if let mostRecentDateInterval = gottenStats.mostRecentQuantityDateInterval() {
697
- dic.updateValue([
698
- "start": self._dateFormatter.string(from: mostRecentDateInterval.start),
699
- "end": self._dateFormatter.string(from: mostRecentDateInterval.end)
700
- ], forKey: "mostRecentQuantityDateInterval")
701
- }
700
+ if let mostRecentDateInterval = gottenStats.mostRecentQuantityDateInterval() {
701
+ dic.updateValue([
702
+ "start": self._dateFormatter.string(from: mostRecentDateInterval.start),
703
+ "end": self._dateFormatter.string(from: mostRecentDateInterval.end)
704
+ ], forKey: "mostRecentQuantityDateInterval")
702
705
  }
703
- if #available(iOS 13, *) {
704
- let durationUnit = HKUnit.second()
705
- if let duration = gottenStats.duration() {
706
- dic.updateValue(serializeQuantity(unit: durationUnit, quantity: duration), forKey: "duration")
707
- }
706
+ }
707
+ if #available(iOS 13, *) {
708
+ let durationUnit = HKUnit.second()
709
+ if let duration = gottenStats.duration() {
710
+ dic.updateValue(serializeQuantity(unit: durationUnit, quantity: duration), forKey: "duration")
708
711
  }
709
-
710
- resolve(dic)
711
712
  }
713
+
714
+ resolve(dic)
712
715
  }
713
716
 
714
717
  store.execute(query)
@@ -8,6 +8,11 @@ var _react = require("react");
8
8
  var _getRequestStatusForAuthorization = _interopRequireDefault(require("../utils/getRequestStatusForAuthorization"));
9
9
  var _requestAuthorization = _interopRequireDefault(require("../utils/requestAuthorization"));
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ /**
12
+ * @description Hook to retrieve the current authorization status for the given types, and request authorization if needed.
13
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614152-requestauthorization Apple Docs - requestAuthorization}
14
+ * @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Apple Docs - Authorizing access to health data}
15
+ */
11
16
  const useHealthkitAuthorization = (read, write) => {
12
17
  const [status, setStatus] = (0, _react.useState)(null);
13
18
  const readMemo = (0, _react.useRef)(read);
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_getRequestStatusForAuthorization","_interopRequireDefault","_requestAuthorization","obj","__esModule","default","useHealthkitAuthorization","read","write","status","setStatus","useState","readMemo","useRef","writeMemo","useEffect","current","refreshAuthStatus","useCallback","auth","getRequestStatusForAuthorization","request","requestAuthorization","_default","exports"],"sources":["useHealthkitAuthorization.ts"],"sourcesContent":["import {\n useCallback, useEffect, useRef, useState,\n} from 'react'\n\nimport getRequestStatusForAuthorization from '../utils/getRequestStatusForAuthorization'\nimport requestAuthorization from '../utils/requestAuthorization'\n\nimport type { HealthkitReadAuthorization, HealthkitWriteAuthorization, HKAuthorizationRequestStatus } from '../native-types'\n\nconst useHealthkitAuthorization = (read: readonly HealthkitReadAuthorization[], write?: readonly HealthkitWriteAuthorization[]) => {\n const [status, setStatus] = useState<HKAuthorizationRequestStatus | null>(null)\n\n const readMemo = useRef(read)\n const writeMemo = useRef(write)\n\n useEffect(() => {\n readMemo.current = read\n writeMemo.current = write\n }, [read, write])\n\n const refreshAuthStatus = useCallback(async () => {\n const auth = await getRequestStatusForAuthorization(readMemo.current, writeMemo.current)\n\n setStatus(auth)\n return auth\n }, [])\n\n const request = useCallback(async () => {\n await requestAuthorization(readMemo.current, writeMemo.current)\n return refreshAuthStatus()\n }, [refreshAuthStatus])\n\n useEffect(() => {\n void refreshAuthStatus()\n }, [refreshAuthStatus])\n\n return [status, request] as const\n}\n\nexport default useHealthkitAuthorization\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,iCAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAD,sBAAA,CAAAF,OAAA;AAAgE,SAAAE,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAIhE,MAAMG,yBAAyB,GAAGA,CAACC,IAA2C,EAAEC,KAA8C,KAAK;EACjI,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAG,IAAAC,eAAQ,EAAsC,IAAI,CAAC;EAE/E,MAAMC,QAAQ,GAAG,IAAAC,aAAM,EAACN,IAAI,CAAC;EAC7B,MAAMO,SAAS,GAAG,IAAAD,aAAM,EAACL,KAAK,CAAC;EAE/B,IAAAO,gBAAS,EAAC,MAAM;IACdH,QAAQ,CAACI,OAAO,GAAGT,IAAI;IACvBO,SAAS,CAACE,OAAO,GAAGR,KAAK;EAC3B,CAAC,EAAE,CAACD,IAAI,EAAEC,KAAK,CAAC,CAAC;EAEjB,MAAMS,iBAAiB,GAAG,IAAAC,kBAAW,EAAC,YAAY;IAChD,MAAMC,IAAI,GAAG,MAAM,IAAAC,yCAAgC,EAACR,QAAQ,CAACI,OAAO,EAAEF,SAAS,CAACE,OAAO,CAAC;IAExFN,SAAS,CAACS,IAAI,CAAC;IACf,OAAOA,IAAI;EACb,CAAC,EAAE,EAAE,CAAC;EAEN,MAAME,OAAO,GAAG,IAAAH,kBAAW,EAAC,YAAY;IACtC,MAAM,IAAAI,6BAAoB,EAACV,QAAQ,CAACI,OAAO,EAAEF,SAAS,CAACE,OAAO,CAAC;IAC/D,OAAOC,iBAAiB,CAAC,CAAC;EAC5B,CAAC,EAAE,CAACA,iBAAiB,CAAC,CAAC;EAEvB,IAAAF,gBAAS,EAAC,MAAM;IACd,KAAKE,iBAAiB,CAAC,CAAC;EAC1B,CAAC,EAAE,CAACA,iBAAiB,CAAC,CAAC;EAEvB,OAAO,CAACR,MAAM,EAAEY,OAAO,CAAC;AAC1B,CAAC;AAAA,IAAAE,QAAA,GAEcjB,yBAAyB;AAAAkB,OAAA,CAAAnB,OAAA,GAAAkB,QAAA"}
1
+ {"version":3,"names":["_react","require","_getRequestStatusForAuthorization","_interopRequireDefault","_requestAuthorization","obj","__esModule","default","useHealthkitAuthorization","read","write","status","setStatus","useState","readMemo","useRef","writeMemo","useEffect","current","refreshAuthStatus","useCallback","auth","getRequestStatusForAuthorization","request","requestAuthorization","_default","exports"],"sources":["useHealthkitAuthorization.ts"],"sourcesContent":["import {\n useCallback, useEffect, useRef, useState,\n} from 'react'\n\nimport getRequestStatusForAuthorization from '../utils/getRequestStatusForAuthorization'\nimport requestAuthorization from '../utils/requestAuthorization'\n\nimport type { HealthkitReadAuthorization, HealthkitWriteAuthorization, HKAuthorizationRequestStatus } from '../native-types'\n\n/**\n * @description Hook to retrieve the current authorization status for the given types, and request authorization if needed.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614152-requestauthorization Apple Docs - requestAuthorization}\n * @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Apple Docs - Authorizing access to health data}\n */\nconst useHealthkitAuthorization = (read: readonly HealthkitReadAuthorization[], write?: readonly HealthkitWriteAuthorization[]) => {\n const [status, setStatus] = useState<HKAuthorizationRequestStatus | null>(null)\n\n const readMemo = useRef(read)\n const writeMemo = useRef(write)\n\n useEffect(() => {\n readMemo.current = read\n writeMemo.current = write\n }, [read, write])\n\n const refreshAuthStatus = useCallback(async () => {\n const auth = await getRequestStatusForAuthorization(readMemo.current, writeMemo.current)\n\n setStatus(auth)\n return auth\n }, [])\n\n const request = useCallback(async () => {\n await requestAuthorization(readMemo.current, writeMemo.current)\n return refreshAuthStatus()\n }, [refreshAuthStatus])\n\n useEffect(() => {\n void refreshAuthStatus()\n }, [refreshAuthStatus])\n\n return [status, request] as const\n}\n\nexport default useHealthkitAuthorization\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,iCAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAD,sBAAA,CAAAF,OAAA;AAAgE,SAAAE,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAIhE;AACA;AACA;AACA;AACA;AACA,MAAMG,yBAAyB,GAAGA,CAACC,IAA2C,EAAEC,KAA8C,KAAK;EACjI,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAG,IAAAC,eAAQ,EAAsC,IAAI,CAAC;EAE/E,MAAMC,QAAQ,GAAG,IAAAC,aAAM,EAACN,IAAI,CAAC;EAC7B,MAAMO,SAAS,GAAG,IAAAD,aAAM,EAACL,KAAK,CAAC;EAE/B,IAAAO,gBAAS,EAAC,MAAM;IACdH,QAAQ,CAACI,OAAO,GAAGT,IAAI;IACvBO,SAAS,CAACE,OAAO,GAAGR,KAAK;EAC3B,CAAC,EAAE,CAACD,IAAI,EAAEC,KAAK,CAAC,CAAC;EAEjB,MAAMS,iBAAiB,GAAG,IAAAC,kBAAW,EAAC,YAAY;IAChD,MAAMC,IAAI,GAAG,MAAM,IAAAC,yCAAgC,EAACR,QAAQ,CAACI,OAAO,EAAEF,SAAS,CAACE,OAAO,CAAC;IAExFN,SAAS,CAACS,IAAI,CAAC;IACf,OAAOA,IAAI;EACb,CAAC,EAAE,EAAE,CAAC;EAEN,MAAME,OAAO,GAAG,IAAAH,kBAAW,EAAC,YAAY;IACtC,MAAM,IAAAI,6BAAoB,EAACV,QAAQ,CAACI,OAAO,EAAEF,SAAS,CAACE,OAAO,CAAC;IAC/D,OAAOC,iBAAiB,CAAC,CAAC;EAC5B,CAAC,EAAE,CAACA,iBAAiB,CAAC,CAAC;EAEvB,IAAAF,gBAAS,EAAC,MAAM;IACd,KAAKE,iBAAiB,CAAC,CAAC;EAC1B,CAAC,EAAE,CAACA,iBAAiB,CAAC,CAAC;EAEvB,OAAO,CAACR,MAAM,EAAEY,OAAO,CAAC;AAC1B,CAAC;AAAA,IAAAE,QAAA,GAEcjB,yBAAyB;AAAAkB,OAAA,CAAAnB,OAAA,GAAAkB,QAAA"}
@@ -8,6 +8,9 @@ var _react = require("react");
8
8
  var _useSubscribeToChanges = _interopRequireDefault(require("./useSubscribeToChanges"));
9
9
  var _getMostRecentCategorySample = _interopRequireDefault(require("../utils/getMostRecentCategorySample"));
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ /**
12
+ * @returns the most recent sample for the given category type.
13
+ */
11
14
  function useMostRecentCategorySample(identifier) {
12
15
  const [category, setCategory] = (0, _react.useState)(null);
13
16
  const updater = (0, _react.useCallback)(() => {
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_useSubscribeToChanges","_interopRequireDefault","_getMostRecentCategorySample","obj","__esModule","default","useMostRecentCategorySample","identifier","category","setCategory","useState","updater","useCallback","getMostRecentCategorySample","then","useSubscribeToChanges","_default","exports"],"sources":["useMostRecentCategorySample.ts"],"sourcesContent":["import { useCallback, useState } from 'react'\n\nimport useSubscribeToChanges from './useSubscribeToChanges'\nimport getMostRecentCategorySample from '../utils/getMostRecentCategorySample'\n\nimport type { HKCategoryTypeIdentifier } from '../native-types'\nimport type { HKCategorySample } from '../types'\n\nfunction useMostRecentCategorySample<\n TCategory extends HKCategoryTypeIdentifier\n>(identifier: TCategory) {\n const [category, setCategory] = useState<HKCategorySample<TCategory> | null>(\n null,\n )\n const updater = useCallback(() => {\n void getMostRecentCategorySample(identifier).then(setCategory)\n }, [identifier])\n\n useSubscribeToChanges(identifier, updater)\n\n return category\n}\n\nexport default useMostRecentCategorySample\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,sBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,4BAAA,GAAAD,sBAAA,CAAAF,OAAA;AAA8E,SAAAE,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAK9E,SAASG,2BAA2BA,CAElCC,UAAqB,EAAE;EACvB,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAG,IAAAC,eAAQ,EACtC,IACF,CAAC;EACD,MAAMC,OAAO,GAAG,IAAAC,kBAAW,EAAC,MAAM;IAChC,KAAK,IAAAC,oCAA2B,EAACN,UAAU,CAAC,CAACO,IAAI,CAACL,WAAW,CAAC;EAChE,CAAC,EAAE,CAACF,UAAU,CAAC,CAAC;EAEhB,IAAAQ,8BAAqB,EAACR,UAAU,EAAEI,OAAO,CAAC;EAE1C,OAAOH,QAAQ;AACjB;AAAC,IAAAQ,QAAA,GAEcV,2BAA2B;AAAAW,OAAA,CAAAZ,OAAA,GAAAW,QAAA"}
1
+ {"version":3,"names":["_react","require","_useSubscribeToChanges","_interopRequireDefault","_getMostRecentCategorySample","obj","__esModule","default","useMostRecentCategorySample","identifier","category","setCategory","useState","updater","useCallback","getMostRecentCategorySample","then","useSubscribeToChanges","_default","exports"],"sources":["useMostRecentCategorySample.ts"],"sourcesContent":["import { useCallback, useState } from 'react'\n\nimport useSubscribeToChanges from './useSubscribeToChanges'\nimport getMostRecentCategorySample from '../utils/getMostRecentCategorySample'\n\nimport type { HKCategoryTypeIdentifier } from '../native-types'\nimport type { HKCategorySample } from '../types'\n\n/**\n * @returns the most recent sample for the given category type.\n */\nfunction useMostRecentCategorySample<\n TCategory extends HKCategoryTypeIdentifier\n>(identifier: TCategory) {\n const [category, setCategory] = useState<HKCategorySample<TCategory> | null>(\n null,\n )\n const updater = useCallback(() => {\n void getMostRecentCategorySample(identifier).then(setCategory)\n }, [identifier])\n\n useSubscribeToChanges(identifier, updater)\n\n return category\n}\n\nexport default useMostRecentCategorySample\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,sBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,4BAAA,GAAAD,sBAAA,CAAAF,OAAA;AAA8E,SAAAE,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAK9E;AACA;AACA;AACA,SAASG,2BAA2BA,CAElCC,UAAqB,EAAE;EACvB,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAG,IAAAC,eAAQ,EACtC,IACF,CAAC;EACD,MAAMC,OAAO,GAAG,IAAAC,kBAAW,EAAC,MAAM;IAChC,KAAK,IAAAC,oCAA2B,EAACN,UAAU,CAAC,CAACO,IAAI,CAACL,WAAW,CAAC;EAChE,CAAC,EAAE,CAACF,UAAU,CAAC,CAAC;EAEhB,IAAAQ,8BAAqB,EAACR,UAAU,EAAEI,OAAO,CAAC;EAE1C,OAAOH,QAAQ;AACjB;AAAC,IAAAQ,QAAA,GAEcV,2BAA2B;AAAAW,OAAA,CAAAZ,OAAA,GAAAW,QAAA"}
@@ -9,6 +9,9 @@ var _ensureUnit = _interopRequireDefault(require("../utils/ensureUnit"));
9
9
  var _getMostRecentQuantitySample = _interopRequireDefault(require("../utils/getMostRecentQuantitySample"));
10
10
  var _subscribeToChanges = _interopRequireDefault(require("../utils/subscribeToChanges"));
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ /**
13
+ * @returns the most recent sample for the given quantity type.
14
+ */
12
15
  function useMostRecentQuantitySample(identifier, unit) {
13
16
  const [lastSample, setLastSample] = (0, _react.useState)(null);
14
17
  (0, _react.useEffect)(() => {
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_ensureUnit","_interopRequireDefault","_getMostRecentQuantitySample","_subscribeToChanges","obj","__esModule","default","useMostRecentQuantitySample","identifier","unit","lastSample","setLastSample","useState","useEffect","cancelSubscription","init","actualUnit","ensureUnit","subscribeToChanges","value","getMostRecentQuantitySample","_cancelSubscription","_default","exports"],"sources":["useMostRecentQuantitySample.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\n\nimport ensureUnit from '../utils/ensureUnit'\nimport getMostRecentQuantitySample from '../utils/getMostRecentQuantitySample'\nimport subscribeToChanges from '../utils/subscribeToChanges'\n\nimport type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\nimport type { HKQuantitySample } from '../types'\n\nfunction useMostRecentQuantitySample<\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(identifier: TIdentifier, unit?: TUnit) {\n const [lastSample, setLastSample] = useState<HKQuantitySample<\n TIdentifier\n > | null>(null)\n\n useEffect(() => {\n let cancelSubscription: (() => Promise<boolean>) | undefined\n\n const init = async () => {\n const actualUnit = await ensureUnit(identifier, unit)\n\n cancelSubscription = await subscribeToChanges(identifier, async () => {\n const value = await getMostRecentQuantitySample(identifier, actualUnit)\n setLastSample(value)\n })\n }\n void init()\n\n return () => {\n void cancelSubscription?.()\n }\n }, [identifier, unit])\n\n return lastSample\n}\n\nexport default useMostRecentQuantitySample\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,4BAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,mBAAA,GAAAF,sBAAA,CAAAF,OAAA;AAA4D,SAAAE,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAK5D,SAASG,2BAA2BA,CAGlCC,UAAuB,EAAEC,IAAY,EAAE;EACvC,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAC,eAAQ,EAElC,IAAI,CAAC;EAEf,IAAAC,gBAAS,EAAC,MAAM;IACd,IAAIC,kBAAwD;IAE5D,MAAMC,IAAI,GAAG,MAAAA,CAAA,KAAY;MACvB,MAAMC,UAAU,GAAG,MAAM,IAAAC,mBAAU,EAACT,UAAU,EAAEC,IAAI,CAAC;MAErDK,kBAAkB,GAAG,MAAM,IAAAI,2BAAkB,EAACV,UAAU,EAAE,YAAY;QACpE,MAAMW,KAAK,GAAG,MAAM,IAAAC,oCAA2B,EAACZ,UAAU,EAAEQ,UAAU,CAAC;QACvEL,aAAa,CAACQ,KAAK,CAAC;MACtB,CAAC,CAAC;IACJ,CAAC;IACD,KAAKJ,IAAI,CAAC,CAAC;IAEX,OAAO,MAAM;MAAA,IAAAM,mBAAA;MACX,OAAAA,mBAAA,GAAKP,kBAAkB,cAAAO,mBAAA,uBAAlBA,mBAAA,CAAqB,CAAC;IAC7B,CAAC;EACH,CAAC,EAAE,CAACb,UAAU,EAAEC,IAAI,CAAC,CAAC;EAEtB,OAAOC,UAAU;AACnB;AAAC,IAAAY,QAAA,GAEcf,2BAA2B;AAAAgB,OAAA,CAAAjB,OAAA,GAAAgB,QAAA"}
1
+ {"version":3,"names":["_react","require","_ensureUnit","_interopRequireDefault","_getMostRecentQuantitySample","_subscribeToChanges","obj","__esModule","default","useMostRecentQuantitySample","identifier","unit","lastSample","setLastSample","useState","useEffect","cancelSubscription","init","actualUnit","ensureUnit","subscribeToChanges","value","getMostRecentQuantitySample","_cancelSubscription","_default","exports"],"sources":["useMostRecentQuantitySample.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\n\nimport ensureUnit from '../utils/ensureUnit'\nimport getMostRecentQuantitySample from '../utils/getMostRecentQuantitySample'\nimport subscribeToChanges from '../utils/subscribeToChanges'\n\nimport type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\nimport type { HKQuantitySample } from '../types'\n\n/**\n * @returns the most recent sample for the given quantity type.\n */\nfunction useMostRecentQuantitySample<\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(identifier: TIdentifier, unit?: TUnit) {\n const [lastSample, setLastSample] = useState<HKQuantitySample<\n TIdentifier\n > | null>(null)\n\n useEffect(() => {\n let cancelSubscription: (() => Promise<boolean>) | undefined\n\n const init = async () => {\n const actualUnit = await ensureUnit(identifier, unit)\n\n cancelSubscription = await subscribeToChanges(identifier, async () => {\n const value = await getMostRecentQuantitySample(identifier, actualUnit)\n setLastSample(value)\n })\n }\n void init()\n\n return () => {\n void cancelSubscription?.()\n }\n }, [identifier, unit])\n\n return lastSample\n}\n\nexport default useMostRecentQuantitySample\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,4BAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,mBAAA,GAAAF,sBAAA,CAAAF,OAAA;AAA4D,SAAAE,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAK5D;AACA;AACA;AACA,SAASG,2BAA2BA,CAGlCC,UAAuB,EAAEC,IAAY,EAAE;EACvC,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAC,eAAQ,EAElC,IAAI,CAAC;EAEf,IAAAC,gBAAS,EAAC,MAAM;IACd,IAAIC,kBAAwD;IAE5D,MAAMC,IAAI,GAAG,MAAAA,CAAA,KAAY;MACvB,MAAMC,UAAU,GAAG,MAAM,IAAAC,mBAAU,EAACT,UAAU,EAAEC,IAAI,CAAC;MAErDK,kBAAkB,GAAG,MAAM,IAAAI,2BAAkB,EAACV,UAAU,EAAE,YAAY;QACpE,MAAMW,KAAK,GAAG,MAAM,IAAAC,oCAA2B,EAACZ,UAAU,EAAEQ,UAAU,CAAC;QACvEL,aAAa,CAACQ,KAAK,CAAC;MACtB,CAAC,CAAC;IACJ,CAAC;IACD,KAAKJ,IAAI,CAAC,CAAC;IAEX,OAAO,MAAM;MAAA,IAAAM,mBAAA;MACX,OAAAA,mBAAA,GAAKP,kBAAkB,cAAAO,mBAAA,uBAAlBA,mBAAA,CAAqB,CAAC;IAC7B,CAAC;EACH,CAAC,EAAE,CAACb,UAAU,EAAEC,IAAI,CAAC,CAAC;EAEtB,OAAOC,UAAU;AACnB;AAAC,IAAAY,QAAA,GAEcf,2BAA2B;AAAAgB,OAAA,CAAAjB,OAAA,GAAAgB,QAAA"}
@@ -9,6 +9,9 @@ var _getMostRecentWorkout = _interopRequireDefault(require("../utils/getMostRece
9
9
  var _getPreferredUnitsTyped = _interopRequireDefault(require("../utils/getPreferredUnitsTyped"));
10
10
  var _subscribeToChanges = _interopRequireDefault(require("../utils/subscribeToChanges"));
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ /**
13
+ * @returns the most recent workout sample.
14
+ */
12
15
  function useMostRecentWorkout(options) {
13
16
  const [workout, setWorkout] = (0, _react.useState)(null);
14
17
  const optionsRef = (0, _react.useRef)(options);
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_getMostRecentWorkout","_interopRequireDefault","_getPreferredUnitsTyped","_subscribeToChanges","obj","__esModule","default","useMostRecentWorkout","options","workout","setWorkout","useState","optionsRef","useRef","useEffect","current","update","useCallback","energyUnit","distanceUnit","getPreferredUnitsTyped","getMostRecentWorkout","cancelSubscription","init","subscribeToChanges","_cancelSubscription","_default","exports"],"sources":["useMostRecentWorkout.ts"],"sourcesContent":["import {\n useEffect, useState, useRef, useCallback,\n} from 'react'\n\nimport getMostRecentWorkout from '../utils/getMostRecentWorkout'\nimport getPreferredUnitsTyped from '../utils/getPreferredUnitsTyped'\nimport subscribeToChanges from '../utils/subscribeToChanges'\n\nimport type { EnergyUnit, LengthUnit } from '../native-types'\nimport type { HKWorkout } from '../types'\n\nfunction useMostRecentWorkout<\n TEnergy extends EnergyUnit,\n TDistance extends LengthUnit\n>(options?: { readonly energyUnit?: TEnergy; readonly distanceUnit?: TDistance }) {\n const [workout, setWorkout] = useState<HKWorkout<TEnergy, TDistance> | null>(null)\n\n const optionsRef = useRef(options)\n\n useEffect(() => {\n optionsRef.current = options\n }, [options])\n\n const update = useCallback(async () => {\n const { energyUnit, distanceUnit } = await getPreferredUnitsTyped(\n optionsRef.current,\n )\n\n setWorkout(await getMostRecentWorkout({\n energyUnit,\n distanceUnit,\n }))\n }, [])\n\n useEffect(() => {\n void update()\n }, [update])\n\n useEffect(() => {\n let cancelSubscription: (() => Promise<boolean>) | undefined\n\n const init = async () => {\n cancelSubscription = await subscribeToChanges(\n 'HKWorkoutTypeIdentifier',\n update,\n )\n }\n void init()\n\n return () => {\n void cancelSubscription?.()\n }\n }, [update])\n\n return workout\n}\n\nexport default useMostRecentWorkout\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,qBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,uBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA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OAAO;AAChB;AAAC,IAAAiB,QAAA,GAEcnB,oBAAoB;AAAAoB,OAAA,CAAArB,OAAA,GAAAoB,QAAA"}
1
+ {"version":3,"names":["_react","require","_getMostRecentWorkout","_interopRequireDefault","_getPreferredUnitsTyped","_subscribeToChanges","obj","__esModule","default","useMostRecentWorkout","options","workout","setWorkout","useState","optionsRef","useRef","useEffect","current","update","useCallback","energyUnit","distanceUnit","getPreferredUnitsTyped","getMostRecentWorkout","cancelSubscription","init","subscribeToChanges","_cancelSubscription","_default","exports"],"sources":["useMostRecentWorkout.ts"],"sourcesContent":["import {\n useEffect, useState, useRef, useCallback,\n} from 'react'\n\nimport getMostRecentWorkout from '../utils/getMostRecentWorkout'\nimport getPreferredUnitsTyped from '../utils/getPreferredUnitsTyped'\nimport subscribeToChanges from '../utils/subscribeToChanges'\n\nimport type { EnergyUnit, LengthUnit } from '../native-types'\nimport type { HKWorkout } from '../types'\n\n/**\n * @returns the most recent workout sample.\n */\nfunction useMostRecentWorkout<\n TEnergy extends EnergyUnit,\n TDistance extends LengthUnit\n>(options?: { readonly energyUnit?: TEnergy; readonly distanceUnit?: TDistance }) {\n const [workout, setWorkout] = useState<HKWorkout<TEnergy, TDistance> | null>(null)\n\n const optionsRef = useRef(options)\n\n useEffect(() => {\n optionsRef.current = options\n }, [options])\n\n const update = useCallback(async () => {\n const { energyUnit, distanceUnit } = await getPreferredUnitsTyped(\n optionsRef.current,\n )\n\n setWorkout(await getMostRecentWorkout({\n energyUnit,\n distanceUnit,\n }))\n }, [])\n\n useEffect(() => {\n void update()\n }, [update])\n\n useEffect(() => {\n let cancelSubscription: (() => Promise<boolean>) | undefined\n\n const init = async () => {\n cancelSubscription = await subscribeToChanges(\n 'HKWorkoutTypeIdentifier',\n update,\n )\n }\n void init()\n\n return () => {\n void cancelSubscription?.()\n }\n }, [update])\n\n return workout\n}\n\nexport default useMostRecentWorkout\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAA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AA,uBAAlBA,mBAAA,CAAqB,CAAC;IAC7B,CAAC;EACH,CAAC,EAAE,CAACT,MAAM,CAAC,CAAC;EAEZ,OAAOP,OAAO;AAChB;AAAC,IAAAiB,QAAA,GAEcnB,oBAAoB;AAAAoB,OAAA,CAAArB,OAAA,GAAAoB,QAAA"}
@@ -3,14 +3,279 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _exportNames = {};
7
- exports.default = void 0;
6
+ var _exportNames = {
7
+ authorizationStatusFor: true,
8
+ availableQuantityTypes: true,
9
+ disableAllBackgroundDelivery: true,
10
+ disableBackgroundDelivery: true,
11
+ enableBackgroundDelivery: true,
12
+ getBiologicalSex: true,
13
+ getBloodType: true,
14
+ getFitzpatrickSkinType: true,
15
+ getWheelchairUse: true,
16
+ getWorkoutRoutes: true,
17
+ isHealthDataAvailable: true,
18
+ canAccessProtectedData: true,
19
+ isProtectedDataAvailable: true,
20
+ useHealthkitAuthorization: true,
21
+ useIsHealthDataAvailable: true,
22
+ useMostRecentCategorySample: true,
23
+ useMostRecentQuantitySample: true,
24
+ useMostRecentWorkout: true,
25
+ useSources: true,
26
+ useStatisticsForQuantity: true,
27
+ useSubscribeToChanges: true,
28
+ deleteQuantitySample: true,
29
+ deleteSamples: true,
30
+ getDateOfBirth: true,
31
+ getMostRecentCategorySample: true,
32
+ getMostRecentQuantitySample: true,
33
+ getMostRecentWorkout: true,
34
+ getPreferredUnit: true,
35
+ getPreferredUnits: true,
36
+ getRequestStatusForAuthorization: true,
37
+ getWorkoutPlanById: true,
38
+ queryCategorySamples: true,
39
+ queryCategorySamplesWithAnchor: true,
40
+ queryCorrelationSamples: true,
41
+ queryHeartbeatSeriesSamples: true,
42
+ queryHeartbeatSeriesSamplesWithAnchor: true,
43
+ queryQuantitySamples: true,
44
+ queryQuantitySamplesWithAnchor: true,
45
+ querySources: true,
46
+ queryStatisticsForQuantity: true,
47
+ queryWorkouts: true,
48
+ requestAuthorization: true,
49
+ saveCategorySample: true,
50
+ saveCorrelationSample: true,
51
+ saveQuantitySample: true,
52
+ saveWorkoutRoute: true,
53
+ saveWorkoutSample: true,
54
+ subscribeToChanges: true
55
+ };
56
+ exports.default = exports.canAccessProtectedData = exports.availableQuantityTypes = exports.authorizationStatusFor = void 0;
57
+ Object.defineProperty(exports, "deleteQuantitySample", {
58
+ enumerable: true,
59
+ get: function () {
60
+ return _deleteQuantitySample.default;
61
+ }
62
+ });
63
+ Object.defineProperty(exports, "deleteSamples", {
64
+ enumerable: true,
65
+ get: function () {
66
+ return _deleteSamples.default;
67
+ }
68
+ });
69
+ exports.getBloodType = exports.getBiologicalSex = exports.enableBackgroundDelivery = exports.disableBackgroundDelivery = exports.disableAllBackgroundDelivery = void 0;
70
+ Object.defineProperty(exports, "getDateOfBirth", {
71
+ enumerable: true,
72
+ get: function () {
73
+ return _getDateOfBirth.default;
74
+ }
75
+ });
76
+ exports.getFitzpatrickSkinType = void 0;
77
+ Object.defineProperty(exports, "getMostRecentCategorySample", {
78
+ enumerable: true,
79
+ get: function () {
80
+ return _getMostRecentCategorySample.default;
81
+ }
82
+ });
83
+ Object.defineProperty(exports, "getMostRecentQuantitySample", {
84
+ enumerable: true,
85
+ get: function () {
86
+ return _getMostRecentQuantitySample.default;
87
+ }
88
+ });
89
+ Object.defineProperty(exports, "getMostRecentWorkout", {
90
+ enumerable: true,
91
+ get: function () {
92
+ return _getMostRecentWorkout.default;
93
+ }
94
+ });
95
+ Object.defineProperty(exports, "getPreferredUnit", {
96
+ enumerable: true,
97
+ get: function () {
98
+ return _getPreferredUnit.default;
99
+ }
100
+ });
101
+ Object.defineProperty(exports, "getPreferredUnits", {
102
+ enumerable: true,
103
+ get: function () {
104
+ return _getPreferredUnits.default;
105
+ }
106
+ });
107
+ Object.defineProperty(exports, "getRequestStatusForAuthorization", {
108
+ enumerable: true,
109
+ get: function () {
110
+ return _getRequestStatusForAuthorization.default;
111
+ }
112
+ });
113
+ exports.getWheelchairUse = void 0;
114
+ Object.defineProperty(exports, "getWorkoutPlanById", {
115
+ enumerable: true,
116
+ get: function () {
117
+ return _getWorkoutPlanById.default;
118
+ }
119
+ });
120
+ exports.isProtectedDataAvailable = exports.isHealthDataAvailable = exports.getWorkoutRoutes = void 0;
121
+ Object.defineProperty(exports, "queryCategorySamples", {
122
+ enumerable: true,
123
+ get: function () {
124
+ return _queryCategorySamples.default;
125
+ }
126
+ });
127
+ Object.defineProperty(exports, "queryCategorySamplesWithAnchor", {
128
+ enumerable: true,
129
+ get: function () {
130
+ return _queryCategorySamplesWithAnchor.default;
131
+ }
132
+ });
133
+ Object.defineProperty(exports, "queryCorrelationSamples", {
134
+ enumerable: true,
135
+ get: function () {
136
+ return _queryCorrelationSamples.default;
137
+ }
138
+ });
139
+ Object.defineProperty(exports, "queryHeartbeatSeriesSamples", {
140
+ enumerable: true,
141
+ get: function () {
142
+ return _queryHeartbeatSeriesSamples.default;
143
+ }
144
+ });
145
+ Object.defineProperty(exports, "queryHeartbeatSeriesSamplesWithAnchor", {
146
+ enumerable: true,
147
+ get: function () {
148
+ return _queryHeartbeatSeriesSamplesWithAnchor.default;
149
+ }
150
+ });
151
+ Object.defineProperty(exports, "queryQuantitySamples", {
152
+ enumerable: true,
153
+ get: function () {
154
+ return _queryQuantitySamples.default;
155
+ }
156
+ });
157
+ Object.defineProperty(exports, "queryQuantitySamplesWithAnchor", {
158
+ enumerable: true,
159
+ get: function () {
160
+ return _queryQuantitySamplesWithAnchor.default;
161
+ }
162
+ });
163
+ Object.defineProperty(exports, "querySources", {
164
+ enumerable: true,
165
+ get: function () {
166
+ return _querySources.default;
167
+ }
168
+ });
169
+ Object.defineProperty(exports, "queryStatisticsForQuantity", {
170
+ enumerable: true,
171
+ get: function () {
172
+ return _queryStatisticsForQuantity.default;
173
+ }
174
+ });
175
+ Object.defineProperty(exports, "queryWorkouts", {
176
+ enumerable: true,
177
+ get: function () {
178
+ return _queryWorkouts.default;
179
+ }
180
+ });
181
+ Object.defineProperty(exports, "requestAuthorization", {
182
+ enumerable: true,
183
+ get: function () {
184
+ return _requestAuthorization.default;
185
+ }
186
+ });
187
+ Object.defineProperty(exports, "saveCategorySample", {
188
+ enumerable: true,
189
+ get: function () {
190
+ return _saveCategorySample.default;
191
+ }
192
+ });
193
+ Object.defineProperty(exports, "saveCorrelationSample", {
194
+ enumerable: true,
195
+ get: function () {
196
+ return _saveCorrelationSample.default;
197
+ }
198
+ });
199
+ Object.defineProperty(exports, "saveQuantitySample", {
200
+ enumerable: true,
201
+ get: function () {
202
+ return _saveQuantitySample.default;
203
+ }
204
+ });
205
+ Object.defineProperty(exports, "saveWorkoutRoute", {
206
+ enumerable: true,
207
+ get: function () {
208
+ return _saveWorkoutRoute.default;
209
+ }
210
+ });
211
+ Object.defineProperty(exports, "saveWorkoutSample", {
212
+ enumerable: true,
213
+ get: function () {
214
+ return _saveWorkoutSample.default;
215
+ }
216
+ });
217
+ Object.defineProperty(exports, "subscribeToChanges", {
218
+ enumerable: true,
219
+ get: function () {
220
+ return _subscribeToChanges.default;
221
+ }
222
+ });
223
+ Object.defineProperty(exports, "useHealthkitAuthorization", {
224
+ enumerable: true,
225
+ get: function () {
226
+ return _useHealthkitAuthorization.default;
227
+ }
228
+ });
229
+ Object.defineProperty(exports, "useIsHealthDataAvailable", {
230
+ enumerable: true,
231
+ get: function () {
232
+ return _useIsHealthDataAvailable.default;
233
+ }
234
+ });
235
+ Object.defineProperty(exports, "useMostRecentCategorySample", {
236
+ enumerable: true,
237
+ get: function () {
238
+ return _useMostRecentCategorySample.default;
239
+ }
240
+ });
241
+ Object.defineProperty(exports, "useMostRecentQuantitySample", {
242
+ enumerable: true,
243
+ get: function () {
244
+ return _useMostRecentQuantitySample.default;
245
+ }
246
+ });
247
+ Object.defineProperty(exports, "useMostRecentWorkout", {
248
+ enumerable: true,
249
+ get: function () {
250
+ return _useMostRecentWorkout.default;
251
+ }
252
+ });
253
+ Object.defineProperty(exports, "useSources", {
254
+ enumerable: true,
255
+ get: function () {
256
+ return _useSources.default;
257
+ }
258
+ });
259
+ Object.defineProperty(exports, "useStatisticsForQuantity", {
260
+ enumerable: true,
261
+ get: function () {
262
+ return _useStatisticsForQuantity.default;
263
+ }
264
+ });
265
+ Object.defineProperty(exports, "useSubscribeToChanges", {
266
+ enumerable: true,
267
+ get: function () {
268
+ return _useSubscribeToChanges.default;
269
+ }
270
+ });
8
271
  var _reactNative = require("react-native");
9
272
  var _useHealthkitAuthorization = _interopRequireDefault(require("./hooks/useHealthkitAuthorization"));
10
273
  var _useIsHealthDataAvailable = _interopRequireDefault(require("./hooks/useIsHealthDataAvailable"));
11
274
  var _useMostRecentCategorySample = _interopRequireDefault(require("./hooks/useMostRecentCategorySample"));
12
275
  var _useMostRecentQuantitySample = _interopRequireDefault(require("./hooks/useMostRecentQuantitySample"));
13
276
  var _useMostRecentWorkout = _interopRequireDefault(require("./hooks/useMostRecentWorkout"));
277
+ var _useSources = _interopRequireDefault(require("./hooks/useSources"));
278
+ var _useStatisticsForQuantity = _interopRequireDefault(require("./hooks/useStatisticsForQuantity"));
14
279
  var _useSubscribeToChanges = _interopRequireDefault(require("./hooks/useSubscribeToChanges"));
15
280
  var _nativeTypes = _interopRequireWildcard(require("./native-types"));
16
281
  var _deleteQuantitySample = _interopRequireDefault(require("./utils/deleteQuantitySample"));
@@ -66,22 +331,34 @@ const availableQuantityTypes = function () {
66
331
  // remove types that are not available before iOS 17
67
332
  return allQuantityTypesList.filter(type => ![_nativeTypes.HKQuantityTypeIdentifier.cyclingCadence, _nativeTypes.HKQuantityTypeIdentifier.cyclingFunctionalThresholdPower, _nativeTypes.HKQuantityTypeIdentifier.cyclingPower, _nativeTypes.HKQuantityTypeIdentifier.cyclingSpeed, _nativeTypes.HKQuantityTypeIdentifier.physicalEffort, _nativeTypes.HKQuantityTypeIdentifier.timeInDaylight].includes(type));
68
333
  };
334
+ exports.availableQuantityTypes = availableQuantityTypes;
69
335
  const authorizationStatusFor = _nativeTypes.default.authorizationStatusFor.bind(_nativeTypes.default);
336
+ exports.authorizationStatusFor = authorizationStatusFor;
70
337
  const isHealthDataAvailable = _nativeTypes.default.isHealthDataAvailable.bind(_nativeTypes.default);
71
338
  // Todo [>8]: Rename to align with Apple function name (isProtectedDataAvailable)
339
+ exports.isHealthDataAvailable = isHealthDataAvailable;
72
340
  const canAccessProtectedData = _nativeTypes.default.canAccessProtectedData.bind(_nativeTypes.default);
341
+ exports.canAccessProtectedData = canAccessProtectedData;
73
342
  const disableBackgroundDelivery = _nativeTypes.default.disableBackgroundDelivery.bind(_nativeTypes.default);
343
+ exports.disableBackgroundDelivery = disableBackgroundDelivery;
74
344
  const disableAllBackgroundDelivery = _nativeTypes.default.disableAllBackgroundDelivery.bind(_nativeTypes.default);
345
+ exports.disableAllBackgroundDelivery = disableAllBackgroundDelivery;
75
346
  const enableBackgroundDelivery = _nativeTypes.default.enableBackgroundDelivery.bind(_nativeTypes.default);
347
+ exports.enableBackgroundDelivery = enableBackgroundDelivery;
76
348
  const getBiologicalSex = _nativeTypes.default.getBiologicalSex.bind(_nativeTypes.default);
349
+ exports.getBiologicalSex = getBiologicalSex;
77
350
  const getFitzpatrickSkinType = _nativeTypes.default.getFitzpatrickSkinType.bind(_nativeTypes.default);
351
+ exports.getFitzpatrickSkinType = getFitzpatrickSkinType;
78
352
  const getWheelchairUse = _nativeTypes.default.getWheelchairUse.bind(_nativeTypes.default);
353
+ exports.getWheelchairUse = getWheelchairUse;
79
354
  const getBloodType = _nativeTypes.default.getBloodType.bind(_nativeTypes.default);
355
+ exports.getBloodType = getBloodType;
80
356
  const getWorkoutRoutes = _nativeTypes.default.getWorkoutRoutes.bind(_nativeTypes.default);
81
357
 
82
358
  /**
83
359
  * @see {@link https://developer.apple.com/documentation/healthkit/about_the_healthkit_framework About the HealthKit Framework (Apple Docs)}
84
360
  */
361
+ exports.getWorkoutRoutes = getWorkoutRoutes;
85
362
  var _default = {
86
363
  /**
87
364
  * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614154-authorizationstatus authorizationStatus(for:) (Apple Docs) }
@@ -209,7 +486,11 @@ var _default = {
209
486
  * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614152-requestauthorization Apple Docs - requestAuthorization}
210
487
  * @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Apple Docs - Authorizing access to health data}
211
488
  */
212
- useHealthkitAuthorization: _useHealthkitAuthorization.default
489
+ useHealthkitAuthorization: _useHealthkitAuthorization.default,
490
+ useSources: _useSources.default,
491
+ useStatisticsForQuantity: _useStatisticsForQuantity.default
213
492
  };
214
493
  exports.default = _default;
494
+ const isProtectedDataAvailable = canAccessProtectedData;
495
+ exports.isProtectedDataAvailable = isProtectedDataAvailable;
215
496
  //# sourceMappingURL=index.ios.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_useHealthkitAuthorization","_interopRequireDefault","_useIsHealthDataAvailable","_useMostRecentCategorySample","_useMostRecentQuantitySample","_useMostRecentWorkout","_useSubscribeToChanges","_nativeTypes","_interopRequireWildcard","_deleteQuantitySample","_deleteSamples","_getDateOfBirth","_getMostRecentCategorySample","_getMostRecentQuantitySample","_getMostRecentWorkout","_getPreferredUnit","_getPreferredUnits","_getRequestStatusForAuthorization","_getWorkoutPlanById","_queryCategorySamples","_queryCategorySamplesWithAnchor","_queryCorrelationSamples","_queryHeartbeatSeriesSamples","_queryHeartbeatSeriesSamplesWithAnchor","_queryQuantitySamples","_queryQuantitySamplesWithAnchor","_querySources","_queryStatisticsForQuantity","_queryWorkouts","_requestAuthorization","_saveCategorySample","_saveCorrelationSample","_saveQuantitySample","_saveWorkoutRoute","_saveWorkoutSample","_subscribeToChanges","_types","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","newObj","hasPropertyDescriptor","getOwnPropertyDescriptor","desc","set","currentMajorVersionIOS","Platform","OS","parseInt","Version","allQuantityTypesList","values","HKQuantityTypeIdentifier","availableQuantityTypes","majorVersionIOS","arguments","length","undefined","filter","type","cyclingCadence","cyclingFunctionalThresholdPower","cyclingPower","cyclingSpeed","physicalEffort","timeInDaylight","includes","authorizationStatusFor","Native","bind","isHealthDataAvailable","canAccessProtectedData","disableBackgroundDelivery","disableAllBackgroundDelivery","enableBackgroundDelivery","getBiologicalSex","getFitzpatrickSkinType","getWheelchairUse","getBloodType","getWorkoutRoutes","_default","isProtectedDataAvailable","getDateOfBirth","getMostRecentQuantitySample","getMostRecentCategorySample","getMostRecentWorkout","getWorkoutPlanById","getPreferredUnit","getPreferredUnits","getRequestStatusForAuthorization","queryCategorySamples","queryCategorySamplesWithAnchor","queryCorrelationSamples","queryHeartbeatSeriesSamples","queryHeartbeatSeriesSamplesWithAnchor","queryQuantitySamples","queryQuantitySamplesWithAnchor","queryStatisticsForQuantity","queryWorkouts","querySources","requestAuthorization","deleteQuantitySample","deleteSamples","saveCategorySample","saveCorrelationSample","saveQuantitySample","saveWorkoutSample","saveWorkoutRoute","subscribeToChanges","useMostRecentCategorySample","useMostRecentQuantitySample","useMostRecentWorkout","useSubscribeToChanges","useIsHealthDataAvailable","useHealthkitAuthorization"],"sources":["index.ios.tsx"],"sourcesContent":["import { Platform } from 'react-native'\n\nimport useHealthkitAuthorization from './hooks/useHealthkitAuthorization'\nimport useIsHealthDataAvailable from './hooks/useIsHealthDataAvailable'\nimport useMostRecentCategorySample from './hooks/useMostRecentCategorySample'\nimport useMostRecentQuantitySample from './hooks/useMostRecentQuantitySample'\nimport useMostRecentWorkout from './hooks/useMostRecentWorkout'\nimport useSubscribeToChanges from './hooks/useSubscribeToChanges'\nimport Native, { HKQuantityTypeIdentifier } from './native-types'\nimport deleteQuantitySample from './utils/deleteQuantitySample'\nimport deleteSamples from './utils/deleteSamples'\nimport getDateOfBirth from './utils/getDateOfBirth'\nimport getMostRecentCategorySample from './utils/getMostRecentCategorySample'\nimport getMostRecentQuantitySample from './utils/getMostRecentQuantitySample'\nimport getMostRecentWorkout from './utils/getMostRecentWorkout'\nimport getPreferredUnit from './utils/getPreferredUnit'\nimport getPreferredUnits from './utils/getPreferredUnits'\nimport getRequestStatusForAuthorization from './utils/getRequestStatusForAuthorization'\nimport getWorkoutPlanById from './utils/getWorkoutPlanById'\nimport queryCategorySamples from './utils/queryCategorySamples'\nimport queryCategorySamplesWithAnchor from './utils/queryCategorySamplesWithAnchor'\nimport queryCorrelationSamples from './utils/queryCorrelationSamples'\nimport queryHeartbeatSeriesSamples from './utils/queryHeartbeatSeriesSamples'\nimport queryHeartbeatSeriesSamplesWithAnchor from './utils/queryHeartbeatSeriesSamplesWithAnchor'\nimport queryQuantitySamples from './utils/queryQuantitySamples'\nimport queryQuantitySamplesWithAnchor from './utils/queryQuantitySamplesWithAnchor'\nimport querySources from './utils/querySources'\nimport queryStatisticsForQuantity from './utils/queryStatisticsForQuantity'\nimport queryWorkouts from './utils/queryWorkouts'\nimport requestAuthorization from './utils/requestAuthorization'\nimport saveCategorySample from './utils/saveCategorySample'\nimport saveCorrelationSample from './utils/saveCorrelationSample'\nimport saveQuantitySample from './utils/saveQuantitySample'\nimport saveWorkoutRoute from './utils/saveWorkoutRoute'\nimport saveWorkoutSample from './utils/saveWorkoutSample'\nimport subscribeToChanges from './utils/subscribeToChanges'\n\nconst currentMajorVersionIOS = Platform.OS === 'ios' ? parseInt(Platform.Version, 10) : 0\n\nconst allQuantityTypesList = [...Object.values(HKQuantityTypeIdentifier)]\n\nconst availableQuantityTypes = (majorVersionIOS = currentMajorVersionIOS) => {\n if (majorVersionIOS >= 17) {\n return allQuantityTypesList\n }\n\n // remove types that are not available before iOS 17\n return allQuantityTypesList.filter((type) => ![\n HKQuantityTypeIdentifier.cyclingCadence,\n HKQuantityTypeIdentifier.cyclingFunctionalThresholdPower,\n HKQuantityTypeIdentifier.cyclingPower,\n HKQuantityTypeIdentifier.cyclingSpeed,\n HKQuantityTypeIdentifier.physicalEffort,\n HKQuantityTypeIdentifier.timeInDaylight,\n ].includes(type))\n}\n\nconst authorizationStatusFor = Native.authorizationStatusFor.bind(Native)\nconst isHealthDataAvailable = Native.isHealthDataAvailable.bind(Native)\n// Todo [>8]: Rename to align with Apple function name (isProtectedDataAvailable)\nconst canAccessProtectedData = Native.canAccessProtectedData.bind(Native)\nconst disableBackgroundDelivery = Native.disableBackgroundDelivery.bind(Native)\nconst disableAllBackgroundDelivery = Native.disableAllBackgroundDelivery.bind(Native)\nconst enableBackgroundDelivery = Native.enableBackgroundDelivery.bind(Native)\nconst getBiologicalSex = Native.getBiologicalSex.bind(Native)\nconst getFitzpatrickSkinType = Native.getFitzpatrickSkinType.bind(Native)\nconst getWheelchairUse = Native.getWheelchairUse.bind(Native)\nconst getBloodType = Native.getBloodType.bind(Native)\nconst getWorkoutRoutes = Native.getWorkoutRoutes.bind(Native)\n\n/**\n * @see {@link https://developer.apple.com/documentation/healthkit/about_the_healthkit_framework About the HealthKit Framework (Apple Docs)}\n */\nexport default {\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614154-authorizationstatus authorizationStatus(for:) (Apple Docs) }\n * @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Authorizing access to health data (Apple Docs) }\n */\n authorizationStatusFor,\n\n /**\n *\n * @returns All available quantity types for the current iOS version (currently excluding types that are not available before iOS 17)\n */\n availableQuantityTypes,\n\n /**\n * @description By default, HealthKit data is available on iOS and watchOS. HealthKit data is also available on iPadOS 17 or later. However, devices running in an enterprise environment may restrict access to HealthKit data.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614180-ishealthdataavailable isHealthDataAvailable() (Apple Docs)}\n * @returns {boolean} true if HealthKit is available; otherwise, false.\n */\n isHealthDataAvailable,\n\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614181-isprotecteddataavailable isProtectedDataAvailable() (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/protecting_user_privacy#3705074 Protecting User Privacy - Access encrypted data (Apple Docs)}\n * @returns {boolean} A Boolean value that indicates whether content protection is active.\n */\n isProtectedDataAvailable: canAccessProtectedData,\n\n // Todo [>8]: Remove to align with Apple function name (isProtectedDataAvailable)\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614181-isprotecteddataavailable isProtectedDataAvailable() (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/protecting_user_privacy#3705074 Protecting User Privacy - Access encrypted data (Apple Docs)}\n * @deprecated Use {@link isProtectedDataAvailable} instead. Will be removed in next major version.\n * @returns {boolean} A Boolean value that indicates whether content protection is active.\n */\n canAccessProtectedData,\n\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614158-disableallbackgrounddelivery disableAllBackgroundDelivery(completion:) (Apple Docs)}\n */\n disableAllBackgroundDelivery,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614177-disablebackgrounddelivery disableBackgroundDelivery(for:withCompletion:) (Apple Docs)}\n */\n disableBackgroundDelivery,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614175-enablebackgrounddelivery enableBackgroundDelivery(for:frequency:withCompletion:) (Apple Docs)}\n */\n enableBackgroundDelivery,\n\n // simple convenience getters\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614171-biologicalsex biologicalSex() (Apple Docs)}\n */\n getBiologicalSex,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614161-fitzpatrickskintype fitzpatrickSkinType() (Apple Docs)}\n */\n getFitzpatrickSkinType,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1648356-wheelchairuse wheelchairUse() (Apple Docs)}\n */\n getWheelchairUse,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614164-bloodtype bloodType() (Apple Docs)}\n */\n getBloodType,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1648357-dateofbirthcomponents dateOfBirthComponents() (Apple Docs)}\n */\n getDateOfBirth,\n\n getMostRecentQuantitySample,\n getMostRecentCategorySample,\n getMostRecentWorkout,\n\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/reading_route_data Reading route data (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/hkworkoutroutequery HKWorkoutRouteQuery (Apple Docs)}\n */\n getWorkoutRoutes,\n getWorkoutPlanById,\n\n getPreferredUnit,\n getPreferredUnits,\n getRequestStatusForAuthorization,\n\n // query methods\n queryCategorySamples,\n queryCategorySamplesWithAnchor,\n queryCorrelationSamples,\n queryHeartbeatSeriesSamples,\n queryHeartbeatSeriesSamplesWithAnchor,\n queryQuantitySamples,\n queryQuantitySamplesWithAnchor,\n queryStatisticsForQuantity,\n queryWorkouts,\n querySources,\n\n requestAuthorization,\n\n // delete methods\n deleteQuantitySample,\n deleteSamples,\n\n // save methods\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614168-savecategorysample save(_:withCompletion:) (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/saving_data_to_healthkit Saving data to HealthKit (Apple Docs)}\n */\n saveCategorySample,\n saveCorrelationSample,\n saveQuantitySample,\n saveWorkoutSample,\n saveWorkoutRoute,\n\n // subscriptions\n subscribeToChanges,\n\n /**\n * @returns the most recent sample for the given category type.\n */\n useMostRecentCategorySample,\n /**\n * @returns the most recent sample for the given quantity type.\n */\n useMostRecentQuantitySample,\n /**\n * @returns the most recent workout sample.\n */\n useMostRecentWorkout,\n useSubscribeToChanges,\n /**\n * @description By default, HealthKit data is available on iOS and watchOS. HealthKit data is also available on iPadOS 17 or later. However, devices running in an enterprise environment may restrict access to HealthKit data.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614180-ishealthdataavailable Apple Docs}\n * @returns {boolean | null} true if HealthKit is available; otherwise, false. null while initializing.\n */\n useIsHealthDataAvailable,\n /**\n * @description Hook to retrieve the current authorization status for the given types, and request authorization if needed.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614152-requestauthorization Apple Docs - requestAuthorization}\n * @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Apple Docs - Authorizing access to health data}\n */\n useHealthkitAuthorization,\n}\n\nexport * from './types'\n"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,0BAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,yBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,4BAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,4BAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,qBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,sBAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,YAAA,GAAAC,uBAAA,CAAAT,OAAA;AACA,IAAAU,qBAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,cAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,eAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,4BAAA,GAAAX,sBAAA,CAAAF,OAAA;AACA,IAAAc,4BAAA,GAAAZ,sBAAA,CAAAF,OAAA;AACA,IAAAe,qBAAA,GAAAb,sBAAA,CAAAF,OAAA;AACA,IAAAgB,iBAAA,GAAAd,sBAAA,CAAAF,OAAA;AACA,IAAAiB,kBAAA,GAAAf,sBAAA,CAAAF,OAAA;AACA,IAAAkB,iCAAA,GAAAhB,sBAAA,CAAAF,OAAA;AACA,IAAAmB,mBAAA,GAAAjB,sBAAA,CAAAF,OAAA;AACA,IAAAoB,qBAAA,GAAAlB,sBAAA,CAAAF,OAAA;AACA,IAAAqB,+BAAA,GAAAnB,sBAAA,CAAAF,OAAA;AACA,IAAAsB,wBAAA,GAAApB,sBAAA,CAAAF,OAAA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CAAqC,EAArCA,8CAAqC;EACrCC,oBAAoB,EAApBA,6BAAoB;EACpBC,8BAA8B,EAA9BA,uCAA8B;EAC9BC,0BAA0B,EAA1BA,mCAA0B;EAC1BC,aAAa,EAAbA,sBAAa;EACbC,YAAY,EAAZA,qBAAY;EAEZC,oBAAoB,EAApBA,6BAAoB;EAEpB;EACAC,oBAAoB,EAApBA,6BAAoB;EACpBC,aAAa,EAAbA,sBAAa;EAEb;EACA;AACF;AACA;AACA;EACEC,kBAAkB,EAAlBA,2BAAkB;EAClBC,qBAAqB,EAArBA,8BAAqB;EACrBC,kBAAkB,EAAlBA,2BAAkB;EAClBC,iBAAiB,EAAjBA,0BAAiB;EACjBC,gBAAgB,EAAhBA,yBAAgB;EAEhB;EACAC,kBAAkB,EAAlBA,2BAAkB;EAElB;AACF;AACA;EACEC,2BAA2B,EAA3BA,oCAA2B;EAC3B;AACF;AACA;EACEC,2BAA2B,EAA3BA,oCAA2B;EAC3B;AACF;AACA;EACEC,oBAAoB,EAApBA,6BAAoB;EACpBC,qBAAqB,EAArBA,8BAAqB;EACrB;AACF;AACA;AACA;AACA;EACEC,wBAAwB,EAAxBA,iCAAwB;EACxB;AACF;AACA;AACA;AACA;EACEC,yBAAyB,EAAzBA;AACF,CAAC;AAAAxF,OAAA,CAAAW,OAAA,GAAA2C,QAAA"}
1
+ {"version":3,"names":["_reactNative","require","_useHealthkitAuthorization","_interopRequireDefault","_useIsHealthDataAvailable","_useMostRecentCategorySample","_useMostRecentQuantitySample","_useMostRecentWorkout","_useSources","_useStatisticsForQuantity","_useSubscribeToChanges","_nativeTypes","_interopRequireWildcard","_deleteQuantitySample","_deleteSamples","_getDateOfBirth","_getMostRecentCategorySample","_getMostRecentQuantitySample","_getMostRecentWorkout","_getPreferredUnit","_getPreferredUnits","_getRequestStatusForAuthorization","_getWorkoutPlanById","_queryCategorySamples","_queryCategorySamplesWithAnchor","_queryCorrelationSamples","_queryHeartbeatSeriesSamples","_queryHeartbeatSeriesSamplesWithAnchor","_queryQuantitySamples","_queryQuantitySamplesWithAnchor","_querySources","_queryStatisticsForQuantity","_queryWorkouts","_requestAuthorization","_saveCategorySample","_saveCorrelationSample","_saveQuantitySample","_saveWorkoutRoute","_saveWorkoutSample","_subscribeToChanges","_types","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","newObj","hasPropertyDescriptor","getOwnPropertyDescriptor","desc","set","currentMajorVersionIOS","Platform","OS","parseInt","Version","allQuantityTypesList","values","HKQuantityTypeIdentifier","availableQuantityTypes","majorVersionIOS","arguments","length","undefined","filter","type","cyclingCadence","cyclingFunctionalThresholdPower","cyclingPower","cyclingSpeed","physicalEffort","timeInDaylight","includes","authorizationStatusFor","Native","bind","isHealthDataAvailable","canAccessProtectedData","disableBackgroundDelivery","disableAllBackgroundDelivery","enableBackgroundDelivery","getBiologicalSex","getFitzpatrickSkinType","getWheelchairUse","getBloodType","getWorkoutRoutes","_default","isProtectedDataAvailable","getDateOfBirth","getMostRecentQuantitySample","getMostRecentCategorySample","getMostRecentWorkout","getWorkoutPlanById","getPreferredUnit","getPreferredUnits","getRequestStatusForAuthorization","queryCategorySamples","queryCategorySamplesWithAnchor","queryCorrelationSamples","queryHeartbeatSeriesSamples","queryHeartbeatSeriesSamplesWithAnchor","queryQuantitySamples","queryQuantitySamplesWithAnchor","queryStatisticsForQuantity","queryWorkouts","querySources","requestAuthorization","deleteQuantitySample","deleteSamples","saveCategorySample","saveCorrelationSample","saveQuantitySample","saveWorkoutSample","saveWorkoutRoute","subscribeToChanges","useMostRecentCategorySample","useMostRecentQuantitySample","useMostRecentWorkout","useSubscribeToChanges","useIsHealthDataAvailable","useHealthkitAuthorization","useSources","useStatisticsForQuantity"],"sources":["index.ios.tsx"],"sourcesContent":["import { Platform } from 'react-native'\n\nimport useHealthkitAuthorization from './hooks/useHealthkitAuthorization'\nimport useIsHealthDataAvailable from './hooks/useIsHealthDataAvailable'\nimport useMostRecentCategorySample from './hooks/useMostRecentCategorySample'\nimport useMostRecentQuantitySample from './hooks/useMostRecentQuantitySample'\nimport useMostRecentWorkout from './hooks/useMostRecentWorkout'\nimport useSources from './hooks/useSources'\nimport useStatisticsForQuantity from './hooks/useStatisticsForQuantity'\nimport useSubscribeToChanges from './hooks/useSubscribeToChanges'\nimport Native, { HKQuantityTypeIdentifier } from './native-types'\nimport deleteQuantitySample from './utils/deleteQuantitySample'\nimport deleteSamples from './utils/deleteSamples'\nimport getDateOfBirth from './utils/getDateOfBirth'\nimport getMostRecentCategorySample from './utils/getMostRecentCategorySample'\nimport getMostRecentQuantitySample from './utils/getMostRecentQuantitySample'\nimport getMostRecentWorkout from './utils/getMostRecentWorkout'\nimport getPreferredUnit from './utils/getPreferredUnit'\nimport getPreferredUnits from './utils/getPreferredUnits'\nimport getRequestStatusForAuthorization from './utils/getRequestStatusForAuthorization'\nimport getWorkoutPlanById from './utils/getWorkoutPlanById'\nimport queryCategorySamples from './utils/queryCategorySamples'\nimport queryCategorySamplesWithAnchor from './utils/queryCategorySamplesWithAnchor'\nimport queryCorrelationSamples from './utils/queryCorrelationSamples'\nimport queryHeartbeatSeriesSamples from './utils/queryHeartbeatSeriesSamples'\nimport queryHeartbeatSeriesSamplesWithAnchor from './utils/queryHeartbeatSeriesSamplesWithAnchor'\nimport queryQuantitySamples from './utils/queryQuantitySamples'\nimport queryQuantitySamplesWithAnchor from './utils/queryQuantitySamplesWithAnchor'\nimport querySources from './utils/querySources'\nimport queryStatisticsForQuantity from './utils/queryStatisticsForQuantity'\nimport queryWorkouts from './utils/queryWorkouts'\nimport requestAuthorization from './utils/requestAuthorization'\nimport saveCategorySample from './utils/saveCategorySample'\nimport saveCorrelationSample from './utils/saveCorrelationSample'\nimport saveQuantitySample from './utils/saveQuantitySample'\nimport saveWorkoutRoute from './utils/saveWorkoutRoute'\nimport saveWorkoutSample from './utils/saveWorkoutSample'\nimport subscribeToChanges from './utils/subscribeToChanges'\n\nconst currentMajorVersionIOS = Platform.OS === 'ios' ? parseInt(Platform.Version, 10) : 0\n\nconst allQuantityTypesList = [...Object.values(HKQuantityTypeIdentifier)]\n\nconst availableQuantityTypes = (majorVersionIOS = currentMajorVersionIOS) => {\n if (majorVersionIOS >= 17) {\n return allQuantityTypesList\n }\n\n // remove types that are not available before iOS 17\n return allQuantityTypesList.filter((type) => ![\n HKQuantityTypeIdentifier.cyclingCadence,\n HKQuantityTypeIdentifier.cyclingFunctionalThresholdPower,\n HKQuantityTypeIdentifier.cyclingPower,\n HKQuantityTypeIdentifier.cyclingSpeed,\n HKQuantityTypeIdentifier.physicalEffort,\n HKQuantityTypeIdentifier.timeInDaylight,\n ].includes(type))\n}\n\nconst authorizationStatusFor = Native.authorizationStatusFor.bind(Native)\nconst isHealthDataAvailable = Native.isHealthDataAvailable.bind(Native)\n// Todo [>8]: Rename to align with Apple function name (isProtectedDataAvailable)\nconst canAccessProtectedData = Native.canAccessProtectedData.bind(Native)\nconst disableBackgroundDelivery = Native.disableBackgroundDelivery.bind(Native)\nconst disableAllBackgroundDelivery = Native.disableAllBackgroundDelivery.bind(Native)\nconst enableBackgroundDelivery = Native.enableBackgroundDelivery.bind(Native)\nconst getBiologicalSex = Native.getBiologicalSex.bind(Native)\nconst getFitzpatrickSkinType = Native.getFitzpatrickSkinType.bind(Native)\nconst getWheelchairUse = Native.getWheelchairUse.bind(Native)\nconst getBloodType = Native.getBloodType.bind(Native)\nconst getWorkoutRoutes = Native.getWorkoutRoutes.bind(Native)\n\n/**\n * @see {@link https://developer.apple.com/documentation/healthkit/about_the_healthkit_framework About the HealthKit Framework (Apple Docs)}\n */\nexport default {\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614154-authorizationstatus authorizationStatus(for:) (Apple Docs) }\n * @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Authorizing access to health data (Apple Docs) }\n */\n authorizationStatusFor,\n\n /**\n *\n * @returns All available quantity types for the current iOS version (currently excluding types that are not available before iOS 17)\n */\n availableQuantityTypes,\n\n /**\n * @description By default, HealthKit data is available on iOS and watchOS. HealthKit data is also available on iPadOS 17 or later. However, devices running in an enterprise environment may restrict access to HealthKit data.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614180-ishealthdataavailable isHealthDataAvailable() (Apple Docs)}\n * @returns {boolean} true if HealthKit is available; otherwise, false.\n */\n isHealthDataAvailable,\n\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614181-isprotecteddataavailable isProtectedDataAvailable() (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/protecting_user_privacy#3705074 Protecting User Privacy - Access encrypted data (Apple Docs)}\n * @returns {boolean} A Boolean value that indicates whether content protection is active.\n */\n isProtectedDataAvailable: canAccessProtectedData,\n\n // Todo [>8]: Remove to align with Apple function name (isProtectedDataAvailable)\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614181-isprotecteddataavailable isProtectedDataAvailable() (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/protecting_user_privacy#3705074 Protecting User Privacy - Access encrypted data (Apple Docs)}\n * @deprecated Use {@link isProtectedDataAvailable} instead. Will be removed in next major version.\n * @returns {boolean} A Boolean value that indicates whether content protection is active.\n */\n canAccessProtectedData,\n\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614158-disableallbackgrounddelivery disableAllBackgroundDelivery(completion:) (Apple Docs)}\n */\n disableAllBackgroundDelivery,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614177-disablebackgrounddelivery disableBackgroundDelivery(for:withCompletion:) (Apple Docs)}\n */\n disableBackgroundDelivery,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614175-enablebackgrounddelivery enableBackgroundDelivery(for:frequency:withCompletion:) (Apple Docs)}\n */\n enableBackgroundDelivery,\n\n // simple convenience getters\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614171-biologicalsex biologicalSex() (Apple Docs)}\n */\n getBiologicalSex,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614161-fitzpatrickskintype fitzpatrickSkinType() (Apple Docs)}\n */\n getFitzpatrickSkinType,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1648356-wheelchairuse wheelchairUse() (Apple Docs)}\n */\n getWheelchairUse,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614164-bloodtype bloodType() (Apple Docs)}\n */\n getBloodType,\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1648357-dateofbirthcomponents dateOfBirthComponents() (Apple Docs)}\n */\n getDateOfBirth,\n\n getMostRecentQuantitySample,\n getMostRecentCategorySample,\n getMostRecentWorkout,\n\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/reading_route_data Reading route data (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/hkworkoutroutequery HKWorkoutRouteQuery (Apple Docs)}\n */\n getWorkoutRoutes,\n getWorkoutPlanById,\n\n getPreferredUnit,\n getPreferredUnits,\n getRequestStatusForAuthorization,\n\n // query methods\n queryCategorySamples,\n queryCategorySamplesWithAnchor,\n queryCorrelationSamples,\n queryHeartbeatSeriesSamples,\n queryHeartbeatSeriesSamplesWithAnchor,\n queryQuantitySamples,\n queryQuantitySamplesWithAnchor,\n queryStatisticsForQuantity,\n queryWorkouts,\n querySources,\n\n requestAuthorization,\n\n // delete methods\n deleteQuantitySample,\n deleteSamples,\n\n // save methods\n /**\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614168-savecategorysample save(_:withCompletion:) (Apple Docs)}\n * @see {@link https://developer.apple.com/documentation/healthkit/saving_data_to_healthkit Saving data to HealthKit (Apple Docs)}\n */\n saveCategorySample,\n saveCorrelationSample,\n saveQuantitySample,\n saveWorkoutSample,\n saveWorkoutRoute,\n\n // subscriptions\n subscribeToChanges,\n\n /**\n * @returns the most recent sample for the given category type.\n */\n useMostRecentCategorySample,\n /**\n * @returns the most recent sample for the given quantity type.\n */\n useMostRecentQuantitySample,\n /**\n * @returns the most recent workout sample.\n */\n useMostRecentWorkout,\n useSubscribeToChanges,\n /**\n * @description By default, HealthKit data is available on iOS and watchOS. HealthKit data is also available on iPadOS 17 or later. However, devices running in an enterprise environment may restrict access to HealthKit data.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614180-ishealthdataavailable Apple Docs}\n * @returns {boolean | null} true if HealthKit is available; otherwise, false. null while initializing.\n */\n useIsHealthDataAvailable,\n /**\n * @description Hook to retrieve the current authorization status for the given types, and request authorization if needed.\n * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614152-requestauthorization Apple Docs - requestAuthorization}\n * @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Apple Docs - Authorizing access to health data}\n */\n useHealthkitAuthorization,\n useSources,\n useStatisticsForQuantity,\n}\n\nconst isProtectedDataAvailable = canAccessProtectedData\n\nexport {\n authorizationStatusFor,\n availableQuantityTypes,\n disableAllBackgroundDelivery,\n disableBackgroundDelivery,\n enableBackgroundDelivery,\n getBiologicalSex,\n getBloodType,\n getDateOfBirth,\n getFitzpatrickSkinType,\n getMostRecentCategorySample,\n getMostRecentQuantitySample,\n getMostRecentWorkout,\n getPreferredUnit,\n getPreferredUnits,\n getRequestStatusForAuthorization,\n getWheelchairUse,\n getWorkoutRoutes,\n isHealthDataAvailable,\n queryCategorySamples,\n queryCategorySamplesWithAnchor,\n queryCorrelationSamples,\n queryHeartbeatSeriesSamples,\n queryHeartbeatSeriesSamplesWithAnchor,\n queryQuantitySamples,\n queryQuantitySamplesWithAnchor,\n queryStatisticsForQuantity,\n queryWorkouts,\n querySources,\n requestAuthorization,\n deleteQuantitySample,\n deleteSamples,\n getWorkoutPlanById,\n saveCategorySample,\n saveCorrelationSample,\n saveQuantitySample,\n saveWorkoutSample,\n saveWorkoutRoute,\n subscribeToChanges,\n useMostRecentCategorySample,\n useMostRecentQuantitySample,\n useMostRecentWorkout,\n useSubscribeToChanges,\n useHealthkitAuthorization,\n useIsHealthDataAvailable,\n useSources,\n useStatisticsForQuantity,\n canAccessProtectedData,\n isProtectedDataAvailable,\n}\n\nexport * from './types'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,0BAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,yBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,4BAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,4BAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,qBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,WAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,yBAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,sBAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,YAAA,GAAAC,uBAAA,CAAAX,OAAA;AACA,IAAAY,qBAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,cAAA,GAAAX,sBAAA,CAAAF,OAAA;AACA,IAAAc,eAAA,GAAAZ,sBAAA,CAAAF,OAAA;AACA,IAAAe,4BAAA,GAAAb,sBAAA,CAAAF,OAAA;AACA,IA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