@symbo.ls/sdk 2.33.38 → 2.33.39

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.
@@ -831,7 +831,9 @@ var PlanService = class extends BaseService {
831
831
  }
832
832
  throw new Error(response.message);
833
833
  } catch (error) {
834
- throw new Error(`Failed to get plans with pricing: ${error.message}`, { cause: error });
834
+ throw new Error(`Failed to get plans with pricing: ${error.message}`, {
835
+ cause: error
836
+ });
835
837
  }
836
838
  }
837
839
  /**
@@ -870,7 +872,9 @@ var PlanService = class extends BaseService {
870
872
  }
871
873
  throw new Error(response.message);
872
874
  } catch (error) {
873
- throw new Error(`Failed to get admin plans: ${error.message}`, { cause: error });
875
+ throw new Error(`Failed to get admin plans: ${error.message}`, {
876
+ cause: error
877
+ });
874
878
  }
875
879
  }
876
880
  /**
@@ -892,7 +896,9 @@ var PlanService = class extends BaseService {
892
896
  }
893
897
  throw new Error(response.message);
894
898
  } catch (error) {
895
- throw new Error(`Failed to create plan: ${error.message}`, { cause: error });
899
+ throw new Error(`Failed to create plan: ${error.message}`, {
900
+ cause: error
901
+ });
896
902
  }
897
903
  }
898
904
  /**
@@ -917,7 +923,9 @@ var PlanService = class extends BaseService {
917
923
  }
918
924
  throw new Error(response.message);
919
925
  } catch (error) {
920
- throw new Error(`Failed to update plan: ${error.message}`, { cause: error });
926
+ throw new Error(`Failed to update plan: ${error.message}`, {
927
+ cause: error
928
+ });
921
929
  }
922
930
  }
923
931
  /**
@@ -938,7 +946,9 @@ var PlanService = class extends BaseService {
938
946
  }
939
947
  throw new Error(response.message);
940
948
  } catch (error) {
941
- throw new Error(`Failed to delete plan: ${error.message}`, { cause: error });
949
+ throw new Error(`Failed to delete plan: ${error.message}`, {
950
+ cause: error
951
+ });
942
952
  }
943
953
  }
944
954
  /**
@@ -956,7 +966,9 @@ var PlanService = class extends BaseService {
956
966
  }
957
967
  throw new Error(response.message);
958
968
  } catch (error) {
959
- throw new Error(`Failed to initialize plans: ${error.message}`, { cause: error });
969
+ throw new Error(`Failed to initialize plans: ${error.message}`, {
970
+ cause: error
971
+ });
960
972
  }
961
973
  }
962
974
  // ==================== PLAN HELPER METHODS ====================
@@ -971,7 +983,9 @@ var PlanService = class extends BaseService {
971
983
  }
972
984
  return plans;
973
985
  } catch (error) {
974
- throw new Error(`Failed to get plans with validation: ${error.message}`, { cause: error });
986
+ throw new Error(`Failed to get plans with validation: ${error.message}`, {
987
+ cause: error
988
+ });
975
989
  }
976
990
  }
977
991
  /**
@@ -988,7 +1002,9 @@ var PlanService = class extends BaseService {
988
1002
  }
989
1003
  return plan;
990
1004
  } catch (error) {
991
- throw new Error(`Failed to get plan with validation: ${error.message}`, { cause: error });
1005
+ throw new Error(`Failed to get plan with validation: ${error.message}`, {
1006
+ cause: error
1007
+ });
992
1008
  }
993
1009
  }
994
1010
  /**
@@ -1005,11 +1021,15 @@ var PlanService = class extends BaseService {
1005
1021
  }
1006
1022
  }
1007
1023
  if (Object.hasOwn(planData, "price")) {
1008
- throw new Error('Field "price" is no longer supported. Use unified "pricingOptions" with "amount" instead.');
1024
+ throw new Error(
1025
+ 'Field "price" is no longer supported. Use unified "pricingOptions" with "amount" instead.'
1026
+ );
1009
1027
  }
1010
1028
  if (planData.pricingOptions != null) {
1011
1029
  if (!Array.isArray(planData.pricingOptions) || planData.pricingOptions.length === 0) {
1012
- throw new Error("pricingOptions must be a non-empty array when provided");
1030
+ throw new Error(
1031
+ "pricingOptions must be a non-empty array when provided"
1032
+ );
1013
1033
  }
1014
1034
  const allowedIntervals = /* @__PURE__ */ new Set(["month", "year", "week", "day", null]);
