@neurodyn/react-ar 0.0.14 → 0.1.0
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.
|
@@ -4,9 +4,9 @@ import { FullScreenQuad } from "three/examples/jsm/postprocessing/Pass.js";
|
|
|
4
4
|
import { HorizontalBlurShader } from "three/examples/jsm/shaders/HorizontalBlurShader.js";
|
|
5
5
|
import { VerticalBlurShader } from "three/examples/jsm/shaders/VerticalBlurShader.js";
|
|
6
6
|
import { HDRLoader } from "three/examples/jsm/loaders/HDRLoader.js";
|
|
7
|
-
export const __rspack_esm_id = "
|
|
7
|
+
export const __rspack_esm_id = "647";
|
|
8
8
|
export const __rspack_esm_ids = [
|
|
9
|
-
"
|
|
9
|
+
"647"
|
|
10
10
|
];
|
|
11
11
|
export const __webpack_modules__ = {
|
|
12
12
|
"./src/root.tsx" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -18,29 +18,7 @@ export const __webpack_modules__ = {
|
|
|
18
18
|
var react_query_ = __webpack_require__("@tanstack/react-query");
|
|
19
19
|
var external_react_ = __webpack_require__("react");
|
|
20
20
|
var external_react_i18next_ = __webpack_require__("react-i18next");
|
|
21
|
-
|
|
22
|
-
if (!error || 'object' != typeof error || !('response' in error)) return;
|
|
23
|
-
const response = error.response;
|
|
24
|
-
if (!response || 'object' != typeof response || !('status' in response)) return;
|
|
25
|
-
return 'number' == typeof response.status ? response.status : void 0;
|
|
26
|
-
}
|
|
27
|
-
function getArDataError(error, resource) {
|
|
28
|
-
const status = getErrorResponseStatus(error);
|
|
29
|
-
if (401 === status || 403 === status) return 'access-denied';
|
|
30
|
-
if (404 === status && 'object' === resource) return 'object-not-published';
|
|
31
|
-
return 'object' === resource ? 'object-load-failed' : 'catalog-load-failed';
|
|
32
|
-
}
|
|
33
|
-
function getArErrorStateVariant(error) {
|
|
34
|
-
switch(error){
|
|
35
|
-
case 'access-denied':
|
|
36
|
-
return 'unauthorized';
|
|
37
|
-
case 'missing-tinuuid':
|
|
38
|
-
case 'object-not-published':
|
|
39
|
-
return 'not-found';
|
|
40
|
-
default:
|
|
41
|
-
return 'unavailable';
|
|
42
|
-
}
|
|
43
|
-
}
|
|
21
|
+
var errors = __webpack_require__("./src/api/public-api/errors.ts");
|
|
44
22
|
var widget_session = __webpack_require__("./src/api/public-api/widget-session.ts");
|
|
45
23
|
var object_metadata = __webpack_require__("./src/lib/object-metadata.ts");
|
|
46
24
|
function createArSessionResource(object, hid) {
|
|
@@ -8207,6 +8185,7 @@ export const __webpack_modules__ = {
|
|
|
8207
8185
|
function getAnonymousRequestConfig(options) {
|
|
8208
8186
|
return {
|
|
8209
8187
|
baseURL: options.baseURL,
|
|
8188
|
+
headers: (0, widget_session.s2)(options.brand),
|
|
8210
8189
|
signal: options.signal
|
|
8211
8190
|
};
|
|
8212
8191
|
}
|
|
@@ -8214,11 +8193,30 @@ export const __webpack_modules__ = {
|
|
|
8214
8193
|
return {
|
|
8215
8194
|
baseURL: options.baseURL,
|
|
8216
8195
|
headers: {
|
|
8196
|
+
...(0, widget_session.s2)(options.brand),
|
|
8217
8197
|
'x-api-key': options.apiKey
|
|
8218
8198
|
},
|
|
8219
8199
|
signal: options.signal
|
|
8220
8200
|
};
|
|
8221
8201
|
}
|
|
8202
|
+
async function requestWithKey(options, request) {
|
|
8203
|
+
try {
|
|
8204
|
+
return await request(getRequestConfig(options));
|
|
8205
|
+
} catch (error) {
|
|
8206
|
+
const status = (0, errors.Es)(error);
|
|
8207
|
+
if (401 !== status && 403 !== status || options.signal?.aborted) throw error;
|
|
8208
|
+
const token = (await options.getWidgetSessionToken?.())?.trim();
|
|
8209
|
+
if (!token || options.signal?.aborted) throw error;
|
|
8210
|
+
return await request({
|
|
8211
|
+
baseURL: options.baseURL,
|
|
8212
|
+
headers: {
|
|
8213
|
+
...(0, widget_session.s2)(options.brand),
|
|
8214
|
+
[widget_session.qw]: token
|
|
8215
|
+
},
|
|
8216
|
+
signal: options.signal
|
|
8217
|
+
});
|
|
8218
|
+
}
|
|
8219
|
+
}
|
|
8222
8220
|
function arObjectQueryKey(tinuuid, options) {
|
|
8223
8221
|
return [
|
|
8224
8222
|
'ar',
|
|
@@ -8226,6 +8224,7 @@ export const __webpack_modules__ = {
|
|
|
8226
8224
|
{
|
|
8227
8225
|
apiKey: options.apiKey ?? null,
|
|
8228
8226
|
baseURL: options.baseURL,
|
|
8227
|
+
brand: options.brand ?? null,
|
|
8229
8228
|
tinuuid,
|
|
8230
8229
|
variantId: options.variantId ?? null
|
|
8231
8230
|
}
|
|
@@ -8240,6 +8239,7 @@ export const __webpack_modules__ = {
|
|
|
8240
8239
|
categoryId: filters.category?.id ?? null,
|
|
8241
8240
|
categoryKind: filters.category?.kind ?? null,
|
|
8242
8241
|
baseURL: options.baseURL,
|
|
8242
|
+
brand: options.brand ?? null,
|
|
8243
8243
|
ownerUuid: ownerUuid ?? null,
|
|
8244
8244
|
search: (0, helpers.J)(filters.search) ?? null
|
|
8245
8245
|
}
|
|
@@ -8251,6 +8251,7 @@ export const __webpack_modules__ = {
|
|
|
8251
8251
|
'owner-account',
|
|
8252
8252
|
{
|
|
8253
8253
|
baseURL: options.baseURL,
|
|
8254
|
+
brand: options.brand ?? null,
|
|
8254
8255
|
ownerUuid: ownerUuid ?? null
|
|
8255
8256
|
}
|
|
8256
8257
|
];
|
|
@@ -8263,6 +8264,7 @@ export const __webpack_modules__ = {
|
|
|
8263
8264
|
apiKey: options.apiKey ?? null,
|
|
8264
8265
|
categoryMode,
|
|
8265
8266
|
baseURL: options.baseURL,
|
|
8267
|
+
brand: options.brand ?? null,
|
|
8266
8268
|
ownerUuid: ownerUuid ?? null
|
|
8267
8269
|
}
|
|
8268
8270
|
];
|
|
@@ -8271,12 +8273,12 @@ export const __webpack_modules__ = {
|
|
|
8271
8273
|
if (!options.apiKey) return await (0, gen.Ago)({
|
|
8272
8274
|
tinuuid
|
|
8273
8275
|
}, getAnonymousRequestConfig(options));
|
|
8274
|
-
return await (0, gen.ytc)({
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8276
|
+
return await requestWithKey(options, (config)=>(0, gen.ytc)({
|
|
8277
|
+
tinuuid
|
|
8278
|
+
}, {
|
|
8279
|
+
productType: AR_PRODUCT_TYPE,
|
|
8280
|
+
variantId: options.variantId
|
|
8281
|
+
}, config));
|
|
8280
8282
|
}
|
|
8281
8283
|
async function fetchArOwnerObjects(ownerUuid, page, options, filters = {}) {
|
|
8282
8284
|
const search = (0, helpers.J)(filters.search);
|
|
@@ -8298,9 +8300,9 @@ export const __webpack_modules__ = {
|
|
|
8298
8300
|
} : {}
|
|
8299
8301
|
};
|
|
8300
8302
|
if (!options.apiKey) return await (0, gen.qgy)(data, getAnonymousRequestConfig(options));
|
|
8301
|
-
return await (0, gen.avi)(data, {
|
|
8302
|
-
|
|
8303
|
-
|
|
8303
|
+
return await requestWithKey(options, (config)=>(0, gen.avi)(data, {
|
|
8304
|
+
productType: AR_PRODUCT_TYPE
|
|
8305
|
+
}, config));
|
|
8304
8306
|
}
|
|
8305
8307
|
function getArOwnerObjectsNextPage(lastPage, lastPageParam) {
|
|
8306
8308
|
if (void 0 !== lastPage.pages_count) return lastPageParam < lastPage.pages_count ? lastPageParam + 1 : void 0;
|
|
@@ -8309,10 +8311,7 @@ export const __webpack_modules__ = {
|
|
|
8309
8311
|
async function fetchArOwnerAccount(ownerUuid, options) {
|
|
8310
8312
|
return fetchPublicAccount({
|
|
8311
8313
|
uuid: ownerUuid
|
|
8312
|
-
},
|
|
8313
|
-
baseURL: options.baseURL,
|
|
8314
|
-
signal: options.signal
|
|
8315
|
-
});
|
|
8314
|
+
}, getAnonymousRequestConfig(options));
|
|
8316
8315
|
}
|
|
8317
8316
|
function toCatalogCategory(cat) {
|
|
8318
8317
|
const id = normalizeCategoryId(cat.id);
|
|
@@ -8341,13 +8340,13 @@ export const __webpack_modules__ = {
|
|
|
8341
8340
|
return b.id === DEFAULT_CATEGORY_ID ? -1 : 0;
|
|
8342
8341
|
}
|
|
8343
8342
|
async function fetchOwnerTags(ownerUuid, options) {
|
|
8344
|
-
if (options.apiKey) return await (
|
|
8343
|
+
if (options.apiKey) return await requestWithKey(options, gen.c03);
|
|
8345
8344
|
return await (0, gen._8U)({
|
|
8346
8345
|
ownerUuid
|
|
8347
8346
|
}, getAnonymousRequestConfig(options));
|
|
8348
8347
|
}
|
|
8349
8348
|
async function fetchOwnerCategories(ownerUuid, options) {
|
|
8350
|
-
if (options.apiKey) return await (
|
|
8349
|
+
if (options.apiKey) return await requestWithKey(options, gen.T07);
|
|
8351
8350
|
return await (0, gen.adr)({
|
|
8352
8351
|
ownerUuid
|
|
8353
8352
|
}, getAnonymousRequestConfig(options));
|
|
@@ -8378,7 +8377,8 @@ export const __webpack_modules__ = {
|
|
|
8378
8377
|
'ar',
|
|
8379
8378
|
'scene-environment',
|
|
8380
8379
|
{
|
|
8381
|
-
baseURL: options.baseURL
|
|
8380
|
+
baseURL: options.baseURL,
|
|
8381
|
+
brand: options.brand ?? null
|
|
8382
8382
|
}
|
|
8383
8383
|
];
|
|
8384
8384
|
}
|
|
@@ -8386,6 +8386,7 @@ export const __webpack_modules__ = {
|
|
|
8386
8386
|
try {
|
|
8387
8387
|
const config = await (0, gen.b6)(void 0, {
|
|
8388
8388
|
baseURL: options.baseURL,
|
|
8389
|
+
headers: (0, widget_session.s2)(options.brand),
|
|
8389
8390
|
signal: options.signal
|
|
8390
8391
|
});
|
|
8391
8392
|
return extractArEnvironmentUrl(config) ?? DEFAULT_AR_ENVIRONMENT_HDR_URL;
|
|
@@ -8427,9 +8428,21 @@ export const __webpack_modules__ = {
|
|
|
8427
8428
|
const normalizedApiKey = apiKey?.trim() || void 0;
|
|
8428
8429
|
const normalizedHid = hid?.trim() || void 0;
|
|
8429
8430
|
const normalizedTinuuid = tinuuid?.trim() ?? '';
|
|
8431
|
+
const handoffToken = initialWidgetSessionToken?.trim() || void 0;
|
|
8432
|
+
const widgetSessionRef = (0, external_react_.useRef)(null);
|
|
8433
|
+
const getHandoffSessionToken = (0, external_react_.useCallback)(async ()=>{
|
|
8434
|
+
const session = widgetSessionRef.current;
|
|
8435
|
+
if (!session) return handoffToken;
|
|
8436
|
+
return await session.getTokenForRequest().catch(()=>session.token);
|
|
8437
|
+
}, [
|
|
8438
|
+
handoffToken
|
|
8439
|
+
]);
|
|
8440
|
+
const getWidgetSessionToken = handoffToken ? getHandoffSessionToken : void 0;
|
|
8430
8441
|
const apiOptions = {
|
|
8431
8442
|
apiKey: normalizedApiKey,
|
|
8432
|
-
baseURL: tenant.apiOrigin
|
|
8443
|
+
baseURL: tenant.apiOrigin,
|
|
8444
|
+
brand: tenant.brand,
|
|
8445
|
+
getWidgetSessionToken
|
|
8433
8446
|
};
|
|
8434
8447
|
const canLoadObject = Boolean(normalizedTinuuid);
|
|
8435
8448
|
const objectQuery = (0, react_query_.useQuery)({
|
|
@@ -8460,7 +8473,8 @@ export const __webpack_modules__ = {
|
|
|
8460
8473
|
{
|
|
8461
8474
|
apiKey: normalizedApiKey ?? null,
|
|
8462
8475
|
handoffTokenDigest: (0, widget_session.a4)(initialWidgetSessionToken),
|
|
8463
|
-
baseURL: tenant.apiOrigin
|
|
8476
|
+
baseURL: tenant.apiOrigin,
|
|
8477
|
+
brand: tenant.brand
|
|
8464
8478
|
}
|
|
8465
8479
|
],
|
|
8466
8480
|
enabled: Boolean(normalizedApiKey),
|
|
@@ -8471,11 +8485,17 @@ export const __webpack_modules__ = {
|
|
|
8471
8485
|
return (0, widget_session.Uu)({
|
|
8472
8486
|
apiBaseUrl: tenant.apiOrigin,
|
|
8473
8487
|
apiKey: normalizedApiKey,
|
|
8488
|
+
brand: tenant.brand,
|
|
8474
8489
|
initialWidgetSessionToken,
|
|
8475
8490
|
signal
|
|
8476
8491
|
});
|
|
8477
8492
|
}
|
|
8478
8493
|
});
|
|
8494
|
+
(0, external_react_.useEffect)(()=>{
|
|
8495
|
+
widgetSessionRef.current = widgetSessionQuery.data ?? null;
|
|
8496
|
+
}, [
|
|
8497
|
+
widgetSessionQuery.data
|
|
8498
|
+
]);
|
|
8479
8499
|
const object = objectQuery.data ?? null;
|
|
8480
8500
|
const owner = object?.owner ?? null;
|
|
8481
8501
|
const ownerUuid = owner?.uuid;
|
|
@@ -8566,17 +8586,21 @@ export const __webpack_modules__ = {
|
|
|
8566
8586
|
return fetchArObject(catalogObjectTinuuid, {
|
|
8567
8587
|
apiKey: normalizedApiKey,
|
|
8568
8588
|
baseURL: tenant.apiOrigin,
|
|
8589
|
+
brand: tenant.brand,
|
|
8590
|
+
getWidgetSessionToken,
|
|
8569
8591
|
variantId
|
|
8570
8592
|
});
|
|
8571
8593
|
}, [
|
|
8594
|
+
getWidgetSessionToken,
|
|
8572
8595
|
normalizedApiKey,
|
|
8573
|
-
tenant.apiOrigin
|
|
8596
|
+
tenant.apiOrigin,
|
|
8597
|
+
tenant.brand
|
|
8574
8598
|
]);
|
|
8575
8599
|
let error = null;
|
|
8576
8600
|
if (normalizedTinuuid) {
|
|
8577
|
-
if (objectQuery.error) error =
|
|
8601
|
+
if (objectQuery.error) error = (0, errors.QG)(objectQuery.error, 'object');
|
|
8578
8602
|
else if (object && !ownerUuid) error = 'owner-missing';
|
|
8579
|
-
else if (catalogError) error =
|
|
8603
|
+
else if (catalogError) error = (0, errors.QG)(catalogError, 'catalog');
|
|
8580
8604
|
} else error = 'missing-tinuuid';
|
|
8581
8605
|
const isLoading = canLoadObject && objectQuery.isLoading;
|
|
8582
8606
|
const status = error ? 'error' : isLoading || !object ? 'loading' : 'ready';
|
|
@@ -8760,16 +8784,21 @@ export const __webpack_modules__ = {
|
|
|
8760
8784
|
refetchOnReconnect: false,
|
|
8761
8785
|
refetchOnWindowFocus: false,
|
|
8762
8786
|
retry: (failureCount, error)=>{
|
|
8763
|
-
const status =
|
|
8787
|
+
const status = (0, errors.Es)(error);
|
|
8764
8788
|
return 'number' == typeof status && status >= 400 && status < 500 ? false : failureCount < 2;
|
|
8765
8789
|
}
|
|
8766
8790
|
}
|
|
8767
8791
|
}
|
|
8768
8792
|
});
|
|
8769
|
-
function ArExperience({ apiKey, hid, initialWidgetSessionToken, language, onAnalyticsEvent, scaleEnabled = false, tinuuid }) {
|
|
8793
|
+
function ArExperience({ apiBaseUrl, apiKey, hid, initialWidgetSessionToken, language, onAnalyticsEvent, scaleEnabled = false, tinuuid }) {
|
|
8770
8794
|
const { i18n } = (0, external_react_i18next_.useTranslation)();
|
|
8771
8795
|
const detectedBrand = useArTenant();
|
|
8772
|
-
const
|
|
8796
|
+
const brandTenant = (0, src_config._K)(language ? (0, src_config.hs)(language) : detectedBrand);
|
|
8797
|
+
const hostApiOrigin = (0, src_config.BC)(apiBaseUrl);
|
|
8798
|
+
const tenant = hostApiOrigin ? {
|
|
8799
|
+
...brandTenant,
|
|
8800
|
+
apiOrigin: hostApiOrigin
|
|
8801
|
+
} : brandTenant;
|
|
8773
8802
|
(0, external_react_.useEffect)(()=>{
|
|
8774
8803
|
if (language && i18n.language !== language) i18n.changeLanguage(language);
|
|
8775
8804
|
}, [
|
|
@@ -8904,7 +8933,7 @@ export const __webpack_modules__ = {
|
|
|
8904
8933
|
initialResource
|
|
8905
8934
|
]);
|
|
8906
8935
|
if (data.error) return /*#__PURE__*/ (0, jsx_runtime_.jsx)(ArErrorState, {
|
|
8907
|
-
variant:
|
|
8936
|
+
variant: (0, errors.wT)(data.error),
|
|
8908
8937
|
showDialogCloseButton: true
|
|
8909
8938
|
});
|
|
8910
8939
|
if ('ready' === data.status && !initialResource) return /*#__PURE__*/ (0, jsx_runtime_.jsx)(ArErrorState, {
|
package/dist/index.d.ts
CHANGED
|
@@ -389,9 +389,15 @@ export declare interface ArDebugOverride {
|
|
|
389
389
|
forcesInPageSession: boolean;
|
|
390
390
|
}
|
|
391
391
|
|
|
392
|
-
export declare function ArDialog({ apiKey, hid, initialWidgetSessionToken, name, language, onAnalyticsEvent, open, defaultOpen, onOpenChange, scaleEnabled, tinuuid, ...props }: ArDialogProps): JSX.Element | null;
|
|
392
|
+
export declare function ArDialog({ apiBaseUrl, apiKey, hid, initialWidgetSessionToken, name, language, onAnalyticsEvent, open, defaultOpen, onOpenChange, scaleEnabled, tinuuid, ...props }: ArDialogProps): JSX.Element | null;
|
|
393
393
|
|
|
394
394
|
export declare interface ArDialogProps extends Omit<DialogProps, 'children' | 'modal'> {
|
|
395
|
+
/**
|
|
396
|
+
* The API to talk to instead of the one this build was made for. A host
|
|
397
|
+
* widget handing over its Widget Session passes the origin that issued it, so
|
|
398
|
+
* the token is refreshed where it is valid and a `dev` widget stays on dev.
|
|
399
|
+
*/
|
|
400
|
+
apiBaseUrl?: string | null;
|
|
395
401
|
/** Public API key used to load AR data. */
|
|
396
402
|
apiKey?: string | null;
|
|
397
403
|
/** Selected material variant identifier. */
|
|
@@ -554,9 +560,11 @@ export declare type ArWidgetEventName = 'appclip' | 'ar_launched' | 'heartbeat'
|
|
|
554
560
|
declare class ArWidgetSession {
|
|
555
561
|
private readonly apiBaseUrl;
|
|
556
562
|
private readonly apiKey;
|
|
563
|
+
private readonly brandHeaders;
|
|
557
564
|
private readonly issueWidgetToken;
|
|
558
565
|
private readonly now;
|
|
559
566
|
private readonly refreshThresholdMs;
|
|
567
|
+
private readonly refreshWithToken;
|
|
560
568
|
private refreshPromise;
|
|
561
569
|
private session;
|
|
562
570
|
/**
|
|
@@ -598,10 +606,16 @@ declare interface ArWidgetSessionApiConfig {
|
|
|
598
606
|
declare interface ArWidgetSessionOptions {
|
|
599
607
|
apiBaseUrl?: string;
|
|
600
608
|
apiKey: string;
|
|
609
|
+
brand?: ArBrand;
|
|
601
610
|
/** Set when the session was handed over instead of activated here. */
|
|
602
611
|
continued?: boolean;
|
|
603
612
|
issueWidgetToken?: IssueArWidgetToken;
|
|
604
613
|
now?: () => number;
|
|
614
|
+
/**
|
|
615
|
+
* Renew the session on its own token rather than the key: set once the key
|
|
616
|
+
* was refused from this page's origin, where it would be refused again.
|
|
617
|
+
*/
|
|
618
|
+
refreshWithToken?: boolean;
|
|
605
619
|
refreshThresholdMs?: number;
|
|
606
620
|
}
|
|
607
621
|
|
|
@@ -7504,6 +7518,20 @@ declare class Plane {
|
|
|
7504
7518
|
isIntersectionLine(l: any): any;
|
|
7505
7519
|
}
|
|
7506
7520
|
|
|
7521
|
+
/**
|
|
7522
|
+
* Gets the in-page session ready for a host about to hand it a tap, and says
|
|
7523
|
+
* whether it takes the tap.
|
|
7524
|
+
*
|
|
7525
|
+
* Resolves `false` where the dialog would not run the session in this page: a
|
|
7526
|
+
* device with another route (App Clip, viewer), an in-app browser without
|
|
7527
|
+
* WebXR — it gets nothing else, and Android's WebView never has it — or a frame
|
|
7528
|
+
* without the camera. The host then keeps its own launch. Otherwise the
|
|
7529
|
+
* session's code is fetched before this resolves `true`, so a host claims the
|
|
7530
|
+
* tap only once nothing is left to fail on the way to the intro. Rejects when
|
|
7531
|
+
* that fetch fails.
|
|
7532
|
+
*/
|
|
7533
|
+
export declare function prepareArSessionInPage(tinuuid?: string | null): Promise<boolean>;
|
|
7534
|
+
|
|
7507
7535
|
/**
|
|
7508
7536
|
* Starts everything an AR session needs that does not need the DOM yet, from
|
|
7509
7537
|
* the tap that opens the widget.
|
package/dist/index.js
CHANGED
|
@@ -10486,16 +10486,51 @@ var __webpack_modules__ = {
|
|
|
10486
10486
|
]);
|
|
10487
10487
|
const __rspack_default_export = ___CSS_LOADER_EXPORT___.toString();
|
|
10488
10488
|
},
|
|
10489
|
+
"./src/api/public-api/errors.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
10490
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
10491
|
+
Es: ()=>getErrorResponseStatus,
|
|
10492
|
+
QG: ()=>getArDataError,
|
|
10493
|
+
wT: ()=>getArErrorStateVariant
|
|
10494
|
+
});
|
|
10495
|
+
function getErrorResponseStatus(error) {
|
|
10496
|
+
if (!error || 'object' != typeof error || !('response' in error)) return;
|
|
10497
|
+
const response = error.response;
|
|
10498
|
+
if (!response || 'object' != typeof response || !('status' in response)) return;
|
|
10499
|
+
return 'number' == typeof response.status ? response.status : void 0;
|
|
10500
|
+
}
|
|
10501
|
+
function getArDataError(error, resource) {
|
|
10502
|
+
const status = getErrorResponseStatus(error);
|
|
10503
|
+
if (401 === status || 403 === status) return 'access-denied';
|
|
10504
|
+
if (404 === status && 'object' === resource) return 'object-not-published';
|
|
10505
|
+
return 'object' === resource ? 'object-load-failed' : 'catalog-load-failed';
|
|
10506
|
+
}
|
|
10507
|
+
function getArErrorStateVariant(error) {
|
|
10508
|
+
switch(error){
|
|
10509
|
+
case 'access-denied':
|
|
10510
|
+
return 'unauthorized';
|
|
10511
|
+
case 'missing-tinuuid':
|
|
10512
|
+
case 'object-not-published':
|
|
10513
|
+
return 'not-found';
|
|
10514
|
+
default:
|
|
10515
|
+
return 'unavailable';
|
|
10516
|
+
}
|
|
10517
|
+
}
|
|
10518
|
+
},
|
|
10489
10519
|
"./src/api/public-api/widget-session.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
10490
10520
|
__webpack_require__.d(__webpack_exports__, {
|
|
10491
10521
|
HR: ()=>sendArWidgetEventWithToken,
|
|
10492
10522
|
Kq: ()=>sendArWidgetEvent,
|
|
10493
10523
|
Uu: ()=>createArWidgetSession,
|
|
10494
|
-
a4: ()=>getHandoffTokenDigest
|
|
10524
|
+
a4: ()=>getHandoffTokenDigest,
|
|
10525
|
+
qw: ()=>WIDGET_SESSION_TOKEN_HEADER,
|
|
10526
|
+
s2: ()=>getBrandHeaders
|
|
10495
10527
|
});
|
|
10496
10528
|
var _vizbl_api__rspack_import_0 = __webpack_require__("../api/dist/gen/index.js");
|
|
10529
|
+
var _errors__rspack_import_1 = __webpack_require__("./src/api/public-api/errors.ts");
|
|
10497
10530
|
const WIDGET_SESSION_TOKEN_HEADER = 'x-widget-session-token';
|
|
10531
|
+
const APP_TYPE_HEADER = 'x-app-type';
|
|
10498
10532
|
const DEFAULT_REFRESH_THRESHOLD_MS = 30000;
|
|
10533
|
+
const ASSUMED_HANDOFF_SESSION_TTL_SECONDS = 900;
|
|
10499
10534
|
const ALLOWED_PRODUCT_TYPES = new Set([
|
|
10500
10535
|
'core-ar',
|
|
10501
10536
|
'core-ar-shopify'
|
|
@@ -10503,12 +10538,19 @@ var __webpack_modules__ = {
|
|
|
10503
10538
|
const WIDGET_EVENTS_PATH = '/public/widget/events';
|
|
10504
10539
|
const MAX_VARIANT_ID_LENGTH = 64;
|
|
10505
10540
|
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
10541
|
+
function getBrandHeaders(brand) {
|
|
10542
|
+
return brand ? {
|
|
10543
|
+
[APP_TYPE_HEADER]: brand
|
|
10544
|
+
} : {};
|
|
10545
|
+
}
|
|
10506
10546
|
class ArWidgetSession {
|
|
10507
10547
|
apiBaseUrl;
|
|
10508
10548
|
apiKey;
|
|
10549
|
+
brandHeaders;
|
|
10509
10550
|
issueWidgetToken;
|
|
10510
10551
|
now;
|
|
10511
10552
|
refreshThresholdMs;
|
|
10553
|
+
refreshWithToken;
|
|
10512
10554
|
refreshPromise = null;
|
|
10513
10555
|
session;
|
|
10514
10556
|
continued;
|
|
@@ -10516,9 +10558,11 @@ var __webpack_modules__ = {
|
|
|
10516
10558
|
this.continued = options.continued ?? false;
|
|
10517
10559
|
this.apiBaseUrl = options.apiBaseUrl;
|
|
10518
10560
|
this.apiKey = options.apiKey;
|
|
10561
|
+
this.brandHeaders = getBrandHeaders(options.brand);
|
|
10519
10562
|
this.issueWidgetToken = options.issueWidgetToken ?? _vizbl_api__rspack_import_0.MNX;
|
|
10520
10563
|
this.now = options.now ?? Date.now;
|
|
10521
10564
|
this.refreshThresholdMs = options.refreshThresholdMs ?? DEFAULT_REFRESH_THRESHOLD_MS;
|
|
10565
|
+
this.refreshWithToken = options.refreshWithToken ?? false;
|
|
10522
10566
|
this.session = this.toSnapshot(activationData);
|
|
10523
10567
|
}
|
|
10524
10568
|
get token() {
|
|
@@ -10540,6 +10584,7 @@ var __webpack_modules__ = {
|
|
|
10540
10584
|
return {
|
|
10541
10585
|
baseURL: this.apiBaseUrl,
|
|
10542
10586
|
headers: {
|
|
10587
|
+
...this.brandHeaders,
|
|
10543
10588
|
[WIDGET_SESSION_TOKEN_HEADER]: await this.getTokenForRequest()
|
|
10544
10589
|
},
|
|
10545
10590
|
signal
|
|
@@ -10553,7 +10598,12 @@ var __webpack_modules__ = {
|
|
|
10553
10598
|
}, {
|
|
10554
10599
|
baseURL: this.apiBaseUrl,
|
|
10555
10600
|
headers: {
|
|
10556
|
-
|
|
10601
|
+
...this.brandHeaders,
|
|
10602
|
+
...this.refreshWithToken ? {
|
|
10603
|
+
[WIDGET_SESSION_TOKEN_HEADER]: this.session.token
|
|
10604
|
+
} : {
|
|
10605
|
+
'x-api-key': this.apiKey
|
|
10606
|
+
}
|
|
10557
10607
|
}
|
|
10558
10608
|
}).then((data)=>this.toSnapshot(parseWidgetSession(data))).then((session)=>{
|
|
10559
10609
|
this.session = session;
|
|
@@ -10577,10 +10627,11 @@ var __webpack_modules__ = {
|
|
|
10577
10627
|
for(let index = 0; index < normalized.length; index++)hash = Math.imul(hash, 31) + normalized.charCodeAt(index) | 0;
|
|
10578
10628
|
return (hash >>> 0).toString(36);
|
|
10579
10629
|
}
|
|
10580
|
-
async function createArWidgetSession({ apiBaseUrl, apiKey, initialWidgetSessionToken, signal }) {
|
|
10630
|
+
async function createArWidgetSession({ apiBaseUrl, apiKey, brand, initialWidgetSessionToken, signal }) {
|
|
10581
10631
|
const requestConfig = {
|
|
10582
10632
|
baseURL: apiBaseUrl,
|
|
10583
10633
|
headers: {
|
|
10634
|
+
...getBrandHeaders(brand),
|
|
10584
10635
|
'x-api-key': apiKey
|
|
10585
10636
|
},
|
|
10586
10637
|
signal
|
|
@@ -10594,36 +10645,87 @@ var __webpack_modules__ = {
|
|
|
10594
10645
|
return new ArWidgetSession(parseWidgetSession(refreshed), {
|
|
10595
10646
|
apiBaseUrl,
|
|
10596
10647
|
apiKey,
|
|
10648
|
+
brand,
|
|
10597
10649
|
continued: true
|
|
10598
10650
|
});
|
|
10599
10651
|
} catch (error) {
|
|
10600
10652
|
if (signal?.aborted) throw error;
|
|
10601
10653
|
}
|
|
10602
|
-
|
|
10603
|
-
|
|
10604
|
-
|
|
10654
|
+
let activation;
|
|
10655
|
+
try {
|
|
10656
|
+
activation = await (0, _vizbl_api__rspack_import_0.tOZ)({
|
|
10657
|
+
mode: 'ar-viewer'
|
|
10658
|
+
}, requestConfig);
|
|
10659
|
+
} catch (error) {
|
|
10660
|
+
const status = (0, _errors__rspack_import_1.Es)(error);
|
|
10661
|
+
if (!normalizedInitialToken || 401 !== status && 403 !== status || signal?.aborted) throw error;
|
|
10662
|
+
return await continueHandedOverSession(normalizedInitialToken, {
|
|
10663
|
+
apiBaseUrl,
|
|
10664
|
+
apiKey,
|
|
10665
|
+
brand,
|
|
10666
|
+
signal
|
|
10667
|
+
});
|
|
10668
|
+
}
|
|
10605
10669
|
if ('string' != typeof activation.productType || !ALLOWED_PRODUCT_TYPES.has(activation.productType)) throw new TypeError('The API key is not enabled for Core AR');
|
|
10606
10670
|
return new ArWidgetSession(parseWidgetSession(activation.widgetSession), {
|
|
10607
10671
|
apiBaseUrl,
|
|
10608
|
-
apiKey
|
|
10672
|
+
apiKey,
|
|
10673
|
+
brand
|
|
10609
10674
|
});
|
|
10610
10675
|
}
|
|
10676
|
+
async function continueHandedOverSession(token, { apiBaseUrl, apiKey, brand, signal }) {
|
|
10677
|
+
const sessionOptions = {
|
|
10678
|
+
apiBaseUrl,
|
|
10679
|
+
apiKey,
|
|
10680
|
+
brand,
|
|
10681
|
+
continued: true,
|
|
10682
|
+
refreshWithToken: true
|
|
10683
|
+
};
|
|
10684
|
+
try {
|
|
10685
|
+
const exchanged = await (0, _vizbl_api__rspack_import_0.MNX)({
|
|
10686
|
+
mode: 'ar-viewer',
|
|
10687
|
+
token
|
|
10688
|
+
}, {
|
|
10689
|
+
baseURL: apiBaseUrl,
|
|
10690
|
+
headers: {
|
|
10691
|
+
...getBrandHeaders(brand),
|
|
10692
|
+
[WIDGET_SESSION_TOKEN_HEADER]: token
|
|
10693
|
+
},
|
|
10694
|
+
signal
|
|
10695
|
+
});
|
|
10696
|
+
return new ArWidgetSession(parseWidgetSession(exchanged), sessionOptions);
|
|
10697
|
+
} catch (error) {
|
|
10698
|
+
if (signal?.aborted) throw error;
|
|
10699
|
+
}
|
|
10700
|
+
return new ArWidgetSession({
|
|
10701
|
+
expiresIn: ASSUMED_HANDOFF_SESSION_TTL_SECONDS,
|
|
10702
|
+
sid: token,
|
|
10703
|
+
token
|
|
10704
|
+
}, sessionOptions);
|
|
10705
|
+
}
|
|
10611
10706
|
async function sendArWidgetEvent(session, event, options = {}) {
|
|
10612
10707
|
if (!session) return;
|
|
10613
10708
|
try {
|
|
10614
10709
|
const config = await session.getRequestConfig();
|
|
10615
|
-
await postArWidgetEvent(
|
|
10710
|
+
await postArWidgetEvent(event, {
|
|
10616
10711
|
...options,
|
|
10617
|
-
apiBaseUrl: config.baseURL
|
|
10712
|
+
apiBaseUrl: config.baseURL,
|
|
10713
|
+
headers: config.headers
|
|
10618
10714
|
});
|
|
10619
10715
|
} catch {}
|
|
10620
10716
|
}
|
|
10621
|
-
function sendArWidgetEventWithToken(event, { widgetSessionToken, ...options }) {
|
|
10717
|
+
function sendArWidgetEventWithToken(event, { brand, widgetSessionToken, ...options }) {
|
|
10622
10718
|
const token = widgetSessionToken?.trim();
|
|
10623
10719
|
if (!token) return;
|
|
10624
|
-
postArWidgetEvent(
|
|
10720
|
+
postArWidgetEvent(event, {
|
|
10721
|
+
...options,
|
|
10722
|
+
headers: {
|
|
10723
|
+
...getBrandHeaders(brand),
|
|
10724
|
+
[WIDGET_SESSION_TOKEN_HEADER]: token
|
|
10725
|
+
}
|
|
10726
|
+
}).catch(()=>{});
|
|
10625
10727
|
}
|
|
10626
|
-
async function postArWidgetEvent(
|
|
10728
|
+
async function postArWidgetEvent(event, { apiBaseUrl, headers, objectId, variantId }) {
|
|
10627
10729
|
const url = new URL(WIDGET_EVENTS_PATH, apiBaseUrl || window.location.origin);
|
|
10628
10730
|
const response = await fetch(url, {
|
|
10629
10731
|
body: JSON.stringify({
|
|
@@ -10634,7 +10736,7 @@ var __webpack_modules__ = {
|
|
|
10634
10736
|
}),
|
|
10635
10737
|
headers: {
|
|
10636
10738
|
'Content-Type': 'application/json',
|
|
10637
|
-
|
|
10739
|
+
...headers
|
|
10638
10740
|
},
|
|
10639
10741
|
keepalive: true,
|
|
10640
10742
|
method: 'POST'
|
|
@@ -10671,7 +10773,8 @@ var __webpack_modules__ = {
|
|
|
10671
10773
|
"./src/ar/session-prewarm.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
10672
10774
|
__webpack_require__.d(__webpack_exports__, {
|
|
10673
10775
|
YP: ()=>prewarmArSession,
|
|
10674
|
-
oP: ()=>requestArMotionPermission
|
|
10776
|
+
oP: ()=>requestArMotionPermission,
|
|
10777
|
+
Zi: ()=>prepareArSessionInPage
|
|
10675
10778
|
});
|
|
10676
10779
|
var platform = __webpack_require__("./src/lib/platform.ts");
|
|
10677
10780
|
var backend_policy = __webpack_require__("./src/ar/tracker/backend-policy.ts");
|
|
@@ -10689,13 +10792,23 @@ var __webpack_modules__ = {
|
|
|
10689
10792
|
prewarmed = true;
|
|
10690
10793
|
Promise.all([
|
|
10691
10794
|
__webpack_require__.e("191"),
|
|
10692
|
-
__webpack_require__.e("
|
|
10795
|
+
__webpack_require__.e("647")
|
|
10693
10796
|
]).then(__webpack_require__.bind(__webpack_require__, "./src/root.tsx")).catch(()=>void 0);
|
|
10694
10797
|
willRunEighthWall(backend ?? null).then((eighthWall)=>{
|
|
10695
10798
|
if (!eighthWall) return;
|
|
10696
10799
|
return Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "./src/ar/tracker/eighth-wall-surface-tracker.ts")).then(({ loadEighthWallEngine })=>loadEighthWallEngine());
|
|
10697
10800
|
}).catch(()=>void 0);
|
|
10698
10801
|
}
|
|
10802
|
+
async function prepareArSessionInPage(tinuuid) {
|
|
10803
|
+
if ('ar' !== (0, platform.wz)((0, platform.U_)(), tinuuid, (0, platform.nc)())) return false;
|
|
10804
|
+
if (!(0, platform.$N)()) return false;
|
|
10805
|
+
if ((0, platform.N0)() && !await (0, backend_policy.f)()) return false;
|
|
10806
|
+
await Promise.all([
|
|
10807
|
+
__webpack_require__.e("191"),
|
|
10808
|
+
__webpack_require__.e("647")
|
|
10809
|
+
]).then(__webpack_require__.bind(__webpack_require__, "./src/root.tsx"));
|
|
10810
|
+
return true;
|
|
10811
|
+
}
|
|
10699
10812
|
async function willRunEighthWall(backend) {
|
|
10700
10813
|
if (backend) return '8thwall' === backend;
|
|
10701
10814
|
if ((0, platform.N0)()) return false;
|
|
@@ -11536,6 +11649,7 @@ var __webpack_modules__ = {
|
|
|
11536
11649
|
},
|
|
11537
11650
|
"./src/config.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
11538
11651
|
__webpack_require__.d(__webpack_exports__, {
|
|
11652
|
+
BC: ()=>resolveHostApiOrigin,
|
|
11539
11653
|
_K: ()=>createArTenantConfig,
|
|
11540
11654
|
hs: ()=>resolveArBrand
|
|
11541
11655
|
});
|
|
@@ -11579,6 +11693,15 @@ var __webpack_modules__ = {
|
|
|
11579
11693
|
if ('arizo' === brand) return isDev ? 'go-dev.arizo.ru' : 'go.arizo.ru';
|
|
11580
11694
|
return isDev ? 'go-dev.vizbl.com' : 'go.vizbl.com';
|
|
11581
11695
|
}
|
|
11696
|
+
function resolveHostApiOrigin(value) {
|
|
11697
|
+
const trimmed = value?.trim();
|
|
11698
|
+
if (!trimmed) return;
|
|
11699
|
+
try {
|
|
11700
|
+
return new URL(trimmed).origin;
|
|
11701
|
+
} catch {
|
|
11702
|
+
return;
|
|
11703
|
+
}
|
|
11704
|
+
}
|
|
11582
11705
|
function resolveArBrand(language) {
|
|
11583
11706
|
return 'ru' === language ? 'arizo' : 'vizbl';
|
|
11584
11707
|
}
|
|
@@ -12018,6 +12141,7 @@ var __webpack_modules__ = {
|
|
|
12018
12141
|
},
|
|
12019
12142
|
"./src/lib/platform.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
12020
12143
|
__webpack_require__.d(__webpack_exports__, {
|
|
12144
|
+
$N: ()=>mayUseArCamera,
|
|
12021
12145
|
N0: ()=>isArWebView,
|
|
12022
12146
|
Tw: ()=>getIosMajorVersion,
|
|
12023
12147
|
U_: ()=>detectArPlatform,
|
|
@@ -12044,6 +12168,13 @@ var __webpack_modules__ = {
|
|
|
12044
12168
|
if (!navigatorInfo) return false;
|
|
12045
12169
|
return /; wv\)|\bFBAN\b|\bFBAV\b|\bInstagram\b|\bLine\/|\bMicroMessenger\b/i.test(navigatorInfo.userAgent);
|
|
12046
12170
|
}
|
|
12171
|
+
function mayUseArCamera() {
|
|
12172
|
+
if ("u" < typeof window) return false;
|
|
12173
|
+
if (window.self === window.top) return true;
|
|
12174
|
+
const policyDocument = document;
|
|
12175
|
+
const policy = policyDocument.permissionsPolicy ?? policyDocument.featurePolicy;
|
|
12176
|
+
return policy?.allowsFeature('camera') ?? false;
|
|
12177
|
+
}
|
|
12047
12178
|
const MIN_APP_CLIP_IOS_MAJOR = 17;
|
|
12048
12179
|
function getIosMajorVersion(navigatorInfo = getNavigatorInfo()) {
|
|
12049
12180
|
const match = /\bOS (\d+)[._]/.exec(navigatorInfo?.userAgent ?? '');
|
|
@@ -18627,8 +18758,8 @@ __webpack_require__.m = __webpack_modules__;
|
|
|
18627
18758
|
})();
|
|
18628
18759
|
(()=>{
|
|
18629
18760
|
__webpack_require__.u = (chunkId)=>"" + chunkId + "." + ({
|
|
18630
|
-
191: "
|
|
18631
|
-
|
|
18761
|
+
191: "0238d726a82ead14",
|
|
18762
|
+
647: "6c7f9f8f87550212"
|
|
18632
18763
|
})[chunkId] + ".js";
|
|
18633
18764
|
})();
|
|
18634
18765
|
(()=>{
|
|
@@ -19121,8 +19252,10 @@ function resolvePageLanguage() {
|
|
|
19121
19252
|
return document.documentElement.lang || navigator.language || void 0;
|
|
19122
19253
|
}
|
|
19123
19254
|
function sendAppClipWidgetEvent({ hid, language, widgetSessionToken }) {
|
|
19255
|
+
const brand = resolveAppClipBrand(language);
|
|
19124
19256
|
(0, widget_session.HR)('appclip', {
|
|
19125
|
-
apiBaseUrl: (0, config._K)(
|
|
19257
|
+
apiBaseUrl: (0, config._K)(brand).apiOrigin,
|
|
19258
|
+
brand,
|
|
19126
19259
|
variantId: hid,
|
|
19127
19260
|
widgetSessionToken
|
|
19128
19261
|
});
|
|
@@ -19176,15 +19309,49 @@ ${propertyDefaults}
|
|
|
19176
19309
|
}
|
|
19177
19310
|
var styleinline = __webpack_require__("./src/style.css?inline");
|
|
19178
19311
|
const shadowRootCssText = createShadowRootCssText(styleinline.A);
|
|
19179
|
-
const
|
|
19312
|
+
const arExperience = retryableLazy(async ()=>({
|
|
19180
19313
|
default: (await Promise.all([
|
|
19181
19314
|
__webpack_require__.e("191"),
|
|
19182
|
-
__webpack_require__.e("
|
|
19315
|
+
__webpack_require__.e("647")
|
|
19183
19316
|
]).then(__webpack_require__.bind(__webpack_require__, "./src/root.tsx"))).ArExperience
|
|
19184
19317
|
}));
|
|
19185
|
-
const
|
|
19318
|
+
const modelViewerDialog = retryableLazy(async ()=>({
|
|
19186
19319
|
default: (await import("@neurodyn/react-model-viewer")).ModelViewerDialog
|
|
19187
19320
|
}));
|
|
19321
|
+
function retryableLazy(load) {
|
|
19322
|
+
let component = /*#__PURE__*/ (0, external_react_.lazy)(load);
|
|
19323
|
+
return {
|
|
19324
|
+
get Component () {
|
|
19325
|
+
return component;
|
|
19326
|
+
},
|
|
19327
|
+
reset () {
|
|
19328
|
+
component = /*#__PURE__*/ (0, external_react_.lazy)(load);
|
|
19329
|
+
}
|
|
19330
|
+
};
|
|
19331
|
+
}
|
|
19332
|
+
class ExperienceBoundary extends external_react_.Component {
|
|
19333
|
+
state = {
|
|
19334
|
+
failed: false,
|
|
19335
|
+
resetKey: this.props.resetKey
|
|
19336
|
+
};
|
|
19337
|
+
static getDerivedStateFromProps(props, state) {
|
|
19338
|
+
return props.resetKey === state.resetKey ? null : {
|
|
19339
|
+
failed: false,
|
|
19340
|
+
resetKey: props.resetKey
|
|
19341
|
+
};
|
|
19342
|
+
}
|
|
19343
|
+
static getDerivedStateFromError() {
|
|
19344
|
+
return {
|
|
19345
|
+
failed: true
|
|
19346
|
+
};
|
|
19347
|
+
}
|
|
19348
|
+
componentDidCatch() {
|
|
19349
|
+
this.props.onError();
|
|
19350
|
+
}
|
|
19351
|
+
render() {
|
|
19352
|
+
return this.state.failed ? null : this.props.children;
|
|
19353
|
+
}
|
|
19354
|
+
}
|
|
19188
19355
|
const fullscreenDialogContentClassName = 'inset-0 h-dvh min-w-full max-w-none translate-x-0 translate-y-0 rounded-none border-none bg-transparent p-0 shadow-none sm:p-0 sm:max-w-none';
|
|
19189
19356
|
const visuallyHiddenStyle = {
|
|
19190
19357
|
border: 0,
|
|
@@ -19204,7 +19371,7 @@ function LightDomDialogTitle({ title }) {
|
|
|
19204
19371
|
children: title
|
|
19205
19372
|
}), document.body);
|
|
19206
19373
|
}
|
|
19207
|
-
function ArDialog({ apiKey, hid, initialWidgetSessionToken, name, language, onAnalyticsEvent, open, defaultOpen, onOpenChange, scaleEnabled, tinuuid, ...props }) {
|
|
19374
|
+
function ArDialog({ apiBaseUrl, apiKey, hid, initialWidgetSessionToken, name, language, onAnalyticsEvent, open, defaultOpen, onOpenChange, scaleEnabled, tinuuid, ...props }) {
|
|
19208
19375
|
const [themeRoot, setThemeRoot] = (0, external_react_.useState)(null);
|
|
19209
19376
|
const platform = (0, lib_platform.U_)();
|
|
19210
19377
|
const normalizedTinuuid = tinuuid?.trim() || null;
|
|
@@ -19233,6 +19400,18 @@ function ArDialog({ apiKey, hid, initialWidgetSessionToken, name, language, onAn
|
|
|
19233
19400
|
}, [
|
|
19234
19401
|
onOpenChange
|
|
19235
19402
|
]);
|
|
19403
|
+
const handleExperienceError = (0, external_react_.useCallback)(()=>{
|
|
19404
|
+
arExperience.reset();
|
|
19405
|
+
handleOpenChange(false);
|
|
19406
|
+
}, [
|
|
19407
|
+
handleOpenChange
|
|
19408
|
+
]);
|
|
19409
|
+
const handleViewerError = (0, external_react_.useCallback)(()=>{
|
|
19410
|
+
modelViewerDialog.reset();
|
|
19411
|
+
handleOpenChange(false);
|
|
19412
|
+
}, [
|
|
19413
|
+
handleOpenChange
|
|
19414
|
+
]);
|
|
19236
19415
|
(0, external_react_.useLayoutEffect)(()=>{
|
|
19237
19416
|
if (effectiveOpen && 'ar' === route) (0, session_prewarm.YP)({
|
|
19238
19417
|
backend: debugOverride.backend
|
|
@@ -19295,21 +19474,28 @@ function ArDialog({ apiKey, hid, initialWidgetSessionToken, name, language, onAn
|
|
|
19295
19474
|
if ('app-clip' === route) return null;
|
|
19296
19475
|
if ('model-viewer' === route && normalizedTinuuid) {
|
|
19297
19476
|
const tenant = (0, config._K)((0, config.hs)(language ?? arI18n.resolvedLanguage ?? arI18n.language));
|
|
19298
|
-
|
|
19299
|
-
|
|
19300
|
-
|
|
19301
|
-
|
|
19302
|
-
|
|
19303
|
-
|
|
19304
|
-
|
|
19305
|
-
|
|
19306
|
-
|
|
19307
|
-
|
|
19308
|
-
|
|
19309
|
-
|
|
19477
|
+
const ModelViewerDialog = modelViewerDialog.Component;
|
|
19478
|
+
return /*#__PURE__*/ (0, jsx_runtime_.jsx)(ExperienceBoundary, {
|
|
19479
|
+
onError: handleViewerError,
|
|
19480
|
+
resetKey: effectiveOpen,
|
|
19481
|
+
children: /*#__PURE__*/ (0, jsx_runtime_.jsx)(external_react_.Suspense, {
|
|
19482
|
+
fallback: null,
|
|
19483
|
+
children: /*#__PURE__*/ (0, jsx_runtime_.jsx)(ModelViewerDialog, {
|
|
19484
|
+
...props,
|
|
19485
|
+
apiBaseUrl: (0, config.BC)(apiBaseUrl) ?? tenant.apiOrigin,
|
|
19486
|
+
apiKey: apiKey,
|
|
19487
|
+
defaultOpen: defaultOpen,
|
|
19488
|
+
hid: hid,
|
|
19489
|
+
initialWidgetSessionToken: initialWidgetSessionToken ?? void 0,
|
|
19490
|
+
lang: 'arizo' === tenant.brand ? 'ru' : 'en',
|
|
19491
|
+
onOpenChange: handleOpenChange,
|
|
19492
|
+
open: open,
|
|
19493
|
+
tinuuid: normalizedTinuuid
|
|
19494
|
+
})
|
|
19310
19495
|
})
|
|
19311
19496
|
});
|
|
19312
19497
|
}
|
|
19498
|
+
const ArExperience = arExperience.Component;
|
|
19313
19499
|
return /*#__PURE__*/ (0, jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
|
|
19314
19500
|
children: [
|
|
19315
19501
|
/*#__PURE__*/ (0, external_react_dom_.createPortal)(/*#__PURE__*/ (0, jsx_runtime_.jsx)("style", {
|
|
@@ -19360,16 +19546,21 @@ function ArDialog({ apiKey, hid, initialWidgetSessionToken, name, language, onAn
|
|
|
19360
19546
|
onInteractOutside: (e)=>{
|
|
19361
19547
|
e.preventDefault();
|
|
19362
19548
|
},
|
|
19363
|
-
children: /*#__PURE__*/ (0, jsx_runtime_.jsx)(
|
|
19364
|
-
|
|
19365
|
-
|
|
19366
|
-
|
|
19367
|
-
|
|
19368
|
-
|
|
19369
|
-
|
|
19370
|
-
|
|
19371
|
-
|
|
19372
|
-
|
|
19549
|
+
children: /*#__PURE__*/ (0, jsx_runtime_.jsx)(ExperienceBoundary, {
|
|
19550
|
+
onError: handleExperienceError,
|
|
19551
|
+
resetKey: effectiveOpen,
|
|
19552
|
+
children: /*#__PURE__*/ (0, jsx_runtime_.jsx)(external_react_.Suspense, {
|
|
19553
|
+
fallback: null,
|
|
19554
|
+
children: /*#__PURE__*/ (0, jsx_runtime_.jsx)(ArExperience, {
|
|
19555
|
+
apiBaseUrl: apiBaseUrl,
|
|
19556
|
+
apiKey: apiKey,
|
|
19557
|
+
hid: hid,
|
|
19558
|
+
initialWidgetSessionToken: initialWidgetSessionToken,
|
|
19559
|
+
language: language,
|
|
19560
|
+
onAnalyticsEvent: onAnalyticsEvent,
|
|
19561
|
+
scaleEnabled: scaleEnabled,
|
|
19562
|
+
tinuuid: tinuuid
|
|
19563
|
+
})
|
|
19373
19564
|
})
|
|
19374
19565
|
})
|
|
19375
19566
|
})
|
|
@@ -19396,10 +19587,11 @@ var __webpack_exports__detectSupportedArBackends = tracker_backend.Sf;
|
|
|
19396
19587
|
var __webpack_exports__emitArAnalyticsEvent = analytics.lA;
|
|
19397
19588
|
var __webpack_exports__getIosMajorVersion = lib_platform.Tw;
|
|
19398
19589
|
var __webpack_exports__loadEighthWallEngine = eighth_wall_surface_tracker.loadEighthWallEngine;
|
|
19590
|
+
var __webpack_exports__prepareArSessionInPage = session_prewarm.Zi;
|
|
19399
19591
|
var __webpack_exports__prewarmArSession = session_prewarm.YP;
|
|
19400
19592
|
var __webpack_exports__readArDebugOverride = debug_flags.Bo;
|
|
19401
19593
|
var __webpack_exports__resolveArPlatformRoute = lib_platform.wz;
|
|
19402
19594
|
var __webpack_exports__resolveEighthWallReticleHit = eighth_wall_hit.hj;
|
|
19403
19595
|
var __webpack_exports__supportsArAppClip = lib_platform.nc;
|
|
19404
19596
|
var __webpack_exports__supportsImmersiveAr = backend_policy.f;
|
|
19405
|
-
export { ArDialog, buildAppClipUrl, openAppClip, performArAppClipHandoff, resolveAppClipRegion, sendAppClipWidgetEvent, __webpack_exports__AR_TRACKING_BACKENDS as AR_TRACKING_BACKENDS, __webpack_exports__AutoSurfaceTracker as AutoSurfaceTracker, __webpack_exports__EIGHTH_WALL_ENGINE_URL as EIGHTH_WALL_ENGINE_URL, __webpack_exports__EighthWallSurfaceTracker as EighthWallSurfaceTracker, __webpack_exports__MIN_WALL_HEIGHT as MIN_WALL_HEIGHT, __webpack_exports__WebXrSurfaceTracker as WebXrSurfaceTracker, __webpack_exports__classifySurfaceByNormal as classifySurfaceByNormal, __webpack_exports__createArTracker as createArTracker, __webpack_exports__createArTrackerRegistry as createArTrackerRegistry, __webpack_exports__detectArPlatform as detectArPlatform, __webpack_exports__detectSupportedArBackends as detectSupportedArBackends, __webpack_exports__emitArAnalyticsEvent as emitArAnalyticsEvent, __webpack_exports__getIosMajorVersion as getIosMajorVersion, __webpack_exports__loadEighthWallEngine as loadEighthWallEngine, __webpack_exports__prewarmArSession as prewarmArSession, __webpack_exports__readArDebugOverride as readArDebugOverride, __webpack_exports__resolveArPlatformRoute as resolveArPlatformRoute, __webpack_exports__resolveEighthWallReticleHit as resolveEighthWallReticleHit, __webpack_exports__supportsArAppClip as supportsArAppClip, __webpack_exports__supportsImmersiveAr as supportsImmersiveAr };
|
|
19597
|
+
export { ArDialog, buildAppClipUrl, openAppClip, performArAppClipHandoff, resolveAppClipRegion, sendAppClipWidgetEvent, __webpack_exports__AR_TRACKING_BACKENDS as AR_TRACKING_BACKENDS, __webpack_exports__AutoSurfaceTracker as AutoSurfaceTracker, __webpack_exports__EIGHTH_WALL_ENGINE_URL as EIGHTH_WALL_ENGINE_URL, __webpack_exports__EighthWallSurfaceTracker as EighthWallSurfaceTracker, __webpack_exports__MIN_WALL_HEIGHT as MIN_WALL_HEIGHT, __webpack_exports__WebXrSurfaceTracker as WebXrSurfaceTracker, __webpack_exports__classifySurfaceByNormal as classifySurfaceByNormal, __webpack_exports__createArTracker as createArTracker, __webpack_exports__createArTrackerRegistry as createArTrackerRegistry, __webpack_exports__detectArPlatform as detectArPlatform, __webpack_exports__detectSupportedArBackends as detectSupportedArBackends, __webpack_exports__emitArAnalyticsEvent as emitArAnalyticsEvent, __webpack_exports__getIosMajorVersion as getIosMajorVersion, __webpack_exports__loadEighthWallEngine as loadEighthWallEngine, __webpack_exports__prepareArSessionInPage as prepareArSessionInPage, __webpack_exports__prewarmArSession as prewarmArSession, __webpack_exports__readArDebugOverride as readArDebugOverride, __webpack_exports__resolveArPlatformRoute as resolveArPlatformRoute, __webpack_exports__resolveEighthWallReticleHit as resolveEighthWallReticleHit, __webpack_exports__supportsArAppClip as supportsArAppClip, __webpack_exports__supportsImmersiveAr as supportsImmersiveAr };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neurodyn/react-ar",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"//sideEffects": "Lets a consumer that only wants the platform helpers off the barrel drop the scene and three.js instead of shipping them. The exceptions are the two modules that really do run on import: stylesheets, and the i18n instance that configures itself.",
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"*.css",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"react-shadow": "^20.6.0",
|
|
40
40
|
"three": "^0.185.1",
|
|
41
41
|
"ua-parser-js": "^2.0.9",
|
|
42
|
-
"@neurodyn/react-model-viewer": "0.
|
|
42
|
+
"@neurodyn/react-model-viewer": "0.2.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@microsoft/api-extractor": "^7.58.0",
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license React
|
|
3
|
-
* use-sync-external-store-shim.development.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @license React
|
|
13
|
-
* use-sync-external-store-shim.production.js
|
|
14
|
-
*
|
|
15
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
16
|
-
*
|
|
17
|
-
* This source code is licensed under the MIT license found in the
|
|
18
|
-
* LICENSE file in the root directory of this source tree.
|
|
19
|
-
*/
|