@surfside/ads 3.6.2 → 3.6.4-4c0a326f.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 (86) hide show
  1. package/lib/cjs/BuildInfo.js +9 -0
  2. package/lib/cjs/BuildInfo.js.map +1 -0
  3. package/lib/cjs/Constants.js +5 -0
  4. package/lib/cjs/Constants.js.map +1 -0
  5. package/lib/cjs/Init.js +130 -0
  6. package/lib/cjs/Init.js.map +1 -0
  7. package/lib/cjs/components/Banner.js +135 -0
  8. package/lib/cjs/components/Banner.js.map +1 -0
  9. package/lib/cjs/components/Card.js +162 -0
  10. package/lib/cjs/components/Card.js.map +1 -0
  11. package/lib/cjs/components/Carousel.js +241 -0
  12. package/lib/cjs/components/Carousel.js.map +1 -0
  13. package/lib/cjs/components/Creative.js +203 -0
  14. package/lib/cjs/components/Creative.js.map +1 -0
  15. package/lib/cjs/components/Dynamic.js +300 -0
  16. package/lib/cjs/components/Dynamic.js.map +1 -0
  17. package/lib/cjs/components/SimpleCreative.js +75 -0
  18. package/lib/cjs/components/SimpleCreative.js.map +1 -0
  19. package/lib/cjs/components/Video.js +134 -0
  20. package/lib/cjs/components/Video.js.map +1 -0
  21. package/lib/cjs/demo/test.js +7 -0
  22. package/lib/cjs/demo/test.js.map +1 -0
  23. package/lib/cjs/index.module.js +107 -0
  24. package/lib/cjs/index.module.js.map +1 -0
  25. package/lib/cjs/index.script.js +102 -0
  26. package/lib/cjs/index.script.js.map +1 -0
  27. package/lib/cjs/index.script.mock.js +154 -0
  28. package/lib/cjs/index.script.mock.js.map +1 -0
  29. package/lib/cjs/service/Init.js +3 -0
  30. package/lib/cjs/service/Init.js.map +1 -0
  31. package/lib/cjs/util/Attributes.js +93 -0
  32. package/lib/cjs/util/Attributes.js.map +1 -0
  33. package/lib/cjs/util/Types.js +3 -0
  34. package/lib/cjs/util/Types.js.map +1 -0
  35. package/lib/esm/BuildInfo.js +6 -0
  36. package/lib/esm/BuildInfo.js.map +1 -0
  37. package/lib/esm/Constants.js +2 -0
  38. package/lib/esm/Constants.js.map +1 -0
  39. package/lib/esm/Init.js +92 -0
  40. package/lib/esm/Init.js.map +1 -0
  41. package/lib/esm/components/Banner.js +131 -0
  42. package/lib/esm/components/Banner.js.map +1 -0
  43. package/lib/esm/components/Card.js +158 -0
  44. package/lib/esm/components/Card.js.map +1 -0
  45. package/lib/esm/components/Carousel.js +237 -0
  46. package/lib/esm/components/Carousel.js.map +1 -0
  47. package/lib/esm/components/Creative.js +198 -0
  48. package/lib/esm/components/Creative.js.map +1 -0
  49. package/lib/esm/components/Dynamic.js +296 -0
  50. package/lib/esm/components/Dynamic.js.map +1 -0
  51. package/lib/esm/components/SimpleCreative.js +69 -0
  52. package/lib/esm/components/SimpleCreative.js.map +1 -0
  53. package/lib/esm/components/Video.js +130 -0
  54. package/lib/esm/components/Video.js.map +1 -0
  55. package/lib/esm/demo/test.js +5 -0
  56. package/lib/esm/demo/test.js.map +1 -0
  57. package/lib/esm/index.module.js +67 -0
  58. package/lib/esm/index.module.js.map +1 -0
  59. package/lib/esm/index.script.js +100 -0
  60. package/lib/esm/index.script.js.map +1 -0
  61. package/lib/esm/index.script.mock.js +152 -0
  62. package/lib/esm/index.script.mock.js.map +1 -0
  63. package/lib/esm/service/Init.js +2 -0
  64. package/lib/esm/service/Init.js.map +1 -0
  65. package/lib/esm/util/Attributes.js +81 -0
  66. package/lib/esm/util/Attributes.js.map +1 -0
  67. package/lib/esm/util/Types.js +2 -0
  68. package/lib/esm/util/Types.js.map +1 -0
  69. package/lib/types/BuildInfo.d.ts +5 -0
  70. package/lib/types/Constants.d.ts +1 -0
  71. package/lib/types/Init.d.ts +31 -0
  72. package/lib/types/components/Banner.d.ts +18 -0
  73. package/lib/types/components/Card.d.ts +17 -0
  74. package/lib/types/components/Carousel.d.ts +31 -0
  75. package/lib/types/components/Creative.d.ts +65 -0
  76. package/lib/types/components/Dynamic.d.ts +23 -0
  77. package/lib/types/components/SimpleCreative.d.ts +19 -0
  78. package/lib/types/components/Video.d.ts +22 -0
  79. package/lib/types/demo/test.d.ts +1 -0
  80. package/lib/types/index.module.d.ts +12 -0
  81. package/lib/types/index.script.d.ts +1 -0
  82. package/lib/types/index.script.mock.d.ts +1 -0
  83. package/lib/types/service/Init.d.ts +1 -0
  84. package/lib/types/util/Attributes.d.ts +24 -0
  85. package/lib/types/util/Types.d.ts +3 -0
  86. package/package.json +10 -10
