@partbot/stockist-map 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics.d.ts +7 -0
- package/dist/stockist-map.js +9004 -8892
- package/dist/stockist-map.umd.js +43 -43
- package/dist/stockist-search.js +343 -229
- package/dist/stockist-search.umd.js +10 -10
- package/dist/types.d.ts +3 -0
- package/package.json +1 -1
package/dist/stockist-search.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsxs as
|
|
5
|
-
import { createRoot as
|
|
1
|
+
var _e = Object.defineProperty;
|
|
2
|
+
var Le = (e, t, r) => t in e ? _e(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var W = (e, t, r) => Le(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { jsxs as m, jsx as i } from "react/jsx-runtime";
|
|
5
|
+
import { createRoot as be } from "react-dom/client";
|
|
6
6
|
import * as s from "react";
|
|
7
|
-
import { createContext as
|
|
8
|
-
const
|
|
7
|
+
import { createContext as Ae } from "react";
|
|
8
|
+
const Ce = Ae({
|
|
9
9
|
color: "currentColor",
|
|
10
10
|
size: "1em",
|
|
11
11
|
weight: "regular",
|
|
12
12
|
mirrored: !1
|
|
13
|
-
}),
|
|
13
|
+
}), se = s.forwardRef(
|
|
14
14
|
(e, t) => {
|
|
15
15
|
const {
|
|
16
16
|
alt: r,
|
|
17
|
-
color:
|
|
17
|
+
color: o,
|
|
18
18
|
size: l,
|
|
19
19
|
weight: p,
|
|
20
|
-
mirrored:
|
|
20
|
+
mirrored: S,
|
|
21
21
|
children: c,
|
|
22
|
-
weights:
|
|
23
|
-
...
|
|
22
|
+
weights: O,
|
|
23
|
+
..._
|
|
24
24
|
} = e, {
|
|
25
|
-
color:
|
|
26
|
-
size:
|
|
27
|
-
weight:
|
|
28
|
-
mirrored:
|
|
29
|
-
...
|
|
30
|
-
} = s.useContext(
|
|
25
|
+
color: N = "currentColor",
|
|
26
|
+
size: U,
|
|
27
|
+
weight: w = "regular",
|
|
28
|
+
mirrored: L = !1,
|
|
29
|
+
...A
|
|
30
|
+
} = s.useContext(Ce);
|
|
31
31
|
return /* @__PURE__ */ s.createElement(
|
|
32
32
|
"svg",
|
|
33
33
|
{
|
|
34
34
|
ref: t,
|
|
35
35
|
xmlns: "http://www.w3.org/2000/svg",
|
|
36
|
-
width: l ??
|
|
37
|
-
height: l ??
|
|
38
|
-
fill:
|
|
36
|
+
width: l ?? U,
|
|
37
|
+
height: l ?? U,
|
|
38
|
+
fill: o ?? N,
|
|
39
39
|
viewBox: "0 0 256 256",
|
|
40
|
-
transform:
|
|
41
|
-
...
|
|
42
|
-
...
|
|
40
|
+
transform: S || L ? "scale(-1, 1)" : void 0,
|
|
41
|
+
...A,
|
|
42
|
+
..._
|
|
43
43
|
},
|
|
44
44
|
!!r && /* @__PURE__ */ s.createElement("title", null, r),
|
|
45
45
|
c,
|
|
46
|
-
|
|
46
|
+
O.get(p ?? w)
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
);
|
|
50
|
-
|
|
51
|
-
const
|
|
50
|
+
se.displayName = "IconBase";
|
|
51
|
+
const Me = /* @__PURE__ */ new Map([
|
|
52
52
|
[
|
|
53
53
|
"bold",
|
|
54
54
|
/* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M238.7,102.46,62.81,37.21l-.25-.09A20,20,0,0,0,37.12,62.56l.09.25L102.46,238.7A20,20,0,0,0,121.3,252h.35a20,20,0,0,0,18.77-14.12l.09-.29,21.23-75.85,75.85-21.23.29-.09a20,20,0,0,0,.82-38Zm-89.93,38a12,12,0,0,0-8.32,8.32l-19.68,70.29L62.8,62.8l156.26,58Z" }))
|
|
@@ -79,9 +79,9 @@ const fe = /* @__PURE__ */ new Map([
|
|
|
79
79
|
"thin",
|
|
80
80
|
/* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M236,110,59.93,44.67A12,12,0,0,0,44.69,60L110,235.93A11.83,11.83,0,0,0,121.28,244h.22a11.82,11.82,0,0,0,11.26-8.47l0-.1,22.45-80.19,80.19-22.44.1,0A12,12,0,0,0,236,110Zm-2.79,15.12-82.3,23a4,4,0,0,0-2.78,2.77l-23,82.3a3.88,3.88,0,0,1-3.74,2.78,4,4,0,0,1-3.88-2.77L52.22,57.32a3.93,3.93,0,0,1,1-4.14A4,4,0,0,1,56,52a3.86,3.86,0,0,1,1.25.21l176.08,65.32a4,4,0,0,1-.09,7.59Z" }))
|
|
81
81
|
]
|
|
82
|
-
]),
|
|
83
|
-
|
|
84
|
-
const
|
|
82
|
+
]), fe = s.forwardRef((e, t) => /* @__PURE__ */ s.createElement(se, { ref: t, ...e, weights: Me }));
|
|
83
|
+
fe.displayName = "NavigationArrowIcon";
|
|
84
|
+
const Re = /* @__PURE__ */ new Map([
|
|
85
85
|
[
|
|
86
86
|
"bold",
|
|
87
87
|
/* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z" }))
|
|
@@ -112,9 +112,9 @@ const he = /* @__PURE__ */ new Map([
|
|
|
112
112
|
"thin",
|
|
113
113
|
/* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z" }))
|
|
114
114
|
]
|
|
115
|
-
]),
|
|
116
|
-
|
|
117
|
-
const
|
|
115
|
+
]), he = s.forwardRef((e, t) => /* @__PURE__ */ s.createElement(se, { ref: t, ...e, weights: Re }));
|
|
116
|
+
he.displayName = "XIcon";
|
|
117
|
+
const Ie = "https://tile.openstreetmap.org/{z}/{x}/{y}.png", me = "https://basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png", ge = "OpenStreetMap contributors, CARTO", xe = "https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json", ee = {
|
|
118
118
|
primaryColor: "#111111",
|
|
119
119
|
markerColor: "#111111",
|
|
120
120
|
borderRadius: 8,
|
|
@@ -122,355 +122,469 @@ const me = "https://tile.openstreetmap.org/{z}/{x}/{y}.png", se = "https://basem
|
|
|
122
122
|
defaultZoom: 5,
|
|
123
123
|
defaultCenter: { lat: -25.2744, lng: 133.7751 },
|
|
124
124
|
darkMode: !1,
|
|
125
|
-
styleUrl:
|
|
125
|
+
styleUrl: xe,
|
|
126
126
|
mapPalette: "monotone",
|
|
127
|
-
tileUrl:
|
|
128
|
-
tileAttribution:
|
|
127
|
+
tileUrl: me,
|
|
128
|
+
tileAttribution: ge,
|
|
129
129
|
phoneDisplay: "call_now"
|
|
130
130
|
};
|
|
131
|
-
function
|
|
132
|
-
const t = e.trim().replace(/^#/, ""), r = t.length === 3 ? t.split("").map((
|
|
131
|
+
function te(e) {
|
|
132
|
+
const t = e.trim().replace(/^#/, ""), r = t.length === 3 ? t.split("").map((o) => `${o}${o}`).join("") : t;
|
|
133
133
|
return /^[0-9a-f]{6}$/i.test(r) ? {
|
|
134
134
|
r: Number.parseInt(r.slice(0, 2), 16),
|
|
135
135
|
g: Number.parseInt(r.slice(2, 4), 16),
|
|
136
136
|
b: Number.parseInt(r.slice(4, 6), 16)
|
|
137
137
|
} : null;
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
const
|
|
139
|
+
function G({ r: e, g: t, b: r }) {
|
|
140
|
+
const o = [e, t, r].map((l) => {
|
|
141
141
|
const p = l / 255;
|
|
142
142
|
return p <= 0.03928 ? p / 12.92 : ((p + 0.055) / 1.055) ** 2.4;
|
|
143
143
|
});
|
|
144
|
-
return 0.2126 *
|
|
144
|
+
return 0.2126 * o[0] + 0.7152 * o[1] + 0.0722 * o[2];
|
|
145
145
|
}
|
|
146
|
-
function
|
|
147
|
-
const r = Math.max(
|
|
148
|
-
return (r + 0.05) / (
|
|
146
|
+
function ae(e, t) {
|
|
147
|
+
const r = Math.max(G(e), G(t)), o = Math.min(G(e), G(t));
|
|
148
|
+
return (r + 0.05) / (o + 0.05);
|
|
149
149
|
}
|
|
150
|
-
function
|
|
151
|
-
const
|
|
152
|
-
return !
|
|
150
|
+
function Te(e, t = "#111111", r = "#ffffff") {
|
|
151
|
+
const o = te(e), l = te(t), p = te(r);
|
|
152
|
+
return !o || !l || !p ? r : ae(o, l) >= ae(o, p) ? t : r;
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function Ne(e = {}) {
|
|
155
155
|
return {
|
|
156
|
-
...
|
|
156
|
+
...ee,
|
|
157
157
|
...e,
|
|
158
158
|
defaultCenter: {
|
|
159
|
-
...
|
|
159
|
+
...ee.defaultCenter,
|
|
160
160
|
...e.defaultCenter || {}
|
|
161
161
|
},
|
|
162
|
-
styleUrl: e.styleUrl ||
|
|
162
|
+
styleUrl: e.styleUrl || xe,
|
|
163
163
|
mapPalette: e.mapPalette || "monotone",
|
|
164
|
-
borderRadius: Number.isFinite(Number(e.borderRadius)) ? Number(e.borderRadius) :
|
|
165
|
-
tileUrl: !e.tileUrl || e.tileUrl ===
|
|
166
|
-
tileAttribution: e.tileAttribution ||
|
|
164
|
+
borderRadius: Number.isFinite(Number(e.borderRadius)) ? Number(e.borderRadius) : ee.borderRadius,
|
|
165
|
+
tileUrl: !e.tileUrl || e.tileUrl === Ie ? me : e.tileUrl,
|
|
166
|
+
tileAttribution: e.tileAttribution || ge,
|
|
167
167
|
phoneDisplay: e.phoneDisplay === "number" ? "number" : "call_now",
|
|
168
168
|
radiusUnit: "km"
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function Ue(e, t) {
|
|
172
172
|
return `/v1/stockist_maps/${encodeURIComponent(e)}/config`;
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
const r = typeof window > "u" ? "http://localhost" : window.location.href,
|
|
176
|
-
return t.query &&
|
|
174
|
+
function De(e, t = {}) {
|
|
175
|
+
const r = typeof window > "u" ? "http://localhost" : window.location.href, o = new URL(e, r);
|
|
176
|
+
return t.query && o.searchParams.set("q", t.query), t.limit && o.searchParams.set("limit", String(t.limit)), t.center && (o.searchParams.set("lat", String(t.center.lat)), o.searchParams.set("lng", String(t.center.lng))), t.radiusKm && o.searchParams.set("radius_km", String(t.radiusKm)), t.category && o.searchParams.set("category", t.category), t.locationSearch && o.searchParams.set("location_search", "true"), o.toString();
|
|
177
177
|
}
|
|
178
|
-
async function
|
|
178
|
+
async function $e(e) {
|
|
179
179
|
const t = await fetch(e, { headers: { Accept: "application/json" } });
|
|
180
180
|
if (!t.ok) throw new Error(`Could not load stockist map config (${t.status})`);
|
|
181
181
|
return t.json();
|
|
182
182
|
}
|
|
183
|
-
async function
|
|
184
|
-
const r = await fetch(
|
|
183
|
+
async function He(e, t = {}) {
|
|
184
|
+
const r = await fetch(De(e, t), { headers: { Accept: "application/json" } });
|
|
185
185
|
if (!r.ok) throw new Error(`Could not search stockists (${r.status})`);
|
|
186
|
-
const
|
|
186
|
+
const o = await r.json();
|
|
187
187
|
return {
|
|
188
|
-
hits: Array.isArray(
|
|
189
|
-
estimatedTotalHits: Number(
|
|
190
|
-
center:
|
|
191
|
-
resolvedQuery:
|
|
188
|
+
hits: Array.isArray(o.hits) ? o.hits : [],
|
|
189
|
+
estimatedTotalHits: Number(o.estimatedTotalHits || 0),
|
|
190
|
+
center: o.center || null,
|
|
191
|
+
resolvedQuery: o.resolvedQuery || null
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
function ie() {
|
|
195
|
+
var e;
|
|
196
|
+
return typeof ((e = globalThis.crypto) == null ? void 0 : e.randomUUID) == "function" ? globalThis.crypto.randomUUID() : `pb-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 14)}`;
|
|
197
|
+
}
|
|
198
|
+
function le(e, t) {
|
|
199
|
+
var r;
|
|
200
|
+
return {
|
|
201
|
+
stockist_id: e.stockist_id,
|
|
202
|
+
stockist_name: e.name,
|
|
203
|
+
categories: (r = e.categories) != null && r.length ? e.categories : e.category ? [e.category] : [],
|
|
204
|
+
result_rank: t,
|
|
205
|
+
distance_km: typeof e.distanceKm == "number" ? Math.round(e.distanceKm * 10) / 10 : void 0
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function Pe(e, t, r, o, l = {}, p = fetch) {
|
|
209
|
+
var c;
|
|
210
|
+
const S = (c = e == null ? void 0 : e.analytics) == null ? void 0 : c.url;
|
|
211
|
+
S && p(S, {
|
|
212
|
+
method: "POST",
|
|
213
|
+
headers: { "Content-Type": "application/json" },
|
|
214
|
+
body: JSON.stringify({
|
|
215
|
+
event: t,
|
|
216
|
+
properties: {
|
|
217
|
+
...l,
|
|
218
|
+
component: r,
|
|
219
|
+
locator_session_id: o,
|
|
220
|
+
page_path: typeof window > "u" ? void 0 : window.location.pathname
|
|
221
|
+
}
|
|
222
|
+
}),
|
|
223
|
+
keepalive: !0
|
|
224
|
+
}).catch(() => {
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
const ze = 6371;
|
|
228
|
+
function Q(e) {
|
|
196
229
|
return e * Math.PI / 180;
|
|
197
230
|
}
|
|
198
|
-
function
|
|
199
|
-
const r =
|
|
200
|
-
return 2 *
|
|
231
|
+
function Oe(e, t) {
|
|
232
|
+
const r = Q(t.lat - e.lat), o = Q(t.lng - e.lng), l = Math.sin(r / 2) ** 2 + Math.cos(Q(e.lat)) * Math.cos(Q(t.lat)) * Math.sin(o / 2) ** 2;
|
|
233
|
+
return 2 * ze * Math.atan2(Math.sqrt(l), Math.sqrt(1 - l));
|
|
201
234
|
}
|
|
202
|
-
function
|
|
235
|
+
function Ze(e) {
|
|
203
236
|
return `${e.toFixed(1)} km`;
|
|
204
237
|
}
|
|
205
|
-
function
|
|
238
|
+
function Fe(e) {
|
|
206
239
|
const t = ["localhost", "127.0.0.1", "::1"].includes(window.location.hostname);
|
|
207
240
|
return window.location.protocol !== "https:" && !t ? "Browser location is blocked on this local Partbot domain. Chrome and Brave only allow location access on HTTPS, localhost, or origins manually trusted in browser flags." : e.code === e.PERMISSION_DENIED ? "Location permission is blocked for this site. Allow location access in your browser settings, then try again." : e.code === e.POSITION_UNAVAILABLE ? "Your browser could not determine your location. Try again, or search by suburb or postcode." : e.code === e.TIMEOUT ? "Finding your location timed out. Try again, or search by suburb or postcode." : `Browser location failed with error code ${e.code}. Try again, or search by suburb or postcode.`;
|
|
208
241
|
}
|
|
209
|
-
function
|
|
242
|
+
function Be(e) {
|
|
210
243
|
const t = e == null ? void 0 : e.trim();
|
|
211
244
|
if (!t || t.startsWith("/") && !t.startsWith("//")) return null;
|
|
212
245
|
const r = t.startsWith("//") ? `https:${t}` : /^[a-z][a-z\d+.-]*:/i.test(t) ? t : `https://${t}`;
|
|
213
246
|
try {
|
|
214
|
-
const
|
|
215
|
-
return
|
|
247
|
+
const o = new URL(r);
|
|
248
|
+
return o.protocol === "http:" || o.protocol === "https:" ? o.toString() : null;
|
|
216
249
|
} catch {
|
|
217
250
|
return null;
|
|
218
251
|
}
|
|
219
252
|
}
|
|
220
|
-
function
|
|
253
|
+
function Ke(e) {
|
|
221
254
|
return `https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(`${e.lat},${e.lng}`)}`;
|
|
222
255
|
}
|
|
223
|
-
function
|
|
256
|
+
function qe(e, t = "call_now") {
|
|
224
257
|
return t === "number" ? e : "Call now";
|
|
225
258
|
}
|
|
226
|
-
function
|
|
259
|
+
function je(e) {
|
|
227
260
|
return e.stockist_id ?? e.id;
|
|
228
261
|
}
|
|
229
|
-
function
|
|
262
|
+
function Ve(e) {
|
|
230
263
|
const t = /* @__PURE__ */ new Set();
|
|
231
264
|
return e.filter((r) => {
|
|
232
|
-
const
|
|
233
|
-
return t.has(
|
|
265
|
+
const o = je(r);
|
|
266
|
+
return t.has(o) ? !1 : (t.add(o), !0);
|
|
234
267
|
});
|
|
235
268
|
}
|
|
236
|
-
const
|
|
237
|
-
function
|
|
269
|
+
const We = 3, Ge = 100, Y = 50, Qe = 350;
|
|
270
|
+
function ce(e) {
|
|
238
271
|
return e.display_address || e.address;
|
|
239
272
|
}
|
|
240
|
-
function
|
|
273
|
+
function Ye(e) {
|
|
241
274
|
var t;
|
|
242
275
|
return (t = e.categories) != null && t.length ? e.categories : e.category ? [e.category] : [];
|
|
243
276
|
}
|
|
244
|
-
function
|
|
277
|
+
function Je(e, t) {
|
|
245
278
|
const r = t == null ? void 0 : t[e];
|
|
246
279
|
return r ? {
|
|
247
280
|
"--pbss-category-color": r,
|
|
248
|
-
"--pbss-category-contrast":
|
|
281
|
+
"--pbss-category-contrast": Te(r)
|
|
249
282
|
} : void 0;
|
|
250
283
|
}
|
|
251
|
-
function
|
|
252
|
-
const r = t ? e.map((
|
|
253
|
-
return
|
|
284
|
+
function Xe(e, t) {
|
|
285
|
+
const r = t ? e.map((o) => ({ ...o, distanceKm: Oe(t, o._geo) })).sort((o, l) => (o.distanceKm || 0) - (l.distanceKm || 0)) : e;
|
|
286
|
+
return Ve(r).slice(0, We);
|
|
254
287
|
}
|
|
255
|
-
function
|
|
288
|
+
function ye({
|
|
256
289
|
token: e,
|
|
257
290
|
configUrl: t,
|
|
258
291
|
config: r,
|
|
259
|
-
theme:
|
|
292
|
+
theme: o,
|
|
260
293
|
initialQuery: l = "",
|
|
261
294
|
viewAllUrl: p = "/pages/stockists",
|
|
262
|
-
className:
|
|
295
|
+
className: S = ""
|
|
263
296
|
}) {
|
|
264
|
-
const [c,
|
|
297
|
+
const [c, O] = s.useState(r || null), [_, N] = s.useState(l), [U, w] = s.useState(
|
|
265
298
|
l.trim() ? "typed" : null
|
|
266
|
-
), [
|
|
267
|
-
() =>
|
|
268
|
-
[c == null ? void 0 : c.theme,
|
|
269
|
-
),
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
299
|
+
), [L, A] = s.useState([]), [Z, F] = s.useState(!1), [C, M] = s.useState(!1), [ve, b] = s.useState(!1), [re, v] = s.useState(!1), [B, g] = s.useState(null), R = s.useRef(null), y = s.useRef(0), k = s.useRef(0), D = s.useRef(null), ne = s.useId(), ke = s.useRef(ie()), $ = s.useRef(null), H = s.useRef(!1), oe = s.useRef(/* @__PURE__ */ new Set()), K = s.useMemo(
|
|
300
|
+
() => Ne({ ...(c == null ? void 0 : c.theme) || {}, ...o || {} }),
|
|
301
|
+
[c == null ? void 0 : c.theme, o]
|
|
302
|
+
), f = s.useCallback(
|
|
303
|
+
(n, a = {}) => {
|
|
304
|
+
Pe(c, n, "search", ke.current, a);
|
|
305
|
+
},
|
|
306
|
+
[c]
|
|
307
|
+
), q = s.useCallback(
|
|
308
|
+
(n, a, u) => {
|
|
309
|
+
f("stockist action clicked", {
|
|
310
|
+
...le(n, a + 1),
|
|
311
|
+
search_id: $.current,
|
|
312
|
+
action_type: u,
|
|
313
|
+
action_placement: "search_result"
|
|
314
|
+
});
|
|
315
|
+
},
|
|
316
|
+
[f]
|
|
317
|
+
), h = s.useCallback(() => {
|
|
318
|
+
D.current && (clearTimeout(D.current), D.current = null);
|
|
319
|
+
}, []), j = s.useCallback(() => {
|
|
320
|
+
y.current += 1, h(), A([]), F(!1), v(!1), g(null), b(!1), $.current = null;
|
|
321
|
+
}, [h]), V = s.useCallback(
|
|
322
|
+
async ({
|
|
323
|
+
activeQuery: n,
|
|
324
|
+
center: a,
|
|
325
|
+
trigger: u,
|
|
326
|
+
trackInteraction: d
|
|
327
|
+
}) => {
|
|
328
|
+
var z;
|
|
275
329
|
if (!c) return;
|
|
276
|
-
const
|
|
277
|
-
|
|
330
|
+
const x = ie(), P = a ? "geolocation" : "typed", I = Date.now(), T = y.current + 1;
|
|
331
|
+
y.current = T, h(), F(!0), v(!0), g(null), b(!0);
|
|
278
332
|
try {
|
|
279
|
-
const
|
|
280
|
-
query:
|
|
333
|
+
const E = await He(c.search.url, {
|
|
334
|
+
query: n,
|
|
281
335
|
center: a,
|
|
282
|
-
radiusKm:
|
|
283
|
-
limit:
|
|
284
|
-
locationSearch: !a && !!
|
|
336
|
+
radiusKm: Y,
|
|
337
|
+
limit: Ge,
|
|
338
|
+
locationSearch: !a && !!n
|
|
339
|
+
});
|
|
340
|
+
if (T !== y.current) return;
|
|
341
|
+
const X = Xe(E.hits, E.center || a);
|
|
342
|
+
A(X), $.current = d ? x : null, d && f("stockist search completed", {
|
|
343
|
+
search_id: x,
|
|
344
|
+
search_method: P,
|
|
345
|
+
search_trigger: u,
|
|
346
|
+
radius_km: Y,
|
|
347
|
+
estimated_result_count: E.estimatedTotalHits,
|
|
348
|
+
displayed_result_count: X.length,
|
|
349
|
+
has_results: X.length > 0,
|
|
350
|
+
resolved_location_source: ((z = E.resolvedQuery) == null ? void 0 : z.source) || void 0,
|
|
351
|
+
duration_ms: Date.now() - I
|
|
352
|
+
});
|
|
353
|
+
} catch (E) {
|
|
354
|
+
if (T !== y.current) return;
|
|
355
|
+
A([]), g(E instanceof Error ? E.message : "Could not search stockists"), d && f("stockist search failed", {
|
|
356
|
+
search_id: x,
|
|
357
|
+
search_method: P,
|
|
358
|
+
search_trigger: u,
|
|
359
|
+
radius_km: Y
|
|
285
360
|
});
|
|
286
|
-
if (u !== m.current) return;
|
|
287
|
-
k(Pe(g.hits, g.center || a));
|
|
288
|
-
} catch (g) {
|
|
289
|
-
if (u !== m.current) return;
|
|
290
|
-
k([]), h(g instanceof Error ? g.message : "Could not search stockists");
|
|
291
361
|
} finally {
|
|
292
|
-
|
|
362
|
+
T === y.current && F(!1);
|
|
293
363
|
}
|
|
294
364
|
},
|
|
295
|
-
[
|
|
365
|
+
[h, c, f]
|
|
296
366
|
);
|
|
297
367
|
s.useEffect(() => {
|
|
298
|
-
if (
|
|
299
|
-
const
|
|
300
|
-
if (!
|
|
368
|
+
if (k.current += 1, y.current += 1, h(), O(r || null), N(l), w(l.trim() ? "typed" : null), A([]), F(!1), M(!1), v(!1), b(!1), g(null), H.current = !1, r) return;
|
|
369
|
+
const n = t || (e ? Ue(e) : null);
|
|
370
|
+
if (!n) return;
|
|
301
371
|
let a = !1;
|
|
302
|
-
return
|
|
303
|
-
a ||
|
|
372
|
+
return $e(n).then((u) => {
|
|
373
|
+
a || O(u);
|
|
304
374
|
}).catch((u) => {
|
|
305
|
-
a || (
|
|
375
|
+
a || (g(u instanceof Error ? u.message : "Could not load stockist search"), v(!0), b(!0));
|
|
306
376
|
}), () => {
|
|
307
377
|
a = !0;
|
|
308
378
|
};
|
|
309
|
-
}, [
|
|
310
|
-
if (!c ||
|
|
311
|
-
const
|
|
312
|
-
if (!
|
|
313
|
-
|
|
379
|
+
}, [h, t, l, r, e]), s.useEffect(() => {
|
|
380
|
+
if (!c || U !== "typed") return;
|
|
381
|
+
const n = _.trim();
|
|
382
|
+
if (!n) {
|
|
383
|
+
j();
|
|
314
384
|
return;
|
|
315
385
|
}
|
|
316
|
-
return
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
386
|
+
return h(), D.current = setTimeout(() => {
|
|
387
|
+
D.current = null, V({
|
|
388
|
+
activeQuery: n,
|
|
389
|
+
center: null,
|
|
390
|
+
trigger: "query",
|
|
391
|
+
trackInteraction: H.current && n.length >= 3
|
|
392
|
+
});
|
|
393
|
+
}, Qe), h;
|
|
394
|
+
}, [h, c, _, j, V, U]), s.useEffect(() => {
|
|
395
|
+
const n = (a) => {
|
|
396
|
+
const u = typeof a.composedPath == "function" ? a.composedPath() : [], d = a.target instanceof Node ? a.target : null;
|
|
397
|
+
R.current && u.includes(R.current) || R.current && d && R.current.contains(d) || b(!1);
|
|
323
398
|
};
|
|
324
|
-
return document.addEventListener("pointerdown",
|
|
399
|
+
return document.addEventListener("pointerdown", n), () => document.removeEventListener("pointerdown", n);
|
|
325
400
|
}, []), s.useEffect(
|
|
326
401
|
() => () => {
|
|
327
|
-
|
|
402
|
+
k.current += 1, y.current += 1, h();
|
|
328
403
|
},
|
|
329
|
-
[
|
|
404
|
+
[h]
|
|
330
405
|
);
|
|
331
|
-
const
|
|
332
|
-
if (
|
|
333
|
-
|
|
406
|
+
const Ee = () => {
|
|
407
|
+
if (H.current = !0, k.current += 1, j(), w(null), M(!1), typeof window < "u" && window.isSecureContext === !1) {
|
|
408
|
+
g("Browser location is blocked on this site. Search by suburb or postcode instead."), v(!0), b(!0), f("stockist location failed", { failure_reason: "insecure" });
|
|
334
409
|
return;
|
|
335
410
|
}
|
|
336
411
|
if (!navigator.geolocation) {
|
|
337
|
-
|
|
412
|
+
g(
|
|
338
413
|
"This browser does not support location search. Search by suburb or postcode instead."
|
|
339
|
-
),
|
|
414
|
+
), v(!0), b(!0), f("stockist location failed", { failure_reason: "unsupported" });
|
|
340
415
|
return;
|
|
341
416
|
}
|
|
342
|
-
|
|
343
|
-
const
|
|
417
|
+
w("location"), M(!0), g(null), b(!0);
|
|
418
|
+
const n = k.current;
|
|
344
419
|
navigator.geolocation.getCurrentPosition(
|
|
345
420
|
(a) => {
|
|
346
|
-
if (
|
|
421
|
+
if (n !== k.current) return;
|
|
347
422
|
const u = { lat: a.coords.latitude, lng: a.coords.longitude };
|
|
348
|
-
|
|
423
|
+
N(""), M(!1), V({ activeQuery: "", center: u, trigger: "location", trackInteraction: !0 });
|
|
349
424
|
},
|
|
350
425
|
(a) => {
|
|
351
|
-
|
|
426
|
+
n === k.current && (M(!1), v(!0), g(Fe(a)), b(!0), f("stockist location failed", {
|
|
427
|
+
failure_reason: {
|
|
428
|
+
1: "permission_denied",
|
|
429
|
+
2: "unavailable",
|
|
430
|
+
3: "timeout"
|
|
431
|
+
}[a.code] || "unknown"
|
|
432
|
+
}));
|
|
352
433
|
},
|
|
353
434
|
{ enableHighAccuracy: !1, timeout: 8e3 }
|
|
354
435
|
);
|
|
355
|
-
},
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
436
|
+
}, Se = () => {
|
|
437
|
+
const n = _.trim();
|
|
438
|
+
n && (w("typed"), H.current = !0, V({
|
|
439
|
+
activeQuery: n,
|
|
440
|
+
center: null,
|
|
441
|
+
trigger: "submit",
|
|
442
|
+
trackInteraction: n.length >= 3
|
|
443
|
+
}));
|
|
444
|
+
}, J = ve && (Z || C || re || !!B);
|
|
445
|
+
return s.useEffect(() => {
|
|
446
|
+
const n = R.current, a = $.current;
|
|
447
|
+
if (!n || !a || typeof IntersectionObserver > "u") return;
|
|
448
|
+
const u = new IntersectionObserver(
|
|
449
|
+
(d) => {
|
|
450
|
+
d.forEach((x) => {
|
|
451
|
+
if (!x.isIntersecting || x.intersectionRatio < 0.5) return;
|
|
452
|
+
const P = Number(x.target.dataset.stockistResultIndex), I = L[P];
|
|
453
|
+
if (!I) return;
|
|
454
|
+
const T = I.stockist_id || I.id, z = `${a}:${T}`;
|
|
455
|
+
oe.current.has(z) || (oe.current.add(z), f("stockist result viewed", {
|
|
456
|
+
...le(I, P + 1),
|
|
457
|
+
search_id: a
|
|
458
|
+
}), u.unobserve(x.target));
|
|
459
|
+
});
|
|
460
|
+
},
|
|
461
|
+
{ threshold: 0.5 }
|
|
462
|
+
);
|
|
463
|
+
return n.querySelectorAll("[data-stockist-result-index]").forEach((d) => u.observe(d)), () => u.disconnect();
|
|
464
|
+
}, [L, f]), /* @__PURE__ */ m(
|
|
360
465
|
"div",
|
|
361
466
|
{
|
|
362
|
-
ref:
|
|
363
|
-
className: `pbss-root ${
|
|
467
|
+
ref: R,
|
|
468
|
+
className: `pbss-root ${K.darkMode ? "is-dark" : ""} ${S}`.trim(),
|
|
364
469
|
style: {
|
|
365
|
-
"--pbss-primary":
|
|
366
|
-
"--pbss-radius": `${Math.max(0,
|
|
470
|
+
"--pbss-primary": K.primaryColor,
|
|
471
|
+
"--pbss-radius": `${Math.max(0, K.borderRadius)}px`
|
|
367
472
|
},
|
|
368
|
-
onKeyDown: (
|
|
369
|
-
|
|
473
|
+
onKeyDown: (n) => {
|
|
474
|
+
n.key === "Escape" && b(!1);
|
|
370
475
|
},
|
|
371
476
|
children: [
|
|
372
|
-
/* @__PURE__ */
|
|
477
|
+
/* @__PURE__ */ m("div", { className: "pbss-search-control", children: [
|
|
373
478
|
/* @__PURE__ */ i(
|
|
374
479
|
"input",
|
|
375
480
|
{
|
|
376
|
-
"aria-controls":
|
|
377
|
-
"aria-expanded":
|
|
481
|
+
"aria-controls": J ? ne : void 0,
|
|
482
|
+
"aria-expanded": J,
|
|
378
483
|
"aria-label": "Search stockists",
|
|
379
484
|
autoComplete: "postal-code",
|
|
380
485
|
className: "pbss-input",
|
|
381
486
|
name: "stockist-search",
|
|
382
487
|
placeholder: "Search suburb or postcode",
|
|
383
488
|
type: "search",
|
|
384
|
-
value:
|
|
385
|
-
onChange: (
|
|
386
|
-
const a =
|
|
387
|
-
|
|
489
|
+
value: _,
|
|
490
|
+
onChange: (n) => {
|
|
491
|
+
const a = n.target.value;
|
|
492
|
+
H.current = !0, k.current += 1, j(), M(!1), N(a), w(a.trim() ? "typed" : null);
|
|
388
493
|
},
|
|
389
494
|
onFocus: () => {
|
|
390
|
-
(
|
|
495
|
+
(Z || C || re || B) && b(!0);
|
|
391
496
|
},
|
|
392
|
-
onKeyDown: (
|
|
393
|
-
|
|
497
|
+
onKeyDown: (n) => {
|
|
498
|
+
n.key === "Enter" && (n.preventDefault(), Se());
|
|
394
499
|
}
|
|
395
500
|
}
|
|
396
501
|
),
|
|
397
|
-
/* @__PURE__ */
|
|
502
|
+
/* @__PURE__ */ m(
|
|
398
503
|
"button",
|
|
399
504
|
{
|
|
400
|
-
"aria-label":
|
|
505
|
+
"aria-label": C ? "Finding your location" : "Use my location",
|
|
401
506
|
className: "pbss-location-button",
|
|
402
|
-
disabled:
|
|
507
|
+
disabled: C || Z || !c,
|
|
403
508
|
type: "button",
|
|
404
|
-
onClick:
|
|
509
|
+
onClick: Ee,
|
|
405
510
|
children: [
|
|
406
|
-
|
|
511
|
+
C ? /* @__PURE__ */ i("span", { "aria-hidden": "true", className: "pbss-spinner" }) : /* @__PURE__ */ i(fe, { "aria-hidden": "true", "data-slot": "icon", weight: "bold" }),
|
|
407
512
|
/* @__PURE__ */ i("span", { "aria-hidden": "true", className: "pbss-touch-target" })
|
|
408
513
|
]
|
|
409
514
|
}
|
|
410
515
|
)
|
|
411
516
|
] }),
|
|
412
|
-
|
|
517
|
+
J && /* @__PURE__ */ m(
|
|
413
518
|
"div",
|
|
414
519
|
{
|
|
415
520
|
"aria-label": "Nearest stockists",
|
|
416
521
|
className: "pbss-results-panel",
|
|
417
|
-
id:
|
|
522
|
+
id: ne,
|
|
418
523
|
role: "region",
|
|
419
524
|
children: [
|
|
420
|
-
/* @__PURE__ */
|
|
525
|
+
/* @__PURE__ */ m("div", { className: "pbss-mobile-results-header", children: [
|
|
421
526
|
/* @__PURE__ */ i("span", { children: "Nearest stockists" }),
|
|
422
|
-
/* @__PURE__ */
|
|
527
|
+
/* @__PURE__ */ m(
|
|
423
528
|
"button",
|
|
424
529
|
{
|
|
425
530
|
"aria-label": "Close stockist results",
|
|
426
531
|
className: "pbss-results-close",
|
|
427
532
|
type: "button",
|
|
428
|
-
onClick: () =>
|
|
533
|
+
onClick: () => b(!1),
|
|
429
534
|
children: [
|
|
430
|
-
/* @__PURE__ */ i(
|
|
535
|
+
/* @__PURE__ */ i(he, { "aria-hidden": "true", "data-slot": "icon", weight: "bold" }),
|
|
431
536
|
/* @__PURE__ */ i("span", { children: "Close" })
|
|
432
537
|
]
|
|
433
538
|
}
|
|
434
539
|
)
|
|
435
540
|
] }),
|
|
436
|
-
/* @__PURE__ */ i("div", { "aria-live": "polite", className: "pbss-results-status", children:
|
|
437
|
-
const
|
|
438
|
-
return /* @__PURE__ */
|
|
439
|
-
/* @__PURE__ */
|
|
440
|
-
/* @__PURE__ */ i("div", { className: "pbss-result-name", children:
|
|
441
|
-
/* @__PURE__ */ i("div", { className: "pbss-result-categories", children:
|
|
541
|
+
/* @__PURE__ */ i("div", { "aria-live": "polite", className: "pbss-results-status", children: Z || C ? /* @__PURE__ */ i("div", { className: "pbss-loading", children: "Finding nearby stockists." }) : B ? /* @__PURE__ */ i("div", { className: "pbss-error", children: B }) : L.length > 0 ? /* @__PURE__ */ i("ul", { className: "pbss-results", role: "list", children: L.map((n, a) => {
|
|
542
|
+
const u = Be(n.website);
|
|
543
|
+
return /* @__PURE__ */ m("li", { className: "pbss-result", "data-stockist-result-index": a, children: [
|
|
544
|
+
/* @__PURE__ */ m("div", { className: "pbss-result-heading", children: [
|
|
545
|
+
/* @__PURE__ */ i("div", { className: "pbss-result-name", children: n.name }),
|
|
546
|
+
/* @__PURE__ */ i("div", { className: "pbss-result-categories", children: Ye(n).map((d) => /* @__PURE__ */ i(
|
|
442
547
|
"span",
|
|
443
548
|
{
|
|
444
549
|
className: "pbss-result-category",
|
|
445
|
-
style:
|
|
446
|
-
children:
|
|
550
|
+
style: Je(d, c == null ? void 0 : c.search.categoryColors),
|
|
551
|
+
children: d
|
|
447
552
|
},
|
|
448
|
-
|
|
553
|
+
d
|
|
449
554
|
)) })
|
|
450
555
|
] }),
|
|
451
|
-
|
|
452
|
-
/* @__PURE__ */
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
556
|
+
ce(n) && /* @__PURE__ */ i("div", { className: "pbss-result-address", children: ce(n) }),
|
|
557
|
+
/* @__PURE__ */ m("div", { className: "pbss-result-actions", children: [
|
|
558
|
+
n.phone && /* @__PURE__ */ i("a", { href: `tel:${n.phone}`, onClick: () => q(n, a, "phone"), children: qe(n.phone, K.phoneDisplay) }),
|
|
559
|
+
u && /* @__PURE__ */ i("a", { href: u, rel: "noreferrer", target: "_blank", onClick: () => q(n, a, "website"), children: "Website" }),
|
|
560
|
+
n.email && /* @__PURE__ */ i("a", { href: `mailto:${n.email}`, onClick: () => q(n, a, "email"), children: "Email" }),
|
|
561
|
+
n.directions_available !== !1 && /* @__PURE__ */ i(
|
|
457
562
|
"a",
|
|
458
563
|
{
|
|
459
|
-
href:
|
|
564
|
+
href: Ke(n._geo),
|
|
460
565
|
rel: "noreferrer",
|
|
461
566
|
target: "_blank",
|
|
567
|
+
onClick: () => q(n, a, "directions"),
|
|
462
568
|
children: "Get directions"
|
|
463
569
|
}
|
|
464
570
|
),
|
|
465
|
-
typeof
|
|
571
|
+
typeof n.distanceKm == "number" && /* @__PURE__ */ i("span", { className: "pbss-result-distance", children: Ze(n.distanceKm) })
|
|
466
572
|
] })
|
|
467
|
-
] },
|
|
468
|
-
}) }) : /* @__PURE__ */
|
|
573
|
+
] }, n.id);
|
|
574
|
+
}) }) : /* @__PURE__ */ m("div", { className: "pbss-empty", children: [
|
|
469
575
|
"No stockists found within ",
|
|
470
|
-
|
|
576
|
+
Y,
|
|
471
577
|
" km. Try another location."
|
|
472
578
|
] }) }),
|
|
473
|
-
/* @__PURE__ */ i(
|
|
579
|
+
/* @__PURE__ */ i(
|
|
580
|
+
"a",
|
|
581
|
+
{
|
|
582
|
+
className: "pbss-view-all",
|
|
583
|
+
href: p || "/pages/stockists",
|
|
584
|
+
onClick: () => f("stockist view all clicked", { search_id: $.current }),
|
|
585
|
+
children: "View All Stockists"
|
|
586
|
+
}
|
|
587
|
+
)
|
|
474
588
|
]
|
|
475
589
|
}
|
|
476
590
|
)
|
|
@@ -478,35 +592,35 @@ function oe({
|
|
|
478
592
|
}
|
|
479
593
|
);
|
|
480
594
|
}
|
|
481
|
-
const
|
|
482
|
-
function
|
|
483
|
-
const r =
|
|
484
|
-
return r.render(/* @__PURE__ */ i(
|
|
595
|
+
const et = ":host{display:block;position:relative;z-index:11}partbot-stockist-search{display:block}.pbss-root{--pbss-primary: #111111;--pbss-action-color: var(--pbss-primary);--pbss-radius: 8px;--pbss-surface: #ffffff;--pbss-control-surface: #ffffff;--pbss-border: rgb(28 25 23 / .14);--pbss-divider: rgb(28 25 23 / .09);--pbss-text: #1c1917;--pbss-muted-text: #78716c;--pbss-placeholder-text: #57534e;--pbss-danger-surface: #fff1f2;--pbss-danger-text: #9f1239;color:var(--pbss-text);container-type:inline-size;font-family:inherit;isolation:isolate;position:relative;width:100%;-webkit-font-smoothing:antialiased}.pbss-search-control{align-items:center;display:flex;min-width:0;position:relative}.pbss-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--pbss-control-surface);border:0;border-radius:var(--pbss-radius);box-shadow:inset 0 0 0 1px var(--pbss-border);color:var(--pbss-text);font:inherit;font-size:16px;line-height:1.5;min-height:48px;min-width:0;padding:10px 56px 10px 14px;width:100%}.pbss-input::-webkit-search-cancel-button{margin-right:4px}.pbss-input::placeholder{color:var(--pbss-placeholder-text);opacity:1}.pbss-input:focus{box-shadow:inset 0 0 0 2px color-mix(in srgb,var(--pbss-action-color) 70%,transparent),0 0 0 3px color-mix(in srgb,var(--pbss-action-color) 14%,transparent);outline:none}.pbss-location-button{align-items:center;background:transparent;border:0;border-radius:max(4px,calc(var(--pbss-radius) - 4px));color:var(--pbss-action-color);cursor:pointer;display:inline-flex;height:40px;justify-content:center;padding:0;position:absolute;right:4px;width:40px}.pbss-location-button [data-slot=icon]{flex:0 0 auto;height:16px;width:16px}.pbss-location-button:hover{background:color-mix(in srgb,var(--pbss-action-color) 8%,transparent)}.pbss-location-button:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:-2px}.pbss-location-button:disabled{cursor:not-allowed;opacity:.5}.pbss-touch-target{height:max(100%,48px);left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:max(100%,48px)}.pbss-spinner{animation:pbss-spin .7s linear infinite;border:2px solid color-mix(in srgb,var(--pbss-action-color) 22%,transparent);border-radius:999px;border-top-color:var(--pbss-action-color);height:16px;width:16px}.pbss-results-panel{background:var(--pbss-surface);border-radius:var(--pbss-radius);box-shadow:0 16px 36px #1c191729,0 2px 8px #1c191714,0 0 0 1px #1c19170f;display:grid;left:0;margin-top:6px;overflow:hidden;position:absolute;right:0;z-index:20}.pbss-results-status{min-width:0}.pbss-mobile-results-header{display:none}.pbss-results{list-style:none;margin:0;padding:0}.pbss-result{display:grid;gap:8px;padding:14px}.pbss-result+.pbss-result{border-top:1px solid var(--pbss-divider)}.pbss-result-heading{align-items:center;display:flex;gap:8px;justify-content:space-between;min-width:0}.pbss-result-name{font-size:16px;font-weight:600;line-height:1.35;min-width:0}.pbss-result-categories{display:flex;flex:0 1 auto;flex-wrap:wrap;gap:5px;justify-content:flex-end}.pbss-result-category{background:var( --pbss-category-color, color-mix(in srgb, var(--pbss-action-color) 10%, var(--pbss-control-surface)) );border-radius:999px;color:var(--pbss-category-contrast, var(--pbss-action-color));font-size:11px;font-weight:700;line-height:1.2;padding:3px 7px;width:fit-content}.pbss-loading,.pbss-empty,.pbss-error{font-size:16px;line-height:1.45}.pbss-result-address{color:var(--pbss-muted-text);font-size:14px;line-height:1.4}.pbss-result-actions{align-items:center;display:flex;flex-wrap:wrap;gap:8px 14px}.pbss-result-actions a{color:var(--pbss-action-color);font-size:14px;font-weight:600;line-height:1.35;text-decoration:none}.pbss-result-actions a:hover{text-decoration:underline;text-underline-offset:3px}.pbss-result-actions a:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:2px}.pbss-result-distance{background:color-mix(in srgb,var(--pbss-text) 14%,transparent);border-radius:999px;color:var(--pbss-text);flex:0 0 auto;font-size:12px;font-variant-numeric:tabular-nums;font-weight:600;line-height:1.2;padding:4px 8px}.pbss-loading,.pbss-empty,.pbss-error{padding:16px 14px}.pbss-loading,.pbss-empty{color:var(--pbss-muted-text)}.pbss-error{background:var(--pbss-danger-surface);color:var(--pbss-danger-text)}.pbss-view-all{border-top:1px solid var(--pbss-divider);color:var(--pbss-action-color);font-size:16px;font-weight:600;line-height:1.4;padding:13px 14px;text-align:center;text-decoration:none}.pbss-view-all:hover{background:color-mix(in srgb,var(--pbss-action-color) 6%,var(--pbss-surface));text-decoration:underline;text-underline-offset:3px}.pbss-view-all:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:-3px}@container (min-width: 480px){.pbss-result-name,.pbss-loading,.pbss-empty,.pbss-error,.pbss-view-all{font-size:14px}.pbss-result-address,.pbss-result-actions a{font-size:12px}}@container (max-width: 479px){.pbss-mobile-results-header{align-items:center;border-bottom:1px solid var(--pbss-divider);display:flex;font-size:14px;font-weight:600;justify-content:space-between;line-height:1.35;min-height:48px;padding:4px 4px 4px 14px}.pbss-results-close{align-items:center;background:transparent;border:0;border-radius:max(4px,calc(var(--pbss-radius) - 4px));color:var(--pbss-action-color);cursor:pointer;display:inline-flex;font:inherit;gap:6px;min-height:40px;padding:8px 10px}.pbss-results-close [data-slot=icon]{height:16px;width:16px}.pbss-results-close:hover{background:color-mix(in srgb,var(--pbss-action-color) 8%,transparent)}.pbss-results-close:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:-2px}}.pbss-root.is-dark{--pbss-action-color: #f5f3f0;--pbss-surface: #1c1917;--pbss-control-surface: #292524;--pbss-border: rgb(255 255 255 / .16);--pbss-divider: rgb(255 255 255 / .1);--pbss-text: #f5f3f0;--pbss-muted-text: #d6d3d1;--pbss-placeholder-text: #d6d3d1;--pbss-danger-surface: #4c0519;--pbss-danger-text: #fecdd3}.pbss-root.is-dark .pbss-results-panel{box-shadow:0 18px 38px #0000006b,0 0 0 1px #ffffff1a}@media(prefers-reduced-motion:reduce){.pbss-spinner{animation-duration:1.4s}}@keyframes pbss-spin{to{transform:rotate(360deg)}}";
|
|
596
|
+
function tt(e, t) {
|
|
597
|
+
const r = be(e);
|
|
598
|
+
return r.render(/* @__PURE__ */ i(ye, { ...t })), r;
|
|
485
599
|
}
|
|
486
|
-
const
|
|
487
|
-
function
|
|
600
|
+
const ue = "data-partbot-stockist-search-styles", de = "data-partbot-stockist-search-root";
|
|
601
|
+
function st(e) {
|
|
488
602
|
return e.shadowRoot || e.attachShadow({ mode: "open" });
|
|
489
603
|
}
|
|
490
|
-
function
|
|
491
|
-
if (e.querySelector(`style[${
|
|
604
|
+
function rt(e) {
|
|
605
|
+
if (e.querySelector(`style[${ue}]`)) return;
|
|
492
606
|
const t = document.createElement("style");
|
|
493
|
-
t.setAttribute(
|
|
607
|
+
t.setAttribute(ue, ""), t.textContent = et, e.prepend(t);
|
|
494
608
|
}
|
|
495
|
-
function
|
|
609
|
+
function nt(e) {
|
|
496
610
|
const t = e.querySelector(
|
|
497
|
-
`div[${
|
|
611
|
+
`div[${de}]`
|
|
498
612
|
);
|
|
499
613
|
if (t) return t;
|
|
500
614
|
const r = document.createElement("div");
|
|
501
|
-
return r.setAttribute(
|
|
615
|
+
return r.setAttribute(de, ""), e.appendChild(r), r;
|
|
502
616
|
}
|
|
503
|
-
const
|
|
617
|
+
const ot = typeof HTMLElement > "u" ? class {
|
|
504
618
|
} : HTMLElement;
|
|
505
|
-
class
|
|
619
|
+
class we extends ot {
|
|
506
620
|
constructor() {
|
|
507
621
|
super(...arguments);
|
|
508
|
-
|
|
509
|
-
|
|
622
|
+
W(this, "root");
|
|
623
|
+
W(this, "mountElement");
|
|
510
624
|
}
|
|
511
625
|
connectedCallback() {
|
|
512
626
|
this.renderStockistSearch();
|
|
@@ -519,8 +633,8 @@ class ae extends Be {
|
|
|
519
633
|
this.isConnected && this.renderStockistSearch();
|
|
520
634
|
}
|
|
521
635
|
renderStockistSearch() {
|
|
522
|
-
const r =
|
|
523
|
-
|
|
636
|
+
const r = st(this);
|
|
637
|
+
rt(r), this.mountElement || (this.mountElement = nt(r)), this.root || (this.root = be(this.mountElement)), this.root.render(/* @__PURE__ */ i(ye, { ...this.stockistSearchProps() }));
|
|
524
638
|
}
|
|
525
639
|
stockistSearchProps() {
|
|
526
640
|
return {
|
|
@@ -531,17 +645,17 @@ class ae extends Be {
|
|
|
531
645
|
};
|
|
532
646
|
}
|
|
533
647
|
}
|
|
534
|
-
|
|
535
|
-
function
|
|
536
|
-
typeof window > "u" || !window.customElements || window.customElements.get("partbot-stockist-search") || window.customElements.define("partbot-stockist-search",
|
|
648
|
+
W(we, "observedAttributes", ["token", "config-url", "initial-query", "view-all-url"]);
|
|
649
|
+
function pe() {
|
|
650
|
+
typeof window > "u" || !window.customElements || window.customElements.get("partbot-stockist-search") || window.customElements.define("partbot-stockist-search", we);
|
|
537
651
|
}
|
|
538
|
-
typeof window < "u" && (
|
|
539
|
-
defineCustomElement:
|
|
540
|
-
mount:
|
|
652
|
+
typeof window < "u" && (pe(), window.PartbotStockistSearch = {
|
|
653
|
+
defineCustomElement: pe,
|
|
654
|
+
mount: tt
|
|
541
655
|
});
|
|
542
656
|
export {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
657
|
+
we as PartbotStockistSearchElement,
|
|
658
|
+
ye as StockistSearch,
|
|
659
|
+
pe as defineStockistSearchElement,
|
|
660
|
+
tt as mountStockistSearch
|
|
547
661
|
};
|