tevrocsdk 0.1.40 → 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/package.json CHANGED
@@ -1,21 +1,21 @@
1
- {
2
- "name": "tevrocsdk",
3
- "version": "0.1.40",
4
- "description": "JavaScript SDK for the Tevroc API.",
5
- "main": "./tevroc-sdk.umd.js",
6
- "module": "./tevroc-sdk.esm.js",
7
-
8
- "keywords": [
9
- "tevroc",
10
- "sdk",
11
- "worker",
12
- "api" ,
13
- "tauri",
14
- "capacitor",
15
- "YOCO" ,
16
- "google Auth",
17
- "Google Drive",
18
- "Firebase"
19
- ],
20
- "license": "MIT"
1
+ {
2
+ "name": "tevrocsdk",
3
+ "version": "0.1.42",
4
+ "description": "JavaScript SDK for the Tevroc API.",
5
+ "main": "./tevroc-sdk.umd.js",
6
+ "module": "./tevroc-sdk.esm.js",
7
+
8
+ "keywords": [
9
+ "tevroc",
10
+ "sdk",
11
+ "worker",
12
+ "api" ,
13
+ "tauri",
14
+ "capacitor",
15
+ "YOCO" ,
16
+ "google Auth",
17
+ "Google Drive",
18
+ "Firebase"
19
+ ],
20
+ "license": "MIT"
21
21
  }
package/tevroc-sdk.esm.js CHANGED
@@ -26282,7 +26282,7 @@ function subscribeGoogleLogin(cb) {
26282
26282
  if (i4 !== -1) googleListeners.splice(i4, 1);
26283
26283
  };
26284
26284
  }
