gramene-search 1.7.26 → 2.0.0

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.
Binary file
Binary file
@@ -1,2 +1,2 @@
1
- 299010731
2
- 1777055997815079000
1
+ 299077950
2
+ 1777056892357556000
package/dist/index.js CHANGED
@@ -217,6 +217,7 @@ $parcel$export(module.exports, "Status", () => $693dd8c7a5607c3a$export$96e9906d
217
217
  $parcel$export(module.exports, "Filters", () => $693dd8c7a5607c3a$export$92a576f896a9bf72);
218
218
  $parcel$export(module.exports, "Results", () => $693dd8c7a5607c3a$export$4a34de49b46a2bfa);
219
219
  $parcel$export(module.exports, "Views", () => $693dd8c7a5607c3a$export$5cb791131c501f6a);
220
+ $parcel$export(module.exports, "Auth", () => $c5d403787de8b05f$export$2e2bcd8739ae039);
220
221
 
221
222
 
222
223
 
@@ -1528,7 +1529,9 @@ const $24971af0a229e0e3$var$grameneViews = {
1528
1529
  'list'
1529
1530
  ]);
1530
1531
  const autoDisable = numFound === 0 || !hasFilters;
1532
+ const hasFirebase = !!(config && config.firebaseConfig);
1531
1533
  let options = raw.options;
1534
+ if (!hasFirebase) options = options.filter((v)=>v.id !== 'userLists');
1532
1535
  if (overrides) options = options.filter((v)=>overrides[v.id] !== 'hidden');
