@neurodyn/react-model-viewer 0.0.10 → 0.0.12
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 +9 -2
- package/dist/index.js +16 -13
- package/package.json +1 -1
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 || '';
|
|
@@ -7074,13 +7077,17 @@ function buildNativeArUrl(glbUrl, usdzUrl, objectType, ios = isIOSDevice()) {
|
|
|
7074
7077
|
const verticalPlacement = 'wall' === objectType || 'ceiling' === objectType ? '&enable_vertical_placement=true' : '';
|
|
7075
7078
|
return `intent://arvr.google.com/scene-viewer/1.0?file=${encodeURIComponent(new URL(glbUrl).toString())}&resizable=false${verticalPlacement}&mode=ar_preferred#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;end;`;
|
|
7076
7079
|
}
|
|
7077
|
-
function
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
}
|
|
7080
|
+
function navigateToAppClip(url) {
|
|
7081
|
+
try {
|
|
7082
|
+
if (window.top && window.top !== window) {
|
|
7083
|
+
window.top.location.href = url;
|
|
7084
|
+
return;
|
|
7085
|
+
}
|
|
7086
|
+
} catch {}
|
|
7087
|
+
window.location.assign(url);
|
|
7088
|
+
}
|
|
7089
|
+
function launchDirectAr(options) {
|
|
7090
|
+
if ('advanced' === options.experience && isSupportedAppClipDevice()) return void navigateToAppClip(buildAppClipUrl(options.appClipBundleId, options.tinuuid, options.hostname, options.hid));
|
|
7084
7091
|
const link = document.createElement('a');
|
|
7085
7092
|
const image = document.createElement('img');
|
|
7086
7093
|
link.rel = 'ar';
|
|
@@ -7192,7 +7199,7 @@ function AR({ disabled, onClick, onBeforeActivateAr, size = 'lg', ...props }) {
|
|
|
7192
7199
|
widgetSessionToken
|
|
7193
7200
|
]);
|
|
7194
7201
|
useEffect(()=>{
|
|
7195
|
-
if (!directArLaunchOptions || isLoading || !isMobileArDevice()) return;
|
|
7202
|
+
if (!directArLaunchOptions || isLoading || !shouldAutoLaunchDirectAr(mode) || !isMobileArDevice()) return;
|
|
7196
7203
|
const launchKey = [
|
|
7197
7204
|
widgetSessionSid ?? 'legacy',
|
|
7198
7205
|
directArLaunchOptions.tinuuid,
|
|
@@ -7219,6 +7226,7 @@ function AR({ disabled, onClick, onBeforeActivateAr, size = 'lg', ...props }) {
|
|
|
7219
7226
|
isLoading,
|
|
7220
7227
|
launchAr,
|
|
7221
7228
|
material?.hid,
|
|
7229
|
+
mode,
|
|
7222
7230
|
trackEvent,
|
|
7223
7231
|
widgetSessionSid
|
|
7224
7232
|
]);
|
|
@@ -7227,11 +7235,6 @@ function AR({ disabled, onClick, onBeforeActivateAr, size = 'lg', ...props }) {
|
|
|
7227
7235
|
if (await launchArOverride(launchAr, arTarget)) return void onBeforeActivateAr?.();
|
|
7228
7236
|
if (directArLaunchOptions && isMobileArDevice()) {
|
|
7229
7237
|
onBeforeActivateAr?.();
|
|
7230
|
-
if ('advanced' === directArLaunchOptions.experience && isSupportedAppClipDevice()) {
|
|
7231
|
-
launchDirectAr(directArLaunchOptions, true);
|
|
7232
|
-
trackEvent('ar_launched');
|
|
7233
|
-
return;
|
|
7234
|
-
}
|
|
7235
7238
|
await flushWidgetEvent(trackEvent('ar_launched'));
|
|
7236
7239
|
launchDirectAr(directArLaunchOptions);
|
|
7237
7240
|
} else if (modelViewerEl.canActivateAR) {
|