@authowl/react 0.21.0 → 0.21.2
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/{TeamsSection-SHXAL64Q.js → TeamsSection-ZQDNMWV3.js} +1 -1
- package/dist/{chunk-K67DJJHP.js → chunk-PUJV7S6G.js} +9 -6
- package/dist/index.cjs +3523 -3456
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +678 -2286
- package/dist/qr-ZNG4MAV5.js +1656 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
useT,
|
|
38
38
|
useUser,
|
|
39
39
|
useWaitlist
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-PUJV7S6G.js";
|
|
41
41
|
|
|
42
42
|
// src/project-capabilities.ts
|
|
43
43
|
import {
|
|
@@ -757,1666 +757,25 @@ function shouldDiscardSetup(args) {
|
|
|
757
757
|
|
|
758
758
|
// src/components/QrCode.tsx
|
|
759
759
|
import * as React7 from "react";
|
|
760
|
-
|
|
761
|
-
// ../../node_modules/.pnpm/qrcode-generator@2.0.4/node_modules/qrcode-generator/dist/qrcode.mjs
|
|
762
|
-
var qrcode = function(typeNumber, errorCorrectionLevel) {
|
|
763
|
-
const PAD0 = 236;
|
|
764
|
-
const PAD1 = 17;
|
|
765
|
-
let _typeNumber = typeNumber;
|
|
766
|
-
const _errorCorrectionLevel = QRErrorCorrectionLevel[errorCorrectionLevel];
|
|
767
|
-
let _modules = null;
|
|
768
|
-
let _moduleCount = 0;
|
|
769
|
-
let _dataCache = null;
|
|
770
|
-
const _dataList = [];
|
|
771
|
-
const _this = {};
|
|
772
|
-
const makeImpl = function(test, maskPattern) {
|
|
773
|
-
_moduleCount = _typeNumber * 4 + 17;
|
|
774
|
-
_modules = (function(moduleCount) {
|
|
775
|
-
const modules = new Array(moduleCount);
|
|
776
|
-
for (let row = 0; row < moduleCount; row += 1) {
|
|
777
|
-
modules[row] = new Array(moduleCount);
|
|
778
|
-
for (let col = 0; col < moduleCount; col += 1) {
|
|
779
|
-
modules[row][col] = null;
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
return modules;
|
|
783
|
-
})(_moduleCount);
|
|
784
|
-
setupPositionProbePattern(0, 0);
|
|
785
|
-
setupPositionProbePattern(_moduleCount - 7, 0);
|
|
786
|
-
setupPositionProbePattern(0, _moduleCount - 7);
|
|
787
|
-
setupPositionAdjustPattern();
|
|
788
|
-
setupTimingPattern();
|
|
789
|
-
setupTypeInfo(test, maskPattern);
|
|
790
|
-
if (_typeNumber >= 7) {
|
|
791
|
-
setupTypeNumber(test);
|
|
792
|
-
}
|
|
793
|
-
if (_dataCache == null) {
|
|
794
|
-
_dataCache = createData(_typeNumber, _errorCorrectionLevel, _dataList);
|
|
795
|
-
}
|
|
796
|
-
mapData(_dataCache, maskPattern);
|
|
797
|
-
};
|
|
798
|
-
const setupPositionProbePattern = function(row, col) {
|
|
799
|
-
for (let r = -1; r <= 7; r += 1) {
|
|
800
|
-
if (row + r <= -1 || _moduleCount <= row + r) continue;
|
|
801
|
-
for (let c = -1; c <= 7; c += 1) {
|
|
802
|
-
if (col + c <= -1 || _moduleCount <= col + c) continue;
|
|
803
|
-
if (0 <= r && r <= 6 && (c == 0 || c == 6) || 0 <= c && c <= 6 && (r == 0 || r == 6) || 2 <= r && r <= 4 && 2 <= c && c <= 4) {
|
|
804
|
-
_modules[row + r][col + c] = true;
|
|
805
|
-
} else {
|
|
806
|
-
_modules[row + r][col + c] = false;
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
};
|
|
811
|
-
const getBestMaskPattern = function() {
|
|
812
|
-
let minLostPoint = 0;
|
|
813
|
-
let pattern = 0;
|
|
814
|
-
for (let i = 0; i < 8; i += 1) {
|
|
815
|
-
makeImpl(true, i);
|
|
816
|
-
const lostPoint = QRUtil.getLostPoint(_this);
|
|
817
|
-
if (i == 0 || minLostPoint > lostPoint) {
|
|
818
|
-
minLostPoint = lostPoint;
|
|
819
|
-
pattern = i;
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
return pattern;
|
|
823
|
-
};
|
|
824
|
-
const setupTimingPattern = function() {
|
|
825
|
-
for (let r = 8; r < _moduleCount - 8; r += 1) {
|
|
826
|
-
if (_modules[r][6] != null) {
|
|
827
|
-
continue;
|
|
828
|
-
}
|
|
829
|
-
_modules[r][6] = r % 2 == 0;
|
|
830
|
-
}
|
|
831
|
-
for (let c = 8; c < _moduleCount - 8; c += 1) {
|
|
832
|
-
if (_modules[6][c] != null) {
|
|
833
|
-
continue;
|
|
834
|
-
}
|
|
835
|
-
_modules[6][c] = c % 2 == 0;
|
|
836
|
-
}
|
|
837
|
-
};
|
|
838
|
-
const setupPositionAdjustPattern = function() {
|
|
839
|
-
const pos = QRUtil.getPatternPosition(_typeNumber);
|
|
840
|
-
for (let i = 0; i < pos.length; i += 1) {
|
|
841
|
-
for (let j = 0; j < pos.length; j += 1) {
|
|
842
|
-
const row = pos[i];
|
|
843
|
-
const col = pos[j];
|
|
844
|
-
if (_modules[row][col] != null) {
|
|
845
|
-
continue;
|
|
846
|
-
}
|
|
847
|
-
for (let r = -2; r <= 2; r += 1) {
|
|
848
|
-
for (let c = -2; c <= 2; c += 1) {
|
|
849
|
-
if (r == -2 || r == 2 || c == -2 || c == 2 || r == 0 && c == 0) {
|
|
850
|
-
_modules[row + r][col + c] = true;
|
|
851
|
-
} else {
|
|
852
|
-
_modules[row + r][col + c] = false;
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
};
|
|
859
|
-
const setupTypeNumber = function(test) {
|
|
860
|
-
const bits = QRUtil.getBCHTypeNumber(_typeNumber);
|
|
861
|
-
for (let i = 0; i < 18; i += 1) {
|
|
862
|
-
const mod = !test && (bits >> i & 1) == 1;
|
|
863
|
-
_modules[Math.floor(i / 3)][i % 3 + _moduleCount - 8 - 3] = mod;
|
|
864
|
-
}
|
|
865
|
-
for (let i = 0; i < 18; i += 1) {
|
|
866
|
-
const mod = !test && (bits >> i & 1) == 1;
|
|
867
|
-
_modules[i % 3 + _moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
|
|
868
|
-
}
|
|
869
|
-
};
|
|
870
|
-
const setupTypeInfo = function(test, maskPattern) {
|
|
871
|
-
const data = _errorCorrectionLevel << 3 | maskPattern;
|
|
872
|
-
const bits = QRUtil.getBCHTypeInfo(data);
|
|
873
|
-
for (let i = 0; i < 15; i += 1) {
|
|
874
|
-
const mod = !test && (bits >> i & 1) == 1;
|
|
875
|
-
if (i < 6) {
|
|
876
|
-
_modules[i][8] = mod;
|
|
877
|
-
} else if (i < 8) {
|
|
878
|
-
_modules[i + 1][8] = mod;
|
|
879
|
-
} else {
|
|
880
|
-
_modules[_moduleCount - 15 + i][8] = mod;
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
for (let i = 0; i < 15; i += 1) {
|
|
884
|
-
const mod = !test && (bits >> i & 1) == 1;
|
|
885
|
-
if (i < 8) {
|
|
886
|
-
_modules[8][_moduleCount - i - 1] = mod;
|
|
887
|
-
} else if (i < 9) {
|
|
888
|
-
_modules[8][15 - i - 1 + 1] = mod;
|
|
889
|
-
} else {
|
|
890
|
-
_modules[8][15 - i - 1] = mod;
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
_modules[_moduleCount - 8][8] = !test;
|
|
894
|
-
};
|
|
895
|
-
const mapData = function(data, maskPattern) {
|
|
896
|
-
let inc = -1;
|
|
897
|
-
let row = _moduleCount - 1;
|
|
898
|
-
let bitIndex = 7;
|
|
899
|
-
let byteIndex = 0;
|
|
900
|
-
const maskFunc = QRUtil.getMaskFunction(maskPattern);
|
|
901
|
-
for (let col = _moduleCount - 1; col > 0; col -= 2) {
|
|
902
|
-
if (col == 6) col -= 1;
|
|
903
|
-
while (true) {
|
|
904
|
-
for (let c = 0; c < 2; c += 1) {
|
|
905
|
-
if (_modules[row][col - c] == null) {
|
|
906
|
-
let dark = false;
|
|
907
|
-
if (byteIndex < data.length) {
|
|
908
|
-
dark = (data[byteIndex] >>> bitIndex & 1) == 1;
|
|
909
|
-
}
|
|
910
|
-
const mask = maskFunc(row, col - c);
|
|
911
|
-
if (mask) {
|
|
912
|
-
dark = !dark;
|
|
913
|
-
}
|
|
914
|
-
_modules[row][col - c] = dark;
|
|
915
|
-
bitIndex -= 1;
|
|
916
|
-
if (bitIndex == -1) {
|
|
917
|
-
byteIndex += 1;
|
|
918
|
-
bitIndex = 7;
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
row += inc;
|
|
923
|
-
if (row < 0 || _moduleCount <= row) {
|
|
924
|
-
row -= inc;
|
|
925
|
-
inc = -inc;
|
|
926
|
-
break;
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
};
|
|
931
|
-
const createBytes = function(buffer, rsBlocks) {
|
|
932
|
-
let offset = 0;
|
|
933
|
-
let maxDcCount = 0;
|
|
934
|
-
let maxEcCount = 0;
|
|
935
|
-
const dcdata = new Array(rsBlocks.length);
|
|
936
|
-
const ecdata = new Array(rsBlocks.length);
|
|
937
|
-
for (let r = 0; r < rsBlocks.length; r += 1) {
|
|
938
|
-
const dcCount = rsBlocks[r].dataCount;
|
|
939
|
-
const ecCount = rsBlocks[r].totalCount - dcCount;
|
|
940
|
-
maxDcCount = Math.max(maxDcCount, dcCount);
|
|
941
|
-
maxEcCount = Math.max(maxEcCount, ecCount);
|
|
942
|
-
dcdata[r] = new Array(dcCount);
|
|
943
|
-
for (let i = 0; i < dcdata[r].length; i += 1) {
|
|
944
|
-
dcdata[r][i] = 255 & buffer.getBuffer()[i + offset];
|
|
945
|
-
}
|
|
946
|
-
offset += dcCount;
|
|
947
|
-
const rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
|
|
948
|
-
const rawPoly = qrPolynomial(dcdata[r], rsPoly.getLength() - 1);
|
|
949
|
-
const modPoly = rawPoly.mod(rsPoly);
|
|
950
|
-
ecdata[r] = new Array(rsPoly.getLength() - 1);
|
|
951
|
-
for (let i = 0; i < ecdata[r].length; i += 1) {
|
|
952
|
-
const modIndex = i + modPoly.getLength() - ecdata[r].length;
|
|
953
|
-
ecdata[r][i] = modIndex >= 0 ? modPoly.getAt(modIndex) : 0;
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
let totalCodeCount = 0;
|
|
957
|
-
for (let i = 0; i < rsBlocks.length; i += 1) {
|
|
958
|
-
totalCodeCount += rsBlocks[i].totalCount;
|
|
959
|
-
}
|
|
960
|
-
const data = new Array(totalCodeCount);
|
|
961
|
-
let index = 0;
|
|
962
|
-
for (let i = 0; i < maxDcCount; i += 1) {
|
|
963
|
-
for (let r = 0; r < rsBlocks.length; r += 1) {
|
|
964
|
-
if (i < dcdata[r].length) {
|
|
965
|
-
data[index] = dcdata[r][i];
|
|
966
|
-
index += 1;
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
for (let i = 0; i < maxEcCount; i += 1) {
|
|
971
|
-
for (let r = 0; r < rsBlocks.length; r += 1) {
|
|
972
|
-
if (i < ecdata[r].length) {
|
|
973
|
-
data[index] = ecdata[r][i];
|
|
974
|
-
index += 1;
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
return data;
|
|
979
|
-
};
|
|
980
|
-
const createData = function(typeNumber2, errorCorrectionLevel2, dataList) {
|
|
981
|
-
const rsBlocks = QRRSBlock.getRSBlocks(typeNumber2, errorCorrectionLevel2);
|
|
982
|
-
const buffer = qrBitBuffer();
|
|
983
|
-
for (let i = 0; i < dataList.length; i += 1) {
|
|
984
|
-
const data = dataList[i];
|
|
985
|
-
buffer.put(data.getMode(), 4);
|
|
986
|
-
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber2));
|
|
987
|
-
data.write(buffer);
|
|
988
|
-
}
|
|
989
|
-
let totalDataCount = 0;
|
|
990
|
-
for (let i = 0; i < rsBlocks.length; i += 1) {
|
|
991
|
-
totalDataCount += rsBlocks[i].dataCount;
|
|
992
|
-
}
|
|
993
|
-
if (buffer.getLengthInBits() > totalDataCount * 8) {
|
|
994
|
-
throw "code length overflow. (" + buffer.getLengthInBits() + ">" + totalDataCount * 8 + ")";
|
|
995
|
-
}
|
|
996
|
-
if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
|
|
997
|
-
buffer.put(0, 4);
|
|
998
|
-
}
|
|
999
|
-
while (buffer.getLengthInBits() % 8 != 0) {
|
|
1000
|
-
buffer.putBit(false);
|
|
1001
|
-
}
|
|
1002
|
-
while (true) {
|
|
1003
|
-
if (buffer.getLengthInBits() >= totalDataCount * 8) {
|
|
1004
|
-
break;
|
|
1005
|
-
}
|
|
1006
|
-
buffer.put(PAD0, 8);
|
|
1007
|
-
if (buffer.getLengthInBits() >= totalDataCount * 8) {
|
|
1008
|
-
break;
|
|
1009
|
-
}
|
|
1010
|
-
buffer.put(PAD1, 8);
|
|
1011
|
-
}
|
|
1012
|
-
return createBytes(buffer, rsBlocks);
|
|
1013
|
-
};
|
|
1014
|
-
_this.addData = function(data, mode) {
|
|
1015
|
-
mode = mode || "Byte";
|
|
1016
|
-
let newData = null;
|
|
1017
|
-
switch (mode) {
|
|
1018
|
-
case "Numeric":
|
|
1019
|
-
newData = qrNumber(data);
|
|
1020
|
-
break;
|
|
1021
|
-
case "Alphanumeric":
|
|
1022
|
-
newData = qrAlphaNum(data);
|
|
1023
|
-
break;
|
|
1024
|
-
case "Byte":
|
|
1025
|
-
newData = qr8BitByte(data);
|
|
1026
|
-
break;
|
|
1027
|
-
case "Kanji":
|
|
1028
|
-
newData = qrKanji(data);
|
|
1029
|
-
break;
|
|
1030
|
-
default:
|
|
1031
|
-
throw "mode:" + mode;
|
|
1032
|
-
}
|
|
1033
|
-
_dataList.push(newData);
|
|
1034
|
-
_dataCache = null;
|
|
1035
|
-
};
|
|
1036
|
-
_this.isDark = function(row, col) {
|
|
1037
|
-
if (row < 0 || _moduleCount <= row || col < 0 || _moduleCount <= col) {
|
|
1038
|
-
throw row + "," + col;
|
|
1039
|
-
}
|
|
1040
|
-
return _modules[row][col];
|
|
1041
|
-
};
|
|
1042
|
-
_this.getModuleCount = function() {
|
|
1043
|
-
return _moduleCount;
|
|
1044
|
-
};
|
|
1045
|
-
_this.make = function() {
|
|
1046
|
-
if (_typeNumber < 1) {
|
|
1047
|
-
let typeNumber2 = 1;
|
|
1048
|
-
for (; typeNumber2 < 40; typeNumber2++) {
|
|
1049
|
-
const rsBlocks = QRRSBlock.getRSBlocks(typeNumber2, _errorCorrectionLevel);
|
|
1050
|
-
const buffer = qrBitBuffer();
|
|
1051
|
-
for (let i = 0; i < _dataList.length; i++) {
|
|
1052
|
-
const data = _dataList[i];
|
|
1053
|
-
buffer.put(data.getMode(), 4);
|
|
1054
|
-
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber2));
|
|
1055
|
-
data.write(buffer);
|
|
1056
|
-
}
|
|
1057
|
-
let totalDataCount = 0;
|
|
1058
|
-
for (let i = 0; i < rsBlocks.length; i++) {
|
|
1059
|
-
totalDataCount += rsBlocks[i].dataCount;
|
|
1060
|
-
}
|
|
1061
|
-
if (buffer.getLengthInBits() <= totalDataCount * 8) {
|
|
1062
|
-
break;
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
_typeNumber = typeNumber2;
|
|
1066
|
-
}
|
|
1067
|
-
makeImpl(false, getBestMaskPattern());
|
|
1068
|
-
};
|
|
1069
|
-
_this.createTableTag = function(cellSize, margin) {
|
|
1070
|
-
cellSize = cellSize || 2;
|
|
1071
|
-
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
1072
|
-
let qrHtml = "";
|
|
1073
|
-
qrHtml += '<table style="';
|
|
1074
|
-
qrHtml += " border-width: 0px; border-style: none;";
|
|
1075
|
-
qrHtml += " border-collapse: collapse;";
|
|
1076
|
-
qrHtml += " padding: 0px; margin: " + margin + "px;";
|
|
1077
|
-
qrHtml += '">';
|
|
1078
|
-
qrHtml += "<tbody>";
|
|
1079
|
-
for (let r = 0; r < _this.getModuleCount(); r += 1) {
|
|
1080
|
-
qrHtml += "<tr>";
|
|
1081
|
-
for (let c = 0; c < _this.getModuleCount(); c += 1) {
|
|
1082
|
-
qrHtml += '<td style="';
|
|
1083
|
-
qrHtml += " border-width: 0px; border-style: none;";
|
|
1084
|
-
qrHtml += " border-collapse: collapse;";
|
|
1085
|
-
qrHtml += " padding: 0px; margin: 0px;";
|
|
1086
|
-
qrHtml += " width: " + cellSize + "px;";
|
|
1087
|
-
qrHtml += " height: " + cellSize + "px;";
|
|
1088
|
-
qrHtml += " background-color: ";
|
|
1089
|
-
qrHtml += _this.isDark(r, c) ? "#000000" : "#ffffff";
|
|
1090
|
-
qrHtml += ";";
|
|
1091
|
-
qrHtml += '"/>';
|
|
1092
|
-
}
|
|
1093
|
-
qrHtml += "</tr>";
|
|
1094
|
-
}
|
|
1095
|
-
qrHtml += "</tbody>";
|
|
1096
|
-
qrHtml += "</table>";
|
|
1097
|
-
return qrHtml;
|
|
1098
|
-
};
|
|
1099
|
-
_this.createSvgTag = function(cellSize, margin, alt, title) {
|
|
1100
|
-
let opts = {};
|
|
1101
|
-
if (typeof arguments[0] == "object") {
|
|
1102
|
-
opts = arguments[0];
|
|
1103
|
-
cellSize = opts.cellSize;
|
|
1104
|
-
margin = opts.margin;
|
|
1105
|
-
alt = opts.alt;
|
|
1106
|
-
title = opts.title;
|
|
1107
|
-
}
|
|
1108
|
-
cellSize = cellSize || 2;
|
|
1109
|
-
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
1110
|
-
alt = typeof alt === "string" ? { text: alt } : alt || {};
|
|
1111
|
-
alt.text = alt.text || null;
|
|
1112
|
-
alt.id = alt.text ? alt.id || "qrcode-description" : null;
|
|
1113
|
-
title = typeof title === "string" ? { text: title } : title || {};
|
|
1114
|
-
title.text = title.text || null;
|
|
1115
|
-
title.id = title.text ? title.id || "qrcode-title" : null;
|
|
1116
|
-
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
1117
|
-
let c, mc, r, mr, qrSvg = "", rect;
|
|
1118
|
-
rect = "l" + cellSize + ",0 0," + cellSize + " -" + cellSize + ",0 0,-" + cellSize + "z ";
|
|
1119
|
-
qrSvg += '<svg version="1.1" xmlns="http://www.w3.org/2000/svg"';
|
|
1120
|
-
qrSvg += !opts.scalable ? ' width="' + size + 'px" height="' + size + 'px"' : "";
|
|
1121
|
-
qrSvg += ' viewBox="0 0 ' + size + " " + size + '" ';
|
|
1122
|
-
qrSvg += ' preserveAspectRatio="xMinYMin meet"';
|
|
1123
|
-
qrSvg += title.text || alt.text ? ' role="img" aria-labelledby="' + escapeXml([title.id, alt.id].join(" ").trim()) + '"' : "";
|
|
1124
|
-
qrSvg += ">";
|
|
1125
|
-
qrSvg += title.text ? '<title id="' + escapeXml(title.id) + '">' + escapeXml(title.text) + "</title>" : "";
|
|
1126
|
-
qrSvg += alt.text ? '<description id="' + escapeXml(alt.id) + '">' + escapeXml(alt.text) + "</description>" : "";
|
|
1127
|
-
qrSvg += '<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>';
|
|
1128
|
-
qrSvg += '<path d="';
|
|
1129
|
-
for (r = 0; r < _this.getModuleCount(); r += 1) {
|
|
1130
|
-
mr = r * cellSize + margin;
|
|
1131
|
-
for (c = 0; c < _this.getModuleCount(); c += 1) {
|
|
1132
|
-
if (_this.isDark(r, c)) {
|
|
1133
|
-
mc = c * cellSize + margin;
|
|
1134
|
-
qrSvg += "M" + mc + "," + mr + rect;
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
qrSvg += '" stroke="transparent" fill="black"/>';
|
|
1139
|
-
qrSvg += "</svg>";
|
|
1140
|
-
return qrSvg;
|
|
1141
|
-
};
|
|
1142
|
-
_this.createDataURL = function(cellSize, margin) {
|
|
1143
|
-
cellSize = cellSize || 2;
|
|
1144
|
-
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
1145
|
-
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
1146
|
-
const min = margin;
|
|
1147
|
-
const max = size - margin;
|
|
1148
|
-
return createDataURL(size, size, function(x, y) {
|
|
1149
|
-
if (min <= x && x < max && min <= y && y < max) {
|
|
1150
|
-
const c = Math.floor((x - min) / cellSize);
|
|
1151
|
-
const r = Math.floor((y - min) / cellSize);
|
|
1152
|
-
return _this.isDark(r, c) ? 0 : 1;
|
|
1153
|
-
} else {
|
|
1154
|
-
return 1;
|
|
1155
|
-
}
|
|
1156
|
-
});
|
|
1157
|
-
};
|
|
1158
|
-
_this.createImgTag = function(cellSize, margin, alt) {
|
|
1159
|
-
cellSize = cellSize || 2;
|
|
1160
|
-
margin = typeof margin == "undefined" ? cellSize * 4 : margin;
|
|
1161
|
-
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
1162
|
-
let img = "";
|
|
1163
|
-
img += "<img";
|
|
1164
|
-
img += ' src="';
|
|
1165
|
-
img += _this.createDataURL(cellSize, margin);
|
|
1166
|
-
img += '"';
|
|
1167
|
-
img += ' width="';
|
|
1168
|
-
img += size;
|
|
1169
|
-
img += '"';
|
|
1170
|
-
img += ' height="';
|
|
1171
|
-
img += size;
|
|
1172
|
-
img += '"';
|
|
1173
|
-
if (alt) {
|
|
1174
|
-
img += ' alt="';
|
|
1175
|
-
img += escapeXml(alt);
|
|
1176
|
-
img += '"';
|
|
1177
|
-
}
|
|
1178
|
-
img += "/>";
|
|
1179
|
-
return img;
|
|
1180
|
-
};
|
|
1181
|
-
const escapeXml = function(s) {
|
|
1182
|
-
let escaped = "";
|
|
1183
|
-
for (let i = 0; i < s.length; i += 1) {
|
|
1184
|
-
const c = s.charAt(i);
|
|
1185
|
-
switch (c) {
|
|
1186
|
-
case "<":
|
|
1187
|
-
escaped += "<";
|
|
1188
|
-
break;
|
|
1189
|
-
case ">":
|
|
1190
|
-
escaped += ">";
|
|
1191
|
-
break;
|
|
1192
|
-
case "&":
|
|
1193
|
-
escaped += "&";
|
|
1194
|
-
break;
|
|
1195
|
-
case '"':
|
|
1196
|
-
escaped += """;
|
|
1197
|
-
break;
|
|
1198
|
-
default:
|
|
1199
|
-
escaped += c;
|
|
1200
|
-
break;
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
return escaped;
|
|
1204
|
-
};
|
|
1205
|
-
const _createHalfASCII = function(margin) {
|
|
1206
|
-
const cellSize = 1;
|
|
1207
|
-
margin = typeof margin == "undefined" ? cellSize * 2 : margin;
|
|
1208
|
-
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
1209
|
-
const min = margin;
|
|
1210
|
-
const max = size - margin;
|
|
1211
|
-
let y, x, r1, r2, p;
|
|
1212
|
-
const blocks = {
|
|
1213
|
-
"\u2588\u2588": "\u2588",
|
|
1214
|
-
"\u2588 ": "\u2580",
|
|
1215
|
-
" \u2588": "\u2584",
|
|
1216
|
-
" ": " "
|
|
1217
|
-
};
|
|
1218
|
-
const blocksLastLineNoMargin = {
|
|
1219
|
-
"\u2588\u2588": "\u2580",
|
|
1220
|
-
"\u2588 ": "\u2580",
|
|
1221
|
-
" \u2588": " ",
|
|
1222
|
-
" ": " "
|
|
1223
|
-
};
|
|
1224
|
-
let ascii = "";
|
|
1225
|
-
for (y = 0; y < size; y += 2) {
|
|
1226
|
-
r1 = Math.floor((y - min) / cellSize);
|
|
1227
|
-
r2 = Math.floor((y + 1 - min) / cellSize);
|
|
1228
|
-
for (x = 0; x < size; x += 1) {
|
|
1229
|
-
p = "\u2588";
|
|
1230
|
-
if (min <= x && x < max && min <= y && y < max && _this.isDark(r1, Math.floor((x - min) / cellSize))) {
|
|
1231
|
-
p = " ";
|
|
1232
|
-
}
|
|
1233
|
-
if (min <= x && x < max && min <= y + 1 && y + 1 < max && _this.isDark(r2, Math.floor((x - min) / cellSize))) {
|
|
1234
|
-
p += " ";
|
|
1235
|
-
} else {
|
|
1236
|
-
p += "\u2588";
|
|
1237
|
-
}
|
|
1238
|
-
ascii += margin < 1 && y + 1 >= max ? blocksLastLineNoMargin[p] : blocks[p];
|
|
1239
|
-
}
|
|
1240
|
-
ascii += "\n";
|
|
1241
|
-
}
|
|
1242
|
-
if (size % 2 && margin > 0) {
|
|
1243
|
-
return ascii.substring(0, ascii.length - size - 1) + Array(size + 1).join("\u2580");
|
|
1244
|
-
}
|
|
1245
|
-
return ascii.substring(0, ascii.length - 1);
|
|
1246
|
-
};
|
|
1247
|
-
_this.createASCII = function(cellSize, margin) {
|
|
1248
|
-
cellSize = cellSize || 1;
|
|
1249
|
-
if (cellSize < 2) {
|
|
1250
|
-
return _createHalfASCII(margin);
|
|
1251
|
-
}
|
|
1252
|
-
cellSize -= 1;
|
|
1253
|
-
margin = typeof margin == "undefined" ? cellSize * 2 : margin;
|
|
1254
|
-
const size = _this.getModuleCount() * cellSize + margin * 2;
|
|
1255
|
-
const min = margin;
|
|
1256
|
-
const max = size - margin;
|
|
1257
|
-
let y, x, r, p;
|
|
1258
|
-
const white = Array(cellSize + 1).join("\u2588\u2588");
|
|
1259
|
-
const black = Array(cellSize + 1).join(" ");
|
|
1260
|
-
let ascii = "";
|
|
1261
|
-
let line = "";
|
|
1262
|
-
for (y = 0; y < size; y += 1) {
|
|
1263
|
-
r = Math.floor((y - min) / cellSize);
|
|
1264
|
-
line = "";
|
|
1265
|
-
for (x = 0; x < size; x += 1) {
|
|
1266
|
-
p = 1;
|
|
1267
|
-
if (min <= x && x < max && min <= y && y < max && _this.isDark(r, Math.floor((x - min) / cellSize))) {
|
|
1268
|
-
p = 0;
|
|
1269
|
-
}
|
|
1270
|
-
line += p ? white : black;
|
|
1271
|
-
}
|
|
1272
|
-
for (r = 0; r < cellSize; r += 1) {
|
|
1273
|
-
ascii += line + "\n";
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
return ascii.substring(0, ascii.length - 1);
|
|
1277
|
-
};
|
|
1278
|
-
_this.renderTo2dContext = function(context, cellSize) {
|
|
1279
|
-
cellSize = cellSize || 2;
|
|
1280
|
-
const length = _this.getModuleCount();
|
|
1281
|
-
for (let row = 0; row < length; row++) {
|
|
1282
|
-
for (let col = 0; col < length; col++) {
|
|
1283
|
-
context.fillStyle = _this.isDark(row, col) ? "black" : "white";
|
|
1284
|
-
context.fillRect(col * cellSize, row * cellSize, cellSize, cellSize);
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
};
|
|
1288
|
-
return _this;
|
|
1289
|
-
};
|
|
1290
|
-
qrcode.stringToBytes = function(s) {
|
|
1291
|
-
const bytes = [];
|
|
1292
|
-
for (let i = 0; i < s.length; i += 1) {
|
|
1293
|
-
const c = s.charCodeAt(i);
|
|
1294
|
-
bytes.push(c & 255);
|
|
1295
|
-
}
|
|
1296
|
-
return bytes;
|
|
1297
|
-
};
|
|
1298
|
-
qrcode.createStringToBytes = function(unicodeData, numChars) {
|
|
1299
|
-
const unicodeMap = (function() {
|
|
1300
|
-
const bin = base64DecodeInputStream(unicodeData);
|
|
1301
|
-
const read = function() {
|
|
1302
|
-
const b = bin.read();
|
|
1303
|
-
if (b == -1) throw "eof";
|
|
1304
|
-
return b;
|
|
1305
|
-
};
|
|
1306
|
-
let count = 0;
|
|
1307
|
-
const unicodeMap2 = {};
|
|
1308
|
-
while (true) {
|
|
1309
|
-
const b0 = bin.read();
|
|
1310
|
-
if (b0 == -1) break;
|
|
1311
|
-
const b1 = read();
|
|
1312
|
-
const b2 = read();
|
|
1313
|
-
const b3 = read();
|
|
1314
|
-
const k = String.fromCharCode(b0 << 8 | b1);
|
|
1315
|
-
const v = b2 << 8 | b3;
|
|
1316
|
-
unicodeMap2[k] = v;
|
|
1317
|
-
count += 1;
|
|
1318
|
-
}
|
|
1319
|
-
if (count != numChars) {
|
|
1320
|
-
throw count + " != " + numChars;
|
|
1321
|
-
}
|
|
1322
|
-
return unicodeMap2;
|
|
1323
|
-
})();
|
|
1324
|
-
const unknownChar = "?".charCodeAt(0);
|
|
1325
|
-
return function(s) {
|
|
1326
|
-
const bytes = [];
|
|
1327
|
-
for (let i = 0; i < s.length; i += 1) {
|
|
1328
|
-
const c = s.charCodeAt(i);
|
|
1329
|
-
if (c < 128) {
|
|
1330
|
-
bytes.push(c);
|
|
1331
|
-
} else {
|
|
1332
|
-
const b = unicodeMap[s.charAt(i)];
|
|
1333
|
-
if (typeof b == "number") {
|
|
1334
|
-
if ((b & 255) == b) {
|
|
1335
|
-
bytes.push(b);
|
|
1336
|
-
} else {
|
|
1337
|
-
bytes.push(b >>> 8);
|
|
1338
|
-
bytes.push(b & 255);
|
|
1339
|
-
}
|
|
1340
|
-
} else {
|
|
1341
|
-
bytes.push(unknownChar);
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
|
-
}
|
|
1345
|
-
return bytes;
|
|
1346
|
-
};
|
|
1347
|
-
};
|
|
1348
|
-
var QRMode = {
|
|
1349
|
-
MODE_NUMBER: 1 << 0,
|
|
1350
|
-
MODE_ALPHA_NUM: 1 << 1,
|
|
1351
|
-
MODE_8BIT_BYTE: 1 << 2,
|
|
1352
|
-
MODE_KANJI: 1 << 3
|
|
1353
|
-
};
|
|
1354
|
-
var QRErrorCorrectionLevel = {
|
|
1355
|
-
L: 1,
|
|
1356
|
-
M: 0,
|
|
1357
|
-
Q: 3,
|
|
1358
|
-
H: 2
|
|
1359
|
-
};
|
|
1360
|
-
var QRMaskPattern = {
|
|
1361
|
-
PATTERN000: 0,
|
|
1362
|
-
PATTERN001: 1,
|
|
1363
|
-
PATTERN010: 2,
|
|
1364
|
-
PATTERN011: 3,
|
|
1365
|
-
PATTERN100: 4,
|
|
1366
|
-
PATTERN101: 5,
|
|
1367
|
-
PATTERN110: 6,
|
|
1368
|
-
PATTERN111: 7
|
|
1369
|
-
};
|
|
1370
|
-
var QRUtil = (function() {
|
|
1371
|
-
const PATTERN_POSITION_TABLE = [
|
|
1372
|
-
[],
|
|
1373
|
-
[6, 18],
|
|
1374
|
-
[6, 22],
|
|
1375
|
-
[6, 26],
|
|
1376
|
-
[6, 30],
|
|
1377
|
-
[6, 34],
|
|
1378
|
-
[6, 22, 38],
|
|
1379
|
-
[6, 24, 42],
|
|
1380
|
-
[6, 26, 46],
|
|
1381
|
-
[6, 28, 50],
|
|
1382
|
-
[6, 30, 54],
|
|
1383
|
-
[6, 32, 58],
|
|
1384
|
-
[6, 34, 62],
|
|
1385
|
-
[6, 26, 46, 66],
|
|
1386
|
-
[6, 26, 48, 70],
|
|
1387
|
-
[6, 26, 50, 74],
|
|
1388
|
-
[6, 30, 54, 78],
|
|
1389
|
-
[6, 30, 56, 82],
|
|
1390
|
-
[6, 30, 58, 86],
|
|
1391
|
-
[6, 34, 62, 90],
|
|
1392
|
-
[6, 28, 50, 72, 94],
|
|
1393
|
-
[6, 26, 50, 74, 98],
|
|
1394
|
-
[6, 30, 54, 78, 102],
|
|
1395
|
-
[6, 28, 54, 80, 106],
|
|
1396
|
-
[6, 32, 58, 84, 110],
|
|
1397
|
-
[6, 30, 58, 86, 114],
|
|
1398
|
-
[6, 34, 62, 90, 118],
|
|
1399
|
-
[6, 26, 50, 74, 98, 122],
|
|
1400
|
-
[6, 30, 54, 78, 102, 126],
|
|
1401
|
-
[6, 26, 52, 78, 104, 130],
|
|
1402
|
-
[6, 30, 56, 82, 108, 134],
|
|
1403
|
-
[6, 34, 60, 86, 112, 138],
|
|
1404
|
-
[6, 30, 58, 86, 114, 142],
|
|
1405
|
-
[6, 34, 62, 90, 118, 146],
|
|
1406
|
-
[6, 30, 54, 78, 102, 126, 150],
|
|
1407
|
-
[6, 24, 50, 76, 102, 128, 154],
|
|
1408
|
-
[6, 28, 54, 80, 106, 132, 158],
|
|
1409
|
-
[6, 32, 58, 84, 110, 136, 162],
|
|
1410
|
-
[6, 26, 54, 82, 110, 138, 166],
|
|
1411
|
-
[6, 30, 58, 86, 114, 142, 170]
|
|
1412
|
-
];
|
|
1413
|
-
const G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
|
|
1414
|
-
const G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;
|
|
1415
|
-
const G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;
|
|
1416
|
-
const _this = {};
|
|
1417
|
-
const getBCHDigit = function(data) {
|
|
1418
|
-
let digit = 0;
|
|
1419
|
-
while (data != 0) {
|
|
1420
|
-
digit += 1;
|
|
1421
|
-
data >>>= 1;
|
|
1422
|
-
}
|
|
1423
|
-
return digit;
|
|
1424
|
-
};
|
|
1425
|
-
_this.getBCHTypeInfo = function(data) {
|
|
1426
|
-
let d = data << 10;
|
|
1427
|
-
while (getBCHDigit(d) - getBCHDigit(G15) >= 0) {
|
|
1428
|
-
d ^= G15 << getBCHDigit(d) - getBCHDigit(G15);
|
|
1429
|
-
}
|
|
1430
|
-
return (data << 10 | d) ^ G15_MASK;
|
|
1431
|
-
};
|
|
1432
|
-
_this.getBCHTypeNumber = function(data) {
|
|
1433
|
-
let d = data << 12;
|
|
1434
|
-
while (getBCHDigit(d) - getBCHDigit(G18) >= 0) {
|
|
1435
|
-
d ^= G18 << getBCHDigit(d) - getBCHDigit(G18);
|
|
1436
|
-
}
|
|
1437
|
-
return data << 12 | d;
|
|
1438
|
-
};
|
|
1439
|
-
_this.getPatternPosition = function(typeNumber) {
|
|
1440
|
-
return PATTERN_POSITION_TABLE[typeNumber - 1];
|
|
1441
|
-
};
|
|
1442
|
-
_this.getMaskFunction = function(maskPattern) {
|
|
1443
|
-
switch (maskPattern) {
|
|
1444
|
-
case QRMaskPattern.PATTERN000:
|
|
1445
|
-
return function(i, j) {
|
|
1446
|
-
return (i + j) % 2 == 0;
|
|
1447
|
-
};
|
|
1448
|
-
case QRMaskPattern.PATTERN001:
|
|
1449
|
-
return function(i, j) {
|
|
1450
|
-
return i % 2 == 0;
|
|
1451
|
-
};
|
|
1452
|
-
case QRMaskPattern.PATTERN010:
|
|
1453
|
-
return function(i, j) {
|
|
1454
|
-
return j % 3 == 0;
|
|
1455
|
-
};
|
|
1456
|
-
case QRMaskPattern.PATTERN011:
|
|
1457
|
-
return function(i, j) {
|
|
1458
|
-
return (i + j) % 3 == 0;
|
|
1459
|
-
};
|
|
1460
|
-
case QRMaskPattern.PATTERN100:
|
|
1461
|
-
return function(i, j) {
|
|
1462
|
-
return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0;
|
|
1463
|
-
};
|
|
1464
|
-
case QRMaskPattern.PATTERN101:
|
|
1465
|
-
return function(i, j) {
|
|
1466
|
-
return i * j % 2 + i * j % 3 == 0;
|
|
1467
|
-
};
|
|
1468
|
-
case QRMaskPattern.PATTERN110:
|
|
1469
|
-
return function(i, j) {
|
|
1470
|
-
return (i * j % 2 + i * j % 3) % 2 == 0;
|
|
1471
|
-
};
|
|
1472
|
-
case QRMaskPattern.PATTERN111:
|
|
1473
|
-
return function(i, j) {
|
|
1474
|
-
return (i * j % 3 + (i + j) % 2) % 2 == 0;
|
|
1475
|
-
};
|
|
1476
|
-
default:
|
|
1477
|
-
throw "bad maskPattern:" + maskPattern;
|
|
1478
|
-
}
|
|
1479
|
-
};
|
|
1480
|
-
_this.getErrorCorrectPolynomial = function(errorCorrectLength) {
|
|
1481
|
-
let a = qrPolynomial([1], 0);
|
|
1482
|
-
for (let i = 0; i < errorCorrectLength; i += 1) {
|
|
1483
|
-
a = a.multiply(qrPolynomial([1, QRMath.gexp(i)], 0));
|
|
1484
|
-
}
|
|
1485
|
-
return a;
|
|
1486
|
-
};
|
|
1487
|
-
_this.getLengthInBits = function(mode, type) {
|
|
1488
|
-
if (1 <= type && type < 10) {
|
|
1489
|
-
switch (mode) {
|
|
1490
|
-
case QRMode.MODE_NUMBER:
|
|
1491
|
-
return 10;
|
|
1492
|
-
case QRMode.MODE_ALPHA_NUM:
|
|
1493
|
-
return 9;
|
|
1494
|
-
case QRMode.MODE_8BIT_BYTE:
|
|
1495
|
-
return 8;
|
|
1496
|
-
case QRMode.MODE_KANJI:
|
|
1497
|
-
return 8;
|
|
1498
|
-
default:
|
|
1499
|
-
throw "mode:" + mode;
|
|
1500
|
-
}
|
|
1501
|
-
} else if (type < 27) {
|
|
1502
|
-
switch (mode) {
|
|
1503
|
-
case QRMode.MODE_NUMBER:
|
|
1504
|
-
return 12;
|
|
1505
|
-
case QRMode.MODE_ALPHA_NUM:
|
|
1506
|
-
return 11;
|
|
1507
|
-
case QRMode.MODE_8BIT_BYTE:
|
|
1508
|
-
return 16;
|
|
1509
|
-
case QRMode.MODE_KANJI:
|
|
1510
|
-
return 10;
|
|
1511
|
-
default:
|
|
1512
|
-
throw "mode:" + mode;
|
|
1513
|
-
}
|
|
1514
|
-
} else if (type < 41) {
|
|
1515
|
-
switch (mode) {
|
|
1516
|
-
case QRMode.MODE_NUMBER:
|
|
1517
|
-
return 14;
|
|
1518
|
-
case QRMode.MODE_ALPHA_NUM:
|
|
1519
|
-
return 13;
|
|
1520
|
-
case QRMode.MODE_8BIT_BYTE:
|
|
1521
|
-
return 16;
|
|
1522
|
-
case QRMode.MODE_KANJI:
|
|
1523
|
-
return 12;
|
|
1524
|
-
default:
|
|
1525
|
-
throw "mode:" + mode;
|
|
1526
|
-
}
|
|
1527
|
-
} else {
|
|
1528
|
-
throw "type:" + type;
|
|
1529
|
-
}
|
|
1530
|
-
};
|
|
1531
|
-
_this.getLostPoint = function(qrcode2) {
|
|
1532
|
-
const moduleCount = qrcode2.getModuleCount();
|
|
1533
|
-
let lostPoint = 0;
|
|
1534
|
-
for (let row = 0; row < moduleCount; row += 1) {
|
|
1535
|
-
for (let col = 0; col < moduleCount; col += 1) {
|
|
1536
|
-
let sameCount = 0;
|
|
1537
|
-
const dark = qrcode2.isDark(row, col);
|
|
1538
|
-
for (let r = -1; r <= 1; r += 1) {
|
|
1539
|
-
if (row + r < 0 || moduleCount <= row + r) {
|
|
1540
|
-
continue;
|
|
1541
|
-
}
|
|
1542
|
-
for (let c = -1; c <= 1; c += 1) {
|
|
1543
|
-
if (col + c < 0 || moduleCount <= col + c) {
|
|
1544
|
-
continue;
|
|
1545
|
-
}
|
|
1546
|
-
if (r == 0 && c == 0) {
|
|
1547
|
-
continue;
|
|
1548
|
-
}
|
|
1549
|
-
if (dark == qrcode2.isDark(row + r, col + c)) {
|
|
1550
|
-
sameCount += 1;
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
}
|
|
1554
|
-
if (sameCount > 5) {
|
|
1555
|
-
lostPoint += 3 + sameCount - 5;
|
|
1556
|
-
}
|
|
1557
|
-
}
|
|
1558
|
-
}
|
|
1559
|
-
;
|
|
1560
|
-
for (let row = 0; row < moduleCount - 1; row += 1) {
|
|
1561
|
-
for (let col = 0; col < moduleCount - 1; col += 1) {
|
|
1562
|
-
let count = 0;
|
|
1563
|
-
if (qrcode2.isDark(row, col)) count += 1;
|
|
1564
|
-
if (qrcode2.isDark(row + 1, col)) count += 1;
|
|
1565
|
-
if (qrcode2.isDark(row, col + 1)) count += 1;
|
|
1566
|
-
if (qrcode2.isDark(row + 1, col + 1)) count += 1;
|
|
1567
|
-
if (count == 0 || count == 4) {
|
|
1568
|
-
lostPoint += 3;
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
}
|
|
1572
|
-
for (let row = 0; row < moduleCount; row += 1) {
|
|
1573
|
-
for (let col = 0; col < moduleCount - 6; col += 1) {
|
|
1574
|
-
if (qrcode2.isDark(row, col) && !qrcode2.isDark(row, col + 1) && qrcode2.isDark(row, col + 2) && qrcode2.isDark(row, col + 3) && qrcode2.isDark(row, col + 4) && !qrcode2.isDark(row, col + 5) && qrcode2.isDark(row, col + 6)) {
|
|
1575
|
-
lostPoint += 40;
|
|
1576
|
-
}
|
|
1577
|
-
}
|
|
1578
|
-
}
|
|
1579
|
-
for (let col = 0; col < moduleCount; col += 1) {
|
|
1580
|
-
for (let row = 0; row < moduleCount - 6; row += 1) {
|
|
1581
|
-
if (qrcode2.isDark(row, col) && !qrcode2.isDark(row + 1, col) && qrcode2.isDark(row + 2, col) && qrcode2.isDark(row + 3, col) && qrcode2.isDark(row + 4, col) && !qrcode2.isDark(row + 5, col) && qrcode2.isDark(row + 6, col)) {
|
|
1582
|
-
lostPoint += 40;
|
|
1583
|
-
}
|
|
1584
|
-
}
|
|
1585
|
-
}
|
|
1586
|
-
let darkCount = 0;
|
|
1587
|
-
for (let col = 0; col < moduleCount; col += 1) {
|
|
1588
|
-
for (let row = 0; row < moduleCount; row += 1) {
|
|
1589
|
-
if (qrcode2.isDark(row, col)) {
|
|
1590
|
-
darkCount += 1;
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
}
|
|
1594
|
-
const ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
|
|
1595
|
-
lostPoint += ratio * 10;
|
|
1596
|
-
return lostPoint;
|
|
1597
|
-
};
|
|
1598
|
-
return _this;
|
|
1599
|
-
})();
|
|
1600
|
-
var QRMath = (function() {
|
|
1601
|
-
const EXP_TABLE = new Array(256);
|
|
1602
|
-
const LOG_TABLE = new Array(256);
|
|
1603
|
-
for (let i = 0; i < 8; i += 1) {
|
|
1604
|
-
EXP_TABLE[i] = 1 << i;
|
|
1605
|
-
}
|
|
1606
|
-
for (let i = 8; i < 256; i += 1) {
|
|
1607
|
-
EXP_TABLE[i] = EXP_TABLE[i - 4] ^ EXP_TABLE[i - 5] ^ EXP_TABLE[i - 6] ^ EXP_TABLE[i - 8];
|
|
1608
|
-
}
|
|
1609
|
-
for (let i = 0; i < 255; i += 1) {
|
|
1610
|
-
LOG_TABLE[EXP_TABLE[i]] = i;
|
|
1611
|
-
}
|
|
1612
|
-
const _this = {};
|
|
1613
|
-
_this.glog = function(n) {
|
|
1614
|
-
if (n < 1) {
|
|
1615
|
-
throw "glog(" + n + ")";
|
|
1616
|
-
}
|
|
1617
|
-
return LOG_TABLE[n];
|
|
1618
|
-
};
|
|
1619
|
-
_this.gexp = function(n) {
|
|
1620
|
-
while (n < 0) {
|
|
1621
|
-
n += 255;
|
|
1622
|
-
}
|
|
1623
|
-
while (n >= 256) {
|
|
1624
|
-
n -= 255;
|
|
1625
|
-
}
|
|
1626
|
-
return EXP_TABLE[n];
|
|
1627
|
-
};
|
|
1628
|
-
return _this;
|
|
1629
|
-
})();
|
|
1630
|
-
var qrPolynomial = function(num, shift) {
|
|
1631
|
-
if (typeof num.length == "undefined") {
|
|
1632
|
-
throw num.length + "/" + shift;
|
|
1633
|
-
}
|
|
1634
|
-
const _num = (function() {
|
|
1635
|
-
let offset = 0;
|
|
1636
|
-
while (offset < num.length && num[offset] == 0) {
|
|
1637
|
-
offset += 1;
|
|
1638
|
-
}
|
|
1639
|
-
const _num2 = new Array(num.length - offset + shift);
|
|
1640
|
-
for (let i = 0; i < num.length - offset; i += 1) {
|
|
1641
|
-
_num2[i] = num[i + offset];
|
|
1642
|
-
}
|
|
1643
|
-
return _num2;
|
|
1644
|
-
})();
|
|
1645
|
-
const _this = {};
|
|
1646
|
-
_this.getAt = function(index) {
|
|
1647
|
-
return _num[index];
|
|
1648
|
-
};
|
|
1649
|
-
_this.getLength = function() {
|
|
1650
|
-
return _num.length;
|
|
1651
|
-
};
|
|
1652
|
-
_this.multiply = function(e) {
|
|
1653
|
-
const num2 = new Array(_this.getLength() + e.getLength() - 1);
|
|
1654
|
-
for (let i = 0; i < _this.getLength(); i += 1) {
|
|
1655
|
-
for (let j = 0; j < e.getLength(); j += 1) {
|
|
1656
|
-
num2[i + j] ^= QRMath.gexp(QRMath.glog(_this.getAt(i)) + QRMath.glog(e.getAt(j)));
|
|
1657
|
-
}
|
|
1658
|
-
}
|
|
1659
|
-
return qrPolynomial(num2, 0);
|
|
1660
|
-
};
|
|
1661
|
-
_this.mod = function(e) {
|
|
1662
|
-
if (_this.getLength() - e.getLength() < 0) {
|
|
1663
|
-
return _this;
|
|
1664
|
-
}
|
|
1665
|
-
const ratio = QRMath.glog(_this.getAt(0)) - QRMath.glog(e.getAt(0));
|
|
1666
|
-
const num2 = new Array(_this.getLength());
|
|
1667
|
-
for (let i = 0; i < _this.getLength(); i += 1) {
|
|
1668
|
-
num2[i] = _this.getAt(i);
|
|
1669
|
-
}
|
|
1670
|
-
for (let i = 0; i < e.getLength(); i += 1) {
|
|
1671
|
-
num2[i] ^= QRMath.gexp(QRMath.glog(e.getAt(i)) + ratio);
|
|
1672
|
-
}
|
|
1673
|
-
return qrPolynomial(num2, 0).mod(e);
|
|
1674
|
-
};
|
|
1675
|
-
return _this;
|
|
1676
|
-
};
|
|
1677
|
-
var QRRSBlock = (function() {
|
|
1678
|
-
const RS_BLOCK_TABLE = [
|
|
1679
|
-
// L
|
|
1680
|
-
// M
|
|
1681
|
-
// Q
|
|
1682
|
-
// H
|
|
1683
|
-
// 1
|
|
1684
|
-
[1, 26, 19],
|
|
1685
|
-
[1, 26, 16],
|
|
1686
|
-
[1, 26, 13],
|
|
1687
|
-
[1, 26, 9],
|
|
1688
|
-
// 2
|
|
1689
|
-
[1, 44, 34],
|
|
1690
|
-
[1, 44, 28],
|
|
1691
|
-
[1, 44, 22],
|
|
1692
|
-
[1, 44, 16],
|
|
1693
|
-
// 3
|
|
1694
|
-
[1, 70, 55],
|
|
1695
|
-
[1, 70, 44],
|
|
1696
|
-
[2, 35, 17],
|
|
1697
|
-
[2, 35, 13],
|
|
1698
|
-
// 4
|
|
1699
|
-
[1, 100, 80],
|
|
1700
|
-
[2, 50, 32],
|
|
1701
|
-
[2, 50, 24],
|
|
1702
|
-
[4, 25, 9],
|
|
1703
|
-
// 5
|
|
1704
|
-
[1, 134, 108],
|
|
1705
|
-
[2, 67, 43],
|
|
1706
|
-
[2, 33, 15, 2, 34, 16],
|
|
1707
|
-
[2, 33, 11, 2, 34, 12],
|
|
1708
|
-
// 6
|
|
1709
|
-
[2, 86, 68],
|
|
1710
|
-
[4, 43, 27],
|
|
1711
|
-
[4, 43, 19],
|
|
1712
|
-
[4, 43, 15],
|
|
1713
|
-
// 7
|
|
1714
|
-
[2, 98, 78],
|
|
1715
|
-
[4, 49, 31],
|
|
1716
|
-
[2, 32, 14, 4, 33, 15],
|
|
1717
|
-
[4, 39, 13, 1, 40, 14],
|
|
1718
|
-
// 8
|
|
1719
|
-
[2, 121, 97],
|
|
1720
|
-
[2, 60, 38, 2, 61, 39],
|
|
1721
|
-
[4, 40, 18, 2, 41, 19],
|
|
1722
|
-
[4, 40, 14, 2, 41, 15],
|
|
1723
|
-
// 9
|
|
1724
|
-
[2, 146, 116],
|
|
1725
|
-
[3, 58, 36, 2, 59, 37],
|
|
1726
|
-
[4, 36, 16, 4, 37, 17],
|
|
1727
|
-
[4, 36, 12, 4, 37, 13],
|
|
1728
|
-
// 10
|
|
1729
|
-
[2, 86, 68, 2, 87, 69],
|
|
1730
|
-
[4, 69, 43, 1, 70, 44],
|
|
1731
|
-
[6, 43, 19, 2, 44, 20],
|
|
1732
|
-
[6, 43, 15, 2, 44, 16],
|
|
1733
|
-
// 11
|
|
1734
|
-
[4, 101, 81],
|
|
1735
|
-
[1, 80, 50, 4, 81, 51],
|
|
1736
|
-
[4, 50, 22, 4, 51, 23],
|
|
1737
|
-
[3, 36, 12, 8, 37, 13],
|
|
1738
|
-
// 12
|
|
1739
|
-
[2, 116, 92, 2, 117, 93],
|
|
1740
|
-
[6, 58, 36, 2, 59, 37],
|
|
1741
|
-
[4, 46, 20, 6, 47, 21],
|
|
1742
|
-
[7, 42, 14, 4, 43, 15],
|
|
1743
|
-
// 13
|
|
1744
|
-
[4, 133, 107],
|
|
1745
|
-
[8, 59, 37, 1, 60, 38],
|
|
1746
|
-
[8, 44, 20, 4, 45, 21],
|
|
1747
|
-
[12, 33, 11, 4, 34, 12],
|
|
1748
|
-
// 14
|
|
1749
|
-
[3, 145, 115, 1, 146, 116],
|
|
1750
|
-
[4, 64, 40, 5, 65, 41],
|
|
1751
|
-
[11, 36, 16, 5, 37, 17],
|
|
1752
|
-
[11, 36, 12, 5, 37, 13],
|
|
1753
|
-
// 15
|
|
1754
|
-
[5, 109, 87, 1, 110, 88],
|
|
1755
|
-
[5, 65, 41, 5, 66, 42],
|
|
1756
|
-
[5, 54, 24, 7, 55, 25],
|
|
1757
|
-
[11, 36, 12, 7, 37, 13],
|
|
1758
|
-
// 16
|
|
1759
|
-
[5, 122, 98, 1, 123, 99],
|
|
1760
|
-
[7, 73, 45, 3, 74, 46],
|
|
1761
|
-
[15, 43, 19, 2, 44, 20],
|
|
1762
|
-
[3, 45, 15, 13, 46, 16],
|
|
1763
|
-
// 17
|
|
1764
|
-
[1, 135, 107, 5, 136, 108],
|
|
1765
|
-
[10, 74, 46, 1, 75, 47],
|
|
1766
|
-
[1, 50, 22, 15, 51, 23],
|
|
1767
|
-
[2, 42, 14, 17, 43, 15],
|
|
1768
|
-
// 18
|
|
1769
|
-
[5, 150, 120, 1, 151, 121],
|
|
1770
|
-
[9, 69, 43, 4, 70, 44],
|
|
1771
|
-
[17, 50, 22, 1, 51, 23],
|
|
1772
|
-
[2, 42, 14, 19, 43, 15],
|
|
1773
|
-
// 19
|
|
1774
|
-
[3, 141, 113, 4, 142, 114],
|
|
1775
|
-
[3, 70, 44, 11, 71, 45],
|
|
1776
|
-
[17, 47, 21, 4, 48, 22],
|
|
1777
|
-
[9, 39, 13, 16, 40, 14],
|
|
1778
|
-
// 20
|
|
1779
|
-
[3, 135, 107, 5, 136, 108],
|
|
1780
|
-
[3, 67, 41, 13, 68, 42],
|
|
1781
|
-
[15, 54, 24, 5, 55, 25],
|
|
1782
|
-
[15, 43, 15, 10, 44, 16],
|
|
1783
|
-
// 21
|
|
1784
|
-
[4, 144, 116, 4, 145, 117],
|
|
1785
|
-
[17, 68, 42],
|
|
1786
|
-
[17, 50, 22, 6, 51, 23],
|
|
1787
|
-
[19, 46, 16, 6, 47, 17],
|
|
1788
|
-
// 22
|
|
1789
|
-
[2, 139, 111, 7, 140, 112],
|
|
1790
|
-
[17, 74, 46],
|
|
1791
|
-
[7, 54, 24, 16, 55, 25],
|
|
1792
|
-
[34, 37, 13],
|
|
1793
|
-
// 23
|
|
1794
|
-
[4, 151, 121, 5, 152, 122],
|
|
1795
|
-
[4, 75, 47, 14, 76, 48],
|
|
1796
|
-
[11, 54, 24, 14, 55, 25],
|
|
1797
|
-
[16, 45, 15, 14, 46, 16],
|
|
1798
|
-
// 24
|
|
1799
|
-
[6, 147, 117, 4, 148, 118],
|
|
1800
|
-
[6, 73, 45, 14, 74, 46],
|
|
1801
|
-
[11, 54, 24, 16, 55, 25],
|
|
1802
|
-
[30, 46, 16, 2, 47, 17],
|
|
1803
|
-
// 25
|
|
1804
|
-
[8, 132, 106, 4, 133, 107],
|
|
1805
|
-
[8, 75, 47, 13, 76, 48],
|
|
1806
|
-
[7, 54, 24, 22, 55, 25],
|
|
1807
|
-
[22, 45, 15, 13, 46, 16],
|
|
1808
|
-
// 26
|
|
1809
|
-
[10, 142, 114, 2, 143, 115],
|
|
1810
|
-
[19, 74, 46, 4, 75, 47],
|
|
1811
|
-
[28, 50, 22, 6, 51, 23],
|
|
1812
|
-
[33, 46, 16, 4, 47, 17],
|
|
1813
|
-
// 27
|
|
1814
|
-
[8, 152, 122, 4, 153, 123],
|
|
1815
|
-
[22, 73, 45, 3, 74, 46],
|
|
1816
|
-
[8, 53, 23, 26, 54, 24],
|
|
1817
|
-
[12, 45, 15, 28, 46, 16],
|
|
1818
|
-
// 28
|
|
1819
|
-
[3, 147, 117, 10, 148, 118],
|
|
1820
|
-
[3, 73, 45, 23, 74, 46],
|
|
1821
|
-
[4, 54, 24, 31, 55, 25],
|
|
1822
|
-
[11, 45, 15, 31, 46, 16],
|
|
1823
|
-
// 29
|
|
1824
|
-
[7, 146, 116, 7, 147, 117],
|
|
1825
|
-
[21, 73, 45, 7, 74, 46],
|
|
1826
|
-
[1, 53, 23, 37, 54, 24],
|
|
1827
|
-
[19, 45, 15, 26, 46, 16],
|
|
1828
|
-
// 30
|
|
1829
|
-
[5, 145, 115, 10, 146, 116],
|
|
1830
|
-
[19, 75, 47, 10, 76, 48],
|
|
1831
|
-
[15, 54, 24, 25, 55, 25],
|
|
1832
|
-
[23, 45, 15, 25, 46, 16],
|
|
1833
|
-
// 31
|
|
1834
|
-
[13, 145, 115, 3, 146, 116],
|
|
1835
|
-
[2, 74, 46, 29, 75, 47],
|
|
1836
|
-
[42, 54, 24, 1, 55, 25],
|
|
1837
|
-
[23, 45, 15, 28, 46, 16],
|
|
1838
|
-
// 32
|
|
1839
|
-
[17, 145, 115],
|
|
1840
|
-
[10, 74, 46, 23, 75, 47],
|
|
1841
|
-
[10, 54, 24, 35, 55, 25],
|
|
1842
|
-
[19, 45, 15, 35, 46, 16],
|
|
1843
|
-
// 33
|
|
1844
|
-
[17, 145, 115, 1, 146, 116],
|
|
1845
|
-
[14, 74, 46, 21, 75, 47],
|
|
1846
|
-
[29, 54, 24, 19, 55, 25],
|
|
1847
|
-
[11, 45, 15, 46, 46, 16],
|
|
1848
|
-
// 34
|
|
1849
|
-
[13, 145, 115, 6, 146, 116],
|
|
1850
|
-
[14, 74, 46, 23, 75, 47],
|
|
1851
|
-
[44, 54, 24, 7, 55, 25],
|
|
1852
|
-
[59, 46, 16, 1, 47, 17],
|
|
1853
|
-
// 35
|
|
1854
|
-
[12, 151, 121, 7, 152, 122],
|
|
1855
|
-
[12, 75, 47, 26, 76, 48],
|
|
1856
|
-
[39, 54, 24, 14, 55, 25],
|
|
1857
|
-
[22, 45, 15, 41, 46, 16],
|
|
1858
|
-
// 36
|
|
1859
|
-
[6, 151, 121, 14, 152, 122],
|
|
1860
|
-
[6, 75, 47, 34, 76, 48],
|
|
1861
|
-
[46, 54, 24, 10, 55, 25],
|
|
1862
|
-
[2, 45, 15, 64, 46, 16],
|
|
1863
|
-
// 37
|
|
1864
|
-
[17, 152, 122, 4, 153, 123],
|
|
1865
|
-
[29, 74, 46, 14, 75, 47],
|
|
1866
|
-
[49, 54, 24, 10, 55, 25],
|
|
1867
|
-
[24, 45, 15, 46, 46, 16],
|
|
1868
|
-
// 38
|
|
1869
|
-
[4, 152, 122, 18, 153, 123],
|
|
1870
|
-
[13, 74, 46, 32, 75, 47],
|
|
1871
|
-
[48, 54, 24, 14, 55, 25],
|
|
1872
|
-
[42, 45, 15, 32, 46, 16],
|
|
1873
|
-
// 39
|
|
1874
|
-
[20, 147, 117, 4, 148, 118],
|
|
1875
|
-
[40, 75, 47, 7, 76, 48],
|
|
1876
|
-
[43, 54, 24, 22, 55, 25],
|
|
1877
|
-
[10, 45, 15, 67, 46, 16],
|
|
1878
|
-
// 40
|
|
1879
|
-
[19, 148, 118, 6, 149, 119],
|
|
1880
|
-
[18, 75, 47, 31, 76, 48],
|
|
1881
|
-
[34, 54, 24, 34, 55, 25],
|
|
1882
|
-
[20, 45, 15, 61, 46, 16]
|
|
1883
|
-
];
|
|
1884
|
-
const qrRSBlock = function(totalCount, dataCount) {
|
|
1885
|
-
const _this2 = {};
|
|
1886
|
-
_this2.totalCount = totalCount;
|
|
1887
|
-
_this2.dataCount = dataCount;
|
|
1888
|
-
return _this2;
|
|
1889
|
-
};
|
|
1890
|
-
const _this = {};
|
|
1891
|
-
const getRsBlockTable = function(typeNumber, errorCorrectionLevel) {
|
|
1892
|
-
switch (errorCorrectionLevel) {
|
|
1893
|
-
case QRErrorCorrectionLevel.L:
|
|
1894
|
-
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
|
|
1895
|
-
case QRErrorCorrectionLevel.M:
|
|
1896
|
-
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
|
|
1897
|
-
case QRErrorCorrectionLevel.Q:
|
|
1898
|
-
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
|
|
1899
|
-
case QRErrorCorrectionLevel.H:
|
|
1900
|
-
return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
|
|
1901
|
-
default:
|
|
1902
|
-
return void 0;
|
|
1903
|
-
}
|
|
1904
|
-
};
|
|
1905
|
-
_this.getRSBlocks = function(typeNumber, errorCorrectionLevel) {
|
|
1906
|
-
const rsBlock = getRsBlockTable(typeNumber, errorCorrectionLevel);
|
|
1907
|
-
if (typeof rsBlock == "undefined") {
|
|
1908
|
-
throw "bad rs block @ typeNumber:" + typeNumber + "/errorCorrectionLevel:" + errorCorrectionLevel;
|
|
1909
|
-
}
|
|
1910
|
-
const length = rsBlock.length / 3;
|
|
1911
|
-
const list = [];
|
|
1912
|
-
for (let i = 0; i < length; i += 1) {
|
|
1913
|
-
const count = rsBlock[i * 3 + 0];
|
|
1914
|
-
const totalCount = rsBlock[i * 3 + 1];
|
|
1915
|
-
const dataCount = rsBlock[i * 3 + 2];
|
|
1916
|
-
for (let j = 0; j < count; j += 1) {
|
|
1917
|
-
list.push(qrRSBlock(totalCount, dataCount));
|
|
1918
|
-
}
|
|
1919
|
-
}
|
|
1920
|
-
return list;
|
|
1921
|
-
};
|
|
1922
|
-
return _this;
|
|
1923
|
-
})();
|
|
1924
|
-
var qrBitBuffer = function() {
|
|
1925
|
-
const _buffer = [];
|
|
1926
|
-
let _length = 0;
|
|
1927
|
-
const _this = {};
|
|
1928
|
-
_this.getBuffer = function() {
|
|
1929
|
-
return _buffer;
|
|
1930
|
-
};
|
|
1931
|
-
_this.getAt = function(index) {
|
|
1932
|
-
const bufIndex = Math.floor(index / 8);
|
|
1933
|
-
return (_buffer[bufIndex] >>> 7 - index % 8 & 1) == 1;
|
|
1934
|
-
};
|
|
1935
|
-
_this.put = function(num, length) {
|
|
1936
|
-
for (let i = 0; i < length; i += 1) {
|
|
1937
|
-
_this.putBit((num >>> length - i - 1 & 1) == 1);
|
|
1938
|
-
}
|
|
1939
|
-
};
|
|
1940
|
-
_this.getLengthInBits = function() {
|
|
1941
|
-
return _length;
|
|
1942
|
-
};
|
|
1943
|
-
_this.putBit = function(bit) {
|
|
1944
|
-
const bufIndex = Math.floor(_length / 8);
|
|
1945
|
-
if (_buffer.length <= bufIndex) {
|
|
1946
|
-
_buffer.push(0);
|
|
1947
|
-
}
|
|
1948
|
-
if (bit) {
|
|
1949
|
-
_buffer[bufIndex] |= 128 >>> _length % 8;
|
|
1950
|
-
}
|
|
1951
|
-
_length += 1;
|
|
1952
|
-
};
|
|
1953
|
-
return _this;
|
|
1954
|
-
};
|
|
1955
|
-
var qrNumber = function(data) {
|
|
1956
|
-
const _mode = QRMode.MODE_NUMBER;
|
|
1957
|
-
const _data = data;
|
|
1958
|
-
const _this = {};
|
|
1959
|
-
_this.getMode = function() {
|
|
1960
|
-
return _mode;
|
|
1961
|
-
};
|
|
1962
|
-
_this.getLength = function(buffer) {
|
|
1963
|
-
return _data.length;
|
|
1964
|
-
};
|
|
1965
|
-
_this.write = function(buffer) {
|
|
1966
|
-
const data2 = _data;
|
|
1967
|
-
let i = 0;
|
|
1968
|
-
while (i + 2 < data2.length) {
|
|
1969
|
-
buffer.put(strToNum(data2.substring(i, i + 3)), 10);
|
|
1970
|
-
i += 3;
|
|
1971
|
-
}
|
|
1972
|
-
if (i < data2.length) {
|
|
1973
|
-
if (data2.length - i == 1) {
|
|
1974
|
-
buffer.put(strToNum(data2.substring(i, i + 1)), 4);
|
|
1975
|
-
} else if (data2.length - i == 2) {
|
|
1976
|
-
buffer.put(strToNum(data2.substring(i, i + 2)), 7);
|
|
1977
|
-
}
|
|
1978
|
-
}
|
|
1979
|
-
};
|
|
1980
|
-
const strToNum = function(s) {
|
|
1981
|
-
let num = 0;
|
|
1982
|
-
for (let i = 0; i < s.length; i += 1) {
|
|
1983
|
-
num = num * 10 + chatToNum(s.charAt(i));
|
|
1984
|
-
}
|
|
1985
|
-
return num;
|
|
1986
|
-
};
|
|
1987
|
-
const chatToNum = function(c) {
|
|
1988
|
-
if ("0" <= c && c <= "9") {
|
|
1989
|
-
return c.charCodeAt(0) - "0".charCodeAt(0);
|
|
1990
|
-
}
|
|
1991
|
-
throw "illegal char :" + c;
|
|
1992
|
-
};
|
|
1993
|
-
return _this;
|
|
1994
|
-
};
|
|
1995
|
-
var qrAlphaNum = function(data) {
|
|
1996
|
-
const _mode = QRMode.MODE_ALPHA_NUM;
|
|
1997
|
-
const _data = data;
|
|
1998
|
-
const _this = {};
|
|
1999
|
-
_this.getMode = function() {
|
|
2000
|
-
return _mode;
|
|
2001
|
-
};
|
|
2002
|
-
_this.getLength = function(buffer) {
|
|
2003
|
-
return _data.length;
|
|
2004
|
-
};
|
|
2005
|
-
_this.write = function(buffer) {
|
|
2006
|
-
const s = _data;
|
|
2007
|
-
let i = 0;
|
|
2008
|
-
while (i + 1 < s.length) {
|
|
2009
|
-
buffer.put(
|
|
2010
|
-
getCode(s.charAt(i)) * 45 + getCode(s.charAt(i + 1)),
|
|
2011
|
-
11
|
|
2012
|
-
);
|
|
2013
|
-
i += 2;
|
|
2014
|
-
}
|
|
2015
|
-
if (i < s.length) {
|
|
2016
|
-
buffer.put(getCode(s.charAt(i)), 6);
|
|
2017
|
-
}
|
|
2018
|
-
};
|
|
2019
|
-
const getCode = function(c) {
|
|
2020
|
-
if ("0" <= c && c <= "9") {
|
|
2021
|
-
return c.charCodeAt(0) - "0".charCodeAt(0);
|
|
2022
|
-
} else if ("A" <= c && c <= "Z") {
|
|
2023
|
-
return c.charCodeAt(0) - "A".charCodeAt(0) + 10;
|
|
2024
|
-
} else {
|
|
2025
|
-
switch (c) {
|
|
2026
|
-
case " ":
|
|
2027
|
-
return 36;
|
|
2028
|
-
case "$":
|
|
2029
|
-
return 37;
|
|
2030
|
-
case "%":
|
|
2031
|
-
return 38;
|
|
2032
|
-
case "*":
|
|
2033
|
-
return 39;
|
|
2034
|
-
case "+":
|
|
2035
|
-
return 40;
|
|
2036
|
-
case "-":
|
|
2037
|
-
return 41;
|
|
2038
|
-
case ".":
|
|
2039
|
-
return 42;
|
|
2040
|
-
case "/":
|
|
2041
|
-
return 43;
|
|
2042
|
-
case ":":
|
|
2043
|
-
return 44;
|
|
2044
|
-
default:
|
|
2045
|
-
throw "illegal char :" + c;
|
|
2046
|
-
}
|
|
2047
|
-
}
|
|
2048
|
-
};
|
|
2049
|
-
return _this;
|
|
2050
|
-
};
|
|
2051
|
-
var qr8BitByte = function(data) {
|
|
2052
|
-
const _mode = QRMode.MODE_8BIT_BYTE;
|
|
2053
|
-
const _data = data;
|
|
2054
|
-
const _bytes = qrcode.stringToBytes(data);
|
|
2055
|
-
const _this = {};
|
|
2056
|
-
_this.getMode = function() {
|
|
2057
|
-
return _mode;
|
|
2058
|
-
};
|
|
2059
|
-
_this.getLength = function(buffer) {
|
|
2060
|
-
return _bytes.length;
|
|
2061
|
-
};
|
|
2062
|
-
_this.write = function(buffer) {
|
|
2063
|
-
for (let i = 0; i < _bytes.length; i += 1) {
|
|
2064
|
-
buffer.put(_bytes[i], 8);
|
|
2065
|
-
}
|
|
2066
|
-
};
|
|
2067
|
-
return _this;
|
|
2068
|
-
};
|
|
2069
|
-
var qrKanji = function(data) {
|
|
2070
|
-
const _mode = QRMode.MODE_KANJI;
|
|
2071
|
-
const _data = data;
|
|
2072
|
-
const stringToBytes2 = qrcode.stringToBytes;
|
|
2073
|
-
!(function(c, code) {
|
|
2074
|
-
const test = stringToBytes2(c);
|
|
2075
|
-
if (test.length != 2 || (test[0] << 8 | test[1]) != code) {
|
|
2076
|
-
throw "sjis not supported.";
|
|
2077
|
-
}
|
|
2078
|
-
})("\u53CB", 38726);
|
|
2079
|
-
const _bytes = stringToBytes2(data);
|
|
2080
|
-
const _this = {};
|
|
2081
|
-
_this.getMode = function() {
|
|
2082
|
-
return _mode;
|
|
2083
|
-
};
|
|
2084
|
-
_this.getLength = function(buffer) {
|
|
2085
|
-
return ~~(_bytes.length / 2);
|
|
2086
|
-
};
|
|
2087
|
-
_this.write = function(buffer) {
|
|
2088
|
-
const data2 = _bytes;
|
|
2089
|
-
let i = 0;
|
|
2090
|
-
while (i + 1 < data2.length) {
|
|
2091
|
-
let c = (255 & data2[i]) << 8 | 255 & data2[i + 1];
|
|
2092
|
-
if (33088 <= c && c <= 40956) {
|
|
2093
|
-
c -= 33088;
|
|
2094
|
-
} else if (57408 <= c && c <= 60351) {
|
|
2095
|
-
c -= 49472;
|
|
2096
|
-
} else {
|
|
2097
|
-
throw "illegal char at " + (i + 1) + "/" + c;
|
|
2098
|
-
}
|
|
2099
|
-
c = (c >>> 8 & 255) * 192 + (c & 255);
|
|
2100
|
-
buffer.put(c, 13);
|
|
2101
|
-
i += 2;
|
|
2102
|
-
}
|
|
2103
|
-
if (i < data2.length) {
|
|
2104
|
-
throw "illegal char at " + (i + 1);
|
|
2105
|
-
}
|
|
2106
|
-
};
|
|
2107
|
-
return _this;
|
|
2108
|
-
};
|
|
2109
|
-
var byteArrayOutputStream = function() {
|
|
2110
|
-
const _bytes = [];
|
|
2111
|
-
const _this = {};
|
|
2112
|
-
_this.writeByte = function(b) {
|
|
2113
|
-
_bytes.push(b & 255);
|
|
2114
|
-
};
|
|
2115
|
-
_this.writeShort = function(i) {
|
|
2116
|
-
_this.writeByte(i);
|
|
2117
|
-
_this.writeByte(i >>> 8);
|
|
2118
|
-
};
|
|
2119
|
-
_this.writeBytes = function(b, off, len) {
|
|
2120
|
-
off = off || 0;
|
|
2121
|
-
len = len || b.length;
|
|
2122
|
-
for (let i = 0; i < len; i += 1) {
|
|
2123
|
-
_this.writeByte(b[i + off]);
|
|
2124
|
-
}
|
|
2125
|
-
};
|
|
2126
|
-
_this.writeString = function(s) {
|
|
2127
|
-
for (let i = 0; i < s.length; i += 1) {
|
|
2128
|
-
_this.writeByte(s.charCodeAt(i));
|
|
2129
|
-
}
|
|
2130
|
-
};
|
|
2131
|
-
_this.toByteArray = function() {
|
|
2132
|
-
return _bytes;
|
|
2133
|
-
};
|
|
2134
|
-
_this.toString = function() {
|
|
2135
|
-
let s = "";
|
|
2136
|
-
s += "[";
|
|
2137
|
-
for (let i = 0; i < _bytes.length; i += 1) {
|
|
2138
|
-
if (i > 0) {
|
|
2139
|
-
s += ",";
|
|
2140
|
-
}
|
|
2141
|
-
s += _bytes[i];
|
|
2142
|
-
}
|
|
2143
|
-
s += "]";
|
|
2144
|
-
return s;
|
|
2145
|
-
};
|
|
2146
|
-
return _this;
|
|
2147
|
-
};
|
|
2148
|
-
var base64EncodeOutputStream = function() {
|
|
2149
|
-
let _buffer = 0;
|
|
2150
|
-
let _buflen = 0;
|
|
2151
|
-
let _length = 0;
|
|
2152
|
-
let _base64 = "";
|
|
2153
|
-
const _this = {};
|
|
2154
|
-
const writeEncoded = function(b) {
|
|
2155
|
-
_base64 += String.fromCharCode(encode(b & 63));
|
|
2156
|
-
};
|
|
2157
|
-
const encode = function(n) {
|
|
2158
|
-
if (n < 0) {
|
|
2159
|
-
throw "n:" + n;
|
|
2160
|
-
} else if (n < 26) {
|
|
2161
|
-
return 65 + n;
|
|
2162
|
-
} else if (n < 52) {
|
|
2163
|
-
return 97 + (n - 26);
|
|
2164
|
-
} else if (n < 62) {
|
|
2165
|
-
return 48 + (n - 52);
|
|
2166
|
-
} else if (n == 62) {
|
|
2167
|
-
return 43;
|
|
2168
|
-
} else if (n == 63) {
|
|
2169
|
-
return 47;
|
|
2170
|
-
} else {
|
|
2171
|
-
throw "n:" + n;
|
|
2172
|
-
}
|
|
2173
|
-
};
|
|
2174
|
-
_this.writeByte = function(n) {
|
|
2175
|
-
_buffer = _buffer << 8 | n & 255;
|
|
2176
|
-
_buflen += 8;
|
|
2177
|
-
_length += 1;
|
|
2178
|
-
while (_buflen >= 6) {
|
|
2179
|
-
writeEncoded(_buffer >>> _buflen - 6);
|
|
2180
|
-
_buflen -= 6;
|
|
2181
|
-
}
|
|
2182
|
-
};
|
|
2183
|
-
_this.flush = function() {
|
|
2184
|
-
if (_buflen > 0) {
|
|
2185
|
-
writeEncoded(_buffer << 6 - _buflen);
|
|
2186
|
-
_buffer = 0;
|
|
2187
|
-
_buflen = 0;
|
|
2188
|
-
}
|
|
2189
|
-
if (_length % 3 != 0) {
|
|
2190
|
-
const padlen = 3 - _length % 3;
|
|
2191
|
-
for (let i = 0; i < padlen; i += 1) {
|
|
2192
|
-
_base64 += "=";
|
|
2193
|
-
}
|
|
2194
|
-
}
|
|
2195
|
-
};
|
|
2196
|
-
_this.toString = function() {
|
|
2197
|
-
return _base64;
|
|
2198
|
-
};
|
|
2199
|
-
return _this;
|
|
2200
|
-
};
|
|
2201
|
-
var base64DecodeInputStream = function(str) {
|
|
2202
|
-
const _str = str;
|
|
2203
|
-
let _pos = 0;
|
|
2204
|
-
let _buffer = 0;
|
|
2205
|
-
let _buflen = 0;
|
|
2206
|
-
const _this = {};
|
|
2207
|
-
_this.read = function() {
|
|
2208
|
-
while (_buflen < 8) {
|
|
2209
|
-
if (_pos >= _str.length) {
|
|
2210
|
-
if (_buflen == 0) {
|
|
2211
|
-
return -1;
|
|
2212
|
-
}
|
|
2213
|
-
throw "unexpected end of file./" + _buflen;
|
|
2214
|
-
}
|
|
2215
|
-
const c = _str.charAt(_pos);
|
|
2216
|
-
_pos += 1;
|
|
2217
|
-
if (c == "=") {
|
|
2218
|
-
_buflen = 0;
|
|
2219
|
-
return -1;
|
|
2220
|
-
} else if (c.match(/^\s$/)) {
|
|
2221
|
-
continue;
|
|
2222
|
-
}
|
|
2223
|
-
_buffer = _buffer << 6 | decode(c.charCodeAt(0));
|
|
2224
|
-
_buflen += 6;
|
|
2225
|
-
}
|
|
2226
|
-
const n = _buffer >>> _buflen - 8 & 255;
|
|
2227
|
-
_buflen -= 8;
|
|
2228
|
-
return n;
|
|
2229
|
-
};
|
|
2230
|
-
const decode = function(c) {
|
|
2231
|
-
if (65 <= c && c <= 90) {
|
|
2232
|
-
return c - 65;
|
|
2233
|
-
} else if (97 <= c && c <= 122) {
|
|
2234
|
-
return c - 97 + 26;
|
|
2235
|
-
} else if (48 <= c && c <= 57) {
|
|
2236
|
-
return c - 48 + 52;
|
|
2237
|
-
} else if (c == 43) {
|
|
2238
|
-
return 62;
|
|
2239
|
-
} else if (c == 47) {
|
|
2240
|
-
return 63;
|
|
2241
|
-
} else {
|
|
2242
|
-
throw "c:" + c;
|
|
2243
|
-
}
|
|
2244
|
-
};
|
|
2245
|
-
return _this;
|
|
2246
|
-
};
|
|
2247
|
-
var gifImage = function(width, height) {
|
|
2248
|
-
const _width = width;
|
|
2249
|
-
const _height = height;
|
|
2250
|
-
const _data = new Array(width * height);
|
|
2251
|
-
const _this = {};
|
|
2252
|
-
_this.setPixel = function(x, y, pixel) {
|
|
2253
|
-
_data[y * _width + x] = pixel;
|
|
2254
|
-
};
|
|
2255
|
-
_this.write = function(out) {
|
|
2256
|
-
out.writeString("GIF87a");
|
|
2257
|
-
out.writeShort(_width);
|
|
2258
|
-
out.writeShort(_height);
|
|
2259
|
-
out.writeByte(128);
|
|
2260
|
-
out.writeByte(0);
|
|
2261
|
-
out.writeByte(0);
|
|
2262
|
-
out.writeByte(0);
|
|
2263
|
-
out.writeByte(0);
|
|
2264
|
-
out.writeByte(0);
|
|
2265
|
-
out.writeByte(255);
|
|
2266
|
-
out.writeByte(255);
|
|
2267
|
-
out.writeByte(255);
|
|
2268
|
-
out.writeString(",");
|
|
2269
|
-
out.writeShort(0);
|
|
2270
|
-
out.writeShort(0);
|
|
2271
|
-
out.writeShort(_width);
|
|
2272
|
-
out.writeShort(_height);
|
|
2273
|
-
out.writeByte(0);
|
|
2274
|
-
const lzwMinCodeSize = 2;
|
|
2275
|
-
const raster = getLZWRaster(lzwMinCodeSize);
|
|
2276
|
-
out.writeByte(lzwMinCodeSize);
|
|
2277
|
-
let offset = 0;
|
|
2278
|
-
while (raster.length - offset > 255) {
|
|
2279
|
-
out.writeByte(255);
|
|
2280
|
-
out.writeBytes(raster, offset, 255);
|
|
2281
|
-
offset += 255;
|
|
2282
|
-
}
|
|
2283
|
-
out.writeByte(raster.length - offset);
|
|
2284
|
-
out.writeBytes(raster, offset, raster.length - offset);
|
|
2285
|
-
out.writeByte(0);
|
|
2286
|
-
out.writeString(";");
|
|
2287
|
-
};
|
|
2288
|
-
const bitOutputStream = function(out) {
|
|
2289
|
-
const _out = out;
|
|
2290
|
-
let _bitLength = 0;
|
|
2291
|
-
let _bitBuffer = 0;
|
|
2292
|
-
const _this2 = {};
|
|
2293
|
-
_this2.write = function(data, length) {
|
|
2294
|
-
if (data >>> length != 0) {
|
|
2295
|
-
throw "length over";
|
|
2296
|
-
}
|
|
2297
|
-
while (_bitLength + length >= 8) {
|
|
2298
|
-
_out.writeByte(255 & (data << _bitLength | _bitBuffer));
|
|
2299
|
-
length -= 8 - _bitLength;
|
|
2300
|
-
data >>>= 8 - _bitLength;
|
|
2301
|
-
_bitBuffer = 0;
|
|
2302
|
-
_bitLength = 0;
|
|
2303
|
-
}
|
|
2304
|
-
_bitBuffer = data << _bitLength | _bitBuffer;
|
|
2305
|
-
_bitLength = _bitLength + length;
|
|
2306
|
-
};
|
|
2307
|
-
_this2.flush = function() {
|
|
2308
|
-
if (_bitLength > 0) {
|
|
2309
|
-
_out.writeByte(_bitBuffer);
|
|
2310
|
-
}
|
|
2311
|
-
};
|
|
2312
|
-
return _this2;
|
|
2313
|
-
};
|
|
2314
|
-
const getLZWRaster = function(lzwMinCodeSize) {
|
|
2315
|
-
const clearCode = 1 << lzwMinCodeSize;
|
|
2316
|
-
const endCode = (1 << lzwMinCodeSize) + 1;
|
|
2317
|
-
let bitLength = lzwMinCodeSize + 1;
|
|
2318
|
-
const table = lzwTable();
|
|
2319
|
-
for (let i = 0; i < clearCode; i += 1) {
|
|
2320
|
-
table.add(String.fromCharCode(i));
|
|
2321
|
-
}
|
|
2322
|
-
table.add(String.fromCharCode(clearCode));
|
|
2323
|
-
table.add(String.fromCharCode(endCode));
|
|
2324
|
-
const byteOut = byteArrayOutputStream();
|
|
2325
|
-
const bitOut = bitOutputStream(byteOut);
|
|
2326
|
-
bitOut.write(clearCode, bitLength);
|
|
2327
|
-
let dataIndex = 0;
|
|
2328
|
-
let s = String.fromCharCode(_data[dataIndex]);
|
|
2329
|
-
dataIndex += 1;
|
|
2330
|
-
while (dataIndex < _data.length) {
|
|
2331
|
-
const c = String.fromCharCode(_data[dataIndex]);
|
|
2332
|
-
dataIndex += 1;
|
|
2333
|
-
if (table.contains(s + c)) {
|
|
2334
|
-
s = s + c;
|
|
2335
|
-
} else {
|
|
2336
|
-
bitOut.write(table.indexOf(s), bitLength);
|
|
2337
|
-
if (table.size() < 4095) {
|
|
2338
|
-
if (table.size() == 1 << bitLength) {
|
|
2339
|
-
bitLength += 1;
|
|
2340
|
-
}
|
|
2341
|
-
table.add(s + c);
|
|
2342
|
-
}
|
|
2343
|
-
s = c;
|
|
2344
|
-
}
|
|
2345
|
-
}
|
|
2346
|
-
bitOut.write(table.indexOf(s), bitLength);
|
|
2347
|
-
bitOut.write(endCode, bitLength);
|
|
2348
|
-
bitOut.flush();
|
|
2349
|
-
return byteOut.toByteArray();
|
|
2350
|
-
};
|
|
2351
|
-
const lzwTable = function() {
|
|
2352
|
-
const _map = {};
|
|
2353
|
-
let _size = 0;
|
|
2354
|
-
const _this2 = {};
|
|
2355
|
-
_this2.add = function(key) {
|
|
2356
|
-
if (_this2.contains(key)) {
|
|
2357
|
-
throw "dup key:" + key;
|
|
2358
|
-
}
|
|
2359
|
-
_map[key] = _size;
|
|
2360
|
-
_size += 1;
|
|
2361
|
-
};
|
|
2362
|
-
_this2.size = function() {
|
|
2363
|
-
return _size;
|
|
2364
|
-
};
|
|
2365
|
-
_this2.indexOf = function(key) {
|
|
2366
|
-
return _map[key];
|
|
2367
|
-
};
|
|
2368
|
-
_this2.contains = function(key) {
|
|
2369
|
-
return typeof _map[key] != "undefined";
|
|
2370
|
-
};
|
|
2371
|
-
return _this2;
|
|
2372
|
-
};
|
|
2373
|
-
return _this;
|
|
2374
|
-
};
|
|
2375
|
-
var createDataURL = function(width, height, getPixel) {
|
|
2376
|
-
const gif = gifImage(width, height);
|
|
2377
|
-
for (let y = 0; y < height; y += 1) {
|
|
2378
|
-
for (let x = 0; x < width; x += 1) {
|
|
2379
|
-
gif.setPixel(x, y, getPixel(x, y));
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
const b = byteArrayOutputStream();
|
|
2383
|
-
gif.write(b);
|
|
2384
|
-
const base64 = base64EncodeOutputStream();
|
|
2385
|
-
const bytes = b.toByteArray();
|
|
2386
|
-
for (let i = 0; i < bytes.length; i += 1) {
|
|
2387
|
-
base64.writeByte(bytes[i]);
|
|
2388
|
-
}
|
|
2389
|
-
base64.flush();
|
|
2390
|
-
return "data:image/gif;base64," + base64;
|
|
2391
|
-
};
|
|
2392
|
-
var qrcode_default = qrcode;
|
|
2393
|
-
var stringToBytes = qrcode.stringToBytes;
|
|
2394
|
-
|
|
2395
|
-
// src/components/qr.ts
|
|
2396
|
-
function qrPath(value) {
|
|
2397
|
-
if (!value) return null;
|
|
2398
|
-
try {
|
|
2399
|
-
const qr = qrcode_default(0, "M");
|
|
2400
|
-
qr.addData(value);
|
|
2401
|
-
qr.make();
|
|
2402
|
-
const count = qr.getModuleCount();
|
|
2403
|
-
let d = "";
|
|
2404
|
-
for (let row = 0; row < count; row++) {
|
|
2405
|
-
for (let col = 0; col < count; col++) {
|
|
2406
|
-
if (qr.isDark(row, col)) d += `M${col} ${row}h1v1h-1z`;
|
|
2407
|
-
}
|
|
2408
|
-
}
|
|
2409
|
-
return { d, count };
|
|
2410
|
-
} catch {
|
|
2411
|
-
return null;
|
|
2412
|
-
}
|
|
2413
|
-
}
|
|
2414
|
-
|
|
2415
|
-
// src/components/QrCode.tsx
|
|
2416
760
|
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2417
761
|
function QrCode({ value, size = 200 }) {
|
|
2418
762
|
const t = useT();
|
|
2419
|
-
const path = React7.
|
|
763
|
+
const [path, setPath] = React7.useState(null);
|
|
764
|
+
React7.useEffect(() => {
|
|
765
|
+
let active = true;
|
|
766
|
+
setPath(null);
|
|
767
|
+
void import("./qr-ZNG4MAV5.js").then(
|
|
768
|
+
({ qrPath }) => {
|
|
769
|
+
if (active) setPath(qrPath(value));
|
|
770
|
+
},
|
|
771
|
+
() => {
|
|
772
|
+
if (active) setPath(null);
|
|
773
|
+
}
|
|
774
|
+
);
|
|
775
|
+
return () => {
|
|
776
|
+
active = false;
|
|
777
|
+
};
|
|
778
|
+
}, [value]);
|
|
2420
779
|
if (!path) return null;
|
|
2421
780
|
const margin = 4;
|
|
2422
781
|
const dim = path.count + margin * 2;
|
|
@@ -3015,8 +1374,25 @@ function InvitationBanner() {
|
|
|
3015
1374
|
return /* @__PURE__ */ jsx17("p", { className: "ba-muted", "data-testid": "authowl-invitation-banner", children: t("organization.invitationBanner") });
|
|
3016
1375
|
}
|
|
3017
1376
|
|
|
1377
|
+
// src/components/PublicConfigError.tsx
|
|
1378
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1379
|
+
function PublicConfigError({
|
|
1380
|
+
showBadge,
|
|
1381
|
+
showBranding = true
|
|
1382
|
+
}) {
|
|
1383
|
+
const t = useT();
|
|
1384
|
+
const { retry } = usePublicConfig();
|
|
1385
|
+
return /* @__PURE__ */ jsxs16("div", { className: "ba-form", "data-testid": "authowl-config-error", role: "alert", children: [
|
|
1386
|
+
showBranding ? /* @__PURE__ */ jsx18(AuthOwlBranding, {}) : null,
|
|
1387
|
+
/* @__PURE__ */ jsx18("h2", { className: "ba-title", children: t("publicConfig.error.title") }),
|
|
1388
|
+
/* @__PURE__ */ jsx18("p", { className: "ba-muted", children: t("publicConfig.error.description") }),
|
|
1389
|
+
/* @__PURE__ */ jsx18("button", { className: "ba-button", type: "button", onClick: retry, children: t("publicConfig.retry") }),
|
|
1390
|
+
/* @__PURE__ */ jsx18(AuthOwlBadge, { force: showBadge })
|
|
1391
|
+
] });
|
|
1392
|
+
}
|
|
1393
|
+
|
|
3018
1394
|
// src/components/SignIn.tsx
|
|
3019
|
-
import { Fragment as Fragment4, jsx as
|
|
1395
|
+
import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3020
1396
|
function SignIn({
|
|
3021
1397
|
redirectTo,
|
|
3022
1398
|
onSignedIn,
|
|
@@ -3058,41 +1434,44 @@ function SignIn({
|
|
|
3058
1434
|
redirectTo,
|
|
3059
1435
|
onSignedIn
|
|
3060
1436
|
});
|
|
3061
|
-
const badge = /* @__PURE__ */
|
|
3062
|
-
const branding = showBranding ? /* @__PURE__ */
|
|
1437
|
+
const badge = /* @__PURE__ */ jsx19(AuthOwlBadge, { force: showBadge });
|
|
1438
|
+
const branding = showBranding ? /* @__PURE__ */ jsx19(AuthOwlBranding, {}) : null;
|
|
3063
1439
|
if (isLoading) {
|
|
3064
|
-
return /* @__PURE__ */
|
|
3065
|
-
/* @__PURE__ */
|
|
3066
|
-
/* @__PURE__ */
|
|
1440
|
+
return /* @__PURE__ */ jsxs17("div", { className: "ba-form", "data-testid": "signin-loading", "aria-busy": "true", children: [
|
|
1441
|
+
/* @__PURE__ */ jsx19("div", { className: "ba-skeleton" }),
|
|
1442
|
+
/* @__PURE__ */ jsx19("div", { className: "ba-skeleton" })
|
|
3067
1443
|
] });
|
|
3068
1444
|
}
|
|
1445
|
+
if (isError) {
|
|
1446
|
+
return /* @__PURE__ */ jsx19(PublicConfigError, { showBadge, showBranding });
|
|
1447
|
+
}
|
|
3069
1448
|
if (mfaEnrolment !== "clear") {
|
|
3070
|
-
return /* @__PURE__ */
|
|
1449
|
+
return /* @__PURE__ */ jsxs17("div", { className: "ba-form", "data-testid": "signin-mfa-enrolment", "aria-busy": mfaEnrolment === "confirming", children: [
|
|
3071
1450
|
branding,
|
|
3072
|
-
mfaEnrolment === "pending" ? /* @__PURE__ */
|
|
1451
|
+
mfaEnrolment === "pending" ? /* @__PURE__ */ jsx19(MfaEnrollmentStep, {}) : /* @__PURE__ */ jsx19("div", { className: "ba-skeleton" }),
|
|
3073
1452
|
badge
|
|
3074
1453
|
] });
|
|
3075
1454
|
}
|
|
3076
1455
|
if (challenge) {
|
|
3077
|
-
return /* @__PURE__ */
|
|
1456
|
+
return /* @__PURE__ */ jsxs17("div", { className: "ba-form", "data-testid": "signin-mfa", children: [
|
|
3078
1457
|
branding,
|
|
3079
|
-
/* @__PURE__ */
|
|
1458
|
+
/* @__PURE__ */ jsx19(MFAChallenge, { onVerified: () => finishSignIn({ sessionStore, redirectTo, onSignedIn }) }),
|
|
3080
1459
|
badge
|
|
3081
1460
|
] });
|
|
3082
1461
|
}
|
|
3083
1462
|
if (view === "forgot" && resetPasswordUrl) {
|
|
3084
|
-
return /* @__PURE__ */
|
|
1463
|
+
return /* @__PURE__ */ jsxs17("div", { className: "ba-form", "data-testid": "signin-forgot", children: [
|
|
3085
1464
|
branding,
|
|
3086
|
-
/* @__PURE__ */
|
|
3087
|
-
/* @__PURE__ */
|
|
1465
|
+
/* @__PURE__ */ jsx19("h2", { className: "ba-title", children: t("signIn.forgotTitle") }),
|
|
1466
|
+
/* @__PURE__ */ jsx19(ForgotPassword, { resetPasswordUrl, onBack: () => setView("sign-in") }),
|
|
3088
1467
|
badge
|
|
3089
1468
|
] });
|
|
3090
1469
|
}
|
|
3091
1470
|
if (view === "otp-code") {
|
|
3092
|
-
return /* @__PURE__ */
|
|
1471
|
+
return /* @__PURE__ */ jsxs17("div", { className: "ba-form", "data-testid": "signin-otp-code", children: [
|
|
3093
1472
|
branding,
|
|
3094
|
-
/* @__PURE__ */
|
|
3095
|
-
/* @__PURE__ */
|
|
1473
|
+
/* @__PURE__ */ jsx19("h2", { className: "ba-title", children: t("signIn.title") }),
|
|
1474
|
+
/* @__PURE__ */ jsx19(
|
|
3096
1475
|
OtpCodeForm,
|
|
3097
1476
|
{
|
|
3098
1477
|
email,
|
|
@@ -3118,18 +1497,18 @@ function SignIn({
|
|
|
3118
1497
|
] });
|
|
3119
1498
|
}
|
|
3120
1499
|
if (view === "magic-sent") {
|
|
3121
|
-
return /* @__PURE__ */
|
|
1500
|
+
return /* @__PURE__ */ jsxs17("div", { className: "ba-form", "data-testid": "signin-magic-sent", children: [
|
|
3122
1501
|
branding,
|
|
3123
|
-
/* @__PURE__ */
|
|
3124
|
-
/* @__PURE__ */
|
|
3125
|
-
/* @__PURE__ */
|
|
1502
|
+
/* @__PURE__ */ jsx19("h2", { className: "ba-title", children: t("signIn.title") }),
|
|
1503
|
+
/* @__PURE__ */ jsx19("p", { className: "ba-muted", children: t("magicLink.sent") }),
|
|
1504
|
+
/* @__PURE__ */ jsx19("button", { type: "button", className: "ba-link-button", onClick: () => setView("sign-in"), children: t("forgotPassword.backToSignIn") }),
|
|
3126
1505
|
badge
|
|
3127
1506
|
] });
|
|
3128
1507
|
}
|
|
3129
1508
|
if (view === "phone") {
|
|
3130
|
-
return /* @__PURE__ */
|
|
1509
|
+
return /* @__PURE__ */ jsxs17("div", { className: "ba-form", "data-testid": "signin-phone", children: [
|
|
3131
1510
|
branding,
|
|
3132
|
-
/* @__PURE__ */
|
|
1511
|
+
/* @__PURE__ */ jsx19(
|
|
3133
1512
|
PhoneOTP,
|
|
3134
1513
|
{
|
|
3135
1514
|
redirectTo,
|
|
@@ -3206,14 +1585,13 @@ function SignIn({
|
|
|
3206
1585
|
{ key: "otp", enabled: plan.emailOtp, action: doRequestOtp, label: t("emailOtp.requestSubmit"), pendingLabel: t("common.sending") },
|
|
3207
1586
|
{ key: "sso", enabled: plan.sso, action: doSso, label: t("sso.continueWith"), pendingLabel: t("sso.redirecting") }
|
|
3208
1587
|
];
|
|
3209
|
-
return /* @__PURE__ */
|
|
1588
|
+
return /* @__PURE__ */ jsxs17("div", { className: "ba-form", "data-testid": "signin-form", children: [
|
|
3210
1589
|
branding,
|
|
3211
|
-
/* @__PURE__ */
|
|
3212
|
-
/* @__PURE__ */
|
|
3213
|
-
|
|
3214
|
-
/* @__PURE__ */
|
|
3215
|
-
|
|
3216
|
-
hasCredentialForm && /* @__PURE__ */ jsxs16(
|
|
1590
|
+
/* @__PURE__ */ jsx19("h2", { className: "ba-title", children: t("signIn.title") }),
|
|
1591
|
+
/* @__PURE__ */ jsx19(InvitationBanner, {}),
|
|
1592
|
+
/* @__PURE__ */ jsx19(SocialButtons, { providers: plan.social, callbackURL: redirectTo }),
|
|
1593
|
+
showDivider && /* @__PURE__ */ jsx19("div", { className: "ba-divider", children: t("common.orDivider") }),
|
|
1594
|
+
hasCredentialForm && /* @__PURE__ */ jsxs17(
|
|
3217
1595
|
"form",
|
|
3218
1596
|
{
|
|
3219
1597
|
method: "post",
|
|
@@ -3224,9 +1602,9 @@ function SignIn({
|
|
|
3224
1602
|
else if (plan.primary) PRIMARY_ACTION[plan.primary]();
|
|
3225
1603
|
},
|
|
3226
1604
|
children: [
|
|
3227
|
-
credentialMode === "email" ? /* @__PURE__ */
|
|
1605
|
+
credentialMode === "email" ? /* @__PURE__ */ jsxs17("label", { className: "ba-label", children: [
|
|
3228
1606
|
t("common.emailLabel"),
|
|
3229
|
-
/* @__PURE__ */
|
|
1607
|
+
/* @__PURE__ */ jsx19(
|
|
3230
1608
|
"input",
|
|
3231
1609
|
{
|
|
3232
1610
|
ref: emailRef,
|
|
@@ -3241,9 +1619,9 @@ function SignIn({
|
|
|
3241
1619
|
required: true
|
|
3242
1620
|
}
|
|
3243
1621
|
)
|
|
3244
|
-
] }) : /* @__PURE__ */
|
|
1622
|
+
] }) : /* @__PURE__ */ jsxs17("label", { className: "ba-label", children: [
|
|
3245
1623
|
t("common.usernameLabel"),
|
|
3246
|
-
/* @__PURE__ */
|
|
1624
|
+
/* @__PURE__ */ jsx19(
|
|
3247
1625
|
"input",
|
|
3248
1626
|
{
|
|
3249
1627
|
className: "ba-input",
|
|
@@ -3258,9 +1636,9 @@ function SignIn({
|
|
|
3258
1636
|
}
|
|
3259
1637
|
)
|
|
3260
1638
|
] }),
|
|
3261
|
-
plan.password && /* @__PURE__ */
|
|
1639
|
+
plan.password && /* @__PURE__ */ jsxs17("label", { className: "ba-label", children: [
|
|
3262
1640
|
t("common.passwordLabel"),
|
|
3263
|
-
/* @__PURE__ */
|
|
1641
|
+
/* @__PURE__ */ jsx19(
|
|
3264
1642
|
"input",
|
|
3265
1643
|
{
|
|
3266
1644
|
className: "ba-input",
|
|
@@ -3276,19 +1654,19 @@ function SignIn({
|
|
|
3276
1654
|
)
|
|
3277
1655
|
] }),
|
|
3278
1656
|
authChallenge.control,
|
|
3279
|
-
/* @__PURE__ */
|
|
3280
|
-
plan.password && /* @__PURE__ */
|
|
3281
|
-
/* @__PURE__ */
|
|
1657
|
+
/* @__PURE__ */ jsx19(FormError, { children: error }),
|
|
1658
|
+
plan.password && /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
1659
|
+
/* @__PURE__ */ jsx19(
|
|
3282
1660
|
"button",
|
|
3283
1661
|
{
|
|
3284
1662
|
className: "ba-button",
|
|
3285
1663
|
type: "submit",
|
|
3286
1664
|
disabled: pending || authChallenge.configPending,
|
|
3287
1665
|
"aria-busy": pending && inFlight === "password" || void 0,
|
|
3288
|
-
children: /* @__PURE__ */
|
|
1666
|
+
children: /* @__PURE__ */ jsx19(Busy, { busy: pending && inFlight === "password", label: t("signIn.submitPending"), children: t("signIn.submit") })
|
|
3289
1667
|
}
|
|
3290
1668
|
),
|
|
3291
|
-
resetPasswordUrl && /* @__PURE__ */
|
|
1669
|
+
resetPasswordUrl && /* @__PURE__ */ jsx19(
|
|
3292
1670
|
"button",
|
|
3293
1671
|
{
|
|
3294
1672
|
type: "button",
|
|
@@ -3300,7 +1678,7 @@ function SignIn({
|
|
|
3300
1678
|
] }),
|
|
3301
1679
|
credentialMode === "email" && alternates.filter((a) => a.enabled).map(({ key, action, label: label2, pendingLabel }) => {
|
|
3302
1680
|
const isPrimary = plan.primary === key;
|
|
3303
|
-
return /* @__PURE__ */
|
|
1681
|
+
return /* @__PURE__ */ jsx19(
|
|
3304
1682
|
"button",
|
|
3305
1683
|
{
|
|
3306
1684
|
type: isPrimary ? "submit" : "button",
|
|
@@ -3308,12 +1686,12 @@ function SignIn({
|
|
|
3308
1686
|
disabled: pending || authChallenge.configPending,
|
|
3309
1687
|
"aria-busy": pending && inFlight === key || void 0,
|
|
3310
1688
|
onClick: isPrimary ? void 0 : withEmail(action),
|
|
3311
|
-
children: /* @__PURE__ */
|
|
1689
|
+
children: /* @__PURE__ */ jsx19(Busy, { busy: pending && inFlight === key, label: pendingLabel, children: label2 })
|
|
3312
1690
|
},
|
|
3313
1691
|
key
|
|
3314
1692
|
);
|
|
3315
1693
|
}),
|
|
3316
|
-
plan.username && /* @__PURE__ */
|
|
1694
|
+
plan.username && /* @__PURE__ */ jsx19(
|
|
3317
1695
|
"button",
|
|
3318
1696
|
{
|
|
3319
1697
|
type: "button",
|
|
@@ -3329,8 +1707,8 @@ function SignIn({
|
|
|
3329
1707
|
]
|
|
3330
1708
|
}
|
|
3331
1709
|
),
|
|
3332
|
-
plan.passkey && /* @__PURE__ */
|
|
3333
|
-
plan.phoneOtp && /* @__PURE__ */
|
|
1710
|
+
plan.passkey && /* @__PURE__ */ jsx19(PasskeyButton, { redirectTo, onSignedIn }),
|
|
1711
|
+
plan.phoneOtp && /* @__PURE__ */ jsx19(
|
|
3334
1712
|
"button",
|
|
3335
1713
|
{
|
|
3336
1714
|
type: "button",
|
|
@@ -3339,7 +1717,7 @@ function SignIn({
|
|
|
3339
1717
|
children: t("phoneOtp.usePhone")
|
|
3340
1718
|
}
|
|
3341
1719
|
),
|
|
3342
|
-
!plan.renderable && /* @__PURE__ */
|
|
1720
|
+
!plan.renderable && /* @__PURE__ */ jsx19("p", { className: "ba-muted", children: plan.emptyReason === "unsupported" ? t("signIn.empty.unsupported") : t("signIn.empty.none") }),
|
|
3343
1721
|
badge
|
|
3344
1722
|
] });
|
|
3345
1723
|
}
|
|
@@ -3349,7 +1727,7 @@ import * as React17 from "react";
|
|
|
3349
1727
|
|
|
3350
1728
|
// src/components/VerificationPending.tsx
|
|
3351
1729
|
import * as React14 from "react";
|
|
3352
|
-
import { jsx as
|
|
1730
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3353
1731
|
function VerificationPending({
|
|
3354
1732
|
email,
|
|
3355
1733
|
callbackURL,
|
|
@@ -3367,10 +1745,10 @@ function VerificationPending({
|
|
|
3367
1745
|
const [code, setCode] = React14.useState("");
|
|
3368
1746
|
const [verified, setVerified] = React14.useState(false);
|
|
3369
1747
|
if (verified) {
|
|
3370
|
-
return /* @__PURE__ */
|
|
1748
|
+
return /* @__PURE__ */ jsx20("p", { className: "ba-success", role: "status", "data-testid": "verify-code-success", children: t("verifyEmail.success") });
|
|
3371
1749
|
}
|
|
3372
1750
|
if (method === "code") {
|
|
3373
|
-
return /* @__PURE__ */
|
|
1751
|
+
return /* @__PURE__ */ jsxs18(
|
|
3374
1752
|
"form",
|
|
3375
1753
|
{
|
|
3376
1754
|
method: "post",
|
|
@@ -3387,12 +1765,12 @@ function VerificationPending({
|
|
|
3387
1765
|
);
|
|
3388
1766
|
},
|
|
3389
1767
|
children: [
|
|
3390
|
-
/* @__PURE__ */
|
|
3391
|
-
email: /* @__PURE__ */
|
|
1768
|
+
/* @__PURE__ */ jsx20("p", { className: "ba-muted", children: richMessage(t("verifyPending.codeBody"), {
|
|
1769
|
+
email: /* @__PURE__ */ jsx20("strong", { children: /* @__PURE__ */ jsx20(Bidi, { children: email }) })
|
|
3392
1770
|
}) }),
|
|
3393
|
-
/* @__PURE__ */
|
|
1771
|
+
/* @__PURE__ */ jsxs18("label", { className: "ba-label", children: [
|
|
3394
1772
|
t("verifyPending.codeLabel"),
|
|
3395
|
-
/* @__PURE__ */
|
|
1773
|
+
/* @__PURE__ */ jsx20(
|
|
3396
1774
|
"input",
|
|
3397
1775
|
{
|
|
3398
1776
|
className: "ba-input",
|
|
@@ -3404,20 +1782,20 @@ function VerificationPending({
|
|
|
3404
1782
|
}
|
|
3405
1783
|
)
|
|
3406
1784
|
] }),
|
|
3407
|
-
resent && /* @__PURE__ */
|
|
1785
|
+
resent && /* @__PURE__ */ jsx20("p", { className: "ba-muted", children: t("verifyPending.resent") }),
|
|
3408
1786
|
authChallenge.control,
|
|
3409
|
-
/* @__PURE__ */
|
|
3410
|
-
/* @__PURE__ */
|
|
1787
|
+
/* @__PURE__ */ jsx20(FormError, { children: error }),
|
|
1788
|
+
/* @__PURE__ */ jsx20(
|
|
3411
1789
|
"button",
|
|
3412
1790
|
{
|
|
3413
1791
|
className: "ba-button",
|
|
3414
1792
|
type: "submit",
|
|
3415
1793
|
disabled: pending || !code,
|
|
3416
1794
|
"aria-busy": pending || void 0,
|
|
3417
|
-
children: /* @__PURE__ */
|
|
1795
|
+
children: /* @__PURE__ */ jsx20(Busy, { busy: pending, label: t("common.verifying"), children: t("emailOtp.verifySubmit") })
|
|
3418
1796
|
}
|
|
3419
1797
|
),
|
|
3420
|
-
/* @__PURE__ */
|
|
1798
|
+
/* @__PURE__ */ jsx20(
|
|
3421
1799
|
"button",
|
|
3422
1800
|
{
|
|
3423
1801
|
type: "button",
|
|
@@ -3443,14 +1821,14 @@ function VerificationPending({
|
|
|
3443
1821
|
}
|
|
3444
1822
|
);
|
|
3445
1823
|
}
|
|
3446
|
-
return /* @__PURE__ */
|
|
3447
|
-
/* @__PURE__ */
|
|
3448
|
-
email: /* @__PURE__ */
|
|
1824
|
+
return /* @__PURE__ */ jsxs18("div", { className: "ba-fields", "data-testid": "verify-pending", children: [
|
|
1825
|
+
/* @__PURE__ */ jsx20("p", { className: "ba-muted", children: richMessage(t("verifyPending.body"), {
|
|
1826
|
+
email: /* @__PURE__ */ jsx20("strong", { children: /* @__PURE__ */ jsx20(Bidi, { children: email }) })
|
|
3449
1827
|
}) }),
|
|
3450
|
-
resent && /* @__PURE__ */
|
|
1828
|
+
resent && /* @__PURE__ */ jsx20("p", { className: "ba-muted", children: t("verifyPending.resent") }),
|
|
3451
1829
|
authChallenge.control,
|
|
3452
|
-
/* @__PURE__ */
|
|
3453
|
-
/* @__PURE__ */
|
|
1830
|
+
/* @__PURE__ */ jsx20(FormError, { children: error }),
|
|
1831
|
+
/* @__PURE__ */ jsx20(
|
|
3454
1832
|
"button",
|
|
3455
1833
|
{
|
|
3456
1834
|
type: "button",
|
|
@@ -3461,7 +1839,7 @@ function VerificationPending({
|
|
|
3461
1839
|
failure: t("verifyPending.error.resendFailed"),
|
|
3462
1840
|
onSuccess: () => setResent(true)
|
|
3463
1841
|
}),
|
|
3464
|
-
children: /* @__PURE__ */
|
|
1842
|
+
children: /* @__PURE__ */ jsx20(Busy, { busy: pending, label: t("common.sending"), children: t("verifyPending.resendButton") })
|
|
3465
1843
|
}
|
|
3466
1844
|
)
|
|
3467
1845
|
] });
|
|
@@ -3469,7 +1847,7 @@ function VerificationPending({
|
|
|
3469
1847
|
|
|
3470
1848
|
// src/components/PasswordlessSignUp.tsx
|
|
3471
1849
|
import * as React15 from "react";
|
|
3472
|
-
import { jsx as
|
|
1850
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3473
1851
|
function PasswordlessSignUp({ onAuthenticated }) {
|
|
3474
1852
|
const t = useT();
|
|
3475
1853
|
const { sendEmailOtp, signInEmailOtp } = useSignIn();
|
|
@@ -3479,7 +1857,7 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
3479
1857
|
const [code, setCode] = React15.useState("");
|
|
3480
1858
|
const [codeSent, setCodeSent] = React15.useState(false);
|
|
3481
1859
|
if (codeSent) {
|
|
3482
|
-
return /* @__PURE__ */
|
|
1860
|
+
return /* @__PURE__ */ jsx21("div", { className: "ba-fields", "data-testid": "signup-emailotp-code", children: /* @__PURE__ */ jsx21(
|
|
3483
1861
|
OtpCodeForm,
|
|
3484
1862
|
{
|
|
3485
1863
|
email,
|
|
@@ -3499,7 +1877,7 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
3499
1877
|
}
|
|
3500
1878
|
) });
|
|
3501
1879
|
}
|
|
3502
|
-
return /* @__PURE__ */
|
|
1880
|
+
return /* @__PURE__ */ jsxs19(
|
|
3503
1881
|
"form",
|
|
3504
1882
|
{
|
|
3505
1883
|
method: "post",
|
|
@@ -3513,9 +1891,9 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
3513
1891
|
});
|
|
3514
1892
|
},
|
|
3515
1893
|
children: [
|
|
3516
|
-
/* @__PURE__ */
|
|
1894
|
+
/* @__PURE__ */ jsxs19("label", { className: "ba-label", children: [
|
|
3517
1895
|
t("common.emailLabel"),
|
|
3518
|
-
/* @__PURE__ */
|
|
1896
|
+
/* @__PURE__ */ jsx21(
|
|
3519
1897
|
"input",
|
|
3520
1898
|
{
|
|
3521
1899
|
className: "ba-input",
|
|
@@ -3528,15 +1906,15 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
3528
1906
|
)
|
|
3529
1907
|
] }),
|
|
3530
1908
|
authChallenge.control,
|
|
3531
|
-
/* @__PURE__ */
|
|
3532
|
-
/* @__PURE__ */
|
|
1909
|
+
/* @__PURE__ */ jsx21(FormError, { children: error }),
|
|
1910
|
+
/* @__PURE__ */ jsx21(
|
|
3533
1911
|
"button",
|
|
3534
1912
|
{
|
|
3535
1913
|
className: "ba-button ba-button-secondary",
|
|
3536
1914
|
type: "submit",
|
|
3537
1915
|
disabled: pending || authChallenge.configPending,
|
|
3538
1916
|
"aria-busy": pending || void 0,
|
|
3539
|
-
children: /* @__PURE__ */
|
|
1917
|
+
children: /* @__PURE__ */ jsx21(Busy, { busy: pending, label: t("common.sending"), children: t("signUp.passwordlessSubmit") })
|
|
3540
1918
|
}
|
|
3541
1919
|
)
|
|
3542
1920
|
]
|
|
@@ -3545,16 +1923,16 @@ function PasswordlessSignUp({ onAuthenticated }) {
|
|
|
3545
1923
|
}
|
|
3546
1924
|
|
|
3547
1925
|
// src/components/PasskeySignUpCompletion.tsx
|
|
3548
|
-
import { jsx as
|
|
1926
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3549
1927
|
function PasskeySignUpCompletion({ onComplete }) {
|
|
3550
1928
|
const t = useT();
|
|
3551
1929
|
const { addPasskey } = usePasskeys();
|
|
3552
1930
|
const { pending, error, run } = useSubmitAction();
|
|
3553
|
-
return /* @__PURE__ */
|
|
3554
|
-
/* @__PURE__ */
|
|
3555
|
-
/* @__PURE__ */
|
|
3556
|
-
/* @__PURE__ */
|
|
3557
|
-
/* @__PURE__ */
|
|
1931
|
+
return /* @__PURE__ */ jsxs20("div", { className: "ba-fields", "data-testid": "signup-passkey-completion", children: [
|
|
1932
|
+
/* @__PURE__ */ jsx22("h3", { className: "ba-title", children: t("signUp.passkeyTitle") }),
|
|
1933
|
+
/* @__PURE__ */ jsx22("p", { className: "ba-muted", children: t("signUp.passkeyDescription") }),
|
|
1934
|
+
/* @__PURE__ */ jsx22(FormError, { children: error }),
|
|
1935
|
+
/* @__PURE__ */ jsx22(
|
|
3558
1936
|
"button",
|
|
3559
1937
|
{
|
|
3560
1938
|
className: "ba-button",
|
|
@@ -3565,16 +1943,16 @@ function PasskeySignUpCompletion({ onComplete }) {
|
|
|
3565
1943
|
failure: t("signUp.error.passkeyFailed"),
|
|
3566
1944
|
onSuccess: onComplete
|
|
3567
1945
|
}),
|
|
3568
|
-
children: /* @__PURE__ */
|
|
1946
|
+
children: /* @__PURE__ */ jsx22(Busy, { busy: pending, label: t("passkey.waiting"), children: t("signUp.passkeySubmit") })
|
|
3569
1947
|
}
|
|
3570
1948
|
),
|
|
3571
|
-
/* @__PURE__ */
|
|
1949
|
+
/* @__PURE__ */ jsx22("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: onComplete, children: t("signUp.passkeySkip") })
|
|
3572
1950
|
] });
|
|
3573
1951
|
}
|
|
3574
1952
|
|
|
3575
1953
|
// src/components/Waitlist.tsx
|
|
3576
1954
|
import * as React16 from "react";
|
|
3577
|
-
import { jsx as
|
|
1955
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3578
1956
|
function Waitlist({ onJoined, showBadge, showBranding = true } = {}) {
|
|
3579
1957
|
const t = useT();
|
|
3580
1958
|
const { join } = useWaitlist();
|
|
@@ -3583,18 +1961,18 @@ function Waitlist({ onJoined, showBadge, showBranding = true } = {}) {
|
|
|
3583
1961
|
const [email, setEmail] = React16.useState("");
|
|
3584
1962
|
const [joined, setJoined] = React16.useState(false);
|
|
3585
1963
|
if (joined) {
|
|
3586
|
-
return /* @__PURE__ */
|
|
3587
|
-
showBranding ? /* @__PURE__ */
|
|
3588
|
-
/* @__PURE__ */
|
|
3589
|
-
/* @__PURE__ */
|
|
3590
|
-
/* @__PURE__ */
|
|
1964
|
+
return /* @__PURE__ */ jsxs21("div", { className: "ba-form", "data-testid": "waitlist-accepted", children: [
|
|
1965
|
+
showBranding ? /* @__PURE__ */ jsx23(AuthOwlBranding, {}) : null,
|
|
1966
|
+
/* @__PURE__ */ jsx23("h2", { className: "ba-title", children: t("waitlist.acceptedTitle") }),
|
|
1967
|
+
/* @__PURE__ */ jsx23("p", { className: "ba-muted", children: t("waitlist.acceptedDescription") }),
|
|
1968
|
+
/* @__PURE__ */ jsx23(AuthOwlBadge, { force: showBadge })
|
|
3591
1969
|
] });
|
|
3592
1970
|
}
|
|
3593
|
-
return /* @__PURE__ */
|
|
3594
|
-
showBranding ? /* @__PURE__ */
|
|
3595
|
-
/* @__PURE__ */
|
|
3596
|
-
/* @__PURE__ */
|
|
3597
|
-
/* @__PURE__ */
|
|
1971
|
+
return /* @__PURE__ */ jsxs21("div", { className: "ba-form", "data-testid": "waitlist-form", children: [
|
|
1972
|
+
showBranding ? /* @__PURE__ */ jsx23(AuthOwlBranding, {}) : null,
|
|
1973
|
+
/* @__PURE__ */ jsx23("h2", { className: "ba-title", children: t("waitlist.title") }),
|
|
1974
|
+
/* @__PURE__ */ jsx23("p", { className: "ba-muted", children: t("waitlist.description") }),
|
|
1975
|
+
/* @__PURE__ */ jsxs21(
|
|
3598
1976
|
"form",
|
|
3599
1977
|
{
|
|
3600
1978
|
method: "post",
|
|
@@ -3616,9 +1994,9 @@ function Waitlist({ onJoined, showBadge, showBranding = true } = {}) {
|
|
|
3616
1994
|
);
|
|
3617
1995
|
},
|
|
3618
1996
|
children: [
|
|
3619
|
-
/* @__PURE__ */
|
|
1997
|
+
/* @__PURE__ */ jsxs21("label", { className: "ba-label", children: [
|
|
3620
1998
|
t("common.emailLabel"),
|
|
3621
|
-
/* @__PURE__ */
|
|
1999
|
+
/* @__PURE__ */ jsx23(
|
|
3622
2000
|
"input",
|
|
3623
2001
|
{
|
|
3624
2002
|
className: "ba-input",
|
|
@@ -3632,26 +2010,26 @@ function Waitlist({ onJoined, showBadge, showBranding = true } = {}) {
|
|
|
3632
2010
|
)
|
|
3633
2011
|
] }),
|
|
3634
2012
|
authChallenge.control,
|
|
3635
|
-
/* @__PURE__ */
|
|
3636
|
-
/* @__PURE__ */
|
|
2013
|
+
/* @__PURE__ */ jsx23(FormError, { children: error }),
|
|
2014
|
+
/* @__PURE__ */ jsx23(
|
|
3637
2015
|
"button",
|
|
3638
2016
|
{
|
|
3639
2017
|
className: "ba-button",
|
|
3640
2018
|
type: "submit",
|
|
3641
2019
|
disabled: pending || authChallenge.configPending,
|
|
3642
2020
|
"aria-busy": pending || void 0,
|
|
3643
|
-
children: /* @__PURE__ */
|
|
2021
|
+
children: /* @__PURE__ */ jsx23(Busy, { busy: pending, label: t("waitlist.submitPending"), children: t("waitlist.submit") })
|
|
3644
2022
|
}
|
|
3645
2023
|
)
|
|
3646
2024
|
]
|
|
3647
2025
|
}
|
|
3648
2026
|
),
|
|
3649
|
-
/* @__PURE__ */
|
|
2027
|
+
/* @__PURE__ */ jsx23(AuthOwlBadge, { force: showBadge })
|
|
3650
2028
|
] });
|
|
3651
2029
|
}
|
|
3652
2030
|
|
|
3653
2031
|
// src/components/SignUp.tsx
|
|
3654
|
-
import { Fragment as Fragment5, jsx as
|
|
2032
|
+
import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3655
2033
|
function SignUp({
|
|
3656
2034
|
redirectTo,
|
|
3657
2035
|
onSignedUp,
|
|
@@ -3663,7 +2041,7 @@ function SignUp({
|
|
|
3663
2041
|
const t = useT();
|
|
3664
2042
|
const toServerError = useServerError();
|
|
3665
2043
|
const { signUp } = useSignUp();
|
|
3666
|
-
const { config, isLoading } = usePublicConfig();
|
|
2044
|
+
const { config, isLoading, isError } = usePublicConfig();
|
|
3667
2045
|
const authChallenge = useAuthChallenge();
|
|
3668
2046
|
const [email, setEmail] = React17.useState("");
|
|
3669
2047
|
const [password, setPassword] = React17.useState("");
|
|
@@ -3735,18 +2113,21 @@ function SignUp({
|
|
|
3735
2113
|
}
|
|
3736
2114
|
}
|
|
3737
2115
|
if (isLoading) {
|
|
3738
|
-
return /* @__PURE__ */
|
|
3739
|
-
/* @__PURE__ */
|
|
3740
|
-
/* @__PURE__ */
|
|
2116
|
+
return /* @__PURE__ */ jsxs22("div", { className: "ba-form", "data-testid": "signup-loading", "aria-busy": "true", children: [
|
|
2117
|
+
/* @__PURE__ */ jsx24("div", { className: "ba-skeleton" }),
|
|
2118
|
+
/* @__PURE__ */ jsx24("div", { className: "ba-skeleton" })
|
|
3741
2119
|
] });
|
|
3742
2120
|
}
|
|
2121
|
+
if (isError) {
|
|
2122
|
+
return /* @__PURE__ */ jsx24(PublicConfigError, { showBadge, showBranding });
|
|
2123
|
+
}
|
|
3743
2124
|
if (config?.signUp?.mode === "waitlist") {
|
|
3744
|
-
return /* @__PURE__ */
|
|
2125
|
+
return /* @__PURE__ */ jsx24(Waitlist, { onJoined: onWaitlisted, showBadge, showBranding });
|
|
3745
2126
|
}
|
|
3746
2127
|
if (pendingEmail) {
|
|
3747
|
-
return /* @__PURE__ */
|
|
3748
|
-
showBranding ? /* @__PURE__ */
|
|
3749
|
-
/* @__PURE__ */
|
|
2128
|
+
return /* @__PURE__ */ jsxs22("div", { className: "ba-form", "data-testid": "signup-verify-pending", children: [
|
|
2129
|
+
showBranding ? /* @__PURE__ */ jsx24(AuthOwlBranding, {}) : null,
|
|
2130
|
+
/* @__PURE__ */ jsx24(
|
|
3750
2131
|
VerificationPending,
|
|
3751
2132
|
{
|
|
3752
2133
|
email: pendingEmail,
|
|
@@ -3754,7 +2135,7 @@ function SignUp({
|
|
|
3754
2135
|
method: capabilities.emailVerificationMethod
|
|
3755
2136
|
}
|
|
3756
2137
|
),
|
|
3757
|
-
/* @__PURE__ */
|
|
2138
|
+
/* @__PURE__ */ jsx24(AuthOwlBadge, { force: showBadge })
|
|
3758
2139
|
] });
|
|
3759
2140
|
}
|
|
3760
2141
|
const methods = config?.enabledMethods ?? ["password"];
|
|
@@ -3764,22 +2145,22 @@ function SignUp({
|
|
|
3764
2145
|
const showPasswordless = publicSignupAllowed && capabilities.emailOtpSignIn && capabilities.emailSignUp && !consentRequired && !capabilities.mfaRequired;
|
|
3765
2146
|
const renderable = showPassword || showPasswordless || social.length > 0;
|
|
3766
2147
|
if (completeWithPasskey) {
|
|
3767
|
-
return /* @__PURE__ */
|
|
3768
|
-
showBranding ? /* @__PURE__ */
|
|
3769
|
-
/* @__PURE__ */
|
|
3770
|
-
/* @__PURE__ */
|
|
2148
|
+
return /* @__PURE__ */ jsxs22("div", { className: "ba-form", "data-testid": "signup-passkey-step", children: [
|
|
2149
|
+
showBranding ? /* @__PURE__ */ jsx24(AuthOwlBranding, {}) : null,
|
|
2150
|
+
/* @__PURE__ */ jsx24(PasskeySignUpCompletion, { onComplete: finishSignUp }),
|
|
2151
|
+
/* @__PURE__ */ jsx24(AuthOwlBadge, { force: showBadge })
|
|
3771
2152
|
] });
|
|
3772
2153
|
}
|
|
3773
|
-
return /* @__PURE__ */
|
|
3774
|
-
showBranding ? /* @__PURE__ */
|
|
3775
|
-
/* @__PURE__ */
|
|
3776
|
-
/* @__PURE__ */
|
|
3777
|
-
/* @__PURE__ */
|
|
3778
|
-
showPassword && social.length > 0 && /* @__PURE__ */
|
|
3779
|
-
showPassword && /* @__PURE__ */
|
|
3780
|
-
capabilities.legacyNameField && /* @__PURE__ */
|
|
2154
|
+
return /* @__PURE__ */ jsxs22("div", { className: "ba-form", "data-testid": "signup-form", children: [
|
|
2155
|
+
showBranding ? /* @__PURE__ */ jsx24(AuthOwlBranding, {}) : null,
|
|
2156
|
+
/* @__PURE__ */ jsx24("h2", { className: "ba-title", children: t("signUp.title") }),
|
|
2157
|
+
/* @__PURE__ */ jsx24(InvitationBanner, {}),
|
|
2158
|
+
/* @__PURE__ */ jsx24(SocialButtons, { providers: social, callbackURL: redirectTo }),
|
|
2159
|
+
showPassword && social.length > 0 && /* @__PURE__ */ jsx24("div", { className: "ba-divider", children: t("common.orDivider") }),
|
|
2160
|
+
showPassword && /* @__PURE__ */ jsxs22("form", { method: "post", onSubmit, className: "ba-fields", children: [
|
|
2161
|
+
capabilities.legacyNameField && /* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
|
|
3781
2162
|
t("signUp.nameLabel"),
|
|
3782
|
-
/* @__PURE__ */
|
|
2163
|
+
/* @__PURE__ */ jsx24(
|
|
3783
2164
|
"input",
|
|
3784
2165
|
{
|
|
3785
2166
|
className: "ba-input",
|
|
@@ -3793,10 +2174,10 @@ function SignUp({
|
|
|
3793
2174
|
}
|
|
3794
2175
|
)
|
|
3795
2176
|
] }),
|
|
3796
|
-
capabilities.firstLastName && /* @__PURE__ */
|
|
3797
|
-
/* @__PURE__ */
|
|
2177
|
+
capabilities.firstLastName && /* @__PURE__ */ jsxs22(Fragment5, { children: [
|
|
2178
|
+
/* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
|
|
3798
2179
|
t("signUp.firstNameLabel"),
|
|
3799
|
-
/* @__PURE__ */
|
|
2180
|
+
/* @__PURE__ */ jsx24(
|
|
3800
2181
|
"input",
|
|
3801
2182
|
{
|
|
3802
2183
|
className: "ba-input",
|
|
@@ -3809,9 +2190,9 @@ function SignUp({
|
|
|
3809
2190
|
}
|
|
3810
2191
|
)
|
|
3811
2192
|
] }),
|
|
3812
|
-
/* @__PURE__ */
|
|
2193
|
+
/* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
|
|
3813
2194
|
t("signUp.lastNameLabel"),
|
|
3814
|
-
/* @__PURE__ */
|
|
2195
|
+
/* @__PURE__ */ jsx24(
|
|
3815
2196
|
"input",
|
|
3816
2197
|
{
|
|
3817
2198
|
className: "ba-input",
|
|
@@ -3825,9 +2206,9 @@ function SignUp({
|
|
|
3825
2206
|
)
|
|
3826
2207
|
] })
|
|
3827
2208
|
] }),
|
|
3828
|
-
capabilities.collectUsername && /* @__PURE__ */
|
|
2209
|
+
capabilities.collectUsername && /* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
|
|
3829
2210
|
t("common.usernameLabel"),
|
|
3830
|
-
/* @__PURE__ */
|
|
2211
|
+
/* @__PURE__ */ jsx24(
|
|
3831
2212
|
"input",
|
|
3832
2213
|
{
|
|
3833
2214
|
className: "ba-input",
|
|
@@ -3841,9 +2222,9 @@ function SignUp({
|
|
|
3841
2222
|
}
|
|
3842
2223
|
)
|
|
3843
2224
|
] }),
|
|
3844
|
-
/* @__PURE__ */
|
|
2225
|
+
/* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
|
|
3845
2226
|
t("common.emailLabel"),
|
|
3846
|
-
/* @__PURE__ */
|
|
2227
|
+
/* @__PURE__ */ jsx24(
|
|
3847
2228
|
"input",
|
|
3848
2229
|
{
|
|
3849
2230
|
className: "ba-input",
|
|
@@ -3858,9 +2239,9 @@ function SignUp({
|
|
|
3858
2239
|
}
|
|
3859
2240
|
)
|
|
3860
2241
|
] }),
|
|
3861
|
-
/* @__PURE__ */
|
|
2242
|
+
/* @__PURE__ */ jsxs22("label", { className: "ba-label", children: [
|
|
3862
2243
|
t("common.passwordLabel"),
|
|
3863
|
-
/* @__PURE__ */
|
|
2244
|
+
/* @__PURE__ */ jsx24(
|
|
3864
2245
|
"input",
|
|
3865
2246
|
{
|
|
3866
2247
|
className: "ba-input",
|
|
@@ -3878,7 +2259,7 @@ function SignUp({
|
|
|
3878
2259
|
)
|
|
3879
2260
|
] }),
|
|
3880
2261
|
authChallenge.control,
|
|
3881
|
-
legal && /* @__PURE__ */
|
|
2262
|
+
legal && /* @__PURE__ */ jsx24(
|
|
3882
2263
|
LegalConsentCheckbox,
|
|
3883
2264
|
{
|
|
3884
2265
|
legal,
|
|
@@ -3887,20 +2268,20 @@ function SignUp({
|
|
|
3887
2268
|
testId: "signup-consent"
|
|
3888
2269
|
}
|
|
3889
2270
|
),
|
|
3890
|
-
/* @__PURE__ */
|
|
3891
|
-
/* @__PURE__ */
|
|
2271
|
+
/* @__PURE__ */ jsx24(FormError, { children: error }),
|
|
2272
|
+
/* @__PURE__ */ jsx24(
|
|
3892
2273
|
"button",
|
|
3893
2274
|
{
|
|
3894
2275
|
className: "ba-button",
|
|
3895
2276
|
type: "submit",
|
|
3896
2277
|
disabled: submitting || consentBlocked || authChallenge.configPending,
|
|
3897
2278
|
"aria-busy": submitting || void 0,
|
|
3898
|
-
children: /* @__PURE__ */
|
|
2279
|
+
children: /* @__PURE__ */ jsx24(Busy, { busy: submitting, label: t("signUp.submitPending"), children: t("signUp.submit") })
|
|
3899
2280
|
}
|
|
3900
2281
|
)
|
|
3901
2282
|
] }),
|
|
3902
|
-
showPasswordless && (showPassword || social.length > 0) && /* @__PURE__ */
|
|
3903
|
-
showPasswordless && /* @__PURE__ */
|
|
2283
|
+
showPasswordless && (showPassword || social.length > 0) && /* @__PURE__ */ jsx24("div", { className: "ba-divider", children: t("common.orDivider") }),
|
|
2284
|
+
showPasswordless && /* @__PURE__ */ jsx24(
|
|
3904
2285
|
PasswordlessSignUp,
|
|
3905
2286
|
{
|
|
3906
2287
|
onAuthenticated: () => {
|
|
@@ -3909,25 +2290,25 @@ function SignUp({
|
|
|
3909
2290
|
}
|
|
3910
2291
|
}
|
|
3911
2292
|
),
|
|
3912
|
-
!renderable && /* @__PURE__ */
|
|
3913
|
-
/* @__PURE__ */
|
|
2293
|
+
!renderable && /* @__PURE__ */ jsx24("p", { className: "ba-muted", children: publicSignupAllowed && methods.length > 0 ? t("signUp.empty.unsupported") : t("signUp.empty.none") }),
|
|
2294
|
+
/* @__PURE__ */ jsx24(AuthOwlBadge, { force: showBadge })
|
|
3914
2295
|
] });
|
|
3915
2296
|
}
|
|
3916
2297
|
|
|
3917
2298
|
// src/components/ConsentGate.tsx
|
|
3918
|
-
import { Fragment as Fragment6, jsx as
|
|
2299
|
+
import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3919
2300
|
function ConsentGate({ children, title }) {
|
|
3920
2301
|
const t = useT();
|
|
3921
2302
|
const { needsConsent, status, accept } = useConsent();
|
|
3922
2303
|
const { pending, error, run } = useSubmitAction();
|
|
3923
|
-
if (!needsConsent) return /* @__PURE__ */
|
|
3924
|
-
return /* @__PURE__ */
|
|
3925
|
-
/* @__PURE__ */
|
|
3926
|
-
/* @__PURE__ */
|
|
3927
|
-
links: /* @__PURE__ */
|
|
2304
|
+
if (!needsConsent) return /* @__PURE__ */ jsx25(Fragment6, { children });
|
|
2305
|
+
return /* @__PURE__ */ jsxs23("div", { className: "ba-form", "data-testid": "consent-gate", children: [
|
|
2306
|
+
/* @__PURE__ */ jsx25("h2", { className: "ba-title", children: title ?? t("consent.gateTitle") }),
|
|
2307
|
+
/* @__PURE__ */ jsx25("p", { className: "ba-muted", children: richMessage(t("consent.gateBody"), {
|
|
2308
|
+
links: /* @__PURE__ */ jsx25(ConsentDocLinks, { termsUrl: status?.termsUrl, privacyUrl: status?.privacyUrl })
|
|
3928
2309
|
}) }),
|
|
3929
|
-
/* @__PURE__ */
|
|
3930
|
-
/* @__PURE__ */
|
|
2310
|
+
/* @__PURE__ */ jsx25(FormError, { children: error }),
|
|
2311
|
+
/* @__PURE__ */ jsx25(
|
|
3931
2312
|
"button",
|
|
3932
2313
|
{
|
|
3933
2314
|
className: "ba-button",
|
|
@@ -3941,28 +2322,28 @@ function ConsentGate({ children, title }) {
|
|
|
3941
2322
|
},
|
|
3942
2323
|
{ failure: t("consent.error.acceptFailed") }
|
|
3943
2324
|
),
|
|
3944
|
-
children: /* @__PURE__ */
|
|
2325
|
+
children: /* @__PURE__ */ jsx25(Busy, { busy: pending, label: t("consent.acceptPending"), children: t("consent.acceptSubmit") })
|
|
3945
2326
|
}
|
|
3946
2327
|
),
|
|
3947
|
-
/* @__PURE__ */
|
|
2328
|
+
/* @__PURE__ */ jsx25(AuthOwlBadge, {})
|
|
3948
2329
|
] });
|
|
3949
2330
|
}
|
|
3950
2331
|
|
|
3951
2332
|
// src/components/MFARequiredGate.tsx
|
|
3952
|
-
import { Fragment as Fragment7, jsx as
|
|
2333
|
+
import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3953
2334
|
function MFARequiredGate({ children, title }) {
|
|
3954
2335
|
const state = useConfirmedMfaPending();
|
|
3955
|
-
if (state === "clear") return /* @__PURE__ */
|
|
2336
|
+
if (state === "clear") return /* @__PURE__ */ jsx26(Fragment7, { children });
|
|
3956
2337
|
if (state === "confirming") return null;
|
|
3957
|
-
return /* @__PURE__ */
|
|
3958
|
-
/* @__PURE__ */
|
|
3959
|
-
/* @__PURE__ */
|
|
2338
|
+
return /* @__PURE__ */ jsxs24("div", { className: "ba-form", "data-testid": "mfa-required-gate", children: [
|
|
2339
|
+
/* @__PURE__ */ jsx26(MfaEnrollmentStep, { title }),
|
|
2340
|
+
/* @__PURE__ */ jsx26(AuthOwlBadge, {})
|
|
3960
2341
|
] });
|
|
3961
2342
|
}
|
|
3962
2343
|
|
|
3963
2344
|
// src/components/BackupCodesManager.tsx
|
|
3964
2345
|
import * as React18 from "react";
|
|
3965
|
-
import { Fragment as Fragment8, jsx as
|
|
2346
|
+
import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3966
2347
|
function BackupCodesManager({ title }) {
|
|
3967
2348
|
const t = useT();
|
|
3968
2349
|
const { user } = useUser();
|
|
@@ -3981,20 +2362,20 @@ function BackupCodesManager({ title }) {
|
|
|
3981
2362
|
}
|
|
3982
2363
|
});
|
|
3983
2364
|
};
|
|
3984
|
-
return /* @__PURE__ */
|
|
3985
|
-
title !== null && /* @__PURE__ */
|
|
3986
|
-
/* @__PURE__ */
|
|
3987
|
-
codes ? /* @__PURE__ */
|
|
3988
|
-
/* @__PURE__ */
|
|
3989
|
-
/* @__PURE__ */
|
|
2365
|
+
return /* @__PURE__ */ jsxs25("div", { className: "ba-form", "data-testid": "backup-codes-manager", children: [
|
|
2366
|
+
title !== null && /* @__PURE__ */ jsx27("h2", { className: "ba-title", children: title ?? t("backupCodes.title") }),
|
|
2367
|
+
/* @__PURE__ */ jsx27("p", { className: "ba-muted", children: t("backupCodes.hint") }),
|
|
2368
|
+
codes ? /* @__PURE__ */ jsxs25(Fragment8, { children: [
|
|
2369
|
+
/* @__PURE__ */ jsxs25("p", { className: "ba-muted", children: [
|
|
2370
|
+
/* @__PURE__ */ jsx27("strong", { children: t("mfa.enroll.backupCodesWarningStrong") }),
|
|
3990
2371
|
" ",
|
|
3991
2372
|
t("mfa.enroll.backupCodesWarningRest")
|
|
3992
2373
|
] }),
|
|
3993
|
-
/* @__PURE__ */
|
|
3994
|
-
] }) : /* @__PURE__ */
|
|
3995
|
-
/* @__PURE__ */
|
|
2374
|
+
/* @__PURE__ */ jsx27("ul", { className: "ba-passkey-list", "data-testid": "backup-codes-list", children: codes.map((c) => /* @__PURE__ */ jsx27("li", { className: "ba-passkey-item", children: /* @__PURE__ */ jsx27("code", { children: /* @__PURE__ */ jsx27("bdi", { children: c }) }) }, c)) })
|
|
2375
|
+
] }) : /* @__PURE__ */ jsxs25("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
2376
|
+
/* @__PURE__ */ jsxs25("label", { className: "ba-label", children: [
|
|
3996
2377
|
t("common.passwordLabel"),
|
|
3997
|
-
/* @__PURE__ */
|
|
2378
|
+
/* @__PURE__ */ jsx27(
|
|
3998
2379
|
"input",
|
|
3999
2380
|
{
|
|
4000
2381
|
className: "ba-input",
|
|
@@ -4006,15 +2387,15 @@ function BackupCodesManager({ title }) {
|
|
|
4006
2387
|
}
|
|
4007
2388
|
)
|
|
4008
2389
|
] }),
|
|
4009
|
-
/* @__PURE__ */
|
|
4010
|
-
/* @__PURE__ */
|
|
2390
|
+
/* @__PURE__ */ jsx27(FormError, { children: error }),
|
|
2391
|
+
/* @__PURE__ */ jsx27("button", { className: "ba-button", type: "submit", disabled: pending || !password, "aria-busy": pending || void 0, children: /* @__PURE__ */ jsx27(Busy, { busy: pending, label: t("backupCodes.pending"), children: t("backupCodes.submit") }) })
|
|
4011
2392
|
] })
|
|
4012
2393
|
] });
|
|
4013
2394
|
}
|
|
4014
2395
|
|
|
4015
2396
|
// src/components/MagicLinkForm.tsx
|
|
4016
2397
|
import * as React19 from "react";
|
|
4017
|
-
import { jsx as
|
|
2398
|
+
import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
4018
2399
|
function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
4019
2400
|
const t = useT();
|
|
4020
2401
|
const { signInMagicLink } = useSignIn();
|
|
@@ -4023,9 +2404,9 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
|
4023
2404
|
const [email, setEmail] = React19.useState("");
|
|
4024
2405
|
const [sent, setSent] = React19.useState(false);
|
|
4025
2406
|
if (sent) {
|
|
4026
|
-
return /* @__PURE__ */
|
|
2407
|
+
return /* @__PURE__ */ jsx28("p", { className: "ba-muted", "data-testid": "magiclink-sent", children: t("magicLink.sent") });
|
|
4027
2408
|
}
|
|
4028
|
-
return /* @__PURE__ */
|
|
2409
|
+
return /* @__PURE__ */ jsxs26(
|
|
4029
2410
|
"form",
|
|
4030
2411
|
{
|
|
4031
2412
|
method: "post",
|
|
@@ -4039,9 +2420,9 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
|
4039
2420
|
className: "ba-fields",
|
|
4040
2421
|
"data-testid": "magiclink-form",
|
|
4041
2422
|
children: [
|
|
4042
|
-
/* @__PURE__ */
|
|
2423
|
+
/* @__PURE__ */ jsxs26("label", { className: "ba-label", children: [
|
|
4043
2424
|
t("common.emailLabel"),
|
|
4044
|
-
/* @__PURE__ */
|
|
2425
|
+
/* @__PURE__ */ jsx28(
|
|
4045
2426
|
"input",
|
|
4046
2427
|
{
|
|
4047
2428
|
className: "ba-input",
|
|
@@ -4054,15 +2435,15 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
|
4054
2435
|
)
|
|
4055
2436
|
] }),
|
|
4056
2437
|
authChallenge.control,
|
|
4057
|
-
/* @__PURE__ */
|
|
4058
|
-
/* @__PURE__ */
|
|
2438
|
+
/* @__PURE__ */ jsx28(FormError, { children: error }),
|
|
2439
|
+
/* @__PURE__ */ jsx28(
|
|
4059
2440
|
"button",
|
|
4060
2441
|
{
|
|
4061
2442
|
className: "ba-button",
|
|
4062
2443
|
type: "submit",
|
|
4063
2444
|
disabled: pending || authChallenge.configPending,
|
|
4064
2445
|
"aria-busy": pending || void 0,
|
|
4065
|
-
children: /* @__PURE__ */
|
|
2446
|
+
children: /* @__PURE__ */ jsx28(Busy, { busy: pending, label: t("common.sending"), children: t("magicLink.submit") })
|
|
4066
2447
|
}
|
|
4067
2448
|
)
|
|
4068
2449
|
]
|
|
@@ -4072,7 +2453,7 @@ function MagicLinkForm({ callbackURL, webauthnAutofill }) {
|
|
|
4072
2453
|
|
|
4073
2454
|
// src/components/EmailOtpForm.tsx
|
|
4074
2455
|
import * as React20 from "react";
|
|
4075
|
-
import { jsx as
|
|
2456
|
+
import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
4076
2457
|
function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
4077
2458
|
const t = useT();
|
|
4078
2459
|
const { sessionStore } = useAuthClient();
|
|
@@ -4083,7 +2464,7 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
4083
2464
|
const [otp, setOtp] = React20.useState("");
|
|
4084
2465
|
const [stage, setStage] = React20.useState("email");
|
|
4085
2466
|
if (stage === "code") {
|
|
4086
|
-
return /* @__PURE__ */
|
|
2467
|
+
return /* @__PURE__ */ jsx29(
|
|
4087
2468
|
OtpCodeForm,
|
|
4088
2469
|
{
|
|
4089
2470
|
email,
|
|
@@ -4106,7 +2487,7 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
4106
2487
|
}
|
|
4107
2488
|
);
|
|
4108
2489
|
}
|
|
4109
|
-
return /* @__PURE__ */
|
|
2490
|
+
return /* @__PURE__ */ jsxs27(
|
|
4110
2491
|
"form",
|
|
4111
2492
|
{
|
|
4112
2493
|
method: "post",
|
|
@@ -4120,9 +2501,9 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
4120
2501
|
className: "ba-fields",
|
|
4121
2502
|
"data-testid": "emailotp-email",
|
|
4122
2503
|
children: [
|
|
4123
|
-
/* @__PURE__ */
|
|
2504
|
+
/* @__PURE__ */ jsxs27("label", { className: "ba-label", children: [
|
|
4124
2505
|
t("common.emailLabel"),
|
|
4125
|
-
/* @__PURE__ */
|
|
2506
|
+
/* @__PURE__ */ jsx29(
|
|
4126
2507
|
"input",
|
|
4127
2508
|
{
|
|
4128
2509
|
className: "ba-input",
|
|
@@ -4138,15 +2519,15 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
4138
2519
|
)
|
|
4139
2520
|
] }),
|
|
4140
2521
|
authChallenge.control,
|
|
4141
|
-
/* @__PURE__ */
|
|
4142
|
-
/* @__PURE__ */
|
|
2522
|
+
/* @__PURE__ */ jsx29(FormError, { children: error }),
|
|
2523
|
+
/* @__PURE__ */ jsx29(
|
|
4143
2524
|
"button",
|
|
4144
2525
|
{
|
|
4145
2526
|
className: "ba-button",
|
|
4146
2527
|
type: "submit",
|
|
4147
2528
|
disabled: pending || authChallenge.configPending,
|
|
4148
2529
|
"aria-busy": pending || void 0,
|
|
4149
|
-
children: /* @__PURE__ */
|
|
2530
|
+
children: /* @__PURE__ */ jsx29(Busy, { busy: pending, label: t("common.sending"), children: t("emailOtp.requestSubmit") })
|
|
4150
2531
|
}
|
|
4151
2532
|
)
|
|
4152
2533
|
]
|
|
@@ -4156,7 +2537,7 @@ function EmailOtpForm({ redirectTo, onSignedIn, webauthnAutofill }) {
|
|
|
4156
2537
|
|
|
4157
2538
|
// src/components/ResetPassword.tsx
|
|
4158
2539
|
import * as React21 from "react";
|
|
4159
|
-
import { jsx as
|
|
2540
|
+
import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
4160
2541
|
function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
4161
2542
|
const t = useT();
|
|
4162
2543
|
const { resetPassword } = usePasswordReset();
|
|
@@ -4176,15 +2557,15 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
4176
2557
|
setReady(true);
|
|
4177
2558
|
}, [tokenProp]);
|
|
4178
2559
|
if (!ready) {
|
|
4179
|
-
return /* @__PURE__ */
|
|
2560
|
+
return /* @__PURE__ */ jsx30("div", { className: "ba-form", "aria-busy": "true", children: /* @__PURE__ */ jsx30("div", { className: "ba-skeleton" }) });
|
|
4180
2561
|
}
|
|
4181
2562
|
if (!token) {
|
|
4182
|
-
return /* @__PURE__ */
|
|
2563
|
+
return /* @__PURE__ */ jsx30(FormError, { "data-testid": "reset-invalid", children: t("resetPassword.invalidLink") });
|
|
4183
2564
|
}
|
|
4184
2565
|
if (done) {
|
|
4185
|
-
return /* @__PURE__ */
|
|
2566
|
+
return /* @__PURE__ */ jsx30("p", { className: "ba-muted", "data-testid": "reset-done", children: t("resetPassword.done") });
|
|
4186
2567
|
}
|
|
4187
|
-
return /* @__PURE__ */
|
|
2568
|
+
return /* @__PURE__ */ jsxs28(
|
|
4188
2569
|
"form",
|
|
4189
2570
|
{
|
|
4190
2571
|
method: "post",
|
|
@@ -4210,9 +2591,9 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
4210
2591
|
});
|
|
4211
2592
|
},
|
|
4212
2593
|
children: [
|
|
4213
|
-
/* @__PURE__ */
|
|
2594
|
+
/* @__PURE__ */ jsxs28("label", { className: "ba-label", children: [
|
|
4214
2595
|
t("resetPassword.newPasswordLabel"),
|
|
4215
|
-
/* @__PURE__ */
|
|
2596
|
+
/* @__PURE__ */ jsx30(
|
|
4216
2597
|
"input",
|
|
4217
2598
|
{
|
|
4218
2599
|
className: "ba-input",
|
|
@@ -4229,9 +2610,9 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
4229
2610
|
}
|
|
4230
2611
|
)
|
|
4231
2612
|
] }),
|
|
4232
|
-
/* @__PURE__ */
|
|
2613
|
+
/* @__PURE__ */ jsxs28("label", { className: "ba-label", children: [
|
|
4233
2614
|
t("resetPassword.confirmPasswordLabel"),
|
|
4234
|
-
/* @__PURE__ */
|
|
2615
|
+
/* @__PURE__ */ jsx30(
|
|
4235
2616
|
"input",
|
|
4236
2617
|
{
|
|
4237
2618
|
className: "ba-input",
|
|
@@ -4248,8 +2629,8 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
4248
2629
|
}
|
|
4249
2630
|
)
|
|
4250
2631
|
] }),
|
|
4251
|
-
/* @__PURE__ */
|
|
4252
|
-
/* @__PURE__ */
|
|
2632
|
+
/* @__PURE__ */ jsx30(FormError, { children: error }),
|
|
2633
|
+
/* @__PURE__ */ jsx30("button", { className: "ba-button", type: "submit", disabled: pending, "aria-busy": pending || void 0, children: /* @__PURE__ */ jsx30(Busy, { busy: pending, label: t("resetPassword.submitPending"), children: t("resetPassword.submit") }) })
|
|
4253
2634
|
]
|
|
4254
2635
|
}
|
|
4255
2636
|
);
|
|
@@ -4257,7 +2638,7 @@ function ResetPassword({ token: tokenProp, redirectTo, onReset }) {
|
|
|
4257
2638
|
|
|
4258
2639
|
// src/components/VerifyEmail.tsx
|
|
4259
2640
|
import * as React22 from "react";
|
|
4260
|
-
import { Fragment as Fragment9, jsx as
|
|
2641
|
+
import { Fragment as Fragment9, jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
4261
2642
|
function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
4262
2643
|
const t = useT();
|
|
4263
2644
|
const { sendVerificationEmail } = useEmailVerification();
|
|
@@ -4277,12 +2658,12 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
4277
2658
|
}
|
|
4278
2659
|
}, [onVerified, redirectTo]);
|
|
4279
2660
|
if (!ready) {
|
|
4280
|
-
return /* @__PURE__ */
|
|
2661
|
+
return /* @__PURE__ */ jsx31("div", { className: "ba-form", "aria-busy": "true", children: /* @__PURE__ */ jsx31("div", { className: "ba-skeleton" }) });
|
|
4281
2662
|
}
|
|
4282
2663
|
if (!failed) {
|
|
4283
|
-
return /* @__PURE__ */
|
|
2664
|
+
return /* @__PURE__ */ jsx31("p", { className: "ba-muted", "data-testid": "verify-success", children: t("verifyEmail.success") });
|
|
4284
2665
|
}
|
|
4285
|
-
return /* @__PURE__ */
|
|
2666
|
+
return /* @__PURE__ */ jsxs29(
|
|
4286
2667
|
"form",
|
|
4287
2668
|
{
|
|
4288
2669
|
method: "post",
|
|
@@ -4297,11 +2678,11 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
4297
2678
|
});
|
|
4298
2679
|
},
|
|
4299
2680
|
children: [
|
|
4300
|
-
/* @__PURE__ */
|
|
4301
|
-
resent ? /* @__PURE__ */
|
|
4302
|
-
/* @__PURE__ */
|
|
2681
|
+
/* @__PURE__ */ jsx31(FormError, { children: t("verifyEmail.invalidLink") }),
|
|
2682
|
+
resent ? /* @__PURE__ */ jsx31("p", { className: "ba-muted", children: richMessage(t("verifyEmail.resent"), { email: /* @__PURE__ */ jsx31(Bidi, { children: email }) }) }) : /* @__PURE__ */ jsxs29(Fragment9, { children: [
|
|
2683
|
+
/* @__PURE__ */ jsxs29("label", { className: "ba-label", children: [
|
|
4303
2684
|
t("common.emailLabel"),
|
|
4304
|
-
/* @__PURE__ */
|
|
2685
|
+
/* @__PURE__ */ jsx31(
|
|
4305
2686
|
"input",
|
|
4306
2687
|
{
|
|
4307
2688
|
className: "ba-input",
|
|
@@ -4314,15 +2695,15 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
4314
2695
|
)
|
|
4315
2696
|
] }),
|
|
4316
2697
|
authChallenge.control,
|
|
4317
|
-
/* @__PURE__ */
|
|
4318
|
-
/* @__PURE__ */
|
|
2698
|
+
/* @__PURE__ */ jsx31(FormError, { children: error }),
|
|
2699
|
+
/* @__PURE__ */ jsx31(
|
|
4319
2700
|
"button",
|
|
4320
2701
|
{
|
|
4321
2702
|
className: "ba-button",
|
|
4322
2703
|
type: "submit",
|
|
4323
2704
|
disabled: pending || authChallenge.configPending,
|
|
4324
2705
|
"aria-busy": pending || void 0,
|
|
4325
|
-
children: /* @__PURE__ */
|
|
2706
|
+
children: /* @__PURE__ */ jsx31(Busy, { busy: pending, label: t("common.sending"), children: t("verifyEmail.resendSubmit") })
|
|
4326
2707
|
}
|
|
4327
2708
|
)
|
|
4328
2709
|
] })
|
|
@@ -4333,17 +2714,17 @@ function VerifyEmail({ redirectTo, onVerified, callbackURL }) {
|
|
|
4333
2714
|
|
|
4334
2715
|
// src/components/PasskeyManager.tsx
|
|
4335
2716
|
import * as React23 from "react";
|
|
4336
|
-
import { jsx as
|
|
2717
|
+
import { jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
4337
2718
|
function PasskeyManager({ title, allowAdd = true } = {}) {
|
|
4338
2719
|
const t = useT();
|
|
4339
2720
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
4340
2721
|
if (!isLoaded) {
|
|
4341
|
-
return /* @__PURE__ */
|
|
2722
|
+
return /* @__PURE__ */ jsx32("div", { className: "ba-form", "data-testid": "passkey-manager-loading", "aria-busy": "true", children: /* @__PURE__ */ jsx32("div", { className: "ba-skeleton" }) });
|
|
4342
2723
|
}
|
|
4343
2724
|
if (!isSignedIn || !user) {
|
|
4344
|
-
return /* @__PURE__ */
|
|
2725
|
+
return /* @__PURE__ */ jsx32("p", { className: "ba-muted", children: t("passkeys.signedOut") });
|
|
4345
2726
|
}
|
|
4346
|
-
return /* @__PURE__ */
|
|
2727
|
+
return /* @__PURE__ */ jsx32(PasskeyManagerBody, { title, allowAdd }, user.id);
|
|
4347
2728
|
}
|
|
4348
2729
|
function PasskeyManagerBody({
|
|
4349
2730
|
title,
|
|
@@ -4392,13 +2773,13 @@ function PasskeyManagerBody({
|
|
|
4392
2773
|
onSuccess: load
|
|
4393
2774
|
});
|
|
4394
2775
|
}
|
|
4395
|
-
return /* @__PURE__ */
|
|
4396
|
-
title !== null && /* @__PURE__ */
|
|
4397
|
-
passkeys === null ? error ? null : /* @__PURE__ */
|
|
4398
|
-
(passkeys ?? []).map((pk) => /* @__PURE__ */
|
|
4399
|
-
/* @__PURE__ */
|
|
4400
|
-
/* @__PURE__ */
|
|
4401
|
-
/* @__PURE__ */
|
|
2776
|
+
return /* @__PURE__ */ jsxs30("div", { className: "ba-form", "data-testid": "passkey-manager", children: [
|
|
2777
|
+
title !== null && /* @__PURE__ */ jsx32("h2", { className: "ba-title", children: title ?? t("passkeys.title") }),
|
|
2778
|
+
passkeys === null ? error ? null : /* @__PURE__ */ jsx32("div", { className: "ba-skeleton" }) : /* @__PURE__ */ jsxs30("ul", { className: "ba-passkey-list", children: [
|
|
2779
|
+
(passkeys ?? []).map((pk) => /* @__PURE__ */ jsxs30("li", { className: "ba-passkey-item", children: [
|
|
2780
|
+
/* @__PURE__ */ jsx32("span", { className: "ba-passkey-name", children: pk.name?.trim() || t("passkeys.unnamed") }),
|
|
2781
|
+
/* @__PURE__ */ jsxs30("span", { className: "ba-passkey-actions", children: [
|
|
2782
|
+
/* @__PURE__ */ jsx32(
|
|
4402
2783
|
"button",
|
|
4403
2784
|
{
|
|
4404
2785
|
type: "button",
|
|
@@ -4408,7 +2789,7 @@ function PasskeyManagerBody({
|
|
|
4408
2789
|
children: t("passkeys.rename")
|
|
4409
2790
|
}
|
|
4410
2791
|
),
|
|
4411
|
-
/* @__PURE__ */
|
|
2792
|
+
/* @__PURE__ */ jsx32(
|
|
4412
2793
|
"button",
|
|
4413
2794
|
{
|
|
4414
2795
|
type: "button",
|
|
@@ -4420,13 +2801,13 @@ function PasskeyManagerBody({
|
|
|
4420
2801
|
)
|
|
4421
2802
|
] })
|
|
4422
2803
|
] }, pk.id)),
|
|
4423
|
-
passkeys !== null && passkeys.length === 0 && /* @__PURE__ */
|
|
2804
|
+
passkeys !== null && passkeys.length === 0 && /* @__PURE__ */ jsx32("li", { className: "ba-muted", children: t("passkeys.empty") })
|
|
4424
2805
|
] }),
|
|
4425
|
-
error && /* @__PURE__ */
|
|
4426
|
-
/* @__PURE__ */
|
|
4427
|
-
passkeys === null && /* @__PURE__ */
|
|
2806
|
+
error && /* @__PURE__ */ jsxs30("div", { className: "ba-inline-error", children: [
|
|
2807
|
+
/* @__PURE__ */ jsx32(FormError, { children: error }),
|
|
2808
|
+
passkeys === null && /* @__PURE__ */ jsx32("button", { className: "ba-link-button", type: "button", onClick: () => void load(), children: t("userProfile.retry") })
|
|
4428
2809
|
] }),
|
|
4429
|
-
passkeys !== null && allowAdd && /* @__PURE__ */
|
|
2810
|
+
passkeys !== null && allowAdd && /* @__PURE__ */ jsx32(
|
|
4430
2811
|
"button",
|
|
4431
2812
|
{
|
|
4432
2813
|
className: "ba-button",
|
|
@@ -4437,7 +2818,7 @@ function PasskeyManagerBody({
|
|
|
4437
2818
|
failure: t("passkeys.error.addFailed"),
|
|
4438
2819
|
onSuccess: load
|
|
4439
2820
|
}),
|
|
4440
|
-
children: /* @__PURE__ */
|
|
2821
|
+
children: /* @__PURE__ */ jsx32(Busy, { busy: pending, label: t("common.working"), children: t("passkeys.add") })
|
|
4441
2822
|
}
|
|
4442
2823
|
)
|
|
4443
2824
|
] });
|
|
@@ -4445,14 +2826,14 @@ function PasskeyManagerBody({
|
|
|
4445
2826
|
|
|
4446
2827
|
// src/components/control.tsx
|
|
4447
2828
|
import { membershipHas } from "@authowl/core";
|
|
4448
|
-
import { Fragment as Fragment10, jsx as
|
|
2829
|
+
import { Fragment as Fragment10, jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
4449
2830
|
function SignedIn({ children }) {
|
|
4450
2831
|
const { isLoaded, isSignedIn } = useUser();
|
|
4451
|
-
return isLoaded && isSignedIn ? /* @__PURE__ */
|
|
2832
|
+
return isLoaded && isSignedIn ? /* @__PURE__ */ jsx33(Fragment10, { children }) : null;
|
|
4452
2833
|
}
|
|
4453
2834
|
function SignedOut({ children }) {
|
|
4454
2835
|
const { isLoaded, isSignedIn } = useUser();
|
|
4455
|
-
return isLoaded && !isSignedIn ? /* @__PURE__ */
|
|
2836
|
+
return isLoaded && !isSignedIn ? /* @__PURE__ */ jsx33(Fragment10, { children }) : null;
|
|
4456
2837
|
}
|
|
4457
2838
|
function Protect({
|
|
4458
2839
|
children,
|
|
@@ -4465,36 +2846,36 @@ function Protect({
|
|
|
4465
2846
|
const { user, isLoaded, isSignedIn } = useUser();
|
|
4466
2847
|
const membership = useSession().data?.session?.membership ?? null;
|
|
4467
2848
|
if (!isLoaded) return null;
|
|
4468
|
-
if (!isSignedIn || !user) return /* @__PURE__ */
|
|
2849
|
+
if (!isSignedIn || !user) return /* @__PURE__ */ jsx33(Fragment10, { children: fallback });
|
|
4469
2850
|
if ((role !== void 0 || permission !== void 0 || teamId !== void 0) && !membershipHas(membership, { role, permission, teamId })) {
|
|
4470
|
-
return /* @__PURE__ */
|
|
2851
|
+
return /* @__PURE__ */ jsx33(Fragment10, { children: fallback });
|
|
4471
2852
|
}
|
|
4472
|
-
if (condition && !condition(user)) return /* @__PURE__ */
|
|
4473
|
-
return /* @__PURE__ */
|
|
2853
|
+
if (condition && !condition(user)) return /* @__PURE__ */ jsx33(Fragment10, { children: fallback });
|
|
2854
|
+
return /* @__PURE__ */ jsx33(Fragment10, { children });
|
|
4474
2855
|
}
|
|
4475
2856
|
function AuthLoading({ children }) {
|
|
4476
2857
|
const t = useT();
|
|
4477
2858
|
const { isLoaded } = useUser();
|
|
4478
2859
|
if (isLoaded) return null;
|
|
4479
|
-
if (children !== void 0) return /* @__PURE__ */
|
|
4480
|
-
return /* @__PURE__ */
|
|
4481
|
-
/* @__PURE__ */
|
|
4482
|
-
/* @__PURE__ */
|
|
2860
|
+
if (children !== void 0) return /* @__PURE__ */ jsx33(Fragment10, { children });
|
|
2861
|
+
return /* @__PURE__ */ jsxs31("div", { className: "ba-auth-loading", role: "status", "aria-busy": "true", "data-testid": "auth-loading", children: [
|
|
2862
|
+
/* @__PURE__ */ jsx33(Spinner, {}),
|
|
2863
|
+
/* @__PURE__ */ jsx33("span", { className: "ba-sr-only", children: t("common.loading") })
|
|
4483
2864
|
] });
|
|
4484
2865
|
}
|
|
4485
2866
|
function AuthLoaded({ children }) {
|
|
4486
|
-
return useUser().isLoaded ? /* @__PURE__ */
|
|
2867
|
+
return useUser().isLoaded ? /* @__PURE__ */ jsx33(Fragment10, { children }) : null;
|
|
4487
2868
|
}
|
|
4488
2869
|
|
|
4489
2870
|
// src/components/SignOutButton.tsx
|
|
4490
2871
|
import * as React24 from "react";
|
|
4491
|
-
import { jsx as
|
|
2872
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
4492
2873
|
function SignOutButton({ children, redirectTo, onSignedOut, className }) {
|
|
4493
2874
|
const t = useT();
|
|
4494
2875
|
const { signOut } = useSignOut();
|
|
4495
2876
|
const [pending, setPending] = React24.useState(false);
|
|
4496
2877
|
const content = children ?? t("signOut.button");
|
|
4497
|
-
return /* @__PURE__ */
|
|
2878
|
+
return /* @__PURE__ */ jsx34(
|
|
4498
2879
|
"button",
|
|
4499
2880
|
{
|
|
4500
2881
|
type: "button",
|
|
@@ -4512,7 +2893,7 @@ function SignOutButton({ children, redirectTo, onSignedOut, className }) {
|
|
|
4512
2893
|
setPending(false);
|
|
4513
2894
|
}
|
|
4514
2895
|
},
|
|
4515
|
-
children: /* @__PURE__ */
|
|
2896
|
+
children: /* @__PURE__ */ jsx34(Busy, { busy: pending, label: content, children: content })
|
|
4516
2897
|
}
|
|
4517
2898
|
);
|
|
4518
2899
|
}
|
|
@@ -4525,7 +2906,7 @@ import * as React36 from "react";
|
|
|
4525
2906
|
|
|
4526
2907
|
// src/components/user-profile/EmailSection.tsx
|
|
4527
2908
|
import * as React25 from "react";
|
|
4528
|
-
import { jsx as
|
|
2909
|
+
import { jsx as jsx35, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
4529
2910
|
function EmailSection({ allowChange }) {
|
|
4530
2911
|
const t = useT();
|
|
4531
2912
|
const account = useAccount();
|
|
@@ -4535,9 +2916,9 @@ function EmailSection({ allowChange }) {
|
|
|
4535
2916
|
const [sent, setSent] = React25.useState(false);
|
|
4536
2917
|
const titleId = React25.useId();
|
|
4537
2918
|
if (!user?.email) {
|
|
4538
|
-
return /* @__PURE__ */
|
|
4539
|
-
/* @__PURE__ */
|
|
4540
|
-
/* @__PURE__ */
|
|
2919
|
+
return /* @__PURE__ */ jsxs32("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
2920
|
+
/* @__PURE__ */ jsx35("h2", { id: titleId, className: "ba-title", children: t("userProfile.email.title") }),
|
|
2921
|
+
/* @__PURE__ */ jsx35("p", { className: "ba-muted", children: t("userProfile.email.unavailable") })
|
|
4541
2922
|
] });
|
|
4542
2923
|
}
|
|
4543
2924
|
const submit = (event) => {
|
|
@@ -4557,19 +2938,19 @@ function EmailSection({ allowChange }) {
|
|
|
4557
2938
|
}
|
|
4558
2939
|
);
|
|
4559
2940
|
};
|
|
4560
|
-
return /* @__PURE__ */
|
|
4561
|
-
/* @__PURE__ */
|
|
4562
|
-
/* @__PURE__ */
|
|
4563
|
-
/* @__PURE__ */
|
|
2941
|
+
return /* @__PURE__ */ jsxs32("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
2942
|
+
/* @__PURE__ */ jsxs32("header", { className: "ba-profile-section-header", children: [
|
|
2943
|
+
/* @__PURE__ */ jsx35("h2", { id: titleId, className: "ba-title", children: t("userProfile.email.title") }),
|
|
2944
|
+
/* @__PURE__ */ jsx35("p", { className: "ba-muted", children: t("userProfile.email.description") })
|
|
4564
2945
|
] }),
|
|
4565
|
-
/* @__PURE__ */
|
|
4566
|
-
/* @__PURE__ */
|
|
4567
|
-
/* @__PURE__ */
|
|
2946
|
+
/* @__PURE__ */ jsxs32("p", { className: "ba-profile-current", children: [
|
|
2947
|
+
/* @__PURE__ */ jsx35("span", { children: t("userProfile.email.current") }),
|
|
2948
|
+
/* @__PURE__ */ jsx35("strong", { children: /* @__PURE__ */ jsx35(Bidi, { children: user.email }) })
|
|
4568
2949
|
] }),
|
|
4569
|
-
!allowChange ? /* @__PURE__ */
|
|
4570
|
-
/* @__PURE__ */
|
|
2950
|
+
!allowChange ? /* @__PURE__ */ jsx35("p", { className: "ba-muted", "data-testid": "email-change-disabled", children: t("userProfile.email.changeDisabled") }) : /* @__PURE__ */ jsxs32("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
2951
|
+
/* @__PURE__ */ jsxs32("label", { className: "ba-label", children: [
|
|
4571
2952
|
t("userProfile.email.newLabel"),
|
|
4572
|
-
/* @__PURE__ */
|
|
2953
|
+
/* @__PURE__ */ jsx35(
|
|
4573
2954
|
"input",
|
|
4574
2955
|
{
|
|
4575
2956
|
className: "ba-input",
|
|
@@ -4581,16 +2962,16 @@ function EmailSection({ allowChange }) {
|
|
|
4581
2962
|
}
|
|
4582
2963
|
)
|
|
4583
2964
|
] }),
|
|
4584
|
-
/* @__PURE__ */
|
|
4585
|
-
sent && /* @__PURE__ */
|
|
4586
|
-
/* @__PURE__ */
|
|
2965
|
+
/* @__PURE__ */ jsx35(FormError, { children: error }),
|
|
2966
|
+
sent && /* @__PURE__ */ jsx35("p", { className: "ba-success", role: "status", children: t("userProfile.email.sent") }),
|
|
2967
|
+
/* @__PURE__ */ jsx35(
|
|
4587
2968
|
"button",
|
|
4588
2969
|
{
|
|
4589
2970
|
className: "ba-button ba-profile-submit",
|
|
4590
2971
|
type: "submit",
|
|
4591
2972
|
disabled: pending || !newEmail.trim(),
|
|
4592
2973
|
"aria-busy": pending || void 0,
|
|
4593
|
-
children: /* @__PURE__ */
|
|
2974
|
+
children: /* @__PURE__ */ jsx35(Busy, { busy: pending, label: t("common.sending"), children: t("userProfile.email.submit") })
|
|
4594
2975
|
}
|
|
4595
2976
|
)
|
|
4596
2977
|
] })
|
|
@@ -4599,7 +2980,7 @@ function EmailSection({ allowChange }) {
|
|
|
4599
2980
|
|
|
4600
2981
|
// src/components/user-profile/DeleteAccountSection.tsx
|
|
4601
2982
|
import * as React26 from "react";
|
|
4602
|
-
import { jsx as
|
|
2983
|
+
import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
4603
2984
|
function DeleteAccountSection({ onDeleted }) {
|
|
4604
2985
|
const t = useT();
|
|
4605
2986
|
const account = useAccount();
|
|
@@ -4624,18 +3005,18 @@ function DeleteAccountSection({ onDeleted }) {
|
|
|
4624
3005
|
}
|
|
4625
3006
|
);
|
|
4626
3007
|
};
|
|
4627
|
-
return /* @__PURE__ */
|
|
4628
|
-
/* @__PURE__ */
|
|
4629
|
-
/* @__PURE__ */
|
|
4630
|
-
/* @__PURE__ */
|
|
3008
|
+
return /* @__PURE__ */ jsxs33("section", { className: "ba-profile-section ba-profile-danger-zone", "aria-labelledby": titleId, children: [
|
|
3009
|
+
/* @__PURE__ */ jsxs33("header", { className: "ba-profile-section-header", children: [
|
|
3010
|
+
/* @__PURE__ */ jsx36("h2", { id: titleId, className: "ba-title", children: t("userProfile.delete.title") }),
|
|
3011
|
+
/* @__PURE__ */ jsx36("p", { className: "ba-muted", children: t("userProfile.delete.description") })
|
|
4631
3012
|
] }),
|
|
4632
|
-
/* @__PURE__ */
|
|
4633
|
-
/* @__PURE__ */
|
|
4634
|
-
/* @__PURE__ */
|
|
3013
|
+
/* @__PURE__ */ jsxs33("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
3014
|
+
/* @__PURE__ */ jsx36("p", { className: "ba-profile-delete-warning", children: t("userProfile.delete.warning", { identifier }) }),
|
|
3015
|
+
/* @__PURE__ */ jsxs33("label", { className: "ba-label", children: [
|
|
4635
3016
|
t("userProfile.delete.confirmLabel"),
|
|
4636
3017
|
" ",
|
|
4637
|
-
/* @__PURE__ */
|
|
4638
|
-
/* @__PURE__ */
|
|
3018
|
+
/* @__PURE__ */ jsx36(Bidi, { children: identifier }),
|
|
3019
|
+
/* @__PURE__ */ jsx36(
|
|
4639
3020
|
"input",
|
|
4640
3021
|
{
|
|
4641
3022
|
className: "ba-input",
|
|
@@ -4649,15 +3030,15 @@ function DeleteAccountSection({ onDeleted }) {
|
|
|
4649
3030
|
}
|
|
4650
3031
|
)
|
|
4651
3032
|
] }),
|
|
4652
|
-
/* @__PURE__ */
|
|
4653
|
-
/* @__PURE__ */
|
|
3033
|
+
/* @__PURE__ */ jsx36(FormError, { children: error }),
|
|
3034
|
+
/* @__PURE__ */ jsx36(
|
|
4654
3035
|
"button",
|
|
4655
3036
|
{
|
|
4656
3037
|
className: "ba-button ba-danger-button ba-profile-submit",
|
|
4657
3038
|
type: "submit",
|
|
4658
3039
|
disabled: pending || !confirmed,
|
|
4659
3040
|
"aria-busy": pending || void 0,
|
|
4660
|
-
children: /* @__PURE__ */
|
|
3041
|
+
children: /* @__PURE__ */ jsx36(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.delete.submit") })
|
|
4661
3042
|
}
|
|
4662
3043
|
)
|
|
4663
3044
|
] })
|
|
@@ -4666,7 +3047,7 @@ function DeleteAccountSection({ onDeleted }) {
|
|
|
4666
3047
|
|
|
4667
3048
|
// src/components/user-profile/MfaSection.tsx
|
|
4668
3049
|
import * as React27 from "react";
|
|
4669
|
-
import { jsx as
|
|
3050
|
+
import { jsx as jsx37, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
4670
3051
|
function MfaSection() {
|
|
4671
3052
|
const t = useT();
|
|
4672
3053
|
const { user } = useUser();
|
|
@@ -4679,12 +3060,12 @@ function MfaSection() {
|
|
|
4679
3060
|
const titleId = React27.useId();
|
|
4680
3061
|
const required = resolveProjectCapabilities(config).mfaRequired;
|
|
4681
3062
|
if (!user?.twoFactorEnabled) {
|
|
4682
|
-
return /* @__PURE__ */
|
|
4683
|
-
/* @__PURE__ */
|
|
4684
|
-
/* @__PURE__ */
|
|
4685
|
-
/* @__PURE__ */
|
|
3063
|
+
return /* @__PURE__ */ jsxs34("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3064
|
+
/* @__PURE__ */ jsxs34("header", { className: "ba-profile-section-header", children: [
|
|
3065
|
+
/* @__PURE__ */ jsx37("h2", { id: titleId, className: "ba-title", children: t("userProfile.mfa.title") }),
|
|
3066
|
+
/* @__PURE__ */ jsx37("p", { className: "ba-muted", children: required ? t("userProfile.mfa.requiredDescription") : t("userProfile.mfa.description") })
|
|
4686
3067
|
] }),
|
|
4687
|
-
/* @__PURE__ */
|
|
3068
|
+
/* @__PURE__ */ jsx37(
|
|
4688
3069
|
MFAEnrollment,
|
|
4689
3070
|
{
|
|
4690
3071
|
title: null,
|
|
@@ -4707,16 +3088,16 @@ function MfaSection() {
|
|
|
4707
3088
|
}
|
|
4708
3089
|
);
|
|
4709
3090
|
};
|
|
4710
|
-
return /* @__PURE__ */
|
|
4711
|
-
/* @__PURE__ */
|
|
4712
|
-
/* @__PURE__ */
|
|
4713
|
-
/* @__PURE__ */
|
|
3091
|
+
return /* @__PURE__ */ jsxs34("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3092
|
+
/* @__PURE__ */ jsxs34("header", { className: "ba-profile-section-header", children: [
|
|
3093
|
+
/* @__PURE__ */ jsx37("h2", { id: titleId, className: "ba-title", children: t("userProfile.mfa.title") }),
|
|
3094
|
+
/* @__PURE__ */ jsx37("p", { className: "ba-muted", children: required ? t("userProfile.mfa.requiredActive") : t("userProfile.mfa.active") })
|
|
4714
3095
|
] }),
|
|
4715
|
-
/* @__PURE__ */
|
|
4716
|
-
/* @__PURE__ */
|
|
4717
|
-
/* @__PURE__ */
|
|
3096
|
+
/* @__PURE__ */ jsxs34("div", { className: "ba-profile-status", role: "status", children: [
|
|
3097
|
+
/* @__PURE__ */ jsx37("strong", { children: t("userProfile.mfa.enabled") }),
|
|
3098
|
+
/* @__PURE__ */ jsx37("span", { children: t("userProfile.mfa.authenticator") })
|
|
4718
3099
|
] }),
|
|
4719
|
-
!showDisable ? /* @__PURE__ */
|
|
3100
|
+
!showDisable ? /* @__PURE__ */ jsx37(
|
|
4720
3101
|
"button",
|
|
4721
3102
|
{
|
|
4722
3103
|
className: "ba-button ba-button-secondary ba-profile-submit",
|
|
@@ -4724,11 +3105,11 @@ function MfaSection() {
|
|
|
4724
3105
|
onClick: () => setShowDisable(true),
|
|
4725
3106
|
children: required ? t("userProfile.mfa.replace") : t("userProfile.mfa.disable")
|
|
4726
3107
|
}
|
|
4727
|
-
) : /* @__PURE__ */
|
|
4728
|
-
/* @__PURE__ */
|
|
4729
|
-
/* @__PURE__ */
|
|
3108
|
+
) : /* @__PURE__ */ jsxs34("form", { method: "post", className: "ba-fields ba-profile-security-form", onSubmit: submitDisable, children: [
|
|
3109
|
+
/* @__PURE__ */ jsx37("p", { className: "ba-muted", children: required ? t("userProfile.mfa.replaceWarning") : t("userProfile.mfa.disableWarning") }),
|
|
3110
|
+
/* @__PURE__ */ jsxs34("label", { className: "ba-label", children: [
|
|
4730
3111
|
t("common.passwordLabel"),
|
|
4731
|
-
/* @__PURE__ */
|
|
3112
|
+
/* @__PURE__ */ jsx37(
|
|
4732
3113
|
"input",
|
|
4733
3114
|
{
|
|
4734
3115
|
className: "ba-input",
|
|
@@ -4740,19 +3121,19 @@ function MfaSection() {
|
|
|
4740
3121
|
}
|
|
4741
3122
|
)
|
|
4742
3123
|
] }),
|
|
4743
|
-
/* @__PURE__ */
|
|
4744
|
-
/* @__PURE__ */
|
|
4745
|
-
/* @__PURE__ */
|
|
3124
|
+
/* @__PURE__ */ jsx37(FormError, { children: error }),
|
|
3125
|
+
/* @__PURE__ */ jsxs34("span", { className: "ba-profile-action-row", children: [
|
|
3126
|
+
/* @__PURE__ */ jsx37(
|
|
4746
3127
|
"button",
|
|
4747
3128
|
{
|
|
4748
3129
|
className: "ba-button ba-danger-button",
|
|
4749
3130
|
type: "submit",
|
|
4750
3131
|
disabled: pending || !password,
|
|
4751
3132
|
"aria-busy": pending || void 0,
|
|
4752
|
-
children: /* @__PURE__ */
|
|
3133
|
+
children: /* @__PURE__ */ jsx37(Busy, { busy: pending, label: t("common.working"), children: required ? t("userProfile.mfa.replaceConfirm") : t("userProfile.mfa.disableConfirm") })
|
|
4753
3134
|
}
|
|
4754
3135
|
),
|
|
4755
|
-
/* @__PURE__ */
|
|
3136
|
+
/* @__PURE__ */ jsx37(
|
|
4756
3137
|
"button",
|
|
4757
3138
|
{
|
|
4758
3139
|
className: "ba-button ba-button-secondary",
|
|
@@ -4772,7 +3153,7 @@ function MfaSection() {
|
|
|
4772
3153
|
|
|
4773
3154
|
// src/components/user-profile/PasswordSection.tsx
|
|
4774
3155
|
import * as React28 from "react";
|
|
4775
|
-
import { jsx as
|
|
3156
|
+
import { jsx as jsx38, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
4776
3157
|
function PasswordSection() {
|
|
4777
3158
|
const t = useT();
|
|
4778
3159
|
const account = useAccount();
|
|
@@ -4808,43 +3189,43 @@ function PasswordSection() {
|
|
|
4808
3189
|
}
|
|
4809
3190
|
);
|
|
4810
3191
|
};
|
|
4811
|
-
return /* @__PURE__ */
|
|
4812
|
-
/* @__PURE__ */
|
|
4813
|
-
/* @__PURE__ */
|
|
4814
|
-
/* @__PURE__ */
|
|
3192
|
+
return /* @__PURE__ */ jsxs35("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3193
|
+
/* @__PURE__ */ jsxs35("header", { className: "ba-profile-section-header", children: [
|
|
3194
|
+
/* @__PURE__ */ jsx38("h2", { id: titleId, className: "ba-title", children: t("userProfile.password.title") }),
|
|
3195
|
+
/* @__PURE__ */ jsx38("p", { className: "ba-muted", children: t("userProfile.password.description") })
|
|
4815
3196
|
] }),
|
|
4816
|
-
/* @__PURE__ */
|
|
4817
|
-
/* @__PURE__ */
|
|
3197
|
+
/* @__PURE__ */ jsxs35("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
3198
|
+
/* @__PURE__ */ jsxs35("label", { className: "ba-label", children: [
|
|
4818
3199
|
t("userProfile.password.currentLabel"),
|
|
4819
|
-
/* @__PURE__ */
|
|
3200
|
+
/* @__PURE__ */ jsx38("input", { className: "ba-input", type: "password", autoComplete: "current-password", value: currentPassword, onChange: (event) => {
|
|
4820
3201
|
setCurrentPassword(event.target.value);
|
|
4821
3202
|
setError(null);
|
|
4822
3203
|
}, required: true })
|
|
4823
3204
|
] }),
|
|
4824
|
-
/* @__PURE__ */
|
|
3205
|
+
/* @__PURE__ */ jsxs35("label", { className: "ba-label", children: [
|
|
4825
3206
|
t("resetPassword.newPasswordLabel"),
|
|
4826
|
-
/* @__PURE__ */
|
|
3207
|
+
/* @__PURE__ */ jsx38("input", { className: "ba-input", type: "password", autoComplete: "new-password", value: newPassword, onChange: (event) => {
|
|
4827
3208
|
setNewPassword(event.target.value);
|
|
4828
3209
|
setError(null);
|
|
4829
3210
|
}, minLength: passwordMinLength, maxLength: passwordMaxLength, required: true })
|
|
4830
3211
|
] }),
|
|
4831
|
-
/* @__PURE__ */
|
|
3212
|
+
/* @__PURE__ */ jsxs35("label", { className: "ba-label", children: [
|
|
4832
3213
|
t("resetPassword.confirmPasswordLabel"),
|
|
4833
|
-
/* @__PURE__ */
|
|
3214
|
+
/* @__PURE__ */ jsx38("input", { className: "ba-input", type: "password", autoComplete: "new-password", value: confirmPassword, onChange: (event) => {
|
|
4834
3215
|
setConfirmPassword(event.target.value);
|
|
4835
3216
|
setError(null);
|
|
4836
3217
|
}, minLength: passwordMinLength, maxLength: passwordMaxLength, required: true })
|
|
4837
3218
|
] }),
|
|
4838
|
-
/* @__PURE__ */
|
|
4839
|
-
saved && /* @__PURE__ */
|
|
4840
|
-
/* @__PURE__ */
|
|
3219
|
+
/* @__PURE__ */ jsx38(FormError, { children: error }),
|
|
3220
|
+
saved && /* @__PURE__ */ jsx38("p", { className: "ba-success", role: "status", children: t("userProfile.password.saved") }),
|
|
3221
|
+
/* @__PURE__ */ jsx38(
|
|
4841
3222
|
"button",
|
|
4842
3223
|
{
|
|
4843
3224
|
className: "ba-button ba-profile-submit",
|
|
4844
3225
|
type: "submit",
|
|
4845
3226
|
disabled: pending || !currentPassword || !newPassword || !confirmPassword,
|
|
4846
3227
|
"aria-busy": pending || void 0,
|
|
4847
|
-
children: /* @__PURE__ */
|
|
3228
|
+
children: /* @__PURE__ */ jsx38(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.password.submit") })
|
|
4848
3229
|
}
|
|
4849
3230
|
)
|
|
4850
3231
|
] })
|
|
@@ -4853,22 +3234,22 @@ function PasswordSection() {
|
|
|
4853
3234
|
|
|
4854
3235
|
// src/components/user-profile/PasskeysSection.tsx
|
|
4855
3236
|
import * as React29 from "react";
|
|
4856
|
-
import { jsx as
|
|
3237
|
+
import { jsx as jsx39, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4857
3238
|
function PasskeysSection({ allowAdd }) {
|
|
4858
3239
|
const t = useT();
|
|
4859
3240
|
const titleId = React29.useId();
|
|
4860
|
-
return /* @__PURE__ */
|
|
4861
|
-
/* @__PURE__ */
|
|
4862
|
-
/* @__PURE__ */
|
|
4863
|
-
/* @__PURE__ */
|
|
3241
|
+
return /* @__PURE__ */ jsxs36("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3242
|
+
/* @__PURE__ */ jsxs36("header", { className: "ba-profile-section-header", children: [
|
|
3243
|
+
/* @__PURE__ */ jsx39("h2", { id: titleId, className: "ba-title", children: t("userProfile.passkeys.title") }),
|
|
3244
|
+
/* @__PURE__ */ jsx39("p", { className: "ba-muted", children: t("userProfile.passkeys.description") })
|
|
4864
3245
|
] }),
|
|
4865
|
-
/* @__PURE__ */
|
|
3246
|
+
/* @__PURE__ */ jsx39(PasskeyManager, { title: null, allowAdd })
|
|
4866
3247
|
] });
|
|
4867
3248
|
}
|
|
4868
3249
|
|
|
4869
3250
|
// src/components/user-profile/ProfileSection.tsx
|
|
4870
3251
|
import * as React30 from "react";
|
|
4871
|
-
import { Fragment as Fragment11, jsx as
|
|
3252
|
+
import { Fragment as Fragment11, jsx as jsx40, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
4872
3253
|
function ProfileSection({
|
|
4873
3254
|
firstLastName,
|
|
4874
3255
|
usernameEnabled,
|
|
@@ -4910,15 +3291,15 @@ function ProfileSection({
|
|
|
4910
3291
|
}
|
|
4911
3292
|
);
|
|
4912
3293
|
};
|
|
4913
|
-
return /* @__PURE__ */
|
|
4914
|
-
/* @__PURE__ */
|
|
4915
|
-
/* @__PURE__ */
|
|
4916
|
-
/* @__PURE__ */
|
|
3294
|
+
return /* @__PURE__ */ jsxs37("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3295
|
+
/* @__PURE__ */ jsxs37("header", { className: "ba-profile-section-header", children: [
|
|
3296
|
+
/* @__PURE__ */ jsx40("h2", { id: titleId, className: "ba-title", children: t("userProfile.profile.title") }),
|
|
3297
|
+
/* @__PURE__ */ jsx40("p", { className: "ba-muted", children: t("userProfile.profile.description") })
|
|
4917
3298
|
] }),
|
|
4918
|
-
/* @__PURE__ */
|
|
4919
|
-
legacyNameField && /* @__PURE__ */
|
|
3299
|
+
/* @__PURE__ */ jsxs37("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
3300
|
+
legacyNameField && /* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
|
|
4920
3301
|
t("signUp.nameLabel"),
|
|
4921
|
-
/* @__PURE__ */
|
|
3302
|
+
/* @__PURE__ */ jsx40(
|
|
4922
3303
|
"input",
|
|
4923
3304
|
{
|
|
4924
3305
|
className: "ba-input",
|
|
@@ -4929,10 +3310,10 @@ function ProfileSection({
|
|
|
4929
3310
|
}
|
|
4930
3311
|
)
|
|
4931
3312
|
] }),
|
|
4932
|
-
firstLastName && /* @__PURE__ */
|
|
4933
|
-
/* @__PURE__ */
|
|
3313
|
+
firstLastName && /* @__PURE__ */ jsxs37(Fragment11, { children: [
|
|
3314
|
+
/* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
|
|
4934
3315
|
t("signUp.firstNameLabel"),
|
|
4935
|
-
/* @__PURE__ */
|
|
3316
|
+
/* @__PURE__ */ jsx40(
|
|
4936
3317
|
"input",
|
|
4937
3318
|
{
|
|
4938
3319
|
className: "ba-input",
|
|
@@ -4942,9 +3323,9 @@ function ProfileSection({
|
|
|
4942
3323
|
}
|
|
4943
3324
|
)
|
|
4944
3325
|
] }),
|
|
4945
|
-
/* @__PURE__ */
|
|
3326
|
+
/* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
|
|
4946
3327
|
t("signUp.lastNameLabel"),
|
|
4947
|
-
/* @__PURE__ */
|
|
3328
|
+
/* @__PURE__ */ jsx40(
|
|
4948
3329
|
"input",
|
|
4949
3330
|
{
|
|
4950
3331
|
className: "ba-input",
|
|
@@ -4955,9 +3336,9 @@ function ProfileSection({
|
|
|
4955
3336
|
)
|
|
4956
3337
|
] })
|
|
4957
3338
|
] }),
|
|
4958
|
-
usernameEnabled && /* @__PURE__ */
|
|
3339
|
+
usernameEnabled && /* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
|
|
4959
3340
|
t("common.usernameLabel"),
|
|
4960
|
-
/* @__PURE__ */
|
|
3341
|
+
/* @__PURE__ */ jsx40(
|
|
4961
3342
|
"input",
|
|
4962
3343
|
{
|
|
4963
3344
|
className: "ba-input",
|
|
@@ -4967,9 +3348,9 @@ function ProfileSection({
|
|
|
4967
3348
|
}
|
|
4968
3349
|
)
|
|
4969
3350
|
] }),
|
|
4970
|
-
/* @__PURE__ */
|
|
3351
|
+
/* @__PURE__ */ jsxs37("label", { className: "ba-label", children: [
|
|
4971
3352
|
t("userProfile.profile.imageLabel"),
|
|
4972
|
-
/* @__PURE__ */
|
|
3353
|
+
/* @__PURE__ */ jsx40(
|
|
4973
3354
|
"input",
|
|
4974
3355
|
{
|
|
4975
3356
|
className: "ba-input",
|
|
@@ -4980,16 +3361,16 @@ function ProfileSection({
|
|
|
4980
3361
|
}
|
|
4981
3362
|
)
|
|
4982
3363
|
] }),
|
|
4983
|
-
/* @__PURE__ */
|
|
4984
|
-
saved && /* @__PURE__ */
|
|
4985
|
-
/* @__PURE__ */
|
|
3364
|
+
/* @__PURE__ */ jsx40(FormError, { children: error }),
|
|
3365
|
+
saved && /* @__PURE__ */ jsx40("p", { className: "ba-success", role: "status", children: t("userProfile.profile.saved") }),
|
|
3366
|
+
/* @__PURE__ */ jsx40(
|
|
4986
3367
|
"button",
|
|
4987
3368
|
{
|
|
4988
3369
|
className: "ba-button ba-profile-submit",
|
|
4989
3370
|
type: "submit",
|
|
4990
3371
|
disabled: pending || legacyNameField && !name.trim(),
|
|
4991
3372
|
"aria-busy": pending || void 0,
|
|
4992
|
-
children: /* @__PURE__ */
|
|
3373
|
+
children: /* @__PURE__ */ jsx40(Busy, { busy: pending, label: t("common.working"), children: t("userProfile.save") })
|
|
4993
3374
|
}
|
|
4994
3375
|
)
|
|
4995
3376
|
] })
|
|
@@ -4998,24 +3379,24 @@ function ProfileSection({
|
|
|
4998
3379
|
|
|
4999
3380
|
// src/components/user-profile/RecoverySection.tsx
|
|
5000
3381
|
import * as React31 from "react";
|
|
5001
|
-
import { Fragment as Fragment12, jsx as
|
|
3382
|
+
import { Fragment as Fragment12, jsx as jsx41, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
5002
3383
|
function RecoverySection() {
|
|
5003
3384
|
const t = useT();
|
|
5004
3385
|
const { user } = useUser();
|
|
5005
3386
|
const titleId = React31.useId();
|
|
5006
|
-
return /* @__PURE__ */
|
|
5007
|
-
/* @__PURE__ */
|
|
5008
|
-
/* @__PURE__ */
|
|
5009
|
-
/* @__PURE__ */
|
|
3387
|
+
return /* @__PURE__ */ jsxs38("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3388
|
+
/* @__PURE__ */ jsxs38("header", { className: "ba-profile-section-header", children: [
|
|
3389
|
+
/* @__PURE__ */ jsx41("h2", { id: titleId, className: "ba-title", children: t("userProfile.recovery.title") }),
|
|
3390
|
+
/* @__PURE__ */ jsx41("p", { className: "ba-muted", children: t("userProfile.recovery.description") })
|
|
5010
3391
|
] }),
|
|
5011
|
-
/* @__PURE__ */
|
|
5012
|
-
/* @__PURE__ */
|
|
5013
|
-
user?.email && user.emailVerified ? /* @__PURE__ */
|
|
5014
|
-
/* @__PURE__ */
|
|
5015
|
-
/* @__PURE__ */
|
|
5016
|
-
] }) : /* @__PURE__ */
|
|
3392
|
+
/* @__PURE__ */ jsxs38("div", { className: "ba-profile-recovery-card", children: [
|
|
3393
|
+
/* @__PURE__ */ jsx41("strong", { children: t("userProfile.recovery.emailTitle") }),
|
|
3394
|
+
user?.email && user.emailVerified ? /* @__PURE__ */ jsxs38(Fragment12, { children: [
|
|
3395
|
+
/* @__PURE__ */ jsx41("p", { children: t("userProfile.recovery.emailDescription") }),
|
|
3396
|
+
/* @__PURE__ */ jsx41(Bidi, { children: user.email })
|
|
3397
|
+
] }) : /* @__PURE__ */ jsx41("p", { children: t("userProfile.recovery.emailUnavailable") })
|
|
5017
3398
|
] }),
|
|
5018
|
-
/* @__PURE__ */
|
|
3399
|
+
/* @__PURE__ */ jsx41(BackupCodesManager, { title: null })
|
|
5019
3400
|
] });
|
|
5020
3401
|
}
|
|
5021
3402
|
|
|
@@ -5107,7 +3488,7 @@ function useAccountResource(loader2, failure) {
|
|
|
5107
3488
|
}
|
|
5108
3489
|
|
|
5109
3490
|
// src/components/user-profile/SessionsSection.tsx
|
|
5110
|
-
import { jsx as
|
|
3491
|
+
import { jsx as jsx42, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
5111
3492
|
function SessionsSection() {
|
|
5112
3493
|
const t = useT();
|
|
5113
3494
|
const locale = useLocale();
|
|
@@ -5136,31 +3517,31 @@ function SessionsSection() {
|
|
|
5136
3517
|
}
|
|
5137
3518
|
);
|
|
5138
3519
|
};
|
|
5139
|
-
return /* @__PURE__ */
|
|
5140
|
-
/* @__PURE__ */
|
|
5141
|
-
/* @__PURE__ */
|
|
5142
|
-
/* @__PURE__ */
|
|
3520
|
+
return /* @__PURE__ */ jsxs39("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3521
|
+
/* @__PURE__ */ jsxs39("header", { className: "ba-profile-section-header", children: [
|
|
3522
|
+
/* @__PURE__ */ jsx42("h2", { id: titleId, className: "ba-title", children: t("userProfile.sessions.title") }),
|
|
3523
|
+
/* @__PURE__ */ jsx42("p", { className: "ba-muted", children: t("userProfile.sessions.description") })
|
|
5143
3524
|
] }),
|
|
5144
|
-
resource.data === null ? resource.loading ? /* @__PURE__ */
|
|
5145
|
-
/* @__PURE__ */
|
|
5146
|
-
/* @__PURE__ */
|
|
5147
|
-
] }) : null : /* @__PURE__ */
|
|
3525
|
+
resource.data === null ? resource.loading ? /* @__PURE__ */ jsxs39("div", { className: "ba-profile-list-skeleton", "aria-busy": "true", children: [
|
|
3526
|
+
/* @__PURE__ */ jsx42("div", { className: "ba-skeleton" }),
|
|
3527
|
+
/* @__PURE__ */ jsx42("div", { className: "ba-skeleton" })
|
|
3528
|
+
] }) : null : /* @__PURE__ */ jsxs39("ul", { className: "ba-profile-list", children: [
|
|
5148
3529
|
sessions.map((session) => {
|
|
5149
3530
|
const label2 = session.userAgent?.trim() || t("userProfile.sessions.unknownDevice");
|
|
5150
|
-
return /* @__PURE__ */
|
|
5151
|
-
/* @__PURE__ */
|
|
5152
|
-
/* @__PURE__ */
|
|
5153
|
-
/* @__PURE__ */
|
|
5154
|
-
session.id === currentId && /* @__PURE__ */
|
|
3531
|
+
return /* @__PURE__ */ jsxs39("li", { className: "ba-profile-list-item", children: [
|
|
3532
|
+
/* @__PURE__ */ jsxs39("span", { children: [
|
|
3533
|
+
/* @__PURE__ */ jsx42("strong", { children: label2 }),
|
|
3534
|
+
/* @__PURE__ */ jsxs39("small", { children: [
|
|
3535
|
+
session.id === currentId && /* @__PURE__ */ jsx42("em", { children: t("userProfile.sessions.current") }),
|
|
5155
3536
|
formatSessionTime(session.updatedAt, locale)
|
|
5156
3537
|
] })
|
|
5157
3538
|
] }),
|
|
5158
|
-
/* @__PURE__ */
|
|
3539
|
+
/* @__PURE__ */ jsx42("button", { className: "ba-link-button ba-danger", type: "button", disabled: mutation.pending, onClick: () => revoke(session.id, label2), children: t("userProfile.sessions.revoke") })
|
|
5159
3540
|
] }, session.id);
|
|
5160
3541
|
}),
|
|
5161
|
-
sessions.length === 0 && /* @__PURE__ */
|
|
3542
|
+
sessions.length === 0 && /* @__PURE__ */ jsx42("li", { className: "ba-muted", children: t("userProfile.sessions.empty") })
|
|
5162
3543
|
] }),
|
|
5163
|
-
sessions.some((session) => session.id !== currentId) && /* @__PURE__ */
|
|
3544
|
+
sessions.some((session) => session.id !== currentId) && /* @__PURE__ */ jsx42(
|
|
5164
3545
|
"button",
|
|
5165
3546
|
{
|
|
5166
3547
|
className: "ba-button ba-button-secondary ba-profile-submit",
|
|
@@ -5176,17 +3557,17 @@ function SessionsSection() {
|
|
|
5176
3557
|
children: t("userProfile.sessions.revokeOthers")
|
|
5177
3558
|
}
|
|
5178
3559
|
),
|
|
5179
|
-
resource.error && /* @__PURE__ */
|
|
5180
|
-
/* @__PURE__ */
|
|
5181
|
-
/* @__PURE__ */
|
|
3560
|
+
resource.error && /* @__PURE__ */ jsxs39("div", { className: "ba-profile-inline-error", children: [
|
|
3561
|
+
/* @__PURE__ */ jsx42(FormError, { children: resource.error }),
|
|
3562
|
+
/* @__PURE__ */ jsx42("button", { className: "ba-link-button", type: "button", onClick: () => void resource.load(), children: t("userProfile.retry") })
|
|
5182
3563
|
] }),
|
|
5183
|
-
/* @__PURE__ */
|
|
3564
|
+
/* @__PURE__ */ jsx42(FormError, { children: mutation.error })
|
|
5184
3565
|
] });
|
|
5185
3566
|
}
|
|
5186
3567
|
|
|
5187
3568
|
// src/components/user-profile/SocialSection.tsx
|
|
5188
3569
|
import * as React34 from "react";
|
|
5189
|
-
import { jsx as
|
|
3570
|
+
import { jsx as jsx43, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
5190
3571
|
function providerLabel(provider) {
|
|
5191
3572
|
return provider.charAt(0).toUpperCase() + provider.slice(1);
|
|
5192
3573
|
}
|
|
@@ -5226,18 +3607,18 @@ function SocialSection() {
|
|
|
5226
3607
|
{ failure: t("userProfile.social.unlinkError"), onSuccess: resource.load }
|
|
5227
3608
|
);
|
|
5228
3609
|
};
|
|
5229
|
-
return /* @__PURE__ */
|
|
5230
|
-
/* @__PURE__ */
|
|
5231
|
-
/* @__PURE__ */
|
|
5232
|
-
/* @__PURE__ */
|
|
3610
|
+
return /* @__PURE__ */ jsxs40("section", { className: "ba-profile-section", "aria-labelledby": titleId, children: [
|
|
3611
|
+
/* @__PURE__ */ jsxs40("header", { className: "ba-profile-section-header", children: [
|
|
3612
|
+
/* @__PURE__ */ jsx43("h2", { id: titleId, className: "ba-title", children: t("userProfile.social.title") }),
|
|
3613
|
+
/* @__PURE__ */ jsx43("p", { className: "ba-muted", children: t("userProfile.social.description") })
|
|
5233
3614
|
] }),
|
|
5234
|
-
resource.data === null ? resource.loading ? /* @__PURE__ */
|
|
5235
|
-
linked.map((item) => /* @__PURE__ */
|
|
5236
|
-
/* @__PURE__ */
|
|
5237
|
-
/* @__PURE__ */
|
|
5238
|
-
/* @__PURE__ */
|
|
3615
|
+
resource.data === null ? resource.loading ? /* @__PURE__ */ jsx43("div", { className: "ba-profile-list-skeleton", "aria-busy": "true", children: /* @__PURE__ */ jsx43("div", { className: "ba-skeleton" }) }) : null : /* @__PURE__ */ jsxs40("ul", { className: "ba-profile-list", children: [
|
|
3616
|
+
linked.map((item) => /* @__PURE__ */ jsxs40("li", { className: "ba-profile-list-item", children: [
|
|
3617
|
+
/* @__PURE__ */ jsxs40("span", { children: [
|
|
3618
|
+
/* @__PURE__ */ jsx43("strong", { children: providerLabel(item.providerId) }),
|
|
3619
|
+
/* @__PURE__ */ jsx43("small", { children: item.canUnlink ? t("userProfile.social.connected") : t("userProfile.social.lastMethod") })
|
|
5239
3620
|
] }),
|
|
5240
|
-
/* @__PURE__ */
|
|
3621
|
+
/* @__PURE__ */ jsx43(
|
|
5241
3622
|
"button",
|
|
5242
3623
|
{
|
|
5243
3624
|
className: "ba-link-button ba-danger",
|
|
@@ -5252,23 +3633,23 @@ function SocialSection() {
|
|
|
5252
3633
|
}
|
|
5253
3634
|
)
|
|
5254
3635
|
] }, item.id)),
|
|
5255
|
-
linked.length === 0 && /* @__PURE__ */
|
|
3636
|
+
linked.length === 0 && /* @__PURE__ */ jsx43("li", { className: "ba-muted", children: t("userProfile.social.empty") })
|
|
5256
3637
|
] }),
|
|
5257
|
-
available.length > 0 && /* @__PURE__ */
|
|
5258
|
-
/* @__PURE__ */
|
|
5259
|
-
available.map((provider) => /* @__PURE__ */
|
|
3638
|
+
available.length > 0 && /* @__PURE__ */ jsxs40("div", { className: "ba-profile-provider-actions", children: [
|
|
3639
|
+
/* @__PURE__ */ jsx43("p", { className: "ba-profile-subtitle", children: t("userProfile.social.add") }),
|
|
3640
|
+
available.map((provider) => /* @__PURE__ */ jsx43("button", { type: "button", className: "ba-button ba-button-secondary", disabled: mutation.pending, onClick: () => link(provider), children: t("userProfile.social.connectProvider", { provider: providerLabel(provider) }) }, provider))
|
|
5260
3641
|
] }),
|
|
5261
|
-
resource.error && /* @__PURE__ */
|
|
5262
|
-
/* @__PURE__ */
|
|
5263
|
-
/* @__PURE__ */
|
|
3642
|
+
resource.error && /* @__PURE__ */ jsxs40("div", { className: "ba-profile-inline-error", children: [
|
|
3643
|
+
/* @__PURE__ */ jsx43(FormError, { children: resource.error }),
|
|
3644
|
+
/* @__PURE__ */ jsx43("button", { className: "ba-link-button", type: "button", onClick: () => void resource.load(), children: t("userProfile.retry") })
|
|
5264
3645
|
] }),
|
|
5265
|
-
/* @__PURE__ */
|
|
3646
|
+
/* @__PURE__ */ jsx43(FormError, { children: mutation.error })
|
|
5266
3647
|
] });
|
|
5267
3648
|
}
|
|
5268
3649
|
|
|
5269
3650
|
// src/components/user-profile/UserProfileModal.tsx
|
|
5270
3651
|
import * as React35 from "react";
|
|
5271
|
-
import { jsx as
|
|
3652
|
+
import { jsx as jsx44, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
5272
3653
|
function UserProfileModal({
|
|
5273
3654
|
children,
|
|
5274
3655
|
onClose,
|
|
@@ -5276,7 +3657,7 @@ function UserProfileModal({
|
|
|
5276
3657
|
}) {
|
|
5277
3658
|
const t = useT();
|
|
5278
3659
|
const titleId = React35.useId();
|
|
5279
|
-
return /* @__PURE__ */
|
|
3660
|
+
return /* @__PURE__ */ jsxs41(
|
|
5280
3661
|
ModalSurface,
|
|
5281
3662
|
{
|
|
5282
3663
|
overlayClassName: "ba-profile-overlay",
|
|
@@ -5285,13 +3666,13 @@ function UserProfileModal({
|
|
|
5285
3666
|
testId: "user-profile-modal",
|
|
5286
3667
|
onClose,
|
|
5287
3668
|
children: [
|
|
5288
|
-
/* @__PURE__ */
|
|
5289
|
-
/* @__PURE__ */
|
|
3669
|
+
/* @__PURE__ */ jsxs41("div", { className: "ba-profile-modal-header", children: [
|
|
3670
|
+
/* @__PURE__ */ jsxs41("span", { children: [
|
|
5290
3671
|
branding,
|
|
5291
|
-
/* @__PURE__ */
|
|
5292
|
-
/* @__PURE__ */
|
|
3672
|
+
/* @__PURE__ */ jsx44("h1", { id: titleId, children: t("userProfile.title") }),
|
|
3673
|
+
/* @__PURE__ */ jsx44("p", { children: t("userProfile.description") })
|
|
5293
3674
|
] }),
|
|
5294
|
-
/* @__PURE__ */
|
|
3675
|
+
/* @__PURE__ */ jsx44(
|
|
5295
3676
|
"button",
|
|
5296
3677
|
{
|
|
5297
3678
|
type: "button",
|
|
@@ -5299,7 +3680,7 @@ function UserProfileModal({
|
|
|
5299
3680
|
"aria-label": t("userProfile.close"),
|
|
5300
3681
|
onClick: onClose,
|
|
5301
3682
|
autoFocus: true,
|
|
5302
|
-
children: /* @__PURE__ */
|
|
3683
|
+
children: /* @__PURE__ */ jsx44("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx44(
|
|
5303
3684
|
"path",
|
|
5304
3685
|
{
|
|
5305
3686
|
d: "M6 6l12 12M18 6L6 18",
|
|
@@ -5312,14 +3693,14 @@ function UserProfileModal({
|
|
|
5312
3693
|
)
|
|
5313
3694
|
] }),
|
|
5314
3695
|
children,
|
|
5315
|
-
/* @__PURE__ */
|
|
3696
|
+
/* @__PURE__ */ jsx44("footer", { className: "ba-profile-modal-footer", children: /* @__PURE__ */ jsx44(AuthOwlBadge, {}) })
|
|
5316
3697
|
]
|
|
5317
3698
|
}
|
|
5318
3699
|
);
|
|
5319
3700
|
}
|
|
5320
3701
|
|
|
5321
3702
|
// src/components/UserProfile.tsx
|
|
5322
|
-
import { jsx as
|
|
3703
|
+
import { jsx as jsx45, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
5323
3704
|
var SECTION_KEYS = {
|
|
5324
3705
|
profile: "userProfile.nav.profile",
|
|
5325
3706
|
email: "userProfile.nav.email",
|
|
@@ -5385,11 +3766,11 @@ function UserProfile(props = {}) {
|
|
|
5385
3766
|
window.history.replaceState(null, "", userProfileSectionHash(next));
|
|
5386
3767
|
}
|
|
5387
3768
|
};
|
|
5388
|
-
const content = !isLoaded ? /* @__PURE__ */
|
|
5389
|
-
/* @__PURE__ */
|
|
5390
|
-
/* @__PURE__ */
|
|
5391
|
-
/* @__PURE__ */
|
|
5392
|
-
] }) : !isSignedIn || !user ? /* @__PURE__ */
|
|
3769
|
+
const content = !isLoaded ? /* @__PURE__ */ jsxs42("div", { className: "ba-profile-loading", "aria-busy": "true", children: [
|
|
3770
|
+
/* @__PURE__ */ jsx45("div", { className: "ba-skeleton" }),
|
|
3771
|
+
/* @__PURE__ */ jsx45("div", { className: "ba-skeleton" }),
|
|
3772
|
+
/* @__PURE__ */ jsx45("div", { className: "ba-skeleton" })
|
|
3773
|
+
] }) : !isSignedIn || !user ? /* @__PURE__ */ jsx45("p", { className: "ba-muted", children: t("userProfile.signedOut") }) : /* @__PURE__ */ jsx45(
|
|
5393
3774
|
UserProfileBody,
|
|
5394
3775
|
{
|
|
5395
3776
|
active: visibleActive,
|
|
@@ -5401,23 +3782,23 @@ function UserProfile(props = {}) {
|
|
|
5401
3782
|
user.id
|
|
5402
3783
|
);
|
|
5403
3784
|
if (props.mode === "modal") {
|
|
5404
|
-
return /* @__PURE__ */
|
|
3785
|
+
return /* @__PURE__ */ jsx45(
|
|
5405
3786
|
UserProfileModal,
|
|
5406
3787
|
{
|
|
5407
3788
|
onClose: props.onClose,
|
|
5408
|
-
branding: showBranding ? /* @__PURE__ */
|
|
3789
|
+
branding: showBranding ? /* @__PURE__ */ jsx45(AuthOwlBranding, {}) : null,
|
|
5409
3790
|
children: content
|
|
5410
3791
|
}
|
|
5411
3792
|
);
|
|
5412
3793
|
}
|
|
5413
|
-
return /* @__PURE__ */
|
|
5414
|
-
/* @__PURE__ */
|
|
5415
|
-
showBranding ? /* @__PURE__ */
|
|
5416
|
-
/* @__PURE__ */
|
|
5417
|
-
/* @__PURE__ */
|
|
3794
|
+
return /* @__PURE__ */ jsxs42("article", { className: "ba-profile ba-profile-page", "data-testid": "user-profile", children: [
|
|
3795
|
+
/* @__PURE__ */ jsxs42("header", { className: "ba-profile-heading", children: [
|
|
3796
|
+
showBranding ? /* @__PURE__ */ jsx45(AuthOwlBranding, {}) : null,
|
|
3797
|
+
/* @__PURE__ */ jsx45("h1", { children: t("userProfile.title") }),
|
|
3798
|
+
/* @__PURE__ */ jsx45("p", { children: t("userProfile.description") })
|
|
5418
3799
|
] }),
|
|
5419
3800
|
content,
|
|
5420
|
-
/* @__PURE__ */
|
|
3801
|
+
/* @__PURE__ */ jsx45("footer", { className: "ba-profile-modal-footer", children: /* @__PURE__ */ jsx45(AuthOwlBadge, {}) })
|
|
5421
3802
|
] });
|
|
5422
3803
|
}
|
|
5423
3804
|
function UserProfileBody({
|
|
@@ -5428,8 +3809,8 @@ function UserProfileBody({
|
|
|
5428
3809
|
capabilities
|
|
5429
3810
|
}) {
|
|
5430
3811
|
const t = useT();
|
|
5431
|
-
return /* @__PURE__ */
|
|
5432
|
-
/* @__PURE__ */
|
|
3812
|
+
return /* @__PURE__ */ jsxs42("div", { className: "ba-profile-layout", children: [
|
|
3813
|
+
/* @__PURE__ */ jsx45("nav", { className: "ba-profile-nav", "aria-label": t("userProfile.nav.aria"), children: sections.map((item) => /* @__PURE__ */ jsx45(
|
|
5433
3814
|
"button",
|
|
5434
3815
|
{
|
|
5435
3816
|
type: "button",
|
|
@@ -5440,8 +3821,8 @@ function UserProfileBody({
|
|
|
5440
3821
|
},
|
|
5441
3822
|
item
|
|
5442
3823
|
)) }),
|
|
5443
|
-
/* @__PURE__ */
|
|
5444
|
-
active === "profile" && /* @__PURE__ */
|
|
3824
|
+
/* @__PURE__ */ jsxs42("div", { className: "ba-profile-content", "data-section": active, children: [
|
|
3825
|
+
active === "profile" && /* @__PURE__ */ jsx45(
|
|
5445
3826
|
ProfileSection,
|
|
5446
3827
|
{
|
|
5447
3828
|
firstLastName: capabilities.firstLastName,
|
|
@@ -5449,43 +3830,54 @@ function UserProfileBody({
|
|
|
5449
3830
|
legacyNameField: capabilities.legacyNameField
|
|
5450
3831
|
}
|
|
5451
3832
|
),
|
|
5452
|
-
active === "email" && /* @__PURE__ */
|
|
5453
|
-
active === "password" && /* @__PURE__ */
|
|
5454
|
-
active === "social" && /* @__PURE__ */
|
|
5455
|
-
active === "sessions" && /* @__PURE__ */
|
|
5456
|
-
active === "passkeys" && /* @__PURE__ */
|
|
5457
|
-
active === "mfa" && /* @__PURE__ */
|
|
5458
|
-
active === "recovery" && /* @__PURE__ */
|
|
5459
|
-
active === "danger" && /* @__PURE__ */
|
|
3833
|
+
active === "email" && /* @__PURE__ */ jsx45(EmailSection, { allowChange: capabilities.emailChange }),
|
|
3834
|
+
active === "password" && /* @__PURE__ */ jsx45(PasswordSection, {}),
|
|
3835
|
+
active === "social" && /* @__PURE__ */ jsx45(SocialSection, {}),
|
|
3836
|
+
active === "sessions" && /* @__PURE__ */ jsx45(SessionsSection, {}),
|
|
3837
|
+
active === "passkeys" && /* @__PURE__ */ jsx45(PasskeysSection, { allowAdd: capabilities.passkeyAdd }),
|
|
3838
|
+
active === "mfa" && /* @__PURE__ */ jsx45(MfaSection, {}),
|
|
3839
|
+
active === "recovery" && /* @__PURE__ */ jsx45(RecoverySection, {}),
|
|
3840
|
+
active === "danger" && /* @__PURE__ */ jsx45(DeleteAccountSection, { onDeleted })
|
|
5460
3841
|
] })
|
|
5461
3842
|
] });
|
|
5462
3843
|
}
|
|
5463
3844
|
|
|
5464
3845
|
// src/components/UserButton.tsx
|
|
5465
|
-
import { jsx as
|
|
3846
|
+
import { jsx as jsx46, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
5466
3847
|
function UserButton() {
|
|
5467
3848
|
const t = useT();
|
|
5468
3849
|
const { user, isLoaded } = useUser();
|
|
5469
3850
|
const { signOut } = useSignOut();
|
|
5470
3851
|
const [open, setOpen] = React37.useState(false);
|
|
5471
3852
|
const [profileOpen, setProfileOpen] = React37.useState(false);
|
|
3853
|
+
const [failedImage, setFailedImage] = React37.useState(null);
|
|
5472
3854
|
const triggerRef = React37.useRef(null);
|
|
5473
3855
|
if (!isLoaded || !user) return null;
|
|
5474
3856
|
const identity = user.email ?? user.phoneNumber ?? user.name ?? "?";
|
|
5475
|
-
|
|
5476
|
-
|
|
3857
|
+
const image = user.image ?? null;
|
|
3858
|
+
return /* @__PURE__ */ jsxs43("div", { className: "ba-user-button", "data-testid": "user-button", children: [
|
|
3859
|
+
/* @__PURE__ */ jsx46(
|
|
5477
3860
|
"button",
|
|
5478
3861
|
{
|
|
5479
3862
|
ref: triggerRef,
|
|
5480
3863
|
className: "ba-user-button-trigger",
|
|
5481
3864
|
"aria-label": t("userButton.openMenuAria"),
|
|
5482
3865
|
onClick: () => setOpen((v) => !v),
|
|
5483
|
-
children:
|
|
3866
|
+
children: image && failedImage !== image ? /* @__PURE__ */ jsx46(
|
|
3867
|
+
"img",
|
|
3868
|
+
{
|
|
3869
|
+
className: "ba-avatar",
|
|
3870
|
+
src: image,
|
|
3871
|
+
alt: "",
|
|
3872
|
+
referrerPolicy: "no-referrer",
|
|
3873
|
+
onError: () => setFailedImage(image)
|
|
3874
|
+
}
|
|
3875
|
+
) : /* @__PURE__ */ jsx46("span", { className: "ba-avatar ba-avatar-fallback", children: identity[0]?.toUpperCase() })
|
|
5484
3876
|
}
|
|
5485
3877
|
),
|
|
5486
|
-
open && /* @__PURE__ */
|
|
5487
|
-
/* @__PURE__ */
|
|
5488
|
-
/* @__PURE__ */
|
|
3878
|
+
open && /* @__PURE__ */ jsxs43("div", { className: "ba-menu", children: [
|
|
3879
|
+
/* @__PURE__ */ jsx46("p", { className: "ba-menu-label", children: identity }),
|
|
3880
|
+
/* @__PURE__ */ jsx46(
|
|
5489
3881
|
"button",
|
|
5490
3882
|
{
|
|
5491
3883
|
className: "ba-menu-item",
|
|
@@ -5496,10 +3888,10 @@ function UserButton() {
|
|
|
5496
3888
|
children: t("userButton.manageAccount")
|
|
5497
3889
|
}
|
|
5498
3890
|
),
|
|
5499
|
-
/* @__PURE__ */
|
|
5500
|
-
/* @__PURE__ */
|
|
3891
|
+
/* @__PURE__ */ jsx46("button", { className: "ba-menu-item", onClick: () => signOut(), children: t("userButton.signOut") }),
|
|
3892
|
+
/* @__PURE__ */ jsx46("div", { className: "ba-menu-badge", children: /* @__PURE__ */ jsx46(AuthOwlBadge, {}) })
|
|
5501
3893
|
] }),
|
|
5502
|
-
profileOpen && /* @__PURE__ */
|
|
3894
|
+
profileOpen && /* @__PURE__ */ jsx46(
|
|
5503
3895
|
UserProfile,
|
|
5504
3896
|
{
|
|
5505
3897
|
mode: "modal",
|
|
@@ -5519,7 +3911,7 @@ import * as React45 from "react";
|
|
|
5519
3911
|
|
|
5520
3912
|
// src/components/CreateOrganization.tsx
|
|
5521
3913
|
import * as React38 from "react";
|
|
5522
|
-
import { jsx as
|
|
3914
|
+
import { jsx as jsx47, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
5523
3915
|
function CreateOrganization({ onCreated, title } = {}) {
|
|
5524
3916
|
const t = useT();
|
|
5525
3917
|
const { config, isLoading: configLoading } = usePublicConfig();
|
|
@@ -5531,10 +3923,10 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
5531
3923
|
const [logo, setLogo] = React38.useState("");
|
|
5532
3924
|
const [slugTouched, setSlugTouched] = React38.useState(false);
|
|
5533
3925
|
if (configLoading || !isLoaded) {
|
|
5534
|
-
return /* @__PURE__ */
|
|
3926
|
+
return /* @__PURE__ */ jsx47("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
5535
3927
|
}
|
|
5536
3928
|
if (config?.organizations !== true) return null;
|
|
5537
|
-
if (!isSignedIn) return /* @__PURE__ */
|
|
3929
|
+
if (!isSignedIn) return /* @__PURE__ */ jsx47("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
5538
3930
|
const submit = (event) => {
|
|
5539
3931
|
event.preventDefault();
|
|
5540
3932
|
const normalizedName = name.trim();
|
|
@@ -5559,15 +3951,15 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
5559
3951
|
}
|
|
5560
3952
|
);
|
|
5561
3953
|
};
|
|
5562
|
-
return /* @__PURE__ */
|
|
5563
|
-
title !== null && /* @__PURE__ */
|
|
5564
|
-
/* @__PURE__ */
|
|
5565
|
-
/* @__PURE__ */
|
|
3954
|
+
return /* @__PURE__ */ jsxs44("section", { className: "ba-organization-create", children: [
|
|
3955
|
+
title !== null && /* @__PURE__ */ jsxs44("header", { className: "ba-organization-section-header", children: [
|
|
3956
|
+
/* @__PURE__ */ jsx47("h2", { className: "ba-title", children: title ?? t("organization.create.title") }),
|
|
3957
|
+
/* @__PURE__ */ jsx47("p", { className: "ba-muted", children: t("organization.create.description") })
|
|
5566
3958
|
] }),
|
|
5567
|
-
/* @__PURE__ */
|
|
5568
|
-
/* @__PURE__ */
|
|
3959
|
+
/* @__PURE__ */ jsxs44("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
3960
|
+
/* @__PURE__ */ jsxs44("label", { className: "ba-label", children: [
|
|
5569
3961
|
t("organization.create.name"),
|
|
5570
|
-
/* @__PURE__ */
|
|
3962
|
+
/* @__PURE__ */ jsx47(
|
|
5571
3963
|
"input",
|
|
5572
3964
|
{
|
|
5573
3965
|
className: "ba-input",
|
|
@@ -5582,9 +3974,9 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
5582
3974
|
}
|
|
5583
3975
|
)
|
|
5584
3976
|
] }),
|
|
5585
|
-
/* @__PURE__ */
|
|
3977
|
+
/* @__PURE__ */ jsxs44("label", { className: "ba-label", children: [
|
|
5586
3978
|
t("organization.create.slug"),
|
|
5587
|
-
/* @__PURE__ */
|
|
3979
|
+
/* @__PURE__ */ jsx47(
|
|
5588
3980
|
"input",
|
|
5589
3981
|
{
|
|
5590
3982
|
className: "ba-input",
|
|
@@ -5599,9 +3991,9 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
5599
3991
|
}
|
|
5600
3992
|
)
|
|
5601
3993
|
] }),
|
|
5602
|
-
/* @__PURE__ */
|
|
3994
|
+
/* @__PURE__ */ jsxs44("label", { className: "ba-label", children: [
|
|
5603
3995
|
t("organization.create.logo"),
|
|
5604
|
-
/* @__PURE__ */
|
|
3996
|
+
/* @__PURE__ */ jsx47(
|
|
5605
3997
|
"input",
|
|
5606
3998
|
{
|
|
5607
3999
|
className: "ba-input",
|
|
@@ -5613,15 +4005,15 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
5613
4005
|
}
|
|
5614
4006
|
)
|
|
5615
4007
|
] }),
|
|
5616
|
-
/* @__PURE__ */
|
|
5617
|
-
/* @__PURE__ */
|
|
4008
|
+
/* @__PURE__ */ jsx47(FormError, { children: error }),
|
|
4009
|
+
/* @__PURE__ */ jsx47(
|
|
5618
4010
|
"button",
|
|
5619
4011
|
{
|
|
5620
4012
|
className: "ba-button ba-profile-submit",
|
|
5621
4013
|
type: "submit",
|
|
5622
4014
|
disabled: pending || !name.trim() || !slug.trim(),
|
|
5623
4015
|
"aria-busy": pending || void 0,
|
|
5624
|
-
children: /* @__PURE__ */
|
|
4016
|
+
children: /* @__PURE__ */ jsx47(Busy, { busy: pending, label: t("common.working"), children: t("organization.create.submit") })
|
|
5625
4017
|
}
|
|
5626
4018
|
)
|
|
5627
4019
|
] })
|
|
@@ -5630,7 +4022,7 @@ function CreateOrganization({ onCreated, title } = {}) {
|
|
|
5630
4022
|
|
|
5631
4023
|
// src/components/organization/OrganizationModal.tsx
|
|
5632
4024
|
import * as React39 from "react";
|
|
5633
|
-
import { jsx as
|
|
4025
|
+
import { jsx as jsx48, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
5634
4026
|
function OrganizationModal({
|
|
5635
4027
|
title,
|
|
5636
4028
|
onClose,
|
|
@@ -5639,7 +4031,7 @@ function OrganizationModal({
|
|
|
5639
4031
|
}) {
|
|
5640
4032
|
const t = useT();
|
|
5641
4033
|
const titleId = React39.useId();
|
|
5642
|
-
return /* @__PURE__ */
|
|
4034
|
+
return /* @__PURE__ */ jsxs45(
|
|
5643
4035
|
ModalSurface,
|
|
5644
4036
|
{
|
|
5645
4037
|
overlayClassName: "ba-organization-overlay",
|
|
@@ -5648,9 +4040,9 @@ function OrganizationModal({
|
|
|
5648
4040
|
returnFocusRef,
|
|
5649
4041
|
onClose,
|
|
5650
4042
|
children: [
|
|
5651
|
-
/* @__PURE__ */
|
|
5652
|
-
/* @__PURE__ */
|
|
5653
|
-
/* @__PURE__ */
|
|
4043
|
+
/* @__PURE__ */ jsxs45("div", { className: "ba-organization-modal-header", children: [
|
|
4044
|
+
/* @__PURE__ */ jsx48("h2", { id: titleId, className: "ba-title", children: title }),
|
|
4045
|
+
/* @__PURE__ */ jsx48(
|
|
5654
4046
|
"button",
|
|
5655
4047
|
{
|
|
5656
4048
|
className: "ba-profile-close",
|
|
@@ -5662,7 +4054,7 @@ function OrganizationModal({
|
|
|
5662
4054
|
}
|
|
5663
4055
|
)
|
|
5664
4056
|
] }),
|
|
5665
|
-
/* @__PURE__ */
|
|
4057
|
+
/* @__PURE__ */ jsx48("div", { className: "ba-organization-modal-body", children })
|
|
5666
4058
|
]
|
|
5667
4059
|
}
|
|
5668
4060
|
);
|
|
@@ -5727,7 +4119,7 @@ import * as React44 from "react";
|
|
|
5727
4119
|
|
|
5728
4120
|
// src/components/organization/DangerSection.tsx
|
|
5729
4121
|
import * as React41 from "react";
|
|
5730
|
-
import { jsx as
|
|
4122
|
+
import { jsx as jsx49, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
5731
4123
|
function DangerSection({
|
|
5732
4124
|
organization,
|
|
5733
4125
|
membership,
|
|
@@ -5768,43 +4160,43 @@ function DangerSection({
|
|
|
5768
4160
|
}
|
|
5769
4161
|
);
|
|
5770
4162
|
};
|
|
5771
|
-
return /* @__PURE__ */
|
|
5772
|
-
/* @__PURE__ */
|
|
5773
|
-
/* @__PURE__ */
|
|
5774
|
-
/* @__PURE__ */
|
|
4163
|
+
return /* @__PURE__ */ jsxs46("section", { className: "ba-organization-section ba-organization-danger", children: [
|
|
4164
|
+
/* @__PURE__ */ jsxs46("header", { className: "ba-organization-section-header", children: [
|
|
4165
|
+
/* @__PURE__ */ jsx49("h3", { className: "ba-title", children: t("organization.profile.danger.title") }),
|
|
4166
|
+
/* @__PURE__ */ jsx49("p", { className: "ba-muted", children: t("organization.profile.danger.description") })
|
|
5775
4167
|
] }),
|
|
5776
|
-
/* @__PURE__ */
|
|
5777
|
-
/* @__PURE__ */
|
|
5778
|
-
/* @__PURE__ */
|
|
5779
|
-
/* @__PURE__ */
|
|
4168
|
+
/* @__PURE__ */ jsxs46("div", { className: "ba-organization-danger-action", children: [
|
|
4169
|
+
/* @__PURE__ */ jsx49("strong", { children: t("organization.profile.danger.leaveTitle") }),
|
|
4170
|
+
/* @__PURE__ */ jsx49("p", { className: "ba-muted", children: isOwner ? t("organization.profile.danger.ownerLeaveHint") : t("organization.profile.danger.leaveHint") }),
|
|
4171
|
+
/* @__PURE__ */ jsx49("button", { className: "ba-button ba-button-secondary", type: "button", disabled: pending, onClick: leave, children: t("organization.profile.danger.leave") })
|
|
5780
4172
|
] }),
|
|
5781
|
-
isOwner && /* @__PURE__ */
|
|
5782
|
-
/* @__PURE__ */
|
|
5783
|
-
/* @__PURE__ */
|
|
5784
|
-
/* @__PURE__ */
|
|
4173
|
+
isOwner && /* @__PURE__ */ jsxs46("form", { method: "post", className: "ba-organization-danger-action ba-organization-delete", onSubmit: remove, children: [
|
|
4174
|
+
/* @__PURE__ */ jsx49("strong", { children: t("organization.profile.danger.deleteTitle") }),
|
|
4175
|
+
/* @__PURE__ */ jsx49("p", { className: "ba-muted", children: t("organization.profile.danger.deleteHint") }),
|
|
4176
|
+
/* @__PURE__ */ jsxs46("label", { className: "ba-label", children: [
|
|
5785
4177
|
t("organization.profile.danger.deleteConfirm"),
|
|
5786
4178
|
" ",
|
|
5787
|
-
/* @__PURE__ */
|
|
5788
|
-
/* @__PURE__ */
|
|
4179
|
+
/* @__PURE__ */ jsx49(Bidi, { children: organization.slug }),
|
|
4180
|
+
/* @__PURE__ */ jsx49("input", { className: "ba-input", dir: "ltr", value: confirmation, onChange: (event) => setConfirmation(event.target.value), autoComplete: "off", required: true })
|
|
5789
4181
|
] }),
|
|
5790
|
-
/* @__PURE__ */
|
|
4182
|
+
/* @__PURE__ */ jsx49(
|
|
5791
4183
|
"button",
|
|
5792
4184
|
{
|
|
5793
4185
|
className: "ba-button ba-danger-button",
|
|
5794
4186
|
type: "submit",
|
|
5795
4187
|
disabled: pending || !confirmed,
|
|
5796
4188
|
"aria-busy": pending || void 0,
|
|
5797
|
-
children: /* @__PURE__ */
|
|
4189
|
+
children: /* @__PURE__ */ jsx49(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.danger.delete") })
|
|
5798
4190
|
}
|
|
5799
4191
|
)
|
|
5800
4192
|
] }),
|
|
5801
|
-
/* @__PURE__ */
|
|
4193
|
+
/* @__PURE__ */ jsx49(FormError, { children: error })
|
|
5802
4194
|
] });
|
|
5803
4195
|
}
|
|
5804
4196
|
|
|
5805
4197
|
// src/components/organization/GeneralSection.tsx
|
|
5806
4198
|
import * as React42 from "react";
|
|
5807
|
-
import { jsx as
|
|
4199
|
+
import { jsx as jsx50, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
5808
4200
|
function GeneralSection({
|
|
5809
4201
|
organization,
|
|
5810
4202
|
canManage,
|
|
@@ -5822,16 +4214,16 @@ function GeneralSection({
|
|
|
5822
4214
|
setLogo(organization.logo ?? "");
|
|
5823
4215
|
}, [organization.id, organization.logo, organization.name, organization.slug]);
|
|
5824
4216
|
if (!canManage) {
|
|
5825
|
-
return /* @__PURE__ */
|
|
5826
|
-
/* @__PURE__ */
|
|
5827
|
-
/* @__PURE__ */
|
|
5828
|
-
/* @__PURE__ */
|
|
5829
|
-
/* @__PURE__ */
|
|
5830
|
-
/* @__PURE__ */
|
|
4217
|
+
return /* @__PURE__ */ jsxs47("section", { className: "ba-organization-section", children: [
|
|
4218
|
+
/* @__PURE__ */ jsx50("p", { className: "ba-muted", children: t("organization.profile.general.readOnly") }),
|
|
4219
|
+
/* @__PURE__ */ jsxs47("dl", { className: "ba-organization-facts", children: [
|
|
4220
|
+
/* @__PURE__ */ jsxs47("div", { children: [
|
|
4221
|
+
/* @__PURE__ */ jsx50("dt", { children: t("organization.create.name") }),
|
|
4222
|
+
/* @__PURE__ */ jsx50("dd", { children: organization.name })
|
|
5831
4223
|
] }),
|
|
5832
|
-
/* @__PURE__ */
|
|
5833
|
-
/* @__PURE__ */
|
|
5834
|
-
/* @__PURE__ */
|
|
4224
|
+
/* @__PURE__ */ jsxs47("div", { children: [
|
|
4225
|
+
/* @__PURE__ */ jsx50("dt", { children: t("organization.create.slug") }),
|
|
4226
|
+
/* @__PURE__ */ jsx50("dd", { children: /* @__PURE__ */ jsx50(Bidi, { children: organization.slug }) })
|
|
5835
4227
|
] })
|
|
5836
4228
|
] })
|
|
5837
4229
|
] });
|
|
@@ -5849,19 +4241,19 @@ function GeneralSection({
|
|
|
5849
4241
|
}
|
|
5850
4242
|
);
|
|
5851
4243
|
};
|
|
5852
|
-
return /* @__PURE__ */
|
|
5853
|
-
/* @__PURE__ */
|
|
5854
|
-
/* @__PURE__ */
|
|
5855
|
-
/* @__PURE__ */
|
|
4244
|
+
return /* @__PURE__ */ jsxs47("section", { className: "ba-organization-section", children: [
|
|
4245
|
+
/* @__PURE__ */ jsxs47("header", { className: "ba-organization-section-header", children: [
|
|
4246
|
+
/* @__PURE__ */ jsx50("h3", { className: "ba-title", children: t("organization.profile.general.title") }),
|
|
4247
|
+
/* @__PURE__ */ jsx50("p", { className: "ba-muted", children: t("organization.profile.general.description") })
|
|
5856
4248
|
] }),
|
|
5857
|
-
/* @__PURE__ */
|
|
5858
|
-
/* @__PURE__ */
|
|
4249
|
+
/* @__PURE__ */ jsxs47("form", { method: "post", className: "ba-fields", onSubmit: submit, children: [
|
|
4250
|
+
/* @__PURE__ */ jsxs47("label", { className: "ba-label", children: [
|
|
5859
4251
|
t("organization.create.name"),
|
|
5860
|
-
/* @__PURE__ */
|
|
4252
|
+
/* @__PURE__ */ jsx50("input", { className: "ba-input", value: name, onChange: (event) => setName(event.target.value), required: true })
|
|
5861
4253
|
] }),
|
|
5862
|
-
/* @__PURE__ */
|
|
4254
|
+
/* @__PURE__ */ jsxs47("label", { className: "ba-label", children: [
|
|
5863
4255
|
t("organization.create.slug"),
|
|
5864
|
-
/* @__PURE__ */
|
|
4256
|
+
/* @__PURE__ */ jsx50(
|
|
5865
4257
|
"input",
|
|
5866
4258
|
{
|
|
5867
4259
|
className: "ba-input",
|
|
@@ -5873,19 +4265,19 @@ function GeneralSection({
|
|
|
5873
4265
|
}
|
|
5874
4266
|
)
|
|
5875
4267
|
] }),
|
|
5876
|
-
/* @__PURE__ */
|
|
4268
|
+
/* @__PURE__ */ jsxs47("label", { className: "ba-label", children: [
|
|
5877
4269
|
t("organization.create.logo"),
|
|
5878
|
-
/* @__PURE__ */
|
|
4270
|
+
/* @__PURE__ */ jsx50("input", { className: "ba-input", type: "url", dir: "ltr", value: logo, onChange: (event) => setLogo(event.target.value), placeholder: "https://" })
|
|
5879
4271
|
] }),
|
|
5880
|
-
/* @__PURE__ */
|
|
5881
|
-
/* @__PURE__ */
|
|
4272
|
+
/* @__PURE__ */ jsx50(FormError, { children: error }),
|
|
4273
|
+
/* @__PURE__ */ jsx50(
|
|
5882
4274
|
"button",
|
|
5883
4275
|
{
|
|
5884
4276
|
className: "ba-button ba-profile-submit",
|
|
5885
4277
|
type: "submit",
|
|
5886
4278
|
disabled: pending || !name.trim() || !slug.trim(),
|
|
5887
4279
|
"aria-busy": pending || void 0,
|
|
5888
|
-
children: /* @__PURE__ */
|
|
4280
|
+
children: /* @__PURE__ */ jsx50(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.general.save") })
|
|
5889
4281
|
}
|
|
5890
4282
|
)
|
|
5891
4283
|
] })
|
|
@@ -5908,7 +4300,7 @@ function organizationRoleLabel(role, t) {
|
|
|
5908
4300
|
}
|
|
5909
4301
|
|
|
5910
4302
|
// src/components/organization/InvitationsSection.tsx
|
|
5911
|
-
import { jsx as
|
|
4303
|
+
import { jsx as jsx51, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
5912
4304
|
function InvitationsSection({
|
|
5913
4305
|
organization,
|
|
5914
4306
|
onChanged
|
|
@@ -5940,44 +4332,44 @@ function InvitationsSection({
|
|
|
5940
4332
|
{ failure: t("organization.profile.invitations.cancelError"), onSuccess: onChanged }
|
|
5941
4333
|
);
|
|
5942
4334
|
};
|
|
5943
|
-
return /* @__PURE__ */
|
|
5944
|
-
/* @__PURE__ */
|
|
5945
|
-
/* @__PURE__ */
|
|
5946
|
-
/* @__PURE__ */
|
|
4335
|
+
return /* @__PURE__ */ jsxs48("section", { className: "ba-organization-section", children: [
|
|
4336
|
+
/* @__PURE__ */ jsxs48("header", { className: "ba-organization-section-header", children: [
|
|
4337
|
+
/* @__PURE__ */ jsx51("h3", { className: "ba-title", children: t("organization.profile.invitations.title") }),
|
|
4338
|
+
/* @__PURE__ */ jsx51("p", { className: "ba-muted", children: t("organization.profile.invitations.description") })
|
|
5947
4339
|
] }),
|
|
5948
|
-
/* @__PURE__ */
|
|
5949
|
-
/* @__PURE__ */
|
|
4340
|
+
/* @__PURE__ */ jsxs48("form", { method: "post", className: "ba-organization-invite-form", onSubmit: invite, children: [
|
|
4341
|
+
/* @__PURE__ */ jsxs48("label", { className: "ba-label", children: [
|
|
5950
4342
|
t("organization.profile.invitations.email"),
|
|
5951
|
-
/* @__PURE__ */
|
|
4343
|
+
/* @__PURE__ */ jsx51("input", { className: "ba-input", type: "email", dir: "ltr", value: email, onChange: (event) => setEmail(event.target.value), required: true })
|
|
5952
4344
|
] }),
|
|
5953
|
-
/* @__PURE__ */
|
|
4345
|
+
/* @__PURE__ */ jsxs48("label", { className: "ba-label", children: [
|
|
5954
4346
|
t("organization.profile.members.role"),
|
|
5955
|
-
/* @__PURE__ */
|
|
4347
|
+
/* @__PURE__ */ jsx51("select", { className: "ba-input", value: role, onChange: (event) => setRole(event.target.value), children: roles.map((option) => /* @__PURE__ */ jsx51("option", { value: option, children: organizationRoleLabel(option, t) }, option)) })
|
|
5956
4348
|
] }),
|
|
5957
|
-
/* @__PURE__ */
|
|
4349
|
+
/* @__PURE__ */ jsx51(
|
|
5958
4350
|
"button",
|
|
5959
4351
|
{
|
|
5960
4352
|
className: "ba-button",
|
|
5961
4353
|
type: "submit",
|
|
5962
4354
|
disabled: pending || !email.trim(),
|
|
5963
4355
|
"aria-busy": pending || void 0,
|
|
5964
|
-
children: /* @__PURE__ */
|
|
4356
|
+
children: /* @__PURE__ */ jsx51(Busy, { busy: pending, label: t("common.working"), children: t("organization.profile.invitations.invite") })
|
|
5965
4357
|
}
|
|
5966
4358
|
)
|
|
5967
4359
|
] }),
|
|
5968
|
-
/* @__PURE__ */
|
|
5969
|
-
invitations.length === 0 ? /* @__PURE__ */
|
|
5970
|
-
/* @__PURE__ */
|
|
5971
|
-
/* @__PURE__ */
|
|
5972
|
-
/* @__PURE__ */
|
|
4360
|
+
/* @__PURE__ */ jsx51(FormError, { children: error }),
|
|
4361
|
+
invitations.length === 0 ? /* @__PURE__ */ jsx51("p", { className: "ba-muted", children: t("organization.profile.invitations.empty") }) : /* @__PURE__ */ jsx51("ul", { className: "ba-organization-list", children: invitations.map((invitation) => /* @__PURE__ */ jsxs48("li", { className: "ba-organization-invitation", children: [
|
|
4362
|
+
/* @__PURE__ */ jsxs48("span", { children: [
|
|
4363
|
+
/* @__PURE__ */ jsx51("strong", { children: /* @__PURE__ */ jsx51(Bidi, { children: invitation.email }) }),
|
|
4364
|
+
/* @__PURE__ */ jsx51("small", { children: organizationRoleLabel(invitation.role, t) })
|
|
5973
4365
|
] }),
|
|
5974
|
-
/* @__PURE__ */
|
|
4366
|
+
/* @__PURE__ */ jsx51("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => cancel(invitation), children: t("organization.profile.invitations.cancel") })
|
|
5975
4367
|
] }, invitation.id)) })
|
|
5976
4368
|
] });
|
|
5977
4369
|
}
|
|
5978
4370
|
|
|
5979
4371
|
// src/components/organization/MembersSection.tsx
|
|
5980
|
-
import { jsx as
|
|
4372
|
+
import { jsx as jsx52, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
5981
4373
|
function MembersSection({
|
|
5982
4374
|
organization,
|
|
5983
4375
|
userId,
|
|
@@ -6004,27 +4396,27 @@ function MembersSection({
|
|
|
6004
4396
|
{ failure: t("organization.profile.members.removeError"), onSuccess: onChanged }
|
|
6005
4397
|
);
|
|
6006
4398
|
};
|
|
6007
|
-
return /* @__PURE__ */
|
|
6008
|
-
/* @__PURE__ */
|
|
6009
|
-
/* @__PURE__ */
|
|
6010
|
-
/* @__PURE__ */
|
|
4399
|
+
return /* @__PURE__ */ jsxs49("section", { className: "ba-organization-section", children: [
|
|
4400
|
+
/* @__PURE__ */ jsxs49("header", { className: "ba-organization-section-header", children: [
|
|
4401
|
+
/* @__PURE__ */ jsx52("h3", { className: "ba-title", children: t("organization.profile.members.title") }),
|
|
4402
|
+
/* @__PURE__ */ jsx52("p", { className: "ba-muted", children: t("organization.profile.members.description") })
|
|
6011
4403
|
] }),
|
|
6012
|
-
/* @__PURE__ */
|
|
6013
|
-
/* @__PURE__ */
|
|
4404
|
+
/* @__PURE__ */ jsx52(FormError, { children: error }),
|
|
4405
|
+
/* @__PURE__ */ jsx52("ul", { className: "ba-organization-list", children: organization.members.map((member) => {
|
|
6014
4406
|
const primaryRole = organizationRoles(member.role)[0] ?? member.role;
|
|
6015
4407
|
const isCurrent = member.userId === userId;
|
|
6016
|
-
return /* @__PURE__ */
|
|
6017
|
-
/* @__PURE__ */
|
|
6018
|
-
/* @__PURE__ */
|
|
6019
|
-
/* @__PURE__ */
|
|
4408
|
+
return /* @__PURE__ */ jsxs49("li", { className: "ba-organization-member", children: [
|
|
4409
|
+
/* @__PURE__ */ jsx52("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: member.user.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
4410
|
+
/* @__PURE__ */ jsxs49("span", { className: "ba-organization-member-copy", children: [
|
|
4411
|
+
/* @__PURE__ */ jsxs49("strong", { children: [
|
|
6020
4412
|
member.user.name,
|
|
6021
4413
|
isCurrent ? ` ${t("organization.profile.members.you")}` : ""
|
|
6022
4414
|
] }),
|
|
6023
|
-
/* @__PURE__ */
|
|
4415
|
+
/* @__PURE__ */ jsx52("small", { children: /* @__PURE__ */ jsx52(Bidi, { children: member.user.email }) })
|
|
6024
4416
|
] }),
|
|
6025
|
-
canManage && !isCurrent ? /* @__PURE__ */
|
|
6026
|
-
/* @__PURE__ */
|
|
6027
|
-
/* @__PURE__ */
|
|
4417
|
+
canManage && !isCurrent ? /* @__PURE__ */ jsxs49("span", { className: "ba-organization-member-actions", children: [
|
|
4418
|
+
/* @__PURE__ */ jsx52("label", { className: "ba-sr-only", htmlFor: `organization-role-${member.id}`, children: t("organization.profile.members.role") }),
|
|
4419
|
+
/* @__PURE__ */ jsx52(
|
|
6028
4420
|
"select",
|
|
6029
4421
|
{
|
|
6030
4422
|
id: `organization-role-${member.id}`,
|
|
@@ -6032,18 +4424,18 @@ function MembersSection({
|
|
|
6032
4424
|
value: primaryRole,
|
|
6033
4425
|
disabled: pending,
|
|
6034
4426
|
onChange: (event) => updateRole(member, event.target.value),
|
|
6035
|
-
children: (roles.includes(primaryRole) ? roles : [primaryRole, ...roles]).map((role) => /* @__PURE__ */
|
|
4427
|
+
children: (roles.includes(primaryRole) ? roles : [primaryRole, ...roles]).map((role) => /* @__PURE__ */ jsx52("option", { value: role, children: organizationRoleLabel(role, t) }, role))
|
|
6036
4428
|
}
|
|
6037
4429
|
),
|
|
6038
|
-
/* @__PURE__ */
|
|
6039
|
-
] }) : /* @__PURE__ */
|
|
4430
|
+
/* @__PURE__ */ jsx52("button", { className: "ba-link-button ba-danger", type: "button", disabled: pending, onClick: () => remove(member), children: t("organization.profile.members.remove") })
|
|
4431
|
+
] }) : /* @__PURE__ */ jsx52("span", { className: "ba-organization-role-label", children: /* @__PURE__ */ jsx52(Bidi, { children: organizationRoleLabel(member.role, t) }) })
|
|
6040
4432
|
] }, member.id);
|
|
6041
4433
|
}) })
|
|
6042
4434
|
] });
|
|
6043
4435
|
}
|
|
6044
4436
|
|
|
6045
4437
|
// src/components/OrganizationProfile.tsx
|
|
6046
|
-
import { jsx as
|
|
4438
|
+
import { jsx as jsx53, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
6047
4439
|
var SECTION_KEYS2 = {
|
|
6048
4440
|
general: "organization.profile.nav.general",
|
|
6049
4441
|
members: "organization.profile.nav.members",
|
|
@@ -6051,7 +4443,7 @@ var SECTION_KEYS2 = {
|
|
|
6051
4443
|
invitations: "organization.profile.nav.invitations",
|
|
6052
4444
|
danger: "organization.profile.nav.danger"
|
|
6053
4445
|
};
|
|
6054
|
-
var TeamsSection = React44.lazy(() => import("./TeamsSection-
|
|
4446
|
+
var TeamsSection = React44.lazy(() => import("./TeamsSection-ZQDNMWV3.js"));
|
|
6055
4447
|
function OrganizationProfile({ organizationId, defaultSection = "general", onDeleted, onLeft } = {}) {
|
|
6056
4448
|
const t = useT();
|
|
6057
4449
|
const toServerError = useServerError();
|
|
@@ -6098,20 +4490,20 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
6098
4490
|
requestRef.current += 1;
|
|
6099
4491
|
};
|
|
6100
4492
|
}, [load]);
|
|
6101
|
-
if (configLoading || !isLoaded) return /* @__PURE__ */
|
|
4493
|
+
if (configLoading || !isLoaded) return /* @__PURE__ */ jsx53("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
6102
4494
|
if (config?.organizations !== true) return null;
|
|
6103
|
-
if (!isSignedIn || !user) return /* @__PURE__ */
|
|
6104
|
-
if (wasRemoved) return /* @__PURE__ */
|
|
6105
|
-
if (!requestedId) return /* @__PURE__ */
|
|
4495
|
+
if (!isSignedIn || !user) return /* @__PURE__ */ jsx53("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
4496
|
+
if (wasRemoved) return /* @__PURE__ */ jsx53("p", { className: "ba-muted", children: t("organization.profile.noActive") });
|
|
4497
|
+
if (!requestedId) return /* @__PURE__ */ jsx53("p", { className: "ba-muted", children: t("organization.profile.noActive") });
|
|
6106
4498
|
if (error) {
|
|
6107
|
-
return /* @__PURE__ */
|
|
6108
|
-
/* @__PURE__ */
|
|
6109
|
-
/* @__PURE__ */
|
|
4499
|
+
return /* @__PURE__ */ jsxs50("div", { className: "ba-inline-error", children: [
|
|
4500
|
+
/* @__PURE__ */ jsx53(FormError, { children: error }),
|
|
4501
|
+
/* @__PURE__ */ jsx53("button", { className: "ba-link-button", type: "button", onClick: () => void load(), children: t("organization.retry") })
|
|
6110
4502
|
] });
|
|
6111
4503
|
}
|
|
6112
|
-
if (!organization) return /* @__PURE__ */
|
|
4504
|
+
if (!organization) return /* @__PURE__ */ jsx53("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
6113
4505
|
const membership = organization.members.find((member) => member.userId === user.id);
|
|
6114
|
-
if (!membership) return /* @__PURE__ */
|
|
4506
|
+
if (!membership) return /* @__PURE__ */ jsx53("p", { className: "ba-muted", children: t("organization.profile.notMember") });
|
|
6115
4507
|
const canManage = canManageOrganization(membership);
|
|
6116
4508
|
const visibleSections = canManage ? ["general", "members", "teams", "invitations", "danger"] : ["general", "members", "teams", "danger"];
|
|
6117
4509
|
const activeSection = visibleSections.includes(section) ? section : "general";
|
|
@@ -6120,16 +4512,16 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
6120
4512
|
setOrganization(null);
|
|
6121
4513
|
callback?.(removedOrganization);
|
|
6122
4514
|
};
|
|
6123
|
-
return /* @__PURE__ */
|
|
6124
|
-
/* @__PURE__ */
|
|
6125
|
-
/* @__PURE__ */
|
|
6126
|
-
/* @__PURE__ */
|
|
6127
|
-
/* @__PURE__ */
|
|
6128
|
-
/* @__PURE__ */
|
|
4515
|
+
return /* @__PURE__ */ jsxs50("article", { className: "ba-organization-profile", children: [
|
|
4516
|
+
/* @__PURE__ */ jsxs50("header", { className: "ba-organization-profile-heading", children: [
|
|
4517
|
+
/* @__PURE__ */ jsx53("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
4518
|
+
/* @__PURE__ */ jsxs50("span", { children: [
|
|
4519
|
+
/* @__PURE__ */ jsx53("h2", { className: "ba-title", children: organization.name }),
|
|
4520
|
+
/* @__PURE__ */ jsx53("p", { className: "ba-muted", children: organization.slug })
|
|
6129
4521
|
] })
|
|
6130
4522
|
] }),
|
|
6131
|
-
/* @__PURE__ */
|
|
6132
|
-
/* @__PURE__ */
|
|
4523
|
+
/* @__PURE__ */ jsxs50("div", { className: "ba-organization-profile-layout", children: [
|
|
4524
|
+
/* @__PURE__ */ jsx53("nav", { className: "ba-organization-profile-nav", "aria-label": t("organization.profile.nav.label"), children: visibleSections.map((item) => /* @__PURE__ */ jsx53(
|
|
6133
4525
|
"button",
|
|
6134
4526
|
{
|
|
6135
4527
|
className: "ba-profile-nav-item",
|
|
@@ -6140,12 +4532,12 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
6140
4532
|
},
|
|
6141
4533
|
item
|
|
6142
4534
|
)) }),
|
|
6143
|
-
/* @__PURE__ */
|
|
6144
|
-
activeSection === "general" && /* @__PURE__ */
|
|
6145
|
-
activeSection === "members" && /* @__PURE__ */
|
|
6146
|
-
activeSection === "teams" && /* @__PURE__ */
|
|
6147
|
-
activeSection === "invitations" && /* @__PURE__ */
|
|
6148
|
-
activeSection === "danger" && /* @__PURE__ */
|
|
4535
|
+
/* @__PURE__ */ jsxs50("div", { className: "ba-organization-profile-content", children: [
|
|
4536
|
+
activeSection === "general" && /* @__PURE__ */ jsx53(GeneralSection, { organization, canManage, onChanged: load }),
|
|
4537
|
+
activeSection === "members" && /* @__PURE__ */ jsx53(MembersSection, { organization, userId: user.id, canManage, onChanged: load }),
|
|
4538
|
+
activeSection === "teams" && /* @__PURE__ */ jsx53(React44.Suspense, { fallback: null, children: /* @__PURE__ */ jsx53(TeamsSection, { organization, membership }) }),
|
|
4539
|
+
activeSection === "invitations" && /* @__PURE__ */ jsx53(InvitationsSection, { organization, onChanged: load }),
|
|
4540
|
+
activeSection === "danger" && /* @__PURE__ */ jsx53(
|
|
6149
4541
|
DangerSection,
|
|
6150
4542
|
{
|
|
6151
4543
|
organization,
|
|
@@ -6160,7 +4552,7 @@ function OrganizationProfile({ organizationId, defaultSection = "general", onDel
|
|
|
6160
4552
|
}
|
|
6161
4553
|
|
|
6162
4554
|
// src/components/OrganizationSwitcher.tsx
|
|
6163
|
-
import { Fragment as Fragment13, jsx as
|
|
4555
|
+
import { Fragment as Fragment13, jsx as jsx54, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
6164
4556
|
function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChange } = {}) {
|
|
6165
4557
|
const t = useT();
|
|
6166
4558
|
const { config, isLoading: configLoading } = usePublicConfig();
|
|
@@ -6193,9 +4585,9 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
6193
4585
|
document.removeEventListener("keydown", onKeyDown);
|
|
6194
4586
|
};
|
|
6195
4587
|
}, [open]);
|
|
6196
|
-
if (configLoading || !isLoaded) return /* @__PURE__ */
|
|
4588
|
+
if (configLoading || !isLoaded) return /* @__PURE__ */ jsx54("div", { className: "ba-skeleton ba-organization-switcher-skeleton", "aria-label": t("organization.loading") });
|
|
6197
4589
|
if (config?.organizations !== true) return null;
|
|
6198
|
-
if (!isSignedIn) return /* @__PURE__ */
|
|
4590
|
+
if (!isSignedIn) return /* @__PURE__ */ jsx54("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
6199
4591
|
const select = (organization) => {
|
|
6200
4592
|
void run(
|
|
6201
4593
|
() => api.setActive({ organizationId: organization?.id ?? null }),
|
|
@@ -6238,9 +4630,9 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
6238
4630
|
else if (event.key === "ArrowDown") items[(current + 1 + items.length) % items.length]?.focus();
|
|
6239
4631
|
else items[(current - 1 + items.length) % items.length]?.focus();
|
|
6240
4632
|
};
|
|
6241
|
-
return /* @__PURE__ */
|
|
6242
|
-
/* @__PURE__ */
|
|
6243
|
-
/* @__PURE__ */
|
|
4633
|
+
return /* @__PURE__ */ jsxs51(Fragment13, { children: [
|
|
4634
|
+
/* @__PURE__ */ jsxs51("div", { ref: rootRef, className: "ba-organization-switcher", children: [
|
|
4635
|
+
/* @__PURE__ */ jsxs51(
|
|
6244
4636
|
"button",
|
|
6245
4637
|
{
|
|
6246
4638
|
ref: triggerRef,
|
|
@@ -6257,43 +4649,43 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
6257
4649
|
focusMenuItem(event.key === "ArrowDown" ? "first" : "last");
|
|
6258
4650
|
},
|
|
6259
4651
|
children: [
|
|
6260
|
-
/* @__PURE__ */
|
|
6261
|
-
/* @__PURE__ */
|
|
6262
|
-
/* @__PURE__ */
|
|
4652
|
+
/* @__PURE__ */ jsx54("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: active?.name.trim().charAt(0).toUpperCase() || "P" }),
|
|
4653
|
+
/* @__PURE__ */ jsx54("span", { children: active?.name ?? t("organization.personal") }),
|
|
4654
|
+
/* @__PURE__ */ jsx54("span", { "aria-hidden": "true", children: "\u2304" })
|
|
6263
4655
|
]
|
|
6264
4656
|
}
|
|
6265
4657
|
),
|
|
6266
|
-
open && /* @__PURE__ */
|
|
6267
|
-
isLoading ? /* @__PURE__ */
|
|
6268
|
-
showPersonalWorkspace && /* @__PURE__ */
|
|
6269
|
-
/* @__PURE__ */
|
|
6270
|
-
/* @__PURE__ */
|
|
4658
|
+
open && /* @__PURE__ */ jsxs51("div", { ref: menuRef, id: menuId, className: "ba-organization-menu", role: "menu", "aria-label": t("organization.switcher.label"), onKeyDown: onMenuKeyDown, children: [
|
|
4659
|
+
isLoading ? /* @__PURE__ */ jsx54("div", { className: "ba-skeleton" }) : /* @__PURE__ */ jsxs51(Fragment13, { children: [
|
|
4660
|
+
showPersonalWorkspace && /* @__PURE__ */ jsxs51("button", { className: "ba-organization-menu-item", type: "button", role: "menuitem", "aria-current": activeId === null ? "true" : void 0, disabled: pending, onClick: () => select(null), children: [
|
|
4661
|
+
/* @__PURE__ */ jsx54("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: "P" }),
|
|
4662
|
+
/* @__PURE__ */ jsx54("span", { children: t("organization.personal") })
|
|
6271
4663
|
] }),
|
|
6272
|
-
organizations?.map((organization) => /* @__PURE__ */
|
|
6273
|
-
/* @__PURE__ */
|
|
6274
|
-
/* @__PURE__ */
|
|
4664
|
+
organizations?.map((organization) => /* @__PURE__ */ jsxs51("button", { className: "ba-organization-menu-item", type: "button", role: "menuitem", "aria-current": activeId === organization.id ? "true" : void 0, disabled: pending, onClick: () => select(organization), children: [
|
|
4665
|
+
/* @__PURE__ */ jsx54("span", { className: "ba-organization-avatar", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
4666
|
+
/* @__PURE__ */ jsxs51("span", { children: [
|
|
6275
4667
|
organization.name,
|
|
6276
|
-
/* @__PURE__ */
|
|
4668
|
+
/* @__PURE__ */ jsx54("small", { children: organization.slug })
|
|
6277
4669
|
] })
|
|
6278
4670
|
] }, organization.id))
|
|
6279
4671
|
] }),
|
|
6280
|
-
(loadError || error) && /* @__PURE__ */
|
|
6281
|
-
/* @__PURE__ */
|
|
6282
|
-
loadError && /* @__PURE__ */
|
|
4672
|
+
(loadError || error) && /* @__PURE__ */ jsxs51("div", { className: "ba-inline-error", children: [
|
|
4673
|
+
/* @__PURE__ */ jsx54(FormError, { children: loadError ?? error }),
|
|
4674
|
+
loadError && /* @__PURE__ */ jsx54("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
|
|
6283
4675
|
] }),
|
|
6284
|
-
/* @__PURE__ */
|
|
6285
|
-
active && /* @__PURE__ */
|
|
4676
|
+
/* @__PURE__ */ jsxs51("div", { className: "ba-organization-menu-actions", children: [
|
|
4677
|
+
active && /* @__PURE__ */ jsx54("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
|
|
6286
4678
|
setOpen(false);
|
|
6287
4679
|
setDialog("profile");
|
|
6288
4680
|
}, children: t("organization.switcher.manage") }),
|
|
6289
|
-
/* @__PURE__ */
|
|
4681
|
+
/* @__PURE__ */ jsx54("button", { className: "ba-menu-item", type: "button", role: "menuitem", onClick: () => {
|
|
6290
4682
|
setOpen(false);
|
|
6291
4683
|
setDialog("create");
|
|
6292
4684
|
}, children: t("organization.switcher.create") })
|
|
6293
4685
|
] })
|
|
6294
4686
|
] })
|
|
6295
4687
|
] }),
|
|
6296
|
-
dialog === "create" && /* @__PURE__ */
|
|
4688
|
+
dialog === "create" && /* @__PURE__ */ jsx54(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: triggerRef, onClose: () => setDialog(null), children: /* @__PURE__ */ jsx54(
|
|
6297
4689
|
CreateOrganization,
|
|
6298
4690
|
{
|
|
6299
4691
|
title: null,
|
|
@@ -6307,13 +4699,13 @@ function OrganizationSwitcher({ showPersonalWorkspace = true, onOrganizationChan
|
|
|
6307
4699
|
}
|
|
6308
4700
|
}
|
|
6309
4701
|
) }),
|
|
6310
|
-
dialog === "profile" && active && /* @__PURE__ */
|
|
4702
|
+
dialog === "profile" && active && /* @__PURE__ */ jsx54(OrganizationModal, { title: t("organization.profile.title"), returnFocusRef: triggerRef, onClose: () => setDialog(null), children: /* @__PURE__ */ jsx54(OrganizationProfile, { organizationId: active.id, onDeleted: () => void afterProfileRemoval(), onLeft: () => void afterProfileRemoval() }) })
|
|
6311
4703
|
] });
|
|
6312
4704
|
}
|
|
6313
4705
|
|
|
6314
4706
|
// src/components/OrganizationList.tsx
|
|
6315
4707
|
import * as React46 from "react";
|
|
6316
|
-
import { Fragment as Fragment14, jsx as
|
|
4708
|
+
import { Fragment as Fragment14, jsx as jsx55, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
6317
4709
|
function OrganizationList({ onOrganizationChange } = {}) {
|
|
6318
4710
|
const t = useT();
|
|
6319
4711
|
const toServerError = useServerError();
|
|
@@ -6362,9 +4754,9 @@ function OrganizationList({ onOrganizationChange } = {}) {
|
|
|
6362
4754
|
invitationRequestRef.current += 1;
|
|
6363
4755
|
};
|
|
6364
4756
|
}, [isLoaded, loadInvitations, user?.id]);
|
|
6365
|
-
if (configLoading || !isLoaded) return /* @__PURE__ */
|
|
4757
|
+
if (configLoading || !isLoaded) return /* @__PURE__ */ jsx55("div", { className: "ba-skeleton", "aria-label": t("organization.loading") });
|
|
6366
4758
|
if (config?.organizations !== true) return null;
|
|
6367
|
-
if (!isSignedIn) return /* @__PURE__ */
|
|
4759
|
+
if (!isSignedIn) return /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.signedOut") });
|
|
6368
4760
|
const setActive = (organization) => {
|
|
6369
4761
|
void run(
|
|
6370
4762
|
() => api.setActive({ organizationId: organization.id }),
|
|
@@ -6405,66 +4797,66 @@ function OrganizationList({ onOrganizationChange } = {}) {
|
|
|
6405
4797
|
setDialog(null);
|
|
6406
4798
|
setProfileId(null);
|
|
6407
4799
|
};
|
|
6408
|
-
return /* @__PURE__ */
|
|
6409
|
-
/* @__PURE__ */
|
|
6410
|
-
/* @__PURE__ */
|
|
6411
|
-
/* @__PURE__ */
|
|
6412
|
-
/* @__PURE__ */
|
|
6413
|
-
/* @__PURE__ */
|
|
4800
|
+
return /* @__PURE__ */ jsxs52(Fragment14, { children: [
|
|
4801
|
+
/* @__PURE__ */ jsxs52("section", { className: "ba-organization-directory", children: [
|
|
4802
|
+
/* @__PURE__ */ jsxs52("header", { className: "ba-organization-directory-header", children: [
|
|
4803
|
+
/* @__PURE__ */ jsxs52("span", { children: [
|
|
4804
|
+
/* @__PURE__ */ jsx55("h2", { className: "ba-title", children: t("organization.list.title") }),
|
|
4805
|
+
/* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.list.description") })
|
|
6414
4806
|
] }),
|
|
6415
|
-
/* @__PURE__ */
|
|
4807
|
+
/* @__PURE__ */ jsx55("button", { className: "ba-button", type: "button", onClick: (event) => {
|
|
6416
4808
|
dialogReturnFocusRef.current = event.currentTarget;
|
|
6417
4809
|
setDialog("create");
|
|
6418
4810
|
}, children: t("organization.switcher.create") })
|
|
6419
4811
|
] }),
|
|
6420
|
-
(organizationError || error) && /* @__PURE__ */
|
|
6421
|
-
/* @__PURE__ */
|
|
6422
|
-
organizationError && /* @__PURE__ */
|
|
4812
|
+
(organizationError || error) && /* @__PURE__ */ jsxs52("div", { className: "ba-inline-error", children: [
|
|
4813
|
+
/* @__PURE__ */ jsx55(FormError, { children: organizationError ?? error }),
|
|
4814
|
+
organizationError && /* @__PURE__ */ jsx55("button", { className: "ba-link-button", type: "button", onClick: () => void refresh(), children: t("organization.retry") })
|
|
6423
4815
|
] }),
|
|
6424
|
-
isLoading ? /* @__PURE__ */
|
|
6425
|
-
/* @__PURE__ */
|
|
6426
|
-
/* @__PURE__ */
|
|
6427
|
-
] }) : organizations?.length ? /* @__PURE__ */
|
|
6428
|
-
/* @__PURE__ */
|
|
6429
|
-
/* @__PURE__ */
|
|
6430
|
-
/* @__PURE__ */
|
|
6431
|
-
/* @__PURE__ */
|
|
4816
|
+
isLoading ? /* @__PURE__ */ jsxs52("div", { className: "ba-organization-card-grid", children: [
|
|
4817
|
+
/* @__PURE__ */ jsx55("div", { className: "ba-skeleton" }),
|
|
4818
|
+
/* @__PURE__ */ jsx55("div", { className: "ba-skeleton" })
|
|
4819
|
+
] }) : organizations?.length ? /* @__PURE__ */ jsx55("ul", { className: "ba-organization-card-grid", children: organizations.map((organization) => /* @__PURE__ */ jsxs52("li", { className: "ba-organization-card", children: [
|
|
4820
|
+
/* @__PURE__ */ jsx55("span", { className: "ba-organization-avatar ba-organization-avatar-large", "aria-hidden": "true", children: organization.name.trim().charAt(0).toUpperCase() || "?" }),
|
|
4821
|
+
/* @__PURE__ */ jsxs52("span", { className: "ba-organization-card-copy", children: [
|
|
4822
|
+
/* @__PURE__ */ jsx55("strong", { children: organization.name }),
|
|
4823
|
+
/* @__PURE__ */ jsx55("small", { children: /* @__PURE__ */ jsx55(Bidi, { children: organization.slug }) })
|
|
6432
4824
|
] }),
|
|
6433
|
-
activeId === organization.id && /* @__PURE__ */
|
|
6434
|
-
/* @__PURE__ */
|
|
6435
|
-
activeId !== organization.id && /* @__PURE__ */
|
|
6436
|
-
/* @__PURE__ */
|
|
4825
|
+
activeId === organization.id && /* @__PURE__ */ jsx55("span", { className: "ba-organization-active", children: t("organization.list.active") }),
|
|
4826
|
+
/* @__PURE__ */ jsxs52("span", { className: "ba-organization-card-actions", children: [
|
|
4827
|
+
activeId !== organization.id && /* @__PURE__ */ jsx55("button", { className: "ba-button ba-button-secondary", type: "button", disabled: pending, onClick: () => setActive(organization), children: t("organization.list.switch") }),
|
|
4828
|
+
/* @__PURE__ */ jsx55("button", { className: "ba-link-button", type: "button", onClick: (event) => openProfile(organization, event.currentTarget), children: t("organization.list.manage") })
|
|
6437
4829
|
] })
|
|
6438
|
-
] }, organization.id)) }) : organizationError ? null : /* @__PURE__ */
|
|
6439
|
-
/* @__PURE__ */
|
|
6440
|
-
/* @__PURE__ */
|
|
6441
|
-
/* @__PURE__ */
|
|
6442
|
-
/* @__PURE__ */
|
|
4830
|
+
] }, organization.id)) }) : organizationError ? null : /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.list.empty") }),
|
|
4831
|
+
/* @__PURE__ */ jsxs52("section", { className: "ba-organization-user-invitations", children: [
|
|
4832
|
+
/* @__PURE__ */ jsxs52("header", { className: "ba-organization-section-header", children: [
|
|
4833
|
+
/* @__PURE__ */ jsx55("h3", { className: "ba-title", children: t("organization.list.invitationsTitle") }),
|
|
4834
|
+
/* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.list.invitationsDescription") })
|
|
6443
4835
|
] }),
|
|
6444
|
-
invitationError && /* @__PURE__ */
|
|
6445
|
-
/* @__PURE__ */
|
|
6446
|
-
/* @__PURE__ */
|
|
4836
|
+
invitationError && /* @__PURE__ */ jsxs52("div", { className: "ba-inline-error", children: [
|
|
4837
|
+
/* @__PURE__ */ jsx55(FormError, { children: invitationError }),
|
|
4838
|
+
/* @__PURE__ */ jsx55("button", { className: "ba-link-button", type: "button", onClick: () => void loadInvitations(), children: t("organization.retry") })
|
|
6447
4839
|
] }),
|
|
6448
|
-
invitations?.length ? /* @__PURE__ */
|
|
6449
|
-
/* @__PURE__ */
|
|
6450
|
-
/* @__PURE__ */
|
|
6451
|
-
/* @__PURE__ */
|
|
4840
|
+
invitations?.length ? /* @__PURE__ */ jsx55("ul", { className: "ba-organization-list", children: invitations.map((invitation) => /* @__PURE__ */ jsxs52("li", { className: "ba-organization-invitation", children: [
|
|
4841
|
+
/* @__PURE__ */ jsxs52("span", { children: [
|
|
4842
|
+
/* @__PURE__ */ jsx55("strong", { children: invitation.organizationName }),
|
|
4843
|
+
/* @__PURE__ */ jsx55("small", { children: organizationRoleLabel(invitation.role, t) })
|
|
6452
4844
|
] }),
|
|
6453
|
-
/* @__PURE__ */
|
|
6454
|
-
/* @__PURE__ */
|
|
6455
|
-
/* @__PURE__ */
|
|
4845
|
+
/* @__PURE__ */ jsxs52("span", { className: "ba-organization-card-actions", children: [
|
|
4846
|
+
/* @__PURE__ */ jsx55("button", { className: "ba-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "accept"), children: t("organization.list.accept") }),
|
|
4847
|
+
/* @__PURE__ */ jsx55("button", { className: "ba-link-button", type: "button", disabled: pending, onClick: () => invitationAction(invitation, "reject"), children: t("organization.list.reject") })
|
|
6456
4848
|
] })
|
|
6457
|
-
] }, invitation.id)) }) : invitationError ? null : invitations === null ? /* @__PURE__ */
|
|
4849
|
+
] }, invitation.id)) }) : invitationError ? null : invitations === null ? /* @__PURE__ */ jsx55("div", { className: "ba-skeleton" }) : /* @__PURE__ */ jsx55("p", { className: "ba-muted", children: t("organization.list.noInvitations") })
|
|
6458
4850
|
] })
|
|
6459
4851
|
] }),
|
|
6460
|
-
dialog === "create" && /* @__PURE__ */
|
|
4852
|
+
dialog === "create" && /* @__PURE__ */ jsx55(OrganizationModal, { title: t("organization.create.title"), returnFocusRef: dialogReturnFocusRef, onClose: () => setDialog(null), children: /* @__PURE__ */ jsx55(CreateOrganization, { title: null, onCreated: () => {
|
|
6461
4853
|
void (async () => {
|
|
6462
4854
|
await refresh();
|
|
6463
4855
|
await session.refetch({ query: { disableCookieCache: true } });
|
|
6464
4856
|
setDialog(null);
|
|
6465
4857
|
})();
|
|
6466
4858
|
} }) }),
|
|
6467
|
-
dialog === "profile" && profileId && /* @__PURE__ */
|
|
4859
|
+
dialog === "profile" && profileId && /* @__PURE__ */ jsx55(OrganizationModal, { title: t("organization.profile.title"), returnFocusRef: dialogReturnFocusRef, onClose: () => setDialog(null), children: /* @__PURE__ */ jsx55(OrganizationProfile, { organizationId: profileId, onDeleted: () => void afterProfileRemoval(), onLeft: () => void afterProfileRemoval() }) })
|
|
6468
4860
|
] });
|
|
6469
4861
|
}
|
|
6470
4862
|
|