@posiwise/user-module 0.0.171 → 0.0.173

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.
@@ -51,17 +51,17 @@ import { HelperService } from "@posiwise/helper-service";
51
51
  import * as i12$1 from "@posiwise/utils";
52
52
  import { ValidateForm, appendQueryParam, clearQueryParams } from "@posiwise/utils";
53
53
  import { StatusCodes } from "http-status-codes";
54
- import { forkJoin, from, interval, map } from "rxjs";
54
+ import { firstValueFrom, forkJoin, from, interval, map } from "rxjs";
55
55
  import { getDomain } from "tldts";
56
56
  import * as i3 from "@posiwise/common-services";
57
- import { FormHelperService, PermissionService, ValidationService } from "@posiwise/common-services";
57
+ import { FormHelperService, PermissionService, ValidationService, hasKnowledgeAlpha } from "@posiwise/common-services";
58
58
  import * as i13 from "@jsverse/transloco";
59
59
  import cloneDeep from "lodash/cloneDeep";
60
60
  import sortBy from "lodash/sortBy";
61
61
  import { distinct, mergeMap } from "rxjs/operators";
62
+ import { HttpErrorResponse, HttpParams } from "@angular/common/http";
62
63
  import { GetUser, getUser } from "@posiwise/app-store";
63
64
  import * as i4$3 from "@ngrx/store";
64
- import { HttpParams } from "@angular/common/http";
65
65
  import * as i2$1 from "@posiwise/admin-module-utils";
66
66
  import { AppAdmin } from "@posiwise/admin-module-utils";
67
67
  import * as i5$1 from "@angular/cdk/clipboard";
@@ -1736,6 +1736,71 @@ i0.ɵɵngDeclareClassMetadata({
1736
1736
  }]
1737
1737
  }
1738
1738
  });
1739
+ const PRODUCTION_ENVIRONMENTS = [
1740
+ "prod",
1741
+ "production",
1742
+ "live"
1743
+ ];
1744
+ const READY_TIMEOUT_MS = 2e4;
1745
+ var AirwallexElementHelper = class AirwallexElementHelper {
1746
+ constructor() {
1747
+ this.element = null;
1748
+ }
1749
+ async mount(host, setup) {
1750
+ this.teardown();
1751
+ const sdk = await import("@airwallex/components-sdk");
1752
+ await sdk.init({
1753
+ env: AirwallexElementHelper.sdkEnv(setup.environment),
1754
+ enabledElements: ["payments"]
1755
+ });
1756
+ const element = await sdk.createElement("dropIn", this.options(setup));
1757
+ const ready = AirwallexElementHelper.whenReady(host);
1758
+ element.mount(host);
1759
+ this.element = element;
1760
+ await ready;
1761
+ }
1762
+ static whenReady(host) {
1763
+ return new Promise((resolve, reject) => {
1764
+ const finish = (done) => () => {
1765
+ clearTimeout(timer);
1766
+ host.removeEventListener("onReady", onReady);
1767
+ host.removeEventListener("onError", onError);
1768
+ done();
1769
+ };
1770
+ const onReady = finish(resolve);
1771
+ const onError = finish(() => reject(/* @__PURE__ */ new Error("airwallex_form_failed")));
1772
+ const timer = setTimeout(finish(() => reject(/* @__PURE__ */ new Error("airwallex_ready_timeout"))), READY_TIMEOUT_MS);
1773
+ host.addEventListener("onReady", onReady);
1774
+ host.addEventListener("onError", onError);
1775
+ });
1776
+ }
1777
+ async confirm() {
1778
+ if (!this.element) throw new Error("airwallex_element_not_mounted");
1779
+ const intent = await this.element.confirm();
1780
+ if (!intent?.id) throw new Error("airwallex_confirm_failed");
1781
+ return intent.id;
1782
+ }
1783
+ teardown() {
1784
+ this.element?.destroy();
1785
+ this.element = null;
1786
+ }
1787
+ static sdkEnv(environment) {
1788
+ return PRODUCTION_ENVIRONMENTS.includes((environment || "").trim().toLowerCase()) ? "prod" : "demo";
1789
+ }
1790
+ options(setup) {
1791
+ return {
1792
+ intent_id: setup.intent_id,
1793
+ client_secret: setup.client_secret,
1794
+ currency: setup.currency,
1795
+ methods: ["card"],
1796
+ showConfirmButton: false,
1797
+ payment_consent: {
1798
+ next_triggered_by: "merchant",
1799
+ merchant_trigger_reason: "unscheduled"
1800
+ }
1801
+ };
1802
+ }
1803
+ };
1739
1804
  const DROPIN_CDN_URL = "https://js.braintreegateway.com/web/dropin/1.43.0/js/dropin.min.js";
1740
1805
  var BraintreeDropinHelper = class {
1741
1806
  constructor() {
@@ -1779,6 +1844,228 @@ var BraintreeDropinHelper = class {
1779
1844
  });
1780
1845
  }
1781
1846
  };
