@surfside/ads 3.6.5 → 3.7.0-8cd008d7.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 (56) hide show
  1. package/lib/cjs/BuildInfo.js +2 -2
  2. package/lib/cjs/Init.js +15 -8
  3. package/lib/cjs/Init.js.map +1 -1
  4. package/lib/cjs/components/Banner.js +23 -8
  5. package/lib/cjs/components/Banner.js.map +1 -1
  6. package/lib/cjs/components/Card.js +8 -0
  7. package/lib/cjs/components/Card.js.map +1 -1
  8. package/lib/cjs/components/Carousel.js +27 -2
  9. package/lib/cjs/components/Carousel.js.map +1 -1
  10. package/lib/cjs/components/Creative.js +93 -6
  11. package/lib/cjs/components/Creative.js.map +1 -1
  12. package/lib/cjs/components/Debug.js +20 -0
  13. package/lib/cjs/components/Debug.js.map +1 -0
  14. package/lib/cjs/components/Dynamic.js +13 -3
  15. package/lib/cjs/components/Dynamic.js.map +1 -1
  16. package/lib/cjs/components/SimpleCreative.js +8 -2
  17. package/lib/cjs/components/SimpleCreative.js.map +1 -1
  18. package/lib/cjs/components/Video.js +14 -4
  19. package/lib/cjs/components/Video.js.map +1 -1
  20. package/lib/cjs/index.module.js +11 -5
  21. package/lib/cjs/index.module.js.map +1 -1
  22. package/lib/cjs/index.script.js +2 -1
  23. package/lib/cjs/index.script.js.map +1 -1
  24. package/lib/esm/BuildInfo.js +2 -2
  25. package/lib/esm/Init.js +15 -8
  26. package/lib/esm/Init.js.map +1 -1
  27. package/lib/esm/components/Banner.js +23 -8
  28. package/lib/esm/components/Banner.js.map +1 -1
  29. package/lib/esm/components/Card.js +8 -0
  30. package/lib/esm/components/Card.js.map +1 -1
  31. package/lib/esm/components/Carousel.js +27 -2
  32. package/lib/esm/components/Carousel.js.map +1 -1
  33. package/lib/esm/components/Creative.js +93 -6
  34. package/lib/esm/components/Creative.js.map +1 -1
  35. package/lib/esm/components/Debug.js +16 -0
  36. package/lib/esm/components/Debug.js.map +1 -0
  37. package/lib/esm/components/Dynamic.js +13 -3
  38. package/lib/esm/components/Dynamic.js.map +1 -1
  39. package/lib/esm/components/SimpleCreative.js +8 -2
  40. package/lib/esm/components/SimpleCreative.js.map +1 -1
  41. package/lib/esm/components/Video.js +15 -5
  42. package/lib/esm/components/Video.js.map +1 -1
  43. package/lib/esm/index.module.js +11 -5
  44. package/lib/esm/index.module.js.map +1 -1
  45. package/lib/esm/index.script.js +2 -1
  46. package/lib/esm/index.script.js.map +1 -1
  47. package/lib/types/Init.d.ts +1 -0
  48. package/lib/types/components/Banner.d.ts +4 -6
  49. package/lib/types/components/Card.d.ts +1 -0
  50. package/lib/types/components/Carousel.d.ts +6 -4
  51. package/lib/types/components/Creative.d.ts +30 -3
  52. package/lib/types/components/Debug.d.ts +2 -0
  53. package/lib/types/components/Dynamic.d.ts +1 -0
  54. package/lib/types/components/SimpleCreative.d.ts +6 -4
  55. package/lib/types/components/Video.d.ts +5 -5
  56. package/package.json +4 -4
@@ -24,9 +24,13 @@ export declare const RecommenderTypeInputs: {
24
24
  };
25
25
  export declare const AttributeValOrThrow: (element: Element, attribute: string, value: string | null) => string;
26
26
  export declare const DEBOUNCE_THRESHOLD = 10;
