cloudx-react-native 3.10.0 → 3.11.0

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.
Files changed (105) hide show
  1. package/README.md +1 -0
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/cloudxreactnative/CloudXAdEvents.kt +10 -0
  4. package/android/src/main/java/com/cloudxreactnative/CloudXAdInfo.kt +40 -0
  5. package/android/src/main/java/com/cloudxreactnative/CloudXNativeAdView.kt +718 -0
  6. package/android/src/main/java/com/cloudxreactnative/CloudXNativeAdViewManagerImpl.kt +119 -0
  7. package/android/src/main/java/com/cloudxreactnative/CloudXPackage.kt +4 -1
  8. package/android/src/main/res/layout/cloudx_rn_native_media_banner_template.xml +100 -0
  9. package/android/src/main/res/layout/cloudx_rn_native_medium_template.xml +99 -0
  10. package/android/src/main/res/layout/cloudx_rn_native_small_template.xml +72 -0
  11. package/android/src/main/res/layout/cloudx_rn_native_vertical_media_template.xml +117 -0
  12. package/android/src/newarch/com/cloudxreactnative/CloudXModule.kt +1 -0
  13. package/android/src/newarch/com/cloudxreactnative/CloudXNativeAdViewManager.kt +86 -0
  14. package/android/src/oldarch/com/cloudxreactnative/CloudXModule.kt +1 -0
  15. package/android/src/oldarch/com/cloudxreactnative/CloudXNativeAdViewManager.kt +118 -0
  16. package/cloudx-react-native.podspec +1 -1
  17. package/ios/CloudX.h +8 -0
  18. package/ios/CloudX.mm +159 -29
  19. package/ios/CloudXNativeAdView.h +75 -0
  20. package/ios/CloudXNativeAdView.mm +979 -0
  21. package/ios/CloudXNativeAdViewManager.h +12 -0
  22. package/ios/CloudXNativeAdViewManager.mm +119 -0
  23. package/lib/commonjs/CloudXAdViewBase.js +8 -97
  24. package/lib/commonjs/CloudXAdViewBase.js.map +1 -1
  25. package/lib/commonjs/CloudXNativeAdView.js +331 -0
  26. package/lib/commonjs/CloudXNativeAdView.js.map +1 -0
  27. package/lib/commonjs/CloudXNativeAdViewComponents.js +252 -0
  28. package/lib/commonjs/CloudXNativeAdViewComponents.js.map +1 -0
  29. package/lib/commonjs/CloudXNativeAdViewProvider.js +117 -0
  30. package/lib/commonjs/CloudXNativeAdViewProvider.js.map +1 -0
  31. package/lib/commonjs/extraParameters.js +52 -0
  32. package/lib/commonjs/extraParameters.js.map +1 -0
  33. package/lib/commonjs/hooks.js +34 -0
  34. package/lib/commonjs/hooks.js.map +1 -1
  35. package/lib/commonjs/index.js +72 -0
  36. package/lib/commonjs/index.js.map +1 -1
  37. package/lib/commonjs/specs/CloudXNativeAdViewNativeComponent.js +41 -0
  38. package/lib/commonjs/specs/CloudXNativeAdViewNativeComponent.js.map +1 -0
  39. package/lib/commonjs/types/NativeAd.js +70 -0
  40. package/lib/commonjs/types/NativeAd.js.map +1 -0
  41. package/lib/commonjs/types/index.js +13 -0
  42. package/lib/commonjs/types/index.js.map +1 -1
  43. package/lib/commonjs/useCloudXSdkInitialization.js +75 -0
  44. package/lib/commonjs/useCloudXSdkInitialization.js.map +1 -0
  45. package/lib/commonjs/version.js +1 -1
  46. package/lib/module/CloudXAdViewBase.js +7 -96
  47. package/lib/module/CloudXAdViewBase.js.map +1 -1
  48. package/lib/module/CloudXNativeAdView.js +324 -0
  49. package/lib/module/CloudXNativeAdView.js.map +1 -0
  50. package/lib/module/CloudXNativeAdViewComponents.js +240 -0
  51. package/lib/module/CloudXNativeAdViewComponents.js.map +1 -0
  52. package/lib/module/CloudXNativeAdViewProvider.js +110 -0
  53. package/lib/module/CloudXNativeAdViewProvider.js.map +1 -0
  54. package/lib/module/extraParameters.js +45 -0
  55. package/lib/module/extraParameters.js.map +1 -0
  56. package/lib/module/hooks.js +34 -0
  57. package/lib/module/hooks.js.map +1 -1
  58. package/lib/module/index.js +13 -0
  59. package/lib/module/index.js.map +1 -1
  60. package/lib/module/specs/CloudXNativeAdViewNativeComponent.js +35 -0
  61. package/lib/module/specs/CloudXNativeAdViewNativeComponent.js.map +1 -0
  62. package/lib/module/types/NativeAd.js +68 -0
  63. package/lib/module/types/NativeAd.js.map +1 -0
  64. package/lib/module/types/index.js +1 -0
  65. package/lib/module/types/index.js.map +1 -1
  66. package/lib/module/useCloudXSdkInitialization.js +68 -0
  67. package/lib/module/useCloudXSdkInitialization.js.map +1 -0
  68. package/lib/module/version.js +1 -1
  69. package/lib/typescript/src/CloudXAdViewBase.d.ts.map +1 -1
  70. package/lib/typescript/src/CloudXNativeAdView.d.ts +24 -0
  71. package/lib/typescript/src/CloudXNativeAdView.d.ts.map +1 -0
  72. package/lib/typescript/src/CloudXNativeAdViewComponents.d.ts +67 -0
  73. package/lib/typescript/src/CloudXNativeAdViewComponents.d.ts.map +1 -0
  74. package/lib/typescript/src/CloudXNativeAdViewProvider.d.ts +72 -0
  75. package/lib/typescript/src/CloudXNativeAdViewProvider.d.ts.map +1 -0
  76. package/lib/typescript/src/extraParameters.d.ts +4 -0
  77. package/lib/typescript/src/extraParameters.d.ts.map +1 -0
  78. package/lib/typescript/src/hooks.d.ts.map +1 -1
  79. package/lib/typescript/src/index.d.ts +4 -1
  80. package/lib/typescript/src/index.d.ts.map +1 -1
  81. package/lib/typescript/src/specs/CloudXNativeAdViewNativeComponent.d.ts +103 -0
  82. package/lib/typescript/src/specs/CloudXNativeAdViewNativeComponent.d.ts.map +1 -0
  83. package/lib/typescript/src/types/AdInfo.d.ts +4 -1
  84. package/lib/typescript/src/types/AdInfo.d.ts.map +1 -1
  85. package/lib/typescript/src/types/NativeAd.d.ts +114 -0
  86. package/lib/typescript/src/types/NativeAd.d.ts.map +1 -0
  87. package/lib/typescript/src/types/index.d.ts +2 -0
  88. package/lib/typescript/src/types/index.d.ts.map +1 -1
  89. package/lib/typescript/src/useCloudXSdkInitialization.d.ts +16 -0
  90. package/lib/typescript/src/useCloudXSdkInitialization.d.ts.map +1 -0
  91. package/lib/typescript/src/version.d.ts +1 -1
  92. package/package.json +1 -1
  93. package/src/CloudXAdViewBase.tsx +8 -125
  94. package/src/CloudXNativeAdView.tsx +419 -0
  95. package/src/CloudXNativeAdViewComponents.tsx +203 -0
  96. package/src/CloudXNativeAdViewProvider.tsx +149 -0
  97. package/src/extraParameters.ts +65 -0
  98. package/src/hooks.ts +38 -0
  99. package/src/index.ts +24 -0
  100. package/src/specs/CloudXNativeAdViewNativeComponent.ts +137 -0
  101. package/src/types/AdInfo.ts +5 -1
  102. package/src/types/NativeAd.ts +125 -0
  103. package/src/types/index.ts +7 -0
  104. package/src/useCloudXSdkInitialization.ts +73 -0
  105. package/src/version.ts +1 -1
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Context provider for the manual-render `<CloudXNativeAdView/>` flow.
3
+ *
4
+ * The pre-built asset components (title, advertiser, body, CTA, icon,
5
+ * options, media, star rating) read metadata and refs from this context.
6
+ * The host `<CloudXNativeAdView/>` owns the `setNativeAd` state setter and
7
+ * publishes the latest `CloudXNativeAdMetadata` when `onAdLoaded` fires so
8
+ * pre-built components re-render with the new content.
9
+ *
10
+ * Design notes:
11
+ * - A `starRatingRef` lets the star component participate in the binder
12
+ * pipeline (even though the native side treats it as decorative).
13
+ * - Refs are typed explicitly rather than relying on `any`, so misuse
14
+ * surfaces at compile time.
15
+ * - Adds `registerAssetRole`, called by every pre-built asset component on
16
+ * mount. The host `<CloudXNativeAdView/>` passes `onAssetRoleRegistered`
17
+ * to detect an asset component mounted while `renderMode` is `'template'`
18
+ * — a likely publisher mistake — and warn once.
19
+ */
20
+ import * as React from 'react';
21
+ import type { ReactNode } from 'react';
22
+ import type { Image, Text, View } from 'react-native';
23
+ import type { CloudXNativeAdMetadata } from './types/NativeAd';
24
+ type TextRef = React.ElementRef<typeof Text>;
25
+ type ImageRef = React.ElementRef<typeof Image>;
26
+ type ViewRef = React.ElementRef<typeof View>;
27
+ /**
28
+ * Shape exposed to pre-built asset components. Consumers typically destructure
29
+ * a single ref + the `nativeAd` field; the setter is only used by the host.
30
+ */
31
+ export type CloudXNativeAdViewContextValue = {
32
+ titleRef: React.RefObject<TextRef | null>;
33
+ advertiserRef: React.RefObject<TextRef | null>;
34
+ bodyRef: React.RefObject<TextRef | null>;
35
+ callToActionRef: React.RefObject<TextRef | null>;
36
+ iconRef: React.RefObject<ImageRef | null>;
37
+ optionsRef: React.RefObject<ViewRef | null>;
38
+ mediaRef: React.RefObject<ViewRef | null>;
39
+ starRatingRef: React.RefObject<ViewRef | null>;
40
+ nativeAd: CloudXNativeAdMetadata | null;
41
+ setNativeAd: React.Dispatch<React.SetStateAction<CloudXNativeAdMetadata | null>>;
42
+ /**
43
+ * Called by each pre-built asset component on mount, naming its asset
44
+ * role. Returns an unregister function, so an effect can simply
45
+ * `return registerAssetRole('CloudXTitleView')` and have the role drop
46
+ * out again when the component unmounts.
47
+ */
48
+ registerAssetRole: (role: string) => () => void;
49
+ /**
50
+ * Roles whose component is currently mounted. The host intersects this
51
+ * with the loaded ad's own asset set, so it only waits on a binding the
52
+ * publisher's layout can actually satisfy.
53
+ */
54
+ mountedAssetRoles: React.MutableRefObject<Set<string>>;
55
+ };
56
+ export declare const CloudXNativeAdViewContext: React.Context<CloudXNativeAdViewContextValue>;
57
+ type ProviderProps = {
58
+ children: ReactNode;
59
+ /**
60
+ * Invoked when a descendant asset component registers its role. The host
61
+ * `<CloudXNativeAdView/>` uses this to warn when an asset component is
62
+ * mounted while `renderMode` is `'template'`.
63
+ */
64
+ onAssetRoleRegistered?: (role: string) => void;
65
+ };
66
+ /**
67
+ * Wrap this around the root of a `<CloudXNativeAdView/>` tree so descendant
68
+ * asset components share refs and ad state.
69
+ */
70
+ export declare const CloudXNativeAdViewProvider: React.FC<ProviderProps>;
71
+ export {};
72
+ //# sourceMappingURL=CloudXNativeAdViewProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudXNativeAdViewProvider.d.ts","sourceRoot":"","sources":["../../../src/CloudXNativeAdViewProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,K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I,EAAE,MAAM,KAAK,MAAM,IAAI,CAAC;IAChD;;;;OAIG;IACH,iBAAiB,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;CAC1D,CAAC;AAUF,eAAO,MAAM,yBAAyB,+CAgBpC,CAAC;AAEH,KAAK,aAAa,GAAG;IACjB,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAgD9D,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { NativeExtraParameterEntry } from './specs/CloudXAdViewNativeComponent';
2
+ import type { CloudXAdProps } from './types/AdProps';
3
+ export declare const toNativeExtraParameterEntries: (extraParameters?: CloudXAdProps["extraParameters"]) => ReadonlyArray<NativeExtraParameterEntry>;
4
+ //# sourceMappingURL=extraParameters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extraParameters.d.ts","sourceRoot":"","sources":["../../../src/extraParameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA4CrD,eAAO,MAAM,6BAA6B,GACtC,kBAAkB,aAAa,CAAC,iBAAiB,CAAC,KACnD,aAAa,CAAC,yBAAyB,CAiBzC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA6BH,MAAM,MAAM,4BAA4B,GAAG;IACvC,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAA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,CAAC;IACtB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACtE,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,wBAAwB,CAsG5E;AAMD,MAAM,MAAM,sBAAsB,GAAG;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,sBAAsB,CA0CxE"}
@@ -11,12 +11,15 @@ export { CloudXMRECAd } from './CloudXMRECAd';
11
11
  export { CloudXAdPosition } from './CloudXAdPosition';
