@zyratalk1/zyra-twilio-wrapper 1.2.1 → 1.2.2

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/dist/index.js CHANGED
@@ -1192,54 +1192,6 @@ async function setRoutingConfig(deps, input) {
1192
1192
  }
1193
1193
  }
1194
1194
 
1195
- // src/twilioConfig.ts
1196
- async function setTwilioVoiceConfig(deps) {
1197
- try {
1198
- const res = await deps.axiosInstance.post(
1199
- `${deps.serverUrl}/voipSdk.setTwilioVoiceConfig`,
1200
- {},
1201
- {
1202
- headers: {
1203
- Authorization: `Bearer ${deps.sdkToken}`
1204
- }
1205
- }
1206
- );
1207
- const result = res?.data?.result ?? res?.data;
1208
- return createSuccessResult(
1209
- result?.message || "Twilio voice config updated",
1210
- result
1211
- );
1212
- } catch (error) {
1213
- return createErrorResult(
1214
- error instanceof Error ? error : "Failed to set Twilio voice config"
1215
- );
1216
- }
1217
- }
1218
- async function getVoipProviderConfigStatus(deps) {
1219
- try {
1220
- const res = await deps.axiosInstance.post(
1221
- `${deps.serverUrl}/voipSdk.getVoipProviderConfigStatus`,
1222
- {},
1223
- {
1224
- headers: {
1225
- Authorization: `Bearer ${deps.sdkToken}`
1226
- }
1227
- }
1228
- );
1229
- const data = res?.data?.result ?? res?.data;
1230
- const raw = data?.data?.isConfiguredVoipProvider;
1231
- const isConfiguredVoipProvider = raw === true || raw === 1 || raw === "1";
1232
- return createSuccessResult(
1233
- "VoIP provider config status fetched",
1234
- { isConfiguredVoipProvider }
1235
- );
1236
- } catch (error) {
1237
- return createErrorResult(
1238
- error instanceof Error ? error : "Failed to fetch VoIP provider config status"
1239
- );
1240
- }
1241
- }
1242
-
1243
1195
  // src/webhook.ts
1244
1196
  function validateWebhookUrl(webhookUrl) {
1245
1197
  const trimmed = (webhookUrl ?? "").trim();
@@ -1411,12 +1363,6 @@ var ConfigService = class {
1411
1363
  async welcomeMessageConfig(welcomeType, welcomeMessage) {
1412
1364
  return welcomeMessageConfig(this.withDeps(), { welcomeType, welcomeMessage });
1413
1365
  }
1414
- async getVoipProviderConfigStatus() {
1415
- return getVoipProviderConfigStatus(this.withDeps());
1416
- }
1417
- async setTwilioVoiceConfig() {
1418
- return setTwilioVoiceConfig(this.withDeps());
1419
- }
1420
1366
  withDeps() {
1421
1367
  return {
1422
1368
  axiosInstance: this.axiosInstance,
@@ -1625,37 +1571,16 @@ var ReactNativeVoipSdk = class {
1625
1571
  async initializeSDK(config) {
1626
1572
  logVoipDebug("initializeSDK() called");
1627
1573
  if (this.initialized) return;
1628
- try {
1629
- const configStatus = await this.configService.getVoipProviderConfigStatus();
1630
- if (!configStatus.success) {
1631
- throw new Error("Failed to fetch VoIP provider config status");
1632
- }
1633
- const isConfigured = configStatus.data?.isConfiguredVoipProvider;
1634
- logVoipDebug("VoIP config status checked", { isConfigured });
1635
- if (!isConfigured) {
1636
- logVoipDebug("VoIP not configured. Setting Twilio config");
1637
- const setupRes = await this.configService.setTwilioVoiceConfig();
1638
- if (!setupRes.success) {
1639
- throw new Error("Failed to set Twilio Voice Config");
1640
- }
1641
- logVoipDebug("VoIP configuration completed");
1642
- }
1643
- const mergedConfig = { ...this.sdkConfig, ...config };
1644
- const result = await this.bridge.nativeModule.initializeSDK(mergedConfig);
1645
- if (!result.success) {
1646
- logVoipDebug("initializeSDK() failed", {
1647
- error: result.error ?? "Failed to initialize native VOIP SDK"
1648
- });
1649
- throw new Error(result.error ?? "Failed to initialize native VOIP SDK");
1650
- }
1651
- this.initialized = true;
1652
- logVoipDebug("initializeSDK() success");
1653
- } catch (error) {
1654
- logVoipDebug("initializeSDK() config check failure", {
1655
- message: error instanceof Error ? error.message : String(error)
1574
+ const mergedConfig = { ...this.sdkConfig, ...config };
1575
+ const result = await this.bridge.nativeModule.initializeSDK(mergedConfig);
1576
+ if (!result.success) {
1577
+ logVoipDebug("initializeSDK() failed", {
1578
+ error: result.error ?? "Failed to initialize native VOIP SDK"
1656
1579
  });
1657
- throw error;
1580
+ throw new Error(result.error ?? "Failed to initialize native VOIP SDK");
1658
1581
  }
1582
+ this.initialized = true;
1583
+ logVoipDebug("initializeSDK() success");
1659
1584
  }
1660
1585
  async authenticate(payload) {
1661
1586
  logVoipDebug("authenticate() start", {