1015
1035
  planData.pricingOptions.forEach((option, index) => {
@@ -1018,29 +1038,41 @@ var PlanService = class extends BaseService {
1018
1038
  }
1019
1039
  const { key, displayName, amount, interval, lookupKey } = option;
1020
1040
  if (!key || typeof key !== "string") {
1021
- throw new Error(`Pricing option at index ${index} is missing required field 'key'`);
1041
+ throw new Error(
1042
+ `Pricing option at index ${index} is missing required field 'key'`
1043
+ );
1022
1044
  }
1023
1045
  if (!/^[a-z0-9-]+$/u.test(key)) {
1024
- throw new Error(`Pricing option key '${key}' must contain only lowercase letters, numbers, and hyphens`);
1046
+ throw new Error(
1047
+ `Pricing option key '${key}' must contain only lowercase letters, numbers, and hyphens`
1048
+ );
1025
1049
  }
1026
1050
  if (!displayName || typeof displayName !== "string") {
1027
- throw new Error(`Pricing option '${key}' is missing required field 'displayName'`);
1051
+ throw new Error(
1052
+ `Pricing option '${key}' is missing required field 'displayName'`
1053
+ );
1028
1054
  }
1029
1055
  if (typeof amount !== "number" || amount < 0) {
1030
- throw new Error(`Pricing option '${key}' must have a non-negative numeric 'amount'`);
1056
+ throw new Error(
1057
+ `Pricing option '${key}' must have a non-negative numeric 'amount'`
1058
+ );
1031
1059
  }
1032
- if (interval != null && !allowedIntervals.has(interval)) {
1060
+ if (interval !== null && !allowedIntervals.has(interval)) {
1033
1061
  throw new Error(
1034
1062
  `Pricing option '${key}' has invalid interval '${interval}'. Allowed: month, year, week, day or null`
1035
1063
  );
1036
1064
  }
1037
1065
  if (!lookupKey || typeof lookupKey !== "string") {
1038
- throw new Error(`Pricing option '${key}' is missing required field 'lookupKey'`);
1066
+ throw new Error(
1067
+ `Pricing option '${key}' is missing required field 'lookupKey'`
1068
+ );
1039
1069
  }
1040
1070
  });
1041
1071
  }
1042
1072
  if (planData.key && !/^[a-z0-9-]+$/u.test(planData.key)) {
1043
- throw new Error("Plan key must contain only lowercase letters, numbers, and hyphens");
1073
+ throw new Error(
1074
+ "Plan key must contain only lowercase letters, numbers, and hyphens"
1075
+ );
1044
1076
  }
1045
1077
  return await this.createPlan(planData);
1046
1078
  }
@@ -1055,11 +1087,15 @@ var PlanService = class extends BaseService {
1055
1087
  throw new Error("Plan data must be a valid object");
1056
1088
  }
1057
1089
  if (Object.hasOwn(planData, "price")) {
1058
- throw new Error('Field "price" is no longer supported. Use unified "pricingOptions" with "amount" instead.');
1090
+ throw new Error(
1091
+ 'Field "price" is no longer supported. Use unified "pricingOptions" with "amount" instead.'
1092
+ );
1059
1093
  }
