@surfside/ads-react 0.1.22 → 0.3.0-c2d1d13c.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 (70) hide show
  1. package/README.md +127 -127
  2. package/lib/cjs/BuildInfo.js +6 -2
  3. package/lib/cjs/BuildInfo.js.map +1 -1
  4. package/lib/cjs/components/SurfsideBanner.js.map +1 -1
  5. package/lib/cjs/components/SurfsideBannerRenderer.js.map +1 -1
  6. package/lib/cjs/components/SurfsideBannerVideoRenderer.js.map +1 -1
  7. package/lib/cjs/components/SurfsideCarousel.js +49 -44
  8. package/lib/cjs/components/SurfsideCarousel.js.map +1 -1
  9. package/lib/cjs/components/SurfsideDynamicZone.js.map +1 -1
  10. package/lib/cjs/components/SurfsideProduct.js.map +1 -1
  11. package/lib/cjs/components/SurfsideVideo.js.map +1 -1
  12. package/lib/cjs/components/SurfsideVideoRenderer.js.map +1 -1
  13. package/lib/cjs/components/index.js.map +1 -1
  14. package/lib/cjs/hooks/index.js.map +1 -1
  15. package/lib/cjs/hooks/useSurfsideBanner.js +34 -23
  16. package/lib/cjs/hooks/useSurfsideBanner.js.map +1 -1
  17. package/lib/cjs/hooks/useSurfsideDynamicZone.js.map +1 -1
  18. package/lib/cjs/hooks/useSurfsideProducts.js.map +1 -1
  19. package/lib/cjs/hooks/useSurfsideVideo.js +2 -1
  20. package/lib/cjs/hooks/useSurfsideVideo.js.map +1 -1
  21. package/lib/cjs/index.js +26 -5
  22. package/lib/cjs/index.js.map +1 -1
  23. package/lib/cjs/provider/SurfsideContextProvider.js +417 -58
  24. package/lib/cjs/provider/SurfsideContextProvider.js.map +1 -1
  25. package/lib/cjs/provider/index.js +3 -1
  26. package/lib/cjs/provider/index.js.map +1 -1
  27. package/lib/cjs/utils/Analytics.js.map +1 -1
  28. package/lib/cjs/utils/index.js.map +1 -1
  29. package/lib/cjs/utils/useLog.js +8 -0
  30. package/lib/cjs/utils/useLog.js.map +1 -0
  31. package/lib/esm/BuildInfo.js +5 -1
  32. package/lib/esm/BuildInfo.js.map +1 -1
  33. package/lib/esm/components/SurfsideBanner.js.map +1 -1
  34. package/lib/esm/components/SurfsideBannerRenderer.js.map +1 -1
  35. package/lib/esm/components/SurfsideBannerVideoRenderer.js.map +1 -1
  36. package/lib/esm/components/SurfsideCarousel.js +49 -44
  37. package/lib/esm/components/SurfsideCarousel.js.map +1 -1
  38. package/lib/esm/components/SurfsideDynamicZone.js.map +1 -1
  39. package/lib/esm/components/SurfsideProduct.js.map +1 -1
  40. package/lib/esm/components/SurfsideVideo.js.map +1 -1
  41. package/lib/esm/components/SurfsideVideoRenderer.js.map +1 -1
  42. package/lib/esm/components/index.js.map +1 -1
  43. package/lib/esm/hooks/index.js.map +1 -1
  44. package/lib/esm/hooks/useSurfsideBanner.js +36 -25
  45. package/lib/esm/hooks/useSurfsideBanner.js.map +1 -1
  46. package/lib/esm/hooks/useSurfsideDynamicZone.js.map +1 -1
  47. package/lib/esm/hooks/useSurfsideProducts.js.map +1 -1
  48. package/lib/esm/hooks/useSurfsideVideo.js +2 -1
  49. package/lib/esm/hooks/useSurfsideVideo.js.map +1 -1
  50. package/lib/esm/index.js +2 -2
  51. package/lib/esm/index.js.map +1 -1
  52. package/lib/esm/provider/SurfsideContextProvider.js +383 -59
  53. package/lib/esm/provider/SurfsideContextProvider.js.map +1 -1
  54. package/lib/esm/provider/index.js +1 -1
  55. package/lib/esm/provider/index.js.map +1 -1
  56. package/lib/esm/utils/Analytics.js.map +1 -1
  57. package/lib/esm/utils/index.js.map +1 -1
  58. package/lib/esm/utils/useLog.js +4 -0
  59. package/lib/esm/utils/useLog.js.map +1 -0
  60. package/lib/types/BuildInfo.d.ts +1 -1
  61. package/lib/types/components/SurfsideCarousel.d.ts +1 -1
  62. package/lib/types/components/SurfsideDynamicZone.d.ts +1 -1
  63. package/lib/types/components/SurfsideProduct.d.ts +1 -1
  64. package/lib/types/components/SurfsideVideo.d.ts +1 -1
  65. package/lib/types/hooks/useSurfsideVideo.d.ts +4 -0
  66. package/lib/types/index.d.ts +2 -2
  67. package/lib/types/provider/SurfsideContextProvider.d.ts +37 -3
  68. package/lib/types/provider/index.d.ts +1 -1
  69. package/lib/types/utils/useLog.d.ts +2 -0
  70. package/package.json +49 -44