@@ -0,0 +1,18 @@
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';
5
+ export declare class SurfsideBanner extends SimpleCreativeComponent {
6
+ private _cancellationToken;
7
+ private _nextRender;
8
+ private _bounce;
9
+ static get observedAttributes(): string[];
10
+ constructor(initApi: InitApi, getUserId: GetUserIdFn, logger?: ILogger);
11
+ protected getComponentName(): string;
12
+ attributeChangedCallback(this: this, name: string, oldValue: string | null, newValue: string | null): Promise<void>;
13
+ connectedCallback(): Promise<void>;
14
+ adoptedCallback(): void;
15
+ disconnectedCallback(): void;
16
+ connectedMoveCallback(): void;
17
+ render(this: this & CompletedSimpleCreativeAttributes): Promise<void>;
18
+ }
@@ -0,0 +1,17 @@
1
+ import { type RecommenderType } from '@surfside/ads-core';
2
+ import { type CompletedBaseAttributes, CreativeComponent } from './Creative';
3
+ export type CompletedCardAttributes = CompletedBaseAttributes & {
4
+ strategy: string;
5
+ recommend: string;
6
+ };
7
+ export declare class SurfsideProductCard extends CreativeComponent {
8
+ private _cancellationToken;
9
+ protected recommend: RecommenderType;
10
+ protected strategy: string;
11
+ private _bounce;
12
+ static get observedAttributes(): string[];
13
+ protected getComponentName(): string;
14
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): Promise<void>;
15
+ connectedCallback(): Promise<void>;
16
+ render(this: this & CompletedCardAttributes): Promise<void>;
17
+ }
@@ -0,0 +1,31 @@
1
+ import { type ILogger, type RecommenderType } from '@surfside/ads-core';
2
+ import { type CompletedBaseAttributes, CreativeComponent, type InitApi } from './Creative';
3
+ import { type GetUserIdFn } from '@surfside/ads-core-web';
4
+ export declare const NextType: {
5
+ readonly Product: "product";
6
+ readonly Page: "page";
7
+ };
8
+ export type CompletedCarouselAttributes = CompletedBaseAttributes & {
9
+ maxItems: number | undefined;
10
+ cardMinWidth: number;
11
+ cardMaxWidth: number | undefined;
12
+ strategy: string;
13
+ recommend: string;
14
+ nextType: string;
15
+ };
16
+ export declare class SurfsideCarousel extends CreativeComponent {
17
+ private _cancellationToken;
18
+ private _renderDebounce?;
19
+ protected maxItems?: number | null;
20
+ protected cardMinWidth: number;
21
+ protected cardMaxWidth?: number | null;
22
+ protected strategy: string;
23
+ protected recommend: RecommenderType;
24
+ protected nextType: 'page' | 'product';
25
+ static get observedAttributes(): string[];
26
+ constructor(initApi: InitApi, getUserId: GetUserIdFn, logger?: ILogger);
27
+ protected getComponentName(): string;
28
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): Promise<void>;
29
+ connectedCallback(): Promise<void>;
30
+ render(this: this & CompletedCarouselAttributes): Promise<void>;
31
+ }
@@ -0,0 +1,65 @@
1
+ import { type AsyncResult, type ILogger, type IContextLogger } from '@surfside/ads-core';
2
+ import { type GetUserIdFn, type ISurfsideWebApi } from '@surfside/ads-core-web';
3
+ export type CompletedBaseAttributes = {
4
+ accountId: string;
5
+ siteId: string;
6
+ locationId: string;
7
+ channelId: string;
8
+ zoneId: string;
9
+ keywords: string[];
10
+ api: ISurfsideWebApi;
11
+ };
12
+ export type BaseAttributeNames = 'account-id' | 'site-id' | 'location-id' | 'channel-id' | 'zone-id' | 'keywords' | 'category';
13
+ export type InitApi = (accountId: string, siteId: string, channelId: string, locationId: string, userId: string | undefined, url: string) => AsyncResult<ISurfsideWebApi>;
14
+ export declare const ProductFeedStrategy: {
15
+ readonly Sponsored: "sponsored";
16
+ readonly Hybrid: "hybrid";
17
+ readonly Recommended: "recommended";
18
+ };
19
+ export declare const RecommenderTypeInputs: {
20
+ TopProducts: string;
21
+ ForYou: string;
22
+ BuyAgain: string;
23
+ PastPurchases: string;
24
+ };
25
+ export declare const AttributeValOrThrow: (element: Element, attribute: string, value: string | null) => string;
26
+ export declare const DEBOUNCE_THRESHOLD = 10;
27
+ export declare abstract class CreativeComponent extends HTMLElement {
28
+ private _initApi;
29
+ private _getUserId;
30
+ protected accountId: string | undefined;
31
+ protected siteId: string | undefined;
32
+ protected locationId: string | undefined;
33
+ protected channelId: string | undefined;
34
+ protected zoneId: string | undefined;
35
+ protected category: string[];
36
+ protected keywords: string[];
37
+ protected shadow: ShadowRoot;
38
+ protected api?: ISurfsideWebApi;
39
+ protected log?: IContextLogger;
40
+ protected totem: string | undefined;
41
+ private _stopTimer?;
42
+ protected restartEndToEndTimer: () => void;
43
+ private _instanceId;
44
+ protected get instanceId(): string;
45
+ private readonly _monkeyHistoryReplaceCallback;
46
+ constructor(_initApi: InitApi, _getUserId: GetUserIdFn, logger?: ILogger);
47
+ connectedCallback(): void;
48
+ protected abstract getComponentName(): string;
49
+ protected static get observedBaseAttributes(): string[];
50
+ protected getBaseAttributeValues(): {
51
+ accountId: string | undefined;
52
+ siteId: string | undefined;
53
+ channelId: string | undefined;
54
+ locationId: string | undefined;
55
+ zoneId: string | undefined;
56
+ category: string[];
57
+ keywords: string[];
58
+ };
59
+ protected attributesLoaded(): boolean;
60
+ protected lazyLoadApi(): Promise<void>;
61
+ protected baseAttributeChangedCallback(key: BaseAttributeNames, oldValue: string | null, newValue: string | null, logger?: IContextLogger): Promise<void>;
62
+ disconnectedCallback(): void;
63
+ protected initApi(): Promise<void>;
64
+ protected readBaseAttributes(): asserts this is this & CompletedBaseAttributes;
65
+ }
@@ -0,0 +1,23 @@
1
+ import { type IDynamicZoneRequest, type RecommenderType } from '@surfside/ads-core';
2
+ import { type CompletedBaseAttributes, CreativeComponent } from './Creative';
3
+ export type CompletedDynamicAttributes = CompletedBaseAttributes & {
4
+ maxItems: number | undefined;
5
+ cardMinWidth?: number;
6
+ strategy?: string;
7
+ recommend?: string;
8
+ nextType?: string;
9
+ };
10
+ export declare class SurfsideDynamicZone extends CreativeComponent {
11
+ private _cancellationToken;
12
+ protected maxItems?: number;
13
+ protected cardMinWidth?: number;
14
+ protected strategy?: string;
15
+ protected recommend?: RecommenderType;
16
+ protected nextType?: 'page' | 'product';
17
+ private _bounce;
18
+ protected getComponentName(): string;
19
+ static get observedAttributes(): string[];
20
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): Promise<void>;
21
+ render(this: this & CompletedDynamicAttributes): Promise<void>;
22
+ requestAndRender(this: this & CompletedDynamicAttributes, dynamicZoneRequest: IDynamicZoneRequest): Promise<void>;
23
+ }
@@ -0,0 +1,19 @@
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';
4
+ export type CompletedSimpleCreativeAttributes = CompletedBaseAttributes & {
5
+ width: number;
6
+ height: number;
7
+ };
8
+ export type SimpleCreativeAttributeNames = BaseAttributeNames | 'width' | 'height';
9
+ export declare const IntValOrThrow: (element: Element, attribute: string, value: string | null) => number;
10
+ export declare const IntValOr: <T>(element: Element, attribute: string, value: string | null, or: T) => number | T;
11
+ export declare abstract class SimpleCreativeComponent extends CreativeComponent {
12
+ protected width?: number | null;
13
+ protected height?: number | null;
14
+ constructor(initApi: InitApi, getUserId: GetUserIdFn, logger?: ILogger);
15
+ protected attributesLoaded(): boolean;
16
+ protected static get observedSimpleAttributes(): string[];
17
+ simpleAttributeChangedCallback(name: string, oldValue: string | null, newValue: string | null, logger?: IContextLogger): Promise<void>;
18
+ readSimpleAttributes(): asserts this is this & CompletedSimpleCreativeAttributes;
19
+ }
@@ -0,0 +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';
5
+ export type CompletedVideoAttributes = CompletedSimpleCreativeAttributes & {
6
+ minDuration: number;
7
+ maxDuration: number;
8
+ };
9
+ export declare class SurfsideVideo extends SimpleCreativeComponent {
10
+ private _cancellationToken;
11
+ protected minDuration?: number | null;
12
+ protected maxDuration?: number | null;
13
+ private _bounce;
14
+ static get observedAttributes(): string[];
15
+ constructor(initApi: InitApi, getUserId: GetUserIdFn, logger?: ILogger);
16
+ protected getComponentName(): string;
17
+ protected attributesLoaded(): boolean;
18
+ attributeChangedCallback(this: this, name: string, oldValue: string | null, newValue: string | null): Promise<void>;
19
+ protected readVideoAttributes(): asserts this is this & CompletedVideoAttributes;
20
+ connectedCallback(): Promise<void>;
21
+ render(this: this & CompletedVideoAttributes): Promise<void>;
22
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import { type AsyncResult, type ILogger } from '@surfside/ads-core';
2
+ import { type ISurfsideClientApi } from '@surfside/ads-core-client';
3
+ export * from './Init';
4
+ export type Initializer = (accountId: string, siteId: string, channelId: string, locationId: string, userId: string | undefined, logger?: ILogger) => AsyncResult<ISurfsideClientApi>;
5
+ export declare const InitSurfAdsWebComponents: (initializer?: Initializer) => void;
6
+ export declare const SurfsideAdsVersionTable: {
7
+ [x: string]: {
8
+ buildBranch: string;
9
+ buildHash: string;
10
+ buildVer: string;
11
+ };
12
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ import { type Result } from '@surfside/ads-core';
2
+ export declare const ReadAttribute: (element: Element, attr: string) => Result<string>;
3
+ export declare const ReadNumberAttribute: (element: Element, attr: string) => Result<number>;
4
+ export declare const ReadIntAttribute: (element: Element, attr: string) => Result<number>;
5
+ export declare const ReadBoolAttribute: (element: Element, attr: string) => Result<boolean>;
6
+ export declare class AttributeNotFoundError extends Error {
7
+ element: Element;
8
+ attribute: string;
9
+ constructor(element: Element, attribute: string);
10
+ }
11
+ export declare abstract class AttributeWrongTypeError extends Error {
12
+ element: Element;
13
+ attribute: string;
14
+ constructor(element: Element, attribute: string, message: string);
15
+ }
16
+ export declare class AttributeNotANumberError extends AttributeWrongTypeError {
17
+ constructor(element: Element, attribute: string);
18
+ }
19
+ export declare class AttributeNotBoolError extends AttributeWrongTypeError {
20
+ constructor(element: Element, attribute: string);
21
+ }
22
+ export declare class AttributeNotIntError extends AttributeWrongTypeError {
23
+ constructor(element: Element, attribute: string);
24
+ }
@@ -0,0 +1,3 @@
1
+ export type NoneNullable<T> = {
2
+ [K in keyof T]: NonNullable<T[K]>;
3
+ };
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@surfside/ads",
3
- "version": "3.6.2",
4
- "module": "./lib/esm/index.js",
5
- "main": "./lib/cjs/index.js",
6
- "types": "./lib/types/index.d.ts",
3
+ "version": "3.6.4-4c0a326f.0",
4
+ "module": "./lib/esm/index.module.js",
5
+ "main": "./lib/cjs/index.module.js",
6
+ "types": "./lib/types/index.module.d.ts",
7
7
  "exports": {
8
8
  ".": {
9
- "import": "./lib/esm/index.js",
10
- "require": "./lib/cjs/index.js",
11
- "types": "./lib/types/index.d.ts"
9
+ "import": "./lib/esm/index.module.js",
10
+ "require": "./lib/cjs/index.module.js",
11
+ "types": "./lib/types/index.module.d.ts"
12
12
  }
13
13
  },
14
14
  "license": "UNLICENSED",
@@ -35,8 +35,8 @@
35
35
  "typescript": "^5"
36
36
  },
37
37
  "dependencies": {
38
- "@surfside/ads-core": "2.4.2",
39
- "@surfside/ads-core-mock": "0.4.2",
40
- "@surfside/ads-core-web": "0.4.2"
38
+ "@surfside/ads-core": "2.4.4-4c0a326f.0",
39
+ "@surfside/ads-core-mock": "0.4.4-4c0a326f.0",
40
+ "@surfside/ads-core-web": "0.4.4-4c0a326f.0"
41
41
  }
42
42
  }