1060
1094
  if (planData.pricingOptions != null) {
1061
1095
  if (!Array.isArray(planData.pricingOptions) || planData.pricingOptions.length === 0) {
1062
- throw new Error("pricingOptions must be a non-empty array when provided");
1096
+ throw new Error(
1097
+ "pricingOptions must be a non-empty array when provided"
1098
+ );
1063
1099
  }
1064
1100
  const allowedIntervals = /* @__PURE__ */ new Set(["month", "year", "week", "day", null]);
1065
1101
  planData.pricingOptions.forEach((option, index) => {
@@ -1068,16 +1104,24 @@ var PlanService = class extends BaseService {
1068
1104
  }
1069
1105
  const { key, displayName, amount, interval, lookupKey } = option;
1070
1106
  if (!key || typeof key !== "string") {
1071
- throw new Error(`Pricing option at index ${index} is missing required field 'key'`);
1107
+ throw new Error(
1108
+ `Pricing option at index ${index} is missing required field 'key'`
1109
+ );
1072
1110
  }
1073
1111
  if (!/^[a-z0-9-]+$/u.test(key)) {
1074
- throw new Error(`Pricing option key '${key}' must contain only lowercase letters, numbers, and hyphens`);
1112
+ throw new Error(
1113
+ `Pricing option key '${key}' must contain only lowercase letters, numbers, and hyphens`
1114
+ );
1075
1115
  }
1076
1116
  if (!displayName || typeof displayName !== "string") {
1077
- throw new Error(`Pricing option '${key}' is missing required field 'displayName'`);
1117
+ throw new Error(
1118
+ `Pricing option '${key}' is missing required field 'displayName'`
1119
+ );
1078
1120
  }
1079
1121
  if (typeof amount !== "number" || amount < 0) {
1080
- throw new Error(`Pricing option '${key}' must have a non-negative numeric 'amount'`);
1122
+ throw new Error(
1123
+ `Pricing option '${key}' must have a non-negative numeric 'amount'`
1124
+ );
1081
1125
  }
1082
1126
  if (interval != null && !allowedIntervals.has(interval)) {
1083
1127
  throw new Error(
@@ -1085,12 +1129,16 @@ var PlanService = class extends BaseService {
1085
1129
  );
1086
1130
  }
1087
1131
  if (!lookupKey || typeof lookupKey !== "string") {
1088
- throw new Error(`Pricing option '${key}' is missing required field 'lookupKey'`);
1132
+ throw new Error(
1133
+ `Pricing option '${key}' is missing required field 'lookupKey'`
1134
+ );
1089
1135
  }
1090
1136
  });
1091
1137
  }
1092
1138
  if (planData.key && !/^[a-z0-9-]+$/u.test(planData.key)) {
1093
- throw new Error("Plan key must contain only lowercase letters, numbers, and hyphens");
1139
+ throw new Error(
1140
+ "Plan key must contain only lowercase letters, numbers, and hyphens"
1141
+ );
1094
1142
  }
1095
1143
  return await this.updatePlan(planId, planData);
1096
1144
  }
