@nok-integration/storefront-react 0.17.2 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1300 -89
- package/dist/index.mjs +1367 -589
- package/dist/standalone/storefront.mjs +1367 -589
- package/dist/standalone/styles.css +1187 -274
- package/dist/styles.css +1187 -274
- package/package.json +9 -26
package/dist/index.mjs
CHANGED
|
@@ -764,7 +764,7 @@ function requireTypes() {
|
|
|
764
764
|
const result = await ((0, parseUtil_js_1.isAsync)(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
|
|
765
765
|
return handleResult(ctx, result);
|
|
766
766
|
}
|
|
767
|
-
refine(
|
|
767
|
+
refine(check2, message2) {
|
|
768
768
|
const getIssueProperties = (val) => {
|
|
769
769
|
if (typeof message2 === "string" || typeof message2 === "undefined") {
|
|
770
770
|
return { message: message2 };
|
|
@@ -775,7 +775,7 @@ function requireTypes() {
|
|
|
775
775
|
}
|
|
776
776
|
};
|
|
777
777
|
return this._refinement((val, ctx) => {
|
|
778
|
-
const result =
|
|
778
|
+
const result = check2(val);
|
|
779
779
|
const setError = () => ctx.addIssue({
|
|
780
780
|
code: ZodError_js_1.ZodIssueCode.custom,
|
|
781
781
|
...getIssueProperties(val)
|
|
@@ -798,9 +798,9 @@ function requireTypes() {
|
|
|
798
798
|
}
|
|
799
799
|
});
|
|
800
800
|
}
|
|
801
|
-
refinement(
|
|
801
|
+
refinement(check2, refinementData) {
|
|
802
802
|
return this._refinement((val, ctx) => {
|
|
803
|
-
if (!
|
|
803
|
+
if (!check2(val)) {
|
|
804
804
|
ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
|
|
805
805
|
return false;
|
|
806
806
|
} else {
|
|
@@ -1025,70 +1025,70 @@ function requireTypes() {
|
|
|
1025
1025
|
}
|
|
1026
1026
|
const status = new parseUtil_js_1.ParseStatus();
|
|
1027
1027
|
let ctx = void 0;
|
|
1028
|
-
for (const
|
|
1029
|
-
if (
|
|
1030
|
-
if (input.data.length <
|
|
1028
|
+
for (const check2 of this._def.checks) {
|
|
1029
|
+
if (check2.kind === "min") {
|
|
1030
|
+
if (input.data.length < check2.value) {
|
|
1031
1031
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1032
1032
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1033
1033
|
code: ZodError_js_1.ZodIssueCode.too_small,
|
|
1034
|
-
minimum:
|
|
1034
|
+
minimum: check2.value,
|
|
1035
1035
|
type: "string",
|
|
1036
1036
|
inclusive: true,
|
|
1037
1037
|
exact: false,
|
|
1038
|
-
message:
|
|
1038
|
+
message: check2.message
|
|
1039
1039
|
});
|
|
1040
1040
|
status.dirty();
|
|
1041
1041
|
}
|
|
1042
|
-
} else if (
|
|
1043
|
-
if (input.data.length >
|
|
1042
|
+
} else if (check2.kind === "max") {
|
|
1043
|
+
if (input.data.length > check2.value) {
|
|
1044
1044
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1045
1045
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1046
1046
|
code: ZodError_js_1.ZodIssueCode.too_big,
|
|
1047
|
-
maximum:
|
|
1047
|
+
maximum: check2.value,
|
|
1048
1048
|
type: "string",
|
|
1049
1049
|
inclusive: true,
|
|
1050
1050
|
exact: false,
|
|
1051
|
-
message:
|
|
1051
|
+
message: check2.message
|
|
1052
1052
|
});
|
|
1053
1053
|
status.dirty();
|
|
1054
1054
|
}
|
|
1055
|
-
} else if (
|
|
1056
|
-
const tooBig = input.data.length >
|
|
1057
|
-
const tooSmall = input.data.length <
|
|
1055
|
+
} else if (check2.kind === "length") {
|
|
1056
|
+
const tooBig = input.data.length > check2.value;
|
|
1057
|
+
const tooSmall = input.data.length < check2.value;
|
|
1058
1058
|
if (tooBig || tooSmall) {
|
|
1059
1059
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1060
1060
|
if (tooBig) {
|
|
1061
1061
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1062
1062
|
code: ZodError_js_1.ZodIssueCode.too_big,
|
|
1063
|
-
maximum:
|
|
1063
|
+
maximum: check2.value,
|
|
1064
1064
|
type: "string",
|
|
1065
1065
|
inclusive: true,
|
|
1066
1066
|
exact: true,
|
|
1067
|
-
message:
|
|
1067
|
+
message: check2.message
|
|
1068
1068
|
});
|
|
1069
1069
|
} else if (tooSmall) {
|
|
1070
1070
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1071
1071
|
code: ZodError_js_1.ZodIssueCode.too_small,
|
|
1072
|
-
minimum:
|
|
1072
|
+
minimum: check2.value,
|
|
1073
1073
|
type: "string",
|
|
1074
1074
|
inclusive: true,
|
|
1075
1075
|
exact: true,
|
|
1076
|
-
message:
|
|
1076
|
+
message: check2.message
|
|
1077
1077
|
});
|
|
1078
1078
|
}
|
|
1079
1079
|
status.dirty();
|
|
1080
1080
|
}
|
|
1081
|
-
} else if (
|
|
1081
|
+
} else if (check2.kind === "email") {
|
|
1082
1082
|
if (!emailRegex.test(input.data)) {
|
|
1083
1083
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1084
1084
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1085
1085
|
validation: "email",
|
|
1086
1086
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1087
|
-
message:
|
|
1087
|
+
message: check2.message
|
|
1088
1088
|
});
|
|
1089
1089
|
status.dirty();
|
|
1090
1090
|
}
|
|
1091
|
-
} else if (
|
|
1091
|
+
} else if (check2.kind === "emoji") {
|
|
1092
1092
|
if (!emojiRegex) {
|
|
1093
1093
|
emojiRegex = new RegExp(_emojiRegex, "u");
|
|
1094
1094
|
}
|
|
@@ -1097,61 +1097,61 @@ function requireTypes() {
|
|
|
1097
1097
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1098
1098
|
validation: "emoji",
|
|
1099
1099
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1100
|
-
message:
|
|
1100
|
+
message: check2.message
|
|
1101
1101
|
});
|
|
1102
1102
|
status.dirty();
|
|
1103
1103
|
}
|
|
1104
|
-
} else if (
|
|
1104
|
+
} else if (check2.kind === "uuid") {
|
|
1105
1105
|
if (!uuidRegex.test(input.data)) {
|
|
1106
1106
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1107
1107
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1108
1108
|
validation: "uuid",
|
|
1109
1109
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1110
|
-
message:
|
|
1110
|
+
message: check2.message
|
|
1111
1111
|
});
|
|
1112
1112
|
status.dirty();
|
|
1113
1113
|
}
|
|
1114
|
-
} else if (
|
|
1114
|
+
} else if (check2.kind === "nanoid") {
|
|
1115
1115
|
if (!nanoidRegex.test(input.data)) {
|
|
1116
1116
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1117
1117
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1118
1118
|
validation: "nanoid",
|
|
1119
1119
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1120
|
-
message:
|
|
1120
|
+
message: check2.message
|
|
1121
1121
|
});
|
|
1122
1122
|
status.dirty();
|
|
1123
1123
|
}
|
|
1124
|
-
} else if (
|
|
1124
|
+
} else if (check2.kind === "cuid") {
|
|
1125
1125
|
if (!cuidRegex.test(input.data)) {
|
|
1126
1126
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1127
1127
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1128
1128
|
validation: "cuid",
|
|
1129
1129
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1130
|
-
message:
|
|
1130
|
+
message: check2.message
|
|
1131
1131
|
});
|
|
1132
1132
|
status.dirty();
|
|
1133
1133
|
}
|
|
1134
|
-
} else if (
|
|
1134
|
+
} else if (check2.kind === "cuid2") {
|
|
1135
1135
|
if (!cuid2Regex.test(input.data)) {
|
|
1136
1136
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1137
1137
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1138
1138
|
validation: "cuid2",
|
|
1139
1139
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1140
|
-
message:
|
|
1140
|
+
message: check2.message
|
|
1141
1141
|
});
|
|
1142
1142
|
status.dirty();
|
|
1143
1143
|
}
|
|
1144
|
-
} else if (
|
|
1144
|
+
} else if (check2.kind === "ulid") {
|
|
1145
1145
|
if (!ulidRegex.test(input.data)) {
|
|
1146
1146
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1147
1147
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1148
1148
|
validation: "ulid",
|
|
1149
1149
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1150
|
-
message:
|
|
1150
|
+
message: check2.message
|
|
1151
1151
|
});
|
|
1152
1152
|
status.dirty();
|
|
1153
1153
|
}
|
|
1154
|
-
} else if (
|
|
1154
|
+
} else if (check2.kind === "url") {
|
|
1155
1155
|
try {
|
|
1156
1156
|
new URL(input.data);
|
|
1157
1157
|
} catch {
|
|
@@ -1159,153 +1159,153 @@ function requireTypes() {
|
|
|
1159
1159
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1160
1160
|
validation: "url",
|
|
1161
1161
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1162
|
-
message:
|
|
1162
|
+
message: check2.message
|
|
1163
1163
|
});
|
|
1164
1164
|
status.dirty();
|
|
1165
1165
|
}
|
|
1166
|
-
} else if (
|
|
1167
|
-
|
|
1168
|
-
const testResult =
|
|
1166
|
+
} else if (check2.kind === "regex") {
|
|
1167
|
+
check2.regex.lastIndex = 0;
|
|
1168
|
+
const testResult = check2.regex.test(input.data);
|
|
1169
1169
|
if (!testResult) {
|
|
1170
1170
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1171
1171
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1172
1172
|
validation: "regex",
|
|
1173
1173
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1174
|
-
message:
|
|
1174
|
+
message: check2.message
|
|
1175
1175
|
});
|
|
1176
1176
|
status.dirty();
|
|
1177
1177
|
}
|
|
1178
|
-
} else if (
|
|
1178
|
+
} else if (check2.kind === "trim") {
|
|
1179
1179
|
input.data = input.data.trim();
|
|
1180
|
-
} else if (
|
|
1181
|
-
if (!input.data.includes(
|
|
1180
|
+
} else if (check2.kind === "includes") {
|
|
1181
|
+
if (!input.data.includes(check2.value, check2.position)) {
|
|
1182
1182
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1183
1183
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1184
1184
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1185
|
-
validation: { includes:
|
|
1186
|
-
message:
|
|
1185
|
+
validation: { includes: check2.value, position: check2.position },
|
|
1186
|
+
message: check2.message
|
|
1187
1187
|
});
|
|
1188
1188
|
status.dirty();
|
|
1189
1189
|
}
|
|
1190
|
-
} else if (
|
|
1190
|
+
} else if (check2.kind === "toLowerCase") {
|
|
1191
1191
|
input.data = input.data.toLowerCase();
|
|
1192
|
-
} else if (
|
|
1192
|
+
} else if (check2.kind === "toUpperCase") {
|
|
1193
1193
|
input.data = input.data.toUpperCase();
|
|
1194
|
-
} else if (
|
|
1195
|
-
if (!input.data.startsWith(
|
|
1194
|
+
} else if (check2.kind === "startsWith") {
|
|
1195
|
+
if (!input.data.startsWith(check2.value)) {
|
|
1196
1196
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1197
1197
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1198
1198
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1199
|
-
validation: { startsWith:
|
|
1200
|
-
message:
|
|
1199
|
+
validation: { startsWith: check2.value },
|
|
1200
|
+
message: check2.message
|
|
1201
1201
|
});
|
|
1202
1202
|
status.dirty();
|
|
1203
1203
|
}
|
|
1204
|
-
} else if (
|
|
1205
|
-
if (!input.data.endsWith(
|
|
1204
|
+
} else if (check2.kind === "endsWith") {
|
|
1205
|
+
if (!input.data.endsWith(check2.value)) {
|
|
1206
1206
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1207
1207
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1208
1208
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1209
|
-
validation: { endsWith:
|
|
1210
|
-
message:
|
|
1209
|
+
validation: { endsWith: check2.value },
|
|
1210
|
+
message: check2.message
|
|
1211
1211
|
});
|
|
1212
1212
|
status.dirty();
|
|
1213
1213
|
}
|
|
1214
|
-
} else if (
|
|
1215
|
-
const regex = datetimeRegex(
|
|
1214
|
+
} else if (check2.kind === "datetime") {
|
|
1215
|
+
const regex = datetimeRegex(check2);
|
|
1216
1216
|
if (!regex.test(input.data)) {
|
|
1217
1217
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1218
1218
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1219
1219
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1220
1220
|
validation: "datetime",
|
|
1221
|
-
message:
|
|
1221
|
+
message: check2.message
|
|
1222
1222
|
});
|
|
1223
1223
|
status.dirty();
|
|
1224
1224
|
}
|
|
1225
|
-
} else if (
|
|
1225
|
+
} else if (check2.kind === "date") {
|
|
1226
1226
|
const regex = dateRegex;
|
|
1227
1227
|
if (!regex.test(input.data)) {
|
|
1228
1228
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1229
1229
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1230
1230
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1231
1231
|
validation: "date",
|
|
1232
|
-
message:
|
|
1232
|
+
message: check2.message
|
|
1233
1233
|
});
|
|
1234
1234
|
status.dirty();
|
|
1235
1235
|
}
|
|
1236
|
-
} else if (
|
|
1237
|
-
const regex = timeRegex(
|
|
1236
|
+
} else if (check2.kind === "time") {
|
|
1237
|
+
const regex = timeRegex(check2);
|
|
1238
1238
|
if (!regex.test(input.data)) {
|
|
1239
1239
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1240
1240
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1241
1241
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1242
1242
|
validation: "time",
|
|
1243
|
-
message:
|
|
1243
|
+
message: check2.message
|
|
1244
1244
|
});
|
|
1245
1245
|
status.dirty();
|
|
1246
1246
|
}
|
|
1247
|
-
} else if (
|
|
1247
|
+
} else if (check2.kind === "duration") {
|
|
1248
1248
|
if (!durationRegex.test(input.data)) {
|
|
1249
1249
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1250
1250
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1251
1251
|
validation: "duration",
|
|
1252
1252
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1253
|
-
message:
|
|
1253
|
+
message: check2.message
|
|
1254
1254
|
});
|
|
1255
1255
|
status.dirty();
|
|
1256
1256
|
}
|
|
1257
|
-
} else if (
|
|
1258
|
-
if (!isValidIP(input.data,
|
|
1257
|
+
} else if (check2.kind === "ip") {
|
|
1258
|
+
if (!isValidIP(input.data, check2.version)) {
|
|
1259
1259
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1260
1260
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1261
1261
|
validation: "ip",
|
|
1262
1262
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1263
|
-
message:
|
|
1263
|
+
message: check2.message
|
|
1264
1264
|
});
|
|
1265
1265
|
status.dirty();
|
|
1266
1266
|
}
|
|
1267
|
-
} else if (
|
|
1268
|
-
if (!isValidJWT(input.data,
|
|
1267
|
+
} else if (check2.kind === "jwt") {
|
|
1268
|
+
if (!isValidJWT(input.data, check2.alg)) {
|
|
1269
1269
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1270
1270
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1271
1271
|
validation: "jwt",
|
|
1272
1272
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1273
|
-
message:
|
|
1273
|
+
message: check2.message
|
|
1274
1274
|
});
|
|
1275
1275
|
status.dirty();
|
|
1276
1276
|
}
|
|
1277
|
-
} else if (
|
|
1278
|
-
if (!isValidCidr(input.data,
|
|
1277
|
+
} else if (check2.kind === "cidr") {
|
|
1278
|
+
if (!isValidCidr(input.data, check2.version)) {
|
|
1279
1279
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1280
1280
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1281
1281
|
validation: "cidr",
|
|
1282
1282
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1283
|
-
message:
|
|
1283
|
+
message: check2.message
|
|
1284
1284
|
});
|
|
1285
1285
|
status.dirty();
|
|
1286
1286
|
}
|
|
1287
|
-
} else if (
|
|
1287
|
+
} else if (check2.kind === "base64") {
|
|
1288
1288
|
if (!base64Regex.test(input.data)) {
|
|
1289
1289
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1290
1290
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1291
1291
|
validation: "base64",
|
|
1292
1292
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1293
|
-
message:
|
|
1293
|
+
message: check2.message
|
|
1294
1294
|
});
|
|
1295
1295
|
status.dirty();
|
|
1296
1296
|
}
|
|
1297
|
-
} else if (
|
|
1297
|
+
} else if (check2.kind === "base64url") {
|
|
1298
1298
|
if (!base64urlRegex.test(input.data)) {
|
|
1299
1299
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1300
1300
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1301
1301
|
validation: "base64url",
|
|
1302
1302
|
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
1303
|
-
message:
|
|
1303
|
+
message: check2.message
|
|
1304
1304
|
});
|
|
1305
1305
|
status.dirty();
|
|
1306
1306
|
}
|
|
1307
1307
|
} else {
|
|
1308
|
-
util_js_1.util.assertNever(
|
|
1308
|
+
util_js_1.util.assertNever(check2);
|
|
1309
1309
|
}
|
|
1310
1310
|
}
|
|
1311
1311
|
return { status: status.value, value: input.data };
|
|
@@ -1317,10 +1317,10 @@ function requireTypes() {
|
|
|
1317
1317
|
...errorUtil_js_1.errorUtil.errToObj(message2)
|
|
1318
1318
|
});
|
|
1319
1319
|
}
|
|
1320
|
-
_addCheck(
|
|
1320
|
+
_addCheck(check2) {
|
|
1321
1321
|
return new ZodString({
|
|
1322
1322
|
...this._def,
|
|
1323
|
-
checks: [...this._def.checks,
|
|
1323
|
+
checks: [...this._def.checks, check2]
|
|
1324
1324
|
});
|
|
1325
1325
|
}
|
|
1326
1326
|
email(message2) {
|
|
@@ -1555,12 +1555,12 @@ function requireTypes() {
|
|
|
1555
1555
|
...processCreateParams(params)
|
|
1556
1556
|
});
|
|
1557
1557
|
};
|
|
1558
|
-
function floatSafeRemainder(val,
|
|
1558
|
+
function floatSafeRemainder(val, step3) {
|
|
1559
1559
|
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
1560
|
-
const stepDecCount = (
|
|
1560
|
+
const stepDecCount = (step3.toString().split(".")[1] || "").length;
|
|
1561
1561
|
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
1562
1562
|
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
|
1563
|
-
const stepInt = Number.parseInt(
|
|
1563
|
+
const stepInt = Number.parseInt(step3.toFixed(decCount).replace(".", ""));
|
|
1564
1564
|
return valInt % stepInt / 10 ** decCount;
|
|
1565
1565
|
}
|
|
1566
1566
|
class ZodNumber extends ZodType {
|
|
@@ -1586,67 +1586,67 @@ function requireTypes() {
|
|
|
1586
1586
|
}
|
|
1587
1587
|
let ctx = void 0;
|
|
1588
1588
|
const status = new parseUtil_js_1.ParseStatus();
|
|
1589
|
-
for (const
|
|
1590
|
-
if (
|
|
1589
|
+
for (const check2 of this._def.checks) {
|
|
1590
|
+
if (check2.kind === "int") {
|
|
1591
1591
|
if (!util_js_1.util.isInteger(input.data)) {
|
|
1592
1592
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1593
1593
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1594
1594
|
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
1595
1595
|
expected: "integer",
|
|
1596
1596
|
received: "float",
|
|
1597
|
-
message:
|
|
1597
|
+
message: check2.message
|
|
1598
1598
|
});
|
|
1599
1599
|
status.dirty();
|
|
1600
1600
|
}
|
|
1601
|
-
} else if (
|
|
1602
|
-
const tooSmall =
|
|
1601
|
+
} else if (check2.kind === "min") {
|
|
1602
|
+
const tooSmall = check2.inclusive ? input.data < check2.value : input.data <= check2.value;
|
|
1603
1603
|
if (tooSmall) {
|
|
1604
1604
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1605
1605
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1606
1606
|
code: ZodError_js_1.ZodIssueCode.too_small,
|
|
1607
|
-
minimum:
|
|
1607
|
+
minimum: check2.value,
|
|
1608
1608
|
type: "number",
|
|
1609
|
-
inclusive:
|
|
1609
|
+
inclusive: check2.inclusive,
|
|
1610
1610
|
exact: false,
|
|
1611
|
-
message:
|
|
1611
|
+
message: check2.message
|
|
1612
1612
|
});
|
|
1613
1613
|
status.dirty();
|
|
1614
1614
|
}
|
|
1615
|
-
} else if (
|
|
1616
|
-
const tooBig =
|
|
1615
|
+
} else if (check2.kind === "max") {
|
|
1616
|
+
const tooBig = check2.inclusive ? input.data > check2.value : input.data >= check2.value;
|
|
1617
1617
|
if (tooBig) {
|
|
1618
1618
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1619
1619
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1620
1620
|
code: ZodError_js_1.ZodIssueCode.too_big,
|
|
1621
|
-
maximum:
|
|
1621
|
+
maximum: check2.value,
|
|
1622
1622
|
type: "number",
|
|
1623
|
-
inclusive:
|
|
1623
|
+
inclusive: check2.inclusive,
|
|
1624
1624
|
exact: false,
|
|
1625
|
-
message:
|
|
1625
|
+
message: check2.message
|
|
1626
1626
|
});
|
|
1627
1627
|
status.dirty();
|
|
1628
1628
|
}
|
|
1629
|
-
} else if (
|
|
1630
|
-
if (floatSafeRemainder(input.data,
|
|
1629
|
+
} else if (check2.kind === "multipleOf") {
|
|
1630
|
+
if (floatSafeRemainder(input.data, check2.value) !== 0) {
|
|
1631
1631
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1632
1632
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1633
1633
|
code: ZodError_js_1.ZodIssueCode.not_multiple_of,
|
|
1634
|
-
multipleOf:
|
|
1635
|
-
message:
|
|
1634
|
+
multipleOf: check2.value,
|
|
1635
|
+
message: check2.message
|
|
1636
1636
|
});
|
|
1637
1637
|
status.dirty();
|
|
1638
1638
|
}
|
|
1639
|
-
} else if (
|
|
1639
|
+
} else if (check2.kind === "finite") {
|
|
1640
1640
|
if (!Number.isFinite(input.data)) {
|
|
1641
1641
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1642
1642
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1643
1643
|
code: ZodError_js_1.ZodIssueCode.not_finite,
|
|
1644
|
-
message:
|
|
1644
|
+
message: check2.message
|
|
1645
1645
|
});
|
|
1646
1646
|
status.dirty();
|
|
1647
1647
|
}
|
|
1648
1648
|
} else {
|
|
1649
|
-
util_js_1.util.assertNever(
|
|
1649
|
+
util_js_1.util.assertNever(check2);
|
|
1650
1650
|
}
|
|
1651
1651
|
}
|
|
1652
1652
|
return { status: status.value, value: input.data };
|
|
@@ -1677,10 +1677,10 @@ function requireTypes() {
|
|
|
1677
1677
|
]
|
|
1678
1678
|
});
|
|
1679
1679
|
}
|
|
1680
|
-
_addCheck(
|
|
1680
|
+
_addCheck(check2) {
|
|
1681
1681
|
return new ZodNumber({
|
|
1682
1682
|
...this._def,
|
|
1683
|
-
checks: [...this._def.checks,
|
|
1683
|
+
checks: [...this._def.checks, check2]
|
|
1684
1684
|
});
|
|
1685
1685
|
}
|
|
1686
1686
|
int(message2) {
|
|
@@ -1816,45 +1816,45 @@ function requireTypes() {
|
|
|
1816
1816
|
}
|
|
1817
1817
|
let ctx = void 0;
|
|
1818
1818
|
const status = new parseUtil_js_1.ParseStatus();
|
|
1819
|
-
for (const
|
|
1820
|
-
if (
|
|
1821
|
-
const tooSmall =
|
|
1819
|
+
for (const check2 of this._def.checks) {
|
|
1820
|
+
if (check2.kind === "min") {
|
|
1821
|
+
const tooSmall = check2.inclusive ? input.data < check2.value : input.data <= check2.value;
|
|
1822
1822
|
if (tooSmall) {
|
|
1823
1823
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1824
1824
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1825
1825
|
code: ZodError_js_1.ZodIssueCode.too_small,
|
|
1826
1826
|
type: "bigint",
|
|
1827
|
-
minimum:
|
|
1828
|
-
inclusive:
|
|
1829
|
-
message:
|
|
1827
|
+
minimum: check2.value,
|
|
1828
|
+
inclusive: check2.inclusive,
|
|
1829
|
+
message: check2.message
|
|
1830
1830
|
});
|
|
1831
1831
|
status.dirty();
|
|
1832
1832
|
}
|
|
1833
|
-
} else if (
|
|
1834
|
-
const tooBig =
|
|
1833
|
+
} else if (check2.kind === "max") {
|
|
1834
|
+
const tooBig = check2.inclusive ? input.data > check2.value : input.data >= check2.value;
|
|
1835
1835
|
if (tooBig) {
|
|
1836
1836
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1837
1837
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1838
1838
|
code: ZodError_js_1.ZodIssueCode.too_big,
|
|
1839
1839
|
type: "bigint",
|
|
1840
|
-
maximum:
|
|
1841
|
-
inclusive:
|
|
1842
|
-
message:
|
|
1840
|
+
maximum: check2.value,
|
|
1841
|
+
inclusive: check2.inclusive,
|
|
1842
|
+
message: check2.message
|
|
1843
1843
|
});
|
|
1844
1844
|
status.dirty();
|
|
1845
1845
|
}
|
|
1846
|
-
} else if (
|
|
1847
|
-
if (input.data %
|
|
1846
|
+
} else if (check2.kind === "multipleOf") {
|
|
1847
|
+
if (input.data % check2.value !== BigInt(0)) {
|
|
1848
1848
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1849
1849
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1850
1850
|
code: ZodError_js_1.ZodIssueCode.not_multiple_of,
|
|
1851
|
-
multipleOf:
|
|
1852
|
-
message:
|
|
1851
|
+
multipleOf: check2.value,
|
|
1852
|
+
message: check2.message
|
|
1853
1853
|
});
|
|
1854
1854
|
status.dirty();
|
|
1855
1855
|
}
|
|
1856
1856
|
} else {
|
|
1857
|
-
util_js_1.util.assertNever(
|
|
1857
|
+
util_js_1.util.assertNever(check2);
|
|
1858
1858
|
}
|
|
1859
1859
|
}
|
|
1860
1860
|
return { status: status.value, value: input.data };
|
|
@@ -1894,10 +1894,10 @@ function requireTypes() {
|
|
|
1894
1894
|
]
|
|
1895
1895
|
});
|
|
1896
1896
|
}
|
|
1897
|
-
_addCheck(
|
|
1897
|
+
_addCheck(check2) {
|
|
1898
1898
|
return new ZodBigInt({
|
|
1899
1899
|
...this._def,
|
|
1900
|
-
checks: [...this._def.checks,
|
|
1900
|
+
checks: [...this._def.checks, check2]
|
|
1901
1901
|
});
|
|
1902
1902
|
}
|
|
1903
1903
|
positive(message2) {
|
|
@@ -2019,35 +2019,35 @@ function requireTypes() {
|
|
|
2019
2019
|
}
|
|
2020
2020
|
const status = new parseUtil_js_1.ParseStatus();
|
|
2021
2021
|
let ctx = void 0;
|
|
2022
|
-
for (const
|
|
2023
|
-
if (
|
|
2024
|
-
if (input.data.getTime() <
|
|
2022
|
+
for (const check2 of this._def.checks) {
|
|
2023
|
+
if (check2.kind === "min") {
|
|
2024
|
+
if (input.data.getTime() < check2.value) {
|
|
2025
2025
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2026
2026
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
2027
2027
|
code: ZodError_js_1.ZodIssueCode.too_small,
|
|
2028
|
-
message:
|
|
2028
|
+
message: check2.message,
|
|
2029
2029
|
inclusive: true,
|
|
2030
2030
|
exact: false,
|
|
2031
|
-
minimum:
|
|
2031
|
+
minimum: check2.value,
|
|
2032
2032
|
type: "date"
|
|
2033
2033
|
});
|
|
2034
2034
|
status.dirty();
|
|
2035
2035
|
}
|
|
2036
|
-
} else if (
|
|
2037
|
-
if (input.data.getTime() >
|
|
2036
|
+
} else if (check2.kind === "max") {
|
|
2037
|
+
if (input.data.getTime() > check2.value) {
|
|
2038
2038
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2039
2039
|
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
2040
2040
|
code: ZodError_js_1.ZodIssueCode.too_big,
|
|
2041
|
-
message:
|
|
2041
|
+
message: check2.message,
|
|
2042
2042
|
inclusive: true,
|
|
2043
2043
|
exact: false,
|
|
2044
|
-
maximum:
|
|
2044
|
+
maximum: check2.value,
|
|
2045
2045
|
type: "date"
|
|
2046
2046
|
});
|
|
2047
2047
|
status.dirty();
|
|
2048
2048
|
}
|
|
2049
2049
|
} else {
|
|
2050
|
-
util_js_1.util.assertNever(
|
|
2050
|
+
util_js_1.util.assertNever(check2);
|
|
2051
2051
|
}
|
|
2052
2052
|
}
|
|
2053
2053
|
return {
|
|
@@ -2055,10 +2055,10 @@ function requireTypes() {
|
|
|
2055
2055
|
value: new Date(input.data.getTime())
|
|
2056
2056
|
};
|
|
2057
2057
|
}
|
|
2058
|
-
_addCheck(
|
|
2058
|
+
_addCheck(check2) {
|
|
2059
2059
|
return new ZodDate({
|
|
2060
2060
|
...this._def,
|
|
2061
|
-
checks: [...this._def.checks,
|
|
2061
|
+
checks: [...this._def.checks, check2]
|
|
2062
2062
|
});
|
|
2063
2063
|
}
|
|
2064
2064
|
min(minDate, message2) {
|
|
@@ -3952,10 +3952,10 @@ function requireTypes() {
|
|
|
3952
3952
|
const p2 = typeof p === "string" ? { message: p } : p;
|
|
3953
3953
|
return p2;
|
|
3954
3954
|
}
|
|
3955
|
-
function custom(
|
|
3956
|
-
if (
|
|
3955
|
+
function custom(check2, _params = {}, fatal) {
|
|
3956
|
+
if (check2)
|
|
3957
3957
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
3958
|
-
const r =
|
|
3958
|
+
const r = check2(data);
|
|
3959
3959
|
if (r instanceof Promise) {
|
|
3960
3960
|
return r.then((r2) => {
|
|
3961
3961
|
if (!r2) {
|
|
@@ -4517,7 +4517,7 @@ function requireCart() {
|
|
|
4517
4517
|
hasRequiredCart = 1;
|
|
4518
4518
|
(function(exports) {
|
|
4519
4519
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4520
|
-
exports.PartnerCart = exports.PartnerCartItem = exports.CartHandoffResponse = exports.UpdateCartItemRequest = exports.AddCartItemRequest = exports.Cart = exports.HiddenSummaryLine = exports.CartLock = exports.CartLockReason = exports.CartTotals = exports.CartItem = void 0;
|
|
4520
|
+
exports.PartnerCart = exports.PartnerCartItem = exports.CartHandoffResponse = exports.UpdateCartItemRequest = exports.AddCartItemRequest = exports.Cart = exports.HiddenSummaryLine = exports.CartHold = exports.CartLock = exports.CartLockReason = exports.CartTotals = exports.CartItem = void 0;
|
|
4521
4521
|
const zod_1 = /* @__PURE__ */ requireZod();
|
|
4522
4522
|
const money_1 = requireMoney();
|
|
4523
4523
|
const ids_1 = requireIds();
|
|
@@ -4528,6 +4528,24 @@ function requireCart() {
|
|
|
4528
4528
|
qty: zod_1.z.number().int().positive(),
|
|
4529
4529
|
unit_price: money_1.Money,
|
|
4530
4530
|
line_total: money_1.Money,
|
|
4531
|
+
/**
|
|
4532
|
+
* The undiscounted per-unit price, from the catalogue. Display only.
|
|
4533
|
+
*
|
|
4534
|
+
* Drawn as a struck-through figure under what the line costs now, with a `-NN%` badge
|
|
4535
|
+
* over the thumbnail — Figma's cart draws every discounted line that way and, until
|
|
4536
|
+
* this field existed, a consumer had no way to. The saving was simply invisible in the
|
|
4537
|
+
* basket and appeared for the first time at checkout.
|
|
4538
|
+
*
|
|
4539
|
+
* Absent means the line is at full price, which is the ordinary case. Present only when
|
|
4540
|
+
* it is strictly greater than `unit_price`: a compare-at equal to or below the live
|
|
4541
|
+
* price is not a sale, and drawing one would be an invented discount.
|
|
4542
|
+
*
|
|
4543
|
+
* **The catalogue's figure, not an order's.** `OrderItem.compare_at_unit_price` is the
|
|
4544
|
+
* one DAZN sent at intake and is frozen there, because a receipt whose struck price
|
|
4545
|
+
* moves next week is not a receipt. A cart is live, so this one moves with
|
|
4546
|
+
* merchandising — that is correct here and wrong there.
|
|
4547
|
+
*/
|
|
4548
|
+
compare_at_unit_price: money_1.Money.optional(),
|
|
4531
4549
|
/**
|
|
4532
4550
|
* Product title for this line, e.g. "Signature Hoodie".
|
|
4533
4551
|
*
|
|
@@ -4572,7 +4590,22 @@ function requireCart() {
|
|
|
4572
4590
|
*/
|
|
4573
4591
|
available: zod_1.z.number().int().nonnegative().optional()
|
|
4574
4592
|
});
|
|
4575
|
-
exports.CartTotals = common_1.Pricing
|
|
4593
|
+
exports.CartTotals = common_1.Pricing.extend({
|
|
4594
|
+
/**
|
|
4595
|
+
* What came off across the whole basket, as a **positive** amount. Absent means nothing
|
|
4596
|
+
* did; a zero is never sent.
|
|
4597
|
+
*
|
|
4598
|
+
* Positive rather than signed, and the surface that draws it owns the minus sign —
|
|
4599
|
+
* exactly as `OrderTotals.discount` does. A signed field invites a reader to add it to a
|
|
4600
|
+
* running total, and nothing here is a running total: every figure is server-computed
|
|
4601
|
+
* and `total` is never derived by a consumer from the parts.
|
|
4602
|
+
*
|
|
4603
|
+
* Kept out of `subtotal` deliberately. The design lists a subtotal and a discount as two
|
|
4604
|
+
* rows because the fan is owed both figures, and folding the saving into the subtotal
|
|
4605
|
+
* loses the one they came for.
|
|
4606
|
+
*/
|
|
4607
|
+
discount: money_1.Money.optional()
|
|
4608
|
+
});
|
|
4576
4609
|
exports.CartLockReason = zod_1.z.enum(["checkout_handoff"]);
|
|
4577
4610
|
exports.CartLock = zod_1.z.object({
|
|
4578
4611
|
since: zod_1.z.string().datetime(),
|
|
@@ -4580,6 +4613,10 @@ function requireCart() {
|
|
|
4580
4613
|
expires_at: zod_1.z.string().datetime().optional(),
|
|
4581
4614
|
reason: exports.CartLockReason
|
|
4582
4615
|
});
|
|
4616
|
+
exports.CartHold = zod_1.z.object({
|
|
4617
|
+
taken_at: zod_1.z.string().datetime(),
|
|
4618
|
+
expires_at: zod_1.z.string().datetime()
|
|
4619
|
+
});
|
|
4583
4620
|
exports.HiddenSummaryLine = zod_1.z.enum(["tax", "shipping"]);
|
|
4584
4621
|
exports.Cart = zod_1.z.object({
|
|
4585
4622
|
cart_id: ids_1.CartId,
|
|
@@ -4591,6 +4628,13 @@ function requireCart() {
|
|
|
4591
4628
|
* consumer that has never heard of locking is unaffected.
|
|
4592
4629
|
*/
|
|
4593
4630
|
locked: exports.CartLock.optional(),
|
|
4631
|
+
/**
|
|
4632
|
+
* Stock held for this cart while it sits in checkout. Absent = nothing held.
|
|
4633
|
+
*
|
|
4634
|
+
* Additive, and a consumer that has never heard of it is unaffected: the cart behaves
|
|
4635
|
+
* exactly as it did, and the hold does its work server-side either way.
|
|
4636
|
+
*/
|
|
4637
|
+
hold: exports.CartHold.optional(),
|
|
4594
4638
|
/**
|
|
4595
4639
|
* Summary rows to leave undrawn, resolved server-side from the CMS setting.
|
|
4596
4640
|
*
|
|
@@ -4859,7 +4903,7 @@ function requireOrderTracking() {
|
|
|
4859
4903
|
hasRequiredOrderTracking = 1;
|
|
4860
4904
|
(function(exports) {
|
|
4861
4905
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4862
|
-
exports.OrderDetail = exports.OrderList = exports.OrderSummaryItem = exports.OrderItem = exports.OrderTracking = exports.OrderProgressEntry = exports.OrderProgressStep = void 0;
|
|
4906
|
+
exports.ReturnDetail = exports.ReturnItem = exports.ReturnProgressEntry = exports.CreateReturnRequest = exports.ReturnRequestItem = exports.FanReturnReason = exports.RequestCancellationRequest = exports.FanCancelReason = exports.OrderDetail = exports.ReturnSummary = exports.ReturnStatus = exports.OrderList = exports.OrderSummaryItem = exports.OrderItem = exports.OrderTracking = exports.OrderProgressEntry = exports.OrderProgressStep = void 0;
|
|
4863
4907
|
const zod_1 = /* @__PURE__ */ requireZod();
|
|
4864
4908
|
const money_1 = requireMoney();
|
|
4865
4909
|
const ids_1 = requireIds();
|
|
@@ -4938,6 +4982,12 @@ function requireOrderTracking() {
|
|
|
4938
4982
|
exports.OrderList = zod_1.z.object({
|
|
4939
4983
|
orders: zod_1.z.array(exports.OrderSummaryItem)
|
|
4940
4984
|
});
|
|
4985
|
+
exports.ReturnStatus = zod_1.z.enum(["reported", "package_received", "completed"]);
|
|
4986
|
+
exports.ReturnSummary = zod_1.z.object({
|
|
4987
|
+
return_ref: zod_1.z.string().min(1),
|
|
4988
|
+
status: exports.ReturnStatus,
|
|
4989
|
+
reported_at: common_1.Timestamp
|
|
4990
|
+
});
|
|
4941
4991
|
exports.OrderDetail = zod_1.z.object({
|
|
4942
4992
|
order_ref: ids_1.OrderRef,
|
|
4943
4993
|
placed_at: common_1.Timestamp,
|
|
@@ -4963,7 +5013,72 @@ function requireOrderTracking() {
|
|
|
4963
5013
|
ship_to: common_1.Address,
|
|
4964
5014
|
payment: orders_1.OrderPaymentSummary.optional(),
|
|
4965
5015
|
/** Exactly what DAZN charged, echoed. Never recomputed here. */
|
|
4966
|
-
totals: orders_1.OrderTotals
|
|
5016
|
+
totals: orders_1.OrderTotals,
|
|
5017
|
+
/**
|
|
5018
|
+
* Whether this order can still be cancelled, and whether it can be returned.
|
|
5019
|
+
*
|
|
5020
|
+
* **Decided by the engine and sent, not derived by the consumer from `status`.** The
|
|
5021
|
+
* rule involves a dispatch cut-off and a returns window that a screen has no way of
|
|
5022
|
+
* knowing, and two consumers deriving it independently would disagree the day either
|
|
5023
|
+
* moves. Absent means no — an older engine that has never heard of either draws
|
|
5024
|
+
* neither button, which is the safe way round for an action that cannot be undone.
|
|
5025
|
+
*/
|
|
5026
|
+
can_cancel: zod_1.z.boolean().optional(),
|
|
5027
|
+
can_return: zod_1.z.boolean().optional(),
|
|
5028
|
+
/** Returns already reported against this order. Absent/empty = none. */
|
|
5029
|
+
returns: zod_1.z.array(exports.ReturnSummary).optional()
|
|
5030
|
+
});
|
|
5031
|
+
exports.FanCancelReason = zod_1.z.enum([
|
|
5032
|
+
"changed_my_mind",
|
|
5033
|
+
"ordered_by_mistake",
|
|
5034
|
+
"delivery_too_long"
|
|
5035
|
+
]);
|
|
5036
|
+
exports.RequestCancellationRequest = zod_1.z.object({ reason: exports.FanCancelReason }).strict();
|
|
5037
|
+
exports.FanReturnReason = zod_1.z.enum([
|
|
5038
|
+
"too_large",
|
|
5039
|
+
"too_small",
|
|
5040
|
+
"arrived_too_late",
|
|
5041
|
+
"item_damaged",
|
|
5042
|
+
"not_as_described",
|
|
5043
|
+
"changed_my_mind"
|
|
5044
|
+
]);
|
|
5045
|
+
exports.ReturnRequestItem = zod_1.z.object({
|
|
5046
|
+
line_ref: zod_1.z.string().min(1),
|
|
5047
|
+
qty: zod_1.z.number().int().positive(),
|
|
5048
|
+
reason: exports.FanReturnReason
|
|
5049
|
+
});
|
|
5050
|
+
exports.CreateReturnRequest = zod_1.z.object({ items: zod_1.z.array(exports.ReturnRequestItem).min(1) }).strict();
|
|
5051
|
+
exports.ReturnProgressEntry = zod_1.z.object({
|
|
5052
|
+
step: exports.ReturnStatus,
|
|
5053
|
+
label: zod_1.z.string().min(1),
|
|
5054
|
+
/** When the step completed. Absent = not reached yet, never a projected date. */
|
|
5055
|
+
at: common_1.Timestamp.optional(),
|
|
5056
|
+
current: zod_1.z.boolean()
|
|
5057
|
+
});
|
|
5058
|
+
exports.ReturnItem = zod_1.z.object({
|
|
5059
|
+
line_ref: zod_1.z.string().min(1),
|
|
5060
|
+
sku: common_1.Sku,
|
|
5061
|
+
qty: zod_1.z.number().int().positive(),
|
|
5062
|
+
reason: exports.FanReturnReason,
|
|
5063
|
+
unit_price: money_1.Money,
|
|
5064
|
+
compare_at_unit_price: money_1.Money.optional(),
|
|
5065
|
+
title: zod_1.z.string().optional(),
|
|
5066
|
+
image: common_1.Url.optional(),
|
|
5067
|
+
attributes: common_1.Attributes.optional()
|
|
5068
|
+
});
|
|
5069
|
+
exports.ReturnDetail = zod_1.z.object({
|
|
5070
|
+
return_ref: zod_1.z.string().min(1),
|
|
5071
|
+
order_ref: ids_1.OrderRef,
|
|
5072
|
+
status: exports.ReturnStatus,
|
|
5073
|
+
reported_at: common_1.Timestamp,
|
|
5074
|
+
progress: zod_1.z.array(exports.ReturnProgressEntry).min(1),
|
|
5075
|
+
items: zod_1.z.array(exports.ReturnItem).min(1),
|
|
5076
|
+
label_url: common_1.Url.optional(),
|
|
5077
|
+
/**
|
|
5078
|
+
* Where the label PDF was sent, for the frame's "You'll receive a shipping label PDF to
|
|
5079
|
+
* your email as well" line. PII, like `OrderDetail.email`: render it, never log it.
|
|
5080
|
+
*/
|
|
5081
|
+
label_email: zod_1.z.string().email().optional()
|
|
4967
5082
|
});
|
|
4968
5083
|
})(orderTracking);
|
|
4969
5084
|
return orderTracking;
|
|
@@ -5172,8 +5287,8 @@ function requireClient() {
|
|
|
5172
5287
|
...options2.defaultHeaders,
|
|
5173
5288
|
...config.headers
|
|
5174
5289
|
};
|
|
5175
|
-
const
|
|
5176
|
-
if (
|
|
5290
|
+
const body3 = config.body === void 0 && config.method === "POST" ? {} : config.body;
|
|
5291
|
+
if (body3 !== void 0)
|
|
5177
5292
|
headers["content-type"] = "application/json";
|
|
5178
5293
|
if (token)
|
|
5179
5294
|
headers["authorization"] = `Bearer ${token}`;
|
|
@@ -5181,7 +5296,7 @@ function requireClient() {
|
|
|
5181
5296
|
method: config.method,
|
|
5182
5297
|
headers,
|
|
5183
5298
|
credentials: options2.credentials ?? "include",
|
|
5184
|
-
body:
|
|
5299
|
+
body: body3 !== void 0 ? JSON.stringify(body3) : void 0
|
|
5185
5300
|
});
|
|
5186
5301
|
if (!res.ok) {
|
|
5187
5302
|
let parsed;
|
|
@@ -5274,11 +5389,11 @@ function requireClient() {
|
|
|
5274
5389
|
cart: {
|
|
5275
5390
|
create: () => request({ method: "POST", path: "/cart", schema: cart_1.Cart }),
|
|
5276
5391
|
get: () => request({ method: "GET", path: "/cart", schema: cart_1.Cart }),
|
|
5277
|
-
addItem: (
|
|
5278
|
-
updateItem: (sku,
|
|
5392
|
+
addItem: (body3) => request({ method: "POST", path: "/cart/items", body: body3, schema: cart_1.Cart }),
|
|
5393
|
+
updateItem: (sku, body3) => request({
|
|
5279
5394
|
method: "PATCH",
|
|
5280
5395
|
path: `/cart/items/${encodeURIComponent(sku)}`,
|
|
5281
|
-
body:
|
|
5396
|
+
body: body3,
|
|
5282
5397
|
schema: cart_1.Cart
|
|
5283
5398
|
}),
|
|
5284
5399
|
removeItem: (sku) => request({
|
|
@@ -5304,7 +5419,7 @@ function requireClient() {
|
|
|
5304
5419
|
*/
|
|
5305
5420
|
stockAlerts: {
|
|
5306
5421
|
/** "Remind me when available" — idempotent per SKU for the session's principal. */
|
|
5307
|
-
create: (
|
|
5422
|
+
create: (body3) => request({ method: "POST", path: "/stock-alerts", body: body3, schema: stock_alerts_1.StockAlert })
|
|
5308
5423
|
},
|
|
5309
5424
|
orders: {
|
|
5310
5425
|
list: () => request({ method: "GET", path: "/orders", schema: order_tracking_1.OrderList }),
|
|
@@ -5312,6 +5427,32 @@ function requireClient() {
|
|
|
5312
5427
|
method: "GET",
|
|
5313
5428
|
path: `/orders/${encodeURIComponent(orderRef)}`,
|
|
5314
5429
|
schema: order_tracking_1.OrderDetail
|
|
5430
|
+
}),
|
|
5431
|
+
/**
|
|
5432
|
+
* Ask for the order to be cancelled (ADR-0024). Returns the order as it now stands.
|
|
5433
|
+
*
|
|
5434
|
+
* A request, not a refund: DAZN are merchant of record and the money is theirs to
|
|
5435
|
+
* move. This records the fan's ask and hands it on.
|
|
5436
|
+
*/
|
|
5437
|
+
requestCancellation: (orderRef, body3) => request({
|
|
5438
|
+
method: "POST",
|
|
5439
|
+
path: `/orders/${encodeURIComponent(orderRef)}/cancellation`,
|
|
5440
|
+
body: body3,
|
|
5441
|
+
schema: order_tracking_1.OrderDetail
|
|
5442
|
+
}),
|
|
5443
|
+
/** Report items coming back, and get the return — including its label when ready. */
|
|
5444
|
+
createReturn: (orderRef, body3) => request({
|
|
5445
|
+
method: "POST",
|
|
5446
|
+
path: `/orders/${encodeURIComponent(orderRef)}/returns`,
|
|
5447
|
+
body: body3,
|
|
5448
|
+
schema: order_tracking_1.ReturnDetail
|
|
5449
|
+
})
|
|
5450
|
+
},
|
|
5451
|
+
returns: {
|
|
5452
|
+
get: (returnRef) => request({
|
|
5453
|
+
method: "GET",
|
|
5454
|
+
path: `/returns/${encodeURIComponent(returnRef)}`,
|
|
5455
|
+
schema: order_tracking_1.ReturnDetail
|
|
5315
5456
|
})
|
|
5316
5457
|
},
|
|
5317
5458
|
/**
|
|
@@ -5328,24 +5469,24 @@ function requireClient() {
|
|
|
5328
5469
|
*/
|
|
5329
5470
|
uploadAttachment: (file) => upload("/support/attachments", file, support_1.SupportAttachment),
|
|
5330
5471
|
/** File the ticket. Repeating an identical one within a few minutes returns the first. */
|
|
5331
|
-
createTicket: (
|
|
5472
|
+
createTicket: (body3) => request({ method: "POST", path: "/support/tickets", body: body3, schema: support_1.SupportTicket })
|
|
5332
5473
|
},
|
|
5333
5474
|
auth: {
|
|
5334
5475
|
/** Exchange a single-use DAZN identity JWT for a session (sets the cookie). */
|
|
5335
|
-
exchangeSession: (
|
|
5476
|
+
exchangeSession: (body3) => request({
|
|
5336
5477
|
method: "POST",
|
|
5337
5478
|
path: "/auth/session",
|
|
5338
|
-
body:
|
|
5479
|
+
body: body3,
|
|
5339
5480
|
schema: session_1.SessionExchangeResponse
|
|
5340
5481
|
}),
|
|
5341
5482
|
/**
|
|
5342
5483
|
* Redeem the `session` + `code` a DAZN redirect arrives with (sets the cookie).
|
|
5343
5484
|
* The entry path from the DAZN app; see `ShopSessionRequest`.
|
|
5344
5485
|
*/
|
|
5345
|
-
redeemShopSession: (
|
|
5486
|
+
redeemShopSession: (body3) => request({
|
|
5346
5487
|
method: "POST",
|
|
5347
5488
|
path: "/auth/shop-session",
|
|
5348
|
-
body:
|
|
5489
|
+
body: body3,
|
|
5349
5490
|
schema: session_1.ShopSessionResponse
|
|
5350
5491
|
})
|
|
5351
5492
|
}
|
|
@@ -5425,26 +5566,28 @@ function DaznShopProvider({
|
|
|
5425
5566
|
listeners.current.delete(listener);
|
|
5426
5567
|
};
|
|
5427
5568
|
}, []);
|
|
5428
|
-
const
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
}
|
|
5569
|
+
const onEventRef = useRef(onEvent);
|
|
5570
|
+
onEventRef.current = onEvent;
|
|
5571
|
+
const getTokenRef = useRef(getToken);
|
|
5572
|
+
getTokenRef.current = getToken;
|
|
5573
|
+
const stableGetToken = useCallback(() => getTokenRef.current(), []);
|
|
5574
|
+
const emit = useCallback((event) => {
|
|
5575
|
+
for (const listener of listeners.current) {
|
|
5436
5576
|
try {
|
|
5437
|
-
|
|
5577
|
+
listener(event);
|
|
5438
5578
|
} catch {
|
|
5439
5579
|
}
|
|
5440
|
-
}
|
|
5441
|
-
|
|
5442
|
-
|
|
5580
|
+
}
|
|
5581
|
+
try {
|
|
5582
|
+
onEventRef.current?.(event);
|
|
5583
|
+
} catch {
|
|
5584
|
+
}
|
|
5585
|
+
}, []);
|
|
5443
5586
|
const api = useMemo(
|
|
5444
5587
|
() => clientExports.createClient({
|
|
5445
5588
|
baseUrl: apiBaseUrl,
|
|
5446
|
-
getToken,
|
|
5447
|
-
fetch: createShopFetch({ getToken, onEvent, sessionTransport }),
|
|
5589
|
+
getToken: stableGetToken,
|
|
5590
|
+
fetch: createShopFetch({ getToken: stableGetToken, onEvent: emit, sessionTransport }),
|
|
5448
5591
|
/**
|
|
5449
5592
|
* Mounted in a host's page we are cross-origin with the API and hold no cookie,
|
|
5450
5593
|
* so `omit` is right and the bearer token is the whole session story.
|
|
@@ -5456,9 +5599,10 @@ function DaznShopProvider({
|
|
|
5456
5599
|
*/
|
|
5457
5600
|
credentials: sessionTransport === "cookie" ? "include" : "omit"
|
|
5458
5601
|
}),
|
|
5459
|
-
//
|
|
5460
|
-
//
|
|
5461
|
-
|
|
5602
|
+
// Only the two things that genuinely change the client. `stableGetToken` and `emit`
|
|
5603
|
+
// are stable for the provider's lifetime by construction — see the refs above — so a
|
|
5604
|
+
// host's re-render can no longer drop every in-flight request.
|
|
5605
|
+
[apiBaseUrl, stableGetToken, emit, sessionTransport]
|
|
5462
5606
|
);
|
|
5463
5607
|
const navigate = useCallback(
|
|
5464
5608
|
(to) => {
|
|
@@ -5575,29 +5719,29 @@ function ShopImage({
|
|
|
5575
5719
|
}
|
|
5576
5720
|
);
|
|
5577
5721
|
}
|
|
5578
|
-
const badge$
|
|
5722
|
+
const badge$5 = "_badge_1bagf_1";
|
|
5579
5723
|
const neutral$1 = "_neutral_1bagf_12";
|
|
5580
5724
|
const success$1 = "_success_1bagf_17";
|
|
5581
5725
|
const critical$1 = "_critical_1bagf_22";
|
|
5582
5726
|
const promo = "_promo_1bagf_27";
|
|
5583
|
-
const styles$
|
|
5584
|
-
badge: badge$
|
|
5727
|
+
const styles$P = {
|
|
5728
|
+
badge: badge$5,
|
|
5585
5729
|
neutral: neutral$1,
|
|
5586
5730
|
success: success$1,
|
|
5587
5731
|
critical: critical$1,
|
|
5588
5732
|
promo
|
|
5589
5733
|
};
|
|
5590
5734
|
function Badge({ tone = "neutral", children }) {
|
|
5591
|
-
return /* @__PURE__ */ jsx("span", { className: [styles$
|
|
5592
|
-
}
|
|
5593
|
-
const button$1 = "
|
|
5594
|
-
const fullWidth = "
|
|
5595
|
-
const primary = "
|
|
5596
|
-
const secondary = "
|
|
5597
|
-
const ghost = "
|
|
5598
|
-
const spinner = "
|
|
5599
|
-
const spin = "
|
|
5600
|
-
const styles$
|
|
5735
|
+
return /* @__PURE__ */ jsx("span", { className: [styles$P.badge, styles$P[tone]].join(" "), children });
|
|
5736
|
+
}
|
|
5737
|
+
const button$1 = "_button_1u2uh_1";
|
|
5738
|
+
const fullWidth = "_fullWidth_1u2uh_25";
|
|
5739
|
+
const primary = "_primary_1u2uh_29";
|
|
5740
|
+
const secondary = "_secondary_1u2uh_34";
|
|
5741
|
+
const ghost = "_ghost_1u2uh_40";
|
|
5742
|
+
const spinner = "_spinner_1u2uh_83";
|
|
5743
|
+
const spin = "_spin_1u2uh_83";
|
|
5744
|
+
const styles$O = {
|
|
5601
5745
|
button: button$1,
|
|
5602
5746
|
fullWidth,
|
|
5603
5747
|
primary,
|
|
@@ -5623,23 +5767,23 @@ const Button = forwardRef(function Button2({
|
|
|
5623
5767
|
ref,
|
|
5624
5768
|
type,
|
|
5625
5769
|
className: [
|
|
5626
|
-
styles$
|
|
5627
|
-
styles$
|
|
5628
|
-
fullWidth2 ? styles$
|
|
5770
|
+
styles$O.button,
|
|
5771
|
+
styles$O[variant],
|
|
5772
|
+
fullWidth2 ? styles$O.fullWidth : "",
|
|
5629
5773
|
className ?? ""
|
|
5630
5774
|
].filter(Boolean).join(" "),
|
|
5631
5775
|
disabled: isDisabled,
|
|
5632
5776
|
"aria-busy": loading || void 0,
|
|
5633
5777
|
...rest,
|
|
5634
5778
|
children: [
|
|
5635
|
-
loading && /* @__PURE__ */ jsx("span", { className: styles$
|
|
5779
|
+
loading && /* @__PURE__ */ jsx("span", { className: styles$O.spinner, "aria-hidden": "true" }),
|
|
5636
5780
|
/* @__PURE__ */ jsx("span", { children })
|
|
5637
5781
|
]
|
|
5638
5782
|
}
|
|
5639
5783
|
);
|
|
5640
5784
|
});
|
|
5641
5785
|
const skeleton = "_skeleton_1nxz7_1";
|
|
5642
|
-
const styles$
|
|
5786
|
+
const styles$N = {
|
|
5643
5787
|
skeleton
|
|
5644
5788
|
};
|
|
5645
5789
|
function Skeleton({ width, height, radius, className, circle }) {
|
|
@@ -5652,24 +5796,32 @@ function Skeleton({ width, height, radius, className, circle }) {
|
|
|
5652
5796
|
"span",
|
|
5653
5797
|
{
|
|
5654
5798
|
"aria-hidden": "true",
|
|
5655
|
-
className: [styles$
|
|
5799
|
+
className: [styles$N.skeleton, className ?? ""].filter(Boolean).join(" "),
|
|
5656
5800
|
style
|
|
5657
5801
|
}
|
|
5658
5802
|
);
|
|
5659
5803
|
}
|
|
5660
5804
|
const surface$1 = "_surface_cfqo9_10";
|
|
5661
5805
|
const fill = "_fill_cfqo9_35";
|
|
5662
|
-
const styles$
|
|
5806
|
+
const styles$M = {
|
|
5663
5807
|
surface: surface$1,
|
|
5664
5808
|
fill
|
|
5665
5809
|
};
|
|
5810
|
+
function offsetFromViewportTop(el) {
|
|
5811
|
+
let top = el.getBoundingClientRect().top;
|
|
5812
|
+
for (let node = el.parentElement; node; node = node.parentElement) {
|
|
5813
|
+
top += node.scrollTop;
|
|
5814
|
+
if (getComputedStyle(node).position === "fixed") break;
|
|
5815
|
+
}
|
|
5816
|
+
const offset = Math.max(0, Math.round(top));
|
|
5817
|
+
return offset >= window.innerHeight ? 0 : offset;
|
|
5818
|
+
}
|
|
5666
5819
|
function useTopOffset(ref, property, enabled = true) {
|
|
5667
5820
|
useEffect(() => {
|
|
5668
5821
|
const el = ref.current;
|
|
5669
5822
|
if (!el || !enabled) return;
|
|
5670
5823
|
const measure = () => {
|
|
5671
|
-
|
|
5672
|
-
el.style.setProperty(property, `${top}px`);
|
|
5824
|
+
el.style.setProperty(property, `${offsetFromViewportTop(el)}px`);
|
|
5673
5825
|
};
|
|
5674
5826
|
measure();
|
|
5675
5827
|
window.addEventListener("resize", measure);
|
|
@@ -5700,7 +5852,7 @@ const ShopSurface = forwardRef(function ShopSurface2({ tone, fill: fill2 = false
|
|
|
5700
5852
|
...rest,
|
|
5701
5853
|
ref: attach,
|
|
5702
5854
|
"data-shop-theme": tone,
|
|
5703
|
-
className: [styles$
|
|
5855
|
+
className: [styles$M.surface, fill2 ? styles$M.fill : "", className ?? ""].filter(Boolean).join(" "),
|
|
5704
5856
|
children
|
|
5705
5857
|
}
|
|
5706
5858
|
);
|
|
@@ -5712,9 +5864,9 @@ const lines$2 = "_lines_ney0g_32";
|
|
|
5712
5864
|
const lineWide = "_lineWide_ney0g_41";
|
|
5713
5865
|
const lineMid = "_lineMid_ney0g_45";
|
|
5714
5866
|
const lineNarrow = "_lineNarrow_ney0g_49";
|
|
5715
|
-
const row$
|
|
5867
|
+
const row$9 = "_row_ney0g_53";
|
|
5716
5868
|
const action$2 = "_action_ney0g_57";
|
|
5717
|
-
const styles$
|
|
5869
|
+
const styles$L = {
|
|
5718
5870
|
root: root$6,
|
|
5719
5871
|
inner,
|
|
5720
5872
|
media: media$3,
|
|
@@ -5722,42 +5874,42 @@ const styles$G = {
|
|
|
5722
5874
|
lineWide,
|
|
5723
5875
|
lineMid,
|
|
5724
5876
|
lineNarrow,
|
|
5725
|
-
row: row$
|
|
5877
|
+
row: row$9,
|
|
5726
5878
|
action: action$2
|
|
5727
5879
|
};
|
|
5728
5880
|
function ScreenSkeleton({ tone, shape = "media" }) {
|
|
5729
|
-
return /* @__PURE__ */ jsx(ShopSurface, { tone, fill: true, className: styles$
|
|
5730
|
-
/* @__PURE__ */ jsx(Skeleton, { className: styles$
|
|
5731
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
5732
|
-
/* @__PURE__ */ jsx(Skeleton, { height: 22, className: styles$
|
|
5733
|
-
/* @__PURE__ */ jsx(Skeleton, { height: 16, className: styles$
|
|
5734
|
-
/* @__PURE__ */ jsx(Skeleton, { height: 16, className: styles$
|
|
5881
|
+
return /* @__PURE__ */ jsx(ShopSurface, { tone, fill: true, className: styles$L.root, children: /* @__PURE__ */ jsx("div", { className: styles$L.inner, role: "status", "aria-label": "Loading", children: shape === "media" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5882
|
+
/* @__PURE__ */ jsx(Skeleton, { className: styles$L.media }),
|
|
5883
|
+
/* @__PURE__ */ jsxs("div", { className: styles$L.lines, children: [
|
|
5884
|
+
/* @__PURE__ */ jsx(Skeleton, { height: 22, className: styles$L.lineWide }),
|
|
5885
|
+
/* @__PURE__ */ jsx(Skeleton, { height: 16, className: styles$L.lineMid }),
|
|
5886
|
+
/* @__PURE__ */ jsx(Skeleton, { height: 16, className: styles$L.lineNarrow })
|
|
5735
5887
|
] }),
|
|
5736
|
-
/* @__PURE__ */ jsx(Skeleton, { height: 48, radius: 8, className: styles$
|
|
5737
|
-
] }) : /* @__PURE__ */ jsx("div", { className: styles$
|
|
5888
|
+
/* @__PURE__ */ jsx(Skeleton, { height: 48, radius: 8, className: styles$L.action })
|
|
5889
|
+
] }) : /* @__PURE__ */ jsx("div", { className: styles$L.lines, children: [0, 1, 2, 3].map((i) => /* @__PURE__ */ jsx(Skeleton, { height: 72, className: styles$L.row }, i)) }) }) });
|
|
5738
5890
|
}
|
|
5739
5891
|
const root$5 = "_root_ryf3q_6";
|
|
5740
5892
|
const icon$4 = "_icon_ryf3q_15";
|
|
5741
5893
|
const text$5 = "_text_ryf3q_21";
|
|
5742
|
-
const title$
|
|
5743
|
-
const body$
|
|
5894
|
+
const title$n = "_title_ryf3q_35";
|
|
5895
|
+
const body$8 = "_body_ryf3q_40";
|
|
5744
5896
|
const action$1 = "_action_ryf3q_48";
|
|
5745
|
-
const styles$
|
|
5897
|
+
const styles$K = {
|
|
5746
5898
|
root: root$5,
|
|
5747
5899
|
icon: icon$4,
|
|
5748
5900
|
text: text$5,
|
|
5749
|
-
title: title$
|
|
5750
|
-
body: body$
|
|
5901
|
+
title: title$n,
|
|
5902
|
+
body: body$8,
|
|
5751
5903
|
action: action$1
|
|
5752
5904
|
};
|
|
5753
|
-
function EmptyState({ title: title2, body:
|
|
5754
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
5755
|
-
icon2 && /* @__PURE__ */ jsx("div", { className: styles$
|
|
5756
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
5757
|
-
/* @__PURE__ */ jsx("h2", { className: styles$
|
|
5758
|
-
|
|
5905
|
+
function EmptyState({ title: title2, body: body3, action: action2, icon: icon2 }) {
|
|
5906
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$K.root, role: "status", children: [
|
|
5907
|
+
icon2 && /* @__PURE__ */ jsx("div", { className: styles$K.icon, children: icon2 }),
|
|
5908
|
+
/* @__PURE__ */ jsxs("div", { className: styles$K.text, children: [
|
|
5909
|
+
/* @__PURE__ */ jsx("h2", { className: styles$K.title, children: title2 }),
|
|
5910
|
+
body3 && /* @__PURE__ */ jsx("p", { className: styles$K.body, children: body3 })
|
|
5759
5911
|
] }),
|
|
5760
|
-
action2 && /* @__PURE__ */ jsx("div", { className: styles$
|
|
5912
|
+
action2 && /* @__PURE__ */ jsx("div", { className: styles$K.action, children: action2 })
|
|
5761
5913
|
] });
|
|
5762
5914
|
}
|
|
5763
5915
|
const TREATMENTS = {
|
|
@@ -5828,9 +5980,13 @@ const TREATMENTS = {
|
|
|
5828
5980
|
/**
|
|
5829
5981
|
* Codes a fan cannot reach, kept because this map is exhaustive over `ErrorCode`.
|
|
5830
5982
|
*
|
|
5831
|
-
* `
|
|
5832
|
-
*
|
|
5833
|
-
*
|
|
5983
|
+
* `forbidden` and `invalid_transition` belong to the operations console and cannot
|
|
5984
|
+
* arrive on a storefront request.
|
|
5985
|
+
*
|
|
5986
|
+
* `order_not_found` and `order_not_cancellable` no longer belong to that list, and this
|
|
5987
|
+
* comment used to say they did. Both are fan-facing now: ADR-0024 gave us the cancel and
|
|
5988
|
+
* return requests, and the engine raises `order_not_cancellable` for a cancellation past
|
|
5989
|
+
* the dispatch cut-off AND for a return outside the window.
|
|
5834
5990
|
*
|
|
5835
5991
|
* They are given real copy rather than a shrug because the alternative is worse: this
|
|
5836
5992
|
* map is a `Record<ErrorCode, …>` precisely so a new code fails the build here and gets
|
|
@@ -5894,19 +6050,19 @@ function isDuplicateOrder(err) {
|
|
|
5894
6050
|
return codeOf(err) === "duplicate_order";
|
|
5895
6051
|
}
|
|
5896
6052
|
const root$4 = "_root_1lbpx_1";
|
|
5897
|
-
const title$
|
|
5898
|
-
const body$
|
|
5899
|
-
const styles$
|
|
6053
|
+
const title$m = "_title_1lbpx_10";
|
|
6054
|
+
const body$7 = "_body_1lbpx_15";
|
|
6055
|
+
const styles$J = {
|
|
5900
6056
|
root: root$4,
|
|
5901
|
-
title: title$
|
|
5902
|
-
body: body$
|
|
6057
|
+
title: title$m,
|
|
6058
|
+
body: body$7
|
|
5903
6059
|
};
|
|
5904
|
-
function ErrorState({ code, title: title2, body:
|
|
6060
|
+
function ErrorState({ code, title: title2, body: body3, onRetry, retryLabel }) {
|
|
5905
6061
|
const treatment = treatmentFor(code);
|
|
5906
6062
|
const showRetry = Boolean(onRetry) && treatment.retriable;
|
|
5907
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
5908
|
-
/* @__PURE__ */ jsx("h2", { className: styles$
|
|
5909
|
-
/* @__PURE__ */ jsx("p", { className: styles$
|
|
6063
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$J.root, role: "alert", children: [
|
|
6064
|
+
/* @__PURE__ */ jsx("h2", { className: styles$J.title, children: title2 ?? treatment.title }),
|
|
6065
|
+
/* @__PURE__ */ jsx("p", { className: styles$J.body, children: body3 ?? treatment.body }),
|
|
5910
6066
|
showRetry && /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: onRetry, children: retryLabel ?? "Try again" })
|
|
5911
6067
|
] });
|
|
5912
6068
|
}
|
|
@@ -5943,9 +6099,9 @@ const success = "_success_5aafz_163";
|
|
|
5943
6099
|
const critical = "_critical_5aafz_168";
|
|
5944
6100
|
const rich = "_rich_5aafz_183";
|
|
5945
6101
|
const description = "_description_5aafz_198";
|
|
5946
|
-
const thumb$
|
|
6102
|
+
const thumb$3 = "_thumb_5aafz_216";
|
|
5947
6103
|
const thumbImage = "_thumbImage_5aafz_227";
|
|
5948
|
-
const styles$
|
|
6104
|
+
const styles$I = {
|
|
5949
6105
|
viewport,
|
|
5950
6106
|
anchor,
|
|
5951
6107
|
caret,
|
|
@@ -5958,7 +6114,7 @@ const styles$D = {
|
|
|
5958
6114
|
critical,
|
|
5959
6115
|
rich,
|
|
5960
6116
|
description,
|
|
5961
|
-
thumb: thumb$
|
|
6117
|
+
thumb: thumb$3,
|
|
5962
6118
|
thumbImage
|
|
5963
6119
|
};
|
|
5964
6120
|
const ToastContext = createContext(null);
|
|
@@ -6055,35 +6211,35 @@ function ToastProvider({ children }) {
|
|
|
6055
6211
|
const api = useMemo(() => ({ show }), [show]);
|
|
6056
6212
|
return /* @__PURE__ */ jsxs(ToastContext.Provider, { value: api, children: [
|
|
6057
6213
|
children,
|
|
6058
|
-
/* @__PURE__ */ jsx("div", { className: styles$
|
|
6214
|
+
/* @__PURE__ */ jsx("div", { className: styles$I.viewport, ref: viewportRef, "aria-live": "polite", "aria-atomic": "false", children: toasts.map((t) => {
|
|
6059
6215
|
const rich2 = Boolean(t.description || t.image);
|
|
6060
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
6061
|
-
t.anchor === "cart" && /* @__PURE__ */ jsx("span", { className: styles$
|
|
6216
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$I.anchor, children: [
|
|
6217
|
+
t.anchor === "cart" && /* @__PURE__ */ jsx("span", { className: styles$I.caret, children: /* @__PURE__ */ jsx(Caret, {}) }),
|
|
6062
6218
|
/* @__PURE__ */ jsxs(
|
|
6063
6219
|
"div",
|
|
6064
6220
|
{
|
|
6065
|
-
className: [styles$
|
|
6221
|
+
className: [styles$I.toast, rich2 ? styles$I.rich : styles$I[t.tone]].join(" "),
|
|
6066
6222
|
role: "status",
|
|
6067
6223
|
children: [
|
|
6068
|
-
t.image && /* @__PURE__ */ jsx("span", { className: styles$
|
|
6224
|
+
t.image && /* @__PURE__ */ jsx("span", { className: styles$I.thumb, children: /* @__PURE__ */ jsx(
|
|
6069
6225
|
ShopImage,
|
|
6070
6226
|
{
|
|
6071
6227
|
src: t.image,
|
|
6072
6228
|
alt: "",
|
|
6073
6229
|
fill: true,
|
|
6074
6230
|
sizes: "40px",
|
|
6075
|
-
className: styles$
|
|
6231
|
+
className: styles$I.thumbImage
|
|
6076
6232
|
}
|
|
6077
6233
|
) }),
|
|
6078
|
-
/* @__PURE__ */ jsxs("span", { className: styles$
|
|
6079
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
6080
|
-
t.description && /* @__PURE__ */ jsx("span", { className: styles$
|
|
6234
|
+
/* @__PURE__ */ jsxs("span", { className: styles$I.text, children: [
|
|
6235
|
+
/* @__PURE__ */ jsx("span", { className: styles$I.message, children: t.message }),
|
|
6236
|
+
t.description && /* @__PURE__ */ jsx("span", { className: styles$I.description, children: t.description })
|
|
6081
6237
|
] }),
|
|
6082
6238
|
t.action && /* @__PURE__ */ jsx(
|
|
6083
6239
|
"button",
|
|
6084
6240
|
{
|
|
6085
6241
|
type: "button",
|
|
6086
|
-
className: styles$
|
|
6242
|
+
className: styles$I.action,
|
|
6087
6243
|
onClick: () => {
|
|
6088
6244
|
t.action?.onAction();
|
|
6089
6245
|
dismiss(t.id);
|
|
@@ -6144,15 +6300,15 @@ function useLocale(override) {
|
|
|
6144
6300
|
const shop = useShopOptional();
|
|
6145
6301
|
return override ?? shop?.locale ?? shop?.market?.lang ?? (typeof navigator !== "undefined" ? navigator.language : void 0);
|
|
6146
6302
|
}
|
|
6147
|
-
const badge$
|
|
6303
|
+
const badge$4 = "_badge_156ya_2";
|
|
6148
6304
|
const icon$3 = "_icon_156ya_18";
|
|
6149
|
-
const styles$
|
|
6150
|
-
badge: badge$
|
|
6305
|
+
const styles$H = {
|
|
6306
|
+
badge: badge$4,
|
|
6151
6307
|
icon: icon$3
|
|
6152
6308
|
};
|
|
6153
6309
|
function SaleBadge({ pct }) {
|
|
6154
|
-
return /* @__PURE__ */ jsxs("span", { className: styles$
|
|
6155
|
-
/* @__PURE__ */ jsxs("svg", { className: styles$
|
|
6310
|
+
return /* @__PURE__ */ jsxs("span", { className: styles$H.badge, children: [
|
|
6311
|
+
/* @__PURE__ */ jsxs("svg", { className: styles$H.icon, width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
6156
6312
|
/* @__PURE__ */ jsx(
|
|
6157
6313
|
"path",
|
|
6158
6314
|
{
|
|
@@ -6169,23 +6325,25 @@ function SaleBadge({ pct }) {
|
|
|
6169
6325
|
"%"
|
|
6170
6326
|
] });
|
|
6171
6327
|
}
|
|
6172
|
-
const root$3 = "
|
|
6173
|
-
const center$1 = "
|
|
6174
|
-
const end = "
|
|
6175
|
-
const sm = "
|
|
6176
|
-
const md = "
|
|
6177
|
-
const lg = "
|
|
6178
|
-
const
|
|
6179
|
-
const
|
|
6180
|
-
const
|
|
6181
|
-
const
|
|
6328
|
+
const root$3 = "_root_rvfx9_1";
|
|
6329
|
+
const center$1 = "_center_rvfx9_10";
|
|
6330
|
+
const end = "_end_rvfx9_14";
|
|
6331
|
+
const sm = "_sm_rvfx9_28";
|
|
6332
|
+
const md = "_md_rvfx9_32";
|
|
6333
|
+
const lg = "_lg_rvfx9_36";
|
|
6334
|
+
const badge$3 = "_badge_rvfx9_48";
|
|
6335
|
+
const price$4 = "_price_rvfx9_52";
|
|
6336
|
+
const compareAt = "_compareAt_rvfx9_57";
|
|
6337
|
+
const strikethrough = "_strikethrough_rvfx9_65";
|
|
6338
|
+
const styles$G = {
|
|
6182
6339
|
root: root$3,
|
|
6183
6340
|
center: center$1,
|
|
6184
6341
|
end,
|
|
6185
6342
|
sm,
|
|
6186
6343
|
md,
|
|
6187
6344
|
lg,
|
|
6188
|
-
|
|
6345
|
+
badge: badge$3,
|
|
6346
|
+
price: price$4,
|
|
6189
6347
|
compareAt,
|
|
6190
6348
|
strikethrough
|
|
6191
6349
|
};
|
|
@@ -6200,9 +6358,9 @@ function PriceBlock({
|
|
|
6200
6358
|
const { format } = useMoney();
|
|
6201
6359
|
const pct = discountPct$1 ?? discountPct(price2, compareAt2);
|
|
6202
6360
|
const hasCompare = compareAt2 && compareAt2.amount > price2.amount;
|
|
6203
|
-
return /* @__PURE__ */ jsxs("div", { className: [styles$
|
|
6204
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
6205
|
-
hasCompare && /* @__PURE__ */ jsxs("span", { className: styles$
|
|
6361
|
+
return /* @__PURE__ */ jsxs("div", { className: [styles$G.root, styles$G[size], styles$G[align], styles$G[variant]].join(" "), children: [
|
|
6362
|
+
/* @__PURE__ */ jsx("span", { className: styles$G.price, children: format(price2) }),
|
|
6363
|
+
hasCompare && /* @__PURE__ */ jsxs("span", { className: styles$G.compareAt, children: [
|
|
6206
6364
|
/* @__PURE__ */ jsx("span", { className: "visually-hidden", children: `Was ${format(compareAt2)}` }),
|
|
6207
6365
|
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: format(compareAt2) })
|
|
6208
6366
|
] }),
|
|
@@ -6210,28 +6368,28 @@ function PriceBlock({
|
|
|
6210
6368
|
] });
|
|
6211
6369
|
}
|
|
6212
6370
|
const timeline = "_timeline_1cum7_7";
|
|
6213
|
-
const row$
|
|
6214
|
-
const line$
|
|
6371
|
+
const row$8 = "_row_1cum7_15";
|
|
6372
|
+
const line$3 = "_line_1cum7_20";
|
|
6215
6373
|
const marker = "_marker_1cum7_27";
|
|
6216
6374
|
const tick = "_tick_1cum7_35";
|
|
6217
6375
|
const pending$2 = "_pending_1cum7_44";
|
|
6218
6376
|
const connector = "_connector_1cum7_68";
|
|
6219
6377
|
const text$3 = "_text_1cum7_84";
|
|
6220
|
-
const label$
|
|
6378
|
+
const label$2 = "_label_1cum7_101";
|
|
6221
6379
|
const past = "_past_1cum7_113";
|
|
6222
6380
|
const current = "_current_1cum7_118";
|
|
6223
6381
|
const future = "_future_1cum7_133";
|
|
6224
6382
|
const date$1 = "_date_1cum7_138";
|
|
6225
|
-
const styles$
|
|
6383
|
+
const styles$F = {
|
|
6226
6384
|
timeline,
|
|
6227
|
-
row: row$
|
|
6228
|
-
line: line$
|
|
6385
|
+
row: row$8,
|
|
6386
|
+
line: line$3,
|
|
6229
6387
|
marker,
|
|
6230
6388
|
tick,
|
|
6231
6389
|
pending: pending$2,
|
|
6232
6390
|
connector,
|
|
6233
6391
|
text: text$3,
|
|
6234
|
-
label: label$
|
|
6392
|
+
label: label$2,
|
|
6235
6393
|
past,
|
|
6236
6394
|
current,
|
|
6237
6395
|
future,
|
|
@@ -6244,23 +6402,23 @@ function OrderTimeline({
|
|
|
6244
6402
|
}) {
|
|
6245
6403
|
const locale = useLocale(localeProp);
|
|
6246
6404
|
const currentIndex = progress2.findIndex((e) => e.current);
|
|
6247
|
-
return /* @__PURE__ */ jsx("ol", { className: styles$
|
|
6405
|
+
return /* @__PURE__ */ jsx("ol", { className: styles$F.timeline, children: progress2.map((entry, i) => {
|
|
6248
6406
|
const state = stateOf(entry, i, currentIndex);
|
|
6249
6407
|
const estimate = !entry.at && i === progress2.length - 1 && estimatedDelivery ? formatWindow(estimatedDelivery, locale) : void 0;
|
|
6250
6408
|
return /* @__PURE__ */ jsxs(
|
|
6251
6409
|
"li",
|
|
6252
6410
|
{
|
|
6253
|
-
className: styles$
|
|
6411
|
+
className: styles$F.row,
|
|
6254
6412
|
"aria-current": entry.current ? "step" : void 0,
|
|
6255
6413
|
children: [
|
|
6256
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
6257
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
6258
|
-
/* @__PURE__ */ jsxs("span", { className: styles$
|
|
6259
|
-
/* @__PURE__ */ jsx("span", { className: [styles$
|
|
6260
|
-
entry.at ? /* @__PURE__ */ jsx("time", { className: styles$
|
|
6414
|
+
/* @__PURE__ */ jsxs("div", { className: styles$F.line, children: [
|
|
6415
|
+
/* @__PURE__ */ jsx("span", { className: styles$F.marker, children: state === "future" ? /* @__PURE__ */ jsx("span", { className: styles$F.pending, "aria-hidden": "true" }) : /* @__PURE__ */ jsx(StepTick, { tone: state }) }),
|
|
6416
|
+
/* @__PURE__ */ jsxs("span", { className: styles$F.text, children: [
|
|
6417
|
+
/* @__PURE__ */ jsx("span", { className: [styles$F.label, styles$F[state]].join(" "), children: entry.label }),
|
|
6418
|
+
entry.at ? /* @__PURE__ */ jsx("time", { className: styles$F.date, dateTime: entry.at, children: formatStepDate(entry.at, locale) }) : estimate && /* @__PURE__ */ jsx("span", { className: styles$F.date, children: estimate })
|
|
6261
6419
|
] })
|
|
6262
6420
|
] }),
|
|
6263
|
-
i < progress2.length - 1 && /* @__PURE__ */ jsx("span", { className: styles$
|
|
6421
|
+
i < progress2.length - 1 && /* @__PURE__ */ jsx("span", { className: styles$F.connector, "aria-hidden": "true" })
|
|
6264
6422
|
]
|
|
6265
6423
|
},
|
|
6266
6424
|
entry.step
|
|
@@ -6276,7 +6434,7 @@ function StepTick({ tone }) {
|
|
|
6276
6434
|
return /* @__PURE__ */ jsxs(
|
|
6277
6435
|
"svg",
|
|
6278
6436
|
{
|
|
6279
|
-
className: styles$
|
|
6437
|
+
className: styles$F.tick,
|
|
6280
6438
|
width: "28",
|
|
6281
6439
|
height: "28",
|
|
6282
6440
|
viewBox: "0 0 28 28",
|
|
@@ -6413,19 +6571,20 @@ function swatchColour(name2) {
|
|
|
6413
6571
|
return SWATCH_HEX[name2.toLowerCase().trim()] ?? "#c9cdd0";
|
|
6414
6572
|
}
|
|
6415
6573
|
const summary = "_summary_1hsxt_2";
|
|
6416
|
-
const row$
|
|
6574
|
+
const row$7 = "_row_1hsxt_16";
|
|
6417
6575
|
const free = "_free_1hsxt_53";
|
|
6418
6576
|
const pending$1 = "_pending_1hsxt_59";
|
|
6419
6577
|
const discount = "_discount_1hsxt_69";
|
|
6420
|
-
const styles$
|
|
6578
|
+
const styles$E = {
|
|
6421
6579
|
summary,
|
|
6422
|
-
row: row$
|
|
6580
|
+
row: row$7,
|
|
6423
6581
|
free,
|
|
6424
6582
|
pending: pending$1,
|
|
6425
6583
|
discount
|
|
6426
6584
|
};
|
|
6427
6585
|
const CART_ROWS = [
|
|
6428
6586
|
{ label: "Subtotal", key: "subtotal" },
|
|
6587
|
+
{ label: "Discount", key: "discount" },
|
|
6429
6588
|
{ label: "Delivery", key: "shipping" },
|
|
6430
6589
|
{ label: "Tax", key: "tax" },
|
|
6431
6590
|
{ label: "Total", key: "total" }
|
|
@@ -6439,58 +6598,57 @@ function OrderSummary({
|
|
|
6439
6598
|
}) {
|
|
6440
6599
|
const { format } = useMoney();
|
|
6441
6600
|
const isDeferred = (key) => deferred.includes(key);
|
|
6442
|
-
const
|
|
6443
|
-
|
|
6444
|
-
return /* @__PURE__ */ jsx("dl", { className: styles$z.summary, children: visible.map(({ label: label2, key }) => {
|
|
6601
|
+
const visible = rows.filter((row2) => !hidden.includes(row2.key)).filter((row2) => row2.key !== "discount" || discount2 !== void 0);
|
|
6602
|
+
return /* @__PURE__ */ jsx("dl", { className: styles$E.summary, children: visible.map(({ label: label2, key }) => {
|
|
6445
6603
|
if (key === "discount" && discount2) {
|
|
6446
|
-
return /* @__PURE__ */ jsxs("div", { className: [styles$
|
|
6604
|
+
return /* @__PURE__ */ jsxs("div", { className: [styles$E.row, styles$E.discount].join(" "), children: [
|
|
6447
6605
|
/* @__PURE__ */ jsx("dt", { children: label2 }),
|
|
6448
6606
|
/* @__PURE__ */ jsx("dd", { children: `−${format(discount2)}` })
|
|
6449
6607
|
] }, key);
|
|
6450
6608
|
}
|
|
6451
6609
|
const pending2 = key !== "total" && isDeferred(key);
|
|
6452
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
6610
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$E.row, children: [
|
|
6453
6611
|
/* @__PURE__ */ jsx("dt", { children: label2 }),
|
|
6454
|
-
/* @__PURE__ */ jsx("dd", { className: pending2 ? styles$
|
|
6612
|
+
/* @__PURE__ */ jsx("dd", { className: pending2 ? styles$E.pending : void 0, children: pending2 ? "Calculated at checkout" : renderValue(key, pricing, format) })
|
|
6455
6613
|
] }, key);
|
|
6456
6614
|
}) });
|
|
6457
6615
|
}
|
|
6458
6616
|
function renderValue(key, pricing, format) {
|
|
6459
6617
|
if (key === "shipping" && pricing.shipping.amount === 0) {
|
|
6460
|
-
return /* @__PURE__ */ jsx("span", { className: styles$
|
|
6618
|
+
return /* @__PURE__ */ jsx("span", { className: styles$E.free, children: "Free" });
|
|
6461
6619
|
}
|
|
6462
6620
|
return key === "discount" ? null : format(pricing[key]);
|
|
6463
6621
|
}
|
|
6464
6622
|
const lines$1 = "_lines_7mr8w_19";
|
|
6465
|
-
const line = "_line_7mr8w_19";
|
|
6466
|
-
const thumb = "_thumb_7mr8w_34";
|
|
6623
|
+
const line$2 = "_line_7mr8w_19";
|
|
6624
|
+
const thumb$2 = "_thumb_7mr8w_34";
|
|
6467
6625
|
const image$9 = "_image_7mr8w_44";
|
|
6468
|
-
const placeholder$
|
|
6626
|
+
const placeholder$8 = "_placeholder_7mr8w_48";
|
|
6469
6627
|
const lineBody = "_lineBody_7mr8w_53";
|
|
6470
6628
|
const lineText = "_lineText_7mr8w_62";
|
|
6471
6629
|
const lineTitle = "_lineTitle_7mr8w_72";
|
|
6472
6630
|
const lineMeta = "_lineMeta_7mr8w_91";
|
|
6473
6631
|
const linePrice = "_linePrice_7mr8w_106";
|
|
6474
|
-
const paid$
|
|
6475
|
-
const was$
|
|
6476
|
-
const card$
|
|
6632
|
+
const paid$3 = "_paid_7mr8w_118";
|
|
6633
|
+
const was$4 = "_was_7mr8w_124";
|
|
6634
|
+
const card$4 = "_card_7mr8w_144";
|
|
6477
6635
|
const cardTitle = "_cardTitle_7mr8w_152";
|
|
6478
6636
|
const cardBody = "_cardBody_7mr8w_164";
|
|
6479
6637
|
const summaryCard = "_summaryCard_7mr8w_136";
|
|
6480
|
-
const styles$
|
|
6638
|
+
const styles$D = {
|
|
6481
6639
|
lines: lines$1,
|
|
6482
|
-
line,
|
|
6483
|
-
thumb,
|
|
6640
|
+
line: line$2,
|
|
6641
|
+
thumb: thumb$2,
|
|
6484
6642
|
image: image$9,
|
|
6485
|
-
placeholder: placeholder$
|
|
6643
|
+
placeholder: placeholder$8,
|
|
6486
6644
|
lineBody,
|
|
6487
6645
|
lineText,
|
|
6488
6646
|
lineTitle,
|
|
6489
6647
|
lineMeta,
|
|
6490
6648
|
linePrice,
|
|
6491
|
-
paid: paid$
|
|
6492
|
-
was: was$
|
|
6493
|
-
card: card$
|
|
6649
|
+
paid: paid$3,
|
|
6650
|
+
was: was$4,
|
|
6651
|
+
card: card$4,
|
|
6494
6652
|
cardTitle,
|
|
6495
6653
|
cardBody,
|
|
6496
6654
|
summaryCard
|
|
@@ -6506,19 +6664,19 @@ function OrderLine({ item: item2 }) {
|
|
|
6506
6664
|
const compareAt2 = item2.compare_at_unit_price;
|
|
6507
6665
|
const pct = compareAt2 ? discountPct(item2.unit_price, compareAt2) : void 0;
|
|
6508
6666
|
const details2 = detailsOf(item2);
|
|
6509
|
-
return /* @__PURE__ */ jsxs("li", { className: styles$
|
|
6510
|
-
/* @__PURE__ */ jsx("div", { className: styles$
|
|
6511
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
6512
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
6513
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
6514
|
-
/* @__PURE__ */ jsxs("span", { className: styles$
|
|
6667
|
+
return /* @__PURE__ */ jsxs("li", { className: styles$D.line, children: [
|
|
6668
|
+
/* @__PURE__ */ jsx("div", { className: styles$D.thumb, children: item2.image ? /* @__PURE__ */ jsx(ShopImage, { src: item2.image, alt: "", fill: true, sizes: "48px", className: styles$D.image }) : /* @__PURE__ */ jsx("div", { className: styles$D.placeholder, "aria-hidden": "true" }) }),
|
|
6669
|
+
/* @__PURE__ */ jsxs("div", { className: styles$D.lineBody, children: [
|
|
6670
|
+
/* @__PURE__ */ jsxs("div", { className: styles$D.lineText, children: [
|
|
6671
|
+
/* @__PURE__ */ jsx("span", { className: styles$D.lineTitle, children: item2.title ?? item2.sku }),
|
|
6672
|
+
/* @__PURE__ */ jsxs("span", { className: styles$D.lineMeta, children: [
|
|
6515
6673
|
details2.map((detail2) => /* @__PURE__ */ jsx("span", { children: detail2 }, detail2)),
|
|
6516
6674
|
pct !== void 0 && /* @__PURE__ */ jsx(SaleBadge, { pct })
|
|
6517
6675
|
] })
|
|
6518
6676
|
] }),
|
|
6519
|
-
/* @__PURE__ */ jsxs("span", { className: styles$
|
|
6520
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
6521
|
-
compareAt2 && /* @__PURE__ */ jsxs("span", { className: styles$
|
|
6677
|
+
/* @__PURE__ */ jsxs("span", { className: styles$D.linePrice, children: [
|
|
6678
|
+
/* @__PURE__ */ jsx("span", { className: styles$D.paid, children: format(item2.line_total) }),
|
|
6679
|
+
compareAt2 && /* @__PURE__ */ jsxs("span", { className: styles$D.was, children: [
|
|
6522
6680
|
/* @__PURE__ */ jsx("span", { className: "visually-hidden", children: `Was ${format(compareAt2)}` }),
|
|
6523
6681
|
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: format(compareAt2) })
|
|
6524
6682
|
] })
|
|
@@ -6527,17 +6685,17 @@ function OrderLine({ item: item2 }) {
|
|
|
6527
6685
|
] });
|
|
6528
6686
|
}
|
|
6529
6687
|
function OrderLines({ order }) {
|
|
6530
|
-
return /* @__PURE__ */ jsx("ul", { className: styles$
|
|
6688
|
+
return /* @__PURE__ */ jsx("ul", { className: styles$D.lines, "aria-label": "Items", children: order.items.map((item2) => /* @__PURE__ */ jsx(OrderLine, { item: item2 }, item2.line_ref)) });
|
|
6531
6689
|
}
|
|
6532
6690
|
function ShippingAddressCard({ order }) {
|
|
6533
|
-
return /* @__PURE__ */ jsxs("section", { className: styles$
|
|
6534
|
-
/* @__PURE__ */ jsx("h2", { className: styles$
|
|
6535
|
-
/* @__PURE__ */ jsx("p", { className: styles$
|
|
6691
|
+
return /* @__PURE__ */ jsxs("section", { className: styles$D.card, "aria-label": "Shipping address", children: [
|
|
6692
|
+
/* @__PURE__ */ jsx("h2", { className: styles$D.cardTitle, children: "Shipping address" }),
|
|
6693
|
+
/* @__PURE__ */ jsx("p", { className: styles$D.cardBody, children: formatAddress(order.ship_to) })
|
|
6536
6694
|
] });
|
|
6537
6695
|
}
|
|
6538
6696
|
function OrderSummaryCard({ order }) {
|
|
6539
|
-
return /* @__PURE__ */ jsxs("section", { className: [styles$
|
|
6540
|
-
/* @__PURE__ */ jsx("h2", { className: styles$
|
|
6697
|
+
return /* @__PURE__ */ jsxs("section", { className: [styles$D.card, styles$D.summaryCard].join(" "), "aria-label": "Order summary", children: [
|
|
6698
|
+
/* @__PURE__ */ jsx("h2", { className: styles$D.cardTitle, children: "Order summary" }),
|
|
6541
6699
|
/* @__PURE__ */ jsx(OrderSummary, { pricing: toPricing(order), rows: rowsFor(order), discount: order.totals.discount })
|
|
6542
6700
|
] });
|
|
6543
6701
|
}
|
|
@@ -6562,18 +6720,195 @@ function toPricing(order) {
|
|
|
6562
6720
|
function formatAddress(address) {
|
|
6563
6721
|
return [address.line1, address.line2, address.postcode, address.city, address.country].filter(Boolean).join(", ");
|
|
6564
6722
|
}
|
|
6565
|
-
const
|
|
6566
|
-
const
|
|
6567
|
-
const
|
|
6568
|
-
const
|
|
6569
|
-
const
|
|
6570
|
-
const
|
|
6571
|
-
const
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6723
|
+
const header$6 = "_header_1f3nh_7";
|
|
6724
|
+
const slot = "_slot_1f3nh_15";
|
|
6725
|
+
const handleSlot = "_handleSlot_1f3nh_23";
|
|
6726
|
+
const handle = "_handle_1f3nh_23";
|
|
6727
|
+
const closeSlot$1 = "_closeSlot_1f3nh_35";
|
|
6728
|
+
const close$2 = "_close_1f3nh_35";
|
|
6729
|
+
const styles$C = {
|
|
6730
|
+
header: header$6,
|
|
6731
|
+
slot,
|
|
6732
|
+
handleSlot,
|
|
6733
|
+
handle,
|
|
6734
|
+
closeSlot: closeSlot$1,
|
|
6735
|
+
close: close$2
|
|
6736
|
+
};
|
|
6737
|
+
function CloseIcon$1() {
|
|
6738
|
+
return /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("g", { transform: "translate(2.667 2.667)", children: /* @__PURE__ */ jsx(
|
|
6739
|
+
"path",
|
|
6740
|
+
{
|
|
6741
|
+
fillRule: "evenodd",
|
|
6742
|
+
clipRule: "evenodd",
|
|
6743
|
+
d: "M10.6667 1.12866L9.538 0L5.33333 4.21262L1.12866 0L0 1.12866L4.21262 5.33333L0 9.538L1.12866 10.6667L5.33333 6.45405L9.538 10.6667L10.6667 9.538L6.45405 5.33333L10.6667 1.12866Z",
|
|
6744
|
+
fill: "currentColor"
|
|
6745
|
+
}
|
|
6746
|
+
) }) });
|
|
6747
|
+
}
|
|
6748
|
+
function SheetHeader({ onClose, closeLabel }) {
|
|
6749
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$C.header, children: [
|
|
6750
|
+
/* @__PURE__ */ jsx("div", { className: styles$C.slot, "aria-hidden": "true" }),
|
|
6751
|
+
/* @__PURE__ */ jsx("div", { className: styles$C.handleSlot, "aria-hidden": "true", children: /* @__PURE__ */ jsx("div", { className: styles$C.handle }) }),
|
|
6752
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: styles$C.closeSlot, onClick: onClose, "aria-label": closeLabel, children: /* @__PURE__ */ jsx("span", { className: styles$C.close, children: /* @__PURE__ */ jsx(CloseIcon$1, {}) }) })
|
|
6753
|
+
] });
|
|
6754
|
+
}
|
|
6755
|
+
const FOCUSABLE = 'a[href], button:not([disabled]), textarea, input, select, [tabindex]:not([tabindex="-1"])';
|
|
6756
|
+
function useModalDialog(open, onClose, ref) {
|
|
6757
|
+
const handleKeyDown = useCallback(
|
|
6758
|
+
(e) => {
|
|
6759
|
+
if (e.key === "Escape") {
|
|
6760
|
+
e.preventDefault();
|
|
6761
|
+
onClose();
|
|
6762
|
+
return;
|
|
6763
|
+
}
|
|
6764
|
+
if (e.key !== "Tab") return;
|
|
6765
|
+
const dialog = ref.current;
|
|
6766
|
+
if (!dialog) return;
|
|
6767
|
+
const focusables = Array.from(dialog.querySelectorAll(FOCUSABLE)).filter(
|
|
6768
|
+
(el) => el.offsetParent !== null || el === document.activeElement
|
|
6769
|
+
);
|
|
6770
|
+
if (focusables.length === 0) {
|
|
6771
|
+
e.preventDefault();
|
|
6772
|
+
return;
|
|
6773
|
+
}
|
|
6774
|
+
const first = focusables[0];
|
|
6775
|
+
const last = focusables[focusables.length - 1];
|
|
6776
|
+
if (e.shiftKey && document.activeElement === first) {
|
|
6777
|
+
e.preventDefault();
|
|
6778
|
+
last.focus();
|
|
6779
|
+
} else if (!e.shiftKey && document.activeElement === last) {
|
|
6780
|
+
e.preventDefault();
|
|
6781
|
+
first.focus();
|
|
6782
|
+
}
|
|
6783
|
+
},
|
|
6784
|
+
[onClose, ref]
|
|
6785
|
+
);
|
|
6786
|
+
useEffect(() => {
|
|
6787
|
+
if (!open) return;
|
|
6788
|
+
const previouslyFocused = document.activeElement;
|
|
6789
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
6790
|
+
ref.current?.querySelector(FOCUSABLE)?.focus();
|
|
6791
|
+
const { overflow } = document.body.style;
|
|
6792
|
+
document.body.style.overflow = "hidden";
|
|
6793
|
+
return () => {
|
|
6794
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
6795
|
+
document.body.style.overflow = overflow;
|
|
6796
|
+
previouslyFocused?.focus?.();
|
|
6797
|
+
};
|
|
6798
|
+
}, [open, handleKeyDown, ref]);
|
|
6799
|
+
}
|
|
6800
|
+
const scrim$5 = "_scrim_7on4q_8";
|
|
6801
|
+
const sheet$3 = "_sheet_7on4q_20";
|
|
6802
|
+
const body$6 = "_body_7on4q_32";
|
|
6803
|
+
const title$l = "_title_7on4q_46";
|
|
6804
|
+
const options$1 = "_options_7on4q_54";
|
|
6805
|
+
const option$1 = "_option_7on4q_54";
|
|
6806
|
+
const radio = "_radio_7on4q_88";
|
|
6807
|
+
const label$1 = "_label_7on4q_118";
|
|
6808
|
+
const footer$1 = "_footer_7on4q_127";
|
|
6809
|
+
const error$1 = "_error_7on4q_135";
|
|
6810
|
+
const styles$B = {
|
|
6811
|
+
scrim: scrim$5,
|
|
6812
|
+
sheet: sheet$3,
|
|
6813
|
+
body: body$6,
|
|
6814
|
+
title: title$l,
|
|
6815
|
+
options: options$1,
|
|
6816
|
+
option: option$1,
|
|
6817
|
+
radio,
|
|
6818
|
+
label: label$1,
|
|
6819
|
+
footer: footer$1,
|
|
6820
|
+
error: error$1
|
|
6821
|
+
};
|
|
6822
|
+
function ReasonSheet({
|
|
6823
|
+
title: title2,
|
|
6824
|
+
options: options2,
|
|
6825
|
+
ctaLabel,
|
|
6826
|
+
selected: selected2,
|
|
6827
|
+
onConfirm,
|
|
6828
|
+
onClose,
|
|
6829
|
+
closeLabel,
|
|
6830
|
+
busy = false,
|
|
6831
|
+
error: error2
|
|
6832
|
+
}) {
|
|
6833
|
+
const sheetRef = useRef(null);
|
|
6834
|
+
const [choice, setChoice] = useState(selected2);
|
|
6835
|
+
useModalDialog(true, onClose, sheetRef);
|
|
6836
|
+
return /* @__PURE__ */ jsx("div", { className: styles$B.scrim, onClick: onClose, children: /* @__PURE__ */ jsxs(
|
|
6837
|
+
ShopSurface,
|
|
6838
|
+
{
|
|
6839
|
+
tone: "light",
|
|
6840
|
+
ref: sheetRef,
|
|
6841
|
+
className: styles$B.sheet,
|
|
6842
|
+
role: "dialog",
|
|
6843
|
+
"aria-modal": "true",
|
|
6844
|
+
"aria-labelledby": "reason-sheet-title",
|
|
6845
|
+
onClick: (e) => e.stopPropagation(),
|
|
6846
|
+
children: [
|
|
6847
|
+
/* @__PURE__ */ jsx(SheetHeader, { onClose, closeLabel }),
|
|
6848
|
+
/* @__PURE__ */ jsxs("div", { className: styles$B.body, children: [
|
|
6849
|
+
/* @__PURE__ */ jsx("h2", { id: "reason-sheet-title", className: styles$B.title, children: title2 }),
|
|
6850
|
+
/* @__PURE__ */ jsx("div", { className: styles$B.options, role: "radiogroup", "aria-labelledby": "reason-sheet-title", children: options2.map((o) => /* @__PURE__ */ jsxs(
|
|
6851
|
+
"button",
|
|
6852
|
+
{
|
|
6853
|
+
type: "button",
|
|
6854
|
+
role: "radio",
|
|
6855
|
+
"aria-checked": o.value === choice,
|
|
6856
|
+
className: styles$B.option,
|
|
6857
|
+
onClick: () => setChoice(o.value),
|
|
6858
|
+
children: [
|
|
6859
|
+
/* @__PURE__ */ jsx("span", { className: styles$B.radio, "aria-hidden": "true", children: o.value === choice && /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
|
|
6860
|
+
/* @__PURE__ */ jsx("circle", { cx: "10", cy: "10", r: "10", fill: "currentColor" }),
|
|
6861
|
+
/* @__PURE__ */ jsx(
|
|
6862
|
+
"path",
|
|
6863
|
+
{
|
|
6864
|
+
d: "m5.8 10.3 2.7 2.7 5.7-5.7",
|
|
6865
|
+
stroke: "var(--color-text-strong)",
|
|
6866
|
+
strokeWidth: "1.8",
|
|
6867
|
+
strokeLinecap: "round",
|
|
6868
|
+
strokeLinejoin: "round"
|
|
6869
|
+
}
|
|
6870
|
+
)
|
|
6871
|
+
] }) }),
|
|
6872
|
+
/* @__PURE__ */ jsx("span", { className: styles$B.label, children: o.label })
|
|
6873
|
+
]
|
|
6874
|
+
},
|
|
6875
|
+
o.value
|
|
6876
|
+
)) })
|
|
6877
|
+
] }),
|
|
6878
|
+
/* @__PURE__ */ jsxs("div", { className: styles$B.footer, children: [
|
|
6879
|
+
error2 && /* @__PURE__ */ jsx("p", { className: styles$B.error, role: "alert", children: error2 }),
|
|
6880
|
+
/* @__PURE__ */ jsx(
|
|
6881
|
+
Button,
|
|
6882
|
+
{
|
|
6883
|
+
variant: "primary",
|
|
6884
|
+
fullWidth: true,
|
|
6885
|
+
disabled: !choice,
|
|
6886
|
+
loading: busy,
|
|
6887
|
+
onClick: () => choice && onConfirm(choice),
|
|
6888
|
+
children: ctaLabel
|
|
6889
|
+
}
|
|
6890
|
+
)
|
|
6891
|
+
] })
|
|
6892
|
+
]
|
|
6893
|
+
}
|
|
6894
|
+
) });
|
|
6895
|
+
}
|
|
6896
|
+
const page$6 = "_page_opefg_8";
|
|
6897
|
+
const widget = "_widget_opefg_18";
|
|
6898
|
+
const titleRow = "_titleRow_opefg_26";
|
|
6899
|
+
const headline$1 = "_headline_opefg_42";
|
|
6900
|
+
const track$5 = "_track_opefg_61";
|
|
6901
|
+
const rule = "_rule_opefg_86";
|
|
6902
|
+
const help = "_help_opefg_96";
|
|
6903
|
+
const helpTitle = "_helpTitle_opefg_102";
|
|
6904
|
+
const helpRows = "_helpRows_opefg_109";
|
|
6905
|
+
const helpRow = "_helpRow_opefg_109";
|
|
6906
|
+
const cancel = "_cancel_opefg_167";
|
|
6907
|
+
const cancelledHead = "_cancelledHead_opefg_191";
|
|
6908
|
+
const cancelledTitle = "_cancelledTitle_opefg_197";
|
|
6909
|
+
const cancelledMeta = "_cancelledMeta_opefg_206";
|
|
6910
|
+
const styles$A = {
|
|
6911
|
+
page: page$6,
|
|
6577
6912
|
widget,
|
|
6578
6913
|
titleRow,
|
|
6579
6914
|
headline: headline$1,
|
|
@@ -6582,7 +6917,11 @@ const styles$x = {
|
|
|
6582
6917
|
help,
|
|
6583
6918
|
helpTitle,
|
|
6584
6919
|
helpRows,
|
|
6585
|
-
helpRow
|
|
6920
|
+
helpRow,
|
|
6921
|
+
cancel,
|
|
6922
|
+
cancelledHead,
|
|
6923
|
+
cancelledTitle,
|
|
6924
|
+
cancelledMeta
|
|
6586
6925
|
};
|
|
6587
6926
|
function RedirectLink() {
|
|
6588
6927
|
return /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: [
|
|
@@ -6618,13 +6957,19 @@ function OrderTrackingContent({
|
|
|
6618
6957
|
orderRef,
|
|
6619
6958
|
locale: localeProp,
|
|
6620
6959
|
onStartReturn,
|
|
6621
|
-
onContactSupport
|
|
6960
|
+
onContactSupport,
|
|
6961
|
+
onCancelled,
|
|
6962
|
+
onReorder
|
|
6622
6963
|
}) {
|
|
6623
6964
|
const { api } = useShop();
|
|
6624
6965
|
const locale = useLocale(localeProp);
|
|
6625
6966
|
const [order, setOrder] = useState(null);
|
|
6626
6967
|
const [state, setState] = useState("loading");
|
|
6627
6968
|
const [errorCode, setErrorCode] = useState(void 0);
|
|
6969
|
+
const [cancelOpen, setCancelOpen] = useState(false);
|
|
6970
|
+
const [cancelling, setCancelling] = useState(false);
|
|
6971
|
+
const [cancelError, setCancelError] = useState(null);
|
|
6972
|
+
const emit = useShopEvent();
|
|
6628
6973
|
const load = useCallback(async () => {
|
|
6629
6974
|
setState("loading");
|
|
6630
6975
|
try {
|
|
@@ -6639,7 +6984,7 @@ function OrderTrackingContent({
|
|
|
6639
6984
|
void load();
|
|
6640
6985
|
}, [load]);
|
|
6641
6986
|
if (state === "loading") {
|
|
6642
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
6987
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$A.page, children: [
|
|
6643
6988
|
/* @__PURE__ */ jsx(Skeleton, { height: 206, radius: 8 }),
|
|
6644
6989
|
/* @__PURE__ */ jsx(Skeleton, { height: 48, radius: 8 }),
|
|
6645
6990
|
/* @__PURE__ */ jsx(Skeleton, { height: 113, radius: 18 }),
|
|
@@ -6649,14 +6994,52 @@ function OrderTrackingContent({
|
|
|
6649
6994
|
if (state === "error" || !order) {
|
|
6650
6995
|
return /* @__PURE__ */ jsx(ErrorState, { code: errorCode, onRetry: () => void load() });
|
|
6651
6996
|
}
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6997
|
+
async function confirmCancellation(reason2) {
|
|
6998
|
+
setCancelling(true);
|
|
6999
|
+
setCancelError(null);
|
|
7000
|
+
try {
|
|
7001
|
+
const updated = await api.orders.requestCancellation(orderRef, { reason: reason2 });
|
|
7002
|
+
setOrder(updated);
|
|
7003
|
+
setCancelOpen(false);
|
|
7004
|
+
emit({ type: "order_cancellation_requested", orderRef, reason: reason2 });
|
|
7005
|
+
onCancelled?.(updated);
|
|
7006
|
+
} catch (err) {
|
|
7007
|
+
setCancelError(treatmentFor(codeOf(err)).body);
|
|
7008
|
+
} finally {
|
|
7009
|
+
setCancelling(false);
|
|
7010
|
+
}
|
|
7011
|
+
}
|
|
7012
|
+
if (order.status === "cancelled") {
|
|
7013
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$A.page, children: [
|
|
7014
|
+
/* @__PURE__ */ jsxs("div", { className: styles$A.cancelledHead, children: [
|
|
7015
|
+
/* @__PURE__ */ jsx("h1", { className: styles$A.cancelledTitle, children: "Order cancelled" }),
|
|
7016
|
+
/* @__PURE__ */ jsx("p", { className: styles$A.cancelledMeta, children: `Order #${shortRef$1(order.order_ref)} · Placed ${placedOn(order.placed_at, locale)}` })
|
|
7017
|
+
] }),
|
|
7018
|
+
onReorder && /* @__PURE__ */ jsx(
|
|
7019
|
+
Button,
|
|
7020
|
+
{
|
|
7021
|
+
variant: "primary",
|
|
7022
|
+
fullWidth: true,
|
|
7023
|
+
onClick: () => {
|
|
7024
|
+
emit({ type: "reorder_requested", orderRef: order.order_ref });
|
|
7025
|
+
onReorder();
|
|
7026
|
+
},
|
|
7027
|
+
children: "Reorder"
|
|
7028
|
+
}
|
|
7029
|
+
),
|
|
7030
|
+
/* @__PURE__ */ jsx(OrderLines, { order }),
|
|
7031
|
+
/* @__PURE__ */ jsx(ShippingAddressCard, { order }),
|
|
7032
|
+
/* @__PURE__ */ jsx(OrderSummaryCard, { order })
|
|
7033
|
+
] });
|
|
7034
|
+
}
|
|
7035
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$A.page, children: [
|
|
7036
|
+
/* @__PURE__ */ jsxs("section", { className: styles$A.widget, "aria-label": "Delivery status", children: [
|
|
7037
|
+
/* @__PURE__ */ jsxs("div", { className: styles$A.titleRow, children: [
|
|
7038
|
+
/* @__PURE__ */ jsx("h1", { className: styles$A.headline, children: `Order #${shortRef$1(order.order_ref)}` }),
|
|
6656
7039
|
order.tracking?.url && /* @__PURE__ */ jsxs(
|
|
6657
7040
|
"a",
|
|
6658
7041
|
{
|
|
6659
|
-
className: styles$
|
|
7042
|
+
className: styles$A.track,
|
|
6660
7043
|
href: order.tracking.url,
|
|
6661
7044
|
target: "_blank",
|
|
6662
7045
|
rel: "noopener noreferrer",
|
|
@@ -6675,12 +7058,14 @@ function OrderTrackingContent({
|
|
|
6675
7058
|
...order.estimated_delivery ? { estimatedDelivery: order.estimated_delivery } : {},
|
|
6676
7059
|
locale
|
|
6677
7060
|
}
|
|
6678
|
-
)
|
|
7061
|
+
),
|
|
7062
|
+
order.can_return && onStartReturn && /* @__PURE__ */ jsx(Button, { variant: "secondary", fullWidth: true, onClick: onStartReturn, children: "Return items" })
|
|
6679
7063
|
] }),
|
|
6680
|
-
/* @__PURE__ */ jsx("hr", { className: styles$
|
|
7064
|
+
/* @__PURE__ */ jsx("hr", { className: styles$A.rule }),
|
|
6681
7065
|
/* @__PURE__ */ jsx(OrderLines, { order }),
|
|
6682
7066
|
/* @__PURE__ */ jsx(ShippingAddressCard, { order }),
|
|
6683
7067
|
/* @__PURE__ */ jsx(OrderSummaryCard, { order }),
|
|
7068
|
+
order.can_cancel && /* @__PURE__ */ jsx("button", { type: "button", className: styles$A.cancel, onClick: () => setCancelOpen(true), children: "Cancel order" }),
|
|
6684
7069
|
/* @__PURE__ */ jsx(
|
|
6685
7070
|
NeedHelp,
|
|
6686
7071
|
{
|
|
@@ -6688,9 +7073,33 @@ function OrderTrackingContent({
|
|
|
6688
7073
|
...onStartReturn ? { onStartReturn } : {},
|
|
6689
7074
|
...onContactSupport ? { onContactSupport } : {}
|
|
6690
7075
|
}
|
|
7076
|
+
),
|
|
7077
|
+
cancelOpen && /* @__PURE__ */ jsx(
|
|
7078
|
+
ReasonSheet,
|
|
7079
|
+
{
|
|
7080
|
+
title: "Reason for cancelling",
|
|
7081
|
+
options: CANCEL_REASONS,
|
|
7082
|
+
ctaLabel: "Cancel order",
|
|
7083
|
+
closeLabel: "Close reasons",
|
|
7084
|
+
busy: cancelling,
|
|
7085
|
+
onClose: () => setCancelOpen(false),
|
|
7086
|
+
onConfirm: (reason2) => void confirmCancellation(reason2),
|
|
7087
|
+
...cancelError ? { error: cancelError } : {}
|
|
7088
|
+
}
|
|
6691
7089
|
)
|
|
6692
7090
|
] });
|
|
6693
7091
|
}
|
|
7092
|
+
const CANCEL_REASONS = [
|
|
7093
|
+
{ value: "changed_my_mind", label: "Changed my mind" },
|
|
7094
|
+
{ value: "ordered_by_mistake", label: "Ordered by mistake" },
|
|
7095
|
+
{ value: "delivery_too_long", label: "Delivery takes too long" }
|
|
7096
|
+
];
|
|
7097
|
+
function placedOn(iso, locale) {
|
|
7098
|
+
const d = new Date(iso);
|
|
7099
|
+
const day = d.getUTCDate();
|
|
7100
|
+
const month = new Intl.DateTimeFormat(locale, { month: "short", timeZone: "UTC" }).format(d);
|
|
7101
|
+
return `${day} ${month}, ${d.getUTCFullYear()}`;
|
|
7102
|
+
}
|
|
6694
7103
|
function NeedHelp({
|
|
6695
7104
|
order,
|
|
6696
7105
|
onStartReturn,
|
|
@@ -6698,9 +7107,9 @@ function NeedHelp({
|
|
|
6698
7107
|
}) {
|
|
6699
7108
|
const emit = useShopEvent();
|
|
6700
7109
|
if (order.status !== "delivered") return null;
|
|
6701
|
-
return /* @__PURE__ */ jsxs("section", { className: styles$
|
|
6702
|
-
/* @__PURE__ */ jsx("h2", { className: styles$
|
|
6703
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
7110
|
+
return /* @__PURE__ */ jsxs("section", { className: styles$A.help, "aria-labelledby": "order-help", children: [
|
|
7111
|
+
/* @__PURE__ */ jsx("h2", { className: styles$A.helpTitle, id: "order-help", children: "Need help?" }),
|
|
7112
|
+
/* @__PURE__ */ jsxs("div", { className: styles$A.helpRows, children: [
|
|
6704
7113
|
onStartReturn && /* @__PURE__ */ jsx(HelpRow, { label: "Start a return", onClick: onStartReturn }),
|
|
6705
7114
|
/* @__PURE__ */ jsx(
|
|
6706
7115
|
HelpRow,
|
|
@@ -6716,7 +7125,7 @@ function NeedHelp({
|
|
|
6716
7125
|
] });
|
|
6717
7126
|
}
|
|
6718
7127
|
function HelpRow({ label: label2, onClick }) {
|
|
6719
|
-
return /* @__PURE__ */ jsxs("button", { type: "button", className: styles$
|
|
7128
|
+
return /* @__PURE__ */ jsxs("button", { type: "button", className: styles$A.helpRow, onClick, children: [
|
|
6720
7129
|
/* @__PURE__ */ jsx("span", { children: label2 }),
|
|
6721
7130
|
/* @__PURE__ */ jsx(ChevronRight$1, {})
|
|
6722
7131
|
] });
|
|
@@ -6724,6 +7133,398 @@ function HelpRow({ label: label2, onClick }) {
|
|
|
6724
7133
|
function shortRef$1(orderRef) {
|
|
6725
7134
|
return orderRef.replace(/^ord_/, "");
|
|
6726
7135
|
}
|
|
7136
|
+
const page$5 = "_page_1c7ro_7";
|
|
7137
|
+
const titles$2 = "_titles_1c7ro_15";
|
|
7138
|
+
const title$k = "_title_1c7ro_15";
|
|
7139
|
+
const subtitle$7 = "_subtitle_1c7ro_30";
|
|
7140
|
+
const list$2 = "_list_1c7ro_38";
|
|
7141
|
+
const card$3 = "_card_1c7ro_48";
|
|
7142
|
+
const checkSlot = "_checkSlot_1c7ro_61";
|
|
7143
|
+
const check = "_check_1c7ro_61";
|
|
7144
|
+
const row$6 = "_row_1c7ro_105";
|
|
7145
|
+
const line$1 = "_line_1c7ro_113";
|
|
7146
|
+
const thumb$1 = "_thumb_1c7ro_119";
|
|
7147
|
+
const img$1 = "_img_1c7ro_129";
|
|
7148
|
+
const placeholder$7 = "_placeholder_1c7ro_133";
|
|
7149
|
+
const meta$2 = "_meta_1c7ro_138";
|
|
7150
|
+
const name$2 = "_name_1c7ro_147";
|
|
7151
|
+
const attrs$1 = "_attrs_1c7ro_159";
|
|
7152
|
+
const price$3 = "_price_1c7ro_167";
|
|
7153
|
+
const paid$2 = "_paid_1c7ro_176";
|
|
7154
|
+
const was$3 = "_was_1c7ro_184";
|
|
7155
|
+
const reason = "_reason_1c7ro_199";
|
|
7156
|
+
const reasonSet = "_reasonSet_1c7ro_217";
|
|
7157
|
+
const styles$z = {
|
|
7158
|
+
page: page$5,
|
|
7159
|
+
titles: titles$2,
|
|
7160
|
+
title: title$k,
|
|
7161
|
+
subtitle: subtitle$7,
|
|
7162
|
+
list: list$2,
|
|
7163
|
+
card: card$3,
|
|
7164
|
+
checkSlot,
|
|
7165
|
+
check,
|
|
7166
|
+
row: row$6,
|
|
7167
|
+
line: line$1,
|
|
7168
|
+
thumb: thumb$1,
|
|
7169
|
+
img: img$1,
|
|
7170
|
+
placeholder: placeholder$7,
|
|
7171
|
+
meta: meta$2,
|
|
7172
|
+
name: name$2,
|
|
7173
|
+
attrs: attrs$1,
|
|
7174
|
+
price: price$3,
|
|
7175
|
+
paid: paid$2,
|
|
7176
|
+
was: was$3,
|
|
7177
|
+
reason,
|
|
7178
|
+
reasonSet
|
|
7179
|
+
};
|
|
7180
|
+
function Chevron$1() {
|
|
7181
|
+
return /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
7182
|
+
"path",
|
|
7183
|
+
{
|
|
7184
|
+
d: "m6.3 4.1 3.4 3.9-3.4 3.9",
|
|
7185
|
+
stroke: "currentColor",
|
|
7186
|
+
strokeWidth: "1.6",
|
|
7187
|
+
strokeLinecap: "round",
|
|
7188
|
+
strokeLinejoin: "round"
|
|
7189
|
+
}
|
|
7190
|
+
) });
|
|
7191
|
+
}
|
|
7192
|
+
function Tick() {
|
|
7193
|
+
return /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
7194
|
+
/* @__PURE__ */ jsx("circle", { cx: "10", cy: "10", r: "10", fill: "currentColor" }),
|
|
7195
|
+
/* @__PURE__ */ jsx(
|
|
7196
|
+
"path",
|
|
7197
|
+
{
|
|
7198
|
+
d: "m5.8 10.3 2.7 2.7 5.7-5.7",
|
|
7199
|
+
stroke: "var(--color-text-strong)",
|
|
7200
|
+
strokeWidth: "1.8",
|
|
7201
|
+
strokeLinecap: "round",
|
|
7202
|
+
strokeLinejoin: "round"
|
|
7203
|
+
}
|
|
7204
|
+
)
|
|
7205
|
+
] });
|
|
7206
|
+
}
|
|
7207
|
+
const RETURN_REASONS = [
|
|
7208
|
+
{ value: "too_large", label: "Too large" },
|
|
7209
|
+
{ value: "too_small", label: "Too small" },
|
|
7210
|
+
{ value: "arrived_too_late", label: "Arrived too late" },
|
|
7211
|
+
{ value: "item_damaged", label: "Item is damaged" },
|
|
7212
|
+
{ value: "not_as_described", label: "Item doesn't match description" },
|
|
7213
|
+
{ value: "changed_my_mind", label: "Changed my mind" }
|
|
7214
|
+
];
|
|
7215
|
+
const REASON_LABEL = new Map(RETURN_REASONS.map((r) => [r.value, r.label]));
|
|
7216
|
+
function ReturnItemsView({ order, onSubmit, busy = false }) {
|
|
7217
|
+
const { format } = useMoney();
|
|
7218
|
+
const [chosen, setChosen] = useState({});
|
|
7219
|
+
const [reasonFor, setReasonFor] = useState(null);
|
|
7220
|
+
const returnable = useMemo(
|
|
7221
|
+
() => order.items.filter((i) => i.qty - i.cancelled_qty - i.refunded_qty > 0),
|
|
7222
|
+
[order.items]
|
|
7223
|
+
);
|
|
7224
|
+
const selected2 = Object.entries(chosen).filter(([, reason2]) => reason2 !== void 0);
|
|
7225
|
+
const canSubmit = selected2.length > 0;
|
|
7226
|
+
function remaining(item2) {
|
|
7227
|
+
return item2.qty - item2.cancelled_qty - item2.refunded_qty;
|
|
7228
|
+
}
|
|
7229
|
+
function toggle2(lineRef) {
|
|
7230
|
+
if (lineRef in chosen) {
|
|
7231
|
+
setChosen((prev) => {
|
|
7232
|
+
const next = { ...prev };
|
|
7233
|
+
delete next[lineRef];
|
|
7234
|
+
return next;
|
|
7235
|
+
});
|
|
7236
|
+
return;
|
|
7237
|
+
}
|
|
7238
|
+
setChosen((prev) => ({ ...prev, [lineRef]: void 0 }));
|
|
7239
|
+
setReasonFor(lineRef);
|
|
7240
|
+
}
|
|
7241
|
+
function submit() {
|
|
7242
|
+
const items2 = returnable.filter((i) => chosen[i.line_ref]).map((i) => ({
|
|
7243
|
+
line_ref: i.line_ref,
|
|
7244
|
+
qty: remaining(i),
|
|
7245
|
+
reason: chosen[i.line_ref]
|
|
7246
|
+
}));
|
|
7247
|
+
if (items2.length > 0) onSubmit(items2);
|
|
7248
|
+
}
|
|
7249
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$z.page, children: [
|
|
7250
|
+
/* @__PURE__ */ jsxs("div", { className: styles$z.titles, children: [
|
|
7251
|
+
/* @__PURE__ */ jsx("h1", { className: styles$z.title, children: "What do you want to return?" }),
|
|
7252
|
+
/* @__PURE__ */ jsx("p", { className: styles$z.subtitle, children: "Select items you want to return" })
|
|
7253
|
+
] }),
|
|
7254
|
+
/* @__PURE__ */ jsx("div", { className: styles$z.list, children: returnable.map((item2) => {
|
|
7255
|
+
const picked = item2.line_ref in chosen;
|
|
7256
|
+
const reason2 = chosen[item2.line_ref];
|
|
7257
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$z.card, children: [
|
|
7258
|
+
/* @__PURE__ */ jsx(
|
|
7259
|
+
"button",
|
|
7260
|
+
{
|
|
7261
|
+
type: "button",
|
|
7262
|
+
role: "checkbox",
|
|
7263
|
+
"aria-checked": picked,
|
|
7264
|
+
"aria-label": item2.title ?? item2.sku,
|
|
7265
|
+
className: styles$z.checkSlot,
|
|
7266
|
+
onClick: () => toggle2(item2.line_ref),
|
|
7267
|
+
children: /* @__PURE__ */ jsx("span", { className: styles$z.check, children: picked ? /* @__PURE__ */ jsx(Tick, {}) : null })
|
|
7268
|
+
}
|
|
7269
|
+
),
|
|
7270
|
+
/* @__PURE__ */ jsxs("div", { className: styles$z.row, children: [
|
|
7271
|
+
/* @__PURE__ */ jsxs("div", { className: styles$z.line, children: [
|
|
7272
|
+
/* @__PURE__ */ jsx("div", { className: styles$z.thumb, children: item2.image ? /* @__PURE__ */ jsx(ShopImage, { src: item2.image, alt: "", fill: true, sizes: "48px", className: styles$z.img }) : /* @__PURE__ */ jsx("div", { className: styles$z.placeholder, "aria-hidden": "true" }) }),
|
|
7273
|
+
/* @__PURE__ */ jsxs("div", { className: styles$z.meta, children: [
|
|
7274
|
+
/* @__PURE__ */ jsx("p", { className: styles$z.name, children: item2.title ?? item2.sku }),
|
|
7275
|
+
item2.attributes?.size && /* @__PURE__ */ jsx("p", { className: styles$z.attrs, children: `Size: ${item2.attributes.size}` })
|
|
7276
|
+
] }),
|
|
7277
|
+
/* @__PURE__ */ jsxs("div", { className: styles$z.price, children: [
|
|
7278
|
+
/* @__PURE__ */ jsx("span", { className: styles$z.paid, children: format(item2.unit_price) }),
|
|
7279
|
+
item2.compare_at_unit_price && /* @__PURE__ */ jsx("span", { className: styles$z.was, children: format(item2.compare_at_unit_price) })
|
|
7280
|
+
] })
|
|
7281
|
+
] }),
|
|
7282
|
+
/* @__PURE__ */ jsxs(
|
|
7283
|
+
"button",
|
|
7284
|
+
{
|
|
7285
|
+
type: "button",
|
|
7286
|
+
className: `${styles$z.reason} ${reason2 ? styles$z.reasonSet : ""}`,
|
|
7287
|
+
onClick: () => setReasonFor(item2.line_ref),
|
|
7288
|
+
"aria-haspopup": "dialog",
|
|
7289
|
+
children: [
|
|
7290
|
+
/* @__PURE__ */ jsx("span", { children: reason2 ? REASON_LABEL.get(reason2) : "Select reason" }),
|
|
7291
|
+
/* @__PURE__ */ jsx(Chevron$1, {})
|
|
7292
|
+
]
|
|
7293
|
+
}
|
|
7294
|
+
)
|
|
7295
|
+
] })
|
|
7296
|
+
] }, item2.line_ref);
|
|
7297
|
+
}) }),
|
|
7298
|
+
/* @__PURE__ */ jsx(Button, { variant: "primary", fullWidth: true, disabled: !canSubmit, loading: busy, onClick: submit, children: "Return selected items" }),
|
|
7299
|
+
reasonFor && /* @__PURE__ */ jsx(
|
|
7300
|
+
ReasonSheet,
|
|
7301
|
+
{
|
|
7302
|
+
title: "Reason for return",
|
|
7303
|
+
options: RETURN_REASONS,
|
|
7304
|
+
ctaLabel: "Select",
|
|
7305
|
+
...chosen[reasonFor] ? { selected: chosen[reasonFor] } : {},
|
|
7306
|
+
closeLabel: "Close reasons",
|
|
7307
|
+
onClose: () => setReasonFor(null),
|
|
7308
|
+
onConfirm: (value2) => {
|
|
7309
|
+
setChosen((prev) => ({ ...prev, [reasonFor]: value2 }));
|
|
7310
|
+
setReasonFor(null);
|
|
7311
|
+
}
|
|
7312
|
+
}
|
|
7313
|
+
)
|
|
7314
|
+
] });
|
|
7315
|
+
}
|
|
7316
|
+
const page$4 = "_page_1r0ea_7";
|
|
7317
|
+
const intro$1 = "_intro_1r0ea_15";
|
|
7318
|
+
const title$j = "_title_1r0ea_22";
|
|
7319
|
+
const subtitle$6 = "_subtitle_1r0ea_31";
|
|
7320
|
+
const card$2 = "_card_1r0ea_39";
|
|
7321
|
+
const step = "_step_1r0ea_49";
|
|
7322
|
+
const step2 = "_step2_1r0ea_56";
|
|
7323
|
+
const stepHead = "_stepHead_1r0ea_62";
|
|
7324
|
+
const number = "_number_1r0ea_69";
|
|
7325
|
+
const stepTitle = "_stepTitle_1r0ea_84";
|
|
7326
|
+
const body$5 = "_body_1r0ea_95";
|
|
7327
|
+
const body2 = "_body2_1r0ea_103";
|
|
7328
|
+
const download = "_download_1r0ea_121";
|
|
7329
|
+
const note$1 = "_note_1r0ea_143";
|
|
7330
|
+
const styles$y = {
|
|
7331
|
+
page: page$4,
|
|
7332
|
+
intro: intro$1,
|
|
7333
|
+
title: title$j,
|
|
7334
|
+
subtitle: subtitle$6,
|
|
7335
|
+
card: card$2,
|
|
7336
|
+
step,
|
|
7337
|
+
step2,
|
|
7338
|
+
stepHead,
|
|
7339
|
+
number,
|
|
7340
|
+
stepTitle,
|
|
7341
|
+
body: body$5,
|
|
7342
|
+
body2,
|
|
7343
|
+
download,
|
|
7344
|
+
note: note$1
|
|
7345
|
+
};
|
|
7346
|
+
function ReturnLabelView({ ret, onDone }) {
|
|
7347
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$y.page, children: [
|
|
7348
|
+
/* @__PURE__ */ jsxs("div", { className: styles$y.intro, children: [
|
|
7349
|
+
/* @__PURE__ */ jsx("h1", { className: styles$y.title, children: "We’ve generated your return label" }),
|
|
7350
|
+
/* @__PURE__ */ jsx("p", { className: styles$y.subtitle, children: "Follow the instructions below to complete your return" })
|
|
7351
|
+
] }),
|
|
7352
|
+
/* @__PURE__ */ jsxs("div", { className: styles$y.card, children: [
|
|
7353
|
+
/* @__PURE__ */ jsxs("section", { className: styles$y.step, children: [
|
|
7354
|
+
/* @__PURE__ */ jsxs("div", { className: styles$y.stepHead, children: [
|
|
7355
|
+
/* @__PURE__ */ jsx("span", { className: styles$y.number, "aria-hidden": "true", children: "1" }),
|
|
7356
|
+
/* @__PURE__ */ jsx("h2", { className: styles$y.stepTitle, children: "Download your return label" })
|
|
7357
|
+
] }),
|
|
7358
|
+
/* @__PURE__ */ jsx("p", { className: styles$y.body, children: "Tap the button below to download your pre-paid return label" }),
|
|
7359
|
+
ret.label_url && /* @__PURE__ */ jsxs(
|
|
7360
|
+
"a",
|
|
7361
|
+
{
|
|
7362
|
+
className: styles$y.download,
|
|
7363
|
+
href: ret.label_url,
|
|
7364
|
+
target: "_blank",
|
|
7365
|
+
rel: "noopener noreferrer",
|
|
7366
|
+
children: [
|
|
7367
|
+
"Download return label",
|
|
7368
|
+
/* @__PURE__ */ jsx("span", { className: "visually-hidden", children: " (opens in a new tab)" })
|
|
7369
|
+
]
|
|
7370
|
+
}
|
|
7371
|
+
),
|
|
7372
|
+
ret.label_email && /* @__PURE__ */ jsxs("p", { className: styles$y.note, children: [
|
|
7373
|
+
"You’ll receive a shipping label PDF to your email as well.",
|
|
7374
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
7375
|
+
ret.label_email
|
|
7376
|
+
] })
|
|
7377
|
+
] }),
|
|
7378
|
+
/* @__PURE__ */ jsxs("section", { className: styles$y.step2, children: [
|
|
7379
|
+
/* @__PURE__ */ jsxs("div", { className: styles$y.stepHead, children: [
|
|
7380
|
+
/* @__PURE__ */ jsx("span", { className: styles$y.number, "aria-hidden": "true", children: "2" }),
|
|
7381
|
+
/* @__PURE__ */ jsx("h2", { className: styles$y.stepTitle, children: "Pack and ship the item" })
|
|
7382
|
+
] }),
|
|
7383
|
+
/* @__PURE__ */ jsxs("p", { className: styles$y.body2, children: [
|
|
7384
|
+
"Repackage the item securely and attach the return label to the outside of the package.",
|
|
7385
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
7386
|
+
"Drop it off at your local carrier or post office."
|
|
7387
|
+
] })
|
|
7388
|
+
] })
|
|
7389
|
+
] }),
|
|
7390
|
+
onDone && /* @__PURE__ */ jsx(Button, { variant: "primary", fullWidth: true, onClick: onDone, children: "Done" })
|
|
7391
|
+
] });
|
|
7392
|
+
}
|
|
7393
|
+
const page$3 = "_page_o44fl_8";
|
|
7394
|
+
const titles$1 = "_titles_o44fl_15";
|
|
7395
|
+
const title$i = "_title_o44fl_15";
|
|
7396
|
+
const subtitle$5 = "_subtitle_o44fl_30";
|
|
7397
|
+
const items$1 = "_items_o44fl_38";
|
|
7398
|
+
const item$1 = "_item_o44fl_38";
|
|
7399
|
+
const thumb = "_thumb_o44fl_53";
|
|
7400
|
+
const img = "_img_o44fl_63";
|
|
7401
|
+
const placeholder$6 = "_placeholder_o44fl_67";
|
|
7402
|
+
const meta$1 = "_meta_o44fl_72";
|
|
7403
|
+
const name$1 = "_name_o44fl_80";
|
|
7404
|
+
const attrs = "_attrs_o44fl_100";
|
|
7405
|
+
const price$2 = "_price_o44fl_115";
|
|
7406
|
+
const paid$1 = "_paid_o44fl_124";
|
|
7407
|
+
const was$2 = "_was_o44fl_132";
|
|
7408
|
+
const styles$x = {
|
|
7409
|
+
page: page$3,
|
|
7410
|
+
titles: titles$1,
|
|
7411
|
+
title: title$i,
|
|
7412
|
+
subtitle: subtitle$5,
|
|
7413
|
+
items: items$1,
|
|
7414
|
+
item: item$1,
|
|
7415
|
+
thumb,
|
|
7416
|
+
img,
|
|
7417
|
+
placeholder: placeholder$6,
|
|
7418
|
+
meta: meta$1,
|
|
7419
|
+
name: name$1,
|
|
7420
|
+
attrs,
|
|
7421
|
+
price: price$2,
|
|
7422
|
+
paid: paid$1,
|
|
7423
|
+
was: was$2
|
|
7424
|
+
};
|
|
7425
|
+
function pctOff(item2) {
|
|
7426
|
+
return item2.compare_at_unit_price ? discountPct(item2.unit_price, item2.compare_at_unit_price) : void 0;
|
|
7427
|
+
}
|
|
7428
|
+
function ReturnTrackingView({ ret, locale: localeProp }) {
|
|
7429
|
+
const locale = useLocale(localeProp);
|
|
7430
|
+
const { format } = useMoney();
|
|
7431
|
+
const reported = new Date(ret.reported_at).toLocaleDateString(locale, {
|
|
7432
|
+
day: "numeric",
|
|
7433
|
+
month: "short",
|
|
7434
|
+
year: "numeric",
|
|
7435
|
+
timeZone: "UTC"
|
|
7436
|
+
});
|
|
7437
|
+
return /* @__PURE__ */ jsx(ShopSurface, { tone: "light", fill: true, children: /* @__PURE__ */ jsxs("div", { className: styles$x.page, children: [
|
|
7438
|
+
/* @__PURE__ */ jsxs("div", { className: styles$x.titles, children: [
|
|
7439
|
+
/* @__PURE__ */ jsx("h1", { className: styles$x.title, children: "Return in progress" }),
|
|
7440
|
+
/* @__PURE__ */ jsx("p", { className: styles$x.subtitle, children: `Return #${ret.return_ref} · Reported ${reported}` })
|
|
7441
|
+
] }),
|
|
7442
|
+
/* @__PURE__ */ jsx(OrderTimeline, { progress: ret.progress, locale }),
|
|
7443
|
+
/* @__PURE__ */ jsx("ul", { className: styles$x.items, children: ret.items.map((item2) => /* @__PURE__ */ jsxs("li", { className: styles$x.item, children: [
|
|
7444
|
+
/* @__PURE__ */ jsx("div", { className: styles$x.thumb, children: item2.image ? /* @__PURE__ */ jsx(ShopImage, { src: item2.image, alt: "", fill: true, sizes: "48px", className: styles$x.img }) : /* @__PURE__ */ jsx("div", { className: styles$x.placeholder, "aria-hidden": "true" }) }),
|
|
7445
|
+
/* @__PURE__ */ jsxs("div", { className: styles$x.meta, children: [
|
|
7446
|
+
/* @__PURE__ */ jsx("p", { className: styles$x.name, children: item2.title ?? item2.sku }),
|
|
7447
|
+
(item2.attributes?.size || pctOff(item2)) && /* @__PURE__ */ jsxs("p", { className: styles$x.attrs, children: [
|
|
7448
|
+
item2.attributes?.size && /* @__PURE__ */ jsx("span", { children: `Size: ${item2.attributes.size}` }),
|
|
7449
|
+
pctOff(item2) !== void 0 && /* @__PURE__ */ jsx(SaleBadge, { pct: pctOff(item2) })
|
|
7450
|
+
] })
|
|
7451
|
+
] }),
|
|
7452
|
+
/* @__PURE__ */ jsxs("div", { className: styles$x.price, children: [
|
|
7453
|
+
/* @__PURE__ */ jsx("span", { className: styles$x.paid, children: format(item2.unit_price) }),
|
|
7454
|
+
item2.compare_at_unit_price && /* @__PURE__ */ jsx("span", { className: styles$x.was, children: format(item2.compare_at_unit_price) })
|
|
7455
|
+
] })
|
|
7456
|
+
] }, item2.line_ref)) })
|
|
7457
|
+
] }) });
|
|
7458
|
+
}
|
|
7459
|
+
function ReturnFlowView(props) {
|
|
7460
|
+
return /* @__PURE__ */ jsx(ShopSurface, { tone: "light", fill: true, children: /* @__PURE__ */ jsx(ReturnFlowContent, { ...props }) });
|
|
7461
|
+
}
|
|
7462
|
+
function ReturnFlowContent({ orderRef, returnRef, onDone, locale }) {
|
|
7463
|
+
const { api } = useShop();
|
|
7464
|
+
const emit = useShopEvent();
|
|
7465
|
+
const [order, setOrder] = useState(null);
|
|
7466
|
+
const [ret, setRet] = useState(null);
|
|
7467
|
+
const [state, setState] = useState("loading");
|
|
7468
|
+
const [errorCode, setErrorCode] = useState(void 0);
|
|
7469
|
+
const [busy, setBusy] = useState(false);
|
|
7470
|
+
const load = useCallback(async () => {
|
|
7471
|
+
setState("loading");
|
|
7472
|
+
try {
|
|
7473
|
+
if (returnRef) {
|
|
7474
|
+
setRet(await api.returns.get(returnRef));
|
|
7475
|
+
} else if (orderRef) {
|
|
7476
|
+
setOrder(await api.orders.get(orderRef));
|
|
7477
|
+
}
|
|
7478
|
+
setState("ready");
|
|
7479
|
+
} catch (err) {
|
|
7480
|
+
setErrorCode(codeOf(err));
|
|
7481
|
+
setState("error");
|
|
7482
|
+
}
|
|
7483
|
+
}, [api, orderRef, returnRef]);
|
|
7484
|
+
useEffect(() => {
|
|
7485
|
+
void load();
|
|
7486
|
+
}, [load]);
|
|
7487
|
+
async function submit(items2) {
|
|
7488
|
+
if (!orderRef) return;
|
|
7489
|
+
setBusy(true);
|
|
7490
|
+
try {
|
|
7491
|
+
const created = await api.orders.createReturn(orderRef, { items: items2 });
|
|
7492
|
+
setRet(created);
|
|
7493
|
+
emit({ type: "return_requested", orderRef, returnRef: created.return_ref });
|
|
7494
|
+
} catch (err) {
|
|
7495
|
+
setErrorCode(codeOf(err));
|
|
7496
|
+
setState("error");
|
|
7497
|
+
setBusy(false);
|
|
7498
|
+
}
|
|
7499
|
+
}
|
|
7500
|
+
if (state === "loading") {
|
|
7501
|
+
return /* @__PURE__ */ jsx(
|
|
7502
|
+
"div",
|
|
7503
|
+
{
|
|
7504
|
+
style: {
|
|
7505
|
+
padding: "var(--space-16)",
|
|
7506
|
+
display: "flex",
|
|
7507
|
+
flexDirection: "column",
|
|
7508
|
+
gap: "var(--space-16)"
|
|
7509
|
+
},
|
|
7510
|
+
children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx(Skeleton, { height: 88, radius: 8 }, i))
|
|
7511
|
+
}
|
|
7512
|
+
);
|
|
7513
|
+
}
|
|
7514
|
+
if (state === "error") {
|
|
7515
|
+
return /* @__PURE__ */ jsx(ErrorState, { code: errorCode, onRetry: () => void load() });
|
|
7516
|
+
}
|
|
7517
|
+
if (ret) {
|
|
7518
|
+
return ret.status === "reported" ? /* @__PURE__ */ jsx(ReturnLabelView, { ret, ...onDone ? { onDone } : {} }) : /* @__PURE__ */ jsx(ReturnTrackingView, { ret, ...locale ? { locale } : {} });
|
|
7519
|
+
}
|
|
7520
|
+
if (!order) {
|
|
7521
|
+
return /* @__PURE__ */ jsx(ErrorState, { code: errorCode, onRetry: () => void load() });
|
|
7522
|
+
}
|
|
7523
|
+
if (!order.can_return) {
|
|
7524
|
+
return /* @__PURE__ */ jsx(ErrorState, { code: "order_not_cancellable", onRetry: () => void load() });
|
|
7525
|
+
}
|
|
7526
|
+
return /* @__PURE__ */ jsx(ReturnItemsView, { order, onSubmit: (items2) => void submit(items2), busy });
|
|
7527
|
+
}
|
|
6727
7528
|
const page$2 = "_page_1s8l9_6";
|
|
6728
7529
|
const confirmed = "_confirmed_1s8l9_16";
|
|
6729
7530
|
const title$h = "_title_1s8l9_22";
|
|
@@ -6924,7 +7725,7 @@ function OrderCard({
|
|
|
6924
7725
|
locale,
|
|
6925
7726
|
onOpen
|
|
6926
7727
|
}) {
|
|
6927
|
-
const
|
|
7728
|
+
const body3 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6928
7729
|
/* @__PURE__ */ jsxs("div", { className: styles$u.head, children: [
|
|
6929
7730
|
/* @__PURE__ */ jsxs("div", { className: styles$u.heading, children: [
|
|
6930
7731
|
/* @__PURE__ */ jsx("span", { className: styles$u.title, children: `Order #${shortRef(order.order_ref)}` }),
|
|
@@ -6937,7 +7738,7 @@ function OrderCard({
|
|
|
6937
7738
|
onOpen && /* @__PURE__ */ jsx("span", { className: styles$u.chevron, children: /* @__PURE__ */ jsx(Chevron, {}) })
|
|
6938
7739
|
] })
|
|
6939
7740
|
] });
|
|
6940
|
-
if (!onOpen) return /* @__PURE__ */ jsx("div", { className: styles$u.card, children:
|
|
7741
|
+
if (!onOpen) return /* @__PURE__ */ jsx("div", { className: styles$u.card, children: body3 });
|
|
6941
7742
|
return /* @__PURE__ */ jsx(
|
|
6942
7743
|
"button",
|
|
6943
7744
|
{
|
|
@@ -6945,7 +7746,7 @@ function OrderCard({
|
|
|
6945
7746
|
className: [styles$u.card, styles$u.tappable].join(" "),
|
|
6946
7747
|
onClick: onOpen,
|
|
6947
7748
|
"aria-label": `Order ${shortRef(order.order_ref)}, ${order.headline}`,
|
|
6948
|
-
children:
|
|
7749
|
+
children: body3
|
|
6949
7750
|
}
|
|
6950
7751
|
);
|
|
6951
7752
|
}
|
|
@@ -6978,21 +7779,21 @@ function formatPlaced(iso, locale) {
|
|
|
6978
7779
|
const day = date2.toLocaleDateString(locale, { day: "numeric", month: "short" });
|
|
6979
7780
|
return `${day}, ${date2.toLocaleDateString(locale, { year: "numeric" })}`;
|
|
6980
7781
|
}
|
|
6981
|
-
const tile$1 = "
|
|
6982
|
-
const media$2 = "
|
|
6983
|
-
const image$7 = "
|
|
6984
|
-
const placeholder$4 = "
|
|
6985
|
-
const topBadge = "
|
|
6986
|
-
const saleBadge$2 = "
|
|
6987
|
-
const oos$3 = "
|
|
6988
|
-
const bottom = "
|
|
6989
|
-
const titlePrice$1 = "
|
|
6990
|
-
const title$f = "
|
|
6991
|
-
const swatches = "
|
|
6992
|
-
const swatch = "
|
|
6993
|
-
const swatchActive = "
|
|
6994
|
-
const swatchDot = "
|
|
6995
|
-
const large = "
|
|
7782
|
+
const tile$1 = "_tile_1io44_7";
|
|
7783
|
+
const media$2 = "_media_1io44_15";
|
|
7784
|
+
const image$7 = "_image_1io44_25";
|
|
7785
|
+
const placeholder$4 = "_placeholder_1io44_29";
|
|
7786
|
+
const topBadge = "_topBadge_1io44_37";
|
|
7787
|
+
const saleBadge$2 = "_saleBadge_1io44_78";
|
|
7788
|
+
const oos$3 = "_oos_1io44_86";
|
|
7789
|
+
const bottom = "_bottom_1io44_113";
|
|
7790
|
+
const titlePrice$1 = "_titlePrice_1io44_100";
|
|
7791
|
+
const title$f = "_title_1io44_5";
|
|
7792
|
+
const swatches = "_swatches_1io44_179";
|
|
7793
|
+
const swatch = "_swatch_1io44_179";
|
|
7794
|
+
const swatchActive = "_swatchActive_1io44_196";
|
|
7795
|
+
const swatchDot = "_swatchDot_1io44_200";
|
|
7796
|
+
const large = "_large_1io44_211";
|
|
6996
7797
|
const styles$t = {
|
|
6997
7798
|
tile: tile$1,
|
|
6998
7799
|
media: media$2,
|
|
@@ -7065,20 +7866,20 @@ function ProductTile({ product, priority, size = "default" }) {
|
|
|
7065
7866
|
}
|
|
7066
7867
|
);
|
|
7067
7868
|
}
|
|
7068
|
-
const section$3 = "
|
|
7069
|
-
const title$e = "
|
|
7070
|
-
const link = "
|
|
7071
|
-
const track$4 = "
|
|
7072
|
-
const frame = "
|
|
7073
|
-
const image$6 = "
|
|
7074
|
-
const placeholder$3 = "
|
|
7075
|
-
const saleBadge$1 = "
|
|
7076
|
-
const oos$2 = "
|
|
7077
|
-
const caption = "
|
|
7078
|
-
const name = "
|
|
7079
|
-
const price$1 = "
|
|
7080
|
-
const paid = "
|
|
7081
|
-
const was$1 = "
|
|
7869
|
+
const section$3 = "_section_1n5an_5";
|
|
7870
|
+
const title$e = "_title_1n5an_17";
|
|
7871
|
+
const link = "_link_1n5an_26";
|
|
7872
|
+
const track$4 = "_track_1n5an_38";
|
|
7873
|
+
const frame = "_frame_1n5an_58";
|
|
7874
|
+
const image$6 = "_image_1n5an_69";
|
|
7875
|
+
const placeholder$3 = "_placeholder_1n5an_73";
|
|
7876
|
+
const saleBadge$1 = "_saleBadge_1n5an_85";
|
|
7877
|
+
const oos$2 = "_oos_1n5an_93";
|
|
7878
|
+
const caption = "_caption_1n5an_109";
|
|
7879
|
+
const name = "_name_1n5an_122";
|
|
7880
|
+
const price$1 = "_price_1n5an_135";
|
|
7881
|
+
const paid = "_paid_1n5an_144";
|
|
7882
|
+
const was$1 = "_was_1n5an_150";
|
|
7082
7883
|
const styles$s = {
|
|
7083
7884
|
section: section$3,
|
|
7084
7885
|
title: title$e,
|
|
@@ -7233,7 +8034,7 @@ function ProductGrid({
|
|
|
7233
8034
|
] });
|
|
7234
8035
|
}
|
|
7235
8036
|
const rail = "_rail_11l7h_7";
|
|
7236
|
-
const header$
|
|
8037
|
+
const header$5 = "_header_11l7h_14";
|
|
7237
8038
|
const title$d = "_title_11l7h_21";
|
|
7238
8039
|
const seeAll = "_seeAll_11l7h_27";
|
|
7239
8040
|
const track$3 = "_track_11l7h_33";
|
|
@@ -7241,7 +8042,7 @@ const item = "_item_11l7h_50";
|
|
|
7241
8042
|
const inset = "_inset_11l7h_62";
|
|
7242
8043
|
const styles$p = {
|
|
7243
8044
|
rail,
|
|
7244
|
-
header: header$
|
|
8045
|
+
header: header$5,
|
|
7245
8046
|
title: title$d,
|
|
7246
8047
|
seeAll,
|
|
7247
8048
|
track: track$3,
|
|
@@ -7258,59 +8059,14 @@ function RailCarousel({ title: title2, products, seeAllTo, inset: inset2 }) {
|
|
|
7258
8059
|
/* @__PURE__ */ jsx("ul", { className: styles$p.track, children: products.map((product, i) => /* @__PURE__ */ jsx("li", { className: styles$p.item, children: /* @__PURE__ */ jsx(ProductTile, { product, priority: i < 2 }) }, product.sku)) })
|
|
7259
8060
|
] });
|
|
7260
8061
|
}
|
|
7261
|
-
const FOCUSABLE = 'a[href], button:not([disabled]), textarea, input, select, [tabindex]:not([tabindex="-1"])';
|
|
7262
|
-
function useModalDialog(open, onClose, ref) {
|
|
7263
|
-
const handleKeyDown = useCallback(
|
|
7264
|
-
(e) => {
|
|
7265
|
-
if (e.key === "Escape") {
|
|
7266
|
-
e.preventDefault();
|
|
7267
|
-
onClose();
|
|
7268
|
-
return;
|
|
7269
|
-
}
|
|
7270
|
-
if (e.key !== "Tab") return;
|
|
7271
|
-
const dialog = ref.current;
|
|
7272
|
-
if (!dialog) return;
|
|
7273
|
-
const focusables = Array.from(dialog.querySelectorAll(FOCUSABLE)).filter(
|
|
7274
|
-
(el) => el.offsetParent !== null || el === document.activeElement
|
|
7275
|
-
);
|
|
7276
|
-
if (focusables.length === 0) {
|
|
7277
|
-
e.preventDefault();
|
|
7278
|
-
return;
|
|
7279
|
-
}
|
|
7280
|
-
const first = focusables[0];
|
|
7281
|
-
const last = focusables[focusables.length - 1];
|
|
7282
|
-
if (e.shiftKey && document.activeElement === first) {
|
|
7283
|
-
e.preventDefault();
|
|
7284
|
-
last.focus();
|
|
7285
|
-
} else if (!e.shiftKey && document.activeElement === last) {
|
|
7286
|
-
e.preventDefault();
|
|
7287
|
-
first.focus();
|
|
7288
|
-
}
|
|
7289
|
-
},
|
|
7290
|
-
[onClose, ref]
|
|
7291
|
-
);
|
|
7292
|
-
useEffect(() => {
|
|
7293
|
-
if (!open) return;
|
|
7294
|
-
const previouslyFocused = document.activeElement;
|
|
7295
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
7296
|
-
ref.current?.querySelector(FOCUSABLE)?.focus();
|
|
7297
|
-
const { overflow } = document.body.style;
|
|
7298
|
-
document.body.style.overflow = "hidden";
|
|
7299
|
-
return () => {
|
|
7300
|
-
document.removeEventListener("keydown", handleKeyDown);
|
|
7301
|
-
document.body.style.overflow = overflow;
|
|
7302
|
-
previouslyFocused?.focus?.();
|
|
7303
|
-
};
|
|
7304
|
-
}, [open, handleKeyDown, ref]);
|
|
7305
|
-
}
|
|
7306
8062
|
const overlay$2 = "_overlay_s4eai_1";
|
|
7307
8063
|
const scrim$4 = "_scrim_s4eai_10";
|
|
7308
8064
|
const sheet$2 = "_sheet_s4eai_16";
|
|
7309
8065
|
const grabArea = "_grabArea_s4eai_41";
|
|
7310
8066
|
const grabber = "_grabber_s4eai_51";
|
|
7311
|
-
const header$
|
|
8067
|
+
const header$4 = "_header_s4eai_59";
|
|
7312
8068
|
const title$c = "_title_s4eai_67";
|
|
7313
|
-
const close$
|
|
8069
|
+
const close$1 = "_close_s4eai_71";
|
|
7314
8070
|
const body$4 = "_body_s4eai_84";
|
|
7315
8071
|
const footer = "_footer_s4eai_90";
|
|
7316
8072
|
const styles$o = {
|
|
@@ -7319,9 +8075,9 @@ const styles$o = {
|
|
|
7319
8075
|
sheet: sheet$2,
|
|
7320
8076
|
grabArea,
|
|
7321
8077
|
grabber,
|
|
7322
|
-
header: header$
|
|
8078
|
+
header: header$4,
|
|
7323
8079
|
title: title$c,
|
|
7324
|
-
close: close$
|
|
8080
|
+
close: close$1,
|
|
7325
8081
|
body: body$4,
|
|
7326
8082
|
footer
|
|
7327
8083
|
};
|
|
@@ -7397,6 +8153,18 @@ function BottomSheet({ open, onClose, title: title2, children, footer: footer2 }
|
|
|
7397
8153
|
)
|
|
7398
8154
|
] });
|
|
7399
8155
|
}
|
|
8156
|
+
const LOW_STOCK_THRESHOLD = 5;
|
|
8157
|
+
function isLowStock(available) {
|
|
8158
|
+
return available !== void 0 && available > 0 && available <= LOW_STOCK_THRESHOLD;
|
|
8159
|
+
}
|
|
8160
|
+
function lowStockLabel(available) {
|
|
8161
|
+
return `Only ${available} left`;
|
|
8162
|
+
}
|
|
8163
|
+
let idCounter = 0;
|
|
8164
|
+
function useStableId(prefix) {
|
|
8165
|
+
const [id] = useState(() => `${prefix}-${idCounter += 1}`);
|
|
8166
|
+
return id;
|
|
8167
|
+
}
|
|
7400
8168
|
const wrap$1 = "_wrap_1rmip_1";
|
|
7401
8169
|
const stepper = "_stepper_1rmip_10";
|
|
7402
8170
|
const cap = "_cap_1rmip_23";
|
|
@@ -7409,11 +8177,6 @@ const styles$n = {
|
|
|
7409
8177
|
button,
|
|
7410
8178
|
value: value$1
|
|
7411
8179
|
};
|
|
7412
|
-
let idCounter = 0;
|
|
7413
|
-
function useStableId(prefix) {
|
|
7414
|
-
const [id] = useState(() => `${prefix}-${idCounter += 1}`);
|
|
7415
|
-
return id;
|
|
7416
|
-
}
|
|
7417
8180
|
function TrashIcon() {
|
|
7418
8181
|
return /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxs("g", { transform: "translate(3.8633 3.227)", fill: "currentColor", children: [
|
|
7419
8182
|
/* @__PURE__ */ jsx("path", { d: "M4.92871 5.4375C5.31531 5.4375 5.62891 5.7511 5.62891 6.1377V9.7627C5.62841 10.1489 5.315 10.4619 4.92871 10.4619C4.54242 10.4619 4.22901 10.1489 4.22852 9.7627V6.1377C4.22852 5.7511 4.54211 5.4375 4.92871 5.4375Z" }),
|
|
@@ -7446,9 +8209,17 @@ function PlusIcon() {
|
|
|
7446
8209
|
}
|
|
7447
8210
|
) }) });
|
|
7448
8211
|
}
|
|
7449
|
-
function QtyStepper({
|
|
7450
|
-
|
|
8212
|
+
function QtyStepper({
|
|
8213
|
+
qty,
|
|
8214
|
+
max,
|
|
8215
|
+
onChange,
|
|
8216
|
+
onRemove,
|
|
8217
|
+
disabled: disabled2,
|
|
8218
|
+
capDescribedBy
|
|
8219
|
+
}) {
|
|
8220
|
+
const ownCapId = useStableId("qty-cap");
|
|
7451
8221
|
const atMax = max !== void 0 && qty >= max;
|
|
8222
|
+
const capId = capDescribedBy ?? ownCapId;
|
|
7452
8223
|
const willDelete = qty <= 1;
|
|
7453
8224
|
function decrement() {
|
|
7454
8225
|
if (willDelete) {
|
|
@@ -7487,28 +8258,34 @@ function QtyStepper({ qty, max, onChange, onRemove, disabled: disabled2 }) {
|
|
|
7487
8258
|
}
|
|
7488
8259
|
)
|
|
7489
8260
|
] }),
|
|
7490
|
-
atMax && /* @__PURE__ */ jsx("span", { id:
|
|
8261
|
+
atMax && capDescribedBy === void 0 && /* @__PURE__ */ jsx("span", { id: ownCapId, className: styles$n.cap, role: "status", children: max === 0 ? "Out of stock" : lowStockLabel(max) })
|
|
7491
8262
|
] });
|
|
7492
8263
|
}
|
|
7493
|
-
const
|
|
7494
|
-
const
|
|
7495
|
-
const
|
|
7496
|
-
const
|
|
7497
|
-
const
|
|
7498
|
-
const
|
|
7499
|
-
const
|
|
7500
|
-
const
|
|
7501
|
-
const
|
|
7502
|
-
const
|
|
7503
|
-
const
|
|
7504
|
-
const
|
|
7505
|
-
const
|
|
7506
|
-
const
|
|
7507
|
-
const
|
|
7508
|
-
const
|
|
8264
|
+
const line = "_line_1s2s6_6";
|
|
8265
|
+
const row$5 = "_row_1s2s6_12";
|
|
8266
|
+
const pending = "_pending_1s2s6_18";
|
|
8267
|
+
const labels = "_labels_1s2s6_24";
|
|
8268
|
+
const lowStock = "_lowStock_1s2s6_39";
|
|
8269
|
+
const media$1 = "_media_1s2s6_49";
|
|
8270
|
+
const image$5 = "_image_1s2s6_59";
|
|
8271
|
+
const placeholder$2 = "_placeholder_1s2s6_63";
|
|
8272
|
+
const saleBadge = "_saleBadge_1s2s6_76";
|
|
8273
|
+
const oos$1 = "_oos_1s2s6_91";
|
|
8274
|
+
const info$1 = "_info_1s2s6_104";
|
|
8275
|
+
const head = "_head_1s2s6_112";
|
|
8276
|
+
const meta = "_meta_1s2s6_119";
|
|
8277
|
+
const title$b = "_title_1s2s6_134";
|
|
8278
|
+
const details = "_details_1s2s6_152";
|
|
8279
|
+
const detail = "_detail_1s2s6_152";
|
|
8280
|
+
const price = "_price_1s2s6_171";
|
|
8281
|
+
const amount = "_amount_1s2s6_179";
|
|
8282
|
+
const was = "_was_1s2s6_188";
|
|
7509
8283
|
const styles$m = {
|
|
8284
|
+
line,
|
|
7510
8285
|
row: row$5,
|
|
7511
8286
|
pending,
|
|
8287
|
+
labels,
|
|
8288
|
+
lowStock,
|
|
7512
8289
|
media: media$1,
|
|
7513
8290
|
image: image$5,
|
|
7514
8291
|
placeholder: placeholder$2,
|
|
@@ -7529,7 +8306,7 @@ function CartLineItem({
|
|
|
7529
8306
|
title: title2,
|
|
7530
8307
|
image: image2,
|
|
7531
8308
|
compareAt: compareAt2,
|
|
7532
|
-
discountPct:
|
|
8309
|
+
discountPct: discountPct$1,
|
|
7533
8310
|
maxQty,
|
|
7534
8311
|
onQtyChange,
|
|
7535
8312
|
onRemove,
|
|
@@ -7539,38 +8316,47 @@ function CartLineItem({
|
|
|
7539
8316
|
const displayTitle = title2 ?? item2.title ?? item2.sku;
|
|
7540
8317
|
const displayImage = image2 ?? item2.image;
|
|
7541
8318
|
const pairs = variantPairs(item2.attributes);
|
|
7542
|
-
const
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
label2,
|
|
7554
|
-
": ",
|
|
7555
|
-
value2
|
|
7556
|
-
] }, key)) })
|
|
7557
|
-
] }),
|
|
7558
|
-
/* @__PURE__ */ jsxs("div", { className: styles$m.price, children: [
|
|
7559
|
-
/* @__PURE__ */ jsx("span", { className: styles$m.amount, children: format(item2.line_total) }),
|
|
7560
|
-
compareAt2 && /* @__PURE__ */ jsx("span", { className: styles$m.was, children: format(compareAt2) })
|
|
7561
|
-
] })
|
|
8319
|
+
const available = item2.available;
|
|
8320
|
+
const soldOut = available === 0;
|
|
8321
|
+
const lowStock2 = isLowStock(available);
|
|
8322
|
+
const pct = discountPct$1 ?? (compareAt2 ? discountPct(item2.unit_price, compareAt2) : void 0);
|
|
8323
|
+
const noticeId = useStableId("cart-line-stock");
|
|
8324
|
+
const notice = lowStock2 || soldOut ? noticeId : void 0;
|
|
8325
|
+
return /* @__PURE__ */ jsxs("div", { className: [styles$m.line, pending2 ? styles$m.pending : ""].join(" "), children: [
|
|
8326
|
+
/* @__PURE__ */ jsxs("div", { className: styles$m.row, children: [
|
|
8327
|
+
/* @__PURE__ */ jsxs("div", { className: styles$m.media, children: [
|
|
8328
|
+
displayImage ? /* @__PURE__ */ jsx(ShopImage, { src: displayImage, alt: "", fill: true, sizes: "100px", className: styles$m.image }) : /* @__PURE__ */ jsx("div", { className: styles$m.placeholder, "aria-hidden": "true" }),
|
|
8329
|
+
soldOut ? /* @__PURE__ */ jsx("span", { className: styles$m.oos, id: noticeId, children: "Out of stock" }) : pct !== void 0 && /* @__PURE__ */ jsx("span", { className: styles$m.saleBadge, children: /* @__PURE__ */ jsx(SaleBadge, { pct }) })
|
|
7562
8330
|
] }),
|
|
7563
|
-
/* @__PURE__ */
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
8331
|
+
/* @__PURE__ */ jsxs("div", { className: styles$m.info, children: [
|
|
8332
|
+
/* @__PURE__ */ jsxs("div", { className: styles$m.head, children: [
|
|
8333
|
+
/* @__PURE__ */ jsxs("div", { className: styles$m.meta, children: [
|
|
8334
|
+
/* @__PURE__ */ jsx("span", { className: styles$m.title, children: displayTitle }),
|
|
8335
|
+
pairs.length > 0 && /* @__PURE__ */ jsx("div", { className: styles$m.details, children: pairs.map(({ key, label: label2, value: value2 }) => /* @__PURE__ */ jsxs("span", { className: styles$m.detail, children: [
|
|
8336
|
+
label2,
|
|
8337
|
+
": ",
|
|
8338
|
+
value2
|
|
8339
|
+
] }, key)) })
|
|
8340
|
+
] }),
|
|
8341
|
+
/* @__PURE__ */ jsxs("div", { className: styles$m.price, children: [
|
|
8342
|
+
/* @__PURE__ */ jsx("span", { className: styles$m.amount, children: format(item2.line_total) }),
|
|
8343
|
+
compareAt2 && /* @__PURE__ */ jsx("span", { className: styles$m.was, children: format(compareAt2) })
|
|
8344
|
+
] })
|
|
8345
|
+
] }),
|
|
8346
|
+
/* @__PURE__ */ jsx(
|
|
8347
|
+
QtyStepper,
|
|
8348
|
+
{
|
|
8349
|
+
qty: item2.qty,
|
|
8350
|
+
max: maxQty,
|
|
8351
|
+
onChange: onQtyChange,
|
|
8352
|
+
onRemove,
|
|
8353
|
+
disabled: pending2,
|
|
8354
|
+
capDescribedBy: notice
|
|
8355
|
+
}
|
|
8356
|
+
)
|
|
8357
|
+
] })
|
|
8358
|
+
] }),
|
|
8359
|
+
lowStock2 && /* @__PURE__ */ jsx("div", { className: styles$m.labels, children: /* @__PURE__ */ jsx("span", { id: noticeId, className: styles$m.lowStock, role: "status", children: lowStockLabel(available) }) })
|
|
7574
8360
|
] });
|
|
7575
8361
|
}
|
|
7576
8362
|
const box$1 = "_box_1cf1a_1";
|
|
@@ -7745,12 +8531,16 @@ function CartViewContent({
|
|
|
7745
8531
|
).then((ok) => {
|
|
7746
8532
|
if (!ok || !removed) return;
|
|
7747
8533
|
emit({ type: "remove_from_cart", sku, qty: removed.qty });
|
|
7748
|
-
toast2.show("
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
8534
|
+
toast2.show("Removed from cart", {
|
|
8535
|
+
description: describeLine(removed),
|
|
8536
|
+
image: removed.image,
|
|
8537
|
+
action: {
|
|
8538
|
+
label: "Undo",
|
|
8539
|
+
onAction: () => {
|
|
8540
|
+
void mutate(sku, () => api.cart.addItem({ sku, qty: removed.qty })).then((undone) => {
|
|
8541
|
+
if (undone) emit({ type: "add_to_cart", sku, qty: removed.qty });
|
|
8542
|
+
});
|
|
8543
|
+
}
|
|
7754
8544
|
}
|
|
7755
8545
|
});
|
|
7756
8546
|
});
|
|
@@ -7805,7 +8595,6 @@ function CartViewContent({
|
|
|
7805
8595
|
setHandingOff(false);
|
|
7806
8596
|
}
|
|
7807
8597
|
}
|
|
7808
|
-
const locked = cart2.locked !== void 0;
|
|
7809
8598
|
const itemCount = cart2.items.reduce((n, i) => n + i.qty, 0);
|
|
7810
8599
|
return /* @__PURE__ */ jsxs("div", { className: styles$j.screen, children: [
|
|
7811
8600
|
/* @__PURE__ */ jsxs("div", { className: styles$j.body, children: [
|
|
@@ -7818,8 +8607,9 @@ function CartViewContent({
|
|
|
7818
8607
|
CartLineItem,
|
|
7819
8608
|
{
|
|
7820
8609
|
item: item2,
|
|
8610
|
+
...item2.compare_at_unit_price ? { compareAt: item2.compare_at_unit_price } : {},
|
|
7821
8611
|
maxQty: item2.available,
|
|
7822
|
-
pending:
|
|
8612
|
+
pending: pendingSku === item2.sku,
|
|
7823
8613
|
onQtyChange: (qty) => changeQty(item2.sku, qty),
|
|
7824
8614
|
onRemove: () => remove(item2.sku)
|
|
7825
8615
|
}
|
|
@@ -7831,21 +8621,18 @@ function CartViewContent({
|
|
|
7831
8621
|
{
|
|
7832
8622
|
pricing: cart2.totals,
|
|
7833
8623
|
deferred: ["shipping", "tax"],
|
|
8624
|
+
...cart2.totals.discount ? { discount: cart2.totals.discount } : {},
|
|
7834
8625
|
hidden: cart2.hidden_lines
|
|
7835
8626
|
}
|
|
7836
8627
|
)
|
|
7837
8628
|
] }),
|
|
7838
|
-
/* @__PURE__ */ jsx(StickyCtaBar, { variant: "divider", children: /* @__PURE__ */ jsx(
|
|
7839
|
-
Button,
|
|
7840
|
-
{
|
|
7841
|
-
variant: "primary",
|
|
7842
|
-
onClick: () => void handOff(cart2),
|
|
7843
|
-
disabled: handingOff,
|
|
7844
|
-
children: locked ? "Return to checkout" : checkoutLabel
|
|
7845
|
-
}
|
|
7846
|
-
) })
|
|
8629
|
+
/* @__PURE__ */ jsx(StickyCtaBar, { variant: "divider", children: /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: () => void handOff(cart2), disabled: handingOff, children: checkoutLabel }) })
|
|
7847
8630
|
] });
|
|
7848
8631
|
}
|
|
8632
|
+
function describeLine(item2) {
|
|
8633
|
+
const size = item2.attributes?.size;
|
|
8634
|
+
return [item2.title, size && `Size ${size}`].filter(Boolean).join(" · ") || void 0;
|
|
8635
|
+
}
|
|
7849
8636
|
const CartSheetContext = createContext(null);
|
|
7850
8637
|
function useCartSheet() {
|
|
7851
8638
|
return useContext(CartSheetContext);
|
|
@@ -7860,15 +8647,15 @@ function CartSheetProvider({ children }) {
|
|
|
7860
8647
|
isOpen && /* @__PURE__ */ jsx(BottomSheet, { open: true, onClose: close2, title: "Cart", children: /* @__PURE__ */ jsx(CartView, { onContinueShopping: close2 }) })
|
|
7861
8648
|
] });
|
|
7862
8649
|
}
|
|
7863
|
-
const gallery = "
|
|
7864
|
-
const track$2 = "
|
|
7865
|
-
const slide$1 = "
|
|
7866
|
-
const image$4 = "
|
|
7867
|
-
const placeholder$1 = "
|
|
7868
|
-
const share = "
|
|
7869
|
-
const dots$2 = "
|
|
7870
|
-
const dot$2 = "
|
|
7871
|
-
const dotActive$2 = "
|
|
8650
|
+
const gallery = "_gallery_10mch_1";
|
|
8651
|
+
const track$2 = "_track_10mch_8";
|
|
8652
|
+
const slide$1 = "_slide_10mch_32";
|
|
8653
|
+
const image$4 = "_image_10mch_39";
|
|
8654
|
+
const placeholder$1 = "_placeholder_10mch_43";
|
|
8655
|
+
const share = "_share_10mch_50";
|
|
8656
|
+
const dots$2 = "_dots_10mch_67";
|
|
8657
|
+
const dot$2 = "_dot_10mch_67";
|
|
8658
|
+
const dotActive$2 = "_dotActive_10mch_91";
|
|
7872
8659
|
const styles$i = {
|
|
7873
8660
|
gallery,
|
|
7874
8661
|
track: track$2,
|
|
@@ -7951,46 +8738,34 @@ function MediaGallery({ media: media2, alt }) {
|
|
|
7951
8738
|
)) })
|
|
7952
8739
|
] });
|
|
7953
8740
|
}
|
|
7954
|
-
const scrim$3 = "
|
|
7955
|
-
const sheet$1 = "
|
|
7956
|
-
const
|
|
7957
|
-
const
|
|
7958
|
-
const
|
|
7959
|
-
const
|
|
7960
|
-
const
|
|
7961
|
-
const
|
|
7962
|
-
const
|
|
7963
|
-
const
|
|
7964
|
-
const
|
|
7965
|
-
const
|
|
7966
|
-
const
|
|
7967
|
-
const
|
|
7968
|
-
const
|
|
7969
|
-
const
|
|
7970
|
-
const
|
|
7971
|
-
const
|
|
7972
|
-
const
|
|
7973
|
-
const
|
|
7974
|
-
const
|
|
7975
|
-
const
|
|
7976
|
-
const
|
|
7977
|
-
const
|
|
7978
|
-
const
|
|
7979
|
-
const howLabel = "_howLabel_v44fk_351";
|
|
7980
|
-
const howText = "_howText_v44fk_361";
|
|
7981
|
-
const fabric = "_fabric_v44fk_370";
|
|
7982
|
-
const fabricLabel = "_fabricLabel_v44fk_378";
|
|
7983
|
-
const fabricText = "_fabricText_v44fk_386";
|
|
7984
|
-
const notes = "_notes_v44fk_397";
|
|
8741
|
+
const scrim$3 = "_scrim_ddqa4_8";
|
|
8742
|
+
const sheet$1 = "_sheet_ddqa4_2";
|
|
8743
|
+
const body$2 = "_body_ddqa4_40";
|
|
8744
|
+
const titles = "_titles_ddqa4_60";
|
|
8745
|
+
const title$a = "_title_ddqa4_60";
|
|
8746
|
+
const subtitle$3 = "_subtitle_ddqa4_76";
|
|
8747
|
+
const units = "_units_ddqa4_89";
|
|
8748
|
+
const unit = "_unit_ddqa4_89";
|
|
8749
|
+
const unitOn = "_unitOn_ddqa4_123";
|
|
8750
|
+
const unitOff = "_unitOff_ddqa4_131";
|
|
8751
|
+
const tableWrap = "_tableWrap_ddqa4_140";
|
|
8752
|
+
const table = "_table_ddqa4_140";
|
|
8753
|
+
const col = "_col_ddqa4_165";
|
|
8754
|
+
const colEdge = "_colEdge_ddqa4_169";
|
|
8755
|
+
const note = "_note_ddqa4_237";
|
|
8756
|
+
const how = "_how_ddqa4_249";
|
|
8757
|
+
const howTitle = "_howTitle_ddqa4_255";
|
|
8758
|
+
const howList = "_howList_ddqa4_263";
|
|
8759
|
+
const howItem = "_howItem_ddqa4_270";
|
|
8760
|
+
const howLabel = "_howLabel_ddqa4_295";
|
|
8761
|
+
const howText = "_howText_ddqa4_305";
|
|
8762
|
+
const fabric = "_fabric_ddqa4_314";
|
|
8763
|
+
const fabricLabel = "_fabricLabel_ddqa4_322";
|
|
8764
|
+
const fabricText = "_fabricText_ddqa4_330";
|
|
8765
|
+
const notes = "_notes_ddqa4_341";
|
|
7985
8766
|
const styles$h = {
|
|
7986
8767
|
scrim: scrim$3,
|
|
7987
8768
|
sheet: sheet$1,
|
|
7988
|
-
header: header$4,
|
|
7989
|
-
slot,
|
|
7990
|
-
handleSlot,
|
|
7991
|
-
handle,
|
|
7992
|
-
closeSlot: closeSlot$1,
|
|
7993
|
-
close: close$1,
|
|
7994
8769
|
body: body$2,
|
|
7995
8770
|
titles,
|
|
7996
8771
|
title: title$a,
|
|
@@ -8015,17 +8790,6 @@ const styles$h = {
|
|
|
8015
8790
|
fabricText,
|
|
8016
8791
|
notes
|
|
8017
8792
|
};
|
|
8018
|
-
function CloseIcon$1() {
|
|
8019
|
-
return /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("g", { transform: "translate(2.667 2.667)", children: /* @__PURE__ */ jsx(
|
|
8020
|
-
"path",
|
|
8021
|
-
{
|
|
8022
|
-
fillRule: "evenodd",
|
|
8023
|
-
clipRule: "evenodd",
|
|
8024
|
-
d: "M10.6667 1.12866L9.538 0L5.33333 4.21262L1.12866 0L0 1.12866L4.21262 5.33333L0 9.538L1.12866 10.6667L5.33333 6.45405L9.538 10.6667L10.6667 9.538L6.45405 5.33333L10.6667 1.12866Z",
|
|
8025
|
-
fill: "currentColor"
|
|
8026
|
-
}
|
|
8027
|
-
) }) });
|
|
8028
|
-
}
|
|
8029
8793
|
const CM_PER_INCH = 2.54;
|
|
8030
8794
|
const UNIT_LABEL = { cm: "cm", in: "inches" };
|
|
8031
8795
|
function otherUnit(unit2) {
|
|
@@ -8062,20 +8826,7 @@ function SizeGuideSheet({ guide, onClose }) {
|
|
|
8062
8826
|
"aria-labelledby": "size-guide-title",
|
|
8063
8827
|
onClick: (e) => e.stopPropagation(),
|
|
8064
8828
|
children: [
|
|
8065
|
-
/* @__PURE__ */
|
|
8066
|
-
/* @__PURE__ */ jsx("div", { className: styles$h.slot, "aria-hidden": "true" }),
|
|
8067
|
-
/* @__PURE__ */ jsx("div", { className: styles$h.handleSlot, "aria-hidden": "true", children: /* @__PURE__ */ jsx("div", { className: styles$h.handle }) }),
|
|
8068
|
-
/* @__PURE__ */ jsx(
|
|
8069
|
-
"button",
|
|
8070
|
-
{
|
|
8071
|
-
type: "button",
|
|
8072
|
-
className: styles$h.closeSlot,
|
|
8073
|
-
onClick: onClose,
|
|
8074
|
-
"aria-label": "Close size guide",
|
|
8075
|
-
children: /* @__PURE__ */ jsx("span", { className: styles$h.close, children: /* @__PURE__ */ jsx(CloseIcon$1, {}) })
|
|
8076
|
-
}
|
|
8077
|
-
)
|
|
8078
|
-
] }),
|
|
8829
|
+
/* @__PURE__ */ jsx(SheetHeader, { onClose, closeLabel: "Close size guide" }),
|
|
8079
8830
|
/* @__PURE__ */ jsxs("div", { className: styles$h.body, children: [
|
|
8080
8831
|
/* @__PURE__ */ jsxs("div", { className: styles$h.titles, children: [
|
|
8081
8832
|
/* @__PURE__ */ jsx("h2", { id: "size-guide-title", className: styles$h.title, children: guide.title }),
|
|
@@ -8217,18 +8968,18 @@ function SizeSelector({
|
|
|
8217
8968
|
guide && guideOpen && /* @__PURE__ */ jsx(SizeGuideSheet, { guide, onClose: () => setGuideOpen(false) })
|
|
8218
8969
|
] });
|
|
8219
8970
|
}
|
|
8220
|
-
const root$1 = "
|
|
8221
|
-
const header$2 = "
|
|
8222
|
-
const title$8 = "
|
|
8223
|
-
const value = "
|
|
8224
|
-
const tiles = "
|
|
8225
|
-
const tile = "
|
|
8226
|
-
const selected$1 = "
|
|
8227
|
-
const media = "
|
|
8228
|
-
const image$3 = "
|
|
8229
|
-
const placeholder = "
|
|
8230
|
-
const scrim$2 = "
|
|
8231
|
-
const stockBadge = "
|
|
8971
|
+
const root$1 = "_root_1h4ny_1";
|
|
8972
|
+
const header$2 = "_header_1h4ny_9";
|
|
8973
|
+
const title$8 = "_title_1h4ny_18";
|
|
8974
|
+
const value = "_value_1h4ny_23";
|
|
8975
|
+
const tiles = "_tiles_1h4ny_28";
|
|
8976
|
+
const tile = "_tile_1h4ny_28";
|
|
8977
|
+
const selected$1 = "_selected_1h4ny_52";
|
|
8978
|
+
const media = "_media_1h4ny_36";
|
|
8979
|
+
const image$3 = "_image_1h4ny_64";
|
|
8980
|
+
const placeholder = "_placeholder_1h4ny_68";
|
|
8981
|
+
const scrim$2 = "_scrim_1h4ny_76";
|
|
8982
|
+
const stockBadge = "_stockBadge_1h4ny_95";
|
|
8232
8983
|
const styles$f = {
|
|
8233
8984
|
root: root$1,
|
|
8234
8985
|
header: header$2,
|
|
@@ -8253,7 +9004,7 @@ function ColorSelector({ colours, selected: selected2, onSelect }) {
|
|
|
8253
9004
|
/* @__PURE__ */ jsx("div", { className: styles$f.tiles, role: "radiogroup", "aria-label": "Color", "aria-required": "true", children: colours.map((c) => {
|
|
8254
9005
|
const isSelected = c.value === selected2;
|
|
8255
9006
|
const soldOut = !c.available;
|
|
8256
|
-
const
|
|
9007
|
+
const lowStock2 = !soldOut && isLowStock(c.remaining);
|
|
8257
9008
|
return /* @__PURE__ */ jsxs(
|
|
8258
9009
|
"button",
|
|
8259
9010
|
{
|
|
@@ -8268,7 +9019,7 @@ function ColorSelector({ colours, selected: selected2, onSelect }) {
|
|
|
8268
9019
|
c.image ? /* @__PURE__ */ jsx(ShopImage, { src: c.image, alt: "", fill: true, sizes: "79px", className: styles$f.image }) : /* @__PURE__ */ jsx("span", { className: styles$f.placeholder, "aria-hidden": "true" }),
|
|
8269
9020
|
soldOut && /* @__PURE__ */ jsx("span", { className: styles$f.scrim, "aria-hidden": "true", children: "Out of stock" })
|
|
8270
9021
|
] }),
|
|
8271
|
-
|
|
9022
|
+
lowStock2 && /* @__PURE__ */ jsx("span", { className: styles$f.stockBadge, "aria-hidden": "true", children: `${c.remaining} left` })
|
|
8272
9023
|
]
|
|
8273
9024
|
},
|
|
8274
9025
|
c.value
|
|
@@ -8353,14 +9104,34 @@ function paragraphsOf(description2) {
|
|
|
8353
9104
|
}
|
|
8354
9105
|
function ProductDetails({ description: description2 }) {
|
|
8355
9106
|
const [expanded, setExpanded] = useState(false);
|
|
9107
|
+
const [clipped, setClipped] = useState(null);
|
|
9108
|
+
const bodyRef = useRef(null);
|
|
8356
9109
|
const paragraphs = paragraphsOf(description2);
|
|
9110
|
+
useEffect(() => {
|
|
9111
|
+
if (expanded) return;
|
|
9112
|
+
const el = bodyRef.current;
|
|
9113
|
+
if (!el) return;
|
|
9114
|
+
const measure = () => setClipped(el.scrollHeight - el.clientHeight > 1);
|
|
9115
|
+
measure();
|
|
9116
|
+
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
|
|
9117
|
+
observer?.observe(el);
|
|
9118
|
+
const fonts = document.fonts;
|
|
9119
|
+
let live = true;
|
|
9120
|
+
void fonts?.ready.then(() => {
|
|
9121
|
+
if (live) measure();
|
|
9122
|
+
});
|
|
9123
|
+
return () => {
|
|
9124
|
+
live = false;
|
|
9125
|
+
observer?.disconnect();
|
|
9126
|
+
};
|
|
9127
|
+
}, [expanded, description2]);
|
|
8357
9128
|
if (paragraphs.length === 0) return null;
|
|
8358
9129
|
return /* @__PURE__ */ jsxs("section", { className: styles$d.root, "aria-labelledby": "details-heading", children: [
|
|
8359
9130
|
/* @__PURE__ */ jsxs("div", { className: styles$d.group, children: [
|
|
8360
9131
|
/* @__PURE__ */ jsx("h2", { id: "details-heading", className: styles$d.title, children: "Product details" }),
|
|
8361
|
-
/* @__PURE__ */ jsx("div", { className: [styles$d.body, expanded ? "" : styles$d.clamped].join(" "), children: paragraphs.map((p) => /* @__PURE__ */ jsx("p", { className: styles$d.paragraph, children: p }, p)) })
|
|
9132
|
+
/* @__PURE__ */ jsx("div", { ref: bodyRef, className: [styles$d.body, expanded ? "" : styles$d.clamped].join(" "), children: paragraphs.map((p) => /* @__PURE__ */ jsx("p", { className: styles$d.paragraph, children: p }, p)) })
|
|
8362
9133
|
] }),
|
|
8363
|
-
/* @__PURE__ */ jsx(
|
|
9134
|
+
clipped ? /* @__PURE__ */ jsx(
|
|
8364
9135
|
"button",
|
|
8365
9136
|
{
|
|
8366
9137
|
type: "button",
|
|
@@ -8369,7 +9140,7 @@ function ProductDetails({ description: description2 }) {
|
|
|
8369
9140
|
onClick: () => setExpanded((v) => !v),
|
|
8370
9141
|
children: expanded ? "Less" : "more"
|
|
8371
9142
|
}
|
|
8372
|
-
)
|
|
9143
|
+
) : null
|
|
8373
9144
|
] });
|
|
8374
9145
|
}
|
|
8375
9146
|
const row$3 = "_row_l4edh_1";
|
|
@@ -8589,9 +9360,9 @@ function ProductDetail({ product, inventory: inventory2, recommendations = [] })
|
|
|
8589
9360
|
const inCart = selectedSku !== null && added.includes(selectedSku);
|
|
8590
9361
|
const selectedVariant = hasVariants ? variants.find((v) => v.sku === selectedSku) : void 0;
|
|
8591
9362
|
const available = selectedVariant?.available ?? inventory2?.available ?? 0;
|
|
8592
|
-
const
|
|
8593
|
-
const stockNotice = !purchasable ||
|
|
8594
|
-
const availabilityLabel = !purchasable ? "Out of stock" :
|
|
9363
|
+
const lowStock2 = isLowStock(available);
|
|
9364
|
+
const stockNotice = !purchasable || lowStock2;
|
|
9365
|
+
const availabilityLabel = !purchasable ? "Out of stock" : lowStock2 ? lowStockLabel(available) : "";
|
|
8595
9366
|
const cta2 = purchasable ? (
|
|
8596
9367
|
/*
|
|
8597
9368
|
* Three labels, one button (5241:71382 / 5295:75115 / 5268:72907). "Adding to cart"
|
|
@@ -9583,10 +10354,17 @@ export {
|
|
|
9583
10354
|
ProductView,
|
|
9584
10355
|
PromoBanner,
|
|
9585
10356
|
QtyStepper,
|
|
10357
|
+
RETURN_REASONS,
|
|
9586
10358
|
RailCarousel,
|
|
10359
|
+
ReasonSheet,
|
|
10360
|
+
ReturnFlowView,
|
|
10361
|
+
ReturnItemsView,
|
|
10362
|
+
ReturnLabelView,
|
|
10363
|
+
ReturnTrackingView,
|
|
9587
10364
|
ReviewCarousel,
|
|
9588
10365
|
SaleBadge,
|
|
9589
10366
|
ScreenSkeleton,
|
|
10367
|
+
SheetHeader,
|
|
9590
10368
|
ShippingInfo,
|
|
9591
10369
|
ShopHeader,
|
|
9592
10370
|
HomeShowcase as ShopHome,
|