File tree Expand file tree Collapse file tree 6 files changed +152
-0
lines changed
docs/surfaces/checkout/reference
examples/purchase.thank-you.announcement.render Expand file tree Collapse file tree 6 files changed +152
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @shopify/ui-extensions ' : minor
3+ ---
4+
5+ Add Checkout Thank You page announcement extension target
Original file line number Diff line number Diff line change 1+ import {
2+ BlockStack ,
3+ Button ,
4+ InlineStack ,
5+ Link ,
6+ Modal ,
7+ TextField ,
8+ Text ,
9+ extension ,
10+ } from '@shopify/ui-extensions/checkout' ;
11+
12+ export default extension (
13+ 'purchase.thank-you.announcement.render' ,
14+ ( root , { shop} ) => {
15+ const modalFragment = root . createFragment ( ) ;
16+ modalFragment . appendChild (
17+ root . createComponent (
18+ Modal ,
19+ {
20+ title :
21+ 'Tell us about your shopping experience' ,
22+ padding : true ,
23+ } ,
24+ [
25+ root . createComponent (
26+ BlockStack ,
27+ undefined ,
28+ [
29+ root . createComponent (
30+ Text ,
31+ undefined ,
32+ `We'd love to hear about your shopping experience at ${ shop . name } ` ,
33+ ) ,
34+ root . createComponent ( TextField , {
35+ multiline : 4 ,
36+ label :
37+ 'How can we make your shopping experience better?' ,
38+ } ) ,
39+ root . createComponent (
40+ Button ,
41+ undefined ,
42+ 'Submit' ,
43+ ) ,
44+ ] ,
45+ ) ,
46+ ] ,
47+ ) ,
48+ ) ;
49+
50+ root . appendChild (
51+ root . createComponent (
52+ InlineStack ,
53+ undefined ,
54+ [
55+ root . createComponent (
56+ Text ,
57+ undefined ,
58+ 'Check our latest offers' ,
59+ ) ,
60+ root . createComponent (
61+ Link ,
62+ {
63+ overlay : modalFragment ,
64+ } ,
65+ 'Fill out the survey' ,
66+ ) ,
67+ ] ,
68+ ) ,
69+ ) ;
70+ } ,
71+ ) ;
Original file line number Diff line number Diff line change 1+ import {
2+ BlockStack ,
3+ Button ,
4+ InlineStack ,
5+ Link ,
6+ Modal ,
7+ reactExtension ,
8+ TextField ,
9+ Text ,
10+ useApi ,
11+ } from '@shopify/ui-extensions-react/checkout' ;
12+
13+ // 1. Choose an extension target
14+ export default reactExtension (
15+ 'purchase.thank-you.announcement.render' ,
16+ ( ) => < Extension /> ,
17+ ) ;
18+
19+ function Extension ( ) {
20+ // 2. Use the extension API to gather context from the shop
21+ const { shop} = useApi ( ) ;
22+
23+ // 3. Render a UI
24+ return (
25+ < InlineStack >
26+ < Text > Check our latest offers</ Text >
27+ < Link
28+ overlay = {
29+ < Modal
30+ title = "Tell us about your shopping experience"
31+ padding
32+ >
33+ < BlockStack >
34+ < Text >
35+ We'd love to hear about your
36+ shopping experience at { shop . name }
37+ </ Text >
38+ < TextField
39+ multiline = { 4 }
40+ label = "How can we make your shopping experience better?"
41+ > </ TextField >
42+ < Button > Submit</ Button >
43+ </ BlockStack >
44+ </ Modal >
45+ }
46+ >
47+ Fill out the survey
48+ </ Link >
49+ </ InlineStack >
50+ ) ;
51+ }
Original file line number Diff line number Diff line change @@ -152,6 +152,7 @@ export function getExamples(
152152 ...createExample ( 'purchase.thank-you.footer.render-after/default' ) ,
153153 ...createExample ( 'purchase.checkout.chat.render/default' ) ,
154154 ...createExample ( 'purchase.thank-you.chat.render/default' ) ,
155+ ...createExample ( 'purchase.thank-you.announcement.render/default' ) ,
155156 'analytics-publish' : {
156157 description :
157158 'You can publish analytics events to the Shopify analytics frameworks and they will be propagated to all web pixels on the page.' ,
Original file line number Diff line number Diff line change 1+ import type { ReferenceEntityTemplateSchema } from '@shopify/generate-docs' ;
2+
3+ import { getExample , getLinksByTag , THANK_YOU_API } from '../helper.docs' ;
4+
5+ const data : ReferenceEntityTemplateSchema = {
6+ name : 'purchase.thank-you.announcment.render' ,
7+ description : `A static extension target that is rendered on top of the **Thank you page** as a dismissable announcement.` ,
8+ defaultExample : getExample ( 'purchase.thank-you.announcement.render/default' , [
9+ 'jsx' ,
10+ 'js' ,
11+ ] ) ,
12+ related : getLinksByTag ( 'targets' ) ,
13+ ...THANK_YOU_API ,
14+ } ;
15+
16+ export default data ;
Original file line number Diff line number Diff line change @@ -647,6 +647,14 @@ export interface RenderExtensionTargets {
647647 OrderConfirmationApi & StandardApi < 'purchase.thank-you.chat.render' > ,
648648 AllowedComponents < 'Chat' >
649649 > ;
650+ /**
651+ * A static extension target that is rendered on top of the **Thank you page** as a dismissable announcement.
652+ */
653+ 'purchase.thank-you.announcement.render' : RenderExtension <
654+ OrderConfirmationApi &
655+ StandardApi < 'purchase.thank-you.announcement.render' > ,
656+ AnyComponent
657+ > ;
650658}
651659
652660export interface RunnableExtensionTargets {
You can’t perform that action at this time.
0 commit comments