@visa-check-r/integrations 0.0.112 → 0.0.114

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -2244,7 +2244,8 @@ var sopReviewQuery = [
2244
2244
  "visaProfileChecklistItemId",
2245
2245
  "visaProfileId",
2246
2246
  "isValidSOP",
2247
- "documentType"
2247
+ "documentType",
2248
+ "visaType"
2248
2249
  ];
2249
2250
  var documentReviewQuery = [
2250
2251
  "title",
@@ -4319,7 +4320,7 @@ var createAIServerService = (client) => {
4319
4320
  async startDraft(input, option) {
4320
4321
  var _a;
4321
4322
  const res = await client.request(
4322
- `mutation startDraft($visaProfileId: String!, $documentType: String!, $fromUpload: Boolean) {
4323
+ `mutation startDraft($visaProfileId: String, $documentType: String!, $fromUpload: Boolean) {
4323
4324
  startDraft(visaProfileId: $visaProfileId, documentType: $documentType, fromUpload: $fromUpload) {
4324
4325
  aiServerAuth { url accessToken }
4325
4326
  }
@@ -4328,6 +4329,40 @@ var createAIServerService = (client) => {
4328
4329
  option
4329
4330
  );
4330
4331
  return (_a = res.data) == null ? void 0 : _a.startDraft;
4332
+ },
4333
+ /** The caller's SOP and LOE drafts that aren't attached to a visa profile. */
4334
+ async listMyDrafts(option) {
4335
+ var _a, _b, _c;
4336
+ const res = await client.request(
4337
+ `query listMyDrafts { listMyDrafts { drafts { id documentType visaType generatedSop createdAt } } }`,
4338
+ {},
4339
+ option
4340
+ );
4341
+ return (_c = (_b = (_a = res.data) == null ? void 0 : _a.listMyDrafts) == null ? void 0 : _b.drafts) != null ? _c : [];
4342
+ },
4343
+ /** Moves a draft onto a visa profile, replacing that profile's draft of the same kind. */
4344
+ async attachDraft(input, option) {
4345
+ var _a, _b;
4346
+ const res = await client.request(
4347
+ `mutation attachDraft($draftId: String!, $visaProfileId: String!) { attachDraft(draftId: $draftId, visaProfileId: $visaProfileId) { draft { id visaProfileId documentType } } }`,
4348
+ input,
4349
+ option
4350
+ );
4351
+ return (_b = (_a = res.data) == null ? void 0 : _a.attachDraft) == null ? void 0 : _b.draft;
4352
+ },
4353
+ /** Stores a PDF to improve when the draft has no visa profile; returns its URL. */
4354
+ async uploadDraftFile(file) {
4355
+ const formData = new FormData();
4356
+ formData.append("file", file);
4357
+ const token = await client.token();
4358
+ const res = await fetch(client["url"].replace("/graphql", "") + "/api/upload/draft", {
4359
+ method: "POST",
4360
+ headers: token ? { Authorization: `Bearer ${token}` } : {},
4361
+ body: formData
4362
+ });
4363
+ const text = await res.text();
4364
+ if (!res.ok) throw new Error(text || "File upload failed");
4365
+ return JSON.parse(text).url;
4331
4366
  }
4332
4367
  };
4333
4368
  };
@@ -4378,6 +4413,69 @@ var createPartnerLinkService = (client) => ({
4378
4413
  }
4379
4414
  });
4380
4415
 
4416
+ // src/services/help/index.ts
4417
+ var ARTICLE = "id title description content";
4418
+ var createHelpService = (client) => ({
4419
+ async listHelpArticles(option) {
4420
+ var _a, _b, _c;
4421
+ const res = await client.request(
4422
+ `query listHelpArticles { listHelpArticles { articles { ${ARTICLE} } } }`,
4423
+ {},
4424
+ option
4425
+ );
4426
+ return (_c = (_b = (_a = res.data) == null ? void 0 : _a.listHelpArticles) == null ? void 0 : _b.articles) != null ? _c : [];
4427
+ },
4428
+ async getHelpArticle(articleId, option) {
4429
+ var _a, _b;
4430
+ const res = await client.request(
4431
+ `query getHelpArticle($articleId: String!) { getHelpArticle(articleId: $articleId) { article { ${ARTICLE} } } }`,
4432
+ { articleId },
4433
+ option
4434
+ );
4435
+ return (_b = (_a = res.data) == null ? void 0 : _a.getHelpArticle) == null ? void 0 : _b.article;
4436
+ },
4437
+ async saveHelpArticle(input, option) {
4438
+ var _a, _b;
4439
+ const res = await client.request(
4440
+ `mutation saveHelpArticle($articleId: String, $title: String!, $description: String, $content: String!) {
4441
+ saveHelpArticle(articleId: $articleId, title: $title, description: $description, content: $content) { article { ${ARTICLE} } }
4442
+ }`,
4443
+ input,
4444
+ option
4445
+ );
4446
+ return (_b = (_a = res.data) == null ? void 0 : _a.saveHelpArticle) == null ? void 0 : _b.article;
4447
+ },
4448
+ async deleteHelpArticle(articleId, option) {
4449
+ var _a, _b;
4450
+ const res = await client.request(
4451
+ `mutation deleteHelpArticle($articleId: String!) { deleteHelpArticle(articleId: $articleId) { articleId } }`,
4452
+ { articleId },
4453
+ option
4454
+ );
4455
+ return (_b = (_a = res.data) == null ? void 0 : _a.deleteHelpArticle) == null ? void 0 : _b.articleId;
4456
+ },
4457
+ /** Ends every session of the signed-in user, including this one. */
4458
+ async signOutEverywhere(option) {
4459
+ var _a, _b;
4460
+ const res = await client.request(
4461
+ `mutation signOutEverywhere { signOutEverywhere { signedOut } }`,
4462
+ {},
4463
+ option
4464
+ );
4465
+ return Boolean((_b = (_a = res.data) == null ? void 0 : _a.signOutEverywhere) == null ? void 0 : _b.signedOut);
4466
+ },
4467
+ /** Clients only: closes the signed-in account after checking its password. */
4468
+ async deleteMyAccount(password, option) {
4469
+ var _a, _b;
4470
+ const res = await client.request(
4471
+ `mutation deleteMyAccount($password: String!) { deleteMyAccount(password: $password) { deleted } }`,
4472
+ { password },
4473
+ option
4474
+ );
4475
+ return Boolean((_b = (_a = res.data) == null ? void 0 : _a.deleteMyAccount) == null ? void 0 : _b.deleted);
4476
+ }
4477
+ });
4478
+
4381
4479
  exports.AuthenticationError = AuthenticationError;
4382
4480
  exports.GraphQLClient = GraphQLClient;
4383
4481
  exports.NetworkError = NetworkError;
@@ -4418,6 +4516,7 @@ exports.createCreditPlanService = createCreditPlanService;
4418
4516
  exports.createCreditTransactionService = createCreditTransactionService;
4419
4517
  exports.createCustomerObjectResponse = createCustomerObjectResponse;
4420
4518
  exports.createFlutterwaveService = createFlutterwaveService;
4519
+ exports.createHelpService = createHelpService;
4421
4520
  exports.createNotificationService = createNotificationService;
4422
4521
  exports.createPartnerLinkService = createPartnerLinkService;
4423
4522
  exports.createPaystackService = createPaystackService;