@neurodyn/react-model-viewer 0.0.1 → 0.0.3
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 +49 -5
- package/dist/index.js +780 -106
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, memo, use as external_react_use, useCallback, useEffect, useMemo as external_react_useMemo, useState } from "react";
|
|
2
|
+
import { createContext, memo, use as external_react_use, useCallback, useEffect, useMemo as external_react_useMemo, useRef, useState } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
4
|
import react_shadow from "react-shadow";
|
|
5
5
|
import { QueryClient, QueryClientProvider, useQuery as react_query_useQuery } from "@tanstack/react-query";
|
|
@@ -113,6 +113,7 @@ var __webpack_modules__ = {
|
|
|
113
113
|
--color-white: #fff;
|
|
114
114
|
--spacing: 4px;
|
|
115
115
|
--container-xs: 320px;
|
|
116
|
+
--container-lg: 512px;
|
|
116
117
|
--text-xs: 12px;
|
|
117
118
|
--text-sm: 14px;
|
|
118
119
|
--text-base: 16px;
|
|
@@ -648,6 +649,10 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
648
649
|
margin-top: calc(var(--spacing) * 1.5);
|
|
649
650
|
}
|
|
650
651
|
|
|
652
|
+
.mt-4 {
|
|
653
|
+
margin-top: calc(var(--spacing) * 4);
|
|
654
|
+
}
|
|
655
|
+
|
|
651
656
|
.mt-6 {
|
|
652
657
|
margin-top: calc(var(--spacing) * 6);
|
|
653
658
|
}
|
|
@@ -711,6 +716,22 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
711
716
|
display: inline-flex;
|
|
712
717
|
}
|
|
713
718
|
|
|
719
|
+
.table {
|
|
720
|
+
display: table;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
.table-caption {
|
|
724
|
+
display: table-caption;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
.table-cell {
|
|
728
|
+
display: table-cell;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
.table-row {
|
|
732
|
+
display: table-row;
|
|
733
|
+
}
|
|
734
|
+
|
|
714
735
|
.field-sizing-content {
|
|
715
736
|
field-sizing: content;
|
|
716
737
|
}
|
|
@@ -898,6 +919,10 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
898
919
|
height: auto;
|
|
899
920
|
}
|
|
900
921
|
|
|
922
|
+
.h-dvh {
|
|
923
|
+
height: 100dvh;
|
|
924
|
+
}
|
|
925
|
+
|
|
901
926
|
.h-full {
|
|
902
927
|
height: 100%;
|
|
903
928
|
}
|
|
@@ -906,10 +931,6 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
906
931
|
height: 1px;
|
|
907
932
|
}
|
|
908
933
|
|
|
909
|
-
.h-svh {
|
|
910
|
-
height: 100svh;
|
|
911
|
-
}
|
|
912
|
-
|
|
913
934
|
.max-h-\\(--radix-select-content-available-height\\) {
|
|
914
935
|
max-height: var(--radix-select-content-available-height);
|
|
915
936
|
}
|
|
@@ -926,6 +947,10 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
926
947
|
min-height: 1px;
|
|
927
948
|
}
|
|
928
949
|
|
|
950
|
+
.w-0\\.5 {
|
|
951
|
+
width: calc(var(--spacing) * .5);
|
|
952
|
+
}
|
|
953
|
+
|
|
929
954
|
.w-2 {
|
|
930
955
|
width: calc(var(--spacing) * 2);
|
|
931
956
|
}
|
|
@@ -938,6 +963,10 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
938
963
|
width: calc(var(--spacing) * 9);
|
|
939
964
|
}
|
|
940
965
|
|
|
966
|
+
.w-10 {
|
|
967
|
+
width: calc(var(--spacing) * 10);
|
|
968
|
+
}
|
|
969
|
+
|
|
941
970
|
.w-11 {
|
|
942
971
|
width: calc(var(--spacing) * 11);
|
|
943
972
|
}
|
|
@@ -1062,6 +1091,10 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
1062
1091
|
flex-basis: 100%;
|
|
1063
1092
|
}
|
|
1064
1093
|
|
|
1094
|
+
.caption-bottom {
|
|
1095
|
+
caption-side: bottom;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1065
1098
|
.origin-\\(--radix-dropdown-menu-content-transform-origin\\) {
|
|
1066
1099
|
transform-origin: var(--radix-dropdown-menu-content-transform-origin);
|
|
1067
1100
|
}
|
|
@@ -1136,6 +1169,10 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
1136
1169
|
cursor: default;
|
|
1137
1170
|
}
|
|
1138
1171
|
|
|
1172
|
+
.cursor-grab {
|
|
1173
|
+
cursor: grab;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1139
1176
|
.cursor-pointer {
|
|
1140
1177
|
cursor: pointer;
|
|
1141
1178
|
}
|
|
@@ -1184,6 +1221,10 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
1184
1221
|
flex-direction: column;
|
|
1185
1222
|
}
|
|
1186
1223
|
|
|
1224
|
+
.flex-col-reverse {
|
|
1225
|
+
flex-direction: column-reverse;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1187
1228
|
.flex-row {
|
|
1188
1229
|
flex-direction: row;
|
|
1189
1230
|
}
|
|
@@ -1379,6 +1420,16 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
1379
1420
|
border-width: 2px;
|
|
1380
1421
|
}
|
|
1381
1422
|
|
|
1423
|
+
.border-t {
|
|
1424
|
+
border-top-style: var(--tw-border-style);
|
|
1425
|
+
border-top-width: 1px;
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
.border-b {
|
|
1429
|
+
border-bottom-style: var(--tw-border-style);
|
|
1430
|
+
border-bottom-width: 1px;
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1382
1433
|
.border-l-0 {
|
|
1383
1434
|
border-left-style: var(--tw-border-style);
|
|
1384
1435
|
border-left-width: 0;
|
|
@@ -1557,7 +1608,15 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
1557
1608
|
background-color: var(--color-lime-400);
|
|
1558
1609
|
}
|
|
1559
1610
|
|
|
1560
|
-
.bg-muted
|
|
1611
|
+
.bg-muted {
|
|
1612
|
+
background-color: var(--muted);
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
.bg-muted-foreground {
|
|
1616
|
+
background-color: var(--muted-foreground);
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
.bg-muted\\/50 {
|
|
1561
1620
|
background-color: var(--muted);
|
|
1562
1621
|
}
|
|
1563
1622
|
|
|
@@ -1680,6 +1739,10 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
1680
1739
|
padding-inline: calc(var(--spacing) * 0);
|
|
1681
1740
|
}
|
|
1682
1741
|
|
|
1742
|
+
.px-0\\.5 {
|
|
1743
|
+
padding-inline: calc(var(--spacing) * .5);
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1683
1746
|
.px-1\\.5 {
|
|
1684
1747
|
padding-inline: calc(var(--spacing) * 1.5);
|
|
1685
1748
|
}
|
|
@@ -1812,6 +1875,10 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
1812
1875
|
text-align: left;
|
|
1813
1876
|
}
|
|
1814
1877
|
|
|
1878
|
+
.align-middle {
|
|
1879
|
+
vertical-align: middle;
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1815
1882
|
.font-mono {
|
|
1816
1883
|
font-family: var(--font-mono);
|
|
1817
1884
|
}
|
|
@@ -1962,6 +2029,11 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
1962
2029
|
font-weight: var(--font-weight-normal);
|
|
1963
2030
|
}
|
|
1964
2031
|
|
|
2032
|
+
.font-semibold {
|
|
2033
|
+
--tw-font-weight: var(--font-weight-semibold);
|
|
2034
|
+
font-weight: var(--font-weight-semibold);
|
|
2035
|
+
}
|
|
2036
|
+
|
|
1965
2037
|
.tracking-\\[-0\\.02em\\] {
|
|
1966
2038
|
--tw-tracking: -.02em;
|
|
1967
2039
|
letter-spacing: -.02em;
|
|
@@ -2730,10 +2802,20 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
2730
2802
|
position: absolute;
|
|
2731
2803
|
}
|
|
2732
2804
|
|
|
2805
|
+
.first\\:rounded-l-md:first-child {
|
|
2806
|
+
border-top-left-radius: calc(var(--radius) - 2px);
|
|
2807
|
+
border-bottom-left-radius: calc(var(--radius) - 2px);
|
|
2808
|
+
}
|
|
2809
|
+
|
|
2733
2810
|
.last\\:mt-0:last-child {
|
|
2734
2811
|
margin-top: calc(var(--spacing) * 0);
|
|
2735
2812
|
}
|
|
2736
2813
|
|
|
2814
|
+
.last\\:rounded-r-md:last-child {
|
|
2815
|
+
border-top-right-radius: calc(var(--radius) - 2px);
|
|
2816
|
+
border-bottom-right-radius: calc(var(--radius) - 2px);
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2737
2819
|
.focus-within\\:border-border-dark:focus-within {
|
|
2738
2820
|
border-color: var(--v-borders-dark);
|
|
2739
2821
|
}
|
|
@@ -2794,10 +2876,16 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
2794
2876
|
}
|
|
2795
2877
|
}
|
|
2796
2878
|
|
|
2797
|
-
.hover\\:bg-muted:hover {
|
|
2879
|
+
.hover\\:bg-muted:hover, .hover\\:bg-muted\\/50:hover {
|
|
2798
2880
|
background-color: var(--muted);
|
|
2799
2881
|
}
|
|
2800
2882
|
|
|
2883
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
2884
|
+
.hover\\:bg-muted\\/50:hover {
|
|
2885
|
+
background-color: color-mix(in oklab, var(--muted) 50%, transparent);
|
|
2886
|
+
}
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2801
2889
|
.hover\\:bg-primary--hover:hover {
|
|
2802
2890
|
background-color: var(--contrast--hover);
|
|
2803
2891
|
}
|
|
@@ -2859,6 +2947,10 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
2859
2947
|
}
|
|
2860
2948
|
}
|
|
2861
2949
|
|
|
2950
|
+
.focus\\:z-10:focus {
|
|
2951
|
+
z-index: 10;
|
|
2952
|
+
}
|
|
2953
|
+
|
|
2862
2954
|
.focus\\:border-border-dark:focus {
|
|
2863
2955
|
border-color: var(--v-borders-dark);
|
|
2864
2956
|
}
|
|
@@ -2978,6 +3070,10 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
2978
3070
|
outline-style: none;
|
|
2979
3071
|
}
|
|
2980
3072
|
|
|
3073
|
+
.active\\:cursor-grabbing:active {
|
|
3074
|
+
cursor: grabbing;
|
|
3075
|
+
}
|
|
3076
|
+
|
|
2981
3077
|
.active\\:rounded-lg:active {
|
|
2982
3078
|
border-radius: var(--radius);
|
|
2983
3079
|
}
|
|
@@ -3769,6 +3865,10 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
3769
3865
|
--tw-enter-scale: .95;
|
|
3770
3866
|
}
|
|
3771
3867
|
|
|
3868
|
+
.data-\\[state\\=selected\\]\\:bg-muted[data-state="selected"] {
|
|
3869
|
+
background-color: var(--muted);
|
|
3870
|
+
}
|
|
3871
|
+
|
|
3772
3872
|
.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state="unchecked"] {
|
|
3773
3873
|
--tw-translate-x: calc(var(--spacing) * 0);
|
|
3774
3874
|
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
@@ -3828,6 +3928,21 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
3828
3928
|
line-height: var(--tw-leading, 1.5);
|
|
3829
3929
|
}
|
|
3830
3930
|
|
|
3931
|
+
.data-\\[variant\\=outline\\]\\:border-l-0[data-variant="outline"] {
|
|
3932
|
+
border-left-style: var(--tw-border-style);
|
|
3933
|
+
border-left-width: 0;
|
|
3934
|
+
}
|
|
3935
|
+
|
|
3936
|
+
.data-\\[variant\\=outline\\]\\:shadow-xs[data-variant="outline"] {
|
|
3937
|
+
--tw-shadow: 0 1px 2px 0 var(--tw-shadow-color, #0000000d);
|
|
3938
|
+
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
3939
|
+
}
|
|
3940
|
+
|
|
3941
|
+
.data-\\[variant\\=outline\\]\\:first\\:border-l[data-variant="outline"]:first-child {
|
|
3942
|
+
border-left-style: var(--tw-border-style);
|
|
3943
|
+
border-left-width: 1px;
|
|
3944
|
+
}
|
|
3945
|
+
|
|
3831
3946
|
.nth-last-2\\:-mt-1:nth-last-child(2) {
|
|
3832
3947
|
margin-top: calc(var(--spacing) * -1);
|
|
3833
3948
|
}
|
|
@@ -3851,10 +3966,22 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
3851
3966
|
max-width: calc(var(--spacing) * 120);
|
|
3852
3967
|
}
|
|
3853
3968
|
|
|
3969
|
+
.sm\\:max-w-lg {
|
|
3970
|
+
max-width: var(--container-lg);
|
|
3971
|
+
}
|
|
3972
|
+
|
|
3854
3973
|
.sm\\:grid-cols-3 {
|
|
3855
3974
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
3856
3975
|
}
|
|
3857
3976
|
|
|
3977
|
+
.sm\\:flex-row {
|
|
3978
|
+
flex-direction: row;
|
|
3979
|
+
}
|
|
3980
|
+
|
|
3981
|
+
.sm\\:justify-end {
|
|
3982
|
+
justify-content: flex-end;
|
|
3983
|
+
}
|
|
3984
|
+
|
|
3858
3985
|
.sm\\:p-0 {
|
|
3859
3986
|
padding: calc(var(--spacing) * 0);
|
|
3860
3987
|
}
|
|
@@ -3862,6 +3989,10 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
3862
3989
|
.sm\\:p-10 {
|
|
3863
3990
|
padding: calc(var(--spacing) * 10);
|
|
3864
3991
|
}
|
|
3992
|
+
|
|
3993
|
+
.sm\\:text-left {
|
|
3994
|
+
text-align: left;
|
|
3995
|
+
}
|
|
3865
3996
|
}
|
|
3866
3997
|
|
|
3867
3998
|
@media (width >= 768px) {
|
|
@@ -4099,34 +4230,44 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
4099
4230
|
}
|
|
4100
4231
|
}
|
|
4101
4232
|
|
|
4102
|
-
.\\[\\&_svg\\:not\\(\\[class
|
|
4233
|
+
.\\[\\&_svg\\:not\\(\\[class\\*\\=size-\\]\\)\\]\\:size-4 svg:not([class*="size-"]) {
|
|
4103
4234
|
width: calc(var(--spacing) * 4);
|
|
4104
4235
|
height: calc(var(--spacing) * 4);
|
|
4105
4236
|
}
|
|
4106
4237
|
|
|
4107
|
-
.\\[\\&_svg\\:not\\(\\[class
|
|
4238
|
+
.\\[\\&_svg\\:not\\(\\[class\\*\\=size-\\]\\)\\]\\:size-6 svg:not([class*="size-"]), .group-data-\\[size\\=default\\]\\/input-group\\:\\[\\&_svg\\:not\\(\\[class\\*\\=size-\\]\\)\\]\\:size-6:is(:where(.group\\/input-group)[data-size="default"] *) svg:not([class*="size-"]) {
|
|
4108
4239
|
width: calc(var(--spacing) * 6);
|
|
4109
4240
|
height: calc(var(--spacing) * 6);
|
|
4110
4241
|
}
|
|
4111
4242
|
|
|
4112
|
-
.group-data-\\[size\\=md\\]\\/input-group\\:\\[\\&_svg\\:not\\(\\[class
|
|
4243
|
+
.group-data-\\[size\\=md\\]\\/input-group\\:\\[\\&_svg\\:not\\(\\[class\\*\\=size-\\]\\)\\]\\:size-4:is(:where(.group\\/input-group)[data-size="md"] *) svg:not([class*="size-"]) {
|
|
4113
4244
|
width: calc(var(--spacing) * 4);
|
|
4114
4245
|
height: calc(var(--spacing) * 4);
|
|
4115
4246
|
}
|
|
4116
4247
|
|
|
4117
|
-
.group-data-\\[size\\=sm\\]\\/input-group\\:\\[\\&_svg\\:not\\(\\[class
|
|
4248
|
+
.group-data-\\[size\\=sm\\]\\/input-group\\:\\[\\&_svg\\:not\\(\\[class\\*\\=size-\\]\\)\\]\\:size-3:is(:where(.group\\/input-group)[data-size="sm"] *) svg:not([class*="size-"]) {
|
|
4118
4249
|
width: calc(var(--spacing) * 3);
|
|
4119
4250
|
height: calc(var(--spacing) * 3);
|
|
4120
4251
|
}
|
|
4121
4252
|
|
|
4122
|
-
.\\[\\&_svg\\:not\\(\\[class
|
|
4253
|
+
.\\[\\&_svg\\:not\\(\\[class\\*\\=text-\\]\\)\\]\\:text-muted-foreground svg:not([class*="text-"]) {
|
|
4123
4254
|
color: var(--muted-foreground);
|
|
4124
4255
|
}
|
|
4125
4256
|
|
|
4126
|
-
.\\[\\&_svg\\:not\\(\\[class
|
|
4257
|
+
.\\[\\&_svg\\:not\\(\\[class\\*\\=text-\\]\\)\\]\\:text-text-dark svg:not([class*="text-"]) {
|
|
4127
4258
|
color: var(--v-text-dark);
|
|
4128
4259
|
}
|
|
4129
4260
|
|
|
4261
|
+
.\\[\\&_tr\\]\\:border-b tr {
|
|
4262
|
+
border-bottom-style: var(--tw-border-style);
|
|
4263
|
+
border-bottom-width: 1px;
|
|
4264
|
+
}
|
|
4265
|
+
|
|
4266
|
+
.\\[\\&_tr\\:last-child\\]\\:border-0 tr:last-child {
|
|
4267
|
+
border-style: var(--tw-border-style);
|
|
4268
|
+
border-width: 0;
|
|
4269
|
+
}
|
|
4270
|
+
|
|
4130
4271
|
.\\[\\&\\+\\[data-slot\\=item-content\\]\\]\\:flex-none + [data-slot="item-content"] {
|
|
4131
4272
|
flex: none;
|
|
4132
4273
|
}
|
|
@@ -4147,6 +4288,10 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
4147
4288
|
appearance: none;
|
|
4148
4289
|
}
|
|
4149
4290
|
|
|
4291
|
+
.\\[\\&\\:has\\(\\[role\\=checkbox\\]\\)\\]\\:pr-0:has([role="checkbox"]) {
|
|
4292
|
+
padding-right: calc(var(--spacing) * 0);
|
|
4293
|
+
}
|
|
4294
|
+
|
|
4150
4295
|
.\\[\\.border-b\\]\\:pb-2\\.5.border-b {
|
|
4151
4296
|
padding-bottom: calc(var(--spacing) * 2.5);
|
|
4152
4297
|
}
|
|
@@ -4225,6 +4370,11 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
4225
4370
|
}
|
|
4226
4371
|
}
|
|
4227
4372
|
|
|
4373
|
+
.\\[\\&\\>\\[role\\=checkbox\\]\\]\\:translate-y-\\[2px\\] > [role="checkbox"] {
|
|
4374
|
+
--tw-translate-y: 2px;
|
|
4375
|
+
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
4376
|
+
}
|
|
4377
|
+
|
|
4228
4378
|
.has-\\[\\>\\[data-slot\\=field-content\\]\\]\\:\\[\\&\\>\\[role\\=checkbox\\]\\,\\[role\\=radio\\]\\]\\:mt-px:has( > [data-slot="field-content"]) > [role="checkbox"], .has-\\[\\>\\[data-slot\\=field-content\\]\\]\\:\\[\\&\\>\\[role\\=checkbox\\]\\,\\[role\\=radio\\]\\]\\:mt-px:has( > [data-slot="field-content"]) [role="radio"] {
|
|
4229
4379
|
margin-top: 1px;
|
|
4230
4380
|
}
|
|
@@ -4263,26 +4413,31 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
4263
4413
|
padding-left: calc(var(--spacing) * 2);
|
|
4264
4414
|
}
|
|
4265
4415
|
|
|
4266
|
-
.\\[\\&\\>svg\\:not\\(\\[class
|
|
4416
|
+
.\\[\\&\\>svg\\:not\\(\\[class\\*\\=size-\\]\\)\\]\\:size-3\\.5 > svg:not([class*="size-"]) {
|
|
4267
4417
|
width: calc(var(--spacing) * 3.5);
|
|
4268
4418
|
height: calc(var(--spacing) * 3.5);
|
|
4269
4419
|
}
|
|
4270
4420
|
|
|
4271
|
-
.group-data-\\[size\\=default\\]\\/input-group\\:\\[\\&\\>svg\\:not\\(\\[class
|
|
4421
|
+
.group-data-\\[size\\=default\\]\\/input-group\\:\\[\\&\\>svg\\:not\\(\\[class\\*\\=size-\\]\\)\\]\\:size-6:is(:where(.group\\/input-group)[data-size="default"] *) > svg:not([class*="size-"]) {
|
|
4272
4422
|
width: calc(var(--spacing) * 6);
|
|
4273
4423
|
height: calc(var(--spacing) * 6);
|
|
4274
4424
|
}
|
|
4275
4425
|
|
|
4276
|
-
.group-data-\\[size\\=md\\]\\/input-group\\:\\[\\&\\>svg\\:not\\(\\[class
|
|
4426
|
+
.group-data-\\[size\\=md\\]\\/input-group\\:\\[\\&\\>svg\\:not\\(\\[class\\*\\=size-\\]\\)\\]\\:size-4:is(:where(.group\\/input-group)[data-size="md"] *) > svg:not([class*="size-"]) {
|
|
4277
4427
|
width: calc(var(--spacing) * 4);
|
|
4278
4428
|
height: calc(var(--spacing) * 4);
|
|
4279
4429
|
}
|
|
4280
4430
|
|
|
4281
|
-
.group-data-\\[size\\=sm\\]\\/input-group\\:\\[\\&\\>svg\\:not\\(\\[class
|
|
4431
|
+
.group-data-\\[size\\=sm\\]\\/input-group\\:\\[\\&\\>svg\\:not\\(\\[class\\*\\=size-\\]\\)\\]\\:size-3:is(:where(.group\\/input-group)[data-size="sm"] *) > svg:not([class*="size-"]) {
|
|
4282
4432
|
width: calc(var(--spacing) * 3);
|
|
4283
4433
|
height: calc(var(--spacing) * 3);
|
|
4284
4434
|
}
|
|
4285
4435
|
|
|
4436
|
+
.\\[\\&\\>tr\\]\\:last\\:border-b-0 > tr:last-child {
|
|
4437
|
+
border-bottom-style: var(--tw-border-style);
|
|
4438
|
+
border-bottom-width: 0;
|
|
4439
|
+
}
|
|
4440
|
+
|
|
4286
4441
|
.\\[\\&\\[aria-orientation\\=horizontal\\]\\>div\\]\\:rotate-90[aria-orientation="horizontal"] > div {
|
|
4287
4442
|
rotate: 90deg;
|
|
4288
4443
|
}
|
|
@@ -4700,9 +4855,13 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
4700
4855
|
--v-backgrounds-base: #f5f5f7;
|
|
4701
4856
|
--v-backgrounds-base-2: #e9e9f0;
|
|
4702
4857
|
--v-backgrounds-base-3: #dadae0;
|
|
4858
|
+
--v-backgrounds-gray-transparent: #8c8c9533;
|
|
4703
4859
|
--v-backgrounds-red: #e2491a;
|
|
4860
|
+
--v-backgrounds-red-transparent: #fb783b33;
|
|
4704
4861
|
--v-backgrounds-green: #85c13d;
|
|
4862
|
+
--v-backgrounds-green-transparent: #85d52433;
|
|
4705
4863
|
--v-backgrounds-blue: #3f73ed;
|
|
4864
|
+
--v-backgrounds-blue-transparent: #3291fe33;
|
|
4706
4865
|
--v-borders-white: #fff;
|
|
4707
4866
|
--v-borders-black: #212124;
|
|
4708
4867
|
--v-borders-light: #dadae0;
|
|
@@ -4797,6 +4956,8 @@ button, input:where([type="button"], [type="reset"], [type="submit"]) {
|
|
|
4797
4956
|
--v-font-family: "__tw4_shd_inter_7x4q2", sans-serif;
|
|
4798
4957
|
font-family: var(--v-font-family);
|
|
4799
4958
|
font-feature-settings: "liga" 1, "calt" 1;
|
|
4959
|
+
-webkit-font-smoothing: antialiased;
|
|
4960
|
+
-moz-osx-font-smoothing: grayscale;
|
|
4800
4961
|
--radius: 10px;
|
|
4801
4962
|
--background: var(--v-backgrounds-layout);
|
|
4802
4963
|
--foreground: var(--v-text-dark);
|
|
@@ -5563,25 +5724,35 @@ function ThemeProvider({ children, defaultTheme = 'system', storageKey = 'v-them
|
|
|
5563
5724
|
}
|
|
5564
5725
|
var fontsinline = __webpack_require__("../ui/src/styles/fonts.css?inline");
|
|
5565
5726
|
const PROPERTY_BLOCK_RE = /@property\s+(--[^{\s]+)\s*\{([^}]*)\}/g;
|
|
5566
|
-
const INITIAL_VALUE_RE = /initial-value:([
|
|
5727
|
+
const INITIAL_VALUE_RE = /initial-value:([^;}]+)/i;
|
|
5728
|
+
const NON_INHERITING_RE = /inherits:\s*false(?:\s*;|\s*$)/i;
|
|
5567
5729
|
const ROOT_TO_HOST_SELECTOR_RE = /:root\s*,\s*:host|:root/g;
|
|
5568
5730
|
function createShadowRootCssText(cssText) {
|
|
5569
5731
|
const cssForHost = cssText.replace(ROOT_TO_HOST_SELECTOR_RE, ':host');
|
|
5570
5732
|
const propertyBlocks = Array.from(cssText.matchAll(PROPERTY_BLOCK_RE));
|
|
5571
5733
|
const propertyDefaults = propertyBlocks.map(([, name, body])=>{
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
return ` ${name}: ${initialValue};`;
|
|
5734
|
+
if (!NON_INHERITING_RE.test(body)) return null;
|
|
5735
|
+
const initialValue = body.match(INITIAL_VALUE_RE)?.[1].trim() ?? 'initial';
|
|
5736
|
+
return ` ${name}: ${initialValue};`;
|
|
5576
5737
|
}).filter((value)=>null !== value).join('\n');
|
|
5577
|
-
|
|
5738
|
+
if (!propertyDefaults) return cssForHost;
|
|
5739
|
+
return `${cssForHost}\n\n@layer base {
|
|
5740
|
+
:host,
|
|
5741
|
+
*,
|
|
5742
|
+
::before,
|
|
5743
|
+
::after,
|
|
5744
|
+
::backdrop,
|
|
5745
|
+
::file-selector-button {
|
|
5746
|
+
${propertyDefaults}
|
|
5747
|
+
}
|
|
5748
|
+
}`;
|
|
5578
5749
|
}
|
|
5579
5750
|
var styleinline = __webpack_require__("./src/style.css?inline");
|
|
5580
5751
|
const shadowRootCssText = createShadowRootCssText(styleinline.A);
|
|
5581
5752
|
function utils_cn(...inputs) {
|
|
5582
5753
|
return twMerge(clsx(inputs));
|
|
5583
5754
|
}
|
|
5584
|
-
const buttonVariants = cva('cursor-pointer inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-xl transition-all disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg:not([class
|
|
5755
|
+
const buttonVariants = cva('cursor-pointer inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-xl transition-all disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive', {
|
|
5585
5756
|
variants: {
|
|
5586
5757
|
variant: {
|
|
5587
5758
|
default: 'bg-primary text-primary-foreground hover:bg-primary--hover active:bg-primary--pressed disabled:bg-primary--disabled disabled:opacity-20',
|
|
@@ -5868,35 +6039,40 @@ function DialogOverlay({ className, ...props }) {
|
|
|
5868
6039
|
...props
|
|
5869
6040
|
});
|
|
5870
6041
|
}
|
|
5871
|
-
function DialogContent({ className, children, showCloseButton = true, portalContainer, ...props }) {
|
|
5872
|
-
|
|
5873
|
-
"data-slot": "dialog-
|
|
5874
|
-
|
|
6042
|
+
function DialogContent({ className, children, contentInsideOverlay = false, showCloseButton = true, portalContainer, ...props }) {
|
|
6043
|
+
const content = /*#__PURE__*/ jsxs(Content, {
|
|
6044
|
+
"data-slot": "dialog-content",
|
|
6045
|
+
className: utils_cn('bg-background-containers data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-6 rounded-3xl border-0 p-6 shadow-[var(--shadow-login)] duration-200 outline-none sm:max-w-120 sm:p-10', className),
|
|
6046
|
+
...props,
|
|
5875
6047
|
children: [
|
|
5876
|
-
|
|
5877
|
-
/*#__PURE__*/ jsxs(
|
|
5878
|
-
"data-slot": "dialog-
|
|
5879
|
-
className:
|
|
5880
|
-
...props,
|
|
6048
|
+
children,
|
|
6049
|
+
showCloseButton && /*#__PURE__*/ jsxs(react_dialog_Close, {
|
|
6050
|
+
"data-slot": "dialog-close",
|
|
6051
|
+
className: "focus-visible:ring-ring/30 absolute top-4 right-4 inline-flex size-6 cursor-pointer items-center justify-center rounded-full text-icons-light transition-colors hover:text-icons-normal focus-visible:text-icons-dark focus-visible:ring-2 focus-visible:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
5881
6052
|
children: [
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
className: "size-6"
|
|
5889
|
-
}),
|
|
5890
|
-
/*#__PURE__*/ jsx("span", {
|
|
5891
|
-
className: "sr-only",
|
|
5892
|
-
children: "Close"
|
|
5893
|
-
})
|
|
5894
|
-
]
|
|
6053
|
+
/*#__PURE__*/ jsx(XIcon, {
|
|
6054
|
+
className: "size-6"
|
|
6055
|
+
}),
|
|
6056
|
+
/*#__PURE__*/ jsx("span", {
|
|
6057
|
+
className: "sr-only",
|
|
6058
|
+
children: "Close"
|
|
5895
6059
|
})
|
|
5896
6060
|
]
|
|
5897
6061
|
})
|
|
5898
6062
|
]
|
|
5899
6063
|
});
|
|
6064
|
+
return /*#__PURE__*/ jsx(DialogPortal, {
|
|
6065
|
+
"data-slot": "dialog-portal",
|
|
6066
|
+
container: portalContainer,
|
|
6067
|
+
children: contentInsideOverlay ? /*#__PURE__*/ jsx(DialogOverlay, {
|
|
6068
|
+
children: content
|
|
6069
|
+
}) : /*#__PURE__*/ jsxs(Fragment, {
|
|
6070
|
+
children: [
|
|
6071
|
+
/*#__PURE__*/ jsx(DialogOverlay, {}),
|
|
6072
|
+
content
|
|
6073
|
+
]
|
|
6074
|
+
})
|
|
6075
|
+
});
|
|
5900
6076
|
}
|
|
5901
6077
|
const oklchRegex = /oklch\(([0-9.]+)\s+([0-9.]+)\s+([0-9.]+)\)/;
|
|
5902
6078
|
function getOklch(color, fallback) {
|
|
@@ -5968,6 +6144,7 @@ function QRCode({ data, foreground, background, robustness = 'M', className, ...
|
|
|
5968
6144
|
});
|
|
5969
6145
|
}
|
|
5970
6146
|
const MODEL_VIEWER_URL = "https://integrations.vizbl.com/model-viewer";
|
|
6147
|
+
const AR_DEVICE_REQUIREMENTS_DISCLAIMER = '*Requires AR-supported device and browser. We recommend iOS 12 or later with Safari, or Android 7.0 or later with Chrome.';
|
|
5971
6148
|
const DEFAULT_API_TIMEOUT = 30000;
|
|
5972
6149
|
function createDefaultClient(defaultBaseURL) {
|
|
5973
6150
|
return axios.create({
|
|
@@ -6308,7 +6485,7 @@ const runtime = createApiClientRuntime({
|
|
|
6308
6485
|
configureFunctionName: 'configureNodeApiClient',
|
|
6309
6486
|
defaultBaseURL: "https://api.vizbl.com"
|
|
6310
6487
|
});
|
|
6311
|
-
|
|
6488
|
+
runtime.configureClientRuntime;
|
|
6312
6489
|
runtime.configureAccessTokenResolverRuntime;
|
|
6313
6490
|
runtime.configureHeadersResolverRuntime;
|
|
6314
6491
|
runtime.configureUnauthorizedHandlerRuntime;
|
|
@@ -6318,13 +6495,31 @@ runtime.resetClientForTestsRuntime;
|
|
|
6318
6495
|
const requestNodeRuntime = runtime.requestRuntime;
|
|
6319
6496
|
runtime.requestWithoutUnauthorizedRecovery;
|
|
6320
6497
|
runtime.addResponseInterceptorRuntime;
|
|
6321
|
-
function configureNodeApiClient(config) {
|
|
6322
|
-
configureNodeApiClientRuntime(config);
|
|
6323
|
-
}
|
|
6324
6498
|
async function node_client_node_client(config) {
|
|
6325
6499
|
return requestNodeRuntime(config);
|
|
6326
6500
|
}
|
|
6327
|
-
async function
|
|
6501
|
+
async function publicApiControllerActivateCoreAR(params, config = {}) {
|
|
6502
|
+
const { client: request = node_client_node_client, ...requestConfig } = config;
|
|
6503
|
+
const res = await request({
|
|
6504
|
+
method: "POST",
|
|
6505
|
+
url: "/public/widget/activate-core",
|
|
6506
|
+
params,
|
|
6507
|
+
...requestConfig
|
|
6508
|
+
});
|
|
6509
|
+
return res.data;
|
|
6510
|
+
}
|
|
6511
|
+
async function publicApiControllerIssueWidgetToken(data, config = {}) {
|
|
6512
|
+
const { client: request = node_client_node_client, ...requestConfig } = config;
|
|
6513
|
+
const requestData = data;
|
|
6514
|
+
const res = await request({
|
|
6515
|
+
method: "POST",
|
|
6516
|
+
url: "/public/widget/token",
|
|
6517
|
+
data: requestData,
|
|
6518
|
+
...requestConfig
|
|
6519
|
+
});
|
|
6520
|
+
return res.data;
|
|
6521
|
+
}
|
|
6522
|
+
async function publicApiControllerReadObjectByTinuuid({ tinuuid }, params, config = {}) {
|
|
6328
6523
|
const { client: request = node_client_node_client, ...requestConfig } = config;
|
|
6329
6524
|
const res = await request({
|
|
6330
6525
|
method: "GET",
|
|
@@ -6334,33 +6529,227 @@ async function publicApiControllerGetObjectByTinuuid({ tinuuid }, params, config
|
|
|
6334
6529
|
});
|
|
6335
6530
|
return res.data;
|
|
6336
6531
|
}
|
|
6532
|
+
const WIDGET_SESSION_TOKEN_HEADER = 'x-widget-session-token';
|
|
6533
|
+
const DEFAULT_REFRESH_THRESHOLD_MS = 30000;
|
|
6534
|
+
const ALLOWED_PRODUCT_TYPES = new Set([
|
|
6535
|
+
'core-ar',
|
|
6536
|
+
'core-ar-shopify'
|
|
6537
|
+
]);
|
|
6538
|
+
class ModelViewerWidgetSession {
|
|
6539
|
+
apiBaseUrl;
|
|
6540
|
+
apiKey;
|
|
6541
|
+
issueWidgetToken;
|
|
6542
|
+
mode;
|
|
6543
|
+
now;
|
|
6544
|
+
refreshThresholdMs;
|
|
6545
|
+
refreshPromise = null;
|
|
6546
|
+
session;
|
|
6547
|
+
constructor(activationData, options){
|
|
6548
|
+
this.apiBaseUrl = options.apiBaseUrl;
|
|
6549
|
+
this.apiKey = options.apiKey;
|
|
6550
|
+
this.issueWidgetToken = options.issueWidgetToken ?? publicApiControllerIssueWidgetToken;
|
|
6551
|
+
this.mode = options.mode;
|
|
6552
|
+
this.now = options.now ?? Date.now;
|
|
6553
|
+
this.refreshThresholdMs = options.refreshThresholdMs ?? DEFAULT_REFRESH_THRESHOLD_MS;
|
|
6554
|
+
this.session = this.toSnapshot(activationData);
|
|
6555
|
+
}
|
|
6556
|
+
get token() {
|
|
6557
|
+
return this.session.token;
|
|
6558
|
+
}
|
|
6559
|
+
get sid() {
|
|
6560
|
+
return this.session.sid;
|
|
6561
|
+
}
|
|
6562
|
+
get snapshot() {
|
|
6563
|
+
return {
|
|
6564
|
+
...this.session
|
|
6565
|
+
};
|
|
6566
|
+
}
|
|
6567
|
+
async getTokenForRequest() {
|
|
6568
|
+
if (this.session.expiresAt - this.now() > this.refreshThresholdMs) return this.session.token;
|
|
6569
|
+
return (await this.refresh()).token;
|
|
6570
|
+
}
|
|
6571
|
+
async getRequestConfig(signal) {
|
|
6572
|
+
return {
|
|
6573
|
+
baseURL: this.apiBaseUrl,
|
|
6574
|
+
headers: {
|
|
6575
|
+
[WIDGET_SESSION_TOKEN_HEADER]: await this.getTokenForRequest()
|
|
6576
|
+
},
|
|
6577
|
+
signal
|
|
6578
|
+
};
|
|
6579
|
+
}
|
|
6580
|
+
refresh() {
|
|
6581
|
+
if (this.refreshPromise) return this.refreshPromise;
|
|
6582
|
+
this.refreshPromise = this.issueWidgetToken({
|
|
6583
|
+
mode: this.mode,
|
|
6584
|
+
token: this.session.token
|
|
6585
|
+
}, {
|
|
6586
|
+
baseURL: this.apiBaseUrl,
|
|
6587
|
+
headers: {
|
|
6588
|
+
'x-api-key': this.apiKey
|
|
6589
|
+
}
|
|
6590
|
+
}).then((data)=>this.toSnapshot(parseWidgetSession(data))).then((session)=>{
|
|
6591
|
+
this.session = session;
|
|
6592
|
+
return this.snapshot;
|
|
6593
|
+
}).finally(()=>{
|
|
6594
|
+
this.refreshPromise = null;
|
|
6595
|
+
});
|
|
6596
|
+
return this.refreshPromise;
|
|
6597
|
+
}
|
|
6598
|
+
toSnapshot(data) {
|
|
6599
|
+
return {
|
|
6600
|
+
...data,
|
|
6601
|
+
expiresAt: this.now() + 1000 * data.expiresIn
|
|
6602
|
+
};
|
|
6603
|
+
}
|
|
6604
|
+
}
|
|
6605
|
+
async function createModelViewerWidgetSession({ apiBaseUrl, apiKey, initialWidgetSessionToken, mode, signal }) {
|
|
6606
|
+
const requestConfig = {
|
|
6607
|
+
baseURL: apiBaseUrl,
|
|
6608
|
+
headers: {
|
|
6609
|
+
'x-api-key': apiKey
|
|
6610
|
+
},
|
|
6611
|
+
signal
|
|
6612
|
+
};
|
|
6613
|
+
if (initialWidgetSessionToken) try {
|
|
6614
|
+
const refreshed = await publicApiControllerIssueWidgetToken({
|
|
6615
|
+
mode,
|
|
6616
|
+
token: initialWidgetSessionToken
|
|
6617
|
+
}, requestConfig);
|
|
6618
|
+
return new ModelViewerWidgetSession(parseWidgetSession(refreshed), {
|
|
6619
|
+
apiBaseUrl,
|
|
6620
|
+
apiKey,
|
|
6621
|
+
mode
|
|
6622
|
+
});
|
|
6623
|
+
} catch (error) {
|
|
6624
|
+
if (signal?.aborted) throw error;
|
|
6625
|
+
}
|
|
6626
|
+
const activation = await publicApiControllerActivateCoreAR({
|
|
6627
|
+
mode
|
|
6628
|
+
}, requestConfig);
|
|
6629
|
+
if ('string' != typeof activation.productType || !ALLOWED_PRODUCT_TYPES.has(activation.productType)) throw new TypeError('The API key is not enabled for Core AR');
|
|
6630
|
+
return new ModelViewerWidgetSession(parseWidgetSession(activation.widgetSession), {
|
|
6631
|
+
apiBaseUrl,
|
|
6632
|
+
apiKey,
|
|
6633
|
+
mode
|
|
6634
|
+
});
|
|
6635
|
+
}
|
|
6636
|
+
async function fetchModelViewerObject(tinuuid, variantId, session, signal) {
|
|
6637
|
+
return publicApiControllerReadObjectByTinuuid({
|
|
6638
|
+
tinuuid
|
|
6639
|
+
}, {
|
|
6640
|
+
productType: 'core-ar',
|
|
6641
|
+
variantId: variantId ?? void 0
|
|
6642
|
+
}, await session.getRequestConfig(signal));
|
|
6643
|
+
}
|
|
6644
|
+
async function sendModelViewerWidgetEvent(session, event, options = {}) {
|
|
6645
|
+
if (!session) return;
|
|
6646
|
+
try {
|
|
6647
|
+
const config = await session.getRequestConfig();
|
|
6648
|
+
const url = new URL('/public/widget/events', config.baseURL ?? window.location.origin);
|
|
6649
|
+
const response = await fetch(url, {
|
|
6650
|
+
body: JSON.stringify({
|
|
6651
|
+
event,
|
|
6652
|
+
objectId: options.objectId ?? void 0,
|
|
6653
|
+
timestamp: new Date().toISOString(),
|
|
6654
|
+
variantId: options.variantId ?? void 0
|
|
6655
|
+
}),
|
|
6656
|
+
headers: {
|
|
6657
|
+
'Content-Type': 'application/json',
|
|
6658
|
+
...config.headers
|
|
6659
|
+
},
|
|
6660
|
+
keepalive: true,
|
|
6661
|
+
method: 'POST'
|
|
6662
|
+
});
|
|
6663
|
+
if (!response.ok) throw new Error(`Widget event request failed with ${response.status}`);
|
|
6664
|
+
} catch {}
|
|
6665
|
+
}
|
|
6666
|
+
function parseWidgetSession(value) {
|
|
6667
|
+
const session = value;
|
|
6668
|
+
if (!session || 'object' != typeof session || 'string' != typeof session.token || !session.token.trim() || 'string' != typeof session.sid || !session.sid.trim() || 'number' != typeof session.expiresIn || !Number.isFinite(session.expiresIn) || session.expiresIn <= 0) throw new TypeError('Invalid widget session response');
|
|
6669
|
+
return session;
|
|
6670
|
+
}
|
|
6671
|
+
const client_runtime_runtime = createApiClientRuntime({
|
|
6672
|
+
clientName: 'API client',
|
|
6673
|
+
configureFunctionName: 'configureApiClient',
|
|
6674
|
+
defaultBaseURL: "https://api.vizbl.com/v1"
|
|
6675
|
+
});
|
|
6676
|
+
client_runtime_runtime.configureClientRuntime;
|
|
6677
|
+
client_runtime_runtime.configureAccessTokenResolverRuntime;
|
|
6678
|
+
client_runtime_runtime.configureHeadersResolverRuntime;
|
|
6679
|
+
client_runtime_runtime.configureUnauthorizedHandlerRuntime;
|
|
6680
|
+
client_runtime_runtime.isClientConfiguredRuntime;
|
|
6681
|
+
client_runtime_runtime.assertClientConfiguredRuntime;
|
|
6682
|
+
client_runtime_runtime.resetClientForTestsRuntime;
|
|
6683
|
+
const client_runtime_requestRuntime = client_runtime_runtime.requestRuntime;
|
|
6684
|
+
client_runtime_runtime.requestWithoutUnauthorizedRecovery;
|
|
6685
|
+
client_runtime_runtime.addResponseInterceptorRuntime;
|
|
6686
|
+
async function client_client(config) {
|
|
6687
|
+
return client_runtime_requestRuntime(config);
|
|
6688
|
+
}
|
|
6689
|
+
async function objFetch(data, config = {}) {
|
|
6690
|
+
const { client: request = client_client, ...requestConfig } = config;
|
|
6691
|
+
const requestData = data;
|
|
6692
|
+
const res = await request({
|
|
6693
|
+
method: "POST",
|
|
6694
|
+
url: "/obj/Fetch",
|
|
6695
|
+
data: requestData,
|
|
6696
|
+
...requestConfig
|
|
6697
|
+
});
|
|
6698
|
+
return res.data;
|
|
6699
|
+
}
|
|
6337
6700
|
function useObjectData(tinuuid, initialHid, options) {
|
|
6338
6701
|
const [materialHid, setMaterialHid] = useState(initialHid ?? null);
|
|
6339
6702
|
const { data = null, error, isLoading } = react_query_useQuery({
|
|
6340
6703
|
queryKey: [
|
|
6341
6704
|
'modelViewer',
|
|
6342
6705
|
'object',
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6706
|
+
{
|
|
6707
|
+
apiBaseUrl: options.apiBaseUrl ?? null,
|
|
6708
|
+
apiKey: options.apiKey,
|
|
6709
|
+
initialHid: initialHid ?? null,
|
|
6710
|
+
initialWidgetSessionToken: options.initialWidgetSessionToken ?? null,
|
|
6711
|
+
legacyApiBaseUrl: options.legacyApiBaseUrl ?? null,
|
|
6712
|
+
mode: options.mode,
|
|
6348
6713
|
tinuuid
|
|
6349
|
-
}
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6714
|
+
}
|
|
6715
|
+
],
|
|
6716
|
+
enabled: Boolean(tinuuid),
|
|
6717
|
+
gcTime: 0,
|
|
6718
|
+
refetchOnMount: 'always',
|
|
6719
|
+
queryFn: async ({ signal })=>{
|
|
6720
|
+
if (!options.apiKey) {
|
|
6721
|
+
const object = await objFetch({
|
|
6722
|
+
tinuuid
|
|
6723
|
+
}, {
|
|
6724
|
+
baseURL: options.legacyApiBaseUrl,
|
|
6725
|
+
signal
|
|
6726
|
+
});
|
|
6727
|
+
return {
|
|
6728
|
+
object,
|
|
6729
|
+
widgetSession: null
|
|
6730
|
+
};
|
|
6731
|
+
}
|
|
6732
|
+
const widgetSession = await createModelViewerWidgetSession({
|
|
6733
|
+
apiBaseUrl: options.apiBaseUrl,
|
|
6734
|
+
apiKey: options.apiKey,
|
|
6735
|
+
initialWidgetSessionToken: options.initialWidgetSessionToken,
|
|
6736
|
+
mode: options.mode,
|
|
6355
6737
|
signal
|
|
6356
|
-
})
|
|
6738
|
+
});
|
|
6739
|
+
const object = await fetchModelViewerObject(tinuuid, initialHid, widgetSession, signal);
|
|
6740
|
+
return {
|
|
6741
|
+
object,
|
|
6742
|
+
widgetSession
|
|
6743
|
+
};
|
|
6744
|
+
}
|
|
6357
6745
|
});
|
|
6746
|
+
const object = data?.object ?? null;
|
|
6358
6747
|
const material = external_react_useMemo(()=>{
|
|
6359
|
-
if (!
|
|
6360
|
-
return materialHid ?
|
|
6748
|
+
if (!object?.materials?.length) return null;
|
|
6749
|
+
return materialHid ? object.materials.find((m)=>m.hid === materialHid) || object.materials[0] : object.materials?.[0] ?? null;
|
|
6361
6750
|
}, [
|
|
6362
|
-
|
|
6363
|
-
|
|
6751
|
+
materialHid,
|
|
6752
|
+
object
|
|
6364
6753
|
]);
|
|
6365
6754
|
useEffect(()=>{
|
|
6366
6755
|
setMaterialHid(initialHid ?? null);
|
|
@@ -6369,11 +6758,12 @@ function useObjectData(tinuuid, initialHid, options) {
|
|
|
6369
6758
|
tinuuid
|
|
6370
6759
|
]);
|
|
6371
6760
|
return {
|
|
6372
|
-
object
|
|
6761
|
+
object,
|
|
6373
6762
|
material,
|
|
6374
6763
|
error,
|
|
6375
6764
|
isLoading,
|
|
6376
|
-
setMaterialHid
|
|
6765
|
+
setMaterialHid,
|
|
6766
|
+
widgetSession: data?.widgetSession ?? null
|
|
6377
6767
|
};
|
|
6378
6768
|
}
|
|
6379
6769
|
function getErrorResponseStatus(error) {
|
|
@@ -6384,36 +6774,82 @@ function getModelViewerApiError(error) {
|
|
|
6384
6774
|
if (!isAxiosError(error)) return null;
|
|
6385
6775
|
const status = error.response?.status;
|
|
6386
6776
|
if (401 === status) return 'unauthorized';
|
|
6777
|
+
if (403 === status) return 'forbidden';
|
|
6387
6778
|
if (402 === status) return 'payment-required';
|
|
6388
6779
|
return null;
|
|
6389
6780
|
}
|
|
6390
6781
|
const ModelViewerContext = /*#__PURE__*/ createContext(null);
|
|
6391
|
-
function ModelViewerProvider({ children, tinuuid, apiKey, hid, layout, background }) {
|
|
6392
|
-
const { object, material, error, isLoading, setMaterialHid } = useObjectData(tinuuid, hid, {
|
|
6393
|
-
|
|
6782
|
+
function ModelViewerProvider({ children, tinuuid, apiKey, appClipBundleId, arExperience, apiBaseUrl, legacyApiBaseUrl, mode, initialWidgetSessionToken, handoffUrl, hid, launchAr, layout, background, sizeType, viewerSurface }) {
|
|
6783
|
+
const { object, material, error, isLoading, setMaterialHid: setObjectMaterialHid, widgetSession } = useObjectData(tinuuid, hid, {
|
|
6784
|
+
apiBaseUrl,
|
|
6785
|
+
apiKey,
|
|
6786
|
+
initialWidgetSessionToken,
|
|
6787
|
+
legacyApiBaseUrl,
|
|
6788
|
+
mode
|
|
6394
6789
|
});
|
|
6395
6790
|
const [isModelLoading, setIsModelLoading] = useState(true);
|
|
6396
6791
|
const [containerEl, setContainerEl] = useState(null);
|
|
6397
6792
|
const [modelViewerEl, setModelViewerEl] = useState(null);
|
|
6398
|
-
const
|
|
6793
|
+
const trackedCameraInteractionSidRef = useRef(null);
|
|
6794
|
+
const trackedOpenSidRef = useRef(null);
|
|
6399
6795
|
const glbUrl = material?.native?.glbUrl ?? null;
|
|
6400
6796
|
const usdzUrl = material?.native?.usdzUrl ?? null;
|
|
6401
6797
|
const previewUrl = material?.previews?.[0]?.url ?? null;
|
|
6402
6798
|
const state = external_react_useMemo(()=>{
|
|
6403
|
-
if (!hasNonEmptyApiKey) return 'unauthorized';
|
|
6404
6799
|
if (isLoading) return 'loading';
|
|
6405
6800
|
const accessError = getModelViewerApiError(error);
|
|
6406
6801
|
if (accessError) return accessError;
|
|
6802
|
+
const instantArExperience = 'ar-view' === mode || 'qr-code' === mode && 'standard' === arExperience;
|
|
6803
|
+
const advancedArExperience = 'advanced-ar-view' === mode || 'qr-code' === mode && 'advanced' === arExperience;
|
|
6804
|
+
if (instantArExperience && object?.policy?.instantArView === false) return 'forbidden';
|
|
6805
|
+
if ((advancedArExperience || 'ar-viewer' === mode) && object?.policy?.appClip === false) return 'forbidden';
|
|
6407
6806
|
if (null != error || !object || !material || !glbUrl) return 'not-found';
|
|
6408
6807
|
return 'ready';
|
|
6409
6808
|
}, [
|
|
6809
|
+
arExperience,
|
|
6410
6810
|
error,
|
|
6411
6811
|
glbUrl,
|
|
6412
|
-
hasNonEmptyApiKey,
|
|
6413
6812
|
isLoading,
|
|
6414
6813
|
material,
|
|
6814
|
+
mode,
|
|
6415
6815
|
object
|
|
6416
6816
|
]);
|
|
6817
|
+
const trackEvent = useCallback((event)=>sendModelViewerWidgetEvent(widgetSession, event, {
|
|
6818
|
+
objectId: object?.uuid,
|
|
6819
|
+
variantId: material?.hid
|
|
6820
|
+
}), [
|
|
6821
|
+
material?.hid,
|
|
6822
|
+
object?.uuid,
|
|
6823
|
+
widgetSession
|
|
6824
|
+
]);
|
|
6825
|
+
const setMaterialHid = useCallback((nextHid)=>{
|
|
6826
|
+
if (nextHid === material?.hid) return;
|
|
6827
|
+
setObjectMaterialHid(nextHid);
|
|
6828
|
+
sendModelViewerWidgetEvent(widgetSession, 'interacted', {
|
|
6829
|
+
objectId: object?.uuid,
|
|
6830
|
+
variantId: nextHid
|
|
6831
|
+
});
|
|
6832
|
+
}, [
|
|
6833
|
+
material?.hid,
|
|
6834
|
+
object?.uuid,
|
|
6835
|
+
setObjectMaterialHid,
|
|
6836
|
+
widgetSession
|
|
6837
|
+
]);
|
|
6838
|
+
useEffect(()=>{
|
|
6839
|
+
if ('inline' === viewerSurface || 'ready' !== state || !widgetSession || trackedOpenSidRef.current === widgetSession.sid) return;
|
|
6840
|
+
trackEvent('widget_opened');
|
|
6841
|
+
trackedOpenSidRef.current = widgetSession.sid;
|
|
6842
|
+
}, [
|
|
6843
|
+
state,
|
|
6844
|
+
trackEvent,
|
|
6845
|
+
viewerSurface,
|
|
6846
|
+
widgetSession
|
|
6847
|
+
]);
|
|
6848
|
+
useEffect(()=>{
|
|
6849
|
+
trackedCameraInteractionSidRef.current = null;
|
|
6850
|
+
}, [
|
|
6851
|
+
widgetSession?.sid
|
|
6852
|
+
]);
|
|
6417
6853
|
useEffect(()=>{
|
|
6418
6854
|
setIsModelLoading('ready' === state && Boolean(glbUrl));
|
|
6419
6855
|
}, [
|
|
@@ -6433,49 +6869,77 @@ function ModelViewerProvider({ children, tinuuid, apiKey, hid, layout, backgroun
|
|
|
6433
6869
|
const handleError = ()=>{
|
|
6434
6870
|
setIsModelLoading(false);
|
|
6435
6871
|
};
|
|
6872
|
+
const handleCameraChange = (event)=>{
|
|
6873
|
+
const source = event.detail?.source;
|
|
6874
|
+
if ('user-interaction' !== source || !widgetSession || trackedCameraInteractionSidRef.current === widgetSession.sid) return;
|
|
6875
|
+
trackEvent('interacted');
|
|
6876
|
+
trackedCameraInteractionSidRef.current = widgetSession.sid;
|
|
6877
|
+
};
|
|
6436
6878
|
modelViewerEl.addEventListener('progress', handleProgress);
|
|
6437
6879
|
modelViewerEl.addEventListener('load', handleLoad);
|
|
6438
6880
|
modelViewerEl.addEventListener('error', handleError);
|
|
6881
|
+
modelViewerEl.addEventListener('camera-change', handleCameraChange);
|
|
6439
6882
|
return ()=>{
|
|
6440
6883
|
modelViewerEl.removeEventListener('progress', handleProgress);
|
|
6441
6884
|
modelViewerEl.removeEventListener('load', handleLoad);
|
|
6442
6885
|
modelViewerEl.removeEventListener('error', handleError);
|
|
6886
|
+
modelViewerEl.removeEventListener('camera-change', handleCameraChange);
|
|
6443
6887
|
};
|
|
6444
6888
|
}, [
|
|
6445
|
-
modelViewerEl
|
|
6889
|
+
modelViewerEl,
|
|
6890
|
+
trackEvent,
|
|
6891
|
+
widgetSession
|
|
6446
6892
|
]);
|
|
6447
6893
|
const contextValue = external_react_useMemo(()=>({
|
|
6894
|
+
apiKey,
|
|
6895
|
+
appClipBundleId,
|
|
6896
|
+
arExperience,
|
|
6448
6897
|
tinuuid,
|
|
6449
6898
|
object,
|
|
6450
6899
|
material,
|
|
6451
6900
|
glbUrl,
|
|
6452
6901
|
usdzUrl,
|
|
6453
6902
|
previewUrl,
|
|
6903
|
+
handoffUrl,
|
|
6904
|
+
launchAr,
|
|
6454
6905
|
layout,
|
|
6455
6906
|
background,
|
|
6907
|
+
mode,
|
|
6908
|
+
sizeType,
|
|
6456
6909
|
isLoading,
|
|
6457
6910
|
isModelLoading,
|
|
6458
6911
|
state,
|
|
6459
6912
|
modelViewerEl,
|
|
6460
6913
|
containerEl,
|
|
6914
|
+
widgetSession,
|
|
6461
6915
|
setMaterialHid,
|
|
6462
6916
|
setContainerEl,
|
|
6463
|
-
setModelViewerEl
|
|
6917
|
+
setModelViewerEl,
|
|
6918
|
+
trackEvent
|
|
6464
6919
|
}), [
|
|
6920
|
+
apiKey,
|
|
6921
|
+
appClipBundleId,
|
|
6922
|
+
arExperience,
|
|
6465
6923
|
tinuuid,
|
|
6466
6924
|
object,
|
|
6467
6925
|
material,
|
|
6468
6926
|
glbUrl,
|
|
6469
6927
|
usdzUrl,
|
|
6470
6928
|
previewUrl,
|
|
6929
|
+
handoffUrl,
|
|
6930
|
+
launchAr,
|
|
6471
6931
|
layout,
|
|
6472
6932
|
background,
|
|
6933
|
+
mode,
|
|
6934
|
+
sizeType,
|
|
6473
6935
|
isLoading,
|
|
6474
6936
|
isModelLoading,
|
|
6475
6937
|
state,
|
|
6476
6938
|
modelViewerEl,
|
|
6477
6939
|
containerEl,
|
|
6478
|
-
|
|
6940
|
+
widgetSession,
|
|
6941
|
+
setMaterialHid,
|
|
6942
|
+
trackEvent
|
|
6479
6943
|
]);
|
|
6480
6944
|
return /*#__PURE__*/ jsx(ModelViewerContext, {
|
|
6481
6945
|
value: contextValue,
|
|
@@ -6487,27 +6951,204 @@ function useModelViewer() {
|
|
|
6487
6951
|
if (!context) throw new Error('useModelViewer must be used within a ModelViewerProvider');
|
|
6488
6952
|
return context;
|
|
6489
6953
|
}
|
|
6954
|
+
function getUserAgent() {
|
|
6955
|
+
if ("u" < typeof navigator) return '';
|
|
6956
|
+
return navigator.userAgent || navigator.vendor || '';
|
|
6957
|
+
}
|
|
6958
|
+
function isIOSDevice() {
|
|
6959
|
+
if ("u" < typeof window || "u" < typeof navigator) return false;
|
|
6960
|
+
const isIPadOS = 'MacIntel' === navigator.platform && navigator.maxTouchPoints > 1;
|
|
6961
|
+
return (/iPad|iPhone|iPod/.test(getUserAgent()) || isIPadOS) && !('MSStream' in window);
|
|
6962
|
+
}
|
|
6963
|
+
function isMobileArDevice() {
|
|
6964
|
+
if ("u" < typeof window || "u" < typeof navigator) return false;
|
|
6965
|
+
const mobileUserAgent = /Android|iPhone|iPad|iPod|webOS|BlackBerry|Windows Phone|Opera Mini|IEMobile|Mobile/i.test(getUserAgent());
|
|
6966
|
+
const coarsePointer = window.matchMedia?.('(pointer: coarse)').matches ?? false;
|
|
6967
|
+
return navigator.maxTouchPoints > 1 && coarsePointer && (mobileUserAgent || isIOSDevice());
|
|
6968
|
+
}
|
|
6969
|
+
function isSupportedAppClipDevice() {
|
|
6970
|
+
if (!isIOSDevice()) return false;
|
|
6971
|
+
const versionText = getUserAgent().match(/\bOS (\d+)/)?.[1] ?? getUserAgent().match(/Version\/(\d+)/)?.[1];
|
|
6972
|
+
if (!versionText) return false;
|
|
6973
|
+
return Number.parseInt(versionText, 10) >= 17;
|
|
6974
|
+
}
|
|
6975
|
+
function buildAppClipUrl(bundleId, tinuuid, hostname, hid) {
|
|
6976
|
+
const url = new URL('https://appclip.apple.com/id');
|
|
6977
|
+
url.searchParams.set('p', bundleId);
|
|
6978
|
+
url.searchParams.set('tinuuid', tinuuid);
|
|
6979
|
+
if (hid) url.searchParams.set('hid', hid);
|
|
6980
|
+
url.searchParams.set('region', hostname.endsWith('arizo.ru') ? 'ru' : 'en');
|
|
6981
|
+
return url.toString();
|
|
6982
|
+
}
|
|
6983
|
+
function buildNativeArUrl(glbUrl, usdzUrl, objectType, ios = isIOSDevice()) {
|
|
6984
|
+
if (ios) return `${new URL(usdzUrl).toString()}#allowsContentScaling=0`;
|
|
6985
|
+
const verticalPlacement = 'wall' === objectType || 'ceiling' === objectType ? '&enable_vertical_placement=true' : '';
|
|
6986
|
+
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;`;
|
|
6987
|
+
}
|
|
6988
|
+
function launchDirectAr(options) {
|
|
6989
|
+
if ('advanced' === options.experience && isSupportedAppClipDevice()) return void window.location.assign(buildAppClipUrl(options.appClipBundleId, options.tinuuid, options.hostname, options.hid));
|
|
6990
|
+
const link = document.createElement('a');
|
|
6991
|
+
const image = document.createElement('img');
|
|
6992
|
+
link.rel = 'ar';
|
|
6993
|
+
link.href = buildNativeArUrl(options.glbUrl, options.usdzUrl, options.objectType);
|
|
6994
|
+
link.hidden = true;
|
|
6995
|
+
image.alt = '';
|
|
6996
|
+
image.hidden = true;
|
|
6997
|
+
link.appendChild(image);
|
|
6998
|
+
document.body.appendChild(link);
|
|
6999
|
+
link.click();
|
|
7000
|
+
link.remove();
|
|
7001
|
+
}
|
|
7002
|
+
async function launchArOverride(launchAr, target) {
|
|
7003
|
+
if (!launchAr || !target.tinuuid) return false;
|
|
7004
|
+
try {
|
|
7005
|
+
return await launchAr(target);
|
|
7006
|
+
} catch {
|
|
7007
|
+
return false;
|
|
7008
|
+
}
|
|
7009
|
+
}
|
|
7010
|
+
function buildModelViewerHandoffUrl({ apiKey, arExperience, baseUrl, hid, mode, tinuuid, widgetSessionToken }) {
|
|
7011
|
+
if (!baseUrl || !tinuuid) return null;
|
|
7012
|
+
let url;
|
|
7013
|
+
try {
|
|
7014
|
+
url = new URL(baseUrl);
|
|
7015
|
+
} catch {
|
|
7016
|
+
return null;
|
|
7017
|
+
}
|
|
7018
|
+
url.searchParams.set('tinuuid', tinuuid);
|
|
7019
|
+
url.searchParams.set('mode', mode);
|
|
7020
|
+
if (arExperience) url.searchParams.set('ar-experience', arExperience);
|
|
7021
|
+
else url.searchParams.delete('ar-experience');
|
|
7022
|
+
if (hid) url.searchParams.set('hid', hid);
|
|
7023
|
+
else url.searchParams.delete('hid');
|
|
7024
|
+
const fragment = new URLSearchParams(url.hash.slice(1));
|
|
7025
|
+
if (apiKey) fragment.set('api-key', apiKey);
|
|
7026
|
+
else fragment.delete('api-key');
|
|
7027
|
+
if (widgetSessionToken) fragment.set('widget-session-token', widgetSessionToken);
|
|
7028
|
+
else fragment.delete('widget-session-token');
|
|
7029
|
+
url.hash = fragment.toString();
|
|
7030
|
+
return url.toString();
|
|
7031
|
+
}
|
|
7032
|
+
const EVENT_FLUSH_TIMEOUT_MS = 300;
|
|
7033
|
+
async function flushWidgetEvent(eventRequest) {
|
|
7034
|
+
await new Promise((resolve)=>{
|
|
7035
|
+
const timeout = window.setTimeout(resolve, EVENT_FLUSH_TIMEOUT_MS);
|
|
7036
|
+
eventRequest.finally(()=>{
|
|
7037
|
+
window.clearTimeout(timeout);
|
|
7038
|
+
resolve();
|
|
7039
|
+
});
|
|
7040
|
+
});
|
|
7041
|
+
}
|
|
6490
7042
|
function AR({ disabled, onClick, onBeforeActivateAr, size = 'lg', ...props }) {
|
|
6491
|
-
const { containerEl, isLoading, isModelLoading, material, modelViewerEl, object, tinuuid } = useModelViewer();
|
|
7043
|
+
const { apiKey, appClipBundleId, arExperience, containerEl, handoffUrl, isLoading, isModelLoading, launchAr, material, mode, modelViewerEl, object, tinuuid, trackEvent, widgetSession } = useModelViewer();
|
|
7044
|
+
const [handoffSession, setHandoffSession] = useState(null);
|
|
6492
7045
|
const [open, setOpen] = useState(false);
|
|
7046
|
+
const autoLaunchKeyRef = useRef(null);
|
|
7047
|
+
const widgetSessionSid = widgetSession?.sid;
|
|
7048
|
+
const widgetSessionToken = widgetSession?.token;
|
|
6493
7049
|
const isDisabled = isLoading || isModelLoading || null === material;
|
|
6494
|
-
const
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
if (material?.hid) url.searchParams.set('hid', material.hid);
|
|
6499
|
-
return url.toString();
|
|
6500
|
-
}, [
|
|
7050
|
+
const arTarget = external_react_useMemo(()=>({
|
|
7051
|
+
hid: material?.hid,
|
|
7052
|
+
tinuuid: object?.tinuuid ?? tinuuid
|
|
7053
|
+
}), [
|
|
6501
7054
|
material?.hid,
|
|
6502
7055
|
object?.tinuuid,
|
|
6503
7056
|
tinuuid
|
|
6504
7057
|
]);
|
|
7058
|
+
const directArExperience = 'ar-view' === mode ? 'standard' : 'advanced-ar-view' === mode ? 'advanced' : 'qr-code' === mode ? arExperience : void 0;
|
|
7059
|
+
const directArLaunchOptions = external_react_useMemo(()=>{
|
|
7060
|
+
const native = material?.native;
|
|
7061
|
+
if (!directArExperience || !object || !native?.glbUrl || !native.usdzUrl || "u" < typeof window) return null;
|
|
7062
|
+
return {
|
|
7063
|
+
appClipBundleId,
|
|
7064
|
+
experience: directArExperience,
|
|
7065
|
+
glbUrl: native.glbUrl,
|
|
7066
|
+
hid: material?.hid,
|
|
7067
|
+
hostname: window.location.hostname,
|
|
7068
|
+
objectType: object.type,
|
|
7069
|
+
tinuuid: object.tinuuid ?? tinuuid,
|
|
7070
|
+
usdzUrl: native.usdzUrl
|
|
7071
|
+
};
|
|
7072
|
+
}, [
|
|
7073
|
+
appClipBundleId,
|
|
7074
|
+
directArExperience,
|
|
7075
|
+
material?.hid,
|
|
7076
|
+
material?.native,
|
|
7077
|
+
object,
|
|
7078
|
+
tinuuid
|
|
7079
|
+
]);
|
|
7080
|
+
const url = external_react_useMemo(()=>buildModelViewerHandoffUrl({
|
|
7081
|
+
apiKey,
|
|
7082
|
+
arExperience,
|
|
7083
|
+
baseUrl: handoffUrl || MODEL_VIEWER_URL,
|
|
7084
|
+
hid: material?.hid,
|
|
7085
|
+
mode,
|
|
7086
|
+
tinuuid: object?.tinuuid ?? tinuuid,
|
|
7087
|
+
widgetSessionToken: handoffSession && handoffSession.sid === widgetSessionSid ? handoffSession.token : widgetSessionToken
|
|
7088
|
+
}), [
|
|
7089
|
+
apiKey,
|
|
7090
|
+
arExperience,
|
|
7091
|
+
handoffSession,
|
|
7092
|
+
handoffUrl,
|
|
7093
|
+
material?.hid,
|
|
7094
|
+
mode,
|
|
7095
|
+
object?.tinuuid,
|
|
7096
|
+
tinuuid,
|
|
7097
|
+
widgetSessionSid,
|
|
7098
|
+
widgetSessionToken
|
|
7099
|
+
]);
|
|
7100
|
+
useEffect(()=>{
|
|
7101
|
+
if (!directArLaunchOptions || isLoading || !isMobileArDevice()) return;
|
|
7102
|
+
const launchKey = [
|
|
7103
|
+
widgetSessionSid ?? 'legacy',
|
|
7104
|
+
directArLaunchOptions.tinuuid,
|
|
7105
|
+
material?.hid,
|
|
7106
|
+
directArLaunchOptions.experience
|
|
7107
|
+
].join(':');
|
|
7108
|
+
if (autoLaunchKeyRef.current === launchKey) return;
|
|
7109
|
+
autoLaunchKeyRef.current = launchKey;
|
|
7110
|
+
const timer = window.setTimeout(()=>{
|
|
7111
|
+
(async ()=>{
|
|
7112
|
+
if (autoLaunchKeyRef.current !== launchKey) return;
|
|
7113
|
+
if (await launchArOverride(launchAr, arTarget)) return;
|
|
7114
|
+
await flushWidgetEvent(trackEvent('ar_launched'));
|
|
7115
|
+
if (autoLaunchKeyRef.current === launchKey) launchDirectAr(directArLaunchOptions);
|
|
7116
|
+
})();
|
|
7117
|
+
}, 0);
|
|
7118
|
+
return ()=>{
|
|
7119
|
+
window.clearTimeout(timer);
|
|
7120
|
+
if (autoLaunchKeyRef.current === launchKey) autoLaunchKeyRef.current = null;
|
|
7121
|
+
};
|
|
7122
|
+
}, [
|
|
7123
|
+
arTarget,
|
|
7124
|
+
directArLaunchOptions,
|
|
7125
|
+
isLoading,
|
|
7126
|
+
launchAr,
|
|
7127
|
+
material?.hid,
|
|
7128
|
+
trackEvent,
|
|
7129
|
+
widgetSessionSid
|
|
7130
|
+
]);
|
|
6505
7131
|
const handleClick = async ()=>{
|
|
6506
7132
|
if (!modelViewerEl || isDisabled) return;
|
|
6507
|
-
if (
|
|
7133
|
+
if (await launchArOverride(launchAr, arTarget)) return void onBeforeActivateAr?.();
|
|
7134
|
+
if (directArLaunchOptions && isMobileArDevice()) {
|
|
6508
7135
|
onBeforeActivateAr?.();
|
|
7136
|
+
await flushWidgetEvent(trackEvent('ar_launched'));
|
|
7137
|
+
launchDirectAr(directArLaunchOptions);
|
|
7138
|
+
} else if (modelViewerEl.canActivateAR) {
|
|
7139
|
+
onBeforeActivateAr?.();
|
|
7140
|
+
await flushWidgetEvent(trackEvent('ar_launched'));
|
|
6509
7141
|
await modelViewerEl.activateAR();
|
|
6510
|
-
} else if (url)
|
|
7142
|
+
} else if (url) {
|
|
7143
|
+
const activeSession = widgetSession;
|
|
7144
|
+
const sessionToken = await activeSession?.getTokenForRequest().catch(()=>activeSession.token);
|
|
7145
|
+
setHandoffSession(activeSession && sessionToken ? {
|
|
7146
|
+
sid: activeSession.sid,
|
|
7147
|
+
token: sessionToken
|
|
7148
|
+
} : null);
|
|
7149
|
+
trackEvent('interacted');
|
|
7150
|
+
setOpen(true);
|
|
7151
|
+
}
|
|
6511
7152
|
};
|
|
6512
7153
|
const handleButtonClick = async (event)=>{
|
|
6513
7154
|
onClick?.(event);
|
|
@@ -6542,6 +7183,10 @@ function AR({ disabled, onClick, onBeforeActivateAr, size = 'lg', ...props }) {
|
|
|
6542
7183
|
className: "text-center text-lg font-medium text-text-sub",
|
|
6543
7184
|
children: "Scan the QR code with your phone or tablet to view the object in your interior."
|
|
6544
7185
|
}),
|
|
7186
|
+
/*#__PURE__*/ jsx("p", {
|
|
7187
|
+
className: "text-center text-xs text-text-light",
|
|
7188
|
+
children: AR_DEVICE_REQUIREMENTS_DISCLAIMER
|
|
7189
|
+
}),
|
|
6545
7190
|
/*#__PURE__*/ jsx(DialogClose, {
|
|
6546
7191
|
asChild: true,
|
|
6547
7192
|
children: /*#__PURE__*/ jsx(button_Button, {
|
|
@@ -6926,6 +7571,7 @@ function MaterialVariants() {
|
|
|
6926
7571
|
});
|
|
6927
7572
|
}
|
|
6928
7573
|
const viewerErrorTitle = {
|
|
7574
|
+
forbidden: 'Viewer unavailable for this domain',
|
|
6929
7575
|
'not-found': 'Object not found',
|
|
6930
7576
|
unauthorized: 'Invalid API key',
|
|
6931
7577
|
'payment-required': 'Viewer temporarily unavailable'
|
|
@@ -6993,14 +7639,14 @@ function getHotspotConfig(slot) {
|
|
|
6993
7639
|
if (!config) throw new Error(`Missing hotspot config for slot "${slot}"`);
|
|
6994
7640
|
return config;
|
|
6995
7641
|
}
|
|
6996
|
-
function createDimensionLabels(modelViewerEl) {
|
|
7642
|
+
function createDimensionLabels(modelViewerEl, sizeType) {
|
|
6997
7643
|
const info = calculateBoundingBoxInfo(modelViewerEl);
|
|
6998
7644
|
return DIMENSION_LABEL_CONFIGS.map(({ slot, sizeAxis, offsetMultiplier })=>{
|
|
6999
7645
|
const hotspotConfig = getHotspotConfig(slot);
|
|
7000
7646
|
return {
|
|
7001
7647
|
name: slot,
|
|
7002
7648
|
position: calculateDimensionLabelPosition(info, hotspotConfig, offsetMultiplier),
|
|
7003
|
-
text: formatSize(info.size[sizeAxis],
|
|
7649
|
+
text: formatSize(info.size[sizeAxis], sizeType)
|
|
7004
7650
|
};
|
|
7005
7651
|
});
|
|
7006
7652
|
}
|
|
@@ -7013,7 +7659,7 @@ function syncLabelHotspots(modelViewerEl, labels) {
|
|
|
7013
7659
|
});
|
|
7014
7660
|
}
|
|
7015
7661
|
function useDimensions({ isVisible }) {
|
|
7016
|
-
const { glbUrl, isModelLoading, modelViewerEl } = useModelViewer();
|
|
7662
|
+
const { glbUrl, isModelLoading, modelViewerEl, sizeType } = useModelViewer();
|
|
7017
7663
|
const [lines, setLines] = useState([]);
|
|
7018
7664
|
const [labels, setLabels] = useState([]);
|
|
7019
7665
|
const [hiddenHotspots, setHiddenHotspots] = useState(()=>new Set());
|
|
@@ -7030,7 +7676,7 @@ function useDimensions({ isVisible }) {
|
|
|
7030
7676
|
]);
|
|
7031
7677
|
const calculateLabels = useCallback(()=>{
|
|
7032
7678
|
if (!modelViewerEl) return [];
|
|
7033
|
-
const dimensionLabels = createDimensionLabels(modelViewerEl);
|
|
7679
|
+
const dimensionLabels = createDimensionLabels(modelViewerEl, sizeType);
|
|
7034
7680
|
syncLabelHotspots(modelViewerEl, dimensionLabels);
|
|
7035
7681
|
return dimensionLabels.map((label)=>({
|
|
7036
7682
|
slot: label.name,
|
|
@@ -7038,7 +7684,8 @@ function useDimensions({ isVisible }) {
|
|
|
7038
7684
|
position: label.position
|
|
7039
7685
|
}));
|
|
7040
7686
|
}, [
|
|
7041
|
-
modelViewerEl
|
|
7687
|
+
modelViewerEl,
|
|
7688
|
+
sizeType
|
|
7042
7689
|
]);
|
|
7043
7690
|
const updateLines = useCallback(()=>{
|
|
7044
7691
|
if (!modelViewerEl) return;
|
|
@@ -7111,7 +7758,7 @@ function useDimensions({ isVisible }) {
|
|
|
7111
7758
|
};
|
|
7112
7759
|
}
|
|
7113
7760
|
function ModelViewerContainer({ showDialogCloseButton = false }) {
|
|
7114
|
-
const { glbUrl, isModelLoading, object, previewUrl, state, setContainerEl, setModelViewerEl, usdzUrl, layout, background } = useModelViewer();
|
|
7761
|
+
const { glbUrl, isModelLoading, object, previewUrl, state, setContainerEl, setModelViewerEl, usdzUrl, layout, background, trackEvent } = useModelViewer();
|
|
7115
7762
|
const [isDimensionsVisible, setDimensionsVisible] = useState(false);
|
|
7116
7763
|
const isModelLayout = 'model' === layout;
|
|
7117
7764
|
const showViewerLoader = 'loading' === state || 'ready' === state && isModelLoading;
|
|
@@ -7122,7 +7769,7 @@ function ModelViewerContainer({ showDialogCloseButton = false }) {
|
|
|
7122
7769
|
const { lines, labels, hiddenHotspots } = useDimensions({
|
|
7123
7770
|
isVisible: isDimensionsActive
|
|
7124
7771
|
});
|
|
7125
|
-
const errorState = 'not-found' === state || 'unauthorized' === state || 'payment-required' === state ? state : null;
|
|
7772
|
+
const errorState = 'forbidden' === state || 'not-found' === state || 'unauthorized' === state || 'payment-required' === state ? state : null;
|
|
7126
7773
|
if (errorState) return /*#__PURE__*/ jsx("div", {
|
|
7127
7774
|
ref: setContainerEl,
|
|
7128
7775
|
className: utils_cn('relative size-full overflow-hidden text-foreground', 'default' === background && 'bg-background-layout'),
|
|
@@ -7195,7 +7842,10 @@ function ModelViewerContainer({ showDialogCloseButton = false }) {
|
|
|
7195
7842
|
disabled: !canToggleDimensions,
|
|
7196
7843
|
"aria-label": "Toggle dimensions",
|
|
7197
7844
|
"aria-pressed": isDimensionsVisible,
|
|
7198
|
-
onClick: ()=>
|
|
7845
|
+
onClick: ()=>{
|
|
7846
|
+
setDimensionsVisible((current)=>!current);
|
|
7847
|
+
trackEvent('interacted');
|
|
7848
|
+
},
|
|
7199
7849
|
children: [
|
|
7200
7850
|
isDimensionsVisible ? /*#__PURE__*/ jsx(Eye, {
|
|
7201
7851
|
className: "size-6"
|
|
@@ -7220,7 +7870,7 @@ function ModelViewerContainer({ showDialogCloseButton = false }) {
|
|
|
7220
7870
|
});
|
|
7221
7871
|
}
|
|
7222
7872
|
function normalizeApiKey(apiKey) {
|
|
7223
|
-
return apiKey
|
|
7873
|
+
return apiKey?.trim() ?? '';
|
|
7224
7874
|
}
|
|
7225
7875
|
const root_queryClient = new QueryClient({
|
|
7226
7876
|
defaultOptions: {
|
|
@@ -7237,26 +7887,33 @@ const root_queryClient = new QueryClient({
|
|
|
7237
7887
|
}
|
|
7238
7888
|
}
|
|
7239
7889
|
});
|
|
7240
|
-
function ModelViewerRoot({ tinuuid, apiKey, hid, layout = 'default', background = 'default', showDialogCloseButton = false }) {
|
|
7890
|
+
function ModelViewerRoot({ tinuuid, apiKey, appClipBundleId = 'com.us.vizbl.Clip', arExperience, hid, apiBaseUrl = "https://api.vizbl.com", legacyApiBaseUrl = "https://api.vizbl.com/v1", mode = 'embedded-3d-viewer', initialWidgetSessionToken, handoffUrl = "https://integrations.vizbl.com/model-viewer", launchAr, sizeType = 'cm', layout = 'default', background = 'default', showDialogCloseButton = false, viewerSurface = 'inline' }) {
|
|
7241
7891
|
const normalizedApiKey = normalizeApiKey(apiKey);
|
|
7242
7892
|
return /*#__PURE__*/ jsx(QueryClientProvider, {
|
|
7243
7893
|
client: root_queryClient,
|
|
7244
7894
|
children: /*#__PURE__*/ jsx(ModelViewerProvider, {
|
|
7245
7895
|
tinuuid: tinuuid,
|
|
7246
7896
|
apiKey: normalizedApiKey,
|
|
7897
|
+
appClipBundleId: appClipBundleId,
|
|
7898
|
+
arExperience: arExperience,
|
|
7899
|
+
apiBaseUrl: apiBaseUrl,
|
|
7900
|
+
legacyApiBaseUrl: legacyApiBaseUrl,
|
|
7901
|
+
mode: mode,
|
|
7902
|
+
initialWidgetSessionToken: initialWidgetSessionToken,
|
|
7903
|
+
handoffUrl: handoffUrl,
|
|
7247
7904
|
hid: hid,
|
|
7905
|
+
launchAr: launchAr,
|
|
7248
7906
|
layout: layout,
|
|
7249
7907
|
background: background,
|
|
7908
|
+
sizeType: sizeType,
|
|
7909
|
+
viewerSurface: viewerSurface,
|
|
7250
7910
|
children: /*#__PURE__*/ jsx(ModelViewerContainer, {
|
|
7251
7911
|
showDialogCloseButton: showDialogCloseButton
|
|
7252
7912
|
})
|
|
7253
7913
|
})
|
|
7254
7914
|
});
|
|
7255
7915
|
}
|
|
7256
|
-
|
|
7257
|
-
baseURL: "https://api.vizbl.com"
|
|
7258
|
-
});
|
|
7259
|
-
function ModelViewerDialog({ tinuuid, apiKey, hid, ...props }) {
|
|
7916
|
+
function ModelViewerDialog({ tinuuid, apiKey, apiBaseUrl, legacyApiBaseUrl, initialWidgetSessionToken, handoffUrl, hid, sizeType, ...props }) {
|
|
7260
7917
|
const [container, setContainer] = useState(null);
|
|
7261
7918
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
7262
7919
|
children: [
|
|
@@ -7269,7 +7926,7 @@ function ModelViewerDialog({ tinuuid, apiKey, hid, ...props }) {
|
|
|
7269
7926
|
children: /*#__PURE__*/ jsx(Dialog, {
|
|
7270
7927
|
...props,
|
|
7271
7928
|
children: /*#__PURE__*/ jsxs(DialogContent, {
|
|
7272
|
-
className: "min-w-full h-
|
|
7929
|
+
className: "min-w-full h-dvh p-0 rounded-none sm:p-0",
|
|
7273
7930
|
portalContainer: container,
|
|
7274
7931
|
showCloseButton: false,
|
|
7275
7932
|
onInteractOutside: (e)=>{
|
|
@@ -7290,8 +7947,15 @@ function ModelViewerDialog({ tinuuid, apiKey, hid, ...props }) {
|
|
|
7290
7947
|
/*#__PURE__*/ jsx(ModelViewerRoot, {
|
|
7291
7948
|
tinuuid: tinuuid,
|
|
7292
7949
|
apiKey: apiKey,
|
|
7950
|
+
apiBaseUrl: apiBaseUrl,
|
|
7951
|
+
legacyApiBaseUrl: legacyApiBaseUrl,
|
|
7952
|
+
mode: "ar-viewer",
|
|
7953
|
+
initialWidgetSessionToken: initialWidgetSessionToken,
|
|
7954
|
+
handoffUrl: handoffUrl,
|
|
7293
7955
|
hid: hid,
|
|
7294
|
-
|
|
7956
|
+
sizeType: sizeType,
|
|
7957
|
+
showDialogCloseButton: true,
|
|
7958
|
+
viewerSurface: "dialog"
|
|
7295
7959
|
})
|
|
7296
7960
|
]
|
|
7297
7961
|
})
|
|
@@ -7315,7 +7979,7 @@ function ModelViewerDialog({ tinuuid, apiKey, hid, ...props }) {
|
|
|
7315
7979
|
]
|
|
7316
7980
|
});
|
|
7317
7981
|
}
|
|
7318
|
-
function ModelViewer({ tinuuid, apiKey, hid, layout, background, className, ...props }) {
|
|
7982
|
+
function ModelViewer({ tinuuid, apiKey, appClipBundleId, arExperience, hid, apiBaseUrl, legacyApiBaseUrl, mode, initialWidgetSessionToken, handoffUrl, launchAr, sizeType, layout, background, viewerSurface, className, ...props }) {
|
|
7319
7983
|
const [container, setContainer] = useState(null);
|
|
7320
7984
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
7321
7985
|
children: [
|
|
@@ -7346,9 +8010,19 @@ function ModelViewer({ tinuuid, apiKey, hid, layout, background, className, ...p
|
|
|
7346
8010
|
children: /*#__PURE__*/ jsx(ModelViewerRoot, {
|
|
7347
8011
|
tinuuid: tinuuid,
|
|
7348
8012
|
apiKey: apiKey,
|
|
8013
|
+
appClipBundleId: appClipBundleId,
|
|
8014
|
+
arExperience: arExperience,
|
|
8015
|
+
apiBaseUrl: apiBaseUrl,
|
|
8016
|
+
legacyApiBaseUrl: legacyApiBaseUrl,
|
|
8017
|
+
mode: mode,
|
|
8018
|
+
initialWidgetSessionToken: initialWidgetSessionToken,
|
|
8019
|
+
handoffUrl: handoffUrl,
|
|
7349
8020
|
hid: hid,
|
|
8021
|
+
launchAr: launchAr,
|
|
8022
|
+
sizeType: sizeType,
|
|
7350
8023
|
layout: layout,
|
|
7351
|
-
background: background
|
|
8024
|
+
background: background,
|
|
8025
|
+
viewerSurface: viewerSurface
|
|
7352
8026
|
})
|
|
7353
8027
|
})
|
|
7354
8028
|
})
|