@@ -88,6 +88,10 @@ export interface ISurfsideVideoAnalytics {
88
88
  * This event should be called when the video is added to the page.
89
89
  */
90
90
  win: ISurfsideVideoEventHandler;
91
+ /**
92
+ * This event should be called when the video is paused.
93
+ */
94
+ pause: ISurfsideVideoEventHandler;
91
95
  }
92
96
  /**
93
97
  * Return type for the {@link useSurfsideVideo} hook. The optional fields are narrowed by typescript when checking the
@@ -1,4 +1,4 @@
1
- export { ISurfsideProviderProps, ISurfsideContextValueBase, ISurfsideContextValueInitialized, ISurfsideContextValueUninitialized, ISurfsideContextValueHasError, ISurfsideContextValueNoError, SurfsideContextValue, useSurfsideContext, SurfsideProvider, InvalidStateError, NotInProviderError, } from './provider';
1
+ export { ISurfsideProviderProps, ISurfsideContextValueBase, ISurfsideContextValueInitialized, ISurfsideContextValueUninitialized, ISurfsideContextValueHasError, ISurfsideContextValueNoError, SurfsideContextValue, useSurfsideContext, SurfsideProvider, SurfsideProvider2, SurfsideHeadlessProvider, InvalidStateError, NotInProviderError, } from './provider';
2
2
  export { IImpressionAnalytics, IClickAnalytics, trackProductClick, trackBannerClick, trackProductImpressions, trackBannerImpression, trackVideoImpression, trackVideoEvent, trackZoneEvent, } from './utils';
3
3
  export { ISurfsideBannerProps, SurfsideBanner } from './components';
4
4
  export { ISurfsideBannerRendererProps, SurfsideBannerRenderer, } from './components';
@@ -12,4 +12,4 @@ export { IBanner, IUseSurfsideBannerOptions, IBannerAnalyticsCallbacks, IUseSurf
12
12
  export { IUseSurfsideDynamicZoneOptionsConfigProductOptions, IUseSurfsideDynamicZoneOptionsConfigWithProductInfo, IUseSurfsideDynamicZoneOptionsConfigWithProductIDs, UseSurfsideDynamicZoneOptionsConfigProductInfo, UseSurfDynamicZoneOptionsBase, UseSurfDynamicZoneOptionsWithProductInfo, UseSurfDynamicZoneOptionsWithProductIDs, UseSurfDynamicZoneOptions, IUseDynamicZoneReturnBase, IUseDynamicZoneReturnSuccess, IUseDynamicZoneReturnError, IUseDynamicZoneReturnLoading, IUseDynamicZoneReturnBanner, IUseDynamicZoneReturnVideo, IUseDynamicZoneReturnProducts, IUseDynamicZoneReturnProductsIndeterminate, UseSurfDynamicZoneReturnGeneric, UseSurfDynamicZoneReturn, useSurfsideDynamicZone, InvalidDynamicZoneState, } from './hooks';
13
13
  export { IUseSurfsideProductsPropsBase, UseSurfsideProductsPropsWithProductData, UseSurfsideProductsPropsWithProductIDs, UseSurfsideProductsProps, IUseSurfsideProductsResponsePropsBase, UseSurfsideProductsResponsePropsWithProductIDs, UseSurfsideProductsResponsePropsWithProductData, UseSurfsideProductsResponseProps, IProductDataBase, IProductInfoData, IProductIDData, IProductAnalyticsCallbacks, IUseSurfsideProductsReturnGeneric, IUseSurfsideProductsReturnGenericSuccess, IUseSurfsideProductsReturnGenericError, IUseSurfsideProductsReturnGenericLoading, UseSurfsideProductsReturnGeneric, UseSurfsideProductsReturn, useSurfsideProducts, useSurfsideProductsResponse, InvalidStrategyError, InvalidProductsStateError, } from './hooks';
14
14
  export { IVideo, IUseSurfsideVideoOptions, ISurfsideVideoEventHandler, ISurfsideVideoAnalytics, IUseSurfsideVideoReturnBase, IUseSurfsideVideoReturnSuccess, IUseSurfsideVideoReturnError, IUseSurfsideVideoReturnLoading, UseSurfsideVideoReturn, useSurfsideVideo, UseSurfsideVideoResponseProps, useSurfsideVideoResponse, InvalidVideoStateError, } from './hooks';
15
- export * from './BuildInfo';
15
+ export * as SurfsideAdsReactVersionInfo from './BuildInfo';
@@ -1,7 +1,14 @@
1
1
  import React, { type ReactNode } from 'react';
2
- import { type ILogger, type ErrResult } from '@surfside/ads-core';
3
- import { type ISurfsideWebApi } from '@surfside/ads-core-web';
4
- import { type IMockSurfsideProduct } from '@surfside/ads-core-mock';
2
+ import { type ILogger, type ErrResult, type INavigator, type IScreen, type INativeTemplateDelegateWindow, type IProductInformation } from '@surfside/ads-core';
3
+ import { type ILoadSurfAdsWebConfiguration, type ISurfAdsWebConfigurationOverrides, type ISurfAdsWebDependencies, type ISurfsideWebApi } from '@surfside/ads-core-web';
4
+ export interface IMockSurfsideProduct extends Partial<IProductInformation> {
5
+ id: string;
6
+ brand?: string;
7
+ description?: string;
8
+ ext?: {
9
+ category: string;
10
+ };
11
+ }
5
12
  /**
6
13
  * The arguments for initializing the Surfside ads context. user ID is optional because it is not always
7
14
  * available at initialization time, but it can be set later via the context's `setIds` function.
@@ -25,6 +32,11 @@ export interface ISurfsideProviderProps {
25
32
  config?: {
26
33
  /** Whether or not to enable default logging */
