@whop/react-native 0.0.4 → 0.0.5

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.
@@ -3,6 +3,20 @@ export * from '@whop/api';
3
3
 
4
4
  declare const whopSdk: WhopClientSdk;
5
5
 
6
+ interface PathParams {
7
+ path: string[];
8
+ params: Record<string, string>;
9
+ }
10
+ interface BaseViewProps extends PathParams {
11
+ currentUserId: string | undefined | null;
12
+ }
13
+ interface ExperienceViewProps extends BaseViewProps {
14
+ experienceId: string;
15
+ companyId: string;
16
+ }
17
+ interface DiscoverViewProps extends BaseViewProps {
18
+ }
19
+
6
20
  type EmptyObject = {};
7
21
  interface ExecSyncApi {
8
22
  getAppApiOrigin(params: EmptyObject): {
@@ -17,31 +31,20 @@ interface ExecSyncApi {
17
31
  key?: string | null;
18
32
  data?: string | null;
19
33
  }): EmptyObject;
20
- routerPush(params: {
21
- path: string[];
22
- params: Record<string, string>;
23
- }): EmptyObject;
34
+ routerPush(params: PathParams): EmptyObject;
24
35
  routerPop(params: EmptyObject): EmptyObject;
25
- routerGetCurrent(params: EmptyObject): {
26
- path: string[];
27
- params: Record<string, string>;
28
- };
36
+ routerGetCurrent(params: EmptyObject): PathParams;
37
+ setNavigationBarData(params: {
38
+ title?: string | null;
39
+ description?: string | null;
40
+ }): EmptyObject;
41
+ routerPresentSheet(params: PathParams): EmptyObject;
42
+ routerDismissSheet(params: EmptyObject): EmptyObject;
43
+ routerGetCurrentSheet(params: EmptyObject): PathParams | null | undefined;
29
44
  }
30
45
  interface ExecAsyncApi extends ExecSyncApi {
31
46
  }
32
47
  declare function __internal_execSync<F extends keyof ExecSyncApi>(name: F, params: Parameters<ExecSyncApi[F]>[0]): ReturnType<ExecSyncApi[F]>;
33
48
  declare function __internal_execAsync<F extends keyof ExecAsyncApi>(name: F, params: Parameters<ExecAsyncApi[F]>[0]): Promise<ReturnType<ExecAsyncApi[F]>>;
34
49
 
35
- interface BaseViewProps {
36
- currentUserId: string | undefined | null;
37
- path: string[];
38
- params: Record<string, string>;
39
- }
40
- interface ExperienceViewProps extends BaseViewProps {
41
- experienceId: string;
42
- companyId: string;
43
- }
44
- interface DiscoverViewProps extends BaseViewProps {
45
- }
46
-
47
- export { type DiscoverViewProps, type ExecAsyncApi, type ExecSyncApi, type ExperienceViewProps, __internal_execAsync, __internal_execSync, whopSdk };
50
+ export { type DiscoverViewProps, type ExecAsyncApi, type ExecSyncApi, type ExperienceViewProps, type PathParams, __internal_execAsync, __internal_execSync, whopSdk };
@@ -3,6 +3,20 @@ export * from '@whop/api';
3
3
 
4
4
  declare const whopSdk: WhopClientSdk;
5
5
 
6
+ interface PathParams {
7
+ path: string[];
8
+ params: Record<string, string>;
9
+ }
10
+ interface BaseViewProps extends PathParams {
11
+ currentUserId: string | undefined | null;
12
+ }
13
+ interface ExperienceViewProps extends BaseViewProps {
14
+ experienceId: string;
15
+ companyId: string;
16
+ }
17
+ interface DiscoverViewProps extends BaseViewProps {
18
+ }
19
+
6
20
  type EmptyObject = {};
