@reactionary/feeds 0.10.35 → 0.10.36

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.
Files changed (2) hide show
  1. package/cli.cjs +38 -5
  2. package/package.json +9 -9
package/cli.cjs CHANGED
@@ -112951,11 +112951,41 @@ var init_category_factory2 = __esm({
112951
112951
  }
112952
112952
  });
112953
112953
 
112954
+ // packages/commercetools/src/core/payment-protocol-data.ts
112955
+ function serializeProtocolData(entries) {
112956
+ return JSON.stringify(Object.fromEntries(entries.map((entry) => [entry.key, entry.value])));
112957
+ }
112958
+ function parseProtocolDataField(value) {
112959
+ if (typeof value !== "string" || value.length === 0) {
112960
+ return [];
112961
+ }
112962
+ try {
112963
+ const parsed = JSON.parse(value);
112964
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
112965
+ return [];
112966
+ }
112967
+ return Object.entries(parsed).map(([key, entry]) => ({
112968
+ key,
112969
+ value: typeof entry === "string" ? entry : JSON.stringify(entry)
112970
+ }));
112971
+ } catch {
112972
+ return [];
112973
+ }
112974
+ }
112975
+ var PROTOCOL_DATA_FIELD;
112976
+ var init_payment_protocol_data = __esm({
112977
+ "packages/commercetools/src/core/payment-protocol-data.ts"() {
112978
+ "use strict";
112979
+ PROTOCOL_DATA_FIELD = "reactionaryProtocolData";
112980
+ }
112981
+ });
112982
+
112954
112983
  // packages/commercetools/src/factories/checkout/checkout.factory.ts
112955
112984
  var CommercetoolsCheckoutFactory;
112956
112985
  var init_checkout_factory2 = __esm({
112957
112986
  "packages/commercetools/src/factories/checkout/checkout.factory.ts"() {
112958
112987
  "use strict";
112988
+ init_payment_protocol_data();
112959
112989
  init_src();
112960
112990
  init_locale_utils();
112961
112991
  CommercetoolsCheckoutFactory = class {
@@ -113136,10 +113166,9 @@ var init_checkout_factory2 = __esm({
113136
113166
  name: paymentName || method || "Unknown"
113137
113167
  };
113138
113168
  const customData = data.custom?.fields || {};
113139
- const protocolData = Object.keys(customData).map((key) => ({
113140
- key,
113141
- value: customData[key]
113142
- }));
113169
+ const protocolData = Object.keys(customData).flatMap(
113170
+ (key) => key === PROTOCOL_DATA_FIELD ? parseProtocolDataField(customData[key]) : [{ key, value: customData[key] }]
113171
+ );
113143
113172
  let status = "pending";
113144
113173
  if (data.transactions && data.transactions.length > 0) {
113145
113174
  const lastTransaction = data.transactions[data.transactions.length - 1];
@@ -114771,6 +114800,7 @@ var CheckoutNotReadyForFinalizationError, CommercetoolsCheckoutCapability;
114771
114800
  var init_checkout_capability2 = __esm({
114772
114801
  "packages/commercetools/src/capabilities/checkout.capability.ts"() {
114773
114802
  "use strict";
114803
+ init_payment_protocol_data();
114774
114804
  init_src();
114775
114805
  init_zod();
114776
114806
  init_locale_utils();
@@ -114949,7 +114979,10 @@ var init_checkout_capability2 = __esm({
114949
114979
  key: "reactionaryPaymentCustomFields"
114950
114980
  },
114951
114981
  fields: {
114952
- commerceToolsCartId: payload.checkout.key
114982
+ commerceToolsCartId: payload.checkout.key,
114983
+ // Protocol data (e.g. agentic delegated payment tokens) is passed
114984
+ // verbatim for the project's payment extensions to interpret.
114985
+ ...payload.paymentInstruction.protocolData.length > 0 ? { [PROTOCOL_DATA_FIELD]: serializeProtocolData(payload.paymentInstruction.protocolData) } : {}
114953
114986
  }
114954
114987
  }
114955
114988
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactionary/feeds",
3
- "version": "0.10.35",
3
+ "version": "0.10.36",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./src/index.d.ts",
@@ -12,14 +12,14 @@
12
12
  "url": "git+https://github.com/Solteq/reactionary.git"
13
13
  },
14
14
  "dependencies": {
15
- "@reactionary/algolia": "0.10.35",
16
- "@reactionary/commercetools": "0.10.35",
17
- "@reactionary/core": "0.10.35",
18
- "@reactionary/fake": "0.10.35",
19
- "@reactionary/magento": "0.10.35",
20
- "@reactionary/medusa": "0.10.35",
21
- "@reactionary/meilisearch": "0.10.35",
22
- "@reactionary/unomi": "0.10.35",
15
+ "@reactionary/algolia": "0.10.36",
16
+ "@reactionary/commercetools": "0.10.36",
17
+ "@reactionary/core": "0.10.36",
18
+ "@reactionary/fake": "0.10.36",
19
+ "@reactionary/magento": "0.10.36",
20
+ "@reactionary/medusa": "0.10.36",
21
+ "@reactionary/meilisearch": "0.10.36",
22
+ "@reactionary/unomi": "0.10.36",
23
23
  "commander": "^15.0.0",
24
24
  "dotenv": "^17.2.2",
25
25
  "sitemap": "^9.0.1",