@reactionary/feeds 0.10.34 → 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 +46 -5
  2. package/package.json +9 -9
package/cli.cjs CHANGED
@@ -61876,6 +61876,13 @@ var init_initialization = __esm({
61876
61876
  }
61877
61877
  });
61878
61878
 
61879
+ // packages/core/src/metrics/protocol.ts
61880
+ var init_protocol = __esm({
61881
+ "packages/core/src/metrics/protocol.ts"() {
61882
+ "use strict";
61883
+ }
61884
+ });
61885
+
61879
61886
  // packages/core/src/index.ts
61880
61887
  var init_src = __esm({
61881
61888
  "packages/core/src/index.ts"() {
@@ -61887,6 +61894,7 @@ var init_src = __esm({
61887
61894
  init_capabilities();
61888
61895
  init_schemas3();
61889
61896
  init_initialization();
61897
+ init_protocol();
61890
61898
  }
61891
61899
  });
61892
61900
 
@@ -112943,11 +112951,41 @@ var init_category_factory2 = __esm({
112943
112951
  }
112944
112952
  });
112945
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
+
112946
112983
  // packages/commercetools/src/factories/checkout/checkout.factory.ts
112947
112984
  var CommercetoolsCheckoutFactory;
112948
112985
  var init_checkout_factory2 = __esm({
112949
112986
  "packages/commercetools/src/factories/checkout/checkout.factory.ts"() {
112950
112987
  "use strict";
112988
+ init_payment_protocol_data();
112951
112989
  init_src();
112952
112990
  init_locale_utils();
112953
112991
  CommercetoolsCheckoutFactory = class {
@@ -113128,10 +113166,9 @@ var init_checkout_factory2 = __esm({
113128
113166
  name: paymentName || method || "Unknown"
113129
113167
  };
113130
113168
  const customData = data.custom?.fields || {};
113131
- const protocolData = Object.keys(customData).map((key) => ({
113132
- key,
113133
- value: customData[key]
113134
- }));
113169
+ const protocolData = Object.keys(customData).flatMap(
113170
+ (key) => key === PROTOCOL_DATA_FIELD ? parseProtocolDataField(customData[key]) : [{ key, value: customData[key] }]
113171
+ );
113135
113172
  let status = "pending";
113136
113173
  if (data.transactions && data.transactions.length > 0) {
113137
113174
  const lastTransaction = data.transactions[data.transactions.length - 1];
@@ -114763,6 +114800,7 @@ var CheckoutNotReadyForFinalizationError, CommercetoolsCheckoutCapability;
114763
114800
  var init_checkout_capability2 = __esm({
114764
114801
  "packages/commercetools/src/capabilities/checkout.capability.ts"() {
114765
114802
  "use strict";
114803
+ init_payment_protocol_data();
114766
114804
  init_src();
114767
114805
  init_zod();
114768
114806
  init_locale_utils();
@@ -114941,7 +114979,10 @@ var init_checkout_capability2 = __esm({
114941
114979
  key: "reactionaryPaymentCustomFields"
114942
114980
  },
114943
114981
  fields: {
114944
- 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) } : {}
114945
114986
  }
114946
114987
  }
114947
114988
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactionary/feeds",
3
- "version": "0.10.34",
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.34",
16
- "@reactionary/commercetools": "0.10.34",
17
- "@reactionary/core": "0.10.34",
18
- "@reactionary/fake": "0.10.34",
19
- "@reactionary/magento": "0.10.34",
20
- "@reactionary/medusa": "0.10.34",
21
- "@reactionary/meilisearch": "0.10.34",
22
- "@reactionary/unomi": "0.10.34",
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",