Merge remote-tracking branch 'origin/staging'

This commit is contained in:
zino
2021-05-23 22:44:57 +02:00
21 changed files with 799 additions and 56032 deletions

1
client/dist/inject.css vendored Normal file
View File

@@ -0,0 +1 @@
#containerBookingBtn{display:none;margin:0}#get_flash{display:none}.ui-dialog-title{text-align:center;display:none}.ui-widget-overlay{background:#fff;opacity:1;width:100vw;height:100vh}#openSeatmap img{width:64px}#openSeatmap{padding:1rem;font-weight:700;color:#ffb201;font-size:1rem;cursor:pointer}#openSeatmap span{font-size:.8rem}#foobarParent{display:none}div#dialogSeatmap{padding-top:0}.ui-widget-header{background:#fff;border:1px solid #c6c6c6;border-bottom-right-radius:0;border-bottom-left-radius:0}.ui-dialog{background:#fff;left:0!important;padding:0;top:0!important;right:0!important}.ui-dialog .ui-dialog-content{padding:0}.ui-dialog-titlebar{margin-left:0;margin-right:0;padding:0!important;display:none}#iframeSeatmap{height:100vh;background:#fff;width:100%}.ui-corner-all{border-radius:0}.ui-widget{border:none!important}

28669
client/dist/inject.js vendored

File diff suppressed because one or more lines are too long

1
client/dist/seatmap.css vendored Normal file

File diff suppressed because one or more lines are too long

27766
client/dist/seatmap.js vendored

File diff suppressed because one or more lines are too long

166
client/package-lock.json generated
View File

