@mj-biz-apps/orders-ng 5.20.0 → 5.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/checkout-element/main.js +1396 -134
- package/dist/lib/checkout-widget/checkout-account.d.ts +35 -0
- package/dist/lib/checkout-widget/checkout-account.d.ts.map +1 -0
- package/dist/lib/checkout-widget/checkout-account.js +67 -0
- package/dist/lib/checkout-widget/checkout-account.js.map +1 -0
- package/dist/lib/checkout-widget/checkout-events.d.ts +52 -0
- package/dist/lib/checkout-widget/checkout-events.d.ts.map +1 -0
- package/dist/lib/checkout-widget/checkout-events.js +39 -0
- package/dist/lib/checkout-widget/checkout-events.js.map +1 -0
- package/dist/lib/checkout-widget/checkout-public-host.component.d.ts +80 -0
- package/dist/lib/checkout-widget/checkout-public-host.component.d.ts.map +1 -1
- package/dist/lib/checkout-widget/checkout-public-host.component.js +429 -17
- package/dist/lib/checkout-widget/checkout-public-host.component.js.map +1 -1
- package/dist/lib/checkout-widget/checkout-widget.component.d.ts +18 -1
- package/dist/lib/checkout-widget/checkout-widget.component.d.ts.map +1 -1
- package/dist/lib/checkout-widget/checkout-widget.component.js +160 -23
- package/dist/lib/checkout-widget/checkout-widget.component.js.map +1 -1
- package/dist/lib/form-panels/document-forms.module.d.ts +19 -17
- package/dist/lib/form-panels/document-forms.module.d.ts.map +1 -1
- package/dist/lib/form-panels/document-forms.module.js +8 -0
- package/dist/lib/form-panels/document-forms.module.js.map +1 -1
- package/dist/lib/form-panels/order-access-overrides.panel.d.ts +41 -0
- package/dist/lib/form-panels/order-access-overrides.panel.d.ts.map +1 -0
- package/dist/lib/form-panels/order-access-overrides.panel.js +366 -0
- package/dist/lib/form-panels/order-access-overrides.panel.js.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersCheckoutSession/mjbizappsorderscheckoutsession.form.component.d.ts.map +1 -1
- package/dist/lib/generated/Entities/mjBizAppsOrdersCheckoutSession/mjbizappsorderscheckoutsession.form.component.js +24 -5
- package/dist/lib/generated/Entities/mjBizAppsOrdersCheckoutSession/mjbizappsorderscheckoutsession.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/mjBizAppsOrdersCheckoutSessionStep/mjbizappsorderscheckoutsessionstep.form.component.d.ts +10 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersCheckoutSessionStep/mjbizappsorderscheckoutsessionstep.form.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersCheckoutSessionStep/mjbizappsorderscheckoutsessionstep.form.component.js +77 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersCheckoutSessionStep/mjbizappsorderscheckoutsessionstep.form.component.js.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersEntitlementAccessOverride/mjbizappsordersentitlementaccessoverride.form.component.d.ts +10 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersEntitlementAccessOverride/mjbizappsordersentitlementaccessoverride.form.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersEntitlementAccessOverride/mjbizappsordersentitlementaccessoverride.form.component.js +79 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersEntitlementAccessOverride/mjbizappsordersentitlementaccessoverride.form.component.js.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersEntitlementGrant/mjbizappsordersentitlementgrant.form.component.d.ts.map +1 -1
- package/dist/lib/generated/Entities/mjBizAppsOrdersEntitlementGrant/mjbizappsordersentitlementgrant.form.component.js +25 -6
- package/dist/lib/generated/Entities/mjBizAppsOrdersEntitlementGrant/mjbizappsordersentitlementgrant.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/mjBizAppsOrdersOrderCheckoutAnswer/mjbizappsordersordercheckoutanswer.form.component.d.ts +10 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersOrderCheckoutAnswer/mjbizappsordersordercheckoutanswer.form.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersOrderCheckoutAnswer/mjbizappsordersordercheckoutanswer.form.component.js +65 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersOrderCheckoutAnswer/mjbizappsordersordercheckoutanswer.form.component.js.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersOrderHeader/mjbizappsordersorderheader.form.component.d.ts.map +1 -1
- package/dist/lib/generated/Entities/mjBizAppsOrdersOrderHeader/mjbizappsordersorderheader.form.component.js +70 -16
- package/dist/lib/generated/Entities/mjBizAppsOrdersOrderHeader/mjbizappsordersorderheader.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/mjBizAppsOrdersOrderLine/mjbizappsordersorderline.form.component.d.ts.map +1 -1
- package/dist/lib/generated/Entities/mjBizAppsOrdersOrderLine/mjbizappsordersorderline.form.component.js +34 -16
- package/dist/lib/generated/Entities/mjBizAppsOrdersOrderLine/mjbizappsordersorderline.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/mjBizAppsOrdersOrderLineChoice/mjbizappsordersorderlinechoice.form.component.d.ts +10 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersOrderLineChoice/mjbizappsordersorderlinechoice.form.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersOrderLineChoice/mjbizappsordersorderlinechoice.form.component.js +65 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersOrderLineChoice/mjbizappsordersorderlinechoice.form.component.js.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersOutboundDelivery/mjbizappsordersoutbounddelivery.form.component.d.ts +10 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersOutboundDelivery/mjbizappsordersoutbounddelivery.form.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersOutboundDelivery/mjbizappsordersoutbounddelivery.form.component.js +77 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersOutboundDelivery/mjbizappsordersoutbounddelivery.form.component.js.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersOutboundEvent/mjbizappsordersoutboundevent.form.component.d.ts +10 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersOutboundEvent/mjbizappsordersoutboundevent.form.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersOutboundEvent/mjbizappsordersoutboundevent.form.component.js +84 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersOutboundEvent/mjbizappsordersoutboundevent.form.component.js.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsOrdersProductEntitlement/mjbizappsordersproductentitlement.form.component.d.ts.map +1 -1
- package/dist/lib/generated/Entities/mjBizAppsOrdersProductEntitlement/mjbizappsordersproductentitlement.form.component.js +20 -10
- package/dist/lib/generated/Entities/mjBizAppsOrdersProductEntitlement/mjbizappsordersproductentitlement.form.component.js.map +1 -1
- package/dist/lib/generated/generated-forms.module.d.ts +88 -82
- package/dist/lib/generated/generated-forms.module.d.ts.map +1 -1
- package/dist/lib/generated/generated-forms.module.js +22 -4
- package/dist/lib/generated/generated-forms.module.js.map +1 -1
- package/package.json +2 -2
|
@@ -8,9 +8,12 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { ChangeDetectorRef, Component, ElementRef, Input, inject, } from '@angular/core';
|
|
10
10
|
import { CommonModule } from '@angular/common';
|
|
11
|
+
import { ACCOUNT_STEP_FAILED, AccountMessage, CheckPasswordEntry, IsAccountSettled, MayRedirect, ReadCheckoutAccount, VerificationNote, } from './checkout-account.js';
|
|
12
|
+
import { BuildCheckoutCompleteDetail, CHECKOUT_CANCEL_EVENT, CHECKOUT_CLOSE_EVENT, CHECKOUT_RESET_REFUSED_EVENT, CHECKOUT_RESET_REQUEST_EVENT, CHECKOUT_COMPLETE_EVENT, CHECKOUT_ERROR_EVENT, CHECKOUT_STATE_CHANGE_EVENT, CheckoutElementEvent, } from './checkout-events.js';
|
|
11
13
|
import { MJCheckoutWidgetComponent, } from './checkout-widget.component.js';
|
|
12
14
|
import { buildCheckoutDraftLine, formatStripeError, intentAlreadyCollected, stripeConfirmAlreadyCollected, } from './checkout-draft-line.js';
|
|
13
15
|
import * as i0 from "@angular/core";
|
|
16
|
+
const _c0 = a0 => [a0];
|
|
14
17
|
function CheckoutPublicHostComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
15
18
|
i0.ɵɵelementStart(0, "div", 1);
|
|
16
19
|
i0.ɵɵtext(1);
|
|
@@ -21,7 +24,7 @@ function CheckoutPublicHostComponent_Conditional_1_Template(rf, ctx) { if (rf &
|
|
|
21
24
|
i0.ɵɵtextInterpolate(ctx_r0.loadError);
|
|
22
25
|
} }
|
|
23
26
|
function CheckoutPublicHostComponent_Conditional_2_Conditional_7_Template(rf, ctx) { if (rf & 1) {
|
|
24
|
-
i0.ɵɵelementStart(0, "p",
|
|
27
|
+
i0.ɵɵelementStart(0, "p", 7);
|
|
25
28
|
i0.ɵɵtext(1);
|
|
26
29
|
i0.ɵɵelementEnd();
|
|
27
30
|
} if (rf & 2) {
|
|
@@ -29,17 +32,118 @@ function CheckoutPublicHostComponent_Conditional_2_Conditional_7_Template(rf, ct
|
|
|
29
32
|
i0.ɵɵadvance();
|
|
30
33
|
i0.ɵɵtextInterpolate1("Order ", ctx_r0.orderNumber);
|
|
31
34
|
} }
|
|
35
|
+
function CheckoutPublicHostComponent_Conditional_2_Conditional_8_Template(rf, ctx) { if (rf & 1) {
|
|
36
|
+
i0.ɵɵelementStart(0, "p", 8);
|
|
37
|
+
i0.ɵɵtext(1, "Setting up your account\u2026");
|
|
38
|
+
i0.ɵɵelementEnd();
|
|
39
|
+
} }
|
|
40
|
+
function CheckoutPublicHostComponent_Conditional_2_Conditional_9_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
41
|
+
i0.ɵɵelementStart(0, "p", 12);
|
|
42
|
+
i0.ɵɵtext(1);
|
|
43
|
+
i0.ɵɵelementEnd();
|
|
44
|
+
} if (rf & 2) {
|
|
45
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
46
|
+
i0.ɵɵadvance();
|
|
47
|
+
i0.ɵɵtextInterpolate(ctx_r0.verificationNote);
|
|
48
|
+
} }
|
|
49
|
+
function CheckoutPublicHostComponent_Conditional_2_Conditional_9_Conditional_10_Template(rf, ctx) { if (rf & 1) {
|
|
50
|
+
i0.ɵɵelementStart(0, "p", 17);
|
|
51
|
+
i0.ɵɵtext(1);
|
|
52
|
+
i0.ɵɵelementEnd();
|
|
53
|
+
} if (rf & 2) {
|
|
54
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
55
|
+
i0.ɵɵadvance();
|
|
56
|
+
i0.ɵɵtextInterpolate(ctx_r0.passwordError);
|
|
57
|
+
} }
|
|
58
|
+
function CheckoutPublicHostComponent_Conditional_2_Conditional_9_Template(rf, ctx) { if (rf & 1) {
|
|
59
|
+
const _r2 = i0.ɵɵgetCurrentView();
|
|
60
|
+
i0.ɵɵelementStart(0, "form", 10);
|
|
61
|
+
i0.ɵɵlistener("submit", function CheckoutPublicHostComponent_Conditional_2_Conditional_9_Template_form_submit_0_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(2); $event.preventDefault(); return i0.ɵɵresetView(ctx_r0.submitPassword()); });
|
|
62
|
+
i0.ɵɵelementStart(1, "h2", 11);
|
|
63
|
+
i0.ɵɵtext(2, "Set a password for your account");
|
|
64
|
+
i0.ɵɵelementEnd();
|
|
65
|
+
i0.ɵɵconditionalCreate(3, CheckoutPublicHostComponent_Conditional_2_Conditional_9_Conditional_3_Template, 2, 1, "p", 12);
|
|
66
|
+
i0.ɵɵelementStart(4, "label", 13);
|
|
67
|
+
i0.ɵɵtext(5, "Password");
|
|
68
|
+
i0.ɵɵelementEnd();
|
|
69
|
+
i0.ɵɵelementStart(6, "input", 14);
|
|
70
|
+
i0.ɵɵlistener("input", function CheckoutPublicHostComponent_Conditional_2_Conditional_9_Template_input_input_6_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.password = $event.target.value); });
|
|
71
|
+
i0.ɵɵelementEnd();
|
|
72
|
+
i0.ɵɵelementStart(7, "label", 15);
|
|
73
|
+
i0.ɵɵtext(8, "Confirm password");
|
|
74
|
+
i0.ɵɵelementEnd();
|
|
75
|
+
i0.ɵɵelementStart(9, "input", 16);
|
|
76
|
+
i0.ɵɵlistener("input", function CheckoutPublicHostComponent_Conditional_2_Conditional_9_Template_input_input_9_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.passwordConfirmation = $event.target.value); });
|
|
77
|
+
i0.ɵɵelementEnd();
|
|
78
|
+
i0.ɵɵconditionalCreate(10, CheckoutPublicHostComponent_Conditional_2_Conditional_9_Conditional_10_Template, 2, 1, "p", 17);
|
|
79
|
+
i0.ɵɵelementStart(11, "button", 18);
|
|
80
|
+
i0.ɵɵtext(12);
|
|
81
|
+
i0.ɵɵelementEnd();
|
|
82
|
+
i0.ɵɵelementStart(13, "button", 19);
|
|
83
|
+
i0.ɵɵlistener("click", function CheckoutPublicHostComponent_Conditional_2_Conditional_9_Template_button_click_13_listener() { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.skipPassword()); });
|
|
84
|
+
i0.ɵɵtext(14, " Not now ");
|
|
85
|
+
i0.ɵɵelementEnd()();
|
|
86
|
+
} if (rf & 2) {
|
|
87
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
88
|
+
i0.ɵɵadvance(3);
|
|
89
|
+
i0.ɵɵconditional(ctx_r0.verificationNote ? 3 : -1);
|
|
90
|
+
i0.ɵɵadvance(3);
|
|
91
|
+
i0.ɵɵproperty("value", ctx_r0.password);
|
|
92
|
+
i0.ɵɵadvance(3);
|
|
93
|
+
i0.ɵɵproperty("value", ctx_r0.passwordConfirmation);
|
|
94
|
+
i0.ɵɵadvance();
|
|
95
|
+
i0.ɵɵconditional(ctx_r0.passwordError ? 10 : -1);
|
|
96
|
+
i0.ɵɵadvance();
|
|
97
|
+
i0.ɵɵproperty("disabled", ctx_r0.passwordBusy);
|
|
98
|
+
i0.ɵɵadvance();
|
|
99
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r0.passwordBusy ? "Saving\u2026" : "Set password", " ");
|
|
100
|
+
i0.ɵɵadvance();
|
|
101
|
+
i0.ɵɵproperty("disabled", ctx_r0.passwordBusy);
|
|
102
|
+
} }
|
|
103
|
+
function CheckoutPublicHostComponent_Conditional_2_Conditional_10_Conditional_2_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
104
|
+
const _r4 = i0.ɵɵgetCurrentView();
|
|
105
|
+
i0.ɵɵelementStart(0, "button", 23);
|
|
106
|
+
i0.ɵɵlistener("click", function CheckoutPublicHostComponent_Conditional_2_Conditional_10_Conditional_2_Conditional_3_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r4); const ctx_r0 = i0.ɵɵnextContext(4); return i0.ɵɵresetView(ctx_r0.dismissAccount()); });
|
|
107
|
+
i0.ɵɵtext(1, "Not now");
|
|
108
|
+
i0.ɵɵelementEnd();
|
|
109
|
+
} }
|
|
110
|
+
function CheckoutPublicHostComponent_Conditional_2_Conditional_10_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
111
|
+
const _r3 = i0.ɵɵgetCurrentView();
|
|
112
|
+
i0.ɵɵelementStart(0, "div", 20)(1, "button", 21);
|
|
113
|
+
i0.ɵɵlistener("click", function CheckoutPublicHostComponent_Conditional_2_Conditional_10_Conditional_2_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r3); const ctx_r0 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r0.retryAccount()); });
|
|
114
|
+
i0.ɵɵtext(2, "Try again");
|
|
115
|
+
i0.ɵɵelementEnd();
|
|
116
|
+
i0.ɵɵconditionalCreate(3, CheckoutPublicHostComponent_Conditional_2_Conditional_10_Conditional_2_Conditional_3_Template, 2, 0, "button", 22);
|
|
117
|
+
i0.ɵɵelementEnd();
|
|
118
|
+
} if (rf & 2) {
|
|
119
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
120
|
+
i0.ɵɵadvance(3);
|
|
121
|
+
i0.ɵɵconditional((ctx_r0.config == null ? null : ctx_r0.config.redirectUrl) ? 3 : -1);
|
|
122
|
+
} }
|
|
123
|
+
function CheckoutPublicHostComponent_Conditional_2_Conditional_10_Template(rf, ctx) { if (rf & 1) {
|
|
124
|
+
i0.ɵɵelementStart(0, "p", 8);
|
|
125
|
+
i0.ɵɵtext(1);
|
|
126
|
+
i0.ɵɵelementEnd();
|
|
127
|
+
i0.ɵɵconditionalCreate(2, CheckoutPublicHostComponent_Conditional_2_Conditional_10_Conditional_2_Template, 4, 1, "div", 20);
|
|
128
|
+
} if (rf & 2) {
|
|
129
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
130
|
+
i0.ɵɵadvance();
|
|
131
|
+
i0.ɵɵtextInterpolate(ctx_r0.accountMessage);
|
|
132
|
+
i0.ɵɵadvance();
|
|
133
|
+
i0.ɵɵconditional((ctx_r0.account == null ? null : ctx_r0.account.Outcome) === "Failed" ? 2 : -1);
|
|
134
|
+
} }
|
|
32
135
|
function CheckoutPublicHostComponent_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
33
|
-
i0.ɵɵelementStart(0, "div", 2)(1, "div",
|
|
136
|
+
i0.ɵɵelementStart(0, "div", 2)(1, "div", 4);
|
|
34
137
|
i0.ɵɵtext(2, "\u2713");
|
|
35
138
|
i0.ɵɵelementEnd();
|
|
36
|
-
i0.ɵɵelementStart(3, "h1",
|
|
139
|
+
i0.ɵɵelementStart(3, "h1", 5);
|
|
37
140
|
i0.ɵɵtext(4, "You're all set");
|
|
38
141
|
i0.ɵɵelementEnd();
|
|
39
|
-
i0.ɵɵelementStart(5, "p",
|
|
142
|
+
i0.ɵɵelementStart(5, "p", 6);
|
|
40
143
|
i0.ɵɵtext(6);
|
|
41
144
|
i0.ɵɵelementEnd();
|
|
42
|
-
i0.ɵɵconditionalCreate(7, CheckoutPublicHostComponent_Conditional_2_Conditional_7_Template, 2, 1, "p",
|
|
145
|
+
i0.ɵɵconditionalCreate(7, CheckoutPublicHostComponent_Conditional_2_Conditional_7_Template, 2, 1, "p", 7);
|
|
146
|
+
i0.ɵɵconditionalCreate(8, CheckoutPublicHostComponent_Conditional_2_Conditional_8_Template, 2, 0, "p", 8)(9, CheckoutPublicHostComponent_Conditional_2_Conditional_9_Template, 15, 7, "form", 9)(10, CheckoutPublicHostComponent_Conditional_2_Conditional_10_Template, 3, 2);
|
|
43
147
|
i0.ɵɵelementEnd();
|
|
44
148
|
} if (rf & 2) {
|
|
45
149
|
const ctx_r0 = i0.ɵɵnextContext();
|
|
@@ -47,20 +151,28 @@ function CheckoutPublicHostComponent_Conditional_2_Template(rf, ctx) { if (rf &
|
|
|
47
151
|
i0.ɵɵtextInterpolate(ctx_r0.successMessage);
|
|
48
152
|
i0.ɵɵadvance();
|
|
49
153
|
i0.ɵɵconditional(ctx_r0.orderNumber ? 7 : -1);
|
|
154
|
+
i0.ɵɵadvance();
|
|
155
|
+
i0.ɵɵconditional(ctx_r0.accountLoading ? 8 : (ctx_r0.account == null ? null : ctx_r0.account.CanSetPassword) ? 9 : ctx_r0.accountMessage ? 10 : -1);
|
|
50
156
|
} }
|
|
51
157
|
function CheckoutPublicHostComponent_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
52
158
|
i0.ɵɵelementStart(0, "p", 3);
|
|
53
159
|
i0.ɵɵtext(1, "Loading checkout\u2026");
|
|
54
160
|
i0.ɵɵelementEnd();
|
|
55
161
|
} }
|
|
56
|
-
function
|
|
57
|
-
const
|
|
58
|
-
i0.ɵɵelementStart(0, "mj-checkout-widget",
|
|
59
|
-
i0.ɵɵlistener("submitted", function
|
|
162
|
+
function CheckoutPublicHostComponent_Conditional_4_For_1_Template(rf, ctx) { if (rf & 1) {
|
|
163
|
+
const _r5 = i0.ɵɵgetCurrentView();
|
|
164
|
+
i0.ɵɵelementStart(0, "mj-checkout-widget", 25);
|
|
165
|
+
i0.ɵɵlistener("submitted", function CheckoutPublicHostComponent_Conditional_4_For_1_Template_mj_checkout_widget_submitted_0_listener($event) { i0.ɵɵrestoreView(_r5); const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.onSubmitted($event)); })("cancelled", function CheckoutPublicHostComponent_Conditional_4_For_1_Template_mj_checkout_widget_cancelled_0_listener() { i0.ɵɵrestoreView(_r5); const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.onCancelled()); });
|
|
60
166
|
i0.ɵɵelementEnd();
|
|
167
|
+
} if (rf & 2) {
|
|
168
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
169
|
+
i0.ɵɵproperty("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);
|
|
170
|
+
} }
|
|
171
|
+
function CheckoutPublicHostComponent_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
172
|
+
i0.ɵɵrepeaterCreate(0, CheckoutPublicHostComponent_Conditional_4_For_1_Template, 1, 8, "mj-checkout-widget", 24, i0.ɵɵrepeaterTrackByIdentity);
|
|
61
173
|
} if (rf & 2) {
|
|
62
174
|
const ctx_r0 = i0.ɵɵnextContext();
|
|
63
|
-
i0.ɵɵ
|
|
175
|
+
i0.ɵɵrepeater(i0.ɵɵpureFunction1(0, _c0, ctx_r0.formGeneration));
|
|
64
176
|
} }
|
|
65
177
|
export { buildCheckoutDraftLine } from './checkout-draft-line.js';
|
|
66
178
|
export class CheckoutPublicHostComponent {
|
|
@@ -78,10 +190,35 @@ export class CheckoutPublicHostComponent {
|
|
|
78
190
|
loadError = null;
|
|
79
191
|
successMessage = null;
|
|
80
192
|
orderNumber = null;
|
|
193
|
+
/** The post-payment account step, when the host registered one (#292). */
|
|
194
|
+
account = null;
|
|
195
|
+
password = '';
|
|
196
|
+
passwordConfirmation = '';
|
|
197
|
+
passwordError = null;
|
|
198
|
+
passwordBusy = false;
|
|
199
|
+
passwordSet = false;
|
|
200
|
+
/** True while the account step is being asked for. */
|
|
201
|
+
accountLoading = false;
|
|
202
|
+
/** The buyer chose to leave a failed account step. */
|
|
203
|
+
accountDismissed = false;
|
|
204
|
+
get accountMessage() {
|
|
205
|
+
return this.account ? AccountMessage(this.account, this.passwordSet) : null;
|
|
206
|
+
}
|
|
207
|
+
get verificationNote() {
|
|
208
|
+
return VerificationNote(this.account);
|
|
209
|
+
}
|
|
81
210
|
stripe = null;
|
|
82
211
|
card = null;
|
|
83
212
|
cardMounted = false;
|
|
84
213
|
destroyed = false;
|
|
214
|
+
state = null;
|
|
215
|
+
/** Bumped by Cancel: the template re-creates the widget, which clears everything the buyer entered. */
|
|
216
|
+
formGeneration = 0;
|
|
217
|
+
/** From the element's attributes, for a host that embeds the checkout in its own panel. */
|
|
218
|
+
prefillEmail = null;
|
|
219
|
+
attributionSource = null;
|
|
220
|
+
attributionReference = null;
|
|
221
|
+
onResetRequested = () => this.resetRequested();
|
|
85
222
|
get isFree() {
|
|
86
223
|
return (this.config?.unitPrice ?? 0) <= 0;
|
|
87
224
|
}
|
|
@@ -96,6 +233,10 @@ export class CheckoutPublicHostComponent {
|
|
|
96
233
|
this.loadError = 'Checkout requires a secure random source. Open this page over HTTPS.';
|
|
97
234
|
return;
|
|
98
235
|
}
|
|
236
|
+
if (await this.resumeAccountStep()) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
this.setState('LOADING');
|
|
99
240
|
try {
|
|
100
241
|
const init = await this.post('/initialize', {
|
|
101
242
|
slug: this.slug,
|
|
@@ -118,11 +259,14 @@ export class CheckoutPublicHostComponent {
|
|
|
118
259
|
return;
|
|
119
260
|
}
|
|
120
261
|
this.config = cfg;
|
|
262
|
+
this.setState('CHECKOUT');
|
|
121
263
|
}
|
|
122
264
|
catch {
|
|
123
265
|
this.loadError = 'Checkout is temporarily unavailable. Please try again.';
|
|
124
266
|
}
|
|
125
267
|
finally {
|
|
268
|
+
if (this.loadError)
|
|
269
|
+
this.reportError(this.loadError);
|
|
126
270
|
this.cdr.detectChanges();
|
|
127
271
|
}
|
|
128
272
|
}
|
|
@@ -141,6 +285,7 @@ export class CheckoutPublicHostComponent {
|
|
|
141
285
|
}
|
|
142
286
|
ngOnDestroy() {
|
|
143
287
|
this.destroyed = true;
|
|
288
|
+
this.hostEl?.nativeElement?.removeEventListener?.(CHECKOUT_RESET_REQUEST_EVENT, this.onResetRequested);
|
|
144
289
|
try {
|
|
145
290
|
this.card?.unmount?.();
|
|
146
291
|
}
|
|
@@ -148,8 +293,74 @@ export class CheckoutPublicHostComponent {
|
|
|
148
293
|
/* already gone */
|
|
149
294
|
}
|
|
150
295
|
}
|
|
296
|
+
/**
|
|
297
|
+
* Cancel resets the checkout to a blank form and tells the host page, which may close the modal
|
|
298
|
+
* the checkout sits in. The widget is re-created, so every field the buyer filled in is cleared,
|
|
299
|
+
* and the card field is mounted again on the new form. The session stays open for the next try.
|
|
300
|
+
*/
|
|
151
301
|
onCancelled() {
|
|
302
|
+
if (this.processing) {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
this.resetForm();
|
|
306
|
+
this.setState('CHECKOUT');
|
|
307
|
+
this.dispatch(CHECKOUT_CANCEL_EVENT, {});
|
|
308
|
+
this.dispatch(CHECKOUT_CLOSE_EVENT, {});
|
|
309
|
+
this.cdr.detectChanges();
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* A reset the embedding host asked for, by dispatching `checkout-reset` on the element (a voice
|
|
313
|
+
* or chat agent closing its panel, say). Refused while a payment is in flight — resetting then
|
|
314
|
+
* would strand a charge the buyer cannot see. Unlike Cancel it sends no `checkout-cancel` or
|
|
315
|
+
* `checkout-close`: the host started it. Also refused while the account step after a sale is
|
|
316
|
+
* unsettled, since the buyer could not come back to it.
|
|
317
|
+
*
|
|
318
|
+
* A reset always starts a new session, before a sale as well as after one: the server matches
|
|
319
|
+
* the buyer's person record once per session, so a kept session would carry the previous
|
|
320
|
+
* conversation's buyer into the next. The e-mail and attribution are read again, so a host
|
|
321
|
+
* starting a new conversation sets them on the element before it dispatches the reset.
|
|
322
|
+
*/
|
|
323
|
+
resetRequested() {
|
|
324
|
+
if (this.processing || this.accountUnsettled) {
|
|
325
|
+
this.dispatch(CHECKOUT_RESET_REFUSED_EVENT, { state: this.state });
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
this.successMessage = null;
|
|
329
|
+
this.orderNumber = null;
|
|
330
|
+
this.account = null;
|
|
331
|
+
this.accountDismissed = false;
|
|
332
|
+
this.password = '';
|
|
333
|
+
this.passwordConfirmation = '';
|
|
334
|
+
this.passwordError = null;
|
|
335
|
+
this.passwordSet = false;
|
|
336
|
+
this.config = null;
|
|
337
|
+
this.sessionId = '';
|
|
338
|
+
this.forgetClientKey();
|
|
339
|
+
this.forgetCompleting();
|
|
340
|
+
this.resetForm();
|
|
341
|
+
void this.ngOnInit();
|
|
342
|
+
}
|
|
343
|
+
/** The account step is still asking the buyer for something, and the buyer has not left it. */
|
|
344
|
+
get accountUnsettled() {
|
|
345
|
+
return this.accountLoading || this.passwordBusy || (!this.accountDismissed && !IsAccountSettled(this.account));
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Back to a blank form: every field, the error banner and the card entry. The session stays open.
|
|
349
|
+
* The caller reports the state, since a host reset reports `LOADING` next, not `CHECKOUT`.
|
|
350
|
+
*/
|
|
351
|
+
resetForm() {
|
|
152
352
|
this.errorMessage = null;
|
|
353
|
+
this.stripePaymentMethodId = null;
|
|
354
|
+
try {
|
|
355
|
+
this.card?.destroy?.();
|
|
356
|
+
}
|
|
357
|
+
catch {
|
|
358
|
+
/* already gone */
|
|
359
|
+
}
|
|
360
|
+
this.card = null;
|
|
361
|
+
this.cardMounted = false;
|
|
362
|
+
this.isPaymentReady = !this.config?.stripePublishableKey;
|
|
363
|
+
this.formGeneration++;
|
|
153
364
|
}
|
|
154
365
|
async onSubmitted(event) {
|
|
155
366
|
if (this.processing || !this.config?.productId) {
|
|
@@ -157,6 +368,7 @@ export class CheckoutPublicHostComponent {
|
|
|
157
368
|
}
|
|
158
369
|
this.processing = true;
|
|
159
370
|
this.errorMessage = null;
|
|
371
|
+
this.setState('PROCESSING');
|
|
160
372
|
try {
|
|
161
373
|
const line = buildCheckoutDraftLine(this.config.productId, event);
|
|
162
374
|
const draft = await this.post('/draft', {
|
|
@@ -164,6 +376,10 @@ export class CheckoutPublicHostComponent {
|
|
|
164
376
|
clientSessionKey: this.sessionKey,
|
|
165
377
|
email: event.email,
|
|
166
378
|
lines: [line],
|
|
379
|
+
answers: event.answers,
|
|
380
|
+
...(this.attributionSource
|
|
381
|
+
? { attribution: { source: this.attributionSource, reference: this.attributionReference } }
|
|
382
|
+
: {}),
|
|
167
383
|
});
|
|
168
384
|
if (!draft?.Success) {
|
|
169
385
|
throw new Error(this.str(draft?.ErrorMessage, 'Could not price this checkout.'));
|
|
@@ -211,6 +427,7 @@ export class CheckoutPublicHostComponent {
|
|
|
211
427
|
}
|
|
212
428
|
catch (err) {
|
|
213
429
|
this.errorMessage = err instanceof Error ? err.message : 'Checkout failed.';
|
|
430
|
+
this.reportError(this.errorMessage);
|
|
214
431
|
}
|
|
215
432
|
finally {
|
|
216
433
|
this.processing = false;
|
|
@@ -218,6 +435,8 @@ export class CheckoutPublicHostComponent {
|
|
|
218
435
|
}
|
|
219
436
|
}
|
|
220
437
|
async finish() {
|
|
438
|
+
// Remembered before completing, so a reload after payment returns to the account step.
|
|
439
|
+
this.rememberCompleting(this.sessionId);
|
|
221
440
|
const done = await this.post('/complete', {
|
|
222
441
|
sessionId: this.sessionId,
|
|
223
442
|
clientSessionKey: this.sessionKey,
|
|
@@ -229,11 +448,153 @@ export class CheckoutPublicHostComponent {
|
|
|
229
448
|
this.successMessage =
|
|
230
449
|
this.config?.successMessage ||
|
|
231
450
|
(this.orderNumber ? `Thank you. Order ${this.orderNumber} is confirmed.` : 'Thank you. Your order is confirmed.');
|
|
232
|
-
|
|
233
|
-
|
|
451
|
+
// Dispatched before any redirect, so a host listener sees the sale on this page.
|
|
452
|
+
this.setState('SUCCESS');
|
|
453
|
+
this.dispatch(CHECKOUT_COMPLETE_EVENT, BuildCheckoutCompleteDetail({
|
|
454
|
+
sessionId: this.sessionId,
|
|
455
|
+
productName: this.config?.productName ?? this.config?.title,
|
|
456
|
+
productId: this.config?.productId,
|
|
457
|
+
totalGross: done.TotalGross,
|
|
458
|
+
currency: this.config?.currency,
|
|
459
|
+
// The applied promotion code, once the checkout takes one.
|
|
460
|
+
coupon: null,
|
|
461
|
+
}));
|
|
462
|
+
if (done.AccountStep === true) {
|
|
463
|
+
await this.loadAccount();
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
this.forgetCompleting();
|
|
467
|
+
this.leaveIfDone();
|
|
234
468
|
}
|
|
235
469
|
this.cdr.detectChanges();
|
|
236
470
|
}
|
|
471
|
+
/** Asks for the account step of the completed checkout. The host is asked again only after a failure. */
|
|
472
|
+
async loadAccount() {
|
|
473
|
+
this.accountLoading = true;
|
|
474
|
+
this.cdr.detectChanges();
|
|
475
|
+
try {
|
|
476
|
+
const res = await this.post('/account', {
|
|
477
|
+
sessionId: this.sessionId,
|
|
478
|
+
clientSessionKey: this.sessionKey,
|
|
479
|
+
});
|
|
480
|
+
this.account = res.Success ? ReadCheckoutAccount(res.Account) : ACCOUNT_STEP_FAILED;
|
|
481
|
+
}
|
|
482
|
+
catch {
|
|
483
|
+
this.account = ACCOUNT_STEP_FAILED;
|
|
484
|
+
}
|
|
485
|
+
finally {
|
|
486
|
+
this.accountLoading = false;
|
|
487
|
+
}
|
|
488
|
+
if (IsAccountSettled(this.account))
|
|
489
|
+
this.forgetCompleting();
|
|
490
|
+
this.leaveIfDone();
|
|
491
|
+
this.cdr.detectChanges();
|
|
492
|
+
}
|
|
493
|
+
/** Asks the host again after the account step failed. */
|
|
494
|
+
async retryAccount() {
|
|
495
|
+
if (this.accountLoading)
|
|
496
|
+
return;
|
|
497
|
+
await this.loadAccount();
|
|
498
|
+
}
|
|
499
|
+
/** Leaves a failed account step. A reload of this checkout in the same tab offers it again. */
|
|
500
|
+
dismissAccount() {
|
|
501
|
+
this.accountDismissed = true;
|
|
502
|
+
this.leaveIfDone();
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* A reload after payment: when this tab completed a checkout whose account step is not settled,
|
|
506
|
+
* shows the confirmation and the account step instead of a new checkout.
|
|
507
|
+
*/
|
|
508
|
+
async resumeAccountStep() {
|
|
509
|
+
const sessionId = this.completingSession();
|
|
510
|
+
if (!sessionId)
|
|
511
|
+
return false;
|
|
512
|
+
try {
|
|
513
|
+
const res = await this.post('/account', { sessionId, clientSessionKey: this.sessionKey });
|
|
514
|
+
const account = res.Success ? ReadCheckoutAccount(res.Account) : null;
|
|
515
|
+
if (!account) {
|
|
516
|
+
this.forgetCompleting();
|
|
517
|
+
return false;
|
|
518
|
+
}
|
|
519
|
+
this.sessionId = sessionId;
|
|
520
|
+
this.successMessage = 'Thank you. Your order is confirmed.';
|
|
521
|
+
this.account = account;
|
|
522
|
+
if (IsAccountSettled(account))
|
|
523
|
+
this.forgetCompleting();
|
|
524
|
+
return true;
|
|
525
|
+
}
|
|
526
|
+
catch {
|
|
527
|
+
return false;
|
|
528
|
+
}
|
|
529
|
+
finally {
|
|
530
|
+
this.cdr.detectChanges();
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
/** Sends the new account's password. The host's policy decides; its message is shown when it refuses. */
|
|
534
|
+
async submitPassword() {
|
|
535
|
+
const problem = CheckPasswordEntry(this.password, this.passwordConfirmation);
|
|
536
|
+
if (problem) {
|
|
537
|
+
this.passwordError = problem;
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
this.passwordBusy = true;
|
|
541
|
+
this.passwordError = null;
|
|
542
|
+
try {
|
|
543
|
+
const res = await this.post('/account/password', {
|
|
544
|
+
sessionId: this.sessionId,
|
|
545
|
+
clientSessionKey: this.sessionKey,
|
|
546
|
+
password: this.password,
|
|
547
|
+
});
|
|
548
|
+
this.account = ReadCheckoutAccount(res.Account) ?? this.account;
|
|
549
|
+
if (IsAccountSettled(this.account))
|
|
550
|
+
this.forgetCompleting();
|
|
551
|
+
if (res.Success) {
|
|
552
|
+
this.passwordSet = true;
|
|
553
|
+
this.password = '';
|
|
554
|
+
this.passwordConfirmation = '';
|
|
555
|
+
this.leaveIfDone();
|
|
556
|
+
}
|
|
557
|
+
else {
|
|
558
|
+
this.passwordError = this.str(res.ErrorMessage, 'That password could not be set. Please try another.');
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
catch {
|
|
562
|
+
this.passwordError = 'That password could not be set right now. Please try again.';
|
|
563
|
+
}
|
|
564
|
+
finally {
|
|
565
|
+
this.passwordBusy = false;
|
|
566
|
+
this.cdr.detectChanges();
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
/** Leaves the password for later: the buyer can reset it at sign-in. */
|
|
570
|
+
skipPassword() {
|
|
571
|
+
if (this.account)
|
|
572
|
+
this.account = { ...this.account, CanSetPassword: false };
|
|
573
|
+
this.forgetCompleting();
|
|
574
|
+
this.leaveIfDone();
|
|
575
|
+
}
|
|
576
|
+
/** Follows the widget's redirect once nothing is left for the buyer to do here. */
|
|
577
|
+
leaveIfDone() {
|
|
578
|
+
if (this.config?.redirectUrl && !this.accountLoading && MayRedirect(this.account, this.accountDismissed)) {
|
|
579
|
+
window.location.href = this.config.redirectUrl;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
/** Reports a state the host page can track; repeats of the same state are not re-sent. */
|
|
583
|
+
setState(state) {
|
|
584
|
+
if (this.state === state)
|
|
585
|
+
return;
|
|
586
|
+
this.state = state;
|
|
587
|
+
this.dispatch(CHECKOUT_STATE_CHANGE_EVENT, { state });
|
|
588
|
+
}
|
|
589
|
+
reportError(message) {
|
|
590
|
+
this.setState('ERROR');
|
|
591
|
+
this.dispatch(CHECKOUT_ERROR_EVENT, { message });
|
|
592
|
+
}
|
|
593
|
+
/** Dispatches on the `<mj-orders-checkout>` element; bubbling and composed, so `document` hears it too. */
|
|
594
|
+
dispatch(name, detail) {
|
|
595
|
+
const el = this.hostEl?.nativeElement;
|
|
596
|
+
el?.dispatchEvent(CheckoutElementEvent(name, detail));
|
|
597
|
+
}
|
|
237
598
|
async mountStripe(mount) {
|
|
238
599
|
const pk = this.config?.stripePublishableKey;
|
|
239
600
|
if (!pk) {
|
|
@@ -252,6 +613,7 @@ export class CheckoutPublicHostComponent {
|
|
|
252
613
|
catch (err) {
|
|
253
614
|
this.cardMounted = false;
|
|
254
615
|
this.errorMessage = err instanceof Error ? err.message : 'Could not load card entry.';
|
|
616
|
+
this.reportError(this.errorMessage);
|
|
255
617
|
}
|
|
256
618
|
}
|
|
257
619
|
loadStripe(pk) {
|
|
@@ -290,6 +652,29 @@ export class CheckoutPublicHostComponent {
|
|
|
290
652
|
if (apiRoot) {
|
|
291
653
|
this.apiRoot = apiRoot.replace(/\/+$/, '');
|
|
292
654
|
}
|
|
655
|
+
this.readConversationAttributes();
|
|
656
|
+
el.addEventListener?.(CHECKOUT_RESET_REQUEST_EVENT, this.onResetRequested);
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* For a host that embeds the checkout in its own panel: an e-mail it already knows, and where the
|
|
660
|
+
* checkout came from. The server keeps the attribution only if it reads as one.
|
|
661
|
+
*/
|
|
662
|
+
readConversationAttributes() {
|
|
663
|
+
const el = this.hostEl?.nativeElement;
|
|
664
|
+
if (!el) {
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
this.prefillEmail = el.getAttribute('email') || el.getAttribute('data-email') || null;
|
|
668
|
+
this.attributionSource = el.getAttribute('source') || el.getAttribute('data-source') || null;
|
|
669
|
+
this.attributionReference = el.getAttribute('source-ref') || el.getAttribute('data-source-ref') || null;
|
|
670
|
+
}
|
|
671
|
+
forgetClientKey() {
|
|
672
|
+
try {
|
|
673
|
+
sessionStorage.removeItem(`mj-checkout-key:${this.slug}`);
|
|
674
|
+
}
|
|
675
|
+
catch {
|
|
676
|
+
/* private mode */
|
|
677
|
+
}
|
|
293
678
|
}
|
|
294
679
|
clientKey() {
|
|
295
680
|
const storageKey = `mj-checkout-key:${this.slug}`;
|
|
@@ -324,6 +709,33 @@ export class CheckoutPublicHostComponent {
|
|
|
324
709
|
}
|
|
325
710
|
return key;
|
|
326
711
|
}
|
|
712
|
+
get completingKey() {
|
|
713
|
+
return `mj-checkout-completing:${this.slug}`;
|
|
714
|
+
}
|
|
715
|
+
rememberCompleting(sessionId) {
|
|
716
|
+
try {
|
|
717
|
+
sessionStorage.setItem(this.completingKey, sessionId);
|
|
718
|
+
}
|
|
719
|
+
catch {
|
|
720
|
+
/* private mode */
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
forgetCompleting() {
|
|
724
|
+
try {
|
|
725
|
+
sessionStorage.removeItem(this.completingKey);
|
|
726
|
+
}
|
|
727
|
+
catch {
|
|
728
|
+
/* private mode */
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
completingSession() {
|
|
732
|
+
try {
|
|
733
|
+
return sessionStorage.getItem(this.completingKey);
|
|
734
|
+
}
|
|
735
|
+
catch {
|
|
736
|
+
return null;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
327
739
|
async post(path, body) {
|
|
328
740
|
const res = await fetch(`${this.apiRoot}${path}`, {
|
|
329
741
|
method: 'POST',
|
|
@@ -339,22 +751,22 @@ export class CheckoutPublicHostComponent {
|
|
|
339
751
|
return typeof value === 'string' && value ? value : fallback;
|
|
340
752
|
}
|
|
341
753
|
static ɵfac = function CheckoutPublicHostComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CheckoutPublicHostComponent)(); };
|
|
342
|
-
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CheckoutPublicHostComponent, selectors: [["mj-orders-checkout"]], inputs: { slug: "slug", apiRoot: "apiRoot" }, decls: 5, 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"], [3, "
|
|
754
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CheckoutPublicHostComponent, selectors: [["mj-orders-checkout"]], inputs: { slug: "slug", apiRoot: "apiRoot" }, decls: 5, 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"], ["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-account__msg"], [1, "mj-checkout-account"], [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"], [3, "config", "distributionSlug", "sessionKey", "isProcessing", "isPaymentReady", "stripePaymentMethodId", "prefillEmail", "errorMessage"], [3, "submitted", "cancelled", "config", "distributionSlug", "sessionKey", "isProcessing", "isPaymentReady", "stripePaymentMethodId", "prefillEmail", "errorMessage"]], template: function CheckoutPublicHostComponent_Template(rf, ctx) { if (rf & 1) {
|
|
343
755
|
i0.ɵɵelementStart(0, "div", 0);
|
|
344
|
-
i0.ɵɵconditionalCreate(1, CheckoutPublicHostComponent_Conditional_1_Template, 2, 1, "div", 1)(2, CheckoutPublicHostComponent_Conditional_2_Template,
|
|
756
|
+
i0.ɵɵconditionalCreate(1, CheckoutPublicHostComponent_Conditional_1_Template, 2, 1, "div", 1)(2, CheckoutPublicHostComponent_Conditional_2_Template, 11, 3, "div", 2)(3, CheckoutPublicHostComponent_Conditional_3_Template, 2, 0, "p", 3)(4, CheckoutPublicHostComponent_Conditional_4_Template, 2, 2);
|
|
345
757
|
i0.ɵɵelementEnd();
|
|
346
758
|
} if (rf & 2) {
|
|
347
759
|
i0.ɵɵadvance();
|
|
348
760
|
i0.ɵɵconditional(ctx.loadError ? 1 : ctx.successMessage ? 2 : !ctx.config ? 3 : 4);
|
|
349
|
-
} }, 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}"] });
|
|
761
|
+
} }, 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-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}"] });
|
|
350
762
|
}
|
|
351
763
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckoutPublicHostComponent, [{
|
|
352
764
|
type: Component,
|
|
353
|
-
args: [{ selector: 'mj-orders-checkout', standalone: true, imports: [CommonModule, MJCheckoutWidgetComponent], template: "<div class=\"mj-checkout-public\">\n @if (loadError) {\n <div class=\"mj-widget-error-banner\" role=\"alert\">{{ loadError }}</div>\n } @else if (successMessage) {\n <div class=\"mj-checkout-success\" role=\"status\">\n <div class=\"mj-checkout-success__icon\" aria-hidden=\"true\">\u2713</div>\n <h1 class=\"mj-checkout-success__title\">You're all set</h1>\n <p class=\"mj-checkout-success__msg\">{{ successMessage }}</p>\n @if (orderNumber) {\n <p class=\"mj-checkout-success__order\">Order {{ orderNumber }}</p>\n }\n </div>\n } @else if (!config) {\n <p class=\"mj-checkout-public__status\" role=\"status\">Loading checkout\u2026</p>\n } @else {\n <mj-checkout-widget\n [config]=\"config\"\n [distributionSlug]=\"slug\"\n [sessionKey]=\"sessionKey\"\n [isProcessing]=\"processing\"\n [isPaymentReady]=\"isPaymentReady\"\n [stripePaymentMethodId]=\"stripePaymentMethodId\"\n [errorMessage]=\"errorMessage\"\n (submitted)=\"onSubmitted($event)\"\n (cancelled)=\"onCancelled()\">\n </mj-checkout-widget>\n }\n</div>\n", styles: [":host {\n display: block;\n}\n\n.mj-checkout-public {\n max-width: 580px;\n margin: 0 auto;\n}\n\n.mj-checkout-public__status {\n text-align: center;\n color: #64748b;\n font-size: 0.95rem;\n padding: 2rem 0;\n}\n\n.mj-widget-error-banner {\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 {\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 {\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 {\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,\n.mj-checkout-success__order {\n margin: 0;\n color: #64748b;\n font-size: 0.95rem;\n line-height: 1.5;\n}\n\n.mj-checkout-success__order {\n margin-top: 0.75rem;\n font-weight: 600;\n color: #334155;\n}\n"] }]
|
|
765
|
+
args: [{ selector: 'mj-orders-checkout', standalone: true, imports: [CommonModule, MJCheckoutWidgetComponent], template: "<div class=\"mj-checkout-public\">\n @if (loadError) {\n <div class=\"mj-widget-error-banner\" role=\"alert\">{{ loadError }}</div>\n } @else if (successMessage) {\n <div class=\"mj-checkout-success\" role=\"status\">\n <div class=\"mj-checkout-success__icon\" aria-hidden=\"true\">\u2713</div>\n <h1 class=\"mj-checkout-success__title\">You're all set</h1>\n <p class=\"mj-checkout-success__msg\">{{ successMessage }}</p>\n @if (orderNumber) {\n <p class=\"mj-checkout-success__order\">Order {{ orderNumber }}</p>\n }\n @if (accountLoading) {\n <p class=\"mj-checkout-account__msg\" role=\"status\">Setting up your account\u2026</p>\n } @else if (account?.CanSetPassword) {\n <form class=\"mj-checkout-account\" (submit)=\"$event.preventDefault(); submitPassword()\">\n <h2 class=\"mj-checkout-account__title\">Set a password for your account</h2>\n @if (verificationNote) {\n <p class=\"mj-checkout-account__note\">{{ verificationNote }}</p>\n }\n <label class=\"mj-checkout-account__label\" for=\"mj-checkout-password\">Password</label>\n <input\n id=\"mj-checkout-password\"\n class=\"mj-checkout-account__input\"\n type=\"password\"\n autocomplete=\"new-password\"\n [value]=\"password\"\n (input)=\"password = $any($event.target).value\" />\n <label class=\"mj-checkout-account__label\" for=\"mj-checkout-password-confirm\">Confirm password</label>\n <input\n id=\"mj-checkout-password-confirm\"\n class=\"mj-checkout-account__input\"\n type=\"password\"\n autocomplete=\"new-password\"\n [value]=\"passwordConfirmation\"\n (input)=\"passwordConfirmation = $any($event.target).value\" />\n @if (passwordError) {\n <p class=\"mj-checkout-account__error\" role=\"alert\">{{ passwordError }}</p>\n }\n <button class=\"mj-checkout-account__submit\" type=\"submit\" [disabled]=\"passwordBusy\">\n {{ passwordBusy ? 'Saving\u2026' : 'Set password' }}\n </button>\n <button class=\"mj-checkout-account__skip\" type=\"button\" (click)=\"skipPassword()\" [disabled]=\"passwordBusy\">\n Not now\n </button>\n </form>\n } @else if (accountMessage) {\n <p class=\"mj-checkout-account__msg\" role=\"status\">{{ accountMessage }}</p>\n @if (account?.Outcome === 'Failed') {\n <div class=\"mj-checkout-account mj-checkout-account--actions\">\n <button class=\"mj-checkout-account__submit\" type=\"button\" (click)=\"retryAccount()\">Try again</button>\n @if (config?.redirectUrl) {\n <button class=\"mj-checkout-account__skip\" type=\"button\" (click)=\"dismissAccount()\">Not now</button>\n }\n </div>\n }\n }\n </div>\n } @else if (!config) {\n <p class=\"mj-checkout-public__status\" role=\"status\">Loading checkout\u2026</p>\n } @else {\n @for (generation of [formGeneration]; track generation) {\n <mj-checkout-widget\n [config]=\"config\"\n [distributionSlug]=\"slug\"\n [sessionKey]=\"sessionKey\"\n [isProcessing]=\"processing\"\n [isPaymentReady]=\"isPaymentReady\"\n [stripePaymentMethodId]=\"stripePaymentMethodId\"\n [prefillEmail]=\"prefillEmail\"\n [errorMessage]=\"errorMessage\"\n (submitted)=\"onSubmitted($event)\"\n (cancelled)=\"onCancelled()\">\n </mj-checkout-widget>\n }\n }\n</div>\n", styles: [":host {\n display: block;\n}\n\n.mj-checkout-public {\n max-width: 580px;\n margin: 0 auto;\n}\n\n.mj-checkout-public__status {\n text-align: center;\n color: #64748b;\n font-size: 0.95rem;\n padding: 2rem 0;\n}\n\n.mj-widget-error-banner {\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 {\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 {\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 {\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,\n.mj-checkout-success__order {\n margin: 0;\n color: #64748b;\n font-size: 0.95rem;\n line-height: 1.5;\n}\n\n.mj-checkout-success__order {\n margin-top: 0.75rem;\n font-weight: 600;\n color: #334155;\n}\n\n/* Post-payment account step: set a password for the account the host created (#292). */\n.mj-checkout-account {\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 {\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 {\n font-size: 0.85rem;\n font-weight: 600;\n color: #334155;\n}\n\n.mj-checkout-account__input {\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: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 {\n margin: 4px 0 0;\n color: #991b1b;\n font-size: 0.85rem;\n}\n\n.mj-checkout-account__submit {\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 {\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:disabled,\n.mj-checkout-account__skip:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}\n\n.mj-checkout-account__msg {\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 {\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 {\n margin-top: 0.75rem;\n}\n"] }]
|
|
354
766
|
}], null, { slug: [{
|
|
355
767
|
type: Input
|
|
356
768
|
}], apiRoot: [{
|
|
357
769
|
type: Input
|
|
358
770
|
}] }); })();
|
|
359
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CheckoutPublicHostComponent, { className: "CheckoutPublicHostComponent", filePath: "lib/checkout-widget/checkout-public-host.component.ts", lineNumber:
|
|
771
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CheckoutPublicHostComponent, { className: "CheckoutPublicHostComponent", filePath: "lib/checkout-widget/checkout-public-host.component.ts", lineNumber: 84 }); })();
|
|
360
772
|
//# sourceMappingURL=checkout-public-host.component.js.map
|