1847
+ var SecondaryPaymentMethodComponent = class SecondaryPaymentMethodComponent {
1848
+ constructor(subscriptionService, userService, toast, transloco, cdr) {
1849
+ this.subscriptionService = subscriptionService;
1850
+ this.userService = userService;
1851
+ this.toast = toast;
1852
+ this.transloco = transloco;
1853
+ this.cdr = cdr;
1854
+ this.card = null;
1855
+ this.provider = "airwallex";
1856
+ this.loading = true;
1857
+ this.saved = new EventEmitter();
1858
+ this.showForm = false;
1859
+ this.mounting = false;
1860
+ this.busy = false;
1861
+ this.braintree = new BraintreeDropinHelper();
1862
+ this.airwallex = new AirwallexElementHelper();
1863
+ }
1864
+ ngOnDestroy() {
1865
+ this.teardown();
1866
+ }
1867
+ async startFlow() {
1868
+ this.showForm = true;
1869
+ this.mounting = true;
1870
+ this.cdr.detectChanges();
1871
+ try {
1872
+ await this.mountForm(this.formHost.nativeElement);
1873
+ } catch (error) {
1874
+ if (!(error instanceof HttpErrorResponse)) this.fail("User.Payments.Secondary.Errors.FormFailed");
1875
+ this.showForm = false;
1876
+ } finally {
1877
+ this.mounting = false;
1878
+ this.cdr.markForCheck();
1879
+ }
1880
+ }
1881
+ async submit() {
1882
+ this.busy = true;
1883
+ this.cdr.markForCheck();
1884
+ try {
1885
+ const response = await firstValueFrom(this.register(await this.collectCard()));
1886
+ if (response?.data) this.onSaved(response.message);
1887
+ } catch (error) {
1888
+ if (!(error instanceof HttpErrorResponse)) this.fail("User.Payments.Secondary.Errors.CardNotConfirmed");
1889
+ } finally {
1890
+ this.busy = false;
1891
+ this.cdr.markForCheck();
1892
+ }
1893
+ }
1894
+ cancel() {
1895
+ this.teardown();
1896
+ this.showForm = false;
1897
+ this.cdr.markForCheck();
1898
+ }
1899
+ onSaved(message) {
1900
+ if (this.provider === "braintree") this.toast.success(message);
1901
+ this.userService.getUserInfo().subscribe();
1902
+ this.teardown();
1903
+ this.showForm = false;
1904
+ this.saved.emit();
1905
+ }
1906
+ async mountForm(host) {
1907
+ if (this.provider === "braintree") {
1908
+ const response = await firstValueFrom(this.subscriptionService.getBraintreeClientToken(this.subscriptionId));
1909
+ await this.braintree.mount(host, response?.data?.client_token);
1910
+ return;
1911
+ }
1912
+ const response = await firstValueFrom(this.subscriptionService.getAirwallexIntent(this.subscriptionId));
1913
+ await this.airwallex.mount(host, response?.data);
1914
+ }
1915
+ collectCard() {
1916
+ return this.provider === "braintree" ? this.braintree.requestNonce() : this.airwallex.confirm();
1917
+ }
1918
+ register(reference) {
1919
+ return this.provider === "braintree" ? this.subscriptionService.registerBraintreePaymentMethod(this.subscriptionId, reference) : this.subscriptionService.registerAirwallexPaymentMethod(this.subscriptionId, reference);
1920
+ }
1921
+ teardown() {
1922
+ this.braintree.teardown();
1923
+ this.airwallex.teardown();
1924
+ }
1925
+ fail(key) {
1926
+ this.toast.error(this.transloco.translate(key));
1927
+ }
1928
+ static {
1929
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1930
+ minVersion: "12.0.0",
1931
+ version: "22.2.0",
1932
+ ngImport: i0,
1933
+ type: SecondaryPaymentMethodComponent,
1934
+ deps: [
1935
+ { token: i3.SubscriptionService },
1936
+ { token: i3.UserService },
1937
+ { token: i3.CustomToastService },
1938
+ { token: i13.TranslocoService },
1939
+ { token: i0.ChangeDetectorRef }
1940
+ ],
1941
+ target: i0.ɵɵFactoryTarget.Component
1942
+ });
1943
+ }
1944
+ static {
1945
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1946
+ minVersion: "17.0.0",
1947
+ version: "22.2.0",
1948
+ type: SecondaryPaymentMethodComponent,
1949
+ isStandalone: false,
1950
+ selector: "pw-secondary-payment-method",
1951
+ inputs: {
1952
+ subscriptionId: "subscriptionId",
1953
+ card: "card",
1954
+ provider: "provider",
1955
+ loading: "loading"
1956
+ },
1957
+ outputs: { saved: "saved" },
1958
+ viewQueries: [{
1959
+ propertyName: "formHost",
1960
+ first: true,
1961
+ predicate: ["formHost"],
1962
+ descendants: true
1963
+ }],
1964
+ ngImport: i0,
1965
+ template: "<h5 class=\"section-title\">{{ 'User.Payments.Secondary.Title' | transloco }}</h5>\n<p class=\"alert alert-info\" [pTooltip]=\"'User.Payments.Secondary.Tooltip' | transloco\" tooltipPosition=\"top\" appendTo=\"body\">\n {{ 'User.Payments.Secondary.Callout' | transloco }}\n</p>\n\n@if (loading || mounting) {\n <div class=\"text-center\">\n <p-progress-spinner strokeWidth=\"2\"> </p-progress-spinner>\n </div>\n}\n\n@if (card && !showForm) {\n <pw-saved-card-details [data]=\"card\"\n (changeEvent)=\"startFlow()\">\n </pw-saved-card-details>\n}\n\n@if (!card && !showForm && !loading) {\n <button type=\"button\"\n class=\"btn btn-primary\"\n (click)=\"startFlow()\">\n {{ 'User.Payments.Secondary.AddCta' | transloco }}\n </button>\n}\n\n@if (showForm) {\n <div #formHost class=\"secondary-card-form\" [class.mt-3]=\"!mounting\" [class.secondary-card-form--mounting]=\"mounting\"\n [attr.data-provider]=\"provider\"></div>\n @if (!mounting) {\n <div class=\"col-12 mt-4 text-end\">\n <button type=\"button\"\n (click)=\"cancel()\"\n class=\"btn btn-outline-default me-2\">\n {{ 'User.Payments.Cancel' | transloco }}\n </button>\n <button type=\"button\"\n class=\"btn btn-primary\"\n [buttonBusy]=\"busy\"\n (click)=\"submit()\">\n {{ 'User.Payments.Submit' | transloco }}\n </button>\n </div>\n }\n}\n",
1966
+ styles: [".secondary-card-form--mounting{height:0;overflow:hidden}\n"],
1967
+ dependencies: [
1968
+ {
1969
+ kind: "directive",
1970
+ type: i6$3.ButtonBusyDirective,
1971
+ selector: "[buttonBusy]",
1972
+ inputs: ["buttonBusy", "busyText"]
1973
+ },
1974
+ {
1975
+ kind: "directive",
1976
+ type: i9.Tooltip,
1977
+ selector: "[pTooltip]",
1978
+ inputs: [
1979
+ "tooltipPosition",
1980
+ "tooltipEvent",
1981
+ "positionStyle",
1982
+ "tooltipStyleClass",
1983
+ "tooltipZIndex",
1984
+ "escape",
1985
+ "showDelay",
1986
+ "hideDelay",
1987
+ "life",
1988
+ "positionTop",
1989
+ "positionLeft",
1990
+ "autoHide",
1991
+ "fitContent",
1992
+ "hideOnEscape",
1993
+ "showOnEllipsis",
1994
+ "pTooltip",
1995
+ "tooltipDisabled",
1996
+ "tooltipOptions",
1997
+ "appendTo",
1998
+ "pTooltipPT",
1999
+ "pTooltipUnstyled"
2000
+ ]
2001
+ },
2002
+ {
2003
+ kind: "component",
2004
+ type: i11.ProgressSpinner,
2005
+ selector: "p-progress-spinner, p-progressspinner",
2006
+ inputs: [
2007
+ "value",
2008
+ "strokeWidth",
2009
+ "animationDuration",
2010
+ "min",
2011
+ "max",
2012
+ "ariaLabel",
2013
+ "fill"
2014
+ ]
2015
+ },
2016
+ {
2017
+ kind: "component",
2018
+ type: SavedCardDetailsComponent,
2019
+ selector: "pw-saved-card-details",
2020
+ inputs: [
2021
+ "data",
2022
+ "isChangePayment",
2023
+ "showNewCard"
2024
+ ],
2025
+ outputs: ["changeEvent"]
2026
+ },
2027
+ {
2028
+ kind: "pipe",
2029
+ type: i13.TranslocoPipe,
2030
+ name: "transloco"
2031
+ }
2032
+ ]
2033
+ });
2034
+ }
2035
+ };
2036
+ i0.ɵɵngDeclareClassMetadata({
2037
+ minVersion: "12.0.0",
2038
+ version: "22.2.0",
2039
+ ngImport: i0,
2040
+ type: SecondaryPaymentMethodComponent,
2041
+ decorators: [{
2042
+ type: Component,
2043
+ args: [{
2044
+ selector: "pw-secondary-payment-method",
2045
+ standalone: false,
2046
+ template: "<h5 class=\"section-title\">{{ 'User.Payments.Secondary.Title' | transloco }}</h5>\n<p class=\"alert alert-info\" [pTooltip]=\"'User.Payments.Secondary.Tooltip' | transloco\" tooltipPosition=\"top\" appendTo=\"body\">\n {{ 'User.Payments.Secondary.Callout' | transloco }}\n</p>\n\n@if (loading || mounting) {\n <div class=\"text-center\">\n <p-progress-spinner strokeWidth=\"2\"> </p-progress-spinner>\n </div>\n}\n\n@if (card && !showForm) {\n <pw-saved-card-details [data]=\"card\"\n (changeEvent)=\"startFlow()\">\n </pw-saved-card-details>\n}\n\n@if (!card && !showForm && !loading) {\n <button type=\"button\"\n class=\"btn btn-primary\"\n (click)=\"startFlow()\">\n {{ 'User.Payments.Secondary.AddCta' | transloco }}\n </button>\n}\n\n@if (showForm) {\n <div #formHost class=\"secondary-card-form\" [class.mt-3]=\"!mounting\" [class.secondary-card-form--mounting]=\"mounting\"\n [attr.data-provider]=\"provider\"></div>\n @if (!mounting) {\n <div class=\"col-12 mt-4 text-end\">\n <button type=\"button\"\n (click)=\"cancel()\"\n class=\"btn btn-outline-default me-2\">\n {{ 'User.Payments.Cancel' | transloco }}\n </button>\n <button type=\"button\"\n class=\"btn btn-primary\"\n [buttonBusy]=\"busy\"\n (click)=\"submit()\">\n {{ 'User.Payments.Submit' | transloco }}\n </button>\n </div>\n }\n}\n",
2047
+ styles: [".secondary-card-form--mounting{height:0;overflow:hidden}\n"]
2048
+ }]
2049
+ }],
2050
+ ctorParameters: () => [
2051
+ { type: i3.SubscriptionService },
2052
+ { type: i3.UserService },
2053
+ { type: i3.CustomToastService },
2054
+ { type: i13.TranslocoService },
2055
+ { type: i0.ChangeDetectorRef }
2056
+ ],
2057
+ propDecorators: {
2058
+ subscriptionId: [{ type: Input }],
2059
+ card: [{ type: Input }],
2060
+ provider: [{ type: Input }],
2061
+ loading: [{ type: Input }],
2062
+ saved: [{ type: Output }],
2063
+ formHost: [{
2064
+ type: ViewChild,
2065
+ args: ["formHost"]
2066
+ }]
2067
+ }
2068
+ });
1782
2069
  var UpdatePaymentDetailsComponent = class UpdatePaymentDetailsComponent extends AppBaseComponent {
1783
2070
  constructor(fb, scriptLoader, productService, subscriptionService, injector, cdr) {
1784
2071
  super(injector);
@@ -1791,10 +2078,8 @@ var UpdatePaymentDetailsComponent = class UpdatePaymentDetailsComponent extends
1791
2078
  this.months = [];
1792
2079
  this.cardDetails = null;
1793
2080
  this.secondaryCard = null;
1794
- this.showBraintreeForm = false;
1795
- this.braintreeBusy = false;
2081
+ this.secondaryProvider = "airwallex";
1796
2082
  this.loading = true;
1797
- this.braintreeHelper = new BraintreeDropinHelper();
1798
2083
  this.route.params.subscribe((response) => {
1799
2084
  this.subscriptionId = Number(response["subscriptionId"]);
1800
2085
  this.productId = Number(response["productId"]);
@@ -1813,10 +2098,6 @@ var UpdatePaymentDetailsComponent = class UpdatePaymentDetailsComponent extends
1813
2098
  this.years = HelperService.getYears();
1814
2099
  this.months = HelperService.getMonths();
1815
2100
  }
1816
- ngOnDestroy() {
1817
- super.ngOnDestroy();
1818
- this.braintreeHelper.teardown();
1819
- }
1820
2101
  refreshPaymentMethods() {
1821
2102
  forkJoin({
1822
2103
  paymentMethods: this.subscriptionService.getPaymentMethods(this.subscriptionId),
@@ -1827,6 +2108,7 @@ var UpdatePaymentDetailsComponent = class UpdatePaymentDetailsComponent extends
1827
2108
  const data = response.paymentMethods.data || {};
1828
2109
  this.cardDetails = data.primary || null;
1829
2110
  this.secondaryCard = data.secondary || null;
2111
+ this.secondaryProvider = data.secondary_provider || "braintree";
1830
2112
  }
1831
2113
  this.cdr.markForCheck();
1832
2114
  }).add(() => {
@@ -1871,45 +2153,6 @@ var UpdatePaymentDetailsComponent = class UpdatePaymentDetailsComponent extends
1871
2153
  onChange(value) {
1872
2154
  this.isChangePayment = value;
1873
2155
  }
1874
- async startBraintreeFlow() {
1875
- this.showBraintreeForm = true;
1876
- this.cdr.markForCheck();
1877
- try {
1878
- const clientToken = (await this.subscriptionService.getBraintreeClientToken(this.subscriptionId).toPromise())?.data?.client_token;
1879
- await this.braintreeHelper.mount(this.braintreeContainer.nativeElement, clientToken);
1880
- } catch {
1881
- this.toast.error("PAYMENTS.BRAINTREE.SCRIPT_FAILED");
1882
- this.showBraintreeForm = false;
1883
- } finally {
1884
- this.cdr.markForCheck();
1885
- }
1886
- }
1887
- async submitBraintree() {
1888
- this.braintreeBusy = true;
1889
- try {
1890
- const nonce = await this.braintreeHelper.requestNonce();
1891
- this.subscriptionService.registerBraintreePaymentMethod(this.subscriptionId, nonce).subscribe({ next: (response) => {
1892
- if (response?.status === StatusCodes.CREATED) {
1893
- this.toast.success(response.message);
1894
- this.userService.getUserInfo().subscribe();
1895
- this.showBraintreeForm = false;
1896
- this.refreshPaymentMethods();
1897
- } else if (response?.error) this.toast.error(response.error.errors?.[0]?.message);
1898
- this.cdr.markForCheck();
1899
- } }).add(() => {
1900
- this.braintreeBusy = false;
1901
- this.cdr.markForCheck();
1902
- });
1903
- } catch {
1904
- this.braintreeBusy = false;
1905
- this.toast.error("PAYMENTS.BRAINTREE.NONCE_FAILED");
1906
- }
1907
- }
1908
- cancelBraintreeFlow() {
1909
- this.braintreeHelper.teardown();
1910
- this.showBraintreeForm = false;
1911
- this.cdr.markForCheck();
1912
- }
1913
2156
  static {
1914
2157
  this.ɵfac = i0.ɵɵngDeclareFactory({
1915
2158
  minVersion: "12.0.0",
@@ -1934,15 +2177,9 @@ var UpdatePaymentDetailsComponent = class UpdatePaymentDetailsComponent extends
1934
2177
  type: UpdatePaymentDetailsComponent,
1935
2178
  isStandalone: false,
1936
2179
  selector: "pw-update-payment-details",
1937
- viewQueries: [{
1938
- propertyName: "braintreeContainer",
1939
- first: true,
1940
- predicate: ["braintreeContainer"],
1941
- descendants: true
1942
- }],
1943
2180
  usesInheritance: true,
1944
2181
  ngImport: i0,
1945
- template: "<div class=\"container-fluid\">\n <div class=\"card-block\">\n <div class=\"row\">\n <div class=\"col-lg-12 ps-0\">\n <a aria-label=\"Navigate to Target\"\n (click)=\"back()\"\n class=\"previous float-start\"><i class=\"fa fa-arrow-alt-circle-left\" aria-hidden=\"true\"></i></a>\n <h4 class=\"form-section my-3\">\n <i class=\"ft-edit\" aria-hidden=\"true\"></i>\n {{ 'User.Payments.UpdateTitle' | transloco }}\n </h4>\n </div>\n </div>\n\n <div class=\"row g-3 mt-1\">\n <!-- Primary payment method (Stripe) -->\n <div class=\"col-12 col-lg-6\">\n <div class=\"card payment-left p-3 h-100\">\n <div class=\"card-body\">\n <h5 class=\"section-title\">{{ 'User.Payments.Primary.Title' | transloco }}</h5>\n <p class=\"text-muted\">{{ 'User.Payments.Primary.Description' | transloco }}</p>\n\n @if (errorMsg) {\n <div class=\"alert alert-danger\">{{ errorMsg }}</div>\n }\n @if (!isChangePayment && cardDetails) {\n <pw-saved-card-details [data]=\"cardDetails\"\n (changeEvent)=\"onChange($event)\">\n </pw-saved-card-details>\n }\n\n @if (loading) {\n <div class=\"text-center\">\n <p-progress-spinner strokeWidth=\"2\"> </p-progress-spinner>\n </div>\n }\n\n @if ((!cardDetails && !loading) || isChangePayment) {\n <form [formGroup]=\"form\" (ngSubmit)=\"onSave()\">\n <h4 class=\"title\">{{ 'User.Payments.Primary.NewCard' | transloco }}</h4>\n <div class=\"row\">\n <div class=\"col-md-9\">\n <div class=\"mb-3\">\n <label for=\"update-payment-card_number\">{{ 'User.Payments.CardNumber' | transloco }}</label>\n <input type=\"text\"\n id=\"update-payment-card_number\"\n class=\"form-control\"\n formControlName=\"card_number\"\n [placeholder]=\"'User.Payments.CardNumber' | transloco\"\n name=\"card_number\"\n aria-label=\"Card Number\" />\n @if (form.get('card_number').touched && form.get('card_number').errors?.required) {\n <div class=\"danger\"><span>{{ 'User.Payments.Errors.CardNumberRequired' | transloco }}</span></div>\n }\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"mb-3\">\n <label for=\"update-payment-cvc\">{{ 'User.Payments.Cvc' | transloco }}</label>\n <input type=\"text\"\n id=\"update-payment-cvc\"\n class=\"form-control\"\n formControlName=\"cvc\"\n [placeholder]=\"'User.Payments.Cvc' | transloco\"\n name=\"cvc\"\n aria-label=\"Cvc\" />\n @if (form.get('cvc').touched && form.get('cvc').errors?.required) {\n <div class=\"danger\"><span>{{ 'User.Payments.Errors.CvcRequired' | transloco }}</span></div>\n }\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-6\">\n <div class=\"mb-3\">\n <span class=\"sr-only\" id=\"update-payment-exp_month-label\" class=\"pw-label-style\">{{ 'User.Payments.ExpMonth' | transloco }}</span>\n <p-select\n [attr.aria-labelledby]=\"'update-payment-exp_month-label'\"\n [options]=\"months\"\n [appendTo]=\"'body'\"\n formControlName=\"exp_month\"\n [placeholder]=\"'User.Payments.ExpMonth' | transloco\"\n optionValue=\"value\"\n optionLabel=\"value\">\n </p-select>\n @if (form.get('exp_month').touched && form.get('exp_month').errors?.required) {\n <div class=\"danger\"><span>{{ 'User.Payments.Errors.ExpMonthRequired' | transloco }}</span></div>\n }\n </div>\n </div>\n <div class=\"col-md-6\">\n <div class=\"mb-3\">\n <span class=\"sr-only\" id=\"update-payment-exp_year-label\">{{ 'User.Payments.ExpYear' | transloco }}</span>\n <p-select\n [attr.aria-labelledby]=\"'update-payment-exp_year-label'\"\n [options]=\"years\"\n formControlName=\"exp_year\"\n [placeholder]=\"'User.Payments.ExpYear' | transloco\"\n optionValue=\"value\"\n [appendTo]=\"'body'\"\n optionLabel=\"value\">\n </p-select>\n @if (form.get('exp_year')?.touched && form.get('exp_year')?.errors?.['required']) {\n <div class=\"danger\"><span>{{ 'User.Payments.Errors.ExpYearRequired' | transloco }}</span></div>\n }\n </div>\n </div>\n <div class=\"col-12 text-center mt-4\">\n <img src=\"/assets/img/icons/powered_by_stripe_v2.png\"\n class=\"payment-provider\"\n alt=\"\" />\n </div>\n <div class=\"col-12 mt-4 text-end\">\n <button type=\"button\"\n (click)=\"cancel()\"\n class=\"btn btn-outline-default me-2\">\n {{ 'User.Payments.Cancel' | transloco }}\n </button>\n <button type=\"submit\"\n class=\"btn btn-primary\"\n [buttonBusy]=\"busy\">\n {{ 'User.Payments.Submit' | transloco }}\n </button>\n </div>\n </div>\n </form>\n }\n </div>\n </div>\n </div>\n\n <!-- Secondary payment method (Braintree) -->\n <div class=\"col-12 col-lg-6\">\n <div class=\"card payment-right p-3 h-100\">\n <div class=\"card-body\">\n <h5 class=\"section-title\">{{ 'User.Payments.Secondary.Title' | transloco }}</h5>\n <p class=\"alert alert-info\" [pTooltip]=\"'User.Payments.Secondary.Tooltip' | transloco\" tooltipPosition=\"top\" appendTo=\"body\">\n {{ 'User.Payments.Secondary.Callout' | transloco }}\n </p>\n\n @if (loading) {\n <div class=\"text-center\">\n <p-progress-spinner strokeWidth=\"2\"> </p-progress-spinner>\n </div>\n }\n\n @if (secondaryCard && !showBraintreeForm) {\n <pw-saved-card-details [data]=\"secondaryCard\"\n (changeEvent)=\"startBraintreeFlow()\">\n </pw-saved-card-details>\n }\n\n @if (!secondaryCard && !showBraintreeForm && !loading) {\n <button type=\"button\"\n class=\"btn btn-primary\"\n (click)=\"startBraintreeFlow()\">\n {{ 'User.Payments.Secondary.AddCta' | transloco }}\n </button>\n }\n\n @if (showBraintreeForm) {\n <div #braintreeContainer class=\"braintree-dropin-container mt-3\"></div>\n <div class=\"col-12 mt-4 text-end\">\n <button type=\"button\"\n (click)=\"cancelBraintreeFlow()\"\n class=\"btn btn-outline-default me-2\">\n {{ 'User.Payments.Cancel' | transloco }}\n </button>\n <button type=\"button\"\n class=\"btn btn-primary\"\n [buttonBusy]=\"braintreeBusy\"\n (click)=\"submitBraintree()\">\n {{ 'User.Payments.Submit' | transloco }}\n </button>\n </div>\n }\n </div>\n </div>\n </div>\n </div>\n\n </div>\n</div>\n",
2182
+ template: "<div class=\"container-fluid\">\n <div class=\"card-block\">\n <div class=\"row\">\n <div class=\"col-lg-12 ps-0\">\n <a aria-label=\"Navigate to Target\"\n (click)=\"back()\"\n class=\"previous float-start\"><i class=\"fa fa-arrow-alt-circle-left\" aria-hidden=\"true\"></i></a>\n <h4 class=\"form-section my-3\">\n <i class=\"ft-edit\" aria-hidden=\"true\"></i>\n {{ 'User.Payments.UpdateTitle' | transloco }}\n </h4>\n </div>\n </div>\n\n <div class=\"row g-3 mt-1\">\n <!-- Primary payment method (Stripe) -->\n <div class=\"col-12 col-lg-6\">\n <div class=\"card payment-left p-3 h-100\">\n <div class=\"card-body\">\n <h5 class=\"section-title\">{{ 'User.Payments.Primary.Title' | transloco }}</h5>\n <p class=\"text-muted\">{{ 'User.Payments.Primary.Description' | transloco }}</p>\n\n @if (errorMsg) {\n <div class=\"alert alert-danger\">{{ errorMsg }}</div>\n }\n @if (!isChangePayment && cardDetails) {\n <pw-saved-card-details [data]=\"cardDetails\"\n (changeEvent)=\"onChange($event)\">\n </pw-saved-card-details>\n }\n\n @if (loading) {\n <div class=\"text-center\">\n <p-progress-spinner strokeWidth=\"2\"> </p-progress-spinner>\n </div>\n }\n\n @if ((!cardDetails && !loading) || isChangePayment) {\n <form [formGroup]=\"form\" (ngSubmit)=\"onSave()\">\n <h4 class=\"title\">{{ 'User.Payments.Primary.NewCard' | transloco }}</h4>\n <div class=\"row\">\n <div class=\"col-md-9\">\n <div class=\"mb-3\">\n <label for=\"update-payment-card_number\">{{ 'User.Payments.CardNumber' | transloco }}</label>\n <input type=\"text\"\n id=\"update-payment-card_number\"\n class=\"form-control\"\n formControlName=\"card_number\"\n [placeholder]=\"'User.Payments.CardNumber' | transloco\"\n name=\"card_number\"\n aria-label=\"Card Number\" />\n @if (form.get('card_number').touched && form.get('card_number').errors?.required) {\n <div class=\"danger\"><span>{{ 'User.Payments.Errors.CardNumberRequired' | transloco }}</span></div>\n }\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"mb-3\">\n <label for=\"update-payment-cvc\">{{ 'User.Payments.Cvc' | transloco }}</label>\n <input type=\"text\"\n id=\"update-payment-cvc\"\n class=\"form-control\"\n formControlName=\"cvc\"\n [placeholder]=\"'User.Payments.Cvc' | transloco\"\n name=\"cvc\"\n aria-label=\"Cvc\" />\n @if (form.get('cvc').touched && form.get('cvc').errors?.required) {\n <div class=\"danger\"><span>{{ 'User.Payments.Errors.CvcRequired' | transloco }}</span></div>\n }\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-6\">\n <div class=\"mb-3\">\n <span class=\"sr-only\" id=\"update-payment-exp_month-label\" class=\"pw-label-style\">{{ 'User.Payments.ExpMonth' | transloco }}</span>\n <p-select\n [attr.aria-labelledby]=\"'update-payment-exp_month-label'\"\n [options]=\"months\"\n [appendTo]=\"'body'\"\n formControlName=\"exp_month\"\n [placeholder]=\"'User.Payments.ExpMonth' | transloco\"\n optionValue=\"value\"\n optionLabel=\"value\">\n </p-select>\n @if (form.get('exp_month').touched && form.get('exp_month').errors?.required) {\n <div class=\"danger\"><span>{{ 'User.Payments.Errors.ExpMonthRequired' | transloco }}</span></div>\n }\n </div>\n </div>\n <div class=\"col-md-6\">\n <div class=\"mb-3\">\n <span class=\"sr-only\" id=\"update-payment-exp_year-label\">{{ 'User.Payments.ExpYear' | transloco }}</span>\n <p-select\n [attr.aria-labelledby]=\"'update-payment-exp_year-label'\"\n [options]=\"years\"\n formControlName=\"exp_year\"\n [placeholder]=\"'User.Payments.ExpYear' | transloco\"\n optionValue=\"value\"\n [appendTo]=\"'body'\"\n optionLabel=\"value\">\n </p-select>\n @if (form.get('exp_year')?.touched && form.get('exp_year')?.errors?.['required']) {\n <div class=\"danger\"><span>{{ 'User.Payments.Errors.ExpYearRequired' | transloco }}</span></div>\n }\n </div>\n </div>\n <div class=\"col-12 text-center mt-4\">\n <img src=\"/assets/img/icons/powered_by_stripe_v2.png\"\n class=\"payment-provider\"\n alt=\"\" />\n </div>\n <div class=\"col-12 mt-4 text-end\">\n <button type=\"button\"\n (click)=\"cancel()\"\n class=\"btn btn-outline-default me-2\">\n {{ 'User.Payments.Cancel' | transloco }}\n </button>\n <button type=\"submit\"\n class=\"btn btn-primary\"\n [buttonBusy]=\"busy\">\n {{ 'User.Payments.Submit' | transloco }}\n </button>\n </div>\n </div>\n </form>\n }\n </div>\n </div>\n </div>\n\n <!-- Secondary payment method (Braintree or Airwallex, main-api #974) -->\n <div class=\"col-12 col-lg-6\">\n <div class=\"card payment-right p-3 h-100\">\n <div class=\"card-body\">\n <pw-secondary-payment-method\n [subscriptionId]=\"subscriptionId\"\n [card]=\"secondaryCard\"\n [provider]=\"secondaryProvider\"\n [loading]=\"loading\"\n (saved)=\"refreshPaymentMethods()\">\n </pw-secondary-payment-method>\n </div>\n </div>\n </div>\n </div>\n\n </div>\n</div>\n",
1946
2183
  styles: [".card-block .payment-left,.card-block .payment-right{border:1px solid rgb(204,204,204)}.card-block .payment-left h4,.card-block .payment-right h4{border-bottom:1px solid rgb(0,0,0);font-size:1rem;font-weight:600;margin:0 0 20px;padding:0 0 5px;text-transform:uppercase}.payment-provider{width:30%}@media(max-width:800px){.payment-provider{width:60%}}\n"],
1947
2184
  dependencies: [
1948
2185
  {
@@ -1995,34 +2232,6 @@ var UpdatePaymentDetailsComponent = class UpdatePaymentDetailsComponent extends
1995
2232
  ],
1996
2233
  outputs: ["ngModelChange"]
1997
2234
  },
1998
- {
1999
- kind: "directive",
2000
- type: i9.Tooltip,
2001
- selector: "[pTooltip]",
2002
- inputs: [
2003
- "tooltipPosition",
2004
- "tooltipEvent",
2005
- "positionStyle",
2006
- "tooltipStyleClass",
2007
- "tooltipZIndex",
2008
- "escape",
2009
- "showDelay",
2010
- "hideDelay",
2011
- "life",
2012
- "positionTop",
2013
- "positionLeft",
2014
- "autoHide",
2015
- "fitContent",
2016
- "hideOnEscape",
2017
- "showOnEllipsis",
2018
- "pTooltip",
2019
- "tooltipDisabled",
2020
- "tooltipOptions",
2021
- "appendTo",
2022
- "pTooltipPT",
2023
- "pTooltipUnstyled"
2024
- ]
2025
- },
2026
2235
  {
2027
2236
  kind: "component",
2028
2237
  type: i10.Select,
@@ -2118,6 +2327,18 @@ var UpdatePaymentDetailsComponent = class UpdatePaymentDetailsComponent extends
2118
2327
  ],
2119
2328
  outputs: ["changeEvent"]
2120
2329
  },
2330
+ {
2331
+ kind: "component",
2332
+ type: SecondaryPaymentMethodComponent,
2333
+ selector: "pw-secondary-payment-method",
2334
+ inputs: [
2335
+ "subscriptionId",
2336
+ "card",
2337
+ "provider",
2338
+ "loading"
2339
+ ],
2340
+ outputs: ["saved"]
2341
+ },
2121
2342
  {
2122
2343
  kind: "pipe",
2123
2344
  type: i13.TranslocoPipe,
@@ -2138,7 +2359,7 @@ i0.ɵɵngDeclareClassMetadata({
2138
2359
  args: [{
2139
2360
  selector: "pw-update-payment-details",
2140
2361
  standalone: false,
2141
- template: "<div class=\"container-fluid\">\n <div class=\"card-block\">\n <div class=\"row\">\n <div class=\"col-lg-12 ps-0\">\n <a aria-label=\"Navigate to Target\"\n (click)=\"back()\"\n class=\"previous float-start\"><i class=\"fa fa-arrow-alt-circle-left\" aria-hidden=\"true\"></i></a>\n <h4 class=\"form-section my-3\">\n <i class=\"ft-edit\" aria-hidden=\"true\"></i>\n {{ 'User.Payments.UpdateTitle' | transloco }}\n </h4>\n </div>\n </div>\n\n <div class=\"row g-3 mt-1\">\n <!-- Primary payment method (Stripe) -->\n <div class=\"col-12 col-lg-6\">\n <div class=\"card payment-left p-3 h-100\">\n <div class=\"card-body\">\n <h5 class=\"section-title\">{{ 'User.Payments.Primary.Title' | transloco }}</h5>\n <p class=\"text-muted\">{{ 'User.Payments.Primary.Description' | transloco }}</p>\n\n @if (errorMsg) {\n <div class=\"alert alert-danger\">{{ errorMsg }}</div>\n }\n @if (!isChangePayment && cardDetails) {\n <pw-saved-card-details [data]=\"cardDetails\"\n (changeEvent)=\"onChange($event)\">\n </pw-saved-card-details>\n }\n\n @if (loading) {\n <div class=\"text-center\">\n <p-progress-spinner strokeWidth=\"2\"> </p-progress-spinner>\n </div>\n }\n\n @if ((!cardDetails && !loading) || isChangePayment) {\n <form [formGroup]=\"form\" (ngSubmit)=\"onSave()\">\n <h4 class=\"title\">{{ 'User.Payments.Primary.NewCard' | transloco }}</h4>\n <div class=\"row\">\n <div class=\"col-md-9\">\n <div class=\"mb-3\">\n <label for=\"update-payment-card_number\">{{ 'User.Payments.CardNumber' | transloco }}</label>\n <input type=\"text\"\n id=\"update-payment-card_number\"\n class=\"form-control\"\n formControlName=\"card_number\"\n [placeholder]=\"'User.Payments.CardNumber' | transloco\"\n name=\"card_number\"\n aria-label=\"Card Number\" />\n @if (form.get('card_number').touched && form.get('card_number').errors?.required) {\n <div class=\"danger\"><span>{{ 'User.Payments.Errors.CardNumberRequired' | transloco }}</span></div>\n }\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"mb-3\">\n <label for=\"update-payment-cvc\">{{ 'User.Payments.Cvc' | transloco }}</label>\n <input type=\"text\"\n id=\"update-payment-cvc\"\n class=\"form-control\"\n formControlName=\"cvc\"\n [placeholder]=\"'User.Payments.Cvc' | transloco\"\n name=\"cvc\"\n aria-label=\"Cvc\" />\n @if (form.get('cvc').touched && form.get('cvc').errors?.required) {\n <div class=\"danger\"><span>{{ 'User.Payments.Errors.CvcRequired' | transloco }}</span></div>\n }\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-6\">\n <div class=\"mb-3\">\n <span class=\"sr-only\" id=\"update-payment-exp_month-label\" class=\"pw-label-style\">{{ 'User.Payments.ExpMonth' | transloco }}</span>\n <p-select\n [attr.aria-labelledby]=\"'update-payment-exp_month-label'\"\n [options]=\"months\"\n [appendTo]=\"'body'\"\n formControlName=\"exp_month\"\n [placeholder]=\"'User.Payments.ExpMonth' | transloco\"\n optionValue=\"value\"\n optionLabel=\"value\">\n </p-select>\n @if (form.get('exp_month').touched && form.get('exp_month').errors?.required) {\n <div class=\"danger\"><span>{{ 'User.Payments.Errors.ExpMonthRequired' | transloco }}</span></div>\n }\n </div>\n </div>\n <div class=\"col-md-6\">\n <div class=\"mb-3\">\n <span class=\"sr-only\" id=\"update-payment-exp_year-label\">{{ 'User.Payments.ExpYear' | transloco }}</span>\n <p-select\n [attr.aria-labelledby]=\"'update-payment-exp_year-label'\"\n [options]=\"years\"\n formControlName=\"exp_year\"\n [placeholder]=\"'User.Payments.ExpYear' | transloco\"\n optionValue=\"value\"\n [appendTo]=\"'body'\"\n optionLabel=\"value\">\n </p-select>\n @if (form.get('exp_year')?.touched && form.get('exp_year')?.errors?.['required']) {\n <div class=\"danger\"><span>{{ 'User.Payments.Errors.ExpYearRequired' | transloco }}</span></div>\n }\n </div>\n </div>\n <div class=\"col-12 text-center mt-4\">\n <img src=\"/assets/img/icons/powered_by_stripe_v2.png\"\n class=\"payment-provider\"\n alt=\"\" />\n </div>\n <div class=\"col-12 mt-4 text-end\">\n <button type=\"button\"\n (click)=\"cancel()\"\n class=\"btn btn-outline-default me-2\">\n {{ 'User.Payments.Cancel' | transloco }}\n </button>\n <button type=\"submit\"\n class=\"btn btn-primary\"\n [buttonBusy]=\"busy\">\n {{ 'User.Payments.Submit' | transloco }}\n </button>\n </div>\n </div>\n </form>\n }\n </div>\n </div>\n </div>\n\n <!-- Secondary payment method (Braintree) -->\n <div class=\"col-12 col-lg-6\">\n <div class=\"card payment-right p-3 h-100\">\n <div class=\"card-body\">\n <h5 class=\"section-title\">{{ 'User.Payments.Secondary.Title' | transloco }}</h5>\n <p class=\"alert alert-info\" [pTooltip]=\"'User.Payments.Secondary.Tooltip' | transloco\" tooltipPosition=\"top\" appendTo=\"body\">\n {{ 'User.Payments.Secondary.Callout' | transloco }}\n </p>\n\n @if (loading) {\n <div class=\"text-center\">\n <p-progress-spinner strokeWidth=\"2\"> </p-progress-spinner>\n </div>\n }\n\n @if (secondaryCard && !showBraintreeForm) {\n <pw-saved-card-details [data]=\"secondaryCard\"\n (changeEvent)=\"startBraintreeFlow()\">\n </pw-saved-card-details>\n }\n\n @if (!secondaryCard && !showBraintreeForm && !loading) {\n <button type=\"button\"\n class=\"btn btn-primary\"\n (click)=\"startBraintreeFlow()\">\n {{ 'User.Payments.Secondary.AddCta' | transloco }}\n </button>\n }\n\n @if (showBraintreeForm) {\n <div #braintreeContainer class=\"braintree-dropin-container mt-3\"></div>\n <div class=\"col-12 mt-4 text-end\">\n <button type=\"button\"\n (click)=\"cancelBraintreeFlow()\"\n class=\"btn btn-outline-default me-2\">\n {{ 'User.Payments.Cancel' | transloco }}\n </button>\n <button type=\"button\"\n class=\"btn btn-primary\"\n [buttonBusy]=\"braintreeBusy\"\n (click)=\"submitBraintree()\">\n {{ 'User.Payments.Submit' | transloco }}\n </button>\n </div>\n }\n </div>\n </div>\n </div>\n </div>\n\n </div>\n</div>\n",
2362
+ template: "<div class=\"container-fluid\">\n <div class=\"card-block\">\n <div class=\"row\">\n <div class=\"col-lg-12 ps-0\">\n <a aria-label=\"Navigate to Target\"\n (click)=\"back()\"\n class=\"previous float-start\"><i class=\"fa fa-arrow-alt-circle-left\" aria-hidden=\"true\"></i></a>\n <h4 class=\"form-section my-3\">\n <i class=\"ft-edit\" aria-hidden=\"true\"></i>\n {{ 'User.Payments.UpdateTitle' | transloco }}\n </h4>\n </div>\n </div>\n\n <div class=\"row g-3 mt-1\">\n <!-- Primary payment method (Stripe) -->\n <div class=\"col-12 col-lg-6\">\n <div class=\"card payment-left p-3 h-100\">\n <div class=\"card-body\">\n <h5 class=\"section-title\">{{ 'User.Payments.Primary.Title' | transloco }}</h5>\n <p class=\"text-muted\">{{ 'User.Payments.Primary.Description' | transloco }}</p>\n\n @if (errorMsg) {\n <div class=\"alert alert-danger\">{{ errorMsg }}</div>\n }\n @if (!isChangePayment && cardDetails) {\n <pw-saved-card-details [data]=\"cardDetails\"\n (changeEvent)=\"onChange($event)\">\n </pw-saved-card-details>\n }\n\n @if (loading) {\n <div class=\"text-center\">\n <p-progress-spinner strokeWidth=\"2\"> </p-progress-spinner>\n </div>\n }\n\n @if ((!cardDetails && !loading) || isChangePayment) {\n <form [formGroup]=\"form\" (ngSubmit)=\"onSave()\">\n <h4 class=\"title\">{{ 'User.Payments.Primary.NewCard' | transloco }}</h4>\n <div class=\"row\">\n <div class=\"col-md-9\">\n <div class=\"mb-3\">\n <label for=\"update-payment-card_number\">{{ 'User.Payments.CardNumber' | transloco }}</label>\n <input type=\"text\"\n id=\"update-payment-card_number\"\n class=\"form-control\"\n formControlName=\"card_number\"\n [placeholder]=\"'User.Payments.CardNumber' | transloco\"\n name=\"card_number\"\n aria-label=\"Card Number\" />\n @if (form.get('card_number').touched && form.get('card_number').errors?.required) {\n <div class=\"danger\"><span>{{ 'User.Payments.Errors.CardNumberRequired' | transloco }}</span></div>\n }\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"mb-3\">\n <label for=\"update-payment-cvc\">{{ 'User.Payments.Cvc' | transloco }}</label>\n <input type=\"text\"\n id=\"update-payment-cvc\"\n class=\"form-control\"\n formControlName=\"cvc\"\n [placeholder]=\"'User.Payments.Cvc' | transloco\"\n name=\"cvc\"\n aria-label=\"Cvc\" />\n @if (form.get('cvc').touched && form.get('cvc').errors?.required) {\n <div class=\"danger\"><span>{{ 'User.Payments.Errors.CvcRequired' | transloco }}</span></div>\n }\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-6\">\n <div class=\"mb-3\">\n <span class=\"sr-only\" id=\"update-payment-exp_month-label\" class=\"pw-label-style\">{{ 'User.Payments.ExpMonth' | transloco }}</span>\n <p-select\n [attr.aria-labelledby]=\"'update-payment-exp_month-label'\"\n [options]=\"months\"\n [appendTo]=\"'body'\"\n formControlName=\"exp_month\"\n [placeholder]=\"'User.Payments.ExpMonth' | transloco\"\n optionValue=\"value\"\n optionLabel=\"value\">\n </p-select>\n @if (form.get('exp_month').touched && form.get('exp_month').errors?.required) {\n <div class=\"danger\"><span>{{ 'User.Payments.Errors.ExpMonthRequired' | transloco }}</span></div>\n }\n </div>\n </div>\n <div class=\"col-md-6\">\n <div class=\"mb-3\">\n <span class=\"sr-only\" id=\"update-payment-exp_year-label\">{{ 'User.Payments.ExpYear' | transloco }}</span>\n <p-select\n [attr.aria-labelledby]=\"'update-payment-exp_year-label'\"\n [options]=\"years\"\n formControlName=\"exp_year\"\n [placeholder]=\"'User.Payments.ExpYear' | transloco\"\n optionValue=\"value\"\n [appendTo]=\"'body'\"\n optionLabel=\"value\">\n </p-select>\n @if (form.get('exp_year')?.touched && form.get('exp_year')?.errors?.['required']) {\n <div class=\"danger\"><span>{{ 'User.Payments.Errors.ExpYearRequired' | transloco }}</span></div>\n }\n </div>\n </div>\n <div class=\"col-12 text-center mt-4\">\n <img src=\"/assets/img/icons/powered_by_stripe_v2.png\"\n class=\"payment-provider\"\n alt=\"\" />\n </div>\n <div class=\"col-12 mt-4 text-end\">\n <button type=\"button\"\n (click)=\"cancel()\"\n class=\"btn btn-outline-default me-2\">\n {{ 'User.Payments.Cancel' | transloco }}\n </button>\n <button type=\"submit\"\n class=\"btn btn-primary\"\n [buttonBusy]=\"busy\">\n {{ 'User.Payments.Submit' | transloco }}\n </button>\n </div>\n </div>\n </form>\n }\n </div>\n </div>\n </div>\n\n <!-- Secondary payment method (Braintree or Airwallex, main-api #974) -->\n <div class=\"col-12 col-lg-6\">\n <div class=\"card payment-right p-3 h-100\">\n <div class=\"card-body\">\n <pw-secondary-payment-method\n [subscriptionId]=\"subscriptionId\"\n [card]=\"secondaryCard\"\n [provider]=\"secondaryProvider\"\n [loading]=\"loading\"\n (saved)=\"refreshPaymentMethods()\">\n </pw-secondary-payment-method>\n </div>\n </div>\n </div>\n </div>\n\n </div>\n</div>\n",
2142
2363
  styles: [".card-block .payment-left,.card-block .payment-right{border:1px solid rgb(204,204,204)}.card-block .payment-left h4,.card-block .payment-right h4{border-bottom:1px solid rgb(0,0,0);font-size:1rem;font-weight:600;margin:0 0 20px;padding:0 0 5px;text-transform:uppercase}.payment-provider{width:30%}@media(max-width:800px){.payment-provider{width:60%}}\n"]
2143
2364
  }]
2144
2365
  }],
@@ -2150,13 +2371,7 @@ i0.ɵɵngDeclareClassMetadata({
2150
2371
  { type: i0.Injector },
2151
2372
  { type: i0.ChangeDetectorRef }
2152
2373
  ],
2153
- propDecorators: {
2154
- braintreeContainer: [{
2155
- type: ViewChild,
2156
- args: ["braintreeContainer"]
2157
- }],
2158
- onSave: []
2159
- }
2374
+ propDecorators: { onSave: [] }
2160
2375
  });
2161
2376
  var UpgradeSubscriptionComponent = class UpgradeSubscriptionComponent extends AppBaseComponent {
2162
2377
  get totalAmount() {
@@ -4045,6 +4260,96 @@ i0.ɵɵngDeclareClassMetadata({
4045
4260
  }],
4046
4261
  ctorParameters: () => [{ type: i0.Injector }, { type: i0.ChangeDetectorRef }]
4047
4262
  });
4263
+ var AiKnowledgeTabComponent = class AiKnowledgeTabComponent {
4264
+ constructor(permissionService) {
4265
+ this.permissionService = permissionService;
4266
+ }
4267
+ get ready() {
4268
+ return !!this.permissionService.user;
4269
+ }
4270
+ get isAlpha() {
4271
+ return hasKnowledgeAlpha(this.permissionService);
4272
+ }
4273
+ get subscription() {
4274
+ return PermissionService.selectedSubscription ?? null;
4275
+ }
4276
+ get useOwnData() {
4277
+ return this.subscription?.rag_use_own_data === true;
4278
+ }
4279
+ static {
4280
+ this.ɵfac = i0.ɵɵngDeclareFactory({
4281
+ minVersion: "12.0.0",
4282
+ version: "22.2.0",
4283
+ ngImport: i0,
4284
+ type: AiKnowledgeTabComponent,
4285
+ deps: [{ token: i3.PermissionService }],
4286
+ target: i0.ɵɵFactoryTarget.Component
4287
+ });
4288
+ }
4289
+ static {
4290
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
4291
+ minVersion: "17.0.0",
4292
+ version: "22.2.0",
4293
+ type: AiKnowledgeTabComponent,
4294
+ isStandalone: false,
4295
+ selector: "pw-ai-knowledge-tab",
4296
+ ngImport: i0,
4297
+ template: "@if (!ready) {\n <pw-loader [isVisible]=\"true\"></pw-loader>\n} @else if (!isAlpha) {\n <pw-no-data [withImage]=\"true\" [message]=\"'AiKnowledge.NotAvailable' | transloco\"></pw-no-data>\n} @else if (subscription) {\n @if (!useOwnData) {\n <div class=\"alert alert-warning\" role=\"status\">\n <i class=\"fa fa-exclamation-triangle me-2\" aria-hidden=\"true\"></i>\n {{ 'AiKnowledge.PersonalUseOwnDataOff' | transloco: { name: subscription.organisation } }}\n </div>\n }\n <pw-ai-knowledge scope=\"personal\"\n [subscriptionId]=\"subscription.id\"\n [subscriptionName]=\"subscription.organisation\"></pw-ai-knowledge>\n} @else {\n <pw-no-data [withImage]=\"true\" [message]=\"'AiKnowledge.NoSubscription' | transloco\"></pw-no-data>\n}\n",
4298
+ dependencies: [
4299
+ {
4300
+ kind: "component",
4301
+ type: i5$2.AppLoaderComponent,
4302
+ selector: "pw-loader",
4303
+ inputs: [
4304
+ "isVisible",
4305
+ "closeOnOutsideClick",
4306
+ "autoCloseTimeOut"
4307
+ ]
4308
+ },
4309
+ {
4310
+ kind: "component",
4311
+ type: i2$3.AiKnowledgeComponent,
4312
+ selector: "pw-ai-knowledge",
4313
+ inputs: [
4314
+ "scope",
4315
+ "subscriptionId",
4316
+ "subscriptionName"
4317
+ ]
4318
+ },
4319
+ {
4320
+ kind: "component",
4321
+ type: i2$3.NoDataComponent,
4322
+ selector: "pw-no-data",
4323
+ inputs: [
4324
+ "message",
4325
+ "description",
4326
+ "withImage"
4327
+ ]
4328
+ },
4329
+ {
4330
+ kind: "pipe",
4331
+ type: i13.TranslocoPipe,
4332
+ name: "transloco"
4333
+ }
4334
+ ]
4335
+ });
4336
+ }
4337
+ };
4338
+ i0.ɵɵngDeclareClassMetadata({
4339
+ minVersion: "12.0.0",
4340
+ version: "22.2.0",
4341
+ ngImport: i0,
4342
+ type: AiKnowledgeTabComponent,
4343
+ decorators: [{
4344
+ type: Component,
4345
+ args: [{
4346
+ selector: "pw-ai-knowledge-tab",
4347
+ standalone: false,
4348
+ template: "@if (!ready) {\n <pw-loader [isVisible]=\"true\"></pw-loader>\n} @else if (!isAlpha) {\n <pw-no-data [withImage]=\"true\" [message]=\"'AiKnowledge.NotAvailable' | transloco\"></pw-no-data>\n} @else if (subscription) {\n @if (!useOwnData) {\n <div class=\"alert alert-warning\" role=\"status\">\n <i class=\"fa fa-exclamation-triangle me-2\" aria-hidden=\"true\"></i>\n {{ 'AiKnowledge.PersonalUseOwnDataOff' | transloco: { name: subscription.organisation } }}\n </div>\n }\n <pw-ai-knowledge scope=\"personal\"\n [subscriptionId]=\"subscription.id\"\n [subscriptionName]=\"subscription.organisation\"></pw-ai-knowledge>\n} @else {\n <pw-no-data [withImage]=\"true\" [message]=\"'AiKnowledge.NoSubscription' | transloco\"></pw-no-data>\n}\n"
4349
+ }]
4350
+ }],
4351
+ ctorParameters: () => [{ type: i3.PermissionService }]
4352
+ });
4048
4353
  var CommunicationTabComponent = class CommunicationTabComponent extends AppBaseComponent {
4049
4354
  constructor(commonService, profileService, store, injector, cdr) {
4050
4355
  super(injector);
@@ -4611,6 +4916,13 @@ var SettingsComponent = class SettingsComponent {
4611
4916
  icon: "fa fa-fw fa-lock",
4612
4917
  routerLink: ["/settings/security"]
4613
4918
  },
4919
+ {
4920
+ id: "ai-knowledge",
4921
+ label: "AI Knowledge",
4922
+ icon: "fa fa-fw fa-brain",
4923
+ routerLink: ["/settings/ai-knowledge"],
4924
+ visible: hasKnowledgeAlpha(this.permissionService)
4925
+ },
4614
4926
  {
4615
4927
  id: "other",
4616
4928
  label: "Other",
@@ -8168,10 +8480,12 @@ var UserModuleModule = class UserModuleModule {
8168
8480
  SubscriptionNameByIdPipe,
8169
8481
  ClearMaskedOnFocusDirective,
8170
8482
  UpdatePaymentDetailsComponent,
8483
+ SecondaryPaymentMethodComponent,
8171
8484
  UpgradeSubscriptionComponent,
8172
8485
  UserSubscriptionDetailsComponent,
8173
8486
  UserSubscriptionListComponent,
8174
8487
  UserInvoiceComponent,
8488
+ AiKnowledgeTabComponent,
8175
8489
  CommunicationTabComponent,
8176
8490
  OthersTabComponent,
8177
8491
  SecurityTabComponent,
@@ -8231,6 +8545,7 @@ var UserModuleModule = class UserModuleModule {
8231
8545
  UserSubscriptionDetailsComponent,
8232
8546
  UserSubscriptionListComponent,
8233
8547
  UserInvoiceComponent,
8548
+ AiKnowledgeTabComponent,
8234
8549
  CommunicationTabComponent,
8235
8550
  OthersTabComponent,
8236
8551
  SecurityTabComponent,
@@ -8306,10 +8621,12 @@ i0.ɵɵngDeclareClassMetadata({
8306
8621
  SubscriptionNameByIdPipe,
8307
8622
  ClearMaskedOnFocusDirective,
8308
8623
  UpdatePaymentDetailsComponent,
8624
+ SecondaryPaymentMethodComponent,
8309
8625
  UpgradeSubscriptionComponent,
8310
8626
  UserSubscriptionDetailsComponent,
8311
8627
  UserSubscriptionListComponent,
8312
8628
  UserInvoiceComponent,
8629
+ AiKnowledgeTabComponent,
8313
8630
  CommunicationTabComponent,
8314
8631
  OthersTabComponent,
8315
8632
  SecurityTabComponent,
@@ -8360,6 +8677,7 @@ i0.ɵɵngDeclareClassMetadata({
8360
8677
  UserSubscriptionDetailsComponent,
8361
8678
  UserSubscriptionListComponent,
8362
8679
  UserInvoiceComponent,
8680
+ AiKnowledgeTabComponent,
8363
8681
  CommunicationTabComponent,
8364
8682
  OthersTabComponent,
8365
8683
  SecurityTabComponent,
@@ -8391,6 +8709,6 @@ i0.ɵɵngDeclareClassMetadata({
8391
8709
  }]
8392
8710
  }]
8393
8711
  });
8394
- export { AccountComponent, AccountDetailsComponent, AddSubscriptionComponent, ClearMaskedOnFocusDirective, CommunicationTabComponent, CredentialAvatarHuePipe, EditPortfoliosComponent, EditProjectModalComponent, EditQualificationsModalComponent, EditRecommendationModalComponent, EditSkillsModalComponent, EditSocialLinksComponent, EditUserProfileModalComponent, HumanizeCredentialNamePipe, OthersTabComponent, PortfoliosComponent, SavedCardDetailsComponent, SecurityTabComponent, SettingsComponent, SubscriptionCredentialComponent, SubscriptionNameByIdPipe, SupportComponent, SupportDetailsComponent, UpdatePaymentDetailsComponent, UpgradeSubscriptionComponent, UserAboutComponent, UserInvoiceComponent, UserModuleModule, UserProfilePageComponent, UserProjectsComponent, UserSubscriptionDetailsComponent, UserSubscriptionListComponent };
8712
+ export { AccountComponent, AccountDetailsComponent, AddSubscriptionComponent, AiKnowledgeTabComponent, ClearMaskedOnFocusDirective, CommunicationTabComponent, CredentialAvatarHuePipe, EditPortfoliosComponent, EditProjectModalComponent, EditQualificationsModalComponent, EditRecommendationModalComponent, EditSkillsModalComponent, EditSocialLinksComponent, EditUserProfileModalComponent, HumanizeCredentialNamePipe, OthersTabComponent, PortfoliosComponent, SavedCardDetailsComponent, SecurityTabComponent, SettingsComponent, SubscriptionCredentialComponent, SubscriptionNameByIdPipe, SupportComponent, SupportDetailsComponent, UpdatePaymentDetailsComponent, UpgradeSubscriptionComponent, UserAboutComponent, UserInvoiceComponent, UserModuleModule, UserProfilePageComponent, UserProjectsComponent, UserSubscriptionDetailsComponent, UserSubscriptionListComponent };
8395
8713
 
8396
8714
  //# sourceMappingURL=posiwise-user-module.mjs.map