@pitcher/js-api 1.21.0-beta.10 → 1.21.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/js-api.esm.js CHANGED
@@ -3255,21 +3255,45 @@ async function preselect_sfdc_meeting_id(payload) {
3255
3255
  return response.data;
3256
3256
  }
3257
3257
 
3258
+ const contentUi = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
3259
+ __proto__: null,
3260
+ open,
3261
+ preselect_sfdc_meeting_id,
3262
+ select_content,
3263
+ toast: toast$1,
3264
+ ui_select_content
3265
+ }, Symbol.toStringTag, { value: 'Module' }));
3266
+
3258
3267
  async function embeddable_ready$1() {
3259
3268
  const pr = await usePostRobot();
3260
3269
  await pr.send(window.parent, UI_API_METHOD_TYPES.UI_EMBEDDABLE_READY);
3261
3270
  }
3262
3271
 
3272
+ const loadingUi = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
3273
+ __proto__: null,
3274
+ embeddable_ready: embeddable_ready$1
3275
+ }, Symbol.toStringTag, { value: 'Module' }));
3276
+
3263
3277
  async function update_location(payload) {
3264
3278
  const pr = await usePostRobot();
3265
3279
  return pr.send(window.top, UI_API_METHOD_TYPES.UI_UPDATE_LOCATION, payload);
3266
3280
  }
3267
3281
 
3282
+ const locationUi = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
3283
+ __proto__: null,
3284
+ update_location
3285
+ }, Symbol.toStringTag, { value: 'Module' }));
3286
+
3268
3287
  async function capture_app_error(payload) {
3269
3288
  const pr = await usePostRobot();
3270
3289
  pr.send(window.parent, UI_API_METHOD_TYPES.UI_CAPTURE_APP_ERROR, payload);
3271
3290
  }
3272
3291
 
3292
+ const appErrorsUi = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
3293
+ __proto__: null,
3294
+ capture_app_error
3295
+ }, Symbol.toStringTag, { value: 'Module' }));
3296
+
3273
3297
  async function update_canvas(payload) {
3274
3298
  const pr = await usePostRobot();
3275
3299
  return pr.send(window.parent, UI_API_METHOD_TYPES.UI_UPDATE_CANVAS, payload).then((response) => response.data);
@@ -3293,6 +3317,16 @@ async function canvas_navigate_page(payload) {
3293
3317
  pr.send(window.parent, UI_API_METHOD_TYPES.UI_CANVAS_NAVIGATE_PAGE, payload);
3294
3318
  }
3295
3319
 
3320
+ const canvasUi = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
3321
+ __proto__: null,
3322
+ app_loaded,
3323
+ app_resize,
3324
+ canvas_navigate_next_page,
3325
+ canvas_navigate_page,
3326
+ canvas_navigate_previous_page,
3327
+ update_canvas
3328
+ }, Symbol.toStringTag, { value: 'Module' }));
3329
+
3296
3330
  async function complete_postcall(payload) {
3297
3331
  const pr = await usePostRobot();
3298
3332
  pr.send(window.parent, UI_API_METHOD_TYPES.UI_COMPLETE_POSTCALL, payload);
@@ -3310,8 +3344,15 @@ async function set_postcall_style(payload) {
3310
3344
  pr.send(window.parent, UI_API_METHOD_TYPES.UI_SET_POSTCALL_STYLE, payload);
3311
3345
  }
3312
3346
 
3347
+ const postCallUi = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
3348
+ __proto__: null,
3349
+ complete_postcall,
3350
+ disable_postcall_submit,
3351
+ enable_postcall_submit,
3352
+ set_postcall_style
3353
+ }, Symbol.toStringTag, { value: 'Module' }));
3354
+
3313
3355
  async function on_native(type, handler) {
3314
- console.log("attaching native handler for type", type);
3315
3356
  const messageListener = (event) => {
3316
3357
  if (event.data.type === type) {
3317
3358
  handler(event.data.body);
@@ -3350,35 +3391,21 @@ async function ui_broadcast(payload) {
3350
3391
  const pr = await usePostRobot();
3351
3392
  pr.send(window.parent, UI_API_METHOD_TYPES.UI_BROADCAST, payload);
3352
3393
  }
3353
-
3354
- const ui = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
3355
- __proto__: null,
3356
- app_loaded,
3357
- app_resize,
3358
- canvas_navigate_next_page,
3359
- canvas_navigate_page,
3360
- canvas_navigate_previous_page,
3361
- capture_app_error,
3362
- complete_postcall,
3363
- disable_postcall_submit,
3364
- embeddable_ready: embeddable_ready$1,
3365
- enable_postcall_submit,
3366
- on: on$2,
3367
- on_app_set_data,
3368
- on_app_update_data,
3369
- on_canvas_updated,
3370
- on_meeting_canceled,
3371
- on_section_list_updated,
3372
- open,
3373
- preselect_sfdc_meeting_id,
3374
- select_content,
3375
- set_postcall_style,
3376
- toast: toast$1,
3377
- ui_broadcast,
3378
- ui_select_content,
3379
- update_canvas,
3380
- update_location
3381
- }, Symbol.toStringTag, { value: 'Module' }));
3394
+ const ui = {
3395
+ on: on$2,
3396
+ on_meeting_canceled,
3397
+ on_canvas_updated,
3398
+ on_section_list_updated,
3399
+ on_app_set_data,
3400
+ on_app_update_data,
3401
+ ui_broadcast,
3402
+ ...contentUi,
3403
+ ...loadingUi,
3404
+ ...locationUi,
3405
+ ...appErrorsUi,
3406
+ ...canvasUi,
3407
+ ...postCallUi
3408
+ };
3382
3409
 
