@experteam-mx/ngx-services 20.2.2 → 20.2.3-dev3.0

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.
@@ -4498,6 +4498,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
4498
4498
  class ApiSurveysService {
4499
4499
  environments = inject(ENVIRONMENT_TOKEN);
4500
4500
  http = inject(HttpClient);
4501
+ appKey = this.environments.apiExternalOperationsKey ?? ''; // TODO: review
4501
4502
  /**
4502
4503
  * Base URL for surveys API endpoints.
4503
4504
  * @returns The configured surveys API URL or an empty string.
@@ -4505,6 +4506,9 @@ class ApiSurveysService {
4505
4506
  get url() {
4506
4507
  return this.environments.apiSurveysUrl ?? '';
4507
4508
  }
4509
+ appKeyHeader() {
4510
+ return { ...(this.appKey && { AppKey: this.appKey }) };
4511
+ }
4508
4512
  /**
4509
4513
  * Retrieves surveys list based on query parameters.
4510
4514
  * @param params Query parameters used to filter, paginate, or sort surveys.
@@ -4592,6 +4596,38 @@ class ApiSurveysService {
4592
4596
  return this.http.get(`${this.url}/question-types`, { params })
4593
4597
  .pipe(map(({ data }) => data));
4594
4598
  }
4599
+ /**
4600
+ * Retrieves a customer survey by UUID.
4601
+ * @param uuid Customer survey identifier.
4602
+ * @returns Observable stream with customer survey data.
4603
+ */
4604
+ getCustomerSurvey(uuid) {
4605
+ return this.http.get(`${this.url}/customer-surveys/${uuid}`, {
4606
+ headers: this.appKeyHeader(),
4607
+ }).pipe(map(({ data }) => data));
4608
+ }
4609
+ /**
4610
+ * Updates an existing customer survey by UUID.
4611
+ * @param uuid Customer survey identifier.
4612
+ * @param body Customer survey payload used to update the resource.
4613
+ * @returns Observable stream with updated customer survey data.
4614
+ */
4615
+ putCustomerSurvey(uuid, body) {
4616
+ return this.http.put(`${this.url}/customer-surveys/${uuid}`, body, {
4617
+ headers: this.appKeyHeader(),
4618
+ }).pipe(map(({ data }) => data));
4619
+ }
4620
+ /**
4621
+ * Marks a customer survey as finished by UUID.
4622
+ * @param uuid Customer survey identifier.
4623
+ * @param body Customer survey finish payload.
4624
+ * @returns Observable stream with updated customer survey data.
4625
+ */
4626
+ postCustomerSurveyFinish(uuid, body) {
4627
+ return this.http.post(`${this.url}/customer-surveys/${uuid}/finish`, body, {
4628
+ headers: this.appKeyHeader(),
4629
+ }).pipe(map(({ data }) => data));
4630
+ }
4595
4631
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ApiSurveysService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4596
4632
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ApiSurveysService, providedIn: 'root' });
4597
4633
  }