tevrocsdk 0.1.41 → 0.1.42

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.
package/tevroc-sdk.umd.js CHANGED
@@ -26284,7 +26284,7 @@ var Tevroc = (() => {
26284
26284
  if (i4 !== -1) googleListeners.splice(i4, 1);
26285
26285
  };
26286
26286
  }
26287
- var googleInitialized, googleListeners, authWindowRef, authCleanupTimer, authMessageListener, authTauriUnlisten, authHandled, closeAllTauriWebviews, cleanupAuthWindow, handleCallback, initializeGoogleLogin, createGoogleLogin;
26287
+ var googleInitialized, googleListeners, authWindowRef, authCleanupTimer, authMessageListener, closeAllTauriWebviews, cleanupAuthWindow, handleCallback, initializeGoogleLogin, createGoogleLogin;
26288
26288
  var init_useGoogleAuth = __esm({
26289
26289
  "src/services/useGoogleAuth.js"() {
26290
26290
  init_esm3();
@@ -26296,8 +26296,6 @@ var Tevroc = (() => {
26296
26296
  authWindowRef = null;
26297
26297
  authCleanupTimer = null;
26298
26298
  authMessageListener = null;
26299
- authTauriUnlisten = null;
26300
- authHandled = false;
26301
26299
  closeAllTauriWebviews = async () => {
26302
26300
  if (!isTauri) return;
26303
26301
  try {
@@ -26334,14 +26332,6 @@ var Tevroc = (() => {
26334
26332
  window.removeEventListener("message", authMessageListener);
26335
26333
  authMessageListener = null;
26336
26334
  }
26337
- if (authTauriUnlisten) {
26338
- try {
26339
- await authTauriUnlisten();
26340
- } catch (e2) {
26341
- console.warn("Error removing Tauri auth listener:", e2);
26342
- }
26343
- authTauriUnlisten = null;
26344
- }
26345
26335
  if (authWindowRef) {
26346
26336
  const currentAuthWindow = authWindowRef;
26347
26337
  authWindowRef = null;
@@ -26375,8 +26365,6 @@ var Tevroc = (() => {
26375
26365
  };
26376
26366
  handleCallback = async (url) => {
26377
26367
  try {
26378
- if (authHandled) return;
26379
- authHandled = true;
26380
26368
  await cleanupAuthWindow();
26381
26369
  if (!url?.includes("token=")) return;
26382
26370
  const params = new URLSearchParams(url.split("?")[1]);
@@ -26458,17 +26446,6 @@ var Tevroc = (() => {
26458
26446
  win.once("tauri://error", (e2) => {
26459
26447
  console.error("Auth window error:", e2);
26460
26448
  });
26461
- try {
26462
- const { listen: listen2 } = await Promise.resolve().then(() => (init_event(), event_exports));
26463
- authTauriUnlisten = await listen2("google-auth", async (event) => {
26464
- const token = event?.payload?.token;
26465
- if (!token) return;
26466
- const callbackUrl = `${window.location.href}${window.location.href.includes("?") ? "&" : "?"}token=${encodeURIComponent(token)}`;
26467
- await handleCallback(callbackUrl);
26468
- });
26469
- } catch (e2) {
26470
- console.warn("Tauri google-auth listener install failed:", e2);
26471
- }
26472
26449
  return;
26473
26450
  }
26474
26451
  const isLocalhost = true;
@@ -26601,38 +26578,19 @@ var Tevroc = (() => {
26601
26578
  externalCallback
26602
26579
  );
26603
26580
  });
26604
- await listen2("payment-result", async (event) => {
26605
- if (paymentWindowRef) {
26606
- try {
26607
- await paymentWindowRef.close();
26608
- paymentWindowRef = null;
26609
- } catch (e2) {
26610
- console.warn("Error closing Tauri payment window:", e2);
26611
- }
26612
- }
26613
- const payload = event?.payload || {};
26614
- const params = new URLSearchParams();
26615
- if (payload.status) params.set("status", payload.status);
26616
- if (payload.mode) params.set("mode", payload.mode);
26617
- if (payload.app) params.set("app", payload.app);
26618
- if (payload.checkoutId) params.set("checkoutId", payload.checkoutId);
26619
- const url = `?${params.toString()}`;
26620
- handlePaymentCallback(url, externalCallback);
26621
- });
26622
26581
  }
26623
26582
  };
26624
26583
  createPayment = async (amountZAR, {
26625
26584
  appId = "tevrocsoft",
26626
26585
  serviceUrl = "https://tevrocsoftapi.netlify.app",
26627
26586
  payAccount = "default",
26628
- companyId,
26629
26587
  externalCallback = () => {
26630
26588
  }
26631
26589
  } = {}) => {
26632
26590
  await initializePayment(externalCallback);
26633
26591
  const cents = Math.round(Number(amountZAR) * 100);
26634
26592
  const basePaymentUrl = `${serviceUrl.replace(/\/$/, "")}/yoco-pay`;
26635
- const paymentUrl = `${basePaymentUrl}?mode=mobile&amount=${cents}&app=${appId}&account=${payAccount}${companyId ? `&companyId=${encodeURIComponent(companyId)}` : ""}`;
26593
+ const paymentUrl = `${basePaymentUrl}?mode=mobile&amount=${cents}&app=${appId}&account=${payAccount}`;
26636
26594
  console.log(basePaymentUrl, paymentUrl);
26637
26595
  if (isCapacitor) {
26638
26596
  await Browser2.open({
@@ -26641,7 +26599,7 @@ var Tevroc = (() => {
26641
26599
  return;
26642
26600
  }
26643
26601
  if (isTauri) {
26644
- const url = `${basePaymentUrl}?mode=desktop&amount=${cents}&app=${appId}&account=${payAccount}${companyId ? `&companyId=${encodeURIComponent(companyId)}` : ""}`;
26602
+ const url = `${basePaymentUrl}?mode=desktop&amount=${cents}&app=${appId}&account=${payAccount}`;
26645
26603
  const win = new WebviewWindow("payment", {
26646
26604
  url,
26647
26605
  title: "Complete Payment",
@@ -26661,7 +26619,7 @@ var Tevroc = (() => {
26661
26619
  }
26662
26620
  const isLocalhost = window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1";
26663
26621
  const mode = isLocalhost ? "localhost" : "netlify";
26664
- const finalUrl = `${basePaymentUrl}?mode=${mode}&amount=${cents}&app=${appId}${companyId ? `&companyId=${encodeURIComponent(companyId)}` : ""}`;
26622
+ const finalUrl = `${basePaymentUrl}?mode=${mode}&amount=${cents}&app=${appId}`;
26665
26623
  try {
26666
26624
  const popup = window.open(finalUrl, "yocoPayment", "width=500,height=650");
26667
26625
  if (!popup) {
@@ -41331,7 +41289,6 @@ var Tevroc = (() => {
41331
41289
  this.baseUrl = normalizeBaseUrl(baseUrl);
41332
41290
  this.serviceUrl = normalizeBaseUrl(serviceUrl);
41333
41291
  this.appId = options.appId;
41334
- this.userId = options.userId ?? options.user_id ?? "default";
41335
41292
  this.appName = options.appName;
41336
41293
  this.payAccount = options.payAccount ?? "default";
41337
41294
  this.isNative = options.isNative ?? false;
@@ -41395,9 +41352,6 @@ var Tevroc = (() => {
41395
41352
  if (this.appId) {
41396
41353
  headers.set("x-app-id", this.appId);
41397
41354
  }
41398
- if (this.userId) {
41399
- headers.set("x-user-id", this.userId);
41400
- }
41401
41355
  let body = options.body;
41402
41356
  if (body !== void 0 && body !== null && isJsonBody(body)) {
41403
41357
  headers.set("content-type", "application/json");
@@ -41503,13 +41457,12 @@ var Tevroc = (() => {
41503
41457
  }
41504
41458
  function createPaymentApi(client) {
41505
41459
  return {
41506
- create: async ({ amountZAR, appId = "tevrocsoft", mode = "web", account = "default", companyId, externalCallback = void 0 } = {}) => {
41460
+ create: async ({ amountZAR, appId = "tevrocsoft", mode = "web", account = "default", externalCallback = void 0 } = {}) => {
41507
41461
  return await createPayment(amountZAR, {
41508
41462
  appId,
41509
41463
  serviceUrl: client.serviceUrl,
41510
41464
  mode,
41511
41465
  payAccount: account,
41512
- companyId,
41513
41466
  externalCallback
41514
41467
  });
41515
41468
  },
@@ -41726,10 +41679,7 @@ var Tevroc = (() => {
41726
41679
  function createIntegrationApi(client) {
41727
41680
  return {
41728
41681
  Core: {
41729
- InvokeLLM: (payload) => {
41730
- const body = payload && typeof payload === "object" ? { ...payload, appId: payload.appId ?? client.appId, userId: payload.userId ?? client.userId ?? "default" } : { appId: client.appId, userId: client.userId ?? "default" };
41731
- return client.request("/integrations/core/invoke-llm", { method: "POST", body });
41732
- },
41682
+ InvokeLLM: (payload) => client.request("/integrations/core/invoke-llm", { method: "POST", body: payload }),
41733
41683
  GenerateImage: (payload) => client.request("/integrations/core/generate-image", { method: "POST", body: payload }),
41734
41684
  UploadFile: (file, options = {}) => upload(client, "/integrations/core/upload-file", file, options),
41735
41685
  UploadPrivateFile: (file, options = {}) => upload(client, "/integrations/core/upload-private-file", file, options),
@@ -41752,17 +41702,12 @@ var Tevroc = (() => {
41752
41702
  }
41753
41703
  function createAgentApi(client, agentName) {
41754
41704
  const base = `/agents/${encodeURIComponent(agentName)}/conversations`;
41755
- const withContext = (payload = {}) => ({
41756
- ...payload,
41757
- appId: payload.appId ?? client.appId,
41758
- userId: payload.userId ?? client.userId ?? "default"
41759
- });
41760
41705
  return {
41761
- createConversation: (input = {}) => client.request(base, { method: "POST", body: withContext(input) }),
41706
+ createConversation: (input = {}) => client.request(base, { method: "POST", body: input }),
41762
41707
  listConversations: () => client.request(base),
41763
41708
  getConversation: (conversationId) => client.request(`${base}/${encodeURIComponent(conversationId)}`),
41764
41709
  deleteConversation: (conversationId) => client.request(`${base}/${encodeURIComponent(conversationId)}`, { method: "DELETE" }),
41765
- addMessage: (conversationId, input) => client.request(`${base}/${encodeURIComponent(conversationId)}/messages`, { method: "POST", body: withContext(input) }),
41710
+ addMessage: (conversationId, input) => client.request(`${base}/${encodeURIComponent(conversationId)}/messages`, { method: "POST", body: input }),
41766
41711
  listMessages: (conversationId) => client.request(`${base}/${encodeURIComponent(conversationId)}/messages`)
41767
41712
  };
41768
41713
  }