@@ -20,10 +20,12 @@
"@types/xml2js": "^0.4.8",
"browserify": "^17.0.0",
"browserify-css": "^0.15.0",
"envify": "^4.1.0",
"jquery": "^3.6.0",
"jquery-ui": "^1.12.1",
"tsify": "^5.0.2",
"uglify-js": "^3.13.0"
"uglify-js": "^3.13.0",
"uglifyify": "^5.0.2"
}
},
"node_modules/@panzoom/panzoom": {
@@ -543,6 +545,12 @@
"source-map": "~0.5.3"
}
},
"node_modules/commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
},
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -815,6 +823,19 @@
"integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==",
"dev": true
},
"node_modules/envify": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/envify/-/envify-4.1.0.tgz",
"integrity": "sha512-IKRVVoAYr4pIx4yIWNsz9mOsboxlNXiu7TNBnem/K/uTHdkyzXWDzHCK7UTolqBbgaBz0tQHsD3YNls0uIIjiw==",
"dev": true,
"dependencies": {
"esprima": "^4.0.0",
"through": "~2.3.4"
},
"bin": {
"envify": "bin/envify"
}
},
"node_modules/error-ex": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
@@ -869,6 +890,19 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true,
"bin": {
"esparse": "bin/esparse.js",
"esvalidate": "bin/esvalidate.js"
},
"engines": {
"node": ">=4"
}
},
"node_modules/events": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
@@ -2054,6 +2088,25 @@
"urix": "^0.1.0"
}
},
"node_modules/source-map-support": {
"version": "0.5.19",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz",
"integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==",
"dev": true,
"dependencies": {
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
}
},
"node_modules/source-map-support/node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/source-map-url": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.1.tgz",
@@ -2216,6 +2269,32 @@
"acorn-node": "^1.2.0"
}
},
"node_modules/terser": {
"version": "3.17.0",
"resolved": "https://registry.npmjs.org/terser/-/terser-3.17.0.tgz",
"integrity": "sha512-/FQzzPJmCpjAH9Xvk2paiWrFq+5M6aVOf+2KRbwhByISDX/EujxsK+BAvrhb6H+2rtrLCHK9N01wO014vrIwVQ==",
"dev": true,
"dependencies": {
"commander": "^2.19.0",
"source-map": "~0.6.1",
"source-map-support": "~0.5.10"
},
"bin": {
"terser": "bin/uglifyjs"
},
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/terser/node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/through": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
@@ -2327,6 +2406,19 @@
"node": ">=0.8.0"
}
},
"node_modules/uglifyify": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/uglifyify/-/uglifyify-5.0.2.tgz",
"integrity": "sha512-NcSk6pgoC+IgwZZ2tVLVHq+VNKSvLPlLkF5oUiHPVOJI0s/OlSVYEGXG9PCAH0hcyFZLyvt4KBdPAQBRlVDn1Q==",
"dev": true,
"dependencies": {
"convert-source-map": "~1.1.0",
"minimatch": "^3.0.2",
"terser": "^3.7.5",
"through": "~2.3.4",
"xtend": "^4.0.1"
}
},
"node_modules/umd": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/umd/-/umd-3.0.3.tgz",
@@ -2936,6 +3028,12 @@
"source-map": "~0.5.3"
}
},
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -3185,6 +3283,16 @@
}
}
},
"envify": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/envify/-/envify-4.1.0.tgz",
"integrity": "sha512-IKRVVoAYr4pIx4yIWNsz9mOsboxlNXiu7TNBnem/K/uTHdkyzXWDzHCK7UTolqBbgaBz0tQHsD3YNls0uIIjiw==",
"dev": true,
"requires": {
"esprima": "^4.0.0",
"through": "~2.3.4"
}
},
"error-ex": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
@@ -3227,6 +3335,12 @@
"is-symbol": "^1.0.2"
}
},
"esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true
},
"events": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
@@ -4156,6 +4270,24 @@
"urix": "^0.1.0"
}
},
"source-map-support": {
"version": "0.5.19",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz",
"integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==",
"dev": true,
"requires": {
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
},
"dependencies": {
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
}
}
},
"source-map-url": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.1.tgz",
@@ -4301,6 +4433,25 @@
"acorn-node": "^1.2.0"
}
},
"terser": {
"version": "3.17.0",
"resolved": "https://registry.npmjs.org/terser/-/terser-3.17.0.tgz",
"integrity": "sha512-/FQzzPJmCpjAH9Xvk2paiWrFq+5M6aVOf+2KRbwhByISDX/EujxsK+BAvrhb6H+2rtrLCHK9N01wO014vrIwVQ==",
"dev": true,
"requires": {
"commander": "^2.19.0",
"source-map": "~0.6.1",
"source-map-support": "~0.5.10"
},
"dependencies": {
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
}
}
},
"through": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
@@ -4386,6 +4537,19 @@
"integrity": "sha512-TWYSWa9T2pPN4DIJYbU9oAjQx+5qdV5RUDxwARg8fmJZrD/V27Zj0JngW5xg1DFz42G0uDYl2XhzF6alSzD62w==",
"dev": true
},
"uglifyify": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/uglifyify/-/uglifyify-5.0.2.tgz",
"integrity": "sha512-NcSk6pgoC+IgwZZ2tVLVHq+VNKSvLPlLkF5oUiHPVOJI0s/OlSVYEGXG9PCAH0hcyFZLyvt4KBdPAQBRlVDn1Q==",
"dev": true,
"requires": {
"convert-source-map": "~1.1.0",
"minimatch": "^3.0.2",
"terser": "^3.7.5",
"through": "~2.3.4",
"xtend": "^4.0.1"
}
},
"umd": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/umd/-/umd-3.0.3.tgz",

View File