27
34
  debug?: boolean;
35
+ /** Whether or not to send performance timing to Surfside. Default false */
36
+ telemetry?: boolean;
37
+ /** The URL of the current page. Required for SSR users to populate telemetry logs correctly.
38
+ * Client-side users can omit this; window.location.href will be used automatically. */
39
+ url?: string;
28
40
  /** Whether or not to use mock services. Default false */
29
41
  mock?: boolean;
30
42
  /** The % chance that the mock bidder will return No Bids, from 0-1. If 1, the mock bidder will always
@@ -69,6 +81,14 @@ export interface ISurfsideContextValueBase extends Partial<ISurfsideWebApi> {
69
81
  userId?: string;
70
82
  setLocationId: (id: string) => void;
71
83
  setUserId: (id: string) => void;
84
+ setAccountId: (id: string) => void;
85
+ setSiteId: (id: string) => void;
86
+ setChannelId: (id: string) => void;
87
+ setIp: (id: string) => void;
88
+ setMobile: (mobile: boolean) => void;
89
+ setNavigator: (navigator: INavigator) => void;
90
+ setScreen: (screen: IScreen) => void;
91
+ setWindowInfo: (windowInfo: INativeTemplateDelegateWindow) => void;
72
92
  }
73
93
  /**
74
94
  * This state describes the successful initialization of the Surfside context object. if `isReady` is true, Surfside
@@ -151,6 +171,20 @@ export declare const useSurfsideContext: () => SurfsideContextValue;
151
171
  * @see {@link ISurfsideProviderProps}
152
172
  */
153
173
  export declare const SurfsideProvider: React.FC<ISurfsideProviderProps>;
174
+ export declare const SurfsideProvider2: React.FC<React.PropsWithChildren<ILoadSurfAdsReactConfiguration>>;
175
+ export interface ILoadSurfAdsReactConfiguration {
176
+ logger?: ILogger;
177
+ default?: Partial<Omit<ILoadSurfAdsWebConfiguration, 'overrides' | 'logger' | 'locationId'>> & {
178
+ locationId?: string;
179
+ };
180
+ overrides?: {
181
+ services?: Partial<ISurfAdsWebConfigurationOverrides>;
182
+ dependencies?: Partial<ISurfAdsWebDependencies>;
183
+ };
184
+ onError?: (error: ErrResult) => void;
185
+ error?: ErrResult;
186
+ }
187
+ export declare const SurfsideHeadlessProvider: React.FC<React.PropsWithChildren<ILoadSurfAdsReactConfiguration>>;
154
188
  export declare class InvalidStateError extends Error {
155
189
  constructor();
156
190
  }
