@luxfi/ui 8.2.7 → 8.2.8
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/3d-model-viewer.cjs +25 -421
- package/dist/3d-model-viewer.js +20 -416
- package/dist/accordion.cjs +3 -10
- package/dist/accordion.js +2 -10
- package/dist/advanced-navigation-bar.cjs +5 -401
- package/dist/advanced-navigation-bar.js +5 -401
- package/dist/ai-agents.cjs +45 -890
- package/dist/ai-agents.js +8 -834
- package/dist/ai-assistant.cjs +13 -740
- package/dist/ai-assistant.js +10 -738
- package/dist/ai-chat.cjs +24 -770
- package/dist/ai-chat.js +18 -765
- package/dist/ai-code.cjs +67 -923
- package/dist/ai-code.js +49 -905
- package/dist/ai-playground.cjs +25 -801
- package/dist/ai-playground.js +18 -795
- package/dist/ai-tools.cjs +22 -767
- package/dist/ai-tools.js +15 -761
- package/dist/ai-vision.cjs +41 -993
- package/dist/ai-vision.js +30 -983
- package/dist/ai-voice-settings.cjs +35 -1006
- package/dist/ai-voice-settings.js +32 -1004
- package/dist/ai-voice.cjs +51 -1024
- package/dist/ai-voice.js +9 -963
- package/dist/alert.cjs +11 -129
- package/dist/alert.js +8 -127
- package/dist/announcement.cjs +6 -402
- package/dist/announcement.js +6 -402
- package/dist/app-switcher-navigation-bar.cjs +5 -401
- package/dist/app-switcher-navigation-bar.js +5 -401
- package/dist/apple-cards-carousel.cjs +84 -480
- package/dist/apple-cards-carousel.js +19 -415
- package/dist/auth.cjs +10 -387
- package/dist/auth.js +7 -385
- package/dist/avatar.cjs +2 -9
- package/dist/avatar.js +2 -10
- package/dist/badge.cjs +8 -228
- package/dist/badge.js +5 -210
- package/dist/button.cjs +14 -67
- package/dist/button.js +12 -65
- package/dist/chrome.cjs +29 -493
- package/dist/chrome.js +9 -474
- package/dist/code-block.cjs +16 -664
- package/dist/code-block.js +13 -662
- package/dist/code-compare.cjs +28 -1302
- package/dist/code-compare.js +18 -1293
- package/dist/code-diff.cjs +21 -669
- package/dist/code-diff.js +17 -666
- package/dist/code-editor.cjs +13 -409
- package/dist/code-editor.js +12 -408
- package/dist/code-explorer.cjs +14 -456
- package/dist/code-explorer.js +13 -456
- package/dist/code-preview.cjs +31 -983
- package/dist/code-preview.js +23 -976
- package/dist/code-snippet.cjs +19 -667
- package/dist/code-snippet.js +14 -663
- package/dist/code-terminal.cjs +24 -485
- package/dist/code-terminal.js +19 -481
- package/dist/collapsible.cjs +13 -347
- package/dist/collapsible.js +11 -330
- package/dist/color-picker.cjs +8 -450
- package/dist/color-picker.js +7 -450
- package/dist/combobox.cjs +6 -402
- package/dist/combobox.js +6 -402
- package/dist/communication-navigation-bar.cjs +7 -403
- package/dist/communication-navigation-bar.js +5 -401
- package/dist/dashboard-navigation-bar.cjs +6 -402
- package/dist/dashboard-navigation-bar.js +5 -401
- package/dist/dialog-stack.cjs +5 -401
- package/dist/dialog-stack.js +5 -401
- package/dist/dialog.cjs +13 -70
- package/dist/dialog.js +13 -70
- package/dist/drawer.cjs +23 -99
- package/dist/drawer.js +19 -96
- package/dist/e-commerce-navigation-bar.cjs +7 -403
- package/dist/e-commerce-navigation-bar.js +5 -401
- package/dist/editor.cjs +9 -405
- package/dist/editor.js +6 -402
- package/dist/iam.cjs +2 -123
- package/dist/iam.js +1 -122
- package/dist/icon-button.cjs +2 -56
- package/dist/icon-button.js +1 -55
- package/dist/identity.cjs +28 -242
- package/dist/identity.js +20 -235
- package/dist/image-crop.cjs +10 -406
- package/dist/image-crop.js +7 -403
- package/dist/image.cjs +14 -83
- package/dist/image.js +13 -67
- package/dist/index.cjs +1868 -38770
- package/dist/index.js +174 -38320
- package/dist/input-group.cjs +3 -10
- package/dist/input-group.js +2 -10
- package/dist/item.cjs +2 -27
- package/dist/item.js +1 -22
- package/dist/kanban.cjs +25 -751
- package/dist/kanban.js +15 -742
- package/dist/limelight-nav.cjs +10 -452
- package/dist/limelight-nav.js +9 -452
- package/dist/link.cjs +11 -80
- package/dist/link.js +6 -60
- package/dist/lux.config.cjs +14 -32
- package/dist/lux.config.js +3 -26
- package/dist/menu.cjs +5 -13
- package/dist/menu.js +1 -9
- package/dist/message-dock.cjs +5 -401
- package/dist/message-dock.js +5 -401
- package/dist/mini-calendar.cjs +7 -403
- package/dist/mini-calendar.js +6 -402
- package/dist/music-player.cjs +30 -528
- package/dist/music-player.js +22 -520
- package/dist/next.cjs +8 -89
- package/dist/next.js +3 -86
- package/dist/popover.cjs +17 -74
- package/dist/popover.js +16 -73
- package/dist/progress-circle.cjs +3 -10
- package/dist/progress-circle.js +2 -10
- package/dist/provider.cjs +7 -176
- package/dist/provider.js +4 -174
- package/dist/select.cjs +36 -89
- package/dist/select.js +35 -88
- package/dist/sidebar.cjs +22 -493
- package/dist/sidebar.js +17 -489
- package/dist/site/commerce/ui/context.cjs +9 -214
- package/dist/site/commerce/ui/context.js +6 -215
- package/dist/site/components/analytics.cjs +2 -42
- package/dist/site/components/analytics.js +1 -37
- package/dist/site/components/auth/callback.cjs +2 -8
- package/dist/site/components/auth/callback.js +1 -7
- package/dist/site/components/auth/login-panel.cjs +15 -74
- package/dist/site/components/auth/login-panel.js +12 -73
- package/dist/site/components/auth/login.cjs +2 -6
- package/dist/site/components/auth/login.js +1 -5
- package/dist/site/components/auth/widget.cjs +2 -6
- package/dist/site/components/auth/widget.js +1 -5
- package/dist/site/components/commerce/bag-button.cjs +2 -3
- package/dist/site/components/commerce/bag-button.js +2 -3
- package/dist/site/components/commerce/buy-button.cjs +2 -11
- package/dist/site/components/commerce/buy-button.js +1 -10
- package/dist/site/components/commerce/checkout-button.cjs +2 -3
- package/dist/site/components/commerce/checkout-button.js +2 -3
- package/dist/site/components/commerce/checkout-panel/desktop-cp.cjs +15 -173
- package/dist/site/components/commerce/checkout-panel/desktop-cp.js +14 -174
- package/dist/site/components/commerce/checkout-panel/index.cjs +9 -400
- package/dist/site/components/commerce/checkout-panel/index.js +10 -403
- package/dist/site/components/commerce/checkout-panel/mobile-cp.cjs +15 -236
- package/dist/site/components/commerce/checkout-panel/mobile-cp.js +13 -237
- package/dist/site/components/commerce/desktop-bag-popup.cjs +7 -8
- package/dist/site/components/commerce/desktop-bag-popup.js +3 -8
- package/dist/site/components/commerce/drawer/index.cjs +15 -289
- package/dist/site/components/commerce/drawer/index.js +10 -290
- package/dist/site/components/commerce/drawer/micro.cjs +8 -115
- package/dist/site/components/commerce/drawer/micro.js +4 -115
- package/dist/site/components/commerce/drawer/shell.cjs +2 -10
- package/dist/site/components/commerce/drawer/shell.js +2 -10
- package/dist/site/components/contact-dialog/index.cjs +6 -69
- package/dist/site/components/contact-dialog/index.js +7 -71
- package/dist/site/components/drawer-margin.cjs +2 -10
- package/dist/site/components/drawer-margin.js +2 -10
- package/dist/site/components/footer.cjs +11 -81
- package/dist/site/components/footer.js +8 -80
- package/dist/site/components/header/desktop.cjs +18 -374
- package/dist/site/components/header/desktop.js +12 -355
- package/dist/site/components/header/index.cjs +9 -674
- package/dist/site/components/header/index.js +8 -657
- package/dist/site/components/header/mobile-bag-drawer.cjs +6 -71
- package/dist/site/components/header/mobile-bag-drawer.js +5 -74
- package/dist/site/components/header/mobile-nav-menu-ai.cjs +25 -28
- package/dist/site/components/header/mobile-nav-menu-ai.js +24 -27
- package/dist/site/components/header/mobile-nav-menu-item.cjs +6 -60
- package/dist/site/components/header/mobile-nav-menu-item.js +6 -61
- package/dist/site/components/header/mobile-nav-menu.cjs +7 -110
- package/dist/site/components/header/mobile-nav-menu.js +7 -112
- package/dist/site/components/header/mobile.cjs +48 -330
- package/dist/site/components/header/mobile.js +42 -330
- package/dist/site/components/icons/index.cjs +34 -35
- package/dist/site/components/icons/index.js +5 -33
- package/dist/site/components/index.cjs +118 -1961
- package/dist/site/components/index.js +23 -1951
- package/dist/site/components/mini-chart/index.cjs +7 -90
- package/dist/site/components/mini-chart/index.js +1 -92
- package/dist/site/components/mini-chart/wrapper.cjs +7 -76
- package/dist/site/components/mini-chart/wrapper.js +4 -77
- package/dist/site/components/not-found/index.cjs +9 -819
- package/dist/site/components/not-found/index.js +8 -802
- package/dist/site/components/security/index.cjs +9 -819
- package/dist/site/components/security/index.js +8 -802
- package/dist/site/next/analytics/index.cjs +16 -49
- package/dist/site/next/analytics/index.js +3 -49
- package/dist/site/next/analytics/pixel-analytics.cjs +23 -8
- package/dist/site/next/analytics/pixel-analytics.js +4 -8
- package/dist/site/next/index.cjs +13 -140
- package/dist/site/next/index.js +2 -140
- package/dist/site/root-layout/index.cjs +12 -1435
- package/dist/site/root-layout/index.css +0 -133
- package/dist/site/root-layout/index.js +12 -1416
- package/dist/site/site-def/footer/community.cjs +11 -27
- package/dist/site/site-def/footer/community.js +2 -18
- package/dist/site/site-def/footer/index.cjs +38 -218
- package/dist/site/site-def/footer/index.js +14 -215
- package/dist/site/site-def/index.cjs +28 -620
- package/dist/site/site-def/index.js +3 -624
- package/dist/table.cjs +20 -338
- package/dist/table.js +19 -338
- package/dist/tabs.cjs +3 -10
- package/dist/tabs.js +1 -9
- package/dist/tag.cjs +9 -270
- package/dist/tag.js +6 -268
- package/dist/tags.cjs +6 -314
- package/dist/tags.js +5 -314
- package/dist/textarea.cjs +4 -50
- package/dist/textarea.js +3 -49
- package/dist/tooltip.cjs +15 -34
- package/dist/tooltip.js +13 -33
- package/dist/vite.cjs +3 -82
- package/dist/vite.js +1 -80
- package/package.json +1 -1
- package/dist/index.css +0 -132
- package/dist/site/components/auth/login-panel.css +0 -4
- package/dist/site/components/commerce/bag-button.css +0 -4
- package/dist/site/components/commerce/checkout-button.css +0 -4
- package/dist/site/components/commerce/checkout-panel/desktop-cp.css +0 -132
- package/dist/site/components/commerce/checkout-panel/index.css +0 -132
- package/dist/site/components/commerce/checkout-panel/mobile-cp.css +0 -132
- package/dist/site/components/commerce/desktop-bag-popup.css +0 -4
- package/dist/site/components/commerce/drawer/index.css +0 -132
- package/dist/site/components/commerce/drawer/micro.css +0 -4
- package/dist/site/components/header/desktop.css +0 -4
- package/dist/site/components/header/index.css +0 -132
- package/dist/site/components/header/mobile-bag-drawer.css +0 -4
- package/dist/site/components/header/mobile-nav-menu-ai.css +0 -132
- package/dist/site/components/header/mobile-nav-menu-item.css +0 -132
- package/dist/site/components/header/mobile-nav-menu.css +0 -132
- package/dist/site/components/header/mobile.css +0 -132
- package/dist/site/components/icons/index.css +0 -4
- package/dist/site/components/index.css +0 -132
- package/dist/site/components/not-found/index.css +0 -132
- package/dist/site/components/security/index.css +0 -132
- package/dist/site/site-def/footer/community.css +0 -4
- package/dist/site/site-def/footer/index.css +0 -4
- package/dist/site/site-def/index.css +0 -4
|
@@ -6,221 +6,16 @@ var mobxReactLite = require('mobx-react-lite');
|
|
|
6
6
|
var navigation = require('next/navigation');
|
|
7
7
|
var usehooksTs = require('usehooks-ts');
|
|
8
8
|
var commerce = require('@hanzo/commerce');
|
|
9
|
-
var
|
|
9
|
+
var store_js = require('./store.js');
|
|
10
|
+
var conf = require('./conf.js');
|
|
10
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var CommerceUIStore = class {
|
|
18
|
-
// points to either this._pointsConfig.md or this._pointsConfig.dt
|
|
19
|
-
constructor(s, conf) {
|
|
20
|
-
this._vHeight = 0;
|
|
21
|
-
this._routeChangedTime = 0;
|
|
22
|
-
this._currentSkuPath = void 0;
|
|
23
|
-
this._closedByUser = false;
|
|
24
|
-
this._checkingOut = void 0;
|
|
25
|
-
this._ignoreStateChange = false;
|
|
26
|
-
this._activePoint = null;
|
|
27
|
-
this._reactionDisposers = [];
|
|
28
|
-
this.initialize = () => {
|
|
29
|
-
this._reactionDisposers.push(mobx.reaction(
|
|
30
|
-
() => this.state,
|
|
31
|
-
(s) => {
|
|
32
|
-
if (this.ignoreStateChange) {
|
|
33
|
-
log(`STATE CHANGE to "${s}" (IGNORED)`);
|
|
34
|
-
this.setIgnoreStateChange(false);
|
|
35
|
-
return;
|
|
36
|
-
} else {
|
|
37
|
-
log(`STATE CHANGE to "${s}" (UI REACTED)`);
|
|
38
|
-
this._syncUIToState(s);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
));
|
|
42
|
-
};
|
|
43
|
-
this.newRoute = () => {
|
|
44
|
-
this.setRouteChangedTime((/* @__PURE__ */ new Date()).getTime());
|
|
45
|
-
this.hideVariants();
|
|
46
|
-
this.setClosedByUser(false);
|
|
47
|
-
};
|
|
48
|
-
this.onActivePointChanged = (newPoint) => {
|
|
49
|
-
log("ON onActivePointChanged: " + newPoint);
|
|
50
|
-
if (newPoint === this._points.micro && this.activePoint === this._points.full) {
|
|
51
|
-
log("ON onActivePointChanged: to MICRO");
|
|
52
|
-
this.setIgnoreStateChange(true);
|
|
53
|
-
this.hideVariants();
|
|
54
|
-
} else if (newPoint === this._points.full && this.activePoint === this._points.micro) {
|
|
55
|
-
log("ON onActivePointChanged: to FULL");
|
|
56
|
-
this.setIgnoreStateChange(true);
|
|
57
|
-
this.showRecentVariants();
|
|
58
|
-
}
|
|
59
|
-
this.setActivePoint(newPoint);
|
|
60
|
-
};
|
|
61
|
-
this.showVariants = (skuPath) => {
|
|
62
|
-
this._service.setCurrentItem(void 0);
|
|
63
|
-
this._currentSkuPath = skuPath;
|
|
64
|
-
this._closedByUser = false;
|
|
65
|
-
};
|
|
66
|
-
this.showRecentVariants = () => {
|
|
67
|
-
const recentItemInfo = this._service.recentItem;
|
|
68
|
-
if (recentItemInfo) {
|
|
69
|
-
this._service.setCurrentItem(void 0);
|
|
70
|
-
this._currentSkuPath = recentItemInfo.item.sku;
|
|
71
|
-
this._closedByUser = false;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
this.hideVariants = () => {
|
|
75
|
-
this._currentSkuPath = void 0;
|
|
76
|
-
};
|
|
77
|
-
this.setClosedByUser = (b) => {
|
|
78
|
-
this._closedByUser = b;
|
|
79
|
-
};
|
|
80
|
-
this.setIgnoreStateChange = (b) => {
|
|
81
|
-
this._ignoreStateChange = b;
|
|
82
|
-
};
|
|
83
|
-
this.setCheckingOut = (b) => {
|
|
84
|
-
this._checkingOut = b;
|
|
85
|
-
};
|
|
86
|
-
this.setActivePoint = (pt) => {
|
|
87
|
-
this._activePoint = pt;
|
|
88
|
-
};
|
|
89
|
-
this.setRouteChangedTime = (t) => {
|
|
90
|
-
this._routeChangedTime = t;
|
|
91
|
-
};
|
|
92
|
-
this._syncUIToState = (s) => {
|
|
93
|
-
log("_syncUIToState: " + s);
|
|
94
|
-
if (s === "micro") {
|
|
95
|
-
this.setActivePoint(this.points[0]);
|
|
96
|
-
} else if (s === "full") {
|
|
97
|
-
this.setActivePoint(this.points[this.points.length - 1]);
|
|
98
|
-
} else {
|
|
99
|
-
this.setActivePoint(null);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
this.setMobile = (b) => {
|
|
103
|
-
log("setMobile: " + b);
|
|
104
|
-
this._points = b ? this._pointsConfig.mb : this._pointsConfig.dt;
|
|
105
|
-
};
|
|
106
|
-
this.setViewportHeight = (v) => {
|
|
107
|
-
this._vHeight = v;
|
|
108
|
-
};
|
|
109
|
-
this.dispose = () => {
|
|
110
|
-
this._reactionDisposers.forEach((d) => {
|
|
111
|
-
d();
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
this._service = s;
|
|
115
|
-
this._pointsConfig = conf;
|
|
116
|
-
this._points = this._pointsConfig.dt;
|
|
117
|
-
mobx.makeObservable(this, {
|
|
118
|
-
_currentSkuPath: mobx.observable,
|
|
119
|
-
_closedByUser: mobx.observable,
|
|
120
|
-
_checkingOut: mobx.observable,
|
|
121
|
-
_activePoint: mobx.observable,
|
|
122
|
-
_points: mobx.observableRef,
|
|
123
|
-
_vHeight: mobx.observable,
|
|
124
|
-
_routeChangedTime: mobx.observable,
|
|
125
|
-
showVariants: mobx.action,
|
|
126
|
-
showRecentVariants: mobx.action,
|
|
127
|
-
hideVariants: mobx.action,
|
|
128
|
-
setClosedByUser: mobx.action,
|
|
129
|
-
setCheckingOut: mobx.action,
|
|
130
|
-
setActivePoint: mobx.action,
|
|
131
|
-
setMobile: mobx.action,
|
|
132
|
-
setViewportHeight: mobx.action,
|
|
133
|
-
setRouteChangedTime: mobx.action,
|
|
134
|
-
activePoint: mobx.computed,
|
|
135
|
-
checkingOut: mobx.computed,
|
|
136
|
-
closedByUser: mobx.computed,
|
|
137
|
-
currentSkuPath: mobx.computed,
|
|
138
|
-
microHeight: mobx.computed,
|
|
139
|
-
modal: mobx.computed,
|
|
140
|
-
points: mobx.computed,
|
|
141
|
-
showRecent: mobx.computed,
|
|
142
|
-
showBuy: mobx.computed,
|
|
143
|
-
showCheckout: mobx.computed,
|
|
144
|
-
snapPointPx: mobx.computed,
|
|
145
|
-
state: mobx.computed,
|
|
146
|
-
open: mobx.computed
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
get currentSkuPath() {
|
|
150
|
-
return this._currentSkuPath;
|
|
151
|
-
}
|
|
152
|
-
get closedByUser() {
|
|
153
|
-
return this._closedByUser;
|
|
154
|
-
}
|
|
155
|
-
get ignoreStateChange() {
|
|
156
|
-
return this._ignoreStateChange;
|
|
157
|
-
}
|
|
158
|
-
get checkingOut() {
|
|
159
|
-
return this._checkingOut;
|
|
160
|
-
}
|
|
161
|
-
get activePoint() {
|
|
162
|
-
return this._activePoint;
|
|
163
|
-
}
|
|
164
|
-
get points() {
|
|
165
|
-
return [this._points.micro, this._points.full];
|
|
166
|
-
}
|
|
167
|
-
get open() {
|
|
168
|
-
log(
|
|
169
|
-
"open(): showCheckout: " + this.showCheckout + " showRecent: " + this.showRecent + " showBuy: " + this.showBuy
|
|
170
|
-
);
|
|
171
|
-
return this._checkingOut !== void 0 && !this._checkingOut && !this.closedByUser && (this.showCheckout || this.showRecent || this.showBuy);
|
|
172
|
-
}
|
|
173
|
-
get state() {
|
|
174
|
-
if (!this.closedByUser && !this._checkingOut) {
|
|
175
|
-
if (this.showBuy) {
|
|
176
|
-
return "full";
|
|
177
|
-
} else if (this.showRecent || this.showCheckout) {
|
|
178
|
-
return "micro";
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
return "closed";
|
|
182
|
-
}
|
|
183
|
-
get showRecent() {
|
|
184
|
-
const recentInfo = this._service.recentItem;
|
|
185
|
-
return !!recentInfo && recentInfo.modified > this._routeChangedTime;
|
|
186
|
-
}
|
|
187
|
-
get showBuy() {
|
|
188
|
-
return !!this.currentSkuPath;
|
|
189
|
-
}
|
|
190
|
-
get showCheckout() {
|
|
191
|
-
return !this._service.cartEmpty;
|
|
192
|
-
}
|
|
193
|
-
get modal() {
|
|
194
|
-
return this.state !== "micro";
|
|
195
|
-
}
|
|
196
|
-
get microHeight() {
|
|
197
|
-
return this._points.micro;
|
|
198
|
-
}
|
|
199
|
-
get isMobile() {
|
|
200
|
-
return this._pointsConfig.mb === this._points;
|
|
201
|
-
}
|
|
202
|
-
get snapPointPx() {
|
|
203
|
-
if (!this._activePoint || this._vHeight === 0) return 0;
|
|
204
|
-
if (typeof this._activePoint === "string") {
|
|
205
|
-
return parseInt(this._activePoint);
|
|
206
|
-
}
|
|
207
|
-
return this._vHeight * this._activePoint;
|
|
208
|
-
}
|
|
209
|
-
};
|
|
13
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
|
|
15
|
+
var conf__default = /*#__PURE__*/_interopDefault(conf);
|
|
210
16
|
|
|
211
|
-
// src/site/commerce/ui/conf.ts
|
|
212
|
-
var conf_default = {
|
|
213
|
-
mb: {
|
|
214
|
-
micro: "72px",
|
|
215
|
-
full: "600px"
|
|
216
|
-
},
|
|
217
|
-
dt: {
|
|
218
|
-
micro: "90px",
|
|
219
|
-
full: "620px"
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
17
|
var DESKTOP_MIN = 768;
|
|
223
|
-
var
|
|
18
|
+
var log = (s) => {
|
|
224
19
|
};
|
|
225
20
|
mobxReactLite.enableStaticRendering(typeof window === "undefined");
|
|
226
21
|
var CommerceUIContext = react.createContext(void 0);
|
|
@@ -235,7 +30,7 @@ var CommerceUIProvider = ({
|
|
|
235
30
|
}) => {
|
|
236
31
|
const cmmc = commerce.useCommerce();
|
|
237
32
|
const pathname = navigation.usePathname();
|
|
238
|
-
const storeRef = react.useRef(new CommerceUIStore(cmmc,
|
|
33
|
+
const storeRef = react.useRef(new store_js.CommerceUIStore(cmmc, conf__default.default));
|
|
239
34
|
const prevPathRef = react.useRef("initial");
|
|
240
35
|
const onResize = () => {
|
|
241
36
|
const width = window.innerWidth;
|
|
@@ -260,7 +55,7 @@ var CommerceUIProvider = ({
|
|
|
260
55
|
}, []);
|
|
261
56
|
react.useEffect(() => {
|
|
262
57
|
const checkingOut = pathname === "/checkout";
|
|
263
|
-
|
|
58
|
+
log("useEffect: prev pathname: " + prevPathRef.current);
|
|
264
59
|
if (storeRef.current.checkingOut === void 0 || storeRef.current._checkingOut !== checkingOut) {
|
|
265
60
|
storeRef.current.setCheckingOut(checkingOut);
|
|
266
61
|
}
|
|
@@ -270,7 +65,7 @@ var CommerceUIProvider = ({
|
|
|
270
65
|
} else if (!checkingOut && prevPathRef.current !== pathname) {
|
|
271
66
|
storeRef.current.newRoute();
|
|
272
67
|
prevPathRef.current = pathname;
|
|
273
|
-
|
|
68
|
+
log("ROUTE CHANGE: " + pathname + ": " + storeRef.current._routeChangedTime);
|
|
274
69
|
}
|
|
275
70
|
}, [pathname]);
|
|
276
71
|
return /* @__PURE__ */ jsxRuntime.jsx(CommerceUIContext.Provider, { value: storeRef.current, children });
|
|
@@ -4,221 +4,12 @@ import { enableStaticRendering } from 'mobx-react-lite';
|
|
|
4
4
|
import { usePathname } from 'next/navigation';
|
|
5
5
|
import { useDebounceCallback } from 'usehooks-ts';
|
|
6
6
|
import { useCommerce } from '@hanzo/commerce';
|
|
7
|
-
import {
|
|
7
|
+
import { CommerceUIStore } from './store.js';
|
|
8
|
+
import conf from './conf.js';
|
|
8
9
|
import { jsx } from 'react/jsx-runtime';
|
|
9
10
|
|
|
10
|
-
var log = (s) => {
|
|
11
|
-
{
|
|
12
|
-
console.log("COMMERCE_UI " + s);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
var CommerceUIStore = class {
|
|
16
|
-
// points to either this._pointsConfig.md or this._pointsConfig.dt
|
|
17
|
-
constructor(s, conf) {
|
|
18
|
-
this._vHeight = 0;
|
|
19
|
-
this._routeChangedTime = 0;
|
|
20
|
-
this._currentSkuPath = void 0;
|
|
21
|
-
this._closedByUser = false;
|
|
22
|
-
this._checkingOut = void 0;
|
|
23
|
-
this._ignoreStateChange = false;
|
|
24
|
-
this._activePoint = null;
|
|
25
|
-
this._reactionDisposers = [];
|
|
26
|
-
this.initialize = () => {
|
|
27
|
-
this._reactionDisposers.push(reaction(
|
|
28
|
-
() => this.state,
|
|
29
|
-
(s) => {
|
|
30
|
-
if (this.ignoreStateChange) {
|
|
31
|
-
log(`STATE CHANGE to "${s}" (IGNORED)`);
|
|
32
|
-
this.setIgnoreStateChange(false);
|
|
33
|
-
return;
|
|
34
|
-
} else {
|
|
35
|
-
log(`STATE CHANGE to "${s}" (UI REACTED)`);
|
|
36
|
-
this._syncUIToState(s);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
));
|
|
40
|
-
};
|
|
41
|
-
this.newRoute = () => {
|
|
42
|
-
this.setRouteChangedTime((/* @__PURE__ */ new Date()).getTime());
|
|
43
|
-
this.hideVariants();
|
|
44
|
-
this.setClosedByUser(false);
|
|
45
|
-
};
|
|
46
|
-
this.onActivePointChanged = (newPoint) => {
|
|
47
|
-
log("ON onActivePointChanged: " + newPoint);
|
|
48
|
-
if (newPoint === this._points.micro && this.activePoint === this._points.full) {
|
|
49
|
-
log("ON onActivePointChanged: to MICRO");
|
|
50
|
-
this.setIgnoreStateChange(true);
|
|
51
|
-
this.hideVariants();
|
|
52
|
-
} else if (newPoint === this._points.full && this.activePoint === this._points.micro) {
|
|
53
|
-
log("ON onActivePointChanged: to FULL");
|
|
54
|
-
this.setIgnoreStateChange(true);
|
|
55
|
-
this.showRecentVariants();
|
|
56
|
-
}
|
|
57
|
-
this.setActivePoint(newPoint);
|
|
58
|
-
};
|
|
59
|
-
this.showVariants = (skuPath) => {
|
|
60
|
-
this._service.setCurrentItem(void 0);
|
|
61
|
-
this._currentSkuPath = skuPath;
|
|
62
|
-
this._closedByUser = false;
|
|
63
|
-
};
|
|
64
|
-
this.showRecentVariants = () => {
|
|
65
|
-
const recentItemInfo = this._service.recentItem;
|
|
66
|
-
if (recentItemInfo) {
|
|
67
|
-
this._service.setCurrentItem(void 0);
|
|
68
|
-
this._currentSkuPath = recentItemInfo.item.sku;
|
|
69
|
-
this._closedByUser = false;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
this.hideVariants = () => {
|
|
73
|
-
this._currentSkuPath = void 0;
|
|
74
|
-
};
|
|
75
|
-
this.setClosedByUser = (b) => {
|
|
76
|
-
this._closedByUser = b;
|
|
77
|
-
};
|
|
78
|
-
this.setIgnoreStateChange = (b) => {
|
|
79
|
-
this._ignoreStateChange = b;
|
|
80
|
-
};
|
|
81
|
-
this.setCheckingOut = (b) => {
|
|
82
|
-
this._checkingOut = b;
|
|
83
|
-
};
|
|
84
|
-
this.setActivePoint = (pt) => {
|
|
85
|
-
this._activePoint = pt;
|
|
86
|
-
};
|
|
87
|
-
this.setRouteChangedTime = (t) => {
|
|
88
|
-
this._routeChangedTime = t;
|
|
89
|
-
};
|
|
90
|
-
this._syncUIToState = (s) => {
|
|
91
|
-
log("_syncUIToState: " + s);
|
|
92
|
-
if (s === "micro") {
|
|
93
|
-
this.setActivePoint(this.points[0]);
|
|
94
|
-
} else if (s === "full") {
|
|
95
|
-
this.setActivePoint(this.points[this.points.length - 1]);
|
|
96
|
-
} else {
|
|
97
|
-
this.setActivePoint(null);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
this.setMobile = (b) => {
|
|
101
|
-
log("setMobile: " + b);
|
|
102
|
-
this._points = b ? this._pointsConfig.mb : this._pointsConfig.dt;
|
|
103
|
-
};
|
|
104
|
-
this.setViewportHeight = (v) => {
|
|
105
|
-
this._vHeight = v;
|
|
106
|
-
};
|
|
107
|
-
this.dispose = () => {
|
|
108
|
-
this._reactionDisposers.forEach((d) => {
|
|
109
|
-
d();
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
this._service = s;
|
|
113
|
-
this._pointsConfig = conf;
|
|
114
|
-
this._points = this._pointsConfig.dt;
|
|
115
|
-
makeObservable(this, {
|
|
116
|
-
_currentSkuPath: observable,
|
|
117
|
-
_closedByUser: observable,
|
|
118
|
-
_checkingOut: observable,
|
|
119
|
-
_activePoint: observable,
|
|
120
|
-
_points: observableRef,
|
|
121
|
-
_vHeight: observable,
|
|
122
|
-
_routeChangedTime: observable,
|
|
123
|
-
showVariants: action,
|
|
124
|
-
showRecentVariants: action,
|
|
125
|
-
hideVariants: action,
|
|
126
|
-
setClosedByUser: action,
|
|
127
|
-
setCheckingOut: action,
|
|
128
|
-
setActivePoint: action,
|
|
129
|
-
setMobile: action,
|
|
130
|
-
setViewportHeight: action,
|
|
131
|
-
setRouteChangedTime: action,
|
|
132
|
-
activePoint: computed,
|
|
133
|
-
checkingOut: computed,
|
|
134
|
-
closedByUser: computed,
|
|
135
|
-
currentSkuPath: computed,
|
|
136
|
-
microHeight: computed,
|
|
137
|
-
modal: computed,
|
|
138
|
-
points: computed,
|
|
139
|
-
showRecent: computed,
|
|
140
|
-
showBuy: computed,
|
|
141
|
-
showCheckout: computed,
|
|
142
|
-
snapPointPx: computed,
|
|
143
|
-
state: computed,
|
|
144
|
-
open: computed
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
get currentSkuPath() {
|
|
148
|
-
return this._currentSkuPath;
|
|
149
|
-
}
|
|
150
|
-
get closedByUser() {
|
|
151
|
-
return this._closedByUser;
|
|
152
|
-
}
|
|
153
|
-
get ignoreStateChange() {
|
|
154
|
-
return this._ignoreStateChange;
|
|
155
|
-
}
|
|
156
|
-
get checkingOut() {
|
|
157
|
-
return this._checkingOut;
|
|
158
|
-
}
|
|
159
|
-
get activePoint() {
|
|
160
|
-
return this._activePoint;
|
|
161
|
-
}
|
|
162
|
-
get points() {
|
|
163
|
-
return [this._points.micro, this._points.full];
|
|
164
|
-
}
|
|
165
|
-
get open() {
|
|
166
|
-
log(
|
|
167
|
-
"open(): showCheckout: " + this.showCheckout + " showRecent: " + this.showRecent + " showBuy: " + this.showBuy
|
|
168
|
-
);
|
|
169
|
-
return this._checkingOut !== void 0 && !this._checkingOut && !this.closedByUser && (this.showCheckout || this.showRecent || this.showBuy);
|
|
170
|
-
}
|
|
171
|
-
get state() {
|
|
172
|
-
if (!this.closedByUser && !this._checkingOut) {
|
|
173
|
-
if (this.showBuy) {
|
|
174
|
-
return "full";
|
|
175
|
-
} else if (this.showRecent || this.showCheckout) {
|
|
176
|
-
return "micro";
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return "closed";
|
|
180
|
-
}
|
|
181
|
-
get showRecent() {
|
|
182
|
-
const recentInfo = this._service.recentItem;
|
|
183
|
-
return !!recentInfo && recentInfo.modified > this._routeChangedTime;
|
|
184
|
-
}
|
|
185
|
-
get showBuy() {
|
|
186
|
-
return !!this.currentSkuPath;
|
|
187
|
-
}
|
|
188
|
-
get showCheckout() {
|
|
189
|
-
return !this._service.cartEmpty;
|
|
190
|
-
}
|
|
191
|
-
get modal() {
|
|
192
|
-
return this.state !== "micro";
|
|
193
|
-
}
|
|
194
|
-
get microHeight() {
|
|
195
|
-
return this._points.micro;
|
|
196
|
-
}
|
|
197
|
-
get isMobile() {
|
|
198
|
-
return this._pointsConfig.mb === this._points;
|
|
199
|
-
}
|
|
200
|
-
get snapPointPx() {
|
|
201
|
-
if (!this._activePoint || this._vHeight === 0) return 0;
|
|
202
|
-
if (typeof this._activePoint === "string") {
|
|
203
|
-
return parseInt(this._activePoint);
|
|
204
|
-
}
|
|
205
|
-
return this._vHeight * this._activePoint;
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
// src/site/commerce/ui/conf.ts
|
|
210
|
-
var conf_default = {
|
|
211
|
-
mb: {
|
|
212
|
-
micro: "72px",
|
|
213
|
-
full: "600px"
|
|
214
|
-
},
|
|
215
|
-
dt: {
|
|
216
|
-
micro: "90px",
|
|
217
|
-
full: "620px"
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
11
|
var DESKTOP_MIN = 768;
|
|
221
|
-
var
|
|
12
|
+
var log = (s) => {
|
|
222
13
|
};
|
|
223
14
|
enableStaticRendering(typeof window === "undefined");
|
|
224
15
|
var CommerceUIContext = createContext(void 0);
|
|
@@ -233,7 +24,7 @@ var CommerceUIProvider = ({
|
|
|
233
24
|
}) => {
|
|
234
25
|
const cmmc = useCommerce();
|
|
235
26
|
const pathname = usePathname();
|
|
236
|
-
const storeRef = useRef(new CommerceUIStore(cmmc,
|
|
27
|
+
const storeRef = useRef(new CommerceUIStore(cmmc, conf));
|
|
237
28
|
const prevPathRef = useRef("initial");
|
|
238
29
|
const onResize = () => {
|
|
239
30
|
const width = window.innerWidth;
|
|
@@ -258,7 +49,7 @@ var CommerceUIProvider = ({
|
|
|
258
49
|
}, []);
|
|
259
50
|
useEffect(() => {
|
|
260
51
|
const checkingOut = pathname === "/checkout";
|
|
261
|
-
|
|
52
|
+
log("useEffect: prev pathname: " + prevPathRef.current);
|
|
262
53
|
if (storeRef.current.checkingOut === void 0 || storeRef.current._checkingOut !== checkingOut) {
|
|
263
54
|
storeRef.current.setCheckingOut(checkingOut);
|
|
264
55
|
}
|
|
@@ -268,7 +59,7 @@ var CommerceUIProvider = ({
|
|
|
268
59
|
} else if (!checkingOut && prevPathRef.current !== pathname) {
|
|
269
60
|
storeRef.current.newRoute();
|
|
270
61
|
prevPathRef.current = pathname;
|
|
271
|
-
|
|
62
|
+
log("ROUTE CHANGE: " + pathname + ": " + storeRef.current._routeChangedTime);
|
|
272
63
|
}
|
|
273
64
|
}, [pathname]);
|
|
274
65
|
return /* @__PURE__ */ jsx(CommerceUIContext.Provider, { value: storeRef.current, children });
|
|
@@ -2,51 +2,11 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var google = require('@next/third-parties/google');
|
|
5
|
-
var
|
|
6
|
-
var navigation = require('next/navigation');
|
|
7
|
-
var Script = require('next/script');
|
|
5
|
+
var index_js = require('../next/analytics/index.js');
|
|
8
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
7
|
|
|
10
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
|
|
12
|
-
var Script__default = /*#__PURE__*/_interopDefault(Script);
|
|
13
|
-
|
|
14
|
-
// src/site/next/analytics/fpixel.ts
|
|
15
|
-
var FB_PIXEL_ID = process.env.NEXT_PUBLIC_FACEBOOK_PIXEL_ID || "";
|
|
16
|
-
var pageview = () => {
|
|
17
|
-
window.fbq("track", "PageView");
|
|
18
|
-
};
|
|
19
|
-
var FacebookPixel = () => {
|
|
20
|
-
const [loaded, setLoaded] = react.useState(false);
|
|
21
|
-
const pathname = navigation.usePathname();
|
|
22
|
-
react.useEffect(() => {
|
|
23
|
-
if (!loaded) return;
|
|
24
|
-
pageview();
|
|
25
|
-
}, [pathname, loaded]);
|
|
26
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
27
|
-
Script__default.default,
|
|
28
|
-
{
|
|
29
|
-
id: "fb-pixel",
|
|
30
|
-
strategy: "afterInteractive",
|
|
31
|
-
onLoad: () => setLoaded(true),
|
|
32
|
-
dangerouslySetInnerHTML: {
|
|
33
|
-
__html: `
|
|
34
|
-
!function(f,b,e,v,n,t,s)
|
|
35
|
-
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
|
|
36
|
-
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
|
|
37
|
-
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
|
|
38
|
-
n.queue=[];t=b.createElement(e);t.async=!0;
|
|
39
|
-
t.src=v;s=b.getElementsByTagName(e)[0];
|
|
40
|
-
s.parentNode.insertBefore(t,s)}(window, document,'script',
|
|
41
|
-
'https://connect.facebook.net/en_US/fbevents.js');
|
|
42
|
-
fbq('init', ${FB_PIXEL_ID});
|
|
43
|
-
`
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
) });
|
|
47
|
-
};
|
|
48
8
|
var Analytics = () => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
49
|
-
/* @__PURE__ */ jsxRuntime.jsx(FacebookPixel, {}),
|
|
9
|
+
/* @__PURE__ */ jsxRuntime.jsx(index_js.FacebookPixel, {}),
|
|
50
10
|
/* @__PURE__ */ jsxRuntime.jsx(google.GoogleAnalytics, { gaId: process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID ?? "" })
|
|
51
11
|
] });
|
|
52
12
|
|
|
@@ -1,44 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { GoogleAnalytics } from '@next/third-parties/google';
|
|
3
|
-
import {
|
|
4
|
-
import { usePathname } from 'next/navigation';
|
|
5
|
-
import Script from 'next/script';
|
|
3
|
+
import { FacebookPixel } from '../next/analytics/index.js';
|
|
6
4
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
7
5
|
|
|
8
|
-
// src/site/next/analytics/fpixel.ts
|
|
9
|
-
var FB_PIXEL_ID = process.env.NEXT_PUBLIC_FACEBOOK_PIXEL_ID || "";
|
|
10
|
-
var pageview = () => {
|
|
11
|
-
window.fbq("track", "PageView");
|
|
12
|
-
};
|
|
13
|
-
var FacebookPixel = () => {
|
|
14
|
-
const [loaded, setLoaded] = useState(false);
|
|
15
|
-
const pathname = usePathname();
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
if (!loaded) return;
|
|
18
|
-
pageview();
|
|
19
|
-
}, [pathname, loaded]);
|
|
20
|
-
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
21
|
-
Script,
|
|
22
|
-
{
|
|
23
|
-
id: "fb-pixel",
|
|
24
|
-
strategy: "afterInteractive",
|
|
25
|
-
onLoad: () => setLoaded(true),
|
|
26
|
-
dangerouslySetInnerHTML: {
|
|
27
|
-
__html: `
|
|
28
|
-
!function(f,b,e,v,n,t,s)
|
|
29
|
-
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
|
|
30
|
-
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
|
|
31
|
-
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
|
|
32
|
-
n.queue=[];t=b.createElement(e);t.async=!0;
|
|
33
|
-
t.src=v;s=b.getElementsByTagName(e)[0];
|
|
34
|
-
s.parentNode.insertBefore(t,s)}(window, document,'script',
|
|
35
|
-
'https://connect.facebook.net/en_US/fbevents.js');
|
|
36
|
-
fbq('init', ${FB_PIXEL_ID});
|
|
37
|
-
`
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
) });
|
|
41
|
-
};
|
|
42
6
|
var Analytics = () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
43
7
|
/* @__PURE__ */ jsx(FacebookPixel, {}),
|
|
44
8
|
/* @__PURE__ */ jsx(GoogleAnalytics, { gaId: process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID ?? "" })
|
|
@@ -3,21 +3,15 @@
|
|
|
3
3
|
|
|
4
4
|
var react$1 = require('react');
|
|
5
5
|
var react = require('@hanzo/iam/react');
|
|
6
|
+
var resume_js = require('./resume.js');
|
|
6
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
8
|
|
|
8
|
-
// src/site/components/auth/resume.ts
|
|
9
|
-
var KEY = "lux-auth-resume";
|
|
10
|
-
var resume = () => {
|
|
11
|
-
const to = sessionStorage.getItem(KEY);
|
|
12
|
-
sessionStorage.removeItem(KEY);
|
|
13
|
-
return to ?? "/";
|
|
14
|
-
};
|
|
15
9
|
var Callback = () => {
|
|
16
10
|
const { handleCallback } = react.useIam();
|
|
17
11
|
const [error, setError] = react$1.useState(null);
|
|
18
12
|
react$1.useEffect(() => {
|
|
19
13
|
handleCallback().then(() => {
|
|
20
|
-
window.location.replace(resume());
|
|
14
|
+
window.location.replace(resume_js.resume());
|
|
21
15
|
}).catch((e) => {
|
|
22
16
|
setError(e.message);
|
|
23
17
|
});
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useState, useEffect } from 'react';
|
|
3
3
|
import { useIam } from '@hanzo/iam/react';
|
|
4
|
+
import { resume } from './resume.js';
|
|
4
5
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
6
|
|
|
6
|
-
// src/site/components/auth/resume.ts
|
|
7
|
-
var KEY = "lux-auth-resume";
|
|
8
|
-
var resume = () => {
|
|
9
|
-
const to = sessionStorage.getItem(KEY);
|
|
10
|
-
sessionStorage.removeItem(KEY);
|
|
11
|
-
return to ?? "/";
|
|
12
|
-
};
|
|
13
7
|
var Callback = () => {
|
|
14
8
|
const { handleCallback } = useIam();
|
|
15
9
|
const [error, setError] = useState(null);
|