@uniformdev/mesh-sdk 19.35.2 → 19.35.3-alpha.82
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 +1031 -0
- package/dist/index.d.ts +46 -8
- package/dist/index.esm.js +29 -16
- package/dist/index.js +29 -16
- package/dist/index.mjs +29 -16
- package/package.json +5 -5
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
|
|
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
|
-
/**
|
|
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 data element 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 data element */
|
|
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
|
|
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
|
|
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
|
};
|
|
@@ -536,9 +548,12 @@ var createSdkWindow = ({
|
|
|
536
548
|
onHeightChange == null ? void 0 : onHeightChange(height);
|
|
537
549
|
return;
|
|
538
550
|
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
551
|
+
let maxBottom = windowInstance.document.documentElement.getBoundingClientRect().height;
|
|
552
|
+
windowInstance.document.querySelectorAll("div, section, article, menu, nav, footer").forEach((div) => {
|
|
553
|
+
const bottom = div.getBoundingClientRect().bottom;
|
|
554
|
+
maxBottom = Math.max(maxBottom, bottom);
|
|
555
|
+
});
|
|
556
|
+
const windowHeight = `${Math.ceil(maxBottom)}px`;
|
|
542
557
|
if (windowHeight !== oldHeight) {
|
|
543
558
|
oldHeight = windowHeight;
|
|
544
559
|
onHeightChange == null ? void 0 : onHeightChange(windowHeight);
|
|
@@ -604,15 +619,11 @@ async function initializeUniformMeshSDK({
|
|
|
604
619
|
getCurrentLocation: () => {
|
|
605
620
|
const location = {
|
|
606
621
|
getDataResource: parent.getDataResource,
|
|
622
|
+
editConnectedData: parent.editConnectedData,
|
|
607
623
|
type: contextData.locationType,
|
|
608
624
|
isReadOnly: contextData.isReadOnly,
|
|
609
625
|
value: contextData.locationValue,
|
|
610
626
|
setValue: async (value, options) => {
|
|
611
|
-
if (contextData.dialogContext) {
|
|
612
|
-
console.warn(
|
|
613
|
-
"Using setValue() inside a dialog is deprecated. Use dialogContext.returnDialogValue() instead."
|
|
614
|
-
);
|
|
615
|
-
}
|
|
616
627
|
contextData.locationValue = value;
|
|
617
628
|
sdk.events.emit("onValueChanged", { newValue: value });
|
|
618
629
|
await parent.setValue({ uniformMeshLocationValue: value, options });
|
|
@@ -624,7 +635,7 @@ async function initializeUniformMeshSDK({
|
|
|
624
635
|
returnDialogValue: async (value) => {
|
|
625
636
|
contextData.locationValue = value;
|
|
626
637
|
sdk.events.emit("onValueChanged", { newValue: value });
|
|
627
|
-
await parent.setValue({ uniformMeshLocationValue: value });
|
|
638
|
+
await parent.setValue({ uniformMeshLocationValue: value, closeDialog: true });
|
|
628
639
|
}
|
|
629
640
|
} : void 0
|
|
630
641
|
};
|
|
@@ -684,26 +695,28 @@ async function initializeUniformMeshSDK({
|
|
|
684
695
|
},
|
|
685
696
|
openCurrentLocationDialog: async (options) => {
|
|
686
697
|
const result = await parent.openDialog({
|
|
687
|
-
dialogType: "
|
|
698
|
+
dialogType: "currentLocation",
|
|
688
699
|
dialogData: {},
|
|
689
700
|
options: options == null ? void 0 : options.options
|
|
690
701
|
});
|
|
691
702
|
if (!result) {
|
|
692
703
|
return;
|
|
693
704
|
}
|
|
705
|
+
contextData.locationValue = result.value;
|
|
706
|
+
sdk.events.emit("onValueChanged", { newValue: result.value });
|
|
694
707
|
return {
|
|
695
708
|
dialogId: result.dialogId,
|
|
696
709
|
value: result.value,
|
|
697
710
|
closeDialog: async () => {
|
|
698
711
|
await parent.closeDialog({
|
|
699
712
|
dialogId: void 0,
|
|
700
|
-
dialogType: "
|
|
713
|
+
dialogType: "currentLocation"
|
|
701
714
|
});
|
|
702
715
|
}
|
|
703
716
|
};
|
|
704
717
|
},
|
|
705
718
|
closeCurrentLocationDialog: async () => {
|
|
706
|
-
await parent.closeDialog({ dialogId: void 0, dialogType: "
|
|
719
|
+
await parent.closeDialog({ dialogId: void 0, dialogType: "currentLocation" });
|
|
707
720
|
}
|
|
708
721
|
};
|
|
709
722
|
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
|
};
|
|
@@ -573,9 +585,12 @@ var createSdkWindow = ({
|
|
|
573
585
|
onHeightChange == null ? void 0 : onHeightChange(height);
|
|
574
586
|
return;
|
|
575
587
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
588
|
+
let maxBottom = windowInstance.document.documentElement.getBoundingClientRect().height;
|
|
589
|
+
windowInstance.document.querySelectorAll("div, section, article, menu, nav, footer").forEach((div) => {
|
|
590
|
+
const bottom = div.getBoundingClientRect().bottom;
|
|
591
|
+
maxBottom = Math.max(maxBottom, bottom);
|
|
592
|
+
});
|
|
593
|
+
const windowHeight = `${Math.ceil(maxBottom)}px`;
|
|
579
594
|
if (windowHeight !== oldHeight) {
|
|
580
595
|
oldHeight = windowHeight;
|
|
581
596
|
onHeightChange == null ? void 0 : onHeightChange(windowHeight);
|
|
@@ -641,15 +656,11 @@ async function initializeUniformMeshSDK({
|
|
|
641
656
|
getCurrentLocation: () => {
|
|
642
657
|
const location = {
|
|
643
658
|
getDataResource: parent.getDataResource,
|
|
659
|
+
editConnectedData: parent.editConnectedData,
|
|
644
660
|
type: contextData.locationType,
|
|
645
661
|
isReadOnly: contextData.isReadOnly,
|
|
646
662
|
value: contextData.locationValue,
|
|
647
663
|
setValue: async (value, options) => {
|
|
648
|
-
if (contextData.dialogContext) {
|
|
649
|
-
console.warn(
|
|
650
|
-
"Using setValue() inside a dialog is deprecated. Use dialogContext.returnDialogValue() instead."
|
|
651
|
-
);
|
|
652
|
-
}
|
|
653
664
|
contextData.locationValue = value;
|
|
654
665
|
sdk.events.emit("onValueChanged", { newValue: value });
|
|
655
666
|
await parent.setValue({ uniformMeshLocationValue: value, options });
|
|
@@ -661,7 +672,7 @@ async function initializeUniformMeshSDK({
|
|
|
661
672
|
returnDialogValue: async (value) => {
|
|
662
673
|
contextData.locationValue = value;
|
|
663
674
|
sdk.events.emit("onValueChanged", { newValue: value });
|
|
664
|
-
await parent.setValue({ uniformMeshLocationValue: value });
|
|
675
|
+
await parent.setValue({ uniformMeshLocationValue: value, closeDialog: true });
|
|
665
676
|
}
|
|
666
677
|
} : void 0
|
|
667
678
|
};
|
|
@@ -721,26 +732,28 @@ async function initializeUniformMeshSDK({
|
|
|
721
732
|
},
|
|
722
733
|
openCurrentLocationDialog: async (options) => {
|
|
723
734
|
const result = await parent.openDialog({
|
|
724
|
-
dialogType: "
|
|
735
|
+
dialogType: "currentLocation",
|
|
725
736
|
dialogData: {},
|
|
726
737
|
options: options == null ? void 0 : options.options
|
|
727
738
|
});
|
|
728
739
|
if (!result) {
|
|
729
740
|
return;
|
|
730
741
|
}
|
|
742
|
+
contextData.locationValue = result.value;
|
|
743
|
+
sdk.events.emit("onValueChanged", { newValue: result.value });
|
|
731
744
|
return {
|
|
732
745
|
dialogId: result.dialogId,
|
|
733
746
|
value: result.value,
|
|
734
747
|
closeDialog: async () => {
|
|
735
748
|
await parent.closeDialog({
|
|
736
749
|
dialogId: void 0,
|
|
737
|
-
dialogType: "
|
|
750
|
+
dialogType: "currentLocation"
|
|
738
751
|
});
|
|
739
752
|
}
|
|
740
753
|
};
|
|
741
754
|
},
|
|
742
755
|
closeCurrentLocationDialog: async () => {
|
|
743
|
-
await parent.closeDialog({ dialogId: void 0, dialogType: "
|
|
756
|
+
await parent.closeDialog({ dialogId: void 0, dialogType: "currentLocation" });
|
|
744
757
|
}
|
|
745
758
|
};
|
|
746
759
|
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
|
};
|
|
@@ -536,9 +548,12 @@ var createSdkWindow = ({
|
|
|
536
548
|
onHeightChange == null ? void 0 : onHeightChange(height);
|
|
537
549
|
return;
|
|
538
550
|
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
551
|
+
let maxBottom = windowInstance.document.documentElement.getBoundingClientRect().height;
|
|
552
|
+
windowInstance.document.querySelectorAll("div, section, article, menu, nav, footer").forEach((div) => {
|
|
553
|
+
const bottom = div.getBoundingClientRect().bottom;
|
|
554
|
+
maxBottom = Math.max(maxBottom, bottom);
|
|
555
|
+
});
|
|
556
|
+
const windowHeight = `${Math.ceil(maxBottom)}px`;
|
|
542
557
|
if (windowHeight !== oldHeight) {
|
|
543
558
|
oldHeight = windowHeight;
|
|
544
559
|
onHeightChange == null ? void 0 : onHeightChange(windowHeight);
|
|
@@ -604,15 +619,11 @@ async function initializeUniformMeshSDK({
|
|
|
604
619
|
getCurrentLocation: () => {
|
|
605
620
|
const location = {
|
|
606
621
|
getDataResource: parent.getDataResource,
|
|
622
|
+
editConnectedData: parent.editConnectedData,
|
|
607
623
|
type: contextData.locationType,
|
|
608
624
|
isReadOnly: contextData.isReadOnly,
|
|
609
625
|
value: contextData.locationValue,
|
|
610
626
|
setValue: async (value, options) => {
|
|
611
|
-
if (contextData.dialogContext) {
|
|
612
|
-
console.warn(
|
|
613
|
-
"Using setValue() inside a dialog is deprecated. Use dialogContext.returnDialogValue() instead."
|
|
614
|
-
);
|
|
615
|
-
}
|
|
616
627
|
contextData.locationValue = value;
|
|
617
628
|
sdk.events.emit("onValueChanged", { newValue: value });
|
|
618
629
|
await parent.setValue({ uniformMeshLocationValue: value, options });
|
|
@@ -624,7 +635,7 @@ async function initializeUniformMeshSDK({
|
|
|
624
635
|
returnDialogValue: async (value) => {
|
|
625
636
|
contextData.locationValue = value;
|
|
626
637
|
sdk.events.emit("onValueChanged", { newValue: value });
|
|
627
|
-
await parent.setValue({ uniformMeshLocationValue: value });
|
|
638
|
+
await parent.setValue({ uniformMeshLocationValue: value, closeDialog: true });
|
|
628
639
|
}
|
|
629
640
|
} : void 0
|
|
630
641
|
};
|
|
@@ -684,26 +695,28 @@ async function initializeUniformMeshSDK({
|
|
|
684
695
|
},
|
|
685
696
|
openCurrentLocationDialog: async (options) => {
|
|
686
697
|
const result = await parent.openDialog({
|
|
687
|
-
dialogType: "
|
|
698
|
+
dialogType: "currentLocation",
|
|
688
699
|
dialogData: {},
|
|
689
700
|
options: options == null ? void 0 : options.options
|
|
690
701
|
});
|
|
691
702
|
if (!result) {
|
|
692
703
|
return;
|
|
693
704
|
}
|
|
705
|
+
contextData.locationValue = result.value;
|
|
706
|
+
sdk.events.emit("onValueChanged", { newValue: result.value });
|
|
694
707
|
return {
|
|
695
708
|
dialogId: result.dialogId,
|
|
696
709
|
value: result.value,
|
|
697
710
|
closeDialog: async () => {
|
|
698
711
|
await parent.closeDialog({
|
|
699
712
|
dialogId: void 0,
|
|
700
|
-
dialogType: "
|
|
713
|
+
dialogType: "currentLocation"
|
|
701
714
|
});
|
|
702
715
|
}
|
|
703
716
|
};
|
|
704
717
|
},
|
|
705
718
|
closeCurrentLocationDialog: async () => {
|
|
706
|
-
await parent.closeDialog({ dialogId: void 0, dialogType: "
|
|
719
|
+
await parent.closeDialog({ dialogId: void 0, dialogType: "currentLocation" });
|
|
707
720
|
}
|
|
708
721
|
};
|
|
709
722
|
window.UniformMeshSDK = sdk;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/mesh-sdk",
|
|
3
|
-
"version": "19.35.
|
|
3
|
+
"version": "19.35.3-alpha.82+4bc341093",
|
|
4
4
|
"description": "Uniform Mesh Framework SDK",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@uniformdev/canvas": "19.35.
|
|
36
|
-
"@uniformdev/context": "19.35.
|
|
37
|
-
"@uniformdev/project-map": "19.35.
|
|
35
|
+
"@uniformdev/canvas": "19.35.3-alpha.82+4bc341093",
|
|
36
|
+
"@uniformdev/context": "19.35.3-alpha.82+4bc341093",
|
|
37
|
+
"@uniformdev/project-map": "19.35.3-alpha.82+4bc341093",
|
|
38
38
|
"mitt": "^3.0.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "4bc341093bc946900df2646fe53eca4bcddc693c"
|
|
41
41
|
}
|