@washingtonpost/subs-de-inputs 0.2.0-canary.0 → 0.2.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.
- package/CHANGELOG.md +21 -0
- package/dist/interfaces/index.d.ts +2 -0
- package/dist/services/dataEnrichment.d.ts +2 -1
- package/dist/subs-de-inputs.esm.js +163 -582
- package/dist/subs-de-inputs.esm.js.map +1 -1
- package/package.json +11 -4
- package/dist/index.js +0 -8
- package/dist/subs-de-inputs.cjs.development.js +0 -670
- package/dist/subs-de-inputs.cjs.development.js.map +0 -1
- package/dist/subs-de-inputs.cjs.production.min.js +0 -2
- package/dist/subs-de-inputs.cjs.production.min.js.map +0 -1
|
@@ -1,670 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
|
-
|
|
7
|
-
var subsSdk = require('@washingtonpost/subs-sdk');
|
|
8
|
-
var React = require('react');
|
|
9
|
-
var React__default = _interopDefault(React);
|
|
10
|
-
var wpdsUiKit = require('@washingtonpost/wpds-ui-kit');
|
|
11
|
-
|
|
12
|
-
var CollectionBehaviors = {
|
|
13
|
-
COLLECT: 'COLLECT',
|
|
14
|
-
DO_NOT_COLLECT: 'DO_NOT_COLLECT'
|
|
15
|
-
};
|
|
16
|
-
var AttributesState = {
|
|
17
|
-
SUCCESS: '100'
|
|
18
|
-
};
|
|
19
|
-
var IngestType = {
|
|
20
|
-
EXPLICIT: 'explicit',
|
|
21
|
-
IMPLICIT: 'implicit'
|
|
22
|
-
};
|
|
23
|
-
var IngestResponseState = {
|
|
24
|
-
SUCCESS: '100',
|
|
25
|
-
SYSTEM_ERROR: '101',
|
|
26
|
-
INVALID_TYPE: '102',
|
|
27
|
-
INVALID_IDENTIFIER: '103',
|
|
28
|
-
INVALID_DATA: '104',
|
|
29
|
-
INVALID_ATTRIBUTE_DEFINITION: '105',
|
|
30
|
-
INVALID_META_DEFINITION: '106',
|
|
31
|
-
UNAUTHENTICATED: '107',
|
|
32
|
-
MISMATCHED_IDENTIFIER: '108'
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
var hasRequiredPrivacyCookies = function hasRequiredPrivacyCookies() {
|
|
36
|
-
var _WPGeo;
|
|
37
|
-
if (typeof window === 'undefined') {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
var wp_usp = subsSdk.getCookie('wp_usp');
|
|
41
|
-
var countryCode = (_WPGeo = subsSdk.WPGeo()) == null ? void 0 : _WPGeo.country_code;
|
|
42
|
-
return !!(wp_usp && countryCode === 'US');
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
function _regeneratorRuntime() {
|
|
46
|
-
_regeneratorRuntime = function () {
|
|
47
|
-
return exports;
|
|
48
|
-
};
|
|
49
|
-
var exports = {},
|
|
50
|
-
Op = Object.prototype,
|
|
51
|
-
hasOwn = Op.hasOwnProperty,
|
|
52
|
-
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
53
|
-
obj[key] = desc.value;
|
|
54
|
-
},
|
|
55
|
-
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
56
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
57
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
58
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
59
|
-
function define(obj, key, value) {
|
|
60
|
-
return Object.defineProperty(obj, key, {
|
|
61
|
-
value: value,
|
|
62
|
-
enumerable: !0,
|
|
63
|
-
configurable: !0,
|
|
64
|
-
writable: !0
|
|
65
|
-
}), obj[key];
|
|
66
|
-
}
|
|
67
|
-
try {
|
|
68
|
-
define({}, "");
|
|
69
|
-
} catch (err) {
|
|
70
|
-
define = function (obj, key, value) {
|
|
71
|
-
return obj[key] = value;
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
75
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
76
|
-
generator = Object.create(protoGenerator.prototype),
|
|
77
|
-
context = new Context(tryLocsList || []);
|
|
78
|
-
return defineProperty(generator, "_invoke", {
|
|
79
|
-
value: makeInvokeMethod(innerFn, self, context)
|
|
80
|
-
}), generator;
|
|
81
|
-
}
|
|
82
|
-
function tryCatch(fn, obj, arg) {
|
|
83
|
-
try {
|
|
84
|
-
return {
|
|
85
|
-
type: "normal",
|
|
86
|
-
arg: fn.call(obj, arg)
|
|
87
|
-
};
|
|
88
|
-
} catch (err) {
|
|
89
|
-
return {
|
|
90
|
-
type: "throw",
|
|
91
|
-
arg: err
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
exports.wrap = wrap;
|
|
96
|
-
var ContinueSentinel = {};
|
|
97
|
-
function Generator() {}
|
|
98
|
-
function GeneratorFunction() {}
|
|
99
|
-
function GeneratorFunctionPrototype() {}
|
|
100
|
-
var IteratorPrototype = {};
|
|
101
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
102
|
-
return this;
|
|
103
|
-
});
|
|
104
|
-
var getProto = Object.getPrototypeOf,
|
|
105
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
106
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
107
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
108
|
-
function defineIteratorMethods(prototype) {
|
|
109
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
110
|
-
define(prototype, method, function (arg) {
|
|
111
|
-
return this._invoke(method, arg);
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
116
|
-
function invoke(method, arg, resolve, reject) {
|
|
117
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
118
|
-
if ("throw" !== record.type) {
|
|
119
|
-
var result = record.arg,
|
|
120
|
-
value = result.value;
|
|
121
|
-
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
122
|
-
invoke("next", value, resolve, reject);
|
|
123
|
-
}, function (err) {
|
|
124
|
-
invoke("throw", err, resolve, reject);
|
|
125
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
126
|
-
result.value = unwrapped, resolve(result);
|
|
127
|
-
}, function (error) {
|
|
128
|
-
return invoke("throw", error, resolve, reject);
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
reject(record.arg);
|
|
132
|
-
}
|
|
133
|
-
var previousPromise;
|
|
134
|
-
defineProperty(this, "_invoke", {
|
|
135
|
-
value: function (method, arg) {
|
|
136
|
-
function callInvokeWithMethodAndArg() {
|
|
137
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
138
|
-
invoke(method, arg, resolve, reject);
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
function makeInvokeMethod(innerFn, self, context) {
|
|
146
|
-
var state = "suspendedStart";
|
|
147
|
-
return function (method, arg) {
|
|
148
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
149
|
-
if ("completed" === state) {
|
|
150
|
-
if ("throw" === method) throw arg;
|
|
151
|
-
return doneResult();
|
|
152
|
-
}
|
|
153
|
-
for (context.method = method, context.arg = arg;;) {
|
|
154
|
-
var delegate = context.delegate;
|
|
155
|
-
if (delegate) {
|
|
156
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
157
|
-
if (delegateResult) {
|
|
158
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
159
|
-
return delegateResult;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
163
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
164
|
-
context.dispatchException(context.arg);
|
|
165
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
166
|
-
state = "executing";
|
|
167
|
-
var record = tryCatch(innerFn, self, context);
|
|
168
|
-
if ("normal" === record.type) {
|
|
169
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
170
|
-
return {
|
|
171
|
-
value: record.arg,
|
|
172
|
-
done: context.done
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
180
|
-
var methodName = context.method,
|
|
181
|
-
method = delegate.iterator[methodName];
|
|
182
|
-
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
|
|
183
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
184
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
185
|
-
var info = record.arg;
|
|
186
|
-
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
187
|
-
}
|
|
188
|
-
function pushTryEntry(locs) {
|
|
189
|
-
var entry = {
|
|
190
|
-
tryLoc: locs[0]
|
|
191
|
-
};
|
|
192
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
193
|
-
}
|
|
194
|
-
function resetTryEntry(entry) {
|
|
195
|
-
var record = entry.completion || {};
|
|
196
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
197
|
-
}
|
|
198
|
-
function Context(tryLocsList) {
|
|
199
|
-
this.tryEntries = [{
|
|
200
|
-
tryLoc: "root"
|
|
201
|
-
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
202
|
-
}
|
|
203
|
-
function values(iterable) {
|
|
204
|
-
if (iterable) {
|
|
205
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
206
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
207
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
208
|
-
if (!isNaN(iterable.length)) {
|
|
209
|
-
var i = -1,
|
|
210
|
-
next = function next() {
|
|
211
|
-
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
212
|
-
return next.value = undefined, next.done = !0, next;
|
|
213
|
-
};
|
|
214
|
-
return next.next = next;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
return {
|
|
218
|
-
next: doneResult
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
function doneResult() {
|
|
222
|
-
return {
|
|
223
|
-
value: undefined,
|
|
224
|
-
done: !0
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
228
|
-
value: GeneratorFunctionPrototype,
|
|
229
|
-
configurable: !0
|
|
230
|
-
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
231
|
-
value: GeneratorFunction,
|
|
232
|
-
configurable: !0
|
|
233
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
234
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
235
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
236
|
-
}, exports.mark = function (genFun) {
|
|
237
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
238
|
-
}, exports.awrap = function (arg) {
|
|
239
|
-
return {
|
|
240
|
-
__await: arg
|
|
241
|
-
};
|
|
242
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
243
|
-
return this;
|
|
244
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
245
|
-
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
246
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
247
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
248
|
-
return result.done ? result.value : iter.next();
|
|
249
|
-
});
|
|
250
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
251
|
-
return this;
|
|
252
|
-
}), define(Gp, "toString", function () {
|
|
253
|
-
return "[object Generator]";
|
|
254
|
-
}), exports.keys = function (val) {
|
|
255
|
-
var object = Object(val),
|
|
256
|
-
keys = [];
|
|
257
|
-
for (var key in object) keys.push(key);
|
|
258
|
-
return keys.reverse(), function next() {
|
|
259
|
-
for (; keys.length;) {
|
|
260
|
-
var key = keys.pop();
|
|
261
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
262
|
-
}
|
|
263
|
-
return next.done = !0, next;
|
|
264
|
-
};
|
|
265
|
-
}, exports.values = values, Context.prototype = {
|
|
266
|
-
constructor: Context,
|
|
267
|
-
reset: function (skipTempReset) {
|
|
268
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
269
|
-
},
|
|
270
|
-
stop: function () {
|
|
271
|
-
this.done = !0;
|
|
272
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
273
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
274
|
-
return this.rval;
|
|
275
|
-
},
|
|
276
|
-
dispatchException: function (exception) {
|
|
277
|
-
if (this.done) throw exception;
|
|
278
|
-
var context = this;
|
|
279
|
-
function handle(loc, caught) {
|
|
280
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
281
|
-
}
|
|
282
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
283
|
-
var entry = this.tryEntries[i],
|
|
284
|
-
record = entry.completion;
|
|
285
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
286
|
-
if (entry.tryLoc <= this.prev) {
|
|
287
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
288
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
289
|
-
if (hasCatch && hasFinally) {
|
|
290
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
291
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
292
|
-
} else if (hasCatch) {
|
|
293
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
294
|
-
} else {
|
|
295
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
296
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
},
|
|
301
|
-
abrupt: function (type, arg) {
|
|
302
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
303
|
-
var entry = this.tryEntries[i];
|
|
304
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
305
|
-
var finallyEntry = entry;
|
|
306
|
-
break;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
310
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
311
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
312
|
-
},
|
|
313
|
-
complete: function (record, afterLoc) {
|
|
314
|
-
if ("throw" === record.type) throw record.arg;
|
|
315
|
-
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
316
|
-
},
|
|
317
|
-
finish: function (finallyLoc) {
|
|
318
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
319
|
-
var entry = this.tryEntries[i];
|
|
320
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
321
|
-
}
|
|
322
|
-
},
|
|
323
|
-
catch: function (tryLoc) {
|
|
324
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
325
|
-
var entry = this.tryEntries[i];
|
|
326
|
-
if (entry.tryLoc === tryLoc) {
|
|
327
|
-
var record = entry.completion;
|
|
328
|
-
if ("throw" === record.type) {
|
|
329
|
-
var thrown = record.arg;
|
|
330
|
-
resetTryEntry(entry);
|
|
331
|
-
}
|
|
332
|
-
return thrown;
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
throw new Error("illegal catch attempt");
|
|
336
|
-
},
|
|
337
|
-
delegateYield: function (iterable, resultName, nextLoc) {
|
|
338
|
-
return this.delegate = {
|
|
339
|
-
iterator: values(iterable),
|
|
340
|
-
resultName: resultName,
|
|
341
|
-
nextLoc: nextLoc
|
|
342
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
343
|
-
}
|
|
344
|
-
}, exports;
|
|
345
|
-
}
|
|
346
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
347
|
-
try {
|
|
348
|
-
var info = gen[key](arg);
|
|
349
|
-
var value = info.value;
|
|
350
|
-
} catch (error) {
|
|
351
|
-
reject(error);
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
if (info.done) {
|
|
355
|
-
resolve(value);
|
|
356
|
-
} else {
|
|
357
|
-
Promise.resolve(value).then(_next, _throw);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
function _asyncToGenerator(fn) {
|
|
361
|
-
return function () {
|
|
362
|
-
var self = this,
|
|
363
|
-
args = arguments;
|
|
364
|
-
return new Promise(function (resolve, reject) {
|
|
365
|
-
var gen = fn.apply(self, args);
|
|
366
|
-
function _next(value) {
|
|
367
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
368
|
-
}
|
|
369
|
-
function _throw(err) {
|
|
370
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
371
|
-
}
|
|
372
|
-
_next(undefined);
|
|
373
|
-
});
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
function _extends() {
|
|
377
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
378
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
379
|
-
var source = arguments[i];
|
|
380
|
-
for (var key in source) {
|
|
381
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
382
|
-
target[key] = source[key];
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
return target;
|
|
387
|
-
};
|
|
388
|
-
return _extends.apply(this, arguments);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
var base = subsSdk.ENDPOINTS.base + "/de/v1";
|
|
392
|
-
var attributesCache = {};
|
|
393
|
-
var getAttributes = /*#__PURE__*/function () {
|
|
394
|
-
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
395
|
-
var fieldName, fieldNames, url, data, json, attributes;
|
|
396
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
397
|
-
while (1) switch (_context.prev = _context.next) {
|
|
398
|
-
case 0:
|
|
399
|
-
fieldName = _ref.fieldName;
|
|
400
|
-
if (!attributesCache[fieldName]) {
|
|
401
|
-
_context.next = 3;
|
|
402
|
-
break;
|
|
403
|
-
}
|
|
404
|
-
return _context.abrupt("return", attributesCache[fieldName]);
|
|
405
|
-
case 3:
|
|
406
|
-
fieldNames = [fieldName];
|
|
407
|
-
_context.prev = 4;
|
|
408
|
-
url = new URL(base + "/attributes");
|
|
409
|
-
url.searchParams.set('attributes', fieldNames.join(','));
|
|
410
|
-
_context.next = 9;
|
|
411
|
-
return fetch(url.toString(), {
|
|
412
|
-
credentials: 'include',
|
|
413
|
-
headers: subsSdk.JSON_HEADERS
|
|
414
|
-
});
|
|
415
|
-
case 9:
|
|
416
|
-
data = _context.sent;
|
|
417
|
-
_context.next = 12;
|
|
418
|
-
return data.json();
|
|
419
|
-
case 12:
|
|
420
|
-
json = _context.sent;
|
|
421
|
-
if (!(data.ok && json.status === subsSdk.ResponseStatus.SUCCESS)) {
|
|
422
|
-
_context.next = 19;
|
|
423
|
-
break;
|
|
424
|
-
}
|
|
425
|
-
attributes = json.attributes || [];
|
|
426
|
-
attributesCache[fieldName] = attributes;
|
|
427
|
-
return _context.abrupt("return", attributes);
|
|
428
|
-
case 19:
|
|
429
|
-
return _context.abrupt("return", []);
|
|
430
|
-
case 20:
|
|
431
|
-
_context.next = 26;
|
|
432
|
-
break;
|
|
433
|
-
case 22:
|
|
434
|
-
_context.prev = 22;
|
|
435
|
-
_context.t0 = _context["catch"](4);
|
|
436
|
-
console.debug(_context.t0);
|
|
437
|
-
return _context.abrupt("return", []);
|
|
438
|
-
case 26:
|
|
439
|
-
case "end":
|
|
440
|
-
return _context.stop();
|
|
441
|
-
}
|
|
442
|
-
}, _callee, null, [[4, 22]]);
|
|
443
|
-
}));
|
|
444
|
-
return function getAttributes(_x) {
|
|
445
|
-
return _ref2.apply(this, arguments);
|
|
446
|
-
};
|
|
447
|
-
}();
|
|
448
|
-
var ingest = /*#__PURE__*/function () {
|
|
449
|
-
var _ref4 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref3) {
|
|
450
|
-
var _ref3$submitData, fieldName, value, source, url, wapo_login_id, attributeInfo, jucid, ga, payload, response, json;
|
|
451
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
452
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
453
|
-
case 0:
|
|
454
|
-
_ref3$submitData = _ref3.submitData, fieldName = _ref3$submitData.fieldName, value = _ref3$submitData.value, source = _ref3.source;
|
|
455
|
-
url = base + "/ingest";
|
|
456
|
-
wapo_login_id = subsSdk.getCookie('wapo_login_id');
|
|
457
|
-
if (hasRequiredPrivacyCookies()) {
|
|
458
|
-
_context2.next = 5;
|
|
459
|
-
break;
|
|
460
|
-
}
|
|
461
|
-
throw new Error('does not satisfy cookie check');
|
|
462
|
-
case 5:
|
|
463
|
-
attributeInfo = attributesCache[fieldName];
|
|
464
|
-
if (attributeInfo) {
|
|
465
|
-
_context2.next = 10;
|
|
466
|
-
break;
|
|
467
|
-
}
|
|
468
|
-
_context2.next = 9;
|
|
469
|
-
return getAttributes({
|
|
470
|
-
fieldName: fieldName
|
|
471
|
-
});
|
|
472
|
-
case 9:
|
|
473
|
-
attributeInfo = _context2.sent;
|
|
474
|
-
case 10:
|
|
475
|
-
if (!(attributeInfo[0] && attributeInfo[0].name === fieldName && attributeInfo[0].collection_behavior === CollectionBehaviors.DO_NOT_COLLECT)) {
|
|
476
|
-
_context2.next = 12;
|
|
477
|
-
break;
|
|
478
|
-
}
|
|
479
|
-
throw new Error('do not collect');
|
|
480
|
-
case 12:
|
|
481
|
-
jucid = localStorage.getItem('uuid');
|
|
482
|
-
ga = subsSdk.getCookie('_ga');
|
|
483
|
-
payload = {
|
|
484
|
-
jucid: jucid,
|
|
485
|
-
ga: ga,
|
|
486
|
-
type: IngestType.EXPLICIT,
|
|
487
|
-
wapo_login_id: wapo_login_id,
|
|
488
|
-
data: {
|
|
489
|
-
fieldName: fieldName,
|
|
490
|
-
value: value
|
|
491
|
-
},
|
|
492
|
-
metadata: {
|
|
493
|
-
source: source
|
|
494
|
-
}
|
|
495
|
-
};
|
|
496
|
-
_context2.prev = 15;
|
|
497
|
-
_context2.next = 18;
|
|
498
|
-
return fetch(url, {
|
|
499
|
-
method: 'POST',
|
|
500
|
-
credentials: 'include',
|
|
501
|
-
headers: subsSdk.JSON_HEADERS,
|
|
502
|
-
body: JSON.stringify(payload)
|
|
503
|
-
});
|
|
504
|
-
case 18:
|
|
505
|
-
response = _context2.sent;
|
|
506
|
-
_context2.next = 21;
|
|
507
|
-
return response.json();
|
|
508
|
-
case 21:
|
|
509
|
-
json = _context2.sent;
|
|
510
|
-
return _context2.abrupt("return", json);
|
|
511
|
-
case 25:
|
|
512
|
-
_context2.prev = 25;
|
|
513
|
-
_context2.t0 = _context2["catch"](15);
|
|
514
|
-
console.debug(_context2.t0);
|
|
515
|
-
return _context2.abrupt("return", null);
|
|
516
|
-
case 29:
|
|
517
|
-
case "end":
|
|
518
|
-
return _context2.stop();
|
|
519
|
-
}
|
|
520
|
-
}, _callee2, null, [[15, 25]]);
|
|
521
|
-
}));
|
|
522
|
-
return function ingest(_x2) {
|
|
523
|
-
return _ref4.apply(this, arguments);
|
|
524
|
-
};
|
|
525
|
-
}();
|
|
526
|
-
|
|
527
|
-
var DESelect = function DESelect(_ref) {
|
|
528
|
-
var source = _ref.source,
|
|
529
|
-
fieldName = _ref.fieldName,
|
|
530
|
-
label = _ref.label,
|
|
531
|
-
dataDictionaryConfig = _ref.dataDictionaryConfig,
|
|
532
|
-
defaultValue = _ref.defaultValue,
|
|
533
|
-
disabled = _ref.disabled,
|
|
534
|
-
submit = _ref.submit,
|
|
535
|
-
_ref$onChange = _ref.onChange,
|
|
536
|
-
onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
537
|
-
_ref$onFinished = _ref.onFinished,
|
|
538
|
-
onFinished = _ref$onFinished === void 0 ? function () {} : _ref$onFinished,
|
|
539
|
-
_ref$valuesFilter = _ref.valuesFilter,
|
|
540
|
-
valuesFilter = _ref$valuesFilter === void 0 ? function () {
|
|
541
|
-
return true;
|
|
542
|
-
} : _ref$valuesFilter,
|
|
543
|
-
children = _ref.children;
|
|
544
|
-
var _useState = React.useState(dataDictionaryConfig),
|
|
545
|
-
config = _useState[0],
|
|
546
|
-
setConfig = _useState[1];
|
|
547
|
-
var _useState2 = React.useState(''),
|
|
548
|
-
selected = _useState2[0],
|
|
549
|
-
setSelected = _useState2[1];
|
|
550
|
-
React.useEffect(function () {
|
|
551
|
-
if (children) {
|
|
552
|
-
if (process.env.NODE_ENV !== "production") {
|
|
553
|
-
console.debug('childen props', children);
|
|
554
|
-
}
|
|
555
|
-
return;
|
|
556
|
-
}
|
|
557
|
-
if (!config) {
|
|
558
|
-
_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
559
|
-
var config;
|
|
560
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
561
|
-
while (1) switch (_context.prev = _context.next) {
|
|
562
|
-
case 0:
|
|
563
|
-
_context.next = 2;
|
|
564
|
-
return getAttributes({
|
|
565
|
-
fieldName: fieldName
|
|
566
|
-
});
|
|
567
|
-
case 2:
|
|
568
|
-
config = _context.sent;
|
|
569
|
-
if (process.env.NODE_ENV !== "production") {
|
|
570
|
-
console.debug('config from API', config);
|
|
571
|
-
}
|
|
572
|
-
setConfig(config[0]);
|
|
573
|
-
case 5:
|
|
574
|
-
case "end":
|
|
575
|
-
return _context.stop();
|
|
576
|
-
}
|
|
577
|
-
}, _callee);
|
|
578
|
-
}))();
|
|
579
|
-
}
|
|
580
|
-
}, []);
|
|
581
|
-
React.useEffect(function () {
|
|
582
|
-
_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
583
|
-
var result, isError;
|
|
584
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
585
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
586
|
-
case 0:
|
|
587
|
-
if (!(submit && selected)) {
|
|
588
|
-
_context2.next = 6;
|
|
589
|
-
break;
|
|
590
|
-
}
|
|
591
|
-
_context2.next = 3;
|
|
592
|
-
return ingest({
|
|
593
|
-
submitData: {
|
|
594
|
-
fieldName: fieldName,
|
|
595
|
-
value: selected
|
|
596
|
-
},
|
|
597
|
-
source: source
|
|
598
|
-
});
|
|
599
|
-
case 3:
|
|
600
|
-
result = _context2.sent;
|
|
601
|
-
isError = result ? result.status !== subsSdk.ResponseStatus.SUCCESS : true;
|
|
602
|
-
onFinished({
|
|
603
|
-
isFinished: true,
|
|
604
|
-
isError: isError
|
|
605
|
-
});
|
|
606
|
-
case 6:
|
|
607
|
-
case "end":
|
|
608
|
-
return _context2.stop();
|
|
609
|
-
}
|
|
610
|
-
}, _callee2);
|
|
611
|
-
}))();
|
|
612
|
-
}, [submit, selected]);
|
|
613
|
-
if (!(children || config)) {
|
|
614
|
-
return React__default.createElement("span", null, "loading");
|
|
615
|
-
}
|
|
616
|
-
var defaultValueProp = defaultValue ? {
|
|
617
|
-
defaultValue: defaultValue
|
|
618
|
-
} : {};
|
|
619
|
-
var disabledProp = disabled ? {
|
|
620
|
-
disabled: true
|
|
621
|
-
} : {};
|
|
622
|
-
// sort and filter out archived values
|
|
623
|
-
var values = config ? config.values.sort(function (a, b) {
|
|
624
|
-
return a.order - b.order;
|
|
625
|
-
}).filter(function (value) {
|
|
626
|
-
return value.archived !== true;
|
|
627
|
-
}).filter(valuesFilter) : [];
|
|
628
|
-
return React__default.createElement(SelectWrapper, null, React__default.createElement(wpdsUiKit.Select.Root, _extends({
|
|
629
|
-
onValueChange: function onValueChange(e) {
|
|
630
|
-
onChange({
|
|
631
|
-
value: e
|
|
632
|
-
});
|
|
633
|
-
setSelected(e);
|
|
634
|
-
}
|
|
635
|
-
}, defaultValueProp, disabledProp), children ? children : null, !children && config && React__default.createElement(React__default.Fragment, null, React__default.createElement(wpdsUiKit.Select.Trigger, {
|
|
636
|
-
"data-test-id": config.name + "-select-trigger"
|
|
637
|
-
}, React__default.createElement(wpdsUiKit.Select.Label, null, label || config.name), React__default.createElement(wpdsUiKit.Select.Value, null)), React__default.createElement(wpdsUiKit.Select.Content, {
|
|
638
|
-
css: {
|
|
639
|
-
zIndex: wpdsUiKit.theme.zIndices.page
|
|
640
|
-
},
|
|
641
|
-
"data-test-id": config.name + "-select-content"
|
|
642
|
-
}, values.map(function (value) {
|
|
643
|
-
return React__default.createElement(wpdsUiKit.Select.Item, {
|
|
644
|
-
value: value.name,
|
|
645
|
-
key: value.name
|
|
646
|
-
}, value.name);
|
|
647
|
-
})))));
|
|
648
|
-
};
|
|
649
|
-
var SelectWrapper = /*#__PURE__*/wpdsUiKit.styled('div', {
|
|
650
|
-
boxSizing: 'border-box',
|
|
651
|
-
display: 'flex',
|
|
652
|
-
marginBottom: '$100',
|
|
653
|
-
flexDirection: 'column',
|
|
654
|
-
'& button': {
|
|
655
|
-
padding: '1px 6px'
|
|
656
|
-
},
|
|
657
|
-
'& *': {
|
|
658
|
-
boxSizing: 'border-box'
|
|
659
|
-
}
|
|
660
|
-
});
|
|
661
|
-
|
|
662
|
-
exports.AttributesState = AttributesState;
|
|
663
|
-
exports.CollectionBehaviors = CollectionBehaviors;
|
|
664
|
-
exports.DESelect = DESelect;
|
|
665
|
-
exports.IngestResponseState = IngestResponseState;
|
|
666
|
-
exports.IngestType = IngestType;
|
|
667
|
-
exports.getAttributes = getAttributes;
|
|
668
|
-
exports.hasRequiredPrivacyCookies = hasRequiredPrivacyCookies;
|
|
669
|
-
exports.ingest = ingest;
|
|
670
|
-
//# sourceMappingURL=subs-de-inputs.cjs.development.js.map
|