@namiml/expo-sdk 3.4.1 → 3.4.2-dev.202605300214
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.cjs +40 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +42 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
- package/src/components/NamiView.tsx +20 -6
- package/src/components/PaywallScreen.tsx +14 -0
- package/src/components/containers/NamiContentContainer.tsx +11 -0
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var sdkCore = require('@namiml/sdk-core');
|
|
4
4
|
var reactNative = require('react-native');
|
|
5
5
|
var require$$0 = require('react');
|
|
6
|
+
var reactNativeSafeAreaContext = require('react-native-safe-area-context');
|
|
6
7
|
|
|
7
8
|
class ExpoStorageAdapter {
|
|
8
9
|
constructor() {
|
|
@@ -2941,6 +2942,17 @@ function renderResolvedComponent(componentType, resolvedComponent, scaleFactor,
|
|
|
2941
2942
|
function splitContainerStyles(style) {
|
|
2942
2943
|
const { paddingLeft, paddingRight, paddingTop, paddingBottom, flexDirection, alignItems, justifyContent, ...rest } = style;
|
|
2943
2944
|
const outer = { ...rest };
|
|
2945
|
+
// The content container is always the page's vertical fill region: styles.outer
|
|
2946
|
+
// declares flex:1 and the body scrolls internally. A payload height of
|
|
2947
|
+
// 'fitContent' makes sizeStyles emit flexGrow:0, which would otherwise override
|
|
2948
|
+
// that fill and collapse the body to 0 height — the flex:1 ScrollView child
|
|
2949
|
+
// can't give an unbounded parent a height. Drop the flex-sizing keys so the
|
|
2950
|
+
// fill stays authoritative, matching the native renderers which always
|
|
2951
|
+
// fill-and-scroll this region regardless of the authored height.
|
|
2952
|
+
delete outer.flex;
|
|
2953
|
+
delete outer.flexGrow;
|
|
2954
|
+
delete outer.flexBasis;
|
|
2955
|
+
delete outer.flexShrink;
|
|
2944
2956
|
const inner = {
|
|
2945
2957
|
...(paddingLeft != null ? { paddingLeft } : {}),
|
|
2946
2958
|
...(paddingRight != null ? { paddingRight } : {}),
|
|
@@ -3142,7 +3154,19 @@ catch {
|
|
|
3142
3154
|
const fontGateCache = new Map();
|
|
3143
3155
|
const PaywallScreen = ({ paywall, onClose, onCommitted, holdInteractionUntilFocus = false, isActive = true, }) => {
|
|
3144
3156
|
const ctx = usePaywallContext();
|
|
3157
|
+
const insets = reactNativeSafeAreaContext.useSafeAreaInsets();
|
|
3145
3158
|
const focusReadyCtx = useFirstFocusReadyContext();
|
|
3159
|
+
// Push the measured top safe-area inset into paywall state so templates can
|
|
3160
|
+
// position chrome via ${state.safeAreaTop} (e.g. header topPadding,
|
|
3161
|
+
// background topMargin). Mirrors the native Android renderer, which measures
|
|
3162
|
+
// the display cutout and calls setSafeAreaTop. The full-bleed root lets the
|
|
3163
|
+
// background extend under the status bar; this offsets the content back into
|
|
3164
|
+
// the safe area. No safeAreaBottom equivalent exists in core/Android state.
|
|
3165
|
+
// Depend only on insets.top (stable per device/orientation) — depending on
|
|
3166
|
+
// ctx would re-run every render and loop through setState.
|
|
3167
|
+
require$$0.useEffect(() => {
|
|
3168
|
+
ctx.setSafeAreaTop(insets.top);
|
|
3169
|
+
}, [insets.top]);
|
|
3146
3170
|
const scaleFactor = sdkCore.getDeviceScaleFactor(ctx.state.formFactor);
|
|
3147
3171
|
const userInteractionEnabled = ctx.state.userInteractionEnabled !== false;
|
|
3148
3172
|
const currentPageName = ctx.state.selectedPaywall === paywall
|
|
@@ -3330,8 +3354,13 @@ const NamiView = ({ placement, url, onClose, onSignIn, onDeepLink, onPurchase, o
|
|
|
3330
3354
|
return launchRequest;
|
|
3331
3355
|
if (url)
|
|
3332
3356
|
return { type: 'url', value: url };
|
|
3333
|
-
if (placement)
|
|
3334
|
-
|
|
3357
|
+
if (placement) {
|
|
3358
|
+
// A URL/deeplink campaign carries its URL in the value. If one is handed
|
|
3359
|
+
// in via the placement prop, classify it as a url launch so core takes
|
|
3360
|
+
// the URL-match branch — otherwise the label lookup misses, no paywall
|
|
3361
|
+
// resolves, and NamiView spins on the placeholder forever.
|
|
3362
|
+
return { type: sdkCore.isValidUrl(placement) ? 'url' : 'label', value: placement };
|
|
3363
|
+
}
|
|
3335
3364
|
return { type: undefined, value: '' };
|
|
3336
3365
|
}, [launchRequest, url, placement]);
|
|
3337
3366
|
const ctx = require$$0.useMemo(() => ({
|
|
@@ -3743,12 +3772,19 @@ const NamiView = ({ placement, url, onClose, onSignIn, onDeepLink, onPurchase, o
|
|
|
3743
3772
|
setInitialScreenCommitted(true);
|
|
3744
3773
|
}, []);
|
|
3745
3774
|
if (isClosing) {
|
|
3746
|
-
return jsxRuntimeExports.jsx(reactNative.
|
|
3775
|
+
return jsxRuntimeExports.jsx(reactNative.View, { style: styles.root });
|
|
3747
3776
|
}
|
|
3748
3777
|
if (loading || !campaignData || (!isFlowCampaign && !paywallData) || (isFlowCampaign && !hasFlowScreen)) {
|
|
3749
3778
|
return jsxRuntimeExports.jsx(LaunchPlaceholder, { paywall: launchPlaceholderPaywall });
|
|
3750
3779
|
}
|
|
3751
|
-
return (
|
|
3780
|
+
return (
|
|
3781
|
+
// Full-bleed root so the paywall background extends under the status bar and
|
|
3782
|
+
// home indicator (edge-to-edge). Safe-area insets are applied only to the
|
|
3783
|
+
// chrome (header/footer) via useSafeAreaInsets, not the whole tree — the
|
|
3784
|
+
// previous core SafeAreaView inset every edge and let the #000 root show
|
|
3785
|
+
// through as letterbox bands. SafeAreaProvider guarantees an inset context
|
|
3786
|
+
// even if the host app didn't mount one (nested providers are supported).
|
|
3787
|
+
jsxRuntimeExports.jsxs(reactNativeSafeAreaContext.SafeAreaProvider, { initialMetrics: reactNativeSafeAreaContext.initialWindowMetrics, style: styles.root, children: [jsxRuntimeExports.jsx(reactNative.StatusBar, { barStyle: "light-content", translucent: true, backgroundColor: "transparent" }), isFlowCampaign ? (jsxRuntimeExports.jsx(FlowRenderer, { paywalls: flowState.paywalls, currentIndex: flowState.index, animation: flowState.animation ?? undefined, onSettled: handleFlowAnimationSettled, onTransitionVisible: () => setPendingTransitionPaywall(null), onInitialCommitted: handleInitialCommitted, onClose: onClose, campaign: campaignData, context: ctx, flow: flowRef.current })) : (jsxRuntimeExports.jsx(PaywallProvider, { paywall: paywallData, context: ctx, campaign: campaignData, children: jsxRuntimeExports.jsx(PaywallScreen, { paywall: paywallData, onClose: requestClose, onCommitted: handleInitialCommitted, isActive: true }) })), !isClosing && showLaunchPlaceholder && jsxRuntimeExports.jsx(LaunchPlaceholder, { paywall: launchPlaceholderPaywall, overlay: true }), showTransitionPlaceholder && jsxRuntimeExports.jsx(LaunchPlaceholder, { paywall: pendingTransitionPaywall, overlay: true })] }));
|
|
3752
3788
|
};
|
|
3753
3789
|
const LaunchPlaceholder = ({ paywall, overlay = false }) => {
|
|
3754
3790
|
const initialPageName = paywall?.template?.initialState?.currentPage ?? 'page1';
|