PageSourceSearch

https://imcbrokers.com/assets/AdminGmailAddin-Cqc5bfHp.js

js imcbrokers.com collected 2026-10-02 13:13:55 UTC 15,957 bytes, 116 lines download raw bytes

1import{r as i,b as N,j as e,a1 as w,aa as n,ab as o,Z as p,Q as h,ac as C,Y as A,h as g,a9 as k,F as S,ad as L}from"./index-CWDqtotf.js";import{I}from"./info-CYdjlkfU.js";const u="https://www.imcbrokers.com/gmailaddinpanel",b=`// IMC Vault — Gmail Add-in (Code.gs)
2
3var PANEL_URL = 'https://www.imcbrokers.com/gmailaddinpanel';
4
5function onGmailMessage(e) {
6  return buildCard(e);
7}
8
9function onGmailCompose(e) {
10  return buildCard(e);
11}
12
13function onHomepage(e) {
14  return buildCard(e);
15}
16
17// Extracts sender info from the current Gmail message so the panel can
18// pre-fill the "Add New Contact" form automatically.
19function getSenderInfo(e) {
20  var info = { email: '', name: '' };
21  try {
22    if (e && e.gmail && e.gmail.messageId) {
23      var message = GmailApp.getMessageById(e.gmail.messageId);
24      var from = message.getFrom();
25      // "Display Name <[email protected]>" or "[email protected]"
26      var match = from.match(/^(.*?)\\s*<(.+?)>\\s*$/);
27      if (match) {
28        info.name = match[1].replace(/"/g, '').trim();
29        info.email = match[2].trim();
30      } else {
31        info.email = from.trim();
32      }
33    }
34  } catch (err) {
35    // Ignore — panel opens without pre-fill
36  }
37  return info;
38}
39
40function buildCard(e) {
41  var sender = getSenderInfo(e);
42  var url = PANEL_URL;
43  if (sender.email) {
44    url += '?sender_email=' + encodeURIComponent(sender.email);
45    if (sender.name) url += '&sender_name=' + encodeURIComponent(sender.name);
46  }
47
48  // Opens the panel in an overlay — Google manages one overlay per add-in,
49  // so only one IMC Vault panel can be open at a time.
50  var openAction = CardService.newOpenLink()
51    .setUrl(url)
52    .setOpenAs(CardService.OpenAs.OVERLAY)
53    .setOnClose(CardService.OnClose.NOTHING);
54
55  var button = CardService.newTextButton()
56    .setText('Open IMC Vault')
57    .setOpenLink(openAction)
58    .setTextButtonStyle(CardService.TextButtonStyle.FILLED);
59
60  var buttonSet = CardService.newButtonSet()
61    .addButton(button);
62
63  var card = CardService.newCardBuilder()
64    .setHeader(CardService.newCardHeader()
65      .setTitle('IMC Vault')
66      .setSubtitle('IMC Shipbrokers'))
67    .addSection(
68      CardService.newCardSection()
69        .addWidget(CardService.newTextParagraph()
70          .setText('Access vessel documents, generate vault share links, manage contacts, and copy content ready to paste into your email.'))
71        .addWidget(buttonSet)
72    )
73    .build();
74
75  return card;
76}`,y=`{
77  "timeZone": "Europe/Brussels",
78  "dependencies": {},
79  "exceptionLogging": "STACKDRIVER",
80  "runtimeVersion": "V8",
81  "oauthScopes": [
82    "https://www.googleapis.com/auth/gmail.addons.execute",
83    "https://www.googleapis.com/auth/gmail.addons.current.message.metadata",
84    "https://www.googleapis.com/auth/gmail.addons.current.action.compose"
85  ],
86  "gmail": {
87    "name": "IMC Vault",
88    "logoUrl": "https://www.imcbrokers.com/imc-gmail-icon.svg",
89    "primaryColor": "#0A2540",
90    "secondaryColor": "#1E4D8C",
91    "authorizationCheckFunction": "onGmailMessage",
92    "contextualTriggers": [
93      {
94        "unconditional": {},
95        "onTriggerFunction": "onGmailMessage"
96      }
97    ],
98    "composeTrigger": {
99      "selectActions": [
100        {
101          "text": "Open IMC Vault",
102          "runFunction": "onGmailCompose"
103        }
104      ],
105      "draftAccess": "NONE"
106    },
107    "homepageTrigger": {
108      "runFunction": "onHomepage",
109      "enabled": true
110    },
111    "openLinkUrlPrefixes": [
112      "https://www.imcbrokers.com/",
113      "https://imcbrokers.com/"
114    ]
115  }
116}`;function G(){const[a,f]=i.useState("setup"),[d,j]=i.useState([]),[v,c]=i.useState(!1),[r,m]=i.useState("");i.useEffect(()=>{a==="activity"&&x()},[a]);const x=async()=>{c(!0);const s=await N.entities.AuditLog.filter({entity_type:"VaultShareLink"},"-created_date",50);j(s.filter(t=>{try{return JSON.parse(t.details||"{}").source==="gmail_addin"}catch{return!1}})),c(!1)},l=(s,t)=>{navigator.clipboard.writeText(s),m(t),setTimeout(()=>m(""),2e3)};return e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"mb-6 bg-blue-50 border border-blue-200 rounded-xl p-4 flex items-start gap-3",children:[e.jsx(I,{className:"w-5 h-5 text-blue-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-blue-800 mb-1",children:"Gmail Add-in — Private Deployment"}),e.jsx("p",{className:"text-xs text-blue-700",children:"This add-in runs as a private Google Worksp
116ace panel, accessible only to authorized IMC users. Follow the setup guide to configure it in Google Workspace Admin Console."})]})]}),e.jsx("div",{className:"flex gap-1 mb-6 border-b border-gray-200",children:[{id:"setup",label:"Setup Guide"},{id:"activity",label:"Activity Log"},{id:"permissions",label:"Access & Security"}].map(s=>e.jsx("button",{onClick:()=>f(s.id),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${a===s.id?"border-[#0A2540] text-[#0A2540]":"border-transparent text-gray-500 hover:text-gray-700"}`,children:s.label},s.id))}),a==="setup"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-gray-800 mb-3 flex items-center gap-2",children:[e.jsx(w,{className:"w-4 h-4 text-blue-600"})," Add-in Panel URL"]}),e.jsx("p",{className:"text-xs text-gray-500 mb-3",children:"This is the URL that Google Workspace will load inside Gmail's compose panel."}),e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx("code",{className:"flex-1 text-xs bg-gray-50 border border-gray-200 rounded-lg px-3 py-2 text-gray-700 font-mono truncate",children:u}),e.jsxs("button",{onClick:()=>l(u,"panel"),className:"px-3 py-2 bg-gray-100 hover:bg-gray-200 rounded-lg text-xs flex items-center gap-1.5 font-medium transition-colors",children:[r==="panel"?e.jsx(n,{className:"w-3.5 h-3.5 text-green-600"}):e.jsx(o,{className:"w-3.5 h-3.5"})," Copy"]})]})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-800 mb-4",children:"Apps Script — Code.gs"}),e.jsxs("p",{className:"text-xs text-gray-500 mb-3",children:["Replace your Apps Script ",e.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"Code.gs"})," with the code below. Replace ",e.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"REPLACE_WITH_YOUR_PANEL_URL"}),' with the Panel URL above. The add-in will show an "Open IMC Vault" button that opens the panel as an overlay inside Gmail.']}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>l(b,"codegs"),className:"absolute top-2 right-2 px-2 py-1 bg-gray-700 hover:bg-gray-600 text-white rounded text-[10px] flex items-center gap-1 z-10",children:[r==="codegs"?e.jsx(n,{className:"w-3 h-3"}):e.jsx(o,{className:"w-3 h-3"}),r==="codegs"?"Copied!":"Copy"]}),e.jsx("pre",{className:"bg-gray-900 text-gray-100 text-[10px] rounded-lg p-4 overflow-x-auto leading-relaxed whitespace-pre",children:b})]})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-800 mb-4",children:"Apps Script — appsscript.json"}),e.jsxs("p",{className:"text-xs text-gray-500 mb-3",children:["Paste this as your ",e.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"appsscript.json"}),' manifest. Enable "Show manifest file" in Apps Script Project Settings first. The ',e.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"openLinkUrlPrefixes"})," is already set to the correct domain — no placeholder to replace."]}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>l(y,"manifest"),className:"absolute top-2 right-2 px-2 py-1 bg-gray-700 hover:bg-gray-600 text-white rounded text-[10px] flex items-center gap-1 z-10",children:[r==="manifest"?e.jsx(n,{className:"w-3 h-3"}):e.jsx(o,{className:"w-3 h-3"}),r==="manifest"?"Copied!":"Copy"]}),e.jsx("pre",{className:"bg-gray-900 text-gray-100 text-[10px] rounded-lg p-4 overflow-x-auto leading-relaxed whitespace-pre",children:y})]})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-800 mb-3",children:"Deployment Steps"}),e.jsx("div",{className:"space-y-4",children:[{step:1,title:"Open your Apps Script project",desc:"Go to script.google.com, open your IMC Vault add-in project (or create a new one).",link:"https://script.google.com",linkLabel:"Open Apps Script"},{step:2,title:"Replace Code.gs and appsscript.json",desc:"Copy the code above into the respective files. In appsscript.json, replace the PANEL_URL placeholder with the URL shown at the top of this page."}
116,{step:3,title:"Deploy as Google Workspace Add-on",desc:'Click Deploy → New deployment → Add-on. Choose "Test" for development or "Production" for live use.'},{step:4,title:"Restrict to your domain",desc:'In deployment settings, set access to "Specific people in your domain" and restrict to @imcbrokers.com only.'},{step:5,title:"Install from Admin Console",desc:"Go to admin.google.com → Apps → Google Workspace Marketplace → Manage → Install for specific OUs.",link:"https://admin.google.com",linkLabel:"Open Admin Console"}].map(s=>e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-[#0A2540] text-white text-xs font-bold flex items-center justify-center flex-shrink-0",children:s.step}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-800",children:s.title}),e.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:s.desc}),s.link&&e.jsxs("a",{href:s.link,target:"_blank",rel:"noreferrer",className:"mt-1 inline-flex items-center gap-1 text-xs text-blue-600 hover:underline",children:[s.linkLabel," ",e.jsx(p,{className:"w-3 h-3"})]})]})]},s.step))})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-gray-800 mb-3 flex items-center gap-2",children:[e.jsx(h,{className:"w-4 h-4 text-blue-600"})," Where to find the Add-in on Android"]}),e.jsxs("div",{className:"space-y-2 text-xs text-gray-600",children:[e.jsxs("p",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"font-semibold text-gray-700",children:"①"})," The add-in does ",e.jsx("strong",{children:"not"})," appear in the inbox list — it only appears when you ",e.jsx("strong",{children:"open an email"})," or ",e.jsx("strong",{children:"start composing"}),"."]}),e.jsxs("p",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"font-semibold text-gray-700",children:"②"})," ",e.jsx("strong",{children:"Reading an email:"})," tap any email to open it. The IMC Vault card appears at the bottom of the email — tap it to open the panel."]}),e.jsxs("p",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"font-semibold text-gray-700",children:"③"})," ",e.jsx("strong",{children:"Composing:"})," tap the compose (pencil) button. The ",e.jsx("em",{children:"Open IMC Vault"})," button appears in the compose toolbar at the top."]}),e.jsxs("p",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"font-semibold text-gray-700",children:"④"})," If still missing: open Gmail → Settings → [your account] → ensure ",e.jsx("em",{children:"IMC Vault"})," add-on is enabled. You may need to wait up to 24 hours after deployment for it to appear on mobile."]})]})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-800 mb-2",children:"Preview Add-in Panel"}),e.jsx("p",{className:"text-xs text-gray-500 mb-3",children:"Open the panel in a new tab to preview what users will see inside Gmail."}),e.jsxs("a",{href:"/gmailaddinpanel",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-2 px-4 py-2 bg-[#0A2540] text-white text-sm font-medium rounded-lg hover:bg-[#1E4D8C] transition-colors",children:[e.jsx(p,{className:"w-4 h-4"})," Open Panel Preview"]})]})]}),a==="activity"&&e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 flex items-center justify-between",children:[e.jsxs("h3",{className:"text-sm font-semibold text-gray-800 flex items-center gap-2",children:[e.jsx(C,{className:"w-4 h-4 text-blue-600"})," Gmail Add-in Share Activity"]}),e.jsx("button",{onClick:x,className:"text-xs text-blue-600 hover:underline",children:"Refresh"})]}),v?e.jsx("div",{className:"flex items-center justify-center py-10 text-sm text-gray-400",children:"Loading…"}):d.length===0?e.jsxs("div",{className:"py-10 text-center",children:[e.jsx(A,{className:"w-8 h-8 text-gray-200 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-gray-400",children:"No activity recorded yet"})]}):e.jsx("div",{className:"divide-y divide-gray-100",children:d.map(s=>{let t={};try{t=JSON.parse(s.details||"{}")}catch{}return e.jsxs("div",{className:"px-5 py-3 flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-gray-800",children:s.user_name||s.user_email}),e.jsxs("div",{className:"text-xs text-gray-500 mt-0.5",children:["Shared ",(t.vessels||[]).join(", ")
116]}),t.expires_at&&e.jsxs("div",{className:"text-xs text-gray-400 mt-0.5",children:["Expires: ",g(new Date(t.expires_at),"MMM d, yyyy")]})]}),e.jsx("div",{className:"text-xs text-gray-400 whitespace-nowrap",children:s.created_date?g(new Date(s.created_date),"MMM d, HH:mm"):""})]},s.id)})})]}),a==="permissions"&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-gray-800 mb-4 flex items-center gap-2",children:[e.jsx(k,{className:"w-4 h-4 text-green-600"})," Security Model"]}),e.jsx("div",{className:"space-y-3",children:[{label:"Authentication",value:"IMC Shipbrokers account (Base44 SSO)",ok:!0},{label:"Access level",value:"Any authenticated IMC user — unauthorized users see Access Denied",ok:!0},{label:"API communication",value:"All API calls use Base44 session token over HTTPS",ok:!0},{label:"Audit logging",value:"All share link generations are logged to AuditLog",ok:!0},{label:"Vault folder access",value:"Only PUBLIC folders exposed — PRIVATE folders automatically excluded",ok:!0},{label:"Domain restriction",value:"Configure in Google Workspace Admin Console (see Setup tab)",ok:!1,note:"Manual step required"}].map(s=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-4 h-4 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5 ${s.ok?"bg-green-100":"bg-amber-100"}`,children:s.ok?e.jsx(n,{className:"w-2.5 h-2.5 text-green-600"}):e.jsx(S,{className:"w-2.5 h-2.5 text-amber-600"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-semibold text-gray-700",children:s.label}),e.jsx("div",{className:"text-xs text-gray-500",children:s.value}),s.note&&e.jsx("div",{className:"text-[10px] text-amber-600 mt-0.5",children:s.note})]})]},s.label))})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-gray-800 mb-3 flex items-center gap-2",children:[e.jsx(h,{className:"w-4 h-4 text-blue-600"})," User Management"]}),e.jsx("p",{className:"text-xs text-gray-500 mb-3",children:"Access to the Gmail Add-in is controlled by existing user roles. Manage users from the Admin Users page."}),e.jsxs("a",{href:"/adminusers",className:"inline-flex items-center gap-1.5 text-xs font-medium text-blue-600 hover:underline",children:["Manage Users ",e.jsx(L,{className:"w-3.5 h-3.5"})]})]})]})]})}export{G as default};

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.