7
21
  interface ExecSyncApi {
8
22
  getAppApiOrigin(params: EmptyObject): {
@@ -17,31 +31,20 @@ interface ExecSyncApi {
17
31
  key?: string | null;
18
32
  data?: string | null;
19
33
  }): EmptyObject;
20
- routerPush(params: {
21
- path: string[];
22
- params: Record<string, string>;
23
- }): EmptyObject;
34
+ routerPush(params: PathParams): EmptyObject;
24
35
  routerPop(params: EmptyObject): EmptyObject;
25
- routerGetCurrent(params: EmptyObject): {
26
- path: string[];
27
- params: Record<string, string>;
28
- };
36
+ routerGetCurrent(params: EmptyObject): PathParams;
37
+ setNavigationBarData(params: {
38
+ title?: string | null;
39
+ description?: string | null;
40
+ }): EmptyObject;
41
+ routerPresentSheet(params: PathParams): EmptyObject;
42
+ routerDismissSheet(params: EmptyObject): EmptyObject;
43
+ routerGetCurrentSheet(params: EmptyObject): PathParams | null | undefined;
29
44
  }
30
45
  interface ExecAsyncApi extends ExecSyncApi {
31
46
  }
32
47
  declare function __internal_execSync<F extends keyof ExecSyncApi>(name: F, params: Parameters<ExecSyncApi[F]>[0]): ReturnType<ExecSyncApi[F]>;
33
48
  declare function __internal_execAsync<F extends keyof ExecAsyncApi>(name: F, params: Parameters<ExecAsyncApi[F]>[0]): Promise<ReturnType<ExecAsyncApi[F]>>;
34
49
 
