@neurodyn/react-model-viewer 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -29,7 +29,15 @@ declare type ModelViewerBackground = 'default' | 'transparent';
29
29
 
30
30
  export declare function ModelViewerDialog({ tinuuid, apiKey, apiBaseUrl, legacyApiBaseUrl, initialWidgetSessionToken, handoffUrl, hid, sizeType, dimensionAxes, ...props }: ModelViewerDialogProps): JSX.Element;
31
31
 
32
- declare interface ModelViewerDialogProps extends Pick<ModelViewerRootProps, 'apiBaseUrl' | 'apiKey' | 'dimensionAxes' | 'handoffUrl' | 'hid' | 'initialWidgetSessionToken' | 'legacyApiBaseUrl' | 'sizeType' | 'tinuuid'>, Omit<DialogProps, 'children'> {
32
+ declare interface ModelViewerDialogProps extends Pick<ModelViewerRootProps, 'apiBaseUrl' | 'apiKey' | 'dimensionAxes' | 'handoffUrl' | 'hid' | 'initialWidgetSessionToken' | 'legacyApiBaseUrl' | 'sizeType' | 'tinuuid'>, Omit<DialogProps, 'children' | 'open' | 'defaultOpen' | 'onOpenChange' | 'modal'> {
33
+ /** The controlled open state of the dialog. Use with `onOpenChange`. */
34
+ open?: DialogProps['open'];
35
+ /** The initial open state when the dialog is uncontrolled. */
36
+ defaultOpen?: DialogProps['defaultOpen'];
37
+ /** Called when the dialog's open state changes. */
38
+ onOpenChange?: DialogProps['onOpenChange'];
39
+ /** Whether interaction outside the dialog is disabled. Defaults to `true`. */
40
+ modal?: DialogProps['modal'];
33
41
  }
34
42
 
35
43
  export declare type ModelViewerLanguage = 'en' | 'ru';
@@ -42,7 +50,6 @@ export declare interface ModelViewerProps extends Omit<ModelViewerRootProps, 'sh
42
50
  declare interface ModelViewerRootProps {
43
51
  /** The unique identifier of a Vizbl object. */
44
52
  tinuuid: string;
45
- /** Public API key. Without it, the viewer uses the legacy `/obj/Fetch` API. */
46
53
  apiKey?: string | null;
47
54
  /** App Clip bundle used by automatic Advanced AR handoffs. */
48
55
  appClipBundleId?: string;
package/dist/index.js CHANGED
@@ -7040,6 +7040,9 @@ function resolveDirectArExperience(mode, arExperience) {
7040
7040
  if ('advanced-ar-view' === mode || 'ar-viewer' === mode || 'embedded-3d-viewer' === mode) return 'advanced';
7041
7041
  if ('qr-code' === mode) return arExperience;
7042
7042
  }
7043
+ function shouldAutoLaunchDirectAr(mode) {
7044
+ return 'ar-viewer' !== mode && 'embedded-3d-viewer' !== mode;
7045
+ }
7043
7046
  function getUserAgent() {
7044
7047
  if ("u" < typeof navigator) return '';
7045
7048
  return navigator.userAgent || navigator.vendor || '';
@@ -7192,7 +7195,7 @@ function AR({ disabled, onClick, onBeforeActivateAr, size = 'lg', ...props }) {
7192
7195
  widgetSessionToken
7193
7196
  ]);
7194
7197
  useEffect(()=>{
7195
- if (!directArLaunchOptions || isLoading || !isMobileArDevice()) return;
7198
+ if (!directArLaunchOptions || isLoading || !shouldAutoLaunchDirectAr(mode) || !isMobileArDevice()) return;
7196
7199
  const launchKey = [
7197
7200
  widgetSessionSid ?? 'legacy',
7198
7201
  directArLaunchOptions.tinuuid,
@@ -7219,6 +7222,7 @@ function AR({ disabled, onClick, onBeforeActivateAr, size = 'lg', ...props }) {
7219
7222
  isLoading,
7220
7223
  launchAr,
7221
7224
  material?.hid,
7225
+ mode,
7222
7226
  trackEvent,
7223
7227
  widgetSessionSid
7224
7228
  ]);
@@ -7227,11 +7231,6 @@ function AR({ disabled, onClick, onBeforeActivateAr, size = 'lg', ...props }) {
7227
7231
  if (await launchArOverride(launchAr, arTarget)) return void onBeforeActivateAr?.();
7228
7232
  if (directArLaunchOptions && isMobileArDevice()) {
7229
7233
  onBeforeActivateAr?.();
7230
- if ('advanced' === directArLaunchOptions.experience && isSupportedAppClipDevice()) {
7231
- launchDirectAr(directArLaunchOptions, true);
7232
- trackEvent('ar_launched');
7233
- return;
7234
- }
7235
7234
  await flushWidgetEvent(trackEvent('ar_launched'));
7236
7235
  launchDirectAr(directArLaunchOptions);
7237
7236
  } else if (modelViewerEl.canActivateAR) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@neurodyn/react-model-viewer",
3
3
  "type": "module",
4
- "version": "0.0.10",
4
+ "version": "0.0.11",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },