@dereekb/dbx-firebase 13.12.3 → 13.12.5

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.
@@ -15,7 +15,7 @@ import * as i1 from '@angular/material/icon';
15
15
  import { MatIconModule, MatIcon } from '@angular/material/icon';
16
16
  import { firebaseAuthErrorToReadableError, FIREBASE_AUTH_PASSWORD_MIN_LENGTH, FirebaseDevelopmentFunctions, ScheduledFunctionDevelopmentFunctionTypeEnum, clientFirebaseFirestoreContextFactory, SystemStateFirestoreCollections, NotificationFirestoreCollections, StorageFileFirestoreCollections, FIREBASE_DEVELOPMENT_FUNCTIONS_MAP_KEY, iterationQueryDocChangeWatcher, firebaseQuerySnapshotAccumulator, firebaseQueryItemAccumulator, firestoreModelKeysFromDocuments, firestoreModelIdsFromDocuments, documentReferencesFromDocuments, getDocumentSnapshots, getDataFromDocumentSnapshots, latestSnapshotsFromDocuments, dataFromDocumentSnapshots, loadDocumentsForKeys, loadDocumentsForDocumentReferences, loadDocumentsForIds, firestoreModelKeyCollectionTypePair, buildFirebaseCollectionTypeModelTypeMap, firestoreModelId, flatFirestoreModelKey, twoWayFlatFirestoreModelKey, FirestoreAccessorStreamMode, firestoreModelIdsFromKey, firestoreModelKeyPartPairs, firestoreModelKeyPairObject, documentDataWithIdAndKey, isClientFirebaseError, FIRESTORE_PERMISSION_DENIED_ERROR_CODE, inferKeyFromTwoWayFlatFirestoreModelKey, firestoreModelKeyParentKey, AppNotificationTemplateTypeInfoRecordService, NotificationFunctions, unreadNotificationItems, StorageFileFunctions, firestoreModelKey, storageFileIdentity, clientFirebaseStorageContextFactory } from '@dereekb/firebase';
17
17
  import * as i1$2 from '@dereekb/dbx-form';
18
- import { AbstractSyncForgeFormDirective, dbxForgeEmailField, DbxForgeFormComponentImportsModule, dbxForgeFormComponentProviders, DBX_FORGE_FORM_COMPONENT_TEMPLATE, AbstractConfigAsyncForgeFormDirective, dbxForgeUsernameLoginField, dbxForgeTextPasswordField, dbxForgeTextVerifyPasswordField, DbxActionFormDirective, DbxFormSourceDirective, dbxForgePickableChipField, filterPickableItemFieldValuesByLabel } from '@dereekb/dbx-form';
18
+ import { AbstractSyncForgeFormDirective, dbxForgeEmailField, DbxForgeFormComponentImportsModule, dbxForgeFormComponentProviders, DBX_FORGE_FORM_COMPONENT_TEMPLATE, AbstractConfigAsyncForgeFormDirective, dbxForgeUsernameLoginField, dbxForgeTextPasswordField, dbxForgeTextVerifyPasswordField, DbxActionFormDirective, DbxFormSourceDirective, dbxForgeTextPasswordWithVerifyField, dbxForgeTextField, dbxForgePickableChipField, filterPickableItemFieldValuesByLabel } from '@dereekb/dbx-form';
19
19
  import { NgTemplateOutlet, DatePipe } from '@angular/common';
20
20
  import * as i1$3 from '@angular/material/button';
21
21
  import { MatButtonModule } from '@angular/material/button';
@@ -1889,27 +1889,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
1889
1889
  }] });
1890
1890
 
1891
1891
  /**
1892
- * Forge-based form component for completing a password reset, containing new password and verify password fields.
1892
+ * Forge-based form component for completing a password reset.
1893
+ *
1894
+ * Renders New Password + Verify Password fields, and optionally a reset code field when {@link DbxFirebasePasswordResetFormConfig.showOobCodeInput} is true.
1893
1895
  */
