@interopio/browser 3.1.2 → 3.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.
@@ -73,10 +73,8 @@ const enterprise = (config) => {
73
73
  libraries: (_a = config === null || config === void 0 ? void 0 : config.libraries) !== null && _a !== void 0 ? _a : [],
74
74
  logger: (_c = (_b = config === null || config === void 0 ? void 0 : config.systemLogger) === null || _b === void 0 ? void 0 : _b.level) !== null && _c !== void 0 ? _c : "warn"
75
75
  };
76
- if (window.glue42gd) {
77
- return window.Glue(enterpriseConfig);
78
- }
79
- return window.Glue(enterpriseConfig);
76
+ const injectedFactory = window.IODesktop || window.Glue;
77
+ return injectedFactory(enterpriseConfig);
80
78
  };
81
79
 
82
80
  /**
@@ -1800,7 +1798,7 @@ class FDC3Service {
1800
1798
  isFdc3Definition(definition) {
1801
1799
  const decodeRes = allDefinitionsDecoder.run(definition);
1802
1800
  if (!decodeRes.ok) {
1803
- return { isFdc3: false };
1801
+ return { isFdc3: false, reason: parseDecoderErrorToStringMessage(decodeRes.error) };
1804
1802
  }
1805
1803
  if (definition.appId && definition.details) {
1806
1804
  return { isFdc3: true, version: "2.0" };
@@ -1808,7 +1806,7 @@ class FDC3Service {
1808
1806
  if (definition.manifest) {
1809
1807
  return { isFdc3: true, version: "1.2" };
1810
1808
  }
1811
- return { isFdc3: false };
1809
+ return { isFdc3: false, reason: "The passed definition is not FDC3" };
1812
1810
  }
1813
1811
  parseToBrowserBaseAppData(definition) {
1814
1812
  var _a;
@@ -1979,9 +1977,27 @@ const decoders$1 = {
1979
1977
  }
1980
1978
  };
1981
1979
 
1980
+ var INTENTS_ERRORS;
1981
+ (function (INTENTS_ERRORS) {
1982
+ INTENTS_ERRORS["USER_CANCELLED"] = "User Closed Intents Resolver UI without choosing a handler";
1983
+ INTENTS_ERRORS["CALLER_NOT_DEFINED"] = "Caller Id is not defined";
1984
+ INTENTS_ERRORS["TIMEOUT_HIT"] = "Timeout hit";
1985
+ INTENTS_ERRORS["INTENT_NOT_FOUND"] = "Cannot find Intent";
1986
+ INTENTS_ERRORS["HANDLER_NOT_FOUND"] = "Cannot find Intent Handler";
1987
+ INTENTS_ERRORS["TARGET_INSTANCE_UNAVAILABLE"] = "Cannot start Target Instance";
1988
+ INTENTS_ERRORS["INTENT_DELIVERY_FAILED"] = "Target Instance did not add a listener";
1989
+ INTENTS_ERRORS["RESOLVER_UNAVAILABLE"] = "Intents Resolver UI unavailable";
1990
+ INTENTS_ERRORS["RESOLVER_TIMEOUT"] = "User did not choose a handler";
1991
+ INTENTS_ERRORS["INVALID_RESOLVER_RESPONSE"] = "Intents Resolver UI returned invalid response";
1992
+ INTENTS_ERRORS["INTENT_HANDLER_REJECTION"] = "Intent Handler function processing the raised intent threw an error or rejected the promise it returned";
1993
+ })(INTENTS_ERRORS || (INTENTS_ERRORS = {}));
1994
+
1982
1995
  let IoC$1 = class IoC {
1983
1996
  constructor() {
1984
1997
  this._decoders = decoders$1;
1998
+ this._errors = {
1999
+ intents: INTENTS_ERRORS
2000
+ };
1985
2001
  }
1986
2002
  get fdc3() {
1987
2003
  if (!this._fdc3) {
@@ -1992,20 +2008,24 @@ let IoC$1 = class IoC {
1992
2008
  get decoders() {
1993
2009
  return this._decoders;
1994
2010
  }
2011
+ get errors() {
2012
+ return this._errors;
2013
+ }
1995
2014
  };
1996
2015
 
1997
2016
  const ioc = new IoC$1();
1998
2017
  ioc.fdc3;
1999
2018
  const decoders = ioc.decoders;
2019
+ ioc.errors;
2000
2020
 
2001
2021
  const nonEmptyStringDecoder = string$1().where((s) => s.length > 0, "Expected a non-empty string");
2002
2022
  const nonNegativeNumberDecoder = number$1().where((num) => num >= 0, "Expected a non-negative number");
2003
2023
  const optionalNonEmptyStringDecoder = optional$1(nonEmptyStringDecoder);
2004
- const libDomainDecoder = oneOf$1(constant$1("system"), constant$1("windows"), constant$1("appManager"), constant$1("layouts"), constant$1("intents"), constant$1("notifications"), constant$1("channels"), constant$1("extension"), constant$1("themes"));
2024
+ const libDomainDecoder = oneOf$1(constant$1("system"), constant$1("windows"), constant$1("appManager"), constant$1("layouts"), constant$1("intents"), constant$1("notifications"), constant$1("channels"), constant$1("extension"), constant$1("themes"), constant$1("prefs"));
2005
2025
  const windowOperationTypesDecoder = oneOf$1(constant$1("openWindow"), constant$1("windowHello"), constant$1("windowAdded"), constant$1("windowRemoved"), constant$1("getBounds"), constant$1("getFrameBounds"), constant$1("getUrl"), constant$1("moveResize"), constant$1("focus"), constant$1("close"), constant$1("getTitle"), constant$1("setTitle"), constant$1("focusChange"), constant$1("getChannel"));
2006
2026
  const appManagerOperationTypesDecoder = oneOf$1(constant$1("appHello"), constant$1("appDirectoryStateChange"), constant$1("instanceStarted"), constant$1("instanceStopped"), constant$1("applicationStart"), constant$1("instanceStop"), constant$1("clear"));
2007
2027
  const layoutsOperationTypesDecoder = oneOf$1(constant$1("layoutAdded"), constant$1("layoutChanged"), constant$1("layoutRemoved"), constant$1("get"), constant$1("getAll"), constant$1("export"), constant$1("import"), constant$1("remove"), constant$1("clientSaveRequest"), constant$1("getGlobalPermissionState"), constant$1("checkGlobalActivated"), constant$1("requestGlobalPermission"), constant$1("getDefaultGlobal"), constant$1("setDefaultGlobal"), constant$1("clearDefaultGlobal"));
2008
- const notificationsOperationTypesDecoder = oneOf$1(constant$1("raiseNotification"), constant$1("requestPermission"), constant$1("notificationShow"), constant$1("notificationClick"), constant$1("getPermission"), constant$1("list"), constant$1("notificationRaised"), constant$1("notificationClosed"), constant$1("click"), constant$1("clear"), constant$1("clearAll"));
2028
+ const notificationsOperationTypesDecoder = oneOf$1(constant$1("raiseNotification"), constant$1("requestPermission"), constant$1("notificationShow"), constant$1("notificationClick"), constant$1("getPermission"), constant$1("list"), constant$1("notificationRaised"), constant$1("notificationClosed"), constant$1("click"), constant$1("clear"), constant$1("clearAll"), constant$1("configure"), constant$1("getConfiguration"), constant$1("configurationChanged"), constant$1("setState"), constant$1("clearOld"), constant$1("activeCountChange"), constant$1("stateChange"));
2009
2029
  const systemOperationTypesDecoder = oneOf$1(constant$1("getEnvironment"), constant$1("getBase"), constant$1("platformShutdown"));
2010
2030
  const windowRelativeDirectionDecoder = oneOf$1(constant$1("top"), constant$1("left"), constant$1("right"), constant$1("bottom"));
2011
2031
  const windowBoundsDecoder = object$1({
@@ -2332,7 +2352,7 @@ const optionalSimpleLayoutResult = object$1({
2332
2352
  const setDefaultGlobalConfigDecoder = object$1({
2333
2353
  name: nonEmptyStringDecoder
2334
2354
  });
2335
- const intentsOperationTypesDecoder = oneOf$1(constant$1("findIntent"), constant$1("getIntents"), constant$1("raiseIntent"), constant$1("raise"));
2355
+ const intentsOperationTypesDecoder = oneOf$1(constant$1("findIntent"), constant$1("getIntents"), constant$1("raiseIntent"), constant$1("raise"), constant$1("filterHandlers"));
2336
2356
  const intentHandlerDecoder = object$1({
2337
2357
  applicationName: nonEmptyStringDecoder,
2338
2358
  applicationTitle: optional$1(string$1()),
@@ -2389,20 +2409,36 @@ const intentRequestDecoder = object$1({
2389
2409
  waitUserResponseIndefinitely: optional$1(boolean$1())
2390
2410
  });
2391
2411
  const raiseRequestDecoder = oneOf$1(nonEmptyStringDecoder, intentRequestDecoder);
2392
- const intentRequestResolverConfigDecoder = object$1({
2412
+ const resolverConfigDecoder = object$1({
2393
2413
  enabled: boolean$1(),
2394
2414
  appName: nonEmptyStringDecoder,
2395
2415
  waitResponseTimeout: number$1()
2396
2416
  });
2397
2417
  const raiseIntentRequestDecoder = object$1({
2398
2418
  intentRequest: intentRequestDecoder,
2399
- resolverConfig: intentRequestResolverConfigDecoder
2419
+ resolverConfig: resolverConfigDecoder
2400
2420
  });
2401
2421
  const intentResultDecoder = object$1({
2402
2422
  request: intentRequestDecoder,
2403
2423
  handler: intentHandlerDecoder,
2404
2424
  result: anyJson$1()
2405
2425
  });
2426
+ const handlersFilterDecoder = object$1({
2427
+ title: optional$1(nonEmptyStringDecoder),
2428
+ openResolver: optional$1(boolean$1()),
2429
+ timeout: optional$1(nonNegativeNumberDecoder),
2430
+ intent: optional$1(nonEmptyStringDecoder),
2431
+ contextTypes: optional$1(array$1(nonEmptyStringDecoder)),
2432
+ resultType: optional$1(nonEmptyStringDecoder),
2433
+ applicationNames: optional$1(array$1(nonEmptyStringDecoder))
2434
+ });
2435
+ const filterHandlersResultDecoder = object$1({
2436
+ handlers: array$1(intentHandlerDecoder)
2437
+ });
2438
+ const filterHandlersWithResolverConfigDecoder = object$1({
2439
+ filterHandlersRequest: handlersFilterDecoder,
2440
+ resolverConfig: resolverConfigDecoder
2441
+ });
2406
2442
  const AddIntentListenerRequestDecoder = object$1({
2407
2443
  intent: nonEmptyStringDecoder,
2408
2444
  contextTypes: optional$1(array$1(nonEmptyStringDecoder)),
@@ -2412,6 +2448,17 @@ const AddIntentListenerRequestDecoder = object$1({
2412
2448
  resultType: optional$1(string$1())
2413
2449
  });
2414
2450
  const AddIntentListenerDecoder = oneOf$1(nonEmptyStringDecoder, AddIntentListenerRequestDecoder);
2451
+ const intentInfoDecoder = object$1({
2452
+ intent: nonEmptyStringDecoder,
2453
+ contextTypes: optional$1(array$1(nonEmptyStringDecoder)),
2454
+ description: optional$1(nonEmptyStringDecoder),
2455
+ displayName: optional$1(nonEmptyStringDecoder),
2456
+ icon: optional$1(nonEmptyStringDecoder),
2457
+ resultType: optional$1(nonEmptyStringDecoder)
2458
+ });
2459
+ const getIntentsResultDecoder = object$1({
2460
+ intents: array$1(intentInfoDecoder)
2461
+ });
2415
2462
  const channelNameDecoder = (channelNames) => {
2416
2463
  return nonEmptyStringDecoder.where(s => channelNames.includes(s), "Expected a valid channel name");
2417
2464
  };
@@ -2426,6 +2473,10 @@ const glue42NotificationActionDecoder = object$1({
2426
2473
  icon: optional$1(string$1()),
2427
2474
  interop: optional$1(interopActionSettingsDecoder)
2428
2475
  });
2476
+ const notificationStateDecoder = oneOf$1(constant$1("Active"), constant$1("Acknowledged"), constant$1("Seen"), constant$1("Closed"), constant$1("Stale"), constant$1("Snoozed"), constant$1("Processing"));
2477
+ const activeNotificationsCountChangeDecoder = object$1({
2478
+ count: number$1()
2479
+ });
2429
2480
  const notificationDefinitionDecoder = object$1({
2430
2481
  badge: optional$1(string$1()),
2431
2482
  body: optional$1(string$1()),
@@ -2461,7 +2512,12 @@ const glue42NotificationOptionsDecoder = object$1({
2461
2512
  vibrate: optional$1(array$1(number$1())),
2462
2513
  severity: optional$1(oneOf$1(constant$1("Low"), constant$1("None"), constant$1("Medium"), constant$1("High"), constant$1("Critical"))),
2463
2514
  showToast: optional$1(boolean$1()),
2464
- showInPanel: optional$1(boolean$1())
2515
+ showInPanel: optional$1(boolean$1()),
2516
+ state: optional$1(notificationStateDecoder)
2517
+ });
2518
+ const notificationSetStateRequestDecoder = object$1({
2519
+ id: nonEmptyStringDecoder,
2520
+ state: notificationStateDecoder
2465
2521
  });
2466
2522
  const channelContextDecoder = object$1({
2467
2523
  name: nonEmptyStringDecoder,
@@ -2488,6 +2544,28 @@ const notificationEventPayloadDecoder = object$1({
2488
2544
  action: optional$1(string$1()),
2489
2545
  id: optional$1(nonEmptyStringDecoder)
2490
2546
  });
2547
+ const notificationFilterDecoder = object$1({
2548
+ allowed: optional$1(array$1(nonEmptyStringDecoder)),
2549
+ blocked: optional$1(array$1(nonEmptyStringDecoder))
2550
+ });
2551
+ const notificationsConfigurationDecoder = object$1({
2552
+ enable: optional$1(boolean$1()),
2553
+ enableToasts: optional$1(boolean$1()),
2554
+ sourceFilter: optional$1(notificationFilterDecoder),
2555
+ });
2556
+ const notificationsConfigurationProtocolDecoder = object$1({
2557
+ configuration: notificationsConfigurationDecoder
2558
+ });
2559
+ const strictNotificationsConfigurationProtocolDecoder = object$1({
2560
+ configuration: object$1({
2561
+ enable: boolean$1(),
2562
+ enableToasts: boolean$1(),
2563
+ sourceFilter: object$1({
2564
+ allowed: array$1(nonEmptyStringDecoder),
2565
+ blocked: array$1(nonEmptyStringDecoder)
2566
+ })
2567
+ })
2568
+ });
2491
2569
  const platformSaveRequestConfigDecoder = object$1({
2492
2570
  layoutType: oneOf$1(constant$1("Global"), constant$1("Workspace")),
2493
2571
  layoutName: nonEmptyStringDecoder,
@@ -2548,7 +2626,8 @@ const notificationsDataDecoder = object$1({
2548
2626
  vibrate: optional$1(array$1(number$1())),
2549
2627
  severity: optional$1(oneOf$1(constant$1("Low"), constant$1("None"), constant$1("Medium"), constant$1("High"), constant$1("Critical"))),
2550
2628
  showToast: optional$1(boolean$1()),
2551
- showInPanel: optional$1(boolean$1())
2629
+ showInPanel: optional$1(boolean$1()),
2630
+ state: optional$1(notificationStateDecoder)
2552
2631
  });
2553
2632
  const simpleNotificationDataDecoder = object$1({
2554
2633
  notification: notificationsDataDecoder
@@ -2602,9 +2681,33 @@ const joinChannelDataDecoder = object$1({
2602
2681
  });
2603
2682
  const windowChannelResultDecoder = object$1({
2604
2683
  channel: optional$1(nonEmptyStringDecoder),
2684
+ });
2685
+ const prefsOperationTypesDecoder = oneOf$1(constant$1("clear"), constant$1("clearAll"), constant$1("get"), constant$1("getAll"), constant$1("set"), constant$1("update"), constant$1("prefsChanged"), constant$1("prefsHello"));
2686
+ const appPreferencesDecoder = object$1({
2687
+ app: nonEmptyStringDecoder,
2688
+ data: object$1(),
2689
+ lastUpdate: optional$1(nonEmptyStringDecoder),
2690
+ });
2691
+ const basePrefsConfigDecoder = object$1({
2692
+ app: nonEmptyStringDecoder,
2693
+ });
2694
+ const getPrefsResultDecoder = object$1({
2695
+ prefs: appPreferencesDecoder,
2696
+ });
2697
+ const getAllPrefsResultDecoder = object$1({
2698
+ all: array$1(appPreferencesDecoder),
2699
+ });
2700
+ const changePrefsDataDecoder = object$1({
2701
+ app: nonEmptyStringDecoder,
2702
+ data: object$1(),
2703
+ });
2704
+ const prefsHelloSuccessDecoder = object$1({
2705
+ platform: object$1({
2706
+ app: nonEmptyStringDecoder,
2707
+ }),
2605
2708
  });
2606
2709
 
2607
- const operations$8 = {
2710
+ const operations$9 = {
2608
2711
  openWindow: { name: "openWindow", dataDecoder: openWindowConfigDecoder, resultDecoder: coreWindowDataDecoder },
2609
2712
  windowHello: { name: "windowHello", dataDecoder: windowHelloDecoder, resultDecoder: helloSuccessDecoder },
2610
2713
  windowAdded: { name: "windowAdded", dataDecoder: coreWindowDataDecoder },
@@ -2793,7 +2896,7 @@ class WebWindowModel {
2793
2896
  }
2794
2897
  getURL() {
2795
2898
  return __awaiter$1(this, void 0, void 0, function* () {
2796
- const result = yield this._bridge.send("windows", operations$8.getUrl, { windowId: this.id });
2899
+ const result = yield this._bridge.send("windows", operations$9.getUrl, { windowId: this.id });
2797
2900
  return result.url;
2798
2901
  });
2799
2902
  }
@@ -2807,7 +2910,7 @@ class WebWindowModel {
2807
2910
  return __awaiter$1(this, void 0, void 0, function* () {
2808
2911
  const targetBounds = boundsDecoder.runWithException(dimension);
2809
2912
  const commandArgs = Object.assign({}, targetBounds, { windowId: this.id, relative: false });
2810
- yield this._bridge.send("windows", operations$8.moveResize, commandArgs);
2913
+ yield this._bridge.send("windows", operations$9.moveResize, commandArgs);
2811
2914
  return this.me;
2812
2915
  });
2813
2916
  }
@@ -2823,7 +2926,7 @@ class WebWindowModel {
2823
2926
  nonNegativeNumberDecoder.runWithException(height);
2824
2927
  }
2825
2928
  const commandArgs = Object.assign({}, { width, height }, { windowId: this.id, relative: true });
2826
- yield this._bridge.send("windows", operations$8.moveResize, commandArgs);
2929
+ yield this._bridge.send("windows", operations$9.moveResize, commandArgs);
2827
2930
  return this.me;
2828
2931
  });
2829
2932
  }
@@ -2839,7 +2942,7 @@ class WebWindowModel {
2839
2942
  number$1().runWithException(left);
2840
2943
  }
2841
2944
  const commandArgs = Object.assign({}, { top, left }, { windowId: this.id, relative: true });
2842
- yield this._bridge.send("windows", operations$8.moveResize, commandArgs);
2945
+ yield this._bridge.send("windows", operations$9.moveResize, commandArgs);
2843
2946
  return this.me;
2844
2947
  });
2845
2948
  }
@@ -2849,33 +2952,33 @@ class WebWindowModel {
2849
2952
  window.open(undefined, this.id);
2850
2953
  }
2851
2954
  else {
2852
- yield this._bridge.send("windows", operations$8.focus, { windowId: this.id });
2955
+ yield this._bridge.send("windows", operations$9.focus, { windowId: this.id });
2853
2956
  }
2854
2957
  return this.me;
2855
2958
  });
2856
2959
  }
2857
2960
  close() {
2858
2961
  return __awaiter$1(this, void 0, void 0, function* () {
2859
- yield this._bridge.send("windows", operations$8.close, { windowId: this.id });
2962
+ yield this._bridge.send("windows", operations$9.close, { windowId: this.id });
2860
2963
  return this.me;
2861
2964
  });
2862
2965
  }
2863
2966
  getTitle() {
2864
2967
  return __awaiter$1(this, void 0, void 0, function* () {
2865
- const result = yield this._bridge.send("windows", operations$8.getTitle, { windowId: this.id });
2968
+ const result = yield this._bridge.send("windows", operations$9.getTitle, { windowId: this.id });
2866
2969
  return result.title;
2867
2970
  });
2868
2971
  }
2869
2972
  setTitle(title) {
2870
2973
  return __awaiter$1(this, void 0, void 0, function* () {
2871
2974
  const ttl = nonEmptyStringDecoder.runWithException(title);
2872
- yield this._bridge.send("windows", operations$8.setTitle, { windowId: this.id, title: ttl });
2975
+ yield this._bridge.send("windows", operations$9.setTitle, { windowId: this.id, title: ttl });
2873
2976
  return this.me;
2874
2977
  });
2875
2978
  }
2876
2979
  getBounds() {
2877
2980
  return __awaiter$1(this, void 0, void 0, function* () {
2878
- const result = yield this._bridge.send("windows", operations$8.getBounds, { windowId: this.id });
2981
+ const result = yield this._bridge.send("windows", operations$9.getBounds, { windowId: this.id });
2879
2982
  return result.bounds;
2880
2983
  });
2881
2984
  }
@@ -2910,7 +3013,7 @@ class WebWindowModel {
2910
3013
  }
2911
3014
  getChannel() {
2912
3015
  return __awaiter$1(this, void 0, void 0, function* () {
2913
- const result = yield this._bridge.send("windows", operations$8.getChannel, { windowId: this.id }, undefined, { includeOperationCheck: true });
3016
+ const result = yield this._bridge.send("windows", operations$9.getChannel, { windowId: this.id }, undefined, { includeOperationCheck: true });
2914
3017
  return result.channel;
2915
3018
  });
2916
3019
  }
@@ -3008,7 +3111,7 @@ class WindowsController {
3008
3111
  return __awaiter$1(this, void 0, void 0, function* () {
3009
3112
  yield this.platformRegistration;
3010
3113
  const operationName = windowOperationTypesDecoder.runWithException(args.operation);
3011
- const operation = operations$8[operationName];
3114
+ const operation = operations$9[operationName];
3012
3115
  if (!operation.execute) {
3013
3116
  return;
3014
3117
  }
@@ -3024,7 +3127,7 @@ class WindowsController {
3024
3127
  nonEmptyStringDecoder.runWithException(name);
3025
3128
  nonEmptyStringDecoder.runWithException(url);
3026
3129
  const settings = windowOpenSettingsDecoder.runWithException(options);
3027
- const windowSuccess = yield this.bridge.send("windows", operations$8.openWindow, { name, url, options: settings });
3130
+ const windowSuccess = yield this.bridge.send("windows", operations$9.openWindow, { name, url, options: settings });
3028
3131
  return this.waitForWindowAdded(windowSuccess.windowId);
3029
3132
  });
3030
3133
  }
@@ -3049,16 +3152,16 @@ class WindowsController {
3049
3152
  };
3050
3153
  }
3051
3154
  addWindowOperationExecutors() {
3052
- operations$8.focusChange.execute = this.handleFocusChangeEvent.bind(this);
3053
- operations$8.windowAdded.execute = this.handleWindowAdded.bind(this);
3054
- operations$8.windowRemoved.execute = this.handleWindowRemoved.bind(this);
3055
- operations$8.getBounds.execute = this.handleGetBounds.bind(this);
3056
- operations$8.getFrameBounds.execute = this.handleGetBounds.bind(this);
3057
- operations$8.getTitle.execute = this.handleGetTitle.bind(this);
3058
- operations$8.getUrl.execute = this.handleGetUrl.bind(this);
3059
- operations$8.moveResize.execute = this.handleMoveResize.bind(this);
3060
- operations$8.setTitle.execute = this.handleSetTitle.bind(this);
3061
- operations$8.getChannel.execute = this.handleGetChannel.bind(this);
3155
+ operations$9.focusChange.execute = this.handleFocusChangeEvent.bind(this);
3156
+ operations$9.windowAdded.execute = this.handleWindowAdded.bind(this);
3157
+ operations$9.windowRemoved.execute = this.handleWindowRemoved.bind(this);
3158
+ operations$9.getBounds.execute = this.handleGetBounds.bind(this);
3159
+ operations$9.getFrameBounds.execute = this.handleGetBounds.bind(this);
3160
+ operations$9.getTitle.execute = this.handleGetTitle.bind(this);
3161
+ operations$9.getUrl.execute = this.handleGetUrl.bind(this);
3162
+ operations$9.moveResize.execute = this.handleMoveResize.bind(this);
3163
+ operations$9.setTitle.execute = this.handleSetTitle.bind(this);
3164
+ operations$9.getChannel.execute = this.handleGetChannel.bind(this);
3062
3165
  }
3063
3166
  my() {
3064
3167
  return Object.assign({}, this.me);
@@ -3089,7 +3192,7 @@ class WindowsController {
3089
3192
  }
3090
3193
  sayHello() {
3091
3194
  return __awaiter$1(this, void 0, void 0, function* () {
3092
- const helloSuccess = yield this.bridge.send("windows", operations$8.windowHello, { windowId: this.publicWindowId });
3195
+ const helloSuccess = yield this.bridge.send("windows", operations$9.windowHello, { windowId: this.publicWindowId });
3093
3196
  return helloSuccess;
3094
3197
  });
3095
3198
  }
@@ -3255,7 +3358,7 @@ class WindowsController {
3255
3358
  if (this.me) {
3256
3359
  this.me.isFocused = hasFocus;
3257
3360
  }
3258
- yield this.bridge.send("windows", operations$8.focusChange, eventData);
3361
+ yield this.bridge.send("windows", operations$9.focusChange, eventData);
3259
3362
  });
3260
3363
  }
3261
3364
  defineEventListeners() {
@@ -3455,7 +3558,7 @@ class GlueBridge {
3455
3558
  }
3456
3559
  }
3457
3560
 
3458
- const operations$7 = {
3561
+ const operations$8 = {
3459
3562
  appHello: { name: "appHello", dataDecoder: windowHelloDecoder, resultDecoder: appHelloSuccessDecoder },
3460
3563
  appDirectoryStateChange: { name: "appDirectoryStateChange", dataDecoder: appDirectoryStateChangeDecoder },
3461
3564
  instanceStarted: { name: "instanceStarted", dataDecoder: instanceDataDecoder },
@@ -3503,7 +3606,7 @@ class AppManagerController {
3503
3606
  return __awaiter$1(this, void 0, void 0, function* () {
3504
3607
  yield this.platformRegistration;
3505
3608
  const operationName = appManagerOperationTypesDecoder.runWithException(args.operation);
3506
- const operation = operations$7[operationName];
3609
+ const operation = operations$8[operationName];
3507
3610
  if (!operation.execute) {
3508
3611
  return;
3509
3612
  }
@@ -3548,7 +3651,7 @@ class AppManagerController {
3548
3651
  layoutComponentId: options === null || options === void 0 ? void 0 : options.layoutComponentId,
3549
3652
  channelId: options === null || options === void 0 ? void 0 : options.channelId
3550
3653
  };
3551
- const openResult = yield this.bridge.send("appManager", operations$7.applicationStart, startOptions);
3654
+ const openResult = yield this.bridge.send("appManager", operations$8.applicationStart, startOptions);
3552
3655
  const app = this.applications.find((a) => a.name === openResult.applicationName);
3553
3656
  return this.ioc.buildInstance(openResult, app);
3554
3657
  });
@@ -3581,9 +3684,9 @@ class AppManagerController {
3581
3684
  return api;
3582
3685
  }
3583
3686
  addOperationsExecutors() {
3584
- operations$7.appDirectoryStateChange.execute = this.handleAppDirectoryStateChange.bind(this);
3585
- operations$7.instanceStarted.execute = this.handleInstanceStartedMessage.bind(this);
3586
- operations$7.instanceStopped.execute = this.handleInstanceStoppedMessage.bind(this);
3687
+ operations$8.appDirectoryStateChange.execute = this.handleAppDirectoryStateChange.bind(this);
3688
+ operations$8.instanceStarted.execute = this.handleInstanceStartedMessage.bind(this);
3689
+ operations$8.instanceStopped.execute = this.handleInstanceStoppedMessage.bind(this);
3587
3690
  }
3588
3691
  handleAppDirectoryStateChange(data) {
3589
3692
  return __awaiter$1(this, void 0, void 0, function* () {
@@ -3700,7 +3803,7 @@ class AppManagerController {
3700
3803
  return soFar;
3701
3804
  }, { valid: [], invalid: [] });
3702
3805
  const responseTimeout = this.baseApplicationsTimeoutMS + this.appImportTimeoutMS * parseResult.valid.length;
3703
- yield this.bridge.send("appManager", operations$7.import, { definitions: parseResult.valid, mode }, { methodResponseTimeoutMs: responseTimeout });
3806
+ yield this.bridge.send("appManager", operations$8.import, { definitions: parseResult.valid, mode }, { methodResponseTimeoutMs: responseTimeout });
3704
3807
  return {
3705
3808
  imported: parseResult.valid.map((valid) => valid.name),
3706
3809
  errors: parseResult.invalid
@@ -3710,17 +3813,17 @@ class AppManagerController {
3710
3813
  remove(name) {
3711
3814
  return __awaiter$1(this, void 0, void 0, function* () {
3712
3815
  nonEmptyStringDecoder.runWithException(name);
3713
- yield this.bridge.send("appManager", operations$7.remove, { name }, { methodResponseTimeoutMs: this.baseApplicationsTimeoutMS });
3816
+ yield this.bridge.send("appManager", operations$8.remove, { name }, { methodResponseTimeoutMs: this.baseApplicationsTimeoutMS });
3714
3817
  });
3715
3818
  }
3716
3819
  clear() {
3717
3820
  return __awaiter$1(this, void 0, void 0, function* () {
3718
- yield this.bridge.send("appManager", operations$7.clear, undefined, { methodResponseTimeoutMs: this.baseApplicationsTimeoutMS });
3821
+ yield this.bridge.send("appManager", operations$8.clear, undefined, { methodResponseTimeoutMs: this.baseApplicationsTimeoutMS });
3719
3822
  });
3720
3823
  }
3721
3824
  export() {
3722
3825
  return __awaiter$1(this, void 0, void 0, function* () {
3723
- const response = yield this.bridge.send("appManager", operations$7.export, undefined, { methodResponseTimeoutMs: this.baseApplicationsTimeoutMS });
3826
+ const response = yield this.bridge.send("appManager", operations$8.export, undefined, { methodResponseTimeoutMs: this.baseApplicationsTimeoutMS });
3724
3827
  return response.definitions;
3725
3828
  });
3726
3829
  }
@@ -3739,7 +3842,7 @@ class AppManagerController {
3739
3842
  }
3740
3843
  registerWithPlatform() {
3741
3844
  return __awaiter$1(this, void 0, void 0, function* () {
3742
- const result = yield this.bridge.send("appManager", operations$7.appHello, { windowId: this.publicWindowId }, { methodResponseTimeoutMs: this.baseApplicationsTimeoutMS });
3845
+ const result = yield this.bridge.send("appManager", operations$8.appHello, { windowId: this.publicWindowId }, { methodResponseTimeoutMs: this.baseApplicationsTimeoutMS });
3743
3846
  this.logger.trace("the platform responded to the hello message with a full list of apps");
3744
3847
  this.applications = yield Promise.all(result.apps.map((app) => this.ioc.buildApplication(app, app.instances)));
3745
3848
  this.instances = this.applications.reduce((instancesSoFar, app) => {
@@ -3792,7 +3895,7 @@ class InstanceModel {
3792
3895
  }
3793
3896
  stop() {
3794
3897
  return __awaiter$1(this, void 0, void 0, function* () {
3795
- yield this.bridge.send("appManager", operations$7.instanceStop, { id: this.data.id });
3898
+ yield this.bridge.send("appManager", operations$8.instanceStop, { id: this.data.id });
3796
3899
  });
3797
3900
  }
3798
3901
  }
@@ -3848,7 +3951,7 @@ class ApplicationModel {
3848
3951
  }
3849
3952
  }
3850
3953
 
3851
- const operations$6 = {
3954
+ const operations$7 = {
3852
3955
  layoutAdded: { name: "layoutAdded", dataDecoder: glueLayoutDecoder },
3853
3956
  layoutChanged: { name: "layoutChanged", dataDecoder: glueLayoutDecoder },
3854
3957
  layoutRemoved: { name: "layoutRemoved", dataDecoder: glueLayoutDecoder },
@@ -3891,7 +3994,7 @@ class LayoutsController {
3891
3994
  handleBridgeMessage(args) {
3892
3995
  return __awaiter$1(this, void 0, void 0, function* () {
3893
3996
  const operationName = layoutsOperationTypesDecoder.runWithException(args.operation);
3894
- const operation = operations$6[operationName];
3997
+ const operation = operations$7[operationName];
3895
3998
  if (!operation.execute) {
3896
3999
  return;
3897
4000
  }
@@ -3925,30 +4028,30 @@ class LayoutsController {
3925
4028
  return Object.freeze(api);
3926
4029
  }
3927
4030
  addOperationsExecutors() {
3928
- operations$6.layoutAdded.execute = this.handleOnAdded.bind(this);
3929
- operations$6.layoutChanged.execute = this.handleOnChanged.bind(this);
3930
- operations$6.layoutRemoved.execute = this.handleOnRemoved.bind(this);
3931
- operations$6.clientSaveRequest.execute = this.handleSaveRequest.bind(this);
4031
+ operations$7.layoutAdded.execute = this.handleOnAdded.bind(this);
4032
+ operations$7.layoutChanged.execute = this.handleOnChanged.bind(this);
4033
+ operations$7.layoutRemoved.execute = this.handleOnRemoved.bind(this);
4034
+ operations$7.clientSaveRequest.execute = this.handleSaveRequest.bind(this);
3932
4035
  }
3933
4036
  get(name, type) {
3934
4037
  return __awaiter$1(this, void 0, void 0, function* () {
3935
4038
  nonEmptyStringDecoder.runWithException(name);
3936
4039
  layoutTypeDecoder.runWithException(type);
3937
- const result = yield this.bridge.send("layouts", operations$6.get, { name, type });
4040
+ const result = yield this.bridge.send("layouts", operations$7.get, { name, type });
3938
4041
  return result.layout;
3939
4042
  });
3940
4043
  }
3941
4044
  getAll(type) {
3942
4045
  return __awaiter$1(this, void 0, void 0, function* () {
3943
4046
  layoutTypeDecoder.runWithException(type);
3944
- const result = yield this.bridge.send("layouts", operations$6.getAll, { type });
4047
+ const result = yield this.bridge.send("layouts", operations$7.getAll, { type });
3945
4048
  return result.summaries;
3946
4049
  });
3947
4050
  }
3948
4051
  export(type) {
3949
4052
  return __awaiter$1(this, void 0, void 0, function* () {
3950
4053
  layoutTypeDecoder.runWithException(type);
3951
- const result = yield this.bridge.send("layouts", operations$6.export, { type });
4054
+ const result = yield this.bridge.send("layouts", operations$7.export, { type });
3952
4055
  return result.layouts;
3953
4056
  });
3954
4057
  }
@@ -3972,13 +4075,13 @@ class LayoutsController {
3972
4075
  return soFar;
3973
4076
  }, { valid: [] });
3974
4077
  const layoutsToImport = layouts.filter((layout) => parseResult.valid.some((validLayout) => validLayout.name === layout.name));
3975
- yield this.bridge.send("layouts", operations$6.import, { layouts: layoutsToImport, mode });
4078
+ yield this.bridge.send("layouts", operations$7.import, { layouts: layoutsToImport, mode });
3976
4079
  });
3977
4080
  }
3978
4081
  save(layout) {
3979
4082
  return __awaiter$1(this, void 0, void 0, function* () {
3980
4083
  newLayoutOptionsDecoder.runWithException(layout);
3981
- const saveResult = yield this.bridge.send("layouts", operations$6.save, { layout });
4084
+ const saveResult = yield this.bridge.send("layouts", operations$7.save, { layout });
3982
4085
  return saveResult.layout;
3983
4086
  });
3984
4087
  }
@@ -3986,14 +4089,14 @@ class LayoutsController {
3986
4089
  return __awaiter$1(this, void 0, void 0, function* () {
3987
4090
  restoreOptionsDecoder.runWithException(options);
3988
4091
  const invocationTimeout = options.timeout ? options.timeout * 2 : this.defaultLayoutRestoreTimeoutMS;
3989
- yield this.bridge.send("layouts", operations$6.restore, { layout: options }, { methodResponseTimeoutMs: invocationTimeout });
4092
+ yield this.bridge.send("layouts", operations$7.restore, { layout: options }, { methodResponseTimeoutMs: invocationTimeout });
3990
4093
  });
3991
4094
  }
3992
4095
  remove(type, name) {
3993
4096
  return __awaiter$1(this, void 0, void 0, function* () {
3994
4097
  layoutTypeDecoder.runWithException(type);
3995
4098
  nonEmptyStringDecoder.runWithException(name);
3996
- yield this.bridge.send("layouts", operations$6.remove, { type, name });
4099
+ yield this.bridge.send("layouts", operations$7.remove, { type, name });
3997
4100
  });
3998
4101
  }
3999
4102
  handleSaveRequest(config) {
@@ -4013,7 +4116,7 @@ class LayoutsController {
4013
4116
  }
4014
4117
  getGlobalPermissionState() {
4015
4118
  return __awaiter$1(this, void 0, void 0, function* () {
4016
- const requestResult = yield this.bridge.send("layouts", operations$6.getGlobalPermissionState, undefined);
4119
+ const requestResult = yield this.bridge.send("layouts", operations$7.getGlobalPermissionState, undefined);
4017
4120
  return requestResult;
4018
4121
  });
4019
4122
  }
@@ -4032,43 +4135,43 @@ class LayoutsController {
4032
4135
  if (myWindow.name !== "Platform" && !amIWorkspaceFrame) {
4033
4136
  throw new Error("Cannot request permission for multi-window placement from any app other than the Platform.");
4034
4137
  }
4035
- const requestResult = yield this.bridge.send("layouts", operations$6.requestGlobalPermission, undefined, { methodResponseTimeoutMs: 180000 });
4138
+ const requestResult = yield this.bridge.send("layouts", operations$7.requestGlobalPermission, undefined, { methodResponseTimeoutMs: 180000 });
4036
4139
  return { permissionGranted: requestResult.isAvailable };
4037
4140
  });
4038
4141
  }
4039
4142
  checkGlobalActivated() {
4040
4143
  return __awaiter$1(this, void 0, void 0, function* () {
4041
- const requestResult = yield this.bridge.send("layouts", operations$6.checkGlobalActivated, undefined);
4144
+ const requestResult = yield this.bridge.send("layouts", operations$7.checkGlobalActivated, undefined);
4042
4145
  return { activated: requestResult.isAvailable };
4043
4146
  });
4044
4147
  }
4045
4148
  getDefaultGlobal() {
4046
4149
  return __awaiter$1(this, void 0, void 0, function* () {
4047
- const requestResult = yield this.bridge.send("layouts", operations$6.getDefaultGlobal, undefined, undefined, { includeOperationCheck: true });
4150
+ const requestResult = yield this.bridge.send("layouts", operations$7.getDefaultGlobal, undefined, undefined, { includeOperationCheck: true });
4048
4151
  return requestResult.layout;
4049
4152
  });
4050
4153
  }
4051
4154
  setDefaultGlobal(name) {
4052
4155
  return __awaiter$1(this, void 0, void 0, function* () {
4053
4156
  nonEmptyStringDecoder.runWithException(name);
4054
- yield this.bridge.send("layouts", operations$6.setDefaultGlobal, { name }, undefined, { includeOperationCheck: true });
4157
+ yield this.bridge.send("layouts", operations$7.setDefaultGlobal, { name }, undefined, { includeOperationCheck: true });
4055
4158
  });
4056
4159
  }
4057
4160
  clearDefaultGlobal() {
4058
4161
  return __awaiter$1(this, void 0, void 0, function* () {
4059
- yield this.bridge.send("layouts", operations$6.clearDefaultGlobal, undefined, undefined, { includeOperationCheck: true });
4162
+ yield this.bridge.send("layouts", operations$7.clearDefaultGlobal, undefined, undefined, { includeOperationCheck: true });
4060
4163
  });
4061
4164
  }
4062
4165
  onAdded(callback) {
4063
4166
  this.export("Global").then((layouts) => layouts.forEach((layout) => callback(layout))).catch(() => { });
4064
4167
  this.export("Workspace").then((layouts) => layouts.forEach((layout) => callback(layout))).catch(() => { });
4065
- return this.registry.add(operations$6.layoutAdded.name, callback);
4168
+ return this.registry.add(operations$7.layoutAdded.name, callback);
4066
4169
  }
4067
4170
  onChanged(callback) {
4068
- return this.registry.add(operations$6.layoutChanged.name, callback);
4171
+ return this.registry.add(operations$7.layoutChanged.name, callback);
4069
4172
  }
4070
4173
  onRemoved(callback) {
4071
- return this.registry.add(operations$6.layoutRemoved.name, callback);
4174
+ return this.registry.add(operations$7.layoutRemoved.name, callback);
4072
4175
  }
4073
4176
  subscribeOnSaveRequested(callback) {
4074
4177
  if (typeof callback !== "function") {
@@ -4084,22 +4187,22 @@ class LayoutsController {
4084
4187
  }
4085
4188
  handleOnAdded(layout) {
4086
4189
  return __awaiter$1(this, void 0, void 0, function* () {
4087
- this.registry.execute(operations$6.layoutAdded.name, layout);
4190
+ this.registry.execute(operations$7.layoutAdded.name, layout);
4088
4191
  });
4089
4192
  }
4090
4193
  handleOnChanged(layout) {
4091
4194
  return __awaiter$1(this, void 0, void 0, function* () {
4092
- this.registry.execute(operations$6.layoutChanged.name, layout);
4195
+ this.registry.execute(operations$7.layoutChanged.name, layout);
4093
4196
  });
4094
4197
  }
4095
4198
  handleOnRemoved(layout) {
4096
4199
  return __awaiter$1(this, void 0, void 0, function* () {
4097
- this.registry.execute(operations$6.layoutRemoved.name, layout);
4200
+ this.registry.execute(operations$7.layoutRemoved.name, layout);
4098
4201
  });
4099
4202
  }
4100
4203
  }
4101
4204
 
4102
- const operations$5 = {
4205
+ const operations$6 = {
4103
4206
  raiseNotification: { name: "raiseNotification", dataDecoder: raiseNotificationDecoder, resultDecoder: raiseNotificationResultDecoder },
4104
4207
  requestPermission: { name: "requestPermission", resultDecoder: permissionRequestResultDecoder },
4105
4208
  notificationShow: { name: "notificationShow", dataDecoder: notificationEventPayloadDecoder },
@@ -4110,7 +4213,14 @@ const operations$5 = {
4110
4213
  notificationClosed: { name: "notificationClosed", dataDecoder: simpleNotificationSelectDecoder },
4111
4214
  click: { name: "click" },
4112
4215
  clear: { name: "clear" },
4113
- clearAll: { name: "clearAll" }
4216
+ clearAll: { name: "clearAll" },
4217
+ clearOld: { name: "clearOld" },
4218
+ configure: { name: "configure", dataDecoder: notificationsConfigurationProtocolDecoder },
4219
+ getConfiguration: { name: "getConfiguration", resultDecoder: strictNotificationsConfigurationProtocolDecoder },
4220
+ configurationChanged: { name: "configurationChanged", resultDecoder: strictNotificationsConfigurationProtocolDecoder },
4221
+ setState: { name: "setState", dataDecoder: notificationSetStateRequestDecoder },
4222
+ activeCountChange: { name: "activeCountChange", resultDecoder: activeNotificationsCountChangeDecoder },
4223
+ stateChange: { name: "stateChange", resultDecoder: notificationSetStateRequestDecoder }
4114
4224
  };
4115
4225
 
4116
4226
  var shortidExports$1 = {};
@@ -4487,7 +4597,7 @@ class NotificationsController {
4487
4597
  handleBridgeMessage(args) {
4488
4598
  return __awaiter$1(this, void 0, void 0, function* () {
4489
4599
  const operationName = notificationsOperationTypesDecoder.runWithException(args.operation);
4490
- const operation = operations$5[operationName];
4600
+ const operation = operations$6[operationName];
4491
4601
  if (!operation.execute) {
4492
4602
  return;
4493
4603
  }
@@ -4508,19 +4618,28 @@ class NotificationsController {
4508
4618
  onClosed: this.onClosed.bind(this),
4509
4619
  click: this.click.bind(this),
4510
4620
  clear: this.clear.bind(this),
4511
- clearAll: this.clearAll.bind(this)
4621
+ clearAll: this.clearAll.bind(this),
4622
+ clearOld: this.clearOld.bind(this),
4623
+ configure: this.configure.bind(this),
4624
+ getConfiguration: this.getConfiguration.bind(this),
4625
+ getFilter: this.getFilter.bind(this),
4626
+ setFilter: this.setFilter.bind(this),
4627
+ setState: this.setState.bind(this),
4628
+ onConfigurationChanged: this.onConfigurationChanged.bind(this),
4629
+ onActiveCountChanged: this.onActiveCountChanged.bind(this),
4630
+ onStateChanged: this.onStateChanged.bind(this)
4512
4631
  };
4513
4632
  return Object.freeze(api);
4514
4633
  }
4515
4634
  getPermission() {
4516
4635
  return __awaiter$1(this, void 0, void 0, function* () {
4517
- const queryResult = yield this.bridge.send("notifications", operations$5.getPermission, undefined);
4636
+ const queryResult = yield this.bridge.send("notifications", operations$6.getPermission, undefined);
4518
4637
  return queryResult.permission;
4519
4638
  });
4520
4639
  }
4521
4640
  requestPermission() {
4522
4641
  return __awaiter$1(this, void 0, void 0, function* () {
4523
- const permissionResult = yield this.bridge.send("notifications", operations$5.requestPermission, undefined);
4642
+ const permissionResult = yield this.bridge.send("notifications", operations$6.requestPermission, undefined);
4524
4643
  return permissionResult.permissionGranted;
4525
4644
  });
4526
4645
  }
@@ -4534,7 +4653,7 @@ class NotificationsController {
4534
4653
  throw new Error("Cannot raise the notification, because the user has declined the permission request");
4535
4654
  }
4536
4655
  const id = shortidExports$1.generate();
4537
- const raiseResult = yield this.bridge.send("notifications", operations$5.raiseNotification, { settings, id });
4656
+ const raiseResult = yield this.bridge.send("notifications", operations$6.raiseNotification, { settings, id });
4538
4657
  const notification = this.buildNotificationFunc(raiseResult.settings, id);
4539
4658
  this.notifications[id] = notification;
4540
4659
  return notification;
@@ -4542,7 +4661,7 @@ class NotificationsController {
4542
4661
  }
4543
4662
  list() {
4544
4663
  return __awaiter$1(this, void 0, void 0, function* () {
4545
- const bridgeResponse = yield this.bridge.send("notifications", operations$5.list, undefined, undefined, { includeOperationCheck: true });
4664
+ const bridgeResponse = yield this.bridge.send("notifications", operations$6.list, undefined, undefined, { includeOperationCheck: true });
4546
4665
  return bridgeResponse.notifications;
4547
4666
  });
4548
4667
  }
@@ -4564,25 +4683,98 @@ class NotificationsController {
4564
4683
  if (action) {
4565
4684
  nonEmptyStringDecoder.runWithException(action);
4566
4685
  }
4567
- yield this.bridge.send("notifications", operations$5.click, { id, action }, undefined, { includeOperationCheck: true });
4686
+ yield this.bridge.send("notifications", operations$6.click, { id, action }, undefined, { includeOperationCheck: true });
4568
4687
  });
4569
4688
  }
4570
4689
  clear(id) {
4571
4690
  return __awaiter$1(this, void 0, void 0, function* () {
4572
4691
  nonEmptyStringDecoder.runWithException(id);
4573
- yield this.bridge.send("notifications", operations$5.clear, { id }, undefined, { includeOperationCheck: true });
4692
+ yield this.bridge.send("notifications", operations$6.clear, { id }, undefined, { includeOperationCheck: true });
4574
4693
  });
4575
4694
  }
4576
4695
  clearAll() {
4577
4696
  return __awaiter$1(this, void 0, void 0, function* () {
4578
- yield this.bridge.send("notifications", operations$5.clearAll, undefined, undefined, { includeOperationCheck: true });
4697
+ yield this.bridge.send("notifications", operations$6.clearAll, undefined, undefined, { includeOperationCheck: true });
4698
+ });
4699
+ }
4700
+ clearOld() {
4701
+ return __awaiter$1(this, void 0, void 0, function* () {
4702
+ yield this.bridge.send("notifications", operations$6.clearOld, undefined, undefined, { includeOperationCheck: true });
4703
+ });
4704
+ }
4705
+ configure(config) {
4706
+ return __awaiter$1(this, void 0, void 0, function* () {
4707
+ const verifiedConfig = notificationsConfigurationDecoder.runWithException(config);
4708
+ yield this.bridge.send("notifications", operations$6.configure, { configuration: verifiedConfig }, undefined, { includeOperationCheck: true });
4709
+ });
4710
+ }
4711
+ getConfiguration() {
4712
+ return __awaiter$1(this, void 0, void 0, function* () {
4713
+ const response = yield this.bridge.send("notifications", operations$6.getConfiguration, undefined, undefined, { includeOperationCheck: true });
4714
+ return response.configuration;
4715
+ });
4716
+ }
4717
+ getFilter() {
4718
+ return __awaiter$1(this, void 0, void 0, function* () {
4719
+ const response = yield this.bridge.send("notifications", operations$6.getConfiguration, undefined, undefined, { includeOperationCheck: true });
4720
+ return response.configuration.sourceFilter;
4721
+ });
4722
+ }
4723
+ setFilter(filter) {
4724
+ return __awaiter$1(this, void 0, void 0, function* () {
4725
+ const verifiedFilter = notificationFilterDecoder.runWithException(filter);
4726
+ yield this.bridge.send("notifications", operations$6.configure, { configuration: { sourceFilter: verifiedFilter } }, undefined, { includeOperationCheck: true });
4727
+ return verifiedFilter;
4728
+ });
4729
+ }
4730
+ setState(id, state) {
4731
+ return __awaiter$1(this, void 0, void 0, function* () {
4732
+ nonEmptyStringDecoder.runWithException(id);
4733
+ notificationStateDecoder.runWithException(state);
4734
+ yield this.bridge.send("notifications", operations$6.setState, { id, state }, undefined, { includeOperationCheck: true });
4579
4735
  });
4580
4736
  }
4737
+ onConfigurationChanged(callback) {
4738
+ if (typeof callback !== "function") {
4739
+ throw new Error("Cannot subscribe to configuration changed, because the provided callback is not a function!");
4740
+ }
4741
+ return this.registry.add("notifications-config-changed", callback);
4742
+ }
4743
+ onActiveCountChanged(callback) {
4744
+ if (typeof callback !== "function") {
4745
+ throw new Error("Cannot subscribe to onActiveCountChanged changed, because the provided callback is not a function!");
4746
+ }
4747
+ return this.registry.add("notifications-active-count-changed", callback);
4748
+ }
4749
+ onStateChanged(callback) {
4750
+ if (typeof callback !== "function") {
4751
+ throw new Error("Cannot subscribe to onStateChanged changed, because the provided callback is not a function!");
4752
+ }
4753
+ return this.registry.add("notification-state-changed", callback);
4754
+ }
4581
4755
  addOperationExecutors() {
4582
- operations$5.notificationShow.execute = this.handleNotificationShow.bind(this);
4583
- operations$5.notificationClick.execute = this.handleNotificationClick.bind(this);
4584
- operations$5.notificationRaised.execute = this.handleNotificationRaised.bind(this);
4585
- operations$5.notificationClosed.execute = this.handleNotificationClosed.bind(this);
4756
+ operations$6.notificationShow.execute = this.handleNotificationShow.bind(this);
4757
+ operations$6.notificationClick.execute = this.handleNotificationClick.bind(this);
4758
+ operations$6.notificationRaised.execute = this.handleNotificationRaised.bind(this);
4759
+ operations$6.notificationClosed.execute = this.handleNotificationClosed.bind(this);
4760
+ operations$6.configurationChanged.execute = this.handleConfigurationChanged.bind(this);
4761
+ operations$6.activeCountChange.execute = this.handleActiveCountChanged.bind(this);
4762
+ operations$6.stateChange.execute = this.handleNotificationStateChanged.bind(this);
4763
+ }
4764
+ handleConfigurationChanged(data) {
4765
+ return __awaiter$1(this, void 0, void 0, function* () {
4766
+ this.registry.execute("notifications-config-changed", data.configuration);
4767
+ });
4768
+ }
4769
+ handleActiveCountChanged(data) {
4770
+ return __awaiter$1(this, void 0, void 0, function* () {
4771
+ this.registry.execute("notifications-active-count-changed", data);
4772
+ });
4773
+ }
4774
+ handleNotificationStateChanged(data) {
4775
+ return __awaiter$1(this, void 0, void 0, function* () {
4776
+ this.registry.execute("notification-state-changed", { id: data.id }, data.state);
4777
+ });
4586
4778
  }
4587
4779
  handleNotificationShow(data) {
4588
4780
  return __awaiter$1(this, void 0, void 0, function* () {
@@ -4627,21 +4819,24 @@ class NotificationsController {
4627
4819
  }
4628
4820
  }
4629
4821
 
4630
- const operations$4 = {
4822
+ const operations$5 = {
4631
4823
  getIntents: { name: "getIntents", resultDecoder: wrappedIntentsDecoder },
4632
4824
  findIntent: { name: "findIntent", dataDecoder: wrappedIntentFilterDecoder, resultDecoder: wrappedIntentsDecoder },
4633
4825
  raiseIntent: { name: "raiseIntent", dataDecoder: intentRequestDecoder, resultDecoder: intentResultDecoder },
4634
4826
  raise: { name: "raise", dataDecoder: raiseIntentRequestDecoder, resultDecoder: intentResultDecoder },
4827
+ filterHandlers: { name: "filterHandlers", dataDecoder: filterHandlersWithResolverConfigDecoder, resultDecoder: filterHandlersResultDecoder },
4828
+ getIntentsByHandler: { name: "getIntentsByHandler", dataDecoder: intentHandlerDecoder, resultDecoder: getIntentsResultDecoder }
4635
4829
  };
4636
4830
 
4637
4831
  const GLUE42_FDC3_INTENTS_METHOD_PREFIX = "Tick42.FDC3.Intents.";
4638
4832
  const INTENTS_RESOLVER_INTEROP_PREFIX = "T42.Intents.Resolver.Control.";
4639
4833
  const INTENTS_RESOLVER_APP_NAME = "intentsResolver";
4640
- const DEFAULT_RESOLVER_RESPONSE_TIMEOUT = 60000;
4641
- const ADDITIONAL_BRIDGE_OPERATION_TIMEOUT = 30000;
4834
+ const DEFAULT_RESOLVER_RESPONSE_TIMEOUT = 60 * 1000;
4835
+ const ADDITIONAL_BRIDGE_OPERATION_TIMEOUT = 30 * 1000;
4642
4836
  const INTENTS_RESOLVER_WIDTH = 400;
4643
4837
  const INTENTS_RESOLVER_HEIGHT = 440;
4644
- const MAX_SET_TIMEOUT_DELAY = 2147483647;
4838
+ const MAX_SET_TIMEOUT_DELAY = 2147483647;
4839
+ const DEFAULT_PICK_HANDLER_BY_TIMEOUT = 90 * 1000;
4645
4840
 
4646
4841
  class IntentsController {
4647
4842
  constructor() {
@@ -4669,7 +4864,7 @@ class IntentsController {
4669
4864
  handleBridgeMessage(args) {
4670
4865
  return __awaiter$1(this, void 0, void 0, function* () {
4671
4866
  const operationName = intentsOperationTypesDecoder.runWithException(args.operation);
4672
- const operation = operations$4[operationName];
4867
+ const operation = operations$5[operationName];
4673
4868
  if (!operation.execute) {
4674
4869
  return;
4675
4870
  }
@@ -4686,7 +4881,9 @@ class IntentsController {
4686
4881
  all: this.all.bind(this),
4687
4882
  addIntentListener: this.addIntentListener.bind(this),
4688
4883
  register: this.register.bind(this),
4689
- find: this.find.bind(this)
4884
+ find: this.find.bind(this),
4885
+ filterHandlers: this.filterHandlers.bind(this),
4886
+ getIntents: this.getIntentsByHandler.bind(this)
4690
4887
  };
4691
4888
  return api;
4692
4889
  }
@@ -4697,7 +4894,7 @@ class IntentsController {
4697
4894
  ? { intent: validatedIntentRequest }
4698
4895
  : validatedIntentRequest;
4699
4896
  yield Promise.all(this.unregisterIntentPromises);
4700
- const requestWithResolverInfo = this.buildIntentRequestWithResolverInfo(intentRequest);
4897
+ const requestWithResolverInfo = { intentRequest, resolverConfig: this.getResolverConfigByRequest({ intentRequest }) };
4701
4898
  const isRaiseOperationSupported = yield this.isRaiseOperationSupported();
4702
4899
  if (!isRaiseOperationSupported.supported) {
4703
4900
  this.logger.warn(`${isRaiseOperationSupported.reason}. Invoking legacy raise method`);
@@ -4707,18 +4904,24 @@ class IntentsController {
4707
4904
  const methodResponseTimeoutMs = intentRequest.waitUserResponseIndefinitely
4708
4905
  ? MAX_SET_TIMEOUT_DELAY
4709
4906
  : (intentRequest.timeout || this.intentResolverResponseTimeout) + ADDITIONAL_BRIDGE_OPERATION_TIMEOUT;
4710
- const response = yield this.bridge.send("intents", operations$4.raise, requestWithResolverInfo, { methodResponseTimeoutMs, waitTimeoutMs: methodResponseTimeoutMs });
4907
+ const response = yield this.bridge.send("intents", operations$5.raise, requestWithResolverInfo, { methodResponseTimeoutMs, waitTimeoutMs: methodResponseTimeoutMs });
4711
4908
  return response;
4712
4909
  });
4713
4910
  }
4714
- buildIntentRequestWithResolverInfo(request) {
4715
- return {
4716
- intentRequest: request,
4717
- resolverConfig: {
4718
- enabled: this.useIntentsResolverUI,
4911
+ getResolverConfigByRequest(filter) {
4912
+ var _a, _b, _c, _d;
4913
+ if (filter.handlerFilter) {
4914
+ return {
4915
+ enabled: typeof ((_a = filter.handlerFilter) === null || _a === void 0 ? void 0 : _a.openResolver) === "boolean" ? (_b = filter.handlerFilter) === null || _b === void 0 ? void 0 : _b.openResolver : this.useIntentsResolverUI,
4719
4916
  appName: this.intentsResolverAppName,
4720
- waitResponseTimeout: request.waitUserResponseIndefinitely ? MAX_SET_TIMEOUT_DELAY : this.intentResolverResponseTimeout
4721
- }
4917
+ waitResponseTimeout: ((_c = filter.handlerFilter) === null || _c === void 0 ? void 0 : _c.timeout) || DEFAULT_PICK_HANDLER_BY_TIMEOUT
4918
+ };
4919
+ }
4920
+ const waitResponseTimeout = ((_d = filter.intentRequest) === null || _d === void 0 ? void 0 : _d.waitUserResponseIndefinitely) ? MAX_SET_TIMEOUT_DELAY : this.intentResolverResponseTimeout;
4921
+ return {
4922
+ enabled: this.useIntentsResolverUI,
4923
+ appName: this.intentsResolverAppName,
4924
+ waitResponseTimeout
4722
4925
  };
4723
4926
  }
4724
4927
  isRaiseOperationSupported() {
@@ -4741,7 +4944,7 @@ class IntentsController {
4741
4944
  all() {
4742
4945
  return __awaiter$1(this, void 0, void 0, function* () {
4743
4946
  yield Promise.all(this.unregisterIntentPromises);
4744
- const result = yield this.bridge.send("intents", operations$4.getIntents, undefined);
4947
+ const result = yield this.bridge.send("intents", operations$5.getIntents, undefined);
4745
4948
  return result.intents;
4746
4949
  });
4747
4950
  }
@@ -4839,7 +5042,7 @@ class IntentsController {
4839
5042
  }
4840
5043
  }
4841
5044
  yield Promise.all(this.unregisterIntentPromises);
4842
- const result = yield this.bridge.send("intents", operations$4.findIntent, data);
5045
+ const result = yield this.bridge.send("intents", operations$5.findIntent, data);
4843
5046
  return result.intents;
4844
5047
  });
4845
5048
  }
@@ -4871,6 +5074,38 @@ class IntentsController {
4871
5074
  this.clearUnregistrationPromise(unregisterPromise);
4872
5075
  });
4873
5076
  }
5077
+ filterHandlers(handlerFilter) {
5078
+ return __awaiter$1(this, void 0, void 0, function* () {
5079
+ handlersFilterDecoder.runWithException(handlerFilter);
5080
+ this.checkIfAtLeastOneFilterIsPresent(handlerFilter);
5081
+ if (handlerFilter.openResolver && !this.useIntentsResolverUI) {
5082
+ throw new Error("Cannot resolve 'filterHandlers' request using Intents Resolver UI because it's globally disabled");
5083
+ }
5084
+ const methodResponseTimeoutMs = (handlerFilter.timeout || DEFAULT_PICK_HANDLER_BY_TIMEOUT) + ADDITIONAL_BRIDGE_OPERATION_TIMEOUT;
5085
+ const filterHandlersRequestWithResolverConfig = { filterHandlersRequest: handlerFilter, resolverConfig: this.getResolverConfigByRequest({ handlerFilter }) };
5086
+ const result = yield this.bridge.send("intents", operations$5.filterHandlers, filterHandlersRequestWithResolverConfig, { methodResponseTimeoutMs, waitTimeoutMs: methodResponseTimeoutMs }, { includeOperationCheck: true });
5087
+ return result;
5088
+ });
5089
+ }
5090
+ checkIfAtLeastOneFilterIsPresent(filter) {
5091
+ const errorMsg = "Provide at least one filter criteria of the following: 'intent' | 'contextTypes' | 'resultType' | 'applicationNames'";
5092
+ if (!Object.keys(filter).length) {
5093
+ throw new Error(errorMsg);
5094
+ }
5095
+ const { intent, resultType, contextTypes, applicationNames } = filter;
5096
+ const existingValidContextTypes = contextTypes === null || contextTypes === void 0 ? void 0 : contextTypes.length;
5097
+ const existingValidApplicationNames = applicationNames === null || applicationNames === void 0 ? void 0 : applicationNames.length;
5098
+ if (!intent && !resultType && !existingValidContextTypes && !existingValidApplicationNames) {
5099
+ throw new Error(errorMsg);
5100
+ }
5101
+ }
5102
+ getIntentsByHandler(handler) {
5103
+ return __awaiter$1(this, void 0, void 0, function* () {
5104
+ intentHandlerDecoder.runWithException(handler);
5105
+ const result = yield this.bridge.send("intents", operations$5.getIntentsByHandler, handler, undefined, { includeOperationCheck: true });
5106
+ return result;
5107
+ });
5108
+ }
4874
5109
  }
4875
5110
 
4876
5111
  const Glue42CoreMessageTypes = {
@@ -4887,7 +5122,7 @@ const Glue42CoreMessageTypes = {
4887
5122
  const webPlatformTransportName = "web-platform";
4888
5123
  const latestFDC3Type = "latest_fdc3_type";
4889
5124
 
4890
- const operations$3 = {
5125
+ const operations$4 = {
4891
5126
  addChannel: { name: "addChannel", dataDecoder: channelContextDecoder },
4892
5127
  getMyChannel: { name: "getMyChannel", resultDecoder: getMyChanelResultDecoder },
4893
5128
  getWindowIdsOnChannel: { name: "getWindowIdsOnChannel", dataDecoder: getWindowIdsOnChannelDataDecoder, resultDecoder: getWindowIdsOnChannelResultDecoder },
@@ -4924,8 +5159,8 @@ class ChannelsController {
4924
5159
  this.registry.clear();
4925
5160
  }
4926
5161
  addOperationsExecutors() {
4927
- operations$3.getMyChannel.execute = this.handleGetMyChannel.bind(this);
4928
- operations$3.joinChannel.execute = this.handleJoinChannel.bind(this);
5162
+ operations$4.getMyChannel.execute = this.handleGetMyChannel.bind(this);
5163
+ operations$4.joinChannel.execute = this.handleJoinChannel.bind(this);
4929
5164
  }
4930
5165
  start(coreGlue, ioc) {
4931
5166
  return __awaiter$1(this, void 0, void 0, function* () {
@@ -4944,7 +5179,7 @@ class ChannelsController {
4944
5179
  handleBridgeMessage(args) {
4945
5180
  return __awaiter$1(this, void 0, void 0, function* () {
4946
5181
  const operationName = channelsOperationTypesDecoder.runWithException(args.operation);
4947
- const operation = operations$3[operationName];
5182
+ const operation = operations$4[operationName];
4948
5183
  if (!operation.execute) {
4949
5184
  return;
4950
5185
  }
@@ -4980,7 +5215,7 @@ class ChannelsController {
4980
5215
  yield this.switchToChannel(name);
4981
5216
  }
4982
5217
  else {
4983
- yield this.bridge.send("channels", operations$3.joinChannel, { channel: name, windowId }, undefined, { includeOperationCheck: true });
5218
+ yield this.bridge.send("channels", operations$4.joinChannel, { channel: name, windowId }, undefined, { includeOperationCheck: true });
4984
5219
  }
4985
5220
  });
4986
5221
  }
@@ -5151,7 +5386,7 @@ class ChannelsController {
5151
5386
  if (channelWithSuchNameExists) {
5152
5387
  throw new Error("There's an already existing channel with such name");
5153
5388
  }
5154
- yield this.bridge.send("channels", operations$3.addChannel, channelContext);
5389
+ yield this.bridge.send("channels", operations$4.addChannel, channelContext);
5155
5390
  return channelContext;
5156
5391
  });
5157
5392
  }
@@ -5167,7 +5402,7 @@ class ChannelsController {
5167
5402
  return __awaiter$1(this, void 0, void 0, function* () {
5168
5403
  const channelNames = this.getAllChannelNames();
5169
5404
  channelNameDecoder(channelNames).runWithException(channel);
5170
- const { windowIds } = yield this.bridge.send("channels", operations$3.getWindowIdsOnChannel, { channel }, undefined, { includeOperationCheck: true });
5405
+ const { windowIds } = yield this.bridge.send("channels", operations$4.getWindowIdsOnChannel, { channel }, undefined, { includeOperationCheck: true });
5171
5406
  const result = windowIds.reduce((windows, windowId) => {
5172
5407
  const window = this.windowsController.findById(windowId);
5173
5408
  return window ? [...windows, window] : windows;
@@ -5180,7 +5415,7 @@ class ChannelsController {
5180
5415
  const operationData = filter !== undefined
5181
5416
  ? { filter: windowWithChannelFilterDecoder.runWithException(filter) }
5182
5417
  : {};
5183
- const { windowIdsWithChannels } = yield this.bridge.send("channels", operations$3.getWindowIdsWithChannels, operationData, undefined, { includeOperationCheck: true });
5418
+ const { windowIdsWithChannels } = yield this.bridge.send("channels", operations$4.getWindowIdsWithChannels, operationData, undefined, { includeOperationCheck: true });
5184
5419
  const result = windowIdsWithChannels.reduce((windowsWithChannels, { application, channel, windowId }) => {
5185
5420
  const window = this.windowsController.findById(windowId);
5186
5421
  return window ? [...windowsWithChannels, { application, channel, window }] : windowsWithChannels;
@@ -5190,7 +5425,7 @@ class ChannelsController {
5190
5425
  }
5191
5426
  }
5192
5427
 
5193
- const operations$2 = {
5428
+ const operations$3 = {
5194
5429
  getEnvironment: { name: "getEnvironment", resultDecoder: anyDecoder },
5195
5430
  getBase: { name: "getBase", resultDecoder: anyDecoder },
5196
5431
  platformShutdown: { name: "platformShutdown" }
@@ -5208,7 +5443,7 @@ class SystemController {
5208
5443
  handleBridgeMessage(args) {
5209
5444
  return __awaiter$1(this, void 0, void 0, function* () {
5210
5445
  const operationName = systemOperationTypesDecoder.runWithException(args.operation);
5211
- const operation = operations$2[operationName];
5446
+ const operation = operations$3[operationName];
5212
5447
  if (!operation.execute) {
5213
5448
  return;
5214
5449
  }
@@ -5229,8 +5464,8 @@ class SystemController {
5229
5464
  }
5230
5465
  setEnvironment() {
5231
5466
  return __awaiter$1(this, void 0, void 0, function* () {
5232
- const environment = yield this.bridge.send("system", operations$2.getEnvironment, undefined);
5233
- const base = yield this.bridge.send("system", operations$2.getBase, undefined);
5467
+ const environment = yield this.bridge.send("system", operations$3.getEnvironment, undefined);
5468
+ const base = yield this.bridge.send("system", operations$3.getBase, undefined);
5234
5469
  const globalNamespace = window.glue42core || window.iobrowser;
5235
5470
  const globalNamespaceName = window.glue42core ? "glue42core" : "iobrowser";
5236
5471
  const globalObj = Object.assign({}, globalNamespace, base, { environment });
@@ -5238,7 +5473,7 @@ class SystemController {
5238
5473
  });
5239
5474
  }
5240
5475
  addOperationsExecutors() {
5241
- operations$2.platformShutdown.execute = this.processPlatformShutdown.bind(this);
5476
+ operations$3.platformShutdown.execute = this.processPlatformShutdown.bind(this);
5242
5477
  }
5243
5478
  }
5244
5479
 
@@ -5267,6 +5502,7 @@ class Notification {
5267
5502
  this.severity = config.severity;
5268
5503
  this.showToast = config.showToast;
5269
5504
  this.showInPanel = config.showInPanel;
5505
+ this.state = config.state;
5270
5506
  }
5271
5507
  }
5272
5508
 
@@ -5277,7 +5513,7 @@ const extensionConfigDecoder = object$1({
5277
5513
  })
5278
5514
  });
5279
5515
 
5280
- const operations$1 = {
5516
+ const operations$2 = {
5281
5517
  clientHello: { name: "clientHello", resultDecoder: extensionConfigDecoder }
5282
5518
  };
5283
5519
 
@@ -5335,7 +5571,7 @@ class ExtController {
5335
5571
  registerWithPlatform() {
5336
5572
  return __awaiter$1(this, void 0, void 0, function* () {
5337
5573
  this.logger.trace("registering with the platform");
5338
- this.config = yield this.bridge.send("extension", operations$1.clientHello, { windowId: this.windowId });
5574
+ this.config = yield this.bridge.send("extension", operations$2.clientHello, { windowId: this.windowId });
5339
5575
  this.logger.trace("the platform responded to the hello message with a valid extension config");
5340
5576
  });
5341
5577
  }
@@ -5681,7 +5917,7 @@ class LegacyIntentsHelper {
5681
5917
  });
5682
5918
  }
5683
5919
  invokeRaiseIntent(requestObj) {
5684
- return this.bridge.send("intents", operations$4.raiseIntent, requestObj);
5920
+ return this.bridge.send("intents", operations$5.raiseIntent, requestObj);
5685
5921
  }
5686
5922
  registerResponseMethod() {
5687
5923
  return __awaiter$1(this, void 0, void 0, function* () {
@@ -5841,7 +6077,7 @@ class LegacyIntentsHelper {
5841
6077
  }
5842
6078
  }
5843
6079
 
5844
- const operations = {
6080
+ const operations$1 = {
5845
6081
  getCurrent: { name: "getCurrent", resultDecoder: simpleThemeResponseDecoder },
5846
6082
  list: { name: "list", resultDecoder: allThemesResponseDecoder },
5847
6083
  select: { name: "select", dataDecoder: selectThemeConfigDecoder }
@@ -5884,20 +6120,20 @@ class ThemesController {
5884
6120
  }
5885
6121
  getCurrent() {
5886
6122
  return __awaiter$1(this, void 0, void 0, function* () {
5887
- const bridgeResponse = yield this.bridge.send("themes", operations.getCurrent, undefined, undefined, { includeOperationCheck: true });
6123
+ const bridgeResponse = yield this.bridge.send("themes", operations$1.getCurrent, undefined, undefined, { includeOperationCheck: true });
5888
6124
  return bridgeResponse.theme;
5889
6125
  });
5890
6126
  }
5891
6127
  list() {
5892
6128
  return __awaiter$1(this, void 0, void 0, function* () {
5893
- const bridgeResponse = yield this.bridge.send("themes", operations.list, undefined, undefined, { includeOperationCheck: true });
6129
+ const bridgeResponse = yield this.bridge.send("themes", operations$1.list, undefined, undefined, { includeOperationCheck: true });
5894
6130
  return bridgeResponse.themes;
5895
6131
  });
5896
6132
  }
5897
6133
  select(name) {
5898
6134
  return __awaiter$1(this, void 0, void 0, function* () {
5899
6135
  nonEmptyStringDecoder.runWithException(name);
5900
- yield this.bridge.send("themes", operations.select, { name }, undefined, { includeOperationCheck: true });
6136
+ yield this.bridge.send("themes", operations$1.select, { name }, undefined, { includeOperationCheck: true });
5901
6137
  });
5902
6138
  }
5903
6139
  onChanged(callback) {
@@ -5979,6 +6215,175 @@ class SessionStorageController {
5979
6215
  }
5980
6216
  }
5981
6217
 
6218
+ const operations = {
6219
+ clear: { name: "clear", dataDecoder: basePrefsConfigDecoder },
6220
+ clearAll: { name: "clearAll" },
6221
+ get: { name: "get", dataDecoder: basePrefsConfigDecoder, resultDecoder: getPrefsResultDecoder },
6222
+ getAll: { name: "getAll", resultDecoder: getAllPrefsResultDecoder },
6223
+ set: { name: "set", dataDecoder: changePrefsDataDecoder },
6224
+ update: { name: "update", dataDecoder: changePrefsDataDecoder },
6225
+ prefsChanged: { name: "prefsChanged", dataDecoder: getPrefsResultDecoder },
6226
+ prefsHello: { name: "prefsHello", resultDecoder: prefsHelloSuccessDecoder },
6227
+ };
6228
+
6229
+ class PrefsController {
6230
+ constructor() {
6231
+ this.registry = lib$3();
6232
+ }
6233
+ handlePlatformShutdown() {
6234
+ this.registry.clear();
6235
+ }
6236
+ start(coreGlue, ioc) {
6237
+ return __awaiter$1(this, void 0, void 0, function* () {
6238
+ this.logger = coreGlue.logger.subLogger("prefs.controller.web");
6239
+ this.logger.trace("starting the web prefs controller");
6240
+ this.addOperationsExecutors();
6241
+ this.bridge = ioc.bridge;
6242
+ this.config = ioc.config;
6243
+ this.appManagerController = ioc.appManagerController;
6244
+ try {
6245
+ const prefsHelloSuccess = yield this.bridge.send("prefs", operations.prefsHello, undefined, undefined, { includeOperationCheck: true });
6246
+ this.platformAppName = prefsHelloSuccess.platform.app;
6247
+ }
6248
+ catch (error) {
6249
+ this.logger.warn("The platform of this client is outdated and does not support Prefs API.");
6250
+ return;
6251
+ }
6252
+ this.logger.trace("no need for platform registration, attaching the prefs property to glue and returning");
6253
+ const api = this.toApi();
6254
+ coreGlue.prefs = api;
6255
+ });
6256
+ }
6257
+ handleBridgeMessage(args) {
6258
+ return __awaiter$1(this, void 0, void 0, function* () {
6259
+ const operationName = prefsOperationTypesDecoder.runWithException(args.operation);
6260
+ const operation = operations[operationName];
6261
+ if (!operation.execute) {
6262
+ return;
6263
+ }
6264
+ let operationData = args.data;
6265
+ if (operation.dataDecoder) {
6266
+ operationData = operation.dataDecoder.runWithException(args.data);
6267
+ }
6268
+ return yield operation.execute(operationData);
6269
+ });
6270
+ }
6271
+ addOperationsExecutors() {
6272
+ operations.prefsChanged.execute = this.handleOnChanged.bind(this);
6273
+ }
6274
+ toApi() {
6275
+ const api = {
6276
+ clear: this.clear.bind(this),
6277
+ clearAll: this.clearAll.bind(this),
6278
+ clearFor: this.clearFor.bind(this),
6279
+ get: this.get.bind(this),
6280
+ getAll: this.getAll.bind(this),
6281
+ set: this.set.bind(this),
6282
+ setFor: this.setFor.bind(this),
6283
+ subscribe: this.subscribe.bind(this),
6284
+ subscribeFor: this.subscribeFor.bind(this),
6285
+ update: this.update.bind(this),
6286
+ updateFor: this.updateFor.bind(this),
6287
+ };
6288
+ return api;
6289
+ }
6290
+ clear() {
6291
+ return __awaiter$1(this, void 0, void 0, function* () {
6292
+ const app = this.getMyAppName();
6293
+ yield this.clearFor(app);
6294
+ });
6295
+ }
6296
+ clearAll() {
6297
+ return __awaiter$1(this, void 0, void 0, function* () {
6298
+ yield this.bridge.send("prefs", operations.clearAll, undefined, undefined, { includeOperationCheck: true });
6299
+ });
6300
+ }
6301
+ clearFor(app) {
6302
+ return __awaiter$1(this, void 0, void 0, function* () {
6303
+ const verifiedApp = nonEmptyStringDecoder.runWithException(app);
6304
+ yield this.bridge.send("prefs", operations.clear, { app: verifiedApp }, undefined, { includeOperationCheck: true });
6305
+ });
6306
+ }
6307
+ get(app) {
6308
+ return __awaiter$1(this, void 0, void 0, function* () {
6309
+ const verifiedApp = app === undefined || app === null ? this.getMyAppName() : nonEmptyStringDecoder.runWithException(app);
6310
+ const { prefs } = yield this.bridge.send("prefs", operations.get, { app: verifiedApp }, undefined, { includeOperationCheck: true });
6311
+ return prefs;
6312
+ });
6313
+ }
6314
+ getAll() {
6315
+ return __awaiter$1(this, void 0, void 0, function* () {
6316
+ const result = yield this.bridge.send("prefs", operations.getAll, undefined, undefined, { includeOperationCheck: true });
6317
+ return result;
6318
+ });
6319
+ }
6320
+ set(data, options) {
6321
+ var _a;
6322
+ return __awaiter$1(this, void 0, void 0, function* () {
6323
+ const verifiedOptions = optional$1(basePrefsConfigDecoder).runWithException(options);
6324
+ const app = (_a = verifiedOptions === null || verifiedOptions === void 0 ? void 0 : verifiedOptions.app) !== null && _a !== void 0 ? _a : this.getMyAppName();
6325
+ yield this.setFor(app, data);
6326
+ });
6327
+ }
6328
+ setFor(app, data) {
6329
+ return __awaiter$1(this, void 0, void 0, function* () {
6330
+ const verifiedApp = nonEmptyStringDecoder.runWithException(app);
6331
+ const verifiedData = object$1().runWithException(data);
6332
+ yield this.bridge.send("prefs", operations.set, { app: verifiedApp, data: verifiedData }, undefined, { includeOperationCheck: true });
6333
+ });
6334
+ }
6335
+ subscribe(callback) {
6336
+ const app = this.getMyAppName();
6337
+ return this.subscribeFor(app, callback);
6338
+ }
6339
+ subscribeFor(app, callback) {
6340
+ const verifiedApp = nonEmptyStringDecoder.runWithException(app);
6341
+ const applications = this.appManagerController.getApplications();
6342
+ const isValidApp = verifiedApp === this.platformAppName || applications.some((application) => application.name === verifiedApp);
6343
+ if (!isValidApp) {
6344
+ throw new Error(`The provided app name "${app}" is not valid.`);
6345
+ }
6346
+ if (typeof callback !== "function") {
6347
+ throw new Error("Cannot subscribe to prefs, because the provided callback is not a function!");
6348
+ }
6349
+ const subscriptionKey = this.getSubscriptionKey(verifiedApp);
6350
+ this.get(verifiedApp).then(callback);
6351
+ return this.registry.add(subscriptionKey, callback);
6352
+ }
6353
+ update(data, options) {
6354
+ var _a;
6355
+ return __awaiter$1(this, void 0, void 0, function* () {
6356
+ const verifiedOptions = optional$1(basePrefsConfigDecoder).runWithException(options);
6357
+ const app = (_a = verifiedOptions === null || verifiedOptions === void 0 ? void 0 : verifiedOptions.app) !== null && _a !== void 0 ? _a : this.getMyAppName();
6358
+ yield this.updateFor(app, data);
6359
+ });
6360
+ }
6361
+ updateFor(app, data) {
6362
+ return __awaiter$1(this, void 0, void 0, function* () {
6363
+ const verifiedApp = nonEmptyStringDecoder.runWithException(app);
6364
+ const verifiedData = object$1().runWithException(data);
6365
+ yield this.bridge.send("prefs", operations.update, { app: verifiedApp, data: verifiedData }, undefined, { includeOperationCheck: true });
6366
+ });
6367
+ }
6368
+ getMyAppName() {
6369
+ var _a;
6370
+ const myAppName = this.config.isPlatformInternal ? this.platformAppName : (_a = this.appManagerController.me) === null || _a === void 0 ? void 0 : _a.application.name;
6371
+ if (!myAppName) {
6372
+ throw new Error("App Preferences operations can not be executed for windows that do not have app!");
6373
+ }
6374
+ return myAppName;
6375
+ }
6376
+ getSubscriptionKey(app) {
6377
+ return `prefs-changed-${app}`;
6378
+ }
6379
+ handleOnChanged({ prefs }) {
6380
+ return __awaiter$1(this, void 0, void 0, function* () {
6381
+ const subscriptionKey = this.getSubscriptionKey(prefs.app);
6382
+ this.registry.execute(subscriptionKey, prefs);
6383
+ });
6384
+ }
6385
+ }
6386
+
5982
6387
  class IoC {
5983
6388
  constructor() {
5984
6389
  this.controllers = {
@@ -5990,7 +6395,8 @@ class IoC {
5990
6395
  channels: this.channelsController,
5991
6396
  system: this.systemController,
5992
6397
  extension: this.extensionController,
5993
- themes: this.themesController
6398
+ themes: this.themesController,
6399
+ prefs: this.prefsController
5994
6400
  };
5995
6401
  }
5996
6402
  get communicationId() {
@@ -6053,6 +6459,12 @@ class IoC {
6053
6459
  }
6054
6460
  return this._channelsControllerInstance;
6055
6461
  }
6462
+ get prefsController() {
6463
+ if (!this._prefsControllerInstance) {
6464
+ this._prefsControllerInstance = new PrefsController();
6465
+ }
6466
+ return this._prefsControllerInstance;
6467
+ }
6056
6468
  get extensionController() {
6057
6469
  if (!this._extensionController) {
6058
6470
  this._extensionController = new ExtController();
@@ -6118,7 +6530,7 @@ class IoC {
6118
6530
  }
6119
6531
  }
6120
6532
 
6121
- var version$2 = "3.1.2";
6533
+ var version$2 = "3.2.0";
6122
6534
 
6123
6535
  const createFactoryFunction = (coreFactoryFunction) => {
6124
6536
  return (userConfig) => __awaiter$1(void 0, void 0, void 0, function* () {
@@ -8439,7 +8851,7 @@ var GW3ProtocolImpl = (function () {
8439
8851
  });
8440
8852
  };
8441
8853
  GW3ProtocolImpl.prototype.getNewGWToken = function () {
8442
- if (typeof window !== undefined) {
8854
+ if (typeof window !== "undefined") {
8443
8855
  var glue42gd = window.glue42gd;
8444
8856
  if (glue42gd) {
8445
8857
  return glue42gd.getGWToken();
@@ -8777,6 +9189,11 @@ var WebPlatformTransport = (function () {
8777
9189
  if (!data || _this.rejected) {
8778
9190
  return;
8779
9191
  }
9192
+ var allowedOrigins = _this.settings.allowedOrigins || [];
9193
+ if (allowedOrigins.length && !allowedOrigins.includes(event.origin)) {
9194
+ _this.logger.warn("received a message from an origin which is not in the allowed list: ".concat(event.origin));
9195
+ return;
9196
+ }
8780
9197
  if (!_this.checkMessageTypeValid(data.type)) {
8781
9198
  _this.logger.error("cannot handle the incoming glue42 core message, because the type is invalid: ".concat(data.type));
8782
9199
  return;
@@ -8884,6 +9301,11 @@ var WebPlatformTransport = (function () {
8884
9301
  if (!extData) {
8885
9302
  return;
8886
9303
  }
9304
+ var allowedOrigins = _this.settings.allowedOrigins || [];
9305
+ if (allowedOrigins.length && !allowedOrigins.includes(event.origin)) {
9306
+ _this.logger.warn("received a message from an origin which is not in the allowed list: ".concat(event.origin));
9307
+ return;
9308
+ }
8887
9309
  _this.registry.execute("onMessage", extData);
8888
9310
  });
8889
9311
  if (this.connectionResolve) {
@@ -9761,7 +10183,7 @@ var ContextMessageReplaySpec = {
9761
10183
  }
9762
10184
  };
9763
10185
 
9764
- var version = "6.1.0";
10186
+ var version = "6.2.0";
9765
10187
 
9766
10188
  function prepareConfig (configuration, ext, glue42gd) {
9767
10189
  var _a, _b, _c, _d;
@@ -12037,7 +12459,7 @@ var GW3Bridge = (function () {
12037
12459
  currentContext = _b.sent();
12038
12460
  _b.label = 4;
12039
12461
  case 4:
12040
- calculatedDelta = this.protocolVersion === 2 ?
12462
+ calculatedDelta = this.setPathSupported ?
12041
12463
  this.calculateContextDeltaV2(currentContext, delta) :
12042
12464
  this.calculateContextDeltaV1(currentContext, delta);
12043
12465
  if (!Object.keys(calculatedDelta.added).length
@@ -13542,41 +13964,46 @@ var Server = (function () {
13542
13964
  return this.registerCore(methodDefinition, wrappedCallbackFunction);
13543
13965
  };
13544
13966
  Server.prototype.registerAsync = function (methodDefinition, callback) {
13967
+ var _this = this;
13545
13968
  if (!methodDefinition) {
13546
13969
  return Promise.reject("Method definition is required. Please, provide either a unique string for a method name or a “methodDefinition” object with a required “name” property.");
13547
13970
  }
13548
13971
  if (typeof callback !== "function") {
13549
13972
  return Promise.reject("The second parameter must be a callback function. Method: ".concat(typeof methodDefinition === "string" ? methodDefinition : methodDefinition.name));
13550
13973
  }
13551
- var wrappedCallback = function (context, resultCallback) {
13552
- try {
13553
- var resultCalled_1 = false;
13554
- var success = function (result) {
13555
- if (!resultCalled_1) {
13556
- resultCallback(undefined, result);
13557
- }
13558
- resultCalled_1 = true;
13559
- };
13560
- var error = function (e) {
13561
- if (!resultCalled_1) {
13562
- if (!e) {
13563
- e = "";
13974
+ var wrappedCallback = function (context, resultCallback) { return __awaiter(_this, void 0, void 0, function () {
13975
+ var resultCalled_1, success, error, methodResult;
13976
+ return __generator(this, function (_a) {
13977
+ try {
13978
+ resultCalled_1 = false;
13979
+ success = function (result) {
13980
+ if (!resultCalled_1) {
13981
+ resultCallback(undefined, result);
13982
+ }
13983
+ resultCalled_1 = true;
13984
+ };
13985
+ error = function (e) {
13986
+ if (!resultCalled_1) {
13987
+ if (!e) {
13988
+ e = "";
13989
+ }
13990
+ resultCallback(e, e);
13564
13991
  }
13565
- resultCallback(e, e);
13992
+ resultCalled_1 = true;
13993
+ };
13994
+ methodResult = callback(context.args, context.instance, success, error);
13995
+ if (methodResult && typeof methodResult.then === "function") {
13996
+ methodResult
13997
+ .then(success)
13998
+ .catch(error);
13566
13999
  }
13567
- resultCalled_1 = true;
13568
- };
13569
- var methodResult = callback(context.args, context.instance, success, error);
13570
- if (methodResult && typeof methodResult.then === "function") {
13571
- methodResult
13572
- .then(success)
13573
- .catch(error);
13574
14000
  }
13575
- }
13576
- catch (e) {
13577
- resultCallback(e, undefined);
13578
- }
13579
- };
14001
+ catch (e) {
14002
+ resultCallback(e, undefined);
14003
+ }
14004
+ return [2];
14005
+ });
14006
+ }); };
13580
14007
  wrappedCallback.userCallbackAsync = callback;
13581
14008
  return this.registerCore(methodDefinition, wrappedCallback);
13582
14009
  };
@@ -13687,7 +14114,7 @@ var Server = (function () {
13687
14114
  return [2, Promise.reject("Please, provide a (unique) string value for the \u201Cname\u201D property in the \u201CmethodDefinition\u201D object: ".concat(JSON.stringify(method)))];
13688
14115
  }
13689
14116
  unregisterInProgress = this.currentlyUnregistering[methodDefinition.name];
13690
- if (!unregisterInProgress) return [3, 2];
14117
+ if (!(typeof unregisterInProgress !== "undefined")) return [3, 2];
13691
14118
  return [4, unregisterInProgress];
13692
14119
  case 1:
13693
14120
  _a.sent();