@mj-biz-apps/orders-ng 5.35.1 → 5.36.1

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.
Files changed (46) hide show
  1. package/dist/checkout-element/main.js +193 -82
  2. package/dist/lib/checkout-widget/checkout-complete.d.ts +53 -0
  3. package/dist/lib/checkout-widget/checkout-complete.d.ts.map +1 -0
  4. package/dist/lib/checkout-widget/checkout-complete.js +92 -0
  5. package/dist/lib/checkout-widget/checkout-complete.js.map +1 -0
  6. package/dist/lib/checkout-widget/checkout-public-host.component.d.ts +15 -0
  7. package/dist/lib/checkout-widget/checkout-public-host.component.d.ts.map +1 -1
  8. package/dist/lib/checkout-widget/checkout-public-host.component.js +126 -80
  9. package/dist/lib/checkout-widget/checkout-public-host.component.js.map +1 -1
  10. package/dist/lib/data/orders-grid-state.d.ts +4 -2
  11. package/dist/lib/data/orders-grid-state.d.ts.map +1 -1
  12. package/dist/lib/data/orders-grid-state.js +4 -2
  13. package/dist/lib/data/orders-grid-state.js.map +1 -1
  14. package/dist/lib/data/orders-queries.d.ts +20 -0
  15. package/dist/lib/data/orders-queries.d.ts.map +1 -1
  16. package/dist/lib/data/orders-queries.js +32 -1
  17. package/dist/lib/data/orders-queries.js.map +1 -1
  18. package/dist/lib/form-panels/document-forms.module.d.ts +26 -24
  19. package/dist/lib/form-panels/document-forms.module.d.ts.map +1 -1
  20. package/dist/lib/form-panels/document-forms.module.js +7 -0
  21. package/dist/lib/form-panels/document-forms.module.js.map +1 -1
  22. package/dist/lib/form-panels/document-overviews.panels.d.ts +3 -0
  23. package/dist/lib/form-panels/document-overviews.panels.d.ts.map +1 -1
  24. package/dist/lib/form-panels/document-overviews.panels.js +11 -4
  25. package/dist/lib/form-panels/document-overviews.panels.js.map +1 -1
  26. package/dist/lib/form-panels/subscription-cancel.component.d.ts +58 -0
  27. package/dist/lib/form-panels/subscription-cancel.component.d.ts.map +1 -0
  28. package/dist/lib/form-panels/subscription-cancel.component.js +303 -0
  29. package/dist/lib/form-panels/subscription-cancel.component.js.map +1 -0
  30. package/dist/lib/form-panels/subscription-header.panel.d.ts +7 -0
  31. package/dist/lib/form-panels/subscription-header.panel.d.ts.map +1 -1
  32. package/dist/lib/form-panels/subscription-header.panel.js +22 -4
  33. package/dist/lib/form-panels/subscription-header.panel.js.map +1 -1
  34. package/dist/lib/pages/orders/order-document.page.d.ts.map +1 -1
  35. package/dist/lib/pages/orders/order-document.page.js +7 -2
  36. package/dist/lib/pages/orders/order-document.page.js.map +1 -1
  37. package/dist/lib/pages/orders/orders-dashboard.page.d.ts +11 -11
  38. package/dist/lib/pages/orders/orders-dashboard.page.d.ts.map +1 -1
  39. package/dist/lib/pages/orders/orders-dashboard.page.js +2 -2
  40. package/dist/lib/pages/orders/orders-dashboard.page.js.map +1 -1
  41. package/dist/lib/pages/receivables/customer-ar.page.js +2 -2
  42. package/dist/lib/pages/receivables/customer-ar.page.js.map +1 -1
  43. package/dist/lib/sections/orders-sections.component.d.ts.map +1 -1
  44. package/dist/lib/sections/orders-sections.component.js +5 -4
  45. package/dist/lib/sections/orders-sections.component.js.map +1 -1
  46. package/package.json +28 -28
@@ -39326,6 +39326,66 @@ var TurnstileWidget = class {
39326
39326
  }
39327
39327
  };
39328
39328
 
39329
+ // dist/lib/checkout-widget/checkout-complete.js
39330
+ var COMPLETE_RETRY_INTERVAL_MS = 3e3;
39331
+ var COMPLETE_RETRY_TIMEOUT_MS = 12e4;
39332
+ var COMPLETE_FINISHING_MESSAGE = "Payment received. Finishing your order\u2026";
39333
+ var COMPLETE_DELAYED_MESSAGE = "Your payment went through, but confirming your order is taking longer than usual. Please do not pay again. Contact support if you need your order confirmation.";
39334
+ var CHECKOUT_UNREACHABLE_MESSAGE = "Checkout could not reach the server. Please try again.";
39335
+ var CheckoutTransportError = class extends Error {
39336
+ HttpStatus;
39337
+ constructor(HttpStatus) {
39338
+ super(CHECKOUT_UNREACHABLE_MESSAGE);
39339
+ this.HttpStatus = HttpStatus;
39340
+ this.name = "CheckoutTransportError";
39341
+ }
39342
+ };
39343
+ async function ReadCheckoutReply(res) {
39344
+ let json;
39345
+ try {
39346
+ json = await res.json();
39347
+ } catch {
39348
+ throw new CheckoutTransportError(res.status);
39349
+ }
39350
+ if (!json || typeof json !== "object" || Array.isArray(json)) {
39351
+ throw new CheckoutTransportError(res.status);
39352
+ }
39353
+ const reply = json;
39354
+ reply._httpStatus = res.status;
39355
+ return reply;
39356
+ }
39357
+ function CompleteStillProcessing(reply) {
39358
+ return !!reply && reply.Success !== true && reply.Status === "Processing";
39359
+ }
39360
+ async function CompleteWithRetry(send, options = {}) {
39361
+ const interval = options.intervalMs ?? COMPLETE_RETRY_INTERVAL_MS;
39362
+ const now = options.now ?? (() => Date.now());
39363
+ const sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
39364
+ const deadline = now() + (options.timeoutMs ?? COMPLETE_RETRY_TIMEOUT_MS);
39365
+ let waiting = false;
39366
+ for (; ; ) {
39367
+ let reply = null;
39368
+ try {
39369
+ reply = await send();
39370
+ } catch (err) {
39371
+ if (!(err instanceof CheckoutTransportError)) {
39372
+ throw err;
39373
+ }
39374
+ }
39375
+ if (reply && !CompleteStillProcessing(reply)) {
39376
+ return reply;
39377
+ }
39378
+ if (!waiting) {
39379
+ waiting = true;
39380
+ options.onWaiting?.();
39381
+ }
39382
+ if (now() >= deadline) {
39383
+ return null;
39384
+ }
39385
+ await sleep(interval);
39386
+ }
39387
+ }
39388
+
39329
39389
  // dist/lib/checkout-widget/checkout-renewal.js
