@partbot/stockist-map 0.1.10 → 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/links.d.ts +1 -0
- package/dist/stockist-map.js +8898 -8775
- package/dist/stockist-map.umd.js +43 -43
- package/dist/stockist-search.js +353 -234
- package/dist/stockist-search.umd.js +10 -10
- package/dist/types.d.ts +4 -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,350 +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
|
+
phoneDisplay: "call_now"
|
|
129
130
|
};
|
|
130
|
-
function
|
|
131
|
-
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;
|
|
132
133
|
return /^[0-9a-f]{6}$/i.test(r) ? {
|
|
133
134
|
r: Number.parseInt(r.slice(0, 2), 16),
|
|
134
135
|
g: Number.parseInt(r.slice(2, 4), 16),
|
|
135
136
|
b: Number.parseInt(r.slice(4, 6), 16)
|
|
136
137
|
} : null;
|
|
137
138
|
}
|
|
138
|
-
function
|
|
139
|
-
const
|
|
139
|
+
function G({ r: e, g: t, b: r }) {
|
|
140
|
+
const o = [e, t, r].map((l) => {
|
|
140
141
|
const p = l / 255;
|
|
141
142
|
return p <= 0.03928 ? p / 12.92 : ((p + 0.055) / 1.055) ** 2.4;
|
|
142
143
|
});
|
|
143
|
-
return 0.2126 *
|
|
144
|
+
return 0.2126 * o[0] + 0.7152 * o[1] + 0.0722 * o[2];
|
|
144
145
|
}
|
|
145
|
-
function
|
|
146
|
-
const r = Math.max(
|
|
147
|
-
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);
|
|
148
149
|
}
|
|
149
|
-
function
|
|
150
|
-
const
|
|
151
|
-
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;
|
|
152
153
|
}
|
|
153
|
-
function
|
|
154
|
+
function Ne(e = {}) {
|
|
154
155
|
return {
|
|
155
|
-
...
|
|
156
|
+
...ee,
|
|
156
157
|
...e,
|
|
157
158
|
defaultCenter: {
|
|
158
|
-
...
|
|
159
|
+
...ee.defaultCenter,
|
|
159
160
|
...e.defaultCenter || {}
|
|
160
161
|
},
|
|
161
|
-
styleUrl: e.styleUrl ||
|
|
162
|
+
styleUrl: e.styleUrl || xe,
|
|
162
163
|
mapPalette: e.mapPalette || "monotone",
|
|
163
|
-
borderRadius: Number.isFinite(Number(e.borderRadius)) ? Number(e.borderRadius) :
|
|
164
|
-
tileUrl: !e.tileUrl || e.tileUrl ===
|
|
165
|
-
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
|
+
phoneDisplay: e.phoneDisplay === "number" ? "number" : "call_now",
|
|
166
168
|
radiusUnit: "km"
|
|
167
169
|
};
|
|
168
170
|
}
|
|
169
|
-
function
|
|
171
|
+
function Ue(e, t) {
|
|
170
172
|
return `/v1/stockist_maps/${encodeURIComponent(e)}/config`;
|
|
171
173
|
}
|
|
172
|
-
function
|
|
173
|
-
const r = typeof window > "u" ? "http://localhost" : window.location.href,
|
|
174
|
-
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();
|
|
175
177
|
}
|
|
176
|
-
async function
|
|
178
|
+
async function $e(e) {
|
|
177
179
|
const t = await fetch(e, { headers: { Accept: "application/json" } });
|
|
178
180
|
if (!t.ok) throw new Error(`Could not load stockist map config (${t.status})`);
|
|
179
181
|
return t.json();
|
|
180
182
|
}
|
|
181
|
-
async function
|
|
182
|
-
const r = await fetch(
|
|
183
|
+
async function He(e, t = {}) {
|
|
184
|
+
const r = await fetch(De(e, t), { headers: { Accept: "application/json" } });
|
|
183
185
|
if (!r.ok) throw new Error(`Could not search stockists (${r.status})`);
|
|
184
|
-
const
|
|
186
|
+
const o = await r.json();
|
|
185
187
|
return {
|
|
186
|
-
hits: Array.isArray(
|
|
187
|
-
estimatedTotalHits: Number(
|
|
188
|
-
center:
|
|
189
|
-
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
|
|
190
192
|
};
|
|
191
193
|
}
|
|
192
|
-
|
|
193
|
-
|
|
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) {
|
|
194
229
|
return e * Math.PI / 180;
|
|
195
230
|
}
|
|
196
|
-
function
|
|
197
|
-
const r =
|
|
198
|
-
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));
|
|
199
234
|
}
|
|
200
|
-
function
|
|
235
|
+
function Ze(e) {
|
|
201
236
|
return `${e.toFixed(1)} km`;
|
|
202
237
|
}
|
|
203
|
-
function
|
|
238
|
+
function Fe(e) {
|
|
204
239
|
const t = ["localhost", "127.0.0.1", "::1"].includes(window.location.hostname);
|
|
205
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.`;
|
|
206
241
|
}
|
|
207
|
-
function
|
|
242
|
+
function Be(e) {
|
|
208
243
|
const t = e == null ? void 0 : e.trim();
|
|
209
244
|
if (!t || t.startsWith("/") && !t.startsWith("//")) return null;
|
|
210
245
|
const r = t.startsWith("//") ? `https:${t}` : /^[a-z][a-z\d+.-]*:/i.test(t) ? t : `https://${t}`;
|
|
211
246
|
try {
|
|
212
|
-
const
|
|
213
|
-
return
|
|
247
|
+
const o = new URL(r);
|
|
248
|
+
return o.protocol === "http:" || o.protocol === "https:" ? o.toString() : null;
|
|
214
249
|
} catch {
|
|
215
250
|
return null;
|
|
216
251
|
}
|
|
217
252
|
}
|
|
218
|
-
function
|
|
253
|
+
function Ke(e) {
|
|
219
254
|
return `https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(`${e.lat},${e.lng}`)}`;
|
|
220
255
|
}
|
|
221
|
-
function
|
|
256
|
+
function qe(e, t = "call_now") {
|
|
257
|
+
return t === "number" ? e : "Call now";
|
|
258
|
+
}
|
|
259
|
+
function je(e) {
|
|
222
260
|
return e.stockist_id ?? e.id;
|
|
223
261
|
}
|
|
224
|
-
function
|
|
262
|
+
function Ve(e) {
|
|
225
263
|
const t = /* @__PURE__ */ new Set();
|
|
226
264
|
return e.filter((r) => {
|
|
227
|
-
const
|
|
228
|
-
return t.has(
|
|
265
|
+
const o = je(r);
|
|
266
|
+
return t.has(o) ? !1 : (t.add(o), !0);
|
|
229
267
|
});
|
|
230
268
|
}
|
|
231
|
-
const
|
|
232
|
-
function
|
|
269
|
+
const We = 3, Ge = 100, Y = 50, Qe = 350;
|
|
270
|
+
function ce(e) {
|
|
233
271
|
return e.display_address || e.address;
|
|
234
272
|
}
|
|
235
|
-
function
|
|
273
|
+
function Ye(e) {
|
|
236
274
|
var t;
|
|
237
275
|
return (t = e.categories) != null && t.length ? e.categories : e.category ? [e.category] : [];
|
|
238
276
|
}
|
|
239
|
-
function
|
|
277
|
+
function Je(e, t) {
|
|
240
278
|
const r = t == null ? void 0 : t[e];
|
|
241
279
|
return r ? {
|
|
242
280
|
"--pbss-category-color": r,
|
|
243
|
-
"--pbss-category-contrast":
|
|
281
|
+
"--pbss-category-contrast": Te(r)
|
|
244
282
|
} : void 0;
|
|
245
283
|
}
|
|
246
|
-
function
|
|
247
|
-
const r = t ? e.map((
|
|
248
|
-
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);
|
|
249
287
|
}
|
|
250
|
-
function
|
|
288
|
+
function ye({
|
|
251
289
|
token: e,
|
|
252
290
|
configUrl: t,
|
|
253
291
|
config: r,
|
|
254
|
-
theme:
|
|
292
|
+
theme: o,
|
|
255
293
|
initialQuery: l = "",
|
|
256
294
|
viewAllUrl: p = "/pages/stockists",
|
|
257
|
-
className:
|
|
295
|
+
className: S = ""
|
|
258
296
|
}) {
|
|
259
|
-
const [c,
|
|
297
|
+
const [c, O] = s.useState(r || null), [_, N] = s.useState(l), [U, w] = s.useState(
|
|
260
298
|
l.trim() ? "typed" : null
|
|
261
|
-
), [
|
|
262
|
-
() =>
|
|
263
|
-
[c == null ? void 0 : c.theme,
|
|
264
|
-
),
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
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;
|
|
270
329
|
if (!c) return;
|
|
271
|
-
const
|
|
272
|
-
|
|
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);
|
|
273
332
|
try {
|
|
274
|
-
const
|
|
275
|
-
query:
|
|
276
|
-
center:
|
|
277
|
-
radiusKm:
|
|
278
|
-
limit:
|
|
279
|
-
locationSearch: !
|
|
333
|
+
const E = await He(c.search.url, {
|
|
334
|
+
query: n,
|
|
335
|
+
center: 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
|
|
280
360
|
});
|
|
281
|
-
if (u !== m.current) return;
|
|
282
|
-
E(He(g.hits, g.center || o));
|
|
283
|
-
} catch (g) {
|
|
284
|
-
if (u !== m.current) return;
|
|
285
|
-
E([]), h(g instanceof Error ? g.message : "Could not search stockists");
|
|
286
361
|
} finally {
|
|
287
|
-
|
|
362
|
+
T === y.current && F(!1);
|
|
288
363
|
}
|
|
289
364
|
},
|
|
290
|
-
[
|
|
365
|
+
[h, c, f]
|
|
291
366
|
);
|
|
292
367
|
s.useEffect(() => {
|
|
293
|
-
if (
|
|
294
|
-
const
|
|
295
|
-
if (!
|
|
296
|
-
let
|
|
297
|
-
return
|
|
298
|
-
|
|
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;
|
|
371
|
+
let a = !1;
|
|
372
|
+
return $e(n).then((u) => {
|
|
373
|
+
a || O(u);
|
|
299
374
|
}).catch((u) => {
|
|
300
|
-
|
|
375
|
+
a || (g(u instanceof Error ? u.message : "Could not load stockist search"), v(!0), b(!0));
|
|
301
376
|
}), () => {
|
|
302
|
-
|
|
377
|
+
a = !0;
|
|
303
378
|
};
|
|
304
|
-
}, [
|
|
305
|
-
if (!c ||
|
|
306
|
-
const
|
|
307
|
-
if (!
|
|
308
|
-
|
|
379
|
+
}, [h, t, l, r, e]), s.useEffect(() => {
|
|
380
|
+
if (!c || U !== "typed") return;
|
|
381
|
+
const n = _.trim();
|
|
382
|
+
if (!n) {
|
|
383
|
+
j();
|
|
309
384
|
return;
|
|
310
385
|
}
|
|
311
|
-
return
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
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);
|
|
318
398
|
};
|
|
319
|
-
return document.addEventListener("pointerdown",
|
|
399
|
+
return document.addEventListener("pointerdown", n), () => document.removeEventListener("pointerdown", n);
|
|
320
400
|
}, []), s.useEffect(
|
|
321
401
|
() => () => {
|
|
322
|
-
|
|
402
|
+
k.current += 1, y.current += 1, h();
|
|
323
403
|
},
|
|
324
|
-
[
|
|
404
|
+
[h]
|
|
325
405
|
);
|
|
326
|
-
const
|
|
327
|
-
if (
|
|
328
|
-
|
|
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" });
|
|
329
409
|
return;
|
|
330
410
|
}
|
|
331
411
|
if (!navigator.geolocation) {
|
|
332
|
-
|
|
412
|
+
g(
|
|
333
413
|
"This browser does not support location search. Search by suburb or postcode instead."
|
|
334
|
-
),
|
|
414
|
+
), v(!0), b(!0), f("stockist location failed", { failure_reason: "unsupported" });
|
|
335
415
|
return;
|
|
336
416
|
}
|
|
337
|
-
|
|
338
|
-
const
|
|
417
|
+
w("location"), M(!0), g(null), b(!0);
|
|
418
|
+
const n = k.current;
|
|
339
419
|
navigator.geolocation.getCurrentPosition(
|
|
340
|
-
(
|
|
341
|
-
if (
|
|
342
|
-
const u = { lat:
|
|
343
|
-
|
|
420
|
+
(a) => {
|
|
421
|
+
if (n !== k.current) return;
|
|
422
|
+
const u = { lat: a.coords.latitude, lng: a.coords.longitude };
|
|
423
|
+
N(""), M(!1), V({ activeQuery: "", center: u, trigger: "location", trackInteraction: !0 });
|
|
344
424
|
},
|
|
345
|
-
(
|
|
346
|
-
|
|
425
|
+
(a) => {
|
|
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
|
+
}));
|
|
347
433
|
},
|
|
348
434
|
{ enableHighAccuracy: !1, timeout: 8e3 }
|
|
349
435
|
);
|
|
350
|
-
},
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
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(
|
|
355
465
|
"div",
|
|
356
466
|
{
|
|
357
|
-
ref:
|
|
358
|
-
className: `pbss-root ${
|
|
467
|
+
ref: R,
|
|
468
|
+
className: `pbss-root ${K.darkMode ? "is-dark" : ""} ${S}`.trim(),
|
|
359
469
|
style: {
|
|
360
|
-
"--pbss-primary":
|
|
361
|
-
"--pbss-radius": `${Math.max(0,
|
|
470
|
+
"--pbss-primary": K.primaryColor,
|
|
471
|
+
"--pbss-radius": `${Math.max(0, K.borderRadius)}px`
|
|
362
472
|
},
|
|
363
|
-
onKeyDown: (
|
|
364
|
-
|
|
473
|
+
onKeyDown: (n) => {
|
|
474
|
+
n.key === "Escape" && b(!1);
|
|
365
475
|
},
|
|
366
476
|
children: [
|
|
367
|
-
/* @__PURE__ */
|
|
477
|
+
/* @__PURE__ */ m("div", { className: "pbss-search-control", children: [
|
|
368
478
|
/* @__PURE__ */ i(
|
|
369
479
|
"input",
|
|
370
480
|
{
|
|
371
|
-
"aria-controls":
|
|
372
|
-
"aria-expanded":
|
|
481
|
+
"aria-controls": J ? ne : void 0,
|
|
482
|
+
"aria-expanded": J,
|
|
373
483
|
"aria-label": "Search stockists",
|
|
374
484
|
autoComplete: "postal-code",
|
|
375
485
|
className: "pbss-input",
|
|
376
486
|
name: "stockist-search",
|
|
377
487
|
placeholder: "Search suburb or postcode",
|
|
378
488
|
type: "search",
|
|
379
|
-
value:
|
|
380
|
-
onChange: (
|
|
381
|
-
const
|
|
382
|
-
|
|
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);
|
|
383
493
|
},
|
|
384
494
|
onFocus: () => {
|
|
385
|
-
(
|
|
495
|
+
(Z || C || re || B) && b(!0);
|
|
386
496
|
},
|
|
387
|
-
onKeyDown: (
|
|
388
|
-
|
|
497
|
+
onKeyDown: (n) => {
|
|
498
|
+
n.key === "Enter" && (n.preventDefault(), Se());
|
|
389
499
|
}
|
|
390
500
|
}
|
|
391
501
|
),
|
|
392
|
-
/* @__PURE__ */
|
|
502
|
+
/* @__PURE__ */ m(
|
|
393
503
|
"button",
|
|
394
504
|
{
|
|
395
|
-
"aria-label":
|
|
505
|
+
"aria-label": C ? "Finding your location" : "Use my location",
|
|
396
506
|
className: "pbss-location-button",
|
|
397
|
-
disabled:
|
|
507
|
+
disabled: C || Z || !c,
|
|
398
508
|
type: "button",
|
|
399
|
-
onClick:
|
|
509
|
+
onClick: Ee,
|
|
400
510
|
children: [
|
|
401
|
-
|
|
511
|
+
C ? /* @__PURE__ */ i("span", { "aria-hidden": "true", className: "pbss-spinner" }) : /* @__PURE__ */ i(fe, { "aria-hidden": "true", "data-slot": "icon", weight: "bold" }),
|
|
402
512
|
/* @__PURE__ */ i("span", { "aria-hidden": "true", className: "pbss-touch-target" })
|
|
403
513
|
]
|
|
404
514
|
}
|
|
405
515
|
)
|
|
406
516
|
] }),
|
|
407
|
-
|
|
517
|
+
J && /* @__PURE__ */ m(
|
|
408
518
|
"div",
|
|
409
519
|
{
|
|
410
520
|
"aria-label": "Nearest stockists",
|
|
411
521
|
className: "pbss-results-panel",
|
|
412
|
-
id:
|
|
522
|
+
id: ne,
|
|
413
523
|
role: "region",
|
|
414
524
|
children: [
|
|
415
|
-
/* @__PURE__ */
|
|
525
|
+
/* @__PURE__ */ m("div", { className: "pbss-mobile-results-header", children: [
|
|
416
526
|
/* @__PURE__ */ i("span", { children: "Nearest stockists" }),
|
|
417
|
-
/* @__PURE__ */
|
|
527
|
+
/* @__PURE__ */ m(
|
|
418
528
|
"button",
|
|
419
529
|
{
|
|
420
530
|
"aria-label": "Close stockist results",
|
|
421
531
|
className: "pbss-results-close",
|
|
422
532
|
type: "button",
|
|
423
|
-
onClick: () =>
|
|
533
|
+
onClick: () => b(!1),
|
|
424
534
|
children: [
|
|
425
|
-
/* @__PURE__ */ i(
|
|
535
|
+
/* @__PURE__ */ i(he, { "aria-hidden": "true", "data-slot": "icon", weight: "bold" }),
|
|
426
536
|
/* @__PURE__ */ i("span", { children: "Close" })
|
|
427
537
|
]
|
|
428
538
|
}
|
|
429
539
|
)
|
|
430
540
|
] }),
|
|
431
|
-
/* @__PURE__ */ i("div", { "aria-live": "polite", className: "pbss-results-status", children:
|
|
432
|
-
const
|
|
433
|
-
return /* @__PURE__ */
|
|
434
|
-
/* @__PURE__ */
|
|
435
|
-
/* @__PURE__ */ i("div", { className: "pbss-result-name", children:
|
|
436
|
-
/* @__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(
|
|
437
547
|
"span",
|
|
438
548
|
{
|
|
439
549
|
className: "pbss-result-category",
|
|
440
|
-
style:
|
|
441
|
-
children:
|
|
550
|
+
style: Je(d, c == null ? void 0 : c.search.categoryColors),
|
|
551
|
+
children: d
|
|
442
552
|
},
|
|
443
|
-
|
|
553
|
+
d
|
|
444
554
|
)) })
|
|
445
555
|
] }),
|
|
446
|
-
|
|
447
|
-
/* @__PURE__ */
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
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(
|
|
452
562
|
"a",
|
|
453
563
|
{
|
|
454
|
-
href:
|
|
564
|
+
href: Ke(n._geo),
|
|
455
565
|
rel: "noreferrer",
|
|
456
566
|
target: "_blank",
|
|
567
|
+
onClick: () => q(n, a, "directions"),
|
|
457
568
|
children: "Get directions"
|
|
458
569
|
}
|
|
459
570
|
),
|
|
460
|
-
typeof
|
|
571
|
+
typeof n.distanceKm == "number" && /* @__PURE__ */ i("span", { className: "pbss-result-distance", children: Ze(n.distanceKm) })
|
|
461
572
|
] })
|
|
462
|
-
] },
|
|
463
|
-
}) }) : /* @__PURE__ */
|
|
573
|
+
] }, n.id);
|
|
574
|
+
}) }) : /* @__PURE__ */ m("div", { className: "pbss-empty", children: [
|
|
464
575
|
"No stockists found within ",
|
|
465
|
-
|
|
576
|
+
Y,
|
|
466
577
|
" km. Try another location."
|
|
467
578
|
] }) }),
|
|
468
|
-
/* @__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
|
+
)
|
|
469
588
|
]
|
|
470
589
|
}
|
|
471
590
|
)
|
|
@@ -473,35 +592,35 @@ function ae({
|
|
|
473
592
|
}
|
|
474
593
|
);
|
|
475
594
|
}
|
|
476
|
-
const
|
|
477
|
-
function
|
|
478
|
-
const r =
|
|
479
|
-
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;
|
|
480
599
|
}
|
|
481
|
-
const
|
|
482
|
-
function
|
|
600
|
+
const ue = "data-partbot-stockist-search-styles", de = "data-partbot-stockist-search-root";
|
|
601
|
+
function st(e) {
|
|
483
602
|
return e.shadowRoot || e.attachShadow({ mode: "open" });
|
|
484
603
|
}
|
|
485
|
-
function
|
|
486
|
-
if (e.querySelector(`style[${
|
|
604
|
+
function rt(e) {
|
|
605
|
+
if (e.querySelector(`style[${ue}]`)) return;
|
|
487
606
|
const t = document.createElement("style");
|
|
488
|
-
t.setAttribute(
|
|
607
|
+
t.setAttribute(ue, ""), t.textContent = et, e.prepend(t);
|
|
489
608
|
}
|
|
490
|
-
function
|
|
609
|
+
function nt(e) {
|
|
491
610
|
const t = e.querySelector(
|
|
492
|
-
`div[${
|
|
611
|
+
`div[${de}]`
|
|
493
612
|
);
|
|
494
613
|
if (t) return t;
|
|
495
614
|
const r = document.createElement("div");
|
|
496
|
-
return r.setAttribute(
|
|
615
|
+
return r.setAttribute(de, ""), e.appendChild(r), r;
|
|
497
616
|
}
|
|
498
|
-
const
|
|
617
|
+
const ot = typeof HTMLElement > "u" ? class {
|
|
499
618
|
} : HTMLElement;
|
|
500
|
-
class
|
|
619
|
+
class we extends ot {
|
|
501
620
|
constructor() {
|
|
502
621
|
super(...arguments);
|
|
503
|
-
|
|
504
|
-
|
|
622
|
+
W(this, "root");
|
|
623
|
+
W(this, "mountElement");
|
|
505
624
|
}
|
|
506
625
|
connectedCallback() {
|
|
507
626
|
this.renderStockistSearch();
|
|
@@ -514,8 +633,8 @@ class oe extends De {
|
|
|
514
633
|
this.isConnected && this.renderStockistSearch();
|
|
515
634
|
}
|
|
516
635
|
renderStockistSearch() {
|
|
517
|
-
const r =
|
|
518
|
-
|
|
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() }));
|
|
519
638
|
}
|
|
520
639
|
stockistSearchProps() {
|
|
521
640
|
return {
|
|
@@ -526,17 +645,17 @@ class oe extends De {
|
|
|
526
645
|
};
|
|
527
646
|
}
|
|
528
647
|
}
|
|
529
|
-
|
|
530
|
-
function
|
|
531
|
-
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);
|
|
532
651
|
}
|
|
533
|
-
typeof window < "u" && (
|
|
534
|
-
defineCustomElement:
|
|
535
|
-
mount:
|
|
652
|
+
typeof window < "u" && (pe(), window.PartbotStockistSearch = {
|
|
653
|
+
defineCustomElement: pe,
|
|
654
|
+
mount: tt
|
|
536
655
|
});
|
|
537
656
|
export {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
657
|
+
we as PartbotStockistSearchElement,
|
|
658
|
+
ye as StockistSearch,
|
|
659
|
+
pe as defineStockistSearchElement,
|
|
660
|
+
tt as mountStockistSearch
|
|
542
661
|
};
|