@lightspeed/online-payments-sdk 0.2.3 → 0.2.4

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.
@@ -15,9 +15,9 @@ var Logger = /** @class */ (function () {
15
15
  };
16
16
  browser_logs_1.datadogLogs.init(logsConfig);
17
17
  };
18
- Logger.prototype.setSessionContext = function (context) {
18
+ Logger.prototype.setSessionMetadata = function (metadata) {
19
19
  // setting global context removes all existing context
20
- browser_logs_1.datadogLogs.setGlobalContext(context);
20
+ browser_logs_1.datadogLogs.setGlobalContext({ metadata: metadata });
21
21
  };
22
22
  Logger.prototype.log = function (status, message, context) {
23
23
  browser_logs_1.datadogLogs.logger.log(message, context, status);
@@ -7,7 +7,7 @@ var NoopLogger = /** @class */ (function () {
7
7
  NoopLogger.prototype.init = function () {
8
8
  // No operation
9
9
  };
10
- NoopLogger.prototype.setSessionContext = function () {
10
+ NoopLogger.prototype.setSessionMetadata = function () {
11
11
  // No operation
12
12
  };
13
13
  NoopLogger.prototype.log = function () {
@@ -52,13 +52,13 @@ function mountPaymentWidget(session_2, _a) {
52
52
  case 0:
53
53
  decodedSession = (0, session_1.decodePaymentSessionToContext)(session);
54
54
  logger = (0, logger_1.getLogger)(decodedSession.logging);
55
- logger.setSessionContext(decodedSession.metadata);
55
+ logger.setSessionMetadata(decodedSession.metadata);
56
56
  handlers = {
57
57
  onComplete: (0, common_1.withLogging)(logger, 'complete', onComplete || (function () { })),
58
58
  onFail: (0, common_1.withLogging)(logger, 'fail', onFail || (function () { })),
59
59
  onReady: (0, common_1.withLogging)(logger, 'ready', onReady || (function () { })),
60
60
  };
61
- logger.log('info', 'mount', { sessionContext: decodedSession.context });
61
+ logger.log('info', 'mount');
62
62
  _c = decodedSession.psp;
63
63
  switch (_c) {
64
64
  case 'ADYEN': return [3 /*break*/, 1];
@@ -9,7 +9,7 @@ export type LoggerConfig<P extends string, C extends object> = {
9
9
  };
10
10
  export interface Logger<T extends object> {
11
11
  init: (config: LoggerConfig<string, T>['params']) => void;
12
- setSessionContext: (context: Record<string, string>) => void;
12
+ setSessionMetadata: (metadata: Record<string, string>) => void;
13
13
  log: (status: LogLevel, message: string, context?: Record<string, unknown>) => void;
14
14
  }
15
15
  export {};
@@ -7,7 +7,7 @@ export type DatadogLoggerConfig = LoggerConfig<'datadog', {
7
7
  export type LoggerConfigParams = DatadogLoggerConfig['params'];
8
8
  export declare class Logger implements ILogger<LoggerConfigParams> {
9
9
  init(config: LoggerConfigParams): void;
10
- setSessionContext(context: Record<string, string>): void;
10
+ setSessionMetadata(metadata: Record<string, string>): void;
11
11
  log(status: LogLevel, message: string, context?: Record<string, unknown>): void;
12
12
  }
13
13
  export declare const getLogger: () => Logger;
@@ -12,9 +12,9 @@ var Logger = /** @class */ (function () {
12
12
  };
13
13
  datadogLogs.init(logsConfig);
14
14
  };
15
- Logger.prototype.setSessionContext = function (context) {
15
+ Logger.prototype.setSessionMetadata = function (metadata) {
16
16
  // setting global context removes all existing context
17
- datadogLogs.setGlobalContext(context);
17
+ datadogLogs.setGlobalContext({ metadata: metadata });
18
18
  };
19
19
  Logger.prototype.log = function (status, message, context) {
20
20
  datadogLogs.logger.log(message, context, status);
@@ -1,7 +1,7 @@
1
1
  import { Logger } from './common';
2
2
  declare class NoopLogger implements Logger<{}> {
3
3
  init(): void;
4
- setSessionContext(): void;
4
+ setSessionMetadata(): void;
5
5
  log(): void;
6
6
  }
7
7
  export declare const getLogger: () => NoopLogger;
@@ -4,7 +4,7 @@ var NoopLogger = /** @class */ (function () {
4
4
  NoopLogger.prototype.init = function () {
5
5
  // No operation
6
6
  };
7
- NoopLogger.prototype.setSessionContext = function () {
7
+ NoopLogger.prototype.setSessionMetadata = function () {
8
8
  // No operation
9
9
  };
10
10
  NoopLogger.prototype.log = function () {
package/dist/v1/widget.js CHANGED
@@ -49,13 +49,13 @@ export function mountPaymentWidget(session_1, _a) {
49
49
  case 0:
50
50
  decodedSession = decodePaymentSessionToContext(session);
51
51
  logger = getLogger(decodedSession.logging);
52
- logger.setSessionContext(decodedSession.metadata);
52
+ logger.setSessionMetadata(decodedSession.metadata);
53
53
  handlers = {
54
54
  onComplete: withLogging(logger, 'complete', onComplete || (function () { })),
55
55
  onFail: withLogging(logger, 'fail', onFail || (function () { })),
56
56
  onReady: withLogging(logger, 'ready', onReady || (function () { })),
57
57
  };
58
- logger.log('info', 'mount', { sessionContext: decodedSession.context });
58
+ logger.log('info', 'mount');
59
59
  _c = decodedSession.psp;
60
60
  switch (_c) {
61
61
  case 'ADYEN': return [3 /*break*/, 1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightspeed/online-payments-sdk",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Process online-payments with Lightspeed Payments",
5
5
  "author": "Lightspeed Commerce Inc.",
6
6
  "license": "SEE LICENSE IN LICENSE.md",