@forgeroute/ui 0.4.4 → 0.4.6

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.
@@ -416,6 +416,7 @@ var StripePaymentComponent = class StripePaymentComponent {
416
416
  this.doc = inject(DOCUMENT);
417
417
  this.isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
418
418
  this.host = inject(ElementRef);
419
+ this.mountOnly = input(false, ...ngDevMode ? [{ debugName: "mountOnly" }] : /* istanbul ignore next */ []);
419
420
  this.mode = input("payment", ...ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []);
420
421
  this.publishableKey = input(null, ...ngDevMode ? [{ debugName: "publishableKey" }] : /* istanbul ignore next */ []);
421
422
  this.clientSecret = input(null, ...ngDevMode ? [{ debugName: "clientSecret" }] : /* istanbul ignore next */ []);
@@ -461,6 +462,7 @@ var StripePaymentComponent = class StripePaymentComponent {
461
462
  this.errorMessages = input(null, ...ngDevMode ? [{ debugName: "errorMessages" }] : /* istanbul ignore next */ []);
462
463
  this.loadErrorMessage = input("Failed to load the payment form. Please try again.", ...ngDevMode ? [{ debugName: "loadErrorMessage" }] : /* istanbul ignore next */ []);
463
464
  this.a11yMessages = input(null, ...ngDevMode ? [{ debugName: "a11yMessages" }] : /* istanbul ignore next */ []);
465
+ this.stripeReady = output();
464
466
  this.ready = output();
465
467
  this.paymentMethodTypeChange = output();
466
468
  this.elementChange = output();
@@ -477,7 +479,7 @@ var StripePaymentComponent = class StripePaymentComponent {
477
479
  this.announcement = signal("", ...ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []);
478
480
  this.errorId = `ui-stripe-error-${nextId++}`;
479
481
  this.mountRef = viewChild("mount", ...ngDevMode ? [{ debugName: "mountRef" }] : /* istanbul ignore next */ []);
480
- this.mountHidden = computed(() => this.loading() || this.pending() || !!this.loadErrorText(), ...ngDevMode ? [{ debugName: "mountHidden" }] : /* istanbul ignore next */ []);
482
+ this.mountHidden = computed(() => !this.mountOnly() && (this.loading() || this.pending() || !!this.loadErrorText()), ...ngDevMode ? [{ debugName: "mountHidden" }] : /* istanbul ignore next */ []);
481
483
  this.achNoticeVisible = computed(() => this.showAchNotice() && this.selectedType() === "us_bank_account", ...ngDevMode ? [{ debugName: "achNoticeVisible" }] : /* istanbul ignore next */ []);
482
484
  this.effectiveSubmitLabel = computed(() => this.submitLabel() || (this.mode() === "setup" ? "Save payment method" : "Pay"), ...ngDevMode ? [{ debugName: "effectiveSubmitLabel" }] : /* istanbul ignore next */ []);
483
485
  this.submitDisabled = computed(() => this.disabled() || this.loading() || this.pending() || !this.isReady() || !!this.loadErrorText(), ...ngDevMode ? [{ debugName: "submitDisabled" }] : /* istanbul ignore next */ []);
@@ -566,7 +568,7 @@ var StripePaymentComponent = class StripePaymentComponent {
566
568
  effect(() => {
567
569
  const amount = this.deferred()?.amount;
568
570
  untracked(() => {
569
- if (amount !== void 0 && this.lastAmount !== void 0 && amount !== this.lastAmount && this.elements?.update) this.elements.update({ amount });
571
+ if (!this.mountOnly() && amount !== void 0 && this.lastAmount !== void 0 && amount !== this.lastAmount && this.elements?.update) this.elements.update({ amount });
570
572
  this.lastAmount = amount;
571
573
  });
572
574
  });
@@ -888,9 +890,12 @@ var StripePaymentComponent = class StripePaymentComponent {
888
890
  this.lastType = null;
889
891
  this.selectedType.set(null);
890
892
  this.complete.set(false);
891
- if (element) try {
892
- element.destroy();
893
- } catch {}
893
+ if (element) {
894
+ try {
895
+ element.destroy();
896
+ } catch {}
897
+ if (!this.destroyed) this.stripeReady.emit(null);
898
+ }
894
899
  }
895
900
  loadFailed(message, stripeMessage) {
896
901
  this.loading.set(false);
@@ -936,7 +941,7 @@ var StripePaymentComponent = class StripePaymentComponent {
936
941
  const elementOptions = { ...elementConfig };
937
942
  const defaultValues = this.defaultValues();
938
943
  if (defaultValues) elementOptions["defaultValues"] = defaultValues;
939
- if (this.disabled()) elementOptions["readOnly"] = true;
944
+ if (this.disabled() && !this.mountOnly()) elementOptions["readOnly"] = true;
940
945
  this.appliedDefaultValues = JSON.stringify(defaultValues ?? null);
941
946
  this.appliedDisabled = this.disabled();
942
947
  const element = elements.create("payment", elementOptions);
@@ -949,8 +954,10 @@ var StripePaymentComponent = class StripePaymentComponent {
949
954
  if (generation !== this.generation) return;
950
955
  this.loading.set(false);
951
956
  this.isReady.set(true);
952
- this.applyDefaultValues(this.defaultValues());
953
- this.applyDisabled(this.disabled());
957
+ if (!this.mountOnly()) {
958
+ this.applyDefaultValues(this.defaultValues());
959
+ this.applyDisabled(this.disabled());
960
+ }
954
961
  this.ready.emit();
955
962
  });
956
963
  element.on("loaderror", (event) => {
@@ -959,6 +966,11 @@ var StripePaymentComponent = class StripePaymentComponent {
959
966
  this.loadFailed(message, event?.error?.message ?? "");
960
967
  });
961
968
  element.mount(container);
969
+ this.stripeReady.emit({
970
+ stripe: this.stripe,
971
+ elements,
972
+ paymentElement: element
973
+ });
962
974
  } catch (err) {
963
975
  if (generation !== this.generation) return;
964
976
  this.loadFailed(messageOfThrown(err, MSG_LOAD_FAILED), messageOfThrown(err, ""));
@@ -966,12 +978,12 @@ var StripePaymentComponent = class StripePaymentComponent {
966
978
  }
967
979
  applyDefaultValues(defaultValues) {
968
980
  const signature = JSON.stringify(defaultValues ?? null);
969
- if (!this.element?.update || !this.isReady() || signature === this.appliedDefaultValues) return;
981
+ if (this.mountOnly() || !this.element?.update || !this.isReady() || signature === this.appliedDefaultValues) return;
970
982
  this.appliedDefaultValues = signature;
971
983
  this.element.update({ defaultValues: defaultValues ?? {} });
972
984
  }
973
985
  applyDisabled(disabled) {
974
- if (!this.element?.update || !this.isReady() || disabled === this.appliedDisabled) return;
986
+ if (this.mountOnly() || !this.element?.update || !this.isReady() || disabled === this.appliedDisabled) return;
975
987
  this.appliedDisabled = disabled;
976
988
  this.element.update({ readOnly: disabled });
977
989
  }
@@ -1007,6 +1019,13 @@ var StripePaymentComponent = class StripePaymentComponent {
1007
1019
  isStandalone: true,
1008
1020
  selector: "ui-stripe-payment",
1009
1021
  inputs: {
1022
+ mountOnly: {
1023
+ classPropertyName: "mountOnly",
1024
+ publicName: "mountOnly",
1025
+ isSignal: true,
1026
+ isRequired: false,
1027
+ transformFunction: null
1028
+ },
1010
1029
  mode: {
1011
1030
  classPropertyName: "mode",
1012
1031
  publicName: "mode",
@@ -1324,6 +1343,7 @@ var StripePaymentComponent = class StripePaymentComponent {
1324
1343
  }
1325
1344
  },
1326
1345
  outputs: {
1346
+ stripeReady: "stripeReady",
1327
1347
  ready: "ready",
1328
1348
  paymentMethodTypeChange: "paymentMethodTypeChange",
1329
1349
  elementChange: "elementChange",
@@ -1331,7 +1351,7 @@ var StripePaymentComponent = class StripePaymentComponent {
1331
1351
  failed: "failed",
1332
1352
  loadError: "loadError"
1333
1353
  },
1334
- host: { properties: { "attr.aria-busy": "loading() || submitting() ? \"true\" : null" } },
1354
+ host: { properties: { "attr.aria-busy": "!mountOnly() && (loading() || submitting()) ? \"true\" : null" } },
1335
1355
  viewQueries: [{
1336
1356
  propertyName: "mountRef",
1337
1357
  first: true,
@@ -1342,26 +1362,28 @@ var StripePaymentComponent = class StripePaymentComponent {
1342
1362
  ngImport: i0,
1343
1363
  template: `
1344
1364
  <div class="sp">
1345
- <div class="sp-sr" role="status" aria-live="polite" data-testid="stripe-status">{{ statusText() }}</div>
1346
- @if (loading() || pending()) {
1365
+ @if (!mountOnly() || a11yMessages()) {
1366
+ <div class="sp-sr" role="status" aria-live="polite" data-testid="stripe-status">{{ statusText() }}</div>
1367
+ }
1368
+ @if (!mountOnly() && (loading() || pending())) {
1347
1369
  <div class="sp-skeleton" data-testid="stripe-skeleton" aria-hidden="true">
1348
1370
  <ui-skeleton [height]="44" [mb]="10" />
1349
1371
  <ui-skeleton [height]="44" [mb]="10" />
1350
1372
  <ui-skeleton [height]="44" width="60%" />
1351
1373
  </div>
1352
1374
  }
1353
- @if (loadErrorText(); as text) {
1375
+ @if (!mountOnly() && loadErrorText(); as text) {
1354
1376
  <div class="sp-block" data-testid="stripe-load-error"><ui-alert variant="danger">{{ text }}</ui-alert></div>
1355
1377
  }
1356
1378
  <div #mount class="sp-mount" [attr.id]="mountId() || null" [class]="mountClass()" [class.sp-mount--hidden]="mountHidden()" [attr.aria-hidden]="mountHidden() ? 'true' : null" [attr.inert]="mountHidden() ? '' : null"
1357
- role="group" [attr.aria-label]="label()" data-testid="stripe-mount"></div>
1358
- @if (achNoticeVisible()) {
1379
+ [attr.role]="mountOnly() ? null : 'group'" [attr.aria-label]="mountOnly() ? null : label()" data-testid="stripe-mount"></div>
1380
+ @if (!mountOnly() && achNoticeVisible()) {
1359
1381
  <div class="sp-block" [attr.data-testid]="achNoticeTestId()"><ui-alert variant="info">{{ achNotice() }}</ui-alert></div>
1360
1382
  }
1361
- @if (errorText(); as text) {
1383
+ @if (!mountOnly() && errorText(); as text) {
1362
1384
  <div class="sp-block" [id]="errorId" data-testid="stripe-error"><ui-alert variant="danger">{{ text }}</ui-alert></div>
1363
1385
  }
1364
- @if (showSubmit()) {
1386
+ @if (!mountOnly() && showSubmit()) {
1365
1387
  <div class="sp-actions">
1366
1388
  <ui-button variant="primary" type="button" [loading]="submitting()" [disabled]="submitDisabled()" [ariaDescribedBy]="errorText() ? errorId : undefined"
1367
1389
  data-testid="stripe-submit" (click)="confirm()">{{ effectiveSubmitLabel() }}</ui-button>
@@ -1393,6 +1415,7 @@ var StripePaymentComponent = class StripePaymentComponent {
1393
1415
  "variant",
1394
1416
  "routerLink",
1395
1417
  "queryParams",
1418
+ "fragment",
1396
1419
  "href",
1397
1420
  "target",
1398
1421
  "rel",
@@ -1444,29 +1467,31 @@ i0.ɵɵngDeclareClassMetadata({
1444
1467
  ButtonComponent,
1445
1468
  SkeletonComponent
1446
1469
  ],
1447
- host: { "[attr.aria-busy]": "loading() || submitting() ? \"true\" : null" },
1470
+ host: { "[attr.aria-busy]": "!mountOnly() && (loading() || submitting()) ? \"true\" : null" },
1448
1471
  template: `
1449
1472
  <div class="sp">
1450
- <div class="sp-sr" role="status" aria-live="polite" data-testid="stripe-status">{{ statusText() }}</div>
1451
- @if (loading() || pending()) {
1473
+ @if (!mountOnly() || a11yMessages()) {
1474
+ <div class="sp-sr" role="status" aria-live="polite" data-testid="stripe-status">{{ statusText() }}</div>
1475
+ }
1476
+ @if (!mountOnly() && (loading() || pending())) {
1452
1477
  <div class="sp-skeleton" data-testid="stripe-skeleton" aria-hidden="true">
1453
1478
  <ui-skeleton [height]="44" [mb]="10" />
1454
1479
  <ui-skeleton [height]="44" [mb]="10" />
1455
1480
  <ui-skeleton [height]="44" width="60%" />
1456
1481
  </div>
1457
1482
  }
1458
- @if (loadErrorText(); as text) {
1483
+ @if (!mountOnly() && loadErrorText(); as text) {
1459
1484
  <div class="sp-block" data-testid="stripe-load-error"><ui-alert variant="danger">{{ text }}</ui-alert></div>
1460
1485
  }
1461
1486
  <div #mount class="sp-mount" [attr.id]="mountId() || null" [class]="mountClass()" [class.sp-mount--hidden]="mountHidden()" [attr.aria-hidden]="mountHidden() ? 'true' : null" [attr.inert]="mountHidden() ? '' : null"
1462
- role="group" [attr.aria-label]="label()" data-testid="stripe-mount"></div>
1463
- @if (achNoticeVisible()) {
1487
+ [attr.role]="mountOnly() ? null : 'group'" [attr.aria-label]="mountOnly() ? null : label()" data-testid="stripe-mount"></div>
1488
+ @if (!mountOnly() && achNoticeVisible()) {
1464
1489
  <div class="sp-block" [attr.data-testid]="achNoticeTestId()"><ui-alert variant="info">{{ achNotice() }}</ui-alert></div>
1465
1490
  }
1466
- @if (errorText(); as text) {
1491
+ @if (!mountOnly() && errorText(); as text) {
1467
1492
  <div class="sp-block" [id]="errorId" data-testid="stripe-error"><ui-alert variant="danger">{{ text }}</ui-alert></div>
1468
1493
  }
1469
- @if (showSubmit()) {
1494
+ @if (!mountOnly() && showSubmit()) {
1470
1495
  <div class="sp-actions">
1471
1496
  <ui-button variant="primary" type="button" [loading]="submitting()" [disabled]="submitDisabled()" [ariaDescribedBy]="errorText() ? errorId : undefined"
1472
1497
  data-testid="stripe-submit" (click)="confirm()">{{ effectiveSubmitLabel() }}</ui-button>
@@ -1479,6 +1504,14 @@ i0.ɵɵngDeclareClassMetadata({
1479
1504
  }],
1480
1505
  ctorParameters: () => [],
1481
1506
  propDecorators: {
1507
+ mountOnly: [{
1508
+ type: i0.Input,
1509
+ args: [{
1510
+ isSignal: true,
1511
+ alias: "mountOnly",
1512
+ required: false
1513
+ }]
1514
+ }],
1482
1515
  mode: [{
1483
1516
  type: i0.Input,
1484
1517
  args: [{
@@ -1839,6 +1872,10 @@ i0.ɵɵngDeclareClassMetadata({
1839
1872
  required: false
1840
1873
  }]
1841
1874
  }],
1875
+ stripeReady: [{
1876
+ type: i0.Output,
1877
+ args: ["stripeReady"]
1878
+ }],
1842
1879
  ready: [{
1843
1880
  type: i0.Output,
1844
1881
  args: ["ready"]
@@ -2363,6 +2400,7 @@ var MicrodepositVerifyComponent = class MicrodepositVerifyComponent {
2363
2400
  "variant",
2364
2401
  "routerLink",
2365
2402
  "queryParams",
2403
+ "fragment",
2366
2404
  "href",
2367
2405
  "target",
2368
2406
  "rel",
@@ -2402,7 +2440,10 @@ var MicrodepositVerifyComponent = class MicrodepositVerifyComponent {
2402
2440
  "title",
2403
2441
  "description",
2404
2442
  "maxWidth",
2405
- "bodyOverflow"
2443
+ "bodyOverflow",
2444
+ "dialogTestId",
2445
+ "hideClose",
2446
+ "closable"
2406
2447
  ],
2407
2448
  outputs: ["close"]
2408
2449
  },
@@ -2424,6 +2465,7 @@ var MicrodepositVerifyComponent = class MicrodepositVerifyComponent {
2424
2465
  "label",
2425
2466
  "ariaLabel",
2426
2467
  "placeholder",
2468
+ "prefix",
2427
2469
  "type",
2428
2470
  "maxlength",
2429
2471
  "required",
@@ -2438,6 +2480,7 @@ var MicrodepositVerifyComponent = class MicrodepositVerifyComponent {
2438
2480
  "maxDecimals",
2439
2481
  "step",
2440
2482
  "valueType",
2483
+ "formatter",
2441
2484
  "showErrors",
2442
2485
  "disabled"
2443
2486
  ],