@wise/dynamic-flow-client 3.11.5 → 3.11.7
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/build/main.js +410 -231
- package/build/main.min.js +1 -1
- package/build/main.mjs +410 -231
- package/build/types/common/cameraCapture/CameraCapture.d.ts +16 -0
- package/build/types/{legacy/step/cameraStep → common}/cameraCapture/components/bottomBar/BottomBar.d.ts +2 -2
- package/build/types/common/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.d.ts +2 -0
- package/build/types/{legacy/step/cameraStep → common}/cameraCapture/hooks/useFullScreenOrientationLock.d.ts +2 -2
- package/build/types/{legacy/step/cameraStep → common}/cameraCapture/overlay/Overlay.d.ts +1 -1
- package/build/types/{legacy/step/cameraStep → common}/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.d.ts +1 -1
- package/build/types/common/cameraCapture/tracking/index.d.ts +8 -0
- package/build/types/common/errorBoundary/ErrorBoundary.d.ts +1 -1
- package/build/types/common/errorBoundary/ErrorBoundaryAlert.d.ts +1 -1
- package/build/types/common/httpClientContext/HttpClientContext.d.ts +2 -2
- package/build/types/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.d.ts +1 -1
- package/build/types/legacy/common/contexts/eventsContext/EventsContext.d.ts +1 -1
- package/build/types/legacy/common/contexts/featureContext/FeatureContext.d.ts +1 -1
- package/build/types/legacy/common/contexts/logContext/LogContext.d.ts +1 -1
- package/build/types/legacy/common/utils/index.d.ts +5 -5
- package/build/types/legacy/dynamic-flow-types.d.ts +2 -1
- package/build/types/legacy/dynamicFlow/BackButton.d.ts +1 -1
- package/build/types/legacy/dynamicFlow/DynamicFlow.d.ts +1 -1
- package/build/types/legacy/dynamicFlow/DynamicFlowStep.d.ts +1 -1
- package/build/types/legacy/dynamicFlow/utils/useLoader.d.ts +1 -1
- package/build/types/legacy/formControl/FormControl.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/JsonSchemaForm.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/genericSchema/GenericSchema.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/help/Help.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/objectSchema/ObjectSchema.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.d.ts +5 -5
- package/build/types/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.d.ts +1 -1
- package/build/types/legacy/layout/DynamicLayout.d.ts +1 -1
- package/build/types/legacy/layout/alert/DynamicAlert.d.ts +1 -1
- package/build/types/legacy/layout/box/DynamicBox.d.ts +1 -1
- package/build/types/legacy/layout/button/DynamicButton.d.ts +1 -1
- package/build/types/legacy/layout/columns/DynamicColumns.d.ts +1 -1
- package/build/types/legacy/layout/decision/DynamicDecision.d.ts +1 -1
- package/build/types/legacy/layout/divider/DynamicDivider.d.ts +1 -1
- package/build/types/legacy/layout/external/DynamicExternal.d.ts +1 -1
- package/build/types/legacy/layout/form/DynamicForm.d.ts +1 -1
- package/build/types/legacy/layout/heading/DynamicHeading.d.ts +1 -1
- package/build/types/legacy/layout/icon/DynamicIcon.d.ts +1 -1
- package/build/types/legacy/layout/icon/FlagIcon.d.ts +1 -1
- package/build/types/legacy/layout/icon/NamedIcon.d.ts +1 -1
- package/build/types/legacy/layout/image/DynamicImage.d.ts +1 -1
- package/build/types/legacy/layout/instructions/DynamicInstructions.d.ts +1 -1
- package/build/types/legacy/layout/list/DynamicStatusList.d.ts +1 -1
- package/build/types/legacy/layout/loadingIndicator/DynamicLoadingIndicator.d.ts +1 -1
- package/build/types/legacy/layout/markdown/DynamicMarkdown.d.ts +2 -2
- package/build/types/legacy/layout/modal/DynamicModal.d.ts +1 -1
- package/build/types/legacy/layout/paragraph/DynamicParagraph.d.ts +1 -1
- package/build/types/legacy/layout/review/DynamicReview.d.ts +1 -1
- package/build/types/legacy/layout/search/DynamicSearch.d.ts +1 -1
- package/build/types/legacy/layout/search/SearchInput.d.ts +1 -1
- package/build/types/legacy/layout/search/SearchResults.d.ts +2 -2
- package/build/types/legacy/layout/utils/getNavigationOptionMedia.d.ts +3 -3
- package/build/types/legacy/step/cameraStep/CameraStep.d.ts +1 -1
- package/build/types/legacy/step/externalConfirmationStep/ExternalConfirmationStep.d.ts +1 -1
- package/build/types/legacy/step/layoutStep/LayoutStep.d.ts +1 -1
- package/build/types/legacy/test-utils/DynamicFlowProviders.d.ts +1 -1
- package/build/types/legacy/test-utils/legacy-utils.d.ts +1 -1
- package/build/types/revamp/DynamicFlowCore.d.ts +1 -1
- package/build/types/revamp/DynamicFlowWise.d.ts +1 -1
- package/build/types/revamp/domain/components/AllOfComponent.d.ts +2 -2
- package/build/types/revamp/domain/components/BooleanInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/ConstComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/DateInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/IntegerInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/MultiSelectInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/MultiUploadInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/NumberInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/ObjectComponent.d.ts +2 -2
- package/build/types/revamp/domain/components/SelectInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/StepDomainComponent.d.ts +2 -2
- package/build/types/revamp/domain/components/TextInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/UploadInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/repeatableComponent/RepeatableComponent.d.ts +3 -3
- package/build/types/revamp/domain/features/persistAsync/getPerformPersistAsync.d.ts +1 -1
- package/build/types/revamp/domain/features/validationAsync/getPerformValidationAsync.d.ts +1 -1
- package/build/types/revamp/flow/executeRefresh.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/componentToRendererProps.d.ts +3 -3
- package/build/types/revamp/wise/renderers/MultiSelectInputRenderer.d.ts +1 -1
- package/build/types/revamp/wise/renderers/SearchRenderer/BlockSearchRendererComponent.d.ts +2 -2
- package/build/types/revamp/wise/renderers/SearchRenderer/ErrorResult.d.ts +1 -1
- package/build/types/revamp/wise/renderers/SearchRenderer/InlineSearchRendererComponent.d.ts +1 -1
- package/build/types/revamp/wise/renderers/SelectInputRenderer/OptionMedia.d.ts +1 -1
- package/build/types/revamp/wise/renderers/SelectInputRenderer/RadioInputRendererComponent.d.ts +1 -1
- package/build/types/revamp/wise/renderers/SelectInputRenderer/SegmentedInputRendererComponent.d.ts +1 -1
- package/build/types/revamp/wise/renderers/SelectInputRenderer/SelectInputRendererComponent.d.ts +1 -1
- package/build/types/revamp/wise/renderers/SelectInputRenderer/SelectTriggerMedia.d.ts +1 -1
- package/build/types/revamp/wise/renderers/SelectInputRenderer/TabInputRendererComponent.d.ts +1 -1
- package/build/types/revamp/wise/renderers/components/FieldInput.d.ts +1 -1
- package/build/types/revamp/wise/renderers/components/Help.d.ts +1 -1
- package/build/types/revamp/wise/renderers/components/LabelContentWithHelp.d.ts +1 -1
- package/build/types/revamp/wise/renderers/components/UploadFieldInput.d.ts +1 -1
- package/build/types/revamp/wise/renderers/components/VariableDateInput.d.ts +1 -1
- package/build/types/revamp/wise/renderers/components/VariableTextInput.d.ts +1 -1
- package/build/types/revamp/wise/renderers/components/icon/DynamicIcon.d.ts +1 -1
- package/build/types/revamp/wise/renderers/components/icon/FlagIcon.d.ts +1 -1
- package/build/types/revamp/wise/renderers/components/icon/NamedIcon.d.ts +1 -1
- package/build/types/revamp/wise/renderers/components/icon/NavigationOptionMedia.d.ts +1 -1
- package/build/types/revamp/wise/renderers/step/BackButton.d.ts +1 -1
- package/build/types/revamp/wise/renderers/step/ExternalConfirmationDialog.d.ts +1 -1
- package/build/types/test-utils/NeptuneProviders.d.ts +1 -1
- package/package.json +39 -33
- package/build/types/legacy/step/cameraStep/cameraCapture/CameraCapture.d.ts +0 -15
- package/build/types/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.d.ts +0 -2
- package/build/types/legacy/step/cameraStep/cameraCapture/tracking/index.d.ts +0 -8
- /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/CameraCapture.messages.d.ts +0 -0
- /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/components/index.d.ts +0 -0
- /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.d.ts +0 -0
- /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/hooks/useVideoConstraints.d.ts +0 -0
- /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/index.d.ts +0 -0
- /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/screens/index.d.ts +0 -0
- /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/types/index.d.ts +0 -0
- /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/utils/index.d.ts +0 -0
- /package/build/types/{legacy/common → common/cameraCapture}/utils/mobile-utils.d.ts +0 -0
- /package/build/types/{legacy/common → common}/utils/debounce.d.ts +0 -0
package/build/main.mjs
CHANGED
|
@@ -2002,7 +2002,7 @@ var quotelessJson = (obj) => {
|
|
|
2002
2002
|
const json = JSON.stringify(obj, null, 2);
|
|
2003
2003
|
return json.replace(/"([^"]+)":/g, "$1:");
|
|
2004
2004
|
};
|
|
2005
|
-
var ZodError = class extends Error {
|
|
2005
|
+
var ZodError = class _ZodError extends Error {
|
|
2006
2006
|
constructor(issues) {
|
|
2007
2007
|
super();
|
|
2008
2008
|
this.issues = [];
|
|
@@ -2060,6 +2060,11 @@ var ZodError = class extends Error {
|
|
|
2060
2060
|
processError(this);
|
|
2061
2061
|
return fieldErrors;
|
|
2062
2062
|
}
|
|
2063
|
+
static assert(value) {
|
|
2064
|
+
if (!(value instanceof _ZodError)) {
|
|
2065
|
+
throw new Error(`Not a ZodError: ${value}`);
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2063
2068
|
toString() {
|
|
2064
2069
|
return this.message;
|
|
2065
2070
|
}
|
|
@@ -2201,6 +2206,12 @@ var makeIssue = (params) => {
|
|
|
2201
2206
|
const fullIssue = __spreadProps2(__spreadValues2({}, issueData), {
|
|
2202
2207
|
path: fullPath
|
|
2203
2208
|
});
|
|
2209
|
+
if (issueData.message !== void 0) {
|
|
2210
|
+
return __spreadProps2(__spreadValues2({}, issueData), {
|
|
2211
|
+
path: fullPath,
|
|
2212
|
+
message: issueData.message
|
|
2213
|
+
});
|
|
2214
|
+
}
|
|
2204
2215
|
let errorMessage = "";
|
|
2205
2216
|
const maps = errorMaps.filter((m) => !!m).slice().reverse();
|
|
2206
2217
|
for (const map of maps) {
|
|
@@ -2208,11 +2219,12 @@ var makeIssue = (params) => {
|
|
|
2208
2219
|
}
|
|
2209
2220
|
return __spreadProps2(__spreadValues2({}, issueData), {
|
|
2210
2221
|
path: fullPath,
|
|
2211
|
-
message:
|
|
2222
|
+
message: errorMessage
|
|
2212
2223
|
});
|
|
2213
2224
|
};
|
|
2214
2225
|
var EMPTY_PATH = [];
|
|
2215
2226
|
function addIssueToContext(ctx, issueData) {
|
|
2227
|
+
const overrideMap = getErrorMap();
|
|
2216
2228
|
const issue = makeIssue({
|
|
2217
2229
|
issueData,
|
|
2218
2230
|
data: ctx.data,
|
|
@@ -2220,8 +2232,8 @@ function addIssueToContext(ctx, issueData) {
|
|
|
2220
2232
|
errorMaps: [
|
|
2221
2233
|
ctx.common.contextualErrorMap,
|
|
2222
2234
|
ctx.schemaErrorMap,
|
|
2223
|
-
|
|
2224
|
-
errorMap
|
|
2235
|
+
overrideMap,
|
|
2236
|
+
overrideMap === errorMap ? void 0 : errorMap
|
|
2225
2237
|
// then global default map
|
|
2226
2238
|
].filter((x) => !!x)
|
|
2227
2239
|
});
|
|
@@ -2253,9 +2265,11 @@ var ParseStatus = class _ParseStatus {
|
|
|
2253
2265
|
static async mergeObjectAsync(status, pairs) {
|
|
2254
2266
|
const syncPairs = [];
|
|
2255
2267
|
for (const pair of pairs) {
|
|
2268
|
+
const key = await pair.key;
|
|
2269
|
+
const value = await pair.value;
|
|
2256
2270
|
syncPairs.push({
|
|
2257
|
-
key
|
|
2258
|
-
value
|
|
2271
|
+
key,
|
|
2272
|
+
value
|
|
2259
2273
|
});
|
|
2260
2274
|
}
|
|
2261
2275
|
return _ParseStatus.mergeObjectSync(status, syncPairs);
|
|
@@ -2288,11 +2302,29 @@ var isAborted = (x) => x.status === "aborted";
|
|
|
2288
2302
|
var isDirty = (x) => x.status === "dirty";
|
|
2289
2303
|
var isValid = (x) => x.status === "valid";
|
|
2290
2304
|
var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
2305
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
2306
|
+
if (kind === "a" && !f)
|
|
2307
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
2308
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
2309
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
2310
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
2311
|
+
}
|
|
2312
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
2313
|
+
if (kind === "m")
|
|
2314
|
+
throw new TypeError("Private method is not writable");
|
|
2315
|
+
if (kind === "a" && !f)
|
|
2316
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
2317
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
2318
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
2319
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
2320
|
+
}
|
|
2291
2321
|
var errorUtil;
|
|
2292
2322
|
(function(errorUtil2) {
|
|
2293
2323
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
2294
2324
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
2295
2325
|
})(errorUtil || (errorUtil = {}));
|
|
2326
|
+
var _ZodEnum_cache;
|
|
2327
|
+
var _ZodNativeEnum_cache;
|
|
2296
2328
|
var ParseInputLazyPath = class {
|
|
2297
2329
|
constructor(parent, value, path, key) {
|
|
2298
2330
|
this._cachedPath = [];
|
|
@@ -2341,12 +2373,17 @@ function processCreateParams(params) {
|
|
|
2341
2373
|
if (errorMap2)
|
|
2342
2374
|
return { errorMap: errorMap2, description };
|
|
2343
2375
|
const customMap = (iss, ctx) => {
|
|
2344
|
-
|
|
2345
|
-
|
|
2376
|
+
var _a, _b;
|
|
2377
|
+
const { message } = params;
|
|
2378
|
+
if (iss.code === "invalid_enum_value") {
|
|
2379
|
+
return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
|
|
2380
|
+
}
|
|
2346
2381
|
if (typeof ctx.data === "undefined") {
|
|
2347
|
-
return { message:
|
|
2382
|
+
return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
|
|
2348
2383
|
}
|
|
2349
|
-
|
|
2384
|
+
if (iss.code !== "invalid_type")
|
|
2385
|
+
return { message: ctx.defaultError };
|
|
2386
|
+
return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
|
|
2350
2387
|
};
|
|
2351
2388
|
return { errorMap: customMap, description };
|
|
2352
2389
|
}
|
|
@@ -2588,35 +2625,40 @@ var ZodType = class {
|
|
|
2588
2625
|
}
|
|
2589
2626
|
};
|
|
2590
2627
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
|
2591
|
-
var cuid2Regex = /^[
|
|
2628
|
+
var cuid2Regex = /^[0-9a-z]+$/;
|
|
2592
2629
|
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
2593
2630
|
var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
|
|
2594
|
-
var
|
|
2631
|
+
var nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
|
2632
|
+
var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
|
|
2633
|
+
var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
|
2595
2634
|
var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
2596
2635
|
var emojiRegex;
|
|
2597
|
-
var ipv4Regex = /^((
|
|
2636
|
+
var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
2598
2637
|
var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
|
|
2599
|
-
var
|
|
2638
|
+
var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
2639
|
+
var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
|
|
2640
|
+
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
2641
|
+
function timeRegexSource(args) {
|
|
2642
|
+
let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
|
|
2600
2643
|
if (args.precision) {
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
|
|
2605
|
-
}
|
|
2606
|
-
} else if (args.precision === 0) {
|
|
2607
|
-
if (args.offset) {
|
|
2608
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
|
|
2609
|
-
} else {
|
|
2610
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
|
2611
|
-
}
|
|
2612
|
-
} else {
|
|
2613
|
-
if (args.offset) {
|
|
2614
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
|
|
2615
|
-
} else {
|
|
2616
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
|
2617
|
-
}
|
|
2644
|
+
regex = `${regex}\\.\\d{${args.precision}}`;
|
|
2645
|
+
} else if (args.precision == null) {
|
|
2646
|
+
regex = `${regex}(\\.\\d+)?`;
|
|
2618
2647
|
}
|
|
2619
|
-
|
|
2648
|
+
return regex;
|
|
2649
|
+
}
|
|
2650
|
+
function timeRegex(args) {
|
|
2651
|
+
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
2652
|
+
}
|
|
2653
|
+
function datetimeRegex(args) {
|
|
2654
|
+
let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
|
|
2655
|
+
const opts = [];
|
|
2656
|
+
opts.push(args.local ? `Z?` : `Z`);
|
|
2657
|
+
if (args.offset)
|
|
2658
|
+
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
|
2659
|
+
regex = `${regex}(${opts.join("|")})`;
|
|
2660
|
+
return new RegExp(`^${regex}$`);
|
|
2661
|
+
}
|
|
2620
2662
|
function isValidIP(ip, version) {
|
|
2621
2663
|
if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
|
|
2622
2664
|
return true;
|
|
@@ -2634,15 +2676,11 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2634
2676
|
const parsedType = this._getType(input);
|
|
2635
2677
|
if (parsedType !== ZodParsedType.string) {
|
|
2636
2678
|
const ctx2 = this._getOrReturnCtx(input);
|
|
2637
|
-
addIssueToContext(
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
received: ctx2.parsedType
|
|
2643
|
-
}
|
|
2644
|
-
//
|
|
2645
|
-
);
|
|
2679
|
+
addIssueToContext(ctx2, {
|
|
2680
|
+
code: ZodIssueCode.invalid_type,
|
|
2681
|
+
expected: ZodParsedType.string,
|
|
2682
|
+
received: ctx2.parsedType
|
|
2683
|
+
});
|
|
2646
2684
|
return INVALID;
|
|
2647
2685
|
}
|
|
2648
2686
|
const status = new ParseStatus();
|
|
@@ -2733,6 +2771,16 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2733
2771
|
});
|
|
2734
2772
|
status.dirty();
|
|
2735
2773
|
}
|
|
2774
|
+
} else if (check.kind === "nanoid") {
|
|
2775
|
+
if (!nanoidRegex.test(input.data)) {
|
|
2776
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2777
|
+
addIssueToContext(ctx, {
|
|
2778
|
+
validation: "nanoid",
|
|
2779
|
+
code: ZodIssueCode.invalid_string,
|
|
2780
|
+
message: check.message
|
|
2781
|
+
});
|
|
2782
|
+
status.dirty();
|
|
2783
|
+
}
|
|
2736
2784
|
} else if (check.kind === "cuid") {
|
|
2737
2785
|
if (!cuidRegex.test(input.data)) {
|
|
2738
2786
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -2834,6 +2882,38 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2834
2882
|
});
|
|
2835
2883
|
status.dirty();
|
|
2836
2884
|
}
|
|
2885
|
+
} else if (check.kind === "date") {
|
|
2886
|
+
const regex = dateRegex;
|
|
2887
|
+
if (!regex.test(input.data)) {
|
|
2888
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2889
|
+
addIssueToContext(ctx, {
|
|
2890
|
+
code: ZodIssueCode.invalid_string,
|
|
2891
|
+
validation: "date",
|
|
2892
|
+
message: check.message
|
|
2893
|
+
});
|
|
2894
|
+
status.dirty();
|
|
2895
|
+
}
|
|
2896
|
+
} else if (check.kind === "time") {
|
|
2897
|
+
const regex = timeRegex(check);
|
|
2898
|
+
if (!regex.test(input.data)) {
|
|
2899
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2900
|
+
addIssueToContext(ctx, {
|
|
2901
|
+
code: ZodIssueCode.invalid_string,
|
|
2902
|
+
validation: "time",
|
|
2903
|
+
message: check.message
|
|
2904
|
+
});
|
|
2905
|
+
status.dirty();
|
|
2906
|
+
}
|
|
2907
|
+
} else if (check.kind === "duration") {
|
|
2908
|
+
if (!durationRegex.test(input.data)) {
|
|
2909
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2910
|
+
addIssueToContext(ctx, {
|
|
2911
|
+
validation: "duration",
|
|
2912
|
+
code: ZodIssueCode.invalid_string,
|
|
2913
|
+
message: check.message
|
|
2914
|
+
});
|
|
2915
|
+
status.dirty();
|
|
2916
|
+
}
|
|
2837
2917
|
} else if (check.kind === "ip") {
|
|
2838
2918
|
if (!isValidIP(input.data, check.version)) {
|
|
2839
2919
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -2844,6 +2924,16 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2844
2924
|
});
|
|
2845
2925
|
status.dirty();
|
|
2846
2926
|
}
|
|
2927
|
+
} else if (check.kind === "base64") {
|
|
2928
|
+
if (!base64Regex.test(input.data)) {
|
|
2929
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2930
|
+
addIssueToContext(ctx, {
|
|
2931
|
+
validation: "base64",
|
|
2932
|
+
code: ZodIssueCode.invalid_string,
|
|
2933
|
+
message: check.message
|
|
2934
|
+
});
|
|
2935
|
+
status.dirty();
|
|
2936
|
+
}
|
|
2847
2937
|
} else {
|
|
2848
2938
|
util.assertNever(check);
|
|
2849
2939
|
}
|
|
@@ -2873,6 +2963,9 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2873
2963
|
uuid(message) {
|
|
2874
2964
|
return this._addCheck(__spreadValues2({ kind: "uuid" }, errorUtil.errToObj(message)));
|
|
2875
2965
|
}
|
|
2966
|
+
nanoid(message) {
|
|
2967
|
+
return this._addCheck(__spreadValues2({ kind: "nanoid" }, errorUtil.errToObj(message)));
|
|
2968
|
+
}
|
|
2876
2969
|
cuid(message) {
|
|
2877
2970
|
return this._addCheck(__spreadValues2({ kind: "cuid" }, errorUtil.errToObj(message)));
|
|
2878
2971
|
}
|
|
@@ -2882,25 +2975,49 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2882
2975
|
ulid(message) {
|
|
2883
2976
|
return this._addCheck(__spreadValues2({ kind: "ulid" }, errorUtil.errToObj(message)));
|
|
2884
2977
|
}
|
|
2978
|
+
base64(message) {
|
|
2979
|
+
return this._addCheck(__spreadValues2({ kind: "base64" }, errorUtil.errToObj(message)));
|
|
2980
|
+
}
|
|
2885
2981
|
ip(options) {
|
|
2886
2982
|
return this._addCheck(__spreadValues2({ kind: "ip" }, errorUtil.errToObj(options)));
|
|
2887
2983
|
}
|
|
2888
2984
|
datetime(options) {
|
|
2889
|
-
var _a;
|
|
2985
|
+
var _a, _b;
|
|
2890
2986
|
if (typeof options === "string") {
|
|
2891
2987
|
return this._addCheck({
|
|
2892
2988
|
kind: "datetime",
|
|
2893
2989
|
precision: null,
|
|
2894
2990
|
offset: false,
|
|
2991
|
+
local: false,
|
|
2895
2992
|
message: options
|
|
2896
2993
|
});
|
|
2897
2994
|
}
|
|
2898
2995
|
return this._addCheck(__spreadValues2({
|
|
2899
2996
|
kind: "datetime",
|
|
2900
2997
|
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
2901
|
-
offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false
|
|
2998
|
+
offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
|
|
2999
|
+
local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false
|
|
2902
3000
|
}, errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)));
|
|
2903
3001
|
}
|
|
3002
|
+
date(message) {
|
|
3003
|
+
return this._addCheck({ kind: "date", message });
|
|
3004
|
+
}
|
|
3005
|
+
time(options) {
|
|
3006
|
+
if (typeof options === "string") {
|
|
3007
|
+
return this._addCheck({
|
|
3008
|
+
kind: "time",
|
|
3009
|
+
precision: null,
|
|
3010
|
+
message: options
|
|
3011
|
+
});
|
|
3012
|
+
}
|
|
3013
|
+
return this._addCheck(__spreadValues2({
|
|
3014
|
+
kind: "time",
|
|
3015
|
+
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision
|
|
3016
|
+
}, errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)));
|
|
3017
|
+
}
|
|
3018
|
+
duration(message) {
|
|
3019
|
+
return this._addCheck(__spreadValues2({ kind: "duration" }, errorUtil.errToObj(message)));
|
|
3020
|
+
}
|
|
2904
3021
|
regex(regex, message) {
|
|
2905
3022
|
return this._addCheck(__spreadValues2({
|
|
2906
3023
|
kind: "regex",
|
|
@@ -2969,6 +3086,15 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2969
3086
|
get isDatetime() {
|
|
2970
3087
|
return !!this._def.checks.find((ch) => ch.kind === "datetime");
|
|
2971
3088
|
}
|
|
3089
|
+
get isDate() {
|
|
3090
|
+
return !!this._def.checks.find((ch) => ch.kind === "date");
|
|
3091
|
+
}
|
|
3092
|
+
get isTime() {
|
|
3093
|
+
return !!this._def.checks.find((ch) => ch.kind === "time");
|
|
3094
|
+
}
|
|
3095
|
+
get isDuration() {
|
|
3096
|
+
return !!this._def.checks.find((ch) => ch.kind === "duration");
|
|
3097
|
+
}
|
|
2972
3098
|
get isEmail() {
|
|
2973
3099
|
return !!this._def.checks.find((ch) => ch.kind === "email");
|
|
2974
3100
|
}
|
|
@@ -2981,6 +3107,9 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2981
3107
|
get isUUID() {
|
|
2982
3108
|
return !!this._def.checks.find((ch) => ch.kind === "uuid");
|
|
2983
3109
|
}
|
|
3110
|
+
get isNANOID() {
|
|
3111
|
+
return !!this._def.checks.find((ch) => ch.kind === "nanoid");
|
|
3112
|
+
}
|
|
2984
3113
|
get isCUID() {
|
|
2985
3114
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
|
2986
3115
|
}
|
|
@@ -2993,6 +3122,9 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2993
3122
|
get isIP() {
|
|
2994
3123
|
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
|
2995
3124
|
}
|
|
3125
|
+
get isBase64() {
|
|
3126
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
|
3127
|
+
}
|
|
2996
3128
|
get minLength() {
|
|
2997
3129
|
let min = null;
|
|
2998
3130
|
for (const ch of this._def.checks) {
|
|
@@ -3883,9 +4015,10 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
3883
4015
|
const syncPairs = [];
|
|
3884
4016
|
for (const pair of pairs) {
|
|
3885
4017
|
const key = await pair.key;
|
|
4018
|
+
const value = await pair.value;
|
|
3886
4019
|
syncPairs.push({
|
|
3887
4020
|
key,
|
|
3888
|
-
value
|
|
4021
|
+
value,
|
|
3889
4022
|
alwaysSet: pair.alwaysSet
|
|
3890
4023
|
});
|
|
3891
4024
|
}
|
|
@@ -4212,15 +4345,25 @@ var getDiscriminator = (type) => {
|
|
|
4212
4345
|
} else if (type instanceof ZodEnum) {
|
|
4213
4346
|
return type.options;
|
|
4214
4347
|
} else if (type instanceof ZodNativeEnum) {
|
|
4215
|
-
return
|
|
4348
|
+
return util.objectValues(type.enum);
|
|
4216
4349
|
} else if (type instanceof ZodDefault) {
|
|
4217
4350
|
return getDiscriminator(type._def.innerType);
|
|
4218
4351
|
} else if (type instanceof ZodUndefined) {
|
|
4219
4352
|
return [void 0];
|
|
4220
4353
|
} else if (type instanceof ZodNull) {
|
|
4221
4354
|
return [null];
|
|
4355
|
+
} else if (type instanceof ZodOptional) {
|
|
4356
|
+
return [void 0, ...getDiscriminator(type.unwrap())];
|
|
4357
|
+
} else if (type instanceof ZodNullable) {
|
|
4358
|
+
return [null, ...getDiscriminator(type.unwrap())];
|
|
4359
|
+
} else if (type instanceof ZodBranded) {
|
|
4360
|
+
return getDiscriminator(type.unwrap());
|
|
4361
|
+
} else if (type instanceof ZodReadonly) {
|
|
4362
|
+
return getDiscriminator(type.unwrap());
|
|
4363
|
+
} else if (type instanceof ZodCatch) {
|
|
4364
|
+
return getDiscriminator(type._def.innerType);
|
|
4222
4365
|
} else {
|
|
4223
|
-
return
|
|
4366
|
+
return [];
|
|
4224
4367
|
}
|
|
4225
4368
|
};
|
|
4226
4369
|
var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
|
|
@@ -4280,7 +4423,7 @@ var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
|
|
|
4280
4423
|
const optionsMap = /* @__PURE__ */ new Map();
|
|
4281
4424
|
for (const type of options) {
|
|
4282
4425
|
const discriminatorValues = getDiscriminator(type.shape[discriminator]);
|
|
4283
|
-
if (!discriminatorValues) {
|
|
4426
|
+
if (!discriminatorValues.length) {
|
|
4284
4427
|
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
|
4285
4428
|
}
|
|
4286
4429
|
for (const value of discriminatorValues) {
|
|
@@ -4476,7 +4619,8 @@ var ZodRecord = class _ZodRecord extends ZodType {
|
|
|
4476
4619
|
for (const key in ctx.data) {
|
|
4477
4620
|
pairs.push({
|
|
4478
4621
|
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
|
|
4479
|
-
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
|
|
4622
|
+
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
|
|
4623
|
+
alwaysSet: key in ctx.data
|
|
4480
4624
|
});
|
|
4481
4625
|
}
|
|
4482
4626
|
if (ctx.common.async) {
|
|
@@ -4808,6 +4952,10 @@ function createZodEnum(values, params) {
|
|
|
4808
4952
|
}, processCreateParams(params)));
|
|
4809
4953
|
}
|
|
4810
4954
|
var ZodEnum = class _ZodEnum extends ZodType {
|
|
4955
|
+
constructor() {
|
|
4956
|
+
super(...arguments);
|
|
4957
|
+
_ZodEnum_cache.set(this, void 0);
|
|
4958
|
+
}
|
|
4811
4959
|
_parse(input) {
|
|
4812
4960
|
if (typeof input.data !== "string") {
|
|
4813
4961
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -4819,7 +4967,10 @@ var ZodEnum = class _ZodEnum extends ZodType {
|
|
|
4819
4967
|
});
|
|
4820
4968
|
return INVALID;
|
|
4821
4969
|
}
|
|
4822
|
-
if (this
|
|
4970
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
|
|
4971
|
+
__classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
|
|
4972
|
+
}
|
|
4973
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
|
|
4823
4974
|
const ctx = this._getOrReturnCtx(input);
|
|
4824
4975
|
const expectedValues = this._def.values;
|
|
4825
4976
|
addIssueToContext(ctx, {
|
|
@@ -4855,15 +5006,20 @@ var ZodEnum = class _ZodEnum extends ZodType {
|
|
|
4855
5006
|
}
|
|
4856
5007
|
return enumValues;
|
|
4857
5008
|
}
|
|
4858
|
-
extract(values) {
|
|
4859
|
-
return _ZodEnum.create(values);
|
|
5009
|
+
extract(values, newDef = this._def) {
|
|
5010
|
+
return _ZodEnum.create(values, __spreadValues2(__spreadValues2({}, this._def), newDef));
|
|
4860
5011
|
}
|
|
4861
|
-
exclude(values) {
|
|
4862
|
-
return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
|
|
5012
|
+
exclude(values, newDef = this._def) {
|
|
5013
|
+
return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), __spreadValues2(__spreadValues2({}, this._def), newDef));
|
|
4863
5014
|
}
|
|
4864
5015
|
};
|
|
5016
|
+
_ZodEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
4865
5017
|
ZodEnum.create = createZodEnum;
|
|
4866
5018
|
var ZodNativeEnum = class extends ZodType {
|
|
5019
|
+
constructor() {
|
|
5020
|
+
super(...arguments);
|
|
5021
|
+
_ZodNativeEnum_cache.set(this, void 0);
|
|
5022
|
+
}
|
|
4867
5023
|
_parse(input) {
|
|
4868
5024
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
4869
5025
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -4876,7 +5032,10 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
4876
5032
|
});
|
|
4877
5033
|
return INVALID;
|
|
4878
5034
|
}
|
|
4879
|
-
if (
|
|
5035
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
|
|
5036
|
+
__classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
|
|
5037
|
+
}
|
|
5038
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
|
|
4880
5039
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
4881
5040
|
addIssueToContext(ctx, {
|
|
4882
5041
|
received: ctx.data,
|
|
@@ -4891,6 +5050,7 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
4891
5050
|
return this._def.values;
|
|
4892
5051
|
}
|
|
4893
5052
|
};
|
|
5053
|
+
_ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
4894
5054
|
ZodNativeEnum.create = (values, params) => {
|
|
4895
5055
|
return new ZodNativeEnum(__spreadValues2({
|
|
4896
5056
|
values,
|
|
@@ -4952,26 +5112,38 @@ var ZodEffects = class extends ZodType {
|
|
|
4952
5112
|
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
|
4953
5113
|
if (effect.type === "preprocess") {
|
|
4954
5114
|
const processed = effect.transform(ctx.data, checkCtx);
|
|
4955
|
-
if (ctx.common.issues.length) {
|
|
4956
|
-
return {
|
|
4957
|
-
status: "dirty",
|
|
4958
|
-
value: ctx.data
|
|
4959
|
-
};
|
|
4960
|
-
}
|
|
4961
5115
|
if (ctx.common.async) {
|
|
4962
|
-
return Promise.resolve(processed).then((processed2) => {
|
|
4963
|
-
|
|
5116
|
+
return Promise.resolve(processed).then(async (processed2) => {
|
|
5117
|
+
if (status.value === "aborted")
|
|
5118
|
+
return INVALID;
|
|
5119
|
+
const result = await this._def.schema._parseAsync({
|
|
4964
5120
|
data: processed2,
|
|
4965
5121
|
path: ctx.path,
|
|
4966
5122
|
parent: ctx
|
|
4967
5123
|
});
|
|
5124
|
+
if (result.status === "aborted")
|
|
5125
|
+
return INVALID;
|
|
5126
|
+
if (result.status === "dirty")
|
|
5127
|
+
return DIRTY(result.value);
|
|
5128
|
+
if (status.value === "dirty")
|
|
5129
|
+
return DIRTY(result.value);
|
|
5130
|
+
return result;
|
|
4968
5131
|
});
|
|
4969
5132
|
} else {
|
|
4970
|
-
|
|
5133
|
+
if (status.value === "aborted")
|
|
5134
|
+
return INVALID;
|
|
5135
|
+
const result = this._def.schema._parseSync({
|
|
4971
5136
|
data: processed,
|
|
4972
5137
|
path: ctx.path,
|
|
4973
5138
|
parent: ctx
|
|
4974
5139
|
});
|
|
5140
|
+
if (result.status === "aborted")
|
|
5141
|
+
return INVALID;
|
|
5142
|
+
if (result.status === "dirty")
|
|
5143
|
+
return DIRTY(result.value);
|
|
5144
|
+
if (status.value === "dirty")
|
|
5145
|
+
return DIRTY(result.value);
|
|
5146
|
+
return result;
|
|
4975
5147
|
}
|
|
4976
5148
|
}
|
|
4977
5149
|
if (effect.type === "refinement") {
|
|
@@ -5249,10 +5421,16 @@ var ZodPipeline = class _ZodPipeline extends ZodType {
|
|
|
5249
5421
|
var ZodReadonly = class extends ZodType {
|
|
5250
5422
|
_parse(input) {
|
|
5251
5423
|
const result = this._def.innerType._parse(input);
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5424
|
+
const freeze = (data) => {
|
|
5425
|
+
if (isValid(data)) {
|
|
5426
|
+
data.value = Object.freeze(data.value);
|
|
5427
|
+
}
|
|
5428
|
+
return data;
|
|
5429
|
+
};
|
|
5430
|
+
return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
|
|
5431
|
+
}
|
|
5432
|
+
unwrap() {
|
|
5433
|
+
return this._def.innerType;
|
|
5256
5434
|
}
|
|
5257
5435
|
};
|
|
5258
5436
|
ZodReadonly.create = (type, params) => {
|
|
@@ -5261,7 +5439,7 @@ ZodReadonly.create = (type, params) => {
|
|
|
5261
5439
|
typeName: ZodFirstPartyTypeKind.ZodReadonly
|
|
5262
5440
|
}, processCreateParams(params)));
|
|
5263
5441
|
};
|
|
5264
|
-
|
|
5442
|
+
function custom(check, params = {}, fatal) {
|
|
5265
5443
|
if (check)
|
|
5266
5444
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
5267
5445
|
var _a, _b;
|
|
@@ -5273,7 +5451,7 @@ var custom = (check, params = {}, fatal) => {
|
|
|
5273
5451
|
}
|
|
5274
5452
|
});
|
|
5275
5453
|
return ZodAny.create();
|
|
5276
|
-
}
|
|
5454
|
+
}
|
|
5277
5455
|
var late = {
|
|
5278
5456
|
object: ZodObject.lazycreate
|
|
5279
5457
|
};
|
|
@@ -5391,6 +5569,7 @@ var z = /* @__PURE__ */ Object.freeze({
|
|
|
5391
5569
|
ZodParsedType,
|
|
5392
5570
|
getParsedType,
|
|
5393
5571
|
ZodType,
|
|
5572
|
+
datetimeRegex,
|
|
5394
5573
|
ZodString,
|
|
5395
5574
|
ZodNumber,
|
|
5396
5575
|
ZodBigInt,
|
|
@@ -10399,15 +10578,15 @@ var AlertRenderer = {
|
|
|
10399
10578
|
};
|
|
10400
10579
|
var AlertRenderer_default = AlertRenderer;
|
|
10401
10580
|
|
|
10402
|
-
// ../../node_modules/.pnpm/@radix-ui+react-id@1.0.1_@types+react@18.
|
|
10581
|
+
// ../../node_modules/.pnpm/@radix-ui+react-id@1.0.1_@types+react@18.3.3_react@18.3.1/node_modules/@radix-ui/react-id/dist/index.mjs
|
|
10403
10582
|
import * as $2AODx$react from "react";
|
|
10404
10583
|
|
|
10405
|
-
// ../../node_modules/.pnpm/@radix-ui+react-use-layout-effect@1.0.1_@types+react@18.
|
|
10584
|
+
// ../../node_modules/.pnpm/@radix-ui+react-use-layout-effect@1.0.1_@types+react@18.3.3_react@18.3.1/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
|
|
10406
10585
|
import { useLayoutEffect as $dxlwH$useLayoutEffect } from "react";
|
|
10407
10586
|
var $9f79659886946c16$export$e5c5a5f917a5871c = Boolean(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) ? $dxlwH$useLayoutEffect : () => {
|
|
10408
10587
|
};
|
|
10409
10588
|
|
|
10410
|
-
// ../../node_modules/.pnpm/@radix-ui+react-id@1.0.1_@types+react@18.
|
|
10589
|
+
// ../../node_modules/.pnpm/@radix-ui+react-id@1.0.1_@types+react@18.3.3_react@18.3.1/node_modules/@radix-ui/react-id/dist/index.mjs
|
|
10411
10590
|
var $1746a345f3d73bb7$var$useReactId = $2AODx$react["useId".toString()] || (() => void 0);
|
|
10412
10591
|
var $1746a345f3d73bb7$var$count = 0;
|
|
10413
10592
|
function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
|
|
@@ -10423,7 +10602,7 @@ function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
|
|
|
10423
10602
|
return deterministicId || (id ? `radix-${id}` : "");
|
|
10424
10603
|
}
|
|
10425
10604
|
|
|
10426
|
-
// ../../node_modules/.pnpm/@wise+forms@0.3.4_@transferwise+components@46.
|
|
10605
|
+
// ../../node_modules/.pnpm/@wise+forms@0.3.4_@transferwise+components@46.37.0_@types+react@18.3.3_react@18.3.1/node_modules/@wise/forms/dist/index.mjs
|
|
10427
10606
|
var import_classnames = __toESM(require_classnames(), 1);
|
|
10428
10607
|
import { InlineAlert, Sentiment as Sentiment2, Input, TextArea } from "@transferwise/components";
|
|
10429
10608
|
import { createContext as createContext2, useContext as useContext2, forwardRef } from "react";
|
|
@@ -10794,7 +10973,7 @@ var DateInputRenderer_default = DateInputRenderer;
|
|
|
10794
10973
|
// src/revamp/wise/renderers/DecisionRenderer.tsx
|
|
10795
10974
|
import { NavigationOptionsList, NavigationOption } from "@transferwise/components";
|
|
10796
10975
|
|
|
10797
|
-
// ../../node_modules/.pnpm/@wise+art@2.7.0_react-dom@18.
|
|
10976
|
+
// ../../node_modules/.pnpm/@wise+art@2.7.0_react-dom@18.3.1_react@18.3.1/node_modules/@wise/art/dist/index.esm.js
|
|
10798
10977
|
import { useState as useState3, useEffect as useEffect2, forwardRef as forwardRef2 } from "react";
|
|
10799
10978
|
import { jsx as jsx18, jsxs as jsxs5, Fragment as Fragment3 } from "react/jsx-runtime";
|
|
10800
10979
|
var unknownFlagName = "wise";
|
|
@@ -13013,6 +13192,61 @@ function FeatureContextProvider({ features, children }) {
|
|
|
13013
13192
|
return /* @__PURE__ */ jsx64(FeatureContext.Provider, { value: features, children });
|
|
13014
13193
|
}
|
|
13015
13194
|
|
|
13195
|
+
// src/common/cameraCapture/utils/mobile-utils.ts
|
|
13196
|
+
var isMobile = () => isMobileScreenSize() && (isTouchScreen() || isMobileUA());
|
|
13197
|
+
var isMobileUA = (userAgent = window.navigator.userAgent) => (
|
|
13198
|
+
// eslint-disable-next-line regexp/no-unused-capturing-group
|
|
13199
|
+
/mobi|\b(iphone|android|blackberry|webos|windows phone)\b/i.test(userAgent)
|
|
13200
|
+
);
|
|
13201
|
+
var isMobileScreenSize = (width = window.screen.width, height = window.screen.height) => width < 768 || height < 768;
|
|
13202
|
+
var isTouchScreen = (navigator2 = window.navigator, matchMedia = window.matchMedia) => {
|
|
13203
|
+
if ("maxTouchPoints" in navigator2) {
|
|
13204
|
+
return navigator2.maxTouchPoints > 0;
|
|
13205
|
+
}
|
|
13206
|
+
const mQ = matchMedia == null ? void 0 : matchMedia("(pointer:coarse)");
|
|
13207
|
+
if ((mQ == null ? void 0 : mQ.media) === "(pointer:coarse)") {
|
|
13208
|
+
return Boolean(mQ.matches);
|
|
13209
|
+
}
|
|
13210
|
+
return false;
|
|
13211
|
+
};
|
|
13212
|
+
|
|
13213
|
+
// src/common/utils/debounce.ts
|
|
13214
|
+
var debounce2 = (callback, waitMs) => {
|
|
13215
|
+
let timeoutId;
|
|
13216
|
+
let lastArgs;
|
|
13217
|
+
const clearTimer = () => {
|
|
13218
|
+
if (timeoutId) {
|
|
13219
|
+
clearTimeout(timeoutId);
|
|
13220
|
+
timeoutId = null;
|
|
13221
|
+
}
|
|
13222
|
+
lastArgs = null;
|
|
13223
|
+
};
|
|
13224
|
+
const debouncedFn = (...args) => {
|
|
13225
|
+
lastArgs = args;
|
|
13226
|
+
if (timeoutId !== null) {
|
|
13227
|
+
clearTimeout(timeoutId);
|
|
13228
|
+
}
|
|
13229
|
+
timeoutId = setTimeout(() => {
|
|
13230
|
+
callback(...lastArgs);
|
|
13231
|
+
timeoutId = null;
|
|
13232
|
+
lastArgs = null;
|
|
13233
|
+
}, waitMs);
|
|
13234
|
+
};
|
|
13235
|
+
debouncedFn.cancel = () => {
|
|
13236
|
+
if (timeoutId !== null) {
|
|
13237
|
+
clearTimer();
|
|
13238
|
+
}
|
|
13239
|
+
};
|
|
13240
|
+
debouncedFn.flush = () => {
|
|
13241
|
+
if (timeoutId !== null) {
|
|
13242
|
+
callback(...lastArgs);
|
|
13243
|
+
clearTimer();
|
|
13244
|
+
}
|
|
13245
|
+
};
|
|
13246
|
+
debouncedFn.isPending = () => timeoutId !== null;
|
|
13247
|
+
return debouncedFn;
|
|
13248
|
+
};
|
|
13249
|
+
|
|
13016
13250
|
// src/legacy/common/utils/api-utils.ts
|
|
13017
13251
|
function isStatus2xx(status) {
|
|
13018
13252
|
return status >= 200 && status < 300;
|
|
@@ -13475,63 +13709,6 @@ var dateStringToDate = (dateString) => {
|
|
|
13475
13709
|
};
|
|
13476
13710
|
var dateToDateString2 = (date) => formatDate2(date);
|
|
13477
13711
|
|
|
13478
|
-
// src/legacy/common/utils/debounce.ts
|
|
13479
|
-
var debounce2 = (callback, waitMs) => {
|
|
13480
|
-
let timeoutId;
|
|
13481
|
-
let lastArgs;
|
|
13482
|
-
const clearTimer = () => {
|
|
13483
|
-
if (timeoutId) {
|
|
13484
|
-
clearTimeout(timeoutId);
|
|
13485
|
-
timeoutId = null;
|
|
13486
|
-
}
|
|
13487
|
-
lastArgs = null;
|
|
13488
|
-
};
|
|
13489
|
-
const debouncedFn = (...args) => {
|
|
13490
|
-
lastArgs = args;
|
|
13491
|
-
if (timeoutId !== null) {
|
|
13492
|
-
clearTimeout(timeoutId);
|
|
13493
|
-
}
|
|
13494
|
-
timeoutId = setTimeout(() => {
|
|
13495
|
-
callback(...lastArgs);
|
|
13496
|
-
timeoutId = null;
|
|
13497
|
-
lastArgs = null;
|
|
13498
|
-
}, waitMs);
|
|
13499
|
-
};
|
|
13500
|
-
debouncedFn.cancel = () => {
|
|
13501
|
-
if (timeoutId !== null) {
|
|
13502
|
-
clearTimer();
|
|
13503
|
-
}
|
|
13504
|
-
};
|
|
13505
|
-
debouncedFn.flush = () => {
|
|
13506
|
-
if (timeoutId !== null) {
|
|
13507
|
-
callback(...lastArgs);
|
|
13508
|
-
clearTimer();
|
|
13509
|
-
}
|
|
13510
|
-
};
|
|
13511
|
-
debouncedFn.isPending = () => timeoutId !== null;
|
|
13512
|
-
return debouncedFn;
|
|
13513
|
-
};
|
|
13514
|
-
|
|
13515
|
-
// src/legacy/common/utils/is-equal.ts
|
|
13516
|
-
var isEqual = (a, b) => {
|
|
13517
|
-
if (a === b) {
|
|
13518
|
-
return true;
|
|
13519
|
-
}
|
|
13520
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
13521
|
-
return a.length === b.length && a.every((item, index) => isEqual(item, b[index]));
|
|
13522
|
-
}
|
|
13523
|
-
if (isNonNullObject(a) && isNonNullObject(b) && isObjectEquals(a, b)) {
|
|
13524
|
-
return true;
|
|
13525
|
-
}
|
|
13526
|
-
return false;
|
|
13527
|
-
};
|
|
13528
|
-
var isObjectEquals = (a, b) => {
|
|
13529
|
-
const keysA = Object.keys(a);
|
|
13530
|
-
const keysB = Object.keys(b);
|
|
13531
|
-
return keysA.length === keysB.length && keysA.every((key) => Object.hasOwnProperty.call(b, key) && isEqual(a[key], b[key]));
|
|
13532
|
-
};
|
|
13533
|
-
var isNonNullObject = (a) => typeof a === "object" && a !== null;
|
|
13534
|
-
|
|
13535
13712
|
// src/legacy/common/utils/file-utils.ts
|
|
13536
13713
|
function toKilobytes2(sizeInBytes) {
|
|
13537
13714
|
const ONE_KB_IN_BYTES = 1024;
|
|
@@ -13567,6 +13744,52 @@ var generateRandomId = (prefix = "") => {
|
|
|
13567
13744
|
return `${prefixString}${Math.floor(1e8 * Math.random())}`;
|
|
13568
13745
|
};
|
|
13569
13746
|
|
|
13747
|
+
// src/legacy/common/utils/is-equal.ts
|
|
13748
|
+
var isEqual = (a, b) => {
|
|
13749
|
+
if (a === b) {
|
|
13750
|
+
return true;
|
|
13751
|
+
}
|
|
13752
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
13753
|
+
return a.length === b.length && a.every((item, index) => isEqual(item, b[index]));
|
|
13754
|
+
}
|
|
13755
|
+
if (isNonNullObject(a) && isNonNullObject(b) && isObjectEquals(a, b)) {
|
|
13756
|
+
return true;
|
|
13757
|
+
}
|
|
13758
|
+
return false;
|
|
13759
|
+
};
|
|
13760
|
+
var isObjectEquals = (a, b) => {
|
|
13761
|
+
const keysA = Object.keys(a);
|
|
13762
|
+
const keysB = Object.keys(b);
|
|
13763
|
+
return keysA.length === keysB.length && keysA.every((key) => Object.hasOwnProperty.call(b, key) && isEqual(a[key], b[key]));
|
|
13764
|
+
};
|
|
13765
|
+
var isNonNullObject = (a) => typeof a === "object" && a !== null;
|
|
13766
|
+
|
|
13767
|
+
// src/legacy/common/utils/misc-utils.ts
|
|
13768
|
+
var isBasicError = (error) => isString2(error) || isNull3(error);
|
|
13769
|
+
|
|
13770
|
+
// src/legacy/common/utils/model-utils.ts
|
|
13771
|
+
var isObjectModel2 = (model) => typeof model === "object" && model !== null && model.constructor === Object;
|
|
13772
|
+
var isNullableObjectModel = (model) => isNull3(model) || isObjectModel2(model);
|
|
13773
|
+
var isNullableBasicModel = (model) => isBoolean2(model) || isNumber3(model) || isString2(model) || isNull3(model);
|
|
13774
|
+
var isNullableStringModel = (model) => isString2(model) || isNull3(model);
|
|
13775
|
+
var isArrayModel2 = (model) => {
|
|
13776
|
+
if (isArray2(model)) {
|
|
13777
|
+
if (model.length === 0) {
|
|
13778
|
+
return true;
|
|
13779
|
+
}
|
|
13780
|
+
return model.every(
|
|
13781
|
+
(item) => typeof item === "string" || typeof item === "number" || typeof item === "boolean" || typeof item === "object"
|
|
13782
|
+
);
|
|
13783
|
+
}
|
|
13784
|
+
return false;
|
|
13785
|
+
};
|
|
13786
|
+
var isNullableArrayModel = (model) => {
|
|
13787
|
+
if (isNull3(model)) {
|
|
13788
|
+
return true;
|
|
13789
|
+
}
|
|
13790
|
+
return isArrayModel2(model);
|
|
13791
|
+
};
|
|
13792
|
+
|
|
13570
13793
|
// src/legacy/common/utils/schema-utils.ts
|
|
13571
13794
|
function isConstSchema2(schema) {
|
|
13572
13795
|
return !isUndefined3(schema == null ? void 0 : schema.const);
|
|
@@ -13695,50 +13918,6 @@ var filterHiddenSchemas = (schemas) => schemas.filter((schema) => {
|
|
|
13695
13918
|
return (schema == null ? void 0 : schema.hidden) !== true;
|
|
13696
13919
|
});
|
|
13697
13920
|
|
|
13698
|
-
// src/legacy/common/utils/model-utils.ts
|
|
13699
|
-
var isObjectModel2 = (model) => typeof model === "object" && model !== null && model.constructor === Object;
|
|
13700
|
-
var isNullableObjectModel = (model) => isNull3(model) || isObjectModel2(model);
|
|
13701
|
-
var isNullableBasicModel = (model) => isBoolean2(model) || isNumber3(model) || isString2(model) || isNull3(model);
|
|
13702
|
-
var isNullableStringModel = (model) => isString2(model) || isNull3(model);
|
|
13703
|
-
var isArrayModel2 = (model) => {
|
|
13704
|
-
if (isArray2(model)) {
|
|
13705
|
-
if (model.length === 0) {
|
|
13706
|
-
return true;
|
|
13707
|
-
}
|
|
13708
|
-
return model.every(
|
|
13709
|
-
(item) => typeof item === "string" || typeof item === "number" || typeof item === "boolean" || typeof item === "object"
|
|
13710
|
-
);
|
|
13711
|
-
}
|
|
13712
|
-
return false;
|
|
13713
|
-
};
|
|
13714
|
-
var isNullableArrayModel = (model) => {
|
|
13715
|
-
if (isNull3(model)) {
|
|
13716
|
-
return true;
|
|
13717
|
-
}
|
|
13718
|
-
return isArrayModel2(model);
|
|
13719
|
-
};
|
|
13720
|
-
|
|
13721
|
-
// src/legacy/common/utils/misc-utils.ts
|
|
13722
|
-
var isBasicError = (error) => isString2(error) || isNull3(error);
|
|
13723
|
-
|
|
13724
|
-
// src/legacy/common/utils/mobile-utils.ts
|
|
13725
|
-
var isMobile = () => isMobileScreenSize() && (isTouchScreen() || isMobileUA());
|
|
13726
|
-
var isMobileUA = (userAgent = window.navigator.userAgent) => (
|
|
13727
|
-
// eslint-disable-next-line regexp/no-unused-capturing-group
|
|
13728
|
-
/mobi|\b(iphone|android|blackberry|webos|windows phone)\b/i.test(userAgent)
|
|
13729
|
-
);
|
|
13730
|
-
var isMobileScreenSize = (width = window.screen.width, height = window.screen.height) => width < 768 || height < 768;
|
|
13731
|
-
var isTouchScreen = (navigator2 = window.navigator, matchMedia = window.matchMedia) => {
|
|
13732
|
-
if ("maxTouchPoints" in navigator2) {
|
|
13733
|
-
return navigator2.maxTouchPoints > 0;
|
|
13734
|
-
}
|
|
13735
|
-
const mQ = matchMedia == null ? void 0 : matchMedia("(pointer:coarse)");
|
|
13736
|
-
if ((mQ == null ? void 0 : mQ.media) === "(pointer:coarse)") {
|
|
13737
|
-
return Boolean(mQ.matches);
|
|
13738
|
-
}
|
|
13739
|
-
return false;
|
|
13740
|
-
};
|
|
13741
|
-
|
|
13742
13921
|
// src/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.tsx
|
|
13743
13922
|
import { useCallback as useCallback4 } from "react";
|
|
13744
13923
|
function useDebouncedFunction(callback, waitMs) {
|
|
@@ -17967,12 +18146,12 @@ var LayoutStep_default = LayoutStep;
|
|
|
17967
18146
|
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
17968
18147
|
import { useEffect as useEffect25, useState as useState32 } from "react";
|
|
17969
18148
|
|
|
17970
|
-
// src/
|
|
18149
|
+
// src/common/cameraCapture/CameraCapture.tsx
|
|
17971
18150
|
import { useCallback as useCallback10, useEffect as useEffect24, useMemo as useMemo20, useRef as useRef8, useState as useState31 } from "react";
|
|
17972
18151
|
import { useIntl as useIntl23 } from "react-intl";
|
|
17973
18152
|
import Webcam from "react-webcam";
|
|
17974
18153
|
|
|
17975
|
-
// src/
|
|
18154
|
+
// src/common/cameraCapture/CameraCapture.messages.ts
|
|
17976
18155
|
import { defineMessages as defineMessages13 } from "react-intl";
|
|
17977
18156
|
var CameraCapture_messages_default = defineMessages13({
|
|
17978
18157
|
reviewSubmit: {
|
|
@@ -18032,7 +18211,7 @@ var CameraCapture_messages_default = defineMessages13({
|
|
|
18032
18211
|
}
|
|
18033
18212
|
});
|
|
18034
18213
|
|
|
18035
|
-
// src/
|
|
18214
|
+
// src/common/cameraCapture/components/bottomBar/BottomBar.tsx
|
|
18036
18215
|
import { Button as Button10, ControlType, Priority, Size as Size3 } from "@transferwise/components";
|
|
18037
18216
|
import { useIntl as useIntl21 } from "react-intl";
|
|
18038
18217
|
import { jsx as jsx118, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
@@ -18079,10 +18258,10 @@ var CaptureButton = ({ onClick }) => /* @__PURE__ */ jsx118(
|
|
|
18079
18258
|
}
|
|
18080
18259
|
);
|
|
18081
18260
|
|
|
18082
|
-
// src/
|
|
18261
|
+
// src/common/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
18083
18262
|
import { useIntl as useIntl22 } from "react-intl";
|
|
18084
18263
|
|
|
18085
|
-
// src/
|
|
18264
|
+
// src/common/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.ts
|
|
18086
18265
|
import { defineMessages as defineMessages14 } from "react-intl";
|
|
18087
18266
|
var OrientationLockOverlay_messages_default = defineMessages14({
|
|
18088
18267
|
text: {
|
|
@@ -18092,7 +18271,7 @@ var OrientationLockOverlay_messages_default = defineMessages14({
|
|
|
18092
18271
|
}
|
|
18093
18272
|
});
|
|
18094
18273
|
|
|
18095
|
-
// src/
|
|
18274
|
+
// src/common/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
18096
18275
|
import { jsx as jsx119, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
18097
18276
|
function OrientationLockOverlay() {
|
|
18098
18277
|
const intl = useIntl22();
|
|
@@ -18112,23 +18291,11 @@ function OrientationLockOverlay() {
|
|
|
18112
18291
|
}
|
|
18113
18292
|
var OrientationLockOverlay_default = OrientationLockOverlay;
|
|
18114
18293
|
|
|
18115
|
-
// src/
|
|
18116
|
-
import { Button as Button11 } from "@transferwise/components";
|
|
18117
|
-
import { jsx as jsx120, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
18118
|
-
function CameraErrorScreen({ title, description, actionButton, onAction }) {
|
|
18119
|
-
return /* @__PURE__ */ jsx120("div", { className: "container p-t-5", children: /* @__PURE__ */ jsx120("div", { className: "row", children: /* @__PURE__ */ jsxs48("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
18120
|
-
/* @__PURE__ */ jsx120("h2", { className: "text-xs-center m-b-3", children: title }),
|
|
18121
|
-
/* @__PURE__ */ jsx120("p", { className: "text-xs-center m-b-5", children: description }),
|
|
18122
|
-
onAction && actionButton && /* @__PURE__ */ jsx120(Button11, { block: true, onClick: onAction, children: actionButton })
|
|
18123
|
-
] }) }) });
|
|
18124
|
-
}
|
|
18125
|
-
var CameraErrorScreen_default = CameraErrorScreen;
|
|
18126
|
-
|
|
18127
|
-
// src/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
18294
|
+
// src/common/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
18128
18295
|
var import_screenfull = __toESM(require_screenfull());
|
|
18129
18296
|
import { useCallback as useCallback9, useEffect as useEffect21 } from "react";
|
|
18130
18297
|
|
|
18131
|
-
// src/
|
|
18298
|
+
// src/common/cameraCapture/utils/index.ts
|
|
18132
18299
|
var isSelfieCamera = (stream) => {
|
|
18133
18300
|
var _a;
|
|
18134
18301
|
const { facingMode } = ((_a = getVideoTrack(stream)) == null ? void 0 : _a.getSettings()) || {};
|
|
@@ -18174,7 +18341,7 @@ var getVideoCapabilities = (videoStream) => {
|
|
|
18174
18341
|
return (_b = (_a = getVideoTrack(videoStream)) == null ? void 0 : _a.getCapabilities) == null ? void 0 : _b.call(_a);
|
|
18175
18342
|
};
|
|
18176
18343
|
|
|
18177
|
-
// src/
|
|
18344
|
+
// src/common/cameraCapture/tracking/index.ts
|
|
18178
18345
|
var trackCameraError = (message, onEvent, error) => onEvent == null ? void 0 : onEvent(message, { Error: getSerializedError(error) });
|
|
18179
18346
|
var getSerializedError = (error) => error instanceof DOMException ? JSON.stringify({
|
|
18180
18347
|
name: error == null ? void 0 : error.name,
|
|
@@ -18196,13 +18363,13 @@ var getCameraStartedProperties = async (props, videoStream) => {
|
|
|
18196
18363
|
});
|
|
18197
18364
|
};
|
|
18198
18365
|
var trackCameraOrientationLandscape = (onEvent) => {
|
|
18199
|
-
onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Orientation Lock Overlay Shown", {});
|
|
18366
|
+
void (onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Orientation Lock Overlay Shown", {}));
|
|
18200
18367
|
};
|
|
18201
18368
|
var trackCameraOrientationLocked = (onEvent) => {
|
|
18202
|
-
onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Orientation Locked", {});
|
|
18369
|
+
void (onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Orientation Locked", {}));
|
|
18203
18370
|
};
|
|
18204
18371
|
|
|
18205
|
-
// src/
|
|
18372
|
+
// src/common/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
18206
18373
|
var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
18207
18374
|
const lockOrientation = useCallback9(() => {
|
|
18208
18375
|
if (window.screen.orientation && "lock" in window.screen.orientation && typeof window.screen.orientation.lock === "function") {
|
|
@@ -18264,37 +18431,37 @@ var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
|
18264
18431
|
var noop5 = () => {
|
|
18265
18432
|
};
|
|
18266
18433
|
|
|
18267
|
-
// src/
|
|
18434
|
+
// src/common/cameraCapture/hooks/useVideoConstraints.ts
|
|
18268
18435
|
import { useEffect as useEffect22, useState as useState30 } from "react";
|
|
18269
18436
|
var useVideoConstraints = (direction) => {
|
|
18270
18437
|
const [videoConstraints, setVideoConstraints] = useState30();
|
|
18438
|
+
useEffect22(() => {
|
|
18439
|
+
void getVideoConstraints(direction).then(setVideoConstraints);
|
|
18440
|
+
}, [direction]);
|
|
18441
|
+
return { videoConstraints };
|
|
18442
|
+
};
|
|
18443
|
+
var getVideoConstraints = async (dir) => {
|
|
18271
18444
|
const defaultVideoConstraints = {
|
|
18272
|
-
facingMode:
|
|
18445
|
+
facingMode: dir === "front" ? "user" : "environment",
|
|
18273
18446
|
height: { min: 480, max: 1080, ideal: 720 },
|
|
18274
18447
|
width: { min: 640, max: 1920, ideal: 1280 },
|
|
18275
18448
|
frameRate: 30,
|
|
18276
18449
|
aspectRatio: 16 / 9
|
|
18277
18450
|
};
|
|
18278
|
-
|
|
18279
|
-
|
|
18280
|
-
|
|
18281
|
-
|
|
18282
|
-
|
|
18283
|
-
|
|
18284
|
-
if (mainCamera == null ? void 0 : mainCamera.deviceId) {
|
|
18285
|
-
return __spreadProps(__spreadValues({}, defaultVideoConstraints), {
|
|
18286
|
-
deviceId: { exact: mainCamera.deviceId }
|
|
18287
|
-
});
|
|
18288
|
-
}
|
|
18451
|
+
if (dir === "back") {
|
|
18452
|
+
const mainCamera = (await getAvailableVideoDevices()).find(isMainBackCamera);
|
|
18453
|
+
if (mainCamera == null ? void 0 : mainCamera.deviceId) {
|
|
18454
|
+
return __spreadProps(__spreadValues({}, defaultVideoConstraints), {
|
|
18455
|
+
deviceId: { exact: mainCamera.deviceId }
|
|
18456
|
+
});
|
|
18289
18457
|
}
|
|
18290
|
-
|
|
18291
|
-
|
|
18292
|
-
return { videoConstraints };
|
|
18458
|
+
}
|
|
18459
|
+
return defaultVideoConstraints;
|
|
18293
18460
|
};
|
|
18294
18461
|
|
|
18295
|
-
// src/
|
|
18462
|
+
// src/common/cameraCapture/overlay/Overlay.tsx
|
|
18296
18463
|
import { useEffect as useEffect23, useRef as useRef7 } from "react";
|
|
18297
|
-
import { Fragment as Fragment23, jsx as
|
|
18464
|
+
import { Fragment as Fragment23, jsx as jsx120, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
18298
18465
|
var captureButtonHeight = 92;
|
|
18299
18466
|
var reviewButtonsHeight = 120;
|
|
18300
18467
|
var imageHeight = 40;
|
|
@@ -18316,18 +18483,18 @@ function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstru
|
|
|
18316
18483
|
return () => window.removeEventListener("resize", listener);
|
|
18317
18484
|
});
|
|
18318
18485
|
let helperBoxHeight = (imageUrl ? imageHeight : 0) + (title ? titleHeight : 0) + (instructions ? instructionsHeight : 0);
|
|
18319
|
-
let helperBox = /* @__PURE__ */
|
|
18320
|
-
imageUrl && /* @__PURE__ */
|
|
18321
|
-
title && /* @__PURE__ */
|
|
18322
|
-
instructions && /* @__PURE__ */
|
|
18486
|
+
let helperBox = /* @__PURE__ */ jsxs48(Fragment23, { children: [
|
|
18487
|
+
imageUrl && /* @__PURE__ */ jsx120("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
|
|
18488
|
+
title && /* @__PURE__ */ jsx120("h4", { className: "camera-capture-title", children: title }),
|
|
18489
|
+
instructions && /* @__PURE__ */ jsx120("small", { className: "camera-capture-instructions", children: instructions })
|
|
18323
18490
|
] });
|
|
18324
18491
|
const frameBottomMargin = captureButtonHeight + helperBoxHeight;
|
|
18325
18492
|
if (reviewInstructions) {
|
|
18326
18493
|
helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
|
|
18327
|
-
helperBox = /* @__PURE__ */
|
|
18494
|
+
helperBox = /* @__PURE__ */ jsx120("small", { className: "camera-capture-instructions", children: reviewInstructions });
|
|
18328
18495
|
const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
|
|
18329
18496
|
if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
|
|
18330
|
-
helperBox = /* @__PURE__ */
|
|
18497
|
+
helperBox = /* @__PURE__ */ jsx120(Fragment23, {});
|
|
18331
18498
|
}
|
|
18332
18499
|
}
|
|
18333
18500
|
const framePosition = {
|
|
@@ -18345,19 +18512,31 @@ function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstru
|
|
|
18345
18512
|
width: "90%"
|
|
18346
18513
|
}
|
|
18347
18514
|
};
|
|
18348
|
-
return /* @__PURE__ */
|
|
18349
|
-
/* @__PURE__ */
|
|
18350
|
-
/* @__PURE__ */
|
|
18351
|
-
/* @__PURE__ */
|
|
18515
|
+
return /* @__PURE__ */ jsxs48("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
|
|
18516
|
+
/* @__PURE__ */ jsx120("defs", { children: /* @__PURE__ */ jsxs48("mask", { id: "mask", children: [
|
|
18517
|
+
/* @__PURE__ */ jsx120("rect", { width: "100%", height: "100%", fill: "#fff" }),
|
|
18518
|
+
/* @__PURE__ */ jsx120("image", __spreadValues({ href: overlay }, framePosition))
|
|
18352
18519
|
] }) }),
|
|
18353
|
-
overlay && /* @__PURE__ */
|
|
18354
|
-
outline && /* @__PURE__ */
|
|
18355
|
-
/* @__PURE__ */
|
|
18520
|
+
overlay && /* @__PURE__ */ jsx120("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
|
|
18521
|
+
outline && /* @__PURE__ */ jsx120("image", __spreadValues({ href: outline }, framePosition)),
|
|
18522
|
+
/* @__PURE__ */ jsx120("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ jsx120("div", __spreadProps(__spreadValues({ className: "camera-capture-text-and-image-container" }, helperBoxPosition), { children: helperBox })) })
|
|
18356
18523
|
] });
|
|
18357
18524
|
}
|
|
18358
18525
|
var Overlay_default = Overlay;
|
|
18359
18526
|
|
|
18360
|
-
// src/
|
|
18527
|
+
// src/common/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.tsx
|
|
18528
|
+
import { Button as Button11 } from "@transferwise/components";
|
|
18529
|
+
import { jsx as jsx121, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
18530
|
+
function CameraErrorScreen({ title, description, actionButton, onAction }) {
|
|
18531
|
+
return /* @__PURE__ */ jsx121("div", { className: "container p-t-5", children: /* @__PURE__ */ jsx121("div", { className: "row", children: /* @__PURE__ */ jsxs49("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
18532
|
+
/* @__PURE__ */ jsx121("h2", { className: "text-xs-center m-b-3", children: title }),
|
|
18533
|
+
/* @__PURE__ */ jsx121("p", { className: "text-xs-center m-b-5", children: description }),
|
|
18534
|
+
onAction && actionButton && /* @__PURE__ */ jsx121(Button11, { block: true, onClick: onAction, children: actionButton })
|
|
18535
|
+
] }) }) });
|
|
18536
|
+
}
|
|
18537
|
+
var CameraErrorScreen_default = CameraErrorScreen;
|
|
18538
|
+
|
|
18539
|
+
// src/common/cameraCapture/CameraCapture.tsx
|
|
18361
18540
|
import { jsx as jsx122, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
18362
18541
|
function CameraCapture({
|
|
18363
18542
|
direction = "back",
|