3383
3410
  const ADMIN_MESSAGE = "ADMIN_MESSAGE";
3384
3411
  const ADMIN_MESSAGE_TYPES = {
@@ -3396,6 +3423,7 @@ const ADMIN_API_METHOD_TYPES = {
3396
3423
  GET_ENV: "admin_get_env",
3397
3424
  GET_FILE: "admin_get_file",
3398
3425
  GET_FILES: "admin_get_files",
3426
+ SELECT_CONTENT: "admin_select_content",
3399
3427
  GET_INSTANCE_METADATA_TEMPLATES: "admin_get_instance_metadata_templates",
3400
3428
  TOAST: "admin_toast",
3401
3429
  UPDATE_CANVAS: "admin_update_canvas"
@@ -3407,6 +3435,11 @@ async function getEnv$1() {
3407
3435
  return response.data;
3408
3436
  }
3409
3437
 
3438
+ const envAdmin = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
3439
+ __proto__: null,
3440
+ getEnv: getEnv$1
3441
+ }, Symbol.toStringTag, { value: 'Module' }));
3442
+
3410
3443
  async function createCanvas(payload) {
3411
3444
  const pr = await usePostRobot();
3412
3445
  const response = await pr.send(window.parent, ADMIN_API_METHOD_TYPES.CREATE_CANVAS, payload);
@@ -3428,12 +3461,25 @@ async function updateCanvas(payload) {
3428
3461
  return r.data;
3429
3462
  }
3430
3463
 
3464
+ const canvasAdmin = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
3465
+ __proto__: null,
3466
+ createCanvas,
3467
+ getCanvas,
3468
+ getCanvases,
3469
+ updateCanvas
3470
+ }, Symbol.toStringTag, { value: 'Module' }));
3471
+
3431
3472
  async function getInstanceMetadataTemplates(payload) {
3432
3473
  const pr = await usePostRobot();
3433
3474
  const response = await pr.send(window.parent, ADMIN_API_METHOD_TYPES.GET_INSTANCE_METADATA_TEMPLATES, payload);
3434
3475
  return response.data;
3435
3476
  }
3436
3477
 