@@ -1100,9 +1148,13 @@ var PlanService = class extends BaseService {
1100
1148
  async getActivePlans() {
1101
1149
  try {
1102
1150
  const plans = await this.getPlans();
1103
- return plans.filter((plan) => plan.status === "active" && plan.isVisible !== false);
1151
+ return plans.filter(
1152
+ (plan) => plan.status === "active" && plan.isVisible !== false
1153
+ );
1104
1154
  } catch (error) {
1105
- throw new Error(`Failed to get active plans: ${error.message}`, { cause: error });
1155
+ throw new Error(`Failed to get active plans: ${error.message}`, {
1156
+ cause: error
1157
+ });
1106
1158
  }
1107
1159
  }
1108
1160
  /**
@@ -1117,7 +1169,9 @@ var PlanService = class extends BaseService {
1117
1169
  return price >= minPrice && price <= maxPrice;
1118
1170
  });
1119
1171
  } catch (error) {
1120
- throw new Error(`Failed to get plans by price range: ${error.message}`, { cause: error });
1172
+ throw new Error(`Failed to get plans by price range: ${error.message}`, {
1173
+ cause: error
1174
+ });
1121
1175
  }
1122
1176
  }
1123
1177
  /**
@@ -1135,7 +1189,9 @@ var PlanService = class extends BaseService {
1135
1189
  }
1136
1190
  return plan;
1137
1191
  } catch (error) {
1138
- throw new Error(`Failed to get plan by key: ${error.message}`, { cause: error });
1192
+ throw new Error(`Failed to get plan by key: ${error.message}`, {
1193
+ cause: error
1194
+ });
1139
1195
  }
1140
1196
  }
1141
1197
  };
@@ -45051,7 +45051,9 @@ var PlanService = class extends BaseService {
45051
45051
  }
45052
45052
  throw new Error(response.message);
45053
45053
  } catch (error) {
45054
- throw new Error(`Failed to get plans with pricing: ${error.message}`, { cause: error });
45054
+ throw new Error(`Failed to get plans with pricing: ${error.message}`, {
45055
+ cause: error
45056
+ });
45055
45057
  }
45056
45058
  }
45057
45059
  /**
@@ -45090,7 +45092,9 @@ var PlanService = class extends BaseService {
45090
45092
  }
45091
45093
  throw new Error(response.message);
45092
45094
  } catch (error) {
45093
- throw new Error(`Failed to get admin plans: ${error.message}`, { cause: error });
45095
+ throw new Error(`Failed to get admin plans: ${error.message}`, {
45096
+ cause: error
45097
+ });
45094
45098
  }
45095
45099
  }
45096
45100
  /**
@@ -45112,7 +45116,9 @@ var PlanService = class extends BaseService {
45112
45116
  }
45113
45117
  throw new Error(response.message);
45114
45118
  } catch (error) {
45115
- throw new Error(`Failed to create plan: ${error.message}`, { cause: error });
45119
+ throw new Error(`Failed to create plan: ${error.message}`, {
45120
+ cause: error
45121
+ });
45116
45122
  }
45117
45123
  }
45118
45124
  /**
@@ -45137,7 +45143,9 @@ var PlanService = class extends BaseService {
45137
45143
  }
45138
45144
  throw new Error(response.message);
45139
45145
  } catch (error) {
45140
- throw new Error(`Failed to update plan: ${error.message}`, { cause: error });
45146
+ throw new Error(`Failed to update plan: ${error.message}`, {
45147
+ cause: error
45148
+ });
45141
45149
  }
45142
45150
  }
45143
45151
  /**
@@ -45158,7 +45166,9 @@ var PlanService = class extends BaseService {
45158
45166
  }
45159
45167
  throw new Error(response.message);
45160
45168
  } catch (error) {
45161
- throw new Error(`Failed to delete plan: ${error.message}`, { cause: error });
45169
+ throw new Error(`Failed to delete plan: ${error.message}`, {
45170
+ cause: error
45171
+ });
45162
45172
  }
45163
45173
  }
45164
45174
  /**
@@ -45176,7 +45186,9 @@ var PlanService = class extends BaseService {
45176
45186
  }
45177
45187
  throw new Error(response.message);
45178
45188
  } catch (error) {
45179
- throw new Error(`Failed to initialize plans: ${error.message}`, { cause: error });
45189
+ throw new Error(`Failed to initialize plans: ${error.message}`, {
45190
+ cause: error
45191
+ });
45180
45192
  }
45181
45193
  }
45182
45194
  // ==================== PLAN HELPER METHODS ====================
@@ -45191,7 +45203,9 @@ var PlanService = class extends BaseService {
45191
45203
  }
45192
45204
  return plans;
45193
45205
  } catch (error) {
45194
- throw new Error(`Failed to get plans with validation: ${error.message}`, { cause: error });
45206
+ throw new Error(`Failed to get plans with validation: ${error.message}`, {
45207
+ cause: error
45208
+ });
45195
45209
  }
45196
45210
  }
45197
45211
  /**
@@ -45208,7 +45222,9 @@ var PlanService = class extends BaseService {
45208
45222
  }
45209
45223
  return plan;
45210
45224
  } catch (error) {
45211
- throw new Error(`Failed to get plan with validation: ${error.message}`, { cause: error });
45225
+ throw new Error(`Failed to get plan with validation: ${error.message}`, {
45226
+ cause: error
45227
+ });
45212
45228
  }
45213
45229
  }
45214
45230
  /**
@@ -45225,11 +45241,15 @@ var PlanService = class extends BaseService {
45225
45241
  }
45226
45242
  }
45227
45243
  if (Object.hasOwn(planData, "price")) {
45228
- throw new Error('Field "price" is no longer supported. Use unified "pricingOptions" with "amount" instead.');
45244
+ throw new Error(
45245
+ 'Field "price" is no longer supported. Use unified "pricingOptions" with "amount" instead.'
45246
+ );
45229
45247
  }
45230
45248
  if (planData.pricingOptions != null) {
45231
45249
  if (!Array.isArray(planData.pricingOptions) || planData.pricingOptions.length === 0) {
45232
- throw new Error("pricingOptions must be a non-empty array when provided");
45250
+ throw new Error(
45251
+ "pricingOptions must be a non-empty array when provided"
45252
+ );
45233
45253
  }
45234
45254
  const allowedIntervals = /* @__PURE__ */ new Set(["month", "year", "week", "day", null]);
45235
45255
  planData.pricingOptions.forEach((option, index) => {
@@ -45238,29 +45258,41 @@ var PlanService = class extends BaseService {
45238
45258
  }
45239
45259
  const { key, displayName, amount, interval, lookupKey } = option;
45240
45260
  if (!key || typeof key !== "string") {
45241
- throw new Error(`Pricing option at index ${index} is missing required field 'key'`);
45261
+ throw new Error(
45262
+ `Pricing option at index ${index} is missing required field 'key'`
45263
+ );
45242
45264
  }
45243
45265
  if (!/^[a-z0-9-]+$/u.test(key)) {
45244
- throw new Error(`Pricing option key '${key}' must contain only lowercase letters, numbers, and hyphens`);
45266
+ throw new Error(
45267
+ `Pricing option key '${key}' must contain only lowercase letters, numbers, and hyphens`
45268
+ );
45245
45269
  }
45246
45270
  if (!displayName || typeof displayName !== "string") {
45247
- throw new Error(`Pricing option '${key}' is missing required field 'displayName'`);
45271
+ throw new Error(
45272
+ `Pricing option '${key}' is missing required field 'displayName'`
45273
+ );
45248
45274
  }
45249
45275
  if (typeof amount !== "number" || amount < 0) {
45250
- throw new Error(`Pricing option '${key}' must have a non-negative numeric 'amount'`);
45276
+ throw new Error(
45277
+ `Pricing option '${key}' must have a non-negative numeric 'amount'`
45278
+ );
45251
45279
  }
45252
- if (interval != null && !allowedIntervals.has(interval)) {
45280
+ if (interval !== null && !allowedIntervals.has(interval)) {
45253
45281
  throw new Error(
45254
45282
  `Pricing option '${key}' has invalid interval '${interval}'. Allowed: month, year, week, day or null`
45255
45283
  );
45256
45284
  }
45257
45285
  if (!lookupKey || typeof lookupKey !== "string") {
45258
- throw new Error(`Pricing option '${key}' is missing required field 'lookupKey'`);
45286
+ throw new Error(
45287
+ `Pricing option '${key}' is missing required field 'lookupKey'`
45288
+ );
45259
45289
  }
45260
45290
  });
45261
45291
  }
45262
45292
  if (planData.key && !/^[a-z0-9-]+$/u.test(planData.key)) {
45263
- throw new Error("Plan key must contain only lowercase letters, numbers, and hyphens");
45293
+ throw new Error(
45294
+ "Plan key must contain only lowercase letters, numbers, and hyphens"
45295
+ );
45264
45296
  }
45265
45297
  return await this.createPlan(planData);
45266
45298
  }
