TIMESDevelopers
v1.0.0

Bridge client

Talk to the TIMES host from inside your iframe.

bun add @times/aip-sdk

Vanilla

import { createTimesAipClient } from '@times/aip-sdk';

const client = createTimesAipClient({
  parentOrigin: 'https://app.times.et',
  apiBaseUrl: 'https://api.times.et'
});

const init = await client.waitForInit();
client.setTitle(client.t('meta.name'));
client.ready('1.0.0');

const company = await client.api.company();

React

import { AppsBridgeProvider, useAppsInit, useAppsT } from '@times/aip-sdk';

function Root() {
  return (
    <AppsBridgeProvider client={client}>
      <Home />
    </AppsBridgeProvider>
  );
}

function Home() {
  const init = useAppsInit();
  const t = useAppsT();
  if (!init) return null;
  return <h1>{t('home.title')}</h1>;
}

Init payload

FieldNotes
localeen, am, om or ti.
theme, typography, colorModeApplied automatically when you import tokens.css.
tenantPublicIdThe merchant workspace.
surface, sectionWhere you are rendered.
grantedScopesScopes the merchant granted.
slug, kindYour catalog identity.

Client methods

MethodWhat it does
ready(version?)Hides the host splash.
setTitle(title)Sets the host header title.
toast(message, tone?)Shows a host toast.
navigate(section)Changes the host route inside your app.
requestScopes(scopes)Asks for optional scopes.
close()Closes an overlay.
api.*Typed calls for company, invoices, products, users, state, tickets, HR, connection and settings.
api.subscribe(topic, cb)Live events. Requires events:subscribe.