@simula/ads 1.2.0 → 1.3.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.
- package/README.md +51 -306
- package/dist/components/GameCard.d.ts +11 -0
- package/dist/components/GameCard.d.ts.map +1 -0
- package/dist/components/GameGrid.d.ts +12 -0
- package/dist/components/GameGrid.d.ts.map +1 -0
- package/dist/components/GameIframe.d.ts +9 -0
- package/dist/components/GameIframe.d.ts.map +1 -0
- package/dist/components/MiniGameMenu.d.ts +4 -0
- package/dist/components/MiniGameMenu.d.ts.map +1 -0
- package/dist/components/inChatAd/InChatAdSlot.d.ts +4 -0
- package/dist/components/inChatAd/InChatAdSlot.d.ts.map +1 -0
- package/dist/components/miniGame/GameCard.d.ts +11 -0
- package/dist/components/miniGame/GameCard.d.ts.map +1 -0
- package/dist/components/miniGame/GameGrid.d.ts +12 -0
- package/dist/components/miniGame/GameGrid.d.ts.map +1 -0
- package/dist/components/miniGame/GameIframe.d.ts +9 -0
- package/dist/components/miniGame/GameIframe.d.ts.map +1 -0
- package/dist/components/miniGame/MiniGameMenu.d.ts +4 -0
- package/dist/components/miniGame/MiniGameMenu.d.ts.map +1 -0
- package/dist/components/miniGame/mockGames.d.ts +3 -0
- package/dist/components/miniGame/mockGames.d.ts.map +1 -0
- package/dist/components/mockGames.d.ts +3 -0
- package/dist/components/mockGames.d.ts.map +1 -0
- package/dist/components/sponsoredSuggestions/SponsoredSuggestions.d.ts +4 -0
- package/dist/components/sponsoredSuggestions/SponsoredSuggestions.d.ts.map +1 -0
- package/dist/index.d.ts +120 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2089 -205
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2042 -162
- package/dist/index.mjs.map +1 -1
- package/dist/types/SimulaProvider.d.ts +5 -0
- package/dist/types/SimulaProvider.d.ts.map +1 -0
- package/dist/types/components/inChatAd/InChatAdSlot.d.ts +4 -0
- package/dist/types/components/inChatAd/InChatAdSlot.d.ts.map +1 -0
- package/dist/types/components/miniGame/GameCard.d.ts +12 -0
- package/dist/types/components/miniGame/GameCard.d.ts.map +1 -0
- package/dist/types/components/miniGame/GameGrid.d.ts +13 -0
- package/dist/types/components/miniGame/GameGrid.d.ts.map +1 -0
- package/dist/types/components/miniGame/GameIframe.d.ts +21 -0
- package/dist/types/components/miniGame/GameIframe.d.ts.map +1 -0
- package/dist/types/components/miniGame/MiniGameMenu.d.ts +4 -0
- package/dist/types/components/miniGame/MiniGameMenu.d.ts.map +1 -0
- package/dist/types/components/miniGame/mockGames.d.ts +3 -0
- package/dist/types/components/miniGame/mockGames.d.ts.map +1 -0
- package/dist/types/components/nativeBanner/NativeBanner.d.ts +4 -0
- package/dist/types/components/nativeBanner/NativeBanner.d.ts.map +1 -0
- package/dist/types/components/nativeBanner/NativeBannerTest.d.ts +4 -0
- package/dist/types/components/nativeBanner/NativeBannerTest.d.ts.map +1 -0
- package/dist/types/components/nativeBanner/RadialLinesSpinner.d.ts +7 -0
- package/dist/types/components/nativeBanner/RadialLinesSpinner.d.ts.map +1 -0
- package/dist/types/components/nativeBanner/index.d.ts +3 -0
- package/dist/types/components/nativeBanner/index.d.ts.map +1 -0
- package/dist/types/components/sponsoredSuggestions/SponsoredSuggestions.d.ts +4 -0
- package/dist/types/components/sponsoredSuggestions/SponsoredSuggestions.d.ts.map +1 -0
- package/dist/types/hooks/useAssetLoadDetection.d.ts +14 -0
- package/dist/types/hooks/useAssetLoadDetection.d.ts.map +1 -0
- package/dist/types/hooks/useBotDetection.d.ts +3 -0
- package/dist/types/hooks/useBotDetection.d.ts.map +1 -0
- package/dist/types/hooks/useDebounce.d.ts +2 -0
- package/dist/types/hooks/useDebounce.d.ts.map +1 -0
- package/dist/types/hooks/useOMIDViewability.d.ts +24 -0
- package/dist/types/hooks/useOMIDViewability.d.ts.map +1 -0
- package/dist/types/hooks/useViewability.d.ts +6 -0
- package/dist/types/hooks/useViewability.d.ts.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/types.d.ts +189 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/utils/api.d.ts +62 -0
- package/dist/types/utils/api.d.ts.map +1 -0
- package/dist/types/utils/colorThemes.d.ts +21 -0
- package/dist/types/utils/colorThemes.d.ts.map +1 -0
- package/dist/types/utils/styling.d.ts +4 -0
- package/dist/types/utils/styling.d.ts.map +1 -0
- package/dist/types/utils/validation.d.ts +27 -0
- package/dist/types/utils/validation.d.ts.map +1 -0
- package/dist/types.d.ts +50 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/api.d.ts +2 -2
- package/dist/utils/api.d.ts.map +1 -1
- package/dist/utils/styling.d.ts +4 -3
- package/dist/utils/styling.d.ts.map +1 -1
- package/dist/utils/validation.d.ts +2 -2
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import React$1 from 'react';
|
|
|
2
2
|
|
|
3
3
|
type AccentOption = 'blue' | 'red' | 'green' | 'yellow' | 'purple' | 'pink' | 'orange' | 'neutral' | 'gray' | 'tan' | 'transparent' | 'image';
|
|
4
4
|
type FontOption = 'san-serif' | 'serif' | 'monospace';
|
|
5
|
-
interface
|
|
5
|
+
interface InChatTheme {
|
|
6
6
|
mode?: 'light' | 'dark' | 'auto';
|
|
7
7
|
theme?: 'light' | 'dark' | 'auto';
|
|
8
8
|
accent?: AccentOption | AccentOption[];
|
|
@@ -32,12 +32,13 @@ interface AdData {
|
|
|
32
32
|
id: string;
|
|
33
33
|
format: string;
|
|
34
34
|
iframeUrl?: string;
|
|
35
|
+
html?: string;
|
|
35
36
|
}
|
|
36
37
|
interface InChatAdSlotProps {
|
|
37
38
|
messages: Message[];
|
|
38
39
|
trigger?: Promise<any>;
|
|
39
40
|
formats?: string | string[];
|
|
40
|
-
theme?:
|
|
41
|
+
theme?: InChatTheme;
|
|
41
42
|
debounceMs?: number;
|
|
42
43
|
charDesc?: string;
|
|
43
44
|
onImpression?: (ad: AdData) => void;
|
|
@@ -49,11 +50,27 @@ interface SimulaProviderProps {
|
|
|
49
50
|
children: React.ReactNode;
|
|
50
51
|
devMode?: boolean;
|
|
51
52
|
primaryUserID?: string;
|
|
53
|
+
/** Privacy consent flag. When false, suppresses collection of PII (primaryUserID). Defaults to true. */
|
|
54
|
+
hasPrivacyConsent?: boolean;
|
|
52
55
|
}
|
|
53
56
|
interface SimulaContextValue {
|
|
54
57
|
apiKey: string;
|
|
55
58
|
devMode: boolean;
|
|
56
59
|
sessionId?: string;
|
|
60
|
+
/** Privacy consent flag. When false, PII should not be collected. */
|
|
61
|
+
hasPrivacyConsent: boolean;
|
|
62
|
+
/** Get cached ad for a slot/position */
|
|
63
|
+
getCachedAd: (slot: string, position: number) => AdData | null;
|
|
64
|
+
/** Cache an ad for a slot/position */
|
|
65
|
+
cacheAd: (slot: string, position: number, ad: AdData) => void;
|
|
66
|
+
/** Get cached height for a slot/position */
|
|
67
|
+
getCachedHeight: (slot: string, position: number) => number | null;
|
|
68
|
+
/** Cache height for a slot/position */
|
|
69
|
+
cacheHeight: (slot: string, position: number, height: number) => void;
|
|
70
|
+
/** Check if a slot/position has no fill */
|
|
71
|
+
hasNoFill: (slot: string, position: number) => boolean;
|
|
72
|
+
/** Mark a slot/position as having no fill */
|
|
73
|
+
markNoFill: (slot: string, position: number) => void;
|
|
57
74
|
}
|
|
58
75
|
interface BotDetectionResult {
|
|
59
76
|
isBot: boolean;
|
|
@@ -82,12 +99,111 @@ interface ViewabilityResult {
|
|
|
82
99
|
hasBeenViewed: boolean;
|
|
83
100
|
impressionTracked: boolean;
|
|
84
101
|
}
|
|
102
|
+
interface MiniGameTheme {
|
|
103
|
+
backgroundColor?: string;
|
|
104
|
+
headerColor?: string;
|
|
105
|
+
borderColor?: string;
|
|
106
|
+
titleFont?: string;
|
|
107
|
+
secondaryFont?: string;
|
|
108
|
+
titleFontColor?: string;
|
|
109
|
+
secondaryFontColor?: string;
|
|
110
|
+
iconCornerRadius?: number;
|
|
111
|
+
/** Unified accent color for interactive elements (search bar focus, pagination). Default: '#3B82F6' (blue-500) */
|
|
112
|
+
accentColor?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Controls the height of the Mini Game iframe (not the ad).
|
|
115
|
+
* - number: pixel value (e.g., 500 = 500px)
|
|
116
|
+
* - string with %: percentage of screen height (e.g., "80%")
|
|
117
|
+
* - undefined/null: full screen (default behavior)
|
|
118
|
+
* Minimum height is 500px.
|
|
119
|
+
*/
|
|
120
|
+
playableHeight?: number | string;
|
|
121
|
+
/**
|
|
122
|
+
* Controls the background color of the curved border area above the playable
|
|
123
|
+
* when playableHeight is set (bottom sheet mode). Default: '#262626'
|
|
124
|
+
*/
|
|
125
|
+
playableBorderColor?: string;
|
|
126
|
+
}
|
|
127
|
+
interface GameData {
|
|
128
|
+
id: string;
|
|
129
|
+
name: string;
|
|
130
|
+
iconUrl: string;
|
|
131
|
+
description: string;
|
|
132
|
+
iconFallback?: string;
|
|
133
|
+
}
|
|
134
|
+
interface MiniGameMenuProps {
|
|
135
|
+
isOpen: boolean;
|
|
136
|
+
onClose: () => void;
|
|
137
|
+
charName: string;
|
|
138
|
+
charID: string;
|
|
139
|
+
charImage: string;
|
|
140
|
+
messages?: Message[];
|
|
141
|
+
charDesc?: string;
|
|
142
|
+
maxGamesToShow?: 3 | 6 | 9;
|
|
143
|
+
theme?: MiniGameTheme;
|
|
144
|
+
delegateChar?: boolean;
|
|
145
|
+
}
|
|
146
|
+
interface NativeContext {
|
|
147
|
+
searchTerm?: string;
|
|
148
|
+
tags?: string[];
|
|
149
|
+
category?: string;
|
|
150
|
+
title?: string;
|
|
151
|
+
description?: string;
|
|
152
|
+
userProfile?: string;
|
|
153
|
+
/** User email (requires privacy consent) */
|
|
154
|
+
userEmail?: string;
|
|
155
|
+
/** NSFW content flag */
|
|
156
|
+
nsfw?: boolean;
|
|
157
|
+
customContext?: Record<string, string | string[]>;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Filter NativeContext for privacy - removes PII fields when consent is not granted.
|
|
161
|
+
* When hasPrivacyConsent is false, removes userEmail and userProfile.
|
|
162
|
+
*/
|
|
163
|
+
declare const filterContextForPrivacy: (context: NativeContext, hasPrivacyConsent: boolean) => NativeContext;
|
|
164
|
+
interface NativeBannerProps {
|
|
165
|
+
slot: string;
|
|
166
|
+
/**
|
|
167
|
+
* Ad width. Supports multiple formats:
|
|
168
|
+
* - number < 1: percentage as decimal (e.g., 0.8 = 80%)
|
|
169
|
+
* - number >= 1: pixels (e.g., 500 = 500px)
|
|
170
|
+
* - string with %: percentage (e.g., "10%" = 10%)
|
|
171
|
+
* - string with number: pixels (e.g., "500" = 500px)
|
|
172
|
+
* - "auto" or null: fills container width (min 130px)
|
|
173
|
+
*/
|
|
174
|
+
width?: number | string | null;
|
|
175
|
+
position: number;
|
|
176
|
+
context: NativeContext;
|
|
177
|
+
/**
|
|
178
|
+
* Custom loading component to display while the ad is loading.
|
|
179
|
+
* - undefined: uses the default RadialLinesSpinner
|
|
180
|
+
* - null: disables the loading indicator entirely
|
|
181
|
+
* - React.ComponentType: renders your custom component
|
|
182
|
+
*/
|
|
183
|
+
loadingComponent?: React.ComponentType | null;
|
|
184
|
+
/** Called when the ad content has finished loading and is ready to display */
|
|
185
|
+
onLoad?: (ad: AdData) => void;
|
|
186
|
+
/** Called when the ad has been viewable for 1 second (MRC standard) */
|
|
187
|
+
onImpression?: (ad: AdData) => void;
|
|
188
|
+
/** Called when an error occurs fetching or loading the ad */
|
|
189
|
+
onError?: (error: Error) => void;
|
|
190
|
+
}
|
|
85
191
|
|
|
86
192
|
declare const useSimula: () => SimulaContextValue;
|
|
87
193
|
declare const SimulaProvider: React$1.FC<SimulaProviderProps>;
|
|
88
194
|
|
|
89
195
|
declare const InChatAdSlot: React$1.FC<InChatAdSlotProps>;
|
|
90
196
|
|
|
197
|
+
declare const MiniGameMenu: React$1.FC<MiniGameMenuProps>;
|
|
198
|
+
|
|
199
|
+
declare const NativeBanner: React$1.FC<NativeBannerProps>;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Radial lines spinner component (matching Flutter SDK).
|
|
203
|
+
* Displays 12 radial lines that animate around a circle.
|
|
204
|
+
*/
|
|
205
|
+
declare const RadialLinesSpinner: React$1.FC;
|
|
206
|
+
|
|
91
207
|
declare const useBotDetection: () => BotDetectionResult;
|
|
92
208
|
|
|
93
209
|
declare const useViewability: (options?: ViewabilityOptions) => ViewabilityResult & {
|
|
@@ -139,5 +255,5 @@ declare const getBorderLight: (colors: ColorPalette) => string;
|
|
|
139
255
|
declare const getShadow: (colors: ColorPalette) => string;
|
|
140
256
|
declare const getFontStyles: (font?: string) => FontPalette;
|
|
141
257
|
|
|
142
|
-
export { InChatAdSlot, SimulaProvider, fonts, getBackgroundGradient, getBorderLight, getColorTheme, getFontStyles, getShadow, getSolidBackground, getTextMuted, getTextSecondary, useBotDetection, useOMIDViewability, useSimula, useViewability };
|
|
143
|
-
export type { AdData, BotDetectionResult, ColorPalette$1 as ColorPalette, FontPalette$1 as FontPalette, InChatAdSlotProps, Message, OMIDViewabilityOptions, OMIDViewabilityResult$1 as OMIDViewabilityResult, SimulaContextValue, SimulaProviderProps,
|
|
258
|
+
export { InChatAdSlot, MiniGameMenu, NativeBanner, RadialLinesSpinner, SimulaProvider, filterContextForPrivacy, fonts, getBackgroundGradient, getBorderLight, getColorTheme, getFontStyles, getShadow, getSolidBackground, getTextMuted, getTextSecondary, useBotDetection, useOMIDViewability, useSimula, useViewability };
|
|
259
|
+
export type { AdData, BotDetectionResult, ColorPalette$1 as ColorPalette, FontPalette$1 as FontPalette, GameData, InChatAdSlotProps, InChatTheme, Message, MiniGameMenuProps, MiniGameTheme, NativeBannerProps, NativeContext, OMIDViewabilityOptions, OMIDViewabilityResult$1 as OMIDViewabilityResult, SimulaContextValue, SimulaProviderProps, ViewabilityOptions, ViewabilityResult };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wDAAwD,CAAC;AAC9F,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,OAAO,EACL,aAAa,EACb,aAAa,EACb,KAAK,EACL,qBAAqB,EACrB,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,SAAS,EACV,MAAM,qBAAqB,CAAC;AAI7B,YAAY,EACV,WAAW,EACX,OAAO,EACP,MAAM,EACN,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,YAAY,EACZ,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,QAAQ,EACR,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,EAC1B,MAAM,SAAS,CAAC"}
|