@surfside/ads-react 0.1.17 → 0.1.18
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/lib/cjs/BuildInfo.js +1 -1
- package/lib/cjs/BuildInfo.js.map +1 -1
- package/lib/cjs/hooks/useSurfsideProducts.js +17 -6
- package/lib/cjs/hooks/useSurfsideProducts.js.map +1 -1
- package/lib/cjs/provider/SurfsideContextProvider.js +16 -0
- package/lib/cjs/provider/SurfsideContextProvider.js.map +1 -1
- package/lib/esm/BuildInfo.js +1 -1
- package/lib/esm/BuildInfo.js.map +1 -1
- package/lib/esm/components/SurfsideBanner.js +43 -0
- package/lib/esm/components/SurfsideBanner.js.map +1 -0
- package/lib/esm/components/SurfsideBannerRenderer.js +41 -0
- package/lib/esm/components/SurfsideBannerRenderer.js.map +1 -0
- package/lib/esm/components/SurfsideBannerVideoRenderer.js +21 -0
- package/lib/esm/components/SurfsideBannerVideoRenderer.js.map +1 -0
- package/lib/esm/components/SurfsideCarousel.js +112 -0
- package/lib/esm/components/SurfsideCarousel.js.map +1 -0
- package/lib/esm/components/SurfsideDynamicZone.js +136 -0
- package/lib/esm/components/SurfsideDynamicZone.js.map +1 -0
- package/lib/esm/components/SurfsideProduct.js +113 -0
- package/lib/esm/components/SurfsideProduct.js.map +1 -0
- package/lib/esm/components/SurfsideVideo.js +81 -0
- package/lib/esm/components/SurfsideVideo.js.map +1 -0
- package/lib/esm/components/SurfsideVideoRenderer.js +38 -0
- package/lib/esm/components/SurfsideVideoRenderer.js.map +1 -0
- package/lib/esm/components/index.js +9 -0
- package/lib/esm/components/index.js.map +1 -0
- package/lib/esm/hooks/index.js +5 -0
- package/lib/esm/hooks/index.js.map +1 -0
- package/lib/esm/hooks/useSurfsideBanner.js +209 -0
- package/lib/esm/hooks/useSurfsideBanner.js.map +1 -0
- package/lib/esm/hooks/useSurfsideDynamicZone.js +278 -0
- package/lib/esm/hooks/useSurfsideDynamicZone.js.map +1 -0
- package/lib/esm/hooks/useSurfsideProducts.js +438 -0
- package/lib/esm/hooks/useSurfsideProducts.js.map +1 -0
- package/lib/esm/hooks/useSurfsideVideo.js +293 -0
- package/lib/esm/hooks/useSurfsideVideo.js.map +1 -0
- package/lib/esm/index.js +20 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/provider/SurfsideContextProvider.js +168 -0
- package/lib/esm/provider/SurfsideContextProvider.js.map +1 -0
- package/lib/esm/provider/index.js +2 -0
- package/lib/esm/provider/index.js.map +1 -0
- package/lib/esm/utils/Analytics.js +171 -0
- package/lib/esm/utils/Analytics.js.map +1 -0
- package/lib/esm/utils/index.js +2 -0
- package/lib/esm/utils/index.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useState, useEffect, useCallback, useMemo, useRef } from 'react';
|
|
3
|
+
import { useSurfsideContext } from '../provider';
|
|
4
|
+
import { AsyncPipe, Err, WrapValue, Ctx, } from '@surfside/ads-core-client';
|
|
5
|
+
/**
|
|
6
|
+
* Requests and returns a video creative. Accepts size, duration, and MIME type arguments and returns an object wrapping
|
|
7
|
+
* the creative, exporting both a deserialized object representing the VAST 3.0 XML markup as well as the raw XML
|
|
8
|
+
* itself, which can be passed into video players supporting the VAST 3.0 XML specification. The return type also
|
|
9
|
+
* contains an `analytics` object which is a set of callback functions to be called for specific video playback events,
|
|
10
|
+
* such as completing each quartile of the video playback, recording impressions, and starting/finishing the video.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* Video players are more complicated to implement than static banner creatives because of their inherently interactive
|
|
14
|
+
* nature. Modern browsers will disallow videos from autoplaying unmuted, [except under specific circumstances](
|
|
15
|
+
* https://developer.mozilla.org/en-US/docs/Web/Media/Guides/Autoplay#autoplay_availability). For this reason, it is
|
|
16
|
+
* recommended that you mark your `<video>` tag as `autoPlay muted`. e.g:
|
|
17
|
+
*
|
|
18
|
+
* ```html
|
|
19
|
+
* <video autoPlay muted>
|
|
20
|
+
* <!-- ... <source> tags go here -->
|
|
21
|
+
* </video>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* It is *possible* to autoplay a video unmuted under other circumstances, such as if the user has interacted with the
|
|
25
|
+
* page already. That implementation is left up to the developer.
|
|
26
|
+
*
|
|
27
|
+
* Surfside's bidder will always return with a single video creative per video bid request. This means that the
|
|
28
|
+
* `video.vast.ads` field will always have exactly one {@link IAd} object, and all VAST creative types will be a single
|
|
29
|
+
* `linear` video creative. This means that it will always be safe to do this:
|
|
30
|
+
*
|
|
31
|
+
* ```ts
|
|
32
|
+
* if (video !== undefined) {
|
|
33
|
+
* // URL of the video and its MIME type
|
|
34
|
+
* const { url, type } = video.ads[0].inline.creatives[0].mediaFiles[0];
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* Since this is somewhat verbose, these values are available to you through the `video.url` and `video.mime` fields
|
|
39
|
+
* within the {@link IVideo} object.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* A very simple video player for a video response might look like this
|
|
43
|
+
*
|
|
44
|
+
* ```tsx
|
|
45
|
+
* const { video, loading, error, analytics } = useSurfsideVideo({
|
|
46
|
+
* zoneId: 'my-zone',
|
|
47
|
+
* size: [4, 3], // 4x3 video ad
|
|
48
|
+
* maxDuration: 30 // 30 seconds max
|
|
49
|
+
* });
|
|
50
|
+
*
|
|
51
|
+
* // Call impression and win handlers if they exist
|
|
52
|
+
* useEffect(() => {
|
|
53
|
+
* analytics?.impression();
|
|
54
|
+
* analytics?.win();
|
|
55
|
+
* }, [analytics]);
|
|
56
|
+
*
|
|
57
|
+
* if (loading) {
|
|
58
|
+
* return <div>loading...</div>;
|
|
59
|
+
* }
|
|
60
|
+
*
|
|
61
|
+
* if (error) {
|
|
62
|
+
* throw error.error; // error.error is the Javascript Error type and can be safely thrown
|
|
63
|
+
* }
|
|
64
|
+
*
|
|
65
|
+
* return (
|
|
66
|
+
* <video autoplay muted>
|
|
67
|
+
* <source src={video.url} type={video.mime} />
|
|
68
|
+
* </video>
|
|
69
|
+
* );
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* Note that this implementation ONLY implements the `win` and `impression` events. In order to implement playback-based
|
|
73
|
+
* events, you must write handlers for the [`play`, `ended`, and `timeupdate` events](
|
|
74
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/video#events). For quartile playback events, you
|
|
75
|
+
* will need to check the current time of the video during the `timeupdate` events to determine if the proper quartile
|
|
76
|
+
* has been passed (e.g, `firstQuartile` must be fired **a single time, only after the video has surpassed 25% of its
|
|
77
|
+
* duration**).
|
|
78
|
+
*
|
|
79
|
+
* @param {IUseSurfsideVideoOptions} props
|
|
80
|
+
*
|
|
81
|
+
* @expandType IUseSurfsideVideoOptions
|
|
82
|
+
* @expandType UseSurfsideVideoReturn
|
|
83
|
+
*/
|
|
84
|
+
export const useSurfsideVideo = ({ zoneId, size, minDuration = 0, maxDuration, mimes = ['video/mp4'], enabled = true, category }) => {
|
|
85
|
+
const resolvedMimes = useMemo(() => mimes, [mimes.join(',')]);
|
|
86
|
+
const stableCategory = useMemo(() => category, [category?.join(',') ?? '']);
|
|
87
|
+
const respProps = useMemo(() => ({
|
|
88
|
+
video: undefined,
|
|
89
|
+
zoneId,
|
|
90
|
+
size,
|
|
91
|
+
minDuration,
|
|
92
|
+
maxDuration,
|
|
93
|
+
mimes: resolvedMimes,
|
|
94
|
+
enabled,
|
|
95
|
+
category: stableCategory
|
|
96
|
+
}), [zoneId, size?.[0], size?.[1], minDuration, maxDuration, resolvedMimes, enabled, stableCategory]);
|
|
97
|
+
const internalState = useSurfsideVideoResponse(respProps);
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
internalState.refetch?.();
|
|
100
|
+
}, [internalState.refetch]);
|
|
101
|
+
return internalState;
|
|
102
|
+
};
|
|
103
|
+
export const useSurfsideVideoResponse = (props) => {
|
|
104
|
+
const { startRequest, requestBids, buildVideoResponse, logger, error: apiError, hasError: apiHasError, isReady: apiIsReady } = useSurfsideContext();
|
|
105
|
+
const [internalVideo, setInternalVideo] = useState(props?.video);
|
|
106
|
+
const [video, setVideo] = useState();
|
|
107
|
+
const [loading, setLoading] = useState(true);
|
|
108
|
+
const [videoError, setVideoError] = useState();
|
|
109
|
+
const trackingEvents = useRef();
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
if (internalVideo?.ok === true) {
|
|
112
|
+
const value = internalVideo.value;
|
|
113
|
+
const ad = value.video.ads[0];
|
|
114
|
+
const creative = ad?.inline.creatives[0];
|
|
115
|
+
const mediaFile = creative?.mediaFiles[0];
|
|
116
|
+
const adm = internalVideo.value.bid.adm;
|
|
117
|
+
if (ad !== undefined && creative !== undefined && mediaFile !== undefined && adm !== undefined) {
|
|
118
|
+
setSuccessState({
|
|
119
|
+
...internalVideo.value,
|
|
120
|
+
id: internalVideo.value.bid.id,
|
|
121
|
+
title: ad.inline.adTitle,
|
|
122
|
+
duration: creative.duration,
|
|
123
|
+
mime: mediaFile.type,
|
|
124
|
+
adm: adm,
|
|
125
|
+
videoUrl: mediaFile.url,
|
|
126
|
+
}, creative.trackingEvents);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else if (internalVideo?.ok === false) {
|
|
130
|
+
setErrorState(internalVideo);
|
|
131
|
+
}
|
|
132
|
+
}, [internalVideo]);
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
if (props?.video === undefined) {
|
|
135
|
+
// setLoadingState();
|
|
136
|
+
// } else if (internalVideo?.ok === false) {
|
|
137
|
+
// setErrorState(internalVideo);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
setInternalVideo(props?.video);
|
|
141
|
+
}
|
|
142
|
+
}, [props?.video]);
|
|
143
|
+
const setErrorState = (err) => {
|
|
144
|
+
setVideoError(err);
|
|
145
|
+
setVideo(undefined);
|
|
146
|
+
setLoading(false);
|
|
147
|
+
trackingEvents.current = undefined;
|
|
148
|
+
};
|
|
149
|
+
const setLoadingState = () => {
|
|
150
|
+
setVideoError(undefined);
|
|
151
|
+
setVideo(undefined);
|
|
152
|
+
setLoading(true);
|
|
153
|
+
trackingEvents.current = undefined;
|
|
154
|
+
};
|
|
155
|
+
const setSuccessState = (video, track) => {
|
|
156
|
+
setVideoError(undefined);
|
|
157
|
+
setVideo(video);
|
|
158
|
+
setLoading(false);
|
|
159
|
+
trackingEvents.current = track;
|
|
160
|
+
};
|
|
161
|
+
const refetch = useCallback(async () => {
|
|
162
|
+
if (props === undefined || !apiIsReady || props.enabled === false) {
|
|
163
|
+
if (apiHasError) {
|
|
164
|
+
setErrorState(apiError);
|
|
165
|
+
}
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
setLoadingState();
|
|
169
|
+
const request = startRequest(props.zoneId)
|
|
170
|
+
.withSurfCategory(props?.category ?? [])
|
|
171
|
+
.withVideo(props.size[0], props.size[1], props.minDuration, props.maxDuration, props.mimes)
|
|
172
|
+
.build();
|
|
173
|
+
const videoResult = await AsyncPipe(requestBids(request))
|
|
174
|
+
.then(bidResponse => WrapValue(bidResponse.seatbid?.[0]?.bid?.[0]))
|
|
175
|
+
.then(buildVideoResponse)
|
|
176
|
+
.result();
|
|
177
|
+
setInternalVideo(videoResult);
|
|
178
|
+
}, [
|
|
179
|
+
apiIsReady,
|
|
180
|
+
apiError,
|
|
181
|
+
startRequest,
|
|
182
|
+
buildVideoResponse,
|
|
183
|
+
props?.enabled,
|
|
184
|
+
props?.zoneId,
|
|
185
|
+
props?.size[0],
|
|
186
|
+
props?.size[1],
|
|
187
|
+
props?.minDuration,
|
|
188
|
+
props?.maxDuration,
|
|
189
|
+
props?.mimes,
|
|
190
|
+
props?.category
|
|
191
|
+
]);
|
|
192
|
+
const analytics = useMemo(() => {
|
|
193
|
+
if (video === undefined) {
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
...trackVideoEvents(trackingEvents.current, logger),
|
|
198
|
+
...trackVideoWin
|
|
199
|
+
};
|
|
200
|
+
}, [video?.id]);
|
|
201
|
+
if (!loading && videoError === undefined && video !== undefined) {
|
|
202
|
+
return {
|
|
203
|
+
video,
|
|
204
|
+
error: videoError,
|
|
205
|
+
loading,
|
|
206
|
+
isReady: true,
|
|
207
|
+
analytics,
|
|
208
|
+
refetch
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
else if (!loading && videoError !== undefined && video === undefined) {
|
|
212
|
+
return {
|
|
213
|
+
video,
|
|
214
|
+
error: videoError,
|
|
215
|
+
loading: loading,
|
|
216
|
+
isReady: false,
|
|
217
|
+
analytics: undefined,
|
|
218
|
+
refetch
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
else if (loading && videoError === undefined && video === undefined) {
|
|
222
|
+
return {
|
|
223
|
+
video,
|
|
224
|
+
error: videoError,
|
|
225
|
+
loading,
|
|
226
|
+
isReady: false,
|
|
227
|
+
analytics: undefined,
|
|
228
|
+
refetch
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
return {
|
|
233
|
+
video: undefined,
|
|
234
|
+
error: Err(new InvalidVideoStateError(video, videoError, loading)),
|
|
235
|
+
loading: false,
|
|
236
|
+
isReady: false,
|
|
237
|
+
analytics: undefined,
|
|
238
|
+
refetch: refetch
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
export class InvalidVideoStateError extends Error {
|
|
243
|
+
video;
|
|
244
|
+
error;
|
|
245
|
+
loading;
|
|
246
|
+
constructor(video, error, loading) {
|
|
247
|
+
super('useSurfsideBanner resulted in an invalid state');
|
|
248
|
+
this.video = video;
|
|
249
|
+
this.error = error;
|
|
250
|
+
this.loading = loading;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
;
|
|
254
|
+
const trackVideoWin = (video, logger) => () => {
|
|
255
|
+
if (video === undefined) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
const log = Ctx(logger)?.with('trackWin');
|
|
259
|
+
if (video.bid.nurl !== undefined) {
|
|
260
|
+
const url = new URL(video.bid.nurl);
|
|
261
|
+
url.searchParams.delete('url');
|
|
262
|
+
fetch(url.toString()).then(() => log?.debug('Won auction', video));
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
log?.error('Missing nurl on video bid response! This should never happen', video);
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
const trackVideoEvents = (trackingEvents, logger) => {
|
|
269
|
+
if (trackingEvents === undefined) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
const log = Ctx(logger)?.with('trackVideoEvents');
|
|
273
|
+
// Helper to safely return a tracking function or no-op
|
|
274
|
+
const getTracker = (eventName) => {
|
|
275
|
+
const event = trackingEvents.find((e) => e.event === eventName);
|
|
276
|
+
if (event?.url === undefined) {
|
|
277
|
+
return () => log?.debug(`No tracker for event: ${eventName}`);
|
|
278
|
+
}
|
|
279
|
+
return () => {
|
|
280
|
+
fetch(event.url).then(() => log?.debug(`Tracked event: ${eventName}`));
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
return {
|
|
284
|
+
start: getTracker('start'),
|
|
285
|
+
firstQuartile: getTracker('firstQuartile'),
|
|
286
|
+
midpoint: getTracker('midpoint'),
|
|
287
|
+
thirdQuartile: getTracker('thirdQuartile'),
|
|
288
|
+
complete: getTracker('complete'),
|
|
289
|
+
impression: getTracker('impression'),
|
|
290
|
+
win: getTracker('win'),
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
//# sourceMappingURL=useSurfsideVideo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSurfsideVideo.js","sourceRoot":"src/","sources":["hooks/useSurfsideVideo.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;A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AAc,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO;IACX,CAAC;IAED,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAElD,uDAAuD;IACvD,MAAM,UAAU,GAAG,CAAC,SAAiB,EAA8B,EAAE;QACjE,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;QAChE,IAAI,KAAK,EAAE,GAAG,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,yBAAyB,SAAS,EAAE,CAAC,CAAC;QAClE,CAAC;QACD,OAAO,GAAG,EAAE;YACR,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,kBAAkB,SAAS,EAAE,CAAC,CAAC,CAAC;QAC3E,CAAC,CAAC;IACN,CAAC,CAAC;IAEF,OAAO;QACH,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;QAC1B,aAAa,EAAE,UAAU,CAAC,eAAe,CAAC;QAC1C,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC;QAChC,aAAa,EAAE,UAAU,CAAC,eAAe,CAAC;QAC1C,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC;QAChC,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC;QACpC,GAAG,EAAE,UAAU,CAAC,KAAK,CAAC;KACzB,CAAC;AACN,CAAC,CAAC"}
|
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Provider
|
|
2
|
+
export { useSurfsideContext, SurfsideProvider, InvalidStateError, NotInProviderError, } from './provider';
|
|
3
|
+
// Analytics
|
|
4
|
+
export { trackProductClick, trackBannerClick, trackProductImpressions, trackBannerImpression, trackVideoImpression, trackVideoEvent, trackZoneEvent, } from './utils';
|
|
5
|
+
// Components
|
|
6
|
+
export { SurfsideBanner } from './components';
|
|
7
|
+
export { SurfsideBannerRenderer, } from './components';
|
|
8
|
+
export { SurfsideCarousel, } from './components';
|
|
9
|
+
export { SurfsideDynamicZone, DynamicZoneUnmountedError, } from './components';
|
|
10
|
+
export { SurfsideProductCard, NoProductsReturnedError, ProductCardUnmountedError, } from './components';
|
|
11
|
+
export { SurfsideVideo } from './components';
|
|
12
|
+
export { SurfsideVideoRenderer, } from './components';
|
|
13
|
+
export { SurfsideBannerVideoRenderer, } from './components';
|
|
14
|
+
// Hooks
|
|
15
|
+
export { useSurfsideBanner, useSurfsideBannerResponse, InvalidBannerStateError, } from './hooks';
|
|
16
|
+
export { useSurfsideDynamicZone, InvalidDynamicZoneState, } from './hooks';
|
|
17
|
+
export { useSurfsideProducts, useSurfsideProductsResponse, InvalidStrategyError, InvalidProductsStateError, } from './hooks';
|
|
18
|
+
export { useSurfsideVideo, useSurfsideVideoResponse, InvalidVideoStateError, } from './hooks';
|
|
19
|
+
export * from './BuildInfo';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["index.ts"],"names":[],"mappings":"AAAA,WAAW;AACX,OAAO,EAQH,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,GACrB,MAAO,YAAY,CAAC;AAErB,YAAY;AACZ,OAAO,EAGH,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,cAAc,GACjB,MAAM,SAAS,CAAC;AAEjB,aAAa;AACb,OAAO,EAEH,cAAc,EACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAEH,sBAAsB,GACzB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAMH,gBAAgB,GACnB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAEH,mBAAmB,EACnB,yBAAyB,GAC5B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAKH,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,GAC5B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAEH,aAAa,EAChB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAEH,qBAAqB,GACxB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAGH,2BAA2B,GAC9B,MAAM,cAAc,CAAC;AAEtB,QAAQ;AACR,OAAO,EASH,iBAAiB,EAEjB,yBAAyB,EACzB,uBAAuB,GAC1B,MAAM,SAAS,CAAC;AAEjB,OAAO,EAmBH,sBAAsB,EACtB,uBAAuB,GAC1B,MAAM,SAAS,CAAC;AAEjB,OAAO,EAmBH,mBAAmB,EACnB,2BAA2B,EAC3B,oBAAoB,EACpB,yBAAyB,GAC5B,MAAM,SAAS,CAAC;AAEjB,OAAO,EAUH,gBAAgB,EAEhB,wBAAwB,EACxB,sBAAsB,GACzB,MAAM,SAAS,CAAC;AAEjB,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useState, useEffect, useMemo, } from 'react';
|
|
4
|
+
import { InitLogger, Ctx, TryDo, Err, GetValueOrThrow, SurfsideAdsCoreVersionInfo, } from '@surfside/ads-core';
|
|
5
|
+
import { InitSurfAdsWeb, InitSurfAdsWebInternal, SurfsideAdsCoreWebVersionInfo } from '@surfside/ads-core-web';
|
|
6
|
+
import { InitSurfAdsCoreMock } from '@surfside/ads-core-mock';
|
|
7
|
+
import { SurfsideAdsCoreClientVersionInfo } from '@surfside/ads-core-client';
|
|
8
|
+
;
|
|
9
|
+
;
|
|
10
|
+
;
|
|
11
|
+
const SurfsideContext = createContext(undefined);
|
|
12
|
+
/**
|
|
13
|
+
* Returns the Surfside Context state, or throws an error if the context failed to return at all (i.e, you are calling
|
|
14
|
+
* useSurfsideContext outside of SurfsideProvider node)
|
|
15
|
+
*
|
|
16
|
+
* @throws {Error} If the context failed to initialize.
|
|
17
|
+
*/
|
|
18
|
+
export const useSurfsideContext = () => {
|
|
19
|
+
const context = useContext(SurfsideContext);
|
|
20
|
+
if (context === undefined) {
|
|
21
|
+
return {
|
|
22
|
+
error: Err(new NotInProviderError),
|
|
23
|
+
status: 'error',
|
|
24
|
+
isReady: false,
|
|
25
|
+
setLocationId: () => void 0,
|
|
26
|
+
setUserId: () => void 0,
|
|
27
|
+
isInitializing: false,
|
|
28
|
+
hasError: true
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return context;
|
|
32
|
+
};
|
|
33
|
+
const searchHasString = (str) => typeof window !== 'undefined' &&
|
|
34
|
+
window.location.search.toLowerCase().includes(str);
|
|
35
|
+
/**
|
|
36
|
+
* The provider for the Surfside ads context.
|
|
37
|
+
*
|
|
38
|
+
* @see {@link ISurfsideProviderProps}
|
|
39
|
+
*/
|
|
40
|
+
export const SurfsideProvider = ({ accountId, channelId, siteId, locationId: cfgLocationId, userId: cfgUserId, config, onError, children, logger: userLogger }) => {
|
|
41
|
+
const [api, setApi] = useState();
|
|
42
|
+
const [isInitializing, setIsInitializing] = useState(true);
|
|
43
|
+
const [error, setError] = useState();
|
|
44
|
+
const [locationId, setLocationId] = useState(cfgLocationId);
|
|
45
|
+
const [userId, setUserId] = useState(cfgUserId);
|
|
46
|
+
const debug = config?.debug ?? searchHasString('surf_debug=true');
|
|
47
|
+
const mock = config?.mock ?? searchHasString('surf_mock=true');
|
|
48
|
+
const { mockRecommendedProducts, mockSponsoredProducts } = config?.customMockData ?? {};
|
|
49
|
+
const logger = useMemo(() => Ctx(userLogger ?? (debug ? InitLogger() : undefined)), [userLogger]);
|
|
50
|
+
const log = Ctx(logger)?.with('SurfsideProvider');
|
|
51
|
+
log?.info('Initializing Surfside provider');
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
let cancel = false;
|
|
54
|
+
log?.info('Checking initialization state');
|
|
55
|
+
if (locationId === undefined) {
|
|
56
|
+
setLoadingState();
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const initializerPromise = !mock
|
|
60
|
+
? InitSurfAdsWeb(accountId, siteId, channelId, locationId, userId, logger)
|
|
61
|
+
: InitSurfAdsWebInternal(InitSurfAdsCoreMock(accountId, channelId, siteId, locationId, userId, InitLogger(), mockSponsoredProducts, mockRecommendedProducts, config?.simulateNoResponse, config?.simulateTimeout));
|
|
62
|
+
initializerPromise.then(web => {
|
|
63
|
+
if (cancel) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (!web.ok) {
|
|
67
|
+
setErrorState(web);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const { logger } = web.value;
|
|
71
|
+
logger?.table(SurfsideAdsVersionTable);
|
|
72
|
+
setSuccessState(web.value);
|
|
73
|
+
});
|
|
74
|
+
return () => {
|
|
75
|
+
cancel = true;
|
|
76
|
+
};
|
|
77
|
+
}, [locationId, accountId, siteId, channelId, userId, logger]);
|
|
78
|
+
const setLoadingState = () => {
|
|
79
|
+
setIsInitializing(true);
|
|
80
|
+
setError(undefined);
|
|
81
|
+
setApi(undefined);
|
|
82
|
+
};
|
|
83
|
+
const setErrorState = (err) => {
|
|
84
|
+
setIsInitializing(false);
|
|
85
|
+
setError(err);
|
|
86
|
+
setApi(undefined);
|
|
87
|
+
};
|
|
88
|
+
const setSuccessState = (api) => {
|
|
89
|
+
setIsInitializing(false);
|
|
90
|
+
setError(undefined);
|
|
91
|
+
setApi(api);
|
|
92
|
+
};
|
|
93
|
+
const contextValue = GetValueOrThrow(TryDo(() => {
|
|
94
|
+
if (isInitializing) { // Loading state
|
|
95
|
+
return {
|
|
96
|
+
isInitializing: true,
|
|
97
|
+
status: 'initializing',
|
|
98
|
+
isReady: false,
|
|
99
|
+
error: undefined,
|
|
100
|
+
hasError: false,
|
|
101
|
+
setLocationId,
|
|
102
|
+
setUserId
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
else if (error !== undefined) { // error state
|
|
106
|
+
return {
|
|
107
|
+
isInitializing: false,
|
|
108
|
+
status: 'error',
|
|
109
|
+
error,
|
|
110
|
+
setLocationId,
|
|
111
|
+
setUserId,
|
|
112
|
+
isReady: false,
|
|
113
|
+
hasError: true
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
else if (api !== undefined) { // success state
|
|
117
|
+
return {
|
|
118
|
+
...api,
|
|
119
|
+
isReady: true,
|
|
120
|
+
status: 'ready',
|
|
121
|
+
setLocationId,
|
|
122
|
+
setUserId,
|
|
123
|
+
hasError: false,
|
|
124
|
+
isInitializing: false
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
else { // error - indeterminate state. Set error state
|
|
128
|
+
return {
|
|
129
|
+
error: Err(new InvalidStateError),
|
|
130
|
+
isReady: false,
|
|
131
|
+
isInitializing: false,
|
|
132
|
+
status: 'error',
|
|
133
|
+
setLocationId,
|
|
134
|
+
setUserId,
|
|
135
|
+
hasError: true
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}));
|
|
139
|
+
if (contextValue.status === 'error') {
|
|
140
|
+
onError?.(contextValue.error);
|
|
141
|
+
}
|
|
142
|
+
return (_jsx(SurfsideContext.Provider, { value: contextValue, children: children }));
|
|
143
|
+
};
|
|
144
|
+
export class InvalidStateError extends Error {
|
|
145
|
+
constructor() {
|
|
146
|
+
super('Surfside context provider was left in an invalid state. Contact the vendor');
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
export class NotInProviderError extends Error {
|
|
150
|
+
constructor() {
|
|
151
|
+
super('useSurfsideContext must be used within a SurfsideProvider block. Did you forget to add the provider to' +
|
|
152
|
+
' your App.tsx?');
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
const pad = (name) => {
|
|
156
|
+
let newName = name;
|
|
157
|
+
const remaining = 25 - name.length;
|
|
158
|
+
for (let i = 0; i < remaining; i++) {
|
|
159
|
+
newName += ' ';
|
|
160
|
+
}
|
|
161
|
+
return newName;
|
|
162
|
+
};
|
|
163
|
+
const SurfsideAdsVersionTable = {
|
|
164
|
+
[pad('@surfside/ads-core')]: SurfsideAdsCoreVersionInfo,
|
|
165
|
+
[pad('@surfside/ads-core-client')]: SurfsideAdsCoreClientVersionInfo,
|
|
166
|
+
[pad('@surfside/ads-core-web')]: SurfsideAdsCoreWebVersionInfo
|
|
167
|
+
};
|
|
168
|
+
//# sourceMappingURL=SurfsideContextProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SurfsideContextProvider.js","sourceRoot":"src/","sources":["provider/SurfsideContextProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EAGV,aAAa,EACb,UAAU,EACV,QAAQ,EACR,SAAS,EACT,OAAO,GACV,MAAM,OAAO,CAAC;AAEf,OAAO,EAIH,UAAU,EACV,GAAG,EACH,KAAK,EACL,GAAG,EACH,eAAe,EACf,0BAA0B,GAC7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEH,cAAc,EACd,sBAAsB,EACtB,6BAA6B,EAChC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAA6B,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC;AAiF5E,CAAC;AAkDD,CAAC;AAiBD,CAAC;AAUF,MAAM,eAAe,GAAG,aAAa,CACjC,SAAS,CACZ,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAyB,EAAE;IACzD,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IAC5C,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO;YACH,KAAK,EAAE,GAAG,CAAC,IAAI,kBAAkB,CAAC;YAClC,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,KAAK;YACd,aAAa,EA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