Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ca22529
fix: docs ci script (#298)
matus-vacula Jan 28, 2025
2bb5088
chore(deps): bump next from 14.2.15 to 14.2.21 in /packages/react-sdk…
dependabot[bot] Jan 28, 2025
e81ec95
Bump year (#281)
makwarth Jan 28, 2025
f13880a
feat(browser-sdk,node-sdk): add avatar support for user and company c…
pavkam Jan 28, 2025
15119f8
chore(deps): bump nanoid from 3.3.7 to 3.3.8 in /packages/node-sdk/ex…
dependabot[bot] Jan 20, 2025
579eb1c
fix(node-sdk): ensure timers don't keep process alive (#303)
roncohen Feb 3, 2025
d9381e4
chore(browser-sdk,node-sdk): version 2.5.2 (#306)
roncohen Feb 4, 2025
de93d76
feat(node-sdk): allow passing `meta` to `getFeature(s)` (#312)
pavkam Feb 9, 2025
bae0be7
chore(deps-dev): bump vitest from 2.0.4 to 2.1.9 (#314)
dependabot[bot] Feb 10, 2025
2fcef62
chore(deps-dev): bump vitest from 2.1.4 to 2.1.9 in /packages/node-sd…
dependabot[bot] Feb 10, 2025
77d6c63
feat(node-sdk): add configurable exit event flushing (#311)
pavkam Feb 13, 2025
0ed35dc
chore(deps): bump serialize-javascript from 6.0.1 to 6.0.2 (#321)
dependabot[bot] Feb 13, 2025
a48606a
chore: upgrade typedoc-plugin-markdown (#320)
matus-vacula Feb 13, 2025
2a94de2
chore: change docs destination (#327)
matus-vacula Feb 19, 2025
6249a8d
feat(node-sdk): enhance feature evaluation with detailed event tracki…
pavkam Feb 23, 2025
e42cce5
style: update files to match new eslint version and rules
Swiftwork Feb 25, 2025
9c05eb5
fix: clear mistakes and base configurations
Swiftwork Feb 25, 2025
0f9df07
feat: correct hook dependencies and reference loop
Swiftwork Feb 25, 2025
c14ff69
style: fix formatting
Swiftwork Feb 25, 2025
5af8eb7
style: fix preact linting
Swiftwork Feb 25, 2025
f70ea5d
Merge remote-tracking branch 'origin/main' into feat/upgrade-eslint
Swiftwork Feb 26, 2025
988cbd8
fix: cleanup merge conflicts
Swiftwork Feb 26, 2025
af6d544
fix: more merge conflicts
Swiftwork Feb 26, 2025
6bd5794
fix: incorrect browser-sdk version in react-sdk
Swiftwork Feb 26, 2025
f92a4a0
Merge branch 'main' into feat/upgrade-eslint
Swiftwork Feb 26, 2025
2993cf0
fix: add missing http-server for tests
Swiftwork Feb 26, 2025
feea795
feat: add missing deps
Swiftwork Feb 26, 2025
3bcdbf1
fix: turn off unknown properties and stroke svg attributes
Swiftwork Feb 26, 2025
fd949bb
Merge branch 'main' into feat/upgrade-eslint
Swiftwork Feb 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"packageManager": "yarn@4.1.1",
"devDependencies": {
"lerna": "^8.1.3",
"prettier": "^3.3.3",
"prettier": "^3.5.2",
"typedoc": "0.27.6",
"typedoc-plugin-frontmatter": "^1.1.2",
"typedoc-plugin-markdown": "^4.4.2",
Expand Down
24 changes: 22 additions & 2 deletions packages/browser-sdk/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
const base = require("@bucketco/eslint-config/base");
const base = require("@bucketco/eslint-config");

module.exports = [...base, { ignores: ["dist/", "example/"] }];
module.exports = [
...base,
{
// Preact projects
files: ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"],
settings: {
react: {
// We only care about marking h() as being a used variable.
pragma: "h",
// We use "react 16.0" to avoid pushing folks to UNSAFE_ methods.
version: "16.0",
},
},
rules: {
// Ignore React attributes that are not valid in Preact.
// Alternatively, we could use the preact/compat alias or turn off the rule.
"react/no-unknown-property": ["off"],
},
},
{ ignores: ["dist/", "example/"] },
];
8 changes: 5 additions & 3 deletions packages/browser-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,17 @@
"@playwright/test": "^1.49.1",
"@types/js-cookie": "^3.0.6",
"@types/node": "^22.12.0",
"css-loader": "^6.9.0",
"eslint": "^8.57.0",
"@vitest/coverage-v8": "^2.0.4",
"c8": "~10.1.3",
"eslint": "^9.21.0",
"http-server": "^14.1.1",
"jsdom": "^24.1.0",
"msw": "^2.3.4",
"nock": "^14.0.1",
"postcss": "^8.4.33",
"postcss-nesting": "^12.0.2",
"postcss-preset-env": "^9.3.0",
"prettier": "^3.2.5",
"prettier": "^3.5.2",
"typescript": "^5.7.3",
"vite": "^5.3.5",
"vite-plugin-dts": "^4.0.0-beta.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/browser-sdk/src/feature/featureCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class FeatureCache {
if (cachedResponseRaw) {
cacheData = validateCacheData(JSON.parse(cachedResponseRaw)) ?? {};
}
} catch (e) {
} catch {
// ignore errors
}

Expand Down Expand Up @@ -123,7 +123,7 @@ export class FeatureCache {
};
}
}
} catch (e) {
} catch {
// ignore errors
}
return;
Expand Down
2 changes: 1 addition & 1 deletion packages/browser-sdk/src/feature/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ export class FeaturesClient {
let errorBody = null;
try {
errorBody = await res.json();
} catch (e) {
} catch {
// ignore
}

Expand Down
2 changes: 1 addition & 1 deletion packages/browser-sdk/src/feedback/promptStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const getAuthToken = (userId: string) => {
channel,
token,
};
} catch (e) {
} catch {
return undefined;
}
};
Expand Down
8 changes: 4 additions & 4 deletions packages/browser-sdk/src/feedback/ui/Button.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
0 1px 1px 0 rgba(0, 0, 0, 0.01);
border-radius: var(--bucket-feedback-dialog-border-radius, 6px);
transition-duration: 200ms;
transition-property: background-color, border-color, color, opacity,
box-shadow, transform;
transition-property:
background-color, border-color, color, opacity, box-shadow, transform;

&.primary {
background-color: var(
Expand All @@ -40,8 +40,8 @@
border-color: var(--bucket-feedback-dialog-primary-border-color, #d8d9df);

transition-duration: 200ms;
transition-property: background-color, border-color, color, opacity,
box-shadow, transform;
transition-property:
background-color, border-color, color, opacity, box-shadow, transform;
}

&:focus {
Expand Down
37 changes: 18 additions & 19 deletions packages/browser-sdk/src/feedback/ui/FeedbackDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,20 @@ export const FeedbackDialog: FunctionComponent<FeedbackDialogProps> = ({
"idle" | "submitting" | "submitted"
>("idle");

const { isOpen, close } = useDialog({ onClose, initialValue: true });

const autoClose = useTimer({
enabled: position.type === "DIALOG",
initialDuration: INACTIVE_DURATION_MS,
onEnd: close,
});

const submit = useCallback(
async (data: Omit<FeedbackSubmission, "feedbackId">) => {
await onSubmit({ ...data, feedbackId });
autoClose.startWithDuration(SUCCESS_DURATION_MS);
},
[feedbackId, onSubmit],
[autoClose, feedbackId, onSubmit],
);

const submitScore = useCallback(
Expand All @@ -59,17 +67,8 @@ export const FeedbackDialog: FunctionComponent<FeedbackDialogProps> = ({
setScoreState("submitted");
}
},
[feedbackId, onSubmit],
[feedbackId, onScoreSubmit],
);

const { isOpen, close } = useDialog({ onClose, initialValue: true });

const autoClose = useTimer({
enabled: position.type === "DIALOG",
initialDuration: INACTIVE_DURATION_MS,
onEnd: close,
});

const dismiss = useCallback(() => {
autoClose.stop();
close();
Expand All @@ -78,25 +77,25 @@ export const FeedbackDialog: FunctionComponent<FeedbackDialogProps> = ({

return (
<>
<style dangerouslySetInnerHTML={{ __html: styles }}></style>
<style dangerouslySetInnerHTML={{ __html: styles }} />
<Dialog
isOpen={isOpen}
containerId={feedbackContainerId}
key={key}
position={position}
close={close}
containerId={feedbackContainerId}
isOpen={isOpen}
position={position}
onDismiss={onDismiss}
>
<>
<FeedbackForm
t={{ ...DEFAULT_TRANSLATIONS, ...translations }}
key={key}
question={title}
openWithCommentVisible={openWithCommentVisible}
onSubmit={submit}
onScoreSubmit={submitScore}
question={title}
scoreState={scoreState}
t={{ ...DEFAULT_TRANSLATIONS, ...translations }}
onInteraction={autoClose.stop}
onScoreSubmit={submitScore}
onSubmit={submit}
/>

<button class="close" onClick={dismiss}>
Expand Down
38 changes: 19 additions & 19 deletions packages/browser-sdk/src/feedback/ui/FeedbackForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,35 +153,35 @@ export const FeedbackForm: FunctionComponent<FeedbackFormProps> = ({
return (
<div ref={containerRef} class="container">
<div ref={submittedRef} class="submitted">
<div className="submitted-check">
<CheckCircle width={24} height={24} />
<div class="submitted-check">
<CheckCircle height={24} width={24} />
</div>
<p className="text">{t.SuccessMessage}</p>
<p class="text">{t.SuccessMessage}</p>
<Plug />
</div>
{showForm && (
<form
ref={formRef}
onSubmit={handleSubmit}
method="dialog"
class="form"
method="dialog"
style={{ opacity: 1 }}
onClick={onInteraction}
onFocus={onInteraction}
onFocusCapture={onInteraction}
onClick={onInteraction}
style={{ opacity: 1 }}
onSubmit={handleSubmit}
>
<div
ref={headerRef}
role="group"
class="form-control"
aria-labelledby="bucket-feedback-score-label"
class="form-control"
role="group"
>
<div id="bucket-feedback-score-label" class="title">
<div class="title" id="bucket-feedback-score-label">
{question}
</div>
<StarRating
t={t}
name="score"
t={t}
onChange={async (e) => {
setHasRating(true);
await onScoreSubmit({
Expand All @@ -191,14 +191,14 @@ export const FeedbackForm: FunctionComponent<FeedbackFormProps> = ({
}}
/>

<ScoreStatus t={t} scoreState={scoreState} />
<ScoreStatus scoreState={scoreState} t={t} />
</div>

<div ref={expandedContentRef} class="form-expanded-content">
<div class="form-control">
<textarea
id="bucket-feedback-comment-label"
class="textarea"
id="bucket-feedback-comment-label"
name="comment"
placeholder={t.QuestionPlaceholder}
rows={4}
Expand All @@ -208,12 +208,12 @@ export const FeedbackForm: FunctionComponent<FeedbackFormProps> = ({
{error && <p class="error">{error}</p>}

<Button
type="submit"
disabled={
!hasRating ||
status === "submitting" ||
scoreState === "submitting"
}
type="submit"
>
{t.SendButton}
</Button>
Expand Down Expand Up @@ -265,17 +265,17 @@ const ScoreStatus: FunctionComponent<{
const showSubmitted = scoreState === "submitted" || hasBeenSubmitted;

return (
<div className="score-status-container">
<span className="score-status" style={{ opacity: showIdle ? 1 : 0 }}>
<div class="score-status-container">
<span class="score-status" style={{ opacity: showIdle ? 1 : 0 }}>
{t.ScoreStatusDescription}
</span>

<div className="score-status" style={{ opacity: showLoading ? 1 : 0 }}>
<div class="score-status" style={{ opacity: showLoading ? 1 : 0 }}>
{t.ScoreStatusLoading}
</div>

<span className="score-status" style={{ opacity: showSubmitted ? 1 : 0 }}>
<Check width={14} height={14} style={{ marginRight: 3 }} />{" "}
<span class="score-status" style={{ opacity: showSubmitted ? 1 : 0 }}>
<Check height={14} style={{ marginRight: 3 }} width={14} />{" "}
{t.ScoreStatusReceived}
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/browser-sdk/src/feedback/ui/Plug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Logo } from "../../ui/icons/Logo";
export const Plug: FunctionComponent = () => {
return (
<footer class="plug">
<a href="https://bucket.co" target="_blank">
<a href="https://bucket.co" rel="noreferrer" target="_blank">
Powered by <Logo height="10px" width="10px" /> Bucket
</a>
</footer>
Expand Down
6 changes: 3 additions & 3 deletions packages/browser-sdk/src/feedback/ui/RadialProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ export const RadialProgress: FunctionComponent<{
const filled = circumference * progress;

return (
<svg className="radial-progress" width={diameter} height={diameter}>
<svg class="radial-progress" height={diameter} width={diameter}>
<circle
fill="transparent"
cx={radius + stroke}
cy={radius + stroke}
fill="transparent"
r={radius}
stroke-width={stroke}
stroke-dasharray={circumference}
stroke-dashoffset={filled}
stroke-width={stroke}
transform={`rotate(-90) translate(-${radius * 2 + stroke * 2} 0)`}
/>
</svg>
Expand Down
13 changes: 7 additions & 6 deletions packages/browser-sdk/src/feedback/ui/StarRating.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,12 @@ export const StarRating: FunctionComponent<StarRatingProps> = ({
<div class="star-rating-icons">
{scores.map((score) => (
<Score
key={score.value}
isSelected={score.value === selectedValue}
name={name}
onChange={onChange}
score={score}
t={t}
onChange={onChange}
/>
))}
</div>
Expand Down Expand Up @@ -134,19 +135,19 @@ const Score = ({
return (
<>
<input
defaultChecked={isSelected}
id={`bucket-feedback-score-${score.value}`}
type="radio"
name={name}
type="radio"
value={score.value}
defaultChecked={isSelected}
onChange={onChange}
/>
<label
ref={refs.setReference}
for={`bucket-feedback-score-${score.value}`}
aria-label={score.getLabel(t)}
class="button"
for={`bucket-feedback-score-${score.value}`}
style={{ color: score.color }}
aria-label={score.getLabel(t)}
>
<div
style={{
Expand Down Expand Up @@ -178,7 +179,7 @@ const Score = ({
? `${middlewareData.arrow.y}px`
: "",
}}
></div>
/>
</div>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/browser-sdk/src/feedback/ui/hooks/useTimer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const useTimer = ({
return () => {
clearTimeout(t);
};
}, [stopped]);
}, [duration, onEnd, startTime, stopped]);

const stop = useCallback(() => {
setStopped(true);
Expand Down
3 changes: 2 additions & 1 deletion packages/browser-sdk/src/toolbar/Features.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
width: 8px;
height: 8px;
margin-left: 10px;
background: linear-gradient(
background:
linear-gradient(
45deg,
rgba(0, 0, 0, 0) 0%,
rgba(0, 0, 0, 0) 43%,
Expand Down
Loading