Commit b86354f
authored
Update docs for
Resolves shop/issues-retail#8521
### Background
The changes made in #2986 need their documentation to be updated.
### Solution
Adds release notes for:
- Added `editable` property
- Added `useCartEditable` hook
- Added `CartNotEditableError` error class
This PR also changes the API method docs to use `Throws` instead of `@throws` as our internal documentation engine doesn't support those tags yet. Ideally, we'd be able to make use of such tags, but for now I think it makes sense to just do without them.
#### Question
Now `editable` affects all cart methods, throwing an error when the cart is not editable. Should we update all examples to include the `editable` check or is that simply noise?
For example, the react examples would probably look like:
```tsx
const editable = useCartEditable();
// ...
return (
<Tile
// ...
onPress={() => editable && api.cart.setCustomer({
id: 1,
})}
/>
);
```
And TypeScript examples would look like:
```ts
const tile = root.createComponent(Tile, {
// ...
onPress: () => api.cart.subscribable.initial.editable && api.cart.setCustomer({
id: 1,
}),
});
// ...
api.cart.subscribable.subscribe((newCart: Cart) => {
tile.updateProps({
onPress: () => editable && api.cart.setCustomer({
id: 1,
}),
});
});
```
Note that the other way of handling cart editability is to disable the tile when `editable` is false. So we could also update the examples in a similar way but just modifying `enabled` instead of doing `editable && ...`.
How do we feel about including these in the examples? Does it detract from the actual example too much?
### 🎩
https://pos.docs.shopify.io/extensions/contributing/documentation#how-to-update-docs-for-stable-api-versions
Here is the result:
| API Docs | Release Notes | Example |
| -------- | ------------- | ------- |
|  |  |  |
### Checklist
- [x] I have 🎩'd these changes
- [x] I have updated relevant documentationeditable property (#3002)File tree
6 files changed
+62
-48
lines changed- packages/ui-extensions
- docs/surfaces/point-of-sale
- reference
- apis
- examples/cart-api
- staticPages/pages
- src/surfaces/point-of-sale/render/api/cart-api
6 files changed
+62
-48
lines changedLines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
Lines changed: 21 additions & 48 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | | - | |
36 | | - | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
46 | 44 | | |
47 | 45 | | |
48 | 46 | | |
| |||
52 | 50 | | |
53 | 51 | | |
54 | 52 | | |
55 | | - | |
56 | 53 | | |
57 | | - | |
| 54 | + | |
58 | 55 | | |
59 | 56 | | |
60 | 57 | | |
61 | 58 | | |
62 | 59 | | |
63 | | - | |
64 | | - | |
65 | 60 | | |
66 | 61 | | |
67 | 62 | | |
68 | 63 | | |
69 | 64 | | |
70 | | - | |
71 | 65 | | |
72 | | - | |
| 66 | + | |
73 | 67 | | |
74 | 68 | | |
75 | 69 | | |
76 | 70 | | |
77 | 71 | | |
78 | | - | |
79 | | - | |
80 | 72 | | |
81 | 73 | | |
82 | 74 | | |
83 | 75 | | |
84 | 76 | | |
85 | | - | |
86 | 77 | | |
87 | | - | |
| 78 | + | |
88 | 79 | | |
89 | 80 | | |
90 | 81 | | |
91 | 82 | | |
92 | 83 | | |
93 | | - | |
94 | | - | |
95 | 84 | | |
96 | 85 | | |
97 | 86 | | |
98 | 87 | | |
99 | 88 | | |
| 89 | + | |
100 | 90 | | |
101 | 91 | | |
102 | | - | |
103 | | - | |
104 | 92 | | |
105 | 93 | | |
106 | 94 | | |
107 | 95 | | |
108 | 96 | | |
| 97 | + | |
109 | 98 | | |
110 | 99 | | |
111 | 100 | | |
112 | | - | |
113 | | - | |
114 | 101 | | |
115 | 102 | | |
116 | 103 | | |
117 | 104 | | |
118 | 105 | | |
119 | | - | |
120 | 106 | | |
121 | | - | |
| 107 | + | |
122 | 108 | | |
123 | 109 | | |
124 | 110 | | |
125 | 111 | | |
126 | 112 | | |
127 | | - | |
128 | 113 | | |
129 | | - | |
| 114 | + | |
130 | 115 | | |
131 | 116 | | |
132 | 117 | | |
133 | 118 | | |
134 | 119 | | |
135 | | - | |
136 | 120 | | |
137 | | - | |
| 121 | + | |
138 | 122 | | |
139 | 123 | | |
140 | 124 | | |
141 | 125 | | |
142 | 126 | | |
| 127 | + | |
143 | 128 | | |
144 | 129 | | |
145 | | - | |
146 | | - | |
147 | 130 | | |
148 | 131 | | |
149 | 132 | | |
| |||
152 | 135 | | |
153 | 136 | | |
154 | 137 | | |
155 | | - | |
156 | 138 | | |
157 | | - | |
| 139 | + | |
158 | 140 | | |
159 | 141 | | |
160 | 142 | | |
161 | 143 | | |
162 | 144 | | |
163 | 145 | | |
164 | 146 | | |
| 147 | + | |
165 | 148 | | |
166 | 149 | | |
167 | | - | |
168 | | - | |
169 | 150 | | |
170 | 151 | | |
171 | 152 | | |
172 | 153 | | |
173 | 154 | | |
| 155 | + | |
174 | 156 | | |
175 | 157 | | |
176 | 158 | | |
177 | 159 | | |
178 | | - | |
179 | | - | |
180 | 160 | | |
181 | 161 | | |
182 | 162 | | |
| |||
187 | 167 | | |
188 | 168 | | |
189 | 169 | | |
190 | | - | |
191 | 170 | | |
192 | | - | |
| 171 | + | |
193 | 172 | | |
194 | 173 | | |
195 | 174 | | |
196 | 175 | | |
197 | 176 | | |
198 | 177 | | |
199 | 178 | | |
200 | | - | |
201 | 179 | | |
202 | | - | |
| 180 | + | |
203 | 181 | | |
204 | 182 | | |
205 | 183 | | |
206 | 184 | | |
207 | 185 | | |
| 186 | + | |
208 | 187 | | |
209 | 188 | | |
210 | | - | |
211 | | - | |
212 | 189 | | |
213 | 190 | | |
214 | 191 | | |
| |||
217 | 194 | | |
218 | 195 | | |
219 | 196 | | |
220 | | - | |
221 | 197 | | |
222 | | - | |
| 198 | + | |
223 | 199 | | |
224 | 200 | | |
225 | 201 | | |
226 | 202 | | |
227 | 203 | | |
228 | | - | |
229 | 204 | | |
230 | | - | |
| 205 | + | |
231 | 206 | | |
232 | 207 | | |
233 | 208 | | |
234 | 209 | | |
235 | 210 | | |
236 | | - | |
237 | 211 | | |
238 | | - | |
| 212 | + | |
239 | 213 | | |
240 | 214 | | |
241 | 215 | | |
242 | 216 | | |
243 | 217 | | |
244 | | - | |
245 | 218 | | |
246 | | - | |
| 219 | + | |
247 | 220 | | |
248 | 221 | | |
249 | 222 | | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
0 commit comments