@mindful-web/marko-web-omeda-identity-x 1.0.1 → 1.8.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.
@@ -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.0.1/components/identify.marko",
5
+ marko_componentType = "/@mindful-web/marko-web-omeda-identity-x$1.8.0/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.0.1/components/identify.marko",
54
+ id: "/@mindful-web/marko-web-omeda-identity-x$1.8.0/components/identify.marko",
55
55
  component: "./identify.marko",
56
56
  tags: [
57
57
  "@mindful-web/marko-web-identity-x/components/identify.marko",
package/index.js CHANGED
@@ -259,3 +259,178 @@ module.exports = (app, params = {}) => {
259
259
  omedaPromoCodeDefault,
260
260
  }));
261
261
  };
262
+
263
+ /**
264
+ * @typedef {import('@mindful-web/marko-web-identity-x/service')} IdentityX
265
+ * @typedef {import('@mindful-web/marko-web-identity-x/service').User} IdentityXUser
266
+ * @typedef {import('@mindful-web/marko-web-omeda-identity-x/rapid-identify')} OIDXRapidIdentify
267
+ *
268
+ * @typedef {(
269
+ * "onAuthenticationSuccess"|
270
+ * "onChangeEmailLinkSent"|
271
+ * "onChangeEmailSuccess"|
272
+ * "onLoadActiveContext"|
273
+ * "onLoginLinkSent"|
274
+ * "onLogout"|
275
+ * "onUserProfileUpdate"
276
+ * )} IDXHookTypeEnum
277
+ *
278
+ * @typedef {(
279
+ * "default"|
280
+ * "newsletterSignup"|
281
+ * "comments"|
282
+ * "contentGate"
283
+ * )} OIDXLoginSource
284
+ *
285
+ * @typedef {(
286
+ * "default"|
287
+ * "pushdown"|
288
+ * "inlineContent"|
289
+ * "inlineSection"|
290
+ * "footer"
291
+ * )} OIDXNewsletterSource
292
+ *
293
+ * @typedef {(
294
+ * "default"|
295
+ * "metered"|
296
+ * "printPreview"
297
+ * )} OIDXContentGateSource
298
+ */
299
+
300
+ /**
301
+ * Arguments included directly with the hook execution
302
+ *
303
+ * @typedef IdentityXHookArgs
304
+ * see [callHooksFor]({@link ../marko-web-identity-x/utils/call-hooks-for.js}) for
305
+ * @prop {object} additionalEventData
306
+ * @prop {IdentityX} service
307
+ *
308
+ * @typedef {IdentityXHookArgs & OnAuthenticationSuccessHookArgs} OnAuthenticationSuccessHook
309
+ * @typedef {IdentityXHookArgs & OnLoginLinkSentHookArgs} OnLoginLinkSentHook
310
+ * @typedef {IdentityXHookArgs & OnUserProfileUpdateHookArgs} OnUserProfileUpdateHook
311
+ *
312
+ * @typedef OnAuthenticationSuccessHookArgs
313
+ * see [authenticate route]({@link ../marko-web-identity-x/routes/authenticate.js}) for
314
+ * @prop {string} authToken
315
+ * @prop {OIDXLoginSource} [loginSource]
316
+ * @prop {import('express').Request} req
317
+ * @prop {import('express').Response} res
318
+ * @prop {IdentityXUser} user
319
+ *
320
+ * @typedef OnLoginLinkSentHookArgs
321
+ * see [service.sendLoginLink]({@link ../marko-web-identity-x/service.js}) for
322
+ * @prop {object} [additionalEventData]
323
+ * @prop {import('express').Request} req
324
+ * @prop {OIDXLoginSource} [source]
325
+ * @prop {IdentityX} service
326
+ * @prop {IdentityXUser} user
327
+ *
328
+ * @typedef OnUserProfileUpdateHookArgs
329
+ * see [profile route]({@link ../marko-web-identity-x/routes/profile.js}) for
330
+ * @prop {object} [additionalEventData]
331
+ * @prop {import('express').Request} req
332
+ * @prop {IdentityX} service
333
+ * @prop {IdentityXUser} user
334
+ */
335
+
336
+ /**
337
+ * Arguments injected by [hook registration]({@link ./add-integration-hooks.js})
338
+ *
339
+ * @typedef OmedaHookFunctionArgs
340
+ * @prop {object[]} appendBehaviors @todo document data factory results
341
+ * @prop {object[]} appendDemographics
342
+ * @prop {object[]} appendPromoCodes If present, the last value will be used as the promoCode
343
+ * @prop {any} behavior @todo document behavior factory results
344
+ * @prop {string} brandKey
345
+ * @prop {OIDXRapidIdentify} idxOmedaRapidIdentify
346
+ * @prop {string} omedaPromoCodeCookieName
347
+ * @prop {string} omedaPromoCodeDefault
348
+ *
349
+ * @typedef {OmedaHookFunctionArgs & OnAuthenticationSuccessFnParams} OnAuthenticationSuccessFnArgs
350
+ * @typedef OnAuthenticationSuccessFnParams
351
+ * @prop {OnAuthenticationSuccessFormatterFn} formatter
352
+ *
353
+ * @typedef {OmedaHookFunctionArgs & OnLoginLinkSentFnParams} OnLoginLinkSentFnArgs
354
+ * @typedef OnLoginLinkSentFnParams
355
+ * @prop {OnLoginLinkSentFormatterFn} formatter
356
+ *
357
+ * @typedef {OmedaHookFunctionArgs & OnUserProfileUpdateFnParams} OnUserProfileUpdateFnArgs
358
+ * @typedef OnUserProfileUpdateFnParams
359
+ * @prop {OnUserProfileUpdateFormatterFn} formatter
360
+ */
361
+
362
+ /**
363
+ * Arguments injected to hook formatter function
364
+ *
365
+ * @typedef OnAuthenticationSuccessFormatterArgs
366
+ * see [hook]({@link ./integration-hooks/on-authentication-success.js}) for
367
+ * @prop {OmedaRapidIdentificationPayload} payload
368
+ * @prop {string} promoCode the extracted promocode to be applied
369
+ *
370
+ * @typedef OnLoginLinkSentFormatterArgs
371
+ * see [hook]({@link ./integration-hooks/on-login-link-sent.js}) for
372
+ * @prop {OmedaRapidIdentificationPayload} payload
373
+ * @prop {OIDXLoginSource} source
374
+ *
375
+ * @typedef OnUserProfileUpdateFormatterArgs
376
+ * see [hook]({@link ./integration-hooks/on-user-profile-update.js}) for
377
+ * @prop {OmedaRapidIdentificationPayload} payload
378
+ */
379
+
380
+ /**
381
+ * Payload formatter functions
382
+ *
383
+ * @callback OnAuthenticationSuccessFormatterFn
384
+ * @param {OnAuthenticationSuccessFormatterFnArgs} args
385
+ * @returns {Promise<OmedaRapidIdentificationPayload>}
386
+ *
387
+ * @callback OnLoginLinkSentFormatterFn
388
+ * @param {OnLoginLinkSentFormatterFnArgs} args
389
+ * @returns {Promise<OmedaRapidIdentificationPayload>}
390
+ *
391
+ * @callback OnUserProfileUpdateFormatterFn
392
+ * @param {OnUserProfileUpdateFormatterFnArgs} args
393
+ * @returns {Promise<OmedaRapidIdentificationPayload>}
394
+ */
395
+
396
+ /**
397
+ * The payload to be modified by the formatter
398
+ *
399
+ * @typedef OmedaRapidIdentificationPayload
400
+ * @prop {IdentityXUser | UnverifiedUser} user
401
+ * @prop {object} behavior
402
+ * @prop {object} promoCode
403
+ * @prop {object[]} appendBehaviors
404
+ * @prop {object[]} appendDemographics
405
+ * @prop {object[]} appendPromoCodes
406
+ */
407
+
408
+ /**
409
+ * @typedef UnverifiedUser
410
+ * @prop {string} id
411
+ * @prop {string} email
412
+ */
413
+
414
+ /**
415
+ * Arguments passed to handler
416
+ *
417
+ * @typedef {OnAuthenticationSuccessHook &
418
+ * OnAuthenticationSuccessFnArgs} OnAuthenticationSuccessHandlerArgs
419
+ *
420
+ * @typedef {OnLoginLinkSentHook &
421
+ * OnLoginLinkSentFnArgs} OnLoginLinkSentHandlerArgs
422
+ *
423
+ * @typedef {OnUserProfileUpdateHook &
424
+ * OnUserProfileUpdateFnArgs} OnUserProfileUpdateHandlerArgs
425
+ */
426
+
427
+ /**
428
+ * Arguments passed to formatter function to modify payload
429
+ *
430
+ * @typedef {OnAuthenticationSuccessHandlerArgs &
431
+ * OnAuthenticationSuccessFormatterArgs} OnAuthenticationSuccessFormatterFnArgs
432
+ * @typedef {OnLoginLinkSentHandlerArgs &
433
+ * OnLoginLinkSentFormatterArgs} OnLoginLinkSentFormatterFnArgs
434
+ * @typedef {OnUserProfileUpdateHandlerArgs &
435
+ * OnUserProfileUpdateFormatterArgs} OnUserProfileUpdateFormatterFnArgs
436
+ */
@@ -6,7 +6,12 @@ const findEncryptedId = require('../external-id/find-encrypted-customer-id');
6
6
  const props = require('../validation/props');