@@ -45275,11 +45307,15 @@ var PlanService = class extends BaseService {
45275
45307
  throw new Error("Plan data must be a valid object");
45276
45308
  }
45277
45309
  if (Object.hasOwn(planData, "price")) {
45278
- throw new Error('Field "price" is no longer supported. Use unified "pricingOptions" with "amount" instead.');
45310
+ throw new Error(
45311
+ 'Field "price" is no longer supported. Use unified "pricingOptions" with "amount" instead.'
45312
+ );
45279
45313
  }
45280
45314
  if (planData.pricingOptions != null) {
45281
45315
  if (!Array.isArray(planData.pricingOptions) || planData.pricingOptions.length === 0) {
45282
- throw new Error("pricingOptions must be a non-empty array when provided");
45316
+ throw new Error(
45317
+ "pricingOptions must be a non-empty array when provided"
45318
+ );
45283
45319
  }
45284
45320
  const allowedIntervals = /* @__PURE__ */ new Set(["month", "year", "week", "day", null]);
45285
45321
  planData.pricingOptions.forEach((option, index) => {
@@ -45288,16 +45324,24 @@ var PlanService = class extends BaseService {
45288
45324
  }
45289
45325
  const { key, displayName, amount, interval, lookupKey } = option;
45290
45326
  if (!key || typeof key !== "string") {
45291
- throw new Error(`Pricing option at index ${index} is missing required field 'key'`);
45327
+ throw new Error(
45328
+ `Pricing option at index ${index} is missing required field 'key'`
45329
+ );
45292
45330
  }
45293
45331
  if (!/^[a-z0-9-]+$/u.test(key)) {
45294
- throw new Error(`Pricing option key '${key}' must contain only lowercase letters, numbers, and hyphens`);
45332
+ throw new Error(
45333
+ `Pricing option key '${key}' must contain only lowercase letters, numbers, and hyphens`
45334
+ );
45295
45335
  }
45296
45336
  if (!displayName || typeof displayName !== "string") {
45297
- throw new Error(`Pricing option '${key}' is missing required field 'displayName'`);
45337
+ throw new Error(
45338
+ `Pricing option '${key}' is missing required field 'displayName'`
45339
+ );
45298
45340
  }
45299
45341
  if (typeof amount !== "number" || amount < 0) {
45300
- throw new Error(`Pricing option '${key}' must have a non-negative numeric 'amount'`);
45342
+ throw new Error(
45343
+ `Pricing option '${key}' must have a non-negative numeric 'amount'`
45344
+ );
45301
45345
  }
45302
45346
  if (interval != null && !allowedIntervals.has(interval)) {
45303
45347
  throw new Error(
@@ -45305,12 +45349,16 @@ var PlanService = class extends BaseService {
45305
45349
  );
45306
45350
  }
45307
45351
  if (!lookupKey || typeof lookupKey !== "string") {
45308
- throw new Error(`Pricing option '${key}' is missing required field 'lookupKey'`);
45352
+ throw new Error(
45353
+ `Pricing option '${key}' is missing required field 'lookupKey'`
45354
+ );
45309
45355
  }
45310
45356
  });
45311
45357
  }
45312
45358
  if (planData.key && !/^[a-z0-9-]+$/u.test(planData.key)) {
45313
- throw new Error("Plan key must contain only lowercase letters, numbers, and hyphens");
45359
+ throw new Error(
45360
+ "Plan key must contain only lowercase letters, numbers, and hyphens"
45361
+ );
45314
45362
  }
45315
45363
  return await this.updatePlan(planId, planData);
45316
45364
  }
