@openfeature/web-sdk 0.0.2-experimental

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,598 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
+ var __export = (target, all) => {
24
+ for (var name in all)
25
+ __defProp(target, name, { get: all[name], enumerable: true });
26
+ };
27
+ var __copyProps = (to, from, except, desc) => {
28
+ if (from && typeof from === "object" || typeof from === "function") {
29
+ for (let key of __getOwnPropNames(from))
30
+ if (!__hasOwnProp.call(to, key) && key !== except)
31
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
32
+ }
33
+ return to;
34
+ };
35
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
+ var __async = (__this, __arguments, generator) => {
37
+ return new Promise((resolve, reject) => {
38
+ var fulfilled = (value) => {
39
+ try {
40
+ step(generator.next(value));
41
+ } catch (e) {
42
+ reject(e);
43
+ }
44
+ };
45
+ var rejected = (value) => {
46
+ try {
47
+ step(generator.throw(value));
48
+ } catch (e) {
49
+ reject(e);
50
+ }
51
+ };
52
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
53
+ step((generator = generator.apply(__this, __arguments)).next());
54
+ });
55
+ };
56
+
57
+ // src/index.ts
58
+ var src_exports = {};
59
+ __export(src_exports, {
60
+ ApiEvents: () => ApiEvents,
61
+ DefaultLogger: () => DefaultLogger,
62
+ ErrorCode: () => ErrorCode,
63
+ FlagNotFoundError: () => FlagNotFoundError,
64
+ GeneralError: () => GeneralError,
65
+ InvalidContextError: () => InvalidContextError,
66
+ NOOP_PROVIDER: () => NOOP_PROVIDER,
67
+ NOOP_TRANSACTION_CONTEXT_PROPAGATOR: () => NOOP_TRANSACTION_CONTEXT_PROPAGATOR,
68
+ OpenFeature: () => OpenFeature,
69
+ OpenFeatureAPI: () => OpenFeatureAPI,
70
+ OpenFeatureClient: () => OpenFeatureClient,
71
+ OpenFeatureCommonAPI: () => OpenFeatureCommonAPI,
72
+ OpenFeatureError: () => OpenFeatureError,
73
+ ParseError: () => ParseError,
74
+ ProviderEvents: () => ProviderEvents,
75
+ SafeLogger: () => SafeLogger,
76
+ StandardResolutionReasons: () => StandardResolutionReasons,
77
+ TargetingKeyMissingError: () => TargetingKeyMissingError,
78
+ TypeMismatchError: () => TypeMismatchError
79
+ });
80
+ module.exports = __toCommonJS(src_exports);
81
+
82
+ // ../shared/src/types.ts
83
+ var ProviderEvents = /* @__PURE__ */ ((ProviderEvents2) => {
84
+ ProviderEvents2["Ready"] = "PROVIDER_READY";
85
+ ProviderEvents2["Error"] = "PROVIDER_ERROR";
86
+ ProviderEvents2["ConfigurationChanged"] = "PROVIDER_CONFIGURATION_CHANGED";
87
+ ProviderEvents2["Shutdown"] = "PROVIDER_SHUTDOWN";
88
+ return ProviderEvents2;
89
+ })(ProviderEvents || {});
90
+ var ApiEvents = /* @__PURE__ */ ((ApiEvents2) => {
91
+ ApiEvents2["ProviderChanged"] = "providerChanged";
92
+ return ApiEvents2;
93
+ })(ApiEvents || {});
94
+ var StandardResolutionReasons = {
95
+ /**
96
+ * The resolved value was the result of a dynamic evaluation, such as a rule or specific user-targeting.
97
+ */
98
+ TARGETING_MATCH: "TARGETING_MATCH",
99
+ /**
100
+ * The resolved value was the result of pseudorandom assignment.
101
+ */
102
+ SPLIT: "SPLIT",
103
+ /**
104
+ * The resolved value was the result of the flag being disabled in the management system.
105
+ */
106
+ DISABLED: "DISABLED",
107
+ /**
108
+ * The resolved value was configured statically, or otherwise fell back to a pre-configured value.
109
+ */
110
+ DEFAULT: "DEFAULT",
111
+ /**
112
+ * The reason for the resolved value could not be determined.
113
+ */
114
+ UNKNOWN: "UNKNOWN",
115
+ /**
116
+ * The resolved value is static (no dynamic evaluation).
117
+ */
118
+ STATIC: "STATIC",
119
+ /**
120
+ * The resolved value was retrieved from cache.
121
+ */
122
+ CACHED: "CACHED",
123
+ /**
124
+ * The resolved value was the result of an error.
125
+ *
126
+ * Note: The `errorCode` and `errorMessage` fields may contain additional details of this error.
127
+ */
128
+ ERROR: "ERROR"
129
+ };
130
+ var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
131
+ ErrorCode2["PROVIDER_NOT_READY"] = "PROVIDER_NOT_READY";
132
+ ErrorCode2["FLAG_NOT_FOUND"] = "FLAG_NOT_FOUND";
133
+ ErrorCode2["PARSE_ERROR"] = "PARSE_ERROR";
134
+ ErrorCode2["TYPE_MISMATCH"] = "TYPE_MISMATCH";
135
+ ErrorCode2["TARGETING_KEY_MISSING"] = "TARGETING_KEY_MISSING";
136
+ ErrorCode2["INVALID_CONTEXT"] = "INVALID_CONTEXT";
137
+ ErrorCode2["GENERAL"] = "GENERAL";
138
+ return ErrorCode2;
139
+ })(ErrorCode || {});
140
+
141
+ // ../shared/src/errors/open-feature-error-abstract.ts
142
+ var OpenFeatureError = class extends Error {
143
+ constructor(message) {
144
+ super(message);
145
+ Object.setPrototypeOf(this, OpenFeatureError.prototype);
146
+ this.name = "OpenFeatureError";
147
+ }
148
+ };
149
+
150
+ // ../shared/src/errors/general-error.ts
151
+ var GeneralError = class extends OpenFeatureError {
152
+ constructor(message) {
153
+ super(message);
154
+ Object.setPrototypeOf(this, GeneralError.prototype);
155
+ this.name = "GeneralError";
156
+ this.code = "GENERAL" /* GENERAL */;
157
+ }
158
+ };
159
+
160
+ // ../shared/src/errors/flag-not-found-error.ts
161
+ var FlagNotFoundError = class extends OpenFeatureError {
162
+ constructor(message) {
163
+ super(message);
164
+ Object.setPrototypeOf(this, FlagNotFoundError.prototype);
165
+ this.name = "FlagNotFoundError";
166
+ this.code = "FLAG_NOT_FOUND" /* FLAG_NOT_FOUND */;
167
+ }
168
+ };
169
+
170
+ // ../shared/src/errors/parse-error.ts
171
+ var ParseError = class extends OpenFeatureError {
172
+ constructor(message) {
173
+ super(message);
174
+ Object.setPrototypeOf(this, ParseError.prototype);
175
+ this.name = "ParseError";
176
+ this.code = "PARSE_ERROR" /* PARSE_ERROR */;
177
+ }
178
+ };
179
+
180
+ // ../shared/src/errors/type-mismatch-error.ts
181
+ var TypeMismatchError = class extends OpenFeatureError {
182
+ constructor(message) {
183
+ super(message);
184
+ Object.setPrototypeOf(this, TypeMismatchError.prototype);
185
+ this.name = "TypeMismatchError";
186
+ this.code = "TYPE_MISMATCH" /* TYPE_MISMATCH */;
187
+ }
188
+ };
189
+
190
+ // ../shared/src/errors/targeting-key-missing-error.ts
191
+ var TargetingKeyMissingError = class extends OpenFeatureError {
192
+ constructor(message) {
193
+ super(message);
194
+ Object.setPrototypeOf(this, TargetingKeyMissingError.prototype);
195
+ this.name = "TargetingKeyMissingError";
196
+ this.code = "TARGETING_KEY_MISSING" /* TARGETING_KEY_MISSING */;
197
+ }
198
+ };
199
+
200
+ // ../shared/src/errors/invalid-context-error.ts
201
+ var InvalidContextError = class extends OpenFeatureError {
202
+ constructor(message) {
203
+ super(message);
204
+ Object.setPrototypeOf(this, InvalidContextError.prototype);
205
+ this.name = "InvalidContextError";
206
+ this.code = "INVALID_CONTEXT" /* INVALID_CONTEXT */;
207
+ }
208
+ };
209
+
210
+ // ../shared/src/logger.ts
211
+ var LOG_LEVELS = ["error", "warn", "info", "debug"];
212
+ var DefaultLogger = class {
213
+ error(...args) {
214
+ console.error(...args);
215
+ }
216
+ warn(...args) {
217
+ console.warn(...args);
218
+ }
219
+ info() {
220
+ }
221
+ debug() {
222
+ }
223
+ };
224
+ var SafeLogger = class {
225
+ constructor(logger) {
226
+ this.fallbackLogger = new DefaultLogger();
227
+ try {
228
+ for (const level of LOG_LEVELS) {
229
+ if (!logger[level] || typeof logger[level] !== "function") {
230
+ throw new Error(`The provided logger is missing the ${level} method.`);
231
+ }
232
+ }
233
+ this.logger = logger;
234
+ } catch (err) {
235
+ console.error(err);
236
+ console.error("Falling back to the default logger.");
237
+ this.logger = this.fallbackLogger;
238
+ }
239
+ }
240
+ error(...args) {
241
+ this.log("error", ...args);
242
+ }
243
+ warn(...args) {
244
+ this.log("warn", ...args);
245
+ }
246
+ info(...args) {
247
+ this.log("info", ...args);
248
+ }
249
+ debug(...args) {
250
+ this.log("debug", ...args);
251
+ }
252
+ log(level, ...args) {
253
+ try {
254
+ this.logger[level](...args);
255
+ } catch (error) {
256
+ this.fallbackLogger[level](...args);
257
+ }
258
+ }
259
+ };
260
+
261
+ // ../shared/src/no-op-transaction-context-propagator.ts
262
+ var NoopTransactionContextPropagator = class {
263
+ getTransactionContext() {
264
+ return {};
265
+ }
266
+ setTransactionContext(_, callback) {
267
+ callback();
268
+ }
269
+ };
270
+ var NOOP_TRANSACTION_CONTEXT_PROPAGATOR = new NoopTransactionContextPropagator();
271
+
272
+ // ../shared/src/open-feature.ts
273
+ var OpenFeatureCommonAPI = class {
274
+ constructor() {
275
+ this._transactionContextPropagator = NOOP_TRANSACTION_CONTEXT_PROPAGATOR;
276
+ this._context = {};
277
+ this._logger = new DefaultLogger();
278
+ }
279
+ getContext() {
280
+ return this._context;
281
+ }
282
+ setTransactionContextPropagator(transactionContextPropagator) {
283
+ const baseMessage = "Invalid TransactionContextPropagator, will not be set: ";
284
+ if (typeof (transactionContextPropagator == null ? void 0 : transactionContextPropagator.getTransactionContext) !== "function") {
285
+ this._logger.error(`${baseMessage}: getTransactionContext is not a function.`);
286
+ } else if (typeof (transactionContextPropagator == null ? void 0 : transactionContextPropagator.setTransactionContext) !== "function") {
287
+ this._logger.error(`${baseMessage}: setTransactionContext is not a function.`);
288
+ } else {
289
+ this._transactionContextPropagator = transactionContextPropagator;
290
+ }
291
+ return this;
292
+ }
293
+ setTransactionContext(transactionContext, callback, ...args) {
294
+ this._transactionContextPropagator.setTransactionContext(transactionContext, callback, ...args);
295
+ }
296
+ getTransactionContext() {
297
+ try {
298
+ return this._transactionContextPropagator.getTransactionContext();
299
+ } catch (err) {
300
+ const error = err;
301
+ this._logger.error(`Error getting transaction context: ${error == null ? void 0 : error.message}, returning empty context.`);
302
+ this._logger.error(error == null ? void 0 : error.stack);
303
+ return {};
304
+ }
305
+ }
306
+ };
307
+
308
+ // src/no-op-provider.ts
309
+ var REASON_NO_OP = "No-op";
310
+ var NoopFeatureProvider = class {
311
+ constructor() {
312
+ this.metadata = {
313
+ name: "No-op Provider"
314
+ };
315
+ }
316
+ resolveBooleanEvaluation(_, defaultValue) {
317
+ return this.noOp(defaultValue);
318
+ }
319
+ resolveStringEvaluation(_, defaultValue) {
320
+ return this.noOp(defaultValue);
321
+ }
322
+ resolveNumberEvaluation(_, defaultValue) {
323
+ return this.noOp(defaultValue);
324
+ }
325
+ resolveObjectEvaluation(_, defaultValue) {
326
+ return this.noOp(defaultValue);
327
+ }
328
+ noOp(defaultValue) {
329
+ return {
330
+ value: defaultValue,
331
+ reason: REASON_NO_OP
332
+ };
333
+ }
334
+ };
335
+ var NOOP_PROVIDER = new NoopFeatureProvider();
336
+
337
+ // src/open-feature.ts
338
+ var GLOBAL_OPENFEATURE_API_KEY = Symbol.for("@openfeature/js.api");
339
+ var _globalThis = globalThis;
340
+ var OpenFeatureAPI = class extends OpenFeatureCommonAPI {
341
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
342
+ constructor() {
343
+ super();
344
+ this._hooks = [];
345
+ this._provider = NOOP_PROVIDER;
346
+ }
347
+ /**
348
+ * Gets a singleton instance of the OpenFeature API.
349
+ *
350
+ * @ignore
351
+ * @returns {OpenFeatureAPI} OpenFeature API
352
+ */
353
+ static getInstance() {
354
+ const globalApi = _globalThis[GLOBAL_OPENFEATURE_API_KEY];
355
+ if (globalApi) {
356
+ return globalApi;
357
+ }
358
+ const instance = new OpenFeatureAPI();
359
+ _globalThis[GLOBAL_OPENFEATURE_API_KEY] = instance;
360
+ return instance;
361
+ }
362
+ /**
363
+ * Get metadata about registered provider.
364
+ *
365
+ * @returns {ProviderMetadata} Provider Metadata
366
+ */
367
+ get providerMetadata() {
368
+ return this._provider.metadata;
369
+ }
370
+ setLogger(logger) {
371
+ this._logger = new SafeLogger(logger);
372
+ return this;
373
+ }
374
+ addHooks(...hooks) {
375
+ this._hooks = [...this._hooks, ...hooks];
376
+ return this;
377
+ }
378
+ getHooks() {
379
+ return this._hooks;
380
+ }
381
+ clearHooks() {
382
+ this._hooks = [];
383
+ return this;
384
+ }
385
+ setContext(context) {
386
+ return __async(this, null, function* () {
387
+ var _a, _b;
388
+ const oldContext = this._context;
389
+ this._context = context;
390
+ yield (_b = (_a = this._provider) == null ? void 0 : _a.onContextChange) == null ? void 0 : _b.call(_a, oldContext, context);
391
+ });
392
+ }
393
+ setProvider(provider) {
394
+ var _a;
395
+ if (this._provider !== provider) {
396
+ const oldProvider = this._provider;
397
+ this._provider = provider;
398
+ window.dispatchEvent(new CustomEvent("providerChanged" /* ProviderChanged */));
399
+ (_a = oldProvider == null ? void 0 : oldProvider.onClose) == null ? void 0 : _a.call(oldProvider);
400
+ }
401
+ return this;
402
+ }
403
+ close() {
404
+ return __async(this, null, function* () {
405
+ var _a, _b;
406
+ yield (_b = (_a = this == null ? void 0 : this._provider) == null ? void 0 : _a.onClose) == null ? void 0 : _b.call(_a);
407
+ });
408
+ }
409
+ getClient(name, version, context) {
410
+ return new OpenFeatureClient(
411
+ () => this._provider,
412
+ () => this._logger,
413
+ { name, version },
414
+ context
415
+ );
416
+ }
417
+ };
418
+ var OpenFeature = OpenFeatureAPI.getInstance();
419
+
420
+ // src/client.ts
421
+ var OpenFeatureClient = class {
422
+ constructor(providerAccessor, globalLogger, options, context = {}) {
423
+ this.providerAccessor = providerAccessor;
424
+ this.globalLogger = globalLogger;
425
+ this._hooks = [];
426
+ this._handlerWrappers = [];
427
+ this.metadata = {
428
+ name: options.name,
429
+ version: options.version
430
+ };
431
+ this._context = context;
432
+ this.attachListeners();
433
+ window.dispatchEvent(new CustomEvent("providerChanged" /* ProviderChanged */));
434
+ }
435
+ addHandler(eventType, handler) {
436
+ this._handlerWrappers.push({ eventType, handler });
437
+ if (eventType === "PROVIDER_READY" /* Ready */ && this.providerAccessor().ready) {
438
+ handler();
439
+ }
440
+ }
441
+ setLogger(logger) {
442
+ this._clientLogger = new SafeLogger(logger);
443
+ return this;
444
+ }
445
+ addHooks(...hooks) {
446
+ this._hooks = [...this._hooks, ...hooks];
447
+ return this;
448
+ }
449
+ getHooks() {
450
+ return this._hooks;
451
+ }
452
+ clearHooks() {
453
+ this._hooks = [];
454
+ return this;
455
+ }
456
+ getBooleanValue(flagKey, defaultValue, context, options) {
457
+ return this.getBooleanDetails(flagKey, defaultValue, context, options).value;
458
+ }
459
+ getBooleanDetails(flagKey, defaultValue, context, options) {
460
+ return this.evaluate(
461
+ flagKey,
462
+ this._provider.resolveBooleanEvaluation,
463
+ defaultValue,
464
+ "boolean",
465
+ context,
466
+ options
467
+ );
468
+ }
469
+ getStringValue(flagKey, defaultValue, context, options) {
470
+ return this.getStringDetails(flagKey, defaultValue, context, options).value;
471
+ }
472
+ getStringDetails(flagKey, defaultValue, context, options) {
473
+ return this.evaluate(
474
+ flagKey,
475
+ // this isolates providers from our restricted string generic argument.
476
+ this._provider.resolveStringEvaluation,
477
+ defaultValue,
478
+ "string",
479
+ context,
480
+ options
481
+ );
482
+ }
483
+ getNumberValue(flagKey, defaultValue, context, options) {
484
+ return this.getNumberDetails(flagKey, defaultValue, context, options).value;
485
+ }
486
+ getNumberDetails(flagKey, defaultValue, context, options) {
487
+ return this.evaluate(
488
+ flagKey,
489
+ // this isolates providers from our restricted number generic argument.
490
+ this._provider.resolveNumberEvaluation,
491
+ defaultValue,
492
+ "number",
493
+ context,
494
+ options
495
+ );
496
+ }
497
+ getObjectValue(flagKey, defaultValue, context, options) {
498
+ return this.getObjectDetails(flagKey, defaultValue, context, options).value;
499
+ }
500
+ getObjectDetails(flagKey, defaultValue, context, options) {
501
+ return this.evaluate(flagKey, this._provider.resolveObjectEvaluation, defaultValue, "object", context, options);
502
+ }
503
+ evaluate(flagKey, resolver, defaultValue, flagType, invocationContext = {}, options = {}) {
504
+ const allHooks = [
505
+ ...OpenFeature.getHooks(),
506
+ ...this.getHooks(),
507
+ ...options.hooks || [],
508
+ ...this._provider.hooks || []
509
+ ];
510
+ const allHooksReversed = [...allHooks].reverse();
511
+ const mergedContext = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, OpenFeature.getContext()), OpenFeature.getTransactionContext()), this._context), invocationContext);
512
+ const hookContext = {
513
+ flagKey,
514
+ defaultValue,
515
+ flagValueType: flagType,
516
+ clientMetadata: this.metadata,
517
+ providerMetadata: OpenFeature.providerMetadata,
518
+ context: mergedContext,
519
+ logger: this._logger
520
+ };
521
+ try {
522
+ const frozenContext = this.beforeHooks(allHooks, hookContext, options);
523
+ const resolution = resolver.call(this._provider, flagKey, defaultValue, frozenContext, this._logger);
524
+ const evaluationDetails = __spreadProps(__spreadValues({}, resolution), {
525
+ flagKey
526
+ });
527
+ this.afterHooks(allHooksReversed, hookContext, evaluationDetails, options);
528
+ return evaluationDetails;
529
+ } catch (err) {
530
+ const errorMessage = err == null ? void 0 : err.message;
531
+ const errorCode = (err == null ? void 0 : err.code) || "GENERAL" /* GENERAL */;
532
+ this.errorHooks(allHooksReversed, hookContext, err, options);
533
+ return {
534
+ errorCode,
535
+ errorMessage,
536
+ value: defaultValue,
537
+ reason: StandardResolutionReasons.ERROR,
538
+ flagKey
539
+ };
540
+ } finally {
541
+ this.finallyHooks(allHooksReversed, hookContext, options);
542
+ }
543
+ }
544
+ beforeHooks(hooks, hookContext, options) {
545
+ var _a;
546
+ for (const hook of hooks) {
547
+ Object.freeze(hookContext);
548
+ Object.assign(hookContext.context, __spreadValues(__spreadValues({}, hookContext.context), (_a = hook == null ? void 0 : hook.before) == null ? void 0 : _a.call(hook, hookContext, Object.freeze(options.hookHints))));
549
+ }
550
+ return Object.freeze(hookContext.context);
551
+ }
552
+ afterHooks(hooks, hookContext, evaluationDetails, options) {
553
+ var _a;
554
+ for (const hook of hooks) {
555
+ (_a = hook == null ? void 0 : hook.after) == null ? void 0 : _a.call(hook, hookContext, evaluationDetails, options.hookHints);
556
+ }
557
+ }
558
+ errorHooks(hooks, hookContext, err, options) {
559
+ var _a;
560
+ for (const hook of hooks) {
561
+ try {
562
+ (_a = hook == null ? void 0 : hook.error) == null ? void 0 : _a.call(hook, hookContext, err, options.hookHints);
563
+ } catch (err2) {
564
+ this._logger.error(`Unhandled error during 'error' hook: ${err2}`);
565
+ if (err2 instanceof Error) {
566
+ this._logger.error(err2.stack);
567
+ }
568
+ this._logger.error(err2 == null ? void 0 : err2.stack);
569
+ }
570
+ }
571
+ }
572
+ finallyHooks(hooks, hookContext, options) {
573
+ var _a;
574
+ for (const hook of hooks) {
575
+ try {
576
+ (_a = hook == null ? void 0 : hook.finally) == null ? void 0 : _a.call(hook, hookContext, options.hookHints);
577
+ } catch (err) {
578
+ this._logger.error(`Unhandled error during 'finally' hook: ${err}`);
579
+ if (err instanceof Error) {
580
+ this._logger.error(err.stack);
581
+ }
582
+ this._logger.error(err == null ? void 0 : err.stack);
583
+ }
584
+ }
585
+ }
586
+ get _provider() {
587
+ return this.providerAccessor();
588
+ }
589
+ get _logger() {
590
+ return this._clientLogger || this.globalLogger();
591
+ }
592
+ attachListeners() {
593
+ Object.values(ProviderEvents).forEach((eventType) => window.addEventListener(eventType, () => {
594
+ this._handlerWrappers.filter((wrapper) => wrapper.eventType === eventType).forEach((wrapper) => wrapper.handler());
595
+ }));
596
+ }
597
+ };
598
+ //# sourceMappingURL=index.js.map