@iternio/react-native-auto-play 0.5.14-beta.1 → 0.6.1

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 (201) hide show
  1. package/README.md +270 -36
  2. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/AndroidAutoSession.kt +5 -0
  3. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridMapTemplate.kt +9 -2
  4. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/NativeBackdrop.kt +40 -0
  5. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/VirtualRenderer.kt +52 -0
  6. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/GridTemplate.kt +47 -13
  7. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/Parser.kt +69 -15
  8. package/ios/Types.swift +3 -0
  9. package/ios/extensions/UIImage+Toggle.swift +5 -2
  10. package/ios/hybrid/HybridAutoPlay.swift +28 -16
  11. package/ios/hybrid/HybridMapTemplate.swift +22 -5
  12. package/ios/scenes/AutoPlayInterfaceController.swift +261 -72
  13. package/ios/templates/AutoPlayMapPanelDelegate.swift +190 -0
  14. package/ios/templates/AutoPlayTemplate.swift +24 -2
  15. package/ios/templates/GridTemplate.swift +57 -57
  16. package/ios/templates/InformationTemplate.swift +84 -9
  17. package/ios/templates/ListTemplate.swift +66 -11
  18. package/ios/templates/MapTemplate.swift +83 -68
  19. package/ios/templates/MessageTemplate.swift +72 -6
  20. package/ios/templates/Parser.swift +564 -69
  21. package/ios/templates/SearchTemplate.swift +1 -1
  22. package/ios/templates/TemplateStore.swift +5 -15
  23. package/ios/utils/SymbolFont.swift +13 -28
  24. package/jest.js +2 -0
  25. package/lib/Constants.d.ts +4 -0
  26. package/lib/Constants.js +6 -0
  27. package/lib/index.d.ts +1 -0
  28. package/lib/index.js +1 -0
  29. package/lib/index.web.d.ts +73 -0
  30. package/lib/index.web.js +72 -1
  31. package/lib/specs/MapTemplate.nitro.d.ts +3 -1
  32. package/lib/templates/GridTemplate.d.ts +23 -3
  33. package/lib/templates/GridTemplate.js +8 -0
  34. package/lib/templates/InformationTemplate.d.ts +38 -12
  35. package/lib/templates/ListTemplate.d.ts +16 -47
  36. package/lib/templates/MapTemplate.d.ts +26 -2
  37. package/lib/templates/MapTemplate.js +16 -2
  38. package/lib/templates/MessageTemplate.d.ts +52 -11
  39. package/lib/templates/MessageTemplate.js +1 -1
  40. package/lib/types/Image.d.ts +6 -1
  41. package/lib/utils/NitroColor.d.ts +1 -0
  42. package/lib/utils/NitroColor.js +8 -0
  43. package/lib/utils/NitroImage.js +1 -1
  44. package/lib/utils/NitroManeuver.js +1 -3
  45. package/lib/utils/NitroOptionsPanel.d.ts +103 -0
  46. package/lib/utils/NitroOptionsPanel.js +63 -0
  47. package/lib/utils/NitroSection.d.ts +89 -2
  48. package/lib/utils/NitroSection.js +49 -2
  49. package/lib-cjs/AutoPlayHeadlessJsTask.js +16 -0
  50. package/lib-cjs/Constants.js +9 -0
  51. package/lib-cjs/components/MapTemplateContext.js +10 -0
  52. package/lib-cjs/components/SafeAreaInsetsContext.js +21 -0
  53. package/lib-cjs/components/SafeAreaView.js +22 -0
  54. package/lib-cjs/components/WindowInformationWrapper.js +20 -0
  55. package/lib-cjs/hooks/useAndroidAutoTelemetry.js +115 -0
  56. package/lib-cjs/hooks/useFocusedEffect.js +35 -0
  57. package/lib-cjs/hooks/useMapTemplate.js +13 -0
  58. package/lib-cjs/hooks/useSafeAreaInsets.js +9 -0
  59. package/lib-cjs/hooks/useVoiceInput.js +42 -0
  60. package/lib-cjs/hybrid/HybridAndroidAutoTelemetry.js +4 -0
  61. package/lib-cjs/hybrid/HybridAndroidWindowInformation.js +4 -0
  62. package/lib-cjs/hybrid/HybridAutoPlay.js +5 -0
  63. package/lib-cjs/hybrid/HybridVoice.js +61 -0
  64. package/lib-cjs/index.js +76 -0
  65. package/lib-cjs/index.web.js +98 -0
  66. package/lib-cjs/scenes/AutoPlayCluster.js +140 -0
  67. package/lib-cjs/scenes/CarPlayDashboardScene.js +100 -0
  68. package/lib-cjs/specs/AndroidAutoTelemetry.nitro.js +2 -0
  69. package/lib-cjs/specs/AndroidAutomotive.nitro.js +16 -0
  70. package/lib-cjs/specs/AndroidWindowInformation.nitro.js +2 -0
  71. package/lib-cjs/specs/AutoPlay.nitro.js +2 -0
  72. package/lib-cjs/specs/CarPlayDashboard.nitro.js +2 -0
  73. package/lib-cjs/specs/Cluster.nitro.js +2 -0
  74. package/lib-cjs/specs/GridTemplate.nitro.js +2 -0
  75. package/lib-cjs/specs/InformationTemplate.nitro.js +2 -0
  76. package/lib-cjs/specs/ListTemplate.nitro.js +2 -0
  77. package/lib-cjs/specs/MapTemplate.nitro.js +2 -0
  78. package/lib-cjs/specs/MessageTemplate.nitro.js +2 -0
  79. package/lib-cjs/specs/SearchTemplate.nitro.js +2 -0
  80. package/lib-cjs/specs/SignInTemplate.nitro.js +2 -0
  81. package/lib-cjs/specs/Voice.nitro.js +2 -0
  82. package/lib-cjs/templates/GridTemplate.js +41 -0
  83. package/lib-cjs/templates/InformationTemplate.js +49 -0
  84. package/lib-cjs/templates/ListTemplate.js +33 -0
  85. package/lib-cjs/templates/MapTemplate.js +168 -0
  86. package/lib-cjs/templates/MessageTemplate.js +50 -0
  87. package/lib-cjs/templates/SearchTemplate.js +32 -0
  88. package/lib-cjs/templates/SignInTemplate.js +55 -0
  89. package/lib-cjs/templates/Template.js +40 -0
  90. package/lib-cjs/types/Button.js +12 -0
  91. package/lib-cjs/types/Event.js +2 -0
  92. package/lib-cjs/types/Image.js +2 -0
  93. package/lib-cjs/types/Maneuver.js +77 -0
  94. package/lib-cjs/types/RootComponent.js +2 -0
  95. package/lib-cjs/types/SignInMethod.js +22 -0
  96. package/lib-cjs/types/Telemetry.js +24 -0
  97. package/lib-cjs/types/Text.js +8 -0
  98. package/lib-cjs/types/Trip.js +2 -0
  99. package/lib-cjs/types/Voice.js +2 -0
  100. package/lib-cjs/utils/ErrorUtil.js +34 -0
  101. package/lib-cjs/utils/NitroAction.js +129 -0
  102. package/lib-cjs/utils/NitroAlert.js +19 -0
  103. package/lib-cjs/utils/NitroAttributedString.js +14 -0
  104. package/lib-cjs/utils/NitroColor.js +32 -0
  105. package/lib-cjs/utils/NitroGrid.js +12 -0
  106. package/lib-cjs/utils/NitroImage.js +97 -0
  107. package/lib-cjs/utils/NitroManeuver.js +79 -0
  108. package/lib-cjs/utils/NitroMapButton.js +33 -0
  109. package/lib-cjs/utils/NitroOptionsPanel.js +66 -0
  110. package/lib-cjs/utils/NitroSection.js +112 -0
  111. package/nitrogen/generated/android/ReactNativeAutoPlay+autolinking.cmake +1 -0
  112. package/nitrogen/generated/android/c++/JChargingConnector.hpp +79 -0
  113. package/nitrogen/generated/android/c++/JGridImageSize.hpp +64 -0
  114. package/nitrogen/generated/android/c++/JGridTemplateConfig.hpp +7 -1
  115. package/nitrogen/generated/android/c++/JHybridGridTemplateSpec.cpp +4 -0
  116. package/nitrogen/generated/android/c++/JHybridInformationTemplateSpec.cpp +12 -0
  117. package/nitrogen/generated/android/c++/JHybridListTemplateSpec.cpp +12 -0
  118. package/nitrogen/generated/android/c++/JHybridMapTemplateSpec.cpp +78 -3
  119. package/nitrogen/generated/android/c++/JHybridMapTemplateSpec.hpp +2 -1
  120. package/nitrogen/generated/android/c++/JHybridSearchTemplateSpec.cpp +12 -0
  121. package/nitrogen/generated/android/c++/JInformationTemplateConfig.hpp +6 -0
  122. package/nitrogen/generated/android/c++/JListImageType.hpp +67 -0
  123. package/nitrogen/generated/android/c++/JListTemplateConfig.hpp +6 -0
  124. package/nitrogen/generated/android/c++/JNitroChargerLocation.hpp +115 -0
  125. package/nitrogen/generated/android/c++/JNitroChargerOutlet.hpp +82 -0
  126. package/nitrogen/generated/android/c++/JNitroColor.hpp +8 -4
  127. package/nitrogen/generated/android/c++/JNitroOptionsPanelChargerSection.hpp +112 -0
  128. package/nitrogen/generated/android/c++/JNitroOptionsPanelConfig.hpp +157 -0
  129. package/nitrogen/generated/android/c++/JNitroOptionsPanelGridSection.hpp +102 -0
  130. package/nitrogen/generated/android/c++/JNitroOptionsPanelSection.cpp +30 -0
  131. package/nitrogen/generated/android/c++/JNitroOptionsPanelSection.hpp +129 -0
  132. package/nitrogen/generated/android/c++/JNitroRow.hpp +33 -3
  133. package/nitrogen/generated/android/c++/JNitroSection.hpp +6 -0
  134. package/nitrogen/generated/android/c++/JSearchTemplateConfig.hpp +6 -0
  135. package/nitrogen/generated/android/c++/JWaypointCoordinate.hpp +65 -0
  136. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/ChargingConnector.kt +30 -0
  137. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/GridImageSize.kt +25 -0
  138. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/GridTemplateConfig.kt +9 -4
  139. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridMapTemplateSpec.kt +5 -1
  140. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/ListImageType.kt +26 -0
  141. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroChargerLocation.kt +90 -0
  142. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroChargerOutlet.kt +70 -0
  143. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroColor.kt +9 -4
  144. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroOptionsPanelChargerSection.kt +61 -0
  145. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroOptionsPanelConfig.kt +61 -0
  146. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroOptionsPanelGridSection.kt +56 -0
  147. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroOptionsPanelSection.kt +75 -0
  148. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroRow.kt +36 -6
  149. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/WaypointCoordinate.kt +61 -0
  150. package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.hpp +174 -0
  151. package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Umbrella.hpp +27 -0
  152. package/nitrogen/generated/ios/c++/HybridGridTemplateSpecSwift.hpp +3 -0
  153. package/nitrogen/generated/ios/c++/HybridInformationTemplateSpecSwift.hpp +9 -0
  154. package/nitrogen/generated/ios/c++/HybridListTemplateSpecSwift.hpp +9 -0
  155. package/nitrogen/generated/ios/c++/HybridMapTemplateSpecSwift.hpp +47 -1
  156. package/nitrogen/generated/ios/c++/HybridSearchTemplateSpecSwift.hpp +9 -0
  157. package/nitrogen/generated/ios/swift/ChargingConnector.swift +68 -0
  158. package/nitrogen/generated/ios/swift/GridImageSize.swift +48 -0
  159. package/nitrogen/generated/ios/swift/GridTemplateConfig.swift +12 -1
  160. package/nitrogen/generated/ios/swift/HybridMapTemplateSpec.swift +2 -1
  161. package/nitrogen/generated/ios/swift/HybridMapTemplateSpec_cxx.swift +31 -4
  162. package/nitrogen/generated/ios/swift/ListImageType.swift +52 -0
  163. package/nitrogen/generated/ios/swift/NitroChargerLocation.swift +161 -0
  164. package/nitrogen/generated/ios/swift/NitroChargerOutlet.swift +65 -0
  165. package/nitrogen/generated/ios/swift/NitroColor.swift +20 -2
  166. package/nitrogen/generated/ios/swift/NitroOptionsPanelChargerSection.swift +64 -0
  167. package/nitrogen/generated/ios/swift/NitroOptionsPanelConfig.swift +94 -0
  168. package/nitrogen/generated/ios/swift/NitroOptionsPanelGridSection.swift +53 -0
  169. package/nitrogen/generated/ios/swift/NitroOptionsPanelSection.swift +32 -0
  170. package/nitrogen/generated/ios/swift/NitroRow.swift +81 -1
  171. package/nitrogen/generated/ios/swift/WaypointCoordinate.swift +52 -0
  172. package/nitrogen/generated/shared/c++/ChargingConnector.hpp +104 -0
  173. package/nitrogen/generated/shared/c++/GridImageSize.hpp +84 -0
  174. package/nitrogen/generated/shared/c++/GridTemplateConfig.hpp +8 -1
  175. package/nitrogen/generated/shared/c++/HybridMapTemplateSpec.cpp +1 -0
  176. package/nitrogen/generated/shared/c++/HybridMapTemplateSpec.hpp +5 -1
  177. package/nitrogen/generated/shared/c++/ListImageType.hpp +88 -0
  178. package/nitrogen/generated/shared/c++/NitroChargerLocation.hpp +131 -0
  179. package/nitrogen/generated/shared/c++/NitroChargerOutlet.hpp +98 -0
  180. package/nitrogen/generated/shared/c++/NitroColor.hpp +7 -3
  181. package/nitrogen/generated/shared/c++/NitroOptionsPanelChargerSection.hpp +98 -0
  182. package/nitrogen/generated/shared/c++/NitroOptionsPanelConfig.hpp +107 -0
  183. package/nitrogen/generated/shared/c++/NitroOptionsPanelGridSection.hpp +91 -0
  184. package/nitrogen/generated/shared/c++/NitroRow.hpp +39 -2
  185. package/nitrogen/generated/shared/c++/WaypointCoordinate.hpp +91 -0
  186. package/package.json +7 -3
  187. package/src/Constants.ts +9 -0
  188. package/src/index.ts +1 -0
  189. package/src/index.web.ts +166 -0
  190. package/src/specs/MapTemplate.nitro.ts +3 -1
  191. package/src/templates/GridTemplate.ts +38 -3
  192. package/src/templates/InformationTemplate.ts +60 -29
  193. package/src/templates/ListTemplate.ts +27 -55
  194. package/src/templates/MapTemplate.ts +60 -2
  195. package/src/templates/MessageTemplate.ts +71 -24
  196. package/src/types/Image.ts +6 -1
  197. package/src/utils/NitroColor.ts +10 -1
  198. package/src/utils/NitroImage.ts +1 -5
  199. package/src/utils/NitroManeuver.ts +1 -4
  200. package/src/utils/NitroOptionsPanel.ts +218 -0
  201. package/src/utils/NitroSection.ts +160 -5
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SearchTemplate = void 0;
4
+ const react_native_nitro_modules_1 = require("react-native-nitro-modules");
5
+ const NitroAction_1 = require("../utils/NitroAction");
6
+ const NitroSection_1 = require("../utils/NitroSection");
7
+ const Template_1 = require("./Template");
8
+ const HybridSearchTemplate = react_native_nitro_modules_1.NitroModules.createHybridObject('SearchTemplate');
9
+ class SearchTemplate extends Template_1.Template {
10
+ template = this;
11
+ constructor(config) {
12
+ super(config);
13
+ const { headerActions, results, ...rest } = config;
14
+ const nitroConfig = {
15
+ ...rest,
16
+ id: this.id,
17
+ headerActions: NitroAction_1.NitroActionUtil.convert(this.template, headerActions),
18
+ results: NitroSection_1.NitroSectionUtil.convert(this.template, results)?.at(0) ?? {
19
+ items: [],
20
+ type: 'default',
21
+ },
22
+ };
23
+ HybridSearchTemplate.createSearchTemplate(nitroConfig);
24
+ }
25
+ updateSearchResults(results) {
26
+ return HybridSearchTemplate.updateSearchResults(this.id, NitroSection_1.NitroSectionUtil.convert(this.template, results)?.at(0) ?? {
27
+ items: [],
28
+ type: 'default',
29
+ });
30
+ }
31
+ }
32
+ exports.SearchTemplate = SearchTemplate;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SignInTemplate = exports.HybridSignInTemplate = void 0;
4
+ const react_native_1 = require("react-native");
5
+ const react_native_nitro_modules_1 = require("react-native-nitro-modules");
6
+ const SignInMethod_1 = require("../types/SignInMethod");
7
+ const NitroAction_1 = require("../utils/NitroAction");
8
+ const Template_1 = require("./Template");
9
+ exports.HybridSignInTemplate = react_native_1.Platform.OS === 'android'
10
+ ? react_native_nitro_modules_1.NitroModules.createHybridObject('SignInTemplate')
11
+ : null;
12
+ /**
13
+ * A template for signing in to an account.
14
+ * @namespace Android
15
+ */
16
+ class SignInTemplate extends Template_1.Template {
17
+ template = this;
18
+ constructor(config) {
19
+ super(config);
20
+ const { headerActions, actions, ...rest } = config;
21
+ const nitroConfig = {
22
+ ...rest,
23
+ id: this.id,
24
+ headerActions: NitroAction_1.NitroActionUtil.convert(this.template, headerActions),
25
+ actions: NitroAction_1.NitroActionUtil.convert(this.template, actions),
26
+ };
27
+ if (config.signInMethod.method === SignInMethod_1.SignInMethods.PIN &&
28
+ (config.signInMethod.pin?.length > 12 || config.signInMethod.pin?.length < 1)) {
29
+ throw new Error('PIN must be 1-12 characters');
30
+ }
31
+ exports.HybridSignInTemplate?.createSignInTemplate(nitroConfig);
32
+ }
33
+ /**
34
+ * Updates the template with new config. The config is merged with the current one,
35
+ * so if values are not provided, they will stay. To change values, they need to be overridden.
36
+ *
37
+ * @param updatedConfig - The updated config for the template.
38
+ * @returns A promise that resolves when the template is updated.
39
+ */
40
+ updateTemplate(updatedConfig) {
41
+ const { headerActions, actions, ...rest } = updatedConfig;
42
+ const nitroConfig = {
43
+ ...rest,
44
+ id: this.id,
45
+ headerActions: NitroAction_1.NitroActionUtil.convert(this.template, headerActions),
46
+ actions: NitroAction_1.NitroActionUtil.convert(this.template, actions),
47
+ };
48
+ if (nitroConfig.signInMethod?.method === SignInMethod_1.SignInMethods.PIN &&
49
+ (nitroConfig.signInMethod.pin?.length > 12 || nitroConfig.signInMethod.pin?.length < 1)) {
50
+ throw new Error('PIN must be 1-12 characters');
51
+ }
52
+ return exports.HybridSignInTemplate?.updateTemplate(this.id, nitroConfig);
53
+ }
54
+ }
55
+ exports.SignInTemplate = SignInTemplate;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Template = void 0;
7
+ const react_native_uuid_1 = __importDefault(require("react-native-uuid"));
8
+ const HybridAutoPlay_1 = require("../hybrid/HybridAutoPlay");
9
+ const NitroAction_1 = require("../utils/NitroAction");
10
+ class Template {
11
+ id;
12
+ constructor(config) {
13
+ // templates that render on a surface provide their own id, others use a auto generated one
14
+ this.id =
15
+ 'id' in config && config.id != null && typeof config.id === 'string' ? config.id : react_native_uuid_1.default.v4();
16
+ }
17
+ /**
18
+ * set as root template on the stack
19
+ */
20
+ setRootTemplate() {
21
+ return HybridAutoPlay_1.HybridAutoPlay.setRootTemplate(this.id);
22
+ }
23
+ /**
24
+ * push this template on the stack and show it to the user
25
+ */
26
+ push() {
27
+ return HybridAutoPlay_1.HybridAutoPlay.pushTemplate(this.id);
28
+ }
29
+ /**
30
+ * remove all templates above this one from the stack
31
+ */
32
+ popTo() {
33
+ return HybridAutoPlay_1.HybridAutoPlay.popToTemplate(this.id);
34
+ }
35
+ setHeaderActions(headerActions) {
36
+ const nitroActions = NitroAction_1.NitroActionUtil.convert(this, headerActions);
37
+ return HybridAutoPlay_1.HybridAutoPlay.setTemplateHeaderActions(this.id, nitroActions);
38
+ }
39
+ }
40
+ exports.Template = Template;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Flag = void 0;
4
+ /**
5
+ * @namespace Android
6
+ */
7
+ var Flag;
8
+ (function (Flag) {
9
+ Flag[Flag["Primary"] = 1] = "Primary";
10
+ Flag[Flag["Persistent"] = 2] = "Persistent";
11
+ Flag[Flag["Default"] = 4] = "Default";
12
+ })(Flag || (exports.Flag = Flag = {}));
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ManeuverState = exports.KeepType = exports.ForkType = exports.OnRampType = exports.OffRampType = exports.TurnType = exports.TrafficSide = exports.ManeuverType = void 0;
4
+ var ManeuverType;
5
+ (function (ManeuverType) {
6
+ ManeuverType[ManeuverType["Depart"] = 0] = "Depart";
7
+ ManeuverType[ManeuverType["Arrive"] = 10] = "Arrive";
8
+ ManeuverType[ManeuverType["ArriveLeft"] = 11] = "ArriveLeft";
9
+ ManeuverType[ManeuverType["ArriveRight"] = 12] = "ArriveRight";
10
+ ManeuverType[ManeuverType["Straight"] = 20] = "Straight";
11
+ ManeuverType[ManeuverType["Turn"] = 30] = "Turn";
12
+ ManeuverType[ManeuverType["Roundabout"] = 40] = "Roundabout";
13
+ ManeuverType[ManeuverType["OffRamp"] = 50] = "OffRamp";
14
+ ManeuverType[ManeuverType["OnRamp"] = 60] = "OnRamp";
15
+ ManeuverType[ManeuverType["Fork"] = 70] = "Fork";
16
+ ManeuverType[ManeuverType["EnterFerry"] = 80] = "EnterFerry";
17
+ ManeuverType[ManeuverType["Keep"] = 90] = "Keep";
18
+ })(ManeuverType || (exports.ManeuverType = ManeuverType = {}));
19
+ var TrafficSide;
20
+ (function (TrafficSide) {
21
+ TrafficSide[TrafficSide["Right"] = 0] = "Right";
22
+ TrafficSide[TrafficSide["Left"] = 1] = "Left";
23
+ })(TrafficSide || (exports.TrafficSide = TrafficSide = {}));
24
+ var TurnType;
25
+ (function (TurnType) {
26
+ TurnType[TurnType["NoTurn"] = 0] = "NoTurn";
27
+ TurnType[TurnType["SlightLeft"] = 1] = "SlightLeft";
28
+ TurnType[TurnType["SlightRight"] = 2] = "SlightRight";
29
+ TurnType[TurnType["NormalLeft"] = 3] = "NormalLeft";
30
+ TurnType[TurnType["NormalRight"] = 4] = "NormalRight";
31
+ TurnType[TurnType["SharpLeft"] = 5] = "SharpLeft";
32
+ TurnType[TurnType["SharpRight"] = 6] = "SharpRight";
33
+ TurnType[TurnType["UTurnLeft"] = 7] = "UTurnLeft";
34
+ TurnType[TurnType["UTurnRight"] = 8] = "UTurnRight";
35
+ })(TurnType || (exports.TurnType = TurnType = {}));
36
+ var OffRampType;
37
+ (function (OffRampType) {
38
+ OffRampType[OffRampType["SlightLeft"] = 0] = "SlightLeft";
39
+ OffRampType[OffRampType["SlightRight"] = 1] = "SlightRight";
40
+ OffRampType[OffRampType["NormalLeft"] = 2] = "NormalLeft";
41
+ OffRampType[OffRampType["NormalRight"] = 3] = "NormalRight";
42
+ })(OffRampType || (exports.OffRampType = OffRampType = {}));
43
+ var OnRampType;
44
+ (function (OnRampType) {
45
+ OnRampType[OnRampType["SlightLeft"] = 0] = "SlightLeft";
46
+ OnRampType[OnRampType["SlightRight"] = 1] = "SlightRight";
47
+ OnRampType[OnRampType["NormalLeft"] = 2] = "NormalLeft";
48
+ OnRampType[OnRampType["NormalRight"] = 3] = "NormalRight";
49
+ OnRampType[OnRampType["SharpLeft"] = 4] = "SharpLeft";
50
+ OnRampType[OnRampType["SharpRight"] = 5] = "SharpRight";
51
+ OnRampType[OnRampType["UTurnLeft"] = 6] = "UTurnLeft";
52
+ OnRampType[OnRampType["UTurnRight"] = 7] = "UTurnRight";
53
+ })(OnRampType || (exports.OnRampType = OnRampType = {}));
54
+ var ForkType;
55
+ (function (ForkType) {
56
+ ForkType[ForkType["Left"] = 0] = "Left";
57
+ ForkType[ForkType["Right"] = 1] = "Right";
58
+ })(ForkType || (exports.ForkType = ForkType = {}));
59
+ var KeepType;
60
+ (function (KeepType) {
61
+ KeepType[KeepType["Left"] = 0] = "Left";
62
+ KeepType[KeepType["Right"] = 1] = "Right";
63
+ KeepType[KeepType["FollowRoad"] = 2] = "FollowRoad";
64
+ })(KeepType || (exports.KeepType = KeepType = {}));
65
+ /**
66
+ * Describes the progress within a maneuver.
67
+ * Transition through: Continue → Initial → Prepare → Execute → Continue
68
+ * @namespace iOS sets CPManeuverState on the CPNavigationSession
69
+ * @namespace Android no-op, Android Auto does not have an equivalent API
70
+ */
71
+ var ManeuverState;
72
+ (function (ManeuverState) {
73
+ ManeuverState[ManeuverState["Continue"] = 0] = "Continue";
74
+ ManeuverState[ManeuverState["Initial"] = 1] = "Initial";
75
+ ManeuverState[ManeuverState["Prepare"] = 2] = "Prepare";
76
+ ManeuverState[ManeuverState["Execute"] = 3] = "Execute";
77
+ })(ManeuverState || (exports.ManeuverState = ManeuverState = {}));
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TextInputType = exports.KeyboardType = exports.SignInMethods = void 0;
4
+ var SignInMethods;
5
+ (function (SignInMethods) {
6
+ SignInMethods[SignInMethods["QR"] = 0] = "QR";
7
+ SignInMethods[SignInMethods["GOOGLE"] = 1] = "GOOGLE";
8
+ SignInMethods[SignInMethods["PIN"] = 2] = "PIN";
9
+ SignInMethods[SignInMethods["INPUT"] = 3] = "INPUT";
10
+ })(SignInMethods || (exports.SignInMethods = SignInMethods = {}));
11
+ var KeyboardType;
12
+ (function (KeyboardType) {
13
+ KeyboardType[KeyboardType["DEFAULT"] = 0] = "DEFAULT";
14
+ KeyboardType[KeyboardType["EMAIL"] = 1] = "EMAIL";
15
+ KeyboardType[KeyboardType["PHONE"] = 2] = "PHONE";
16
+ KeyboardType[KeyboardType["NUMBER"] = 3] = "NUMBER";
17
+ })(KeyboardType || (exports.KeyboardType = KeyboardType = {}));
18
+ var TextInputType;
19
+ (function (TextInputType) {
20
+ TextInputType[TextInputType["PASSWORD"] = 0] = "PASSWORD";
21
+ TextInputType[TextInputType["DEFAULT"] = 1] = "DEFAULT";
22
+ })(TextInputType || (exports.TextInputType = TextInputType = {}));
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VehicleGear = exports.AndroidAutomotiveTelemetryPermissions = exports.AndroidAutoTelemetryPermissions = void 0;
4
+ var AndroidAutoTelemetryPermissions;
5
+ (function (AndroidAutoTelemetryPermissions) {
6
+ AndroidAutoTelemetryPermissions["Speed"] = "com.google.android.gms.permission.CAR_SPEED";
7
+ AndroidAutoTelemetryPermissions["Energy"] = "com.google.android.gms.permission.CAR_FUEL";
8
+ AndroidAutoTelemetryPermissions["Odometer"] = "com.google.android.gms.permission.CAR_MILEAGE";
9
+ })(AndroidAutoTelemetryPermissions || (exports.AndroidAutoTelemetryPermissions = AndroidAutoTelemetryPermissions = {}));
10
+ var AndroidAutomotiveTelemetryPermissions;
11
+ (function (AndroidAutomotiveTelemetryPermissions) {
12
+ AndroidAutomotiveTelemetryPermissions["Info"] = "android.car.permission.CAR_INFO";
13
+ AndroidAutomotiveTelemetryPermissions["Speed"] = "android.car.permission.CAR_SPEED";
14
+ AndroidAutomotiveTelemetryPermissions["Energy"] = "android.car.permission.CAR_ENERGY";
15
+ AndroidAutomotiveTelemetryPermissions["ExteriorEnvironment"] = "android.car.permission.CAR_EXTERIOR_ENVIRONMENT";
16
+ AndroidAutomotiveTelemetryPermissions["EnergyPorts"] = "android.car.permission.CAR_ENERGY_PORTS";
17
+ })(AndroidAutomotiveTelemetryPermissions || (exports.AndroidAutomotiveTelemetryPermissions = AndroidAutomotiveTelemetryPermissions = {}));
18
+ var VehicleGear;
19
+ (function (VehicleGear) {
20
+ VehicleGear[VehicleGear["Neutral"] = 1] = "Neutral";
21
+ VehicleGear[VehicleGear["Reverse"] = 2] = "Reverse";
22
+ VehicleGear[VehicleGear["Park"] = 4] = "Park";
23
+ VehicleGear[VehicleGear["Drive"] = 8] = "Drive";
24
+ })(VehicleGear || (exports.VehicleGear = VehicleGear = {}));
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TextPlaceholders = void 0;
4
+ var TextPlaceholders;
5
+ (function (TextPlaceholders) {
6
+ TextPlaceholders["Distance"] = "{distance}";
7
+ TextPlaceholders["Duration"] = "{duration}";
8
+ })(TextPlaceholders || (exports.TextPlaceholders = TextPlaceholders = {}));
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ErrorUtil = void 0;
4
+ const isError = (error) => {
5
+ if (error == null) {
6
+ return false;
7
+ }
8
+ if (typeof error !== 'object') {
9
+ return false;
10
+ }
11
+ if (!('message' in error && 'name' in error)) {
12
+ return false;
13
+ }
14
+ if (error.name !== 'Error') {
15
+ return false;
16
+ }
17
+ if (typeof error.message !== 'string') {
18
+ return false;
19
+ }
20
+ return true;
21
+ };
22
+ const isTemplateNotFoundError = (error) => {
23
+ if (isError(error)) {
24
+ return error.message.startsWith('templateNotFound');
25
+ }
26
+ return false;
27
+ };
28
+ const isVoiceInputCanceledError = (error) => {
29
+ if (isError(error)) {
30
+ return error.message.startsWith('voiceInputCancelled');
31
+ }
32
+ return false;
33
+ };
34
+ exports.ErrorUtil = { isTemplateNotFoundError, isVoiceInputCanceledError };
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NitroActionUtil = void 0;
4
+ const react_native_1 = require("react-native");
5
+ const NitroImage_1 = require("./NitroImage");
6
+ const getImage = (action) => {
7
+ if (action.type === 'text') {
8
+ return undefined;
9
+ }
10
+ if (action.image.type === 'glyph' && action.image.fontScale == null) {
11
+ action.image.fontScale = react_native_1.Platform.OS === 'android' ? 1.0 : 0.8;
12
+ }
13
+ return NitroImage_1.NitroImageUtil.convert(action.image);
14
+ };
15
+ const getTitle = (action) => {
16
+ if (action.type === 'image') {
17
+ return undefined;
18
+ }
19
+ return action.title;
20
+ };
21
+ // appIcon can not be pressed but we wanna have a non-optional onPress on native side
22
+ const getAppIconAction = (alignment) => ({
23
+ type: 'appIcon',
24
+ onPress: () => null,
25
+ alignment,
26
+ });
27
+ const convertToNitro = (template, action, alignment) => {
28
+ const { type } = action;
29
+ if (type === 'appIcon') {
30
+ return getAppIconAction(alignment);
31
+ }
32
+ const { onPress } = action;
33
+ if (type === 'back') {
34
+ return { type, onPress: () => onPress(template), alignment };
35
+ }
36
+ const { enabled, flags, style } = action;
37
+ const title = getTitle(action);
38
+ const image = getImage(action);
39
+ return {
40
+ onPress: () => onPress(template),
41
+ type: 'custom',
42
+ enabled,
43
+ flags,
44
+ image,
45
+ title,
46
+ alignment,
47
+ style,
48
+ };
49
+ };
50
+ const convertActionButtons = (template, actions) => {
51
+ return actions?.map((action) => convertToNitro(template, action, undefined));
52
+ };
53
+ function convertIos(template, actions) {
54
+ if (actions == null) {
55
+ return undefined;
56
+ }
57
+ const nitroActions = [];
58
+ if (actions.backButton != null) {
59
+ nitroActions.push({
60
+ type: 'back',
61
+ onPress: () => actions.backButton?.onPress(template),
62
+ alignment: undefined,
63
+ });
64
+ }
65
+ if (actions.leadingNavigationBarButtons != null) {
66
+ for (const button of actions.leadingNavigationBarButtons) {
67
+ const { onPress, enabled } = button;
68
+ const image = getImage(button);
69
+ const title = getTitle(button);
70
+ nitroActions.push({
71
+ type: 'custom',
72
+ enabled,
73
+ image,
74
+ onPress: () => onPress(template),
75
+ title,
76
+ alignment: 'leading',
77
+ });
78
+ }
79
+ }
80
+ if (actions.trailingNavigationBarButtons) {
81
+ for (const button of actions.trailingNavigationBarButtons) {
82
+ const { onPress, enabled } = button;
83
+ const image = getImage(button);
84
+ const title = getTitle(button);
85
+ nitroActions.push({
86
+ type: 'custom',
87
+ enabled,
88
+ image,
89
+ onPress: () => onPress(template),
90
+ title,
91
+ alignment: 'trailing',
92
+ });
93
+ }
94
+ }
95
+ return nitroActions;
96
+ }
97
+ function convertAndroid(template, actions) {
98
+ if (actions == null) {
99
+ return undefined;
100
+ }
101
+ if (Array.isArray(actions)) {
102
+ return convertActionButtons(template, actions);
103
+ }
104
+ const nitroActions = [];
105
+ const { startHeaderAction, endHeaderActions = [] } = actions;
106
+ if (startHeaderAction != null) {
107
+ const action = startHeaderAction.type === 'appIcon'
108
+ ? getAppIconAction('leading')
109
+ : {
110
+ ...startHeaderAction,
111
+ alignment: 'leading',
112
+ onPress: () => startHeaderAction.onPress(template),
113
+ };
114
+ nitroActions.push(action);
115
+ }
116
+ for (const action of endHeaderActions) {
117
+ nitroActions.push(convertToNitro(template, action, 'trailing'));
118
+ }
119
+ return nitroActions;
120
+ }
121
+ function convert(template, actions) {
122
+ if (Array.isArray(actions)) {
123
+ return convertActionButtons(template, actions);
124
+ }
125
+ return react_native_1.Platform.OS === 'android'
126
+ ? convertAndroid(template, actions?.android)
127
+ : convertIos(template, actions?.ios);
128
+ }
129
+ exports.NitroActionUtil = { convert };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NitroAlertUtil = void 0;
4
+ const NitroImage_1 = require("./NitroImage");
5
+ var AlertPriorityEnum;
6
+ (function (AlertPriorityEnum) {
7
+ AlertPriorityEnum[AlertPriorityEnum["low"] = 0] = "low";
8
+ AlertPriorityEnum[AlertPriorityEnum["medium"] = 1] = "medium";
9
+ AlertPriorityEnum[AlertPriorityEnum["high"] = 2] = "high";
10
+ })(AlertPriorityEnum || (AlertPriorityEnum = {}));
11
+ const convert = (alert) => {
12
+ const { image, priority, ...rest } = alert;
13
+ return {
14
+ ...rest,
15
+ image: NitroImage_1.NitroImageUtil.convert(image),
16
+ priority: AlertPriorityEnum[priority],
17
+ };
18
+ };
19
+ exports.NitroAlertUtil = { convert };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NitroAttributedStringUtil = void 0;
4
+ const NitroImage_1 = require("./NitroImage");
5
+ function convert(attributedStrings) {
6
+ return attributedStrings.map((attributedString) => ({
7
+ ...attributedString,
8
+ images: attributedString.images?.map((image) => ({
9
+ ...image,
10
+ image: NitroImage_1.NitroImageUtil.convert(image.image),
11
+ })),
12
+ }));
13
+ }
14
+ exports.NitroAttributedStringUtil = { convert };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NitroColorUtil = void 0;
4
+ const react_native_1 = require("react-native");
5
+ const DefaultNitroColor = {
6
+ darkColor: convertColor('white'),
7
+ lightColor: convertColor('black'),
8
+ isDefault: true,
9
+ };
10
+ function convertColor(color) {
11
+ // since we accept only string it can return a number only
12
+ return (0, react_native_1.processColor)(color);
13
+ }
14
+ function convert(color) {
15
+ if (color == null) {
16
+ return undefined;
17
+ }
18
+ if (typeof color === 'string') {
19
+ if (color === 'default') {
20
+ return DefaultNitroColor;
21
+ }
22
+ const convertedColor = convertColor(color);
23
+ return { darkColor: convertedColor, lightColor: convertedColor };
24
+ }
25
+ const darkColor = convertColor(color.darkColor);
26
+ const lightColor = convertColor(color.lightColor);
27
+ return {
28
+ darkColor,
29
+ lightColor,
30
+ };
31
+ }
32
+ exports.NitroColorUtil = { convert };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NitroGridUtil = void 0;
4
+ const NitroImage_1 = require("./NitroImage");
5
+ const convert = (template, buttons) => {
6
+ return buttons.map((button) => ({
7
+ title: button.title,
8
+ image: NitroImage_1.NitroImageUtil.convert(button.image),
9
+ onPress: () => button.onPress(template),
10
+ }));
11
+ };
12
+ exports.NitroGridUtil = { convert };
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NitroImageUtil = void 0;
4
+ exports.setIconFont = setIconFont;
5
+ const react_native_1 = require("react-native");
6
+ const NitroColor_1 = require("./NitroColor");
7
+ let _iconFont;
8
+ let _glyphMap;
9
+ /**
10
+ * Register the icon font and (optionally) a glyph map for name-based lookups.
11
+ * Must be called **once** before creating any templates. Subsequent calls are ignored.
12
+ *
13
+ * The font name maps directly to a native font asset:
14
+ * - **Android** — `res/font/<name>.ttf` (must be lowercase)
15
+ * - **iOS** — `<name>.ttf` in the app bundle (registered via CoreText automatically)
16
+ *
17
+ * For cross-platform compatibility use lowercase with underscores only.
18
+ *
19
+ * @param name Native font asset name (without extension).
20
+ * @param glyphMap Optional map of glyph names to Unicode code points.
21
+ * When provided, glyphs can use `{ type: 'glyph', name: 'icon_name' }`.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * import { glyphMap } from './assets/Glyphmap';
26
+ * setIconFont('material_symbols', glyphMap);
27
+ * ```
28
+ */
29
+ function setIconFont(name, glyphMap) {
30
+ if (_iconFont != null) {
31
+ return;
32
+ }
33
+ _iconFont = name;
34
+ _glyphMap = glyphMap;
35
+ }
36
+ function getIconFont() {
37
+ if (_iconFont == null) {
38
+ throw new Error('No icon font configured. Call setIconFont("your_font_name") before using glyph images.');
39
+ }
40
+ return _iconFont;
41
+ }
42
+ function resolveGlyph(image) {
43
+ if ('name' in image && image.name !== undefined) {
44
+ if (image.codepoint !== undefined) {
45
+ return image.codepoint;
46
+ }
47
+ if (_glyphMap == null) {
48
+ throw new Error(`Glyph name "${image.name}" used but no glyph map was provided to setIconFont().`);
49
+ }
50
+ const cp = _glyphMap[image.name];
51
+ if (cp === undefined) {
52
+ throw new Error(`Glyph name "${image.name}" not found in the glyph map.`);
53
+ }
54
+ return cp;
55
+ }
56
+ if (image.codepoint !== undefined) {
57
+ return image.codepoint;
58
+ }
59
+ throw new Error('Glyph image must provide either `name` or `codepoint`.');
60
+ }
61
+ function convert(image) {
62
+ if (image == null) {
63
+ return undefined;
64
+ }
65
+ if (image.type === 'glyph') {
66
+ const { color = 'default', fontScale, backgroundColor = 'transparent' } = image;
67
+ return {
68
+ glyph: resolveGlyph(image),
69
+ fontName: getIconFont(),
70
+ color: NitroColor_1.NitroColorUtil.convert(color),
71
+ backgroundColor: NitroColor_1.NitroColorUtil.convert(backgroundColor),
72
+ fontScale,
73
+ };
74
+ }
75
+ if (image.type === 'remote') {
76
+ return {
77
+ uri: image.uri,
78
+ color: NitroColor_1.NitroColorUtil.convert(image.color),
79
+ timeoutMs: image.timeoutMs,
80
+ };
81
+ }
82
+ // Image.resolveAssetSource is pretty terrible, it will simply return whatever object you pass it is not a number [require(...)]
83
+ // so the input allows all optional parameters which are returned as is even though
84
+ // the return type claims to not have any optional parameters...
85
+ // we specify some default values to not crash because of proper typing required by nitro-modules
86
+ const { height = 0, scale = 0, uri, width = 0, ...rest } = react_native_1.Image.resolveAssetSource(image.image);
87
+ const assetImage = {
88
+ height,
89
+ scale,
90
+ uri,
91
+ width,
92
+ packager_asset: '__packager_asset' in rest ? Boolean(rest.__packager_asset) : false,
93
+ color: NitroColor_1.NitroColorUtil.convert(image.color),
94
+ };
95
+ return assetImage;
96
+ }
97
+ exports.NitroImageUtil = { convert };