@spritz-finance/service-client 0.3.38 → 0.3.40

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.
@@ -2,4 +2,9 @@ export * as FeaturesClient from './featuresServiceClient';
2
2
  import { FeatureFlag, FeatureFlags } from './types';
3
3
  export declare function getFeatureFlags(): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<FeatureFlags>>;
4
4
  export declare function isFeatureFlagEnabled(flag: FeatureFlag): Promise<boolean>;
5
- export declare function isPaymentsEnabled(network?: string): Promise<boolean>;
5
+ export declare function isPaymentsEnabled(network?: string, allFlags?: FeatureFlags): Promise<boolean>;
6
+ /**
7
+ * Synchronously checks if a feature flag is enabled from a provided flags object.
8
+ * Use this when you already have the flags and want to avoid refetching them.
9
+ */
10
+ export declare function isFeatureEnabled(flag: FeatureFlag, allFlags?: FeatureFlags): Promise<boolean>;
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.isPaymentsEnabled = exports.isFeatureFlagEnabled = exports.getFeatureFlags = exports.FeaturesClient = void 0;
26
+ exports.isFeatureEnabled = exports.isPaymentsEnabled = exports.isFeatureFlagEnabled = exports.getFeatureFlags = exports.FeaturesClient = void 0;
27
27
  exports.FeaturesClient = __importStar(require("./featuresServiceClient"));
28
28
  const serviceClient_1 = require("../serviceClient");
29
29
  const utils_1 = require("../utils");
@@ -53,6 +53,8 @@ const networkToFlag = (network) => {
53
53
  return types_1.FeatureFlag.BtcPayments;
54
54
  case 'dash':
55
55
  return types_1.FeatureFlag.DashPayments;
56
+ case 'sui':
57
+ return types_1.FeatureFlag.SuiPayments;
56
58
  default:
57
59
  return null;
58
60
  }
