tf-checkout-react 1.4.13-beta.2 → 1.4.13-beta.4
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/components/delegationsContainer/IssueTicketForm.d.ts +1 -1
- package/dist/components/delegationsContainer/TicketsAssignedTable.d.ts +2 -1
- package/dist/tf-checkout-react.cjs.development.js +75 -52
- package/dist/tf-checkout-react.cjs.development.js.map +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
- package/dist/tf-checkout-react.esm.js +75 -52
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/common/FieldSection/index.tsx +2 -3
- package/src/components/delegationsContainer/IssueComponent.tsx +16 -4
- package/src/components/delegationsContainer/IssueTicketForm.tsx +17 -20
- package/src/components/delegationsContainer/TicketsAssignedTable.tsx +27 -23
- package/src/components/delegationsContainer/TicketsAvailableTable.tsx +1 -1
- package/src/components/delegationsContainer/index.tsx +1 -0
- package/src/components/registerForm/index.tsx +3 -1
- package/src/utils/form.ts +1 -1
- package/src/validators/index.ts +2 -2
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
export interface ITicketsAssignedTable {
|
|
3
3
|
tableTitle?: string;
|
|
4
4
|
classNamePrefix?: string;
|
|
5
|
+
noTicketsAssignedText?: string;
|
|
5
6
|
issuePageData: {
|
|
6
7
|
tickets: Array<any>;
|
|
7
8
|
};
|
|
8
9
|
}
|
|
9
|
-
declare const TicketsAssignedTable: ({ tableTitle, classNamePrefix, issuePageData, }: ITicketsAssignedTable) => JSX.Element;
|
|
10
|
+
declare const TicketsAssignedTable: ({ tableTitle, classNamePrefix, issuePageData, noTicketsAssignedText, }: ITicketsAssignedTable) => JSX.Element;
|
|
10
11
|
export default TicketsAssignedTable;
|
|
@@ -709,7 +709,7 @@ var getFormInitialValues = function getFormInitialValues(fieldsSections) {
|
|
|
709
709
|
case 'country':
|
|
710
710
|
case 'numTickets':
|
|
711
711
|
case 'state':
|
|
712
|
-
initialValues[fieldItem.name] =
|
|
712
|
+
initialValues[fieldItem.name] = '';
|
|
713
713
|
break;
|
|
714
714
|
case 'brandOptIn':
|
|
715
715
|
initialValues[fieldItem.name] = true;
|
|
@@ -1506,9 +1506,9 @@ function isFalsy(item) {
|
|
|
1506
1506
|
try {
|
|
1507
1507
|
if (!item ||
|
|
1508
1508
|
// handles most, like false, 0, null, etc
|
|
1509
|
-
typeof item
|
|
1509
|
+
typeof item === 'object' && Object.keys(item).length === 0 &&
|
|
1510
1510
|
// for empty objects, like {}, []
|
|
1511
|
-
!(typeof item.addEventListener
|
|
1511
|
+
!(typeof item.addEventListener === 'function') // omit webpage elements
|
|
1512
1512
|
) {
|
|
1513
1513
|
return true;
|
|
1514
1514
|
}
|
|
@@ -8601,11 +8601,11 @@ var FieldsSection = function FieldsSection(_ref2) {
|
|
|
8601
8601
|
id: id,
|
|
8602
8602
|
className: getFieldClassNames(id, classNames)
|
|
8603
8603
|
}, React__default.createElement(formik.Field, {
|
|
8604
|
-
disabled: name === disableField,
|
|
8604
|
+
disabled: name === disableField || name === 'state' && !states.length,
|
|
8605
8605
|
name: name,
|
|
8606
8606
|
label: "" + label + (required ? '' : ' (optional)'),
|
|
8607
8607
|
type: type,
|
|
8608
|
-
validate: getValidateFunctions$1({
|
|
8608
|
+
validate: name === 'state' && !states.length ? false : getValidateFunctions$1({
|
|
8609
8609
|
element: fieldData,
|
|
8610
8610
|
values: values
|
|
8611
8611
|
}),
|
|
@@ -8838,7 +8838,7 @@ var RegistrationForm = function RegistrationForm(_ref) {
|
|
|
8838
8838
|
bodyFormData.append('client_id', CONFIGS.CLIENT_ID);
|
|
8839
8839
|
bodyFormData.append('client_secret', CONFIGS.CLIENT_SECRET);
|
|
8840
8840
|
bodyFormData.append('register_for', registrationType);
|
|
8841
|
-
bodyFormData.append('
|
|
8841
|
+
bodyFormData.append('delegation_access_hash', accessHash);
|
|
8842
8842
|
_context3.next = 18;
|
|
8843
8843
|
return register(bodyFormData);
|
|
8844
8844
|
case 18:
|
|
@@ -8873,7 +8873,9 @@ var RegistrationForm = function RegistrationForm(_ref) {
|
|
|
8873
8873
|
}, []);
|
|
8874
8874
|
return React__default.createElement("div", {
|
|
8875
8875
|
className: "register-form-container"
|
|
8876
|
-
},
|
|
8876
|
+
}, React__default.createElement("h2", null, "Create an account"), React__default.createElement("div", {
|
|
8877
|
+
className: 'register-sub-title'
|
|
8878
|
+
}, "To manage your tickets, please create an account:"), error && React__default.createElement("div", {
|
|
8877
8879
|
className: "register-error"
|
|
8878
8880
|
}, error), React__default.createElement(formik.Formik, {
|
|
8879
8881
|
initialValues: _extends({}, getFormInitialValues(updatedFormFields), {
|
|
@@ -8917,20 +8919,19 @@ var IssueTicketForm = function IssueTicketForm(_ref) {
|
|
|
8917
8919
|
handleSubmit = _ref$handleSubmit === void 0 ? _identity : _ref$handleSubmit,
|
|
8918
8920
|
selectTicketTypeOptions = _ref.selectTicketTypeOptions,
|
|
8919
8921
|
initialValues = _ref.initialValues;
|
|
8920
|
-
var _useState = React.useState(false),
|
|
8921
|
-
agreeTerms = _useState[0],
|
|
8922
|
-
setAgreeTerms = _useState[1];
|
|
8923
8922
|
return React__default.createElement("div", {
|
|
8924
8923
|
className: classNamePrefix + "-issue-form"
|
|
8925
8924
|
}, React__default.createElement(formik.Formik, {
|
|
8926
8925
|
initialValues: initialValues,
|
|
8927
|
-
onSubmit: function onSubmit(values) {
|
|
8928
|
-
|
|
8926
|
+
onSubmit: function onSubmit(values, _ref2) {
|
|
8927
|
+
var resetForm = _ref2.resetForm;
|
|
8928
|
+
delete values.confirm;
|
|
8929
|
+
handleSubmit(values, resetForm);
|
|
8929
8930
|
}
|
|
8930
|
-
}, function (
|
|
8931
|
-
var isValid =
|
|
8932
|
-
values =
|
|
8933
|
-
isSubmitting =
|
|
8931
|
+
}, function (_ref3) {
|
|
8932
|
+
var isValid = _ref3.isValid,
|
|
8933
|
+
values = _ref3.values,
|
|
8934
|
+
isSubmitting = _ref3.isSubmitting;
|
|
8934
8935
|
return React__default.createElement(formik.Form, null, React__default.createElement("div", {
|
|
8935
8936
|
className: "body"
|
|
8936
8937
|
}, React__default.createElement("div", {
|
|
@@ -8978,27 +8979,27 @@ var IssueTicketForm = function IssueTicketForm(_ref) {
|
|
|
8978
8979
|
name: "confirmEmail",
|
|
8979
8980
|
label: "Confirm Email",
|
|
8980
8981
|
component: CustomField,
|
|
8981
|
-
validate:
|
|
8982
|
-
|
|
8983
|
-
|
|
8982
|
+
validate: getValidateFunctions$1({
|
|
8983
|
+
element: {
|
|
8984
|
+
name: 'confirmEmail',
|
|
8985
|
+
label: 'Confirm Email',
|
|
8986
|
+
required: true
|
|
8987
|
+
},
|
|
8988
|
+
values: values
|
|
8989
|
+
})
|
|
8984
8990
|
}))), React__default.createElement("div", {
|
|
8985
8991
|
className: "field-item checkbox_item"
|
|
8986
8992
|
}, React__default.createElement(formik.Field, {
|
|
8987
|
-
onChange: function onChange(_) {
|
|
8988
|
-
setAgreeTerms(!agreeTerms);
|
|
8989
|
-
},
|
|
8990
|
-
checked: agreeTerms,
|
|
8991
|
-
//required={true}
|
|
8992
8993
|
name: 'confirm',
|
|
8993
|
-
label: "I agree to
|
|
8994
|
+
label: "I agree to ManaCommon's privacy policy",
|
|
8994
8995
|
type: 'checkbox',
|
|
8995
|
-
|
|
8996
|
+
validate: requiredValidator,
|
|
8996
8997
|
component: CheckboxField
|
|
8997
8998
|
})), React__default.createElement("div", {
|
|
8998
8999
|
className: "action-button"
|
|
8999
9000
|
}, React__default.createElement("button", {
|
|
9000
9001
|
type: "submit",
|
|
9001
|
-
disabled: !isValid
|
|
9002
|
+
disabled: !isValid
|
|
9002
9003
|
}, isSubmitting ? React__default.createElement(material.CircularProgress, {
|
|
9003
9004
|
size: "22px"
|
|
9004
9005
|
}) : 'Issue Ticket')));
|
|
@@ -9006,17 +9007,19 @@ var IssueTicketForm = function IssueTicketForm(_ref) {
|
|
|
9006
9007
|
};
|
|
9007
9008
|
|
|
9008
9009
|
var TicketsAssignedTable = function TicketsAssignedTable(_ref) {
|
|
9009
|
-
var _issuePageData$ticket;
|
|
9010
|
+
var _issuePageData$ticket, _issuePageData$ticket2;
|
|
9010
9011
|
var _ref$tableTitle = _ref.tableTitle,
|
|
9011
|
-
tableTitle = _ref$tableTitle === void 0 ? 'Tickets
|
|
9012
|
+
tableTitle = _ref$tableTitle === void 0 ? 'Tickets assigned' : _ref$tableTitle,
|
|
9012
9013
|
_ref$classNamePrefix = _ref.classNamePrefix,
|
|
9013
9014
|
classNamePrefix = _ref$classNamePrefix === void 0 ? 'delegations' : _ref$classNamePrefix,
|
|
9014
|
-
issuePageData = _ref.issuePageData
|
|
9015
|
+
issuePageData = _ref.issuePageData,
|
|
9016
|
+
_ref$noTicketsAssigne = _ref.noTicketsAssignedText,
|
|
9017
|
+
noTicketsAssignedText = _ref$noTicketsAssigne === void 0 ? "You haven't issued any tickets yet." : _ref$noTicketsAssigne;
|
|
9015
9018
|
return React__default.createElement("div", {
|
|
9016
9019
|
className: classNamePrefix + "-tables-block"
|
|
9017
9020
|
}, React__default.createElement("div", {
|
|
9018
9021
|
className: classNamePrefix + "-ticket-holder"
|
|
9019
|
-
}, tableTitle), React__default.createElement(TableContainer, {
|
|
9022
|
+
}, tableTitle), (_issuePageData$ticket = issuePageData.tickets) != null && _issuePageData$ticket.length ? React__default.createElement(TableContainer, {
|
|
9020
9023
|
className: "my-ticket-table"
|
|
9021
9024
|
}, React__default.createElement(Table, {
|
|
9022
9025
|
"aria-label": "collapsible table"
|
|
@@ -9026,20 +9029,22 @@ var TicketsAssignedTable = function TicketsAssignedTable(_ref) {
|
|
|
9026
9029
|
key: 'Ticket Type'
|
|
9027
9030
|
}, 'Ticket Type'), React__default.createElement(TableCell, {
|
|
9028
9031
|
key: 'Status'
|
|
9029
|
-
}, 'Status'))), React__default.createElement(TableBody, null, (_issuePageData$
|
|
9030
|
-
return React__default.createElement(TableRow,
|
|
9032
|
+
}, 'Status'))), React__default.createElement(TableBody, null, (_issuePageData$ticket2 = issuePageData.tickets) == null ? void 0 : _issuePageData$ticket2.map(function (ticket) {
|
|
9033
|
+
return React__default.createElement(TableRow, {
|
|
9034
|
+
key: ticket.id
|
|
9035
|
+
}, React__default.createElement(TableCell, {
|
|
9031
9036
|
key: ticket.id + 'type'
|
|
9032
9037
|
}, ticket.firstName + ' ' + ticket.lastName), React__default.createElement(TableCell, {
|
|
9033
9038
|
key: ticket.id + 'ticketType'
|
|
9034
9039
|
}, ticket.ticketType), React__default.createElement(TableCell, {
|
|
9035
9040
|
key: ticket.id + 'status'
|
|
9036
9041
|
}, ticket.status));
|
|
9037
|
-
})))));
|
|
9042
|
+
})))) : noTicketsAssignedText);
|
|
9038
9043
|
};
|
|
9039
9044
|
|
|
9040
9045
|
var TicketsAvailableTable = function TicketsAvailableTable(_ref) {
|
|
9041
9046
|
var _ref$tableTitle = _ref.tableTitle,
|
|
9042
|
-
tableTitle = _ref$tableTitle === void 0 ? 'Tickets
|
|
9047
|
+
tableTitle = _ref$tableTitle === void 0 ? 'Tickets available' : _ref$tableTitle,
|
|
9043
9048
|
_ref$classNamePrefix = _ref.classNamePrefix,
|
|
9044
9049
|
classNamePrefix = _ref$classNamePrefix === void 0 ? 'delegations' : _ref$classNamePrefix,
|
|
9045
9050
|
issuePageData = _ref.issuePageData;
|
|
@@ -9088,10 +9093,13 @@ var IssueComponent = function IssueComponent(_ref) {
|
|
|
9088
9093
|
var _useState2 = React.useState(false),
|
|
9089
9094
|
showMaxQtyModal = _useState2[0],
|
|
9090
9095
|
setShowMaxQtyModal = _useState2[1];
|
|
9096
|
+
var _useState3 = React.useState(false),
|
|
9097
|
+
showSuccessModal = _useState3[0],
|
|
9098
|
+
setShowSuccessModal = _useState3[1];
|
|
9091
9099
|
var accessHash = getQueryVariable('hash') || '';
|
|
9092
|
-
var
|
|
9093
|
-
issuePageData =
|
|
9094
|
-
setIssuePageData =
|
|
9100
|
+
var _useState4 = React.useState({}),
|
|
9101
|
+
issuePageData = _useState4[0],
|
|
9102
|
+
setIssuePageData = _useState4[1];
|
|
9095
9103
|
React.useEffect(function () {
|
|
9096
9104
|
var fetchDelegationTickets = /*#__PURE__*/function () {
|
|
9097
9105
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
@@ -9127,7 +9135,7 @@ var IssueComponent = function IssueComponent(_ref) {
|
|
|
9127
9135
|
};
|
|
9128
9136
|
}();
|
|
9129
9137
|
fetchDelegationTickets();
|
|
9130
|
-
}, []);
|
|
9138
|
+
}, [showSuccessModal]);
|
|
9131
9139
|
var selectTicketTypeOptions = _map(issuePageData.ticketTypes || {}, function (val, key) {
|
|
9132
9140
|
return {
|
|
9133
9141
|
value: key,
|
|
@@ -9145,6 +9153,15 @@ var IssueComponent = function IssueComponent(_ref) {
|
|
|
9145
9153
|
onConfirm: function onConfirm() {
|
|
9146
9154
|
return setShowMaxQtyModal(false);
|
|
9147
9155
|
}
|
|
9156
|
+
}), showSuccessModal && React__default.createElement(ConfirmModal, {
|
|
9157
|
+
hideCancelBtn: true,
|
|
9158
|
+
message: "Your ticket successfully issued.",
|
|
9159
|
+
onClose: function onClose() {
|
|
9160
|
+
return setShowSuccessModal(false);
|
|
9161
|
+
},
|
|
9162
|
+
onConfirm: function onConfirm() {
|
|
9163
|
+
return setShowSuccessModal(false);
|
|
9164
|
+
}
|
|
9148
9165
|
}), React__default.createElement("div", {
|
|
9149
9166
|
className: classNamePrefix + "-head-title"
|
|
9150
9167
|
}, headTitle), React__default.createElement("div", {
|
|
@@ -9158,11 +9175,11 @@ var IssueComponent = function IssueComponent(_ref) {
|
|
|
9158
9175
|
})), React__default.createElement("div", {
|
|
9159
9176
|
className: classNamePrefix + "-tables"
|
|
9160
9177
|
}, React__default.createElement(TicketsAvailableTable, {
|
|
9161
|
-
tableTitle: "Tickets
|
|
9178
|
+
tableTitle: "Tickets available",
|
|
9162
9179
|
issuePageData: issuePageData,
|
|
9163
9180
|
classNamePrefix: "delegations"
|
|
9164
9181
|
}), React__default.createElement(TicketsAssignedTable, {
|
|
9165
|
-
tableTitle: "Tickets
|
|
9182
|
+
tableTitle: "Tickets assigned",
|
|
9166
9183
|
issuePageData: issuePageData,
|
|
9167
9184
|
classNamePrefix: "delegations"
|
|
9168
9185
|
}), React__default.createElement("div", {
|
|
@@ -9174,7 +9191,7 @@ var IssueComponent = function IssueComponent(_ref) {
|
|
|
9174
9191
|
}, "Please select the type of tickets and enter recipient details:")), React__default.createElement(IssueTicketForm, {
|
|
9175
9192
|
classNamePrefix: 'delegations',
|
|
9176
9193
|
handleSubmit: function () {
|
|
9177
|
-
var _handleSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(values) {
|
|
9194
|
+
var _handleSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(values, resetForm) {
|
|
9178
9195
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
9179
9196
|
while (1) switch (_context2.prev = _context2.next) {
|
|
9180
9197
|
case 0:
|
|
@@ -9182,23 +9199,25 @@ var IssueComponent = function IssueComponent(_ref) {
|
|
|
9182
9199
|
_context2.next = 3;
|
|
9183
9200
|
return issueTicket(accessHash, values);
|
|
9184
9201
|
case 3:
|
|
9185
|
-
|
|
9202
|
+
setShowSuccessModal(true);
|
|
9203
|
+
resetForm();
|
|
9204
|
+
_context2.next = 10;
|
|
9186
9205
|
break;
|
|
9187
|
-
case
|
|
9188
|
-
_context2.prev =
|
|
9206
|
+
case 7:
|
|
9207
|
+
_context2.prev = 7;
|
|
9189
9208
|
_context2.t0 = _context2["catch"](0);
|
|
9190
9209
|
if (axios.isAxiosError(_context2.t0)) setShowMaxQtyModal(true);
|
|
9191
|
-
case
|
|
9192
|
-
_context2.prev =
|
|
9210
|
+
case 10:
|
|
9211
|
+
_context2.prev = 10;
|
|
9193
9212
|
setLoading(false);
|
|
9194
|
-
return _context2.finish(
|
|
9195
|
-
case
|
|
9213
|
+
return _context2.finish(10);
|
|
9214
|
+
case 13:
|
|
9196
9215
|
case "end":
|
|
9197
9216
|
return _context2.stop();
|
|
9198
9217
|
}
|
|
9199
|
-
}, _callee2, null, [[0,
|
|
9218
|
+
}, _callee2, null, [[0, 7, 10, 13]]);
|
|
9200
9219
|
}));
|
|
9201
|
-
function handleSubmit(_x) {
|
|
9220
|
+
function handleSubmit(_x, _x2) {
|
|
9202
9221
|
return _handleSubmit.apply(this, arguments);
|
|
9203
9222
|
}
|
|
9204
9223
|
return handleSubmit;
|
|
@@ -9209,7 +9228,8 @@ var IssueComponent = function IssueComponent(_ref) {
|
|
|
9209
9228
|
firstName: '',
|
|
9210
9229
|
lastName: '',
|
|
9211
9230
|
email: '',
|
|
9212
|
-
confirmEmail: ''
|
|
9231
|
+
confirmEmail: '',
|
|
9232
|
+
confirm: false
|
|
9213
9233
|
}
|
|
9214
9234
|
})))));
|
|
9215
9235
|
};
|
|
@@ -9291,6 +9311,9 @@ var DelegationsContainer = function DelegationsContainer(_ref) {
|
|
|
9291
9311
|
})) : isCustomerExsists ? React__default.createElement(LoginForm, {
|
|
9292
9312
|
logo: logo
|
|
9293
9313
|
}) : React__default.createElement(RegistrationForm, {
|
|
9314
|
+
onRegisterAccountSuccess: function onRegisterAccountSuccess() {
|
|
9315
|
+
return setIsLoggedIn(Boolean(getCookieByName(X_TF_ECOMMERCE$1)));
|
|
9316
|
+
},
|
|
9294
9317
|
customerEmail: customerEmail,
|
|
9295
9318
|
formFields: registerFormFields,
|
|
9296
9319
|
registrationType: "delegation"
|