@learncard/chapi-plugin 1.0.26 → 1.0.28

Sign up to get free protection for your applications and to get access to all the features.
@@ -257,7 +257,9 @@ var Injector = class {
257
257
  throw new TypeError("`name` must be a non-empty string.");
258
258
  }
259
259
  if (!(definition && typeof definition === "object" && Array.isArray(definition.functions))) {
260
- throw new TypeError("`definition.function` must be an array of function names or function definition objects to be defined.");
260
+ throw new TypeError(
261
+ "`definition.function` must be an array of function names or function definition objects to be defined."
262
+ );
261
263
  }
262
264
  const self = this;
263
265
  const api = {};
@@ -266,7 +268,11 @@ var Injector = class {
266
268
  fn = { name: fn, options: {} };
267
269
  }
268
270
  api[fn.name] = async function() {
269
- return self.client.send(name + "." + fn.name, [...arguments], fn.options);
271
+ return self.client.send(
272
+ name + "." + fn.name,
273
+ [...arguments],
274
+ fn.options
275
+ );
270
276
  };
271
277
  });
272
278
  self._apis[name] = api;
@@ -443,13 +449,17 @@ var WebApp = class {
443
449
  }
444
450
  async show() {
445
451
  if (!this._connected) {
446
- throw new Error('Cannot "show" yet; not connected. Did you call ".connect()"?');
452
+ throw new Error(
453
+ 'Cannot "show" yet; not connected. Did you call ".connect()"?'
454
+ );
447
455
  }
448
456
  return this._control.show();
449
457
  }
450
458
  async hide() {
451
459
  if (!this._connected) {
452
- throw new Error('Cannot "hide" yet; not connected. Did you call ".connect()?"');
460
+ throw new Error(
461
+ 'Cannot "hide" yet; not connected. Did you call ".connect()?"'
462
+ );
453
463
  }
454
464
  return this._control.hide();
455
465
  }
@@ -523,9 +533,11 @@ var WebAppWindowInlineDialog = class extends WebAppWindowDialog {
523
533
  this.dialog.className = this.dialog.className + " " + className;
524
534
  }
525
535
  const style = document.createElement("style");
526
- style.appendChild(document.createTextNode(`dialog.web-app-window::backdrop {
536
+ style.appendChild(
537
+ document.createTextNode(`dialog.web-app-window::backdrop {
527
538
  background-color: transparent;
528
- }`));
539
+ }`)
540
+ );
529
541
  this.container = document.createElement("div");