@@ -72,17 +74,35 @@ async function isFeatureFlagEnabled(flag) {
72
74
  return (_b = (_a = flags[flag]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : false;
73
75
  }
74
76
  exports.isFeatureFlagEnabled = isFeatureFlagEnabled;
75
- async function isPaymentsEnabled(network) {
76
- var _a, _b, _c;
77
+ async function getFlags() {
77
78
  const response = await getFeatureFlags();
78
79
  if ((0, utils_1.isApiError)(response))
80
+ return null;
81
+ return response.data;
82
+ }
83
+ async function isPaymentsEnabled(network, allFlags) {
84
+ var _a, _b, _c;
85
+ const flags = allFlags !== null && allFlags !== void 0 ? allFlags : (await getFlags());
86
+ if (!flags)
79
87
  return false;
80
- const flags = response.data;
81
88
  if (!((_a = flags[types_1.FeatureFlag.PaymentsEnabled]) === null || _a === void 0 ? void 0 : _a.value))
82
89
  return false;
83
90
  if (!network)
84
91
  return true;
85
92
  const networkFlag = networkToFlag(network);
93
+ // this will default to true if we have not handled the network yet
86
94
  return networkFlag ? (_c = (_b = flags[networkFlag]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : true : true;
87
95
  }
88
96
  exports.isPaymentsEnabled = isPaymentsEnabled;
97
+ /**
98
+ * Synchronously checks if a feature flag is enabled from a provided flags object.
99
+ * Use this when you already have the flags and want to avoid refetching them.
100
+ */
101
+ async function isFeatureEnabled(flag, allFlags) {
102
+ var _a, _b;
103
+ const flags = allFlags !== null && allFlags !== void 0 ? allFlags : (await getFlags());
104
+ if (!flags)
105
+ return false;
106
+ return (_b = (_a = flags[flag]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : false;
107
+ }
108
+ exports.isFeatureEnabled = isFeatureEnabled;
@@ -20,6 +20,8 @@ export declare enum FeatureFlag {
20
20
  TronPayments = "payments.network.tron",
21
21
  BtcPayments = "payments.network.bitcoin",
22
22
  DashPayments = "payments.network.dash",
23
+ SuiPayments = "payments.network.sui",
24
+ SuiMUSDPayments = "payments.token.sui.musd",
23
25
  SpritzCardNoKycEnabled = "spritzCard.noKyc.enabled",
24
26
  SpritzCardNoKycPayments = "spritzCard.noKyc.payments",
25
27
  BinanceBridgeEnabled = "binanceBridge.enabled"
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FeatureFlag = void 0;
4
4
  var FeatureFlag;
5
5
  (function (FeatureFlag) {
6
+ // Payments
6
7
  FeatureFlag["PaymentsEnabled"] = "payments.enabled";
7
8
  FeatureFlag["EthereumPayments"] = "payments.network.ethereum";
8
9
  FeatureFlag["PolygonPayments"] = "payments.network.polygon";
@@ -15,7 +16,12 @@ var FeatureFlag;
15
16
  FeatureFlag["TronPayments"] = "payments.network.tron";
16
17
  FeatureFlag["BtcPayments"] = "payments.network.bitcoin";
17
18
  FeatureFlag["DashPayments"] = "payments.network.dash";
19
+ FeatureFlag["SuiPayments"] = "payments.network.sui";
20
+ // Token Specific
21
+ FeatureFlag["SuiMUSDPayments"] = "payments.token.sui.musd";
22
+ // Features
18
23
  FeatureFlag["SpritzCardNoKycEnabled"] = "spritzCard.noKyc.enabled";
19
24
  FeatureFlag["SpritzCardNoKycPayments"] = "spritzCard.noKyc.payments";
25
+ // Operations
20
26
  FeatureFlag["BinanceBridgeEnabled"] = "binanceBridge.enabled";
21
27
  })(FeatureFlag || (exports.FeatureFlag = FeatureFlag = {}));
@@ -590,6 +590,7 @@ export type DigitalAccount = PayableAccount & {
590
590
  digitalAccountType: DigitalAccountType;
591
591
  disabled: Scalars['Boolean']['output'];
592
592
  externalId?: Maybe<Scalars['String']['output']>;
593
+ holder?: Maybe<Scalars['String']['output']>;
593
594
  id: Scalars['ID']['output'];
594
595
  institution?: Maybe<PayableAccountInstitution>;
595
596
  mask?: Maybe<Scalars['String']['output']>;
@@ -607,7 +608,7 @@ export type DigitalAccount = PayableAccount & {
607
608
  };
608
609
  export type DigitalAccountInput = {
609
610
  identifier: Scalars['String']['input'];
610
- name?: InputMaybe<Scalars['String']['input']>;
611
+ name: Scalars['String']['input'];
611
612
  type: DigitalAccountType;
612
613
  };
613
614
  export declare enum DigitalAccountType {
@@ -1358,6 +1359,7 @@ export declare enum Network {
1358
1359
  Optimism = "Optimism",
1359
1360
  Polygon = "Polygon",
1360
1361
  Solana = "Solana",
1362
+ Sui = "Sui",
1361
1363
  Tron = "Tron"
1362
1364
  }
1363
1365
  export type OnRampPayment = {
@@ -123,6 +123,7 @@ var Network;
123
123
  Network["Optimism"] = "Optimism";
124
124
  Network["Polygon"] = "Polygon";
125
125
  Network["Solana"] = "Solana";
126
+ Network["Sui"] = "Sui";
126
127
  Network["Tron"] = "Tron";
127
128
  })(Network || (exports.Network = Network = {}));
128
129
  var OnrampPaymentStatus;
@@ -1,4 +1,4 @@
1
- import { AccountProvider, AccountSyncStatus, BankAccount, Bill, BillType, DebitCard, PayableAccountInstitution as GraphInstitution, PayableAccountOriginator, PayableAccountType, VirtualCard } from '../lib/graphClient/generated';
1
+ import { AccountProvider, AccountSyncStatus, BankAccount, Bill, BillType, DebitCard, DigitalAccount, PayableAccountInstitution as GraphInstitution, PayableAccountOriginator, PayableAccountType, VirtualCard } from '../lib/graphClient/generated';
2
2
  export { AccountSyncStatus, PayableAccountOriginator, } from '../lib/graphClient/generated';
3
3
  export declare enum BankAccountSubType {
4
4
  Business = "BUSINESS",
@@ -54,11 +54,13 @@ type BillModel = Omit<Bill, 'type' | 'institution'> & PayableAccountModelExtensi
54
54
  type BankAcountModel = Omit<BankAccount, 'type' | 'institution'> & PayableAccountModelExtension;
55
55
  type VirtualCardModel = Omit<VirtualCard, 'type' | 'institution'> & PayableAccountModelExtension;
56
56
  type DebitCardModel = Omit<DebitCard, 'type' | 'institution'> & PayableAccountModelExtension;
57
+ type DigitalAccountModel = Omit<DigitalAccount, 'type' | 'institution'> & PayableAccountModelExtension;
57
58
  export type PayableAccount = BankAcountModel | VirtualCardModel | BillModel | DebitCardModel;
58
59
  export type PayableAccountBankAccount = BankAcountModel;
59
60
  export type PayableAccountVirtualCard = VirtualCardModel;
60
61
  export type PayableAccountBill = BillModel;
61
62
  export type PayableAccountDebitCard = DebitCardModel;
63
+ export type PayableAccountDigitalAccount = DigitalAccountModel;
62
64
  export type PayableAccountInstitution = GraphInstitution & {
63
65
  identificationNumber: string;
64
66
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spritz-finance/service-client",
3
- "version": "0.3.38",
3
+ "version": "0.3.40",
4
4
  "description": "Service client",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",