@allstak/react-native 0.4.0 → 0.4.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.
package/dist/index.mjs CHANGED
@@ -1482,7 +1482,9 @@ function tryRequire(id2) {
1482
1482
 
1483
1483
  // src/privacy.tsx
1484
1484
  import * as React from "react";
1485
- var RN = tryRequire("react-native");
1485
+ function getRN() {
1486
+ return tryRequire("react-native");
1487
+ }
1486
1488
  var state = {
1487
1489
  isCapturing: false,
1488
1490
  sensitiveRefs: /* @__PURE__ */ new Set()
@@ -1530,9 +1532,18 @@ function useAllStakPrivacy() {
1530
1532
  const isCapturing = useIsCapturing();
1531
1533
  return { isCapturing, registerSensitiveRef };
1532
1534
  }
1533
- var View = RN?.View ?? ((props) => React.createElement("View", props));
1534
- var Text = RN?.Text ?? ((props) => React.createElement("Text", props));
1535
- var TextInput = RN?.TextInput ?? ((props) => React.createElement("TextInput", props));
1535
+ function getView() {
1536
+ const RN = getRN();
1537
+ return RN?.View ?? ((props) => React.createElement(React.Fragment, null, props.children));
1538
+ }
1539
+ function getText() {
1540
+ const RN = getRN();
1541
+ return RN?.Text ?? ((props) => React.createElement(React.Fragment, null, props.children));
1542
+ }
1543
+ function getTextInput() {
1544
+ const RN = getRN();
1545
+ return RN?.TextInput ?? ((props) => React.createElement(React.Fragment, null, null));
1546
+ }
1536
1547
  var DEFAULT_MASK_COLOR = "#d8dde7";
1537
1548
  var DEFAULT_MASK_LABEL = "\u2022\u2022\u2022\u2022\u2022\u2022";
1538
1549
  function AllStakMaskedView({
@@ -1545,6 +1556,8 @@ function AllStakMaskedView({
1545
1556
  ...rest
1546
1557
  }) {
1547
1558
  const isCapturing = useIsCapturing();
1559
+ const View = getView();
1560
+ const Text = getText();
1548
1561
  if (!isCapturing || privacy === "show") {
1549
1562
  return React.createElement(View, { style, ...rest }, children);
1550
1563
  }
@@ -1567,6 +1580,8 @@ function AllStakTextInput({
1567
1580
  ...rest
1568
1581
  }) {
1569
1582
  const isCapturing = useIsCapturing();
1583
+ const View = getView();
1584
+ const TextInput = getTextInput();
1570
1585
  if (isCapturing && privacy !== "show") {
1571
1586
  return React.createElement(View, {
1572
1587
  style: [{ minHeight: 40, backgroundColor: maskColor, borderRadius: 4 }, style]
@@ -1582,6 +1597,7 @@ function AllStakSensitiveText({
1582
1597
  ...rest
1583
1598
  }) {
1584
1599
  const isCapturing = useIsCapturing();
1600
+ const Text = getText();
1585
1601
  if (isCapturing && privacy !== "show") {
1586
1602
  return React.createElement(Text, { style, ...rest }, maskLabel);
1587
1603
  }
@@ -1683,8 +1699,8 @@ function estimateBase64Size(base64) {
1683
1699
  }
1684
1700
  function readDimensions() {
1685
1701
  try {
1686
- const RN3 = tryRequire("react-native");
1687
- const dims = RN3?.Dimensions?.get?.("window");
1702
+ const RN = tryRequire("react-native");
1703
+ const dims = RN?.Dimensions?.get?.("window");
1688
1704
  if (dims && typeof dims.width === "number" && typeof dims.height === "number") {
1689
1705
  return { width: Math.round(dims.width), height: Math.round(dims.height) };
1690
1706
  }
@@ -1770,7 +1786,7 @@ function pickScreenshotConfig(source) {
1770
1786
  // src/client.ts
1771
1787
  var INGEST_HOST = "https://api.allstak.sa";
1772
1788
  var SDK_NAME = "allstak-react-native";
1773
- var SDK_VERSION = "0.4.0";
1789
+ var SDK_VERSION = "0.4.1";
1774
1790
  var ERRORS_PATH = "/ingest/v1/errors";
1775
1791
  var LOGS_PATH = "/ingest/v1/logs";
1776
1792
  var VALID_BREADCRUMB_TYPES = /* @__PURE__ */ new Set(["http", "log", "ui", "navigation", "query", "default"]);
@@ -3065,8 +3081,13 @@ function installReactNative(options = {}) {
3065
3081
  }
3066
3082
 
3067
3083
  // src/provider.tsx
3068
- var RN2 = tryRequire("react-native");
3069
- var RootView = RN2?.View ?? ((props) => React2.createElement("View", props));
3084
+ function getRN2() {
3085
+ return tryRequire("react-native");
3086
+ }
3087
+ function getRootView() {
3088
+ const RN = getRN2();
3089
+ return RN?.View;
3090
+ }
3070
3091
  var AllStakContext = React2.createContext(null);
3071
3092
  var __providerOwnedInstance = null;
3072
3093
  var AllStakErrorBoundary = class extends React2.Component {
@@ -3231,7 +3252,8 @@ function AllStakProvider({
3231
3252
  };
3232
3253
  }, [destroyOnUnmount, debug]);
3233
3254
  const boundary = /* @__PURE__ */ React2.createElement(AllStakErrorBoundary, { fallback, onError, debug }, children);
3234
- const wrapped = RN2 ? React2.createElement(
3255
+ const RootView = getRootView();
3256
+ const wrapped = RootView ? React2.createElement(
3235
3257
  RootView,
3236
3258
  { ref: rootRef, style: { flex: 1 }, collapsable: false },
3237
3259
  boundary