@doswiftly/storefront-operations 22.1.0 → 22.3.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/AGENTS.md CHANGED
@@ -27,7 +27,7 @@ consumer's `codegen.ts` references this package's `.graphql` files as
27
27
  live in the consumer's repo.
28
28
 
29
29
  <!-- AUTOGEN:STATS:BEGIN — auto-regenerated, do not edit by hand -->
30
- - **Schema version**: 22.1.0
30
+ - **Schema version**: 22.3.0
31
31
  - **Queries**: 52
32
32
  - **Mutations**: 44
33
33
  - **Fragments**: 105
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # Changelog
2
2
 
3
+ ## 22.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 21b0c44: Storefront payments: surface buyer acknowledgements (such as the Przelewy24 regulation consent) on payment methods, and accept them when starting a payment.
8
+
9
+ `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 }`).
10
+
11
+ 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.
12
+
13
+ Additive and backwards-compatible — existing operations are unaffected.
14
+
15
+ ## 22.2.0
16
+
17
+ ### Minor Changes
18
+
19
+ - 27934d1: Server `getStorefrontClient`: forwarded-IP signing is now **opt-in** via `getBuyerIp`.
20
+
21
+ Previously the server client auto-read the buyer IP through `next/headers` on every
22
+ request. That is a dynamic API and is illegal in statically-generated / ISR routes —
23
+ it crashed such pages with "Page changed from static to dynamic at runtime".
24
+
25
+ Forwarded-IP is now wired only when you pass `getBuyerIp`, which you should do **only
26
+ on routes that are already dynamic** (per-request rendered). Without it the client is
27
+ a fully static-safe, inert pass-through.
28
+
29
+ Migration — to keep forwarding the buyer IP, pass `getBuyerIp` on your dynamic routes:
30
+
31
+ ```typescript
32
+ import { headers } from "next/headers";
33
+
34
+ getStorefrontClient({
35
+ apiUrl,
36
+ shopSlug,
37
+ getBuyerIp: async () => (await headers()).get("cf-connecting-ip"),
38
+ });
39
+ ```
40
+
3
41
  ## 22.1.0
4
42
 
5
43
  ### Minor Changes
package/fragments.graphql CHANGED
@@ -752,6 +752,20 @@ fragment PaymentMethod on PaymentMethod {
752
752
  instruments {
753
753
  ...PaymentInstrument
754
754
  }
755
+ # Consents the buyer can affirm before paying (e.g. the Przelewy24 regulation). Render each
756
+ # `statement` as a checkbox label (the checkbox MUST NOT be pre-checked) with the `<token>…</token>`
757
+ # tagged words linked to the matching `documents[].url`; echo accepted `code`s back in
758
+ # `PaymentCreateInput.acknowledgements`. Empty when the method carries no acknowledgements.
759
+ acknowledgements {
760
+ code
761
+ enforcement
762
+ statement
763
+ documents {
764
+ token
765
+ kind
766
+ url
767
+ }
768
+ }
755
769
  }
756
770
 
757
771
  # Active payment methods list with the merchant's `defaultMethod`. Returned by the `availablePaymentMethods` query.
package/llms-full.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # DoSwiftly Storefront Operations — Full Reference
2
2
 
3
- > Schema version: **22.1.0**
3
+ > Schema version: **22.3.0**
4
4
  > 52 queries · 44 mutations · 105 fragments
5
5
 
6
6
  Auto-generated from `.graphql` source files. Do not edit by hand — this file is
@@ -3655,6 +3655,16 @@ fragment PaymentMethod on PaymentMethod {
3655
3655
  instruments {
3656
3656
  ...PaymentInstrument
3657
3657
  }
3658
+ acknowledgements {
3659
+ code
3660
+ enforcement
3661
+ statement
3662
+ documents {
3663
+ token
3664
+ kind
3665
+ url
3666
+ }
3667
+ }
3658
3668
  }
