@jfdevelops/react-multi-step-form 1.0.0-alpha.23 → 1.0.0-alpha.24
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/utils.cjs +1 -2
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.mjs +1 -2
- package/dist/utils.mjs.map +1 -1
- package/package.json +1 -1
package/dist/utils.cjs
CHANGED
|
@@ -19,8 +19,7 @@ function resolvedCtxCreator(logger, values) {
|
|
|
19
19
|
function getValidatedCustomInputHooks(input) {
|
|
20
20
|
const result = {};
|
|
21
21
|
for (const [key, value] of Object.entries(input)) if (typeof value === "function") try {
|
|
22
|
-
|
|
23
|
-
result$1[key] = result$1;
|
|
22
|
+
result[key] = value();
|
|
24
23
|
} catch (error) {
|
|
25
24
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
26
25
|
throw new Error(`[multi-step-form] Error calling hook "${key}" in useFormInstance.render: ${errorMessage}\n\nThis usually means:\n1. The hook is being called outside of a React component\n2. The hook has invalid dependencies or configuration\n3. There's an error in your hook implementation\n\nOriginal error: ${errorMessage}`, { cause: error });
|
package/dist/utils.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","names":["result: Record<string, unknown>"
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":["result: Record<string, unknown>"],"sources":["../src/utils.ts"],"sourcesContent":["import {\n invariant,\n type Expand,\n type HelperFnChosenSteps,\n type HelperFnCtx,\n type MultiStepFormLogger,\n type StepNumbers,\n type ValidStepKey,\n} from '@jfdevelops/multi-step-form-core';\nimport type { AnyResolvedStep, StepSpecificComponent } from './step-schema';\n\nexport function resolvedCtxCreator<\n resolvedStep extends AnyResolvedStep,\n stepNumbers extends StepNumbers<resolvedStep>\n>(\n logger: MultiStepFormLogger,\n values: Omit<resolvedStep, `step${stepNumbers}`>\n) {\n return function <\n chosenStep extends HelperFnChosenSteps.tupleNotation<\n ValidStepKey<stepNumbers>\n >,\n additionalCtx\n >(\n options: Required<\n StepSpecificComponent.CtxSelector<\n resolvedStep,\n stepNumbers,\n chosenStep,\n additionalCtx\n >\n > & { ctx: Expand<HelperFnCtx<resolvedStep, stepNumbers, chosenStep>> }\n ) {\n const { ctx, ctxData } = options;\n\n logger.info('Option \"ctxData\" is defined');\n invariant(\n typeof ctxData === 'function',\n 'Option \"ctxData\" must be a function'\n );\n\n const additionalCtx = ctxData({ ctx: values } as never);\n\n logger.info(\n `Addition context is: ${JSON.stringify(additionalCtx, null, 2)}`\n );\n\n const resolvedCtx = {\n ...ctx,\n ...additionalCtx,\n };\n\n logger.info(`Resolved context is: ${JSON.stringify(resolvedCtx, null, 2)}`);\n\n return resolvedCtx;\n };\n}\n\nexport function getValidatedCustomInputHooks(input: Record<string, unknown>) {\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(input)) {\n if (typeof value === 'function') {\n try {\n const hookResult = value();\n // Verify the hook was actually called and returned a value\n // (hooks should always return something, even if it's undefined)\n result[key] = hookResult;\n\n // In development, we can add additional verification here\n // Log hook calls for debugging (can be disabled in production by removing console.debug)\n // if (typeof console !== 'undefined' && console.debug) {\n // console.debug(\n // `[multi-step-form] Hook \"${key}\" called successfully`,\n // { result: result === undefined ? 'defined' : 'undefined' }\n // );\n // }\n } catch (error) {\n // Provide helpful error message if hook throws\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n\n throw new Error(\n `[multi-step-form] Error calling hook \"${key}\" in useFormInstance.render: ${errorMessage}\\n\\n` +\n `This usually means:\\n` +\n `1. The hook is being called outside of a React component\\n` +\n `2. The hook has invalid dependencies or configuration\\n` +\n `3. There's an error in your hook implementation\\n\\n` +\n `Original error: ${errorMessage}`,\n { cause: error }\n );\n }\n } else {\n result[key] = value;\n }\n }\n\n return result;\n}\n"],"mappings":";;;AAWA,SAAgB,mBAId,QACA,QACA;AACA,QAAO,SAML,SAQA;EACA,MAAM,EAAE,KAAK,YAAY;AAEzB,SAAO,KAAK,gCAA8B;AAC1C,mDACE,OAAO,YAAY,YACnB,wCACD;EAED,MAAM,gBAAgB,QAAQ,EAAE,KAAK,QAAQ,CAAU;AAEvD,SAAO,KACL,wBAAwB,KAAK,UAAU,eAAe,MAAM,EAAE,GAC/D;EAED,MAAM,cAAc;GAClB,GAAG;GACH,GAAG;GACJ;AAED,SAAO,KAAK,wBAAwB,KAAK,UAAU,aAAa,MAAM,EAAE,GAAG;AAE3E,SAAO;;;AAIX,SAAgB,6BAA6B,OAAgC;CAC3E,MAAMA,SAAkC,EAAE;AAE1C,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,CAC9C,KAAI,OAAO,UAAU,WACnB,KAAI;AAIF,SAAO,OAHY,OAAO;UAanB,OAAO;EAEd,MAAM,eACJ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;AAExD,QAAM,IAAI,MACR,yCAAyC,IAAI,+BAA+B,aAAa,+MAKpE,gBACrB,EAAE,OAAO,OAAO,CACjB;;KAGH,QAAO,OAAO;AAIlB,QAAO"}
|
package/dist/utils.mjs
CHANGED
|
@@ -19,8 +19,7 @@ function resolvedCtxCreator(logger, values) {
|
|
|
19
19
|
function getValidatedCustomInputHooks(input) {
|
|
20
20
|
const result = {};
|
|
21
21
|
for (const [key, value] of Object.entries(input)) if (typeof value === "function") try {
|
|
22
|
-
|
|
23
|
-
result$1[key] = result$1;
|
|
22
|
+
result[key] = value();
|
|
24
23
|
} catch (error) {
|
|
25
24
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
26
25
|
throw new Error(`[multi-step-form] Error calling hook "${key}" in useFormInstance.render: ${errorMessage}\n\nThis usually means:\n1. The hook is being called outside of a React component\n2. The hook has invalid dependencies or configuration\n3. There's an error in your hook implementation\n\nOriginal error: ${errorMessage}`, { cause: error });
|
package/dist/utils.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","names":["result: Record<string, unknown>"
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":["result: Record<string, unknown>"],"sources":["../src/utils.ts"],"sourcesContent":["import {\n invariant,\n type Expand,\n type HelperFnChosenSteps,\n type HelperFnCtx,\n type MultiStepFormLogger,\n type StepNumbers,\n type ValidStepKey,\n} from '@jfdevelops/multi-step-form-core';\nimport type { AnyResolvedStep, StepSpecificComponent } from './step-schema';\n\nexport function resolvedCtxCreator<\n resolvedStep extends AnyResolvedStep,\n stepNumbers extends StepNumbers<resolvedStep>\n>(\n logger: MultiStepFormLogger,\n values: Omit<resolvedStep, `step${stepNumbers}`>\n) {\n return function <\n chosenStep extends HelperFnChosenSteps.tupleNotation<\n ValidStepKey<stepNumbers>\n >,\n additionalCtx\n >(\n options: Required<\n StepSpecificComponent.CtxSelector<\n resolvedStep,\n stepNumbers,\n chosenStep,\n additionalCtx\n >\n > & { ctx: Expand<HelperFnCtx<resolvedStep, stepNumbers, chosenStep>> }\n ) {\n const { ctx, ctxData } = options;\n\n logger.info('Option \"ctxData\" is defined');\n invariant(\n typeof ctxData === 'function',\n 'Option \"ctxData\" must be a function'\n );\n\n const additionalCtx = ctxData({ ctx: values } as never);\n\n logger.info(\n `Addition context is: ${JSON.stringify(additionalCtx, null, 2)}`\n );\n\n const resolvedCtx = {\n ...ctx,\n ...additionalCtx,\n };\n\n logger.info(`Resolved context is: ${JSON.stringify(resolvedCtx, null, 2)}`);\n\n return resolvedCtx;\n };\n}\n\nexport function getValidatedCustomInputHooks(input: Record<string, unknown>) {\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(input)) {\n if (typeof value === 'function') {\n try {\n const hookResult = value();\n // Verify the hook was actually called and returned a value\n // (hooks should always return something, even if it's undefined)\n result[key] = hookResult;\n\n // In development, we can add additional verification here\n // Log hook calls for debugging (can be disabled in production by removing console.debug)\n // if (typeof console !== 'undefined' && console.debug) {\n // console.debug(\n // `[multi-step-form] Hook \"${key}\" called successfully`,\n // { result: result === undefined ? 'defined' : 'undefined' }\n // );\n // }\n } catch (error) {\n // Provide helpful error message if hook throws\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n\n throw new Error(\n `[multi-step-form] Error calling hook \"${key}\" in useFormInstance.render: ${errorMessage}\\n\\n` +\n `This usually means:\\n` +\n `1. The hook is being called outside of a React component\\n` +\n `2. The hook has invalid dependencies or configuration\\n` +\n `3. There's an error in your hook implementation\\n\\n` +\n `Original error: ${errorMessage}`,\n { cause: error }\n );\n }\n } else {\n result[key] = value;\n }\n }\n\n return result;\n}\n"],"mappings":";;;AAWA,SAAgB,mBAId,QACA,QACA;AACA,QAAO,SAML,SAQA;EACA,MAAM,EAAE,KAAK,YAAY;AAEzB,SAAO,KAAK,gCAA8B;AAC1C,YACE,OAAO,YAAY,YACnB,wCACD;EAED,MAAM,gBAAgB,QAAQ,EAAE,KAAK,QAAQ,CAAU;AAEvD,SAAO,KACL,wBAAwB,KAAK,UAAU,eAAe,MAAM,EAAE,GAC/D;EAED,MAAM,cAAc;GAClB,GAAG;GACH,GAAG;GACJ;AAED,SAAO,KAAK,wBAAwB,KAAK,UAAU,aAAa,MAAM,EAAE,GAAG;AAE3E,SAAO;;;AAIX,SAAgB,6BAA6B,OAAgC;CAC3E,MAAMA,SAAkC,EAAE;AAE1C,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,CAC9C,KAAI,OAAO,UAAU,WACnB,KAAI;AAIF,SAAO,OAHY,OAAO;UAanB,OAAO;EAEd,MAAM,eACJ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;AAExD,QAAM,IAAI,MACR,yCAAyC,IAAI,+BAA+B,aAAa,+MAKpE,gBACrB,EAAE,OAAO,OAAO,CACjB;;KAGH,QAAO,OAAO;AAIlB,QAAO"}
|