@@ -5,8 +5,14 @@
"main": "index.js",
"scripts": {
"browserifyf": "func() { browserify --debug -p [ tsify ] $1 > $2; }; func",
"watchifyf": "func() { watchify --debug --verbose -p [ tsify ] $1 -o $2; }; func",
"watchifyfcss": "func() { watchify -g browserify-css --debug --verbose -p [ tsify ] $1 -o $2; }; func"
"watchifyfdev": "func() { watchify -t [ envify --NODE_ENV development ] --debug --verbose -p [ tsify ] $1 -o $2; }; func",
"watchifyfprod": "func() { watchify -g uglifyify -t [ envify --NODE_ENV production ] --debug --verbose -p [ tsify ] $1 -o $2; }; func",
"watchifyfcssdev": "func() { watchify -t [ envify --NODE_ENV development ] -t [ browserify-css ] --output $1 ] --debug --verbose -p [ tsify ] $2 -o $3; }; func",
"watchifyfcssprod": "func() { watchify -t [ envify --NODE_ENV production ] -t [ browserify-css ] --debug --verbose -p [ tsify ] $1 -o $2; }; func",
"injectdev": "func() { watchify -t [ envify --NODE_ENV development ] -t [ browserify-css --output dist/inject.css ] --debug --verbose -p [ tsify ] src/inject.ts -o dist/inject.js; }; func",
"injectprod": "func() { watchify -t [ envify --NODE_ENV production ] -g [ uglifyify ] -t [ browserify-css --output dist/inject.css ] --debug --verbose -p [ tsify ] src/inject.ts -o dist/inject.js; }; func",
"seatmapdev": "func() { watchify -t [ envify --NODE_ENV development ] -t [ browserify-css --output dist/seatmap.css ] --debug --verbose -p [ tsify ] src/seatmap.ts -o dist/seatmap.js; }; func",
"seatmapprod": "func() { watchify -t [ envify --NODE_ENV production ] -g [ uglifyify ] -t [ browserify-css --output dist/seatmap.css ] --debug --verbose -p [ tsify ] src/seatmap.ts -o dist/seatmap.js; }; func"
},
"keywords": [],
"author": "",
@@ -18,10 +24,12 @@
"@types/xml2js": "^0.4.8",
"browserify": "^17.0.0",
"browserify-css": "^0.15.0",
"envify": "^4.1.0",
"jquery": "^3.6.0",
"jquery-ui": "^1.12.1",
"tsify": "^5.0.2",
"uglify-js": "^3.13.0"
"uglify-js": "^3.13.0",
"uglifyify": "^5.0.2"
},
"dependencies": {
"@panzoom/panzoom": "^4.3.2",
@@ -30,8 +38,12 @@
"xml2js": "^0.4.23"
},
"browserify-css": {
"autoInject": true,
"autoInject": false,
"minify": true,
"rootDir": "."
"rootDir": ".",
"stripComments": true,
"minifyOptions": {
"level": 2
}
}
}

View File

@@ -1,3 +1,5 @@
@import url("../../node_modules/jbox/dist/jBox.all.css");
div.seatCharts-cell {
height: 1vw;
display: table-cell;
@@ -285,3 +287,7 @@ span.trimChar {
#bottomHTML {
text-align: center;
}
#bottomHTML h6, #bottomHTML a {
color: #999;
}

View File

