@burdenoff/website-sdk 2026.817.2 → 2026.824.2

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/dist/index.js CHANGED
@@ -1185,16 +1185,38 @@ var PUBLIC_CONTENT_PAGES_QUERY = `
1185
1185
  }
1186
1186
  }
1187
1187
  `;
1188
+ function resolveContentPageGate(resolvedProductId, hasProvider, productLoading) {
1189
+ if (resolvedProductId) return "fetch";
1190
+ return hasProvider && productLoading ? "wait" : "unavailable";
1191
+ }
1188
1192
  function useContentPage(slug, options) {
1189
1193
  const client = useWebSDK();
1190
1194
  const config = useWebSDKConfig();
1191
- const { product } = useProduct();
1195
+ const {
1196
+ product,
1197
+ loading: productLoading,
1198
+ error: productError,
1199
+ hasProvider
1200
+ } = useProduct();
1192
1201
  const resolvedProductId = product?.id || config.productId;
1202
+ const gate = resolveContentPageGate(
1203
+ resolvedProductId,
1204
+ hasProvider,
1205
+ productLoading
1206
+ );
1193
1207
  const [data, setData] = React.useState(null);
1194
1208
  const [loading, setLoading] = React.useState(true);
1195
1209
  const [error, setError] = React.useState(null);
1196
1210
  const fetchPage = React.useCallback(async () => {
1197
- if (!resolvedProductId) return;
1211
+ if (gate === "wait") return;
1212
+ if (gate === "unavailable") {
1213
+ setData(null);
1214
+ setError(
1215
+ productError ?? "Product unavailable \u2014 cannot load content page"
1216
+ );
1217
+ setLoading(false);
1218
+ return;
1219
+ }
1198
1220
  setLoading(true);
1199
1221
  setError(null);
1200
1222
  try {
@@ -1219,7 +1241,7 @@ function useContentPage(slug, options) {
1219
1241
  } finally {
1220
1242
  setLoading(false);
1221
1243
  }
1222
- }, [client, resolvedProductId, slug, options?.resolve]);
1244
+ }, [client, gate, productError, resolvedProductId, slug, options?.resolve]);
1223
1245
  React.useEffect(() => {
1224
1246
  fetchPage();
1225
1247
  }, [fetchPage]);
@@ -2057,6 +2079,7 @@ var NO_APPLICATION_HINT = "Please use the same email address you applied with \u
2057
2079
  function isNoApplicationError(message) {
2058
2080
  return /no application|not found/i.test(message);
2059
2081
  }
