react-native-candle 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +188 -0
  2. package/ReactNativeCandle.podspec +45 -0
  3. package/app.plugin.js +1 -0
  4. package/ios/Sources/CandleLinkSheetWrapperView.swift +53 -0
  5. package/ios/Sources/CandleLinkViewModel.swift +67 -0
  6. package/ios/Sources/HostingViewController.swift +56 -0
  7. package/ios/Sources/RNCandle.swift +155 -0
  8. package/ios/Sources/UIApplication++.swift +14 -0
  9. package/lib/commonjs/index.js +49 -0
  10. package/lib/commonjs/index.js.map +1 -0
  11. package/lib/commonjs/specs/RNCandle.nitro.js +6 -0
  12. package/lib/commonjs/specs/RNCandle.nitro.js.map +1 -0
  13. package/lib/module/index.js +38 -0
  14. package/lib/module/index.js.map +1 -0
  15. package/lib/module/specs/RNCandle.nitro.js +4 -0
  16. package/lib/module/specs/RNCandle.nitro.js.map +1 -0
  17. package/lib/typescript/commonjs/package.json +1 -0
  18. package/lib/typescript/commonjs/src/index.d.ts +22 -0
  19. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  20. package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts +21 -0
  21. package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts.map +1 -0
  22. package/lib/typescript/module/package.json +1 -0
  23. package/lib/typescript/module/src/index.d.ts +22 -0
  24. package/lib/typescript/module/src/index.d.ts.map +1 -0
  25. package/lib/typescript/module/src/specs/RNCandle.nitro.d.ts +21 -0
  26. package/lib/typescript/module/src/specs/RNCandle.nitro.d.ts.map +1 -0
  27. package/nitrogen/generated/.gitattributes +1 -0
  28. package/nitrogen/generated/ios/ReactNativeCandle+autolinking.rb +60 -0
  29. package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Bridge.cpp +56 -0
  30. package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Bridge.hpp +173 -0
  31. package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Umbrella.hpp +58 -0
  32. package/nitrogen/generated/ios/ReactNativeCandleAutolinking.mm +33 -0
  33. package/nitrogen/generated/ios/ReactNativeCandleAutolinking.swift +30 -0
  34. package/nitrogen/generated/ios/c++/HybridRNCandleSpecSwift.cpp +11 -0
  35. package/nitrogen/generated/ios/c++/HybridRNCandleSpecSwift.hpp +139 -0
  36. package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
  37. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  38. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
  39. package/nitrogen/generated/ios/swift/HybridRNCandleSpec.swift +55 -0
  40. package/nitrogen/generated/ios/swift/HybridRNCandleSpec_cxx.swift +263 -0
  41. package/nitrogen/generated/ios/swift/PresentationBackground.swift +40 -0
  42. package/nitrogen/generated/ios/swift/PresentationStyle.swift +40 -0
  43. package/nitrogen/generated/ios/swift/Service.swift +56 -0
  44. package/nitrogen/generated/ios/swift/ToolCall.swift +46 -0
  45. package/nitrogen/generated/shared/c++/HybridRNCandleSpec.cpp +28 -0
  46. package/nitrogen/generated/shared/c++/HybridRNCandleSpec.hpp +83 -0
  47. package/nitrogen/generated/shared/c++/PresentationBackground.hpp +78 -0
  48. package/nitrogen/generated/shared/c++/PresentationStyle.hpp +78 -0
  49. package/nitrogen/generated/shared/c++/Service.hpp +94 -0
  50. package/nitrogen/generated/shared/c++/ToolCall.hpp +73 -0
  51. package/package.json +111 -0
  52. package/plugin/withIosDeploymentTarget.js +46 -0
  53. package/src/index.ts +73 -0
  54. package/src/specs/RNCandle.nitro.ts +39 -0