@@ -5,9 +5,9 @@ import Utils from './modules/utils';
import * as Communication from "./modules/communication";
import * as Parser from './modules/parser';
import * as UI from "./modules/ui";
import { config } from "./modules/config";
import * as BookingBtn from "./modules/bookingButton";
import * as Parent from "./modules/parent";
require("../src/css/inject.css");
let inputsWithValue: I.InputsWithValue;
@@ -16,14 +16,14 @@ window.addEventListener('load', () => {
const content: string = new XMLSerializer().serializeToString(document);
inputsWithValue = { ...inputsWithValue, ...Parser.getInputs(content) };
console.log(inputsWithValue);
console.log(`trxstate: ${inputsWithValue["trxstate"]}`);
Utils.consoleLog(inputsWithValue);
Utils.consoleLog(`trxstate: ${inputsWithValue["trxstate"]}`);
// "posturl" in function showMap() only available if "pvmapse" PVO code is true.
// "pvmapse" false disables seatmap
const posturlAvail: boolean = /posturl:"(.+?)"/.test(content);
console.log(`posturl available: ${posturlAvail}`);
Utils.consoleLog(`posturl available: ${posturlAvail}`);
// Only inject on page with trxstate 20 and if seatmap is enabled with PVO code "pvmapse"
if (inputsWithValue["trxstate"] !== "20" || posturlAvail === false)
@@ -31,7 +31,7 @@ window.addEventListener('load', () => {
// Inject parent CSS
// Parent = trxstate 20
Utils.inject(config.urlCSSParentStaging, "css", "body");
Parent.injectResources();
// Start message handler to be able to receive messages from child
Communication.listenToMessages(messageHandler);
@@ -49,7 +49,7 @@ window.addEventListener('load', () => {
// https://api.jqueryui.com/dialog/
UI.createDialog();
console.log(inputsWithValue);
Utils.consoleLog(inputsWithValue);
});
function messageHandler(e: any) {
@@ -58,8 +58,8 @@ function messageHandler(e: any) {
const data: I.Message = JSON.parse(e.data);
console.log(`parent: received from ${data.from}`);
console.log(data);
Utils.consoleLog(`parent: received from ${data.from}`);
Utils.consoleLog(data);
switch (data.event) {
case "child_init_needInputsWithValue": {
@@ -75,6 +75,7 @@ function messageHandler(e: any) {
break;
}
case "child_seatmap_ready": {
Utils.consoleLog("child completely ready");
jQuery("#containerBookingBtn").show();
break;
}

View File

@@ -7,7 +7,6 @@ export function injectBookingBtn(): void {
}
export function showSeatmapBtnParent(): void {
console.log("child completely ready");
Communication.sendEventToParent("child_seatmap_ready");
}

View File

@@ -41,9 +41,8 @@ export function initSendVenueXML(inE: any) {
jQuery("#dropdownSeatmap").val(id);
Communication.needSeatmapXML(id);
console.log(css);
console.log(seatmapListing);
Utils.consoleLog(css);
Utils.consoleLog(seatmapListing);
}
export function initSendInputsWithValue(inE: any) {
@@ -78,7 +77,7 @@ export function sendCheckoutResponse(inE: any) {
const data: I.Message = JSON.parse(inE.data);
config.state.isValidSeatSelection = data.message.isValidSeatSelection;
console.log(data.message);
Utils.consoleLog(data.message);
if (!config.state.isValidSeatSelection) {
jBoxHelper.showJBoxNotice(`Auswahl nicht möglich: Bitte lassen Sie keinen einzelnen Platz frei.`);
@@ -95,3 +94,14 @@ export function sendCheckoutResponse(inE: any) {
config.state.cartChanged = false;
}
export function injectResources(): void {
const branch: I.TypeConfigBranch = config.branch;
const resources = config.resources[branch];
Utils.inject(resources.JSC, "js", "head");
Utils.inject(resources.CSSJSC, "css", "body");
Utils.inject(resources.CSSjQueryUI, "css", "body");
Utils.inject(resources.CSSChild, "css", "body");
// Utils.inject(resources.CSSjBox, "css", "body");
}

View File

@@ -4,6 +4,7 @@ const xml2jsParser = require('xml2js').parseString;
import * as UI from "./ui";
import { config } from "./config";
import * as Cart from "./cart";
import Utils from './utils'
// rework try/catch ?
export function sendMessage(inData: I.Message, inTo: string): void {
@@ -14,8 +15,6 @@ export function sendMessage(inData: I.Message, inTo: string): void {
if (child !== null && child.contentWindow !== null)
child.contentWindow.postMessage(JSON.stringify(inData), "*");
else
console.log(`Element with ID ${inTo} does not exist`);
}
}
@@ -76,11 +75,8 @@ export function cancelCheckout(inUrl: string): void {
fetch(inUrl, {
redirect: "manual"
})
.then(() => console.log(`${inUrl} canceled`))
.catch(function (error) {
console.log("error");
console.log(error);
});
.then(() => Utils.consoleLog(`${inUrl} canceled`))
.catch((error) => Utils.consoleLog(error));
}
export function isValidSeatSelection(): void {
@@ -121,7 +117,5 @@ function getXMLPromise(inUrl: string): Promise<unknown> {
}
});
})
.catch((error) => {
console.log(error);
});
.catch((error) => Utils.consoleLog(error));
}

View File

@@ -1,21 +1,31 @@
import * as I from "../types/types";
export const config: I.Config = {
childHasVenueXML: false,
debug: true,
branch: "staging",
urlSeatmapStaging: "https://staging.tickets.zinomedia.de",
urlSeatmapMaster: "https://tickets.zinomedia.de",
urlCSSChildMaster: "https://tickets.zinomedia.de/dist/styleChild.css",
urlCSSChildStaging: "https://staging.tickets.zinomedia.de/dist/styleChild.css",
urlCSSParentMaster: "https://tickets.zinomedia.de/dist/styleParent.css",
urlCSSParentStaging: "https://staging.tickets.zinomedia.de/dist/styleParent.css",
urlJSCStaging: "https://staging.tickets.zinomedia.de/libs/jQuery-Seat-Charts/jquery.seat-charts.min.js",
urlJSCMaster: "https://tickets.zinomedia.de/libs/jQuery-Seat-Charts/jquery.seat-charts.min.js",
urlCSSJSCStaging: "https://staging.tickets.zinomedia.de/libs/jQuery-Seat-Charts/jquery.seat-charts.css",
urlCSSJSCMaster: "https://tickets.zinomedia.de/libs/jQuery-Seat-Charts/jquery.seat-charts.css",
urlCSSjQueryUI: "https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css",
childHasVenueXML: false,
version: "0.0.1",
maxSelectedSeats: 10,
resources: {
master: {
seatmap: "https://tickets.zinomedia.de",
JSC: "https://tickets.zinomedia.de/libs/jQuery-Seat-Charts/jquery.seat-charts.min.js",
CSSChild: "https://tickets.zinomedia.de/dist/seatmap.css",
CSSJSC: "https://tickets.zinomedia.de/libs/jQuery-Seat-Charts/jquery.seat-charts.css",
CSSParent: "https://tickets.zinomedia.de/dist/inject.css",
CSSjQueryUI: "https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css",
CSSjBox: "https://tickets.zinomedia.de/dist/jBox.all.min.css"
},
staging: {
seatmap: "https://staging.tickets.zinomedia.de",
JSC: "https://staging.tickets.zinomedia.de/libs/jQuery-Seat-Charts/jquery.seat-charts.min.js",
CSSChild: "https://staging.tickets.zinomedia.de/dist/seatmap.css",
CSSJSC: "https://staging.tickets.zinomedia.de/libs/jQuery-Seat-Charts/jquery.seat-charts.css",
CSSParent: "https://staging.tickets.zinomedia.de/dist/inject.css",
CSSjQueryUI: "https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css",
CSSjBox: "https://staging.tickets.zinomedia.de/dist/jBox.all.min.css"
}
},
state: {
priceOverall: "",
cartChanged: false,

View File

@@ -3,6 +3,7 @@ import { config } from "./config";
import * as State from "./state";
import * as Cart from "./cart";
import * as CartButtons from "./cartButtons";
import Utils from './utils'
export function getSeats(): I.JSCSeats {
const seatmapXML: any = config.state.seatmapXML;
@@ -124,10 +125,6 @@ export function selectSeatsInCart(): void {
export function addSeatmap(inSelector: string, inMap: string[], inRowsNaming: string[], inSeats: I.JSCSeats, inLegend: I.JSCLegend): void {
const containerSeatmap: any = (<any>window).jQuery(inSelector);
// console.log(inSeatmapInitMap);
// console.log(inSeats);
// console.log(inLegend);
config.state.seatmap = containerSeatmap.seatCharts({
naming: {
top: false,
@@ -213,7 +210,8 @@ function clickedSeat(inSeatmap: any) {
function clickAvailableSeat(inSeatmap: any) {
const selectedSeat: I.JSCSelectedSeat = inSeatmap.settings;
console.log(selectedSeat);
Utils.consoleLog(selectedSeat);
if (State.maximumSelectedSeatsReached(selectedSeat))
return "available";

View File

@@ -22,9 +22,9 @@ export function addPanzoom(inSelector: string, inBtnZoomIn: string | undefined =
function addPanzoomEvents(inBtnZoomIn: string | undefined, inBtnZoomOut: string | undefined, inBtnResetZoom: string | undefined, containerParent: HTMLElement, panzoom: PanzoomObject): void {
const eventMapping = [
{ Selector: inBtnZoomIn, PanzoomFunction: panzoom.zoomIn, Type: "Click" },
{ Selector: inBtnZoomOut, PanzoomFunction: panzoom.zoomOut, Type: "Click" },
{ Selector: inBtnResetZoom, PanzoomFunction: panzoom.reset, Type: "Click" },
{ Selector: inBtnZoomIn, PanzoomFunction: panzoom.zoomIn, Type: "click" },
{ Selector: inBtnZoomOut, PanzoomFunction: panzoom.zoomOut, Type: "click" },
{ Selector: inBtnResetZoom, PanzoomFunction: panzoom.reset, Type: "click" },
{ HTMLElement: containerParent, PanzoomFunction: panzoom.zoomWithWheel, Type: "wheel" }
];

View File

@@ -2,6 +2,7 @@ import { config } from "./config";
import axios from 'axios';
import * as Communication from "./communication";
import * as I from "../types/types";
import Utils from './utils'
export function needCheckoutResponse(inE: any, inInputsWithValue: I.InputsWithValue) {
const data: I.Message = JSON.parse(inE.data);
@@ -17,7 +18,7 @@ export function needCheckoutResponse(inE: any, inInputsWithValue: I.InputsWithVa
const parsedHTML: Node[] = jQuery.parseHTML(content);
const orderkey: orderkey = jQuery(parsedHTML).find("#orderkey").val();
console.log(`orderkey: ${orderkey}`);
Utils.consoleLog(`orderkey: ${orderkey}`);
if (orderkey) {
isValidSeatSelection = true;
@@ -38,8 +39,8 @@ export function needCheckoutResponse(inE: any, inInputsWithValue: I.InputsWithVa
Communication.sendMessage(message, "iframeSeatmap");
})
.catch(function (error) {
console.log("error in child_needCheckoutResponse");
console.log(error);
Utils.consoleLog("error in child_needCheckoutResponse");
Utils.consoleLog(error);
});
}
@@ -69,3 +70,10 @@ export function clickCheckout(inE: any) {
const inUrl: string = data.message.url;
window.location.href = inUrl;
}
export function injectResources(): void {
const branch: I.TypeConfigBranch = config.branch;
const resources = config.resources[branch];
Utils.inject(resources.CSSParent, "css", "body");
}

View File

@@ -44,11 +44,9 @@ function decodeNormalTrim(element: string): string {
function applyTrim(inCharacter: string, inTrimPos: I.TrimPos): void {
const regex: RegExp = /[^a-zA-Z0-9äöüÄÖÜß$]/;
if (!regex.test(inCharacter)) {
console.log(`${inCharacter} -> ${inTrimPos.xJSC} ${inTrimPos.yJSC}`);
if (!regex.test(inCharacter))
jQuery(".seatCharts-row")[inTrimPos.yJSC].children[inTrimPos.xJSC].innerHTML = `<span class="trimChar">${inCharacter}</span>`
}
}
function getJSCTrimPos(inX: number, inY: number, index: number): I.TrimPos {
return <I.TrimPos> {

View File

@@ -4,6 +4,7 @@ import { config } from "./config";
import * as Events from "./events";
import * as Panzoom from "./panzoom";
import * as CartButtons from "./cartButtons";
import Utils from "./utils";
export function setOptionSelect(inSeatmapListing: I.Seatmap[], inId: string): void {
const seatmapDropdown: HTMLElement | null = document.getElementById(inId);
@@ -29,7 +30,7 @@ export function setEventInfo(inEventInfo: I.EventInfo): void {
export function createDialog(): void {
const iframeHTML: string = "<iframe id='iframeSeatmap' scrolling='no' frameborder='0' marginwidth='0' marginheight='0' allowfullscreen width='100%' />";
const src: string = config.branch === "staging" ? config.urlSeatmapStaging : config.urlSeatmapMaster;
const src: string = Utils.getConfigValue("seatmap");
jQuery("#dialogSeatmap").append(
jQuery(iframeHTML)
@@ -97,3 +98,8 @@ export function adjustUIToLoading(): void {
jQuery("#modalCart i").hide();
jQuery("#modalCart .uabb-button-text").addClass("dot-pulse");
}
export function appendVersion(): void {
jQuery("#bottomHTMLVersion")[0].innerText = config.version;
jQuery("#bottomHTMLBranch")[0].innerText = `(${config.branch})`;
}

View File

@@ -1,4 +1,5 @@
import * as I from "../types/types";
import { config } from "./config";
export default class Utils {
@@ -9,11 +10,11 @@ export default class Utils {
const element: boolean | HTMLElement = inSwitch === "selector" ? jQuery(<string>inSelector).get(0) : Utils.getSeatmapElement();
if (element) {
console.log("ready");
Utils.consoleLog("ready");
inCallback();
}
else {
console.log(`Repeating for ${inSwitch}`);
Utils.consoleLog(`Repeating for ${inSwitch}`);
setTimeout(() => {
if (inTimeoutInMs && Date.now() - startTimeInMs > inTimeoutInMs)
return;
@@ -93,4 +94,15 @@ export default class Utils {
static getDayName(inDate: Date, inLocale: string): string {
return inDate.toLocaleDateString(inLocale, { weekday: 'long' });
}
static consoleLog(inMessage: any) {
if (process.env["NODE_ENV"] === "development")
console.log(inMessage);
}
static getConfigValue(inProperty: I.TypeConfigResourcesProperty): string {
const branch: I.TypeConfigBranch = config.branch;
const resources = config.resources[branch];
return resources[inProperty];
}
}

View File

@@ -4,18 +4,16 @@ import * as I from "./types/types";
import { config } from "./modules/config";
import Utils from "./modules/utils";
import * as Events from "./modules/events";
require("jbox/dist/jBox.all.css");
import * as Cart from "./modules/cart";
import * as BookingBtn from "./modules/bookingButton";
import * as Child from './modules/child';
import * as UI from "./modules/ui";
require("../src/css/seatmap.css");
window.addEventListener('load', () => {
// Inject JSC (jQuery Seat Charts)
// Inject CSS for JSC, child and jQuery dialog
Utils.inject(config.urlJSCStaging, "js", "head");
Utils.inject(config.urlCSSJSCStaging, "css", "body");
Utils.inject(config.urlCSSChildStaging, "css", "body");
Utils.inject(config.urlCSSjQueryUI, "css", "body");
Child.injectResources();
// Start message handler to be able to receive messages from parent
Communication.listenToMessages(messageHandler);
@@ -31,6 +29,8 @@ window.addEventListener('load', () => {
Events.addModalCart();
Events.addDropdownSeatmap();
// Change version configured in config
UI.appendVersion();
});
// Hide header when height of window is smaller than ...
@@ -40,7 +40,6 @@ window.onresize = function () {
const innerHeight = window.innerHeight;
if (innerHeight < 576) {
console.log("small");
jQuery("#containerEventInfoRow").hide();
panzoom?.reset();
}
@@ -56,8 +55,8 @@ function messageHandler(inE: any) {
const data: I.Message = JSON.parse(inE.data);
console.log(`child: received from ${data.from}`);
console.log(data);
Utils.consoleLog(`child: received from ${data.from}`);
Utils.consoleLog(data);
switch (data.event) {
case "parent_init_venue": {

View File

@@ -83,23 +83,28 @@ export interface InputsWithValue {
export interface Config {
debug: boolean;
branch: string;
urlSeatmapStaging: string;
urlSeatmapMaster: string;
urlCSSChildStaging: string;
urlCSSChildMaster: string;
urlJSCStaging: string;
urlJSCMaster: string;
urlCSSJSCStaging: string;
urlCSSJSCMaster: string;
urlCSSParentStaging: string;
urlCSSParentMaster: string;
branch: "staging" | "master";
version: string;
childHasVenueXML: boolean;
urlCSSjQueryUI: string;
maxSelectedSeats: number;
state: State;
resources: Resources;
}
export interface Resources {
"staging": ResourcesURL;
"master": ResourcesURL;
}
export interface ResourcesURL {
seatmap: string;
JSC: string;
CSSChild: string;
CSSJSC: string;
CSSParent: string;
CSSjQueryUI: string;
CSSjBox: string;
}
export interface Message {
message: any | VenueXML,
@@ -428,3 +433,5 @@ export type TypeBuyerType = (string | undefined)[][] | undefined;
export type TypeBuyerTypeArr = (string | undefined)[];
export type TypeWaitForElementSwitch = "selector" | "seatmap";
export type TypeInjectScript = HTMLLinkElement | HTMLScriptElement | HTMLStyleElement;
export type TypeConfigBranch = "staging" | "master";
export type TypeConfigResourcesProperty = keyof ResourcesURL;