-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvtex.store-newsletter.d.ts
192 lines (191 loc) · 6.38 KB
/
vtex.store-newsletter.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
import { Block } from '.'
declare global {
namespace JSX {
interface IntrinsicElements {
/**
* Top level block that provides context to all its children.
*
* @see {@link https://developers.vtex.com/docs/apps/vtex.store-newsletter}
*/
'newsletter-form': Block<{
/**
* Block to be rendered if the submission of the form fails.
* If none is passed, a default error component will be rendered.
*
* @default undefined
*/
ErrorState?: string
/**
* Block to be rendered if form submission succeeds.
* If none is passed, a default success component will be rendered.
*
* @default undefined
*/
SuccessState?: string
/**
* Block to be rendered while the form submission is loading.
* If none is passed, the default behavior is for the submit button to show a spinner during this loading period.
*
* @default undefined
*/
LoadingState?: string
}>
/**
* Renders an email input in the newsletter form.
*
* @see {@link https://developers.vtex.com/docs/apps/vtex.store-newsletter}
*/
'newsletter-input-email': Block<{
/**
* Placeholder text for the email input.
*
* @default "Enter your email address" (translated according to the store's locale).
*/
placeholderText?: string
/**
* Label for the email input.
*
* @default null
*/
inputLabel?: string
/**
* Error message to be shown if email is invalid.
*
* @default `Invalid email address` (translated according to the store's locale).
*/
errorMessage?: string
}>
/**
* Renders an name input in the newsletter form.
*
* @see {@link https://developers.vtex.com/docs/apps/vtex.store-newsletter}
*/
'newsletter-input-name': Block<{
/**
* Placeholder text for name input.
*
* @default "Enter your name" (translated according to the store's locale).
*/
placeholderText?: string
/**
* Label for the name input.
*
* @default null
*/
inputLabel?: string
/**
* Error message to be shown if name input is empty.
*
* @default "Invalid name" (translated according to the store's locale).
*/
errorMessage?: string
}>
/**
* Renders an phone input in the newsletter form.
*
* @see {@link https://developers.vtex.com/docs/apps/vtex.store-newsletter}
*/
'newsletter-input-phone': Block<{
/**
* Placeholder text for phone input.
*
* @default "Enter your phone" (translated according to the store's locale).
*/
placeholderText?: string
/**
* Label for the phone input.
*
* @default null
*/
inputLabel?: string
/**
* Error message to be shown if phone input is empty.
*
* @default "Invalid phone" (translated according to the store's locale).
*/
errorMessage?: string
}>
/**
* Renders a confirmation checkbox in the newsletter form.
*
* @see {@link https://developers.vtex.com/docs/apps/vtex.store-newsletter}
*/
'newsletter-checkbox-confirmation': Block<{
/**
* Label for the confirmation checkbox.
* This prop supports the [ICU Message Format](https://format-message.github.io/icu-message-format-for-translators/), exposing two variables for you to interpolate: `firstLink` and `secondLink`.
*
* @default `I agree to received this newsletter.` (translated according to the store's locale).
*/
checkboxLabel?: string
/**
* Configures the `firstLink` variable to be interpolated by the text passed to `checkboxLabel` checkbox.
*
* @default undefined
*/
firstLabelLink?: {
/**
* The link's URL.
*
* @default undefined
*/
url?: string
/**
* Text displayed on the link.
*
* @default undefined
*/
text?: string
}
/**
* Configures the `secondLink` variable to be interpolated by the text passed to `checkboxLabel` checkbox.
*
* @default undefined
*/
secondLabelLink?: {
/**
* The link's URL.
*
* @default undefined
*/
url?: string
/**
* Text displayed on the link.
*
* @default undefined
*/
text?: string
}
}>
/**
* Doesn't render anything, but enables hidden fields on the form to fetch custom data and save them in the store's [Master Data](https://help.vtex.com/en/tutorial/what-is-master-data--4otjBnR27u4WUIciQsmkAw) whenever a user subscribes to the newsletter.
*
* @see {@link https://developers.vtex.com/docs/apps/vtex.store-newsletter}
*/
'newsletter-hidden-field': Block<{
/**
* Desired hidden fields responsible for saving the user's custom data on [Master Data](https://help.vtex.com/en/tutorial/what-is-master-data--4otjBnR27u4WUIciQsmkAw) once the newsletter form is submitted.
* Notice that the name of the fields must be written in an array and represent which user data they save.
* Possible values are: `bindingUrl` and `bindingId`.
* *Caution*: To properly save the data, you must also [create the desired filters](https://help.vtex.com/en/tutorial/how-can-i-create-a-field-in-master-data--frequentlyAskedQuestions_1829) in the Master Data's `Client` entity.
*
* @default undefined
*/
dynamicFields?: ('bindingUrl' | 'bindingId')[]
}>
/**
* Renders a `Submit` button for the newsletter form.
*
* @see {@link https://developers.vtex.com/docs/apps/vtex.store-newsletter}
*/
'newsletter-submit': Block<{
/**
* Text displayed on the submit button.
*
* @default "Subscribe" (translated according to the store's locale).
*/
submitButtonLabel?: string
}>
}
}
}