1533
1536
  options = options.map((v)=>{
1534
1537
  if (autoDisable && resultDependentIds.has(v.id)) return {
@@ -4528,15 +4531,12 @@ const $5c2c79352d3d7b81$export$b2e089eb3692b073 = (props)=>/*#__PURE__*/ (0, $gX
4528
4531
 
4529
4532
 
4530
4533
 
4531
- const $047461923b1badda$var$firebaseConfig = {
4532
- apiKey: "AIzaSyCyTJmxfWgfuhI6-8uqocSiE9KOWUlkgkk",
4533
- authDomain: "gramene-auth.firebaseapp.com",
4534
- projectId: "gramene-auth",
4535
- storageBucket: "gramene-auth.appspot.com",
4536
- messagingSenderId: "590873346270",
4537
- appId: "1:590873346270:web:f76a31a93619e69439824f"
4534
+ const $047461923b1badda$export$54387eca9e368edc = (config)=>{
4535
+ if (!config) return null;
4536
+ const name = config.projectId || '[DEFAULT]';
4537
+ if ((0, $gXNCa$firebaseapp.getApps)().some((a)=>a.name === name)) return (0, $gXNCa$firebaseapp.getApp)(name);
4538
+ return (0, $gXNCa$firebaseapp.initializeApp)(config, name);
4538
4539
  };
4539
- const $047461923b1badda$export$a4e2c8f07e884e = (0, $gXNCa$firebaseapp.initializeApp)($047461923b1badda$var$firebaseConfig);
4540
4540
  const $047461923b1badda$export$964d88edb00bbcaa = (suggestion)=>{
4541
4541
  return {
4542
4542
  status: 'init',
@@ -8564,7 +8564,6 @@ var $261baeb81c4d4d8a$export$2e2bcd8739ae039 = (0, $gXNCa$reduxbundlerreact.conn
8564
8564
 
8565
8565
 
8566
8566
 
8567
- const $0f50f369018a42ef$var$auth = (0, $gXNCa$firebaseauth.getAuth)((0, $047461923b1badda$export$a4e2c8f07e884e));
8568
8567
  const $0f50f369018a42ef$var$MAX_GENE_IDS = 1000; // Define the maximum number of gene IDs allowed
8569
8568
  const $0f50f369018a42ef$var$formatCreatedAt = (value)=>{
8570
8569
  if (!value) return '';
@@ -8635,7 +8634,8 @@ const $0f50f369018a42ef$var$GeneListDisplayComponent = (props)=>{
8635
8634
  key: 'createdAt',
8636
8635
  dir: 'desc'
8637
8636
  });
8638
- (0, $gXNCa$firebaseauth.onAuthStateChanged)($0f50f369018a42ef$var$auth, (user)=>setUser(user));
8637
+ const auth = props.auth;
8638
+ if (auth) (0, $gXNCa$firebaseauth.onAuthStateChanged)(auth, (user)=>setUser(user));
8639
8639
  const toggleSort = (key)=>setSort((s)=>s.key === key ? {
8640
8640
  key: key,
8641
8641
  dir: s.dir === 'asc' ? 'desc' : 'asc'
@@ -8661,6 +8661,12 @@ const $0f50f369018a42ef$var$GeneListDisplayComponent = (props)=>{
8661
8661
  sort
8662
8662
  ]);
8663
8663
  const fetchPrivateGeneLists = async ()=>{
8664
+ if (!auth) {
8665
+ setPrivateGeneLists([]);
8666
+ setError(null);
8667
+ setNotice(null);
8668
+ return;
8669
+ }
8664
8670
  if (!user || typeof user.getIdToken !== 'function') {
8665
8671
  setPrivateGeneLists([]);
8666
8672
  setError(null);
@@ -9013,7 +9019,8 @@ const $0f50f369018a42ef$var$GeneListComponent = (props)=>{
9013
9019
  const [errorMessage, setErrorMessage] = (0, $gXNCa$react.useState)('');
9014
9020
  const [loading, setLoading] = (0, $gXNCa$react.useState)(false); // New loading state
9015
9021
  const [user, setUser] = (0, $gXNCa$react.useState)({});
9016
- (0, $gXNCa$firebaseauth.onAuthStateChanged)($0f50f369018a42ef$var$auth, (user)=>setUser(user));
9022
+ const auth = props.auth;
9023
+ if (auth) (0, $gXNCa$firebaseauth.onAuthStateChanged)(auth, (user)=>setUser(user));
9017
9024
  // Function to handle gene list input
9018
9025
  const handleGeneListChange = (event)=>{
9019
9026
  setGeneList(event.target.value);
@@ -9226,6 +9233,17 @@ const $0f50f369018a42ef$var$GeneListComponent = (props)=>{
9226
9233
  const $0f50f369018a42ef$var$UserGeneListsComponent = (props)=>{
9227
9234
  const [refreshKey, setRefreshKey] = (0, $gXNCa$react.useState)(0);
9228
9235
  const handleListSaved = ()=>setRefreshKey((k)=>k + 1);
9236
+ const firebaseConfig = props.configuration && props.configuration.firebaseConfig;
9237
+ const auth = (0, $gXNCa$react.useMemo)(()=>{
9238
+ const app = (0, $047461923b1badda$export$54387eca9e368edc)(firebaseConfig);
9239
+ return app ? (0, $gXNCa$firebaseauth.getAuth)(app) : null;
9240
+ }, [
9241
+ firebaseConfig
9242
+ ]);
9243
+ if (!auth) return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Alert), {
9244
+ variant: "info",
9245
+ children: "User gene lists are not available on this site."
9246
+ });
9229
9247
  return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Container), {
9230
9248
  fluid: true,
9231
9249
  children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactbootstrap.Row), {
@@ -9234,6 +9252,7 @@ const $0f50f369018a42ef$var$UserGeneListsComponent = (props)=>{
9234
9252
  children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)($0f50f369018a42ef$var$GeneListComponent, {
9235
9253
  api: props.configuration.grameneData,
9236
9254
  site: props.configuration.id,
9255
+ auth: auth,
9237
9256
  onListSaved: handleListSaved
9238
9257
  })
9239
9258
  }),
@@ -9241,6 +9260,7 @@ const $0f50f369018a42ef$var$UserGeneListsComponent = (props)=>{
9241
9260
  children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)($0f50f369018a42ef$var$GeneListDisplayComponent, {
9242
9261
  api: props.configuration.grameneData,
9243
9262
  site: props.configuration.id,
9263
+ auth: auth,
9244
9264
  addFilter: props.doAcceptGrameneSuggestion,
9245
9265
  refreshKey: refreshKey
9246
9266
  })
@@ -10187,26 +10207,33 @@ var $37b3bb0145d266b0$export$2e2bcd8739ae039 = (0, $gXNCa$reduxbundlerreact.conn
10187
10207
 
10188
10208
 
10189
10209
 
10190
- const $c5d403787de8b05f$var$auth = (0, $gXNCa$firebaseauth.getAuth)((0, $047461923b1badda$export$a4e2c8f07e884e));
10191
10210
  const $c5d403787de8b05f$var$provider = new (0, $gXNCa$firebaseauth.GoogleAuthProvider)();
10192
10211
  const $c5d403787de8b05f$var$Auth = (props)=>{
10212
+ const firebaseConfig = props.configuration && props.configuration.firebaseConfig;
10213
+ const auth = (0, $gXNCa$react.useMemo)(()=>{
10214
+ const app = (0, $047461923b1badda$export$54387eca9e368edc)(firebaseConfig);
10215
+ return app ? (0, $gXNCa$firebaseauth.getAuth)(app) : null;
10216
+ }, [
10217
+ firebaseConfig
10218
+ ]);
10193
10219
  const [user, setUser] = (0, $gXNCa$react.useState)({});
10194
- (0, $gXNCa$firebaseauth.onAuthStateChanged)($c5d403787de8b05f$var$auth, (user)=>setUser(user));
10220
+ const [open, setOpen] = (0, $gXNCa$react.useState)(true);
10221
+ if (!auth) return null;
10222
+ (0, $gXNCa$firebaseauth.onAuthStateChanged)(auth, (user)=>setUser(user));
10195
10223
  function handleLogin() {
10196
- (0, $gXNCa$firebaseauth.signInWithPopup)($c5d403787de8b05f$var$auth, $c5d403787de8b05f$var$provider).then((result)=>{
10224
+ (0, $gXNCa$firebaseauth.signInWithPopup)(auth, $c5d403787de8b05f$var$provider).then((result)=>{
10197
10225
  setUser(result.user);
10198
10226
  }).catch((err)=>{
10199
10227
  console.log(err);
10200
10228
  });
10201
10229
  }
10202
10230
  function handleLogout() {
10203
- (0, $gXNCa$firebaseauth.signOut)($c5d403787de8b05f$var$auth).then(()=>{
10231
+ (0, $gXNCa$firebaseauth.signOut)(auth).then(()=>{
10204
10232
  setUser(null);
10205
10233
  }).catch((err)=>{
10206
10234
  console.log(err);
10207
10235
  });
10208
10236
  }
10209
- const [open, setOpen] = (0, $gXNCa$react.useState)(true);
10210
10237
  return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("div", {
10211
10238
  className: props.configuration.id === 'sorghum' ? 'sorghumbase-auth-container' : 'gramene-auth-container',
10212
10239
  children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {