@omnizapi/connect 1.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.
@@ -0,0 +1 @@
1
+ "use strict";(()=>{var e=class extends Error{constructor(o,i){super(i);this.code=o;this.name="OmnizapiError"}};var re={PRODUCTION:{api:"https://api.omni.z-api.io",front:"https://app.omni.z-api.io"},STAGING:{api:"https://api.staging.omni.z-api.io",front:"https://app.staging.omni.z-api.io"},SANDBOX:{api:"",front:""}},se=({environment:n="PRODUCTION",apiUrl:t,frontUrl:o}={})=>{if(!Object.prototype.hasOwnProperty.call(re,n))throw new e("INVALID_CONFIGURATION","Unknown environment.");let i=re[n],s={api:t!=null?t:i.api,front:o!=null?o:i.front};for(let c of["api","front"]){let f;try{f=new URL(s[c])}catch(l){throw new e("INVALID_CONFIGURATION",`A valid ${c}Url is required for this environment.`)}if(!["http:","https:"].includes(f.protocol)||f.username||f.password||f.href.includes("?")||f.href.includes("#"))throw new e("INVALID_CONFIGURATION",`${c}Url must be an HTTP(S) base URL without credentials, query or fragment.`);s[c]=f.href.replace(/\/+$/,"")}return s};var ae=Symbol.for("omnizapi.connect.runtime.v1");function W(n){let t=n,o=t[ae];return o||(o={nativeLoginPending:!1,failedFacebookScripts:new WeakSet},Object.defineProperty(t,ae,{configurable:!0,value:o})),o}function ce(n){return!!n&&!("__buffer"in n)&&typeof n.init=="function"&&typeof n.login=="function"}function le(n,t){if(t.aborted)return Promise.reject(new e("SDK_LOAD_FAILED","The Meta SDK load was cancelled."));if(ce(n.FB))return Promise.resolve(n.FB);let o=W(n),i=o.facebookLoading;if(i)return i;let s=Promise.resolve().then(()=>new Promise((c,f)=>{let l=!1,r,E=!1,O,w,_=(I,a)=>{if(!l){l=!0,clearTimeout(K),t.removeEventListener("abort",U),r==null||r.removeEventListener("load",M),r==null||r.removeEventListener("error",G);try{n.fbAsyncInit===L&&(O?Object.defineProperty(n,"fbAsyncInit",O):Reflect.deleteProperty(n,"fbAsyncInit"))}catch(P){}if(a&&r&&(t.aborted||o.failedFacebookScripts.add(r),E))try{r.remove()}catch(P){}o.facebookLoading===s&&delete o.facebookLoading,I?c(I):f(a)}},M=()=>{if(l)return;let I=n.FB;ce(I)&&_(I)},G=()=>_(void 0,new e("SDK_LOAD_FAILED","The Meta SDK could not be loaded.")),U=()=>_(void 0,new e("SDK_LOAD_FAILED","The Meta SDK load was cancelled.")),L=()=>{if(!l){try{w==null||w.call(n)}catch(I){}M()}},K=setTimeout(()=>_(void 0,new e("SDK_LOAD_FAILED","The Meta SDK load timed out.")),30*1e3);try{if(t.addEventListener("abort",U,{once:!0}),t.aborted){U();return}O=Object.getOwnPropertyDescriptor(n,"fbAsyncInit"),w=typeof n.fbAsyncInit=="function"?n.fbAsyncInit:void 0,Object.defineProperty(n,"fbAsyncInit",O&&!O.configurable?{value:L}:{configurable:!0,enumerable:!0,writable:!0,value:L});let I=n.document,a=I.getElementById("facebook-jssdk"),P=(a==null?void 0:a.tagName.toLowerCase())==="script"?a:void 0;r=(P&&!o.failedFacebookScripts.has(P)?P:void 0)||Array.from(I.scripts).find(y=>{if(o.failedFacebookScripts.has(y))return!1;try{let F=new URL(y.src);return F.origin==="https://connect.facebook.net"&&/^\/[^/]+\/sdk\.js$/.test(F.pathname)}catch(F){return!1}}),r||(r=I.createElement("script"),E=!0,a||(r.id="facebook-jssdk"),r.src="https://connect.facebook.net/en_US/sdk.js",r.crossOrigin="anonymous",r.async=!0,r.defer=!0),r.addEventListener("load",M),r.addEventListener("error",G),M(),!l&&E&&I.head.appendChild(r)}catch(I){G()}}));return o.facebookLoading=s,s}var ue=(n,t,o=600,i=700)=>{let s=window,c=s.document,f=s.screenLeft!==void 0?s.screenLeft:s.screenX,l=s.screenTop!==void 0?s.screenTop:s.screenY,r=s.innerWidth?s.innerWidth:c.documentElement.clientWidth?c.documentElement.clientWidth:s.screen.width,E=s.innerHeight?s.innerHeight:c.documentElement.clientHeight?c.documentElement.clientHeight:s.screen.height,O=r/2-o/2+f,w=E/2-i/2+l;return s.open(n,t,`scrollbars=yes, width=${o}, height=${i}, top=${w}, left=${O}`)};var Ie=600*1e3,we=30*1e3;function v(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function p(n){return typeof n=="string"&&n.trim()?n:null}function de(n){if(n==="."||n==="..")throw new e("INVALID_OPTIONS","The channelId cannot be a URL path navigation segment.");try{return encodeURIComponent(n)}catch(t){throw new e("INVALID_OPTIONS","The channelId cannot be encoded as a URL path.")}}function Re(n){return["META_MESSENGER","META_INSTAGRAM","META_WHATSAPP","BOT_TELEGRAM","Z_API_WHATSAPP"].includes(n)}function pe(n){return typeof n=="string"&&["cancelled","popup_closed","not_completed","invalid_channel","origin_not_allowed","unsupported_channel"].includes(n)}function B(n,t,o){return{success:!1,reason:o,channelId:n,type:t,code:null,wabaId:null,phoneId:null}}function fe(n,t,o){return typeof fetch!="function"||typeof AbortController!="function"?Promise.reject(new e("INVALID_CONFIGURATION","Fetch and AbortController are required.")):new Promise((i,s)=>{let c=new AbortController,f=!1,l=(w,_)=>{f||(f=!0,clearTimeout(E),o==null||o.removeEventListener("abort",r),c.abort(),_?s(_):i(w))},r=()=>l(void 0,new e("NETWORK_ERROR","The API request was cancelled.")),E=setTimeout(()=>l(void 0,new e("TIMEOUT","The API request timed out.")),we);if(o==null||o.addEventListener("abort",r,{once:!0}),o!=null&&o.aborted){r();return}(async()=>{let w;try{w=await fetch(n.href,{...t,signal:c.signal})}catch(_){l(void 0,new e("NETWORK_ERROR","The API request failed."));return}if(!f){if(!w||typeof w.ok!="boolean"){l(void 0,new e("INVALID_RESPONSE","The API response is invalid."));return}if(!w.ok){l(void 0,new e("HTTP_ERROR","The API returned an unsuccessful status."));return}try{let _=await w.json();f||l(_)}catch(_){l(void 0,new e("INVALID_RESPONSE","The API did not return valid JSON."))}}})().catch(()=>l(void 0,new e("NETWORK_ERROR","The API request failed.")))})}var j=class{constructor(t){if(!v(t)||!p(t.publicKey)||Array.from(t.publicKey).some(o=>{let i=o.charCodeAt(0);return i<32||i===127})||t.logo!==void 0&&typeof t.logo!="string"||t.apiUrl!==void 0&&!p(t.apiUrl)||t.frontUrl!==void 0&&!p(t.frontUrl))throw new e("INVALID_CONFIGURATION","Valid client properties and a publicKey are required.");this.publicKey=t.publicKey,this.logo=t.logo,this.constants=se({environment:t.environment,apiUrl:t.apiUrl,frontUrl:t.frontUrl})}async getListMessengerPages(t,o){if(!p(t)||!p(o))throw new e("INVALID_OPTIONS","A channelId and authorization code are required.");return fe(new URL(`${this.constants.api}/v1/channels/${de(t)}/list-messenger-pages`),{method:"POST",body:JSON.stringify({redirectUri:new URL(`${this.constants.front}/oauth/proxy-messenger`).href,code:o}),headers:{"Content-Type":"application/json",Authorization:this.publicKey}})}async connect(t){var o;try{if(typeof window=="undefined"||!window.document||!window.location)throw new e("BROWSER_REQUIRED","Connecting requires a browser window.");let i=window,s=W(i);if(s.activeConnection)throw new e("CONNECTION_IN_PROGRESS","A connection is already in progress in this window.");if(!v(t))throw new e("INVALID_OPTIONS","Connection options are required.");let{channelId:c,direct:f,getQRCode:l,timeoutMs:r=Ie}=t;if(typeof c!="string"||f!==void 0&&typeof f!="boolean"||l!==void 0&&typeof l!="function"||typeof r!="number"||!Number.isFinite(r)||r<=0||r>2147483647)throw new e("INVALID_OPTIONS","Invalid channelId, direct, getQRCode or timeoutMs option.");if(!c.trim())return B(c,null,"invalid_channel");let E=de(c);if(typeof i.open!="function"||typeof i.addEventListener!="function"||typeof i.removeEventListener!="function"||typeof i.location.origin!="string"||typeof i.location.href!="string"||typeof((o=i.crypto)==null?void 0:o.getRandomValues)!="function"||typeof AbortController!="function"||typeof fetch!="function")throw new e("INVALID_CONFIGURATION","Required browser APIs are unavailable.");let O=i.location.origin;if(O==="null")return B(c,null,"origin_not_allowed");let w=i.location.href,_=new URL(this.constants.front).origin;return await new Promise((M,G)=>{let U=Symbol("omnizapi-connection"),L=new AbortController,K=Date.now()+r,I=!1,a=null,P=null,y=null,F,q,z,Q=!1,J=[],S=h=>{if(I)return;if(I=!0,clearTimeout(F),clearInterval(q),z)try{i.removeEventListener("message",z)}catch(D){}try{L.abort()}catch(D){}let k=y;y=null;try{k==null||k.close()}catch(D){}for(let{name:D,previous:m,value:N}of J)try{let T=Object.getOwnPropertyDescriptor(i,D);if(!T||!("value"in T)||T.value!==N)continue;m?Object.defineProperty(i,D,m):Reflect.deleteProperty(i,D)}catch(T){}s.activeConnection===U&&delete s.activeConnection,Q&&!(h instanceof e)&&h.success&&(s.nativeLoginPending=!1),h instanceof e?G(h):M(h)},b=()=>(!I&&Date.now()>=K&&S(new e("TIMEOUT","The connection timed out.")),!I),C=h=>S(B(c,a,h)),X=h=>{!b()||!a||S({success:!0,channelId:c,type:a,code:p(h.code),wabaId:p(h.wabaId),phoneId:p(h.phoneId),coexistence:h.coexistence===!0,redirectUri:P,botToken:p(h.botToken),pageId:p(h.pageId),accessToken:p(h.accessToken)})};try{s.activeConnection=U;let h=i.crypto.getRandomValues(new Uint8Array(16)),k=Array.from(h,m=>m.toString(16).padStart(2,"0")).join("");for(let[m,N]of[["__omnizapiPublicKey",this.publicKey],["__omnizapiCurrentChannel",c],["__omnizapiGetQrCode",l]]){let T=Object.getOwnPropertyDescriptor(i,m);Object.defineProperty(i,m,T&&!T.configurable?{value:N}:{configurable:!0,enumerable:!0,writable:!0,value:N}),J.push({name:m,previous:T,value:N})}F=setTimeout(()=>S(new e("TIMEOUT","The connection timed out.")),r),(async()=>{var Z,Y,ee;let m=await fe(new URL(`${this.constants.api}/instances/${E}/sdk-info`),{headers:{Authorization:this.publicKey,"Content-Type":"application/json"}},L.signal);if(!b())return;if(!v(m)||!p(m.middleware))throw new e("INVALID_RESPONSE","The channel configuration is invalid.");let N=(Z=m.allowOrigins)!=null?Z:[];if(!Array.isArray(N)||!N.every(u=>typeof u=="string"))throw new e("INVALID_RESPONSE","The channel origins are invalid.");let T=m.middleware;if(a=Re(T)?T:null,O!==_&&!N.some(u=>O===u.replace(/\/$/,""))){C("origin_not_allowed");return}if(!a){C("unsupported_channel");return}let V=(Y=p(a==="META_INSTAGRAM"?m.appInstagramId:m.appId))!=null?Y:"",H=(ee=p(m.appConfig))!=null?ee:"";if(a.startsWith("META_")&&!V||a==="META_WHATSAPP"&&!H)throw new e("INVALID_RESPONSE","The channel provider configuration is invalid.");if(a==="META_WHATSAPP"&&(f||m.appCustom||O===_)){if(s.nativeLoginPending)throw new e("CONNECTION_IN_PROGRESS","A previous Meta login is incomplete. Reload this window before retrying a native login.");let u=await le(i,L.signal);if(!b())return;try{u.init({appId:V,version:"v25.0",autoLogAppEvents:!0,xfbml:!0})}catch(A){throw new e("PROVIDER_ERROR","The Meta SDK could not be initialized.")}if(!b())return;let d=null,x=null,ne=null,te=!1,oe=!1,ie=()=>{!b()||!d||!x||X({code:d,wabaId:x,phoneId:ne,coexistence:te})};z=A=>{if(!b()||!["https://www.facebook.com","https://web.facebook.com"].includes(A.origin))return;let R=A.data;if(typeof R=="string")try{R=JSON.parse(R)}catch(_e){return}if(!(!v(R)||R.type!=="WA_EMBEDDED_SIGNUP")){if(R.event==="CANCEL")C("cancelled");else if(R.event==="ERROR")S(new e("PROVIDER_ERROR","Meta could not complete the connection."));else if(R.event==="FINISH"||R.event==="FINISH_WHATSAPP_BUSINESS_APP_ONBOARDING"){if(!v(R.data)||!p(R.data.waba_id)||R.data.phone_number_id!=null&&typeof R.data.phone_number_id!="string")return;x=p(R.data.waba_id),ne=p(R.data.phone_number_id),te=R.event==="FINISH_WHATSAPP_BUSINESS_APP_ONBOARDING",ie()}}},i.addEventListener("message",z),s.nativeLoginPending=!0,Q=!0;try{u.login(A=>{if(!(!b()||oe)){if(oe=!0,!v(A)||A.error){S(new e("PROVIDER_ERROR","Meta returned an invalid login response."));return}if(A.authResponse==null){C("not_completed");return}if(!v(A.authResponse)||!p(A.authResponse.code)){C("not_completed");return}d=p(A.authResponse.code),ie()}},{config_id:H,response_type:"code",override_default_response_type:!0,extras:{setup:{},featureType:"whatsapp_business_app_onboarding",sessionInfoVersion:"3"}})}catch(A){throw new e("PROVIDER_ERROR","The Meta login could not be started.")}return}let g;if(a==="META_MESSENGER"||a==="META_INSTAGRAM"){let u=a==="META_MESSENGER";P=new URL(`${this.constants.front}/oauth/proxy-${u?"messenger":"instagram"}`).href,g=new URL(u?"https://www.facebook.com/dialog/oauth":"https://www.instagram.com/oauth/authorize"),g.searchParams.set("client_id",V),u&&g.searchParams.set("display","popup"),g.searchParams.set("redirect_uri",P),g.searchParams.set("response_type","code"),g.searchParams.set("scope",u?"public_profile,business_management,pages_messaging,pages_show_list,pages_manage_metadata,pages_read_engagement":"instagram_business_basic,instagram_business_manage_messages"),g.searchParams.set("state",JSON.stringify({currentUrl:w,attemptId:k,channelId:c}))}else a==="META_WHATSAPP"?(g=new URL(`${this.constants.front}/oauth/proxy-cloud-api`),g.searchParams.set("configId",H),g.searchParams.set("appId",V),g.searchParams.set("channelId",c),g.searchParams.set("channelType",a),g.searchParams.set("logo",this.logo||new URL(`${this.constants.front}/logos/SVG/Ativo%2016.svg`).href),g.searchParams.set("pk",this.publicKey)):(g=new URL(`${this.constants.front}/connect/${a==="BOT_TELEGRAM"?"telegram":"whatsapp-web"}`),g.searchParams.set("channelId",c));if(a!=="META_MESSENGER"&&a!=="META_INSTAGRAM"&&g.searchParams.set("attemptId",k),z=u=>{if(!b()||!y||u.origin!==_||u.source!==y)return;let d=u.data;!v(d)||d.type!=="after-connect"||d.attemptId!==k||d.channelId!==c||typeof d.success!="boolean"||d.reason!==void 0&&!pe(d.reason)||d.coexistence!==void 0&&typeof d.coexistence!="boolean"||["code","wabaId","phoneId","botToken","pageId","accessToken","redirectUri"].some(x=>d[x]!=null&&typeof d[x]!="string")||(d.success?a!=null&&a.startsWith("META_")&&!p(d.code)||a==="BOT_TELEGRAM"&&!p(d.botToken)?C("not_completed"):X(d):C(pe(d.reason)?d.reason:"not_completed"))},i.addEventListener("message",z),!!b()){try{let u=ue(g.href,"_blank",600,740);if(!u||u===i)throw new e("POPUP_BLOCKED","The connection popup was blocked.");y=u}catch(u){throw new e("POPUP_BLOCKED","The connection popup could not be opened.")}q=setInterval(()=>{if(b())try{y!=null&&y.closed&&C("popup_closed")}catch(u){S(new e("PROVIDER_ERROR","The connection popup could not be monitored."))}},500)}})().catch(m=>{b()&&S(m instanceof e?m:new e("PROVIDER_ERROR","The connection could not be completed."))})}catch(h){S(new e("INVALID_CONFIGURATION","The connection could not be initialized."))}})}catch(i){throw i instanceof e?i:new e("INVALID_OPTIONS","The connection could not be started with these options.")}}},me=j;var $=class{static newClient(t){return new me(t)}};var he=$;Object.assign(window,{Omnizapi:he});})();
@@ -0,0 +1,2 @@
1
+ export * from "../src/index.js";
2
+ export { Omnizapi as default } from "../src/index.js";
@@ -0,0 +1,5 @@
1
+ import type { OmnizapiClientProps } from "../types";
2
+ export declare const getConstants: ({ environment, apiUrl, frontUrl, }?: Pick<OmnizapiClientProps, "environment" | "apiUrl" | "frontUrl">) => {
3
+ api: string;
4
+ front: string;
5
+ };
@@ -0,0 +1,10 @@
1
+ import type { ConnectionOptions, ConnectionResult, OmnizapiClient, OmnizapiClientProps } from "../types";
2
+ declare class OmnizapiClientImpl implements OmnizapiClient {
3
+ private readonly publicKey;
4
+ private readonly logo?;
5
+ private readonly constants;
6
+ constructor(props: OmnizapiClientProps);
7
+ getListMessengerPages(channelId: string, code: string): Promise<unknown>;
8
+ connect(options: ConnectionOptions): Promise<ConnectionResult>;
9
+ }
10
+ export default OmnizapiClientImpl;
@@ -0,0 +1,24 @@
1
+ export interface FacebookSdk {
2
+ init(options: {
3
+ appId: string;
4
+ version: string;
5
+ autoLogAppEvents: boolean;
6
+ xfbml: boolean;
7
+ }): void;
8
+ login(callback: (response: unknown) => void, options: {
9
+ config_id: string;
10
+ response_type: string;
11
+ override_default_response_type: boolean;
12
+ extras: {
13
+ setup: Record<string, never>;
14
+ featureType: string;
15
+ sessionInfoVersion: string;
16
+ };
17
+ }): void;
18
+ }
19
+ type FacebookWindow = Window & {
20
+ FB?: FacebookSdk;
21
+ fbAsyncInit?: () => void;
22
+ };
23
+ export declare function loadFacebookSdk(host: FacebookWindow, signal: AbortSignal): Promise<FacebookSdk>;
24
+ export {};
@@ -0,0 +1 @@
1
+ export declare const openPopup: (url: string, title: string, width?: number, height?: number) => Window | null;
@@ -0,0 +1,9 @@
1
+ import type { FacebookSdk } from "./facebook-sdk";
2
+ interface SharedRuntime {
3
+ activeConnection?: symbol;
4
+ nativeLoginPending: boolean;
5
+ facebookLoading?: Promise<FacebookSdk>;
6
+ failedFacebookScripts: WeakSet<HTMLScriptElement>;
7
+ }
8
+ export declare function getRuntime(host: Window): SharedRuntime;
9
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { OmnizapiClient, OmnizapiClientProps } from "./types";
2
+ declare class Omnizapi {
3
+ static newClient(props: OmnizapiClientProps): OmnizapiClient;
4
+ }
5
+ export { Omnizapi };
6
+ export { Environment, OmnizapiError } from "./types";
7
+ export type { ChannelType, ConnectionOptions, ConnectionFailureReason, ConnectionSuccess, ConnectionFailure, ConnectionResult, OmnizapiClient, OmnizapiClientProps, OmnizapiErrorCode, } from "./types";
8
+ export default Omnizapi;
@@ -0,0 +1,55 @@
1
+ export interface ConnectionOptions {
2
+ channelId: string;
3
+ direct?: boolean;
4
+ getQRCode?: () => Promise<{
5
+ connected?: boolean;
6
+ value?: string;
7
+ }>;
8
+ timeoutMs?: number;
9
+ }
10
+ export type ChannelType = "META_MESSENGER" | "META_INSTAGRAM" | "META_WHATSAPP" | "BOT_TELEGRAM" | "Z_API_WHATSAPP";
11
+ export type ConnectionFailureReason = "cancelled" | "popup_closed" | "not_completed" | "invalid_channel" | "origin_not_allowed" | "unsupported_channel";
12
+ export interface ConnectionSuccess {
13
+ success: true;
14
+ channelId: string;
15
+ type: ChannelType;
16
+ code: string | null;
17
+ wabaId: string | null;
18
+ phoneId: string | null;
19
+ coexistence: boolean;
20
+ redirectUri: string | null;
21
+ botToken: string | null;
22
+ pageId: string | null;
23
+ accessToken: string | null;
24
+ }
25
+ export interface ConnectionFailure {
26
+ success: false;
27
+ reason: ConnectionFailureReason;
28
+ channelId: string;
29
+ type: ChannelType | null;
30
+ code: null;
31
+ wabaId: null;
32
+ phoneId: null;
33
+ }
34
+ export type ConnectionResult = ConnectionSuccess | ConnectionFailure;
35
+ export type OmnizapiErrorCode = "BROWSER_REQUIRED" | "CONNECTION_IN_PROGRESS" | "INVALID_CONFIGURATION" | "INVALID_OPTIONS" | "NETWORK_ERROR" | "HTTP_ERROR" | "INVALID_RESPONSE" | "POPUP_BLOCKED" | "TIMEOUT" | "SDK_LOAD_FAILED" | "PROVIDER_ERROR";
36
+ export declare class OmnizapiError extends Error {
37
+ readonly code: OmnizapiErrorCode;
38
+ constructor(code: OmnizapiErrorCode, message: string);
39
+ }
40
+ export interface OmnizapiClient {
41
+ connect(options: ConnectionOptions): Promise<ConnectionResult>;
42
+ getListMessengerPages(channelId: string, code: string): Promise<unknown>;
43
+ }
44
+ export declare enum Environment {
45
+ PRODUCTION = "PRODUCTION",
46
+ STAGING = "STAGING",
47
+ SANDBOX = "SANDBOX"
48
+ }
49
+ export interface OmnizapiClientProps {
50
+ publicKey: string;
51
+ logo?: string;
52
+ environment?: Environment;
53
+ apiUrl?: string;
54
+ frontUrl?: string;
55
+ }
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@omnizapi/connect",
3
+ "version": "1.0.0",
4
+ "description": "Omnizapi SDK for browser applications",
5
+ "main": "dist/cjs/index.js",
6
+ "module": "dist/esm/index.mjs",
7
+ "browser": "dist/esm/index.mjs",
8
+ "unpkg": "dist/omnizapi.min.js",
9
+ "jsdelivr": "dist/omnizapi.min.js",
10
+ "types": "dist/types/src/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "import": {
14
+ "types": "./dist/types/scripts/index.d.mts",
15
+ "default": "./dist/esm/index.mjs"
16
+ },
17
+ "require": {
18
+ "types": "./dist/types/src/index.d.ts",
19
+ "default": "./dist/cjs/index.js"
20
+ }
21
+ }
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "scripts": {
27
+ "dev": "rimraf dist && npm run build:types && dotenv -e .env.local -- node esbuild.config.mjs --watch",
28
+ "build": "rimraf dist && npm run build:types && node esbuild.config.mjs",
29
+ "build:types": "tsc -p tsconfig.types.json",
30
+ "lint": "eslint src __tests__ scripts --ext .ts,.mts,.mjs",
31
+ "test": "jest",
32
+ "test:package": "node scripts/test-package.mjs"
33
+ },
34
+ "keywords": [
35
+ "omnizapi",
36
+ "sdk",
37
+ "messaging"
38
+ ],
39
+ "author": "FourPixel IT",
40
+ "license": "MIT",
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "devDependencies": {
45
+ "@types/jest": "^29.5.0",
46
+ "@types/node": "^18.19.130",
47
+ "@typescript-eslint/eslint-plugin": "^5.59.0",
48
+ "@typescript-eslint/parser": "^5.59.0",
49
+ "dotenv-cli": "^11.0.0",
50
+ "esbuild": "^0.27.3",
51
+ "eslint": "^8.38.0",
52
+ "jest": "^29.5.0",
53
+ "jest-environment-jsdom": "^29.7.0",
54
+ "jsdom": "^20.0.3",
55
+ "rimraf": "^5.0.0",
56
+ "ts-jest": "^29.1.0",
57
+ "typescript": "^5.0.4"
58
+ }
59
+ }