3659
3669
  ```
3660
3670
 
package/operations.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "schemaVersion": "22.1.0",
2
+ "schemaVersion": "22.3.0",
3
3
  "queries": [
4
4
  {
5
5
  "name": "Shop",
@@ -2431,7 +2431,7 @@
2431
2431
  "ImageThumbnail",
2432
2432
  "PaymentInstrument"
2433
2433
  ],
2434
- "body": "fragment PaymentMethod on PaymentMethod {\n id\n name\n provider\n type\n icon {\n ...ImageThumbnail\n }\n description\n isDefault\n supportedCurrencies\n position\n providersAvailable\n preferredProvider\n available\n unavailableReason\n instruments {\n ...PaymentInstrument\n }\n}",
2434
+ "body": "fragment PaymentMethod on PaymentMethod {\n id\n name\n provider\n type\n icon {\n ...ImageThumbnail\n }\n description\n isDefault\n supportedCurrencies\n position\n providersAvailable\n preferredProvider\n available\n unavailableReason\n instruments {\n ...PaymentInstrument\n }\n acknowledgements {\n code\n enforcement\n statement\n documents {\n token\n kind\n url\n }\n }\n}",
2435
2435
  "onType": "PaymentMethod"
2436
2436
  },
2437
2437
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doswiftly/storefront-operations",
3
- "version": "22.1.0",
3
+ "version": "22.3.0",
4
4
  "description": "GraphQL operations for DoSwiftly Storefront - SSOT from backend",
5
5
  "homepage": "https://doswiftly.pl",
6
6
  "publishConfig": {
package/schema.graphql CHANGED
@@ -4928,10 +4928,88 @@ enum PageSortKeys {
4928
4928
  UPDATED_AT
4929
4929
  }
4930
4930
 
4931
+ """
4932
+ A consent the buyer can affirm before paying with this method (e.g. the Przelewy24 regulation declaration). Render `statement` as a checkbox label — the checkbox MUST NOT be pre-checked — with the `<token>…</token>` tagged words linked to the matching `documents[].url`. On submit, echo the accepted `code`s back via `PaymentCreateInput.acknowledgements`. When `enforcement` is GATEWAY_FALLBACK collecting it is optional (the gateway shows it otherwise); STOREFRONT_REQUIRED must be accepted or `paymentCreate` returns ACKNOWLEDGEMENT_REQUIRED.
4933
+ """
4934
+ type PaymentAcknowledgement {
4935
+ """
4936
+ Stable machine code identifying the acknowledgement (e.g. "PRZELEWY24_REGULATION"). Echo it back in `PaymentAcknowledgementInput.code` when the buyer accepts.
4937
+ """
4938
+ code: String!
4939
+
4940
+ """
4941
+ Documents linked from `statement`, bound by `token`. Empty when the statement carries no links.
4942
+ """
4943
+ documents: [PaymentAcknowledgementDocument!]!
4944
+
4945
+ """
4946
+ Whether collecting this in the storefront is optional (GATEWAY_FALLBACK) or mandatory (STOREFRONT_REQUIRED).
4947
+ """
4948
+ enforcement: PaymentAcknowledgementEnforcement!
4949
+
4950
+ """
4951
+ 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.
4952
+ """
4953
+ statement: String!
4954
+ }
4955
+
4956
+ """
4957
+ A document linked from a payment acknowledgement statement. Its `token` matches a `<token>…</token>` tag inside `PaymentAcknowledgement.statement` — wrap the tagged words in an anchor to `url` (open in a new tab). Never inject the statement as raw HTML.
4958
+ """
4959
+ type PaymentAcknowledgementDocument {
4960
+ """
4961
+ Semantic category of the document (TERMS, INFORMATION_OBLIGATION, PRIVACY_POLICY).
4962
+ """
4963
+ kind: PaymentAcknowledgementDocumentKind!
4964
+
4965
+ """
4966
+ Binding token — equals the tag name wrapping the linked words inside `PaymentAcknowledgement.statement` (e.g. `terms` ↔ `<terms>…</terms>`).
4967
+ """
4968
+ token: String!
4969
+
4970
+ """Absolute URL of the document to link to."""
4971
+ url: URL!
4972
+ }
4973
+
4974
+ """
4975
+ Category of a document linked from an acknowledgement statement (TERMS, INFORMATION_OBLIGATION, PRIVACY_POLICY). Use for optional iconography; the `token` is what binds the link into the statement text.
4976
+ """
4977
+ enum PaymentAcknowledgementDocumentKind {
4978
+ INFORMATION_OBLIGATION
4979
+ PRIVACY_POLICY
4980
+ TERMS
4981
+ }
4982
+
4983
+ """
4984
+ Whether collecting a payment acknowledgement in the storefront is optional (GATEWAY_FALLBACK — the gateway shows it itself when you omit it) or mandatory (STOREFRONT_REQUIRED — `paymentCreate` rejects with ACKNOWLEDGEMENT_REQUIRED unless the buyer accepted it).
4985
+ """
4986
+ enum PaymentAcknowledgementEnforcement {
4987
+ GATEWAY_FALLBACK
4988
+ STOREFRONT_REQUIRED
4989
+ }
4990
+
4991
+ """
4992
+ A payment acknowledgement the buyer affirmed at pay time — `code` echoes a `PaymentAcknowledgement.code` from `availablePaymentMethods`.
4993
+ """
4994
+ input PaymentAcknowledgementInput {
4995
+ """True when the buyer checked the acknowledgement."""
4996
+ accepted: Boolean!
4997
+
4998
+ """
4999
+ Code of the acknowledgement the buyer affirmed (e.g. "PRZELEWY24_REGULATION").
5000
+ """
5001
+ code: String!
5002
+ }
5003
+
4931
5004
  """
4932
5005
  Input for `paymentCreate` — initiates a payment for an order created by `cartComplete`. Idempotent on the order: a second call returns the existing still-valid session.
4933
5006
  """
4934
5007
  input PaymentCreateInput {
5008
+ """
5009
+ 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.
5010
+ """
5011
+ acknowledgements: [PaymentAcknowledgementInput!]
5012
+
4935
5013
  """
4936
5014
  URL the gateway returns the buyer to after they cancel the payment. Must point to a verified domain of the shop.
4937
5015
  """
@@ -5039,6 +5117,11 @@ enum PaymentInstrumentType {
5039
5117
  A payment method offered to the buyer at checkout — what to render in the payment picker and pass to `cartSelectPaymentMethod`.
5040
5118
  """
5041
5119
  type PaymentMethod {
5120
+ """
5121
+ 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.
5122
+ """
5123
+ acknowledgements: [PaymentAcknowledgement!]!
5124
+
5042
5125
  """
5043
5126
  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.
5044
5127
  """