commandbar 1.5.0 → 1.6.3

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.
@@ -4,7 +4,6 @@ export declare const ResourceSettingsV: t.PartialC<{
4
4
  search: t.BooleanC;
5
5
  label_field: t.StringC;
6
6
  useCategory: t.BooleanC;
7
- showResources: t.BooleanC;
8
7
  search_fields: t.ArrayC<t.StringC>;
9
8
  auto_execute: t.BooleanC;
10
9
  unfurl: t.BooleanC;
@@ -14,13 +13,15 @@ export declare const ResourceSettingsV: t.PartialC<{
14
13
  max_options_count: t.UnionC<[t.NumberC, t.NullC]>;
15
14
  sortFunction: t.AnyC;
16
15
  default_command_id: t.UnionC<[t.NumberC, t.UndefinedC]>;
16
+ showResources: t.BooleanC;
17
+ show_with_no_results: t.BooleanC;
18
+ setting_pin_to_bottom: t.BooleanC;
17
19
  }>;
18
20
  export declare const ResourceSettingsByContextKeyV: t.RecordC<t.StringC, t.PartialC<{
19
21
  name: t.StringC;
20
22
  search: t.BooleanC;
21
23
  label_field: t.StringC;
22
24
  useCategory: t.BooleanC;
23
- showResources: t.BooleanC;
24
25
  search_fields: t.ArrayC<t.StringC>;
25
26
  auto_execute: t.BooleanC;
26
27
  unfurl: t.BooleanC;
@@ -30,4 +31,7 @@ export declare const ResourceSettingsByContextKeyV: t.RecordC<t.StringC, t.Parti
30
31
  max_options_count: t.UnionC<[t.NumberC, t.NullC]>;
31
32
  sortFunction: t.AnyC;
32
33
  default_command_id: t.UnionC<[t.NumberC, t.UndefinedC]>;
34
+ showResources: t.BooleanC;
35
+ show_with_no_results: t.BooleanC;
36
+ setting_pin_to_bottom: t.BooleanC;
33
37
  }>>;
@@ -1,10 +1,10 @@
1
1
  /*******************************************************************************/
2
2
  import * as t from 'io-ts';
3
3
  /*******************************************************************************/
4
- export declare const ConditionOperatorV: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
4
+ export declare const ConditionOperatorV: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
5
5
  export declare const ConditionV: t.TypeC<{
6
6
  field: t.StringC;
7
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
7
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
8
8
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
9
9
  }>;
10
10
  export declare const ContextArgumentV: t.IntersectionC<[t.TypeC<{
@@ -20,7 +20,7 @@ export declare const ContextArgumentV: t.IntersectionC<[t.TypeC<{
20
20
  label_field: t.StringC;
21
21
  availability_condition: t.ArrayC<t.TypeC<{
22
22
  field: t.StringC;
23
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
23
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
24
24
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
25
25
  }>>;
26
26
  loaded: t.ArrayC<t.AnyC>;
@@ -29,7 +29,7 @@ export declare const ContextArgumentV: t.IntersectionC<[t.TypeC<{
29
29
  }>]>;
30
30
  export declare const SetArgumentV: t.IntersectionC<[t.TypeC<{
31
31
  type: t.LiteralC<"set">;
32
- value: t.UnionC<[t.ArrayC<t.StringC>, t.ArrayC<t.NumberC>]>;
32
+ value: t.UnionC<[t.ArrayC<t.StringC>, t.ArrayC<t.NumberC>, t.ArrayC<t.UnknownRecordC>]>;
33
33
  order_key: t.NumberC;
34
34
  }>, t.PartialC<{
35
35
  label: t.StringC;
@@ -40,7 +40,7 @@ export declare const SetArgumentV: t.IntersectionC<[t.TypeC<{
40
40
  label_field: t.StringC;
41
41
  availability_condition: t.ArrayC<t.TypeC<{
42
42
  field: t.StringC;
43
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
43
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
44
44
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
45
45
  }>>;
46
46
  loaded: t.ArrayC<t.AnyC>;
@@ -60,7 +60,7 @@ export declare const DynamicArgumentV: t.IntersectionC<[t.TypeC<{
60
60
  label_field: t.StringC;
61
61
  availability_condition: t.ArrayC<t.TypeC<{
62
62
  field: t.StringC;
63
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
63
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
64
64
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
65
65
  }>>;
66
66
  loaded: t.ArrayC<t.AnyC>;
@@ -81,7 +81,7 @@ export declare const DependentArgumentV: t.IntersectionC<[t.TypeC<{
81
81
  label_field: t.StringC;
82
82
  availability_condition: t.ArrayC<t.TypeC<{
83
83
  field: t.StringC;
84
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
84
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
85
85
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
86
86
  }>>;
87
87
  loaded: t.ArrayC<t.AnyC>;
@@ -101,7 +101,7 @@ export declare const FunctionArgumentV: t.IntersectionC<[t.TypeC<{
101
101
  label_field: t.StringC;
102
102
  availability_condition: t.ArrayC<t.TypeC<{
103
103
  field: t.StringC;
104
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
104
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
105
105
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
106
106
  }>>;
107
107
  loaded: t.ArrayC<t.AnyC>;
@@ -121,7 +121,7 @@ export declare const ArgumentTypeV: t.UnionC<[t.IntersectionC<[t.TypeC<{
121
121
  label_field: t.StringC;
122
122
  availability_condition: t.ArrayC<t.TypeC<{
123
123
  field: t.StringC;
124
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
124
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
125
125
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
126
126
  }>>;
127
127
  loaded: t.ArrayC<t.AnyC>;
@@ -129,7 +129,7 @@ export declare const ArgumentTypeV: t.UnionC<[t.IntersectionC<[t.TypeC<{
129
129
  allow_create_label: t.StringC;
130
130
  }>]>, t.IntersectionC<[t.TypeC<{
131
131
  type: t.LiteralC<"set">;
132
- value: t.UnionC<[t.ArrayC<t.StringC>, t.ArrayC<t.NumberC>]>;
132
+ value: t.UnionC<[t.ArrayC<t.StringC>, t.ArrayC<t.NumberC>, t.ArrayC<t.UnknownRecordC>]>;
133
133
  order_key: t.NumberC;
134
134
  }>, t.PartialC<{
135
135
  label: t.StringC;
@@ -140,7 +140,7 @@ export declare const ArgumentTypeV: t.UnionC<[t.IntersectionC<[t.TypeC<{
140
140
  label_field: t.StringC;
141
141
  availability_condition: t.ArrayC<t.TypeC<{
142
142
  field: t.StringC;
143
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
143
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
144
144
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
145
145
  }>>;
146
146
  loaded: t.ArrayC<t.AnyC>;
@@ -159,7 +159,7 @@ export declare const ArgumentTypeV: t.UnionC<[t.IntersectionC<[t.TypeC<{
159
159
  label_field: t.StringC;
160
160
  availability_condition: t.ArrayC<t.TypeC<{
161
161
  field: t.StringC;
162
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
162
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
163
163
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
164
164
  }>>;
165
165
  loaded: t.ArrayC<t.AnyC>;
@@ -179,7 +179,7 @@ export declare const ArgumentTypeV: t.UnionC<[t.IntersectionC<[t.TypeC<{
179
179
  label_field: t.StringC;
180
180
  availability_condition: t.ArrayC<t.TypeC<{
181
181
  field: t.StringC;
182
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
182
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
183
183
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
184
184
  }>>;
185
185
  loaded: t.ArrayC<t.AnyC>;
@@ -198,7 +198,7 @@ export declare const ArgumentTypeV: t.UnionC<[t.IntersectionC<[t.TypeC<{
198
198
  label_field: t.StringC;
199
199
  availability_condition: t.ArrayC<t.TypeC<{
200
200
  field: t.StringC;
201
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
201
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
202
202
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
203
203
  }>>;
204
204
  loaded: t.ArrayC<t.AnyC>;
@@ -218,7 +218,7 @@ export declare const ArgumentMapV: t.RecordC<t.StringC, t.UnionC<[t.Intersection
218
218
  label_field: t.StringC;
219
219
  availability_condition: t.ArrayC<t.TypeC<{
220
220
  field: t.StringC;
221
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
221
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
222
222
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
223
223
  }>>;
224
224
  loaded: t.ArrayC<t.AnyC>;
@@ -226,7 +226,7 @@ export declare const ArgumentMapV: t.RecordC<t.StringC, t.UnionC<[t.Intersection
226
226
  allow_create_label: t.StringC;
227
227
  }>]>, t.IntersectionC<[t.TypeC<{
228
228
  type: t.LiteralC<"set">;
229
- value: t.UnionC<[t.ArrayC<t.StringC>, t.ArrayC<t.NumberC>]>;
229
+ value: t.UnionC<[t.ArrayC<t.StringC>, t.ArrayC<t.NumberC>, t.ArrayC<t.UnknownRecordC>]>;
230
230
  order_key: t.NumberC;
231
231
  }>, t.PartialC<{
232
232
  label: t.StringC;
@@ -237,7 +237,7 @@ export declare const ArgumentMapV: t.RecordC<t.StringC, t.UnionC<[t.Intersection
237
237
  label_field: t.StringC;
238
238
  availability_condition: t.ArrayC<t.TypeC<{
239
239
  field: t.StringC;
240
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
240
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
241
241
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
242
242
  }>>;
243
243
  loaded: t.ArrayC<t.AnyC>;
@@ -256,7 +256,7 @@ export declare const ArgumentMapV: t.RecordC<t.StringC, t.UnionC<[t.Intersection
256
256
  label_field: t.StringC;
257
257
  availability_condition: t.ArrayC<t.TypeC<{
258
258
  field: t.StringC;
259
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
259
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
260
260
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
261
261
  }>>;
262
262
  loaded: t.ArrayC<t.AnyC>;
@@ -276,7 +276,7 @@ export declare const ArgumentMapV: t.RecordC<t.StringC, t.UnionC<[t.Intersection
276
276
  label_field: t.StringC;
277
277
  availability_condition: t.ArrayC<t.TypeC<{
278
278
  field: t.StringC;
279
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
279
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
280
280
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
281
281
  }>>;
282
282
  loaded: t.ArrayC<t.AnyC>;
@@ -295,7 +295,7 @@ export declare const ArgumentMapV: t.RecordC<t.StringC, t.UnionC<[t.Intersection
295
295
  label_field: t.StringC;
296
296
  availability_condition: t.ArrayC<t.TypeC<{
297
297
  field: t.StringC;
298
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
298
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
299
299
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
300
300
  }>>;
301
301
  loaded: t.ArrayC<t.AnyC>;
@@ -318,7 +318,7 @@ export declare const StepArgumentTypeV: t.IntersectionC<[t.TypeC<{
318
318
  label_field: t.StringC;
319
319
  availability_condition: t.ArrayC<t.TypeC<{
320
320
  field: t.StringC;
321
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
321
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
322
322
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
323
323
  }>>;
324
324
  loaded: t.ArrayC<t.AnyC>;
@@ -326,7 +326,7 @@ export declare const StepArgumentTypeV: t.IntersectionC<[t.TypeC<{
326
326
  allow_create_label: t.StringC;
327
327
  }>]>, t.IntersectionC<[t.TypeC<{
328
328
  type: t.LiteralC<"set">;
329
- value: t.UnionC<[t.ArrayC<t.StringC>, t.ArrayC<t.NumberC>]>;
329
+ value: t.UnionC<[t.ArrayC<t.StringC>, t.ArrayC<t.NumberC>, t.ArrayC<t.UnknownRecordC>]>;
330
330
  order_key: t.NumberC;
331
331
  }>, t.PartialC<{
332
332
  label: t.StringC;
@@ -337,7 +337,7 @@ export declare const StepArgumentTypeV: t.IntersectionC<[t.TypeC<{
337
337
  label_field: t.StringC;
338
338
  availability_condition: t.ArrayC<t.TypeC<{
339
339
  field: t.StringC;
340
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
340
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
341
341
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
342
342
  }>>;
343
343
  loaded: t.ArrayC<t.AnyC>;
@@ -356,7 +356,7 @@ export declare const StepArgumentTypeV: t.IntersectionC<[t.TypeC<{
356
356
  label_field: t.StringC;
357
357
  availability_condition: t.ArrayC<t.TypeC<{
358
358
  field: t.StringC;
359
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
359
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
360
360
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
361
361
  }>>;
362
362
  loaded: t.ArrayC<t.AnyC>;
@@ -376,7 +376,7 @@ export declare const StepArgumentTypeV: t.IntersectionC<[t.TypeC<{
376
376
  label_field: t.StringC;
377
377
  availability_condition: t.ArrayC<t.TypeC<{
378
378
  field: t.StringC;
379
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
379
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
380
380
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
381
381
  }>>;
382
382
  loaded: t.ArrayC<t.AnyC>;
@@ -395,7 +395,7 @@ export declare const StepArgumentTypeV: t.IntersectionC<[t.TypeC<{
395
395
  label_field: t.StringC;
396
396
  availability_condition: t.ArrayC<t.TypeC<{
397
397
  field: t.StringC;
398
- operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">]>;
398
+ operator: t.UnionC<[t.LiteralC<"==">, t.LiteralC<"!=">, t.LiteralC<"isTruthy">, t.LiteralC<"isFalsy">]>;
399
399
  value: t.UnionC<[t.StringC, t.UndefinedC]>;
400
400
  }>>;
401
401
  loaded: t.ArrayC<t.AnyC>;
@@ -0,0 +1,80 @@
1
+ import * as t from 'io-ts';
2
+ export declare const operators: readonly ["is", "isNot", "isTrue", "isFalse", "isTruthy", "isFalsy", "startsWith", "endsWith", "includes", "doesNotInclude", "matchesRegex", "isGreaterThan", "isLessThan", "isDefined", "isNotDefined", "classnameOnPage", "idOnPage"];
3
+ declare const OperatorV: t.KeyofC<{
4
+ includes: null;
5
+ endsWith: null;
6
+ startsWith: null;
7
+ is: null;
8
+ isTruthy: null;
9
+ isFalsy: null;
10
+ isNot: null;
11
+ isTrue: null;
12
+ isFalse: null;
13
+ doesNotInclude: null;
14
+ matchesRegex: null;
15
+ isGreaterThan: null;
16
+ isLessThan: null;
17
+ isDefined: null;
18
+ isNotDefined: null;
19
+ classnameOnPage: null;
20
+ idOnPage: null;
21
+ }>;
22
+ export declare const AvailabilityRuleV: t.IntersectionC<[t.TypeC<{
23
+ type: t.UnionC<[t.LiteralC<"context">, t.LiteralC<"url">, t.LiteralC<"element">]>;
24
+ operator: t.KeyofC<{
25
+ includes: null;
26
+ endsWith: null;
27
+ startsWith: null;
28
+ is: null;
29
+ isTruthy: null;
30
+ isFalsy: null;
31
+ isNot: null;
32
+ isTrue: null;
33
+ isFalse: null;
34
+ doesNotInclude: null;
35
+ matchesRegex: null;
36
+ isGreaterThan: null;
37
+ isLessThan: null;
38
+ isDefined: null;
39
+ isNotDefined: null;
40
+ classnameOnPage: null;
41
+ idOnPage: null;
42
+ }>;
43
+ }>, t.PartialC<{
44
+ field: t.StringC;
45
+ value: t.StringC;
46
+ reason: t.StringC;
47
+ }>]>;
48
+ export declare const RecommendationRuleV: t.IntersectionC<[t.TypeC<{
49
+ type: t.UnionC<[t.LiteralC<"context">, t.LiteralC<"url">, t.LiteralC<"element">, t.LiteralC<"always">]>;
50
+ }>, t.PartialC<{
51
+ operator: t.KeyofC<{
52
+ includes: null;
53
+ endsWith: null;
54
+ startsWith: null;
55
+ is: null;
56
+ isTruthy: null;
57
+ isFalsy: null;
58
+ isNot: null;
59
+ isTrue: null;
60
+ isFalse: null;
61
+ doesNotInclude: null;
62
+ matchesRegex: null;
63
+ isGreaterThan: null;
64
+ isLessThan: null;
65
+ isDefined: null;
66
+ isNotDefined: null;
67
+ classnameOnPage: null;
68
+ idOnPage: null;
69
+ }>;
70
+ field: t.StringC;
71
+ value: t.StringC;
72
+ reason: t.StringC;
73
+ }>]>;
74
+ export declare type IRuleOperator = t.TypeOf<typeof OperatorV>;
75
+ export declare type IAvailabilityRule = t.TypeOf<typeof AvailabilityRuleV>;
76
+ export declare type IRecommendationRule = t.TypeOf<typeof RecommendationRuleV>;
77
+ export declare type IAvailabilityRuleType = IAvailabilityRule['type'];
78
+ export declare type IRecommendationRuleType = IRecommendationRule['type'];
79
+ export declare type IRule = IAvailabilityRule | IRecommendationRule;
80
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commandbar",
3
- "version": "1.5.0",
3
+ "version": "1.6.3",
4
4
  "description": "Javascript Utility for CommandBar",
5
5
  "main": "build/commandbar-js/src/index.js",
6
6
  "types": "build/commandbar-js/src/index.d.ts",
package/src/init.ts CHANGED
@@ -6,6 +6,7 @@ import { _configuration } from '../../internal/src/client/symbols';
6
6
 
7
7
  interface IInitOptions {
8
8
  debug?: boolean;
9
+ environment?: string;
9
10
  }
10
11
 
11
12
  const getSrc = (org: string) => {
@@ -57,7 +58,7 @@ const DEFAULT_OPTS = { debug: false };
57
58
  * finished loading yet.
58
59
  *
59
60
  * @param {string} org Your organization ID, which can be found [here](https://app.commandbar.com/docs/getting-started/installation#step-1:-install-commandbar).
60
- * @param {IInitOptions} [opts] Additional options to use for initialization: `debug` will enable additional logging
61
+ * @param {IInitOptions} [opts] Additional options to use for initialization: `debug` will enable additional logging, `environment` specifies the environment to load config from
61
62
  * output.
62
63
  */
63
64
  const init = (org: string, opts: IInitOptions = DEFAULT_OPTS) => {
@@ -68,9 +69,9 @@ const init = (org: string, opts: IInitOptions = DEFAULT_OPTS) => {
68
69
  return;
69
70
  }
70
71
 
71
- config.debug && console.log('CommandBar init...');
72
+ config.debug && console.log('CommandBar init...', { environment: opts.environment });
72
73
 
73
- getProxySDK()[_configuration] = { uuid: org };
74
+ getProxySDK()[_configuration] = { uuid: org, environment: opts.environment };
74
75
  loadLatest(org);
75
76
  };
76
77
 
package/src/snippet.ts CHANGED
@@ -41,10 +41,31 @@ export const snippet = (org: string) => {
41
41
  },
42
42
  w.CommandBar,
43
43
  );
44
+
45
+ const ASYNC_METHODS = ['addCommand', 'boot', 'getShortcuts'];
46
+
47
+ const sdk = proxy;
48
+
49
+ Object.assign(proxy, {
50
+ shareCallbacks: () => ({}),
51
+ shareContext: () => ({}),
52
+ });
53
+
44
54
  w.CommandBar = new Proxy(proxy, {
45
- get: function (_, prop: keyof typeof proxy) {
46
- if (prop in proxy) return proxy[prop];
55
+ get: function (_, prop) {
56
+ if (prop in sdk) return proxy[prop];
57
+ if (ASYNC_METHODS.includes(prop as string)) {
58
+ return function () {
59
+ // eslint-disable-next-line prefer-rest-params
60
+ const a = Array.prototype.slice.call(arguments);
61
+ return new Promise((resolve, reject) => {
62
+ a.unshift(prop, resolve, reject);
63
+ (proxy[_queue] as Array<unknown>).push(a);
64
+ });
65
+ };
66
+ }
47
67
  return function () {
68
+ // eslint-disable-next-line prefer-rest-params
48
69
  const a = Array.prototype.slice.call(arguments);
49
70
  a.unshift(prop);
50
71
  (proxy[_queue] as Array<unknown>).push(a);