@coinbase/cdp-react-native 0.0.84 → 0.0.85

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,7 @@
1
+ import { getDefaultExportFromCjs as r } from "./index18.js";
2
+ import { __require as o } from "./index12.js";
3
+ var t = o();
4
+ const a = /* @__PURE__ */ r(t);
5
+ export {
6
+ a as default
7
+ };
@@ -0,0 +1,50 @@
1
+ function n() {
2
+ try {
3
+ return typeof navigator < "u" && navigator.product === "ReactNative";
4
+ } catch {
5
+ return !1;
6
+ }
7
+ }
8
+ function r() {
9
+ try {
10
+ if (typeof window > "u")
11
+ return typeof process < "u" && process.env && "__NEXT_PROCESSED_ENV" in process.env;
12
+ const e = window;
13
+ return !!(e.__NEXT_DATA__ || e.next || document.getElementById("__next"));
14
+ } catch {
15
+ return !1;
16
+ }
17
+ }
18
+ function o() {
19
+ try {
20
+ if (typeof window > "u")
21
+ return !1;
22
+ const e = window;
23
+ return !!(e.__VUE__ || e.__VUE_DEVTOOLS_GLOBAL_HOOK__ || document.querySelector("[data-v-]"));
24
+ } catch {
25
+ return !1;
26
+ }
27
+ }
28
+ function u() {
29
+ try {
30
+ if (typeof window > "u")
31
+ return !1;
32
+ const e = window;
33
+ return e.__REACT_DEVTOOLS_GLOBAL_HOOK__ || e.React ? !0 : !!document.querySelector(
34
+ "[data-reactroot], [data-reactid], ._reactRoot, ._reactRootContainer"
35
+ );
36
+ } catch {
37
+ return !1;
38
+ }
39
+ }
40
+ function a() {
41
+ return u() ? "react" : n() ? "react-native" : r() ? "nextjs" : o() ? "vue" : "unknown";
42
+ }
43
+ let t = null;
44
+ function i() {
45
+ return t === null && (t = a()), t;
46
+ }
47
+ export {
48
+ a as detectFramework,
49
+ i as getFramework
50
+ };
@@ -0,0 +1,41 @@
1
+ import { __module as h } from "./index13.js";
2
+ import { __require as S } from "./index14.js";
3
+ import { __require as q } from "./index15.js";
4
+ import { __require as w } from "./index16.js";
5
+ var x;
6
+ function G() {
7
+ return x ? h.exports : (x = 1, function() {
8
+ var v = S(), p = q().utf8, B = w(), F = q().bin, d = function(o, f) {
9
+ o.constructor == String ? f && f.encoding === "binary" ? o = F.stringToBytes(o) : o = p.stringToBytes(o) : B(o) ? o = Array.prototype.slice.call(o, 0) : !Array.isArray(o) && o.constructor !== Uint8Array && (o = o.toString());
10
+ for (var u = v.bytesToWords(o), a = o.length * 8, n = 1732584193, r = -271733879, i = -1732584194, t = 271733878, e = 0; e < u.length; e++)
11
+ u[e] = (u[e] << 8 | u[e] >>> 24) & 16711935 | (u[e] << 24 | u[e] >>> 8) & 4278255360;
12
+ u[a >>> 5] |= 128 << a % 32, u[(a + 64 >>> 9 << 4) + 14] = a;
13
+ for (var _ = d._ff, c = d._gg, l = d._hh, y = d._ii, e = 0; e < u.length; e += 16) {
14
+ var T = n, b = r, A = i, I = t;
15
+ n = _(n, r, i, t, u[e + 0], 7, -680876936), t = _(t, n, r, i, u[e + 1], 12, -389564586), i = _(i, t, n, r, u[e + 2], 17, 606105819), r = _(r, i, t, n, u[e + 3], 22, -1044525330), n = _(n, r, i, t, u[e + 4], 7, -176418897), t = _(t, n, r, i, u[e + 5], 12, 1200080426), i = _(i, t, n, r, u[e + 6], 17, -1473231341), r = _(r, i, t, n, u[e + 7], 22, -45705983), n = _(n, r, i, t, u[e + 8], 7, 1770035416), t = _(t, n, r, i, u[e + 9], 12, -1958414417), i = _(i, t, n, r, u[e + 10], 17, -42063), r = _(r, i, t, n, u[e + 11], 22, -1990404162), n = _(n, r, i, t, u[e + 12], 7, 1804603682), t = _(t, n, r, i, u[e + 13], 12, -40341101), i = _(i, t, n, r, u[e + 14], 17, -1502002290), r = _(r, i, t, n, u[e + 15], 22, 1236535329), n = c(n, r, i, t, u[e + 1], 5, -165796510), t = c(t, n, r, i, u[e + 6], 9, -1069501632), i = c(i, t, n, r, u[e + 11], 14, 643717713), r = c(r, i, t, n, u[e + 0], 20, -373897302), n = c(n, r, i, t, u[e + 5], 5, -701558691), t = c(t, n, r, i, u[e + 10], 9, 38016083), i = c(i, t, n, r, u[e + 15], 14, -660478335), r = c(r, i, t, n, u[e + 4], 20, -405537848), n = c(n, r, i, t, u[e + 9], 5, 568446438), t = c(t, n, r, i, u[e + 14], 9, -1019803690), i = c(i, t, n, r, u[e + 3], 14, -187363961), r = c(r, i, t, n, u[e + 8], 20, 1163531501), n = c(n, r, i, t, u[e + 13], 5, -1444681467), t = c(t, n, r, i, u[e + 2], 9, -51403784), i = c(i, t, n, r, u[e + 7], 14, 1735328473), r = c(r, i, t, n, u[e + 12], 20, -1926607734), n = l(n, r, i, t, u[e + 5], 4, -378558), t = l(t, n, r, i, u[e + 8], 11, -2022574463), i = l(i, t, n, r, u[e + 11], 16, 1839030562), r = l(r, i, t, n, u[e + 14], 23, -35309556), n = l(n, r, i, t, u[e + 1], 4, -1530992060), t = l(t, n, r, i, u[e + 4], 11, 1272893353), i = l(i, t, n, r, u[e + 7], 16, -155497632), r = l(r, i, t, n, u[e + 10], 23, -1094730640), n = l(n, r, i, t, u[e + 13], 4, 681279174), t = l(t, n, r, i, u[e + 0], 11, -358537222), i = l(i, t, n, r, u[e + 3], 16, -722521979), r = l(r, i, t, n, u[e + 6], 23, 76029189), n = l(n, r, i, t, u[e + 9], 4, -640364487), t = l(t, n, r, i, u[e + 12], 11, -421815835), i = l(i, t, n, r, u[e + 15], 16, 530742520), r = l(r, i, t, n, u[e + 2], 23, -995338651), n = y(n, r, i, t, u[e + 0], 6, -198630844), t = y(t, n, r, i, u[e + 7], 10, 1126891415), i = y(i, t, n, r, u[e + 14], 15, -1416354905), r = y(r, i, t, n, u[e + 5], 21, -57434055), n = y(n, r, i, t, u[e + 12], 6, 1700485571), t = y(t, n, r, i, u[e + 3], 10, -1894986606), i = y(i, t, n, r, u[e + 10], 15, -1051523), r = y(r, i, t, n, u[e + 1], 21, -2054922799), n = y(n, r, i, t, u[e + 8], 6, 1873313359), t = y(t, n, r, i, u[e + 15], 10, -30611744), i = y(i, t, n, r, u[e + 6], 15, -1560198380), r = y(r, i, t, n, u[e + 13], 21, 1309151649), n = y(n, r, i, t, u[e + 4], 6, -145523070), t = y(t, n, r, i, u[e + 11], 10, -1120210379), i = y(i, t, n, r, u[e + 2], 15, 718787259), r = y(r, i, t, n, u[e + 9], 21, -343485551), n = n + T >>> 0, r = r + b >>> 0, i = i + A >>> 0, t = t + I >>> 0;
16
+ }
17
+ return v.endian([n, r, i, t]);
18
+ };
19
+ d._ff = function(o, f, u, a, n, r, i) {
20
+ var t = o + (f & u | ~f & a) + (n >>> 0) + i;
21
+ return (t << r | t >>> 32 - r) + f;
22
+ }, d._gg = function(o, f, u, a, n, r, i) {
23
+ var t = o + (f & a | u & ~a) + (n >>> 0) + i;
24
+ return (t << r | t >>> 32 - r) + f;
25
+ }, d._hh = function(o, f, u, a, n, r, i) {
26
+ var t = o + (f ^ u ^ a) + (n >>> 0) + i;
27
+ return (t << r | t >>> 32 - r) + f;
28
+ }, d._ii = function(o, f, u, a, n, r, i) {
29
+ var t = o + (u ^ (f | ~a)) + (n >>> 0) + i;
30
+ return (t << r | t >>> 32 - r) + f;
31
+ }, d._blocksize = 16, d._digestsize = 16, h.exports = function(o, f) {
32
+ if (o == null)
33
+ throw new Error("Illegal argument " + o);
34
+ var u = v.wordsToBytes(d(o, f));
35
+ return f && f.asBytes ? u : f && f.asString ? F.bytesToString(u) : v.bytesToHex(u);
36
+ };
37
+ }(), h.exports);
38
+ }
39
+ export {
40
+ G as __require
41
+ };
@@ -0,0 +1,4 @@
1
+ var e = { exports: {} };
2
+ export {
3
+ e as __module
4
+ };
@@ -0,0 +1,72 @@
1
+ import { __module as a } from "./index17.js";
2
+ var h;
3
+ function c() {
4
+ return h ? a.exports : (h = 1, function() {
5
+ var f = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", u = {
6
+ // Bit-wise rotation left
7
+ rotl: function(r, t) {
8
+ return r << t | r >>> 32 - t;
9
+ },
10
+ // Bit-wise rotation right
11
+ rotr: function(r, t) {
12
+ return r << 32 - t | r >>> t;
13
+ },
14
+ // Swap big-endian to little-endian and vice versa
15
+ endian: function(r) {
16
+ if (r.constructor == Number)
17
+ return u.rotl(r, 8) & 16711935 | u.rotl(r, 24) & 4278255360;
18
+ for (var t = 0; t < r.length; t++)
19
+ r[t] = u.endian(r[t]);
20
+ return r;
21
+ },
22
+ // Generate an array of any length of random bytes
23
+ randomBytes: function(r) {
24
+ for (var t = []; r > 0; r--)
25
+ t.push(Math.floor(Math.random() * 256));
26
+ return t;
27
+ },
28
+ // Convert a byte array to big-endian 32-bit words
29
+ bytesToWords: function(r) {
30
+ for (var t = [], n = 0, o = 0; n < r.length; n++, o += 8)
31
+ t[o >>> 5] |= r[n] << 24 - o % 32;
32
+ return t;
33
+ },
34
+ // Convert big-endian 32-bit words to a byte array
35
+ wordsToBytes: function(r) {
36
+ for (var t = [], n = 0; n < r.length * 32; n += 8)
37
+ t.push(r[n >>> 5] >>> 24 - n % 32 & 255);
38
+ return t;
39
+ },
40
+ // Convert a byte array to a hex string
41
+ bytesToHex: function(r) {
42
+ for (var t = [], n = 0; n < r.length; n++)
43
+ t.push((r[n] >>> 4).toString(16)), t.push((r[n] & 15).toString(16));
44
+ return t.join("");
45
+ },
46
+ // Convert a hex string to a byte array
47
+ hexToBytes: function(r) {
48
+ for (var t = [], n = 0; n < r.length; n += 2)
49
+ t.push(parseInt(r.substr(n, 2), 16));
50
+ return t;
51
+ },
52
+ // Convert a byte array to a base-64 string
53
+ bytesToBase64: function(r) {
54
+ for (var t = [], n = 0; n < r.length; n += 3)
55
+ for (var o = r[n] << 16 | r[n + 1] << 8 | r[n + 2], e = 0; e < 4; e++)
56
+ n * 8 + e * 6 <= r.length * 8 ? t.push(f.charAt(o >>> 6 * (3 - e) & 63)) : t.push("=");
57
+ return t.join("");
58
+ },
59
+ // Convert a base-64 string to a byte array
60
+ base64ToBytes: function(r) {
61
+ r = r.replace(/[^A-Z0-9+\/]/ig, "");
62
+ for (var t = [], n = 0, o = 0; n < r.length; o = ++n % 4)
63
+ o != 0 && t.push((f.indexOf(r.charAt(n - 1)) & Math.pow(2, -2 * o + 8) - 1) << o * 2 | f.indexOf(r.charAt(n)) >>> 6 - o * 2);
64
+ return t;
65
+ }
66
+ };
67
+ a.exports = u;
68
+ }(), a.exports);
69
+ }
70
+ export {
71
+ c as __require
72
+ };
@@ -0,0 +1,37 @@
1
+ var o, u;
2
+ function c() {
3
+ if (u) return o;
4
+ u = 1;
5
+ var t = {
6
+ // UTF-8 encoding
7
+ utf8: {
8
+ // Convert a string to a byte array
9
+ stringToBytes: function(n) {
10
+ return t.bin.stringToBytes(unescape(encodeURIComponent(n)));
11
+ },
12
+ // Convert a byte array to a string
13
+ bytesToString: function(n) {
14
+ return decodeURIComponent(escape(t.bin.bytesToString(n)));
15
+ }
16
+ },
17
+ // Binary encoding
18
+ bin: {
19
+ // Convert a string to a byte array
20
+ stringToBytes: function(n) {
21
+ for (var e = [], r = 0; r < n.length; r++)
22
+ e.push(n.charCodeAt(r) & 255);
23
+ return e;
24
+ },
25
+ // Convert a byte array to a string
26
+ bytesToString: function(n) {
27
+ for (var e = [], r = 0; r < n.length; r++)
28
+ e.push(String.fromCharCode(n[r]));
29
+ return e.join("");
30
+ }
31
+ }
32
+ };
33
+ return o = t, o;
34
+ }
35
+ export {
36
+ c as __require
37
+ };
@@ -0,0 +1,23 @@
1
+ /*!
2
+ * Determine if an object is a Buffer
3
+ *
4
+ * @author Feross Aboukhadijeh <https://feross.org>
5
+ * @license MIT
6
+ */
7
+ var f, e;
8
+ function t() {
9
+ if (e) return f;
10
+ e = 1, f = function(r) {
11
+ return r != null && (u(r) || n(r) || !!r._isBuffer);
12
+ };
13
+ function u(r) {
14
+ return !!r.constructor && typeof r.constructor.isBuffer == "function" && r.constructor.isBuffer(r);
15
+ }
16
+ function n(r) {
17
+ return typeof r.readFloatLE == "function" && typeof r.slice == "function" && u(r.slice(0, 0));
18
+ }
19
+ return f;
20
+ }
21
+ export {
22
+ t as __require
23
+ };
@@ -0,0 +1,4 @@
1
+ var r = { exports: {} };
2
+ export {
3
+ r as __module
4
+ };
@@ -0,0 +1,6 @@
1
+ function e(t) {
2
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
3
+ }
4
+ export {
5
+ e as getDefaultExportFromCjs
6
+ };
@@ -1,7 +1,10 @@
1
- import { useContext as r } from "react";
2
- import { ApplePayContext as t } from "./index2.js";
3
- function s() {
4
- const e = r(t);
1
+ import "./index6.js";
2
+ import { useSendHookCallOnce as r } from "./index7.js";
3
+ import { useContext as t } from "react";
4
+ import { ApplePayContext as o } from "./index2.js";
5
+ function u() {
6
+ r("use_apple_pay");
7
+ const e = t(o);
5
8
  if (!e)
6
9
  throw new Error("useApplePay must be used within an ApplePayProvider");
7
10
  return {
@@ -13,5 +16,5 @@ function s() {
13
16
  };
14
17
  }
15
18
  export {
16
- s as useApplePay
19
+ u as useApplePay
17
20
  };
@@ -1,29 +1,32 @@
1
- import i, { useContext as d, useCallback as c } from "react";
2
- import { StyleSheet as p, Platform as l, View as g } from "react-native";
3
- import { WebView as v } from "react-native-webview";
4
- import { ApplePayContext as w } from "./index2.js";
5
- import { parseWebViewMessage as f } from "./index6.js";
6
- function S({ style: s }) {
7
- const e = d(w);
1
+ import "./index6.js";
2
+ import i, { useContext as p, useCallback as d } from "react";
3
+ import { useSendComponentCallOnce as c } from "./index8.js";
4
+ import { StyleSheet as l, Platform as g, View as v } from "react-native";
5
+ import { WebView as w } from "react-native-webview";
6
+ import { ApplePayContext as f } from "./index2.js";
7
+ import { parseWebViewMessage as u } from "./index9.js";
8
+ function V({ style: s }) {
9
+ c("apple_pay_button");
10
+ const e = p(f);
8
11
  if (!e)
9
12
  throw new Error("ApplePayButton must be used within an ApplePayProvider");
10
- const n = e.data?.paymentLink.url, r = c(
13
+ const n = e.data?.paymentLink.url, r = d(
11
14
  (a) => {
12
15
  e.debug && console.log(
13
16
  "[ApplePayButton] Received webview event:",
14
17
  JSON.stringify(a.nativeEvent.data, null, 2)
15
18
  );
16
- const t = f(a.nativeEvent.data);
19
+ const t = u(a.nativeEvent.data);
17
20
  e.debug && console.log("[ApplePayButton] Parsed event:", JSON.stringify(t, null, 2)), t.success && e.paymentEventHandler(t.event);
18
21
  },
19
22
  [e.paymentEventHandler]
20
23
  );
21
- return l.OS !== "ios" ? (__DEV__ && console.warn("ApplePayButton is only available on iOS"), null) : n ? /* @__PURE__ */ i.createElement(g, { style: [o.container, s] }, /* @__PURE__ */ i.createElement(
22
- v,
24
+ return g.OS !== "ios" ? (__DEV__ && console.warn("ApplePayButton is only available on iOS"), null) : n ? /* @__PURE__ */ i.createElement(v, { style: [o.container, s] }, /* @__PURE__ */ i.createElement(
25
+ w,
23
26
  {
24
27
  source: { uri: n },
25
- injectedJavaScriptBeforeContentLoaded: u,
26
- injectedJavaScript: m,
28
+ injectedJavaScriptBeforeContentLoaded: m,
29
+ injectedJavaScript: y,
27
30
  onMessage: r,
28
31
  startInLoadingState: !0,
29
32
  style: o.webView,
@@ -32,7 +35,7 @@ function S({ style: s }) {
32
35
  }
33
36
  )) : null;
34
37
  }
35
- const o = p.create({
38
+ const o = l.create({
36
39
  container: {
37
40
  height: 48,
38
41
  width: "100%",
@@ -43,7 +46,7 @@ const o = p.create({
43
46
  flex: 1,
44
47
  backgroundColor: "transparent"
45
48
  }
46
- }), u = `
49
+ }), m = `
47
50
  (function() {
48
51
  // Flag to prevent duplicate installations
49
52
  window.__cdpEventForwarderInstalled = true;
@@ -102,7 +105,7 @@ const o = p.create({
102
105
 
103
106
  true;
104
107
  })();
105
- `, m = `
108
+ `, y = `
106
109
  (function() {
107
110
  if (window.__cdpEventForwarderInstalled) {
108
111
  return true;
@@ -125,5 +128,5 @@ const o = p.create({
125
128
  })();
126
129
  `;
127
130
  export {
128
- S as ApplePayButton
131
+ V as ApplePayButton
129
132
  };
@@ -1,51 +1,60 @@
1
- const a = [
2
- "onramp_api.load_pending",
3
- "onramp_api.load_success",
4
- "onramp_api.load_error",
5
- "onramp_api.polling_start",
6
- "onramp_api.polling_success",
7
- "onramp_api.polling_error",
8
- "onramp_api.commit_success",
9
- "onramp_api.commit_error",
10
- "onramp_api.cancel"
11
- ];
12
- function o(s) {
13
- let e;
14
- try {
15
- e = JSON.parse(s);
16
- } catch {
17
- return { success: !1, reason: "Invalid JSON" };
18
- }
19
- if (!n(e))
20
- return { success: !1, reason: "Invalid message structure" };
21
- const r = e.eventName ?? e.type;
22
- return r ? t(r) ? e.data?.errorCode || e.data?.errorMessage ? {
23
- success: !0,
24
- event: {
25
- type: r,
26
- message: e.message,
27
- error: {
28
- code: e.data?.errorCode,
29
- message: e.data?.errorMessage
30
- }
1
+ import p from "./index10.js";
2
+ import { getFramework as m } from "./index11.js";
3
+ const y = "1f8d3e558f493e38a037dbfadb8ba344", v = "d473b1dcc969105adab157226cd9cf63", i = Symbol.for("@coinbase/cdp-analytics");
4
+ function g() {
5
+ const t = globalThis;
6
+ return t[i] || (t[i] = {
7
+ identifier: "",
8
+ enabled: !0,
9
+ isProduction: !1,
10
+ isUsingMocks: !1,
11
+ sendEvent: o,
12
+ sendActionCallEvent: (e) => o({ ...e, type: "action_call" }),
13
+ sendHookCallEvent: (e) => o({ ...e, type: "hook_call" }),
14
+ sendComponentCallEvent: (e) => o({ ...e, type: "component_call" }),
15
+ versionRegistry: {},
16
+ registerPackageVersion: (e, s) => {
17
+ n.versionRegistry[e] = s;
31
18
  }
32
- } : {
33
- success: !0,
34
- event: {
35
- type: r,
36
- message: e.message
19
+ }), t[i];
20
+ }
21
+ const n = g();
22
+ async function o(t) {
23
+ if (!n.enabled || !n.identifier)
24
+ return;
25
+ const e = Date.now(), r = [{
26
+ user_id: n.identifier,
27
+ event_type: t.type,
28
+ platform: c() ? "web" : "native",
29
+ timestamp: e,
30
+ event_properties: {
31
+ project_name: "cdp-embedded-wallet",
32
+ framework: m(),
33
+ isLocalHost: u(),
34
+ isUsingMocks: n.isUsingMocks,
35
+ package_versions: n.versionRegistry,
36
+ ...t
37
37
  }
38
- } : { success: !1, reason: "Unknown event type" } : { success: !1, reason: "Missing event type" };
38
+ }], a = JSON.stringify(r), d = e.toString(), l = p(a + d), f = {
39
+ client: n.isProduction ? v : y,
40
+ e: a,
41
+ checksum: l
42
+ };
43
+ await fetch("https://cca-lite.coinbase.com/amp", {
44
+ method: "POST",
45
+ mode: "no-cors",
46
+ headers: {
47
+ "Content-Type": "application/json"
48
+ },
49
+ body: JSON.stringify(f)
50
+ });
39
51
  }
40
- function n(s) {
41
- if (typeof s != "object" || s === null)
42
- return !1;
43
- const e = s;
44
- return typeof e.eventName == "string" || typeof e.type == "string";
52
+ function c() {
53
+ return typeof window < "u" && typeof document < "u";
45
54
  }
46
- function t(s) {
47
- return a.includes(s);
55
+ function u() {
56
+ return c() ? window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" : !1;
48
57
  }
49
58
  export {
50
- o as parseWebViewMessage
59
+ n as Analytics
51
60
  };
@@ -0,0 +1,11 @@
1
+ import { useRef as r, useEffect as t } from "react";
2
+ import { Analytics as n } from "./index6.js";
3
+ function s(e) {
4
+ const o = r(!1);
5
+ t(() => {
6
+ o.current || (n.sendHookCallEvent({ name: e }), o.current = !0);
7
+ }, [e]);
8
+ }
9
+ export {
10
+ s as useSendHookCallOnce
11
+ };
@@ -0,0 +1,11 @@
1
+ import { useRef as t, useEffect as o } from "react";
2
+ import { Analytics as r } from "./index6.js";
3
+ function s(e) {
4
+ const n = t(!1);
5
+ o(() => {
6
+ n.current || (r.sendComponentCallEvent({ name: e }), n.current = !0);
7
+ }, [e]);
8
+ }
9
+ export {
10
+ s as useSendComponentCallOnce
11
+ };
@@ -0,0 +1,51 @@
1
+ const a = [
2
+ "onramp_api.load_pending",
3
+ "onramp_api.load_success",
4
+ "onramp_api.load_error",
5
+ "onramp_api.polling_start",
6
+ "onramp_api.polling_success",
7
+ "onramp_api.polling_error",
8
+ "onramp_api.commit_success",
9
+ "onramp_api.commit_error",
10
+ "onramp_api.cancel"
11
+ ];
12
+ function o(s) {
13
+ let e;
14
+ try {
15
+ e = JSON.parse(s);
16
+ } catch {
17
+ return { success: !1, reason: "Invalid JSON" };
18
+ }
19
+ if (!n(e))
20
+ return { success: !1, reason: "Invalid message structure" };
21
+ const r = e.eventName ?? e.type;
22
+ return r ? t(r) ? e.data?.errorCode || e.data?.errorMessage ? {
23
+ success: !0,
24
+ event: {
25
+ type: r,
26
+ message: e.message,
27
+ error: {
28
+ code: e.data?.errorCode,
29
+ message: e.data?.errorMessage
30
+ }
31
+ }
32
+ } : {
33
+ success: !0,
34
+ event: {
35
+ type: r,
36
+ message: e.message
37
+ }
38
+ } : { success: !1, reason: "Unknown event type" } : { success: !1, reason: "Missing event type" };
39
+ }
40
+ function n(s) {
41
+ if (typeof s != "object" || s === null)
42
+ return !1;
43
+ const e = s;
44
+ return typeof e.eventName == "string" || typeof e.type == "string";
45
+ }
46
+ function t(s) {
47
+ return a.includes(s);
48
+ }
49
+ export {
50
+ o as parseWebViewMessage
51
+ };
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-react-native",
3
- "version": "0.0.84",
3
+ "version": "0.0.85",
4
4
  "type": "module",
5
5
  "peerDependencies": {
6
6
  "react": ">=18.2.0",
7
7
  "react-native": ">=0.70.0",
8
8
  "react-native-webview": ">=13.0.0",
9
- "@coinbase/cdp-api-client": "^0.0.84",
10
- "@coinbase/cdp-hooks": "^0.0.84",
11
- "@coinbase/cdp-core": "^0.0.84"
9
+ "@coinbase/cdp-api-client": "^0.0.85",
10
+ "@coinbase/cdp-core": "^0.0.85",
11
+ "@coinbase/cdp-hooks": "^0.0.85"
12
12
  },
13
13
  "devDependencies": {
14
14
  "@testing-library/react": "^16.0.0",
@@ -17,9 +17,9 @@
17
17
  "react-dom": "^19.1.2",
18
18
  "react-native": "^0.79.6",
19
19
  "react-native-webview": "^13.13.5",
20
- "@coinbase/cdp-api-client": "0.0.84",
21
- "@coinbase/cdp-core": "0.0.84",
22
- "@coinbase/cdp-hooks": "0.0.84"
20
+ "@coinbase/cdp-api-client": "0.0.85",
21
+ "@coinbase/cdp-core": "0.0.85",
22
+ "@coinbase/cdp-hooks": "0.0.85"
23
23
  },
24
24
  "files": [
25
25
  "dist/**",