@whop/react-native 0.0.2 → 0.0.3

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.
@@ -0,0 +1,30 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
6
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
7
+ }) : x)(function(x) {
8
+ if (typeof require !== "undefined") return require.apply(this, arguments);
9
+ throw Error('Dynamic require of "' + x + '" is not supported');
10
+ });
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
24
+
25
+ export {
26
+ __require,
27
+ __export,
28
+ __reExport
29
+ };
30
+ //# sourceMappingURL=chunk-AXIFUFN6.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __require
3
- } from "../chunk-BJTO5JO5.mjs";
3
+ } from "../chunk-AXIFUFN6.mjs";
4
4
 
5
5
  // src/cli/index.ts
6
6
  import { existsSync as existsSync2 } from "fs";
@@ -1,7 +1,28 @@
1
1
  import { WhopClientSdk } from '@whop/api';
2
+ export * from '@whop/api';
2
3
 
3
4
  declare const whopSdk: WhopClientSdk;
4
5
 
6
+ type EmptyObject = {};
7
+ interface ExecSyncApi {
8
+ getAppApiOrigin(params: EmptyObject): {
9
+ apiOrigin: string;
10
+ };
11
+ cacheGet(params: {
12
+ key?: string | null;
13
+ }): {
14
+ data?: string | null;
15
+ };
16
+ cacheSet(params: {
17
+ key?: string | null;
18
+ data?: string | null;
19
+ }): EmptyObject;
20
+ }
21
+ interface ExecAsyncApi extends ExecSyncApi {
22
+ }
23
+ declare function __internal_execSync<F extends keyof ExecSyncApi>(name: F, params: Parameters<ExecSyncApi[F]>[0]): ReturnType<ExecSyncApi[F]>;
24
+ declare function __internal_execAsync<F extends keyof ExecAsyncApi>(name: F, params: Parameters<ExecAsyncApi[F]>[0]): Promise<ReturnType<ExecAsyncApi[F]>>;
25
+
5
26
  interface BaseViewProps {
6
27
  currentUserId: string | undefined | null;
7
28
  restPath: string | undefined | null;
@@ -13,4 +34,4 @@ interface ExperienceViewProps extends BaseViewProps {
13
34
  interface DiscoverViewProps extends BaseViewProps {
14
35
  }
15
36
 
16
- export { type DiscoverViewProps, type ExperienceViewProps, whopSdk };
37
+ export { type DiscoverViewProps, type ExecAsyncApi, type ExecSyncApi, type ExperienceViewProps, __internal_execAsync, __internal_execSync, whopSdk };
@@ -1,7 +1,28 @@
1
1
  import { WhopClientSdk } from '@whop/api';
2
+ export * from '@whop/api';
2
3
 
3
4
  declare const whopSdk: WhopClientSdk;
4
5
 
6
+ type EmptyObject = {};
7
+ interface ExecSyncApi {
8
+ getAppApiOrigin(params: EmptyObject): {
9
+ apiOrigin: string;
10
+ };
11
+ cacheGet(params: {
12
+ key?: string | null;
13
+ }): {
14
+ data?: string | null;
15
+ };
16
+ cacheSet(params: {
17
+ key?: string | null;
18
+ data?: string | null;
19
+ }): EmptyObject;
20
+ }
21
+ interface ExecAsyncApi extends ExecSyncApi {
22
+ }
23
+ declare function __internal_execSync<F extends keyof ExecSyncApi>(name: F, params: Parameters<ExecSyncApi[F]>[0]): ReturnType<ExecSyncApi[F]>;
24
+ declare function __internal_execAsync<F extends keyof ExecAsyncApi>(name: F, params: Parameters<ExecAsyncApi[F]>[0]): Promise<ReturnType<ExecAsyncApi[F]>>;
25
+
5
26
  interface BaseViewProps {
6
27
  currentUserId: string | undefined | null;
7
28
  restPath: string | undefined | null;
@@ -13,4 +34,4 @@ interface ExperienceViewProps extends BaseViewProps {
13
34
  interface DiscoverViewProps extends BaseViewProps {
14
35
  }
15
36
 
16
- export { type DiscoverViewProps, type ExperienceViewProps, whopSdk };
37
+ export { type DiscoverViewProps, type ExecAsyncApi, type ExecSyncApi, type ExperienceViewProps, __internal_execAsync, __internal_execSync, whopSdk };
package/dist/lib/index.js CHANGED
@@ -15,16 +15,23 @@ var __copyProps = (to, from, except, desc) => {
15
15
  }
16
16
  return to;
17
17
  };
18
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
20
 
20
21
  // src/lib/index.ts
21
22
  var lib_exports = {};
22
23
  __export(lib_exports, {
24
+ __internal_execAsync: () => __internal_execAsync,
25
+ __internal_execSync: () => __internal_execSync,
23
26
  whopSdk: () => whopSdk
24
27
  });
25
28
  module.exports = __toCommonJS(lib_exports);
26
29
 
27
30
  // src/lib/client-sdk.ts
31
+ var client_sdk_exports = {};
32
+ __export(client_sdk_exports, {
33
+ whopSdk: () => whopSdk
34
+ });
28
35
  var import_api = require("@whop/api");
29
36
  var import_react_native2 = require("react-native");
30
37
 
@@ -32,15 +39,30 @@ var import_react_native2 = require("react-native");
32
39
  var import_react_native = require("react-native");
33
40
  var native_whop_core_default = import_react_native.TurboModuleRegistry.getEnforcing("NativeWhopCore");
34
41
 
42
+ // src/lib/native-whop-core-wrapper.ts
43
+ function __internal_execSync(name, params) {
44
+ const resultJson = native_whop_core_default.execSync(name, JSON.stringify(params));
45
+ if (!resultJson.isOk) {
46
+ throw new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);
47
+ }
48
+ return JSON.parse(resultJson.data || "{}");
49
+ }
50
+ async function __internal_execAsync(name, params) {
51
+ const resultJson = await native_whop_core_default.execAsync(
52
+ name,
53
+ JSON.stringify(params)
54
+ );
55
+ if (!resultJson.isOk) {
56
+ throw new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);
57
+ }
58
+ return JSON.parse(resultJson.data || "{}");
59
+ }
60
+
35
61
  // src/lib/client-sdk.ts
62
+ __reExport(client_sdk_exports, require("@whop/api"));
36
63
  function getAppOrigin() {
37
64
  if (import_react_native2.Platform.OS === "android" || import_react_native2.Platform.OS === "ios") {
38
- const result = native_whop_core_default.execSync("getAppApiOrigin", "{}");
39
- if (result.isOk) {
40
- const { apiOrigin } = JSON.parse(result.data || "{}");
41
- return apiOrigin;
42
- }
43
- throw new Error(`Failed to get app origin: ${result.errorMessage}`);
65
+ return __internal_execSync("getAppApiOrigin", {}).apiOrigin;
44
66
  }
45
67
  if (import_react_native2.Platform.OS === "web" && typeof window !== "undefined") {
46
68
  return window.location.origin;
@@ -52,8 +74,13 @@ var whopSdk = (0, import_api.WhopClientSdk)({
52
74
  apiOrigin: appOrigin,
53
75
  apiPath: "/_whop/public-graphql/"
54
76
  });
77
+
78
+ // src/lib/index.ts
79
+ __reExport(lib_exports, client_sdk_exports, module.exports);
55
80
  // Annotate the CommonJS export names for ESM import in node:
56
81
  0 && (module.exports = {
82
+ __internal_execAsync,
83
+ __internal_execSync,
57
84
  whopSdk
58
85
  });
59
86
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/index.ts","../../src/lib/client-sdk.ts","../../src/lib/native-whop-core.ts"],"sourcesContent":["export * from \"./client-sdk\";\nexport * from \"./props\";\n","import { WhopClientSdk } from \"@whop/api\";\nimport { Platform } from \"react-native\";\nimport nativeWhopCore from \"./native-whop-core\";\n\nfunction getAppOrigin() {\n\tif (Platform.OS === \"android\" || Platform.OS === \"ios\") {\n\t\tconst result = nativeWhopCore.execSync(\"getAppApiOrigin\", \"{}\");\n\t\tif (result.isOk) {\n\t\t\tconst { apiOrigin } = JSON.parse(result.data || \"{}\");\n\t\t\treturn apiOrigin;\n\t\t}\n\t\tthrow new Error(`Failed to get app origin: ${result.errorMessage}`);\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","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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAA8B;AAC9B,IAAAA,uBAAyB;;;ACAzB,0BAAoC;AAapC,IAAO,2BAAQ,wCAAoB,aAAmB,gBAAgB;;;ADVtE,SAAS,eAAe;AACvB,MAAI,8BAAS,OAAO,aAAa,8BAAS,OAAO,OAAO;AACvD,UAAM,SAAS,yBAAe,SAAS,mBAAmB,IAAI;AAC9D,QAAI,OAAO,MAAM;AAChB,YAAM,EAAE,UAAU,IAAI,KAAK,MAAM,OAAO,QAAQ,IAAI;AACpD,aAAO;AAAA,IACR;AACA,UAAM,IAAI,MAAM,6BAA6B,OAAO,YAAY,EAAE;AAAA,EACnE;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;","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\";\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}\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;;;ACD/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;;;AFhBA,+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,6 +1,21 @@
1
- import "../chunk-BJTO5JO5.mjs";
1
+ import {
2
+ __export,
3
+ __reExport
4
+ } from "../chunk-AXIFUFN6.mjs";
5
+
6
+ // src/lib/index.ts
7
+ var lib_exports = {};
8
+ __export(lib_exports, {
9
+ __internal_execAsync: () => __internal_execAsync,
10
+ __internal_execSync: () => __internal_execSync,
11
+ whopSdk: () => whopSdk
12
+ });
2
13
 
3
14
  // src/lib/client-sdk.ts
15
+ var client_sdk_exports = {};
16
+ __export(client_sdk_exports, {
17
+ whopSdk: () => whopSdk
18
+ });
4
19
  import { WhopClientSdk } from "@whop/api";
5
20
  import { Platform } from "react-native";
6
21
 
@@ -8,15 +23,31 @@ import { Platform } from "react-native";
8
23
  import { TurboModuleRegistry } from "react-native";
9
24
  var native_whop_core_default = TurboModuleRegistry.getEnforcing("NativeWhopCore");
10
25
 
26
+ // src/lib/native-whop-core-wrapper.ts
27
+ function __internal_execSync(name, params) {
28
+ const resultJson = native_whop_core_default.execSync(name, JSON.stringify(params));
29
+ if (!resultJson.isOk) {
30
+ throw new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);
31
+ }
32
+ return JSON.parse(resultJson.data || "{}");
33
+ }
34
+ async function __internal_execAsync(name, params) {
35
+ const resultJson = await native_whop_core_default.execAsync(
36
+ name,
37
+ JSON.stringify(params)
38
+ );
39
+ if (!resultJson.isOk) {
40
+ throw new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);
41
+ }
42
+ return JSON.parse(resultJson.data || "{}");
43
+ }
44
+
11
45
  // src/lib/client-sdk.ts
46
+ __reExport(client_sdk_exports, api_star);
47
+ import * as api_star from "@whop/api";
12
48
  function getAppOrigin() {
13
49
  if (Platform.OS === "android" || Platform.OS === "ios") {
14
- const result = native_whop_core_default.execSync("getAppApiOrigin", "{}");
15
- if (result.isOk) {
16
- const { apiOrigin } = JSON.parse(result.data || "{}");
17
- return apiOrigin;
18
- }
19
- throw new Error(`Failed to get app origin: ${result.errorMessage}`);
50
+ return __internal_execSync("getAppApiOrigin", {}).apiOrigin;
20
51
  }
21
52
  if (Platform.OS === "web" && typeof window !== "undefined") {
22
53
  return window.location.origin;
@@ -28,7 +59,12 @@ var whopSdk = WhopClientSdk({
28
59
  apiOrigin: appOrigin,
29
60
  apiPath: "/_whop/public-graphql/"
30
61
  });
62
+
63
+ // src/lib/index.ts
64
+ __reExport(lib_exports, client_sdk_exports);
31
65
  export {
66
+ __internal_execAsync,
67
+ __internal_execSync,
32
68
  whopSdk
33
69
  };
34
70
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/client-sdk.ts","../../src/lib/native-whop-core.ts"],"sourcesContent":["import { WhopClientSdk } from \"@whop/api\";\nimport { Platform } from \"react-native\";\nimport nativeWhopCore from \"./native-whop-core\";\n\nfunction getAppOrigin() {\n\tif (Platform.OS === \"android\" || Platform.OS === \"ios\") {\n\t\tconst result = nativeWhopCore.execSync(\"getAppApiOrigin\", \"{}\");\n\t\tif (result.isOk) {\n\t\t\tconst { apiOrigin } = JSON.parse(result.data || \"{}\");\n\t\t\treturn apiOrigin;\n\t\t}\n\t\tthrow new Error(`Failed to get app origin: ${result.errorMessage}`);\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","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"],"mappings":";;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;;;ACAzB,SAAS,2BAA2B;AAapC,IAAO,2BAAQ,oBAAoB,aAAmB,gBAAgB;;;ADVtE,SAAS,eAAe;AACvB,MAAI,SAAS,OAAO,aAAa,SAAS,OAAO,OAAO;AACvD,UAAM,SAAS,yBAAe,SAAS,mBAAmB,IAAI;AAC9D,QAAI,OAAO,MAAM;AAChB,YAAM,EAAE,UAAU,IAAI,KAAK,MAAM,OAAO,QAAQ,IAAI;AACpD,aAAO;AAAA,IACR;AACA,UAAM,IAAI,MAAM,6BAA6B,OAAO,YAAY,EAAE;AAAA,EACnE;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;","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\";\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}\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;;;ACD/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;;;AFhBA;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.2",
4
+ "version": "0.0.3",
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.36"
51
+ "@whop/api": "0.0.37"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "latest",
@@ -1,11 +0,0 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
- export {
9
- __require
10
- };
11
- //# sourceMappingURL=chunk-BJTO5JO5.mjs.map