@guardian/bridget 1.10.0 → 1.11.1
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/AdSlot.d.ts +3 -0
- package/AdSlot.js +36 -10
- package/package.json +1 -1
package/AdSlot.d.ts
CHANGED
|
@@ -3,15 +3,18 @@ import * as Rect from "./Rect";
|
|
|
3
3
|
export interface IAdSlot {
|
|
4
4
|
rect: Rect.IRect;
|
|
5
5
|
targetingParams?: Map<string, string>;
|
|
6
|
+
isSquare: boolean;
|
|
6
7
|
}
|
|
7
8
|
export interface IAdSlotArgs {
|
|
8
9
|
rect: Rect.IRectArgs;
|
|
9
10
|
targetingParams?: Map<string, string>;
|
|
11
|
+
isSquare: boolean;
|
|
10
12
|
}
|
|
11
13
|
export declare const AdSlotCodec: thrift.IStructCodec<IAdSlotArgs, IAdSlot>;
|
|
12
14
|
export declare class AdSlot extends thrift.StructLike implements IAdSlot {
|
|
13
15
|
rect: Rect.IRect;
|
|
14
16
|
targetingParams?: Map<string, string>;
|
|
17
|
+
isSquare: boolean;
|
|
15
18
|
readonly _annotations: thrift.IThriftAnnotations;
|
|
16
19
|
readonly _fieldAnnotations: thrift.IFieldAnnotations;
|
|
17
20
|
constructor(args: IAdSlotArgs);
|
package/AdSlot.js
CHANGED
|
@@ -19,7 +19,8 @@ exports.AdSlotCodec = {
|
|
|
19
19
|
encode(args, output) {
|
|
20
20
|
const obj = {
|
|
21
21
|
rect: args.rect,
|
|
22
|
-
targetingParams: args.targetingParams
|
|
22
|
+
targetingParams: args.targetingParams,
|
|
23
|
+
isSquare: args.isSquare
|
|
23
24
|
};
|
|
24
25
|
output.writeStructBegin("AdSlot");
|
|
25
26
|
if (obj.rect != null) {
|
|
@@ -40,6 +41,14 @@ exports.AdSlotCodec = {
|
|
|
40
41
|
output.writeMapEnd();
|
|
41
42
|
output.writeFieldEnd();
|
|
42
43
|
}
|
|
44
|
+
if (obj.isSquare != null) {
|
|
45
|
+
output.writeFieldBegin("isSquare", thrift.TType.BOOL, 3);
|
|
46
|
+
output.writeBool(obj.isSquare);
|
|
47
|
+
output.writeFieldEnd();
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[isSquare] is unset!");
|
|
51
|
+
}
|
|
43
52
|
output.writeFieldStop();
|
|
44
53
|
output.writeStructEnd();
|
|
45
54
|
return;
|
|
@@ -81,6 +90,15 @@ exports.AdSlotCodec = {
|
|
|
81
90
|
input.skip(fieldType);
|
|
82
91
|
}
|
|
83
92
|
break;
|
|
93
|
+
case 3:
|
|
94
|
+
if (fieldType === thrift.TType.BOOL) {
|
|
95
|
+
const value_5 = input.readBool();
|
|
96
|
+
_args.isSquare = value_5;
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
input.skip(fieldType);
|
|
100
|
+
}
|
|
101
|
+
break;
|
|
84
102
|
default: {
|
|
85
103
|
input.skip(fieldType);
|
|
86
104
|
}
|
|
@@ -88,10 +106,11 @@ exports.AdSlotCodec = {
|
|
|
88
106
|
input.readFieldEnd();
|
|
89
107
|
}
|
|
90
108
|
input.readStructEnd();
|
|
91
|
-
if (_args.rect !== undefined) {
|
|
109
|
+
if (_args.rect !== undefined && _args.isSquare !== undefined) {
|
|
92
110
|
return {
|
|
93
111
|
rect: _args.rect,
|
|
94
|
-
targetingParams: _args.targetingParams
|
|
112
|
+
targetingParams: _args.targetingParams,
|
|
113
|
+
isSquare: _args.isSquare
|
|
95
114
|
};
|
|
96
115
|
}
|
|
97
116
|
else {
|
|
@@ -105,20 +124,27 @@ class AdSlot extends thrift.StructLike {
|
|
|
105
124
|
this._annotations = {};
|
|
106
125
|
this._fieldAnnotations = {};
|
|
107
126
|
if (args.rect != null) {
|
|
108
|
-
const
|
|
109
|
-
this.rect =
|
|
127
|
+
const value_6 = new Rect.Rect(args.rect);
|
|
128
|
+
this.rect = value_6;
|
|
110
129
|
}
|
|
111
130
|
else {
|
|
112
131
|
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[rect] is unset!");
|
|
113
132
|
}
|
|
114
133
|
if (args.targetingParams != null) {
|
|
115
|
-
const
|
|
116
|
-
args.targetingParams.forEach((
|
|
117
|
-
const
|
|
134
|
+
const value_7 = new Map();
|
|
135
|
+
args.targetingParams.forEach((value_9, key_3) => {
|
|
136
|
+
const value_10 = value_9;
|
|
118
137
|
const key_4 = key_3;
|
|
119
|
-
|
|
138
|
+
value_7.set(key_4, value_10);
|
|
120
139
|
});
|
|
121
|
-
this.targetingParams =
|
|
140
|
+
this.targetingParams = value_7;
|
|
141
|
+
}
|
|
142
|
+
if (args.isSquare != null) {
|
|
143
|
+
const value_8 = args.isSquare;
|
|
144
|
+
this.isSquare = value_8;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[isSquare] is unset!");
|
|
122
148
|
}
|
|
123
149
|
}
|
|
124
150
|
static read(input) {
|