@bannerstudio/angular 0.1.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.
@@ -0,0 +1,36 @@
1
+ import { AfterViewInit, ElementRef, OnChanges, OnDestroy } from '@angular/core';
2
+ import { type BannerType } from '@bannerstudio/core';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Angular standalone component embedding a Banner Studio banner.
6
+ *
7
+ * <banner-studio-embed apiBase="https://api.bannerstud.io" affiliate="acme" type="top" />
8
+ *
9
+ * The banner DOM (a CLS-safe reserved box + scoped iframe) is built imperatively
10
+ * via `@bannerstudio/core`, so there's no template/sanitizer ceremony and the
11
+ * `banner-height` / `banner-empty` / `banner-close` messages are handled for you.
12
+ */
13
+ export declare class BannerStudioEmbedComponent implements AfterViewInit, OnChanges, OnDestroy {
14
+ private readonly host;
15
+ /** Banner Studio API base, e.g. https://api.bannerstud.io */
16
+ apiBase: string;
17
+ /** Affiliate code. */
18
+ affiliate: string;
19
+ /** Embed type (default 'top'). */
20
+ type: BannerType;
21
+ /** Optional placement code. */
22
+ placement?: string;
23
+ /** Optional audience segment for the current visitor (e.g. 'guest', 'pro'). */
24
+ segment?: string;
25
+ /** Reserved height in px — the bounding box that prevents CLS (default 90). */
26
+ height: number;
27
+ private instance;
28
+ private viewReady;
29
+ constructor(host: ElementRef<HTMLElement>);
30
+ ngAfterViewInit(): void;
31
+ ngOnChanges(): void;
32
+ ngOnDestroy(): void;
33
+ private mount;
34
+ static ɵfac: i0.ɵɵFactoryDeclaration<BannerStudioEmbedComponent, never>;
35
+ static ɵcmp: i0.ɵɵComponentDeclaration<BannerStudioEmbedComponent, "banner-studio-embed", never, { "apiBase": { "alias": "apiBase"; "required": false; }; "affiliate": { "alias": "affiliate"; "required": false; }; "type": { "alias": "type"; "required": false; }; "placement": { "alias": "placement"; "required": false; }; "segment": { "alias": "segment"; "required": false; }; "height": { "alias": "height"; "required": false; }; }, {}, never, never, true, never>;
36
+ }
@@ -0,0 +1,83 @@
1
+ import { Component, Input, } from '@angular/core';
2
+ import { createBanner } from '@bannerstudio/core';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Angular standalone component embedding a Banner Studio banner.
6
+ *
7
+ * <banner-studio-embed apiBase="https://api.bannerstud.io" affiliate="acme" type="top" />
8
+ *
9
+ * The banner DOM (a CLS-safe reserved box + scoped iframe) is built imperatively
10
+ * via `@bannerstudio/core`, so there's no template/sanitizer ceremony and the
11
+ * `banner-height` / `banner-empty` / `banner-close` messages are handled for you.
12
+ */
13
+ export class BannerStudioEmbedComponent {
14
+ host;
15
+ /** Banner Studio API base, e.g. https://api.bannerstud.io */
16
+ apiBase = '';
17
+ /** Affiliate code. */
18
+ affiliate = '';
19
+ /** Embed type (default 'top'). */
20
+ type = 'top';
21
+ /** Optional placement code. */
22
+ placement;
23
+ /** Optional audience segment for the current visitor (e.g. 'guest', 'pro'). */
24
+ segment;
25
+ /** Reserved height in px — the bounding box that prevents CLS (default 90). */
26
+ height = 90;
27
+ instance = null;
28
+ viewReady = false;
29
+ constructor(host) {
30
+ this.host = host;
31
+ }
32
+ ngAfterViewInit() {
33
+ this.viewReady = true;
34
+ this.mount();
35
+ }
36
+ ngOnChanges() {
37
+ if (this.viewReady) {
38
+ this.mount();
39
+ }
40
+ }
41
+ ngOnDestroy() {
42
+ this.instance?.destroy();
43
+ this.instance = null;
44
+ }
45
+ mount() {
46
+ this.instance?.destroy();
47
+ this.instance = null;
48
+ if (typeof document === 'undefined' || !this.apiBase || !this.affiliate) {
49
+ return;
50
+ }
51
+ this.instance = createBanner(this.host.nativeElement, {
52
+ apiBase: this.apiBase,
53
+ affiliate: this.affiliate,
54
+ type: this.type,
55
+ placement: this.placement,
56
+ segment: this.segment,
57
+ height: this.height,
58
+ });
59
+ }
60
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: BannerStudioEmbedComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
61
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: BannerStudioEmbedComponent, isStandalone: true, selector: "banner-studio-embed", inputs: { apiBase: "apiBase", affiliate: "affiliate", type: "type", placement: "placement", segment: "segment", height: "height" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true });
62
+ }
63
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: BannerStudioEmbedComponent, decorators: [{
64
+ type: Component,
65
+ args: [{
66
+ selector: 'banner-studio-embed',
67
+ standalone: true,
68
+ template: '',
69
+ }]
70
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { apiBase: [{
71
+ type: Input
72
+ }], affiliate: [{
73
+ type: Input
74
+ }], type: [{
75
+ type: Input
76
+ }], placement: [{
77
+ type: Input
78
+ }], segment: [{
79
+ type: Input
80
+ }], height: [{
81
+ type: Input
82
+ }] } });
83
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFubmVyLXN0dWRpby1lbWJlZC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYmFubmVyLXN0dWRpby1lbWJlZC5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUVMLFNBQVMsRUFFVCxLQUFLLEdBR04sTUFBTSxlQUFlLENBQUE7QUFDdEIsT0FBTyxFQUFFLFlBQVksRUFBd0MsTUFBTSxvQkFBb0IsQ0FBQTs7QUFFdkY7Ozs7Ozs7O0dBUUc7QUFNSCxNQUFNLE9BQU8sMEJBQTBCO0lBaUJSO0lBaEI3Qiw2REFBNkQ7SUFDcEQsT0FBTyxHQUFHLEVBQUUsQ0FBQTtJQUNyQixzQkFBc0I7SUFDYixTQUFTLEdBQUcsRUFBRSxDQUFBO0lBQ3ZCLGtDQUFrQ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ICAgIHRoaXMuaW5zdGFuY2UgPSBjcmVhdGVCYW5uZXIodGhpcy5ob3N0Lm5hdGl2ZUVsZW1lbnQsIHtcbiAgICAgIGFwaUJhc2U6IHRoaXMuYXBpQmFzZSxcbiAgICAgIGFmZmlsaWF0ZTogdGhpcy5hZmZpbGlhdGUsXG4gICAgICB0eXBlOiB0aGlzLnR5cGUsXG4gICAgICBwbGFjZW1lbnQ6IHRoaXMucGxhY2VtZW50LFxuICAgICAgc2VnbWVudDogdGhpcy5zZWdtZW50LFxuICAgICAgaGVpZ2h0OiB0aGlzLmhlaWdodCxcbiAgICB9KVxuICB9XG59XG4iXX0=
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './public-api';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFubmVyc3R1ZGlvLWFuZ3VsYXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYmFubmVyc3R1ZGlvLWFuZ3VsYXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
@@ -0,0 +1,2 @@
1
+ export { BannerStudioEmbedComponent } from './banner-studio-embed.component';
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSwwQkFBMEIsRUFBRSxNQUFNLGlDQUFpQyxDQUFBIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgQmFubmVyU3R1ZGlvRW1iZWRDb21wb25lbnQgfSBmcm9tICcuL2Jhbm5lci1zdHVkaW8tZW1iZWQuY29tcG9uZW50J1xuIl19
@@ -0,0 +1,90 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Input, Component } from '@angular/core';
3
+ import { createBanner } from '@bannerstudio/core';
4
+
5
+ /**
6
+ * Angular standalone component embedding a Banner Studio banner.
7
+ *
8
+ * <banner-studio-embed apiBase="https://api.bannerstud.io" affiliate="acme" type="top" />
9
+ *
10
+ * The banner DOM (a CLS-safe reserved box + scoped iframe) is built imperatively
11
+ * via `@bannerstudio/core`, so there's no template/sanitizer ceremony and the
12
+ * `banner-height` / `banner-empty` / `banner-close` messages are handled for you.
13
+ */
14
+ class BannerStudioEmbedComponent {
15
+ host;
16
+ /** Banner Studio API base, e.g. https://api.bannerstud.io */
17
+ apiBase = '';
18
+ /** Affiliate code. */
19
+ affiliate = '';
20
+ /** Embed type (default 'top'). */
21
+ type = 'top';
22
+ /** Optional placement code. */
23
+ placement;
24
+ /** Optional audience segment for the current visitor (e.g. 'guest', 'pro'). */
25
+ segment;
26
+ /** Reserved height in px — the bounding box that prevents CLS (default 90). */
27
+ height = 90;
28
+ instance = null;
29
+ viewReady = false;
30
+ constructor(host) {
31
+ this.host = host;
32
+ }
33
+ ngAfterViewInit() {
34
+ this.viewReady = true;
35
+ this.mount();
36
+ }
37
+ ngOnChanges() {
38
+ if (this.viewReady) {
39
+ this.mount();
40
+ }
41
+ }
42
+ ngOnDestroy() {
43
+ this.instance?.destroy();
44
+ this.instance = null;
45
+ }
46
+ mount() {
47
+ this.instance?.destroy();
48
+ this.instance = null;
49
+ if (typeof document === 'undefined' || !this.apiBase || !this.affiliate) {
50
+ return;
51
+ }
52
+ this.instance = createBanner(this.host.nativeElement, {
53
+ apiBase: this.apiBase,
54
+ affiliate: this.affiliate,
55
+ type: this.type,
56
+ placement: this.placement,
57
+ segment: this.segment,
58
+ height: this.height,
59
+ });
60
+ }
61
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: BannerStudioEmbedComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
62
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: BannerStudioEmbedComponent, isStandalone: true, selector: "banner-studio-embed", inputs: { apiBase: "apiBase", affiliate: "affiliate", type: "type", placement: "placement", segment: "segment", height: "height" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true });
63
+ }
64
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: BannerStudioEmbedComponent, decorators: [{
65
+ type: Component,
66
+ args: [{
67
+ selector: 'banner-studio-embed',
68
+ standalone: true,
69
+ template: '',
70
+ }]
71
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { apiBase: [{
72
+ type: Input
73
+ }], affiliate: [{
74
+ type: Input
75
+ }], type: [{
76
+ type: Input
77
+ }], placement: [{
78
+ type: Input
79
+ }], segment: [{
80
+ type: Input
81
+ }], height: [{
82
+ type: Input
83
+ }] } });
84
+
85
+ /**
86
+ * Generated bundle index. Do not edit.
87
+ */
88
+
89
+ export { BannerStudioEmbedComponent };
90
+ //# sourceMappingURL=bannerstudio-angular.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bannerstudio-angular.mjs","sources":["../../src/banner-studio-embed.component.ts","../../src/bannerstudio-angular.ts"],"sourcesContent":["import {\n AfterViewInit,\n Component,\n ElementRef,\n Input,\n OnChanges,\n OnDestroy,\n} from '@angular/core'\nimport { createBanner, type BannerInstance, type BannerType } from '@bannerstudio/core'\n\n/**\n * Angular standalone component embedding a Banner Studio banner.\n *\n * <banner-studio-embed apiBase=\"https://api.bannerstud.io\" affiliate=\"acme\" type=\"top\" />\n *\n * The banner DOM (a CLS-safe reserved box + scoped iframe) is built imperatively\n * via `@bannerstudio/core`, so there's no template/sanitizer ceremony and the\n * `banner-height` / `banner-empty` / `banner-close` messages are handled for you.\n */\n@Component({\n selector: 'banner-studio-embed',\n standalone: true,\n template: '',\n})\nexport class BannerStudioEmbedComponent implements AfterViewInit, OnChanges, OnDestroy {\n /** Banner Studio API base, e.g. https://api.bannerstud.io */\n @Input() apiBase = ''\n /** Affiliate code. */\n @Input() affiliate = ''\n /** Embed type (default 'top'). */\n @Input() type: BannerType = 'top'\n /** Optional placement code. */\n @Input() placement?: string\n /** Optional audience segment for the current visitor (e.g. 'guest', 'pro'). */\n @Input() segment?: string\n /** Reserved height in px — the bounding box that prevents CLS (default 90). */\n @Input() height = 90\n\n private instance: BannerInstance | null = null\n private viewReady = false\n\n constructor(private readonly host: ElementRef<HTMLElement>) {}\n\n ngAfterViewInit(): void {\n this.viewReady = true\n this.mount()\n }\n\n ngOnChanges(): void {\n if (this.viewReady) {\n this.mount()\n }\n }\n\n ngOnDestroy(): void {\n this.instance?.destroy()\n this.instance = null\n }\n\n private mount(): void {\n this.instance?.destroy()\n this.instance = null\n if (typeof document === 'undefined' || !this.apiBase || !this.affiliate) {\n return\n }\n this.instance = createBanner(this.host.nativeElement, {\n apiBase: this.apiBase,\n affiliate: this.affiliate,\n type: this.type,\n placement: this.placement,\n segment: this.segment,\n height: this.height,\n })\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAUA;;;;;;;;AAQG;MAMU,0BAA0B,CAAA;AAiBR,IAAA,IAAA;;IAfpB,OAAO,GAAG,EAAE;;IAEZ,SAAS,GAAG,EAAE;;IAEd,IAAI,GAAe,KAAK;;AAExB,IAAA,SAAS;;AAET,IAAA,OAAO;;IAEP,MAAM,GAAG,EAAE;IAEZ,QAAQ,GAA0B,IAAI;IACtC,SAAS,GAAG,KAAK;AAEzB,IAAA,WAAA,CAA6B,IAA6B,EAAA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AA;;4FAED,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBALtC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,qBAAqB;AAC/B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,EAAE;AACb,iBAAA;+EAGU,OAAO,EAAA,CAAA;sBAAf;gBAEQ,SAAS,EAAA,CAAA;sBAAjB;gBAEQ,IAAI,EAAA,CAAA;sBAAZ;gBAEQ,SAAS,EAAA,CAAA;sBAAjB;gBAEQ,OAAO,EAAA,CAAA;sBAAf;gBAEQ,MAAM,EAAA,CAAA;sBAAd;;;ACpCH;;AAEG;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@bannerstudio/angular" />
5
+ export * from './public-api';
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@bannerstudio/angular",
3
+ "version": "0.1.0",
4
+ "description": "Angular component for embedding Banner Studio banners.",
5
+ "license": "MIT",
6
+ "dependencies": {
7
+ "@bannerstudio/core": "^0.1.0",
8
+ "tslib": "^2.6.0"
9
+ },
10
+ "peerDependencies": {
11
+ "@angular/core": ">=16.0.0"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "module": "fesm2022/bannerstudio-angular.mjs",
17
+ "typings": "index.d.ts",
18
+ "exports": {
19
+ "./package.json": {
20
+ "default": "./package.json"
21
+ },
22
+ ".": {
23
+ "types": "./index.d.ts",
24
+ "esm2022": "./esm2022/bannerstudio-angular.mjs",
25
+ "esm": "./esm2022/bannerstudio-angular.mjs",
26
+ "default": "./fesm2022/bannerstudio-angular.mjs"
27
+ }
28
+ },
29
+ "sideEffects": false
30
+ }
@@ -0,0 +1 @@
1
+ export { BannerStudioEmbedComponent } from './banner-studio-embed.component';