@tagadapay/plugin-sdk 3.1.9 → 3.1.11

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.
@@ -1,6 +1,7 @@
1
1
  /**
2
- * TagadaPay SDK v3.1.9
3
- * CDN Bundle - Full standalone SDK for external/vanilla pages (Debug Build)
2
+ * TagadaPay SDK v3.1.11
3
+ * CDN Bundle - Full standalone SDK (Debug Build)
4
+ * Usage: window.tgd.createTagadaClient(), window.tgd.formatMoney(), etc.
4
5
  * @license MIT
5
6
  */
6
7
  "use strict";
@@ -1603,6 +1604,7 @@ var TagadaSDKBundle = (() => {
1603
1604
  createRawPluginConfig: () => createRawPluginConfig,
1604
1605
  createTagadaClient: () => createTagadaClient,
1605
1606
  debounceConfigUpdate: () => debounceConfigUpdate,
1607
+ formatMoney: () => formatMoney,
1606
1608
  funnelQueryKeys: () => funnelQueryKeys,
1607
1609
  getFunnelSessionCookie: () => getFunnelSessionCookie,
1608
1610
  getFunnelVariantId: () => getFunnelVariantId,
@@ -9411,6 +9413,26 @@ var TagadaSDKBundle = (() => {
9411
9413
  };
9412
9414
 
9413
9415
  // src/v2/core/utils/currency.ts
9416
+ function formatMoney(amountMinorUnits, currencyCode = "USD", locale = "en-US") {
9417
+ const decimalPlaces = CurrencyUtils.getDecimalPlaces(currencyCode);
9418
+ let value;
9419
+ if (decimalPlaces === 0) {
9420
+ value = amountMinorUnits / 100;
9421
+ } else {
9422
+ value = amountMinorUnits / Math.pow(10, decimalPlaces);
9423
+ }
9424
+ try {
9425
+ return new Intl.NumberFormat(locale, {
9426
+ style: "currency",
9427
+ currency: currencyCode,
9428
+ minimumFractionDigits: decimalPlaces,
9429
+ maximumFractionDigits: decimalPlaces
9430
+ }).format(value);
9431
+ } catch (e) {
9432
+ const symbol = CurrencyUtils.getCurrencySymbol(currencyCode);
9433
+ return "".concat(symbol).concat(value.toFixed(decimalPlaces));
9434
+ }
9435
+ }
9414
9436
  var CurrencyUtils = class {
9415
9437
  /**
9416
9438
  * Get currency from context or fallback to default
@@ -10130,13 +10152,15 @@ is-standalone-pwa/dist/esm/index.js:
10130
10152
  Author: Faisal Salman <f@faisalman.com>
10131
10153
  MIT License *)
10132
10154
  */
10133
- // Expose SDK exports globally
10155
+ // Expose SDK under window.tgd namespace (clean, single global)
10134
10156
  if (typeof window !== 'undefined' && TagadaSDKBundle) {
10135
- window.TagadaSDK = TagadaSDKBundle;
10136
- window.createTagadaClient = TagadaSDKBundle.createTagadaClient;
10137
- window.getPluginConfig = TagadaSDKBundle.getPluginConfig;
10138
- window.loadPluginConfig = TagadaSDKBundle.loadPluginConfig;
10139
- window.onConfigUpdate = TagadaSDKBundle.onConfigUpdate;
10140
- window.sendConfigUpdate = TagadaSDKBundle.sendConfigUpdate;
10141
- window.broadcastConfigUpdate = TagadaSDKBundle.broadcastConfigUpdate;
10157
+ window.tgd = window.tgd || {};
10158
+ window.tgd.createTagadaClient = TagadaSDKBundle.createTagadaClient;
10159
+ window.tgd.getPluginConfig = TagadaSDKBundle.getPluginConfig;
10160
+ window.tgd.loadPluginConfig = TagadaSDKBundle.loadPluginConfig;
10161
+ window.tgd.onConfigUpdate = TagadaSDKBundle.onConfigUpdate;
10162
+ window.tgd.sendConfigUpdate = TagadaSDKBundle.sendConfigUpdate;
10163
+ window.tgd.broadcastConfigUpdate = TagadaSDKBundle.broadcastConfigUpdate;
10164
+ window.tgd.formatMoney = TagadaSDKBundle.formatMoney;
10165
+ window.tgd.sdk = TagadaSDKBundle;
10142
10166
  }