@uniformdev/mesh-sdk-react 17.1.1-alpha.452 → 17.1.1-alpha.498

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
@@ -1,5 +1,5 @@
1
1
  import * as _uniformdev_mesh_sdk from '@uniformdev/mesh-sdk';
2
- import { UniformMeshSDK, MeshLocation } from '@uniformdev/mesh-sdk';
2
+ import { MeshLocationCore, UniformMeshSDK, MeshLocation } from '@uniformdev/mesh-sdk';
3
3
  export * from '@uniformdev/mesh-sdk';
4
4
  import * as React from 'react';
5
5
  import React__default, { SVGProps } from 'react';
@@ -10,14 +10,11 @@ export { AddListButton, AddListButtonProps, Button, ButtonProps, Callout, Callou
10
10
 
11
11
  /**
12
12
  * Provides convenient access to the current Uniform Mesh location via React hook.
13
- * Intended to be used within a UniformMeshLocationContextProvider.
13
+ * Intended to be used within <MeshApp />.
14
+ *
15
+ * @deprecated prefer useMeshLocation which has much more accurate type safety
14
16
  */
15
- declare function useUniformMeshLocation<TLocationMethodsValue = unknown, TLocationMethodsMetadata = unknown, TLocationSetValue = TLocationMethodsValue>(): {
16
- value: TLocationMethodsValue;
17
- setValue: (value: TLocationSetValue, options?: _uniformdev_mesh_sdk.SetValueOptions | undefined) => Promise<void>;
18
- metadata: TLocationMethodsMetadata;
19
- setValidationResult: (value: _uniformdev_mesh_sdk.ValidationResult) => Promise<void>;
20
- };
17
+ declare function useUniformMeshLocation<TLocationValue = unknown, TLocationMetadata = never, TLocationSetValue = TLocationValue>(): MeshLocationCore<TLocationValue, TLocationMetadata, TLocationSetValue>;
21
18
 
22
19
  interface UseUniformMeshSdkOptions {
23
20
  autoResizingDisabled?: boolean;
@@ -25,6 +22,8 @@ interface UseUniformMeshSdkOptions {
25
22
  /**
26
23
  * Provides a React-hook wrapper around Uniform Mesh SDK initialization.
27
24
  * NOTE: initialization is an async operation and should be handled as such.
25
+ *
26
+ * @deprecated prefer <MeshApp /> to initialize and provide in a single component
28
27
  */
29
28
  declare const useInitializeUniformMeshSdk: ({ autoResizingDisabled }?: UseUniformMeshSdkOptions) => {
30
29
  initializing: boolean;
@@ -34,27 +33,63 @@ declare const useInitializeUniformMeshSdk: ({ autoResizingDisabled }?: UseUnifor
34
33
 
35
34
  /**
36
35
  * Provides convenient access to the current Uniform Mesh SDK instance via React hook.
37
- * Intended to be used within a UniformMeshSdkContextProvider.
36
+ * Intended to be used within <MeshApp />.
38
37
  */
39
38
  declare function useUniformMeshSdk(): _uniformdev_mesh_sdk.UniformMeshSDK;
40
39
 
41
- interface UniformMeshLocationContextValue<TLocationValue = unknown, TLocationMetadata = unknown, TLocationSetValue = TLocationValue> {
42
- location: MeshLocation<TLocationValue, TLocationMetadata, TLocationSetValue>;
40
+ /**
41
+ * Provides convenient access to the current Uniform Mesh location via React hook.
42
+ * Intended to be used within <MeshApp />.
43
+ *
44
+ * There are three primary ways to invoke this hook:
45
+ * 1. Without any arguments, this hook will return the current location regardless of its type. The result will be a union of all possible locations you can discriminate between i.e. with an if statement on the `type`
46
+ * const location = useMeshLocation();
47
+ * if (location.type === 'paramType') { // location is now known to be a paramType }
48
+ * 2. With a string argument, this hook will assert that the current location is the expected one and return the correct typings for that location.
49
+ * const location = useMeshLocation('settings');
50
+ * 3. With an explicit generic to set the expected param type data or param type settings data. This is useful because (2) will return unknown as the value type for param types.
51
+ * const location = useMeshLocation<'paramType', MyParamTypeValueType>();
52
+ *
53
+ * You can also combine (2) and (3) to get both explicit value typing and assertion of the location.
54
+ */
55
+ declare function useMeshLocation<TLocationType extends MeshLocation['type'], TLocationValue = unknown, TLocationSetValue = TLocationValue>(expectedLocation?: TLocationType): Extract<_uniformdev_mesh_sdk.DataConnectionLocation, {
56
+ type: TLocationType;
57
+ }> | Extract<_uniformdev_mesh_sdk.DataTypeLocation, {
58
+ type: TLocationType;
59
+ }> | Extract<_uniformdev_mesh_sdk.DataTypeInstanceLocation, {
60
+ type: TLocationType;
61
+ }> | Extract<_uniformdev_mesh_sdk.ParamTypeLocation<TLocationValue, unknown, TLocationSetValue, unknown>, {
62
+ type: TLocationType;
63
+ }> | Extract<_uniformdev_mesh_sdk.ParamTypeConfigLocation<TLocationValue, unknown>, {
64
+ type: TLocationType;
65
+ }> | Extract<_uniformdev_mesh_sdk.SettingsLocation<TLocationValue>, {
66
+ type: TLocationType;
67
+ }>;
68
+
69
+ /** @deprecated */
70
+ interface UniformMeshLocationContextValue<TLocationValue = unknown, TLocationSetValue = TLocationValue> {
71
+ location: MeshLocation<TLocationValue, TLocationSetValue>;
43
72
  }
44
- declare const UniformMeshLocationContext: React__default.Context<UniformMeshLocationContextValue<unknown, unknown, unknown> | undefined>;
73
+ /** @deprecated not intended for public usage */
74
+ declare const UniformMeshLocationContext: React__default.Context<UniformMeshLocationContextValue<unknown, unknown> | undefined>;
75
+ /** @deprecated not intended for public usage. Use <MeshApp /> instead. */
45
76
  declare const UniformMeshLocationContextProvider: React__default.FC<React__default.PropsWithChildren<unknown>>;
46
77
  /**
47
78
  * Provides access to the current UniformMeshLocationContext value.
79
+ * @deprecated Not intended for public use. Use `useUniformMeshLocation` instead.
48
80
  */
49
- declare const useUniformMeshLocationContext: <TLocationValue, TLocationMetadata, TLocationSetValue = TLocationValue>() => UniformMeshLocationContextValue<TLocationValue, TLocationMetadata, TLocationSetValue>;
81
+ declare const useUniformMeshLocationContext: <TLocationValue = unknown, TLocationSetValue = TLocationValue>() => UniformMeshLocationContextValue<TLocationValue, TLocationSetValue>;
50
82
 
51
83
  interface UniformMeshSdkContextValue {
52
84
  sdk: UniformMeshSDK;
53
85
  }
86
+ /** @deprecated not intended for public usage */
54
87
  declare const UniformMeshSdkContext: React__default.Context<UniformMeshSdkContextValue | undefined>;
88
+ /** @deprecated not intended for public usage; use <MeshApp /> instead */
55
89
  declare const UniformMeshSdkContextProvider: React__default.FC<React__default.PropsWithChildren<unknown>>;
56
90
  /**
57
91
  * Provides access to the current (initialized) Uniform Mesh SDK context value.
92
+ * @deprecated Not intended for public use. Use `useUniformMeshLocation` or `useUniformMeshSdk` instead.
58
93
  */
59
94
  declare const useUniformMeshSdkContext: () => UniformMeshSdkContextValue;
60
95
 
@@ -374,6 +409,14 @@ interface DamSelectedItemProps<TResult extends DamItem = DamItem> {
374
409
  }
375
410
  declare function DamSelectedItem({ selectedItem, onDeselect, onEditClosed, logoIcon, itemDetailsRendererComponent, }: DamSelectedItemProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
376
411
 
412
+ declare type MeshAppProps = {
413
+ loadingComponent?: React__default.ComponentType;
414
+ errorComponent?: React__default.ComponentType<{
415
+ error: Error;
416
+ }>;
417
+ };
418
+ declare const MeshApp: React__default.FC<React__default.PropsWithChildren<MeshAppProps>>;
419
+
377
420
  declare const SvgCaution: (props: SVGProps<SVGSVGElement>) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
378
421
 
379
422
  declare const SvgCheckmark: (props: SVGProps<SVGSVGElement>) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
@@ -418,4 +461,4 @@ declare namespace index {
418
461
  };
419
462
  }
420
463
 
421
- export { Brand, DamItem, DamSelectedItem, DamSelectedItemProps, DefaultSearchRow, DefaultSelectedItem, EntrySearch, EntrySearchContentType, EntrySearchProps, EntrySearchQueryOptions, EntrySearchResult, EntrySearchRowProps, EntrySearchSelectedItemProps, GetProductOptions, GetProductsOptions, index as Icons, NoResultsProps, ProductCategory, ProductDynamicSelectorValue, ProductPreviewList, ProductQuery, ProductQueryCategory, ProductQueryContext, ProductQueryContextValue, ProductQueryProps, ProductSearch, ProductSearchContext, ProductSearchContextValue, ProductSearchProps, ProductSearchResult, ProductSearchResults, ProductSearchRow, ProductSelectedItem, ResolvableLoadingValue, SelectionField, SelectionFieldValue, UniformMeshLocationContext, UniformMeshLocationContextProvider, UniformMeshLocationContextValue, UniformMeshSdkContext, UniformMeshSdkContextProvider, UniformMeshSdkContextValue, UseUniformMeshSdkOptions, badgeIcon, damSelectItemImage, damSelectedItemContainer, damSelectedItemCopy, damSelectedItemDetails, damSelectedItemIcon, damSelectedItemInfoBtn, damSelectedItemInner, damSelectedItemLinkBtn, damSelectedItemLinkContainer, damSelectedItemMediaContainer, damSelectedItemPopover, damSelectedItemPopoverLabel, damSelectedItemSmallText, damSelectedItemTitle, draggableContainer, draggableIcon, draggableIconOffset, draggableIconWrapper, entrySearchBtn, entrySearchConfig, entrySearchConfigHidden, entrySearchLoadMoreBtn, entrySearchResultList, entrySearchSelectIcon, entrySearchSelectImg, entrySearchSelectInput, entrySearchSelectOption, entrySearchWrapper, productSearchRowActiveIcon, productSearchRowCategory, productSearchRowContainer, productSearchRowContent, productSearchRowContentActive, productSearchRowDetails, productSearchRowTitle, productSelectedItemContainer, productSelectedItemContent, productSelectedItemDetails, productSelectedItemIcon, productSelectedItemImage, productSelectedItemLinkContainer, productedSelectedItemLinkBtn, productedSelectedItemSmallText, searchRowBtn, searchRowContainer, searchRowContainerActive, searchRowContainerWithPopover, searchRowPopover, searchRowText, searchRowTextSmall, selectItemLinkBtn, selectItemLinkContainer, selectItemPopover, selectItemPopoverLabel, selectItemSmallText, selectedItemContainer, selectedItemCopy, selectedItemDetails, selectedItemIcon, selectedItemInner, selectedItemTitle, useInitializeUniformMeshSdk, useProductQueryContext, useProductSearchContext, useUniformMeshLocation, useUniformMeshLocationContext, useUniformMeshSdk, useUniformMeshSdkContext };
464
+ export { Brand, DamItem, DamSelectedItem, DamSelectedItemProps, DefaultSearchRow, DefaultSelectedItem, EntrySearch, EntrySearchContentType, EntrySearchProps, EntrySearchQueryOptions, EntrySearchResult, EntrySearchRowProps, EntrySearchSelectedItemProps, GetProductOptions, GetProductsOptions, index as Icons, MeshApp, MeshAppProps, NoResultsProps, ProductCategory, ProductDynamicSelectorValue, ProductPreviewList, ProductQuery, ProductQueryCategory, ProductQueryContext, ProductQueryContextValue, ProductQueryProps, ProductSearch, ProductSearchContext, ProductSearchContextValue, ProductSearchProps, ProductSearchResult, ProductSearchResults, ProductSearchRow, ProductSelectedItem, ResolvableLoadingValue, SelectionField, SelectionFieldValue, UniformMeshLocationContext, UniformMeshLocationContextProvider, UniformMeshLocationContextValue, UniformMeshSdkContext, UniformMeshSdkContextProvider, UniformMeshSdkContextValue, UseUniformMeshSdkOptions, badgeIcon, damSelectItemImage, damSelectedItemContainer, damSelectedItemCopy, damSelectedItemDetails, damSelectedItemIcon, damSelectedItemInfoBtn, damSelectedItemInner, damSelectedItemLinkBtn, damSelectedItemLinkContainer, damSelectedItemMediaContainer, damSelectedItemPopover, damSelectedItemPopoverLabel, damSelectedItemSmallText, damSelectedItemTitle, draggableContainer, draggableIcon, draggableIconOffset, draggableIconWrapper, entrySearchBtn, entrySearchConfig, entrySearchConfigHidden, entrySearchLoadMoreBtn, entrySearchResultList, entrySearchSelectIcon, entrySearchSelectImg, entrySearchSelectInput, entrySearchSelectOption, entrySearchWrapper, productSearchRowActiveIcon, productSearchRowCategory, productSearchRowContainer, productSearchRowContent, productSearchRowContentActive, productSearchRowDetails, productSearchRowTitle, productSelectedItemContainer, productSelectedItemContent, productSelectedItemDetails, productSelectedItemIcon, productSelectedItemImage, productSelectedItemLinkContainer, productedSelectedItemLinkBtn, productedSelectedItemSmallText, searchRowBtn, searchRowContainer, searchRowContainerActive, searchRowContainerWithPopover, searchRowPopover, searchRowText, searchRowTextSmall, selectItemLinkBtn, selectItemLinkContainer, selectItemPopover, selectItemPopoverLabel, selectItemSmallText, selectedItemContainer, selectedItemCopy, selectedItemDetails, selectedItemIcon, selectedItemInner, selectedItemTitle, useInitializeUniformMeshSdk, useMeshLocation, useProductQueryContext, useProductSearchContext, useUniformMeshLocation, useUniformMeshLocationContext, useUniformMeshSdk, useUniformMeshSdkContext };