@bucketco/tracking-sdk
Advanced tools
Comparing version 2.1.11 to 2.2.0
{ | ||
"name": "@bucketco/tracking-sdk", | ||
"version": "2.1.11", | ||
"version": "2.2.0", | ||
"license": "MIT", | ||
@@ -65,3 +65,3 @@ "private": false, | ||
"typescript": "^5.3.3", | ||
"vite": "^5.0.12", | ||
"vite": "^5.0.13", | ||
"vite-plugin-dts": "^3.7.0", | ||
@@ -68,0 +68,0 @@ "vitest": "^1.1.3", |
@@ -29,3 +29,3 @@ "use strict"; | ||
const FeedbackDialog = ({ key, title = defaultTranslations_1.DEFAULT_TRANSLATIONS.DefaultQuestionLabel, position, translations = defaultTranslations_1.DEFAULT_TRANSLATIONS, openWithCommentVisible = false, onClose, onDismiss, onSubmit, onScoreSubmit, }) => { | ||
var _a; | ||
var _a, _b, _c; | ||
const arrowRef = (0, hooks_1.useRef)(null); | ||
@@ -49,18 +49,32 @@ const anchor = position.type === "POPOVER" ? position.anchor : null; | ||
if (position.type === "DIALOG") { | ||
const offsetY = parseOffset((_a = position.offset) === null || _a === void 0 ? void 0 : _a.y); | ||
const offsetX = parseOffset((_b = position.offset) === null || _b === void 0 ? void 0 : _b.x); | ||
switch (position.placement) { | ||
case "top-left": | ||
unanchoredPosition = { top: "1rem", left: "1rem" }; | ||
unanchoredPosition = { | ||
top: offsetY, | ||
left: offsetX, | ||
}; | ||
break; | ||
case "top-right": | ||
unanchoredPosition = { top: "1rem", right: "1rem" }; | ||
unanchoredPosition = { | ||
top: offsetY, | ||
right: offsetX, | ||
}; | ||
break; | ||
case "bottom-left": | ||
unanchoredPosition = { bottom: "1rem", left: "1rem" }; | ||
unanchoredPosition = { | ||
bottom: offsetY, | ||
left: offsetX, | ||
}; | ||
break; | ||
case "bottom-right": | ||
unanchoredPosition = { bottom: "1rem", right: "1rem" }; | ||
unanchoredPosition = { | ||
bottom: offsetY, | ||
right: offsetX, | ||
}; | ||
break; | ||
} | ||
} | ||
const { x: arrowX, y: arrowY } = (_a = middlewareData.arrow) !== null && _a !== void 0 ? _a : {}; | ||
const { x: arrowX, y: arrowY } = (_c = middlewareData.arrow) !== null && _c !== void 0 ? _c : {}; | ||
const staticSide = { | ||
@@ -166,2 +180,9 @@ top: "bottom", | ||
exports.FeedbackDialog = FeedbackDialog; | ||
function parseOffset(offsetInput) { | ||
if (offsetInput === undefined) | ||
return "1rem"; | ||
if (typeof offsetInput === "number") | ||
return offsetInput + "px"; | ||
return offsetInput; | ||
} | ||
//# sourceMappingURL=FeedbackDialog.js.map |
@@ -5,2 +5,12 @@ export type WithRequired<T, K extends keyof T> = T & { | ||
export type FeedbackPlacement = "bottom-right" | "bottom-left" | "top-right" | "top-left"; | ||
export type Offset = { | ||
/** | ||
* Offset from the nearest horizontal screen edge after placement is resolved | ||
*/ | ||
x?: string | number; | ||
/** | ||
* Offset from the nearest vertical screen edge after placement is resolved | ||
*/ | ||
y?: string | number; | ||
}; | ||
export type FeedbackPosition = { | ||
@@ -11,2 +21,3 @@ type: "MODAL"; | ||
placement: FeedbackPlacement; | ||
offset?: Offset; | ||
} | { | ||
@@ -13,0 +24,0 @@ type: "POPOVER"; |
{ | ||
"name": "@bucketco/tracking-sdk", | ||
"version": "2.1.11", | ||
"version": "2.2.0", | ||
"license": "MIT", | ||
@@ -65,3 +65,3 @@ "private": false, | ||
"typescript": "^5.3.3", | ||
"vite": "^5.0.12", | ||
"vite": "^5.0.13", | ||
"vite-plugin-dts": "^3.7.0", | ||
@@ -68,0 +68,0 @@ "vitest": "^1.1.3", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
364543
2468