12
12
  export { CloudXBannerView } from './CloudXBannerView';
13
13
  export { CloudXMRECView } from './CloudXMRECView';
14
+ export { CloudXNativeAdView } from './CloudXNativeAdView';
15
+ export { CloudXTitleView, CloudXAdvertiserView, CloudXBodyView, CloudXCallToActionView, CloudXIconView, CloudXOptionsView, CloudXMediaView, CloudXStarRatingView, } from './CloudXNativeAdViewComponents';
14
16
  export type { CloudXAdViewProps, CloudXAdViewFormat } from './CloudXAdViewBase';
15
17
  export { CloudXErrorCode } from './CloudXErrorCode';
16
18
  export { requestTrackingAuthorization, getTrackingAuthorizationStatus, CloudXATTStatus } from './AppTrackingTransparency';
17
19
  export { useCloudXInterstitial, useCloudXAppOpen, useCloudXRewarded, useCloudXBanner } from './hooks';
18
20
  export type { CloudXInterstitialHookResult, CloudXAppOpenHookResult, CloudXRewardedHookResult, CloudXBannerHookResult, } from './hooks';
19
- export type { CloudXAdInfo, CloudXAdLoadFailedInfo, CloudXAdDisplayFailedInfo, CloudXAdRewardInfo, CloudXInitializationResult, CloudXConfiguration, CloudXType, CloudXLogLevelValue, CloudXArbiterConfiguration, CloudXArbiterPlatform, CloudXArbiterResult, CloudXSDKArbiterBid, CloudXLevelPlayArbiterBid, CloudXPubMaticArbiterBid, CloudXCustomArbiterBid, CloudXAdMobArbiterBid, CloudXGamArbiterBid, CloudXRevenueData, CloudXRevenuePlatformValue, CloudXRevenuePrecisionValue, CloudXFullscreenAdType, CloudXInterstitialAdType, CloudXAppOpenAdType, CloudXRewardedAdType, CloudXViewAdType, CloudXBannerAdType, CloudXMRECAdType, CloudXAdProps, CloudXAdEventObject, CloudXAdEventListener, CloudXExtraParameterValue, CloudXExtraParameters, } from './types';
21
+ export type { CloudXAdInfo, CloudXAdLoadFailedInfo, CloudXAdDisplayFailedInfo, CloudXAdRewardInfo, CloudXInitializationResult, CloudXConfiguration, CloudXType, CloudXLogLevelValue, CloudXArbiterConfiguration, CloudXArbiterPlatform, CloudXArbiterResult, CloudXSDKArbiterBid, CloudXLevelPlayArbiterBid, CloudXPubMaticArbiterBid, CloudXCustomArbiterBid, CloudXAdMobArbiterBid, CloudXGamArbiterBid, CloudXRevenueData, CloudXRevenuePlatformValue, CloudXRevenuePrecisionValue, CloudXFullscreenAdType, CloudXInterstitialAdType, CloudXAppOpenAdType, CloudXRewardedAdType, CloudXViewAdType, CloudXBannerAdType, CloudXMRECAdType, CloudXAdProps, CloudXAdEventObject, CloudXAdEventListener, CloudXExtraParameterValue, CloudXExtraParameters, CloudXNativeAdMetadata, CloudXNativeAdViewHandle, CloudXNativeAdViewProps, CloudXLocalExtraParameters, } from './types';
22
+ export { CloudXNativeTemplate } from './types';
20
23
  export declare const CloudXLogLevel: {
21
24
  readonly VERBOSE: "verbose";
22
25
  readonly DEBUG: "debug";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,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M,cAAc,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC"}
@@ -0,0 +1,103 @@
1
+ import type * as React from 'react';
2
+ import type { HostComponent, ViewProps } from 'react-native';
3
+ import type { Double, Int32, DirectEventHandler, UnsafeMixed } from 'react-native/Libraries/Types/CodegenTypes';
4
+ /**
5
+ * Payload for native-ad lifecycle events (load, click, revenue).
6
+ *
7
+ * Codegen cannot express `Record<string, string>`, so the SDK-owned ad values
8
+ * are delivered as a JSON-encoded string in `adValuesJson` (mirroring
9
+ * CloudXAdViewNativeComponent) and re-parsed into a map by the JS wrapper.
10
+ * The loaded native ad's own metadata (title, media, icon, etc.) is likewise
11
+ * delivered as a JSON-encoded string in `nativeAdJson`, since codegen cannot
12
+ * express the native ad's heterogeneous field set as typed props.
13
+ */
14
+ export type CloudXNativeAdInfoEvent = Readonly<{
15
+ adUnitId: string;
16
+ adFormat: string;
17
+ networkName: string;
18
+ networkPlacement?: string | null;
19
+ placement?: string | null;
20
+ creativeId?: string | null;
21
+ revenue: Double;
22
+ adValuesJson?: string | null;
23
+ nativeAdJson?: string | null;
24
+ }>;
25
+ /**
26
+ * Payload for native-ad load/display-failure events.
27
+ */
28
+ export type CloudXNativeAdLoadFailedEvent = Readonly<{
29
+ adUnitId: string;
30
+ code: Double;
31
+ message?: string | null;
32
+ }>;
33
+ export type NativeExtraParameterEntry = Readonly<{
34
+ key: string;
35
+ value: UnsafeMixed;
36
+ }>;
37
+ /**
38
+ * Props for the native CloudXNativeAdView component.
39
+ *
40
+ * Mirrors the in-tree CloudXAdView (banner/MREC) component: the ad renders as
41
+ * an ordinary React Native view so publisher overlays layer above it via
42
+ * normal RN z-ordering.
43
+ */
44
+ export interface NativeProps extends ViewProps {
45
+ /** Ad unit ID used to load the ad. */
46
+ adUnitId: string;
47
+ /**
48
+ * Publisher-selected template name (e.g. "small_template",
49
+ * "medium_template"). Named `templateName`, not `template` — codegen
50
+ * emits the prop as a literal `std::string template` struct member on
51
+ * the generated Props class, and `template` is a reserved word in C++,
52
+ * so that spelling fails to compile. The Old Architecture manager also
53
+ * accepts the legacy `template` prop name and aliases it internally for
54
+ * publisher compatibility.
55
+ */
56
+ templateName?: string | null;
57
+ /** Optional placement name for reporting. */
58
+ placement?: string | null;
59
+ /** Optional custom data string. */
60
+ customData?: string | null;
61
+ /** Extra parameters applied to the underlying native ad loader. */
62
+ extraParameters?: ReadonlyArray<NativeExtraParameterEntry>;
63
+ /** Local-only extra parameters applied to the underlying native ad loader. */
64
+ localExtraParameters?: ReadonlyArray<NativeExtraParameterEntry>;
65
+ /** Disables the video full-screen affordance when true. */
66
+ disableVideoFullScreen?: boolean;
67
+ /** Starts video creatives unmuted when true. */
68
+ startVideoUnmuted?: boolean;
69
+ /** Hides video media controls when true. */
70
+ hideVideoMediaControls?: boolean;
71
+ /**
72
+ * When true, the host skips template rendering and lets the JS layer
73
+ * drive layout through the `updateAssetView` + `renderNativeAd` commands.
74
+ */
75
+ manualRender?: boolean;
76
+ /** Called when an ad is successfully loaded. */
77
+ onAdLoadedEvent: DirectEventHandler<CloudXNativeAdInfoEvent>;
78
+ /** Called when the SDK fails to load an ad. */
79
+ onAdLoadFailedEvent: DirectEventHandler<CloudXNativeAdLoadFailedEvent>;
80
+ /** Called when the ad fails to render/display (e.g. manual render before load). */
81
+ onAdDisplayFailedEvent: DirectEventHandler<CloudXNativeAdLoadFailedEvent>;
82
+ /** Called when the ad is clicked. */
83
+ onAdClickedEvent: DirectEventHandler<CloudXNativeAdInfoEvent>;
84
+ /** Called when the loaded ad expires. */
85
+ onAdExpiredEvent: DirectEventHandler<CloudXNativeAdInfoEvent>;
86
+ /** Called when the ad is closed. */
87
+ onAdClosedEvent: DirectEventHandler<CloudXNativeAdInfoEvent>;
88
+ /** Called when ad revenue is paid. */
89
+ onAdRevenuePaidEvent: DirectEventHandler<CloudXNativeAdInfoEvent>;
90
+ }
91
+ export interface NativeCommands {
92
+ loadAd: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
93
+ destroyAd: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
94
+ updateAssetView: (viewRef: React.ElementRef<HostComponent<NativeProps>>, assetViewTag: Int32, assetName: string) => void;
95
+ renderNativeAd: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
96
+ }
97
+ export declare const Commands: NativeCommands;
98
+ /**
99
+ * Native in-tree view component backing the publisher-facing native ad view.
100
+ */
101
+ declare const _default: HostComponent<NativeProps>;
102
+ export default _default;
103
+ //# sourceMappingURL=CloudXNativeAdViewNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudXNativeAdViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/specs/CloudXNativeAdViewNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EACR,MAAM,EACN,KAAK,EACL,kBAAkB,EAClB,WAAW,EACd,MAAM,2CAA2C,CAAC;AAInD;;;;;;;;;GASG;AACH,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG,QAAQ,CAAC;IACjD,QAAQ,EAAE,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AuB,CAAC,CAAC;IAE9D,oCAAoC;IACpC,eAAe,EAAE,kBAAkB,CAAC,uBAAuB,CAAC,CAAC;IAE7D,sCAAsC;IACtC,oBAAoB,EAAE,kBAAkB,CAAC,uBAAuB,CAAC,CAAC;CACrE;AAED,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,KAAK,IAAI,CAAC;IACxE,SAAS,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,KAAK,IAAI,CAAC;IAC3E,eAAe,EAAE,CACb,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,EACrD,YAAY,EAAE,KAAK,EACnB,SAAS,EAAE,MAAM,KAChB,IAAI,CAAC;IACV,cAAc,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,KAAK,IAAI,CAAC;CACnF;AAED,eAAO,MAAM,QAAQ,EAAE,cAErB,CAAC;AAEH;;GAEG;wBACyE,aAAa,CAAC,WAAW,CAAC;AAAtG,wBAAuG"}
@@ -1,11 +1,12 @@
1
1
  import type { CloudXErrorCode } from '../CloudXErrorCode';
2
+ import type { CloudXNativeAdMetadata } from './NativeAd';
2
3
  /**
3
4
  * Represents a successfully loaded ad served by CloudX.
4
5
  */
5
6
  export type CloudXAdInfo = {
6
7
  /** The ad unit ID for this ad. */
7
8
  adUnitId: string;
8
- /** The format of the ad (e.g., "BANNER", "MREC", "INTERSTITIAL", "REWARDED"). */
9
+ /** The format of the ad (e.g., "BANNER", "MREC", "INTERSTITIAL", "REWARDED", "NATIVE"). */
9
10
  adFormat: string;
10
11
  /** The name of the ad network that served the ad. */
11
12
  networkName: string;
@@ -19,6 +20,8 @@ export type CloudXAdInfo = {
19
20
  revenue: number;
20
21
  /** SDK-owned metadata values associated with this loaded ad. */
21
22
  adValues: Record<string, string>;
23
+ /** Structured native-ad metadata when the loaded creative is a native ad. */
24
+ nativeAd?: CloudXNativeAdMetadata | null;
22
25
  };
23
26
  /**
24
27
  * Represents a failure when attempting to load an ad.
@@ -1 +1 @@
1
- {"version":3,"file":"AdInfo.d.ts","sourceRoot":"","sources":["../../../../src/types/AdInfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACvB,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IAEjB,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;IAEjB,qDAAqD;IACrD,WAAW,EAAE,MAAM,CAAC;IAEpB,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3B,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAC;IAEhB,gEAAgE;IAChE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACjC,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IAEjB,yBAAyB;IACzB,IAAI,EAAE,eAAe,CAAC;IAEtB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,YAAY,GAAG;IACnD,yBAAyB;IACzB,IAAI,EAAE,eAAe,CAAC;IAEtB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,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,IAAI,EAAE,eAAe,CAAC;IAEtB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG;IAC5C,+BAA+B;IAC/B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,yBAAyB;IACzB,YAAY,EAAE,MAAM,CAAC;CACxB,CAAC"}
@@ -0,0 +1,114 @@
1
+ import type { ViewProps } from 'react-native';
2
+ import type { CloudXAdDisplayFailedInfo, CloudXAdInfo } from './AdInfo';
3
+ import type { CloudXAdProps } from './AdProps';
4
+ import type { CloudXExtraParameterValue } from './ExtraParameters';
5
+ /**
6
+ * Built-in native ad template variants rendered by the SDK's view component.
7
+ *
8
+ * All four variants have a distinct bundled layout on both iOS and Android,
9
+ * and unknown values fall back to `MEDIUM` on both.
10
+ *
11
+ * On both platforms this prop selects the **local layout only**. Neither
12
+ * bid request carries the selection, so the server sizes the creative's
13
+ * assets for `medium` whatever is chosen here:
14
+ *
15
+ * - iOS: `CLXNativeAdLoader` builds its publisher with
16
+ * `CLXNativeTemplateDefault`, which is `CLXNativeTemplateMedium`.
17
+ * `CLXBidSignals` would thread a non-default template, but the loader
18
+ * never supplies one.
19
+ * - Android: `BidSignalsProvider` writes `nativeRequirements.template`
20
+ * as a fixed `"medium"`, pending a public template-selection API.
21
+ *
22
+ * A creative rendered in a non-`MEDIUM` layout therefore carries assets cut
23
+ * for `MEDIUM` — most visible with `VERTICAL_MEDIA`, the full-screen shape.
24
+ * Tracked as CXD-5385.
25
+ */
26
+ export declare enum CloudXNativeTemplate {
27
+ /** 320x90 compact template: icon, title, advertiser, CTA. */
28
+ SMALL = "small_template",
29
+ /** 320x250 template. */
30
+ MEDIUM = "medium_template",
31
+ /** 320x300 media-forward template. */
32
+ MEDIA_BANNER = "media_banner_template",
33
+ /**
34
+ * Full-screen vertical template sized to the available bounds.
35
+ * Intended for feed-style vertical experiences. Bundled layout on both
36
+ * iOS and Android.
37
+ */
38
+ VERTICAL_MEDIA = "vertical_media_template"
39
+ }
40
+ /**
41
+ * Type-safe asset identifiers for custom native-ad binding.
42
+ */
43
+ export declare enum CloudXNativeAssetType {
44
+ TITLE = "TitleView",
45
+ ADVERTISER = "AdvertiserView",
46
+ BODY = "BodyView",
47
+ CALL_TO_ACTION = "CallToActionView",
48
+ ICON = "IconView",
49
+ OPTIONS = "OptionsView",
50
+ MEDIA = "MediaView",
51
+ STAR_RATING = "StarRatingView"
52
+ }
53
+ /**
54
+ * Structured metadata for a single loaded native ad.
55
+ *
56
+ * Surfaced on the `onAdLoaded` callback as `CloudXAdInfo.nativeAd`.
57
+ */
58
+ export type CloudXNativeAdMetadata = {
59
+ title?: string | null;
60
+ advertiser?: string | null;
61
+ body?: string | null;
62
+ callToAction?: string | null;
63
+ starRating?: number | null;
64
+ mediaContentAspectRatio?: number;
65
+ isIconImageAvailable: boolean;
66
+ isOptionsViewAvailable: boolean;
67
+ isMediaViewAvailable: boolean;
68
+ url?: string | null;
69
+ imageSource?: string | null;
70
+ isVideoContent: boolean;
71
+ videoDuration: number;
72
+ isExpired: boolean;
73
+ };
74
+ export type CloudXLocalExtraParameters = {
75
+ [key: string]: CloudXExtraParameterValue;
76
+ };
77
+ /**
78
+ * Props for the native-ad view component.
79
+ *
80
+ * Callbacks inherited from {@link CloudXAdProps} (`onAdLoaded`, `onAdLoadFailed`,
81
+ * `onAdClicked`, `onAdRevenuePaid`) receive unwrapped payloads, not synthetic events.
82
+ */
83
+ export type CloudXNativeAdViewProps = CloudXAdProps & ViewProps & {
84
+ template?: CloudXNativeTemplate;
85
+ localExtraParameters?: CloudXLocalExtraParameters;
86
+ disableVideoFullScreen?: boolean;
87
+ startVideoUnmuted?: boolean;
88
+ hideVideoMediaControls?: boolean;
89
+ /** Selects between the SDK's bundled template layouts and manual asset binding. */
90
+ renderMode?: 'template' | 'manual';
91
+ /**
92
+ * Called when a loaded ad subsequently fails to display or track.
93
+ *
94
+ * Emitted on both platforms. Android fires it for post-load
95
+ * adapter/render errors and when click/impression registration fails in
96
+ * manual mode. iOS fires it on the three manual-mode failure paths:
97
+ * render requested before load, expired ad, and registration refused.
98
+ */
99
+ onAdDisplayFailed?: (errorInfo: CloudXAdDisplayFailedInfo) => void;
100
+ onAdExpired?: (adInfo: CloudXAdInfo) => void;
101
+ onAdClosed?: (adInfo: CloudXAdInfo) => void;
102
+ };
103
+ export type CloudXNativeAdViewHandle = {
104
+ /**
105
+ * Requests a load. This does NOT force a new auction: both native SDKs
106
+ * re-serve the ad they already hold while it is neither expired nor
107
+ * destroyed, including after its impression. Changed targeting is
108
+ * therefore not picked up. Call `destroyAd()` first for a fresh ad.
109
+ */
110
+ loadAd: () => void;
111
+ /** Releases the native ad and its resources. */
112
+ destroyAd: () => void;
113
+ };
114
+ //# sourceMappingURL=NativeAd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeAd.d.ts","sourceRoot":"","sources":["../../../../src/types/NativeAd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,oBAAY,oBAAoB;IAC5B,6DAA6D;IAC7D,KAAK,mBAAmB;IAExB,wBAAwB;IACxB,MAAM,oBAAoB;IAE1B,sCAAsC;IACtC,YAAY,0BAA0B;IAEtC;;;;OAIG;IACH,cAAc,4BAA4B;CAC7C;AAED;;GAEG;AACH,oBAAY,qBAAqB;IAC7B,KAAK,cAAc;IACnB,UAAU,mBAAmB;IAC7B,IAAI,aAAa;IACjB,cAAc,qBAAqB;IACnC,IAAI,aA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,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAC7C,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;CAC/C,CAAC;AAEN,MAAM,MAAM,wBAAwB,GAAG;IACnC;;;;;OAKG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,gDAAgD;IAChD,SAAS,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC"}
@@ -14,4 +14,6 @@ export type { CloudXMRECAdType } from './MRECAd';
14
14
  export type { CloudXAdProps } from './AdProps';
15
15
  export type { CloudXAdEventObject, CloudXAdEventListener } from './AdEvent';
16
16
  export type { CloudXExtraParameterValue, CloudXExtraParameters } from './ExtraParameters';
17
+ export type { CloudXNativeAdMetadata, CloudXNativeAdViewHandle, CloudXNativeAdViewProps, CloudXLocalExtraParameters, } from './NativeAd';
18
+ export { CloudXNativeTemplate, CloudXNativeAssetType } from './NativeAd';
17
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACpH,YAAY,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACvF,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAChE,YAAY,EACR,gBAAgB,EAChB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC9E,YAAY,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,2BAA2B,EAA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AAC;AAC7D,YAAY,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,YAAY,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,YAAY,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAC5E,YAAY,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1F,YAAY,EACR,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,GAC7B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Polls CloudX SDK initialization state and caches the result module-wide.
3
+ *
4
+ * Shared by `CloudXAdViewBase` (banner/MREC) and `CloudXNativeAdView` so
5
+ * every in-tree ad-view component gates native-view creation on SDK
6
+ * initialization identically: a view mounted before `CloudX.initialize()`
7
+ * completes would create its native ad against an uninitialized SDK, which
8
+ * on iOS returns nil and leaves the view permanently dead (no retry, no
9
+ * load-failed event). There is no init event to subscribe to, so poll
10
+ * `isInitialized()` until ready.
11
+ *
12
+ * @param componentName Used only in the console warnings, so callers can
13
+ * tell which component is waiting on initialization.
14
+ */
15
+ export declare const useCloudXSdkInitializationGate: (componentName: string) => boolean;
16
+ //# sourceMappingURL=useCloudXSdkInitialization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCloudXSdkInitialization.d.ts","sourceRoot":"","sources":["../../../src/useCloudXSdkInitialization.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,8BAA8B,GAAI,eAAe,MAAM,KAAG,OA+CtE,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const PLUGIN_VERSION = "3.10.0";
1
+ export declare const PLUGIN_VERSION = "3.11.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudx-react-native",
3
- "version": "3.10.0",
3
+ "version": "3.11.0",
4
4
  "description": "React Native wrapper for CloudX SDK (iOS & Android)",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -2,15 +2,13 @@ import React, { useEffect, useMemo, useState } from 'react';
2
2
  import { View } from 'react-native';
3
3
  import type { NativeSyntheticEvent, StyleProp, ViewProps, ViewStyle } from 'react-native';
4
4
  import NativeCloudXAdView from './specs/CloudXAdViewNativeComponent';
5
- import type {
6
- CloudXAdInfoEvent,
7
- CloudXAdLoadFailedEvent,
8
- NativeExtraParameterEntry,
9
- } from './specs/CloudXAdViewNativeComponent';
5
+ import type { CloudXAdInfoEvent, CloudXAdLoadFailedEvent } from './specs/CloudXAdViewNativeComponent';
10
6
  import NativeCloudX from './specs/NativeCloudX';
11
7
  import type { CloudXAdInfo, CloudXAdLoadFailedInfo } from './types/AdInfo';
12
8
  import type { CloudXAdProps } from './types/AdProps';
13
9
  import type { CloudXErrorCode } from './CloudXErrorCode';
10
+ import { toNativeExtraParameterEntries } from './extraParameters';
11
+ import { useCloudXSdkInitializationGate } from './useCloudXSdkInitialization';
14
12
 
15
13
  /**
16
14
  * Ad format rendered by the in-tree view component.
@@ -40,14 +38,6 @@ const AD_SIZE = {
40
38
  */
41
39
  let cachedIsTablet: boolean | null = null;
42
40
 
43
- /*
44
- * Once the SDK reports initialized it stays initialized for the JS VM's life,
45
- * so cache it module-wide: only the first ad view mounted before init has to
46
- * poll + show a placeholder; every later mount renders the native view
47
- * immediately. Mirrors cachedIsTablet above.
48
- */
49
- let cachedIsInitialized = false;
50
-
51
41
  const parseAdValues = (json?: string | null): Record<string, string> => {
52
42
  if (!json) {
53
43
  return {};
@@ -77,69 +67,6 @@ const toLoadFailedInfo = (event: CloudXAdLoadFailedEvent): CloudXAdLoadFailedInf
77
67
  message: event.message || null,
78
68
  });
79
69
 
80
- const warnIgnoredUndefinedExtraParameter = (keyPath: string): void => {
81
- console.warn(
82
- `CloudXAdView ignored extra parameter "${keyPath}" because ` +
83
- 'undefined values are not supported. Use null when a value is intentional.'
84
- );
85
- };
86
-
87
- const normalizeExtraParameterValue = (
88
- keyPath: string,
89
- value: unknown
90
- ): NativeExtraParameterEntry['value'] | undefined => {
91
- if (value === undefined) {
92
- warnIgnoredUndefinedExtraParameter(keyPath);
93
- return undefined;
94
- }
95
-
96
- if (Array.isArray(value)) {
97
- return value.reduce<unknown[]>((items, item, index) => {
98
- const normalized = normalizeExtraParameterValue(`${keyPath}[${index}]`, item);
99
- if (normalized !== undefined) {
100
- items.push(normalized);
101
- }
102
- return items;
103
- }, []);
104
- }
105
-
106
- if (value !== null && typeof value === 'object') {
107
- return Object.entries(value as Record<string, unknown>).reduce<Record<string, unknown>>(
108
- (object, [childKey, childValue]) => {
109
- const normalized = normalizeExtraParameterValue(`${keyPath}.${childKey}`, childValue);
110
- if (normalized !== undefined) {
111
- object[childKey] = normalized;
112
- }
113
- return object;
114
- },
115
- {}
116
- );
117
- }
118
-
119
- return value;
120
- };
121
-
122
- const toNativeExtraParameterEntries = (
123
- extraParameters?: CloudXAdProps['extraParameters']
124
- ): ReadonlyArray<NativeExtraParameterEntry> => {
125
- if (!extraParameters) {
126
- return [];
127
- }
128
-
129
- return Object.entries(extraParameters as Record<string, unknown>).reduce<NativeExtraParameterEntry[]>(
130
- (entries, [key, value]) => {
131
- const normalizedValue = normalizeExtraParameterValue(key, value);
132
- if (normalizedValue === undefined) {
133
- return entries;
134
- }
135
-
136
- entries.push({ key, value: normalizedValue });
137
- return entries;
138
- },
139
- []
140
- );
141
- };
142
-
143
70
  /**
144
71
  * Shared implementation for the in-tree banner/MREC view component. Resolves a
145
72
  * default fixed size (overridable via `style`), wires the native per-view direct
@@ -175,56 +102,12 @@ export const CloudXAdViewBase: React.FC<CloudXAdViewBaseProps> = ({
175
102
  * Gate native ad-view creation on SDK initialization. A view mounted before
176
103
  * CloudX.initialize() completes would create the ad against an uninitialized
177
104
  * SDK — on iOS createBannerWithAdUnitId: returns nil and the view is
178
- * permanently dead (no retry, no load-failed event). There is no init event
179
- * to subscribe to, so poll isInitialized() until ready, then mount the
180
- * native view (which is what delivers adUnitId/adFormat and triggers create).
181
- * Mirrors CloudXNativeAdView. Cached module-wide so only the first pre-init
182
- * mount pays the placeholder + poll.
105
+ * permanently dead (no retry, no load-failed event). Shared with
106
+ * CloudXNativeAdView via useCloudXSdkInitializationGate: cached module-wide
107
+ * so only the first pre-init mount across any ad-view type pays the
108
+ * placeholder + poll.
183
109
  */
184
- const [isInitialized, setIsInitialized] = useState(cachedIsInitialized);
185
-
186
- useEffect(() => {
187
- if (cachedIsInitialized) {
188
- return;
189
- }
190
- let cancelled = false;
191
- let timer: ReturnType<typeof setTimeout> | undefined;
192
- let warnedOnce = false;
193
- const check = () => {
194
- NativeCloudX.isInitialized()
195
- .then((ready) => {
196
- if (cancelled) {
197
- return;
198
- }
199
- if (ready) {
200
- cachedIsInitialized = true;
201
- setIsInitialized(true);
202
- return;
203
- }
204
- if (!warnedOnce) {
205
- warnedOnce = true;
206
- console.warn(
207
- 'CloudXAdView mounted before CloudX SDK initialization; will render once initialize() completes.'
208
- );
209
- }
210
- timer = setTimeout(check, 1000);
211
- })
212
- .catch((error) => {
213
- if (cancelled) {
214
- return;
215
- }
216
- console.warn('CloudXAdView failed to read initialization state:', error);
217
- timer = setTimeout(check, 1000);
218
- });
219
- };
220
- check();
221
- return () => {
222
- cancelled = true;
223
- if (timer) {
224
- clearTimeout(timer);
225
- }
226
- };
227
- }, []);
110
+ const isInitialized = useCloudXSdkInitializationGate('CloudXAdView');
228
111
 
229
112
  useEffect(() => {
230
113
  if (adFormat !== 'BANNER' || cachedIsTablet !== null) {