7
7
  const schemas = require('../validation/schemas');
8
8
 
9
+ /**
10
+ * @param {import('..').OnAuthenticationSuccessHandlerArgs} params
11
+ * @returns {Promise<void>}
12
+ */
9
13
  module.exports = async (params = {}) => {
14
+ /** @type {import('..').OnAuthenticationSuccessHandlerArgs} */
10
15
  const {
11
16
  appendBehaviors,
12
17
  appendDemographics,
@@ -10,7 +10,12 @@ const {
10
10
  } = require('../omeda-data');
11
11
  const props = require('../validation/props');
12
12
 
13
+ /**
14
+ * @param {import('..').OnLoginLinkSentHandlerArgs} params
15
+ * @returns {Promise<void>}
16
+ */
13
17
  module.exports = async (params = {}) => {
18
+ /** @type {import('..').OnLoginLinkSentHandlerArgs} */
14
19
  const {
15
20
  appendBehaviors,
16
21
  appendDemographics,
@@ -3,7 +3,12 @@ const { validate } = require('@parameter1/joi/utils');
3
3
  const extractPromoCode = require('../utils/extract-promo-code');
4
4
  const schemas = require('../validation/schemas');
5
5
 
6
+ /**
7
+ * @param {import('..').OnUserProfileUpdateHandlerArgs} params
8
+ * @returns {Promise<void>}
9
+ */
6
10
  module.exports = async (params = {}) => {
11
+ /** @type {import('..').OnUserProfileUpdateHandlerArgs} */
7
12
  const {
8
13
  appendBehaviors,
9
14
  appendDemographics,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindful-web/marko-web-omeda-identity-x",
3
- "version": "1.0.1",
3
+ "version": "1.8.0",
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,7 +13,7 @@
13
13
  "test": "yarn compile --no-clean && yarn lint"
14
14
  },
15
15
  "dependencies": {
16
- "@mindful-web/marko-web-identity-x": "^1.0.1",
16
+ "@mindful-web/marko-web-identity-x": "^1.8.0",
17
17
  "@mindful-web/marko-web-omeda": "^1.0.1",
18
18
  "@mindful-web/object-path": "^1.0.0",
19
19
  "@mindful-web/utils": "^1.0.0",
@@ -29,5 +29,5 @@
29
29
  "publishConfig": {
30
30
  "access": "public"
31
31
  },
32
- "gitHead": "32a118ae20fc89f93c2c8c345a73cc2a65de18ae"
32
+ "gitHead": "b55245a64f03737d1e4fce9be0921bc10282750b"
33
33
  }