26285
- var googleInitialized, googleListeners, authWindowRef, authCleanupTimer, authMessageListener, authTauriUnlisten, authHandled, closeAllTauriWebviews, cleanupAuthWindow, handleCallback, initializeGoogleLogin, createGoogleLogin;
26285
+ var googleInitialized, googleListeners, authWindowRef, authCleanupTimer, authMessageListener, closeAllTauriWebviews, cleanupAuthWindow, handleCallback, initializeGoogleLogin, createGoogleLogin;
26286
26286
  var init_useGoogleAuth = __esm({
26287
26287
  "src/services/useGoogleAuth.js"() {
26288
26288
  init_esm3();
@@ -26294,8 +26294,6 @@ var init_useGoogleAuth = __esm({
26294
26294
  authWindowRef = null;
26295
26295
  authCleanupTimer = null;
26296
26296
  authMessageListener = null;
26297
- authTauriUnlisten = null;
26298
- authHandled = false;
26299
26297
  closeAllTauriWebviews = async () => {
26300
26298
  if (!isTauri) return;
26301
26299
  try {
@@ -26332,14 +26330,6 @@ var init_useGoogleAuth = __esm({
26332
26330
  window.removeEventListener("message", authMessageListener);
26333
26331
  authMessageListener = null;
26334
26332
  }
26335
- if (authTauriUnlisten) {
26336
- try {
26337
- await authTauriUnlisten();
26338
- } catch (e2) {
26339
- console.warn("Error removing Tauri auth listener:", e2);
26340
- }
26341
- authTauriUnlisten = null;
26342
- }
26343
26333
  if (authWindowRef) {
26344
26334
  const currentAuthWindow = authWindowRef;
26345
26335
  authWindowRef = null;
@@ -26373,8 +26363,6 @@ var init_useGoogleAuth = __esm({
26373
26363
  };
26374
26364
  handleCallback = async (url) => {
26375
26365
  try {
26376
- if (authHandled) return;
26377
- authHandled = true;
26378
26366
  await cleanupAuthWindow();
26379
26367
  if (!url?.includes("token=")) return;
26380
26368
  const params = new URLSearchParams(url.split("?")[1]);
@@ -26456,17 +26444,6 @@ var init_useGoogleAuth = __esm({
26456
26444
  win.once("tauri://error", (e2) => {
26457
26445
  console.error("Auth window error:", e2);
26458
26446
  });
26459
- try {
26460
- const { listen: listen2 } = await Promise.resolve().then(() => (init_event(), event_exports));
26461
- authTauriUnlisten = await listen2("google-auth", async (event) => {
26462
- const token = event?.payload?.token;
26463
- if (!token) return;
26464
- const callbackUrl = `${window.location.href}${window.location.href.includes("?") ? "&" : "?"}token=${encodeURIComponent(token)}`;
26465
- await handleCallback(callbackUrl);
26466
- });
26467
- } catch (e2) {
26468
- console.warn("Tauri google-auth listener install failed:", e2);
26469
- }
26470
26447
  return;
26471
26448
  }
26472
26449
  const isLocalhost = true;
@@ -26599,38 +26576,19 @@ var init_useYocoPayment = __esm({
26599
26576
  externalCallback
26600
26577
  );
26601
26578
  });
26602
- await listen2("payment-result", async (event) => {
26603
- if (paymentWindowRef) {
26604
- try {
26605
- await paymentWindowRef.close();
26606
- paymentWindowRef = null;
26607
- } catch (e2) {
26608
- console.warn("Error closing Tauri payment window:", e2);
26609
- }
26610
- }
26611
- const payload = event?.payload || {};
26612
- const params = new URLSearchParams();
26613
- if (payload.status) params.set("status", payload.status);
26614
- if (payload.mode) params.set("mode", payload.mode);
26615
- if (payload.app) params.set("app", payload.app);
26616
- if (payload.checkoutId) params.set("checkoutId", payload.checkoutId);
26617
- const url = `?${params.toString()}`;
26618
- handlePaymentCallback(url, externalCallback);
26619
- });
26620
26579
  }
26621
26580
  };
26622
26581
  createPayment = async (amountZAR, {
26623
26582
  appId = "tevrocsoft",
26624
26583
  serviceUrl = "https://tevrocsoftapi.netlify.app",
26625
26584
  payAccount = "default",
26626
- companyId,
26627
26585
  externalCallback = () => {
26628
26586
  }
26629
26587
  } = {}) => {
26630
26588
  await initializePayment(externalCallback);
26631
26589
  const cents = Math.round(Number(amountZAR) * 100);
26632
26590
  const basePaymentUrl = `${serviceUrl.replace(/\/$/, "")}/yoco-pay`;
26633
- const paymentUrl = `${basePaymentUrl}?mode=mobile&amount=${cents}&app=${appId}&account=${payAccount}${companyId ? `&companyId=${encodeURIComponent(companyId)}` : ""}`;
26591
+ const paymentUrl = `${basePaymentUrl}?mode=mobile&amount=${cents}&app=${appId}&account=${payAccount}`;
26634
26592
  console.log(basePaymentUrl, paymentUrl);
26635
26593
  if (isCapacitor) {
26636
26594
  await Browser2.open({
@@ -26639,7 +26597,7 @@ var init_useYocoPayment = __esm({
26639
26597
  return;
26640
26598
  }
26641
26599
  if (isTauri) {
26642
- const url = `${basePaymentUrl}?mode=desktop&amount=${cents}&app=${appId}&account=${payAccount}${companyId ? `&companyId=${encodeURIComponent(companyId)}` : ""}`;
26600
+ const url = `${basePaymentUrl}?mode=desktop&amount=${cents}&app=${appId}&account=${payAccount}`;
26643
26601
  const win = new WebviewWindow("payment", {
26644
26602
  url,
26645
26603
  title: "Complete Payment",
@@ -26659,7 +26617,7 @@ var init_useYocoPayment = __esm({
26659
26617
  }
26660
26618
  const isLocalhost = window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1";
26661
26619
  const mode = isLocalhost ? "localhost" : "netlify";
26662
- const finalUrl = `${basePaymentUrl}?mode=${mode}&amount=${cents}&app=${appId}${companyId ? `&companyId=${encodeURIComponent(companyId)}` : ""}`;
26620
+ const finalUrl = `${basePaymentUrl}?mode=${mode}&amount=${cents}&app=${appId}`;
26663
26621
  try {
26664
26622
  const popup = window.open(finalUrl, "yocoPayment", "width=500,height=650");
26665
26623
  if (!popup) {
@@ -41489,13 +41447,12 @@ function createPlatformApi(client) {
41489
41447
  }
41490
41448
  function createPaymentApi(client) {
41491
41449
  return {
41492
- create: async ({ amountZAR, appId = "tevrocsoft", mode = "web", account = "default", companyId, externalCallback = void 0 } = {}) => {
41450
+ create: async ({ amountZAR, appId = "tevrocsoft", mode = "web", account = "default", externalCallback = void 0 } = {}) => {
41493
41451
  return await createPayment(amountZAR, {
41494
41452
  appId,
41495
41453
  serviceUrl: client.serviceUrl,
41496
41454
  mode,
41497
41455
  payAccount: account,
41498
- companyId,
41499
41456
  externalCallback
41500
41457
  });
41501
41458
  },