@insurup/sdk 0.1.13 → 0.1.15

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.
Files changed (75) hide show
  1. package/README.md +100 -71
  2. package/dist/client/client.d.ts +160 -0
  3. package/dist/client/client.d.ts.map +1 -0
  4. package/dist/client/graphql.d.ts +51 -0
  5. package/dist/client/graphql.d.ts.map +1 -0
  6. package/dist/client/http.d.ts +173 -0
  7. package/dist/client/http.d.ts.map +1 -0
  8. package/dist/client/signalr.d.ts +69 -0
  9. package/dist/client/signalr.d.ts.map +1 -0
  10. package/dist/clients/_internal/build-filter-search-variables.d.ts +12 -0
  11. package/dist/clients/_internal/build-filter-search-variables.d.ts.map +1 -0
  12. package/dist/clients/_internal/normalize-search.d.ts +21 -0
  13. package/dist/clients/_internal/normalize-search.d.ts.map +1 -0
  14. package/dist/clients/_internal/split-unified-filter.d.ts +16 -0
  15. package/dist/clients/_internal/split-unified-filter.d.ts.map +1 -0
  16. package/dist/clients/agent.d.ts +121 -0
  17. package/dist/clients/agent.d.ts.map +1 -0
  18. package/dist/clients/agentBranch.d.ts +61 -0
  19. package/dist/clients/agentBranch.d.ts.map +1 -0
  20. package/dist/clients/agentRole.d.ts +60 -0
  21. package/dist/clients/agentRole.d.ts.map +1 -0
  22. package/dist/clients/agentSetup.d.ts +34 -0
  23. package/dist/clients/agentSetup.d.ts.map +1 -0
  24. package/dist/clients/agentUser.d.ts +176 -0
  25. package/dist/clients/agentUser.d.ts.map +1 -0
  26. package/dist/clients/case.d.ts +232 -0
  27. package/dist/clients/case.d.ts.map +1 -0
  28. package/dist/clients/coverage.d.ts +98 -0
  29. package/dist/clients/coverage.d.ts.map +1 -0
  30. package/dist/clients/customer.d.ts +252 -0
  31. package/dist/clients/customer.d.ts.map +1 -0
  32. package/dist/clients/file.d.ts +30 -0
  33. package/dist/clients/file.d.ts.map +1 -0
  34. package/dist/clients/insurance.d.ts +105 -0
  35. package/dist/clients/insurance.d.ts.map +1 -0
  36. package/dist/clients/language.d.ts +27 -0
  37. package/dist/clients/language.d.ts.map +1 -0
  38. package/dist/clients/policy.d.ts +251 -0
  39. package/dist/clients/policy.d.ts.map +1 -0
  40. package/dist/clients/property.d.ts +163 -0
  41. package/dist/clients/property.d.ts.map +1 -0
  42. package/dist/clients/proposal.d.ts +259 -0
  43. package/dist/clients/proposal.d.ts.map +1 -0
  44. package/dist/clients/template.d.ts +73 -0
  45. package/dist/clients/template.d.ts.map +1 -0
  46. package/dist/clients/vehicle.d.ts +112 -0
  47. package/dist/clients/vehicle.d.ts.map +1 -0
  48. package/dist/clients/webhook.d.ts +106 -0
  49. package/dist/clients/webhook.d.ts.map +1 -0
  50. package/dist/core/config.d.ts +38 -0
  51. package/dist/core/config.d.ts.map +1 -0
  52. package/dist/core/endpoints.d.ts +1371 -0
  53. package/dist/core/endpoints.d.ts.map +1 -0
  54. package/dist/core/error-types.d.ts +66 -0
  55. package/dist/core/error-types.d.ts.map +1 -0
  56. package/dist/core/errors.d.ts +42 -0
  57. package/dist/core/errors.d.ts.map +1 -0
  58. package/dist/core/options.d.ts +234 -0
  59. package/dist/core/options.d.ts.map +1 -0
  60. package/dist/core/result.d.ts +183 -0
  61. package/dist/core/result.d.ts.map +1 -0
  62. package/dist/core/retry.d.ts +15 -0
  63. package/dist/core/retry.d.ts.map +1 -0
  64. package/dist/index.browser.js +24 -24
  65. package/dist/index.browser.js.map +1 -1
  66. package/dist/index.cjs +574 -525
  67. package/dist/index.cjs.map +1 -1
  68. package/dist/index.d.ts +34 -4225
  69. package/dist/index.d.ts.map +1 -0
  70. package/dist/index.js +577 -525
  71. package/dist/index.js.map +1 -1
  72. package/dist/version.d.ts +10 -0
  73. package/dist/version.d.ts.map +1 -0
  74. package/package.json +18 -14
  75. package/dist/index.d.cts +0 -4226
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ var __export = (target, all) => {
7
7
  // package.json
8
8
  var package_default = {
9
9
  name: "@insurup/sdk",
10
- version: "0.1.13",
10
+ version: "0.1.15",
11
11
  description: "Type-safe TypeScript SDK for the InsurUp insurance platform with GraphQL support. Tree-shakeable, works everywhere.",
12
12
  keywords: [
13
13
  "insurup",
@@ -57,35 +57,39 @@ var package_default = {
57
57
  }
58
58
  },
59
59
  scripts: {
60
- build: "tsup",
61
- "build:tsc": "tsc",
60
+ build: "tsup && tsc -p tsconfig.build.json",
62
61
  "check-types": "tsc --noEmit",
63
62
  dev: "tsup --watch",
64
63
  docs: "typedoc",
65
64
  lint: "eslint src test --max-warnings 0",
66
65
  test: "vitest run",
66
+ "test:unit": "vitest run test/unit",
67
+ "test:integration": "vitest run test/integration",
67
68
  "test:watch": "vitest",
68
- "test:coverage": "vitest run --coverage"
69
+ "test:coverage": "vitest run --coverage",
70
+ "test:coverage:unit": "vitest run test/unit --coverage",
71
+ "test:coverage:integration": "vitest run test/integration --coverage"
69
72
  },
70
73
  publishConfig: {
71
74
  access: "public"
72
75
  },
73
76
  devDependencies: {
74
- "@eslint/js": "^9.39.2",
75
- "@vitest/coverage-v8": "^4.0.17",
76
- eslint: "^9.39.2",
77
+ "@eslint/js": "^10.0.1",
78
+ "@vitest/coverage-v8": "^4.1.6",
79
+ eslint: "^10.4.0",
77
80
  "eslint-config-prettier": "^10.1.8",
78
81
  "eslint-plugin-prettier": "^5.5.5",
79
- msw: "^2.12.7",
80
- prettier: "^3.8.0",
82
+ msw: "^2.14.6",
83
+ prettier: "^3.8.3",
81
84
  tsup: "^8.5.1",
82
- typedoc: "^0.28.16",
83
- typescript: "^5.9.3",
84
- "typescript-eslint": "^8.53.1",
85
- vitest: "^4.0.17"
85
+ typedoc: "^0.28.19",
86
+ typescript: "^6.0.3",
87
+ "typescript-eslint": "^8.59.3",
88
+ vitest: "^4.1.6"
86
89
  },
87
90
  dependencies: {
88
- "@insurup/contracts": "workspace:*"
91
+ "@insurup/contracts": "workspace:*",
92
+ "@microsoft/signalr": "^10.0.0"
89
93
  }
90
94
  };
91
95
 
@@ -401,15 +405,7 @@ function mergeWithDefaults(options) {
401
405
 
402
406
  // src/core/retry.ts
403
407
  async function withRetry(fn, options) {
404
- const {
405
- retries,
406
- factor,
407
- minTimeout,
408
- maxTimeout,
409
- randomize,
410
- backoffStrategy,
411
- onFailedAttempt
412
- } = options;
408
+ const { retries, factor, minTimeout, maxTimeout, randomize, backoffStrategy, onFailedAttempt } = options;
413
409
  let attempt = 1;
414
410
  while (true) {
415
411
  try {
@@ -573,10 +569,7 @@ var HttpTransport = class {
573
569
  );
574
570
  } catch (interceptorError) {
575
571
  if (this.options.logLevel !== "none") {
576
- this.options.logger.warn(
577
- "Response interceptor failed:",
578
- interceptorError
579
- );
572
+ this.options.logger.warn("Response interceptor failed:", interceptorError);
580
573
  }
581
574
  }
582
575
  }
@@ -592,10 +585,7 @@ var HttpTransport = class {
592
585
  );
593
586
  } catch (interceptorError) {
594
587
  if (this.options.logLevel !== "none") {
595
- this.options.logger.warn(
596
- "Response interceptor failed:",
597
- interceptorError
598
- );
588
+ this.options.logger.warn("Response interceptor failed:", interceptorError);
599
589
  }
600
590
  }
601
591
  }
@@ -678,13 +668,7 @@ var HttpTransport = class {
678
668
  * @returns Promise resolving to InsurUpResult (no data)
679
669
  */
680
670
  async postNoContent(path, data, options) {
681
- return this.sendInternal(
682
- "POST",
683
- path,
684
- data,
685
- options,
686
- false
687
- );
671
+ return this.sendInternal("POST", path, data, options, false);
688
672
  }
689
673
  /**
690
674
  * PUT request expecting a response with data
@@ -704,13 +688,7 @@ var HttpTransport = class {
704
688
  * @returns Promise resolving to InsurUpResult (no data)
705
689
  */
706
690
  async putNoContent(path, data, options) {
707
- return this.sendInternal(
708
- "PUT",
709
- path,
710
- data,
711
- options,
712
- false
713
- );
691
+ return this.sendInternal("PUT", path, data, options, false);
714
692
  }
715
693
  /**
716
694
  * PATCH request expecting a response with data
@@ -730,13 +708,7 @@ var HttpTransport = class {
730
708
  * @returns Promise resolving to InsurUpResult (no data)
731
709
  */
732
710
  async patchNoContent(path, data, options) {
733
- return this.sendInternal(
734
- "PATCH",
735
- path,
736
- data,
737
- options,
738
- false
739
- );
711
+ return this.sendInternal("PATCH", path, data, options, false);
740
712
  }
741
713
  /**
742
714
  * DELETE request expecting a response with data
@@ -754,13 +726,7 @@ var HttpTransport = class {
754
726
  * @returns Promise resolving to InsurUpResult (no data)
755
727
  */
756
728
  async deleteNoContent(path, options) {
757
- return this.sendInternal(
758
- "DELETE",
759
- path,
760
- null,
761
- options,
762
- false
763
- );
729
+ return this.sendInternal("DELETE", path, null, options, false);
764
730
  }
765
731
  /**
766
732
  * Downloads a binary file as a Blob
@@ -816,10 +782,7 @@ var HttpTransport = class {
816
782
  return await this.options.onResponse(networkError, requestConfig);
817
783
  } catch (interceptorError) {
818
784
  if (this.options.logLevel !== "none") {
819
- this.options.logger.warn(
820
- "Response interceptor failed:",
821
- interceptorError
822
- );
785
+ this.options.logger.warn("Response interceptor failed:", interceptorError);
823
786
  }
824
787
  }
825
788
  }
@@ -836,10 +799,7 @@ var HttpTransport = class {
836
799
  return await this.options.onResponse(serverError, requestConfig);
837
800
  } catch (interceptorError) {
838
801
  if (this.options.logLevel !== "none") {
839
- this.options.logger.warn(
840
- "Response interceptor failed:",
841
- interceptorError
842
- );
802
+ this.options.logger.warn("Response interceptor failed:", interceptorError);
843
803
  }
844
804
  }
845
805
  }
@@ -853,10 +813,7 @@ var HttpTransport = class {
853
813
  return await this.options.onResponse(result, requestConfig);
854
814
  } catch (interceptorError) {
855
815
  if (this.options.logLevel !== "none") {
856
- this.options.logger.warn(
857
- "Response interceptor failed:",
858
- interceptorError
859
- );
816
+ this.options.logger.warn("Response interceptor failed:", interceptorError);
860
817
  }
861
818
  }
862
819
  }
@@ -865,16 +822,10 @@ var HttpTransport = class {
865
822
  const deserializationError = createDeserializationError(error);
866
823
  if (this.options.onResponse) {
867
824
  try {
868
- return await this.options.onResponse(
869
- deserializationError,
870
- requestConfig
871
- );
825
+ return await this.options.onResponse(deserializationError, requestConfig);
872
826
  } catch (interceptorError) {
873
827
  if (this.options.logLevel !== "none") {
874
- this.options.logger.warn(
875
- "Response interceptor failed:",
876
- interceptorError
877
- );
828
+ this.options.logger.warn("Response interceptor failed:", interceptorError);
878
829
  }
879
830
  }
880
831
  }
@@ -912,9 +863,7 @@ var HttpTransport = class {
912
863
  * Checks if Content-Type header is present (case-insensitive)
913
864
  */
914
865
  hasContentTypeHeader(headers) {
915
- return Object.keys(headers).some(
916
- (key) => key.toLowerCase() === "content-type"
917
- );
866
+ return Object.keys(headers).some((key) => key.toLowerCase() === "content-type");
918
867
  }
919
868
  /**
920
869
  * Checks if a content type is a valid JSON content type
@@ -948,9 +897,7 @@ var HttpTransport = class {
948
897
  }
949
898
  const contentType = response.headers.get("content-type");
950
899
  if (contentType && !this.isJsonContentType(contentType)) {
951
- return createDeserializationError(
952
- new Error(`Expected JSON response but got ${contentType}`)
953
- );
900
+ return createDeserializationError(new Error(`Expected JSON response but got ${contentType}`));
954
901
  }
955
902
  return this.parseSuccessResponse(responseText);
956
903
  }
@@ -1016,16 +963,12 @@ var HttpTransport = class {
1016
963
  } else if (this.options.logLevel === "detailed") {
1017
964
  if (status === "SUCCESS") {
1018
965
  const data = result.kind === "success" && "data" in result ? this.sanitizeResponseData(result.data) : void 0;
1019
- this.options.logger.info(
1020
- `Response: ${status} in ${duration}ms${attemptInfo}`,
1021
- { data }
1022
- );
966
+ this.options.logger.info(`Response: ${status} in ${duration}ms${attemptInfo}`, { data });
1023
967
  } else {
1024
968
  const sanitizedError = this.sanitizeError(result);
1025
- this.options.logger.error(
1026
- `Response: ${status} in ${duration}ms${attemptInfo}`,
1027
- { error: sanitizedError }
1028
- );
969
+ this.options.logger.error(`Response: ${status} in ${duration}ms${attemptInfo}`, {
970
+ error: sanitizedError
971
+ });
1029
972
  }
1030
973
  }
1031
974
  }
@@ -1037,9 +980,7 @@ var HttpTransport = class {
1037
980
  return;
1038
981
  }
1039
982
  const reason = result.kind === "server-error" ? `HTTP ${result.status}` : result.kind === "client-error" ? result.type : "Unknown error";
1040
- this.options.logger.warn(
1041
- `Retry attempt ${attemptNumber} failed due to: ${reason}`
1042
- );
983
+ this.options.logger.warn(`Retry attempt ${attemptNumber} failed due to: ${reason}`);
1043
984
  }
1044
985
  /**
1045
986
  * Sanitizes headers for logging (removes sensitive information)
@@ -1049,12 +990,7 @@ var HttpTransport = class {
1049
990
  return void 0;
1050
991
  }
1051
992
  const sanitized = {};
1052
- const sensitiveHeaders = [
1053
- "authorization",
1054
- "cookie",
1055
- "x-api-key",
1056
- "x-auth-token"
1057
- ];
993
+ const sensitiveHeaders = ["authorization", "cookie", "x-api-key", "x-auth-token"];
1058
994
  for (const [key, value] of Object.entries(headers)) {
1059
995
  const lowerKey = key.toLowerCase();
1060
996
  if (sensitiveHeaders.includes(lowerKey)) {
@@ -1117,8 +1053,7 @@ var HttpTransport = class {
1117
1053
  const keys = Object.keys(item);
1118
1054
  propertyCount += keys.length;
1119
1055
  for (const key of keys.slice(0, 10)) {
1120
- if (countProperties(item[key], depth + 1))
1121
- return true;
1056
+ if (countProperties(item[key], depth + 1)) return true;
1122
1057
  }
1123
1058
  }
1124
1059
  return false;
@@ -1218,12 +1153,10 @@ function parseExtensions(raw) {
1218
1153
  }
1219
1154
  function parseGraphQLErrors(rawErrors) {
1220
1155
  return rawErrors.map((error) => {
1221
- const locations = error.locations?.map(
1222
- (loc) => ({
1223
- line: loc.line,
1224
- column: loc.column
1225
- })
1226
- );
1156
+ const locations = error.locations?.map((loc) => ({
1157
+ line: loc.line,
1158
+ column: loc.column
1159
+ }));
1227
1160
  return {
1228
1161
  message: error.message,
1229
1162
  locations,
@@ -1248,11 +1181,7 @@ var GraphQLTransport = class {
1248
1181
  query,
1249
1182
  variables
1250
1183
  };
1251
- const result = await this.http.post(
1252
- "graphql",
1253
- payload,
1254
- options
1255
- );
1184
+ const result = await this.http.post("graphql", payload, options);
1256
1185
  if (!result.isSuccess) {
1257
1186
  return result;
1258
1187
  }
@@ -1270,6 +1199,175 @@ var GraphQLTransport = class {
1270
1199
  }
1271
1200
  };
1272
1201
 
1202
+ // src/client/signalr.ts
1203
+ import {
1204
+ HttpTransportType,
1205
+ HubConnectionBuilder,
1206
+ HubConnectionState,
1207
+ LogLevel
1208
+ } from "@microsoft/signalr";
1209
+ var HUB_METHODS = {
1210
+ success: "ReceiveProposalProductSuccess",
1211
+ failed: "ReceiveProposalProductFailed",
1212
+ inProgress: "ReceiveProposalProductInProgress",
1213
+ revised: "ReceiveProposalProductRevised",
1214
+ purchasing: "ReceiveProposalProductPurchasing",
1215
+ purchased: "ReceiveProposalProductPurchased",
1216
+ purchaseFailed: "ReceiveProposalProductPurchaseFailed",
1217
+ coverage: "ReceiveProposalProductCoverage"
1218
+ };
1219
+ var HUB_PATH = "/hubs/proposal-detail";
1220
+ var REGISTER_METHOD = "Register";
1221
+ var SignalRTransport = class {
1222
+ hubUrl;
1223
+ tokenProvider;
1224
+ logLevel;
1225
+ connection = null;
1226
+ /** Pending or in-flight start, shared by concurrent subscribers. */
1227
+ startPromise = null;
1228
+ /** Active subscriptions keyed by proposalId. */
1229
+ subscribers = /* @__PURE__ */ new Map();
1230
+ constructor(options) {
1231
+ this.hubUrl = new URL(HUB_PATH, ensureTrailingSlash(options.hubsBaseUrl)).toString();
1232
+ this.tokenProvider = options.tokenProvider;
1233
+ this.logLevel = options.logLevel ?? LogLevel.Warning;
1234
+ }
1235
+ /**
1236
+ * Subscribe to proposal-detail events for a given proposal. Opens the
1237
+ * underlying hub connection on first subscribe.
1238
+ *
1239
+ * @returns an unsubscribe function. When the last subscriber for the last
1240
+ * proposal unsubscribes, the underlying connection is stopped.
1241
+ */
1242
+ async subscribeProposalDetail(proposalId, handlers) {
1243
+ if (!proposalId) {
1244
+ throw new Error("subscribeProposalDetail: proposalId is required");
1245
+ }
1246
+ let bucket = this.subscribers.get(proposalId);
1247
+ const isFirstForProposal = bucket === void 0;
1248
+ if (bucket === void 0) {
1249
+ bucket = /* @__PURE__ */ new Set();
1250
+ this.subscribers.set(proposalId, bucket);
1251
+ }
1252
+ bucket.add(handlers);
1253
+ try {
1254
+ const connection = await this.ensureStarted();
1255
+ if (isFirstForProposal) {
1256
+ await connection.send(REGISTER_METHOD, { proposalId });
1257
+ }
1258
+ } catch (error) {
1259
+ bucket.delete(handlers);
1260
+ if (bucket.size === 0) {
1261
+ this.subscribers.delete(proposalId);
1262
+ }
1263
+ throw error;
1264
+ }
1265
+ let disposed = false;
1266
+ return () => {
1267
+ if (disposed) {
1268
+ return;
1269
+ }
1270
+ disposed = true;
1271
+ const current = this.subscribers.get(proposalId);
1272
+ if (!current) {
1273
+ return;
1274
+ }
1275
+ current.delete(handlers);
1276
+ if (current.size === 0) {
1277
+ this.subscribers.delete(proposalId);
1278
+ }
1279
+ if (this.subscribers.size === 0) {
1280
+ void this.stop();
1281
+ }
1282
+ };
1283
+ }
1284
+ /** Stop the underlying hub connection if open and drop all subscribers. */
1285
+ async close() {
1286
+ this.subscribers.clear();
1287
+ await this.stop();
1288
+ }
1289
+ async ensureStarted() {
1290
+ if (this.connection && this.connection.state === HubConnectionState.Connected) {
1291
+ return this.connection;
1292
+ }
1293
+ if (this.startPromise) {
1294
+ return this.startPromise;
1295
+ }
1296
+ const connection = this.buildConnection();
1297
+ this.connection = connection;
1298
+ this.startPromise = (async () => {
1299
+ await connection.start();
1300
+ return connection;
1301
+ })();
1302
+ try {
1303
+ return await this.startPromise;
1304
+ } catch (error) {
1305
+ this.connection = null;
1306
+ throw error;
1307
+ } finally {
1308
+ this.startPromise = null;
1309
+ }
1310
+ }
1311
+ buildConnection() {
1312
+ const tokenProvider = this.tokenProvider;
1313
+ const connection = new HubConnectionBuilder().withUrl(this.hubUrl, {
1314
+ accessTokenFactory: tokenProvider ? () => resolveToken(tokenProvider) : void 0,
1315
+ transport: HttpTransportType.WebSockets,
1316
+ skipNegotiation: true
1317
+ }).withAutomaticReconnect().configureLogging(this.logLevel).build();
1318
+ this.registerHandlers(connection);
1319
+ connection.onreconnected(() => {
1320
+ void this.reRegisterAll(connection);
1321
+ });
1322
+ return connection;
1323
+ }
1324
+ registerHandlers(connection) {
1325
+ const dispatch = (method, pick) => {
1326
+ connection.on(method, (event) => {
1327
+ const bucket = this.subscribers.get(event.proposalId);
1328
+ if (!bucket) {
1329
+ return;
1330
+ }
1331
+ for (const handlers of bucket) {
1332
+ const fn = pick(handlers);
1333
+ fn?.(event);
1334
+ }
1335
+ });
1336
+ };
1337
+ dispatch(HUB_METHODS.success, (h) => h.onProductSuccess);
1338
+ dispatch(HUB_METHODS.failed, (h) => h.onProductFailed);
1339
+ dispatch(HUB_METHODS.inProgress, (h) => h.onProductInProgress);
1340
+ dispatch(HUB_METHODS.revised, (h) => h.onProductRevised);
1341
+ dispatch(HUB_METHODS.purchasing, (h) => h.onProductPurchasing);
1342
+ dispatch(HUB_METHODS.purchased, (h) => h.onProductPurchased);
1343
+ dispatch(HUB_METHODS.purchaseFailed, (h) => h.onProductPurchaseFailed);
1344
+ dispatch(HUB_METHODS.coverage, (h) => h.onProductCoverage);
1345
+ }
1346
+ async reRegisterAll(connection) {
1347
+ for (const proposalId of this.subscribers.keys()) {
1348
+ await connection.send(REGISTER_METHOD, { proposalId });
1349
+ }
1350
+ }
1351
+ async stop() {
1352
+ const current = this.connection;
1353
+ if (!current) {
1354
+ return;
1355
+ }
1356
+ this.connection = null;
1357
+ if (current.state === HubConnectionState.Disconnected || current.state === HubConnectionState.Disconnecting) {
1358
+ return;
1359
+ }
1360
+ await current.stop();
1361
+ }
1362
+ };
1363
+ function ensureTrailingSlash(url) {
1364
+ return url.endsWith("/") ? url : `${url}/`;
1365
+ }
1366
+ async function resolveToken(provider) {
1367
+ const result = await provider();
1368
+ return result ?? "";
1369
+ }
1370
+
1273
1371
  // src/core/endpoints.ts
1274
1372
  var endpoints_exports = {};
1275
1373
  __export(endpoints_exports, {
@@ -1394,46 +1492,32 @@ var customers = {
1394
1492
  },
1395
1493
  getCustomer: {
1396
1494
  definition: "customers/{CustomerId}",
1397
- render: (customerId) => "customers/{CustomerId}".replace(
1398
- "{CustomerId}",
1399
- encodeURIComponent(customerId)
1400
- )
1495
+ render: (customerId) => "customers/{CustomerId}".replace("{CustomerId}", encodeURIComponent(customerId))
1401
1496
  },
1402
1497
  updateCustomer: {
1403
1498
  definition: "customers/{CustomerId}",
1404
- render: (customerId) => "customers/{CustomerId}".replace(
1405
- "{CustomerId}",
1406
- encodeURIComponent(customerId)
1407
- )
1499
+ render: (customerId) => "customers/{CustomerId}".replace("{CustomerId}", encodeURIComponent(customerId))
1408
1500
  },
1409
1501
  deleteCustomer: {
1410
1502
  definition: "customers/{CustomerId}",
1411
- render: (customerId) => "customers/{CustomerId}".replace(
1412
- "{CustomerId}",
1413
- encodeURIComponent(customerId)
1414
- )
1503
+ render: (customerId) => "customers/{CustomerId}".replace("{CustomerId}", encodeURIComponent(customerId))
1504
+ },
1505
+ getCustomerAssets: {
1506
+ definition: "customers/{CustomerId}/assets",
1507
+ render: (customerId) => "customers/{CustomerId}/assets".replace("{CustomerId}", encodeURIComponent(customerId))
1415
1508
  },
1416
1509
  getHealthInfo: {
1417
1510
  definition: "customers/{CustomerId}/health-info",
1418
- render: (customerId) => "customers/{CustomerId}/health-info".replace(
1419
- "{CustomerId}",
1420
- encodeURIComponent(customerId)
1421
- )
1511
+ render: (customerId) => "customers/{CustomerId}/health-info".replace("{CustomerId}", encodeURIComponent(customerId))
1422
1512
  },
1423
1513
  updateHealthInfo: {
1424
1514
  definition: "customers/{CustomerId}/health-info",
1425
- render: (customerId) => "customers/{CustomerId}/health-info".replace(
1426
- "{CustomerId}",
1427
- encodeURIComponent(customerId)
1428
- )
1515
+ render: (customerId) => "customers/{CustomerId}/health-info".replace("{CustomerId}", encodeURIComponent(customerId))
1429
1516
  },
1430
1517
  emails: {
1431
1518
  addCustomerEmail: {
1432
1519
  definition: "customers/{CustomerId}/emails",
1433
- render: (customerId) => "customers/{CustomerId}/emails".replace(
1434
- "{CustomerId}",
1435
- encodeURIComponent(customerId)
1436
- )
1520
+ render: (customerId) => "customers/{CustomerId}/emails".replace("{CustomerId}", encodeURIComponent(customerId))
1437
1521
  },
1438
1522
  removeCustomerEmail: {
1439
1523
  definition: "customers/{CustomerId}/emails/{Email}",
@@ -1445,7 +1529,18 @@ var customers = {
1445
1529
  },
1446
1530
  getCustomerEmails: {
1447
1531
  definition: "customers/{CustomerId}/emails",
1448
- render: (customerId) => "customers/{CustomerId}/emails".replace(
1532
+ render: (customerId) => "customers/{CustomerId}/emails".replace("{CustomerId}", encodeURIComponent(customerId))
1533
+ },
1534
+ getPrimaryCustomerEmail: {
1535
+ definition: "customers/{CustomerId}/emails/primary",
1536
+ render: (customerId) => "customers/{CustomerId}/emails/primary".replace(
1537
+ "{CustomerId}",
1538
+ encodeURIComponent(customerId)
1539
+ )
1540
+ },
1541
+ setPrimaryCustomerEmail: {
1542
+ definition: "customers/{CustomerId}/emails/primary",
1543
+ render: (customerId) => "customers/{CustomerId}/emails/primary".replace(
1449
1544
  "{CustomerId}",
1450
1545
  encodeURIComponent(customerId)
1451
1546
  )
@@ -1461,17 +1556,11 @@ var customers = {
1461
1556
  },
1462
1557
  removeCustomerPhoneNumber: {
1463
1558
  definition: "customers/{CustomerId}/phone-numbers/{CountryCode}-{PhoneNumber}",
1464
- render: (request) => "customers/{CustomerId}/phone-numbers/{CountryCode}-{PhoneNumber}".replace("{CustomerId}", encodeURIComponent(request.customerId)).replace(
1465
- "{CountryCode}",
1466
- encodeURIComponent(request.countryCode.toString())
1467
- ).replace("{PhoneNumber}", encodeURIComponent(request.phoneNumber))
1559
+ render: (request) => "customers/{CustomerId}/phone-numbers/{CountryCode}-{PhoneNumber}".replace("{CustomerId}", encodeURIComponent(request.customerId)).replace("{CountryCode}", encodeURIComponent(request.countryCode.toString())).replace("{PhoneNumber}", encodeURIComponent(request.phoneNumber))
1468
1560
  },
1469
1561
  changePrimaryCustomerPhoneNumber: {
1470
1562
  definition: "customers/{CustomerId}/phone-numbers/{CountryCode}-{PhoneNumber}/primary",
1471
- render: (request) => "customers/{CustomerId}/phone-numbers/{CountryCode}-{PhoneNumber}/primary".replace("{CustomerId}", encodeURIComponent(request.customerId)).replace(
1472
- "{CountryCode}",
1473
- encodeURIComponent(request.countryCode.toString())
1474
- ).replace("{PhoneNumber}", encodeURIComponent(request.phoneNumber))
1563
+ render: (request) => "customers/{CustomerId}/phone-numbers/{CountryCode}-{PhoneNumber}/primary".replace("{CustomerId}", encodeURIComponent(request.customerId)).replace("{CountryCode}", encodeURIComponent(request.countryCode.toString())).replace("{PhoneNumber}", encodeURIComponent(request.phoneNumber))
1475
1564
  },
1476
1565
  getCustomerPhoneNumbers: {
1477
1566
  definition: "customers/{CustomerId}/phone-numbers",
@@ -1479,6 +1568,20 @@ var customers = {
1479
1568
  "{CustomerId}",
1480
1569
  encodeURIComponent(customerId)
1481
1570
  )
1571
+ },
1572
+ getPrimaryCustomerPhoneNumber: {
1573
+ definition: "customers/{CustomerId}/phone-numbers/primary",
1574
+ render: (customerId) => "customers/{CustomerId}/phone-numbers/primary".replace(
1575
+ "{CustomerId}",
1576
+ encodeURIComponent(customerId)
1577
+ )
1578
+ },
1579
+ setPrimaryCustomerPhoneNumber: {
1580
+ definition: "customers/{CustomerId}/phone-numbers/primary",
1581
+ render: (customerId) => "customers/{CustomerId}/phone-numbers/primary".replace(
1582
+ "{CustomerId}",
1583
+ encodeURIComponent(customerId)
1584
+ )
1482
1585
  }
1483
1586
  },
1484
1587
  contactFlows: {
@@ -1517,26 +1620,17 @@ var customers = {
1517
1620
  },
1518
1621
  create: {
1519
1622
  definition: "customers/{CustomerId}/contacts",
1520
- render: (customerId) => "customers/{CustomerId}/contacts".replace(
1521
- "{CustomerId}",
1522
- encodeURIComponent(customerId)
1523
- )
1623
+ render: (customerId) => "customers/{CustomerId}/contacts".replace("{CustomerId}", encodeURIComponent(customerId))
1524
1624
  }
1525
1625
  },
1526
1626
  setCustomerBranch: {
1527
1627
  definition: "customers/{CustomerId}/branch",
1528
- render: (customerId) => "customers/{CustomerId}/branch".replace(
1529
- "{CustomerId}",
1530
- encodeURIComponent(customerId)
1531
- )
1628
+ render: (customerId) => "customers/{CustomerId}/branch".replace("{CustomerId}", encodeURIComponent(customerId))
1532
1629
  },
1533
1630
  addresses: {
1534
1631
  create: {
1535
1632
  definition: "customers/{CustomerId}/addresses",
1536
- render: (customerId) => "customers/{CustomerId}/addresses".replace(
1537
- "{CustomerId}",
1538
- encodeURIComponent(customerId)
1539
- )
1633
+ render: (customerId) => "customers/{CustomerId}/addresses".replace("{CustomerId}", encodeURIComponent(customerId))
1540
1634
  },
1541
1635
  update: {
1542
1636
  definition: "customers/{CustomerId}/addresses/{AddressId}",
@@ -1548,10 +1642,7 @@ var customers = {
1548
1642
  },
1549
1643
  getAll: {
1550
1644
  definition: "customers/{CustomerId}/addresses",
1551
- render: (customerId) => "customers/{CustomerId}/addresses".replace(
1552
- "{CustomerId}",
1553
- encodeURIComponent(customerId)
1554
- )
1645
+ render: (customerId) => "customers/{CustomerId}/addresses".replace("{CustomerId}", encodeURIComponent(customerId))
1555
1646
  },
1556
1647
  delete: {
1557
1648
  definition: "customers/{CustomerId}/addresses/{AddressId}",
@@ -1561,10 +1652,7 @@ var customers = {
1561
1652
  consents: {
1562
1653
  give: {
1563
1654
  definition: "customers/{CustomerId}/consents",
1564
- render: (customerId) => "customers/{CustomerId}/consents".replace(
1565
- "{CustomerId}",
1566
- encodeURIComponent(customerId)
1567
- )
1655
+ render: (customerId) => "customers/{CustomerId}/consents".replace("{CustomerId}", encodeURIComponent(customerId))
1568
1656
  },
1569
1657
  revoke: {
1570
1658
  definition: "customers/{CustomerId}/consents/revoke",
@@ -1575,10 +1663,7 @@ var customers = {
1575
1663
  },
1576
1664
  getAll: {
1577
1665
  definition: "customers/{CustomerId}/consents",
1578
- render: (customerId) => "customers/{CustomerId}/consents".replace(
1579
- "{CustomerId}",
1580
- encodeURIComponent(customerId)
1581
- )
1666
+ render: (customerId) => "customers/{CustomerId}/consents".replace("{CustomerId}", encodeURIComponent(customerId))
1582
1667
  }
1583
1668
  }
1584
1669
  };
@@ -1645,10 +1730,7 @@ var vehicles = {
1645
1730
  },
1646
1731
  create: {
1647
1732
  definition: "customers/{CustomerId}/vehicles",
1648
- render: (customerId) => "customers/{CustomerId}/vehicles".replace(
1649
- "{CustomerId}",
1650
- encodeURIComponent(customerId)
1651
- )
1733
+ render: (customerId) => "customers/{CustomerId}/vehicles".replace("{CustomerId}", encodeURIComponent(customerId))
1652
1734
  },
1653
1735
  update: {
1654
1736
  definition: "customers/{CustomerId}/vehicles/{VehicleId}",
@@ -1664,10 +1746,7 @@ var vehicles = {
1664
1746
  },
1665
1747
  getCustomerVehicles: {
1666
1748
  definition: "customers/{CustomerId}/vehicles",
1667
- render: (customerId) => "customers/{CustomerId}/vehicles".replace(
1668
- "{CustomerId}",
1669
- encodeURIComponent(customerId)
1670
- )
1749
+ render: (customerId) => "customers/{CustomerId}/vehicles".replace("{CustomerId}", encodeURIComponent(customerId))
1671
1750
  }
1672
1751
  };
1673
1752
  var insuranceServices = {
@@ -1679,17 +1758,11 @@ var properties = {
1679
1758
  getCurrentCustomerProperties: "customers/me/properties",
1680
1759
  getAll: {
1681
1760
  definition: "customers/{CustomerId}/properties",
1682
- render: (customerId) => "customers/{CustomerId}/properties".replace(
1683
- "{CustomerId}",
1684
- encodeURIComponent(customerId)
1685
- )
1761
+ render: (customerId) => "customers/{CustomerId}/properties".replace("{CustomerId}", encodeURIComponent(customerId))
1686
1762
  },
1687
1763
  create: {
1688
1764
  definition: "customers/{CustomerId}/properties",
1689
- render: (customerId) => "customers/{CustomerId}/properties".replace(
1690
- "{CustomerId}",
1691
- encodeURIComponent(customerId)
1692
- )
1765
+ render: (customerId) => "customers/{CustomerId}/properties".replace("{CustomerId}", encodeURIComponent(customerId))
1693
1766
  },
1694
1767
  getById: {
1695
1768
  definition: "customers/{CustomerId}/properties/{PropertyId}",
@@ -1708,24 +1781,15 @@ var proposals = {
1708
1781
  create: "proposals",
1709
1782
  getProposalById: {
1710
1783
  definition: "proposals/{ProposalId}",
1711
- render: (proposalId) => "proposals/{ProposalId}".replace(
1712
- "{ProposalId}",
1713
- encodeURIComponent(proposalId)
1714
- )
1784
+ render: (proposalId) => "proposals/{ProposalId}".replace("{ProposalId}", encodeURIComponent(proposalId))
1715
1785
  },
1716
1786
  getProposalSnapshot: {
1717
1787
  definition: "proposals/{ProposalId}/snapshot",
1718
- render: (proposalId) => "proposals/{ProposalId}/snapshot".replace(
1719
- "{ProposalId}",
1720
- encodeURIComponent(proposalId)
1721
- )
1788
+ render: (proposalId) => "proposals/{ProposalId}/snapshot".replace("{ProposalId}", encodeURIComponent(proposalId))
1722
1789
  },
1723
1790
  getProposalCoverage: {
1724
1791
  definition: "proposals/{ProposalId}/coverage",
1725
- render: (proposalId) => "proposals/{ProposalId}/coverage".replace(
1726
- "{ProposalId}",
1727
- encodeURIComponent(proposalId)
1728
- )
1792
+ render: (proposalId) => "proposals/{ProposalId}/coverage".replace("{ProposalId}", encodeURIComponent(proposalId))
1729
1793
  },
1730
1794
  getProposalProductCoverage: {
1731
1795
  definition: "proposals/{ProposalId}/products/{ProposalProductId}/coverage",
@@ -1737,10 +1801,7 @@ var proposals = {
1737
1801
  },
1738
1802
  getProposalProductPremiumDetail: {
1739
1803
  definition: "proposals/{ProposalId}/products/{ProposalProductId}/premium-detail/{InstallmentNumber}",
1740
- render: (proposalId, proposalProductId, installmentNumber) => "proposals/{ProposalId}/products/{ProposalProductId}/premium-detail/{InstallmentNumber}".replace("{ProposalId}", encodeURIComponent(proposalId)).replace("{ProposalProductId}", encodeURIComponent(proposalProductId)).replace(
1741
- "{InstallmentNumber}",
1742
- encodeURIComponent(installmentNumber.toString())
1743
- )
1804
+ render: (proposalId, proposalProductId, installmentNumber) => "proposals/{ProposalId}/products/{ProposalProductId}/premium-detail/{InstallmentNumber}".replace("{ProposalId}", encodeURIComponent(proposalId)).replace("{ProposalProductId}", encodeURIComponent(proposalProductId)).replace("{InstallmentNumber}", encodeURIComponent(installmentNumber.toString()))
1744
1805
  },
1745
1806
  purchaseProposalProductSync: {
1746
1807
  definition: "proposals/{ProposalId}/products/{ProposalProductId}/purchase/sync",
@@ -1752,10 +1813,7 @@ var proposals = {
1752
1813
  },
1753
1814
  reviseProposal: {
1754
1815
  definition: "proposals/{ProposalId}/revise",
1755
- render: (proposalId) => "proposals/{ProposalId}/revise".replace(
1756
- "{ProposalId}",
1757
- encodeURIComponent(proposalId)
1758
- )
1816
+ render: (proposalId) => "proposals/{ProposalId}/revise".replace("{ProposalId}", encodeURIComponent(proposalId))
1759
1817
  },
1760
1818
  reviseProposalProduct: {
1761
1819
  definition: "proposals/{ProposalId}/products/{ProposalProductId}/revise",
@@ -1800,10 +1858,7 @@ var proposals = {
1800
1858
  },
1801
1859
  setProposalBranch: {
1802
1860
  definition: "proposals/{ProposalId}/branch",
1803
- render: (proposalId) => "proposals/{ProposalId}/branch".replace(
1804
- "{ProposalId}",
1805
- encodeURIComponent(proposalId)
1806
- )
1861
+ render: (proposalId) => "proposals/{ProposalId}/branch".replace("{ProposalId}", encodeURIComponent(proposalId))
1807
1862
  },
1808
1863
  generateCustomerProposalDocumentPdf: {
1809
1864
  definition: "proposals/{ProposalId}/customer-document-pdf",
@@ -1823,41 +1878,26 @@ var policies = {
1823
1878
  },
1824
1879
  fetchPolicyDocument: {
1825
1880
  definition: "policies/{PolicyId}/document",
1826
- render: (policyId) => "policies/{PolicyId}/document".replace(
1827
- "{PolicyId}",
1828
- encodeURIComponent(policyId)
1829
- )
1881
+ render: (policyId) => "policies/{PolicyId}/document".replace("{PolicyId}", encodeURIComponent(policyId))
1830
1882
  },
1831
1883
  sendPolicyDocument: {
1832
1884
  definition: "policies/{PolicyId}/document/send",
1833
- render: (policyId) => "policies/{PolicyId}/document/send".replace(
1834
- "{PolicyId}",
1835
- encodeURIComponent(policyId)
1836
- )
1885
+ render: (policyId) => "policies/{PolicyId}/document/send".replace("{PolicyId}", encodeURIComponent(policyId))
1837
1886
  },
1838
1887
  setPolicyRepresentative: {
1839
1888
  definition: "policies/{PolicyId}/representative",
1840
- render: (policyId) => "policies/{PolicyId}/representative".replace(
1841
- "{PolicyId}",
1842
- encodeURIComponent(policyId)
1843
- )
1889
+ render: (policyId) => "policies/{PolicyId}/representative".replace("{PolicyId}", encodeURIComponent(policyId))
1844
1890
  },
1845
1891
  setPolicyBranch: {
1846
1892
  definition: "policies/{PolicyId}/branch",
1847
- render: (policyId) => "policies/{PolicyId}/branch".replace(
1848
- "{PolicyId}",
1849
- encodeURIComponent(policyId)
1850
- )
1893
+ render: (policyId) => "policies/{PolicyId}/branch".replace("{PolicyId}", encodeURIComponent(policyId))
1851
1894
  },
1852
1895
  createManualPolicy: {
1853
1896
  definition: "policies/manual"
1854
1897
  },
1855
1898
  updateManualPolicy: {
1856
1899
  definition: "policies/manual/{PolicyId}",
1857
- render: (policyId) => "policies/manual/{PolicyId}".replace(
1858
- "{PolicyId}",
1859
- encodeURIComponent(policyId)
1860
- )
1900
+ render: (policyId) => "policies/manual/{PolicyId}".replace("{PolicyId}", encodeURIComponent(policyId))
1861
1901
  },
1862
1902
  getPolicyCountAndPremiumAnalytics: {
1863
1903
  definition: "policies/analytics/count-and-premium"
@@ -1883,10 +1923,7 @@ var policyTransfers = {
1883
1923
  },
1884
1924
  getPolicyTransferTriggerDetail: {
1885
1925
  definition: "policy-transfers/{PolicyTransferId}/triggers/{PolicyTransferTriggerId}",
1886
- render: (policyTransferId, policyTransferTriggerId) => "policy-transfers/{PolicyTransferId}/triggers/{PolicyTransferTriggerId}".replace("{PolicyTransferId}", encodeURIComponent(policyTransferId)).replace(
1887
- "{PolicyTransferTriggerId}",
1888
- encodeURIComponent(policyTransferTriggerId)
1889
- )
1926
+ render: (policyTransferId, policyTransferTriggerId) => "policy-transfers/{PolicyTransferId}/triggers/{PolicyTransferTriggerId}".replace("{PolicyTransferId}", encodeURIComponent(policyTransferId)).replace("{PolicyTransferTriggerId}", encodeURIComponent(policyTransferTriggerId))
1890
1927
  },
1891
1928
  triggerPolicyTransfer: {
1892
1929
  definition: "policy-transfers/{PolicyTransferId}/trigger",
@@ -1938,10 +1975,7 @@ var agentSetupRequests = {
1938
1975
  },
1939
1976
  disableAgentSetupRequest: {
1940
1977
  definition: "agent-setup-requests/{Id}/disable",
1941
- render: (id) => "agent-setup-requests/{Id}/disable".replace(
1942
- "{Id}",
1943
- encodeURIComponent(id)
1944
- )
1978
+ render: (id) => "agent-setup-requests/{Id}/disable".replace("{Id}", encodeURIComponent(id))
1945
1979
  }
1946
1980
  };
1947
1981
  var agentUsers = {
@@ -1963,17 +1997,11 @@ var agentUsers = {
1963
1997
  },
1964
1998
  deactivate: {
1965
1999
  definition: "agent-users/{AgentUserId}/deactivate",
1966
- render: (userId) => "agent-users/{AgentUserId}/deactivate".replace(
1967
- "{AgentUserId}",
1968
- encodeURIComponent(userId)
1969
- )
2000
+ render: (userId) => "agent-users/{AgentUserId}/deactivate".replace("{AgentUserId}", encodeURIComponent(userId))
1970
2001
  },
1971
2002
  activate: {
1972
2003
  definition: "agent-users/{AgentUserId}/activate",
1973
- render: (userId) => "agent-users/{AgentUserId}/activate".replace(
1974
- "{AgentUserId}",
1975
- encodeURIComponent(userId)
1976
- )
2004
+ render: (userId) => "agent-users/{AgentUserId}/activate".replace("{AgentUserId}", encodeURIComponent(userId))
1977
2005
  },
1978
2006
  delete: {
1979
2007
  definition: "agent-users/{UserId}",
@@ -1985,10 +2013,7 @@ var agentUsers = {
1985
2013
  },
1986
2014
  checkAgentUserInviteCode: {
1987
2015
  definition: "agent-users/check-invite-code",
1988
- render: (code) => "agent-users/check-invite-code?code={code}".replace(
1989
- "{code}",
1990
- encodeURIComponent(code)
1991
- )
2016
+ render: (code) => "agent-users/check-invite-code?code={code}".replace("{code}", encodeURIComponent(code))
1992
2017
  },
1993
2018
  update: {
1994
2019
  definition: "agent-users/{Id}",
@@ -1996,10 +2021,7 @@ var agentUsers = {
1996
2021
  },
1997
2022
  migrate: {
1998
2023
  definition: "agent-users/{AgentUserId}/migrate",
1999
- render: (agentUserId) => "agent-users/{AgentUserId}/migrate".replace(
2000
- "{AgentUserId}",
2001
- encodeURIComponent(agentUserId)
2002
- )
2024
+ render: (agentUserId) => "agent-users/{AgentUserId}/migrate".replace("{AgentUserId}", encodeURIComponent(agentUserId))
2003
2025
  },
2004
2026
  migrateAll: "agent-users/migrate-all"
2005
2027
  };
@@ -2037,17 +2059,11 @@ var webhooks = {
2037
2059
  deliveries: {
2038
2060
  getById: {
2039
2061
  definition: "webhooks/{WebhookId}/deliveries/{WebhookDeliveryId}",
2040
- render: (webhookId, webhookDeliveryId) => "webhooks/{WebhookId}/deliveries/{WebhookDeliveryId}".replace("{WebhookId}", encodeURIComponent(webhookId)).replace(
2041
- "{WebhookDeliveryId}",
2042
- encodeURIComponent(webhookDeliveryId)
2043
- )
2062
+ render: (webhookId, webhookDeliveryId) => "webhooks/{WebhookId}/deliveries/{WebhookDeliveryId}".replace("{WebhookId}", encodeURIComponent(webhookId)).replace("{WebhookDeliveryId}", encodeURIComponent(webhookDeliveryId))
2044
2063
  },
2045
2064
  redeliver: {
2046
2065
  definition: "webhooks/{WebhookId}/deliveries/{WebhookDeliveryId}/redeliver",
2047
- render: (webhookId, webhookDeliveryId) => "webhooks/{WebhookId}/deliveries/{WebhookDeliveryId}/redeliver".replace("{WebhookId}", encodeURIComponent(webhookId)).replace(
2048
- "{WebhookDeliveryId}",
2049
- encodeURIComponent(webhookDeliveryId)
2050
- )
2066
+ render: (webhookId, webhookDeliveryId) => "webhooks/{WebhookId}/deliveries/{WebhookDeliveryId}/redeliver".replace("{WebhookId}", encodeURIComponent(webhookId)).replace("{WebhookDeliveryId}", encodeURIComponent(webhookDeliveryId))
2051
2067
  }
2052
2068
  }
2053
2069
  };
@@ -2222,10 +2238,7 @@ var InsurUpAgentClient = class {
2222
2238
  * @returns Agent profile information / Acente profil bilgileri
2223
2239
  */
2224
2240
  async getCurrentAgent(options) {
2225
- return this.http.get(
2226
- agents.getCurrentAgent,
2227
- options
2228
- );
2241
+ return this.http.get(agents.getCurrentAgent, options);
2229
2242
  }
2230
2243
  /**
2231
2244
  * Updates the current agent's profile information such as business details, contact information, and operational preferences.
@@ -2260,13 +2273,8 @@ var InsurUpAgentClient = class {
2260
2273
  * @returns Available product branches / Mevcut ürün dalları
2261
2274
  */
2262
2275
  async getAgentInsuranceCompanyBranchesAsync(agentInsuranceCompanyId, options) {
2263
- const endpoint = agents.insuranceCompanies.getBranches.render(
2264
- agentInsuranceCompanyId
2265
- );
2266
- return this.http.get(
2267
- endpoint,
2268
- options
2269
- );
2276
+ const endpoint = agents.insuranceCompanies.getBranches.render(agentInsuranceCompanyId);
2277
+ return this.http.get(endpoint, options);
2270
2278
  }
2271
2279
  /**
2272
2280
  * Retrieves the technical connection configuration and credentials for integrating with a specific insurance company's systems.
@@ -2277,13 +2285,8 @@ var InsurUpAgentClient = class {
2277
2285
  * @returns Connection configuration details / Bağlantı yapılandırma detayları
2278
2286
  */
2279
2287
  async getAgentInsuranceCompanyConnectionAsync(agentInsuranceCompanyId, options) {
2280
- const endpoint = agents.insuranceCompanies.getConnection.render(
2281
- agentInsuranceCompanyId
2282
- );
2283
- return this.http.get(
2284
- endpoint,
2285
- options
2286
- );
2288
+ const endpoint = agents.insuranceCompanies.getConnection.render(agentInsuranceCompanyId);
2289
+ return this.http.get(endpoint, options);
2287
2290
  }
2288
2291
  /**
2289
2292
  * Establishes a new business relationship between the agent and an insurance company, enabling the agent to offer that company's products.
@@ -2309,9 +2312,7 @@ var InsurUpAgentClient = class {
2309
2312
  * @returns Operation result / İşlem sonucu
2310
2313
  */
2311
2314
  async removeAgentInsuranceCompany(agentInsuranceCompanyId, options) {
2312
- const endpoint = agents.insuranceCompanies.remove.render(
2313
- agentInsuranceCompanyId
2314
- );
2315
+ const endpoint = agents.insuranceCompanies.remove.render(agentInsuranceCompanyId);
2315
2316
  return this.http.deleteNoContent(endpoint, options);
2316
2317
  }
2317
2318
  /**
@@ -2364,10 +2365,7 @@ var InsurUpAgentClient = class {
2364
2365
  * @returns List of B2C configuration fields
2365
2366
  */
2366
2367
  async getB2CConfigFields(options) {
2367
- return this.http.get(
2368
- b2c.configFields.getAll,
2369
- options
2370
- );
2368
+ return this.http.get(b2c.configFields.getAll, options);
2371
2369
  }
2372
2370
  /**
2373
2371
  * Updates all B2C configuration fields at once, allowing agents to customize their customer-facing interface settings and branding parameters.
@@ -2418,10 +2416,7 @@ var InsurUpAgentBranchClient = class {
2418
2416
  * @returns List of all agent branches
2419
2417
  */
2420
2418
  async getAgentBranches(options) {
2421
- return this.http.get(
2422
- agentBranches.getAll,
2423
- options
2424
- );
2419
+ return this.http.get(agentBranches.getAll, options);
2425
2420
  }
2426
2421
  /**
2427
2422
  * Updates an existing agent branch's name or parent branch relationship to reflect changing organizational needs.
@@ -2527,11 +2522,7 @@ var InsurUpAgentSetupClient = class {
2527
2522
  * @returns Setup process identifier and next steps / Kurulum süreci tanımlayıcısı ve sonraki adımlar
2528
2523
  */
2529
2524
  async enterAgentSetupRequest(request, options) {
2530
- return this.http.post(
2531
- agentSetupRequests.enter,
2532
- request,
2533
- options
2534
- );
2525
+ return this.http.post(agentSetupRequests.enter, request, options);
2535
2526
  }
2536
2527
  /**
2537
2528
  * Finalizes the agent setup process by confirming all requirements are met and activating the agent's platform access.
@@ -2542,11 +2533,7 @@ var InsurUpAgentSetupClient = class {
2542
2533
  * @returns Operation result / İşlem sonucu
2543
2534
  */
2544
2535
  async completeAgentSetupRequest(request, options) {
2545
- return this.http.postNoContent(
2546
- agentSetupRequests.complete,
2547
- request,
2548
- options
2549
- );
2536
+ return this.http.postNoContent(agentSetupRequests.complete, request, options);
2550
2537
  }
2551
2538
  };
2552
2539
 
@@ -2555,6 +2542,111 @@ import {
2555
2542
  ALL_AGENT_USER_FIELDS
2556
2543
  } from "@insurup/contracts";
2557
2544
  import { buildFieldSelection } from "@insurup/contracts";
2545
+
2546
+ // src/clients/_internal/normalize-search.ts
2547
+ var TEXT_INPUT_OPS = /* @__PURE__ */ new Set([
2548
+ "eq",
2549
+ "neq",
2550
+ "textSearch",
2551
+ "wildcard",
2552
+ "autocomplete",
2553
+ "contains",
2554
+ "notContains",
2555
+ "startsWith",
2556
+ "notStartsWith",
2557
+ "endsWith",
2558
+ "notEndsWith"
2559
+ ]);
2560
+ var TEXT_LIST_INPUT_OPS = /* @__PURE__ */ new Set(["in", "nin"]);
2561
+ var COMBINATOR_OPS = /* @__PURE__ */ new Set(["and", "or"]);
2562
+ function normalizeSearchInput(search) {
2563
+ if (search === null || search === void 0) return search;
2564
+ if (typeof search !== "object") return search;
2565
+ return normalizeNode(search);
2566
+ }
2567
+ function normalizeNode(node) {
2568
+ if (node === null || typeof node !== "object") return node;
2569
+ const out = {};
2570
+ for (const [key, value] of Object.entries(node)) {
2571
+ if (COMBINATOR_OPS.has(key) && Array.isArray(value)) {
2572
+ out[key] = value.map(normalizeNode);
2573
+ } else if (value !== null && typeof value === "object" && !Array.isArray(value)) {
2574
+ out[key] = normalizeStringOps(value);
2575
+ } else {
2576
+ out[key] = value;
2577
+ }
2578
+ }
2579
+ return out;
2580
+ }
2581
+ function normalizeStringOps(field) {
2582
+ const out = {};
2583
+ for (const [op, value] of Object.entries(field)) {
2584
+ if (TEXT_INPUT_OPS.has(op) && typeof value === "string") {
2585
+ out[op] = { value };
2586
+ } else if (TEXT_LIST_INPUT_OPS.has(op) && Array.isArray(value)) {
2587
+ out[op] = { values: value };
2588
+ } else if (COMBINATOR_OPS.has(op) && Array.isArray(value)) {
2589
+ out[op] = value.map((item) => normalizeStringOps(item));
2590
+ } else {
2591
+ out[op] = value;
2592
+ }
2593
+ }
2594
+ return out;
2595
+ }
2596
+
2597
+ // src/clients/_internal/split-unified-filter.ts
2598
+ var isObject = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
2599
+ var isSearchMarked = (v) => isObject(v) && v.$search === true;
2600
+ var stripMarker = ({ $search: _marker, ...rest }) => rest;
2601
+ var nonEmpty = (o) => Object.keys(o).length > 0;
2602
+ function splitUnifiedFilter(input) {
2603
+ if (input == null) return { filter: void 0, search: void 0 };
2604
+ const { filter, search } = splitNode(input);
2605
+ return {
2606
+ filter,
2607
+ search
2608
+ };
2609
+ }
2610
+ function splitNode(node) {
2611
+ const filter = {};
2612
+ const search = {};
2613
+ for (const [key, value] of Object.entries(node)) {
2614
+ if ((key === "and" || key === "or") && Array.isArray(value)) {
2615
+ const filterItems = [];
2616
+ const searchItems = [];
2617
+ for (const item of value) {
2618
+ if (!isObject(item)) {
2619
+ filterItems.push(item);
2620
+ continue;
2621
+ }
2622
+ const split = splitNode(item);
2623
+ if (split.filter) filterItems.push(split.filter);
2624
+ if (split.search) searchItems.push(split.search);
2625
+ }
2626
+ if (filterItems.length > 0) filter[key] = filterItems;
2627
+ if (searchItems.length > 0) search[key] = searchItems;
2628
+ } else if (isSearchMarked(value)) {
2629
+ search[key] = stripMarker(value);
2630
+ } else {
2631
+ filter[key] = value;
2632
+ }
2633
+ }
2634
+ return {
2635
+ filter: nonEmpty(filter) ? filter : void 0,
2636
+ search: nonEmpty(search) ? search : void 0
2637
+ };
2638
+ }
2639
+
2640
+ // src/clients/_internal/build-filter-search-variables.ts
2641
+ function buildFilterSearchVariables(input) {
2642
+ const { filter, search } = splitUnifiedFilter(input);
2643
+ const out = {};
2644
+ if (filter !== void 0) out.filter = filter;
2645
+ if (search !== void 0) out.search = normalizeSearchInput(search);
2646
+ return out;
2647
+ }
2648
+
2649
+ // src/clients/agentUser.ts
2558
2650
  var InsurUpAgentUserClient = class {
2559
2651
  constructor(http, graphql) {
2560
2652
  this.http = http;
@@ -2706,10 +2798,7 @@ var InsurUpAgentUserClient = class {
2706
2798
  * @returns Agent user robot code / Acente kullanıcı robot kodu
2707
2799
  */
2708
2800
  async getMyAgentUserRobotCode(options) {
2709
- return this.http.get(
2710
- agentUsers.meRobotCode,
2711
- options
2712
- );
2801
+ return this.http.get(agentUsers.meRobotCode, options);
2713
2802
  }
2714
2803
  /**
2715
2804
  * Migrates an agent user from the legacy authentication system to the AuthServer.
@@ -2733,11 +2822,7 @@ var InsurUpAgentUserClient = class {
2733
2822
  * @returns Response with the count of migrated users / Taşınan kullanıcı sayısı ile yanıt
2734
2823
  */
2735
2824
  async migrateAllAgentUsers(options) {
2736
- return this.http.post(
2737
- agentUsers.migrateAll,
2738
- void 0,
2739
- options
2740
- );
2825
+ return this.http.post(agentUsers.migrateAll, void 0, options);
2741
2826
  }
2742
2827
  // ============================================================================
2743
2828
  // GRAPHQL QUERIES
@@ -2813,8 +2898,7 @@ var InsurUpAgentUserClient = class {
2813
2898
  after: requestOptions?.after,
2814
2899
  last: requestOptions?.last,
2815
2900
  before: requestOptions?.before,
2816
- search: requestOptions?.search,
2817
- filter: requestOptions?.filter,
2901
+ ...buildFilterSearchVariables(requestOptions?.filter),
2818
2902
  order: requestOptions?.order
2819
2903
  };
2820
2904
  const result = await this.graphql.query(query, variables, options);
@@ -2880,10 +2964,7 @@ var InsurUpCustomerClient = class {
2880
2964
  * Retrieves the profile information of the currently authenticated customer.
2881
2965
  */
2882
2966
  async getCurrentCustomer(options) {
2883
- return this.http.get(
2884
- endpoints.customers.getCurrentCustomer,
2885
- options
2886
- );
2967
+ return this.http.get(endpoints.customers.getCurrentCustomer, options);
2887
2968
  }
2888
2969
  /**
2889
2970
  * Updates existing customer profile information.
@@ -2942,14 +3023,37 @@ var InsurUpCustomerClient = class {
2942
3023
  options
2943
3024
  );
2944
3025
  }
3026
+ /**
3027
+ * Retrieves the primary email address for a customer.
3028
+ *
3029
+ * Müşterinin birincil e-posta adresini getirir.
3030
+ */
3031
+ async getPrimaryCustomerEmail(customerId, options) {
3032
+ return this.http.get(
3033
+ endpoints.customers.emails.getPrimaryCustomerEmail.render(customerId),
3034
+ options
3035
+ );
3036
+ }
3037
+ /**
3038
+ * Sets the primary email address for a customer (upsert — adds to the customer's email
3039
+ * collection if missing, then marks it as primary).
3040
+ *
3041
+ * Müşterinin birincil e-posta adresini ayarlar (mevcut değilse koleksiyona ekler ve birincil
3042
+ * olarak işaretler).
3043
+ */
3044
+ async setPrimaryCustomerEmail(request, options) {
3045
+ return this.http.putNoContent(
3046
+ endpoints.customers.emails.setPrimaryCustomerEmail.render(request.customerId),
3047
+ request,
3048
+ options
3049
+ );
3050
+ }
2945
3051
  /**
2946
3052
  * Retrieves all phone numbers associated with a customer.
2947
3053
  */
2948
3054
  async getCustomerPhoneNumbers(customerId, options) {
2949
3055
  return this.http.get(
2950
- endpoints.customers.phoneNumbers.getCustomerPhoneNumbers.render(
2951
- customerId
2952
- ),
3056
+ endpoints.customers.phoneNumbers.getCustomerPhoneNumbers.render(customerId),
2953
3057
  options
2954
3058
  );
2955
3059
  }
@@ -2958,9 +3062,7 @@ var InsurUpCustomerClient = class {
2958
3062
  */
2959
3063
  async addCustomerPhoneNumber(request, options) {
2960
3064
  return this.http.postNoContent(
2961
- endpoints.customers.phoneNumbers.addCustomerPhoneNumber.render(
2962
- request.customerId
2963
- ),
3065
+ endpoints.customers.phoneNumbers.addCustomerPhoneNumber.render(request.customerId),
2964
3066
  request,
2965
3067
  options
2966
3068
  );
@@ -2970,9 +3072,7 @@ var InsurUpCustomerClient = class {
2970
3072
  */
2971
3073
  async removeCustomerPhoneNumber(request, options) {
2972
3074
  return this.http.deleteNoContent(
2973
- endpoints.customers.phoneNumbers.removeCustomerPhoneNumber.render(
2974
- request
2975
- ),
3075
+ endpoints.customers.phoneNumbers.removeCustomerPhoneNumber.render(request),
2976
3076
  options
2977
3077
  );
2978
3078
  }
@@ -2981,13 +3081,49 @@ var InsurUpCustomerClient = class {
2981
3081
  */
2982
3082
  async changePrimaryCustomerPhoneNumber(request, options) {
2983
3083
  return this.http.postNoContent(
2984
- endpoints.customers.phoneNumbers.changePrimaryCustomerPhoneNumber.render(
2985
- request
2986
- ),
3084
+ endpoints.customers.phoneNumbers.changePrimaryCustomerPhoneNumber.render(request),
2987
3085
  void 0,
2988
3086
  options
2989
3087
  );
2990
3088
  }
3089
+ /**
3090
+ * Retrieves the primary phone number for a customer.
3091
+ *
3092
+ * Müşterinin birincil telefon numarasını getirir.
3093
+ */
3094
+ async getPrimaryCustomerPhoneNumber(customerId, options) {
3095
+ return this.http.get(
3096
+ endpoints.customers.phoneNumbers.getPrimaryCustomerPhoneNumber.render(customerId),
3097
+ options
3098
+ );
3099
+ }
3100
+ /**
3101
+ * Sets the primary phone number for a customer (upsert — adds to the customer's phone
3102
+ * number collection if missing, then marks it as primary).
3103
+ *
3104
+ * Müşterinin birincil telefon numarasını ayarlar (mevcut değilse koleksiyona ekler ve
3105
+ * birincil olarak işaretler).
3106
+ */
3107
+ async setPrimaryCustomerPhoneNumber(request, options) {
3108
+ return this.http.putNoContent(
3109
+ endpoints.customers.phoneNumbers.setPrimaryCustomerPhoneNumber.render(request.customerId),
3110
+ request,
3111
+ options
3112
+ );
3113
+ }
3114
+ /**
3115
+ * Retrieves all of a customer's insurable assets (vehicles and properties) in a single
3116
+ * polymorphic list discriminated by the `$type` field.
3117
+ *
3118
+ * Müşterinin tüm sigortalanabilir varlıklarını (araçlar ve mülkler) `$type` alanı ile
3119
+ * ayırt edilen tek bir polimorfik listede getirir.
3120
+ */
3121
+ async getCustomerAssets(customerId, options) {
3122
+ return this.http.get(
3123
+ endpoints.customers.getCustomerAssets.render(customerId),
3124
+ options
3125
+ );
3126
+ }
2991
3127
  /**
2992
3128
  * Assigns a specific agent representative to manage a customer's account.
2993
3129
  */
@@ -3039,10 +3175,7 @@ var InsurUpCustomerClient = class {
3039
3175
  */
3040
3176
  async updateCustomerAddress(request, options) {
3041
3177
  return this.http.putNoContent(
3042
- endpoints.customers.addresses.update.render(
3043
- request.customerId,
3044
- request.addressId
3045
- ),
3178
+ endpoints.customers.addresses.update.render(request.customerId, request.addressId),
3046
3179
  request,
3047
3180
  options
3048
3181
  );
@@ -3162,9 +3295,7 @@ var InsurUpCustomerClient = class {
3162
3295
  */
3163
3296
  async createCustomerContactFlow(request, options) {
3164
3297
  return this.http.postNoContent(
3165
- endpoints.customers.contactFlows.createContactFlow.render(
3166
- request.customerId
3167
- ),
3298
+ endpoints.customers.contactFlows.createContactFlow.render(request.customerId),
3168
3299
  request,
3169
3300
  options
3170
3301
  );
@@ -3197,10 +3328,7 @@ var InsurUpCustomerClient = class {
3197
3328
  */
3198
3329
  async getCustomerContactFlows(customerId, caseRef, options) {
3199
3330
  return this.http.get(
3200
- endpoints.customers.contactFlows.getCustomerContactFlows.render(
3201
- customerId,
3202
- caseRef
3203
- ),
3331
+ endpoints.customers.contactFlows.getCustomerContactFlows.render(customerId, caseRef),
3204
3332
  options
3205
3333
  );
3206
3334
  }
@@ -3209,10 +3337,7 @@ var InsurUpCustomerClient = class {
3209
3337
  */
3210
3338
  async getCustomerContacts(customerId, caseRef, options) {
3211
3339
  return this.http.get(
3212
- endpoints.customers.contacts.getCustomerContacts.render(
3213
- customerId,
3214
- caseRef
3215
- ),
3340
+ endpoints.customers.contacts.getCustomerContacts.render(customerId, caseRef),
3216
3341
  options
3217
3342
  );
3218
3343
  }
@@ -3298,25 +3423,15 @@ var InsurUpCustomerClient = class {
3298
3423
  }
3299
3424
  }
3300
3425
  `;
3301
- const variables = {};
3302
- if (requestOptions?.first === void 0 && requestOptions?.last === void 0) {
3303
- variables.first = 50;
3304
- } else {
3305
- if (requestOptions?.first !== void 0)
3306
- variables.first = requestOptions.first;
3307
- if (requestOptions?.last !== void 0)
3308
- variables.last = requestOptions.last;
3309
- }
3310
- if (requestOptions?.after !== void 0)
3311
- variables.after = requestOptions.after;
3312
- if (requestOptions?.before !== void 0)
3313
- variables.before = requestOptions.before;
3314
- if (requestOptions?.search !== void 0)
3315
- variables.search = requestOptions.search;
3316
- if (requestOptions?.filter !== void 0)
3317
- variables.filter = requestOptions.filter;
3318
- if (requestOptions?.order !== void 0)
3319
- variables.order = requestOptions.order;
3426
+ const first = requestOptions?.first === void 0 && requestOptions?.last === void 0 ? 50 : requestOptions?.first;
3427
+ const variables = {
3428
+ first,
3429
+ after: requestOptions?.after,
3430
+ last: requestOptions?.last,
3431
+ before: requestOptions?.before,
3432
+ ...buildFilterSearchVariables(requestOptions?.filter),
3433
+ order: requestOptions?.order
3434
+ };
3320
3435
  const result = await this.graphql.query(query, variables, options);
3321
3436
  if (!result.isSuccess) {
3322
3437
  return result;
@@ -3359,10 +3474,7 @@ var InsurUpVehicleClient = class {
3359
3474
  * @returns Operation result / İşlem sonucu
3360
3475
  */
3361
3476
  async updateCustomerVehicle(request, options) {
3362
- const path = endpoints.vehicles.update.render(
3363
- request.customerId,
3364
- request.vehicleId
3365
- );
3477
+ const path = endpoints.vehicles.update.render(request.customerId, request.vehicleId);
3366
3478
  return this.http.putNoContent(path, request, options);
3367
3479
  }
3368
3480
  /**
@@ -3387,9 +3499,7 @@ var InsurUpVehicleClient = class {
3387
3499
  * @returns List of customer vehicles / Müşteri araçları listesi
3388
3500
  */
3389
3501
  async getCustomerVehicles(request, options) {
3390
- const path = endpoints.vehicles.getCustomerVehicles.render(
3391
- request.customerId
3392
- );
3502
+ const path = endpoints.vehicles.getCustomerVehicles.render(request.customerId);
3393
3503
  return this.http.get(path, options);
3394
3504
  }
3395
3505
  /**
@@ -3451,11 +3561,7 @@ var InsurUpVehicleClient = class {
3451
3561
  async queryVehicleByBrandCode(brandCode, options) {
3452
3562
  const path = endpoints.insuranceServices.queryVehicleByBrandCode;
3453
3563
  const request = { brandCode };
3454
- return this.http.post(
3455
- path,
3456
- request,
3457
- options
3458
- );
3564
+ return this.http.post(path, request, options);
3459
3565
  }
3460
3566
  };
3461
3567
 
@@ -3473,10 +3579,7 @@ var InsurUpPropertyClient = class {
3473
3579
  * @returns List of Turkish cities / Türk şehirleri listesi
3474
3580
  */
3475
3581
  async queryCities(options) {
3476
- return this.http.get(
3477
- addressParameters.queryCities,
3478
- options
3479
- );
3582
+ return this.http.get(addressParameters.queryCities, options);
3480
3583
  }
3481
3584
  /**
3482
3585
  * Retrieves all districts within a specific city following the Turkish administrative hierarchy.
@@ -3632,10 +3735,7 @@ var InsurUpPropertyClient = class {
3632
3735
  * @returns Operation result / İşlem sonucu
3633
3736
  */
3634
3737
  async deleteCustomerProperty(customerId, propertyId, options) {
3635
- return this.http.deleteNoContent(
3636
- properties.delete.render(customerId, propertyId),
3637
- options
3638
- );
3738
+ return this.http.deleteNoContent(properties.delete.render(customerId, propertyId), options);
3639
3739
  }
3640
3740
  /**
3641
3741
  * Retrieves property address information using the official Turkish property registration number for verification purposes.
@@ -3868,9 +3968,7 @@ var InsurUpPolicyClient = class {
3868
3968
  */
3869
3969
  async getPolicyTransferDetail(request, options) {
3870
3970
  return this.http.get(
3871
- endpoints.policyTransfers.getPolicyTransferDetail.render(
3872
- request.policyTransferId
3873
- ),
3971
+ endpoints.policyTransfers.getPolicyTransferDetail.render(request.policyTransferId),
3874
3972
  options
3875
3973
  );
3876
3974
  }
@@ -3900,11 +3998,7 @@ var InsurUpPolicyClient = class {
3900
3998
  * @returns Created transfer identifier
3901
3999
  */
3902
4000
  async createPolicyTransfer(request, options) {
3903
- return this.http.post(
3904
- endpoints.policyTransfers.create,
3905
- request,
3906
- options
3907
- );
4001
+ return this.http.post(endpoints.policyTransfers.create, request, options);
3908
4002
  }
3909
4003
  /**
3910
4004
  * Executes a prepared policy transfer, initiating the actual movement of policies according to the transfer configuration.
@@ -3916,9 +4010,7 @@ var InsurUpPolicyClient = class {
3916
4010
  */
3917
4011
  async triggerPolicyTransfer(request, options) {
3918
4012
  return this.http.postNoContent(
3919
- endpoints.policyTransfers.triggerPolicyTransfer.render(
3920
- request.policyTransferId
3921
- ),
4013
+ endpoints.policyTransfers.triggerPolicyTransfer.render(request.policyTransferId),
3922
4014
  request,
3923
4015
  options
3924
4016
  );
@@ -3935,16 +4027,9 @@ var InsurUpPolicyClient = class {
3935
4027
  */
3936
4028
  async createFilePolicyTransfer(request, file, fileName, options) {
3937
4029
  const formData = new FormData();
3938
- formData.append(
3939
- "insuranceCompanyId",
3940
- request.insuranceCompanyId.toString()
3941
- );
4030
+ formData.append("insuranceCompanyId", request.insuranceCompanyId.toString());
3942
4031
  formData.append("file", file, fileName);
3943
- return this.http.postNoContent(
3944
- endpoints.filePolicyTransfers.create,
3945
- formData,
3946
- options
3947
- );
4032
+ return this.http.postNoContent(endpoints.filePolicyTransfers.create, formData, options);
3948
4033
  }
3949
4034
  /**
3950
4035
  * Retrieves detailed information about a file-based policy transfer including processing status and results.
@@ -4037,8 +4122,7 @@ var InsurUpPolicyClient = class {
4037
4122
  after: requestOptions?.after,
4038
4123
  last: requestOptions?.last,
4039
4124
  before: requestOptions?.before,
4040
- search: requestOptions?.search,
4041
- filter: requestOptions?.filter,
4125
+ ...buildFilterSearchVariables(requestOptions?.filter),
4042
4126
  order: requestOptions?.order
4043
4127
  };
4044
4128
  const result = await this.graphql.query(query, variables, options);
@@ -4118,8 +4202,7 @@ var InsurUpPolicyClient = class {
4118
4202
  after: requestOptions?.after,
4119
4203
  last: requestOptions?.last,
4120
4204
  before: requestOptions?.before,
4121
- search: requestOptions?.search,
4122
- filter: requestOptions?.filter,
4205
+ ...buildFilterSearchVariables(requestOptions?.filter),
4123
4206
  order: requestOptions?.order
4124
4207
  };
4125
4208
  const result = await this.graphql.query(query, variables, options);
@@ -4199,8 +4282,7 @@ var InsurUpPolicyClient = class {
4199
4282
  after: requestOptions?.after,
4200
4283
  last: requestOptions?.last,
4201
4284
  before: requestOptions?.before,
4202
- search: requestOptions?.search,
4203
- filter: requestOptions?.filter,
4285
+ ...buildFilterSearchVariables(requestOptions?.filter),
4204
4286
  order: requestOptions?.order
4205
4287
  };
4206
4288
  const result = await this.graphql.query(query, variables, options);
@@ -4285,11 +4367,7 @@ var InsurUpCaseClient = class {
4285
4367
  * @returns Created case identifier / Oluşturulan talep tanımlayıcısı
4286
4368
  */
4287
4369
  async createComplaintCase(request, options) {
4288
- return await this.http.post(
4289
- cases.createComplaint,
4290
- request,
4291
- options
4292
- );
4370
+ return await this.http.post(cases.createComplaint, request, options);
4293
4371
  }
4294
4372
  /**
4295
4373
  * Creates a cross-sale opportunity case to track potential additional insurance products for existing customers.
@@ -4300,11 +4378,7 @@ var InsurUpCaseClient = class {
4300
4378
  * @returns Created case identifier / Oluşturulan talep tanımlayıcısı
4301
4379
  */
4302
4380
  async createCrossSaleOpportunityCase(request, options) {
4303
- return await this.http.post(
4304
- cases.createCrossSaleOpportunity,
4305
- request,
4306
- options
4307
- );
4381
+ return await this.http.post(cases.createCrossSaleOpportunity, request, options);
4308
4382
  }
4309
4383
  /**
4310
4384
  * Creates an endorsement case for policy modifications or updates requested by the customer.
@@ -4315,11 +4389,7 @@ var InsurUpCaseClient = class {
4315
4389
  * @returns Created case identifier / Oluşturulan talep tanımlayıcısı
4316
4390
  */
4317
4391
  async createEndorsementCase(request, options) {
4318
- return await this.http.post(
4319
- cases.createEndorsement,
4320
- request,
4321
- options
4322
- );
4392
+ return await this.http.post(cases.createEndorsement, request, options);
4323
4393
  }
4324
4394
  /**
4325
4395
  * Creates a new sale opportunity case to track potential insurance sales to prospective customers.
@@ -4330,11 +4400,7 @@ var InsurUpCaseClient = class {
4330
4400
  * @returns Created case identifier / Oluşturulan talep tanımlayıcısı
4331
4401
  */
4332
4402
  async createNewSaleOpportunityCase(request, options) {
4333
- return await this.http.post(
4334
- cases.createNewSaleOpportunity,
4335
- request,
4336
- options
4337
- );
4403
+ return await this.http.post(cases.createNewSaleOpportunity, request, options);
4338
4404
  }
4339
4405
  /**
4340
4406
  * Retrieves all policies associated with a specific case for comprehensive case context and decision making.
@@ -4486,10 +4552,7 @@ var InsurUpCaseClient = class {
4486
4552
  * @returns Available case priority templates / Mevcut talep öncelik şablonları
4487
4553
  */
4488
4554
  async getCasePriorityTemplates(options) {
4489
- return await this.http.get(
4490
- cases.getPriorityTemplates,
4491
- options
4492
- );
4555
+ return await this.http.get(cases.getPriorityTemplates, options);
4493
4556
  }
4494
4557
  // ============================================================================
4495
4558
  // GRAPHQL QUERIES
@@ -4565,8 +4628,7 @@ var InsurUpCaseClient = class {
4565
4628
  after: requestOptions?.after,
4566
4629
  last: requestOptions?.last,
4567
4630
  before: requestOptions?.before,
4568
- search: requestOptions?.search,
4569
- filter: requestOptions?.filter,
4631
+ ...buildFilterSearchVariables(requestOptions?.filter),
4570
4632
  order: requestOptions?.order
4571
4633
  };
4572
4634
  const result = await this.graphql.query(query, variables, options);
@@ -4604,11 +4666,7 @@ var InsurUpWebhookClient = class {
4604
4666
  * @returns Created webhook information / Oluşturulan webhook bilgileri
4605
4667
  */
4606
4668
  async createWebhook(request, options) {
4607
- return this.http.post(
4608
- webhooks.create,
4609
- request,
4610
- options
4611
- );
4669
+ return this.http.post(webhooks.create, request, options);
4612
4670
  }
4613
4671
  /**
4614
4672
  * Retrieves detailed information about a specific webhook including its configuration and current status.
@@ -4666,10 +4724,7 @@ var InsurUpWebhookClient = class {
4666
4724
  * @returns Webhook delivery details / Webhook teslimat detayları
4667
4725
  */
4668
4726
  async getWebhookDelivery(webhookId, webhookDeliveryId, options) {
4669
- const endpoint = webhooks.deliveries.getById.render(
4670
- webhookId,
4671
- webhookDeliveryId
4672
- );
4727
+ const endpoint = webhooks.deliveries.getById.render(webhookId, webhookDeliveryId);
4673
4728
  return this.http.get(endpoint, options);
4674
4729
  }
4675
4730
  /**
@@ -4682,10 +4737,7 @@ var InsurUpWebhookClient = class {
4682
4737
  * @returns Operation result / İşlem sonucu
4683
4738
  */
4684
4739
  async redeliverWebhookEvent(webhookId, webhookDeliveryId, options) {
4685
- const endpoint = webhooks.deliveries.redeliver.render(
4686
- webhookId,
4687
- webhookDeliveryId
4688
- );
4740
+ const endpoint = webhooks.deliveries.redeliver.render(webhookId, webhookDeliveryId);
4689
4741
  return this.http.postNoContent(endpoint, void 0, options);
4690
4742
  }
4691
4743
  // ============================================================================
@@ -4762,8 +4814,7 @@ var InsurUpWebhookClient = class {
4762
4814
  after: requestOptions?.after,
4763
4815
  last: requestOptions?.last,
4764
4816
  before: requestOptions?.before,
4765
- search: requestOptions?.search,
4766
- filter: requestOptions?.filter,
4817
+ ...buildFilterSearchVariables(requestOptions?.filter),
4767
4818
  order: requestOptions?.order
4768
4819
  };
4769
4820
  const result = await this.graphql.query(query, variables, options);
@@ -4807,11 +4858,7 @@ var InsurUpCoverageClient = class {
4807
4858
  * @returns Operation result / İşlem sonucu
4808
4859
  */
4809
4860
  async updateCoverageGroup(request, options) {
4810
- return this.http.putNoContent(
4811
- coverageGroups.update.render(request.id),
4812
- request,
4813
- options
4814
- );
4861
+ return this.http.putNoContent(coverageGroups.update.render(request.id), request, options);
4815
4862
  }
4816
4863
  /**
4817
4864
  * Removes a coverage group from the system, ensuring proper cleanup of associated coverage configurations.
@@ -4822,10 +4869,7 @@ var InsurUpCoverageClient = class {
4822
4869
  * @returns Operation result / İşlem sonucu
4823
4870
  */
4824
4871
  async deleteCoverageGroup(request, options) {
4825
- return this.http.deleteNoContent(
4826
- coverageGroups.delete.render(request.id),
4827
- options
4828
- );
4872
+ return this.http.deleteNoContent(coverageGroups.delete.render(request.id), options);
4829
4873
  }
4830
4874
  /**
4831
4875
  * Retrieves detailed information about a specific coverage group including its coverage options and configurations.
@@ -4836,10 +4880,7 @@ var InsurUpCoverageClient = class {
4836
4880
  * @returns Coverage group details / Teminat grubu detayları
4837
4881
  */
4838
4882
  async getCoverageGroupById(coverageGroupId, options) {
4839
- return this.http.get(
4840
- coverageGroups.getById.render(coverageGroupId),
4841
- options
4842
- );
4883
+ return this.http.get(coverageGroups.getById.render(coverageGroupId), options);
4843
4884
  }
4844
4885
  /**
4845
4886
  * Retrieves all available coverage groups within the agency for comprehensive coverage management overview.
@@ -4860,13 +4901,8 @@ var InsurUpCoverageClient = class {
4860
4901
  * @returns Kasko coverage choices grouped by insurance company / Sigorta şirketine göre gruplanmış Kasko teminat seçenekleri
4861
4902
  */
4862
4903
  async getKaskoCoverageChoices(vehicleUtilizationStyle, options) {
4863
- const endpoint = coverageChoices.getKaskoCoverageChoices.render(
4864
- vehicleUtilizationStyle
4865
- );
4866
- return this.http.get(
4867
- endpoint,
4868
- options
4869
- );
4904
+ const endpoint = coverageChoices.getKaskoCoverageChoices.render(vehicleUtilizationStyle);
4905
+ return this.http.get(endpoint, options);
4870
4906
  }
4871
4907
  /**
4872
4908
  * Retrieves available Konut (home/property insurance) coverage options including DASK earthquake insurance configurations.
@@ -4946,9 +4982,7 @@ var InsurUpInsuranceClient = class {
4946
4982
  * @returns List of insurance products / Sigorta ürünleri listesi
4947
4983
  */
4948
4984
  async getInsuranceCompanyProducts(insuranceCompanyId, options) {
4949
- const path = endpoints.insuranceCompanies.getInsuranceCompanyProducts.render(
4950
- insuranceCompanyId
4951
- );
4985
+ const path = endpoints.insuranceCompanies.getInsuranceCompanyProducts.render(insuranceCompanyId);
4952
4986
  return this.http.get(path, options);
4953
4987
  }
4954
4988
  /**
@@ -4959,10 +4993,7 @@ var InsurUpInsuranceClient = class {
4959
4993
  * @returns List of all insurance products / Tüm sigorta ürünleri listesi
4960
4994
  */
4961
4995
  async getAllProducts(options) {
4962
- return this.http.get(
4963
- endpoints.insuranceCompanies.getAllProducts,
4964
- options
4965
- );
4996
+ return this.http.get(endpoints.insuranceCompanies.getAllProducts, options);
4966
4997
  }
4967
4998
  /**
4968
4999
  * Retrieves agent-specific connection fields and requirements for integrating with a particular insurance company's systems.
@@ -4976,10 +5007,7 @@ var InsurUpInsuranceClient = class {
4976
5007
  const path = endpoints.insuranceCompanies.connectionFields.getAgentBasedConnectionFieldsByCompanyId.render(
4977
5008
  insuranceCompanyId
4978
5009
  );
4979
- return this.http.get(
4980
- path,
4981
- options
4982
- );
5010
+ return this.http.get(path, options);
4983
5011
  }
4984
5012
  /**
4985
5013
  * Retrieves all platform release notes including new features, bug fixes, and important updates for system awareness.
@@ -4989,10 +5017,7 @@ var InsurUpInsuranceClient = class {
4989
5017
  * @returns Platform release notes / Platform sürüm notları
4990
5018
  */
4991
5019
  async getAllReleaseNotes(options) {
4992
- return this.http.get(
4993
- endpoints.releaseNotes.getAll,
4994
- options
4995
- );
5020
+ return this.http.get(endpoints.releaseNotes.getAll, options);
4996
5021
  }
4997
5022
  /**
4998
5023
  * Retrieves all banks available for premium collection, policy financing, and customer payment processing operations.
@@ -5024,10 +5049,7 @@ var InsurUpInsuranceClient = class {
5024
5049
  * @returns List of financial institutions / Finansal kurumlar listesi
5025
5050
  */
5026
5051
  async getFinancialInstitutions(options) {
5027
- return this.http.get(
5028
- endpoints.financialInstitutions.getAll,
5029
- options
5030
- );
5052
+ return this.http.get(endpoints.financialInstitutions.getAll, options);
5031
5053
  }
5032
5054
  };
5033
5055
 
@@ -5037,9 +5059,42 @@ import {
5037
5059
  } from "@insurup/contracts";
5038
5060
  import { buildFieldSelection as buildFieldSelection6 } from "@insurup/contracts";
5039
5061
  var InsurUpProposalClient = class {
5040
- constructor(http, graphql) {
5062
+ constructor(http, graphql, signalR) {
5041
5063
  this.http = http;
5042
5064
  this.graphql = graphql;
5065
+ this.signalR = signalR;
5066
+ }
5067
+ /**
5068
+ * Subscribe to real-time updates for a proposal via the InsurUp SignalR
5069
+ * ProposalDetailHub. The first subscriber opens the underlying hub
5070
+ * connection lazily; subscriptions for additional proposals are multiplexed
5071
+ * over the same connection. Pass only the handlers you care about.
5072
+ *
5073
+ * Teklif için gerçek zamanlı güncellemelere SignalR üzerinden abone olur.
5074
+ *
5075
+ * @param proposalId - The proposal to subscribe to / Abone olunacak teklif
5076
+ * @param handlers - Per-event callbacks; missing entries are ignored
5077
+ * @returns An unsubscribe function. When the last subscription is torn
5078
+ * down, the underlying hub connection is stopped.
5079
+ * @throws If the SDK client was constructed without SignalR support
5080
+ *
5081
+ * @example
5082
+ * ```typescript
5083
+ * const unsub = await client.proposals.subscribeToDetail(proposalId, {
5084
+ * onProductSuccess: (event) => console.log('priced', event),
5085
+ * onProductFailed: (event) => console.warn('failed', event.errorMessage),
5086
+ * });
5087
+ * // later
5088
+ * unsub();
5089
+ * ```
5090
+ */
5091
+ async subscribeToDetail(proposalId, handlers) {
5092
+ if (!this.signalR) {
5093
+ throw new Error(
5094
+ "subscribeToDetail requires SignalR support; construct the client via DefaultInsurUpClient"
5095
+ );
5096
+ }
5097
+ return this.signalR.subscribeProposalDetail(proposalId, handlers);
5043
5098
  }
5044
5099
  /**
5045
5100
  * Creates a new insurance proposal with customer information, coverage selections, and product options for quotation.
@@ -5050,11 +5105,7 @@ var InsurUpProposalClient = class {
5050
5105
  * @returns Created proposal information / Oluşturulan teklif bilgileri
5051
5106
  */
5052
5107
  async createProposal(request, options) {
5053
- return this.http.post(
5054
- endpoints.proposals.create,
5055
- request,
5056
- options
5057
- );
5108
+ return this.http.post(endpoints.proposals.create, request, options);
5058
5109
  }
5059
5110
  /**
5060
5111
  * Retries a failed proposal product calculation or processing to attempt resolution of temporary issues.
@@ -5071,10 +5122,7 @@ var InsurUpProposalClient = class {
5071
5122
  proposalProductId
5072
5123
  };
5073
5124
  return this.http.postNoContent(
5074
- endpoints.proposals.retryFailedProposalProduct.render(
5075
- proposalId,
5076
- proposalProductId
5077
- ),
5125
+ endpoints.proposals.retryFailedProposalProduct.render(proposalId, proposalProductId),
5078
5126
  request,
5079
5127
  options
5080
5128
  );
@@ -5160,10 +5208,7 @@ var InsurUpProposalClient = class {
5160
5208
  */
5161
5209
  async getProposalProductCoverage(proposalId, proposalProductId, options) {
5162
5210
  return this.http.get(
5163
- endpoints.proposals.getProposalProductCoverage.render(
5164
- proposalId,
5165
- proposalProductId
5166
- ),
5211
+ endpoints.proposals.getProposalProductCoverage.render(proposalId, proposalProductId),
5167
5212
  options
5168
5213
  );
5169
5214
  }
@@ -5280,9 +5325,7 @@ var InsurUpProposalClient = class {
5280
5325
  */
5281
5326
  async generateCompareProposalProductsPdf(request, options) {
5282
5327
  return this.http.post(
5283
- endpoints.proposals.generateCompareProposalProductsPdf.render(
5284
- request.proposalId
5285
- ),
5328
+ endpoints.proposals.generateCompareProposalProductsPdf.render(request.proposalId),
5286
5329
  request,
5287
5330
  options
5288
5331
  );
@@ -5297,9 +5340,7 @@ var InsurUpProposalClient = class {
5297
5340
  */
5298
5341
  async sendCompareProposalProductsPdf(request, options) {
5299
5342
  return this.http.postNoContent(
5300
- endpoints.proposals.sendCompareProposalProductsPdf.render(
5301
- request.proposalId
5302
- ),
5343
+ endpoints.proposals.sendCompareProposalProductsPdf.render(request.proposalId),
5303
5344
  request,
5304
5345
  options
5305
5346
  );
@@ -5314,9 +5355,7 @@ var InsurUpProposalClient = class {
5314
5355
  */
5315
5356
  async generateCustomerProposalDocumentPdf(request, options) {
5316
5357
  return this.http.post(
5317
- endpoints.proposals.generateCustomerProposalDocumentPdf.render(
5318
- request.proposalId
5319
- ),
5358
+ endpoints.proposals.generateCustomerProposalDocumentPdf.render(request.proposalId),
5320
5359
  request,
5321
5360
  options
5322
5361
  );
@@ -5440,8 +5479,7 @@ var InsurUpProposalClient = class {
5440
5479
  after: requestOptions?.after,
5441
5480
  last: requestOptions?.last,
5442
5481
  before: requestOptions?.before,
5443
- search: requestOptions?.search,
5444
- filter: requestOptions?.filter,
5482
+ ...buildFilterSearchVariables(requestOptions?.filter),
5445
5483
  order: requestOptions?.order
5446
5484
  };
5447
5485
  const result = await this.graphql.query(query, variables, options);
@@ -5483,11 +5521,7 @@ var InsurUpFileClient = class {
5483
5521
  if (request.path) {
5484
5522
  formData.append("path", request.path);
5485
5523
  }
5486
- return this.http.post(
5487
- files.uploadPublicFile,
5488
- formData,
5489
- options
5490
- );
5524
+ return this.http.post(files.uploadPublicFile, formData, options);
5491
5525
  }
5492
5526
  };
5493
5527
 
@@ -5527,10 +5561,7 @@ var InsurUpTemplateClient = class {
5527
5561
  * @returns List of all template definitions
5528
5562
  */
5529
5563
  async getTemplateDefinitions(options) {
5530
- return this.http.get(
5531
- templates.getDefinitions,
5532
- options
5533
- );
5564
+ return this.http.get(templates.getDefinitions, options);
5534
5565
  }
5535
5566
  /**
5536
5567
  * Retrieves all available templates in the system with their metadata and content.
@@ -5593,6 +5624,7 @@ var InsurUpTemplateClient = class {
5593
5624
  var DefaultInsurUpClient = class {
5594
5625
  http;
5595
5626
  graphql;
5627
+ signalR;
5596
5628
  /**
5597
5629
  * Agent Management Client
5598
5630
  *
@@ -5717,6 +5749,11 @@ var DefaultInsurUpClient = class {
5717
5749
  this.http = new HttpTransport(options);
5718
5750
  this.graphql = new GraphQLTransport(this.http);
5719
5751
  this.options = options || {};
5752
+ this.signalR = new SignalRTransport({
5753
+ hubsBaseUrl: options?.hubsBaseUrl ?? deriveHubsBaseUrl(options?.baseUrl),
5754
+ tokenProvider: options?.tokenProvider,
5755
+ logLevel: options?.signalRLogLevel
5756
+ });
5720
5757
  this.agents = new InsurUpAgentClient(this.http);
5721
5758
  this.agentBranches = new InsurUpAgentBranchClient(this.http);
5722
5759
  this.agentRoles = new InsurUpAgentRoleClient(this.http);
@@ -5730,14 +5767,27 @@ var DefaultInsurUpClient = class {
5730
5767
  this.webhooks = new InsurUpWebhookClient(this.http, this.graphql);
5731
5768
  this.coverage = new InsurUpCoverageClient(this.http);
5732
5769
  this.insurance = new InsurUpInsuranceClient(this.http);
5733
- this.proposals = new InsurUpProposalClient(this.http, this.graphql);
5770
+ this.proposals = new InsurUpProposalClient(this.http, this.graphql, this.signalR);
5734
5771
  this.files = new InsurUpFileClient(this.http);
5735
5772
  this.languages = new InsurUpLanguageClient(this.http);
5736
5773
  this.templates = new InsurUpTemplateClient(this.http);
5737
5774
  }
5775
+ /**
5776
+ * Stop any open SignalR connection and drop pending subscribers. Safe to
5777
+ * call multiple times. Call this when disposing of the SDK client (e.g. on
5778
+ * app teardown or test cleanup).
5779
+ */
5780
+ async close() {
5781
+ await this.signalR.close();
5782
+ }
5738
5783
  };
5784
+ function deriveHubsBaseUrl(baseUrl) {
5785
+ const resolved = baseUrl ?? "https://api.insurup.com/api/";
5786
+ return new URL(resolved).origin;
5787
+ }
5739
5788
 
5740
5789
  // src/index.ts
5790
+ import { LogLevel as LogLevel2 } from "@microsoft/signalr";
5741
5791
  export * from "@insurup/contracts";
5742
5792
  export {
5743
5793
  DefaultInsurUpClient,
@@ -5764,6 +5814,8 @@ export {
5764
5814
  InsurUpTemplateClient,
5765
5815
  InsurUpVehicleClient,
5766
5816
  InsurUpWebhookClient,
5817
+ LogLevel2 as SignalRLogLevel,
5818
+ SignalRTransport,
5767
5819
  VERSION,
5768
5820
  createGraphQLErrors,
5769
5821
  extractError,