3478
+ const metadataTemplatesAdmin = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
3479
+ __proto__: null,
3480
+ getInstanceMetadataTemplates
3481
+ }, Symbol.toStringTag, { value: 'Module' }));
3482
+
3437
3483
  async function on$1(type, handler) {
3438
3484
  const pr = await usePostRobot();
3439
3485
  const listener = pr.on(type, (e) => handler(e.data));
@@ -3443,18 +3489,13 @@ async function toast(payload) {
3443
3489
  const pr = await usePostRobot();
3444
3490
  await pr.send(window.parent, ADMIN_API_METHOD_TYPES.TOAST, payload);
3445
3491
  }
3446
-
3447
- const admin = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
3448
- __proto__: null,
3449
- createCanvas,
3450
- getCanvas,
3451
- getCanvases,
3452
- getEnv: getEnv$1,
3453
- getInstanceMetadataTemplates,
3454
- on: on$1,
3455
- toast,
3456
- updateCanvas
3457
- }, Symbol.toStringTag, { value: 'Module' }));
3492
+ const admin = {
3493
+ on: on$1,
3494
+ toast,
3495
+ ...envAdmin,
3496
+ ...canvasAdmin,
3497
+ ...metadataTemplatesAdmin
3498
+ };
3458
3499
 
3459
3500
  const DSR_MESSAGE = "DSR_MESSAGE";
3460
3501
  const DSR_MESSAGE_TYPES = {
@@ -3475,23 +3516,31 @@ async function getEnv() {
3475
3516
  return response.data;
3476
3517
  }
3477
3518
 
3519
+ const envDsr = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
3520
+ __proto__: null,
3521
+ getEnv
3522
+ }, Symbol.toStringTag, { value: 'Module' }));
3523
+
3478
3524
  async function embeddable_ready() {
3479
3525
  const pr = await usePostRobot();
3480
3526
  await pr.send(window.parent, DSR_API_METHOD_TYPES.DSR_EMBEDDABLE_READY);
3481
3527
  }
3482
3528
 
3529
+ const loadingDsr = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
3530
+ __proto__: null,
3531
+ embeddable_ready
3532
+ }, Symbol.toStringTag, { value: 'Module' }));
3533
+
3483
3534
  async function on(type, handler) {
3484
3535
  const pr = await usePostRobot();
3485
3536
  const listener = pr.on(type, (e) => handler(e.data));
3486
3537
  return listener.cancel;
3487
3538
  }
3488
-
3489
- const dsr = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
3490
- __proto__: null,
3491
- embeddable_ready,
3492
- getEnv,
3493
- on
3494
- }, Symbol.toStringTag, { value: 'Module' }));
3539
+ const dsr = {
3540
+ on,
3541
+ ...envDsr,
3542
+ ...loadingDsr
3543
+ };
3495
3544
 
3496
3545
  let highLevelApi;
3497
3546
  let prevOptions;
@@ -3502,38 +3551,24 @@ function usePitcherApi(options) {
3502
3551
  }
3503
3552
  return highLevelApi;
3504
3553
  }
3505
- const uiApi = Object.entries(
3506
- ui
3507
- ).reduce(
3508
- (acc, [key, value]) => {
3509
- acc[key] = value;
3510
- acc[snakeCase(key)] = value;
3511
- return acc;
3512
- },
3513
- {}
3514
- );
3554
+ function enhanceWithSnakeCase(api) {
3555
+ Object.entries(api).forEach(([key, value]) => {
3556
+ const newKey = snakeCase(key);
3557
+ if (newKey && !api[newKey]) {
3558
+ api[newKey] = value;
3559
+ }
3560
+ });
3561
+ return api;
3562
+ }
3563
+ const uiApi = enhanceWithSnakeCase(ui);
3564
+ const adminApi = enhanceWithSnakeCase(admin);
3565
+ const dsrApi = enhanceWithSnakeCase(dsr);
3515
3566
  function useUi() {
3516
3567
  return uiApi;
3517
3568
  }
3518
- const adminApi = Object.entries(admin).reduce(
3519
- (acc, [key, value]) => {
3520
- acc[key] = value;
3521
- acc[snakeCase(key)] = value;
3522
- return acc;
3523
- },
3524
- {}
3525
- );
3526
3569
  function useAdmin() {
3527
3570
  return adminApi;
3528
3571
  }
3529
- const dsrApi = Object.entries(dsr).reduce(
3530
- (acc, [key, value]) => {
3531
- acc[key] = value;
3532
- acc[snakeCase(key)] = value;
3533
- return acc;
3534
- },
3535
- {}
3536
- );
3537
3572
  function useDsr() {
3538
3573
  return dsrApi;
3539
3574
  }