Search by

am2tec / support-sdk

Am2tec

Laravel SDK for the am2tec support_api (widget token issuer + HTTP client).

v0.1.0 2026-11-14 02:26 UTC

This package is auto-updated.

Last update: 2026-11-17 00:34:59 UTC


README

Packagist Version PHP Version License

SDK Laravel para o support_api (server-side: usa X-App-Key / X-App-Secret).

composer require am2tec/support-sdk

Fonte canônica: git.am2tec.com:am2tec/sdks/support-sdk. Espelho público (Packagist): github.com/alberto-morais-oliveira-f/support-sdk.

SUPPORT_API_URL=https://support.am2tec.com
SUPPORT_API_APP_KEY=...
SUPPORT_API_APP_SECRET=...
$token = app(\Am2tec\SupportSdk\SupportSdk::class)->mintWidgetToken(
    ['external_user_id' => $user->id, 'name' => $user->name, 'email' => $user->email],
    ['external_id' => $tenant->id, 'name' => $tenant->name, 'slug' => $tenant->slug],
);

SupportSdk::client() devolve o SupportClient (post/get em /api/v1/*). Nunca exponha app key/secret ao browser — só o token resultante.

Widget Livewire

Requer Livewire 3 no host. Registrado como support-chat-widget:

@livewire('support-chat-widget', ['token' => $token, 'apiUrl' => config('support.api_url')])

Estados: idle | otp | chat | notify. Polling usa polling_interval_ms de /widget/config (padrão 3s). Publicar views: php artisan vendor:publish --tag=support-views; assets (Echo opcional): --tag=support-assets.