27
+ export interface ICreativeComponentDependencies {
28
+ initApi: InitApi;
29
+ getUserId: GetUserIdFn;
30
+ logger?: ILogger;
31
+ isDebug: boolean;
32
+ }
27
33
  export declare abstract class CreativeComponent extends HTMLElement {
28
- private _initApi;
29
- private _getUserId;
30
34
  protected accountId: string | undefined;
31
35
  protected siteId: string | undefined;
32
36
  protected locationId: string | undefined;
@@ -43,7 +47,19 @@ export declare abstract class CreativeComponent extends HTMLElement {
43
47
  private _instanceId;
44
48
  protected get instanceId(): string;
45
49
  private readonly _monkeyHistoryReplaceCallback;
46
- constructor(_initApi: InitApi, _getUserId: GetUserIdFn, logger?: ILogger);
50
+ private _reauctionTimer;
51
+ private _reauctionCallback;
52
+ private _reauctionRemainingMs;
53
+ private _reauctionStartedAt;
54
+ private _windowBlurred;
55
+ private _initApi;
56
+ private _getUserId;
57
+ logger?: ILogger;
58
+ protected readonly isDebug: boolean;
59
+ private readonly _blurCallback;
60
+ private readonly _focusCallback;
61
+ private readonly _visibilityChangeCallback;
62
+ constructor({ initApi, getUserId, logger, isDebug }: ICreativeComponentDependencies);
47
63
  connectedCallback(): void;
48
64
  protected abstract getComponentName(): string;
49
65
  protected static get observedBaseAttributes(): string[];
@@ -60,6 +76,17 @@ export declare abstract class CreativeComponent extends HTMLElement {
60
76
  protected lazyLoadApi(): Promise<void>;
61
77
  protected baseAttributeChangedCallback(key: BaseAttributeNames, oldValue: string | null, newValue: string | null, logger?: IContextLogger): Promise<void>;
62
78
  disconnectedCallback(): void;
79
+ private reauctionPaused;
80
+ /**
81
+ * Schedules `callback` to run after `intervalMs`, replacing any pending re-auction.
82
+ * The countdown is paused while the window is blurred or the document is hidden, and
83
+ * resumes with the remaining time once the page regains focus.
84
+ */
85
+ protected scheduleReauction(callback: () => void, intervalMs: number): void;
86
+ protected clearReauction(): void;
87
+ private startReauctionTimer;
88
+ private pauseReauction;
89
+ private resumeReauction;
63
90
  protected initApi(): Promise<void>;
64
91
  protected readBaseAttributes(): asserts this is this & CompletedBaseAttributes;
65
92
  }
@@ -0,0 +1,2 @@
1
+ export type CreativeTypes = 'banners' | 'videos' | 'carousels' | 'dynamic';
2
+ export declare const CreateDebugButton: (type: CreativeTypes, args: Record<string, string>) => HTMLAnchorElement;
@@ -18,6 +18,7 @@ export declare class SurfsideDynamicZone extends CreativeComponent {
18
18
  protected getComponentName(): string;
19
19
  static get observedAttributes(): string[];
20
20
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): Promise<void>;
21
+ disconnectedCallback(): void;
21
22
  render(this: this & CompletedDynamicAttributes): Promise<void>;
22
23
  requestAndRender(this: this & CompletedDynamicAttributes, dynamicZoneRequest: IDynamicZoneRequest): Promise<void>;
23
24
  }
@@ -1,6 +1,5 @@
1
- import { type BaseAttributeNames, CreativeComponent, type InitApi, type CompletedBaseAttributes } from './Creative';
2
- import type { GetUserIdFn } from '@surfside/ads-core-web';
3
- import { type IContextLogger, type ILogger } from '@surfside/ads-core';
1
+ import { type BaseAttributeNames, CreativeComponent, type CompletedBaseAttributes, type ICreativeComponentDependencies } from './Creative';
2
+ import { type IContextLogger } from '@surfside/ads-core';
4
3
  export type CompletedSimpleCreativeAttributes = CompletedBaseAttributes & {
5
4
  width: number;
6
5
  height: number;
@@ -8,12 +7,15 @@ export type CompletedSimpleCreativeAttributes = CompletedBaseAttributes & {
8
7
  export type SimpleCreativeAttributeNames = BaseAttributeNames | 'width' | 'height';
9
8
  export declare const IntValOrThrow: (element: Element, attribute: string, value: string | null) => number;
10
9
  export declare const IntValOr: <T>(element: Element, attribute: string, value: string | null, or: T) => number | T;
10
+ export interface ISimpleCreativeComponentDependencies extends ICreativeComponentDependencies {
11
+ }
11
12
  export declare abstract class SimpleCreativeComponent extends CreativeComponent {
12
13
  protected width?: number | null;
13
14
  protected height?: number | null;
14
- constructor(initApi: InitApi, getUserId: GetUserIdFn, logger?: ILogger);
15
+ constructor(dependencies: ISimpleCreativeComponentDependencies);
15
16
  protected attributesLoaded(): boolean;
16
17
  protected static get observedSimpleAttributes(): string[];
18
+ protected handleSimpleAttributeChange(name: string, oldValue: string | null, newValue: string | null, logger?: IContextLogger): Promise<void>;
17
19
  simpleAttributeChangedCallback(name: string, oldValue: string | null, newValue: string | null, logger?: IContextLogger): Promise<void>;
18
20
  readSimpleAttributes(): asserts this is this & CompletedSimpleCreativeAttributes;
19
21
  }
@@ -1,22 +1,22 @@
1
- import { type ILogger } from '@surfside/ads-core';
2
- import { SimpleCreativeComponent, type CompletedSimpleCreativeAttributes } from './SimpleCreative';
3
- import { type InitApi } from './Creative';
4
- import { type GetUserIdFn } from '@surfside/ads-core-web';
1
+ import { type ISimpleCreativeComponentDependencies, SimpleCreativeComponent, type CompletedSimpleCreativeAttributes } from './SimpleCreative';
5
2
  export type CompletedVideoAttributes = CompletedSimpleCreativeAttributes & {
6
3
  minDuration: number;
7
4
  maxDuration: number;
8
5
  };
6
+ export interface ISurfsideVideoComponentDependencies extends ISimpleCreativeComponentDependencies {
7
+ }
9
8
  export declare class SurfsideVideo extends SimpleCreativeComponent {
10
9
  private _cancellationToken;
11
10
  protected minDuration?: number | null;
12
11
  protected maxDuration?: number | null;
13
12
  private _bounce;
14
13
  static get observedAttributes(): string[];
15
- constructor(initApi: InitApi, getUserId: GetUserIdFn, logger?: ILogger);
14
+ constructor(dependencies: ISurfsideVideoComponentDependencies);
16
15
  protected getComponentName(): string;
17
16
  protected attributesLoaded(): boolean;
18
17
  attributeChangedCallback(this: this, name: string, oldValue: string | null, newValue: string | null): Promise<void>;
19
18
  protected readVideoAttributes(): asserts this is this & CompletedVideoAttributes;
20
19
  connectedCallback(): Promise<void>;
20
+ disconnectedCallback(): void;
21
21
  render(this: this & CompletedVideoAttributes): Promise<void>;
22
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surfside/ads",
3
- "version": "3.6.5",
3
+ "version": "3.7.0-8cd008d7.0",
4
4
  "module": "./lib/esm/index.module.js",
5
5
  "main": "./lib/cjs/index.module.js",
6
6
  "types": "./lib/types/index.module.d.ts",
@@ -35,8 +35,8 @@
35
35
  "typescript": "^5"
36
36
  },
37
37
  "dependencies": {
38
- "@surfside/ads-core": "2.5.0",
39
- "@surfside/ads-core-mock": "0.5.0",
40
- "@surfside/ads-core-web": "0.5.0"
38
+ "@surfside/ads-core": "2.7.0-8cd008d7.0",
39
+ "@surfside/ads-core-mock": "0.8.0-8cd008d7.0",
40
+ "@surfside/ads-core-web": "0.8.0-8cd008d7.0"
41
41
  }
42
42
  }