@uniformdev/mesh-sdk 18.21.1-alpha.4 → 18.23.1-alpha.34

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/dist/index.d.ts CHANGED
@@ -638,7 +638,7 @@ type DataSourceLocation = MeshLocationCore<DataSourceLocationValue, DataSourceLo
638
638
  type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfiguration = unknown> = {
639
639
  rootNode: Omit<RootComponentInstance, 'slots' | '_data'>;
640
640
  parameterConfiguration: TParamConfiguration;
641
- component: Omit<ComponentInstance, 'slots'>;
641
+ component: Omit<ComponentInstance, 'slots' | '_parameters' | '_id'>;
642
642
  componentDefinitions: Record<string, ComponentDefinition | undefined>;
643
643
  parameterDefinition: ComponentDefinitionParameter;
644
644
  /** Settings defined at the integration level (arbitrary type used on settings location) */
@@ -749,23 +749,19 @@ type CloseDialogMessage = {
749
749
  };
750
750
  type GetDataResourceMessage = Pick<DataType, 'path' | 'headers' | 'parameters' | 'body' | 'method'>;
751
751
 
752
- type MeshSDKEventInterface = Awaited<ReturnType<typeof connectToParent>>['parent'] & {
753
- initialize: () => Promise<MeshContextData>;
754
- };
755
752
  /**
756
753
  * Imports the iframe communications library and provides an interface for interacting with
757
754
  * the parent window via said communications library.
758
755
  */
759
- declare function connectToParent({ dialogResponseHandlers, onMetadataUpdated, }: {
756
+ declare function connectToParent({ dialogResponseHandlers, }: {
760
757
  dialogResponseHandlers: DialogResponseHandlers;
761
- onMetadataUpdated: (metadata: unknown) => void;
762
758
  }): Promise<{
763
759
  initData: MeshContextData;
764
760
  parent: {
765
- resize: ({ height }: {
766
- height: CSSHeight;
767
- }) => Promise<void>;
768
- setValue: (value: SetValueMessage) => Promise<void>;
761
+ resize: (height: CSSHeight) => Promise<void>;
762
+ getValue: () => Promise<unknown>;
763
+ setValue: (value: unknown, options?: SetValueOptions) => Promise<void>;
764
+ getMetadata: () => Promise<unknown>;
769
765
  openDialog: (message: OpenDialogMessage) => Promise<Pick<DialogResponseData, "value" | "dialogId"> | undefined>;
770
766
  closeDialog: (message: CloseDialogMessage) => Promise<void>;
771
767
  getDataResource: <TExpectedResult>(message: GetDataResourceMessage) => Promise<TExpectedResult>;
@@ -881,7 +877,6 @@ type ParamTypeConfigLocationMetadata<TIntegrationConfiguration = unknown> = {
881
877
  settings: TIntegrationConfiguration;
882
878
  /** The Uniform project ID */
883
879
  projectId: string;
884
- componentDefinition: ComponentDefinition;
885
880
  };
886
881
  type ParamTypeConfigLocation<TParamValue = unknown, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeConfigLocationMetadata<TIntegrationConfiguration>, TParamValue, 'paramTypeConfig'>;
887
882
 
@@ -941,10 +936,6 @@ type UniformMeshSDKEvents = {
941
936
  onValueChanged: {
942
937
  newValue: unknown;
943
938
  };
944
- /** Fired when the location metadata value has been updated */
945
- onMetadataChanged: {
946
- newValue: unknown;
947
- };
948
939
  };
949
940
  interface UniformMeshSDK {
950
941
  events: Emitter<UniformMeshSDKEvents>;
@@ -984,4 +975,4 @@ declare function initializeUniformMeshSDK({ autoResizingDisabled, }?: {
984
975
  autoResizingDisabled?: boolean;
985
976
  }): Promise<UniformMeshSDK | undefined>;
986
977
 
987
- export { CSSHeight, CloseDialogMessage, CloseLocationDialogOptions, DataConnectorInfo, DataResourceLocation, DataResourceLocationMetadata, DataSourceLocation, DataSourceLocationMetadata, DataSourceLocationValue, DataTypeInstanceLocation, DataTypeInstanceLocationMetadata, DataTypeLocation, DataTypeLocationMetadata, DataTypeLocationValue, DialogContext, DialogOptions, DialogParamValue, DialogParams, DialogResponseData, DialogResponseHandler, DialogResponseHandlers, DialogType, GetDataResourceLocation, GetDataResourceMessage, IntegrationDefinitionClient, IntegrationDefinitionDeleteParameters, IntegrationDefinitionGetParameters, IntegrationDefinitionGetResponse, IntegrationDefinitionPutParameters, IntegrationDefinitionPutResponse, IntegrationInstallationClient, IntegrationInstallationDeleteParameters, IntegrationInstallationGetParameters, IntegrationInstallationGetResponse, IntegrationInstallationPutParameters, LocationDialogResponse, MeshContextData, MeshLocation, MeshLocationCore, MeshLocationTypes, MeshSDKEventInterface, OpenConfirmationDialogOptions, OpenConfirmationDialogResult, OpenDialogMessage, OpenDialogResult, OpenLocationDialogOptions, ParamTypeConfigLocation, ParamTypeConfigLocationMetadata, ParamTypeLocation, ParamTypeLocationMetadata, SdkWindow, SetLocationFunction, SetValueMessage, SetValueOptions, SettingsLocation, UniformMeshSDK, UniformMeshSDKEvents, ValidationResult, initializeUniformMeshSDK };
978
+ export { CSSHeight, CloseDialogMessage, CloseLocationDialogOptions, DataConnectorInfo, DataResourceLocation, DataResourceLocationMetadata, DataSourceLocation, DataSourceLocationMetadata, DataSourceLocationValue, DataTypeInstanceLocation, DataTypeInstanceLocationMetadata, DataTypeLocation, DataTypeLocationMetadata, DataTypeLocationValue, DialogContext, DialogOptions, DialogParamValue, DialogParams, DialogResponseData, DialogResponseHandler, DialogResponseHandlers, DialogType, GetDataResourceLocation, GetDataResourceMessage, IntegrationDefinitionClient, IntegrationDefinitionDeleteParameters, IntegrationDefinitionGetParameters, IntegrationDefinitionGetResponse, IntegrationDefinitionPutParameters, IntegrationDefinitionPutResponse, IntegrationInstallationClient, IntegrationInstallationDeleteParameters, IntegrationInstallationGetParameters, IntegrationInstallationGetResponse, IntegrationInstallationPutParameters, LocationDialogResponse, MeshContextData, MeshLocation, MeshLocationCore, MeshLocationTypes, OpenConfirmationDialogOptions, OpenConfirmationDialogResult, OpenDialogMessage, OpenDialogResult, OpenLocationDialogOptions, ParamTypeConfigLocation, ParamTypeConfigLocationMetadata, ParamTypeLocation, ParamTypeLocationMetadata, SdkWindow, SetLocationFunction, SetValueMessage, SetValueOptions, SettingsLocation, UniformMeshSDK, UniformMeshSDKEvents, ValidationResult, initializeUniformMeshSDK };
package/dist/index.esm.js CHANGED
@@ -451,8 +451,7 @@ var ChildClient = class extends SharedClient {
451
451
 
452
452
  // src/sdkComms.ts
453
453
  async function connectToParent({
454
- dialogResponseHandlers,
455
- onMetadataUpdated
454
+ dialogResponseHandlers
456
455
  }) {
457
456
  const client = new ChildClient({ debug: false });
458
457
  window.parent.postMessage("parents just don't understand", "*");
@@ -469,15 +468,23 @@ async function connectToParent({
469
468
  }
470
469
  delete dialogResponseHandlers[data.dialogId];
471
470
  });
472
- client.onRequest("metadata-value", onMetadataUpdated);
473
471
  return {
474
472
  initData,
475
473
  parent: {
476
- resize: async ({ height }) => {
477
- await client.request("resize", height);
474
+ resize: async (height) => {
475
+ await client.request("resize", { height });
478
476
  },
479
- setValue: async (value) => {
480
- await client.request("setValue", value);
477
+ getValue: async () => {
478
+ const res = await client.request("getValue");
479
+ return res == null ? void 0 : res.data;
480
+ },
481
+ setValue: async (value, options) => {
482
+ const message = { uniformMeshLocationValue: value, options };
483
+ await client.request("setValue", message);
484
+ },
485
+ getMetadata: async () => {
486
+ const res = await client.request("getMetadata");
487
+ return res == null ? void 0 : res.data;
481
488
  },
482
489
  openDialog: async (message) => {
483
490
  var _a;
@@ -587,20 +594,12 @@ async function initializeUniformMeshSDK({
587
594
  );
588
595
  }
589
596
  initializing = true;
590
- let currentMetadata = void 0;
591
- const events = mitt();
592
597
  const connectResult = await connectToParent({
593
- dialogResponseHandlers: sdkDialogResponseHandlers,
594
- onMetadataUpdated: (newMeta) => {
595
- console.debug("Received metadata update", newMeta);
596
- currentMetadata = newMeta;
597
- events.emit("onMetadataChanged", { newValue: newMeta });
598
- }
598
+ dialogResponseHandlers: sdkDialogResponseHandlers
599
599
  });
600
600
  const { initData: contextData, parent } = connectResult;
601
- currentMetadata = contextData.locationMetadata;
602
601
  const sdk = {
603
- events,
602
+ events: mitt(),
604
603
  getCurrentLocation: () => {
605
604
  const location = {
606
605
  getDataResource: parent.getDataResource,
@@ -618,21 +617,21 @@ async function initializeUniformMeshSDK({
618
617
  }
619
618
  contextData.locationValue = value;
620
619
  sdk.events.emit("onValueChanged", { newValue: value });
621
- await parent.setValue({ uniformMeshLocationValue: value, options });
620
+ await parent.setValue(value, options);
622
621
  },
623
622
  // DEPRECATED
624
- getMetadata: () => currentMetadata,
625
- metadata: currentMetadata,
623
+ getMetadata: () => contextData.locationMetadata,
624
+ metadata: contextData.locationMetadata,
626
625
  setValidationResult: async (value) => {
627
626
  await location.setValue(contextData.locationValue, value);
628
627
  },
629
628
  dialogContext: contextData.dialogContext ? {
630
629
  ...contextData.dialogContext,
631
- params: currentMetadata.dialogParams,
630
+ params: contextData.locationMetadata.dialogParams,
632
631
  returnDialogValue: async (value) => {
633
632
  contextData.locationValue = value;
634
633
  sdk.events.emit("onValueChanged", { newValue: value });
635
- await parent.setValue({ uniformMeshLocationValue: value });
634
+ await parent.setValue(value);
636
635
  }
637
636
  } : void 0
638
637
  };
@@ -640,7 +639,7 @@ async function initializeUniformMeshSDK({
640
639
  },
641
640
  currentWindow: createSdkWindow({
642
641
  onHeightChange: (height) => {
643
- parent.resize({ height });
642
+ parent.resize(height);
644
643
  },
645
644
  // If we're in a dialog context and the dialog was opened with a specified `contentHeight`,
646
645
  // then we disable autoResizing for the dialog location.
package/dist/index.js CHANGED
@@ -488,8 +488,7 @@ var ChildClient = class extends SharedClient {
488
488
 
489
489
  // src/sdkComms.ts
490
490
  async function connectToParent({
491
- dialogResponseHandlers,
492
- onMetadataUpdated
491
+ dialogResponseHandlers
493
492
  }) {
494
493
  const client = new ChildClient({ debug: false });
495
494
  window.parent.postMessage("parents just don't understand", "*");
@@ -506,15 +505,23 @@ async function connectToParent({
506
505
  }
507
506
  delete dialogResponseHandlers[data.dialogId];
508
507
  });
509
- client.onRequest("metadata-value", onMetadataUpdated);
510
508
  return {
511
509
  initData,
512
510
  parent: {
513
- resize: async ({ height }) => {
514
- await client.request("resize", height);
511
+ resize: async (height) => {
512
+ await client.request("resize", { height });
515
513
  },
516
- setValue: async (value) => {
517
- await client.request("setValue", value);
514
+ getValue: async () => {
515
+ const res = await client.request("getValue");
516
+ return res == null ? void 0 : res.data;
517
+ },
518
+ setValue: async (value, options) => {
519
+ const message = { uniformMeshLocationValue: value, options };
520
+ await client.request("setValue", message);
521
+ },
522
+ getMetadata: async () => {
523
+ const res = await client.request("getMetadata");
524
+ return res == null ? void 0 : res.data;
518
525
  },
519
526
  openDialog: async (message) => {
520
527
  var _a;
@@ -624,20 +631,12 @@ async function initializeUniformMeshSDK({
624
631
  );
625
632
  }
626
633
  initializing = true;
627
- let currentMetadata = void 0;
628
- const events = (0, import_mitt.default)();
629
634
  const connectResult = await connectToParent({
630
- dialogResponseHandlers: sdkDialogResponseHandlers,
631
- onMetadataUpdated: (newMeta) => {
632
- console.debug("Received metadata update", newMeta);
633
- currentMetadata = newMeta;
634
- events.emit("onMetadataChanged", { newValue: newMeta });
635
- }
635
+ dialogResponseHandlers: sdkDialogResponseHandlers
636
636
  });
637
637
  const { initData: contextData, parent } = connectResult;
638
- currentMetadata = contextData.locationMetadata;
639
638
  const sdk = {
640
- events,
639
+ events: (0, import_mitt.default)(),
641
640
  getCurrentLocation: () => {
642
641
  const location = {
643
642
  getDataResource: parent.getDataResource,
@@ -655,21 +654,21 @@ async function initializeUniformMeshSDK({
655
654
  }
656
655
  contextData.locationValue = value;
657
656
  sdk.events.emit("onValueChanged", { newValue: value });
658
- await parent.setValue({ uniformMeshLocationValue: value, options });
657
+ await parent.setValue(value, options);
659
658
  },
660
659
  // DEPRECATED
661
- getMetadata: () => currentMetadata,
662
- metadata: currentMetadata,
660
+ getMetadata: () => contextData.locationMetadata,
661
+ metadata: contextData.locationMetadata,
663
662
  setValidationResult: async (value) => {
664
663
  await location.setValue(contextData.locationValue, value);
665
664
  },
666
665
  dialogContext: contextData.dialogContext ? {
667
666
  ...contextData.dialogContext,
668
- params: currentMetadata.dialogParams,
667
+ params: contextData.locationMetadata.dialogParams,
669
668
  returnDialogValue: async (value) => {
670
669
  contextData.locationValue = value;
671
670
  sdk.events.emit("onValueChanged", { newValue: value });
672
- await parent.setValue({ uniformMeshLocationValue: value });
671
+ await parent.setValue(value);
673
672
  }
674
673
  } : void 0
675
674
  };
@@ -677,7 +676,7 @@ async function initializeUniformMeshSDK({
677
676
  },
678
677
  currentWindow: createSdkWindow({
679
678
  onHeightChange: (height) => {
680
- parent.resize({ height });
679
+ parent.resize(height);
681
680
  },
682
681
  // If we're in a dialog context and the dialog was opened with a specified `contentHeight`,
683
682
  // then we disable autoResizing for the dialog location.
package/dist/index.mjs CHANGED
@@ -451,8 +451,7 @@ var ChildClient = class extends SharedClient {
451
451
 
452
452
  // src/sdkComms.ts
453
453
  async function connectToParent({
454
- dialogResponseHandlers,
455
- onMetadataUpdated
454
+ dialogResponseHandlers
456
455
  }) {
457
456
  const client = new ChildClient({ debug: false });
458
457
  window.parent.postMessage("parents just don't understand", "*");
@@ -469,15 +468,23 @@ async function connectToParent({
469
468
  }
470
469
  delete dialogResponseHandlers[data.dialogId];
471
470
  });
472
- client.onRequest("metadata-value", onMetadataUpdated);
473
471
  return {
474
472
  initData,
475
473
  parent: {
476
- resize: async ({ height }) => {
477
- await client.request("resize", height);
474
+ resize: async (height) => {
475
+ await client.request("resize", { height });
478
476
  },
479
- setValue: async (value) => {
480
- await client.request("setValue", value);
477
+ getValue: async () => {
478
+ const res = await client.request("getValue");
479
+ return res == null ? void 0 : res.data;
480
+ },
481
+ setValue: async (value, options) => {
482
+ const message = { uniformMeshLocationValue: value, options };
483
+ await client.request("setValue", message);
484
+ },
485
+ getMetadata: async () => {
486
+ const res = await client.request("getMetadata");
487
+ return res == null ? void 0 : res.data;
481
488
  },
482
489
  openDialog: async (message) => {
483
490
  var _a;
@@ -587,20 +594,12 @@ async function initializeUniformMeshSDK({
587
594
  );
588
595
  }
589
596
  initializing = true;
590
- let currentMetadata = void 0;
591
- const events = mitt();
592
597
  const connectResult = await connectToParent({
593
- dialogResponseHandlers: sdkDialogResponseHandlers,
594
- onMetadataUpdated: (newMeta) => {
595
- console.debug("Received metadata update", newMeta);
596
- currentMetadata = newMeta;
597
- events.emit("onMetadataChanged", { newValue: newMeta });
598
- }
598
+ dialogResponseHandlers: sdkDialogResponseHandlers
599
599
  });
600
600
  const { initData: contextData, parent } = connectResult;
601
- currentMetadata = contextData.locationMetadata;
602
601
  const sdk = {
603
- events,
602
+ events: mitt(),
604
603
  getCurrentLocation: () => {
605
604
  const location = {
606
605
  getDataResource: parent.getDataResource,
@@ -618,21 +617,21 @@ async function initializeUniformMeshSDK({
618
617
  }
619
618
  contextData.locationValue = value;
620
619
  sdk.events.emit("onValueChanged", { newValue: value });
621
- await parent.setValue({ uniformMeshLocationValue: value, options });
620
+ await parent.setValue(value, options);
622
621
  },
623
622
  // DEPRECATED
624
- getMetadata: () => currentMetadata,
625
- metadata: currentMetadata,
623
+ getMetadata: () => contextData.locationMetadata,
624
+ metadata: contextData.locationMetadata,
626
625
  setValidationResult: async (value) => {
627
626
  await location.setValue(contextData.locationValue, value);
628
627
  },
629
628
  dialogContext: contextData.dialogContext ? {
630
629
  ...contextData.dialogContext,
631
- params: currentMetadata.dialogParams,
630
+ params: contextData.locationMetadata.dialogParams,
632
631
  returnDialogValue: async (value) => {
633
632
  contextData.locationValue = value;
634
633
  sdk.events.emit("onValueChanged", { newValue: value });
635
- await parent.setValue({ uniformMeshLocationValue: value });
634
+ await parent.setValue(value);
636
635
  }
637
636
  } : void 0
638
637
  };
@@ -640,7 +639,7 @@ async function initializeUniformMeshSDK({
640
639
  },
641
640
  currentWindow: createSdkWindow({
642
641
  onHeightChange: (height) => {
643
- parent.resize({ height });
642
+ parent.resize(height);
644
643
  },
645
644
  // If we're in a dialog context and the dialog was opened with a specified `contentHeight`,
646
645
  // then we disable autoResizing for the dialog location.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/mesh-sdk",
3
- "version": "18.21.1-alpha.4+677936e4a",
3
+ "version": "18.23.1-alpha.34+8eddcae60",
4
4
  "description": "Uniform Mesh Framework SDK",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -32,9 +32,9 @@
32
32
  "access": "public"
33
33
  },
34
34
  "dependencies": {
35
- "@uniformdev/canvas": "18.21.1-alpha.4+677936e4a",
36
- "@uniformdev/context": "18.21.1-alpha.4+677936e4a",
35
+ "@uniformdev/canvas": "18.23.1-alpha.34+8eddcae60",
36
+ "@uniformdev/context": "18.23.1-alpha.34+8eddcae60",
37
37
  "mitt": "^3.0.0"
38
38
  },
39
- "gitHead": "677936e4a7af7c7c738893d83a2afa8cddbb7bbc"
39
+ "gitHead": "8eddcae607f5c8b7ef9f7752bc11e186eee4305b"
40
40
  }