1894
- class DbxFirebasePasswordResetFormComponent extends AbstractSyncForgeFormDirective {
1895
- formConfig = {
1896
- fields: [
1897
- dbxForgeTextPasswordField({ minLength: FIREBASE_AUTH_PASSWORD_MIN_LENGTH }),
1898
- {
1899
- ...dbxForgeTextVerifyPasswordField(),
1900
- validators: [
1901
- {
1902
- type: 'custom',
1903
- expression: 'fieldValue === formValue.password',
1904
- kind: 'passwordMismatch'
1905
- }
1906
- ],
1907
- validationMessages: {
1908
- passwordMismatch: 'The passwords do not match.'
1909
- }
1896
+ class DbxFirebasePasswordResetFormComponent extends AbstractConfigAsyncForgeFormDirective {
1897
+ formConfig$ = this.currentConfig$.pipe(map((config) => {
1898
+ const showOobCodeInput = config?.showOobCodeInput ?? false;
1899
+ const [passwordField, verifyPasswordField] = dbxForgeTextPasswordWithVerifyField({
1900
+ password: {
1901
+ label: 'New Password',
1902
+ minLength: FIREBASE_AUTH_PASSWORD_MIN_LENGTH
1910
1903
  }
1911
- ]
1912
- };
1904
+ });
1905
+ const fields = [
1906
+ ...(showOobCodeInput
1907
+ ? [
1908
+ dbxForgeTextField({
1909
+ key: 'oobCode',
1910
+ label: 'Reset Code',
1911
+ required: true
1912
+ })
1913
+ ]
1914
+ : []),
1915
+ passwordField,
1916
+ verifyPasswordField
1917
+ ];
1918
+ return { fields };
1919
+ }));
1913
1920
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxFirebasePasswordResetFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1914
1921
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.11", type: DbxFirebasePasswordResetFormComponent, isStandalone: true, selector: "dbx-firebase-password-reset-form", providers: dbxForgeFormComponentProviders(), usesInheritance: true, ngImport: i0, template: "<dbx-forge></dbx-forge>", isInline: true, dependencies: [{ kind: "ngmodule", type: DbxForgeFormComponentImportsModule }, { kind: "component", type: i1$2.DbxForgeFormComponent, selector: "dbx-forge" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1915
1922
  }
@@ -1928,19 +1935,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
1928
1935
  /**
1929
1936
  * Standalone component for completing a password reset.
1930
1937
  *
1931
- * Reads an `oobCode` from input and presents a new password form.
1938
+ * Reads an optional `oobCode` from input and presents a new password form.
1939
+ * When no `oobCode` is supplied, the form additionally prompts the user to enter the reset code.
1932
1940
  * On submit, calls {@link DbxFirebaseAuthService.completePasswordReset} to finalize the reset.
1933
1941
  */
1934
1942
  class DbxFirebasePasswordResetComponent {
1935
1943
  dbxFirebaseAuthService = inject(DbxFirebaseAuthService);
1936
1944
  /**
1937
1945
  * The oobCode from the password reset email link.
1946
+ *
1947
+ * When omitted, the form prompts the user to enter the reset code.
1938
1948
  */
1939
- oobCode = input.required(...(ngDevMode ? [{ debugName: "oobCode" }] : /* istanbul ignore next */ []));
1949
+ oobCode = input(...(ngDevMode ? [undefined, { debugName: "oobCode" }] : /* istanbul ignore next */ []));
1940
1950
  resetCompleteSignal = signal(false, ...(ngDevMode ? [{ debugName: "resetCompleteSignal" }] : /* istanbul ignore next */ []));
1951
+ formConfigSignal = computed(() => ({
1952
+ showOobCodeInput: !this.oobCode()
1953
+ }), ...(ngDevMode ? [{ debugName: "formConfigSignal" }] : /* istanbul ignore next */ []));
1941
1954
  handleResetAction = (value) => {
1955
+ const oobCode = this.oobCode() || value.oobCode;
1942
1956
  return from(this.dbxFirebaseAuthService.completePasswordReset({
1943
- oobCode: this.oobCode(),
1957
+ oobCode: oobCode,
1944
1958
  newPassword: value.password
1945
1959
  })).pipe(tap({
1946
1960
  next: () => this.resetCompleteSignal.set(true),
@@ -1950,12 +1964,12 @@ class DbxFirebasePasswordResetComponent {
1950
1964
  }));
1951
1965
  };
1952
1966
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxFirebasePasswordResetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1953
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", type: DbxFirebasePasswordResetComponent, isStandalone: true, selector: "dbx-firebase-password-reset", inputs: { oobCode: { classPropertyName: "oobCode", publicName: "oobCode", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div class=\"dbx-firebase-password-reset\" aria-live=\"polite\">\n @if (resetCompleteSignal()) {\n <div role=\"status\">\n <p class=\"dbx-hint\">Your password has been reset successfully. You can now log in with your new password.</p>\n </div>\n } @else {\n <ng-container dbxAction [dbxActionHandler]=\"handleResetAction\">\n <dbx-firebase-password-reset-form dbxActionForm></dbx-firebase-password-reset-form>\n <div class=\"dbx-flex\">\n <dbx-button class=\"dbx-button-wide\" text=\"Reset Password\" [raised]=\"true\" color=\"primary\" dbxActionButton></dbx-button>\n </div>\n <dbx-error dbxActionError></dbx-error>\n </ng-container>\n }\n</div>\n", dependencies: [{ kind: "component", type: DbxFirebasePasswordResetFormComponent, selector: "dbx-firebase-password-reset-form" }, { kind: "ngmodule", type: DbxActionModule }, { kind: "directive", type: i2.DbxActionDirective, selector: "dbx-action,[dbxAction]", exportAs: ["action", "dbxAction"] }, { kind: "directive", type: i2.DbxActionHandlerDirective, selector: "[dbxActionHandler]", inputs: ["dbxActionHandler"] }, { kind: "directive", type: i2.DbxActionButtonDirective, selector: "[dbxActionButton]", inputs: ["dbxActionButtonEcho"] }, { kind: "component", type: DbxButtonComponent, selector: "dbx-button", inputs: ["bar", "type", "buttonStyle", "color", "spinnerColor", "customButtonColor", "customTextColor", "customSpinnerColor", "basic", "tonal", "raised", "stroked", "flat", "iconOnly", "fab", "customContent", "allowClickPropagation", "mode"] }, { kind: "component", type: DbxErrorComponent, selector: "dbx-error", inputs: ["error", "iconOnly"], outputs: ["popoverOpened"] }, { kind: "directive", type: DbxActionFormDirective, selector: "[dbxActionForm]", inputs: ["dbxActionFormDisabledOnWorking", "dbxActionFormIsValid", "dbxActionFormIsEqual", "dbxActionFormIsModified", "dbxActionFormMapValue"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1967
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", type: DbxFirebasePasswordResetComponent, isStandalone: true, selector: "dbx-firebase-password-reset", inputs: { oobCode: { classPropertyName: "oobCode", publicName: "oobCode", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"dbx-firebase-password-reset\" aria-live=\"polite\">\n @if (resetCompleteSignal()) {\n <div role=\"status\">\n <p class=\"dbx-hint\">Your password has been reset successfully. You can now log in with your new password.</p>\n <ng-content select=\"[success]\"></ng-content>\n </div>\n } @else {\n <ng-container dbxAction [dbxActionHandler]=\"handleResetAction\">\n <dbx-firebase-password-reset-form dbxActionForm [config]=\"formConfigSignal()\"></dbx-firebase-password-reset-form>\n <div class=\"dbx-flex\">\n <dbx-button class=\"dbx-button-wide\" text=\"Reset Password\" [raised]=\"true\" color=\"primary\" dbxActionButton></dbx-button>\n </div>\n <dbx-error dbxActionError>\n <ng-content select=\"[error]\"></ng-content>\n </dbx-error>\n <ng-content></ng-content>\n </ng-container>\n }\n</div>\n", dependencies: [{ kind: "component", type: DbxFirebasePasswordResetFormComponent, selector: "dbx-firebase-password-reset-form" }, { kind: "ngmodule", type: DbxActionModule }, { kind: "directive", type: i2.DbxActionDirective, selector: "dbx-action,[dbxAction]", exportAs: ["action", "dbxAction"] }, { kind: "directive", type: i2.DbxActionHandlerDirective, selector: "[dbxActionHandler]", inputs: ["dbxActionHandler"] }, { kind: "directive", type: i2.DbxActionButtonDirective, selector: "[dbxActionButton]", inputs: ["dbxActionButtonEcho"] }, { kind: "component", type: DbxButtonComponent, selector: "dbx-button", inputs: ["bar", "type", "buttonStyle", "color", "spinnerColor", "customButtonColor", "customTextColor", "customSpinnerColor", "basic", "tonal", "raised", "stroked", "flat", "iconOnly", "fab", "customContent", "allowClickPropagation", "mode"] }, { kind: "component", type: DbxErrorComponent, selector: "dbx-error", inputs: ["error", "iconOnly"], outputs: ["popoverOpened"] }, { kind: "directive", type: DbxActionErrorDirective, selector: "[dbxActionError]" }, { kind: "directive", type: DbxActionFormDirective, selector: "[dbxActionForm]", inputs: ["dbxActionFormDisabledOnWorking", "dbxActionFormIsValid", "dbxActionFormIsEqual", "dbxActionFormIsModified", "dbxActionFormMapValue"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1954
1968
  }
1955
1969
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxFirebasePasswordResetComponent, decorators: [{
1956
1970
  type: Component,
1957
- args: [{ selector: 'dbx-firebase-password-reset', imports: [DbxFirebasePasswordResetFormComponent, DbxActionModule, DbxButtonComponent, DbxErrorComponent, DbxActionFormDirective], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, template: "<div class=\"dbx-firebase-password-reset\" aria-live=\"polite\">\n @if (resetCompleteSignal()) {\n <div role=\"status\">\n <p class=\"dbx-hint\">Your password has been reset successfully. You can now log in with your new password.</p>\n </div>\n } @else {\n <ng-container dbxAction [dbxActionHandler]=\"handleResetAction\">\n <dbx-firebase-password-reset-form dbxActionForm></dbx-firebase-password-reset-form>\n <div class=\"dbx-flex\">\n <dbx-button class=\"dbx-button-wide\" text=\"Reset Password\" [raised]=\"true\" color=\"primary\" dbxActionButton></dbx-button>\n </div>\n <dbx-error dbxActionError></dbx-error>\n </ng-container>\n }\n</div>\n" }]
1958
- }], propDecorators: { oobCode: [{ type: i0.Input, args: [{ isSignal: true, alias: "oobCode", required: true }] }] } });
1971
+ args: [{ selector: 'dbx-firebase-password-reset', imports: [DbxFirebasePasswordResetFormComponent, DbxActionModule, DbxButtonComponent, DbxErrorComponent, DbxActionErrorDirective, DbxActionFormDirective], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, template: "<div class=\"dbx-firebase-password-reset\" aria-live=\"polite\">\n @if (resetCompleteSignal()) {\n <div role=\"status\">\n <p class=\"dbx-hint\">Your password has been reset successfully. You can now log in with your new password.</p>\n <ng-content select=\"[success]\"></ng-content>\n </div>\n } @else {\n <ng-container dbxAction [dbxActionHandler]=\"handleResetAction\">\n <dbx-firebase-password-reset-form dbxActionForm [config]=\"formConfigSignal()\"></dbx-firebase-password-reset-form>\n <div class=\"dbx-flex\">\n <dbx-button class=\"dbx-button-wide\" text=\"Reset Password\" [raised]=\"true\" color=\"primary\" dbxActionButton></dbx-button>\n </div>\n <dbx-error dbxActionError>\n <ng-content select=\"[error]\"></ng-content>\n </dbx-error>\n <ng-content></ng-content>\n </ng-container>\n }\n</div>\n" }]
1972
+ }], propDecorators: { oobCode: [{ type: i0.Input, args: [{ isSignal: true, alias: "oobCode", required: false }] }] } });
1959
1973
 
1960
1974
  /**
1961
1975
  * Renders the configured terms of service component via dynamic injection from the login service.