@iheartjane/dm-sdk 2.24.1
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/chunk-VEW5EGZ2.js +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +1181 -0
- package/dist/index.d.ts +1181 -0
- package/dist/index.js +1 -0
- package/dist/smartSort-DJFM0D_n.d.cts +1075 -0
- package/dist/smartSort-DJFM0D_n.d.ts +1075 -0
- package/dist/test-utils.cjs +1 -0
- package/dist/test-utils.d.cts +189 -0
- package/dist/test-utils.d.ts +189 -0
- package/dist/test-utils.js +1 -0
- package/package.json +68 -0
- package/test-utils/package.json +4 -0
|
@@ -0,0 +1,1075 @@
|
|
|
1
|
+
declare enum AdMode {
|
|
2
|
+
All = "all",
|
|
3
|
+
Default = "default",
|
|
4
|
+
Off = "off"
|
|
5
|
+
}
|
|
6
|
+
declare enum AppMode {
|
|
7
|
+
Bloom = "bloom",
|
|
8
|
+
Default = "default",
|
|
9
|
+
Embedded = "embedded",
|
|
10
|
+
FramelessEmbed = "framelessEmbed",
|
|
11
|
+
Headless = "headless",
|
|
12
|
+
Kiosk = "kiosk",
|
|
13
|
+
OperatorEmbed = "operatorEmbed",
|
|
14
|
+
WhiteLabel = "whiteLabel"
|
|
15
|
+
}
|
|
16
|
+
declare enum IntendedDisplay {
|
|
17
|
+
Desktop = "desktop",
|
|
18
|
+
Kiosk = "kiosk",
|
|
19
|
+
Mobile = "mobile"
|
|
20
|
+
}
|
|
21
|
+
declare enum JaneDeviceIdSentinel {
|
|
22
|
+
UserOptOut = "user-opt-out"
|
|
23
|
+
}
|
|
24
|
+
declare enum PageContextEnum {
|
|
25
|
+
Featured = "featured",
|
|
26
|
+
Midgrid = "midgrid"
|
|
27
|
+
}
|
|
28
|
+
declare enum Placement {
|
|
29
|
+
BestSelling = "best_selling",
|
|
30
|
+
BrandSpecials = "brand_specials",
|
|
31
|
+
BuyAgainRow = "buy_again_row",
|
|
32
|
+
CartToppers = "cart_toppers",
|
|
33
|
+
CustomImageRow = "custom_image_row",
|
|
34
|
+
FeaturedRow = "featured_row",
|
|
35
|
+
MenuDynamicRow = "menu_dynamic_row",
|
|
36
|
+
MenuInline = "menu_inline",
|
|
37
|
+
MenuInlineTable = "menu_inline_table",
|
|
38
|
+
MenuTopRow = "menu_top_row",
|
|
39
|
+
PdpRow = "pdp_row",
|
|
40
|
+
Sale = "sale",
|
|
41
|
+
Specials = "specials",
|
|
42
|
+
VirtualBudtenderSearch = "virtual_budtender_search"
|
|
43
|
+
}
|
|
44
|
+
declare enum ProductKindEnum {
|
|
45
|
+
Edible = "edible",
|
|
46
|
+
Extract = "extract",
|
|
47
|
+
Flower = "flower",
|
|
48
|
+
Gear = "gear",
|
|
49
|
+
Grow = "grow",
|
|
50
|
+
Merch = "merch",
|
|
51
|
+
PreRoll = "pre-roll",
|
|
52
|
+
Tincture = "tincture",
|
|
53
|
+
Topical = "topical",
|
|
54
|
+
Vape = "vape"
|
|
55
|
+
}
|
|
56
|
+
declare enum ReviewSortEnum {
|
|
57
|
+
Rating = "rating",
|
|
58
|
+
Recent = "recent",
|
|
59
|
+
Upvote = "upvote"
|
|
60
|
+
}
|
|
61
|
+
declare enum SearchSortEnum {
|
|
62
|
+
BestSellerRank = "best-seller-rank",
|
|
63
|
+
CategoryAndNameAsc = "category-and-name-asc",
|
|
64
|
+
Default = "default",
|
|
65
|
+
PriceAsc = "price-asc",
|
|
66
|
+
PriceDesc = "price-desc",
|
|
67
|
+
PriceEighthOunceAsc = "price-eighth-ounce-asc",
|
|
68
|
+
PriceEighthOunceDesc = "price-eighth-ounce-desc",
|
|
69
|
+
PriceGramAsc = "price-gram-asc",
|
|
70
|
+
PriceGramDesc = "price-gram-desc",
|
|
71
|
+
PriceHalfGramAsc = "price-half-gram-asc",
|
|
72
|
+
PriceHalfGramDesc = "price-half-gram-desc",
|
|
73
|
+
PriceHalfOunceAsc = "price-half-ounce-asc",
|
|
74
|
+
PriceHalfOunceDesc = "price-half-ounce-desc",
|
|
75
|
+
PriceOunceAsc = "price-ounce-asc",
|
|
76
|
+
PriceOunceDesc = "price-ounce-desc",
|
|
77
|
+
PriceQuarterOunceAsc = "price-quarter-ounce-asc",
|
|
78
|
+
PriceQuarterOunceDesc = "price-quarter-ounce-desc",
|
|
79
|
+
PriceTwoGramAsc = "price-two-gram-asc",
|
|
80
|
+
PriceTwoGramDesc = "price-two-gram-desc",
|
|
81
|
+
Rating = "rating",
|
|
82
|
+
Recommendation = "recommendation",
|
|
83
|
+
ThcPotencyAsc = "thc-potency-asc",
|
|
84
|
+
ThcPotencyDesc = "thc-potency-desc"
|
|
85
|
+
}
|
|
86
|
+
declare enum SessionEventCategory {
|
|
87
|
+
Edible = "edible",
|
|
88
|
+
Extract = "extract",
|
|
89
|
+
Flower = "flower",
|
|
90
|
+
PreRoll = "pre-roll",
|
|
91
|
+
Vape = "vape"
|
|
92
|
+
}
|
|
93
|
+
interface BrandSpecials {
|
|
94
|
+
placement: Placement;
|
|
95
|
+
/**
|
|
96
|
+
* The title of the brand specials
|
|
97
|
+
*/
|
|
98
|
+
title?: string;
|
|
99
|
+
}
|
|
100
|
+
interface BrandSpecialsPlacementResponse {
|
|
101
|
+
placement?: Placement;
|
|
102
|
+
specials?: BrandSpecials[];
|
|
103
|
+
title?: string;
|
|
104
|
+
}
|
|
105
|
+
type Click = {
|
|
106
|
+
/**
|
|
107
|
+
* Distinct identifier
|
|
108
|
+
*/
|
|
109
|
+
distinctId?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Should be true if the click ads the product to the cart
|
|
112
|
+
*/
|
|
113
|
+
isAddToCart?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Jane device identifier
|
|
116
|
+
*/
|
|
117
|
+
janeDeviceId: string;
|
|
118
|
+
/**
|
|
119
|
+
* Jane store identifier
|
|
120
|
+
*/
|
|
121
|
+
storeId: number;
|
|
122
|
+
} & Engagement;
|
|
123
|
+
interface ConversionExternalProduct {
|
|
124
|
+
posProductId: string;
|
|
125
|
+
price: number;
|
|
126
|
+
quantity: number;
|
|
127
|
+
}
|
|
128
|
+
interface CustomImageData$1 {
|
|
129
|
+
headline: string;
|
|
130
|
+
image_url: string;
|
|
131
|
+
intended_display: IntendedDisplay;
|
|
132
|
+
logo_url: string;
|
|
133
|
+
overlay_color: string;
|
|
134
|
+
position_x: number;
|
|
135
|
+
position_y: number;
|
|
136
|
+
scale_number: number;
|
|
137
|
+
text_color: string;
|
|
138
|
+
}
|
|
139
|
+
interface Engagement {
|
|
140
|
+
/**
|
|
141
|
+
* Ad token
|
|
142
|
+
*/
|
|
143
|
+
adToken?: string;
|
|
144
|
+
/**
|
|
145
|
+
* Kevel token
|
|
146
|
+
*/
|
|
147
|
+
kevelToken?: string;
|
|
148
|
+
/**
|
|
149
|
+
* MyHigh identifier
|
|
150
|
+
*/
|
|
151
|
+
myHighD?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Product ID
|
|
154
|
+
*/
|
|
155
|
+
productId: number;
|
|
156
|
+
}
|
|
157
|
+
type FilterContext = KindFilterContext;
|
|
158
|
+
interface Impression {
|
|
159
|
+
/**
|
|
160
|
+
* Distinct identifier
|
|
161
|
+
*/
|
|
162
|
+
distinctId?: string;
|
|
163
|
+
/**
|
|
164
|
+
* @minItems 1
|
|
165
|
+
*/
|
|
166
|
+
engagements: Engagement[];
|
|
167
|
+
/**
|
|
168
|
+
* Jane device identifier
|
|
169
|
+
*/
|
|
170
|
+
janeDeviceId: string;
|
|
171
|
+
}
|
|
172
|
+
interface KindFilterContext {
|
|
173
|
+
kind: ProductKindEnum[];
|
|
174
|
+
}
|
|
175
|
+
interface PageProduct {
|
|
176
|
+
object_id: string;
|
|
177
|
+
search_attributes?: Record<string, unknown>;
|
|
178
|
+
}
|
|
179
|
+
interface PageResponse {
|
|
180
|
+
products?: PageProduct[];
|
|
181
|
+
}
|
|
182
|
+
type PlacementResponse = BrandSpecialsPlacementResponse | ProductsPlacementResponse | SpecialsPlacementResponse;
|
|
183
|
+
interface Product {
|
|
184
|
+
ad_token: string;
|
|
185
|
+
flight_id?: number;
|
|
186
|
+
kevel_token?: string;
|
|
187
|
+
my_high_d?: string;
|
|
188
|
+
object_id: string;
|
|
189
|
+
price_id?: string;
|
|
190
|
+
product_id: number;
|
|
191
|
+
search_attributes?: Record<string, unknown>;
|
|
192
|
+
store_id: number;
|
|
193
|
+
}
|
|
194
|
+
interface ProductReviewsResponse$1 {
|
|
195
|
+
aggregate: ReviewAggregate;
|
|
196
|
+
product_id: number;
|
|
197
|
+
reviews: Review[];
|
|
198
|
+
total_count: number;
|
|
199
|
+
}
|
|
200
|
+
interface ProductsPlacementResponse {
|
|
201
|
+
creative_ids?: number[];
|
|
202
|
+
/**
|
|
203
|
+
* @deprecated true
|
|
204
|
+
*/
|
|
205
|
+
custom_image_data?: CustomImageData$1;
|
|
206
|
+
custom_images?: CustomImageData$1[];
|
|
207
|
+
nb_hits?: number;
|
|
208
|
+
placement?: Placement;
|
|
209
|
+
products?: Product[];
|
|
210
|
+
row_id?: number;
|
|
211
|
+
search_facets?: Record<string, Record<string, number>>;
|
|
212
|
+
title?: string;
|
|
213
|
+
}
|
|
214
|
+
interface Review {
|
|
215
|
+
activities?: string[];
|
|
216
|
+
avatar?: number;
|
|
217
|
+
comment?: string;
|
|
218
|
+
/**
|
|
219
|
+
* @format date-time
|
|
220
|
+
*/
|
|
221
|
+
created_at: string;
|
|
222
|
+
feelings?: string[];
|
|
223
|
+
has_comment: boolean;
|
|
224
|
+
id: number;
|
|
225
|
+
nickname?: string;
|
|
226
|
+
product_id: number;
|
|
227
|
+
rating: number;
|
|
228
|
+
store_id?: number;
|
|
229
|
+
store_name?: string;
|
|
230
|
+
/**
|
|
231
|
+
* @format date-time
|
|
232
|
+
*/
|
|
233
|
+
updated_at: string;
|
|
234
|
+
upvote_count: number;
|
|
235
|
+
}
|
|
236
|
+
interface ReviewAggregate {
|
|
237
|
+
activities_distribution?: ReviewDistribution;
|
|
238
|
+
average_rating: number;
|
|
239
|
+
distribution: ReviewDistribution;
|
|
240
|
+
feelings_distribution?: ReviewDistribution;
|
|
241
|
+
review_count: number;
|
|
242
|
+
}
|
|
243
|
+
type ReviewDistribution = Record<string, number>;
|
|
244
|
+
type SessionEvent = ({
|
|
245
|
+
type: 'clickedAddToCart';
|
|
246
|
+
} & Omit<SessionEventClickedAddToCart, 'type'>) | ({
|
|
247
|
+
type: 'filteredCategory';
|
|
248
|
+
} & SessionEventFilteredCategory) | ({
|
|
249
|
+
type: 'viewedProduct';
|
|
250
|
+
} & Omit<SessionEventViewedProduct, 'type'>);
|
|
251
|
+
type SessionEventClickedAddToCart = SessionEventClickedAddToCartPOSProduct | SessionEventClickedAddToCartProduct;
|
|
252
|
+
interface SessionEventClickedAddToCartPOSProduct {
|
|
253
|
+
posProductId: string;
|
|
254
|
+
productId?: never;
|
|
255
|
+
storeId: number;
|
|
256
|
+
}
|
|
257
|
+
interface SessionEventClickedAddToCartProduct {
|
|
258
|
+
posProductId?: never;
|
|
259
|
+
productId: number;
|
|
260
|
+
storeId: number;
|
|
261
|
+
}
|
|
262
|
+
interface SessionEventFilteredCategory {
|
|
263
|
+
category: SessionEventCategory;
|
|
264
|
+
storeId: number;
|
|
265
|
+
}
|
|
266
|
+
type SessionEventViewedProduct = SessionEventViewedProductPOSProduct | SessionEventViewedProductProduct;
|
|
267
|
+
interface SessionEventViewedProductPOSProduct {
|
|
268
|
+
posProductId: string;
|
|
269
|
+
productId?: never;
|
|
270
|
+
storeId: number;
|
|
271
|
+
}
|
|
272
|
+
interface SessionEventViewedProductProduct {
|
|
273
|
+
posProductId?: never;
|
|
274
|
+
productId: number;
|
|
275
|
+
storeId: number;
|
|
276
|
+
}
|
|
277
|
+
interface SpecialResponse {
|
|
278
|
+
description?: string;
|
|
279
|
+
specialId?: number;
|
|
280
|
+
title?: string;
|
|
281
|
+
}
|
|
282
|
+
interface SpecialsPlacementResponse {
|
|
283
|
+
placement?: Placement;
|
|
284
|
+
specials?: SpecialResponse[];
|
|
285
|
+
title?: string;
|
|
286
|
+
}
|
|
287
|
+
type VirtualBudtenderProduct = {
|
|
288
|
+
/**
|
|
289
|
+
* AI-generated explanation for why this product matches the query
|
|
290
|
+
*
|
|
291
|
+
* @example This product contains CBD which is known for its calming effects and may help with sleep
|
|
292
|
+
*/
|
|
293
|
+
reasoning?: string;
|
|
294
|
+
/**
|
|
295
|
+
* Relevance score for this product (0 to 10)
|
|
296
|
+
*
|
|
297
|
+
* @example 8.5
|
|
298
|
+
* @format float
|
|
299
|
+
* @maximum 10
|
|
300
|
+
* @minimum 0
|
|
301
|
+
*/
|
|
302
|
+
score?: number;
|
|
303
|
+
} & Product;
|
|
304
|
+
interface VirtualBudtenderQuery {
|
|
305
|
+
/**
|
|
306
|
+
* Human-readable display text for the query
|
|
307
|
+
*
|
|
308
|
+
* @example Help me sleep
|
|
309
|
+
*/
|
|
310
|
+
displayText: string;
|
|
311
|
+
/**
|
|
312
|
+
* The natural language query string
|
|
313
|
+
*
|
|
314
|
+
* @example help me sleep
|
|
315
|
+
*/
|
|
316
|
+
query: string;
|
|
317
|
+
}
|
|
318
|
+
interface VirtualBudtenderSearchResponse {
|
|
319
|
+
/**
|
|
320
|
+
* AI-generated response in HTML format
|
|
321
|
+
*
|
|
322
|
+
* @example <p>Based on your request for sleep help, I recommend these products...</p>
|
|
323
|
+
*/
|
|
324
|
+
htmlResponse: string;
|
|
325
|
+
/**
|
|
326
|
+
* AI-generated response in markdown format
|
|
327
|
+
*
|
|
328
|
+
* @example Based on your request for sleep help, I recommend these products that contain CBD and indica strains...
|
|
329
|
+
*/
|
|
330
|
+
markdownResponse: string;
|
|
331
|
+
/**
|
|
332
|
+
* List of products matching the query
|
|
333
|
+
*/
|
|
334
|
+
products: VirtualBudtenderProduct[];
|
|
335
|
+
/**
|
|
336
|
+
* The original query that was searched
|
|
337
|
+
*
|
|
338
|
+
* @example help me sleep
|
|
339
|
+
*/
|
|
340
|
+
query: string;
|
|
341
|
+
/**
|
|
342
|
+
* Total number of products found
|
|
343
|
+
*
|
|
344
|
+
* @example 15
|
|
345
|
+
* @minimum 0
|
|
346
|
+
*/
|
|
347
|
+
totalResults: number;
|
|
348
|
+
/**
|
|
349
|
+
* Raw AI-generated response without formatting
|
|
350
|
+
*
|
|
351
|
+
* @example Based on your request for sleep help, I recommend these products that contain CBD and indica strains...
|
|
352
|
+
*/
|
|
353
|
+
unformattedResponse: string;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Configuration options for the Jane DM SDK client.
|
|
358
|
+
*/
|
|
359
|
+
type JaneDMConfig = JaneDMInternalConfig & JaneDMPublicConfig;
|
|
360
|
+
/**
|
|
361
|
+
* Tracking identifiers for a user
|
|
362
|
+
*/
|
|
363
|
+
interface JaneDMIdentifiers {
|
|
364
|
+
/**
|
|
365
|
+
* A unique identifier, UUID, representing the device visiting the site
|
|
366
|
+
*/
|
|
367
|
+
jdid: string;
|
|
368
|
+
/**
|
|
369
|
+
* @internal
|
|
370
|
+
*/
|
|
371
|
+
mixpanelDistinctId?: string;
|
|
372
|
+
/**
|
|
373
|
+
* Optional unique identifier for an external pos authenticated user
|
|
374
|
+
*/
|
|
375
|
+
posUserId?: string;
|
|
376
|
+
/**
|
|
377
|
+
* Optional unique identifier for a Jane authenticated user
|
|
378
|
+
*/
|
|
379
|
+
userId?: number;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Internal configuration options for the Jane DM SDK client.
|
|
383
|
+
* Should never be set by the consumer of the SDK.
|
|
384
|
+
*
|
|
385
|
+
* **Modification of these fields will result in unexpected behavior.**
|
|
386
|
+
* @internal
|
|
387
|
+
*/
|
|
388
|
+
interface JaneDMInternalConfig {
|
|
389
|
+
/**
|
|
390
|
+
* The context in which the DM placements should be served in
|
|
391
|
+
*
|
|
392
|
+
* Should never be set by the consumer of the SDK
|
|
393
|
+
*
|
|
394
|
+
* @default 'headless'
|
|
395
|
+
* @internal
|
|
396
|
+
*/
|
|
397
|
+
appMode?: AppMode;
|
|
398
|
+
/**
|
|
399
|
+
* Endpoint used for tracking events
|
|
400
|
+
*
|
|
401
|
+
* The default value is the same as the endpoint
|
|
402
|
+
*
|
|
403
|
+
* Should never be set by the consumer of the SDK
|
|
404
|
+
* @internal
|
|
405
|
+
*/
|
|
406
|
+
eventsEndpoint?: string;
|
|
407
|
+
/**
|
|
408
|
+
* Endpoint used for fetching the page data
|
|
409
|
+
*
|
|
410
|
+
* The default value is the same as the endpoint
|
|
411
|
+
*
|
|
412
|
+
* Should never be set by the consumer of the SDK
|
|
413
|
+
* @internal
|
|
414
|
+
*/
|
|
415
|
+
pageEndpoint?: string;
|
|
416
|
+
/**
|
|
417
|
+
* Skip automatic onLoad call in SmartSort constructor
|
|
418
|
+
*
|
|
419
|
+
* When true, prevents automatic fingerprint collection and session events
|
|
420
|
+
* on SmartSort instantiation. Use this when you need manual control over
|
|
421
|
+
* when onLoad is triggered.
|
|
422
|
+
*
|
|
423
|
+
* Should never be set by the consumer of the SDK
|
|
424
|
+
*
|
|
425
|
+
* @default false
|
|
426
|
+
* @internal
|
|
427
|
+
*/
|
|
428
|
+
skipAutoSmartSortOnLoad?: boolean;
|
|
429
|
+
/**
|
|
430
|
+
* This is an internal field used for tracking the source of the SDK
|
|
431
|
+
*
|
|
432
|
+
* Should never be set by the consumer of the SDK
|
|
433
|
+
*
|
|
434
|
+
* @default 'sdk'
|
|
435
|
+
* @internal
|
|
436
|
+
*/
|
|
437
|
+
source?: string;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Public configuration options for the Jane DM SDK client.
|
|
441
|
+
*/
|
|
442
|
+
interface JaneDMPublicConfig {
|
|
443
|
+
/**
|
|
444
|
+
* Key that enables access to the DM API.
|
|
445
|
+
*
|
|
446
|
+
* Reach out to a Jane representative to learn more about how to obtain an API key.
|
|
447
|
+
*/
|
|
448
|
+
apiKey: string;
|
|
449
|
+
/**
|
|
450
|
+
* The endpoint to use for the DM API
|
|
451
|
+
* @default 'https://dmerch.iheartjane.com'
|
|
452
|
+
*/
|
|
453
|
+
endpoint?: string;
|
|
454
|
+
/**
|
|
455
|
+
* Identifiers object for user tracking purposes
|
|
456
|
+
*/
|
|
457
|
+
identifier?: JaneDMIdentifiers;
|
|
458
|
+
}
|
|
459
|
+
type RequiredConfig = Required<JaneDMConfig>;
|
|
460
|
+
|
|
461
|
+
type Facets = Record<string, Record<string, number>>;
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Default page size used across paginated resources when the caller does
|
|
465
|
+
* not specify one. Matches the server-side default.
|
|
466
|
+
*/
|
|
467
|
+
declare const DEFAULT_PAGE_SIZE = 50;
|
|
468
|
+
/**
|
|
469
|
+
* Shared shape for every paginated iterator in the SDK. Yields items
|
|
470
|
+
* one at a time by default; `.pages` exposes an iterator over whole
|
|
471
|
+
* page envelopes for callers that need page-level data during traversal.
|
|
472
|
+
*
|
|
473
|
+
* Internal: not re-exported from the public SDK entry point. Consumers
|
|
474
|
+
* use the concrete per-resource iterable types (e.g.
|
|
475
|
+
* `ProductReviewsIterable`).
|
|
476
|
+
*/
|
|
477
|
+
interface PaginatedIterable<TItem, TResponse> extends AsyncIterable<TItem> {
|
|
478
|
+
pages: AsyncIterable<TResponse>;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Shared shape for every paginated response in the SDK. Per-resource
|
|
482
|
+
* types extend this with domain-specific fields (e.g. aggregates) at
|
|
483
|
+
* the top level.
|
|
484
|
+
*
|
|
485
|
+
* Internal: not re-exported from the public SDK entry point. Consumers
|
|
486
|
+
* use the concrete per-resource types (e.g. `ProductReviewsResponse`).
|
|
487
|
+
*/
|
|
488
|
+
interface PaginatedResponse<TItem> {
|
|
489
|
+
items: TItem[];
|
|
490
|
+
pagination: PaginationInfo;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Pagination metadata included on every paginated response envelope.
|
|
494
|
+
*
|
|
495
|
+
* Use this shape when typing your own pagination UI components
|
|
496
|
+
* (e.g. a page selector, next/prev buttons, or an infinite-scroll
|
|
497
|
+
* "load more" control).
|
|
498
|
+
*/
|
|
499
|
+
interface PaginationInfo {
|
|
500
|
+
/**
|
|
501
|
+
* The page that was returned. 1-indexed.
|
|
502
|
+
*/
|
|
503
|
+
currentPage: number;
|
|
504
|
+
/**
|
|
505
|
+
* `true` when another page exists after `currentPage`.
|
|
506
|
+
*/
|
|
507
|
+
hasNextPage: boolean;
|
|
508
|
+
/**
|
|
509
|
+
* `true` when a page exists before `currentPage`.
|
|
510
|
+
*/
|
|
511
|
+
hasPreviousPage: boolean;
|
|
512
|
+
/**
|
|
513
|
+
* The size of the current page, echoing the requested `pageSize`.
|
|
514
|
+
*/
|
|
515
|
+
pageSize: number;
|
|
516
|
+
/**
|
|
517
|
+
* Total number of items across every page, matching the filter.
|
|
518
|
+
*/
|
|
519
|
+
totalCount: number;
|
|
520
|
+
/**
|
|
521
|
+
* `Math.ceil(totalCount / pageSize)`, floored to 1 so empty result
|
|
522
|
+
* sets still have at least one page.
|
|
523
|
+
*/
|
|
524
|
+
totalPages: number;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Filter/config props accepted by `fetchProductReviews`.
|
|
529
|
+
*/
|
|
530
|
+
interface FetchProductReviewsProps {
|
|
531
|
+
activities?: string[];
|
|
532
|
+
feelings?: string[];
|
|
533
|
+
/**
|
|
534
|
+
* When `true`, restricts results to reviews that have a non-empty
|
|
535
|
+
* comment. Every aggregate in the response (counts, average, star
|
|
536
|
+
* distribution, feeling/activity tag distributions) is computed over
|
|
537
|
+
* only the commented reviews.
|
|
538
|
+
*
|
|
539
|
+
* Omit (or `false`) for no filter — both are equivalent, since `false`
|
|
540
|
+
* is a no-op server-side. The SDK drops `false` from the request body
|
|
541
|
+
* to keep the payload minimal.
|
|
542
|
+
*/
|
|
543
|
+
hasComment?: boolean;
|
|
544
|
+
/**
|
|
545
|
+
* 1-indexed. Defaults to 1.
|
|
546
|
+
*/
|
|
547
|
+
page?: number;
|
|
548
|
+
pageSize?: number;
|
|
549
|
+
productId: number;
|
|
550
|
+
ratings?: number[];
|
|
551
|
+
sort?: ReviewSortEnum;
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Filter/config props accepted by `iterateProductReviews`. Identical to
|
|
555
|
+
* `FetchProductReviewsProps` except `page` is omitted — the iterator
|
|
556
|
+
* always starts at page 1 and advances until the server reports no
|
|
557
|
+
* more pages.
|
|
558
|
+
*/
|
|
559
|
+
type IterateProductReviewsProps = Omit<FetchProductReviewsProps, 'page'>;
|
|
560
|
+
interface ProductReview {
|
|
561
|
+
activities?: string[];
|
|
562
|
+
avatar?: number;
|
|
563
|
+
comment?: string;
|
|
564
|
+
createdAt: string;
|
|
565
|
+
feelings?: string[];
|
|
566
|
+
hasComment: boolean;
|
|
567
|
+
id: number;
|
|
568
|
+
nickname?: string;
|
|
569
|
+
productId: number;
|
|
570
|
+
rating: number;
|
|
571
|
+
storeId?: number;
|
|
572
|
+
storeName?: string;
|
|
573
|
+
updatedAt: string;
|
|
574
|
+
upvoteCount: number;
|
|
575
|
+
}
|
|
576
|
+
interface ProductReviewsAggregate {
|
|
577
|
+
activitiesDistribution?: Record<string, number>;
|
|
578
|
+
averageRating: number;
|
|
579
|
+
distribution: Record<string, number>;
|
|
580
|
+
feelingsDistribution?: Record<string, number>;
|
|
581
|
+
reviewCount: number;
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Async iterable returned by `JaneDM.iterateProductReviews`. Yields
|
|
585
|
+
* individual reviews by default; use `.pages` to iterate over whole
|
|
586
|
+
* page envelopes.
|
|
587
|
+
*
|
|
588
|
+
* @see [Pagination guide](https://dm-sdk-docs.iheartjane.com/app/pagination).
|
|
589
|
+
*/
|
|
590
|
+
type ProductReviewsIterable = PaginatedIterable<ProductReview, ProductReviewsResponse>;
|
|
591
|
+
/**
|
|
592
|
+
* Envelope returned by `JaneDM.fetchProductReviews`. Extends the SDK's
|
|
593
|
+
* shared paginated-response shape with review-specific fields.
|
|
594
|
+
*
|
|
595
|
+
* @see {@link PaginationInfo} for the `pagination` field shape.
|
|
596
|
+
* @see [Pagination guide](https://dm-sdk-docs.iheartjane.com/app/pagination).
|
|
597
|
+
*/
|
|
598
|
+
interface ProductReviewsResponse extends PaginatedResponse<ProductReview> {
|
|
599
|
+
aggregate: ProductReviewsAggregate;
|
|
600
|
+
productId: number;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* @deprecated Use `SearchSortEnum.best_seller_sort` instead
|
|
605
|
+
*/
|
|
606
|
+
declare const bestSellerRank = "best-seller-rank";
|
|
607
|
+
/**
|
|
608
|
+
* @deprecated Use `SearchSortEnum.category_and_name_asc` instead
|
|
609
|
+
*/
|
|
610
|
+
declare const categoryAndNameAsc = "category-and-name-asc";
|
|
611
|
+
/**
|
|
612
|
+
* @deprecated Use `SearchSortEnum.default` instead
|
|
613
|
+
*/
|
|
614
|
+
declare const defaultOrder = "default";
|
|
615
|
+
/**
|
|
616
|
+
* @deprecated Use `SearchSortEnum.price_asc` instead
|
|
617
|
+
*/
|
|
618
|
+
declare const priceAsc = "price-asc";
|
|
619
|
+
/**
|
|
620
|
+
* @deprecated Use `SearchSortEnum.price_desc` instead
|
|
621
|
+
*/
|
|
622
|
+
declare const priceDesc = "price-desc";
|
|
623
|
+
/**
|
|
624
|
+
* @deprecated Use `SearchSortEnum.price_eighth_ounce_asc` instead
|
|
625
|
+
*/
|
|
626
|
+
declare const priceEighthOunceAsc = "price-eighth-ounce-asc";
|
|
627
|
+
/**
|
|
628
|
+
* @deprecated Use `SearchSortEnum.price_eighth_ounce_desc` instead
|
|
629
|
+
*/
|
|
630
|
+
declare const priceEighthOunceDesc = "price-eighth-ounce-desc";
|
|
631
|
+
/**
|
|
632
|
+
* @deprecated Use `SearchSortEnum.price_gram_asc` instead
|
|
633
|
+
*/
|
|
634
|
+
declare const priceGramAsc = "price-gram-asc";
|
|
635
|
+
/**
|
|
636
|
+
* @deprecated Use `SearchSortEnum.price_gram_desc` instead
|
|
637
|
+
*/
|
|
638
|
+
declare const priceGramDesc = "price-gram-desc";
|
|
639
|
+
/**
|
|
640
|
+
* @deprecated Use `SearchSortEnum.price_half_gram_asc` instead
|
|
641
|
+
*/
|
|
642
|
+
declare const priceHalfGramAsc = "price-half-gram-asc";
|
|
643
|
+
/**
|
|
644
|
+
* @deprecated Use `SearchSortEnum.price_half_gram_desc` instead
|
|
645
|
+
*/
|
|
646
|
+
declare const priceHalfGramDesc = "price-half-gram-desc";
|
|
647
|
+
/**
|
|
648
|
+
* @deprecated Use `SearchSortEnum.price_half_ounce_asc` instead
|
|
649
|
+
*/
|
|
650
|
+
declare const priceHalfOunceAsc = "price-half-ounce-asc";
|
|
651
|
+
/**
|
|
652
|
+
* @deprecated Use `SearchSortEnum.price_half_ounce_desc` instead
|
|
653
|
+
*/
|
|
654
|
+
declare const priceHalfOunceDesc = "price-half-ounce-desc";
|
|
655
|
+
/**
|
|
656
|
+
* @deprecated Use `SearchSortEnum.price_ounce_asc` instead
|
|
657
|
+
*/
|
|
658
|
+
declare const priceOunceAsc = "price-ounce-asc";
|
|
659
|
+
/**
|
|
660
|
+
* @deprecated Use `SearchSortEnum.price_ounce_desc` instead
|
|
661
|
+
*/
|
|
662
|
+
declare const priceOunceDesc = "price-ounce-desc";
|
|
663
|
+
/**
|
|
664
|
+
* @deprecated Use `SearchSortEnum.price_quarter_ounce_asc` instead
|
|
665
|
+
*/
|
|
666
|
+
declare const priceQuarterOunceAsc = "price-quarter-ounce-asc";
|
|
667
|
+
/**
|
|
668
|
+
* @deprecated Use `SearchSortEnum.price_quarter_ounce_desc` instead
|
|
669
|
+
*/
|
|
670
|
+
declare const priceQuarterOunceDesc = "price-quarter-ounce-desc";
|
|
671
|
+
/**
|
|
672
|
+
* @deprecated Use `SearchSortEnum.price_two_gram_asc` instead
|
|
673
|
+
*/
|
|
674
|
+
declare const priceTwoGramAsc = "price-two-gram-asc";
|
|
675
|
+
/**
|
|
676
|
+
* @deprecated Use `SearchSortEnum.price_two_gram_desc` instead
|
|
677
|
+
*/
|
|
678
|
+
declare const priceTwoGramDesc = "price-two-gram-desc";
|
|
679
|
+
/**
|
|
680
|
+
* @deprecated Use `SearchSortEnum.rating` instead
|
|
681
|
+
*/
|
|
682
|
+
declare const rating = "rating";
|
|
683
|
+
/**
|
|
684
|
+
* @deprecated Use `SearchSortEnum.recommendation` instead
|
|
685
|
+
*/
|
|
686
|
+
declare const recommendation = "recommendation";
|
|
687
|
+
/**
|
|
688
|
+
* @deprecated Use `SearchSortEnum.thc_potency_asc` instead
|
|
689
|
+
*/
|
|
690
|
+
declare const thcPotencyAsc = "thc-potency-asc";
|
|
691
|
+
/**
|
|
692
|
+
* @deprecated Use `SearchSortEnum.thc_potency_desc` instead
|
|
693
|
+
*/
|
|
694
|
+
declare const thcPotencyDesc = "thc-potency-desc";
|
|
695
|
+
declare const searchSorts: readonly ["best-seller-rank", "category-and-name-asc", "default", "price-asc", "price-desc", "price-eighth-ounce-asc", "price-eighth-ounce-desc", "price-gram-asc", "price-gram-desc", "price-half-gram-asc", "price-half-gram-desc", "price-half-ounce-asc", "price-half-ounce-desc", "price-ounce-asc", "price-ounce-desc", "price-quarter-ounce-asc", "price-quarter-ounce-desc", "price-two-gram-asc", "price-two-gram-desc", "rating", "recommendation", "thc-potency-asc", "thc-potency-desc"];
|
|
696
|
+
/**
|
|
697
|
+
* @deprecated Use `SearchSortEnum` instead
|
|
698
|
+
*/
|
|
699
|
+
type SearchSort = (typeof searchSorts)[number];
|
|
700
|
+
|
|
701
|
+
interface CustomImageData {
|
|
702
|
+
headline: string;
|
|
703
|
+
imageUrl: string;
|
|
704
|
+
intendedDisplay: IntendedDisplay;
|
|
705
|
+
logoUrl: string;
|
|
706
|
+
overlayColor: string;
|
|
707
|
+
positionX: number;
|
|
708
|
+
positionY: number;
|
|
709
|
+
scaleNumber: number;
|
|
710
|
+
textColor: string;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Properties to fetch by a single store id.
|
|
714
|
+
*/
|
|
715
|
+
interface FetchByStoreIdProps {
|
|
716
|
+
/**
|
|
717
|
+
* The store ID to use for the placement.
|
|
718
|
+
* @deprecated Use `storeIds` instead
|
|
719
|
+
*/
|
|
720
|
+
storeId: number;
|
|
721
|
+
storeIds?: never;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Properties to fetch by many store ids.
|
|
725
|
+
*/
|
|
726
|
+
interface FetchByStoreIdsProps {
|
|
727
|
+
storeId?: never;
|
|
728
|
+
/**
|
|
729
|
+
* The store IDs to use for the placement.
|
|
730
|
+
*/
|
|
731
|
+
storeIds: number[];
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* Properties to fetch a CartTopperRow by POS product IDs.
|
|
735
|
+
*/
|
|
736
|
+
interface FetchCartTopperRowByPosProductId {
|
|
737
|
+
cartProductIds?: never;
|
|
738
|
+
/**
|
|
739
|
+
* The POS IDs of the products present in the cart.
|
|
740
|
+
*/
|
|
741
|
+
posCartProductIds: string[];
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Properties to fetch a CartTopperRow by product IDs.
|
|
745
|
+
*/
|
|
746
|
+
interface FetchCartTopperRowByProductProps {
|
|
747
|
+
/**
|
|
748
|
+
* The IDs of the products present in the cart.
|
|
749
|
+
*/
|
|
750
|
+
cartProductIds: number[];
|
|
751
|
+
posCartProductIds?: never;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Properties to fetch a CartTopperRow.
|
|
755
|
+
*/
|
|
756
|
+
type FetchCartTopperRowProps = {
|
|
757
|
+
/**
|
|
758
|
+
* Product attributes that will be returned in the search results.
|
|
759
|
+
*/
|
|
760
|
+
searchAttributes: string[];
|
|
761
|
+
/**
|
|
762
|
+
* The store ID to use for the placement.
|
|
763
|
+
*/
|
|
764
|
+
storeId: number;
|
|
765
|
+
} & (FetchCartTopperRowByPosProductId | FetchCartTopperRowByProductProps);
|
|
766
|
+
/**
|
|
767
|
+
* Properties to fetch a CustomImageRow.
|
|
768
|
+
*/
|
|
769
|
+
interface FetchCustomImageRowProps {
|
|
770
|
+
/**
|
|
771
|
+
* A list of attributes to be returned in the search results, such as
|
|
772
|
+
* `['product_id', 'name']`.
|
|
773
|
+
*/
|
|
774
|
+
searchAttributes: string[];
|
|
775
|
+
/**
|
|
776
|
+
* A filter string to be applied to the search results, such as
|
|
777
|
+
* `'kind:flower'`.
|
|
778
|
+
*/
|
|
779
|
+
searchFilter?: string;
|
|
780
|
+
/**
|
|
781
|
+
* The store ID to use for the placement.
|
|
782
|
+
*/
|
|
783
|
+
storeId: number;
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Properties to fetch a MenuRow.
|
|
787
|
+
* @internal
|
|
788
|
+
*/
|
|
789
|
+
type FetchMenuRowProps = {
|
|
790
|
+
/**
|
|
791
|
+
* The ad mode to use for the placement.
|
|
792
|
+
*
|
|
793
|
+
* @default AdMode.Default
|
|
794
|
+
*/
|
|
795
|
+
adMode?: AdMode;
|
|
796
|
+
/**
|
|
797
|
+
* If false, the products will not be deduped across stores.
|
|
798
|
+
*/
|
|
799
|
+
distinctByProduct?: boolean;
|
|
800
|
+
/**
|
|
801
|
+
* Metadata passed through data warehouse
|
|
802
|
+
* @internal
|
|
803
|
+
*/
|
|
804
|
+
metadata?: Record<string, unknown>;
|
|
805
|
+
/**
|
|
806
|
+
* The number of columns of products that are displayed in the placement.
|
|
807
|
+
*/
|
|
808
|
+
numColumns?: number;
|
|
809
|
+
/**
|
|
810
|
+
* A list of attributes to be returned in the search results, such as
|
|
811
|
+
* `['product_id', 'name']`.
|
|
812
|
+
*/
|
|
813
|
+
searchAttributes: string[];
|
|
814
|
+
/**
|
|
815
|
+
* A filter string to be applied to the search results, such as
|
|
816
|
+
* `'kind:flower'`.
|
|
817
|
+
*/
|
|
818
|
+
searchFilter?: string;
|
|
819
|
+
searchQuery?: string;
|
|
820
|
+
/**
|
|
821
|
+
* The sort order to apply to the search results.
|
|
822
|
+
*/
|
|
823
|
+
searchSort: SearchSort | SearchSortEnum;
|
|
824
|
+
} & (FetchByStoreIdProps | FetchByStoreIdsProps);
|
|
825
|
+
/**
|
|
826
|
+
* Properties to fetch a MenuTopRow.
|
|
827
|
+
*/
|
|
828
|
+
type FetchMenuTopRowProps<AdditionalTypes = object> = {
|
|
829
|
+
/**
|
|
830
|
+
* A list of attributes to be returned in the search results, such as
|
|
831
|
+
* `['product_id', 'name']`.
|
|
832
|
+
*/
|
|
833
|
+
searchAttributes: string[];
|
|
834
|
+
/**
|
|
835
|
+
* A filter string to be applied to the search results, such as
|
|
836
|
+
* `'kind:flower'`.
|
|
837
|
+
*/
|
|
838
|
+
searchFilter?: string;
|
|
839
|
+
/**
|
|
840
|
+
* The store ID to use for the placement.
|
|
841
|
+
*/
|
|
842
|
+
storeId: number;
|
|
843
|
+
} & AdditionalTypes;
|
|
844
|
+
interface FetchRecommendedPDPRowByPosProductId {
|
|
845
|
+
/**
|
|
846
|
+
* POS Product ID of the product being viewed.
|
|
847
|
+
*/
|
|
848
|
+
posProductId: string;
|
|
849
|
+
productId?: never;
|
|
850
|
+
}
|
|
851
|
+
interface FetchRecommendedPDPRowByProductId {
|
|
852
|
+
posProductId?: never;
|
|
853
|
+
/**
|
|
854
|
+
* Product ID of the product being viewed.
|
|
855
|
+
*/
|
|
856
|
+
productId: number;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Properties to fetch a PDPRow.
|
|
860
|
+
*/
|
|
861
|
+
type FetchRecommendedPDPRowProps = {
|
|
862
|
+
/**
|
|
863
|
+
* A list of attributes to be returned in the search results, such as
|
|
864
|
+
* `['product_id', 'name']`.
|
|
865
|
+
*/
|
|
866
|
+
searchAttributes: string[];
|
|
867
|
+
/**
|
|
868
|
+
* The store ID to use for the placement.
|
|
869
|
+
*/
|
|
870
|
+
storeId: number;
|
|
871
|
+
} & (FetchRecommendedPDPRowByPosProductId | FetchRecommendedPDPRowByProductId);
|
|
872
|
+
/**
|
|
873
|
+
* Properties to fetch a RecommendedRow
|
|
874
|
+
*/
|
|
875
|
+
interface FetchRecommendedRowProps {
|
|
876
|
+
/**
|
|
877
|
+
* The ad mode to use for the placement.
|
|
878
|
+
*
|
|
879
|
+
* @default AdMode.Default
|
|
880
|
+
*/
|
|
881
|
+
adMode?: AdMode;
|
|
882
|
+
/**
|
|
883
|
+
* Structured filter contexts to apply to the search results.
|
|
884
|
+
* Supports filtering by product kind.
|
|
885
|
+
* @example
|
|
886
|
+
* ```typescript
|
|
887
|
+
* filterContext: [{ kind: ['flower', 'edible', 'vape'] }]
|
|
888
|
+
* ```
|
|
889
|
+
*/
|
|
890
|
+
filterContext?: FilterContext[];
|
|
891
|
+
/**
|
|
892
|
+
* Page context indicating where the placement appears.
|
|
893
|
+
* Defaults to 'featured' if not specified.
|
|
894
|
+
* @example
|
|
895
|
+
* ```typescript
|
|
896
|
+
* pageContext: 'featured' // or 'midgrid'
|
|
897
|
+
* ```
|
|
898
|
+
*/
|
|
899
|
+
pageContext?: PageContextEnum;
|
|
900
|
+
/**
|
|
901
|
+
* A list of attributes to be returned in the search results, such as
|
|
902
|
+
* `['product_id', 'name']`.
|
|
903
|
+
*/
|
|
904
|
+
searchAttributes: string[];
|
|
905
|
+
/**
|
|
906
|
+
* The store ID to use for the placement.
|
|
907
|
+
*/
|
|
908
|
+
storeId: number;
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* Properties to fetch a SmartSort instance.
|
|
912
|
+
*/
|
|
913
|
+
type FetchRecommendedSortProps = {
|
|
914
|
+
/**
|
|
915
|
+
* If true, no ads are displayed in the placement.
|
|
916
|
+
*/
|
|
917
|
+
disableAds?: boolean;
|
|
918
|
+
/**
|
|
919
|
+
* If false, the products will not be deduped across stores.
|
|
920
|
+
*/
|
|
921
|
+
distinctByProduct?: boolean;
|
|
922
|
+
/**
|
|
923
|
+
* The maximum number of products to display in the placement.
|
|
924
|
+
*/
|
|
925
|
+
maxProducts?: number;
|
|
926
|
+
/**
|
|
927
|
+
* Metadata passed through data warehouse
|
|
928
|
+
* @internal
|
|
929
|
+
*/
|
|
930
|
+
metadata?: Record<string, unknown>;
|
|
931
|
+
/**
|
|
932
|
+
* The number of columns of products that are displayed in the placement.
|
|
933
|
+
*/
|
|
934
|
+
numColumns?: number;
|
|
935
|
+
/**
|
|
936
|
+
* The number of products to fetch in each page.
|
|
937
|
+
*/
|
|
938
|
+
pageSize?: number;
|
|
939
|
+
/**
|
|
940
|
+
* A list of attributes to be returned in the search results, such as
|
|
941
|
+
* `['product_id', 'name']`.
|
|
942
|
+
*/
|
|
943
|
+
searchAttributes: string[];
|
|
944
|
+
/**
|
|
945
|
+
* A list of search facets to be returned in the search results, such as
|
|
946
|
+
* `['kind']`.
|
|
947
|
+
*/
|
|
948
|
+
searchFacets?: string[];
|
|
949
|
+
/**
|
|
950
|
+
* A filter string to be applied to the search results, such as
|
|
951
|
+
* `'kind:flower'`.
|
|
952
|
+
*/
|
|
953
|
+
searchFilter?: string;
|
|
954
|
+
searchQuery?: string;
|
|
955
|
+
/**
|
|
956
|
+
* The sort order to apply to the search results.
|
|
957
|
+
*/
|
|
958
|
+
searchSort: SearchSort | SearchSortEnum;
|
|
959
|
+
} & (FetchByStoreIdProps | FetchByStoreIdsProps);
|
|
960
|
+
/**
|
|
961
|
+
* Cached product in the SmartSort placement
|
|
962
|
+
* The key difference between a Cached and a regular `SmartSortProduct`
|
|
963
|
+
* is the hydration of the `attributes` property.
|
|
964
|
+
* Cached products do not have this attribute while `SmartSortProducts` do.
|
|
965
|
+
* @internal
|
|
966
|
+
*/
|
|
967
|
+
interface SmartSortCachedProductProps {
|
|
968
|
+
clickPayload: Click;
|
|
969
|
+
clickUrl: string;
|
|
970
|
+
impressPayload: Impression;
|
|
971
|
+
impressUrl: string;
|
|
972
|
+
isSponsored: boolean;
|
|
973
|
+
objectId: string;
|
|
974
|
+
}
|
|
975
|
+
/**
|
|
976
|
+
* The SmartSortClickIntent is used to determine if the click
|
|
977
|
+
* event should be treated as an "add to cart" event.
|
|
978
|
+
*
|
|
979
|
+
*/
|
|
980
|
+
interface SmartSortClickIntent {
|
|
981
|
+
/**
|
|
982
|
+
* When set to true, the click event will be treated as an "add to cart" event.
|
|
983
|
+
*
|
|
984
|
+
* @default false
|
|
985
|
+
*/
|
|
986
|
+
isAddToCart?: boolean;
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* Data structure used to request the next set of products when loading
|
|
990
|
+
* the next page of a SmartSort placement.
|
|
991
|
+
*/
|
|
992
|
+
interface SmartSortNextPageProps {
|
|
993
|
+
pageSize: number;
|
|
994
|
+
searchAttributes: string[];
|
|
995
|
+
}
|
|
996
|
+
/**
|
|
997
|
+
* Properties to create a `SmartSortProduct` instance.
|
|
998
|
+
*/
|
|
999
|
+
interface SmartSortProductProps<ProductShape extends object = Record<string, unknown>> extends SmartSortCachedProductProps {
|
|
1000
|
+
attributes: ProductShape;
|
|
1001
|
+
hasBeenImpressed?: boolean;
|
|
1002
|
+
}
|
|
1003
|
+
/**
|
|
1004
|
+
* Properties to recreate a `SmartSort` instance.
|
|
1005
|
+
* These properties should be passed **unmodified** to the constructor.
|
|
1006
|
+
*/
|
|
1007
|
+
interface SmartSortProps<ProductShape extends object = Record<string, unknown>> {
|
|
1008
|
+
/**
|
|
1009
|
+
* Cached products for the placement. This field is used internally to
|
|
1010
|
+
* improve the performance of the placement.
|
|
1011
|
+
* @internal
|
|
1012
|
+
*/
|
|
1013
|
+
cachedProducts: SmartSortCachedProductProps[];
|
|
1014
|
+
/**
|
|
1015
|
+
* Jane configuration object.
|
|
1016
|
+
* @internal
|
|
1017
|
+
*/
|
|
1018
|
+
config: RequiredConfig;
|
|
1019
|
+
/**
|
|
1020
|
+
* The creative IDs associated with the placement
|
|
1021
|
+
*/
|
|
1022
|
+
creativeIds?: number[];
|
|
1023
|
+
/**
|
|
1024
|
+
* The custom images for the placement. Always an array; empty when the
|
|
1025
|
+
* placement returns no custom images.
|
|
1026
|
+
*/
|
|
1027
|
+
customImages?: CustomImageData[];
|
|
1028
|
+
/**
|
|
1029
|
+
* Parameters to request the next page of the placement.
|
|
1030
|
+
*/
|
|
1031
|
+
nextPageProps: SmartSortNextPageProps;
|
|
1032
|
+
/**
|
|
1033
|
+
* URL where the next set of products can be fetched from.
|
|
1034
|
+
*/
|
|
1035
|
+
nextPageUrl: string;
|
|
1036
|
+
/**
|
|
1037
|
+
* The placement type of the current instance.
|
|
1038
|
+
*/
|
|
1039
|
+
placement?: Placement;
|
|
1040
|
+
/**
|
|
1041
|
+
* The products to display in the placement
|
|
1042
|
+
*/
|
|
1043
|
+
products: SmartSortProductProps<ProductShape>[];
|
|
1044
|
+
/**
|
|
1045
|
+
* The row id of the placement.
|
|
1046
|
+
*/
|
|
1047
|
+
rowId?: number | undefined;
|
|
1048
|
+
/**
|
|
1049
|
+
* A map of search facets for this placement.
|
|
1050
|
+
* @example
|
|
1051
|
+
* ```json
|
|
1052
|
+
* {
|
|
1053
|
+
* "category": {
|
|
1054
|
+
* "sativa": 20,
|
|
1055
|
+
* "indica": 10,
|
|
1056
|
+
* },
|
|
1057
|
+
* "kind": {
|
|
1058
|
+
* "flower": 31,
|
|
1059
|
+
* "vape": 5,
|
|
1060
|
+
* },
|
|
1061
|
+
* }
|
|
1062
|
+
* ```
|
|
1063
|
+
*/
|
|
1064
|
+
searchFacets?: Record<string, Record<string, number>>;
|
|
1065
|
+
/**
|
|
1066
|
+
* The title of the placement
|
|
1067
|
+
*/
|
|
1068
|
+
title?: string | undefined;
|
|
1069
|
+
/**
|
|
1070
|
+
* Total number of products available
|
|
1071
|
+
*/
|
|
1072
|
+
totalProducts: number;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
export { priceEighthOunceDesc as $, AdMode as A, type JaneDMConfig as B, type Click as C, DEFAULT_PAGE_SIZE as D, type JaneDMIdentifiers as E, type FilterContext as F, JaneDeviceIdSentinel as G, type PaginationInfo as H, type Impression as I, type JaneDMPublicConfig as J, ProductKindEnum as K, type ProductReview as L, type ProductReviewsAggregate as M, ReviewSortEnum as N, type SearchSort as O, Placement as P, type SmartSortNextPageProps as Q, type RequiredConfig as R, SearchSortEnum as S, type VirtualBudtenderSearchResponse as T, bestSellerRank as U, type VirtualBudtenderQuery as V, categoryAndNameAsc as W, defaultOrder as X, priceAsc as Y, priceDesc as Z, priceEighthOunceAsc as _, PageContextEnum as a, priceGramAsc as a0, priceGramDesc as a1, priceHalfGramAsc as a2, priceHalfGramDesc as a3, priceHalfOunceAsc as a4, priceHalfOunceDesc as a5, priceOunceAsc as a6, priceOunceDesc as a7, priceQuarterOunceAsc as a8, priceQuarterOunceDesc as a9, priceTwoGramAsc as aa, priceTwoGramDesc as ab, rating as ac, recommendation as ad, searchSorts as ae, thcPotencyAsc as af, thcPotencyDesc as ag, type PlacementResponse as ah, type Product as ai, type ProductReviewsResponse$1 as aj, type ProductsPlacementResponse as ak, type PageResponse as al, type CustomImageData$1 as am, type CustomImageData as b, type SmartSortProductProps as c, type SmartSortClickIntent as d, type SmartSortProps as e, type ConversionExternalProduct as f, type SessionEvent as g, type JaneDMInternalConfig as h, type FetchCartTopperRowProps as i, type FetchCustomImageRowProps as j, type Facets as k, type FetchMenuRowProps as l, type FetchMenuTopRowProps as m, type FetchProductReviewsProps as n, type ProductReviewsResponse as o, type FetchRecommendedPDPRowProps as p, type FetchRecommendedRowProps as q, type FetchRecommendedSortProps as r, type IterateProductReviewsProps as s, type ProductReviewsIterable as t, AppMode as u, type FetchCartTopperRowByPosProductId as v, type FetchCartTopperRowByProductProps as w, type FetchRecommendedPDPRowByPosProductId as x, type FetchRecommendedPDPRowByProductId as y, IntendedDisplay as z };
|