@@ -1 +1 @@
1
- export { ISurfsideProviderProps, ISurfsideContextValueBase, ISurfsideContextValueInitialized, ISurfsideContextValueUninitialized, ISurfsideContextValueHasError, ISurfsideContextValueNoError, SurfsideContextValue, useSurfsideContext, SurfsideProvider, InvalidStateError, NotInProviderError, } from './SurfsideContextProvider';
1
+ export { ISurfsideProviderProps, ISurfsideContextValueBase, ISurfsideContextValueInitialized, ISurfsideContextValueUninitialized, ISurfsideContextValueHasError, ISurfsideContextValueNoError, SurfsideContextValue, useSurfsideContext, SurfsideProvider, SurfsideProvider2, SurfsideHeadlessProvider, InvalidStateError, NotInProviderError, } from './SurfsideContextProvider';
@@ -0,0 +1,2 @@
1
+ import { type ILogger } from '@surfside/ads-core';
2
+ export declare const useLog: (logger: ILogger | undefined, context: string) => import("@surfside/ads-core").IContextLogger | undefined;
package/package.json CHANGED
@@ -1,44 +1,49 @@
1
- {
2
- "name": "@surfside/ads-react",
3
- "version": "0.1.22",
4
- "description": "React components for Surfside Ads",
5
- "main": "./lib/cjs/index.js",
6
- "module": "./lib/esm/index.js",
7
- "types": "./lib/types/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "import": "./lib/esm/index.js",
11
- "require": "./lib/cjs/index.js",
12
- "types": "./lib/types/index.d.ts"
13
- }
14
- },
15
- "type": "module",
16
- "license": "UNLICENSED",
17
- "files": [
18
- "lib/",
19
- "README.md"
20
- ],
21
- "scripts": {
22
- "clean": "rm -rf ./lib",
23
- "prebuild": "echo \"export const SurfsideAdReactVersionInfo = { buildBranch: '$(git rev-parse --abbrev-ref HEAD)', buildHash: '$(git rev-parse --short HEAD)', buildVer: '$(bun -e 'console.log(require(\"./package.json\").version)')'};\" > src/BuildInfo.ts",
24
- "build": "bunx npm-run-all --parallel \"types\" \"esm\" \"cjs\"",
25
- "types": "tsc -p ./tsconfig.types.json",
26
- "esm": "tsc -p ./tsconfig.esm.json",
27
- "cjs": "tsc -p tsconfig.cjs.json",
28
- "lint": "npx eslint"
29
- },
30
- "peerDependencies": {
31
- "react": ">=17",
32
- "typescript": "^5.8.3"
33
- },
34
- "dependencies": {
35
- "@surfside/ads-core-web": "^0.1.22",
36
- "@surfside/ads-core-mock": "^0.1.22"
37
- },
38
- "devDependencies": {
39
- "@types/bun": "latest",
40
- "@types/react": "^18.0.0",
41
- "@types/react-dom": "^18.0.0",
42
- "typedoc": "^0.28.5"
43
- }
44
- }
1
+ {
2
+ "name": "@surfside/ads-react",
3
+ "version": "0.3.0-c2d1d13c.0",
4
+ "description": "React components for Surfside Ads",
5
+ "main": "./lib/cjs/index.js",
6
+ "module": "./lib/esm/index.js",
7
+ "types": "./lib/types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./lib/esm/index.js",
11
+ "require": "./lib/cjs/index.js",
12
+ "types": "./lib/types/index.d.ts"
13
+ }
14
+ },
15
+ "type": "module",
16
+ "license": "UNLICENSED",
17
+ "files": [
18
+ "lib/",
19
+ "README.md"
20
+ ],
21
+ "scripts": {
22
+ "clean": "rm -rf ./lib",
23
+ "build": "bun x npm-run-all --parallel \"types\" \"esm\" \"cjs\"",
24
+ "types": "tsc -p ./tsconfig.types.json",
25
+ "esm": "tsc -p ./tsconfig.esm.json",
26
+ "cjs": "tsc -p tsconfig.cjs.json",
27
+ "lint": "npx eslint",
28
+ "test": "bunx playwright test",
29
+ "test:ui": "bunx playwright test --ui"
30
+ },
31
+ "peerDependencies": {
32
+ "react": ">=17",
33
+ "react-dom": ">=17",
34
+ "typescript": "^5.8.3"
35
+ },
36
+ "dependencies": {
37
+ "@surfside/ads-core-mock": "0.3.0-c2d1d13c.0",
38
+ "@surfside/ads-core-web": "0.3.0-c2d1d13c.0"
39
+ },
40
+ "devDependencies": {
41
+ "@playwright/test": "^1.60.0",
42
+ "@types/bun": "latest",
43
+ "@types/react": "^19.0.0",
44
+ "@types/react-dom": "^19.0.0",
45
+ "react": "^19.0.0",
46
+ "react-dom": "^19.0.0",
47
+ "typedoc": "^0.28.5"
48
+ }
49
+ }