39330
39390
  function ReadRenewalPayment(response) {
39331
39391
  if (!response || typeof response !== "object")
@@ -39369,7 +39429,7 @@ function CheckoutPublicHostComponent_Conditional_1_Template(rf, ctx) {
39369
39429
  }
39370
39430
  function CheckoutPublicHostComponent_Conditional_2_Conditional_7_Template(rf, ctx) {
39371
39431
  if (rf & 1) {
39372
- \u0275\u0275elementStart(0, "p", 9);
39432
+ \u0275\u0275elementStart(0, "p", 10);
39373
39433
  \u0275\u0275text(1);
39374
39434
  \u0275\u0275elementEnd();
39375
39435
  }
@@ -39381,7 +39441,7 @@ function CheckoutPublicHostComponent_Conditional_2_Conditional_7_Template(rf, ct
39381
39441
  }
39382
39442
  function CheckoutPublicHostComponent_Conditional_2_Conditional_8_Template(rf, ctx) {
39383
39443
  if (rf & 1) {
39384
- \u0275\u0275elementStart(0, "p", 13);
39444
+ \u0275\u0275elementStart(0, "p", 14);
39385
39445
  \u0275\u0275text(1);
39386
39446
  \u0275\u0275elementEnd();
39387
39447
  }
@@ -39394,14 +39454,14 @@ function CheckoutPublicHostComponent_Conditional_2_Conditional_8_Template(rf, ct
39394
39454
  }
39395
39455
  function CheckoutPublicHostComponent_Conditional_2_Conditional_9_Template(rf, ctx) {
39396
39456
  if (rf & 1) {
39397
- \u0275\u0275elementStart(0, "p", 11);
39457
+ \u0275\u0275elementStart(0, "p", 12);
39398
39458
  \u0275\u0275text(1, "Setting up your account\u2026");
39399
39459
  \u0275\u0275elementEnd();
39400
39460
  }
39401
39461
  }
39402
39462
  function CheckoutPublicHostComponent_Conditional_2_Conditional_10_Conditional_3_Template(rf, ctx) {
39403
39463
  if (rf & 1) {
39404
- \u0275\u0275elementStart(0, "p", 16);
39464
+ \u0275\u0275elementStart(0, "p", 17);
39405
39465
  \u0275\u0275text(1);
39406
39466
  \u0275\u0275elementEnd();
39407
39467
  }
@@ -39413,7 +39473,7 @@ function CheckoutPublicHostComponent_Conditional_2_Conditional_10_Conditional_3_
39413
39473
  }
39414
39474
  function CheckoutPublicHostComponent_Conditional_2_Conditional_10_Conditional_10_Template(rf, ctx) {
39415
39475
  if (rf & 1) {
39416
- \u0275\u0275elementStart(0, "p", 21);
39476
+ \u0275\u0275elementStart(0, "p", 22);
39417
39477
  \u0275\u0275text(1);
39418
39478
  \u0275\u0275elementEnd();
39419
39479
  }
@@ -39426,42 +39486,42 @@ function CheckoutPublicHostComponent_Conditional_2_Conditional_10_Conditional_10
39426
39486
  function CheckoutPublicHostComponent_Conditional_2_Conditional_10_Template(rf, ctx) {
39427
39487
  if (rf & 1) {
39428
39488
  const _r2 = \u0275\u0275getCurrentView();
39429
- \u0275\u0275elementStart(0, "form", 14);
39489
+ \u0275\u0275elementStart(0, "form", 15);
39430
39490
  \u0275\u0275listener("submit", function CheckoutPublicHostComponent_Conditional_2_Conditional_10_Template_form_submit_0_listener($event) {
39431
39491
  \u0275\u0275restoreView(_r2);
39432
39492
  const ctx_r0 = \u0275\u0275nextContext(2);
39433
39493
  $event.preventDefault();
39434
39494
  return \u0275\u0275resetView(ctx_r0.submitPassword());
39435
39495
  });
39436
- \u0275\u0275elementStart(1, "h2", 15);
39496
+ \u0275\u0275elementStart(1, "h2", 16);
39437
39497
  \u0275\u0275text(2, "Set a password for your account");
39438
39498
  \u0275\u0275elementEnd();
39439
- \u0275\u0275conditionalCreate(3, CheckoutPublicHostComponent_Conditional_2_Conditional_10_Conditional_3_Template, 2, 1, "p", 16);
39440
- \u0275\u0275elementStart(4, "label", 17);
39499
+ \u0275\u0275conditionalCreate(3, CheckoutPublicHostComponent_Conditional_2_Conditional_10_Conditional_3_Template, 2, 1, "p", 17);
39500
+ \u0275\u0275elementStart(4, "label", 18);
39441
39501
  \u0275\u0275text(5, "Password");
39442
39502
  \u0275\u0275elementEnd();
39443
- \u0275\u0275elementStart(6, "input", 18);
39503
+ \u0275\u0275elementStart(6, "input", 19);
39444
39504
  \u0275\u0275listener("input", function CheckoutPublicHostComponent_Conditional_2_Conditional_10_Template_input_input_6_listener($event) {
39445
39505
  \u0275\u0275restoreView(_r2);
39446
39506
  const ctx_r0 = \u0275\u0275nextContext(2);
39447
39507
  return \u0275\u0275resetView(ctx_r0.password = $event.target.value);
39448
39508
  });
39449
39509
  \u0275\u0275elementEnd();
39450
- \u0275\u0275elementStart(7, "label", 19);
39510
+ \u0275\u0275elementStart(7, "label", 20);
39451
39511
  \u0275\u0275text(8, "Confirm password");
39452
39512
  \u0275\u0275elementEnd();
39453
- \u0275\u0275elementStart(9, "input", 20);
39513
+ \u0275\u0275elementStart(9, "input", 21);
39454
39514
  \u0275\u0275listener("input", function CheckoutPublicHostComponent_Conditional_2_Conditional_10_Template_input_input_9_listener($event) {
39455
39515
  \u0275\u0275restoreView(_r2);
39456
39516
  const ctx_r0 = \u0275\u0275nextContext(2);
39457
39517
  return \u0275\u0275resetView(ctx_r0.passwordConfirmation = $event.target.value);
39458
39518
  });
39459
39519
  \u0275\u0275elementEnd();
39460
- \u0275\u0275conditionalCreate(10, CheckoutPublicHostComponent_Conditional_2_Conditional_10_Conditional_10_Template, 2, 1, "p", 21);
39461
- \u0275\u0275elementStart(11, "button", 22);
39520
+ \u0275\u0275conditionalCreate(10, CheckoutPublicHostComponent_Conditional_2_Conditional_10_Conditional_10_Template, 2, 1, "p", 22);
39521
+ \u0275\u0275elementStart(11, "button", 23);
39462
39522
  \u0275\u0275text(12);
39463
39523
  \u0275\u0275elementEnd();
39464
- \u0275\u0275elementStart(13, "button", 23);
39524
+ \u0275\u0275elementStart(13, "button", 24);
39465
39525
  \u0275\u0275listener("click", function CheckoutPublicHostComponent_Conditional_2_Conditional_10_Template_button_click_13_listener() {
39466
39526
  \u0275\u0275restoreView(_r2);
39467
39527
  const ctx_r0 = \u0275\u0275nextContext(2);
@@ -39491,7 +39551,7 @@ function CheckoutPublicHostComponent_Conditional_2_Conditional_10_Template(rf, c
39491
39551
  function CheckoutPublicHostComponent_Conditional_2_Conditional_11_Conditional_2_Conditional_3_Template(rf, ctx) {
39492
39552
  if (rf & 1) {
39493
39553
  const _r4 = \u0275\u0275getCurrentView();
39494
- \u0275\u0275elementStart(0, "button", 27);
39554
+ \u0275\u0275elementStart(0, "button", 28);
39495
39555
  \u0275\u0275listener("click", function CheckoutPublicHostComponent_Conditional_2_Conditional_11_Conditional_2_Conditional_3_Template_button_click_0_listener() {
39496
39556
  \u0275\u0275restoreView(_r4);
39497
39557
  const ctx_r0 = \u0275\u0275nextContext(4);
@@ -39504,7 +39564,7 @@ function CheckoutPublicHostComponent_Conditional_2_Conditional_11_Conditional_2_
39504
39564
  function CheckoutPublicHostComponent_Conditional_2_Conditional_11_Conditional_2_Template(rf, ctx) {
39505
39565
  if (rf & 1) {
39506
39566
  const _r3 = \u0275\u0275getCurrentView();
39507
- \u0275\u0275elementStart(0, "div", 24)(1, "button", 25);
39567
+ \u0275\u0275elementStart(0, "div", 25)(1, "button", 26);
39508
39568
  \u0275\u0275listener("click", function CheckoutPublicHostComponent_Conditional_2_Conditional_11_Conditional_2_Template_button_click_1_listener() {
39509
39569
  \u0275\u0275restoreView(_r3);
39510
39570
  const ctx_r0 = \u0275\u0275nextContext(3);
@@ -39512,7 +39572,7 @@ function CheckoutPublicHostComponent_Conditional_2_Conditional_11_Conditional_2_
39512
39572
  });
39513
39573
  \u0275\u0275text(2, "Try again");
39514
39574
  \u0275\u0275elementEnd();
39515
- \u0275\u0275conditionalCreate(3, CheckoutPublicHostComponent_Conditional_2_Conditional_11_Conditional_2_Conditional_3_Template, 2, 0, "button", 26);
39575
+ \u0275\u0275conditionalCreate(3, CheckoutPublicHostComponent_Conditional_2_Conditional_11_Conditional_2_Conditional_3_Template, 2, 0, "button", 27);
39516
39576
  \u0275\u0275elementEnd();
39517
39577
  }
39518
39578
  if (rf & 2) {
@@ -39523,10 +39583,10 @@ function CheckoutPublicHostComponent_Conditional_2_Conditional_11_Conditional_2_
39523
39583
  }
39524
39584
  function CheckoutPublicHostComponent_Conditional_2_Conditional_11_Template(rf, ctx) {
39525
39585
  if (rf & 1) {
39526
- \u0275\u0275elementStart(0, "p", 11);
39586
+ \u0275\u0275elementStart(0, "p", 12);
39527
39587
  \u0275\u0275text(1);
39528
39588
  \u0275\u0275elementEnd();
39529
- \u0275\u0275conditionalCreate(2, CheckoutPublicHostComponent_Conditional_2_Conditional_11_Conditional_2_Template, 4, 1, "div", 24);
39589
+ \u0275\u0275conditionalCreate(2, CheckoutPublicHostComponent_Conditional_2_Conditional_11_Conditional_2_Template, 4, 1, "div", 25);
39530
39590
  }
39531
39591
  if (rf & 2) {
39532
39592
  const ctx_r0 = \u0275\u0275nextContext(2);
@@ -39538,18 +39598,18 @@ function CheckoutPublicHostComponent_Conditional_2_Conditional_11_Template(rf, c
39538
39598
  }
39539
39599
  function CheckoutPublicHostComponent_Conditional_2_Template(rf, ctx) {
39540
39600
  if (rf & 1) {
39541
- \u0275\u0275elementStart(0, "div", 2)(1, "div", 6);
39601
+ \u0275\u0275elementStart(0, "div", 2)(1, "div", 7);
39542
39602
  \u0275\u0275text(2, "\u2713");
39543
39603
  \u0275\u0275elementEnd();
39544
- \u0275\u0275elementStart(3, "h1", 7);
39604
+ \u0275\u0275elementStart(3, "h1", 8);
39545
39605
  \u0275\u0275text(4, "You're all set");
39546
39606
  \u0275\u0275elementEnd();
39547
- \u0275\u0275elementStart(5, "p", 8);
39607
+ \u0275\u0275elementStart(5, "p", 9);
39548
39608
  \u0275\u0275text(6);
39549
39609
  \u0275\u0275elementEnd();
39550
- \u0275\u0275conditionalCreate(7, CheckoutPublicHostComponent_Conditional_2_Conditional_7_Template, 2, 1, "p", 9);
39551
- \u0275\u0275conditionalCreate(8, CheckoutPublicHostComponent_Conditional_2_Conditional_8_Template, 2, 3, "p", 10);
39552
- \u0275\u0275conditionalCreate(9, CheckoutPublicHostComponent_Conditional_2_Conditional_9_Template, 2, 0, "p", 11)(10, CheckoutPublicHostComponent_Conditional_2_Conditional_10_Template, 15, 7, "form", 12)(11, CheckoutPublicHostComponent_Conditional_2_Conditional_11_Template, 3, 2);
39610
+ \u0275\u0275conditionalCreate(7, CheckoutPublicHostComponent_Conditional_2_Conditional_7_Template, 2, 1, "p", 10);
39611
+ \u0275\u0275conditionalCreate(8, CheckoutPublicHostComponent_Conditional_2_Conditional_8_Template, 2, 3, "p", 11);
39612
+ \u0275\u0275conditionalCreate(9, CheckoutPublicHostComponent_Conditional_2_Conditional_9_Template, 2, 0, "p", 12)(10, CheckoutPublicHostComponent_Conditional_2_Conditional_10_Template, 15, 7, "form", 13)(11, CheckoutPublicHostComponent_Conditional_2_Conditional_11_Template, 3, 2);
39553
39613
  \u0275\u0275elementEnd();
39554
39614
  }
39555
39615
  if (rf & 2) {
@@ -39566,14 +39626,26 @@ function CheckoutPublicHostComponent_Conditional_2_Template(rf, ctx) {
39566
39626
  }
39567
39627
  function CheckoutPublicHostComponent_Conditional_3_Template(rf, ctx) {
39568
39628
  if (rf & 1) {
39569
- \u0275\u0275elementStart(0, "p", 3);
39629
+ \u0275\u0275elementStart(0, "div", 3)(1, "p", 9);
39630
+ \u0275\u0275text(2);
39631
+ \u0275\u0275elementEnd()();
39632
+ }
39633
+ if (rf & 2) {
39634
+ const ctx_r0 = \u0275\u0275nextContext();
39635
+ \u0275\u0275advance(2);
39636
+ \u0275\u0275textInterpolate(ctx_r0.finishingMessage);
39637
+ }
39638
+ }
39639
+ function CheckoutPublicHostComponent_Conditional_4_Template(rf, ctx) {
39640
+ if (rf & 1) {
39641
+ \u0275\u0275elementStart(0, "p", 4);
39570
39642
  \u0275\u0275text(1, "Loading checkout\u2026");
39571
39643
  \u0275\u0275elementEnd();
39572
39644
  }
39573
39645
  }
39574
- function CheckoutPublicHostComponent_Conditional_4_Conditional_6_Template(rf, ctx) {
39646
+ function CheckoutPublicHostComponent_Conditional_5_Conditional_6_Template(rf, ctx) {
39575
39647
  if (rf & 1) {
39576
- \u0275\u0275elementStart(0, "div", 32)(1, "dt");
39648
+ \u0275\u0275elementStart(0, "div", 33)(1, "dt");
39577
39649
  \u0275\u0275text(2, "Renewal of");
39578
39650
  \u0275\u0275elementEnd();
39579
39651
  \u0275\u0275elementStart(3, "dd");
@@ -39586,9 +39658,9 @@ function CheckoutPublicHostComponent_Conditional_4_Conditional_6_Template(rf, ct
39586
39658
  \u0275\u0275textInterpolate(ctx_r0.renewal.Description);
39587
39659
  }
39588
39660
  }
39589
- function CheckoutPublicHostComponent_Conditional_4_Conditional_7_Template(rf, ctx) {
39661
+ function CheckoutPublicHostComponent_Conditional_5_Conditional_7_Template(rf, ctx) {
39590
39662
  if (rf & 1) {
39591
- \u0275\u0275elementStart(0, "div", 32)(1, "dt");
39663
+ \u0275\u0275elementStart(0, "div", 33)(1, "dt");
39592
39664
  \u0275\u0275text(2, "Subscription");
39593
39665
  \u0275\u0275elementEnd();
39594
39666
  \u0275\u0275elementStart(3, "dd");
@@ -39601,9 +39673,9 @@ function CheckoutPublicHostComponent_Conditional_4_Conditional_7_Template(rf, ct
39601
39673
  \u0275\u0275textInterpolate(ctx_r0.renewal.SubscriptionNumber);
39602
39674
  }
39603
39675
  }
39604
- function CheckoutPublicHostComponent_Conditional_4_Conditional_13_Template(rf, ctx) {
39676
+ function CheckoutPublicHostComponent_Conditional_5_Conditional_13_Template(rf, ctx) {
39605
39677
  if (rf & 1) {
39606
- \u0275\u0275elementStart(0, "div", 32)(1, "dt");
39678
+ \u0275\u0275elementStart(0, "div", 33)(1, "dt");
39607
39679
  \u0275\u0275text(2, "Due");
39608
39680
  \u0275\u0275elementEnd();
39609
39681
  \u0275\u0275elementStart(3, "dd");
@@ -39616,15 +39688,15 @@ function CheckoutPublicHostComponent_Conditional_4_Conditional_13_Template(rf, c
39616
39688
  \u0275\u0275textInterpolate(ctx_r0.renewal.DueDate);
39617
39689
  }
39618
39690
  }
39619
- function CheckoutPublicHostComponent_Conditional_4_Conditional_19_Template(rf, ctx) {
39691
+ function CheckoutPublicHostComponent_Conditional_5_Conditional_19_Template(rf, ctx) {
39620
39692
  if (rf & 1) {
39621
- \u0275\u0275elementStart(0, "label", 36);
39693
+ \u0275\u0275elementStart(0, "label", 37);
39622
39694
  \u0275\u0275text(1, "Card");
39623
39695
  \u0275\u0275elementEnd();
39624
- \u0275\u0275element(2, "div", 37);
39696
+ \u0275\u0275element(2, "div", 38);
39625
39697
  }
39626
39698
  }
39627
- function CheckoutPublicHostComponent_Conditional_4_Conditional_22_Template(rf, ctx) {
39699
+ function CheckoutPublicHostComponent_Conditional_5_Conditional_22_Template(rf, ctx) {
39628
39700
  if (rf & 1) {
39629
39701
  \u0275\u0275elementStart(0, "div", 1);
39630
39702
  \u0275\u0275text(1);
@@ -39636,44 +39708,44 @@ function CheckoutPublicHostComponent_Conditional_4_Conditional_22_Template(rf, c
39636
39708
  \u0275\u0275textInterpolate(ctx_r0.errorMessage);
39637
39709
  }
39638
39710
  }
39639
- function CheckoutPublicHostComponent_Conditional_4_Template(rf, ctx) {
39711
+ function CheckoutPublicHostComponent_Conditional_5_Template(rf, ctx) {
39640
39712
  if (rf & 1) {
39641
39713
  const _r5 = \u0275\u0275getCurrentView();
39642
- \u0275\u0275elementStart(0, "form", 28);
39643
- \u0275\u0275listener("submit", function CheckoutPublicHostComponent_Conditional_4_Template_form_submit_0_listener($event) {
39714
+ \u0275\u0275elementStart(0, "form", 29);
39715
+ \u0275\u0275listener("submit", function CheckoutPublicHostComponent_Conditional_5_Template_form_submit_0_listener($event) {
39644
39716
  \u0275\u0275restoreView(_r5);
39645
39717
  const ctx_r0 = \u0275\u0275nextContext();
39646
39718
  $event.preventDefault();
39647
39719
  return \u0275\u0275resetView(ctx_r0.payRenewal());
39648
39720
  });
39649
- \u0275\u0275elementStart(1, "h1", 29);
39721
+ \u0275\u0275elementStart(1, "h1", 30);
39650
39722
  \u0275\u0275text(2, "Renew your subscription");
39651
39723
  \u0275\u0275elementEnd();
39652
- \u0275\u0275elementStart(3, "p", 30);
39724
+ \u0275\u0275elementStart(3, "p", 31);
39653
39725
  \u0275\u0275text(4, "Your saved card could not be charged. Pay with a new card to keep your subscription active.");
39654
39726
  \u0275\u0275elementEnd();
39655
- \u0275\u0275elementStart(5, "dl", 31);
39656
- \u0275\u0275conditionalCreate(6, CheckoutPublicHostComponent_Conditional_4_Conditional_6_Template, 5, 1, "div", 32);
39657
- \u0275\u0275conditionalCreate(7, CheckoutPublicHostComponent_Conditional_4_Conditional_7_Template, 5, 1, "div", 32);
39658
- \u0275\u0275elementStart(8, "div", 32)(9, "dt");
39727
+ \u0275\u0275elementStart(5, "dl", 32);
39728
+ \u0275\u0275conditionalCreate(6, CheckoutPublicHostComponent_Conditional_5_Conditional_6_Template, 5, 1, "div", 33);
39729
+ \u0275\u0275conditionalCreate(7, CheckoutPublicHostComponent_Conditional_5_Conditional_7_Template, 5, 1, "div", 33);
39730
+ \u0275\u0275elementStart(8, "div", 33)(9, "dt");
39659
39731
  \u0275\u0275text(10, "Renewal order");
39660
39732
  \u0275\u0275elementEnd();
39661
39733
  \u0275\u0275elementStart(11, "dd");
39662
39734
  \u0275\u0275text(12);
39663
39735
  \u0275\u0275elementEnd()();
39664
- \u0275\u0275conditionalCreate(13, CheckoutPublicHostComponent_Conditional_4_Conditional_13_Template, 5, 1, "div", 32);
39665
- \u0275\u0275elementStart(14, "div", 33)(15, "dt");
39736
+ \u0275\u0275conditionalCreate(13, CheckoutPublicHostComponent_Conditional_5_Conditional_13_Template, 5, 1, "div", 33);
39737
+ \u0275\u0275elementStart(14, "div", 34)(15, "dt");
39666
39738
  \u0275\u0275text(16, "Amount due");
39667
39739
  \u0275\u0275elementEnd();
39668
39740
  \u0275\u0275elementStart(17, "dd");
39669
39741
  \u0275\u0275text(18);
39670
39742
  \u0275\u0275elementEnd()()();
39671
- \u0275\u0275conditionalCreate(19, CheckoutPublicHostComponent_Conditional_4_Conditional_19_Template, 3, 0);
39672
- \u0275\u0275elementStart(20, "p", 34);
39743
+ \u0275\u0275conditionalCreate(19, CheckoutPublicHostComponent_Conditional_5_Conditional_19_Template, 3, 0);
39744
+ \u0275\u0275elementStart(20, "p", 35);
39673
39745
  \u0275\u0275text(21, "The card you pay with will be charged for future renewals.");
39674
39746
  \u0275\u0275elementEnd();
39675
- \u0275\u0275conditionalCreate(22, CheckoutPublicHostComponent_Conditional_4_Conditional_22_Template, 2, 1, "div", 1);
39676
- \u0275\u0275elementStart(23, "button", 35);
39747
+ \u0275\u0275conditionalCreate(22, CheckoutPublicHostComponent_Conditional_5_Conditional_22_Template, 2, 1, "div", 1);
39748
+ \u0275\u0275elementStart(23, "button", 36);
39677
39749
  \u0275\u0275text(24);
39678
39750
  \u0275\u0275elementEnd()();
39679
39751
  }
@@ -39699,23 +39771,23 @@ function CheckoutPublicHostComponent_Conditional_4_Template(rf, ctx) {
39699
39771
  \u0275\u0275textInterpolate1(" ", ctx_r0.processing ? "Processing\u2026" : "Pay " + ctx_r0.renewalAmount, " ");
39700
39772
  }
39701
39773
  }
39702
- function CheckoutPublicHostComponent_Conditional_5_For_1_Template(rf, ctx) {
39774
+ function CheckoutPublicHostComponent_Conditional_6_For_1_Template(rf, ctx) {
39703
39775
  if (rf & 1) {
39704
39776
  const _r6 = \u0275\u0275getCurrentView();
39705
- \u0275\u0275elementStart(0, "mj-checkout-widget", 39);
39706
- \u0275\u0275listener("promotionCodeApplied", function CheckoutPublicHostComponent_Conditional_5_For_1_Template_mj_checkout_widget_promotionCodeApplied_0_listener($event) {
39777
+ \u0275\u0275elementStart(0, "mj-checkout-widget", 40);
39778
+ \u0275\u0275listener("promotionCodeApplied", function CheckoutPublicHostComponent_Conditional_6_For_1_Template_mj_checkout_widget_promotionCodeApplied_0_listener($event) {
39707
39779
  \u0275\u0275restoreView(_r6);
39708
39780
  const ctx_r0 = \u0275\u0275nextContext(2);
39709
39781
  return \u0275\u0275resetView(ctx_r0.onPromotionCodeApplied($event));
39710
- })("submitted", function CheckoutPublicHostComponent_Conditional_5_For_1_Template_mj_checkout_widget_submitted_0_listener($event) {
39782
+ })("submitted", function CheckoutPublicHostComponent_Conditional_6_For_1_Template_mj_checkout_widget_submitted_0_listener($event) {
39711
39783
  \u0275\u0275restoreView(_r6);
39712
39784
  const ctx_r0 = \u0275\u0275nextContext(2);
39713
39785
  return \u0275\u0275resetView(ctx_r0.onSubmitted($event));
39714
- })("cancelled", function CheckoutPublicHostComponent_Conditional_5_For_1_Template_mj_checkout_widget_cancelled_0_listener() {
39786
+ })("cancelled", function CheckoutPublicHostComponent_Conditional_6_For_1_Template_mj_checkout_widget_cancelled_0_listener() {
39715
39787
  \u0275\u0275restoreView(_r6);
39716
39788
  const ctx_r0 = \u0275\u0275nextContext(2);
39717
39789
  return \u0275\u0275resetView(ctx_r0.onCancelled());
39718
- })("quoteInvalidated", function CheckoutPublicHostComponent_Conditional_5_For_1_Template_mj_checkout_widget_quoteInvalidated_0_listener() {
39790
+ })("quoteInvalidated", function CheckoutPublicHostComponent_Conditional_6_For_1_Template_mj_checkout_widget_quoteInvalidated_0_listener() {
39719
39791
  \u0275\u0275restoreView(_r6);
39720
39792
  const ctx_r0 = \u0275\u0275nextContext(2);
39721
39793
  return \u0275\u0275resetView(ctx_r0.onQuoteInvalidated());
@@ -39727,9 +39799,9 @@ function CheckoutPublicHostComponent_Conditional_5_For_1_Template(rf, ctx) {
39727
39799
  \u0275\u0275property("config", ctx_r0.config)("distributionSlug", ctx_r0.slug)("sessionKey", ctx_r0.sessionKey)("isProcessing", ctx_r0.processing)("isPaymentReady", ctx_r0.isPaymentReady)("stripePaymentMethodId", ctx_r0.stripePaymentMethodId)("prefillEmail", ctx_r0.prefillEmail)("errorMessage", ctx_r0.errorMessage)("appliedPromotion", ctx_r0.appliedPromotion)("serverPricedTotal", ctx_r0.serverPricedTotal)("promotionError", ctx_r0.promotionError)("quotedTotal", ctx_r0.quotedTotal)("quotedTax", ctx_r0.quotedTax);
39728
39800
  }
39729
39801
  }
39730
- function CheckoutPublicHostComponent_Conditional_5_Template(rf, ctx) {
39802
+ function CheckoutPublicHostComponent_Conditional_6_Template(rf, ctx) {
39731
39803
  if (rf & 1) {
39732
- \u0275\u0275repeaterCreate(0, CheckoutPublicHostComponent_Conditional_5_For_1_Template, 1, 13, "mj-checkout-widget", 38, \u0275\u0275repeaterTrackByIdentity);
39804
+ \u0275\u0275repeaterCreate(0, CheckoutPublicHostComponent_Conditional_6_For_1_Template, 1, 13, "mj-checkout-widget", 39, \u0275\u0275repeaterTrackByIdentity);
39733
39805
  }
39734
39806
  if (rf & 2) {
39735
39807
  const ctx_r0 = \u0275\u0275nextContext();
@@ -39802,6 +39874,14 @@ var CheckoutPublicHostComponent = class _CheckoutPublicHostComponent {
39802
39874
  accessPollTimeoutMs = ACCESS_POLL_TIMEOUT_MS;
39803
39875
  /** True while access is being asked for; the redirect waits on it. */
39804
39876
  accessTracking = false;
39877
+ /**
39878
+ * Shown in place of the form once the buyer has paid and `/complete` has not given a final
39879
+ * answer (the reply was a gateway error page, or the session is still Processing).
39880
+ */
39881
+ finishingMessage = null;
39882
+ /** How often, and for how long, `/complete` is asked again. Fields so a test can shorten them. */
39883
+ completeRetryIntervalMs = COMPLETE_RETRY_INTERVAL_MS;
39884
+ completeRetryTimeoutMs = COMPLETE_RETRY_TIMEOUT_MS;
39805
39885
  get accessMessage() {
39806
39886
  return AccessMessage(this.accessState, this.config?.accessMessages);
39807
39887
  }
@@ -40167,12 +40247,15 @@ var CheckoutPublicHostComponent = class _CheckoutPublicHostComponent {
40167
40247
  }
40168
40248
  }
40169
40249
  }
40170
- const done = await this.post("/complete", {
40250
+ const done = await this.completeAfterPayment(() => this.post("/complete", {
40171
40251
  sessionId: this.sessionId,
40172
40252
  clientSessionKey: this.sessionKey
40173
- });
40174
- if (!done?.Success) {
40175
- throw new Error(this.str(done?.ErrorMessage, "Could not complete the payment."));
40253
+ }));
40254
+ if (!done) {
40255
+ return;
40256
+ }
40257
+ if (!done.Success) {
40258
+ throw new Error(this.str(done.ErrorMessage, "Could not complete the payment."));
40176
40259
  }
40177
40260
  this.orderNumber = this.renewal.OrderNumber;
40178
40261
  this.successMessage = RenewalPaidMessage(this.renewal);
@@ -40217,12 +40300,15 @@ var CheckoutPublicHostComponent = class _CheckoutPublicHostComponent {
40217
40300
  }
40218
40301
  async finish() {
40219
40302
  this.rememberCompleting(this.sessionId);
40220
- const done = await this.postGated("/complete", {
40303
+ const done = await this.completeAfterPayment(() => this.postGated("/complete", {
40221
40304
  sessionId: this.sessionId,
40222
40305
  clientSessionKey: this.sessionKey
40223
- });
40224
- if (!done?.Success) {
40225
- throw new Error(this.str(done?.ErrorMessage, "Could not complete checkout."));
40306
+ }));
40307
+ if (!done) {
40308
+ return;
40309
+ }
40310
+ if (!done.Success) {
40311
+ throw new Error(this.str(done.ErrorMessage, "Could not complete checkout."));
40226
40312
  }
40227
40313
  this.orderNumber = done.OrderNumber ? String(done.OrderNumber) : null;
40228
40314
  this.successMessage = this.config?.successMessage || (this.orderNumber ? `Thank you. Order ${this.orderNumber} is confirmed.` : "Thank you. Your order is confirmed.");
@@ -40554,16 +40640,37 @@ var CheckoutPublicHostComponent = class _CheckoutPublicHostComponent {
40554
40640
  return null;
40555
40641
  }
40556
40642
  }
40557
- async post(path, body) {
40558
- const res = await fetch(`${this.apiRoot}${path}`, {
40559
- method: "POST",
40560
- headers: { "Content-Type": "application/json" },
40561
- credentials: "same-origin",
40562
- body: JSON.stringify(body)
40643
+ /**
40644
+ * Sends `/complete` for a checkout the buyer has paid for, asking again while the server may
40645
+ * still be finishing. Returns the server's final answer, or null when the wait ran out; the
40646
+ * buyer then sees that the payment went through, never a failure.
40647
+ */
40648
+ async completeAfterPayment(send) {
40649
+ const done = await CompleteWithRetry(send, {
40650
+ intervalMs: this.completeRetryIntervalMs,
40651
+ timeoutMs: this.completeRetryTimeoutMs,
40652
+ onWaiting: () => {
40653
+ this.finishingMessage = COMPLETE_FINISHING_MESSAGE;
40654
+ this.cdr.detectChanges();
40655
+ }
40563
40656
  });
40564
- const json = await res.json();
40565
- json._httpStatus = res.status;
40566
- return json;
40657
+ this.finishingMessage = done ? null : COMPLETE_DELAYED_MESSAGE;
40658
+ return done;
40659
+ }
40660
+ /** Throws {@link CheckoutTransportError}, whose message is written for the buyer, when no JSON reply arrives. */
40661
+ async post(path, body) {
40662
+ let res;
40663
+ try {
40664
+ res = await fetch(`${this.apiRoot}${path}`, {
40665
+ method: "POST",
40666
+ headers: { "Content-Type": "application/json" },
40667
+ credentials: "same-origin",
40668
+ body: JSON.stringify(body)
40669
+ });
40670
+ } catch {
40671
+ throw new CheckoutTransportError(null);
40672
+ }
40673
+ return ReadCheckoutReply(res);
40567
40674
  }
40568
40675
  /** `/initialize` and `/complete`: sends a Turnstile token when the widget requires one. */
40569
40676
  postGated(path, body) {
@@ -40590,16 +40697,16 @@ var CheckoutPublicHostComponent = class _CheckoutPublicHostComponent {
40590
40697
  static \u0275fac = function CheckoutPublicHostComponent_Factory(__ngFactoryType__) {
40591
40698
  return new (__ngFactoryType__ || _CheckoutPublicHostComponent)();
40592
40699
  };
40593
- static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _CheckoutPublicHostComponent, selectors: [["mj-orders-checkout"]], inputs: { slug: "slug", apiRoot: "apiRoot", memberToken: "memberToken", renewalToken: "renewalToken" }, outputs: { alreadySubscribed: "checkout-already-subscribed" }, decls: 7, vars: 1, consts: [[1, "mj-checkout-public"], ["role", "alert", 1, "mj-widget-error-banner"], ["role", "status", 1, "mj-checkout-success"], ["role", "status", 1, "mj-checkout-public__status"], [1, "mj-checkout-renewal"], [1, "mj-checkout-public__turnstile"], ["aria-hidden", "true", 1, "mj-checkout-success__icon"], [1, "mj-checkout-success__title"], [1, "mj-checkout-success__msg"], [1, "mj-checkout-success__order"], ["role", "status", 1, "mj-checkout-success__access", 3, "is-failed"], ["role", "status", 1, "mj-checkout-account__msg"], [1, "mj-checkout-account"], ["role", "status", 1, "mj-checkout-success__access"], [1, "mj-checkout-account", 3, "submit"], [1, "mj-checkout-account__title"], [1, "mj-checkout-account__note"], ["for", "mj-checkout-password", 1, "mj-checkout-account__label"], ["id", "mj-checkout-password", "type", "password", "autocomplete", "new-password", 1, "mj-checkout-account__input", 3, "input", "value"], ["for", "mj-checkout-password-confirm", 1, "mj-checkout-account__label"], ["id", "mj-checkout-password-confirm", "type", "password", "autocomplete", "new-password", 1, "mj-checkout-account__input", 3, "input", "value"], ["role", "alert", 1, "mj-checkout-account__error"], ["type", "submit", 1, "mj-checkout-account__submit", 3, "disabled"], ["type", "button", 1, "mj-checkout-account__skip", 3, "click", "disabled"], [1, "mj-checkout-account", "mj-checkout-account--actions"], ["type", "button", 1, "mj-checkout-account__submit", 3, "click"], ["type", "button", 1, "mj-checkout-account__skip"], ["type", "button", 1, "mj-checkout-account__skip", 3, "click"], [1, "mj-checkout-renewal", 3, "submit"], [1, "mj-checkout-renewal__title"], [1, "mj-checkout-renewal__lead"], [1, "mj-checkout-renewal__summary"], [1, "mj-checkout-renewal__row"], [1, "mj-checkout-renewal__row", "mj-checkout-renewal__row--total"], [1, "mj-checkout-renewal__note"], ["type", "submit", 1, "mj-checkout-renewal__pay", 3, "disabled"], ["for", "stripe-card-element", 1, "mj-checkout-renewal__label"], ["id", "stripe-card-element", 1, "mj-checkout-renewal__card"], [3, "config", "distributionSlug", "sessionKey", "isProcessing", "isPaymentReady", "stripePaymentMethodId", "prefillEmail", "errorMessage", "appliedPromotion", "serverPricedTotal", "promotionError", "quotedTotal", "quotedTax"], [3, "promotionCodeApplied", "submitted", "cancelled", "quoteInvalidated", "config", "distributionSlug", "sessionKey", "isProcessing", "isPaymentReady", "stripePaymentMethodId", "prefillEmail", "errorMessage", "appliedPromotion", "serverPricedTotal", "promotionError", "quotedTotal", "quotedTax"]], template: function CheckoutPublicHostComponent_Template(rf, ctx) {
40700
+ static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _CheckoutPublicHostComponent, selectors: [["mj-orders-checkout"]], inputs: { slug: "slug", apiRoot: "apiRoot", memberToken: "memberToken", renewalToken: "renewalToken" }, outputs: { alreadySubscribed: "checkout-already-subscribed" }, decls: 8, vars: 1, consts: [[1, "mj-checkout-public"], ["role", "alert", 1, "mj-widget-error-banner"], ["role", "status", 1, "mj-checkout-success"], ["role", "status", "aria-live", "polite", 1, "mj-checkout-success"], ["role", "status", 1, "mj-checkout-public__status"], [1, "mj-checkout-renewal"], [1, "mj-checkout-public__turnstile"], ["aria-hidden", "true", 1, "mj-checkout-success__icon"], [1, "mj-checkout-success__title"], [1, "mj-checkout-success__msg"], [1, "mj-checkout-success__order"], ["role", "status", 1, "mj-checkout-success__access", 3, "is-failed"], ["role", "status", 1, "mj-checkout-account__msg"], [1, "mj-checkout-account"], ["role", "status", 1, "mj-checkout-success__access"], [1, "mj-checkout-account", 3, "submit"], [1, "mj-checkout-account__title"], [1, "mj-checkout-account__note"], ["for", "mj-checkout-password", 1, "mj-checkout-account__label"], ["id", "mj-checkout-password", "type", "password", "autocomplete", "new-password", 1, "mj-checkout-account__input", 3, "input", "value"], ["for", "mj-checkout-password-confirm", 1, "mj-checkout-account__label"], ["id", "mj-checkout-password-confirm", "type", "password", "autocomplete", "new-password", 1, "mj-checkout-account__input", 3, "input", "value"], ["role", "alert", 1, "mj-checkout-account__error"], ["type", "submit", 1, "mj-checkout-account__submit", 3, "disabled"], ["type", "button", 1, "mj-checkout-account__skip", 3, "click", "disabled"], [1, "mj-checkout-account", "mj-checkout-account--actions"], ["type", "button", 1, "mj-checkout-account__submit", 3, "click"], ["type", "button", 1, "mj-checkout-account__skip"], ["type", "button", 1, "mj-checkout-account__skip", 3, "click"], [1, "mj-checkout-renewal", 3, "submit"], [1, "mj-checkout-renewal__title"], [1, "mj-checkout-renewal__lead"], [1, "mj-checkout-renewal__summary"], [1, "mj-checkout-renewal__row"], [1, "mj-checkout-renewal__row", "mj-checkout-renewal__row--total"], [1, "mj-checkout-renewal__note"], ["type", "submit", 1, "mj-checkout-renewal__pay", 3, "disabled"], ["for", "stripe-card-element", 1, "mj-checkout-renewal__label"], ["id", "stripe-card-element", 1, "mj-checkout-renewal__card"], [3, "config", "distributionSlug", "sessionKey", "isProcessing", "isPaymentReady", "stripePaymentMethodId", "prefillEmail", "errorMessage", "appliedPromotion", "serverPricedTotal", "promotionError", "quotedTotal", "quotedTax"], [3, "promotionCodeApplied", "submitted", "cancelled", "quoteInvalidated", "config", "distributionSlug", "sessionKey", "isProcessing", "isPaymentReady", "stripePaymentMethodId", "prefillEmail", "errorMessage", "appliedPromotion", "serverPricedTotal", "promotionError", "quotedTotal", "quotedTax"]], template: function CheckoutPublicHostComponent_Template(rf, ctx) {
40594
40701
  if (rf & 1) {
40595
40702
  \u0275\u0275elementStart(0, "div", 0);
40596
- \u0275\u0275conditionalCreate(1, CheckoutPublicHostComponent_Conditional_1_Template, 2, 1, "div", 1)(2, CheckoutPublicHostComponent_Conditional_2_Template, 12, 4, "div", 2)(3, CheckoutPublicHostComponent_Conditional_3_Template, 2, 0, "p", 3)(4, CheckoutPublicHostComponent_Conditional_4_Template, 25, 9, "form", 4)(5, CheckoutPublicHostComponent_Conditional_5_Template, 2, 2);
40597
- \u0275\u0275element(6, "div", 5);
40703
+ \u0275\u0275conditionalCreate(1, CheckoutPublicHostComponent_Conditional_1_Template, 2, 1, "div", 1)(2, CheckoutPublicHostComponent_Conditional_2_Template, 12, 4, "div", 2)(3, CheckoutPublicHostComponent_Conditional_3_Template, 3, 1, "div", 3)(4, CheckoutPublicHostComponent_Conditional_4_Template, 2, 0, "p", 4)(5, CheckoutPublicHostComponent_Conditional_5_Template, 25, 9, "form", 5)(6, CheckoutPublicHostComponent_Conditional_6_Template, 2, 2);
40704
+ \u0275\u0275element(7, "div", 6);
40598
40705
  \u0275\u0275elementEnd();
40599
40706
  }
40600
40707
  if (rf & 2) {
40601
40708
  \u0275\u0275advance();
40602
- \u0275\u0275conditional(ctx.loadError ? 1 : ctx.successMessage ? 2 : !ctx.config ? 3 : ctx.renewal ? 4 : 5);
40709
+ \u0275\u0275conditional(ctx.loadError ? 1 : ctx.successMessage ? 2 : ctx.finishingMessage ? 3 : !ctx.config ? 4 : ctx.renewal ? 5 : 6);
40603
40710
  }
40604
40711
  }, dependencies: [CommonModule, MJCheckoutWidgetComponent], styles: ["[_nghost-%COMP%] {\n display: block;\n}\n\n.mj-checkout-public[_ngcontent-%COMP%] {\n max-width: 580px;\n margin: 0 auto;\n}\n\n.mj-checkout-public__status[_ngcontent-%COMP%] {\n text-align: center;\n color: #64748b;\n font-size: 0.95rem;\n padding: 2rem 0;\n}\n\n.mj-widget-error-banner[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 8px;\n background: #fef2f2;\n border: 1px solid #f87171;\n color: #991b1b;\n padding: 10px 14px;\n border-radius: 6px;\n font-size: 0.875rem;\n}\n\n.mj-checkout-success[_ngcontent-%COMP%] {\n text-align: center;\n background: #ffffff;\n border: 1px solid #e2e8f0;\n border-radius: 10px;\n padding: 2rem 1.5rem;\n box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);\n}\n\n.mj-checkout-success__icon[_ngcontent-%COMP%] {\n width: 3rem;\n height: 3rem;\n margin: 0 auto 1rem;\n border-radius: 50%;\n background: #dcfce7;\n color: #16a34a;\n font-size: 1.5rem;\n font-weight: 700;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.mj-checkout-success__title[_ngcontent-%COMP%] {\n margin: 0 0 0.5rem;\n font-size: 1.5rem;\n font-weight: 800;\n color: #0f172a;\n}\n\n.mj-checkout-success__msg[_ngcontent-%COMP%], \n.mj-checkout-success__order[_ngcontent-%COMP%] {\n margin: 0;\n color: #64748b;\n font-size: 0.95rem;\n line-height: 1.5;\n}\n\n.mj-checkout-success__order[_ngcontent-%COMP%] {\n margin-top: 0.75rem;\n font-weight: 600;\n color: #334155;\n}\n\n\n\n.mj-checkout-success__access[_ngcontent-%COMP%] {\n margin: 0.75rem 0 0;\n color: #334155;\n font-size: 0.95rem;\n}\n\n.mj-checkout-success__access.is-failed[_ngcontent-%COMP%] {\n color: #991b1b;\n}\n\n\n\n.mj-checkout-account[_ngcontent-%COMP%] {\n margin: 1.5rem auto 0;\n max-width: 320px;\n text-align: left;\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.mj-checkout-account__title[_ngcontent-%COMP%] {\n margin: 0 0 0.5rem;\n font-size: 1.05rem;\n font-weight: 700;\n color: #0f172a;\n text-align: center;\n}\n\n.mj-checkout-account__label[_ngcontent-%COMP%] {\n font-size: 0.85rem;\n font-weight: 600;\n color: #334155;\n}\n\n.mj-checkout-account__input[_ngcontent-%COMP%] {\n padding: 8px 10px;\n border: 1px solid #cbd5e1;\n border-radius: 6px;\n font-size: 0.95rem;\n font-family: inherit;\n}\n\n.mj-checkout-account__input[_ngcontent-%COMP%]:focus {\n outline: none;\n border-color: var(--mj-primary-color, #2563eb);\n box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);\n}\n\n.mj-checkout-account__error[_ngcontent-%COMP%] {\n margin: 4px 0 0;\n color: #991b1b;\n font-size: 0.85rem;\n}\n\n.mj-checkout-account__submit[_ngcontent-%COMP%] {\n margin-top: 10px;\n padding: 10px;\n border: 0;\n border-radius: 6px;\n background: var(--mj-primary-color, #2563eb);\n color: #ffffff;\n font-weight: 600;\n cursor: pointer;\n}\n\n.mj-checkout-account__skip[_ngcontent-%COMP%] {\n padding: 6px;\n border: 0;\n background: none;\n color: #64748b;\n font-size: 0.85rem;\n cursor: pointer;\n}\n\n.mj-checkout-account__submit[_ngcontent-%COMP%]:disabled, \n.mj-checkout-account__skip[_ngcontent-%COMP%]:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}\n\n.mj-checkout-account__msg[_ngcontent-%COMP%] {\n margin: 1rem 0 0;\n color: #334155;\n font-size: 0.95rem;\n line-height: 1.5;\n}\n\n.mj-checkout-account__note[_ngcontent-%COMP%] {\n margin: 0 0 0.5rem;\n color: #475569;\n font-size: 0.85rem;\n line-height: 1.45;\n text-align: center;\n}\n\n.mj-checkout-account--actions[_ngcontent-%COMP%] {\n margin-top: 0.75rem;\n}\n\n\n\n.mj-checkout-public__turnstile[_ngcontent-%COMP%] {\n display: flex;\n justify-content: center;\n margin-top: 0.75rem;\n}\n\n\n\n\n.mj-checkout-renewal[_ngcontent-%COMP%] {\n background: #ffffff;\n border: 1px solid #e2e8f0;\n border-radius: 10px;\n padding: 1.75rem 1.5rem;\n box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);\n display: flex;\n flex-direction: column;\n gap: 0.85rem;\n}\n\n.mj-checkout-renewal__title[_ngcontent-%COMP%] {\n margin: 0;\n font-size: 1.4rem;\n font-weight: 800;\n color: #0f172a;\n}\n\n.mj-checkout-renewal__lead[_ngcontent-%COMP%], \n.mj-checkout-renewal__note[_ngcontent-%COMP%] {\n margin: 0;\n color: #475569;\n font-size: 0.95rem;\n line-height: 1.5;\n}\n\n.mj-checkout-renewal__note[_ngcontent-%COMP%] {\n font-size: 0.85rem;\n}\n\n.mj-checkout-renewal__summary[_ngcontent-%COMP%] {\n margin: 0.25rem 0;\n border: 1px solid #e2e8f0;\n border-radius: 8px;\n padding: 0.25rem 0.9rem;\n}\n\n.mj-checkout-renewal__row[_ngcontent-%COMP%] {\n display: flex;\n justify-content: space-between;\n gap: 1rem;\n padding: 0.55rem 0;\n border-bottom: 1px solid #f1f5f9;\n font-size: 0.92rem;\n}\n\n.mj-checkout-renewal__row[_ngcontent-%COMP%]:last-child {\n border-bottom: none;\n}\n\n.mj-checkout-renewal__row[_ngcontent-%COMP%] dt[_ngcontent-%COMP%] {\n color: #64748b;\n}\n\n.mj-checkout-renewal__row[_ngcontent-%COMP%] dd[_ngcontent-%COMP%] {\n margin: 0;\n color: #0f172a;\n text-align: right;\n}\n\n.mj-checkout-renewal__row--total[_ngcontent-%COMP%] dt[_ngcontent-%COMP%], \n.mj-checkout-renewal__row--total[_ngcontent-%COMP%] dd[_ngcontent-%COMP%] {\n font-weight: 700;\n color: #0f172a;\n}\n\n.mj-checkout-renewal__label[_ngcontent-%COMP%] {\n font-size: 0.85rem;\n font-weight: 600;\n color: #334155;\n}\n\n.mj-checkout-renewal__card[_ngcontent-%COMP%] {\n border: 1px solid #cbd5e1;\n border-radius: 6px;\n padding: 0.75rem;\n background: #ffffff;\n}\n\n.mj-checkout-renewal__pay[_ngcontent-%COMP%] {\n margin-top: 0.25rem;\n padding: 0.8rem 1rem;\n border: none;\n border-radius: 6px;\n background: var(--mj-checkout-primary, #2563eb);\n color: #ffffff;\n font-size: 1rem;\n font-weight: 700;\n cursor: pointer;\n}\n\n.mj-checkout-renewal__pay[_ngcontent-%COMP%]:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}"] });
40605
40712
  };
@@ -40666,6 +40773,10 @@ var CheckoutPublicHostComponent = class _CheckoutPublicHostComponent {
40666
40773
  }
40667
40774
  }
40668
40775
  </div>
40776
+ } @else if (finishingMessage) {
40777
+ <div class="mj-checkout-success" role="status" aria-live="polite">
40778
+ <p class="mj-checkout-success__msg">{{ finishingMessage }}</p>
40779
+ </div>
40669
40780
  } @else if (!config) {
40670
40781
  <p class="mj-checkout-public__status" role="status">Loading checkout\u2026</p>
40671
40782
  } @else if (renewal) {
@@ -40752,7 +40863,7 @@ var CheckoutPublicHostComponent = class _CheckoutPublicHostComponent {
40752
40863
  }] });
40753
40864
  })();
40754
40865
  (() => {
40755
- (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(CheckoutPublicHostComponent, { className: "CheckoutPublicHostComponent", filePath: "lib/checkout-widget/checkout-public-host.component.ts", lineNumber: 112 });
40866
+ (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(CheckoutPublicHostComponent, { className: "CheckoutPublicHostComponent", filePath: "lib/checkout-widget/checkout-public-host.component.ts", lineNumber: 121 });
40756
40867
  })();
40757
40868
 
40758
40869
  // scripts/checkout-element-entry.ts
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Completing a checkout the buyer has already paid for. Pure, so it is testable without the host
3
+ * component.
4
+ *
5
+ * `/complete` books the order in one call. When it runs past the CDN or proxy timeout in front of
6
+ * the server, the browser gets the gateway's HTML error page (a 504), or no reply at all, while
7
+ * the server goes on and confirms the order. The card has been charged by then, so the checkout
8
+ * must not report a failure: it asks again. `/complete` is replay-safe: while the first call is
9
+ * still running it answers `Status: 'Processing'`, and once the session is Confirmed it returns the
10
+ * existing order without booking a second one.
11
+ */
12
+ type CheckoutReply = Record<string, unknown>;
13
+ /** How often the checkout asks again, and for how long, before it stops waiting. */
14
+ export declare const COMPLETE_RETRY_INTERVAL_MS = 3000;
15
+ export declare const COMPLETE_RETRY_TIMEOUT_MS = 120000;
16
+ /** Shown while the checkout asks again. */
17
+ export declare const COMPLETE_FINISHING_MESSAGE = "Payment received. Finishing your order\u2026";
18
+ /** Shown when the wait runs out with the order still unconfirmed. Never asks the buyer to pay again. */
19
+ export declare const COMPLETE_DELAYED_MESSAGE: string;
20
+ /** Shown for any other call whose reply was not the server's JSON. */
21
+ export declare const CHECKOUT_UNREACHABLE_MESSAGE = "Checkout could not reach the server. Please try again.";
22
+ /**
23
+ * A reply that was not the checkout server's JSON: a gateway or proxy error page, or no reply at
24
+ * all (`HttpStatus` null). Its message is written for the buyer, never a parser error.
25
+ */
26
+ export declare class CheckoutTransportError extends Error {
27
+ readonly HttpStatus: number | null;
28
+ constructor(HttpStatus: number | null);
29
+ }
30
+ /**
31
+ * The reply's JSON body, with its HTTP status as `_httpStatus`. Throws {@link CheckoutTransportError}
32
+ * for a body that is not a JSON object, such as a gateway's HTML error page.
33
+ */
34
+ export declare function ReadCheckoutReply(res: Response): Promise<CheckoutReply>;
35
+ /** True when `/complete` answered that an earlier call for the same session is still booking it. */
36
+ export declare function CompleteStillProcessing(reply: CheckoutReply | null | undefined): boolean;
37
+ export interface CompleteRetryOptions {
38
+ intervalMs?: number;
39
+ timeoutMs?: number;
40
+ /** Called once, the first time the checkout has to wait. */
41
+ onWaiting?: () => void;
42
+ now?: () => number;
43
+ sleep?: (ms: number) => Promise<void>;
44
+ }
45
+ /**
46
+ * Sends `/complete` until it gives a final answer: the order (`Success: true`) or a refusal from
47
+ * the server, both returned as they are. A reply that was not the server's JSON, or a session still
48
+ * Processing, means the server may still be finishing, so it asks again. Resolves null when the wait
49
+ * runs out with no final answer. Any other error (a failed human verification) is thrown.
50
+ */
51
+ export declare function CompleteWithRetry(send: () => Promise<CheckoutReply>, options?: CompleteRetryOptions): Promise<CheckoutReply | null>;
52
+ export {};
53
+ //# sourceMappingURL=checkout-complete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkout-complete.d.ts","sourceRoot":"","sources":["../../../src/lib/checkout-widget/checkout-complete.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE7C,oFAAoF;AACpF,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAC/C,eAAO,MAAM,yBAAyB,SAAS,CAAC;AAEhD,2CAA2C;AAC3C,eAAO,MAAM,0BAA0B,iDAA4C,CAAC;AAEpF,wGAAwG;AACxG,eAAO,MAAM,wBAAwB,QAEqB,CAAC;AAE3D,sEAAsE;AACtE,eAAO,MAAM,4BAA4B,2DAA2D,CAAC;AAErG;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;aACjB,UAAU,EAAE,MAAM,GAAG,IAAI;gBAAzB,UAAU,EAAE,MAAM,GAAG,IAAI;CAIxD;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,CAa7E;AAED,oGAAoG;AACpG,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAExF;AAED,MAAM,WAAW,oBAAoB;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACzC;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACnC,IAAI,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,EAClC,OAAO,GAAE,oBAAyB,GACnC,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CA2B/B"}