@@ -45320,9 +45368,13 @@ var PlanService = class extends BaseService {
45320
45368
  async getActivePlans() {
45321
45369
  try {
45322
45370
  const plans = await this.getPlans();
45323
- return plans.filter((plan) => plan.status === "active" && plan.isVisible !== false);
45371
+ return plans.filter(
45372
+ (plan) => plan.status === "active" && plan.isVisible !== false
45373
+ );
45324
45374
  } catch (error) {
45325
- throw new Error(`Failed to get active plans: ${error.message}`, { cause: error });
45375
+ throw new Error(`Failed to get active plans: ${error.message}`, {
45376
+ cause: error
45377
+ });
45326
45378
  }
45327
45379
  }
45328
45380
  /**
@@ -45337,7 +45389,9 @@ var PlanService = class extends BaseService {
45337
45389
  return price >= minPrice && price <= maxPrice;
45338
45390
  });
45339
45391
  } catch (error) {
45340
- throw new Error(`Failed to get plans by price range: ${error.message}`, { cause: error });
45392
+ throw new Error(`Failed to get plans by price range: ${error.message}`, {
45393
+ cause: error
45394
+ });
45341
45395
  }
45342
45396
  }
45343
45397
  /**
@@ -45355,7 +45409,9 @@ var PlanService = class extends BaseService {
45355
45409
  }
45356
45410
  return plan;
45357
45411
  } catch (error) {
45358
- throw new Error(`Failed to get plan by key: ${error.message}`, { cause: error });
45412
+ throw new Error(`Failed to get plan by key: ${error.message}`, {
45413
+ cause: error
45414
+ });
45359
45415
  }
45360
45416
  }
45361
45417
  };