@disconetwork/shopify 0.0.3 → 0.0.5
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/README.md +2 -12
- package/dist/{DiscoRecommendations-i3RGOqOq.js → DiscoRecommendations-3LDn_fcd.js} +393 -144
- package/dist/DiscoRecommendations-3LDn_fcd.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/internal.d.ts +4 -2
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +6 -3
- package/dist/internal.js.map +1 -1
- package/package.json +3 -3
- package/dist/DiscoRecommendations-i3RGOqOq.js.map +0 -1
|
@@ -1,15 +1,224 @@
|
|
|
1
1
|
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "preact/hooks";
|
|
2
2
|
import { createContext } from "preact";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { cloneElement, createContext as createContext$1, createElement, isValidElement, useCallback as useCallback$1, useContext as useContext$1, useEffect as useEffect$1, useMemo as useMemo$1, useState as useState$1 } from "preact/compat";
|
|
4
|
+
import { withImpressionDedupe } from "@disconetwork/core";
|
|
5
|
+
import { jsx } from "preact/jsx-runtime";
|
|
6
|
+
import { INTERNAL_BASE_URL, InternalDiscoClient, parseScreens } from "@disconetwork/core/internal";
|
|
7
|
+
import { Fragment, jsx as jsx$1, jsxs } from "preact/jsx-runtime";
|
|
6
8
|
import { useApi, useBillingAddress, useCartLines, useCheckoutToken, useCustomer, useDiscountCodes, useEmail, usePhone, usePurchasingCompany, useShippingAddress, useShop, useSubscription, useTotalAmount } from "@shopify/ui-extensions/checkout/preact";
|
|
7
9
|
import { useApi as useApi$1, useBillingAddress as useBillingAddress$1, useCartLines as useCartLines$1, useCustomer as useCustomer$1, useDiscountCodes as useDiscountCodes$1, useEmail as useEmail$1, useOrder, usePhone as usePhone$1, usePurchasingCompany as usePurchasingCompany$1, useShippingAddress as useShippingAddress$1, useShop as useShop$1, useSubscription as useSubscription$1, useTotalAmount as useTotalAmount$1 } from "@shopify/ui-extensions/customer-account/preact";
|
|
8
|
-
|
|
10
|
+
//#region ../react-shared/dist/createHeadlessBindings-CPuF5wZQ.js
|
|
11
|
+
/**
|
|
12
|
+
* Build a self-contained set of headless React bindings for one client type.
|
|
13
|
+
*
|
|
14
|
+
* Returns the client context (for a backing-specific `DiscoProvider` to provide
|
|
15
|
+
* into), the `useDiscoClient` accessor, the `Disco.Root` controller, and the
|
|
16
|
+
* `useDiscoRecommendations` / `useDiscoTracker` / `useFetchRecommendations`
|
|
17
|
+
* hooks — all concretely typed to `TRequest` / `TResponse`. Call this once per
|
|
18
|
+
* backing at module load; the returned components/hooks are stable references.
|
|
19
|
+
*/
|
|
20
|
+
function createHeadlessBindings() {
|
|
21
|
+
/**
|
|
22
|
+
* Holds the client built by the backing's `<DiscoProvider>`. Read it with
|
|
23
|
+
* `useDiscoClient` to fetch recommendations or create trackers.
|
|
24
|
+
*/
|
|
25
|
+
const DiscoClientContext = createContext$1(null);
|
|
26
|
+
/**
|
|
27
|
+
* Read the client configured by the surrounding `<DiscoProvider>`.
|
|
28
|
+
*
|
|
29
|
+
* Returns the single, stable, provider-configured instance — use this rather
|
|
30
|
+
* than constructing a client in a component (which would create a new one each
|
|
31
|
+
* render and risk drifting from the provider's auth/env). Throws if used
|
|
32
|
+
* outside a provider.
|
|
33
|
+
*/
|
|
34
|
+
function useDiscoClient() {
|
|
35
|
+
const client = useContext$1(DiscoClientContext);
|
|
36
|
+
if (!client) throw new Error("useDiscoClient must be used inside a <DiscoProvider>.");
|
|
37
|
+
return client;
|
|
38
|
+
}
|
|
39
|
+
const LOADING = {
|
|
40
|
+
status: "loading",
|
|
41
|
+
data: void 0,
|
|
42
|
+
error: void 0
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Fetch-on-mount state machine for a recommendations surface.
|
|
46
|
+
*
|
|
47
|
+
* Owns the request lifecycle — fetch on mount, refetch when the request
|
|
48
|
+
* changes or `refetch` is called, abort in-flight requests on unmount/change —
|
|
49
|
+
* and derives the session-bound tracker from each response. Renders nothing and
|
|
50
|
+
* knows nothing about the `Disco.*` contexts; `<Disco.Root>` adapts its result.
|
|
51
|
+
*
|
|
52
|
+
* Exported from each backing's `/headless` entry as the shared fetch
|
|
53
|
+
* primitive: `<Disco.Root>` builds on it. Reach for it directly only when
|
|
54
|
+
* building a custom surface that needs the fetch lifecycle without the
|
|
55
|
+
* `Disco.*` contexts.
|
|
56
|
+
*/
|
|
57
|
+
function useFetchRecommendations(request) {
|
|
58
|
+
const client = useDiscoClient();
|
|
59
|
+
const [state, setState] = useState$1(LOADING);
|
|
60
|
+
const [tracker, setTracker] = useState$1(null);
|
|
61
|
+
const requestKey = useMemo$1(() => JSON.stringify(request), [request]);
|
|
62
|
+
const [reloadCount, setReloadCount] = useState$1(0);
|
|
63
|
+
const refetch = useCallback$1(() => setReloadCount((n) => n + 1), []);
|
|
64
|
+
useEffect$1(() => {
|
|
65
|
+
const controller = new AbortController();
|
|
66
|
+
setState(LOADING);
|
|
67
|
+
setTracker(null);
|
|
68
|
+
client.getRecommendationsWithTracker(request, { signal: controller.signal }).then(({ data, tracker }) => {
|
|
69
|
+
if (controller.signal.aborted) return;
|
|
70
|
+
setState({
|
|
71
|
+
status: "success",
|
|
72
|
+
data,
|
|
73
|
+
error: void 0
|
|
74
|
+
});
|
|
75
|
+
setTracker(withImpressionDedupe(tracker));
|
|
76
|
+
}).catch((error) => {
|
|
77
|
+
if (controller.signal.aborted) return;
|
|
78
|
+
setState({
|
|
79
|
+
status: "error",
|
|
80
|
+
data: void 0,
|
|
81
|
+
error
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
return () => controller.abort();
|
|
85
|
+
}, [
|
|
86
|
+
client,
|
|
87
|
+
requestKey,
|
|
88
|
+
reloadCount
|
|
89
|
+
]);
|
|
90
|
+
return {
|
|
91
|
+
state,
|
|
92
|
+
tracker,
|
|
93
|
+
refetch
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const DiscoContext = createContext$1(null);
|
|
97
|
+
/**
|
|
98
|
+
* Read the recommendations fetch state, the session-bound tracker, and
|
|
99
|
+
* `refetch` from the surrounding `<Disco.Root>`. The tracker is non-null only
|
|
100
|
+
* once `status === "success"`; for consumers that only need the tracker and
|
|
101
|
+
* render inside a success branch, {@link useDiscoTracker} returns a non-null
|
|
102
|
+
* tracker and throws if used before success. Throws if used outside a
|
|
103
|
+
* `<Disco.Root>`.
|
|
104
|
+
*/
|
|
105
|
+
function useDiscoRecommendations() {
|
|
106
|
+
const ctx = useContext$1(DiscoContext);
|
|
107
|
+
if (!ctx) throw new Error("useDiscoRecommendations must be used inside a <Disco.Root>.");
|
|
108
|
+
return ctx;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Read the session-bound {@link EventTracker} for the surrounding
|
|
112
|
+
* `<Disco.Root>`.
|
|
113
|
+
*
|
|
114
|
+
* The tracker exists only once recommendations have loaded (its session comes
|
|
115
|
+
* from the response). Render tracking UI inside the `success` branch and this
|
|
116
|
+
* hook returns a ready tracker; it throws if used before `success`, surfacing
|
|
117
|
+
* misuse loudly rather than silently dropping events. Throws if used outside a
|
|
118
|
+
* `<Disco.Root>`.
|
|
119
|
+
*/
|
|
120
|
+
function useDiscoTracker() {
|
|
121
|
+
const ctx = useContext$1(DiscoContext);
|
|
122
|
+
if (!ctx) throw new Error("useDiscoTracker must be used inside a <Disco.Root>.");
|
|
123
|
+
if (!ctx.tracker) throw new Error("useDiscoTracker is only available after recommendations have loaded — render tracking UI inside the <Disco.Root> success branch.");
|
|
124
|
+
return ctx.tracker;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Headless controller for a Disco recommendations surface — the root of the
|
|
128
|
+
* `Disco.*` compound. Fetches via `useFetchRecommendations` and provides the
|
|
129
|
+
* fetch state (read with `useDiscoRecommendations`) and the session-bound
|
|
130
|
+
* tracker (read with `useDiscoTracker`) to its subtree. Renders no UI of its
|
|
131
|
+
* own; aborts in-flight requests on unmount or request change.
|
|
132
|
+
*/
|
|
133
|
+
function DiscoRoot({ request, children }) {
|
|
134
|
+
const { state, tracker, refetch } = useFetchRecommendations(request);
|
|
135
|
+
const value = useMemo$1(() => ({
|
|
136
|
+
...state,
|
|
137
|
+
tracker,
|
|
138
|
+
refetch
|
|
139
|
+
}), [
|
|
140
|
+
state,
|
|
141
|
+
tracker,
|
|
142
|
+
refetch
|
|
143
|
+
]);
|
|
144
|
+
return /* @__PURE__ */ jsx(DiscoContext.Provider, {
|
|
145
|
+
value,
|
|
146
|
+
children
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
DiscoClientContext,
|
|
151
|
+
useDiscoClient,
|
|
152
|
+
useDiscoRecommendations,
|
|
153
|
+
useDiscoTracker,
|
|
154
|
+
useFetchRecommendations,
|
|
155
|
+
DiscoRoot
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region ../react-shared/dist/bindings-D-XXI0bV.js
|
|
160
|
+
const bindings = createHeadlessBindings();
|
|
161
|
+
const DiscoClientContext = bindings.DiscoClientContext;
|
|
162
|
+
const useDiscoClient = bindings.useDiscoClient;
|
|
163
|
+
bindings.DiscoRoot;
|
|
164
|
+
const useFetchRecommendations = bindings.useFetchRecommendations;
|
|
165
|
+
bindings.useDiscoRecommendations;
|
|
166
|
+
bindings.useDiscoTracker;
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region ../react-shared/dist/headless-C9iZrlrk.js
|
|
169
|
+
const RendererContext = createContext$1(null);
|
|
170
|
+
function useRendererContext() {
|
|
171
|
+
const ctx = useContext$1(RendererContext);
|
|
172
|
+
if (!ctx) throw new Error("useRendererContext must be used within a ScreensRenderer");
|
|
173
|
+
return ctx;
|
|
174
|
+
}
|
|
175
|
+
function generateNodes({ nodes, path, renderers }) {
|
|
176
|
+
return nodes.map((node, idx) => {
|
|
177
|
+
const generator = renderers[node.type];
|
|
178
|
+
if (!generator) throw new Error(`No renderer found for node type: "${node.type}"`);
|
|
179
|
+
const nodePath = `${path}.${node.type}.${idx}`;
|
|
180
|
+
const reactNode = generator({
|
|
181
|
+
node,
|
|
182
|
+
nodesToJSX: (args) => generateNodes({
|
|
183
|
+
nodes: args.nodes,
|
|
184
|
+
path: nodePath,
|
|
185
|
+
renderers
|
|
186
|
+
})
|
|
187
|
+
});
|
|
188
|
+
if (isValidElement(reactNode)) return cloneElement(reactNode, { key: nodePath });
|
|
189
|
+
return reactNode;
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function ScreensRenderer({ jsonContent, renderers, fallback = null }) {
|
|
193
|
+
const screens = useMemo$1(() => parseScreens(jsonContent), [jsonContent]);
|
|
194
|
+
if (!screens) return fallback;
|
|
195
|
+
return createElement(ScreensNavigator, {
|
|
196
|
+
screens,
|
|
197
|
+
renderers
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
function ScreensNavigator({ screens, renderers }) {
|
|
201
|
+
const [currentScreenId, setCurrentScreenId] = useState$1(() => screens[0]?.id ?? "default");
|
|
202
|
+
useEffect$1(() => {
|
|
203
|
+
setCurrentScreenId(screens[0]?.id ?? "default");
|
|
204
|
+
}, [screens]);
|
|
205
|
+
const activeScreen = screens.find((screen) => screen.id === currentScreenId) ?? screens[0];
|
|
206
|
+
if (!activeScreen) return null;
|
|
207
|
+
return createElement(RendererContext.Provider, { value: {
|
|
208
|
+
screens,
|
|
209
|
+
currentScreenId: activeScreen.id,
|
|
210
|
+
setCurrentScreenId
|
|
211
|
+
} }, generateNodes({
|
|
212
|
+
nodes: activeScreen.children,
|
|
213
|
+
path: activeScreen.id,
|
|
214
|
+
renderers
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
217
|
+
//#endregion
|
|
9
218
|
//#region src/managers/RecommendationsTrackingManager/index.tsx
|
|
10
219
|
const RecommendationsTrackingManagerContext = createContext(null);
|
|
11
220
|
function RecommendationsTrackingManager({ children, tracker }) {
|
|
12
|
-
return /* @__PURE__ */ jsx(RecommendationsTrackingManagerContext.Provider, {
|
|
221
|
+
return /* @__PURE__ */ jsx$1(RecommendationsTrackingManagerContext.Provider, {
|
|
13
222
|
value: tracker,
|
|
14
223
|
children
|
|
15
224
|
});
|
|
@@ -32,7 +241,7 @@ const getShopIdentifier = (shopGid) => {
|
|
|
32
241
|
return shopGid.replace("gid://shopify/Shop/", "");
|
|
33
242
|
};
|
|
34
243
|
const shopifyOrderIdFormatter = (inp) => typeof inp === "string" ? inp.replace("gid://shopify/Order/", "") : inp;
|
|
35
|
-
const getRecommendationsRequest = ({ payload }) => {
|
|
244
|
+
const getRecommendationsRequest = ({ payload, widgetId }) => {
|
|
36
245
|
return {
|
|
37
246
|
user: {
|
|
38
247
|
email: payload.buyerEmail,
|
|
@@ -42,7 +251,8 @@ const getRecommendationsRequest = ({ payload }) => {
|
|
|
42
251
|
},
|
|
43
252
|
placement: {
|
|
44
253
|
displayMode: "INLINE",
|
|
45
|
-
view: payload.target
|
|
254
|
+
view: payload.target,
|
|
255
|
+
widgetId
|
|
46
256
|
},
|
|
47
257
|
order: {
|
|
48
258
|
amount: payload.totalCost,
|
|
@@ -65,7 +275,7 @@ const getRecommendationsRequest = ({ payload }) => {
|
|
|
65
275
|
//#endregion
|
|
66
276
|
//#region src/components/CardContainer.tsx
|
|
67
277
|
const CardContainer = ({ children, ...rest }) => {
|
|
68
|
-
return /* @__PURE__ */ jsx("s-box", {
|
|
278
|
+
return /* @__PURE__ */ jsx$1("s-box", {
|
|
69
279
|
border: "base",
|
|
70
280
|
borderWidth: "base",
|
|
71
281
|
borderRadius: "large",
|
|
@@ -84,16 +294,16 @@ const DummyDiscoFeedRow = () => {
|
|
|
84
294
|
direction: "inline",
|
|
85
295
|
gap: "small-200",
|
|
86
296
|
alignItems: "center",
|
|
87
|
-
children: [/* @__PURE__ */ jsx("s-box", {
|
|
297
|
+
children: [/* @__PURE__ */ jsx$1("s-box", {
|
|
88
298
|
blockSize: "18px",
|
|
89
299
|
inlineSize: "18px",
|
|
90
300
|
background: "subdued",
|
|
91
301
|
borderRadius: "base"
|
|
92
|
-
}), /* @__PURE__ */ jsx("s-skeleton-paragraph", { content: "Brand" })]
|
|
93
|
-
}), /* @__PURE__ */ jsx("s-scroll-box", { children: /* @__PURE__ */ jsx("s-grid", {
|
|
302
|
+
}), /* @__PURE__ */ jsx$1("s-skeleton-paragraph", { content: "Brand" })]
|
|
303
|
+
}), /* @__PURE__ */ jsx$1("s-scroll-box", { children: /* @__PURE__ */ jsx$1("s-grid", {
|
|
94
304
|
gridTemplateColumns: `repeat(10, ${productSize}px)`,
|
|
95
305
|
gap: "small-200",
|
|
96
|
-
children: Array.from({ length: 10 }, (_, index) => /* @__PURE__ */ jsx("s-box", {
|
|
306
|
+
children: Array.from({ length: 10 }, (_, index) => /* @__PURE__ */ jsx$1("s-box", {
|
|
97
307
|
blockSize: `${productSize}px`,
|
|
98
308
|
inlineSize: `${productSize}px`,
|
|
99
309
|
background: "subdued",
|
|
@@ -105,26 +315,58 @@ const DummyDiscoFeedRow = () => {
|
|
|
105
315
|
const DummyDiscoFeedContent = ({ isPadded = false, brandCount = 3, showHeading = false }) => /* @__PURE__ */ jsxs("s-stack", {
|
|
106
316
|
padding: isPadded ? DISCO_FEED_CARD_PADDING : void 0,
|
|
107
317
|
gap: "large-500",
|
|
108
|
-
children: [showHeading && /* @__PURE__ */ jsx("s-skeleton-paragraph", { content: "Recommendations" }), Array.from({ length: brandCount }, (_, index) => /* @__PURE__ */ jsx(DummyDiscoFeedRow, {}, index))]
|
|
318
|
+
children: [showHeading && /* @__PURE__ */ jsx$1("s-skeleton-paragraph", { content: "Recommendations" }), Array.from({ length: brandCount }, (_, index) => /* @__PURE__ */ jsx$1(DummyDiscoFeedRow, {}, index))]
|
|
109
319
|
});
|
|
110
|
-
const DummyDiscoFeed = () => /* @__PURE__ */ jsx(CardContainer, {
|
|
320
|
+
const DummyDiscoFeed = () => /* @__PURE__ */ jsx$1(CardContainer, {
|
|
111
321
|
background: "base",
|
|
112
|
-
children: /* @__PURE__ */ jsx(DummyDiscoFeedContent, {
|
|
322
|
+
children: /* @__PURE__ */ jsx$1(DummyDiscoFeedContent, {
|
|
113
323
|
brandCount: 4,
|
|
114
324
|
showHeading: true,
|
|
115
325
|
isPadded: true
|
|
116
326
|
})
|
|
117
327
|
});
|
|
118
328
|
//#endregion
|
|
119
|
-
//#region src/
|
|
120
|
-
const
|
|
329
|
+
//#region src/sdkIdentity.ts
|
|
330
|
+
const SDK_IDENTITY = {
|
|
121
331
|
name: "@disconetwork/shopify",
|
|
122
|
-
version: "0.0.
|
|
123
|
-
}
|
|
332
|
+
version: "0.0.5"
|
|
333
|
+
};
|
|
334
|
+
//#endregion
|
|
335
|
+
//#region ../react-shared/dist/sdk-internals.js
|
|
336
|
+
/** @internal Bind SDK identity to a provider using the legacy backend proxy. */
|
|
337
|
+
function createProxySdkProvider(sdk) {
|
|
338
|
+
return function ProxySdkProvider({ children, ...auth }) {
|
|
339
|
+
const apiKey = "apiKey" in auth ? auth.apiKey : void 0;
|
|
340
|
+
const surface = "surface" in auth ? auth.surface : void 0;
|
|
341
|
+
const shopGid = "shopGid" in auth ? auth.shopGid : void 0;
|
|
342
|
+
const env = "env" in auth ? auth.env : void 0;
|
|
343
|
+
const client = useMemo$1(() => apiKey !== void 0 ? new InternalDiscoClient({
|
|
344
|
+
apiKey,
|
|
345
|
+
surface,
|
|
346
|
+
sdk
|
|
347
|
+
}) : new InternalDiscoClient({
|
|
348
|
+
shopGid,
|
|
349
|
+
env,
|
|
350
|
+
sdk
|
|
351
|
+
}), [
|
|
352
|
+
apiKey,
|
|
353
|
+
surface,
|
|
354
|
+
shopGid,
|
|
355
|
+
env
|
|
356
|
+
]);
|
|
357
|
+
return /* @__PURE__ */ jsx(DiscoClientContext.Provider, {
|
|
358
|
+
value: client,
|
|
359
|
+
children
|
|
360
|
+
});
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
//#endregion
|
|
364
|
+
//#region src/managers/DataManager.tsx
|
|
365
|
+
const ShopifySdkProvider = createProxySdkProvider(SDK_IDENTITY);
|
|
124
366
|
const MIN_LOADING_VIEW_HEIGHT = 800;
|
|
125
|
-
const DataManager = ({ auth, children }) => {
|
|
367
|
+
const DataManager = ({ auth, widgetId, children }) => {
|
|
126
368
|
const payload = usePayload();
|
|
127
|
-
return /* @__PURE__ */ jsx(ShopifySdkProvider, {
|
|
369
|
+
return /* @__PURE__ */ jsx$1(ShopifySdkProvider, {
|
|
128
370
|
..."apiKey" in auth ? {
|
|
129
371
|
apiKey: auth.apiKey,
|
|
130
372
|
surface: "shopify"
|
|
@@ -132,8 +374,11 @@ const DataManager = ({ auth, children }) => {
|
|
|
132
374
|
shopGid: payload.shopGid,
|
|
133
375
|
env: auth.env
|
|
134
376
|
},
|
|
135
|
-
children: /* @__PURE__ */ jsx(RecommendationsContent, {
|
|
136
|
-
request: getRecommendationsRequest({
|
|
377
|
+
children: /* @__PURE__ */ jsx$1(RecommendationsContent, {
|
|
378
|
+
request: getRecommendationsRequest({
|
|
379
|
+
payload,
|
|
380
|
+
widgetId
|
|
381
|
+
}),
|
|
137
382
|
children
|
|
138
383
|
})
|
|
139
384
|
});
|
|
@@ -141,13 +386,13 @@ const DataManager = ({ auth, children }) => {
|
|
|
141
386
|
const RecommendationsContent = ({ children, request }) => {
|
|
142
387
|
const { state: recommendations, tracker } = useFetchRecommendations(request);
|
|
143
388
|
if (recommendations.status === "error") return null;
|
|
144
|
-
if (recommendations.status === "loading" || !tracker) return /* @__PURE__ */ jsx("s-box", {
|
|
389
|
+
if (recommendations.status === "loading" || !tracker) return /* @__PURE__ */ jsx$1("s-box", {
|
|
145
390
|
minBlockSize: `${MIN_LOADING_VIEW_HEIGHT}px`,
|
|
146
|
-
children: /* @__PURE__ */ jsx(DummyDiscoFeed, {}, "dummy-feed")
|
|
391
|
+
children: /* @__PURE__ */ jsx$1(DummyDiscoFeed, {}, "dummy-feed")
|
|
147
392
|
});
|
|
148
|
-
return /* @__PURE__ */ jsx(RecommendationsDataContext.Provider, {
|
|
393
|
+
return /* @__PURE__ */ jsx$1(RecommendationsDataContext.Provider, {
|
|
149
394
|
value: recommendations.data,
|
|
150
|
-
children: /* @__PURE__ */ jsx(RecommendationsTrackingManager, {
|
|
395
|
+
children: /* @__PURE__ */ jsx$1(RecommendationsTrackingManager, {
|
|
151
396
|
tracker,
|
|
152
397
|
children
|
|
153
398
|
})
|
|
@@ -161,7 +406,7 @@ const GenericPayloadProvider = ({ target, children, payload, additionalPayload,
|
|
|
161
406
|
throw new Error("[Disco]: Disabling for B2B purchase");
|
|
162
407
|
}, [isB2BPurchase]);
|
|
163
408
|
if (isB2BPurchase) return null;
|
|
164
|
-
return /* @__PURE__ */ jsx(PayloadContext.Provider, {
|
|
409
|
+
return /* @__PURE__ */ jsx$1(PayloadContext.Provider, {
|
|
165
410
|
value: {
|
|
166
411
|
...payload,
|
|
167
412
|
...additionalPayload || {},
|
|
@@ -212,7 +457,7 @@ const ThankYouPayloadManager = ({ children }) => {
|
|
|
212
457
|
const api = useApi();
|
|
213
458
|
const orderId = useSubscription(api.orderConfirmation).order.id.split("/").pop();
|
|
214
459
|
if (!orderId) console.warn("[Disco]: Order ID not found in thank you page");
|
|
215
|
-
return /* @__PURE__ */ jsx(GenericPayloadProvider, {
|
|
460
|
+
return /* @__PURE__ */ jsx$1(GenericPayloadProvider, {
|
|
216
461
|
target,
|
|
217
462
|
payload: createGenericPayload({
|
|
218
463
|
buyerPhone,
|
|
@@ -249,7 +494,7 @@ const OrderStatusPayloadManager = ({ children }) => {
|
|
|
249
494
|
const shop = useShop$1();
|
|
250
495
|
const order = useOrder();
|
|
251
496
|
const api = useApi$1();
|
|
252
|
-
return /* @__PURE__ */ jsx(GenericPayloadProvider, {
|
|
497
|
+
return /* @__PURE__ */ jsx$1(GenericPayloadProvider, {
|
|
253
498
|
target,
|
|
254
499
|
payload: createGenericPayload({
|
|
255
500
|
buyerPhone,
|
|
@@ -286,8 +531,8 @@ const getExtensionTarget = () => globalThis.shopify?.extension?.target;
|
|
|
286
531
|
const PayloadManager = ({ children }) => {
|
|
287
532
|
const extensionTarget = getExtensionTarget();
|
|
288
533
|
const target = extensionTarget && EXTENSION_TARGETS[extensionTarget];
|
|
289
|
-
if (target === PAYLOAD_MANAGER_TARGET.THANK_YOU) return /* @__PURE__ */ jsx(ThankYouPayloadManager, { children });
|
|
290
|
-
if (target === PAYLOAD_MANAGER_TARGET.ORDER_STATUS) return /* @__PURE__ */ jsx(OrderStatusPayloadManager, { children });
|
|
534
|
+
if (target === PAYLOAD_MANAGER_TARGET.THANK_YOU) return /* @__PURE__ */ jsx$1(ThankYouPayloadManager, { children });
|
|
535
|
+
if (target === PAYLOAD_MANAGER_TARGET.ORDER_STATUS) return /* @__PURE__ */ jsx$1(OrderStatusPayloadManager, { children });
|
|
291
536
|
throw new Error(`[Disco]: Unsupported extension target ${extensionTarget ?? "(none)"}`);
|
|
292
537
|
};
|
|
293
538
|
//#endregion
|
|
@@ -303,7 +548,7 @@ const UserManager = ({ children }) => {
|
|
|
303
548
|
extrapolatedFirstName
|
|
304
549
|
});
|
|
305
550
|
const hasIdentity = useMemo(() => !!user?.email, [user]);
|
|
306
|
-
return /* @__PURE__ */ jsx(UserContext.Provider, {
|
|
551
|
+
return /* @__PURE__ */ jsx$1(UserContext.Provider, {
|
|
307
552
|
value: {
|
|
308
553
|
user,
|
|
309
554
|
setUser,
|
|
@@ -384,7 +629,7 @@ const HeroOfferProvider = ({ children, recommendationGroup, loop }) => {
|
|
|
384
629
|
claimedOffers,
|
|
385
630
|
recommendations
|
|
386
631
|
};
|
|
387
|
-
return /* @__PURE__ */ jsx(HeroContext.Provider, {
|
|
632
|
+
return /* @__PURE__ */ jsx$1(HeroContext.Provider, {
|
|
388
633
|
value,
|
|
389
634
|
children
|
|
390
635
|
});
|
|
@@ -399,7 +644,7 @@ const useHeroOffer = () => {
|
|
|
399
644
|
const ScrollableSlotContext = createContext(null);
|
|
400
645
|
const ScrollableSlotProvider = ({ children, scrollableRecommendationGroup }) => {
|
|
401
646
|
const value = { hasScrollableSlot: !!scrollableRecommendationGroup };
|
|
402
|
-
return /* @__PURE__ */ jsx(ScrollableSlotContext.Provider, {
|
|
647
|
+
return /* @__PURE__ */ jsx$1(ScrollableSlotContext.Provider, {
|
|
403
648
|
value,
|
|
404
649
|
children
|
|
405
650
|
});
|
|
@@ -536,7 +781,7 @@ const useDiscoEnv = () => useDiscoClient().env;
|
|
|
536
781
|
//#region src/components/Essential/generation/LinkGenerator.tsx
|
|
537
782
|
function InternalLink({ targetScreenId, children }) {
|
|
538
783
|
const ctx = useRendererContext();
|
|
539
|
-
return /* @__PURE__ */ jsx("s-link", {
|
|
784
|
+
return /* @__PURE__ */ jsx$1("s-link", {
|
|
540
785
|
tone: "neutral",
|
|
541
786
|
onClick: () => ctx.setCurrentScreenId(targetScreenId),
|
|
542
787
|
children
|
|
@@ -544,13 +789,13 @@ function InternalLink({ targetScreenId, children }) {
|
|
|
544
789
|
}
|
|
545
790
|
const LinkGenerator = { link: ({ node, nodesToJSX }) => {
|
|
546
791
|
const children = nodesToJSX({ nodes: node.children });
|
|
547
|
-
if ("targetScreenId" in node.attributes) return /* @__PURE__ */ jsx(InternalLink, {
|
|
792
|
+
if ("targetScreenId" in node.attributes) return /* @__PURE__ */ jsx$1(InternalLink, {
|
|
548
793
|
targetScreenId: node.attributes.targetScreenId,
|
|
549
794
|
children
|
|
550
795
|
});
|
|
551
796
|
const href = node.attributes.to;
|
|
552
797
|
const external = node.attributes.external;
|
|
553
|
-
return /* @__PURE__ */ jsx("s-link", {
|
|
798
|
+
return /* @__PURE__ */ jsx$1("s-link", {
|
|
554
799
|
tone: "neutral",
|
|
555
800
|
href,
|
|
556
801
|
target: external ? "_blank" : "auto",
|
|
@@ -560,9 +805,9 @@ const LinkGenerator = { link: ({ node, nodesToJSX }) => {
|
|
|
560
805
|
//#endregion
|
|
561
806
|
//#region src/components/Essential/generation/ParagraphGenerator.tsx
|
|
562
807
|
const ParagraphGenerator = { paragraph: ({ node, nodesToJSX }) => {
|
|
563
|
-
return /* @__PURE__ */ jsx("s-paragraph", {
|
|
808
|
+
return /* @__PURE__ */ jsx$1("s-paragraph", {
|
|
564
809
|
color: "subdued",
|
|
565
|
-
children: /* @__PURE__ */ jsx("s-text", {
|
|
810
|
+
children: /* @__PURE__ */ jsx$1("s-text", {
|
|
566
811
|
type: "strong",
|
|
567
812
|
children: nodesToJSX({ nodes: node.children })
|
|
568
813
|
})
|
|
@@ -573,7 +818,7 @@ const ParagraphGenerator = { paragraph: ({ node, nodesToJSX }) => {
|
|
|
573
818
|
const DEFAULT_MAX_BLOCK_SIZE = 300;
|
|
574
819
|
const ScrollViewGenerator = { scrollview: ({ node, nodesToJSX }) => {
|
|
575
820
|
const children = nodesToJSX({ nodes: node.children });
|
|
576
|
-
return /* @__PURE__ */ jsx("s-scroll-box", {
|
|
821
|
+
return /* @__PURE__ */ jsx$1("s-scroll-box", {
|
|
577
822
|
maxBlockSize: `${node.attributes?.maxBlockSize ?? DEFAULT_MAX_BLOCK_SIZE}px`,
|
|
578
823
|
children
|
|
579
824
|
});
|
|
@@ -591,12 +836,12 @@ const renderers = {
|
|
|
591
836
|
const EssentialOfferContent = ({ heading: offerHeading, subheading: offerSubheading, jsonContent: incentiveJson }) => {
|
|
592
837
|
return /* @__PURE__ */ jsxs("s-stack", {
|
|
593
838
|
gap: "small-200",
|
|
594
|
-
children: [/* @__PURE__ */ jsx("s-heading", { children: offerHeading }), /* @__PURE__ */ jsx(ScreensRenderer, {
|
|
839
|
+
children: [/* @__PURE__ */ jsx$1("s-heading", { children: offerHeading }), /* @__PURE__ */ jsx$1(ScreensRenderer, {
|
|
595
840
|
jsonContent: incentiveJson,
|
|
596
841
|
renderers,
|
|
597
|
-
fallback: /* @__PURE__ */ jsx("s-paragraph", {
|
|
842
|
+
fallback: /* @__PURE__ */ jsx$1("s-paragraph", {
|
|
598
843
|
color: "subdued",
|
|
599
|
-
children: /* @__PURE__ */ jsx("s-text", {
|
|
844
|
+
children: /* @__PURE__ */ jsx$1("s-text", {
|
|
600
845
|
type: "strong",
|
|
601
846
|
children: offerSubheading || ""
|
|
602
847
|
})
|
|
@@ -609,43 +854,43 @@ const EssentialOfferContent = ({ heading: offerHeading, subheading: offerSubhead
|
|
|
609
854
|
const EssentialLayoutType = ({ onLastOffer, compact }) => {
|
|
610
855
|
const { isFirstOffer, activeRecommendation: recommendation } = useHeroOffer();
|
|
611
856
|
const renderBrandLogo = recommendation.offer.metadata.layoutType === "FEATURED_IMAGE";
|
|
612
|
-
return /* @__PURE__ */ jsx("s-query-container", { children: /* @__PURE__ */ jsx("s-box", {
|
|
857
|
+
return /* @__PURE__ */ jsx$1("s-query-container", { children: /* @__PURE__ */ jsx$1("s-box", {
|
|
613
858
|
padding: compact ? "none" : "base",
|
|
614
859
|
children: /* @__PURE__ */ jsxs("s-stack", {
|
|
615
860
|
gap: "small-400",
|
|
616
861
|
children: [
|
|
617
|
-
renderBrandLogo && /* @__PURE__ */ jsx("s-box", {
|
|
862
|
+
renderBrandLogo && /* @__PURE__ */ jsx$1("s-box", {
|
|
618
863
|
display: "@container (inline-size > 450px) none, auto",
|
|
619
|
-
children: /* @__PURE__ */ jsx("s-stack", {
|
|
864
|
+
children: /* @__PURE__ */ jsx$1("s-stack", {
|
|
620
865
|
alignItems: "center",
|
|
621
|
-
children: /* @__PURE__ */ jsx(AdvertiserLogo, { recommendation })
|
|
866
|
+
children: /* @__PURE__ */ jsx$1(AdvertiserLogo, { recommendation })
|
|
622
867
|
})
|
|
623
868
|
}),
|
|
624
|
-
isFirstOffer && !compact && /* @__PURE__ */ jsx(FirstOfferHeading, {}),
|
|
869
|
+
isFirstOffer && !compact && /* @__PURE__ */ jsx$1(FirstOfferHeading, {}),
|
|
625
870
|
/* @__PURE__ */ jsxs("s-grid", {
|
|
626
871
|
gridTemplateColumns: renderBrandLogo ? "@container (inline-size > 450px) 1fr auto, 1fr" : "1fr",
|
|
627
872
|
gap: "base",
|
|
628
873
|
alignItems: "center",
|
|
629
874
|
children: [/* @__PURE__ */ jsxs("s-stack", {
|
|
630
875
|
gap: "base",
|
|
631
|
-
children: [/* @__PURE__ */ jsx(EssentialOfferContent, {
|
|
876
|
+
children: [/* @__PURE__ */ jsx$1(EssentialOfferContent, {
|
|
632
877
|
heading: recommendation.offer.heading || "",
|
|
633
878
|
subheading: recommendation.offer.subheading || "",
|
|
634
879
|
jsonContent: recommendation.offer.jsonContent
|
|
635
880
|
}), /* @__PURE__ */ jsxs("s-stack", {
|
|
636
881
|
direction: "@container (inline-size > 450px) inline, block",
|
|
637
882
|
gap: "base",
|
|
638
|
-
children: [/* @__PURE__ */ jsx("s-box", {
|
|
883
|
+
children: [/* @__PURE__ */ jsx$1("s-box", {
|
|
639
884
|
inlineSize: "@container (inline-size > 450px) auto, 100%",
|
|
640
|
-
children: /* @__PURE__ */ jsx(PrimaryButton, {})
|
|
641
|
-
}), /* @__PURE__ */ jsx("s-box", {
|
|
885
|
+
children: /* @__PURE__ */ jsx$1(PrimaryButton, {})
|
|
886
|
+
}), /* @__PURE__ */ jsx$1("s-box", {
|
|
642
887
|
inlineSize: "@container (inline-size > 450px) auto, 100%",
|
|
643
|
-
children: /* @__PURE__ */ jsx(SecondaryButton, { onLastOffer })
|
|
888
|
+
children: /* @__PURE__ */ jsx$1(SecondaryButton, { onLastOffer })
|
|
644
889
|
})]
|
|
645
890
|
})]
|
|
646
|
-
}), renderBrandLogo && /* @__PURE__ */ jsx("s-box", {
|
|
891
|
+
}), renderBrandLogo && /* @__PURE__ */ jsx$1("s-box", {
|
|
647
892
|
display: "@container (inline-size > 450px) auto, none",
|
|
648
|
-
children: /* @__PURE__ */ jsx(AdvertiserLogo, { recommendation })
|
|
893
|
+
children: /* @__PURE__ */ jsx$1(AdvertiserLogo, { recommendation })
|
|
649
894
|
})]
|
|
650
895
|
})
|
|
651
896
|
]
|
|
@@ -660,10 +905,10 @@ function AdvertiserLogo({ recommendation }) {
|
|
|
660
905
|
env,
|
|
661
906
|
size: imageSize
|
|
662
907
|
});
|
|
663
|
-
return /* @__PURE__ */ jsx("s-box", {
|
|
908
|
+
return /* @__PURE__ */ jsx$1("s-box", {
|
|
664
909
|
blockSize: `${imageSize}px`,
|
|
665
910
|
inlineSize: `${imageSize}px`,
|
|
666
|
-
children: /* @__PURE__ */ jsx("s-image", {
|
|
911
|
+
children: /* @__PURE__ */ jsx$1("s-image", {
|
|
667
912
|
aspectRatio: "1",
|
|
668
913
|
src: image.src,
|
|
669
914
|
srcSet: image.srcSet,
|
|
@@ -687,7 +932,7 @@ function PrimaryButton() {
|
|
|
687
932
|
});
|
|
688
933
|
handleOfferClaim();
|
|
689
934
|
};
|
|
690
|
-
return /* @__PURE__ */ jsx("s-button", {
|
|
935
|
+
return /* @__PURE__ */ jsx$1("s-button", {
|
|
691
936
|
href: recommendation.offer.targetUrl,
|
|
692
937
|
target: "_blank",
|
|
693
938
|
inlineSize: "fill",
|
|
@@ -717,7 +962,7 @@ function SecondaryButton({ onLastOffer }) {
|
|
|
717
962
|
nextOffer();
|
|
718
963
|
};
|
|
719
964
|
const buttonText = isOfferClaimed ? isLastOffer ? hasScrollableSlot ? "See more" : "Close" : "Next offer" : recommendation.offer.ctaDetails.declineCopy || "No thanks";
|
|
720
|
-
return /* @__PURE__ */ jsx("s-button", {
|
|
965
|
+
return /* @__PURE__ */ jsx$1("s-button", {
|
|
721
966
|
inlineSize: "fill",
|
|
722
967
|
variant: isOfferClaimed ? "primary" : "secondary",
|
|
723
968
|
onClick: handleClick,
|
|
@@ -725,7 +970,7 @@ function SecondaryButton({ onLastOffer }) {
|
|
|
725
970
|
});
|
|
726
971
|
}
|
|
727
972
|
function FirstOfferHeading() {
|
|
728
|
-
return /* @__PURE__ */ jsx("s-text", {
|
|
973
|
+
return /* @__PURE__ */ jsx$1("s-text", {
|
|
729
974
|
tone: "info",
|
|
730
975
|
children: useFirstOfferHeading()
|
|
731
976
|
});
|
|
@@ -734,13 +979,13 @@ function FirstOfferHeading() {
|
|
|
734
979
|
//#region src/components/RecommendationsWidget/DotIndicators.tsx
|
|
735
980
|
const DotIndicators = ({ totalCount, activeIndex }) => {
|
|
736
981
|
if (totalCount <= 1) return null;
|
|
737
|
-
return /* @__PURE__ */ jsx("s-stack", {
|
|
982
|
+
return /* @__PURE__ */ jsx$1("s-stack", {
|
|
738
983
|
padding: "small-200 none",
|
|
739
984
|
alignItems: "center",
|
|
740
|
-
children: /* @__PURE__ */ jsx("s-stack", {
|
|
985
|
+
children: /* @__PURE__ */ jsx$1("s-stack", {
|
|
741
986
|
direction: "inline",
|
|
742
987
|
gap: "small-200",
|
|
743
|
-
children: Array.from({ length: totalCount }, (_, i) => /* @__PURE__ */ jsx("s-badge", {
|
|
988
|
+
children: Array.from({ length: totalCount }, (_, i) => /* @__PURE__ */ jsx$1("s-badge", {
|
|
744
989
|
size: "small",
|
|
745
990
|
color: i === activeIndex ? "base" : "subdued",
|
|
746
991
|
children: `${i + 1}`
|
|
@@ -755,9 +1000,9 @@ const PRIVACY_POLICY_URL = "https://www.disconetwork.com/privacy-policy";
|
|
|
755
1000
|
//#endregion
|
|
756
1001
|
//#region src/components/PrivacyLink.tsx
|
|
757
1002
|
const PrivacyLink = ({ onPress }) => {
|
|
758
|
-
return /* @__PURE__ */ jsx("s-text", {
|
|
1003
|
+
return /* @__PURE__ */ jsx$1("s-text", {
|
|
759
1004
|
color: "subdued",
|
|
760
|
-
children: /* @__PURE__ */ jsx("s-link", {
|
|
1005
|
+
children: /* @__PURE__ */ jsx$1("s-link", {
|
|
761
1006
|
href: PRIVACY_POLICY_URL,
|
|
762
1007
|
target: "_blank",
|
|
763
1008
|
tone: "neutral",
|
|
@@ -776,10 +1021,10 @@ function Footer() {
|
|
|
776
1021
|
target: "INLINE_FOOTER_PRIVACY"
|
|
777
1022
|
});
|
|
778
1023
|
};
|
|
779
|
-
return /* @__PURE__ */ jsx("s-stack", {
|
|
1024
|
+
return /* @__PURE__ */ jsx$1("s-stack", {
|
|
780
1025
|
padding: "small-200 base",
|
|
781
1026
|
alignItems: "end",
|
|
782
|
-
children: /* @__PURE__ */ jsx(PrivacyLink, { onPress: handlePrivacyClick })
|
|
1027
|
+
children: /* @__PURE__ */ jsx$1(PrivacyLink, { onPress: handlePrivacyClick })
|
|
783
1028
|
});
|
|
784
1029
|
}
|
|
785
1030
|
//#endregion
|
|
@@ -789,10 +1034,10 @@ const CoverRecommendationsWidget = ({ heroRecommendationGroup }) => {
|
|
|
789
1034
|
useEffect(() => {
|
|
790
1035
|
track({ type: "WIDGET_LOAD" });
|
|
791
1036
|
}, [track]);
|
|
792
|
-
return /* @__PURE__ */ jsx(HeroOfferProvider, {
|
|
1037
|
+
return /* @__PURE__ */ jsx$1(HeroOfferProvider, {
|
|
793
1038
|
recommendationGroup: heroRecommendationGroup,
|
|
794
1039
|
loop: true,
|
|
795
|
-
children: /* @__PURE__ */ jsx(CoverRecommendationsWidgetContent, {})
|
|
1040
|
+
children: /* @__PURE__ */ jsx$1(CoverRecommendationsWidgetContent, {})
|
|
796
1041
|
});
|
|
797
1042
|
};
|
|
798
1043
|
const CoverRecommendationsWidgetContent = () => {
|
|
@@ -821,19 +1066,19 @@ const CoverRecommendationsWidgetContent = () => {
|
|
|
821
1066
|
advertiser.id
|
|
822
1067
|
]);
|
|
823
1068
|
const subtitle = `You've unlocked ${TOTAL_NUM_OFFERS} exclusive offer${TOTAL_NUM_OFFERS !== 1 ? "s" : ""} with your purchase — don't let them go to waste!`;
|
|
824
|
-
return /* @__PURE__ */ jsx(CardContainer, {
|
|
1069
|
+
return /* @__PURE__ */ jsx$1(CardContainer, {
|
|
825
1070
|
background: "transparent",
|
|
826
|
-
children: /* @__PURE__ */ jsx("s-box", {
|
|
1071
|
+
children: /* @__PURE__ */ jsx$1("s-box", {
|
|
827
1072
|
padding: "base",
|
|
828
1073
|
children: /* @__PURE__ */ jsxs("s-stack", {
|
|
829
1074
|
gap: "base",
|
|
830
1075
|
children: [
|
|
831
|
-
/* @__PURE__ */ jsx("s-heading", { children: "Your purchase comes with rewards!" }),
|
|
832
|
-
/* @__PURE__ */ jsx("s-text", {
|
|
1076
|
+
/* @__PURE__ */ jsx$1("s-heading", { children: "Your purchase comes with rewards!" }),
|
|
1077
|
+
/* @__PURE__ */ jsx$1("s-text", {
|
|
833
1078
|
color: "subdued",
|
|
834
1079
|
children: subtitle
|
|
835
1080
|
}),
|
|
836
|
-
/* @__PURE__ */ jsx("s-button", {
|
|
1081
|
+
/* @__PURE__ */ jsx$1("s-button", {
|
|
837
1082
|
variant: "primary",
|
|
838
1083
|
command: "--show",
|
|
839
1084
|
commandFor: "cover-modal",
|
|
@@ -860,16 +1105,16 @@ const CoverRecommendationsWidgetContent = () => {
|
|
|
860
1105
|
});
|
|
861
1106
|
},
|
|
862
1107
|
children: [
|
|
863
|
-
/* @__PURE__ */ jsx(ScrollableSlotProvider, { children: /* @__PURE__ */ jsx(EssentialLayoutType, {
|
|
1108
|
+
/* @__PURE__ */ jsx$1(ScrollableSlotProvider, { children: /* @__PURE__ */ jsx$1(EssentialLayoutType, {
|
|
864
1109
|
onLastOffer: nextOffer,
|
|
865
1110
|
compact: true
|
|
866
1111
|
}) }),
|
|
867
|
-
/* @__PURE__ */ jsx(DotIndicators, {
|
|
1112
|
+
/* @__PURE__ */ jsx$1(DotIndicators, {
|
|
868
1113
|
totalCount: TOTAL_NUM_OFFERS,
|
|
869
1114
|
activeIndex: activeOfferIndex
|
|
870
1115
|
}),
|
|
871
|
-
/* @__PURE__ */ jsx("s-divider", {}),
|
|
872
|
-
/* @__PURE__ */ jsx(Footer, {})
|
|
1116
|
+
/* @__PURE__ */ jsx$1("s-divider", {}),
|
|
1117
|
+
/* @__PURE__ */ jsx$1(Footer, {})
|
|
873
1118
|
]
|
|
874
1119
|
})
|
|
875
1120
|
]
|
|
@@ -880,19 +1125,19 @@ const CoverRecommendationsWidgetContent = () => {
|
|
|
880
1125
|
//#endregion
|
|
881
1126
|
//#region src/components/DiscoFeed/DiscoFeedProduct.tsx
|
|
882
1127
|
function ProductTile({ targetUrl, trackClick, image, productName }) {
|
|
883
|
-
return /* @__PURE__ */ jsx("s-box", {
|
|
1128
|
+
return /* @__PURE__ */ jsx$1("s-box", {
|
|
884
1129
|
inlineSize: "100%",
|
|
885
1130
|
children: /* @__PURE__ */ jsxs("s-stack", {
|
|
886
1131
|
alignItems: "stretch",
|
|
887
1132
|
gap: "none",
|
|
888
|
-
children: [/* @__PURE__ */ jsx("s-link", {
|
|
1133
|
+
children: [/* @__PURE__ */ jsx$1("s-link", {
|
|
889
1134
|
target: "_blank",
|
|
890
1135
|
tone: "neutral",
|
|
891
1136
|
href: targetUrl,
|
|
892
1137
|
onClick: trackClick,
|
|
893
|
-
children: /* @__PURE__ */ jsx("s-box", {
|
|
1138
|
+
children: /* @__PURE__ */ jsx$1("s-box", {
|
|
894
1139
|
inlineSize: "100%",
|
|
895
|
-
children: /* @__PURE__ */ jsx("s-image", {
|
|
1140
|
+
children: /* @__PURE__ */ jsx$1("s-image", {
|
|
896
1141
|
aspectRatio: "1",
|
|
897
1142
|
src: image.src,
|
|
898
1143
|
srcSet: image.srcSet,
|
|
@@ -902,15 +1147,15 @@ function ProductTile({ targetUrl, trackClick, image, productName }) {
|
|
|
902
1147
|
borderRadius: "small"
|
|
903
1148
|
})
|
|
904
1149
|
})
|
|
905
|
-
}), /* @__PURE__ */ jsx("s-stack", {
|
|
1150
|
+
}), /* @__PURE__ */ jsx$1("s-stack", {
|
|
906
1151
|
maxBlockSize: "50px",
|
|
907
1152
|
maxInlineSize: "100%",
|
|
908
1153
|
padding: "small-400 none none none",
|
|
909
1154
|
overflow: "hidden",
|
|
910
|
-
children: /* @__PURE__ */ jsx("s-text", {
|
|
1155
|
+
children: /* @__PURE__ */ jsx$1("s-text", {
|
|
911
1156
|
type: "strong",
|
|
912
1157
|
color: "subdued",
|
|
913
|
-
children: /* @__PURE__ */ jsx("s-link", {
|
|
1158
|
+
children: /* @__PURE__ */ jsx$1("s-link", {
|
|
914
1159
|
target: "_blank",
|
|
915
1160
|
tone: "neutral",
|
|
916
1161
|
href: targetUrl,
|
|
@@ -927,7 +1172,7 @@ function ProductTile({ targetUrl, trackClick, image, productName }) {
|
|
|
927
1172
|
const PAGE_SIZE = 4;
|
|
928
1173
|
const PRODUCT_IMAGE_SOURCE_SIZE = 256;
|
|
929
1174
|
const RecommendationsOfferRow = ({ recommendations, padding }) => {
|
|
930
|
-
return /* @__PURE__ */ jsx(RecommendationsPager, {
|
|
1175
|
+
return /* @__PURE__ */ jsx$1(RecommendationsPager, {
|
|
931
1176
|
recommendations: recommendations.filter((recommendation) => recommendation.offer.assets.length > 0),
|
|
932
1177
|
padding
|
|
933
1178
|
});
|
|
@@ -941,16 +1186,16 @@ function RecommendationsPager({ recommendations, padding }) {
|
|
|
941
1186
|
if (page !== currentPage) setPage(currentPage);
|
|
942
1187
|
}, [page, currentPage]);
|
|
943
1188
|
if (pageRecommendations.length === 0) return null;
|
|
944
|
-
return /* @__PURE__ */ jsx("s-box", {
|
|
1189
|
+
return /* @__PURE__ */ jsx$1("s-box", {
|
|
945
1190
|
padding,
|
|
946
1191
|
children: /* @__PURE__ */ jsxs("s-stack", {
|
|
947
1192
|
gap: "base",
|
|
948
|
-
children: [/* @__PURE__ */ jsx("s-grid", {
|
|
1193
|
+
children: [/* @__PURE__ */ jsx$1("s-grid", {
|
|
949
1194
|
gridTemplateColumns: "repeat(4, minmax(0, 1fr))",
|
|
950
1195
|
gap: "small-200",
|
|
951
|
-
children: pageRecommendations.map((recommendation) => /* @__PURE__ */ jsx("s-box", {
|
|
1196
|
+
children: pageRecommendations.map((recommendation) => /* @__PURE__ */ jsx$1("s-box", {
|
|
952
1197
|
inlineSize: "100%",
|
|
953
|
-
children: /* @__PURE__ */ jsx(RecommendationsOfferRowTile, { recommendation })
|
|
1198
|
+
children: /* @__PURE__ */ jsx$1(RecommendationsOfferRowTile, { recommendation })
|
|
954
1199
|
}, recommendation.id))
|
|
955
1200
|
}), pageCount > 1 && /* @__PURE__ */ jsxs("s-stack", {
|
|
956
1201
|
direction: "inline",
|
|
@@ -958,7 +1203,7 @@ function RecommendationsPager({ recommendations, padding }) {
|
|
|
958
1203
|
alignItems: "center",
|
|
959
1204
|
gap: "small-200",
|
|
960
1205
|
children: [
|
|
961
|
-
/* @__PURE__ */ jsx("s-clickable", {
|
|
1206
|
+
/* @__PURE__ */ jsx$1("s-clickable", {
|
|
962
1207
|
accessibilityLabel: "Previous recommendations page",
|
|
963
1208
|
disabled: currentPage === 0,
|
|
964
1209
|
inlineSize: "32px",
|
|
@@ -966,11 +1211,11 @@ function RecommendationsPager({ recommendations, padding }) {
|
|
|
966
1211
|
border: "base",
|
|
967
1212
|
borderRadius: "base",
|
|
968
1213
|
onClick: () => setPage(currentPage - 1),
|
|
969
|
-
children: /* @__PURE__ */ jsx("s-stack", {
|
|
1214
|
+
children: /* @__PURE__ */ jsx$1("s-stack", {
|
|
970
1215
|
blockSize: "100%",
|
|
971
1216
|
alignItems: "center",
|
|
972
1217
|
justifyContent: "center",
|
|
973
|
-
children: /* @__PURE__ */ jsx("s-icon", {
|
|
1218
|
+
children: /* @__PURE__ */ jsx$1("s-icon", {
|
|
974
1219
|
type: "chevron-left",
|
|
975
1220
|
size: "small",
|
|
976
1221
|
tone: currentPage === 0 ? "neutral" : "auto"
|
|
@@ -987,7 +1232,7 @@ function RecommendationsPager({ recommendations, padding }) {
|
|
|
987
1232
|
pageCount
|
|
988
1233
|
]
|
|
989
1234
|
}),
|
|
990
|
-
/* @__PURE__ */ jsx("s-clickable", {
|
|
1235
|
+
/* @__PURE__ */ jsx$1("s-clickable", {
|
|
991
1236
|
accessibilityLabel: "Next recommendations page",
|
|
992
1237
|
disabled: currentPage === pageCount - 1,
|
|
993
1238
|
inlineSize: "32px",
|
|
@@ -995,11 +1240,11 @@ function RecommendationsPager({ recommendations, padding }) {
|
|
|
995
1240
|
border: "base",
|
|
996
1241
|
borderRadius: "base",
|
|
997
1242
|
onClick: () => setPage(currentPage + 1),
|
|
998
|
-
children: /* @__PURE__ */ jsx("s-stack", {
|
|
1243
|
+
children: /* @__PURE__ */ jsx$1("s-stack", {
|
|
999
1244
|
blockSize: "100%",
|
|
1000
1245
|
alignItems: "center",
|
|
1001
1246
|
justifyContent: "center",
|
|
1002
|
-
children: /* @__PURE__ */ jsx("s-icon", {
|
|
1247
|
+
children: /* @__PURE__ */ jsx$1("s-icon", {
|
|
1003
1248
|
type: "chevron-right",
|
|
1004
1249
|
size: "small",
|
|
1005
1250
|
tone: currentPage === pageCount - 1 ? "neutral" : "auto"
|
|
@@ -1048,7 +1293,7 @@ function RecommendationsOfferRowTile({ recommendation }) {
|
|
|
1048
1293
|
const productName = `${recommendation.offer.heading} ${recommendation.offer.subheading}`;
|
|
1049
1294
|
const offerImageAsset = recommendation.offer.assets[0];
|
|
1050
1295
|
if (!offerImageAsset) return null;
|
|
1051
|
-
return /* @__PURE__ */ jsx(ProductTile, {
|
|
1296
|
+
return /* @__PURE__ */ jsx$1(ProductTile, {
|
|
1052
1297
|
targetUrl,
|
|
1053
1298
|
trackClick,
|
|
1054
1299
|
image: getImageSources(offerImageAsset.imageUrl, {
|
|
@@ -1071,32 +1316,32 @@ const EssentialRecommendationsWidget = ({ heroRecommendationGroup, scrollableRec
|
|
|
1071
1316
|
const hideOfferSlot = () => setShowOfferSlot(false);
|
|
1072
1317
|
const heading = applyCustomizationOrFallback("widget_bottom_slot_heading", "Trending brands we think you'll love");
|
|
1073
1318
|
if (!showOfferSlot && !scrollableRecommendationGroup) return null;
|
|
1074
|
-
return /* @__PURE__ */ jsx(ScrollableSlotProvider, {
|
|
1319
|
+
return /* @__PURE__ */ jsx$1(ScrollableSlotProvider, {
|
|
1075
1320
|
scrollableRecommendationGroup,
|
|
1076
1321
|
children: /* @__PURE__ */ jsxs(CardContainer, {
|
|
1077
1322
|
background: "base",
|
|
1078
1323
|
children: [
|
|
1079
|
-
showOfferSlot && heroRecommendationGroup ? /* @__PURE__ */ jsx("s-box", {
|
|
1324
|
+
showOfferSlot && heroRecommendationGroup ? /* @__PURE__ */ jsx$1("s-box", {
|
|
1080
1325
|
border: "base",
|
|
1081
1326
|
borderWidth: "none none base none",
|
|
1082
|
-
children: /* @__PURE__ */ jsx(HeroOfferProvider, {
|
|
1327
|
+
children: /* @__PURE__ */ jsx$1(HeroOfferProvider, {
|
|
1083
1328
|
recommendationGroup: heroRecommendationGroup,
|
|
1084
|
-
children: /* @__PURE__ */ jsx(TrackedEssentialLayout, { onLastOffer: hideOfferSlot })
|
|
1329
|
+
children: /* @__PURE__ */ jsx$1(TrackedEssentialLayout, { onLastOffer: hideOfferSlot })
|
|
1085
1330
|
})
|
|
1086
|
-
}) : /* @__PURE__ */ jsx("s-box", {
|
|
1331
|
+
}) : /* @__PURE__ */ jsx$1("s-box", {
|
|
1087
1332
|
padding: "base base none base",
|
|
1088
|
-
children: /* @__PURE__ */ jsx("s-heading", { children: heading })
|
|
1333
|
+
children: /* @__PURE__ */ jsx$1("s-heading", { children: heading })
|
|
1089
1334
|
}),
|
|
1090
|
-
scrollableRecommendationGroup && /* @__PURE__ */ jsx("s-box", {
|
|
1335
|
+
scrollableRecommendationGroup && /* @__PURE__ */ jsx$1("s-box", {
|
|
1091
1336
|
padding: "base none",
|
|
1092
1337
|
border: "base",
|
|
1093
1338
|
borderWidth: "none none base none",
|
|
1094
|
-
children: /* @__PURE__ */ jsx(RecommendationsOfferRow, {
|
|
1339
|
+
children: /* @__PURE__ */ jsx$1(RecommendationsOfferRow, {
|
|
1095
1340
|
recommendations: scrollableRecommendationGroup.recommendations,
|
|
1096
1341
|
padding: "none base"
|
|
1097
1342
|
})
|
|
1098
1343
|
}),
|
|
1099
|
-
/* @__PURE__ */ jsx(Footer, {})
|
|
1344
|
+
/* @__PURE__ */ jsx$1(Footer, {})
|
|
1100
1345
|
]
|
|
1101
1346
|
})
|
|
1102
1347
|
});
|
|
@@ -1121,7 +1366,7 @@ const TrackedEssentialLayout = ({ onLastOffer }) => {
|
|
|
1121
1366
|
offer.id,
|
|
1122
1367
|
advertiser.id
|
|
1123
1368
|
]);
|
|
1124
|
-
return /* @__PURE__ */ jsx(EssentialLayoutType, { onLastOffer });
|
|
1369
|
+
return /* @__PURE__ */ jsx$1(EssentialLayoutType, { onLastOffer });
|
|
1125
1370
|
};
|
|
1126
1371
|
//#endregion
|
|
1127
1372
|
//#region src/components/RecommendationsWidget/LeadGen/LeadGenHeader.tsx
|
|
@@ -1134,7 +1379,7 @@ const LeadGenHeader = () => {
|
|
|
1134
1379
|
return /* @__PURE__ */ jsxs("s-stack", {
|
|
1135
1380
|
gap: "none",
|
|
1136
1381
|
padding: "large-200",
|
|
1137
|
-
children: [/* @__PURE__ */ jsx("s-heading", { children: heading }), /* @__PURE__ */ jsx("s-text", {
|
|
1382
|
+
children: [/* @__PURE__ */ jsx$1("s-heading", { children: heading }), /* @__PURE__ */ jsx$1("s-text", {
|
|
1138
1383
|
color: "subdued",
|
|
1139
1384
|
children: subheading
|
|
1140
1385
|
})]
|
|
@@ -1148,7 +1393,7 @@ const LeadGenAssetTile = ({ asset }) => {
|
|
|
1148
1393
|
env,
|
|
1149
1394
|
size: 400
|
|
1150
1395
|
});
|
|
1151
|
-
return /* @__PURE__ */ jsx("s-image", {
|
|
1396
|
+
return /* @__PURE__ */ jsx$1("s-image", {
|
|
1152
1397
|
aspectRatio: "1",
|
|
1153
1398
|
src: image.src,
|
|
1154
1399
|
srcSet: image.srcSet,
|
|
@@ -1163,10 +1408,10 @@ const LeadGenBrandProducts = () => {
|
|
|
1163
1408
|
const { activeRecommendation } = useHeroOffer();
|
|
1164
1409
|
const assets = activeRecommendation.offer.assets.slice(0, 4);
|
|
1165
1410
|
if (assets.length === 0) return null;
|
|
1166
|
-
return /* @__PURE__ */ jsx("s-query-container", { children: /* @__PURE__ */ jsx("s-grid", {
|
|
1411
|
+
return /* @__PURE__ */ jsx$1("s-query-container", { children: /* @__PURE__ */ jsx$1("s-grid", {
|
|
1167
1412
|
gridTemplateColumns: "@container (inline-size > 450px) repeat(4, 1fr), repeat(3, 1fr)",
|
|
1168
1413
|
gap: "small-200",
|
|
1169
|
-
children: assets.map((asset) => /* @__PURE__ */ jsx(LeadGenAssetTile, { asset }, asset.id))
|
|
1414
|
+
children: assets.map((asset) => /* @__PURE__ */ jsx$1(LeadGenAssetTile, { asset }, asset.id))
|
|
1170
1415
|
}) });
|
|
1171
1416
|
};
|
|
1172
1417
|
const LeadGenBrand = () => {
|
|
@@ -1187,14 +1432,14 @@ const LeadGenBrand = () => {
|
|
|
1187
1432
|
alignItems: "start",
|
|
1188
1433
|
children: [/* @__PURE__ */ jsxs("s-stack", {
|
|
1189
1434
|
gap: "none",
|
|
1190
|
-
children: [/* @__PURE__ */ jsx("s-text", {
|
|
1435
|
+
children: [/* @__PURE__ */ jsx$1("s-text", {
|
|
1191
1436
|
type: "strong",
|
|
1192
1437
|
children: advertiser.name
|
|
1193
|
-
}), /* @__PURE__ */ jsx("s-paragraph", { children: advertiser.description })]
|
|
1194
|
-
}), /* @__PURE__ */ jsx("s-box", {
|
|
1438
|
+
}), /* @__PURE__ */ jsx$1("s-paragraph", { children: advertiser.description })]
|
|
1439
|
+
}), /* @__PURE__ */ jsx$1("s-box", {
|
|
1195
1440
|
inlineSize: `${logoSize}px`,
|
|
1196
1441
|
blockSize: `${logoSize}px`,
|
|
1197
|
-
children: /* @__PURE__ */ jsx("s-image", {
|
|
1442
|
+
children: /* @__PURE__ */ jsx$1("s-image", {
|
|
1198
1443
|
aspectRatio: "1",
|
|
1199
1444
|
src: logo.src,
|
|
1200
1445
|
srcSet: logo.srcSet,
|
|
@@ -1204,7 +1449,7 @@ const LeadGenBrand = () => {
|
|
|
1204
1449
|
borderRadius: "max"
|
|
1205
1450
|
})
|
|
1206
1451
|
})]
|
|
1207
|
-
}), /* @__PURE__ */ jsx(LeadGenBrandProducts, {})]
|
|
1452
|
+
}), /* @__PURE__ */ jsx$1(LeadGenBrandProducts, {})]
|
|
1208
1453
|
});
|
|
1209
1454
|
};
|
|
1210
1455
|
//#endregion
|
|
@@ -1357,7 +1602,7 @@ function LeadGenActionButton() {
|
|
|
1357
1602
|
if (payload.buyerEmail) sendOfferEmail();
|
|
1358
1603
|
handleOfferClaim();
|
|
1359
1604
|
};
|
|
1360
|
-
return /* @__PURE__ */ jsx("s-button", {
|
|
1605
|
+
return /* @__PURE__ */ jsx$1("s-button", {
|
|
1361
1606
|
href: activeRecommendation.offer.targetUrl,
|
|
1362
1607
|
target: "_blank",
|
|
1363
1608
|
inlineSize: "fill",
|
|
@@ -1383,13 +1628,13 @@ const LeadGenOfferRow = ({ recommendations }) => {
|
|
|
1383
1628
|
return /* @__PURE__ */ jsxs("s-stack", {
|
|
1384
1629
|
gap: "small-200",
|
|
1385
1630
|
padding: "base none",
|
|
1386
|
-
children: [/* @__PURE__ */ jsx("s-box", {
|
|
1631
|
+
children: [/* @__PURE__ */ jsx$1("s-box", {
|
|
1387
1632
|
padding: "none large-200",
|
|
1388
|
-
children: /* @__PURE__ */ jsx("s-text", {
|
|
1633
|
+
children: /* @__PURE__ */ jsx$1("s-text", {
|
|
1389
1634
|
type: "strong",
|
|
1390
1635
|
children: applyCustomizationOrFallback("widget_bottom_slot_heading", "Trending brands we think you'll love")
|
|
1391
1636
|
})
|
|
1392
|
-
}), /* @__PURE__ */ jsx(RecommendationsOfferRow, {
|
|
1637
|
+
}), /* @__PURE__ */ jsx$1(RecommendationsOfferRow, {
|
|
1393
1638
|
recommendations,
|
|
1394
1639
|
padding: "small-400 large-200"
|
|
1395
1640
|
})]
|
|
@@ -1410,22 +1655,22 @@ const LeadGen = ({ heroRecommendationGroup, scrollableRecommendationGroup }) =>
|
|
|
1410
1655
|
heroRecommendationGroup && /* @__PURE__ */ jsxs(HeroOfferProvider, {
|
|
1411
1656
|
recommendationGroup: heroRecommendationGroup,
|
|
1412
1657
|
children: [
|
|
1413
|
-
/* @__PURE__ */ jsx(LeadGenHeader, {}),
|
|
1414
|
-
/* @__PURE__ */ jsx("s-divider", {}),
|
|
1415
|
-
/* @__PURE__ */ jsx("s-box", {
|
|
1658
|
+
/* @__PURE__ */ jsx$1(LeadGenHeader, {}),
|
|
1659
|
+
/* @__PURE__ */ jsx$1("s-divider", {}),
|
|
1660
|
+
/* @__PURE__ */ jsx$1("s-box", {
|
|
1416
1661
|
minBlockSize: "230px",
|
|
1417
|
-
children: /* @__PURE__ */ jsx(LeadGenBrand, {})
|
|
1662
|
+
children: /* @__PURE__ */ jsx$1(LeadGenBrand, {})
|
|
1418
1663
|
}),
|
|
1419
1664
|
/* @__PURE__ */ jsxs("s-stack", {
|
|
1420
1665
|
padding: "none large-200 large-200 large-200",
|
|
1421
1666
|
gap: "base",
|
|
1422
|
-
children: [/* @__PURE__ */ jsx(LeadGenActionOffer, {}), /* @__PURE__ */ jsx(LeadGenActionNav, {})]
|
|
1667
|
+
children: [/* @__PURE__ */ jsx$1(LeadGenActionOffer, {}), /* @__PURE__ */ jsx$1(LeadGenActionNav, {})]
|
|
1423
1668
|
}),
|
|
1424
|
-
/* @__PURE__ */ jsx("s-divider", {})
|
|
1669
|
+
/* @__PURE__ */ jsx$1("s-divider", {})
|
|
1425
1670
|
]
|
|
1426
1671
|
}),
|
|
1427
|
-
scrollableRecommendationGroup && /* @__PURE__ */ jsx(LeadGenOfferRow, { recommendations: scrollableRecommendationGroup.recommendations }),
|
|
1428
|
-
/* @__PURE__ */ jsx(Footer, {})
|
|
1672
|
+
scrollableRecommendationGroup && /* @__PURE__ */ jsx$1(LeadGenOfferRow, { recommendations: scrollableRecommendationGroup.recommendations }),
|
|
1673
|
+
/* @__PURE__ */ jsx$1(Footer, {})
|
|
1429
1674
|
]
|
|
1430
1675
|
});
|
|
1431
1676
|
};
|
|
@@ -1433,7 +1678,7 @@ function LeadGenActionOffer() {
|
|
|
1433
1678
|
const { activeRecommendation, isOfferClaimed } = useHeroOffer();
|
|
1434
1679
|
const { heading, subheading, metadata } = activeRecommendation.offer;
|
|
1435
1680
|
const primaryHeading = isOfferClaimed ? `You've got ${heading}` : heading;
|
|
1436
|
-
const secondaryHeading = isOfferClaimed && metadata.type === "PROMO_CODE" ? /* @__PURE__ */ jsxs(Fragment, { children: ["Use code: ", /* @__PURE__ */ jsx("s-text", {
|
|
1681
|
+
const secondaryHeading = isOfferClaimed && metadata.type === "PROMO_CODE" ? /* @__PURE__ */ jsxs(Fragment, { children: ["Use code: ", /* @__PURE__ */ jsx$1("s-text", {
|
|
1437
1682
|
type: "strong",
|
|
1438
1683
|
children: metadata.code
|
|
1439
1684
|
})] }) : subheading || "On your next purchase";
|
|
@@ -1445,8 +1690,8 @@ function LeadGenActionOffer() {
|
|
|
1445
1690
|
gap: "base",
|
|
1446
1691
|
children: [/* @__PURE__ */ jsxs("s-stack", {
|
|
1447
1692
|
gap: "none",
|
|
1448
|
-
children: [/* @__PURE__ */ jsx("s-heading", { children: primaryHeading }), /* @__PURE__ */ jsx("s-text", { children: secondaryHeading })]
|
|
1449
|
-
}), /* @__PURE__ */ jsx(LeadGenActionButton, {})]
|
|
1693
|
+
children: [/* @__PURE__ */ jsx$1("s-heading", { children: primaryHeading }), /* @__PURE__ */ jsx$1("s-text", { children: secondaryHeading })]
|
|
1694
|
+
}), /* @__PURE__ */ jsx$1(LeadGenActionButton, {})]
|
|
1450
1695
|
});
|
|
1451
1696
|
}
|
|
1452
1697
|
function LeadGenActionNav() {
|
|
@@ -1482,13 +1727,13 @@ function LeadGenActionNav() {
|
|
|
1482
1727
|
gridTemplateColumns: hasSingleButton ? "1fr" : "1fr 11px 1fr",
|
|
1483
1728
|
gap: "base",
|
|
1484
1729
|
children: [
|
|
1485
|
-
showPrevious && /* @__PURE__ */ jsx("s-button", {
|
|
1730
|
+
showPrevious && /* @__PURE__ */ jsx$1("s-button", {
|
|
1486
1731
|
variant: !isOfferClaimed || showNext ? "secondary" : "primary",
|
|
1487
1732
|
onClick: handlePrevious,
|
|
1488
1733
|
children: applyCustomizationOrFallback("widget_nav_backward_cta_text", "Previous offer")
|
|
1489
1734
|
}),
|
|
1490
|
-
!hasSingleButton && /* @__PURE__ */ jsx("s-box", {}),
|
|
1491
|
-
showNext && /* @__PURE__ */ jsx("s-button", {
|
|
1735
|
+
!hasSingleButton && /* @__PURE__ */ jsx$1("s-box", {}),
|
|
1736
|
+
showNext && /* @__PURE__ */ jsx$1("s-button", {
|
|
1492
1737
|
variant: isOfferClaimed ? "primary" : "secondary",
|
|
1493
1738
|
onClick: handleNext,
|
|
1494
1739
|
children: applyCustomizationOrFallback("widget_nav_forward_cta_text", showPrevious ? "Next offer" : "No thanks")
|
|
@@ -1505,15 +1750,15 @@ const Widget = () => {
|
|
|
1505
1750
|
const scrollableRecommendationGroup = recommendationsData.recommendationGroups.find((group) => group.slotContext === "SCROLLABLE");
|
|
1506
1751
|
if (!heroRecommendationGroup && !scrollableRecommendationGroup) return null;
|
|
1507
1752
|
const layoutId = recommendationsData.layoutId;
|
|
1508
|
-
if (ESSENTIAL_LAYOUT_IDS.includes(layoutId)) return /* @__PURE__ */ jsx(EssentialRecommendationsWidget, {
|
|
1753
|
+
if (ESSENTIAL_LAYOUT_IDS.includes(layoutId)) return /* @__PURE__ */ jsx$1(EssentialRecommendationsWidget, {
|
|
1509
1754
|
heroRecommendationGroup,
|
|
1510
1755
|
scrollableRecommendationGroup
|
|
1511
1756
|
});
|
|
1512
1757
|
if (layoutId === "SHOPIFY_NATIVE_COVER") {
|
|
1513
1758
|
if (!heroRecommendationGroup) return null;
|
|
1514
|
-
return /* @__PURE__ */ jsx(CoverRecommendationsWidget, { heroRecommendationGroup });
|
|
1759
|
+
return /* @__PURE__ */ jsx$1(CoverRecommendationsWidget, { heroRecommendationGroup });
|
|
1515
1760
|
}
|
|
1516
|
-
return /* @__PURE__ */ jsx(LeadGen, {
|
|
1761
|
+
return /* @__PURE__ */ jsx$1(LeadGen, {
|
|
1517
1762
|
heroRecommendationGroup,
|
|
1518
1763
|
scrollableRecommendationGroup
|
|
1519
1764
|
});
|
|
@@ -1527,20 +1772,24 @@ const Widget = () => {
|
|
|
1527
1772
|
* `customer-account.order-status.block.render` target; the order and buyer
|
|
1528
1773
|
* details are read from that target's API.
|
|
1529
1774
|
*/
|
|
1530
|
-
function DiscoRecommendations({ apiKey }) {
|
|
1531
|
-
return /* @__PURE__ */ jsx(Recommendations, {
|
|
1775
|
+
function DiscoRecommendations({ apiKey, widgetId }) {
|
|
1776
|
+
return /* @__PURE__ */ jsx$1(Recommendations, {
|
|
1777
|
+
auth: { apiKey },
|
|
1778
|
+
widgetId
|
|
1779
|
+
});
|
|
1532
1780
|
}
|
|
1533
1781
|
/**
|
|
1534
1782
|
* The widget tree shared by the public (`apiKey`) and internal (`shop_gid`)
|
|
1535
1783
|
* entry points.
|
|
1536
1784
|
*/
|
|
1537
|
-
function Recommendations({ auth }) {
|
|
1538
|
-
return /* @__PURE__ */ jsx(PayloadManager, { children: /* @__PURE__ */ jsx(DataManager, {
|
|
1785
|
+
function Recommendations({ auth, widgetId }) {
|
|
1786
|
+
return /* @__PURE__ */ jsx$1(PayloadManager, { children: /* @__PURE__ */ jsx$1(DataManager, {
|
|
1539
1787
|
auth,
|
|
1540
|
-
|
|
1788
|
+
widgetId,
|
|
1789
|
+
children: /* @__PURE__ */ jsx$1(UserManager, { children: /* @__PURE__ */ jsx$1(Widget, {}) })
|
|
1541
1790
|
}) });
|
|
1542
1791
|
}
|
|
1543
1792
|
//#endregion
|
|
1544
1793
|
export { Recommendations as n, DiscoRecommendations as t };
|
|
1545
1794
|
|
|
1546
|
-
//# sourceMappingURL=DiscoRecommendations-
|
|
1795
|
+
//# sourceMappingURL=DiscoRecommendations-3LDn_fcd.js.map
|