PageSourceSearch

https://60daystartups.notion.site/_assets/AddColumnContainerAIPropertySuggestion-0b88782bbeb8fa5b.js

js 60daystartups.notion.site collected 2026-10-09 21:43:06 UTC 8,224 bytes, 1 lines download raw bytes

1"use strict";(globalThis.rspackChunknotion_next=globalThis.rspackChunknotion_next||[]).push([[18427],{189451(e,t,o){o.r(t),o(499468),o(586042),o(169187),o(726090),o(132457),o(219390),o(73168),o(730330),o(139583);var i=o(635790),n=o(440302);let r={style0:{width:"fit-content",fontSize:o(139424).A.isMobile?"16px":"14px"}},s=i.memo(function(e){let{collectionContextStore:t,onSuggestionChange:s}=e,l=(0,o(533992).v3)(),a=(0,o(533992).Y0)(),g=(0,o(579993).O$)(t.normalizedSchemaStore),u=(0,o(579993).O$)(t.userAddedPropertyStore),c=(0,i.useMemo)(()=>Object.keys(g).length>1,[g]),[p,d]=(0,i.useState)(!1),[y,_]=(0,i.useState)(0),[b,m]=(0,i.useState)({suggestionProperty:void 0,suggestionType:void 0,collectionStoreId:void 0,collectionViewStoreId:void 0}),f=(0,o(579993).K8)(()=>o(218744).default.getConfigKey("adoption_database_newbie_create_property_inline_suggestion","ai_property_suggestion"),[]),S=(0,o(579993).K8)(()=>{let e=t.collectionStore(),i=null==e?void 0:e.getNameStore();return i&&e?(0,o(536614).r4)(i.getValue(),e):""},[t]),v=(0,i.useRef)(!1),E=(0,o(84235).Y)(async()=>{await (0,o(106718).j)({collectionContextStore:t,collectionNameText:S,environment:l,device:a,setDatabasePropertySuggestion:m,cancelled:v,aiPropertySuggestionConfig:f,userLifecycleProfileStore:o(529119).k,recentEventsStore:o(309479).a})},f.debounce_fetch_suggestion_delay_ms);(0,i.useEffect)(()=>(S.trim()?(v.current=!1,E()):m({suggestionProperty:void 0,suggestionType:void 0,collectionStoreId:void 0,collectionViewStoreId:void 0}),()=>{v.current=!0}),[S,E]);let h=f.max_ai_property_suggestions_to_display;(0,i.useEffect)(()=>{null==s||s({suggestionProperty:b.suggestionProperty,suggestionType:b.suggestionType,collectionStoreId:b.collectionStoreId})},[b.suggestionProperty,b.suggestionType,b.collectionStoreId,s]);let I=(0,i.useCallback)(()=>{let e=t.collectionStore();if(!e)return;let i=b.suggestionProperty;if(!i)return;(0,o(408441).trackDatabaseEntrypointCta)({environment:l,feature:"create_property",action:"click",from:"database_add_property_suggestion_inline_button"});let n=e.getSpaceId();if((0,o(323517).createAndCommit)({userAction:"create_ai_suggested_database_property",environment:l,canUndo:!0,cellTarget:n?{spaceWithId:n}:void 0,perform:t=>(0,o(567879).createProperty)({environment:l,collectionStore:e,collectionViewArgs:void 0,propertyType:i.type,propertySchema:i,transaction:t})}),"multiple_suggestions"===b.suggestionType&&b.allSuggestions){let e=b.allSuggestions,t=b.usedSuggestionIndices||new Set,o=e.findIndex(e=>e.name===i.name&&e.type===i.type);if(-1!==o){let i=new Set(t);i.add(o);let n=e.find((e,t)=>!i.has(t));m(e=>({...e,usedSuggestionIndices:i,suggestionProperty:n})),_(e=>e+1)}}else d(!0),null==s||s(null)},[t,l,b,s]),w="multiple_suggestions"===b.suggestionType,T=b.suggestionProperty,x=(0,i.useMemo)(()=>!!T&&"control"!==b.suggestionType&&!u&&("single_suggestion"===b.suggestionType?!p:"multiple_suggestions"===b.suggestionType&&y<(h??1)),[T,b.suggestionType,p,u,y,h]);return((0,i.useEffect)(()=>{if(x&&T)try{(0,o(408441).trackDatabaseEntrypointCta)({environment:l,feature:"create_property",action:"view",from:"database_add_property_suggestion_inline_button"})}catch(e){}},[x,T,l,b.suggestionType]),x&&(!c||w))?(0,n.jsx)(o(988022).p,{testId:"add-column-ai-suggestion-button",style:r.style0,onMouseDown:o(890460).tr,iconLeading:{icon:o(581923).plusIcon,size:"default"},onClick:I,colorPalette:"gray",children:(0,n.jsx)(o(327219).sA,{defaultMessage:"Add {propertyName}",id:"collectionTable.addColumnContainer.inlineAddProperty",values:{propertyName:(null==T?void 0:T.name)??""}})}):null});o.d(t,{},{AddColumnContainerAIPropertySuggestion:s})},686811(e,t,o){function i(e){return!!e.analyticsEventCounts&&(0,o(543346).H0)({...e,configKey:"databaseNewbie"})}function n(e){return!!e.analyticsEventCounts&&(0,o(543346).H0)({...e,configKey:"databaseViewNewbie"})}o.d(t,{X:()=>n,k:()=>i})},408441(e,t,o){function i(e){let{environment:t,...i}=e;(0,o(104310).u)({event:{eventName:"database_entrypoint_cta",eventProperties:i}})}o.r(t),o.d(t,{trackDatabaseEntrypointCta:()=>i})},106718(e,t,o){o.d(t,{j:()=>n}),o(533958),o(499468),o(586042),o(169187),o(726090),o(132457),o(219390),o(73168),o(730330),o(976614);
1let i={name:"Status",type:"status",options:[{id:"not-started",value:"Not started",color:"gray"},{id:"in-progress",value:"In progress",color:"yellow"},{id:"done",value:"Done",color:"green"}],exampleValues:["Not started","In progress","Done"]};async function n(e){let{collectionContextStore:t,collectionNameText:n,environment:s,device:l,setDatabasePropertySuggestion:a,cancelled:g,aiPropertySuggestionConfig:u,userLifecycleProfileStore:c,recentEventsStore:p}=e,d=t.collectionSuggestionStore;try{var y;let e=o(218744).default;if(g.current||!e.checkGate({gateName:"adoption_enable_ai_property_suggestion"}))return;let _=t.collectionStore(),b=t.collectionViewStore();if(!_||!b)return;let m=_.id,f=b.id,S=(0,o(904434).R$)(s),v=o(886556).z.isAiEnabled(),E=(0,o(543346).cz)({userLifecycleProfileStore:c,recentEventsStore:p}),h=c.getProfile(),I=(0,o(686811).k)({environment:s,analyticsEventCounts:E,lifecycleProfile:h}),w=e.getEligibleGroup({experimentId:"adoption_database_newbie_create_property_inline_suggestion",defaultGroup:"control",disableExposureLogging:!1}),T=e.getEligibleGroup({experimentId:"database_newbie_ai_property_preview",defaultGroup:"control",disableExposureLogging:!1});if(t.collectionSuggestionStore.setExperimentVariant(T),"control"===w&&"control"===T)return;let x="control"!==T,P=e.checkGate({gateName:"adoption_database_ai_property_suggestion_skip_newbie_check"});if(!function(e){var t,i,n,r,s,l,a;let g,u,{collectionStore:c,collectionViewStore:p,collectionNameText:d,device:y,aiPropertySuggestionConfig:_,isAiEnabled:b,isDatabaseNewbie:m,isGhostColumnMode:f,shouldSkipDatabaseNewbieCheck:S=!1}=e;return S||m?b?(t=p.getCreatedTime(),i=_.max_database_age_days,(0,o(362008).Mn)(t)<=i)?f||(n=c.getSchema(),r=_.max_non_title_properties,Object.values(n).filter(e=>e&&"title"!==e.type).length<=r)?(s=p.getFormat(),g=(null==s?void 0:s.property_filters)&&(null==s||null==(l=s.property_filters)?void 0:l.length)>0,u=(null==s?void 0:s.board_columns_by)||(null==s?void 0:s.collection_group_by),g||u)?{isEligible:!1,reason:"Sort/filter/group actions taken"}:d.trim().split(/\s+/).length>0?(a=y,o(139424).A.isMobile||a.isTablet)?{isEligible:!1,reason:"Device not eligible"}:{isEligible:!0}:{isEligible:!1,reason:"Invalid title"}:{isEligible:!1,reason:"Too many properties"}:{isEligible:!1,reason:"Database too old"}:{isEligible:!1,reason:"AI is not enabled"}:{isEligible:!1,reason:"User is not a database newbie"}}({collectionStore:_,collectionViewStore:b,collectionNameText:n,userSettingsStore:S,environment:s,device:l,aiPropertySuggestionConfig:u,isAiEnabled:v,isDatabaseNewbie:I,isGhostColumnMode:x,shouldSkipDatabaseNewbieCheck:P}).isEligible)return;d.setLoading(!0),d.setError(void 0);let k="control"!==T?T:w;if(g.current)return;let C=await r({environment:s,collectionStore:_,collectionNameText:n,numAiPropertySuggestions:u.num_ai_property_suggestions,includeExampleValues:x});if(g.current)return;let A=C;x&&C&&(A=C.filter(e=>e.exampleValues&&e.exampleValues.length>0));let N=null!=(y=A)&&y.length?A:[i];a({suggestionProperty:N[0],suggestionType:k,collectionStoreId:m,collectionViewStoreId:f,allSuggestions:N,usedSuggestionIndices:new Set})}catch(e){d.setError(e instanceof Error?e:Error("Failed to load suggestions")),d.setLoading(!1),d.setSuggestions([])}finally{d.setLoading(!1)}}async function r(e){let{environment:t,collectionStore:i,collectionNameText:n,numAiPropertySuggestions:r,includeExampleValues:s}=e;try{var l;let e=i.getSpaceId(),a=i.id;if(!e||!a)throw Error("Missing spaceId or collectionId");let g=await t.api.callCellCompatibleApi({eventName:"getAiSuggestedProperties",environment:t,data:{spaceId:e,collectionId:a,schema:(0,o(960408).oE)(Object.values(i.getSchema())),collectionName:n,numSuggestion:r,propertyTypes:["select","multi_select","status","text","number"],includeExampleValues:s,numExampleValues:1},cellNavigation:{spaceId:e}});if("success"!==g.type||!(null!=(l=g.data)&&null!=(l=l.properties)&&l.length))throw Error("Invalid API response");return g.data.properties}catch(e){return}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.