2082
+ var OTHER_POSITION = "__other__";
2060
2083
  function CareersSubmissionForm({
2061
2084
  productName,
2062
2085
  recaptchaSiteKey,
@@ -2076,6 +2099,9 @@ function CareersSubmissionForm({
2076
2099
  const [isSubmitting, setIsSubmitting] = React.useState(false);
2077
2100
  const [submittedMessage, setSubmittedMessage] = React.useState(null);
2078
2101
  const [formError, setFormError] = React.useState(null);
2102
+ const [useFreeTextPosition, setUseFreeTextPosition] = React.useState(
2103
+ postings.length === 0
2104
+ );
2079
2105
  const handleSubmit = async (e) => {
2080
2106
  e.preventDefault();
2081
2107
  setFormError(null);
@@ -2092,7 +2118,7 @@ function CareersSubmissionForm({
2092
2118
  const repoUrl = (formData.get("repoUrl") ?? "").trim();
2093
2119
  const videoUrl = (formData.get("videoUrl") ?? "").trim();
2094
2120
  const notes = (formData.get("notes") ?? "").trim();
2095
- const selectedPosting = postings.length > 0 ? postings.find((p) => p.id === positionValue) : void 0;
2121
+ const selectedPosting = postings.length > 0 && !useFreeTextPosition ? postings.find((p) => p.id === positionValue) : void 0;
2096
2122
  const position = selectedPosting ? selectedPosting.title : positionValue;
2097
2123
  if (!email) {
2098
2124
  setFormError("Please enter the email address you applied with.");
@@ -2192,28 +2218,53 @@ function CareersSubmissionForm({
2192
2218
  ] }),
2193
2219
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2194
2220
  /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "position", children: "Position *" }),
2195
- postings.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
2196
- "select",
2197
- {
2198
- id: "position",
2199
- name: "position",
2200
- required: true,
2201
- defaultValue: "",
2202
- className: "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring",
2203
- children: [
2204
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: true, children: "Select a role" }),
2205
- postings.map((p) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: p.id, children: p.title }, p.id))
2206
- ]
2207
- }
2208
- ) : /* @__PURE__ */ jsxRuntime.jsx(
2209
- Input,
2210
- {
2211
- id: "position",
2212
- name: "position",
2213
- required: true,
2214
- placeholder: "Role you applied for"
2215
- }
2216
- )
2221
+ postings.length > 0 && !useFreeTextPosition ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2222
+ /* @__PURE__ */ jsxRuntime.jsxs(
2223
+ "select",
2224
+ {
2225
+ id: "position",
2226
+ name: "position",
2227
+ required: true,
2228
+ defaultValue: "",
2229
+ onChange: (e) => {
2230
+ if (e.target.value === OTHER_POSITION) {
2231
+ setUseFreeTextPosition(true);
2232
+ }
2233
+ },
2234
+ className: "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring",
2235
+ children: [
2236
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: true, children: "Select a role" }),
2237
+ postings.map((p) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: p.id, children: p.title }, p.id)),
2238
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: OTHER_POSITION, children: "My role isn't listed" })
2239
+ ]
2240
+ }
2241
+ ),
2242
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: [
2243
+ "Applied to a role that's since closed? Choose",
2244
+ " ",
2245
+ /* @__PURE__ */ jsxRuntime.jsx("em", { children: "My role isn't listed" }),
2246
+ " and type it in \u2014 you can still submit."
2247
+ ] })
2248
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2249
+ /* @__PURE__ */ jsxRuntime.jsx(
2250
+ Input,
2251
+ {
2252
+ id: "position",
2253
+ name: "position",
2254
+ required: true,
2255
+ placeholder: "Role you applied for"
2256
+ }
2257
+ ),
2258
+ postings.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
2259
+ "button",
2260
+ {
2261
+ type: "button",
2262
+ onClick: () => setUseFreeTextPosition(false),
2263
+ className: "mt-1 text-xs text-accent hover:underline",
2264
+ children: "Choose from open roles instead"
2265
+ }
2266
+ )
2267
+ ] })
2217
2268
  ] }),
2218
2269
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2219
2270
  /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "repoUrl", children: "GitHub repository URL *" }),
@@ -4759,6 +4810,25 @@ var PUBLIC_JOB_POSTING_QUERY = (
4759
4810
  }
4760
4811
  `
4761
4812
  );
4813
+ var PUBLIC_JOB_POSTINGS_FOR_SUBMISSION_QUERY = (
4814
+ /* GraphQL */
4815
+ `
4816
+ query PublicJobPostingsForSubmission(
4817
+ $productId: ID
4818
+ $limit: Int
4819
+ $offset: Int
4820
+ ) {
4821
+ publicJobPostingsForSubmission(
4822
+ productId: $productId
4823
+ limit: $limit
4824
+ offset: $offset
4825
+ ) {
4826
+ id
4827
+ title
4828
+ }
4829
+ }
4830
+ `
4831
+ );
4762
4832
  async function fetchPublicJobPostings(client, options) {
4763
4833
  const result = await client.query(PUBLIC_JOB_POSTINGS_QUERY, {
4764
4834
  productId: options?.productId,
@@ -4780,6 +4850,17 @@ async function fetchPublicJobPosting(client, slug, options) {
4780
4850
  }
4781
4851
  return result.data?.publicJobPosting ?? null;
4782
4852
  }
4853
+ async function fetchPublicJobPostingsForSubmission(client, options) {
4854
+ const result = await client.query(PUBLIC_JOB_POSTINGS_FOR_SUBMISSION_QUERY, {
4855
+ productId: options?.productId,
4856
+ limit: options?.limit ?? 50,
4857
+ offset: options?.offset ?? 0
4858
+ });
4859
+ if (result.errors?.length) {
4860
+ throw new Error(result.errors[0]?.message ?? "Unknown error");
4861
+ }
4862
+ return result.data?.publicJobPostingsForSubmission ?? [];
4863
+ }
4783
4864
  function usePublicJobPostings(options) {
4784
4865
  const client = useWebSDK();
4785
4866
  const config = useWebSDKConfig();
@@ -4812,6 +4893,38 @@ function usePublicJobPostings(options) {
4812
4893
  }, [fetchPostings]);
4813
4894
  return { postings, loading, error, refetch: fetchPostings };
4814
4895
  }
4896
+ function usePublicJobPostingsForSubmission(options) {
4897
+ const client = useWebSDK();
4898
+ const config = useWebSDKConfig();
4899
+ const { product } = useProduct();
4900
+ const resolvedProductId = options?.productId ?? product?.id ?? config.productId;
4901
+ const [postings, setPostings] = React.useState([]);
4902
+ const [loading, setLoading] = React.useState(true);
4903
+ const [error, setError] = React.useState(null);
4904
+ const fetchPostings = React.useCallback(async () => {
4905
+ setLoading(true);
4906
+ setError(null);
4907
+ try {
4908
+ const items = await fetchPublicJobPostingsForSubmission(client, {
4909
+ productId: resolvedProductId,
4910
+ limit: options?.limit,
4911
+ offset: options?.offset
4912
+ });
4913
+ setPostings(items);
4914
+ } catch (err) {
4915
+ setError(
4916
+ err instanceof Error ? err.message : "Failed to fetch job postings"
4917
+ );
4918
+ setPostings([]);
4919
+ } finally {
4920
+ setLoading(false);
4921
+ }
4922
+ }, [client, resolvedProductId, options?.limit, options?.offset]);
4923
+ React.useEffect(() => {
4924
+ fetchPostings();
4925
+ }, [fetchPostings]);
4926
+ return { postings, loading, error, refetch: fetchPostings };
4927
+ }
4815
4928
  function usePublicJobPosting(slug, options) {
4816
4929
  const client = useWebSDK();
4817
4930
  const config = useWebSDKConfig();
@@ -9590,6 +9703,7 @@ exports.cn = cn;
9590
9703
  exports.detectElectronPlatform = detectElectronPlatform;
9591
9704
  exports.fetchPublicJobPosting = fetchPublicJobPosting;
9592
9705
  exports.fetchPublicJobPostings = fetchPublicJobPostings;
9706
+ exports.fetchPublicJobPostingsForSubmission = fetchPublicJobPostingsForSubmission;
9593
9707
  exports.formatDownloads = formatDownloads;
9594
9708
  exports.formatPrice = formatPrice2;
9595
9709
  exports.isValidUrl = isValidUrl;
@@ -9599,6 +9713,7 @@ exports.useProduct = useProduct;
9599
9713
  exports.useProductConfig = useProductConfig;
9600
9714
  exports.usePublicJobPosting = usePublicJobPosting;
9601
9715
  exports.usePublicJobPostings = usePublicJobPostings;
9716
+ exports.usePublicJobPostingsForSubmission = usePublicJobPostingsForSubmission;
9602
9717
  exports.useWebSDK = useWebSDK;
9603
9718
  exports.useWebSDKConfig = useWebSDKConfig;
9604
9719
  //# sourceMappingURL=index.js.map