@@ -0,0 +1,46 @@
1
+ const { withDangerousMod } = require("@expo/config-plugins");
2
+ const {
3
+ mergeContents,
4
+ } = require("@expo/config-plugins/build/utils/generateCode");
5
+ const fs = require("fs");
6
+ const path = require("path");
7
+
8
+ const withIosDeploymentTarget = (config) => {
9
+ return withDangerousMod(config, [
10
+ "ios",
11
+ async (config) => {
12
+ // Find the Podfile
13
+ const podfile = path.join(
14
+ config.modRequest.platformProjectRoot,
15
+ "Podfile"
16
+ );
17
+ // Read the Podfile
18
+ const podfileContents = fs.readFileSync(podfile, "utf8");
19
+ // Merge the contents of the Podfile with the new content setting
20
+ // the deployment target of all targets to 17.0
21
+ const setDeploymentTarget = mergeContents({
22
+ tag: "ios-deployment-target",
23
+ src: podfileContents,
24
+ newSrc: ` installer.pods_project.targets.each do |target|
25
+ target.build_configurations.each do |config|
26
+ config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '17.0'
27
+ end
28
+ end`,
29
+ anchor: /post_install do \|installer\|/i,
30
+ offset: 1,
31
+ comment: "#",
32
+ });
33
+
34
+ if (!setDeploymentTarget.didMerge) {
35
+ console.log("Failed to set iOS deployment target");
36
+ return config;
37
+ }
38
+
39
+ fs.writeFileSync(podfile, setDeploymentTarget.contents);
40
+
41
+ return config;
42
+ },
43
+ ]);
44
+ };
45
+
46
+ module.exports = withIosDeploymentTarget;
package/src/index.ts ADDED
@@ -0,0 +1,73 @@
1
+ import { NitroModules } from "react-native-nitro-modules";
2
+ import type {
3
+ PresentationBackground,
4
+ PresentationStyle,
5
+ RNCandle,
6
+ Service,
7
+ } from "./specs/RNCandle.nitro";
8
+
9
+ const CandleHybridObject =
10
+ NitroModules.createHybridObject<RNCandle>("RNCandle");
11
+
12
+ export function presentCandleLinkSheet({
13
+ service = "default",
14
+ cornerRadius = 24,
15
+ customerName,
16
+ showSandbox = false,
17
+ showDynamicLoading = true,
18
+ presentationBackground = "default",
19
+ presentationStyle = "sheet",
20
+ onSuccess,
21
+ }: {
22
+ service?: Service;
23
+ cornerRadius?: number;
24
+ customerName?: string;
25
+ showSandbox?: boolean;
26
+ showDynamicLoading?: boolean;
27
+ presentationBackground?: PresentationBackground;
28
+ presentationStyle?: PresentationStyle;
29
+ onSuccess: (account: string) => void;
30
+ }): void {
31
+ CandleHybridObject.candleLinkSheet(
32
+ true,
33
+ service,
34
+ cornerRadius,
35
+ customerName,
36
+ showSandbox,
37
+ showDynamicLoading,
38
+ presentationBackground,
39
+ presentationStyle,
40
+ onSuccess
41
+ );
42
+ }
43
+
44
+ export async function unlinkAccount(linkedAccountID: string): Promise<void> {
45
+ await CandleHybridObject.unlinkAccount(linkedAccountID);
46
+ }
47
+
48
+ export async function getLinkedAccounts(): Promise<string> {
49
+ return await CandleHybridObject.getLinkedAccounts();
50
+ }
51
+
52
+ export async function getFiatAccounts(): Promise<string> {
53
+ return await CandleHybridObject.getFiatAccounts();
54
+ }
55
+
56
+ export async function getActivity(span?: string): Promise<string> {
57
+ return await CandleHybridObject.getActivity(span);
58
+ }
59
+
60
+ export async function deleteUser(): Promise<void> {
61
+ await CandleHybridObject.deleteUser();
62
+ }
63
+
64
+ export async function getAvailableTools(): Promise<string> {
65
+ return await CandleHybridObject.getAvailableTools();
66
+ }
67
+
68
+ export async function executeTool(tool: {
69
+ name: string;
70
+ arguments: string;
71
+ }): Promise<string> {
72
+ return await CandleHybridObject.executeTool(tool);
73
+ }
@@ -0,0 +1,39 @@
1
+ import type { HybridObject } from "react-native-nitro-modules";
2
+
3
+ export type Service =
4
+ | "robinhood"
5
+ | "cash_app"
6
+ | "venmo"
7
+ | "apple"
8
+ | "demo"
9
+ | "default";
10
+
11
+ export type PresentationBackground = "default" | "blur";
12
+ export type PresentationStyle = "sheet" | "fullScreen";
13
+
14
+ export type ToolCall = {
15
+ name: string;
16
+ arguments: string;
17
+ };
18
+
19
+ export interface RNCandle extends HybridObject<{ ios: "swift" }> {
20
+ candleLinkSheet(
21
+ isPresented: boolean,
22
+ service: Service,
23
+ cornerRadius: number,
24
+ customerName: string | undefined,
25
+ showSandbox: boolean,
26
+ showDynamicLoading: boolean,
27
+ presentationBackground: PresentationBackground,
28
+ presentationStyle: PresentationStyle,
29
+ onSuccess: (account: string) => void
30
+ ): void;
31
+ getLinkedAccounts(): Promise<string>;
32
+ unlinkAccount(linkedAccountID: string): Promise<void>;
33
+ getFiatAccounts(): Promise<string>;
34
+ getActivity(span: string | undefined): Promise<string>;
35
+ deleteUser(): Promise<void>;
36
+ // FIXME: The return type should be a more specific type based on the actual tool calls available.
37
+ getAvailableTools(): Promise<string>;
38
+ executeTool(tool: ToolCall): Promise<string>;
39
+ }