@doswiftly/storefront-sdk 22.2.0 → 22.4.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/CHANGELOG.md +20 -0
- package/README.md +4 -4
- package/dist/core/client/create-client.d.ts.map +1 -1
- package/dist/core/client/create-client.js +9 -0
- package/dist/core/client/execute.d.ts.map +1 -1
- package/dist/core/client/execute.js +102 -23
- package/dist/core/client/types.d.ts +6 -0
- package/dist/core/client/types.d.ts.map +1 -1
- package/dist/core/generated/operation-types.d.ts +54 -0
- package/dist/core/generated/operation-types.d.ts.map +1 -1
- package/dist/core/generated/operation-types.js +9 -0
- package/dist/core/operations/cart.d.ts.map +1 -1
- package/dist/core/operations/cart.js +10 -0
- package/dist/react/components/PriceDisplay.d.ts +12 -3
- package/dist/react/components/PriceDisplay.d.ts.map +1 -1
- package/dist/react/components/PriceDisplay.js +8 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 22.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 848a3fe: Expose payment consents on `PaymentMethod`. The fragment now selects `acknowledgements` — consent statements a buyer can affirm before paying, each with linked documents — so storefronts can render the consent checkboxes and echo accepted codes back in `PaymentCreateInput.acknowledgements`.
|
|
8
|
+
- ecf919f: `<PriceDisplay>` now accepts an optional `locale` prop, forwarded to both the current price and the strikethrough compare-at price. Pass it (e.g. `locale="pl-PL"`) for deterministic, environment-independent formatting — bringing `<PriceDisplay>` in line with the `locale` prop already on `<Money>`. When omitted, behaviour is unchanged (the runtime default locale is used).
|
|
9
|
+
- be11ed6: Add a cacheable `GET` transport for public reads. When a document carries a persisted-document id (`TypedDocumentString.__meta__.hash`), a public cacheable query is sent as a `GET` with only the id — so a shared CDN can cache it — with the shop, currency and language in the URL and no credentials attached; an unrecognised id transparently replays as a `POST`. Mutations and any request without a document id keep the existing `POST` behaviour, so current behaviour is unchanged until document ids are present.
|
|
10
|
+
|
|
11
|
+
## 22.3.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 21b0c44: Storefront payments: surface buyer acknowledgements (such as the Przelewy24 regulation consent) on payment methods, and accept them when starting a payment.
|
|
16
|
+
|
|
17
|
+
`PaymentMethod` now exposes an `acknowledgements` list — consents the buyer can affirm before paying. Each one carries a localized `statement` (with `<token>…</token>` tags marking the words that link to its `documents`), the linked document URLs, and an `enforcement` flag (optional vs required). Render each as a checkbox (never pre-checked) and link the tagged words to the matching `documents[].url`, then send the accepted ones back through the new optional `PaymentCreateInput.acknowledgements` field (`{ code, accepted }`).
|
|
18
|
+
|
|
19
|
+
For Przelewy24 this lets a storefront collect the regulation consent in-store (showing the required statement and links) so the buyer skips the gateway's consent page and goes straight to the bank / BLIK / card form. When you omit it, the gateway shows the consent itself, so it is fully optional.
|
|
20
|
+
|
|
21
|
+
Additive and backwards-compatible — existing operations are unaffected.
|
|
22
|
+
|
|
3
23
|
## 22.2.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -718,11 +718,11 @@ your CSS approach. Available from `@doswiftly/storefront-sdk/react`:
|
|
|
718
718
|
|
|
719
719
|
| Component | Purpose |
|
|
720
720
|
|-----------|---------|
|
|
721
|
-
| `<Money amount currency
|
|
721
|
+
| `<Money amount currency locale?>` | Locale-formatted price string from minor units |
|
|
722
722
|
| `<Image data sizes priority>` | `<img>` with thumbhash blur placeholder + sane defaults |
|
|
723
723
|
| `<CartCount count label>` | Aria-live cart item count |
|
|
724
724
|
| `<AddToCartButton variantId quantity>` | Button wired to `useCartManager().addItem` (loading state + a11y error surfacing) |
|
|
725
|
-
| `<PriceDisplay price compareAtPrice currency
|
|
725
|
+
| `<PriceDisplay price compareAtPrice currency locale?>` | Price + optional strikethrough sale price |
|
|
726
726
|
| `<CartTotals subtotal tax shipping discount total currency>` | Cart financial breakdown `<dl>` |
|
|
727
727
|
| `<PaymentInstrumentTile instrument>` | One selectable payment instrument (card brand, wallet, bank) |
|
|
728
728
|
| `<PaymentInstrumentSection method>` | Instrument group for a payment method (renders tiles) |
|
|
@@ -730,8 +730,8 @@ your CSS approach. Available from `@doswiftly/storefront-sdk/react`:
|
|
|
730
730
|
```tsx
|
|
731
731
|
import { Money, PriceDisplay, CartCount } from '@doswiftly/storefront-sdk/react';
|
|
732
732
|
|
|
733
|
-
<Money amount={9990} currency="PLN" /> {/* "99,90 zł" */}
|
|
734
|
-
<PriceDisplay price={7990} compareAtPrice={9990} currency="PLN" />
|
|
733
|
+
<Money amount={9990} currency="PLN" locale="pl-PL" /> {/* "99,90 zł" */}
|
|
734
|
+
<PriceDisplay price={7990} compareAtPrice={9990} currency="PLN" locale="pl-PL" />
|
|
735
735
|
<CartCount count={3} label="items" />
|
|
736
736
|
```
|
|
737
737
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-client.d.ts","sourceRoot":"","sources":["../../../src/core/client/create-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EAKjB,MAAM,SAAS,CAAC;AAQjB,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,sBAAsB,GAAG,gBAAgB,
|
|
1
|
+
{"version":3,"file":"create-client.d.ts","sourceRoot":"","sources":["../../../src/core/client/create-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EAKjB,MAAM,SAAS,CAAC;AAQjB,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,sBAAsB,GAAG,gBAAgB,CA0HvF"}
|
|
@@ -52,11 +52,19 @@ export function createStorefrontClient(config) {
|
|
|
52
52
|
function resolveQuery(document) {
|
|
53
53
|
return typeof document === 'string' ? document : document.toString();
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Persisted-document id carried by codegen on `TypedDocumentString.__meta__.hash`.
|
|
57
|
+
* Plain strings (and documents without a populated hash) have none → POST transport.
|
|
58
|
+
*/
|
|
59
|
+
function resolveDocumentId(document) {
|
|
60
|
+
return typeof document === 'string' ? undefined : document.__meta__?.hash;
|
|
61
|
+
}
|
|
55
62
|
/**
|
|
56
63
|
* Core request execution — shared by query() and mutate().
|
|
57
64
|
*/
|
|
58
65
|
async function request(document, variables, isMutation = false, cache) {
|
|
59
66
|
const query = resolveQuery(document);
|
|
67
|
+
const documentId = resolveDocumentId(document);
|
|
60
68
|
const operationName = getOperationName(query);
|
|
61
69
|
const pipeline = getPipeline();
|
|
62
70
|
const headers = {
|
|
@@ -73,6 +81,7 @@ export function createStorefrontClient(config) {
|
|
|
73
81
|
headers,
|
|
74
82
|
isMutation,
|
|
75
83
|
cache,
|
|
84
|
+
documentId,
|
|
76
85
|
};
|
|
77
86
|
// Dedupe queries (not mutations) in the same tick
|
|
78
87
|
const executeFn = () => pipeline(graphqlRequest);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/core/client/execute.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EAEZ,cAAc,EACd,eAAe,EAChB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/core/client/execute.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EAEZ,cAAc,EACd,eAAe,EAChB,MAAM,SAAS,CAAC;AAIjB,MAAM,WAAW,aAAa;IAC5B,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,KAAK,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAC/B;;;;OAIG;IACH,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,GAAG,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;CAClC;AAsCD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,GACpD,oBAAoB,GAAG,IAAI,CAiB7B;AA4KD;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,IAGnB,SAAS,cAAc,KAAG,OAAO,CAAC,eAAe,CAAC,CAwEjF"}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Sends GraphQL POST request, parses response, returns typed GraphQLResponse.
|
|
5
5
|
* Error normalization is handled by error middleware, NOT here.
|
|
6
6
|
*/
|
|
7
|
+
import { CURRENCY_HEADER_NAME } from '../currency/cookie-config';
|
|
8
|
+
import { LANGUAGE_HEADER_NAME } from '../language/cookie-config';
|
|
7
9
|
const DEFAULT_LOG = (event) => {
|
|
8
10
|
// Header on a separate line so the data dump below renders untruncated in
|
|
9
11
|
// both terminals and DevTools.
|
|
@@ -151,45 +153,122 @@ function extractUserErrors(data) {
|
|
|
151
153
|
}
|
|
152
154
|
return flat;
|
|
153
155
|
}
|
|
156
|
+
/** Backend signal that a `documentId` is not in the allowlist → replay as POST. */
|
|
157
|
+
const TRUSTED_DOC_NOT_FOUND = 'TRUSTED_DOCUMENT_NOT_FOUND';
|
|
158
|
+
/** Shop-routing header the client always sends; lifted into the GET cache key below. */
|
|
159
|
+
const SHOP_SLUG_HEADER = 'X-Shop-Slug';
|
|
160
|
+
/**
|
|
161
|
+
* Variance axes mirrored from request headers into the GET query string. A shared
|
|
162
|
+
* edge cache keys on the URL, not on request headers — without these in the URL two
|
|
163
|
+
* shops / currencies / languages would collide on one cache entry. The backend still
|
|
164
|
+
* reads the values from the headers; the URL copy exists only to split the cache key.
|
|
165
|
+
*/
|
|
166
|
+
const AXIS_URL_PARAMS = [
|
|
167
|
+
[SHOP_SLUG_HEADER, '__shop'],
|
|
168
|
+
[CURRENCY_HEADER_NAME, '__currency'],
|
|
169
|
+
[LANGUAGE_HEADER_NAME, '__language'],
|
|
170
|
+
];
|
|
171
|
+
/**
|
|
172
|
+
* Default POST transport — the full query travels in the body and cookies are sent.
|
|
173
|
+
* Every request that is not a cacheable public read uses this (unchanged contract).
|
|
174
|
+
*/
|
|
175
|
+
function buildPostRequest(endpoint, request) {
|
|
176
|
+
const body = { query: request.query };
|
|
177
|
+
if (request.variables && Object.keys(request.variables).length > 0) {
|
|
178
|
+
body.variables = request.variables;
|
|
179
|
+
}
|
|
180
|
+
if (request.operationName) {
|
|
181
|
+
body.operationName = request.operationName;
|
|
182
|
+
}
|
|
183
|
+
return [
|
|
184
|
+
endpoint,
|
|
185
|
+
{
|
|
186
|
+
method: 'POST',
|
|
187
|
+
headers: {
|
|
188
|
+
'Content-Type': 'application/json',
|
|
189
|
+
Accept: 'application/json',
|
|
190
|
+
...request.headers,
|
|
191
|
+
},
|
|
192
|
+
body: JSON.stringify(body),
|
|
193
|
+
signal: request.signal,
|
|
194
|
+
// Include httpOnly cookies (e.g. customerAccessToken auth) on cross-origin
|
|
195
|
+
// requests. Required when the storefront runs on a domain different from the
|
|
196
|
+
// backend GraphQL endpoint — same-origin browsers send cookies regardless,
|
|
197
|
+
// but cross-origin needs `credentials: 'include'` paired with the backend's
|
|
198
|
+
// `Access-Control-Allow-Credentials: true` (already configured).
|
|
199
|
+
credentials: 'include',
|
|
200
|
+
},
|
|
201
|
+
];
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Cacheable GET transport for public reads with a known `documentId`. Only the id
|
|
205
|
+
* travels (the backend resolves it to the full query from its allowlist), the variance
|
|
206
|
+
* axes ride in the URL so a shared edge cache keys correctly, and no credentials are
|
|
207
|
+
* sent so the response stays shareable across visitors.
|
|
208
|
+
*/
|
|
209
|
+
function buildTrustedGetRequest(endpoint, request) {
|
|
210
|
+
const url = new URL(endpoint);
|
|
211
|
+
url.searchParams.set('documentId', request.documentId);
|
|
212
|
+
if (request.operationName && request.operationName !== 'anonymous') {
|
|
213
|
+
url.searchParams.set('operationName', request.operationName);
|
|
214
|
+
}
|
|
215
|
+
if (request.variables && Object.keys(request.variables).length > 0) {
|
|
216
|
+
url.searchParams.set('variables', JSON.stringify(request.variables));
|
|
217
|
+
}
|
|
218
|
+
for (const [headerName, param] of AXIS_URL_PARAMS) {
|
|
219
|
+
const value = request.headers[headerName];
|
|
220
|
+
if (value)
|
|
221
|
+
url.searchParams.set(param, value);
|
|
222
|
+
}
|
|
223
|
+
const headers = { ...request.headers };
|
|
224
|
+
// Public read = customer-agnostic → never carry the bearer token (`omit` also drops
|
|
225
|
+
// cookies), so the cached response can be served to any visitor.
|
|
226
|
+
delete headers.Authorization;
|
|
227
|
+
delete headers.authorization;
|
|
228
|
+
headers.Accept = 'application/json';
|
|
229
|
+
// Force a CORS preflight so the backend CSRF prevention admits the GET.
|
|
230
|
+
headers['apollo-require-preflight'] = 'true';
|
|
231
|
+
return [url.toString(), { method: 'GET', headers, signal: request.signal, credentials: 'omit' }];
|
|
232
|
+
}
|
|
154
233
|
/**
|
|
155
234
|
* Create the innermost execute function for the middleware pipeline.
|
|
156
235
|
*/
|
|
157
236
|
export function createExecute(config) {
|
|
158
237
|
const { endpoint, fetch: fetchFn, debug } = config;
|
|
159
238
|
return async function execute(request) {
|
|
160
|
-
const { query, variables, headers,
|
|
239
|
+
const { query, variables, headers, operationName, isMutation, cache, documentId } = request;
|
|
161
240
|
const startedAt = debug?.timing ? Date.now() : 0;
|
|
241
|
+
// Cacheable public reads with a resolvable persisted document go over GET so a
|
|
242
|
+
// shared edge cache can serve them; everything else stays POST.
|
|
243
|
+
const useTrustedGet = !isMutation && cache?.mode === 'public' && typeof documentId === 'string' && documentId.length > 0;
|
|
162
244
|
if (debug) {
|
|
163
|
-
const requestData = { variables };
|
|
245
|
+
const requestData = { variables, method: useTrustedGet ? 'GET' : 'POST' };
|
|
246
|
+
if (useTrustedGet)
|
|
247
|
+
requestData.documentId = documentId;
|
|
164
248
|
if (debug.request)
|
|
165
249
|
requestData.query = query;
|
|
166
250
|
if (debug.headers)
|
|
167
251
|
requestData.headers = redactRequestHeaders(headers);
|
|
168
252
|
debug.log({ phase: 'request', operationName, data: requestData });
|
|
169
253
|
}
|
|
170
|
-
|
|
171
|
-
if (
|
|
172
|
-
|
|
254
|
+
let response;
|
|
255
|
+
if (useTrustedGet) {
|
|
256
|
+
const [getUrl, getInit] = buildTrustedGetRequest(endpoint, request);
|
|
257
|
+
response = await fetchFn(getUrl, getInit);
|
|
258
|
+
// Unknown documentId (custom selection or manifest skew) → replay as POST with
|
|
259
|
+
// the full query. The backend never executes a document it cannot resolve.
|
|
260
|
+
if (response.status === 400) {
|
|
261
|
+
const fallback = (await response.clone().json().catch(() => null));
|
|
262
|
+
if (fallback?.error === TRUSTED_DOC_NOT_FOUND) {
|
|
263
|
+
const [postUrl, postInit] = buildPostRequest(endpoint, request);
|
|
264
|
+
response = await fetchFn(postUrl, postInit);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
173
267
|
}
|
|
174
|
-
|
|
175
|
-
|
|
268
|
+
else {
|
|
269
|
+
const [postUrl, postInit] = buildPostRequest(endpoint, request);
|
|
270
|
+
response = await fetchFn(postUrl, postInit);
|
|
176
271
|
}
|
|
177
|
-
const response = await fetchFn(endpoint, {
|
|
178
|
-
method: 'POST',
|
|
179
|
-
headers: {
|
|
180
|
-
'Content-Type': 'application/json',
|
|
181
|
-
Accept: 'application/json',
|
|
182
|
-
...headers,
|
|
183
|
-
},
|
|
184
|
-
body: JSON.stringify(body),
|
|
185
|
-
signal,
|
|
186
|
-
// Include httpOnly cookies (e.g. customerAccessToken auth) on cross-origin
|
|
187
|
-
// requests. Required when the storefront runs on a domain different from the
|
|
188
|
-
// backend GraphQL endpoint — same-origin browsers send cookies regardless,
|
|
189
|
-
// but cross-origin needs `credentials: 'include'` paired with the backend's
|
|
190
|
-
// `Access-Control-Allow-Credentials: true` (already configured).
|
|
191
|
-
credentials: 'include',
|
|
192
|
-
});
|
|
193
272
|
const json = await response.json();
|
|
194
273
|
if (debug) {
|
|
195
274
|
const responseData = {
|
|
@@ -35,6 +35,12 @@ export interface GraphQLRequest {
|
|
|
35
35
|
isMutation: boolean;
|
|
36
36
|
/** Cache strategy override */
|
|
37
37
|
cache?: CacheStrategy;
|
|
38
|
+
/**
|
|
39
|
+
* Persisted-document id (`sha256:<hex>`), carried by `TypedDocumentString.__meta__.hash`.
|
|
40
|
+
* When present on a cacheable public read, the transport sends only this id over GET
|
|
41
|
+
* (instead of the full query) so a shared edge cache can serve the response. Absent → POST.
|
|
42
|
+
*/
|
|
43
|
+
documentId?: string;
|
|
38
44
|
}
|
|
39
45
|
export interface GraphQLResponse<T = unknown> {
|
|
40
46
|
/** Parsed response data */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/client/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;;;GAKG;AACH,qBAAa,mBAAmB,CAAC,OAAO,GAAG,OAAO,EAAE,UAAU,GAAG,OAAO,CAAE,SAAQ,MAAM;IAIpD,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;IAH7D,+CAA+C;IAC/C,SAAS,CAAC,EAAE,CAAC,SAAS,EAAE,UAAU,KAAK,OAAO,CAAC;gBAEnC,KAAK,EAAE,MAAM,EAAS,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,YAAA;IAIpD,QAAQ,IAAI,MAAM;CAG5B;AAMD,MAAM,WAAW,cAAc;IAC7B,u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;IACrC,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,0BAA0B;IAC1B,UAAU,CAAC,EAAE,UAAU,EAAE,CAAC;IAC1B,+DAA+D;IAC/D,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,YAAY,CAAC;CAC5C;AAMD,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5C,QAAQ,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,EAC5C,SAAS,CAAC,EAAE,CAAC,EACb,KAAK,CAAC,EAAE,aAAa,GACpB,OAAO,CAAC,CAAC,CAAC,CAAC;IAEd;;;;OAIG;IACH,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7C,QAAQ,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,EAC5C,SAAS,CAAC,EAAE,CAAC,GACZ,OAAO,CAAC,CAAC,CAAC,CAAC;IAEd;;;;OAIG;IACH,GAAG,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;CACnC"}
|
|
@@ -2569,7 +2569,44 @@ export type PageInfo = {
|
|
|
2569
2569
|
/** Cursor of the first item on the current page — opaque, base64-encoded. Echo as the `before` argument to paginate backwards. */
|
|
2570
2570
|
startCursor?: Maybe<Scalars['String']['output']>;
|
|
2571
2571
|
};
|
|
2572
|
+
export type PaymentAcknowledgement = {
|
|
2573
|
+
/** Stable machine code identifying the acknowledgement (e.g. "PRZELEWY24_REGULATION"). Echo it back in `PaymentAcknowledgementInput.code` when the buyer accepts. */
|
|
2574
|
+
code: Scalars['String']['output'];
|
|
2575
|
+
/** Documents linked from `statement`, bound by `token`. Empty when the statement carries no links. */
|
|
2576
|
+
documents: Array<PaymentAcknowledgementDocument>;
|
|
2577
|
+
/** Whether collecting this in the storefront is optional (GATEWAY_FALLBACK) or mandatory (STOREFRONT_REQUIRED). */
|
|
2578
|
+
enforcement: PaymentAcknowledgementEnforcement;
|
|
2579
|
+
/** Localized statement to show next to the checkbox. Contains `<token>…</token>` tags marking the words that link to `documents` (e.g. "… <terms>regulaminem</terms> …"). Render the tagged words as anchors; never inject as raw HTML. */
|
|
2580
|
+
statement: Scalars['String']['output'];
|
|
2581
|
+
};
|
|
2582
|
+
export type PaymentAcknowledgementDocument = {
|
|
2583
|
+
/** Semantic category of the document (TERMS, INFORMATION_OBLIGATION, PRIVACY_POLICY). */
|
|
2584
|
+
kind: PaymentAcknowledgementDocumentKind;
|
|
2585
|
+
/** Binding token — equals the tag name wrapping the linked words inside `PaymentAcknowledgement.statement` (e.g. `terms` ↔ `<terms>…</terms>`). */
|
|
2586
|
+
token: Scalars['String']['output'];
|
|
2587
|
+
/** Absolute URL of the document to link to. */
|
|
2588
|
+
url: Scalars['URL']['output'];
|
|
2589
|
+
};
|
|
2590
|
+
export declare const PaymentAcknowledgementDocumentKind: {
|
|
2591
|
+
readonly InformationObligation: "INFORMATION_OBLIGATION";
|
|
2592
|
+
readonly PrivacyPolicy: "PRIVACY_POLICY";
|
|
2593
|
+
readonly Terms: "TERMS";
|
|
2594
|
+
};
|
|
2595
|
+
export type PaymentAcknowledgementDocumentKind = typeof PaymentAcknowledgementDocumentKind[keyof typeof PaymentAcknowledgementDocumentKind];
|
|
2596
|
+
export declare const PaymentAcknowledgementEnforcement: {
|
|
2597
|
+
readonly GatewayFallback: "GATEWAY_FALLBACK";
|
|
2598
|
+
readonly StorefrontRequired: "STOREFRONT_REQUIRED";
|
|
2599
|
+
};
|
|
2600
|
+
export type PaymentAcknowledgementEnforcement = typeof PaymentAcknowledgementEnforcement[keyof typeof PaymentAcknowledgementEnforcement];
|
|
2601
|
+
export type PaymentAcknowledgementInput = {
|
|
2602
|
+
/** True when the buyer checked the acknowledgement. */
|
|
2603
|
+
accepted: Scalars['Boolean']['input'];
|
|
2604
|
+
/** Code of the acknowledgement the buyer affirmed (e.g. "PRZELEWY24_REGULATION"). */
|
|
2605
|
+
code: Scalars['String']['input'];
|
|
2606
|
+
};
|
|
2572
2607
|
export type PaymentCreateInput = {
|
|
2608
|
+
/** Payment acknowledgements the buyer affirmed (e.g. accepting the Przelewy24 regulation). Send only the ones the buyer checked. Optional — when omitted, gateways that present their own consent step collect it; a method with a STOREFRONT_REQUIRED acknowledgement returns `ACKNOWLEDGEMENT_REQUIRED` if not accepted. */
|
|
2609
|
+
acknowledgements?: InputMaybe<Array<PaymentAcknowledgementInput>>;
|
|
2573
2610
|
/** URL the gateway returns the buyer to after they cancel the payment. Must point to a verified domain of the shop. */
|
|
2574
2611
|
cancelUrl?: InputMaybe<Scalars['URL']['input']>;
|
|
2575
2612
|
/** ID of the order to pay for — `cartComplete.order.id`. */
|
|
@@ -2624,6 +2661,8 @@ export declare const PaymentInstrumentType: {
|
|
|
2624
2661
|
};
|
|
2625
2662
|
export type PaymentInstrumentType = typeof PaymentInstrumentType[keyof typeof PaymentInstrumentType];
|
|
2626
2663
|
export type PaymentMethod = {
|
|
2664
|
+
/** Consents the buyer can affirm before paying with this method (e.g. the Przelewy24 regulation declaration). Render each as a checkbox using `statement` + `documents`, then echo accepted `code`s back in `PaymentCreateInput.acknowledgements`. Empty when the method carries no acknowledgements. */
|
|
2665
|
+
acknowledgements: Array<PaymentAcknowledgement>;
|
|
2627
2666
|
/** True when the buyer can actually pick this method right now. False when the resolving gateway is temporarily unavailable (incident/maintenance) or reported the method as disabled. Storefront UI should gray-out the tile when false instead of hiding it — gives merchants observability into routing failures. */
|
|
2628
2667
|
available: Scalars['Boolean']['output'];
|
|
2629
2668
|
/** Optional buyer-facing description shown under the name (e.g. "Pay with your bank app"). */
|
|
@@ -3901,12 +3940,18 @@ export type AvailablePaymentMethodsQuery = {
|
|
|
3901
3940
|
instruments?: Maybe<Array<(Pick<PaymentInstrument, 'provider' | 'code' | 'type' | 'displayName' | 'displayHint' | 'enabled'> & {
|
|
3902
3941
|
brandImage?: Maybe<Pick<Image, 'id' | 'url' | 'altText' | 'width' | 'height' | 'thumbhash'>>;
|
|
3903
3942
|
})>>;
|
|
3943
|
+
acknowledgements: Array<(Pick<PaymentAcknowledgement, 'code' | 'enforcement' | 'statement'> & {
|
|
3944
|
+
documents: Array<Pick<PaymentAcknowledgementDocument, 'token' | 'kind' | 'url'>>;
|
|
3945
|
+
})>;
|
|
3904
3946
|
})>;
|
|
3905
3947
|
defaultMethod?: Maybe<(Pick<PaymentMethod, 'id' | 'name' | 'provider' | 'type' | 'description' | 'isDefault' | 'supportedCurrencies' | 'position' | 'providersAvailable' | 'preferredProvider' | 'available' | 'unavailableReason'> & {
|
|
3906
3948
|
icon?: Maybe<Pick<Image, 'id' | 'url' | 'altText' | 'width' | 'height' | 'thumbhash'>>;
|
|
3907
3949
|
instruments?: Maybe<Array<(Pick<PaymentInstrument, 'provider' | 'code' | 'type' | 'displayName' | 'displayHint' | 'enabled'> & {
|
|
3908
3950
|
brandImage?: Maybe<Pick<Image, 'id' | 'url' | 'altText' | 'width' | 'height' | 'thumbhash'>>;
|
|
3909
3951
|
})>>;
|
|
3952
|
+
acknowledgements: Array<(Pick<PaymentAcknowledgement, 'code' | 'enforcement' | 'statement'> & {
|
|
3953
|
+
documents: Array<Pick<PaymentAcknowledgementDocument, 'token' | 'kind' | 'url'>>;
|
|
3954
|
+
})>;
|
|
3910
3955
|
})>;
|
|
3911
3956
|
};
|
|
3912
3957
|
};
|
|
@@ -5354,12 +5399,18 @@ export type AvailablePaymentMethodsFragment = {
|
|
|
5354
5399
|
instruments?: Maybe<Array<(Pick<PaymentInstrument, 'provider' | 'code' | 'type' | 'displayName' | 'displayHint' | 'enabled'> & {
|
|
5355
5400
|
brandImage?: Maybe<Pick<Image, 'id' | 'url' | 'altText' | 'width' | 'height' | 'thumbhash'>>;
|
|
5356
5401
|
})>>;
|
|
5402
|
+
acknowledgements: Array<(Pick<PaymentAcknowledgement, 'code' | 'enforcement' | 'statement'> & {
|
|
5403
|
+
documents: Array<Pick<PaymentAcknowledgementDocument, 'token' | 'kind' | 'url'>>;
|
|
5404
|
+
})>;
|
|
5357
5405
|
})>;
|
|
5358
5406
|
defaultMethod?: Maybe<(Pick<PaymentMethod, 'id' | 'name' | 'provider' | 'type' | 'description' | 'isDefault' | 'supportedCurrencies' | 'position' | 'providersAvailable' | 'preferredProvider' | 'available' | 'unavailableReason'> & {
|
|
5359
5407
|
icon?: Maybe<Pick<Image, 'id' | 'url' | 'altText' | 'width' | 'height' | 'thumbhash'>>;
|
|
5360
5408
|
instruments?: Maybe<Array<(Pick<PaymentInstrument, 'provider' | 'code' | 'type' | 'displayName' | 'displayHint' | 'enabled'> & {
|
|
5361
5409
|
brandImage?: Maybe<Pick<Image, 'id' | 'url' | 'altText' | 'width' | 'height' | 'thumbhash'>>;
|
|
5362
5410
|
})>>;
|
|
5411
|
+
acknowledgements: Array<(Pick<PaymentAcknowledgement, 'code' | 'enforcement' | 'statement'> & {
|
|
5412
|
+
documents: Array<Pick<PaymentAcknowledgementDocument, 'token' | 'kind' | 'url'>>;
|
|
5413
|
+
})>;
|
|
5363
5414
|
})>;
|
|
5364
5415
|
};
|
|
5365
5416
|
export type PaymentMethodFragment = (Pick<PaymentMethod, 'id' | 'name' | 'provider' | 'type' | 'description' | 'isDefault' | 'supportedCurrencies' | 'position' | 'providersAvailable' | 'preferredProvider' | 'available' | 'unavailableReason'> & {
|
|
@@ -5367,6 +5418,9 @@ export type PaymentMethodFragment = (Pick<PaymentMethod, 'id' | 'name' | 'provid
|
|
|
5367
5418
|
instruments?: Maybe<Array<(Pick<PaymentInstrument, 'provider' | 'code' | 'type' | 'displayName' | 'displayHint' | 'enabled'> & {
|
|
5368
5419
|
brandImage?: Maybe<Pick<Image, 'id' | 'url' | 'altText' | 'width' | 'height' | 'thumbhash'>>;
|
|
5369
5420
|
})>>;
|
|
5421
|
+
acknowledgements: Array<(Pick<PaymentAcknowledgement, 'code' | 'enforcement' | 'statement'> & {
|
|
5422
|
+
documents: Array<Pick<PaymentAcknowledgementDocument, 'token' | 'kind' | 'url'>>;
|
|
5423
|
+
})>;
|
|
5370
5424
|
});
|
|
5371
5425
|
export type PaymentInstrumentFragment = (Pick<PaymentInstrument, 'provider' | 'code' | 'type' | 'displayName' | 'displayHint' | 'enabled'> & {
|
|
5372
5426
|
brandImage?: Maybe<Pick<Image, 'id' | 'url' | 'altText' | 'width' | 'height' | 'thumbhash'>>;
|