@digipair/skill-web-notification 0.70.4 → 0.71.3

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.
package/index.cjs.js CHANGED
@@ -27857,7 +27857,8 @@ var _globalInstance___DIGIPAIR_CONFIG__;
27857
27857
  const _config = globalInstance.__DIGIPAIR_CONFIG__ = (_globalInstance___DIGIPAIR_CONFIG__ = globalInstance.__DIGIPAIR_CONFIG__) != null ? _globalInstance___DIGIPAIR_CONFIG__ : {
27858
27858
  LIBRARIES: {},
27859
27859
  BASE_URL: 'https://cdn.jsdelivr.net/npm',
27860
- ALIAS: []
27860
+ ALIAS: [],
27861
+ LOGGER: (level, path, message, context, data)=>{}
27861
27862
  };
27862
27863
  const isRemoteVersion = /^https?:\/\/[^\s/$.?#].[^\s]*$/;
27863
27864
  const isPinsSettings = (value)=>{
@@ -27898,6 +27899,7 @@ const applyTemplate = (value, context)=>{
27898
27899
  };
27899
27900
  const executePins = async (settingsOrigin, context = {})=>{
27900
27901
  var _settings_conditions, _settings_conditions1;
27902
+ _config.LOGGER('INFO', context.__PATH__, 'execute:start', context);
27901
27903
  let settings = preparePinsSettings(settingsOrigin, context);
27902
27904
  const alias = _config.ALIAS.find((alias)=>settings.library.split(':')[0] === alias.name);
27903
27905
  const config = context.config || {};
@@ -27955,9 +27957,11 @@ const executePins = async (settingsOrigin, context = {})=>{
27955
27957
  if (!pins) {
27956
27958
  throw new Error(`Element ${settings.element} not found in library ${settings.library}`);
27957
27959
  }
27958
- return await pins(settings.properties, settings.pins, context);
27960
+ const result = await pins(settings.properties, settings.pins, context);
27961
+ _config.LOGGER('INFO', context.__PATH__, 'execute:end', context, result);
27962
+ return result;
27959
27963
  };
27960
- const executePinsList = async (pinsSettingsList, context)=>{
27964
+ const executePinsList = async (pinsSettingsList, context, path = 'root')=>{
27961
27965
  let previous = {};
27962
27966
  for(let i = 0; i < pinsSettingsList.length; i++){
27963
27967
  const settings = pinsSettingsList[i];
@@ -27967,7 +27971,8 @@ const executePinsList = async (pinsSettingsList, context)=>{
27967
27971
  parent: {
27968
27972
  previous: context.previous,
27969
27973
  parent: context.parent
27970
- }
27974
+ },
27975
+ __PATH__: `${path}[${i}]`
27971
27976
  }));
27972
27977
  } catch (error) {
27973
27978
  if (error === 'DIGIPAIR_CONDITIONS_IF_FALSE') {
@@ -28393,10 +28398,10 @@ let NotificationService = class NotificationService {
28393
28398
  async confirm(params, _pinsSettingsList, context) {
28394
28399
  const { message, ok = [], ko = [] } = params;
28395
28400
  if (!window.confirm(message)) {
28396
- await executePinsList(ko, context);
28401
+ await executePinsList(ko, context, `${context.__PATH__}.ko`);
28397
28402
  return false;
28398
28403
  }
28399
- await executePinsList(ok, context);
28404
+ await executePinsList(ok, context, `${context.__PATH__}.ok`);
28400
28405
  return true;
28401
28406
  }
28402
28407
  async alert(params, _pinsSettingsList, _context) {
package/index.esm.js CHANGED
@@ -27835,7 +27835,8 @@ var _globalInstance___DIGIPAIR_CONFIG__;
27835
27835
  const _config = globalInstance.__DIGIPAIR_CONFIG__ = (_globalInstance___DIGIPAIR_CONFIG__ = globalInstance.__DIGIPAIR_CONFIG__) != null ? _globalInstance___DIGIPAIR_CONFIG__ : {
27836
27836
  LIBRARIES: {},
27837
27837
  BASE_URL: 'https://cdn.jsdelivr.net/npm',
27838
- ALIAS: []
27838
+ ALIAS: [],
27839
+ LOGGER: (level, path, message, context, data)=>{}
27839
27840
  };
27840
27841
  const isRemoteVersion = /^https?:\/\/[^\s/$.?#].[^\s]*$/;
27841
27842
  const isPinsSettings = (value)=>{
@@ -27876,6 +27877,7 @@ const applyTemplate = (value, context)=>{
27876
27877
  };
27877
27878
  const executePins = async (settingsOrigin, context = {})=>{
27878
27879
  var _settings_conditions, _settings_conditions1;
27880
+ _config.LOGGER('INFO', context.__PATH__, 'execute:start', context);
27879
27881
  let settings = preparePinsSettings(settingsOrigin, context);
27880
27882
  const alias = _config.ALIAS.find((alias)=>settings.library.split(':')[0] === alias.name);
27881
27883
  const config = context.config || {};
@@ -27933,9 +27935,11 @@ const executePins = async (settingsOrigin, context = {})=>{
27933
27935
  if (!pins) {
27934
27936
  throw new Error(`Element ${settings.element} not found in library ${settings.library}`);
27935
27937
  }
27936
- return await pins(settings.properties, settings.pins, context);
27938
+ const result = await pins(settings.properties, settings.pins, context);
27939
+ _config.LOGGER('INFO', context.__PATH__, 'execute:end', context, result);
27940
+ return result;
27937
27941
  };
27938
- const executePinsList = async (pinsSettingsList, context)=>{
27942
+ const executePinsList = async (pinsSettingsList, context, path = 'root')=>{
27939
27943
  let previous = {};
27940
27944
  for(let i = 0; i < pinsSettingsList.length; i++){
27941
27945
  const settings = pinsSettingsList[i];
@@ -27945,7 +27949,8 @@ const executePinsList = async (pinsSettingsList, context)=>{
27945
27949
  parent: {
27946
27950
  previous: context.previous,
27947
27951
  parent: context.parent
27948
- }
27952
+ },
27953
+ __PATH__: `${path}[${i}]`
27949
27954
  }));
27950
27955
  } catch (error) {
27951
27956
  if (error === 'DIGIPAIR_CONDITIONS_IF_FALSE') {
@@ -28371,10 +28376,10 @@ let NotificationService = class NotificationService {
28371
28376
  async confirm(params, _pinsSettingsList, context) {
28372
28377
  const { message, ok = [], ko = [] } = params;
28373
28378
  if (!window.confirm(message)) {
28374
- await executePinsList(ko, context);
28379
+ await executePinsList(ko, context, `${context.__PATH__}.ko`);
28375
28380
  return false;
28376
28381
  }
28377
- await executePinsList(ok, context);
28382
+ await executePinsList(ok, context, `${context.__PATH__}.ok`);
28378
28383
  return true;
28379
28384
  }
28380
28385
  async alert(params, _pinsSettingsList, _context) {
@@ -1,10 +1,11 @@
1
1
  import { PinsSettings } from './pins-settings.interface';
2
- type CONFIG_KEY = 'BASE_URL' | 'LIBRARIES' | 'ALIAS';
2
+ type CONFIG_KEY = 'BASE_URL' | 'LIBRARIES' | 'ALIAS' | 'LOGGER';
3
3
  export declare const config: {
4
4
  set: (key: CONFIG_KEY, value: any) => void;
5
+ log: (level: string, path: string, message: string, context: any, data?: any) => any;
5
6
  };
6
7
  export declare const applyTemplate: (value: any, context: any) => any;
7
- export declare const executePinsList: (pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
8
+ export declare const executePinsList: (pinsSettingsList: PinsSettings[], context: any, path?: string) => Promise<any>;
8
9
  export declare const generateElementFromPins: (pinsSettings: PinsSettings, parent: Element, context: any, document?: Document, options?: {
9
10
  import: boolean;
10
11
  }) => Promise<Element | void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-web-notification",
3
- "version": "0.70.4",
3
+ "version": "0.71.3",
4
4
  "keywords": [
5
5
  "digipair",
6
6
  "web"