@shopify/shop-minis-platform 0.23.0 → 0.25.0
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/package.json
CHANGED
|
@@ -142,23 +142,49 @@ export interface ProductVariantSelection {
|
|
|
142
142
|
source: 'auto' | 'user'
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Variant chosen by the user from the sheet's option pickers.
|
|
147
|
+
*/
|
|
148
|
+
export interface SelectVariantSelectedResult extends ProductVariantSelection {
|
|
149
|
+
/** Discriminator. The user picked a variant and confirmed. */
|
|
150
|
+
outcome: 'selected'
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Returned when the user taps the product header inside the sheet to go
|
|
155
|
+
* to the PDP instead of confirming a selection. The sheet is dismissed,
|
|
156
|
+
* the user has navigated to the PDP, and no selection is reported back.
|
|
157
|
+
*/
|
|
158
|
+
export interface SelectVariantNavigatedToProductResult {
|
|
159
|
+
/** Discriminator. The user navigated to the PDP from the sheet. */
|
|
160
|
+
outcome: 'navigated_to_product'
|
|
161
|
+
/** GID of the product the host navigated to. */
|
|
162
|
+
productId: string
|
|
163
|
+
/**
|
|
164
|
+
* GID of the variant that was highlighted when the user tapped to
|
|
165
|
+
* navigate. The PDP opens scoped to this variant.
|
|
166
|
+
*/
|
|
167
|
+
productVariantId: string
|
|
168
|
+
}
|
|
169
|
+
|
|
145
170
|
/**
|
|
146
171
|
* Successful payload returned from `select:shopify/ProductVariant`. The
|
|
147
172
|
* intent result is `{code: 'ok', data: SelectProductVariantResult}` on
|
|
148
173
|
* success; `{code: 'closed'}` when the user dismisses the sheet.
|
|
149
174
|
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* `
|
|
153
|
-
*
|
|
154
|
-
*
|
|
175
|
+
* Discriminate via `data.outcome`:
|
|
176
|
+
* - `'selected'` — the user picked a variant from the sheet; the full
|
|
177
|
+
* selection (`productVariantId`, `quantity`, `variant`, `source`) is
|
|
178
|
+
* present.
|
|
179
|
+
* - `'navigated_to_product'` — the user tapped the sheet's product
|
|
180
|
+
* header and the host took them to the PDP. Only `productId` and
|
|
181
|
+
* `productVariantId` (the highlighted variant) are present.
|
|
155
182
|
*
|
|
156
183
|
* @publicDocs
|
|
157
184
|
*/
|
|
158
|
-
export
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
185
|
+
export type SelectProductVariantResult =
|
|
186
|
+
| SelectVariantSelectedResult
|
|
187
|
+
| SelectVariantNavigatedToProductResult
|
|
162
188
|
|
|
163
189
|
// ---------------------------------------------------------------------------
|
|
164
190
|
// Add to Cart Intent — add_to_cart:shopify/ProductVariant
|
|
@@ -232,16 +258,34 @@ export interface AddToCartAddedResult extends ProductVariantSelection {
|
|
|
232
258
|
}
|
|
233
259
|
|
|
234
260
|
/**
|
|
235
|
-
* Returned when the
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
* successful hand-off — the shopper is now on the PDP.
|
|
261
|
+
* Returned when the user tapped the sheet's product header to view the
|
|
262
|
+
* PDP instead of adding to cart. The sheet is dismissed and the user is
|
|
263
|
+
* now on the PDP.
|
|
239
264
|
*/
|
|
240
265
|
export interface AddToCartNavigatedToProductResult {
|
|
241
|
-
/** Discriminator. The
|
|
266
|
+
/** Discriminator. The user navigated to the PDP from the sheet. */
|
|
242
267
|
outcome: 'navigated_to_product'
|
|
243
268
|
/** GID of the product the host navigated to. */
|
|
244
269
|
productId: string
|
|
270
|
+
/**
|
|
271
|
+
* GID of the variant that was highlighted when the user tapped to
|
|
272
|
+
* navigate. The PDP opens scoped to this variant.
|
|
273
|
+
*/
|
|
274
|
+
productVariantId: string
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Returned when the product cannot be added to the cart from the mini
|
|
279
|
+
* (e.g. referral products outside Shop's catalog) and the host instead
|
|
280
|
+
* redirected the user to the product's PDP. The mini should treat this
|
|
281
|
+
* as a successful hand-off — the cart was not modified but the shopper
|
|
282
|
+
* is now on the PDP.
|
|
283
|
+
*/
|
|
284
|
+
export interface AddToCartRedirectedToProductResult {
|
|
285
|
+
/** Discriminator. The host redirected the user to the PDP instead. */
|
|
286
|
+
outcome: 'redirected_to_product'
|
|
287
|
+
/** GID of the product the host redirected to. */
|
|
288
|
+
productId: string
|
|
245
289
|
}
|
|
246
290
|
|
|
247
291
|
/**
|
|
@@ -250,15 +294,18 @@ export interface AddToCartNavigatedToProductResult {
|
|
|
250
294
|
* Discriminate via `data.outcome`:
|
|
251
295
|
* - `'added_to_cart'` — a concrete variant was added; selection fields
|
|
252
296
|
* (`productVariantId`, `quantity`, `source`) are present.
|
|
253
|
-
* - `'navigated_to_product'` — the
|
|
254
|
-
*
|
|
255
|
-
*
|
|
297
|
+
* - `'navigated_to_product'` — the user tapped the sheet's product
|
|
298
|
+
* header and the host took them to the PDP. The cart was not modified.
|
|
299
|
+
* - `'redirected_to_product'` — the host could not add this product
|
|
300
|
+
* (e.g. referral product on another merchant's storefront) and
|
|
301
|
+
* redirected the user to the PDP. Only `productId` is present.
|
|
256
302
|
*
|
|
257
303
|
* @publicDocs
|
|
258
304
|
*/
|
|
259
305
|
export type AddToCartProductVariantResult =
|
|
260
306
|
| AddToCartAddedResult
|
|
261
307
|
| AddToCartNavigatedToProductResult
|
|
308
|
+
| AddToCartRedirectedToProductResult
|
|
262
309
|
|
|
263
310
|
// ---------------------------------------------------------------------------
|
|
264
311
|
// Buy Now Intent — buy_now:shopify/ProductVariant
|
|
@@ -316,15 +363,33 @@ export interface BuyNowCheckoutOpenedResult extends ProductVariantSelection {
|
|
|
316
363
|
}
|
|
317
364
|
|
|
318
365
|
/**
|
|
319
|
-
* Returned when the
|
|
320
|
-
*
|
|
321
|
-
*
|
|
366
|
+
* Returned when the user tapped the sheet's product header to view the
|
|
367
|
+
* PDP instead of going to checkout. The sheet is dismissed and the user
|
|
368
|
+
* is now on the PDP.
|
|
322
369
|
*/
|
|
323
370
|
export interface BuyNowNavigatedToProductResult {
|
|
324
|
-
/** Discriminator. The
|
|
371
|
+
/** Discriminator. The user navigated to the PDP from the sheet. */
|
|
325
372
|
outcome: 'navigated_to_product'
|
|
326
373
|
/** GID of the product the host navigated to. */
|
|
327
374
|
productId: string
|
|
375
|
+
/**
|
|
376
|
+
* GID of the variant that was highlighted when the user tapped to
|
|
377
|
+
* navigate. The PDP opens scoped to this variant.
|
|
378
|
+
*/
|
|
379
|
+
productVariantId: string
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Returned when the product cannot be bought from the mini (e.g. referral
|
|
384
|
+
* products outside Shop's catalog) and the host instead redirected the
|
|
385
|
+
* user to the product's PDP. The mini should treat this as a successful
|
|
386
|
+
* hand-off — no checkout was created but the shopper is now on the PDP.
|
|
387
|
+
*/
|
|
388
|
+
export interface BuyNowRedirectedToProductResult {
|
|
389
|
+
/** Discriminator. The host redirected the user to the PDP instead. */
|
|
390
|
+
outcome: 'redirected_to_product'
|
|
391
|
+
/** GID of the product the host redirected to. */
|
|
392
|
+
productId: string
|
|
328
393
|
}
|
|
329
394
|
|
|
330
395
|
/**
|
|
@@ -333,15 +398,18 @@ export interface BuyNowNavigatedToProductResult {
|
|
|
333
398
|
* Discriminate via `data.outcome`:
|
|
334
399
|
* - `'checkout_opened'` — express checkout opened for a concrete variant;
|
|
335
400
|
* selection fields (`productVariantId`, `quantity`, `source`) are present.
|
|
336
|
-
* - `'navigated_to_product'` — the
|
|
337
|
-
*
|
|
338
|
-
*
|
|
401
|
+
* - `'navigated_to_product'` — the user tapped the sheet's product
|
|
402
|
+
* header and the host took them to the PDP. No checkout was created.
|
|
403
|
+
* - `'redirected_to_product'` — the host could not buy this product
|
|
404
|
+
* (e.g. referral product on another merchant's storefront) and
|
|
405
|
+
* redirected the user to the PDP. Only `productId` is present.
|
|
339
406
|
*
|
|
340
407
|
* @publicDocs
|
|
341
408
|
*/
|
|
342
409
|
export type BuyNowProductVariantResult =
|
|
343
410
|
| BuyNowCheckoutOpenedResult
|
|
344
411
|
| BuyNowNavigatedToProductResult
|
|
412
|
+
| BuyNowRedirectedToProductResult
|
|
345
413
|
|
|
346
414
|
// ---------------------------------------------------------------------------
|
|
347
415
|
// Intent Registry
|