35
- interface BaseViewProps {
36
- currentUserId: string | undefined | null;
37
- path: string[];
38
- params: Record<string, string>;
39
- }
40
- interface ExperienceViewProps extends BaseViewProps {
41
- experienceId: string;
42
- companyId: string;
43
- }
44
- interface DiscoverViewProps extends BaseViewProps {
45
- }
46
-
47
- export { type DiscoverViewProps, type ExecAsyncApi, type ExecSyncApi, type ExperienceViewProps, __internal_execAsync, __internal_execSync, whopSdk };
50
+ export { type DiscoverViewProps, type ExecAsyncApi, type ExecSyncApi, type ExperienceViewProps, type PathParams, __internal_execAsync, __internal_execSync, whopSdk };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/index.ts","../../src/lib/client-sdk.ts","../../src/lib/native-whop-core.ts","../../src/lib/native-whop-core-wrapper.ts"],"sourcesContent":["export * from \"./client-sdk\";\nexport * from \"./native-whop-core-wrapper\";\nexport * from \"./props\";\n","import { WhopClientSdk } from \"@whop/api\";\nimport { Platform } from \"react-native\";\nimport { __internal_execSync } from \"./native-whop-core-wrapper\";\n\nfunction getAppOrigin() {\n\tif (Platform.OS === \"android\" || Platform.OS === \"ios\") {\n\t\treturn __internal_execSync(\"getAppApiOrigin\", {}).apiOrigin;\n\t}\n\n\tif (Platform.OS === \"web\" && typeof window !== \"undefined\") {\n\t\treturn window.location.origin;\n\t}\n\n\tthrow new Error(`Unsupported platform: ${Platform.OS}`);\n}\n\nconst appOrigin = getAppOrigin();\n\nexport const whopSdk: WhopClientSdk = WhopClientSdk({\n\tapiOrigin: appOrigin,\n\tapiPath: \"/_whop/public-graphql/\",\n});\n\nexport * from \"@whop/api\";\n","import type { TurboModule } from \"react-native\";\nimport { TurboModuleRegistry } from \"react-native\";\n\nexport type FunctionCallResult = {\n\tisOk: boolean;\n\tdata: string | null;\n\terrorMessage: string | null;\n};\n\nexport interface Spec extends TurboModule {\n\texecSync(name: string, paramsJson: string): FunctionCallResult;\n\texecAsync(name: string, paramsJson: string): Promise<FunctionCallResult>;\n}\n\nexport default TurboModuleRegistry.getEnforcing<Spec>(\"NativeWhopCore\");\n","import nativeWhopCore from \"./native-whop-core\";\n\n// biome-ignore lint/complexity/noBannedTypes: allow here\ntype EmptyObject = {};\n\nexport interface ExecSyncApi {\n\tgetAppApiOrigin(params: EmptyObject): { apiOrigin: string };\n\tcacheGet(params: { key?: string | null }): { data?: string | null };\n\tcacheSet(params: { key?: string | null; data?: string | null }): EmptyObject;\n\trouterPush(params: {\n\t\tpath: string[];\n\t\tparams: Record<string, string>;\n\t}): EmptyObject;\n\trouterPop(params: EmptyObject): EmptyObject;\n\trouterGetCurrent(params: EmptyObject): {\n\t\tpath: string[];\n\t\tparams: Record<string, string>;\n\t};\n}\n\nexport interface ExecAsyncApi extends ExecSyncApi {}\n\nexport function __internal_execSync<F extends keyof ExecSyncApi>(\n\tname: F,\n\tparams: Parameters<ExecSyncApi[F]>[0],\n): ReturnType<ExecSyncApi[F]> {\n\tconst resultJson = nativeWhopCore.execSync(name, JSON.stringify(params));\n\tif (!resultJson.isOk) {\n\t\tthrow new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);\n\t}\n\n\treturn JSON.parse(resultJson.data || \"{}\") as ReturnType<ExecSyncApi[F]>;\n}\n\nexport async function __internal_execAsync<F extends keyof ExecAsyncApi>(\n\tname: F,\n\tparams: Parameters<ExecAsyncApi[F]>[0],\n): Promise<ReturnType<ExecAsyncApi[F]>> {\n\tconst resultJson = await nativeWhopCore.execAsync(\n\t\tname,\n\t\tJSON.stringify(params),\n\t);\n\n\tif (!resultJson.isOk) {\n\t\tthrow new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);\n\t}\n\n\treturn JSON.parse(resultJson.data || \"{}\") as ReturnType<ExecAsyncApi[F]>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA,iBAA8B;AAC9B,IAAAA,uBAAyB;;;ACAzB,0BAAoC;AAapC,IAAO,2BAAQ,wCAAoB,aAAmB,gBAAgB;;;ACQ/D,SAAS,oBACf,MACA,QAC6B;AAC7B,QAAM,aAAa,yBAAe,SAAS,MAAM,KAAK,UAAU,MAAM,CAAC;AACvE,MAAI,CAAC,WAAW,MAAM;AACrB,UAAM,IAAI,MAAM,qBAAqB,IAAI,KAAK,WAAW,YAAY,EAAE;AAAA,EACxE;AAEA,SAAO,KAAK,MAAM,WAAW,QAAQ,IAAI;AAC1C;AAEA,eAAsB,qBACrB,MACA,QACuC;AACvC,QAAM,aAAa,MAAM,yBAAe;AAAA,IACvC;AAAA,IACA,KAAK,UAAU,MAAM;AAAA,EACtB;AAEA,MAAI,CAAC,WAAW,MAAM;AACrB,UAAM,IAAI,MAAM,qBAAqB,IAAI,KAAK,WAAW,YAAY,EAAE;AAAA,EACxE;AAEA,SAAO,KAAK,MAAM,WAAW,QAAQ,IAAI;AAC1C;;;AFzBA,+BAAc;AAnBd,SAAS,eAAe;AACvB,MAAI,8BAAS,OAAO,aAAa,8BAAS,OAAO,OAAO;AACvD,WAAO,oBAAoB,mBAAmB,CAAC,CAAC,EAAE;AAAA,EACnD;AAEA,MAAI,8BAAS,OAAO,SAAS,OAAO,WAAW,aAAa;AAC3D,WAAO,OAAO,SAAS;AAAA,EACxB;AAEA,QAAM,IAAI,MAAM,yBAAyB,8BAAS,EAAE,EAAE;AACvD;AAEA,IAAM,YAAY,aAAa;AAExB,IAAM,cAAyB,0BAAc;AAAA,EACnD,WAAW;AAAA,EACX,SAAS;AACV,CAAC;;;ADrBD,wBAAc,oBAAd;","names":["import_react_native"]}
1
+ {"version":3,"sources":["../../src/lib/index.ts","../../src/lib/client-sdk.ts","../../src/lib/native-whop-core.ts","../../src/lib/native-whop-core-wrapper.ts"],"sourcesContent":["export * from \"./client-sdk\";\nexport * from \"./native-whop-core-wrapper\";\nexport * from \"./props\";\n","import { WhopClientSdk } from \"@whop/api\";\nimport { Platform } from \"react-native\";\nimport { __internal_execSync } from \"./native-whop-core-wrapper\";\n\nfunction getAppOrigin() {\n\tif (Platform.OS === \"android\" || Platform.OS === \"ios\") {\n\t\treturn __internal_execSync(\"getAppApiOrigin\", {}).apiOrigin;\n\t}\n\n\tif (Platform.OS === \"web\" && typeof window !== \"undefined\") {\n\t\treturn window.location.origin;\n\t}\n\n\tthrow new Error(`Unsupported platform: ${Platform.OS}`);\n}\n\nconst appOrigin = getAppOrigin();\n\nexport const whopSdk: WhopClientSdk = WhopClientSdk({\n\tapiOrigin: appOrigin,\n\tapiPath: \"/_whop/public-graphql/\",\n});\n\nexport * from \"@whop/api\";\n","import type { TurboModule } from \"react-native\";\nimport { TurboModuleRegistry } from \"react-native\";\n\nexport type FunctionCallResult = {\n\tisOk: boolean;\n\tdata: string | null;\n\terrorMessage: string | null;\n};\n\nexport interface Spec extends TurboModule {\n\texecSync(name: string, paramsJson: string): FunctionCallResult;\n\texecAsync(name: string, paramsJson: string): Promise<FunctionCallResult>;\n}\n\nexport default TurboModuleRegistry.getEnforcing<Spec>(\"NativeWhopCore\");\n","import nativeWhopCore from \"./native-whop-core\";\nimport type { PathParams } from \"./props\";\n\n// biome-ignore lint/complexity/noBannedTypes: allow here\ntype EmptyObject = {};\n\nexport interface ExecSyncApi {\n\tgetAppApiOrigin(params: EmptyObject): { apiOrigin: string };\n\tcacheGet(params: { key?: string | null }): { data?: string | null };\n\tcacheSet(params: { key?: string | null; data?: string | null }): EmptyObject;\n\trouterPush(params: PathParams): EmptyObject;\n\trouterPop(params: EmptyObject): EmptyObject;\n\trouterGetCurrent(params: EmptyObject): PathParams;\n\tsetNavigationBarData(params: {\n\t\ttitle?: string | null;\n\t\tdescription?: string | null;\n\t}): EmptyObject;\n\trouterPresentSheet(params: PathParams): EmptyObject;\n\trouterDismissSheet(params: EmptyObject): EmptyObject;\n\trouterGetCurrentSheet(params: EmptyObject): PathParams | null | undefined;\n}\n\nexport interface ExecAsyncApi extends ExecSyncApi {}\n\nexport function __internal_execSync<F extends keyof ExecSyncApi>(\n\tname: F,\n\tparams: Parameters<ExecSyncApi[F]>[0],\n): ReturnType<ExecSyncApi[F]> {\n\tconst resultJson = nativeWhopCore.execSync(name, JSON.stringify(params));\n\tif (!resultJson.isOk) {\n\t\tthrow new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);\n\t}\n\n\treturn JSON.parse(resultJson.data || \"{}\") as ReturnType<ExecSyncApi[F]>;\n}\n\nexport async function __internal_execAsync<F extends keyof ExecAsyncApi>(\n\tname: F,\n\tparams: Parameters<ExecAsyncApi[F]>[0],\n): Promise<ReturnType<ExecAsyncApi[F]>> {\n\tconst resultJson = await nativeWhopCore.execAsync(\n\t\tname,\n\t\tJSON.stringify(params),\n\t);\n\n\tif (!resultJson.isOk) {\n\t\tthrow new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);\n\t}\n\n\treturn JSON.parse(resultJson.data || \"{}\") as ReturnType<ExecAsyncApi[F]>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA,iBAA8B;AAC9B,IAAAA,uBAAyB;;;ACAzB,0BAAoC;AAapC,IAAO,2BAAQ,wCAAoB,aAAmB,gBAAgB;;;ACU/D,SAAS,oBACf,MACA,QAC6B;AAC7B,QAAM,aAAa,yBAAe,SAAS,MAAM,KAAK,UAAU,MAAM,CAAC;AACvE,MAAI,CAAC,WAAW,MAAM;AACrB,UAAM,IAAI,MAAM,qBAAqB,IAAI,KAAK,WAAW,YAAY,EAAE;AAAA,EACxE;AAEA,SAAO,KAAK,MAAM,WAAW,QAAQ,IAAI;AAC1C;AAEA,eAAsB,qBACrB,MACA,QACuC;AACvC,QAAM,aAAa,MAAM,yBAAe;AAAA,IACvC;AAAA,IACA,KAAK,UAAU,MAAM;AAAA,EACtB;AAEA,MAAI,CAAC,WAAW,MAAM;AACrB,UAAM,IAAI,MAAM,qBAAqB,IAAI,KAAK,WAAW,YAAY,EAAE;AAAA,EACxE;AAEA,SAAO,KAAK,MAAM,WAAW,QAAQ,IAAI;AAC1C;;;AF3BA,+BAAc;AAnBd,SAAS,eAAe;AACvB,MAAI,8BAAS,OAAO,aAAa,8BAAS,OAAO,OAAO;AACvD,WAAO,oBAAoB,mBAAmB,CAAC,CAAC,EAAE;AAAA,EACnD;AAEA,MAAI,8BAAS,OAAO,SAAS,OAAO,WAAW,aAAa;AAC3D,WAAO,OAAO,SAAS;AAAA,EACxB;AAEA,QAAM,IAAI,MAAM,yBAAyB,8BAAS,EAAE,EAAE;AACvD;AAEA,IAAM,YAAY,aAAa;AAExB,IAAM,cAAyB,0BAAc;AAAA,EACnD,WAAW;AAAA,EACX,SAAS;AACV,CAAC;;;ADrBD,wBAAc,oBAAd;","names":["import_react_native"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/index.ts","../../src/lib/client-sdk.ts","../../src/lib/native-whop-core.ts","../../src/lib/native-whop-core-wrapper.ts"],"sourcesContent":["export * from \"./client-sdk\";\nexport * from \"./native-whop-core-wrapper\";\nexport * from \"./props\";\n","import { WhopClientSdk } from \"@whop/api\";\nimport { Platform } from \"react-native\";\nimport { __internal_execSync } from \"./native-whop-core-wrapper\";\n\nfunction getAppOrigin() {\n\tif (Platform.OS === \"android\" || Platform.OS === \"ios\") {\n\t\treturn __internal_execSync(\"getAppApiOrigin\", {}).apiOrigin;\n\t}\n\n\tif (Platform.OS === \"web\" && typeof window !== \"undefined\") {\n\t\treturn window.location.origin;\n\t}\n\n\tthrow new Error(`Unsupported platform: ${Platform.OS}`);\n}\n\nconst appOrigin = getAppOrigin();\n\nexport const whopSdk: WhopClientSdk = WhopClientSdk({\n\tapiOrigin: appOrigin,\n\tapiPath: \"/_whop/public-graphql/\",\n});\n\nexport * from \"@whop/api\";\n","import type { TurboModule } from \"react-native\";\nimport { TurboModuleRegistry } from \"react-native\";\n\nexport type FunctionCallResult = {\n\tisOk: boolean;\n\tdata: string | null;\n\terrorMessage: string | null;\n};\n\nexport interface Spec extends TurboModule {\n\texecSync(name: string, paramsJson: string): FunctionCallResult;\n\texecAsync(name: string, paramsJson: string): Promise<FunctionCallResult>;\n}\n\nexport default TurboModuleRegistry.getEnforcing<Spec>(\"NativeWhopCore\");\n","import nativeWhopCore from \"./native-whop-core\";\n\n// biome-ignore lint/complexity/noBannedTypes: allow here\ntype EmptyObject = {};\n\nexport interface ExecSyncApi {\n\tgetAppApiOrigin(params: EmptyObject): { apiOrigin: string };\n\tcacheGet(params: { key?: string | null }): { data?: string | null };\n\tcacheSet(params: { key?: string | null; data?: string | null }): EmptyObject;\n\trouterPush(params: {\n\t\tpath: string[];\n\t\tparams: Record<string, string>;\n\t}): EmptyObject;\n\trouterPop(params: EmptyObject): EmptyObject;\n\trouterGetCurrent(params: EmptyObject): {\n\t\tpath: string[];\n\t\tparams: Record<string, string>;\n\t};\n}\n\nexport interface ExecAsyncApi extends ExecSyncApi {}\n\nexport function __internal_execSync<F extends keyof ExecSyncApi>(\n\tname: F,\n\tparams: Parameters<ExecSyncApi[F]>[0],\n): ReturnType<ExecSyncApi[F]> {\n\tconst resultJson = nativeWhopCore.execSync(name, JSON.stringify(params));\n\tif (!resultJson.isOk) {\n\t\tthrow new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);\n\t}\n\n\treturn JSON.parse(resultJson.data || \"{}\") as ReturnType<ExecSyncApi[F]>;\n}\n\nexport async function __internal_execAsync<F extends keyof ExecAsyncApi>(\n\tname: F,\n\tparams: Parameters<ExecAsyncApi[F]>[0],\n): Promise<ReturnType<ExecAsyncApi[F]>> {\n\tconst resultJson = await nativeWhopCore.execAsync(\n\t\tname,\n\t\tJSON.stringify(params),\n\t);\n\n\tif (!resultJson.isOk) {\n\t\tthrow new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);\n\t}\n\n\treturn JSON.parse(resultJson.data || \"{}\") as ReturnType<ExecAsyncApi[F]>;\n}\n"],"mappings":";;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;;;ACAzB,SAAS,2BAA2B;AAapC,IAAO,2BAAQ,oBAAoB,aAAmB,gBAAgB;;;ACQ/D,SAAS,oBACf,MACA,QAC6B;AAC7B,QAAM,aAAa,yBAAe,SAAS,MAAM,KAAK,UAAU,MAAM,CAAC;AACvE,MAAI,CAAC,WAAW,MAAM;AACrB,UAAM,IAAI,MAAM,qBAAqB,IAAI,KAAK,WAAW,YAAY,EAAE;AAAA,EACxE;AAEA,SAAO,KAAK,MAAM,WAAW,QAAQ,IAAI;AAC1C;AAEA,eAAsB,qBACrB,MACA,QACuC;AACvC,QAAM,aAAa,MAAM,yBAAe;AAAA,IACvC;AAAA,IACA,KAAK,UAAU,MAAM;AAAA,EACtB;AAEA,MAAI,CAAC,WAAW,MAAM;AACrB,UAAM,IAAI,MAAM,qBAAqB,IAAI,KAAK,WAAW,YAAY,EAAE;AAAA,EACxE;AAEA,SAAO,KAAK,MAAM,WAAW,QAAQ,IAAI;AAC1C;;;AFzBA;AAAA,0BAAc;AAnBd,SAAS,eAAe;AACvB,MAAI,SAAS,OAAO,aAAa,SAAS,OAAO,OAAO;AACvD,WAAO,oBAAoB,mBAAmB,CAAC,CAAC,EAAE;AAAA,EACnD;AAEA,MAAI,SAAS,OAAO,SAAS,OAAO,WAAW,aAAa;AAC3D,WAAO,OAAO,SAAS;AAAA,EACxB;AAEA,QAAM,IAAI,MAAM,yBAAyB,SAAS,EAAE,EAAE;AACvD;AAEA,IAAM,YAAY,aAAa;AAExB,IAAM,UAAyB,cAAc;AAAA,EACnD,WAAW;AAAA,EACX,SAAS;AACV,CAAC;;;ADrBD,wBAAc;","names":[]}
1
+ {"version":3,"sources":["../../src/lib/index.ts","../../src/lib/client-sdk.ts","../../src/lib/native-whop-core.ts","../../src/lib/native-whop-core-wrapper.ts"],"sourcesContent":["export * from \"./client-sdk\";\nexport * from \"./native-whop-core-wrapper\";\nexport * from \"./props\";\n","import { WhopClientSdk } from \"@whop/api\";\nimport { Platform } from \"react-native\";\nimport { __internal_execSync } from \"./native-whop-core-wrapper\";\n\nfunction getAppOrigin() {\n\tif (Platform.OS === \"android\" || Platform.OS === \"ios\") {\n\t\treturn __internal_execSync(\"getAppApiOrigin\", {}).apiOrigin;\n\t}\n\n\tif (Platform.OS === \"web\" && typeof window !== \"undefined\") {\n\t\treturn window.location.origin;\n\t}\n\n\tthrow new Error(`Unsupported platform: ${Platform.OS}`);\n}\n\nconst appOrigin = getAppOrigin();\n\nexport const whopSdk: WhopClientSdk = WhopClientSdk({\n\tapiOrigin: appOrigin,\n\tapiPath: \"/_whop/public-graphql/\",\n});\n\nexport * from \"@whop/api\";\n","import type { TurboModule } from \"react-native\";\nimport { TurboModuleRegistry } from \"react-native\";\n\nexport type FunctionCallResult = {\n\tisOk: boolean;\n\tdata: string | null;\n\terrorMessage: string | null;\n};\n\nexport interface Spec extends TurboModule {\n\texecSync(name: string, paramsJson: string): FunctionCallResult;\n\texecAsync(name: string, paramsJson: string): Promise<FunctionCallResult>;\n}\n\nexport default TurboModuleRegistry.getEnforcing<Spec>(\"NativeWhopCore\");\n","import nativeWhopCore from \"./native-whop-core\";\nimport type { PathParams } from \"./props\";\n\n// biome-ignore lint/complexity/noBannedTypes: allow here\ntype EmptyObject = {};\n\nexport interface ExecSyncApi {\n\tgetAppApiOrigin(params: EmptyObject): { apiOrigin: string };\n\tcacheGet(params: { key?: string | null }): { data?: string | null };\n\tcacheSet(params: { key?: string | null; data?: string | null }): EmptyObject;\n\trouterPush(params: PathParams): EmptyObject;\n\trouterPop(params: EmptyObject): EmptyObject;\n\trouterGetCurrent(params: EmptyObject): PathParams;\n\tsetNavigationBarData(params: {\n\t\ttitle?: string | null;\n\t\tdescription?: string | null;\n\t}): EmptyObject;\n\trouterPresentSheet(params: PathParams): EmptyObject;\n\trouterDismissSheet(params: EmptyObject): EmptyObject;\n\trouterGetCurrentSheet(params: EmptyObject): PathParams | null | undefined;\n}\n\nexport interface ExecAsyncApi extends ExecSyncApi {}\n\nexport function __internal_execSync<F extends keyof ExecSyncApi>(\n\tname: F,\n\tparams: Parameters<ExecSyncApi[F]>[0],\n): ReturnType<ExecSyncApi[F]> {\n\tconst resultJson = nativeWhopCore.execSync(name, JSON.stringify(params));\n\tif (!resultJson.isOk) {\n\t\tthrow new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);\n\t}\n\n\treturn JSON.parse(resultJson.data || \"{}\") as ReturnType<ExecSyncApi[F]>;\n}\n\nexport async function __internal_execAsync<F extends keyof ExecAsyncApi>(\n\tname: F,\n\tparams: Parameters<ExecAsyncApi[F]>[0],\n): Promise<ReturnType<ExecAsyncApi[F]>> {\n\tconst resultJson = await nativeWhopCore.execAsync(\n\t\tname,\n\t\tJSON.stringify(params),\n\t);\n\n\tif (!resultJson.isOk) {\n\t\tthrow new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);\n\t}\n\n\treturn JSON.parse(resultJson.data || \"{}\") as ReturnType<ExecAsyncApi[F]>;\n}\n"],"mappings":";;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;;;ACAzB,SAAS,2BAA2B;AAapC,IAAO,2BAAQ,oBAAoB,aAAmB,gBAAgB;;;ACU/D,SAAS,oBACf,MACA,QAC6B;AAC7B,QAAM,aAAa,yBAAe,SAAS,MAAM,KAAK,UAAU,MAAM,CAAC;AACvE,MAAI,CAAC,WAAW,MAAM;AACrB,UAAM,IAAI,MAAM,qBAAqB,IAAI,KAAK,WAAW,YAAY,EAAE;AAAA,EACxE;AAEA,SAAO,KAAK,MAAM,WAAW,QAAQ,IAAI;AAC1C;AAEA,eAAsB,qBACrB,MACA,QACuC;AACvC,QAAM,aAAa,MAAM,yBAAe;AAAA,IACvC;AAAA,IACA,KAAK,UAAU,MAAM;AAAA,EACtB;AAEA,MAAI,CAAC,WAAW,MAAM;AACrB,UAAM,IAAI,MAAM,qBAAqB,IAAI,KAAK,WAAW,YAAY,EAAE;AAAA,EACxE;AAEA,SAAO,KAAK,MAAM,WAAW,QAAQ,IAAI;AAC1C;;;AF3BA;AAAA,0BAAc;AAnBd,SAAS,eAAe;AACvB,MAAI,SAAS,OAAO,aAAa,SAAS,OAAO,OAAO;AACvD,WAAO,oBAAoB,mBAAmB,CAAC,CAAC,EAAE;AAAA,EACnD;AAEA,MAAI,SAAS,OAAO,SAAS,OAAO,WAAW,aAAa;AAC3D,WAAO,OAAO,SAAS;AAAA,EACxB;AAEA,QAAM,IAAI,MAAM,yBAAyB,SAAS,EAAE,EAAE;AACvD;AAEA,IAAM,YAAY,aAAa;AAExB,IAAM,UAAyB,cAAc;AAAA,EACnD,WAAW;AAAA,EACX,SAAS;AACV,CAAC;;;ADrBD,wBAAc;","names":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@whop/react-native",
3
3
  "description": "React Native SDK for building embedded apps on Whop",
4
- "version": "0.0.4",
4
+ "version": "0.0.5",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/whopio/whop-sdk-ts",
@@ -48,7 +48,7 @@
48
48
  "metro": "^0.83.0",
49
49
  "metro-react-native-babel-transformer": "^0.77.0",
50
50
  "rimraf": "^6.0.1",
51
- "@whop/api": "0.0.37"
51
+ "@whop/api": "0.0.38"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "latest",