@getlupa/client 1.17.10 → 1.17.11

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.
@@ -25363,6 +25363,8 @@ and ensure you are accounting for this risk.
25363
25363
  return extractFromStorage(options);
25364
25364
  case "htmlElementText":
25365
25365
  return extractFromHtmlElementText(options);
25366
+ case "htmlElementAttribute":
25367
+ return extractFromHtmlElementAttribute(options);
25366
25368
  case "cookie":
25367
25369
  return extractFromCookie(options);
25368
25370
  default:
@@ -25406,6 +25408,17 @@ and ensure you are accounting for this risk.
25406
25408
  const element = document.querySelector(options.querySelector);
25407
25409
  return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
25408
25410
  };
25411
+ const extractFromHtmlElementAttribute = (options) => {
25412
+ const element = document.querySelector(options.querySelector);
25413
+ if (!element) {
25414
+ return options.default;
25415
+ }
25416
+ const attr = options.attribute;
25417
+ if (attr === "value" && (element == null ? void 0 : element.value)) {
25418
+ return element.value;
25419
+ }
25420
+ return element.getAttribute(attr) || options.default;
25421
+ };
25409
25422
  const getValueFromPath = (obj, path) => {
25410
25423
  return path.split(".").reduce((value, key) => value && value[key] || null, obj);
25411
25424
  };
@@ -25363,6 +25363,8 @@ const extractValue = (options) => {
25363
25363
  return extractFromStorage(options);
25364
25364
  case "htmlElementText":
25365
25365
  return extractFromHtmlElementText(options);
25366
+ case "htmlElementAttribute":
25367
+ return extractFromHtmlElementAttribute(options);
25366
25368
  case "cookie":
25367
25369
  return extractFromCookie(options);
25368
25370
  default:
@@ -25406,6 +25408,17 @@ const extractFromHtmlElementText = (options) => {
25406
25408
  const element = document.querySelector(options.querySelector);
25407
25409
  return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
25408
25410
  };
25411
+ const extractFromHtmlElementAttribute = (options) => {
25412
+ const element = document.querySelector(options.querySelector);
25413
+ if (!element) {
25414
+ return options.default;
25415
+ }
25416
+ const attr = options.attribute;
25417
+ if (attr === "value" && (element == null ? void 0 : element.value)) {
25418
+ return element.value;
25419
+ }
25420
+ return element.getAttribute(attr) || options.default;
25421
+ };
25409
25422
  const getValueFromPath = (obj, path) => {
25410
25423
  return path.split(".").reduce((value, key) => value && value[key] || null, obj);
25411
25424
  };
@@ -25361,6 +25361,8 @@ const extractValue = (options) => {
25361
25361
  return extractFromStorage(options);
25362
25362
  case "htmlElementText":
25363
25363
  return extractFromHtmlElementText(options);
25364
+ case "htmlElementAttribute":
25365
+ return extractFromHtmlElementAttribute(options);
25364
25366
  case "cookie":
25365
25367
  return extractFromCookie(options);
25366
25368
  default:
@@ -25404,6 +25406,17 @@ const extractFromHtmlElementText = (options) => {
25404
25406
  const element = document.querySelector(options.querySelector);
25405
25407
  return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
25406
25408
  };
25409
+ const extractFromHtmlElementAttribute = (options) => {
25410
+ const element = document.querySelector(options.querySelector);
25411
+ if (!element) {
25412
+ return options.default;
25413
+ }
25414
+ const attr = options.attribute;
25415
+ if (attr === "value" && (element == null ? void 0 : element.value)) {
25416
+ return element.value;
25417
+ }
25418
+ return element.getAttribute(attr) || options.default;
25419
+ };
25407
25420
  const getValueFromPath = (obj, path) => {
25408
25421
  return path.split(".").reduce((value, key) => value && value[key] || null, obj);
25409
25422
  };
@@ -25365,6 +25365,8 @@ and ensure you are accounting for this risk.
25365
25365
  return extractFromStorage(options);
25366
25366
  case "htmlElementText":
25367
25367
  return extractFromHtmlElementText(options);
25368
+ case "htmlElementAttribute":
25369
+ return extractFromHtmlElementAttribute(options);
25368
25370
  case "cookie":
25369
25371
  return extractFromCookie(options);
25370
25372
  default:
@@ -25408,6 +25410,17 @@ and ensure you are accounting for this risk.
25408
25410
  const element = document.querySelector(options.querySelector);
25409
25411
  return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
25410
25412
  };
25413
+ const extractFromHtmlElementAttribute = (options) => {
25414
+ const element = document.querySelector(options.querySelector);
25415
+ if (!element) {
25416
+ return options.default;
25417
+ }
25418
+ const attr = options.attribute;
25419
+ if (attr === "value" && (element == null ? void 0 : element.value)) {
25420
+ return element.value;
25421
+ }
25422
+ return element.getAttribute(attr) || options.default;
25423
+ };
25411
25424
  const getValueFromPath = (obj, path) => {
25412
25425
  return path.split(".").reduce((value, key) => value && value[key] || null, obj);
25413
25426
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/client",
3
- "version": "1.17.10",
3
+ "version": "1.17.11",
4
4
  "main": "dist/lupaSearch.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/src/index.d.ts",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "devDependencies": {
22
22
  "@getlupa/client-sdk": "^1.3.4",
23
- "@getlupa/vue": "0.17.10",
23
+ "@getlupa/vue": "0.17.11",
24
24
  "@rushstack/eslint-patch": "^1.3.2",
25
25
  "@tsconfig/node18": "^2.0.1",
26
26
  "@types/jsdom": "^21.1.1",