530
542
  applyStyle(this.container, {
531
543
  position: "relative",
@@ -708,7 +720,13 @@ var WebAppWindow = class {
708
720
  this.dialog = dialog = handle._dialog;
709
721
  }
710
722
  this._private._readyPromise = new Promise((resolve, reject) => {
711
- this._timeoutId = setTimeout(() => reject(new DOMException("Loading Web application window timed out.", "TimeoutError")), timeout);
723
+ this._timeoutId = setTimeout(
724
+ () => reject(new DOMException(
725
+ "Loading Web application window timed out.",
726
+ "TimeoutError"
727
+ )),
728
+ timeout
729
+ );
712
730
  this._private._resolveReady = (value) => {
713
731
  clearTimeout(this.timeoutId);
714
732
  this._timeoutId = null;
@@ -725,7 +743,10 @@ var WebAppWindow = class {
725
743
  };
726
744
  this._private.destroy = () => {
727
745
  if (this._timeoutId) {
728
- this._private._rejectReady(new DOMException("Web application window closed before ready.", "AbortError"));
746
+ this._private._rejectReady(new DOMException(
747
+ "Web application window closed before ready.",
748
+ "AbortError"
749
+ ));
729
750
  }
730
751
  if (!this._destroyed) {
731
752
  this.dialog.destroy();
@@ -929,10 +950,20 @@ var CredentialHandlerService = class {
929
950
  this._credentialHandler = credentialHandler;
930
951
  }
931
952
  async request(credentialRequestEvent) {
932
- return await this._credentialHandler._emitter.emit(new CredentialRequestEvent(Object.assign({ credentialHandler: this._credentialHandler }, credentialRequestEvent)));
953
+ return await this._credentialHandler._emitter.emit(
954
+ new CredentialRequestEvent(Object.assign(
955
+ { credentialHandler: this._credentialHandler },
956
+ credentialRequestEvent
957
+ ))
958
+ );
933
959
  }
934
960
  async store(credentialStoreEvent) {
935
- return await this._credentialHandler._emitter.emit(new CredentialStoreEvent(Object.assign({ credentialHandler: this._credentialHandler }, credentialStoreEvent)));
961
+ return await this._credentialHandler._emitter.emit(
962
+ new CredentialStoreEvent(Object.assign(
963
+ { credentialHandler: this._credentialHandler },
964
+ credentialStoreEvent
965
+ ))
966
+ );
936
967
  }
937
968
  };
938
969
  __name(CredentialHandlerService, "CredentialHandlerService");
@@ -947,7 +978,12 @@ var CredentialHandler = class extends WebApp {
947
978
  super(mediatorOrigin, inline);
948
979
  this._emitter = new EventEmitter({
949
980
  async waitUntil(event) {
950
- return event._promise || Promise.reject(new DOMException('No "credentialrequest" event handler found.', "NotFoundError"));
981
+ return event._promise || Promise.reject(
982
+ new DOMException(
983
+ 'No "credentialrequest" event handler found.',
984
+ "NotFoundError"
985
+ )
986
+ );
951
987
  }
952
988
  });
953
989
  }
@@ -959,13 +995,19 @@ var CredentialHandler = class extends WebApp {
959
995
  }
960
996
  addEventListener(eventType, fn) {
961
997
  if (!EVENT_TYPES.includes(eventType)) {
962
- throw new DOMException(`Unsupported event type "${eventType}"`, "NotSupportedError");
998
+ throw new DOMException(
999
+ `Unsupported event type "${eventType}"`,
1000
+ "NotSupportedError"
1001
+ );
963
1002
  }
964
1003
  return this._emitter.addEventListener(eventType, fn);
965
1004
  }
966
1005
  removeEventListener(eventType, fn) {
967
1006
  if (!EVENT_TYPES.includes(eventType)) {
968
- throw new DOMException(`Unsupported event type "${eventType}"`, "NotSupportedError");
1007
+ throw new DOMException(
1008
+ `Unsupported event type "${eventType}"`,
1009
+ "NotSupportedError"
1010
+ );
969
1011
  }
970
1012
  return this._emitter.removeEventListener(eventType, fn);
971
1013
  }
@@ -1032,7 +1074,9 @@ var CredentialManager = class {
1032
1074
  this.hints = new CredentialHints(url, injector);
1033
1075
  }
1034
1076
  static async requestPermission() {
1035
- const status = await navigator.credentialsPolyfill.permissions.request({ name: "credentialhandler" });
1077
+ const status = await navigator.credentialsPolyfill.permissions.request(
1078
+ { name: "credentialhandler" }
1079
+ );
1036
1080
  return status.state;
1037
1081
  }
1038
1082
  };
@@ -1090,7 +1134,9 @@ var CredentialHandlers = class {
1090
1134
  return await this._remote.hasRegistration("credential", url);
1091
1135
  }
1092
1136
  _deprecateNotice() {
1093
- console.warn('Credential handler registration APIs are deprecated. The credential handler specified in "manifest.json" is now automatically registered when a user grants permission to install a credential handler via "CredentialManager.requestPermission()".');
1137
+ console.warn(
1138
+ 'Credential handler registration APIs are deprecated. The credential handler specified in "manifest.json" is now automatically registered when a user grants permission to install a credential handler via "CredentialManager.requestPermission()".'
1139
+ );
1094
1140
  }
1095
1141
  };
1096
1142
  __name(CredentialHandlers, "CredentialHandlers");
@@ -1211,7 +1257,9 @@ async function load(options = {
1211
1257
  } else if (options && typeof options === "object" && typeof options.mediatorOrigin === "string") {
1212
1258
  mediatorUrl = `${options.mediatorOrigin}/mediator`;
1213
1259
  } else {
1214
- throw new Error('"options.mediatorOrigin" must be a string expressing the origin of the mediator.');
1260
+ throw new Error(
1261
+ '"options.mediatorOrigin" must be a string expressing the origin of the mediator.'
1262
+ );
1215
1263
  }
1216
1264
  const appContext = new WebAppContext();
1217
1265
  const injector = appContext.createWindow(mediatorUrl, {
@@ -1219,9 +1267,11 @@ async function load(options = {
1219
1267
  timeout: 3e4
1220
1268
  });
1221
1269
  const style = document.createElement("style");
1222
- style.appendChild(document.createTextNode(`dialog.web-app-window.credential-mediator > .web-app-window-backdrop {
1270
+ style.appendChild(document.createTextNode(
1271
+ `dialog.web-app-window.credential-mediator > .web-app-window-backdrop {
1223
1272
  background-color: rgba(0, 0, 0, 0.25);
1224
- }`));
1273
+ }`
1274
+ ));
1225
1275
  document.body.appendChild(style);
1226
1276
  const polyfill = {};
1227
1277
  polyfill.permissions = new PermissionManager(injector);
@@ -1232,8 +1282,12 @@ async function load(options = {
1232
1282
  polyfill.WebCredential = WebCredential2;
1233
1283
  navigator.credentialsPolyfill = polyfill;
1234
1284
  if ("credentials" in navigator) {
1235
- navigator.credentials.get = polyfill.credentials.get.bind(polyfill.credentials);
1236
- navigator.credentials.store = polyfill.credentials.store.bind(polyfill.credentials);
1285
+ navigator.credentials.get = polyfill.credentials.get.bind(
1286
+ polyfill.credentials
1287
+ );
1288
+ navigator.credentials.store = polyfill.credentials.store.bind(
1289
+ polyfill.credentials
1290
+ );
1237
1291
  } else {
1238
1292
  navigator.credentials = polyfill.credentials;
1239
1293
  }
@@ -1263,7 +1317,7 @@ function _assertSecureContext() {
1263
1317
  }
1264
1318
  __name(_assertSecureContext, "_assertSecureContext");
1265
1319
 
1266
- // ../../../node_modules/.pnpm/web-credential-handler@2.0.0/node_modules/web-credential-handler/CredentialEventProxy.js
1320
+ // ../../../node_modules/.pnpm/web-credential-handler@2.0.2/node_modules/web-credential-handler/CredentialEventProxy.js
1267
1321
  var PROXY_EVENT_TIMEOUT = 6e4;
1268
1322
  var CredentialEventProxy = class extends WebApp {
1269
1323
  constructor() {
@@ -1297,7 +1351,7 @@ var CredentialEventProxy = class extends WebApp {
1297
1351
  };
1298
1352
  __name(CredentialEventProxy, "CredentialEventProxy");
1299
1353
 
1300
- // ../../../node_modules/.pnpm/web-credential-handler@2.0.0/node_modules/web-credential-handler/index.js
1354
+ // ../../../node_modules/.pnpm/web-credential-handler@2.0.2/node_modules/web-credential-handler/index.js
1301
1355
  var DEFAULT_MEDIATOR = "https://authn.io";
1302
1356
  async function installHandler() {
1303
1357
  const CredentialManager2 = navigator.credentialsPolyfill.CredentialManager;
@@ -1344,7 +1398,9 @@ __name(listener, "listener");
1344
1398
  async function createResponse({ event, get, store }) {
1345
1399
  const result = await (get || store)({ event });
1346
1400
  if (!(result && typeof result === "object")) {
1347
- throw new TypeError('Return value of "get" or "store" hook must be an object.');
1401
+ throw new TypeError(
1402
+ 'Return value of "get" or "store" hook must be an object.'
1403
+ );
1348
1404
  }
1349
1405
  if (result.type === "response") {
1350
1406
  return { dataType: result.dataType, data: result.data };
@@ -1369,7 +1425,9 @@ async function createResponse({ event, get, store }) {
1369
1425
  hintKey: event.hintKey
1370
1426
  });
1371
1427
  }
1372
- throw new Error('Return value of "get" or "store" must have a type of "response" or "redirect".');
1428
+ throw new Error(
1429
+ 'Return value of "get" or "store" must have a type of "response" or "redirect".'
1430
+ );
1373
1431
  }
1374
1432
  __name(createResponse, "createResponse");
1375
1433
 
@@ -1409,7 +1467,9 @@ var getCHAPIPlugin = /* @__PURE__ */ __name(async () => {
1409
1467
  methods: {
1410
1468
  installChapiHandler: async () => installHandler(),
1411
1469
  activateChapiHandler: async (_learnCard, {
1412
- mediatorOrigin = `https://authn.io/mediator?${encodeURIComponent(window.location.origin)}`,
1470
+ mediatorOrigin = `https://authn.io/mediator?${encodeURIComponent(
1471
+ window.location.origin
1472
+ )}`,
1413
1473
  get,
1414
1474
  store
1415
1475
  }) => {