A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
fix: compare native percentage bonuses and document API units
Amruth Pillai65d1211ca1b2
diff --git a/apps/mobile/scripts/power-user-repairs.test.mjs b/apps/mobile/scripts/power-user-repairs.test.mjsindex 8b0113098..d0f955f30 100644--- a/apps/mobile/scripts/power-user-repairs.test.mjs+++ b/apps/mobile/scripts/power-user-repairs.test.mjs@@ -326,6 +326,36 @@ assert.deepEqual(calls.find((call) => call?.offerParams)?.offerParams, {highlight: "retained",});assert.equal(selection.useSavedOffer.getState().accounts[selectionScope], undefined);+for (const [otherTerms, note] of [+ [{ ...retainedTerms, variablePercent: 5 }, "€5,000 more"],+ [{ ...retainedTerms, variable: 15000 }, "€5,000 less"],+ [{ ...retainedTerms, currency: "USD", variablePercent: 5 }, null],+ [{ ...retainedTerms, period: "month", variablePercent: 5 }, null],+ [{ ...retainedTerms, base: null, variablePercent: 5 }, null],+]) {+ reset();+ saved.data = [+ { ...saved.data[0], id: "percentage", data: { ...retainedTerms, variablePercent: 10 } },+ { ...saved.data[0], id: "comparison", applicationId: "other-job", data: otherTerms },+ ];+ const compared = expand(render(OffersScreen));+ const values = nodes(compared)+ .filter((node) => node.type === "Text")+ .flatMap((node) => node.props.children);+ const bonus = values.find((value) => typeof value === "string" && value.startsWith("10% of base"));+ assert.ok(bonus?.includes("€10,000"), "percentage stays visible alongside its amount");+ if (note) assert.ok(bonus.includes(note), "native percentage bonus retains its money-difference note");+ else assert.ok(!/more|less/.test(bonus), "incomparable or unknown bonus has no difference note");+}+reset();+saved.data[0].data = { ...retainedTerms, base: null, variablePercent: 10 };+const unknownBase = nodes(expand(render(OffersScreen)))+ .filter((node) => node.type === "Text")+ .flatMap((node) => node.props.children);+assert.ok(+ unknownBase.some((value) => value === "10% of base"),+ "unknown base preserves the entered bonus rate",+);saved.data = [];console.log("PASS native Offers loading/error/retry/persisted row and genuine-empty controls");diff --git a/apps/mobile/src/features/career/offers.tsx b/apps/mobile/src/features/career/offers.tsxindex 76be4dffe..972ed66f2 100644--- a/apps/mobile/src/features/career/offers.tsx+++ b/apps/mobile/src/features/career/offers.tsx@@ -240,7 +240,8 @@ function OfferCard({ offer, highlight, other, profile, onEdit, onDelete }: Offer: null;const money = (key: "base" | "variable" | "learning") => {const amount = key === "variable" ? bonusAmount(data) : data[key];- if (amount === null) return unknown;+ if (amount === null)+ return key === "variable" && data.variablePercent != null ? formatBonus(time.locale, data) : unknown;const difference = other ? moneyDifference(data, other.data, key) : null;const delta =difference === null@@ -255,7 +256,13 @@ function OfferCard({ offer, highlight, other, profile, onEdit, onDelete }: Offer: difference > 0? t`${formatMoney(time.locale, data.currency, difference)} more`: t`${formatMoney(time.locale, data.currency, -difference)} less`;- return [formatMoney(time.locale, data.currency, amount), periodLabel(data.period), note]+ return [+ key === "variable" && data.variablePercent != null+ ? formatBonus(time.locale, data)+ : formatMoney(time.locale, data.currency, amount),+ periodLabel(data.period),+ note,+ ].filter(Boolean).join(" · ");};@@ -271,11 +278,9 @@ function OfferCard({ offer, highlight, other, profile, onEdit, onDelete }: Offerlabel: t`Bonus`,// Old free-text conditions stay as written; only explicit percentage fields are calculated.value:- data.variablePercent != null- ? formatBonus(time.locale, data)- : data.variable === null && data.variableConditions- ? t`${data.variableConditions} · No amount stated · value uncertain`- : money("variable"),+ data.variablePercent == null && data.variable === null && data.variableConditions+ ? t`${data.variableConditions} · No amount stated · value uncertain`+ : money("variable"),},{ label: t`Bonus conditions`, value: data.variableConditions || unknown },{ label: t`Equity`, value: data.equity ? t`${data.equity} · Value uncertain` : unknown },diff --git a/docs/spec.json b/docs/spec.jsonindex 917641bde..6db46c746 100644--- a/docs/spec.json+++ b/docs/spec.json@@ -45634,7 +45634,8 @@{"type": "null"}- ]+ ],+ "description": "Percentage points of base: 10 means 10% of base in its currency and pay period. Set variable to null."},"variableConditions": {"type": "string",@@ -45991,7 +45992,8 @@{"type": "null"}- ]+ ],+ "description": "Percentage points of base: 10 means 10% of base in its currency and pay period. Set variable to null."},"variableConditions": {"type": "string",@@ -53436,7 +53438,8 @@{"type": "null"}- ]+ ],+ "description": "Percentage points of base: 10 means 10% of base in its currency and pay period. Set variable to null."},"variableConditions": {"type": "string",@@ -53793,7 +53796,8 @@{"type": "null"}- ]+ ],+ "description": "Percentage points of base: 10 means 10% of base in its currency and pay period. Set variable to null."},"variableConditions": {"type": "string",@@ -54112,7 +54116,8 @@{"type": "null"}- ]+ ],+ "description": "Percentage points of base: 10 means 10% of base in its currency and pay period. Set variable to null."},"variableConditions": {"type": "string",@@ -54903,7 +54908,8 @@{"type": "null"}- ]+ ],+ "description": "Percentage points of base: 10 means 10% of base in its currency and pay period. Set variable to null."},"variableConditions": {"type": "string",@@ -55260,7 +55266,8 @@{"type": "null"}- ]+ ],+ "description": "Percentage points of base: 10 means 10% of base in its currency and pay period. Set variable to null."},"variableConditions": {"type": "string",@@ -55547,7 +55554,8 @@{"type": "null"}- ]+ ],+ "description": "Percentage points of base: 10 means 10% of base in its currency and pay period. Set variable to null."},"variableConditions": {"type": "string",@@ -55685,7 +55693,8 @@{"type": "null"}- ]+ ],+ "description": "Percentage points of base: 10 means 10% of base in its currency and pay period. Set variable to null."},"variableConditions": {"type": "string",@@ -56482,7 +56491,8 @@{"type": "null"}- ]+ ],+ "description": "Percentage points of base: 10 means 10% of base in its currency and pay period. Set variable to null."},"variableConditions": {"type": "string",@@ -56839,7 +56849,8 @@{"type": "null"}- ]+ ],+ "description": "Percentage points of base: 10 means 10% of base in its currency and pay period. Set variable to null."},"variableConditions": {"type": "string",@@ -58024,7 +58035,8 @@{"type": "null"}- ]+ ],+ "description": "Percentage points of base: 10 means 10% of base in its currency and pay period. Set variable to null."},"variableConditions": {"type": "string",@@ -58381,7 +58393,8 @@{"type": "null"}- ]+ ],+ "description": "Percentage points of base: 10 means 10% of base in its currency and pay period. Set variable to null."},"variableConditions": {"type": "string",diff --git a/packages/schema/src/career.ts b/packages/schema/src/career.tsindex 59362fa52..d4bc1c24b 100644--- a/packages/schema/src/career.ts+++ b/packages/schema/src/career.ts@@ -130,7 +130,14 @@ export const offerTermsSchema = zbase: z.number().nonnegative().nullable(),variable: z.number().nonnegative().nullable(),/** Percentage of base, in the base currency and pay period. Older amount records omit this. */- variablePercent: z.number().nonnegative().nullable().optional(),+ variablePercent: z+ .number()+ .nonnegative()+ .nullable()+ .optional()+ .describe(+ "Percentage points of base: 10 means 10% of base in its currency and pay period. Set variable to null.",+ ),/** What the bonus depends on, or "" when unconditional or unknown. */variableConditions: z.string().max(1000).default(""),equity: z.string().max(1000).default(""),