@uniformdev/mesh-sdk 19.36.1-alpha.4 → 19.36.1-alpha.61

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.mts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { ApiClient, ClientOptions, ExceptProject } from '@uniformdev/context/api';
2
- import { DataSource, RootComponentInstance, ComponentInstance, ComponentDefinition, ComponentDefinitionParameter, DataType as DataType$1, DataResourceVariables } from '@uniformdev/canvas';
2
+ import { DataSource, RootComponentInstance, ComponentInstance, ComponentDefinition, ComponentDefinitionParameter, DataType, DataVariableDefinition, DataResourceVariables } from '@uniformdev/canvas';
3
3
  import { ProjectMapNode } from '@uniformdev/project-map';
4
- import { DataType } from '@uniformdev/canvas/.';
5
4
  import { Emitter } from 'mitt';
6
5
 
7
6
  /**
@@ -646,10 +645,28 @@ type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfig
646
645
  settings: TIntegrationConfiguration;
647
646
  /** The Uniform project ID */
648
647
  projectId: string;
649
- /** Current dynamic inputs that are configured on the composition (if any). */
648
+ /**
649
+ * Current dynamic inputs that are configured on the composition (if any).
650
+ * Use the <ParamTypeDynamicDataProvider> to wire up dynamic data in your parameter.
651
+ */
650
652
  dynamicInputs: DynamicInputs;
653
+ /**
654
+ * The connected data for the current component. Connected data is provided as a map
655
+ * of the binding expression text to the value of that binding expression. For example,
656
+ * if the value is "Hello ${#jptr:/MyData/fields/name}" then this value would be:
657
+ * { "#jptr:/MyData/fields/name": "value-of-connected-data" }
658
+ *
659
+ * Use the <ParamTypeDynamicDataProvider> to wire up dynamic data in your parameter.
660
+ */
661
+ connectedData: Record<string, unknown>;
662
+ };
663
+ type ParamTypeLocation<TParamValue = unknown, TParamConfiguration = unknown, TParamSetValue = TParamValue, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeLocationMetadata<TParamConfiguration, TIntegrationConfiguration>, TParamSetValue, 'paramType'> & {
664
+ /**
665
+ * Opens a dialog on the Uniform platform to edit or select a dynamic token to connect to.
666
+ * Returns the result of the dialog. Useful to build data-enabled parameter types.
667
+ */
668
+ editConnectedData: Awaited<ReturnType<typeof connectToParent>>['parent']['editConnectedData'];
651
669
  };
652
- type ParamTypeLocation<TParamValue = unknown, TParamConfiguration = unknown, TParamSetValue = TParamValue, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeLocationMetadata<TParamConfiguration, TIntegrationConfiguration>, TParamSetValue, 'paramType'>;
653
670
 
