@mindful-web/marko-web-omeda-identity-x 1.83.0 → 1.83.1

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.
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
 
4
4
  var marko_template = module.exports = require("marko/dist/html").t(__filename),
5
- marko_componentType = "/@mindful-web/marko-web-omeda-identity-x$1.83.0/components/identify.marko",
5
+ marko_componentType = "/@mindful-web/marko-web-omeda-identity-x$1.83.1/components/identify.marko",
6
6
  marko_component = require("./identify.marko"),
7
7
  marko_renderer = require("marko/dist/runtime/components/renderer"),
8
8
  module_getCookieId = require("@mindful-web/marko-web-omeda-identity-x/utils/get-cookie-id"),
@@ -51,7 +51,7 @@ marko_template._ = marko_renderer(render, {
51
51
  }, marko_component);
52
52
 
53
53
  marko_template.meta = {
54
- id: "/@mindful-web/marko-web-omeda-identity-x$1.83.0/components/identify.marko",
54
+ id: "/@mindful-web/marko-web-omeda-identity-x$1.83.1/components/identify.marko",
55
55
  component: "./identify.marko",
56
56
  tags: [
57
57
  "@mindful-web/marko-web-identity-x/components/identify.marko",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindful-web/marko-web-omeda-identity-x",
3
- "version": "1.83.0",
3
+ "version": "1.83.1",
4
4
  "description": "Marko Omeda+IdentityX integration tools",
5
5
  "repository": "https://github.com/parameter1/mindful-web/tree/main/packages/marko-web-omeda-identity-x",
6
6
  "author": "Josh Worden <josh@parameter1.com>",
@@ -13,10 +13,10 @@
13
13
  "test": "yarn compile --no-clean && yarn lint"
14
14
  },
15
15
  "dependencies": {
16
- "@mindful-web/marko-web-identity-x": "^1.83.0",
17
- "@mindful-web/marko-web-omeda": "^1.83.0",
18
- "@mindful-web/object-path": "^1.83.0",
19
- "@mindful-web/utils": "^1.83.0",
16
+ "@mindful-web/marko-web-identity-x": "^1.83.1",
17
+ "@mindful-web/marko-web-omeda": "^1.83.1",
18
+ "@mindful-web/object-path": "^1.83.1",
19
+ "@mindful-web/utils": "^1.83.1",
20
20
  "@parameter1/joi": "^1.2.10",
21
21
  "graphql": "^14.7.0",
22
22
  "graphql-tag": "^2.12.6"
@@ -29,5 +29,5 @@
29
29
  "publishConfig": {
30
30
  "access": "public"
31
31
  },
32
- "gitHead": "2b694183f136fdd763ae0d1bc47843c5bf6e9290"
32
+ "gitHead": "c9507129d0e30847cb2b2a941cb383746d1fd501"
33
33
  }
package/rapid-identify.js CHANGED
@@ -185,6 +185,28 @@ module.exports = async ({
185
185
  ...(subscriptions.length && { subscriptions }),
186
186
  });
187
187
 
188
+ /**
189
+ * `RapidCustomerIdentification.id` and `.encryptedCustomerId` are both *nullable*
190
+ * in the Omeda GraphQL schema — only `transactionId` is non-null — so a response
191
+ * can arrive without either one. Written unchecked, `${id}` stored the literal
192
+ * string `'null'` as an external ID and the encrypted identifier was sent with a
193
+ * null value (which is what the `idx/AddExternalUserId` errors in `MindfulApiCall`
194
+ * were).
195
+ *
196
+ * A bogus `encrypted` external ID is worse than none at all: `appendSubscriptions`
197
+ * locates the Omeda customer record by exactly that ID, so a garbage value costs
198
+ * the user every future newsletter auto-signup, silently and permanently. Nothing
199
+ * downstream can proceed without both values, so fail loudly instead of persisting
200
+ * them. This stays non-fatal for the user's sign-in — `callHooksFor` routes the
201
+ * rejection to `onHookError`.
202
+ */
203
+ const isBlank = (value) => value == null || `${value}`.trim() === '';
204
+ const missing = ['id', 'encryptedCustomerId']
205
+ .filter((key) => isBlank({ id, encryptedCustomerId }[key]));
206
+ if (missing.length) {
207
+ throw new Error(`Omeda rapid identification for brand '${brandKey}' returned no ${missing.join(' and no ')}. No external IDs were written for IdentityX user ${appUser.id}.`);
208
+ }
209
+
188
210
  const namespace = { provider: 'omeda', tenant: brandKey.toLowerCase(), type: 'customer' };
189
211
  await Promise.all([
190
212
  identityX.addExternalUserId({