654
671
  type SettingsLocationMetadata = {
655
672
  projectId: string;
@@ -687,7 +704,7 @@ interface DialogResponseData {
687
704
  dialogId: string;
688
705
  error?: string;
689
706
  }
690
- type DialogType = 'location' | 'confirm';
707
+ type DialogType = 'location' | 'confirm' | 'currentLocation';
691
708
  type OpenDialogResult = {
692
709
  /** Unique ID of this dialog which can be used to close it */
693
710
  dialogId: string;
@@ -754,6 +771,25 @@ type CloseDialogMessage = {
754
771
  dialogData?: unknown;
755
772
  };
756
773
  type GetDataResourceMessage = Pick<DataType, 'path' | 'headers' | 'parameters' | 'body' | 'method'>;
774
+ /** Primitive data types that a parameter type accepts to be bound to composition data */
775
+ type BindableTypes = 'string' | 'number' | 'boolean' | 'object' | 'array';
776
+ /** Message to parent to create a data connection expression to insert in a param type */
777
+ type EditConnectedDataMessage = {
778
+ /** Bind expression for existing connected data */
779
+ existingConnectedData?: string;
780
+ allowedTypes: BindableTypes[];
781
+ };
782
+ /** Response from parent when creating a data connection expression */
783
+ type EditConnectedDataResponse = {
784
+ canceled: false;
785
+ /** Bind expression for selected data connection */
786
+ connectedData: DataVariableDefinition & {
787
+ name: string;
788
+ };
789
+ } | {
790
+ /** User cancelled selecting dynamic token */
791
+ canceled: true;
792
+ };
757
793
 
758
794
  type MeshSDKEventInterface = Awaited<ReturnType<typeof connectToParent>>['parent'] & {
759
795
  initialize: () => Promise<MeshContextData>;
@@ -775,6 +811,7 @@ declare function connectToParent({ dialogResponseHandlers, onMetadataUpdated, }:
775
811
  openDialog: (message: OpenDialogMessage) => Promise<Pick<DialogResponseData, "value" | "dialogId"> | undefined>;
776
812
  closeDialog: (message: CloseDialogMessage) => Promise<void>;
777
813
  getDataResource: <TExpectedResult>(message: GetDataResourceMessage) => Promise<TExpectedResult>;
814
+ editConnectedData: (message: EditConnectedDataMessage) => Promise<EditConnectedDataResponse>;
778
815
  };
779
816
  }>;
780
817
 
@@ -823,6 +860,7 @@ type SetValueOptions = ValidationResult;
823
860
  type SetValueMessage = {
824
861
  uniformMeshLocationValue: unknown;
825
862
  options?: SetValueOptions;
863
+ closeDialog?: boolean;
826
864
  };
827
865
  type GetDataResourceLocation = {
828
866
  getDataResource: Awaited<ReturnType<typeof connectToParent>>['parent']['getDataResource'];
@@ -843,7 +881,7 @@ type DynamicInput = {
843
881
  /** Record of dynamic inputs keyed by the input name */
844
882
  type DynamicInputs = Record<string, DynamicInput>;
845
883
 
846
- type DataTypeLocationValue = Pick<DataType$1, 'body' | 'method' | 'path' | 'custom' | 'headers' | 'parameters' | 'variables'>;
884
+ type DataTypeLocationValue = Pick<DataType, 'body' | 'method' | 'path' | 'custom' | 'headers' | 'parameters' | 'variables'>;
847
885
  type DataConnectorInfo = {
848
886
  type: string;
849
887
  displayName: string;
@@ -868,7 +906,7 @@ type DataResourceLocationMetadata<TIntegrationConfiguration = unknown> = {
868
906
  /** Settings defined at the integration level (arbitrary type used on settings location) */
869
907
  settings: TIntegrationConfiguration;
870
908
  /** The current data resource's data type */
871
- dataType: DataType$1;
909
+ dataType: DataType;
872
910
  /** The data type's archetype value. */
873
911
  archetype: string;
874
912
  /**
@@ -990,4 +1028,4 @@ declare function initializeUniformMeshSDK({ autoResizingDisabled, }?: {
990
1028
  autoResizingDisabled?: boolean;
991
1029
  }): Promise<UniformMeshSDK | undefined>;
992
1030
 
993
- export { CSSHeight, CloseDialogMessage, CloseLocationDialogOptions, DataConnectorInfo, DataResourceLocation, DataResourceLocationMetadata, DataSourceLocation, DataSourceLocationMetadata, DataSourceLocationValue, DataTypeLocation, DataTypeLocationMetadata, DataTypeLocationValue, DialogContext, DialogOptions, DialogParamValue, DialogParams, DialogResponseData, DialogResponseHandler, DialogResponseHandlers, DialogType, DynamicInput, DynamicInputs, 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, SettingsLocationMetadata, UniformMeshSDK, UniformMeshSDKEvents, ValidationResult, initializeUniformMeshSDK };
1031
+ export { BindableTypes, CSSHeight, CloseDialogMessage, CloseLocationDialogOptions, DataConnectorInfo, DataResourceLocation, DataResourceLocationMetadata, DataSourceLocation, DataSourceLocationMetadata, DataSourceLocationValue, DataTypeLocation, DataTypeLocationMetadata, DataTypeLocationValue, DialogContext, DialogOptions, DialogParamValue, DialogParams, DialogResponseData, DialogResponseHandler, DialogResponseHandlers, DialogType, DynamicInput, DynamicInputs, EditConnectedDataMessage, EditConnectedDataResponse, 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, SettingsLocationMetadata, UniformMeshSDK, UniformMeshSDKEvents, ValidationResult, initializeUniformMeshSDK };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { ApiClient, ClientOptions, ExceptProject } from '@uniformdev/context/api';
2
- import { DataSource, RootComponentInstance, ComponentInstance, ComponentDefinition, ComponentDefinitionParameter, DataType as DataType$1, DataResourceVariables } from '@uniformdev/canvas';
2
+ import { DataSource, RootComponentInstance, ComponentInstance, ComponentDefinition, ComponentDefinitionParameter, DataType, DataVariableDefinition, DataResourceVariables } from '@uniformdev/canvas';
3
3
  import { ProjectMapNode } from '@uniformdev/project-map';
4
- import { DataType } from '@uniformdev/canvas/.';
5
4
  import { Emitter } from 'mitt';
6
5
 
7
6
  /**
@@ -646,10 +645,28 @@ type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfig
646
645
  settings: TIntegrationConfiguration;
647
646
  /** The Uniform project ID */
648
647
  projectId: string;
649
- /** Current dynamic inputs that are configured on the composition (if any). */
648
+ /**
649
+ * Current dynamic inputs that are configured on the composition (if any).
650
+ * Use the <ParamTypeDynamicDataProvider> to wire up dynamic data in your parameter.
651
+ */
650
652
  dynamicInputs: DynamicInputs;
653
+ /**
654
+ * The connected data for the current component. Connected data is provided as a map
655
+ * of the binding expression text to the value of that binding expression. For example,
656
+ * if the value is "Hello ${#jptr:/MyData/fields/name}" then this value would be:
657
+ * { "#jptr:/MyData/fields/name": "value-of-connected-data" }
658
+ *
659
+ * Use the <ParamTypeDynamicDataProvider> to wire up dynamic data in your parameter.
660
+ */
661
+ connectedData: Record<string, unknown>;
662
+ };
663
+ type ParamTypeLocation<TParamValue = unknown, TParamConfiguration = unknown, TParamSetValue = TParamValue, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeLocationMetadata<TParamConfiguration, TIntegrationConfiguration>, TParamSetValue, 'paramType'> & {
664
+ /**
665
+ * Opens a dialog on the Uniform platform to edit or select a dynamic token to connect to.
666
+ * Returns the result of the dialog. Useful to build data-enabled parameter types.
667
+ */
668
+ editConnectedData: Awaited<ReturnType<typeof connectToParent>>['parent']['editConnectedData'];
651
669
  };
652
- type ParamTypeLocation<TParamValue = unknown, TParamConfiguration = unknown, TParamSetValue = TParamValue, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeLocationMetadata<TParamConfiguration, TIntegrationConfiguration>, TParamSetValue, 'paramType'>;
653
670
 
654
671
  type SettingsLocationMetadata = {
655
672
  projectId: string;
@@ -687,7 +704,7 @@ interface DialogResponseData {
687
704
  dialogId: string;
688
705
  error?: string;
689
706
  }
690
- type DialogType = 'location' | 'confirm';
707
+ type DialogType = 'location' | 'confirm' | 'currentLocation';
691
708
  type OpenDialogResult = {
692
709
  /** Unique ID of this dialog which can be used to close it */
693
710
  dialogId: string;
@@ -754,6 +771,25 @@ type CloseDialogMessage = {
754
771
  dialogData?: unknown;
755
772
  };
756
773
  type GetDataResourceMessage = Pick<DataType, 'path' | 'headers' | 'parameters' | 'body' | 'method'>;
774
+ /** Primitive data types that a parameter type accepts to be bound to composition data */
775
+ type BindableTypes = 'string' | 'number' | 'boolean' | 'object' | 'array';
776
+ /** Message to parent to create a data connection expression to insert in a param type */
777
+ type EditConnectedDataMessage = {
778
+ /** Bind expression for existing connected data */
779
+ existingConnectedData?: string;
780
+ allowedTypes: BindableTypes[];
781
+ };
782
+ /** Response from parent when creating a data connection expression */
783
+ type EditConnectedDataResponse = {
784
+ canceled: false;
785
+ /** Bind expression for selected data connection */
786
+ connectedData: DataVariableDefinition & {
787
+ name: string;
788
+ };
789
+ } | {
790
+ /** User cancelled selecting dynamic token */
791
+ canceled: true;
792
+ };
757
793
 
758
794
  type MeshSDKEventInterface = Awaited<ReturnType<typeof connectToParent>>['parent'] & {
759
795
  initialize: () => Promise<MeshContextData>;
@@ -775,6 +811,7 @@ declare function connectToParent({ dialogResponseHandlers, onMetadataUpdated, }:
775
811
  openDialog: (message: OpenDialogMessage) => Promise<Pick<DialogResponseData, "value" | "dialogId"> | undefined>;
776
812
  closeDialog: (message: CloseDialogMessage) => Promise<void>;
777
813
  getDataResource: <TExpectedResult>(message: GetDataResourceMessage) => Promise<TExpectedResult>;
814
+ editConnectedData: (message: EditConnectedDataMessage) => Promise<EditConnectedDataResponse>;
778
815
  };
779
816
  }>;
780
817
 
@@ -823,6 +860,7 @@ type SetValueOptions = ValidationResult;
823
860
  type SetValueMessage = {
824
861
  uniformMeshLocationValue: unknown;
825
862
  options?: SetValueOptions;
863
+ closeDialog?: boolean;
826
864
  };
827
865
  type GetDataResourceLocation = {
828
866
  getDataResource: Awaited<ReturnType<typeof connectToParent>>['parent']['getDataResource'];
@@ -843,7 +881,7 @@ type DynamicInput = {
843
881
  /** Record of dynamic inputs keyed by the input name */
844
882
  type DynamicInputs = Record<string, DynamicInput>;
845
883
 
846
- type DataTypeLocationValue = Pick<DataType$1, 'body' | 'method' | 'path' | 'custom' | 'headers' | 'parameters' | 'variables'>;
884
+ type DataTypeLocationValue = Pick<DataType, 'body' | 'method' | 'path' | 'custom' | 'headers' | 'parameters' | 'variables'>;
847
885
  type DataConnectorInfo = {
848
886
  type: string;
849
887
  displayName: string;
@@ -868,7 +906,7 @@ type DataResourceLocationMetadata<TIntegrationConfiguration = unknown> = {
868
906
  /** Settings defined at the integration level (arbitrary type used on settings location) */
869
907
  settings: TIntegrationConfiguration;
870
908
  /** The current data resource's data type */
871
- dataType: DataType$1;
909
+ dataType: DataType;
872
910
  /** The data type's archetype value. */
873
911
  archetype: string;
874
912
  /**
@@ -990,4 +1028,4 @@ declare function initializeUniformMeshSDK({ autoResizingDisabled, }?: {
990
1028
  autoResizingDisabled?: boolean;
991
1029
  }): Promise<UniformMeshSDK | undefined>;
992
1030
 
993
- export { CSSHeight, CloseDialogMessage, CloseLocationDialogOptions, DataConnectorInfo, DataResourceLocation, DataResourceLocationMetadata, DataSourceLocation, DataSourceLocationMetadata, DataSourceLocationValue, DataTypeLocation, DataTypeLocationMetadata, DataTypeLocationValue, DialogContext, DialogOptions, DialogParamValue, DialogParams, DialogResponseData, DialogResponseHandler, DialogResponseHandlers, DialogType, DynamicInput, DynamicInputs, 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, SettingsLocationMetadata, UniformMeshSDK, UniformMeshSDKEvents, ValidationResult, initializeUniformMeshSDK };
1031
+ export { BindableTypes, CSSHeight, CloseDialogMessage, CloseLocationDialogOptions, DataConnectorInfo, DataResourceLocation, DataResourceLocationMetadata, DataSourceLocation, DataSourceLocationMetadata, DataSourceLocationValue, DataTypeLocation, DataTypeLocationMetadata, DataTypeLocationValue, DialogContext, DialogOptions, DialogParamValue, DialogParams, DialogResponseData, DialogResponseHandler, DialogResponseHandlers, DialogType, DynamicInput, DynamicInputs, EditConnectedDataMessage, EditConnectedDataResponse, 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, SettingsLocationMetadata, UniformMeshSDK, UniformMeshSDKEvents, ValidationResult, initializeUniformMeshSDK };
package/dist/index.esm.js CHANGED
@@ -124,8 +124,8 @@ var DEFAULT_REQUEST_TIMEOUT = 5e3;
124
124
 
125
125
  // src/framepost/errors.ts
126
126
  var RequestTimeoutError = class _RequestTimeoutError extends Error {
127
- constructor() {
128
- super("Request timed out");
127
+ constructor(message) {
128
+ super("Request timed out: " + message);
129
129
  Object.setPrototypeOf(this, _RequestTimeoutError.prototype);
130
130
  this.name = "RequestTimeoutError";
131
131
  }
@@ -171,7 +171,7 @@ var serializeError = (error) => {
171
171
  var deserializeError = ({ name, message, stack }) => {
172
172
  switch (name) {
173
173
  case RequestTimeoutError.name: {
174
- return new RequestTimeoutError();
174
+ return new RequestTimeoutError(message);
175
175
  }
176
176
  default: {
177
177
  const e = new Error(message);
@@ -277,7 +277,7 @@ var SharedClient = class {
277
277
  timer = setTimeout(() => {
278
278
  unsubscribeResponseHandler();
279
279
  clearOnDestroy();
280
- reject(new RequestTimeoutError());
280
+ reject(new RequestTimeoutError(requestKey));
281
281
  }, options.timeout || this.requestTimeout);
282
282
  });
283
283
  }
@@ -503,6 +503,18 @@ async function connectToParent({
503
503
  return await client.request("getDataResource", message, {
504
504
  timeout: 3e4
505
505
  });
506
+ },
507
+ editConnectedData: async (message) => {
508
+ return await client.request(
509
+ "editConnectedData",
510
+ message,
511
+ {
512
+ timeout: (
513
+ // 24 hours in ms
514
+ 864e5
515
+ )
516
+ }
517
+ );
506
518
  }
507
519
  }
508
520
  };
@@ -537,9 +549,12 @@ var createSdkWindow = ({
537
549
  onHeightChange == null ? void 0 : onHeightChange(height);
538
550
  return;
539
551
  }
540
- const windowHeight = `${Math.ceil(
541
- windowInstance.document.documentElement.getBoundingClientRect().height
542
- )}px`;
552
+ let maxBottom = windowInstance.document.documentElement.getBoundingClientRect().height;
553
+ windowInstance.document.querySelectorAll("div, section, article, menu, nav, footer").forEach((div) => {
554
+ const bottom = div.getBoundingClientRect().bottom;
555
+ maxBottom = Math.max(maxBottom, bottom);
556
+ });
557
+ const windowHeight = `${Math.ceil(maxBottom)}px`;
543
558
  if (windowHeight !== oldHeight) {
544
559
  oldHeight = windowHeight;
545
560
  onHeightChange == null ? void 0 : onHeightChange(windowHeight);
@@ -638,15 +653,11 @@ async function initializeUniformMeshSDK({
638
653
  getCurrentLocation: () => {
639
654
  const location = {
640
655
  getDataResource: parent.getDataResource,
656
+ editConnectedData: parent.editConnectedData,
641
657
  type: contextData.locationType,
642
658
  isReadOnly: contextData.isReadOnly,
643
659
  value: contextData.locationValue,
644
660
  setValue: async (value, options) => {
645
- if (contextData.dialogContext) {
646
- console.warn(
647
- "Using setValue() inside a dialog is deprecated. Use dialogContext.returnDialogValue() instead."
648
- );
649
- }
650
661
  contextData.locationValue = value;
651
662
  sdk.events.emit("onValueChanged", { newValue: value });
652
663
  await parent.setValue({ uniformMeshLocationValue: value, options });
@@ -658,7 +669,7 @@ async function initializeUniformMeshSDK({
658
669
  returnDialogValue: async (value) => {
659
670
  contextData.locationValue = value;
660
671
  sdk.events.emit("onValueChanged", { newValue: value });
661
- await parent.setValue({ uniformMeshLocationValue: value });
672
+ await parent.setValue({ uniformMeshLocationValue: value, closeDialog: true });
662
673
  }
663
674
  } : void 0
664
675
  };
@@ -718,26 +729,28 @@ async function initializeUniformMeshSDK({
718
729
  },
719
730
  openCurrentLocationDialog: async (options) => {
720
731
  const result = await parent.openDialog({
721
- dialogType: "location",
732
+ dialogType: "currentLocation",
722
733
  dialogData: {},
723
734
  options: options == null ? void 0 : options.options
724
735
  });
725
736
  if (!result) {
726
737
  return;
727
738
  }
739
+ contextData.locationValue = result.value;
740
+ sdk.events.emit("onValueChanged", { newValue: result.value });
728
741
  return {
729
742
  dialogId: result.dialogId,
730
743
  value: result.value,
731
744
  closeDialog: async () => {
732
745
  await parent.closeDialog({
733
746
  dialogId: void 0,
734
- dialogType: "location"
747
+ dialogType: "currentLocation"
735
748
  });
736
749
  }
737
750
  };
738
751
  },
739
752
  closeCurrentLocationDialog: async () => {
740
- await parent.closeDialog({ dialogId: void 0, dialogType: "location" });
753
+ await parent.closeDialog({ dialogId: void 0, dialogType: "currentLocation" });
741
754
  }
742
755
  };
743
756
  window.UniformMeshSDK = sdk;
package/dist/index.js CHANGED
@@ -161,8 +161,8 @@ var DEFAULT_REQUEST_TIMEOUT = 5e3;
161
161
 
162
162
  // src/framepost/errors.ts
163
163
  var RequestTimeoutError = class _RequestTimeoutError extends Error {
164
- constructor() {
165
- super("Request timed out");
164
+ constructor(message) {
165
+ super("Request timed out: " + message);
166
166
  Object.setPrototypeOf(this, _RequestTimeoutError.prototype);
167
167
  this.name = "RequestTimeoutError";
168
168
  }
@@ -208,7 +208,7 @@ var serializeError = (error) => {
208
208
  var deserializeError = ({ name, message, stack }) => {
209
209
  switch (name) {
210
210
  case RequestTimeoutError.name: {
211
- return new RequestTimeoutError();
211
+ return new RequestTimeoutError(message);
212
212
  }
213
213
  default: {
214
214
  const e = new Error(message);
@@ -314,7 +314,7 @@ var SharedClient = class {
314
314
  timer = setTimeout(() => {
315
315
  unsubscribeResponseHandler();
316
316
  clearOnDestroy();
317
- reject(new RequestTimeoutError());
317
+ reject(new RequestTimeoutError(requestKey));
318
318
  }, options.timeout || this.requestTimeout);
319
319
  });
320
320
  }
@@ -540,6 +540,18 @@ async function connectToParent({
540
540
  return await client.request("getDataResource", message, {
541
541
  timeout: 3e4
542
542
  });
543
+ },
544
+ editConnectedData: async (message) => {
545
+ return await client.request(
546
+ "editConnectedData",
547
+ message,
548
+ {
549
+ timeout: (
550
+ // 24 hours in ms
551
+ 864e5
552
+ )
553
+ }
554
+ );
543
555
  }
544
556
  }
545
557
  };
@@ -574,9 +586,12 @@ var createSdkWindow = ({
574
586
  onHeightChange == null ? void 0 : onHeightChange(height);
575
587
  return;
576
588
  }
577
- const windowHeight = `${Math.ceil(
578
- windowInstance.document.documentElement.getBoundingClientRect().height
579
- )}px`;
589
+ let maxBottom = windowInstance.document.documentElement.getBoundingClientRect().height;
590
+ windowInstance.document.querySelectorAll("div, section, article, menu, nav, footer").forEach((div) => {
591
+ const bottom = div.getBoundingClientRect().bottom;
592
+ maxBottom = Math.max(maxBottom, bottom);
593
+ });
594
+ const windowHeight = `${Math.ceil(maxBottom)}px`;
580
595
  if (windowHeight !== oldHeight) {
581
596
  oldHeight = windowHeight;
582
597
  onHeightChange == null ? void 0 : onHeightChange(windowHeight);
@@ -675,15 +690,11 @@ async function initializeUniformMeshSDK({
675
690
  getCurrentLocation: () => {
676
691
  const location = {
677
692
  getDataResource: parent.getDataResource,
693
+ editConnectedData: parent.editConnectedData,
678
694
  type: contextData.locationType,
679
695
  isReadOnly: contextData.isReadOnly,
680
696
  value: contextData.locationValue,
681
697
  setValue: async (value, options) => {
682
- if (contextData.dialogContext) {
683
- console.warn(
684
- "Using setValue() inside a dialog is deprecated. Use dialogContext.returnDialogValue() instead."
685
- );
686
- }
687
698
  contextData.locationValue = value;
688
699
  sdk.events.emit("onValueChanged", { newValue: value });
689
700
  await parent.setValue({ uniformMeshLocationValue: value, options });
@@ -695,7 +706,7 @@ async function initializeUniformMeshSDK({
695
706
  returnDialogValue: async (value) => {
696
707
  contextData.locationValue = value;
697
708
  sdk.events.emit("onValueChanged", { newValue: value });
698
- await parent.setValue({ uniformMeshLocationValue: value });
709
+ await parent.setValue({ uniformMeshLocationValue: value, closeDialog: true });
699
710
  }
700
711
  } : void 0
701
712
  };
@@ -755,26 +766,28 @@ async function initializeUniformMeshSDK({
755
766
  },
756
767
  openCurrentLocationDialog: async (options) => {
757
768
  const result = await parent.openDialog({
758
- dialogType: "location",
769
+ dialogType: "currentLocation",
759
770
  dialogData: {},
760
771
  options: options == null ? void 0 : options.options
761
772
  });
762
773
  if (!result) {
763
774
  return;
764
775
  }
776
+ contextData.locationValue = result.value;
777
+ sdk.events.emit("onValueChanged", { newValue: result.value });
765
778
  return {
766
779
  dialogId: result.dialogId,
767
780
  value: result.value,
768
781
  closeDialog: async () => {
769
782
  await parent.closeDialog({
770
783
  dialogId: void 0,
771
- dialogType: "location"
784
+ dialogType: "currentLocation"
772
785
  });
773
786
  }
774
787
  };
775
788
  },
776
789
  closeCurrentLocationDialog: async () => {
777
- await parent.closeDialog({ dialogId: void 0, dialogType: "location" });
790
+ await parent.closeDialog({ dialogId: void 0, dialogType: "currentLocation" });
778
791
  }
779
792
  };
780
793
  window.UniformMeshSDK = sdk;
package/dist/index.mjs CHANGED
@@ -124,8 +124,8 @@ var DEFAULT_REQUEST_TIMEOUT = 5e3;
124
124
 
125
125
  // src/framepost/errors.ts
126
126
  var RequestTimeoutError = class _RequestTimeoutError extends Error {
127
- constructor() {
128
- super("Request timed out");
127
+ constructor(message) {
128
+ super("Request timed out: " + message);
129
129
  Object.setPrototypeOf(this, _RequestTimeoutError.prototype);
130
130
  this.name = "RequestTimeoutError";
131
131
  }
@@ -171,7 +171,7 @@ var serializeError = (error) => {
171
171
  var deserializeError = ({ name, message, stack }) => {
172
172
  switch (name) {
173
173
  case RequestTimeoutError.name: {
174
- return new RequestTimeoutError();
174
+ return new RequestTimeoutError(message);
175
175
  }
176
176
  default: {
177
177
  const e = new Error(message);
@@ -277,7 +277,7 @@ var SharedClient = class {
277
277
  timer = setTimeout(() => {
278
278
  unsubscribeResponseHandler();
279
279
  clearOnDestroy();
280
- reject(new RequestTimeoutError());
280
+ reject(new RequestTimeoutError(requestKey));
281
281
  }, options.timeout || this.requestTimeout);
282
282
  });
283
283
  }
@@ -503,6 +503,18 @@ async function connectToParent({
503
503
  return await client.request("getDataResource", message, {
504
504
  timeout: 3e4
505
505
  });
506
+ },
507
+ editConnectedData: async (message) => {
508
+ return await client.request(
509
+ "editConnectedData",
510
+ message,
511
+ {
512
+ timeout: (
513
+ // 24 hours in ms
514
+ 864e5
515
+ )
516
+ }
517
+ );
506
518
  }
507
519
  }
508
520
  };
@@ -537,9 +549,12 @@ var createSdkWindow = ({
537
549
  onHeightChange == null ? void 0 : onHeightChange(height);
538
550
  return;
539
551
  }
540
- const windowHeight = `${Math.ceil(
541
- windowInstance.document.documentElement.getBoundingClientRect().height
542
- )}px`;
552
+ let maxBottom = windowInstance.document.documentElement.getBoundingClientRect().height;
553
+ windowInstance.document.querySelectorAll("div, section, article, menu, nav, footer").forEach((div) => {
554
+ const bottom = div.getBoundingClientRect().bottom;
555
+ maxBottom = Math.max(maxBottom, bottom);
556
+ });
557
+ const windowHeight = `${Math.ceil(maxBottom)}px`;
543
558
  if (windowHeight !== oldHeight) {
544
559
  oldHeight = windowHeight;
545
560
  onHeightChange == null ? void 0 : onHeightChange(windowHeight);
@@ -638,15 +653,11 @@ async function initializeUniformMeshSDK({
638
653
  getCurrentLocation: () => {
639
654
  const location = {
640
655
  getDataResource: parent.getDataResource,
656
+ editConnectedData: parent.editConnectedData,
641
657
  type: contextData.locationType,
642
658
  isReadOnly: contextData.isReadOnly,
643
659
  value: contextData.locationValue,
644
660
  setValue: async (value, options) => {
645
- if (contextData.dialogContext) {
646
- console.warn(
647
- "Using setValue() inside a dialog is deprecated. Use dialogContext.returnDialogValue() instead."
648
- );
649
- }
650
661
  contextData.locationValue = value;
651
662
  sdk.events.emit("onValueChanged", { newValue: value });
652
663
  await parent.setValue({ uniformMeshLocationValue: value, options });
@@ -658,7 +669,7 @@ async function initializeUniformMeshSDK({
658
669
  returnDialogValue: async (value) => {
659
670
  contextData.locationValue = value;
660
671
  sdk.events.emit("onValueChanged", { newValue: value });
661
- await parent.setValue({ uniformMeshLocationValue: value });
672
+ await parent.setValue({ uniformMeshLocationValue: value, closeDialog: true });
662
673
  }
663
674
  } : void 0
664
675
  };
@@ -718,26 +729,28 @@ async function initializeUniformMeshSDK({
718
729
  },
719
730
  openCurrentLocationDialog: async (options) => {
720
731
  const result = await parent.openDialog({
721
- dialogType: "location",
732
+ dialogType: "currentLocation",
722
733
  dialogData: {},
723
734
  options: options == null ? void 0 : options.options
724
735
  });
725
736
  if (!result) {
726
737
  return;
727
738
  }
739
+ contextData.locationValue = result.value;
740
+ sdk.events.emit("onValueChanged", { newValue: result.value });
728
741
  return {
729
742
  dialogId: result.dialogId,
730
743
  value: result.value,
731
744
  closeDialog: async () => {
732
745
  await parent.closeDialog({
733
746
  dialogId: void 0,
734
- dialogType: "location"
747
+ dialogType: "currentLocation"
735
748
  });
736
749
  }
737
750
  };
738
751
  },
739
752
  closeCurrentLocationDialog: async () => {
740
- await parent.closeDialog({ dialogId: void 0, dialogType: "location" });
753
+ await parent.closeDialog({ dialogId: void 0, dialogType: "currentLocation" });
741
754
  }
742
755
  };
743
756
  window.UniformMeshSDK = sdk;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/mesh-sdk",
3
- "version": "19.36.1-alpha.4+99b59c404",
3
+ "version": "19.36.1-alpha.61+12e4e2a6e",
4
4
  "description": "Uniform Mesh Framework SDK",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -32,14 +32,14 @@
32
32
  "access": "public"
33
33
  },
34
34
  "dependencies": {
35
- "@uniformdev/canvas": "19.36.1-alpha.4+99b59c404",
36
- "@uniformdev/context": "19.36.1-alpha.4+99b59c404",
37
- "@uniformdev/project-map": "19.36.1-alpha.4+99b59c404",
35
+ "@uniformdev/canvas": "19.36.1-alpha.61+12e4e2a6e",
36
+ "@uniformdev/context": "19.36.1-alpha.61+12e4e2a6e",
37
+ "@uniformdev/project-map": "19.36.1-alpha.61+12e4e2a6e",
38
38
  "imagesloaded": "^5.0.0",
39
39
  "mitt": "^3.0.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/imagesloaded": "^4.1.2"
43
43
  },
44
- "gitHead": "99b59c4046213b258e6610258c603878c490a0b9"
44
+ "gitHead": "12e4e2a6e17788b5337c4c0c90c094735d256c60"
45
45
  }