@merchi/product-form-sdk 1.0.10 → 1.0.12
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/components/Field.d.ts +1 -1
- package/dist/components/Field.js +4 -4
- package/dist/components/ProductFormActions.d.ts +1 -1
- package/dist/components/ProductFormActions.js +2 -2
- package/dist/components/context.d.ts +9 -9
- package/dist/components/context.js +4 -4
- package/dist/components/groups.d.ts +1 -1
- package/dist/components/groups.js +4 -4
- package/dist/components/index.d.ts +8 -8
- package/dist/components/index.js +7 -7
- package/dist/components/shell.d.ts +1 -1
- package/dist/components/shell.js +4 -4
- package/dist/helpers/buildJob.d.ts +4 -4
- package/dist/helpers/buildJob.js +2 -2
- package/dist/helpers/gridQuote.d.ts +2 -2
- package/dist/helpers/product.d.ts +2 -2
- package/dist/helpers/product.js +1 -1
- package/dist/helpers/serialize.d.ts +2 -2
- package/dist/index.d.ts +17 -17
- package/dist/index.js +9 -9
- package/dist/runtime/clientPricing.d.ts +1 -1
- package/dist/runtime/pricing.d.ts +2 -2
- package/dist/runtime/pricing.js +2 -2
- package/dist/runtime/runtime.d.ts +5 -5
- package/dist/runtime/runtime.js +3 -3
- package/dist/types/form.d.ts +5 -5
- package/dist/types/job.d.ts +1 -1
- package/dist/types/product.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { VariationFieldJson } from '../types/variation';
|
|
2
|
+
import { VariationFieldJson } from '../types/variation.js';
|
|
3
3
|
export declare function Field({ field, groupIndex, }: {
|
|
4
4
|
field?: VariationFieldJson | null;
|
|
5
5
|
/** When set, reads/writes that batch's group-field selections (see GroupRows). */
|
package/dist/components/Field.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useState } from 'react';
|
|
3
|
-
import { useProductForm } from './context';
|
|
4
|
-
import { theme } from './layout';
|
|
5
|
-
import { clampWithAspectRatio, defaultModalityForAreaUnit, displayToMm, estimateAreaCosts, formatAreaSummary, formatAreaValue, mmToDisplay, parseAreaValue, stepInDisplayUnit, unitLabel, } from '../helpers/area';
|
|
6
|
-
import { formatCurrency } from '../helpers/format';
|
|
3
|
+
import { useProductForm } from './context.js';
|
|
4
|
+
import { theme } from './layout.js';
|
|
5
|
+
import { clampWithAspectRatio, defaultModalityForAreaUnit, displayToMm, estimateAreaCosts, formatAreaSummary, formatAreaValue, mmToDisplay, parseAreaValue, stepInDisplayUnit, unitLabel, } from '../helpers/area.js';
|
|
6
|
+
import { formatCurrency } from '../helpers/format.js';
|
|
7
7
|
const FIELD = {
|
|
8
8
|
TEXT_INPUT: 1,
|
|
9
9
|
SELECT: 2,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useProductForm } from './context';
|
|
3
|
-
import { normalizeFooterActions } from './footerActions';
|
|
2
|
+
import { useProductForm } from './context.js';
|
|
3
|
+
import { normalizeFooterActions } from './footerActions.js';
|
|
4
4
|
/**
|
|
5
5
|
* Configure the host ProductFormShell footer from form source.
|
|
6
6
|
* Render as the first child of the default-exported form.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ProductJson } from '../types/product';
|
|
3
|
-
import { JobJson } from '../types/job';
|
|
4
|
-
import { VariationFieldJson } from '../types/variation';
|
|
5
|
-
import { Pricing } from '../runtime/pricing';
|
|
6
|
-
import { Actions, Helpers } from '../runtime/runtime';
|
|
7
|
-
import { GroupRow } from '../helpers/buildJob';
|
|
8
|
-
import { OPTION_FIELD_TYPES } from '../helpers/constants';
|
|
9
|
-
import { FooterAction, type SubmitAction } from './footerActions';
|
|
2
|
+
import { ProductJson } from '../types/product.js';
|
|
3
|
+
import { JobJson } from '../types/job.js';
|
|
4
|
+
import { VariationFieldJson } from '../types/variation.js';
|
|
5
|
+
import { Pricing } from '../runtime/pricing.js';
|
|
6
|
+
import { Actions, Helpers } from '../runtime/runtime.js';
|
|
7
|
+
import { GroupRow } from '../helpers/buildJob.js';
|
|
8
|
+
import { OPTION_FIELD_TYPES } from '../helpers/constants.js';
|
|
9
|
+
import { FooterAction, type SubmitAction } from './footerActions.js';
|
|
10
10
|
export { OPTION_FIELD_TYPES };
|
|
11
|
-
export type { FooterAction, SubmitAction } from './footerActions';
|
|
11
|
+
export type { FooterAction, SubmitAction } from './footerActions.js';
|
|
12
12
|
export interface FieldSelection {
|
|
13
13
|
/** Comma-separated option ids (selectable fields) or the raw text/number. */
|
|
14
14
|
value: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
|
|
3
|
-
import { buildProductFormJob, jobToFormState, } from '../helpers/buildJob';
|
|
4
|
-
import { OPTION_FIELD_TYPES } from '../helpers/constants';
|
|
5
|
-
import { groupFieldsOf, independentFieldsOf, isOptionQuantityGridProduct, productHasGroups, } from '../helpers/product';
|
|
6
|
-
import { normalizeFooterActions, } from './footerActions';
|
|
3
|
+
import { buildProductFormJob, jobToFormState, } from '../helpers/buildJob.js';
|
|
4
|
+
import { OPTION_FIELD_TYPES } from '../helpers/constants.js';
|
|
5
|
+
import { groupFieldsOf, independentFieldsOf, isOptionQuantityGridProduct, productHasGroups, } from '../helpers/product.js';
|
|
6
|
+
import { normalizeFooterActions, } from './footerActions.js';
|
|
7
7
|
export { OPTION_FIELD_TYPES };
|
|
8
8
|
const Ctx = createContext(null);
|
|
9
9
|
export function useProductForm() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { VariationFieldJson } from '../types/variation';
|
|
2
|
+
import { VariationFieldJson } from '../types/variation.js';
|
|
3
3
|
/**
|
|
4
4
|
* Per-option quantity grid for products with a single group variation field
|
|
5
5
|
* (e.g. Size or Colour). Wired to useProductForm() for live quoting.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useProductForm } from './context';
|
|
4
|
-
import { Field } from './Field';
|
|
5
|
-
import { Card, Heading, Stack, theme } from './layout';
|
|
6
|
-
import { inventoryStatusText, quoteGroupForOption } from '../helpers/gridQuote';
|
|
3
|
+
import { useProductForm } from './context.js';
|
|
4
|
+
import { Field } from './Field.js';
|
|
5
|
+
import { Card, Heading, Stack, theme } from './layout.js';
|
|
6
|
+
import { inventoryStatusText, quoteGroupForOption } from '../helpers/gridQuote.js';
|
|
7
7
|
const COLOUR_SELECT = 11;
|
|
8
8
|
const IMAGE_SELECT = 9;
|
|
9
9
|
function qtyInputStyle(disabled) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { Section, Stack, Card, Heading, Text, Divider, theme } from './layout';
|
|
2
|
-
export { Field } from './Field';
|
|
3
|
-
export { GroupRows, OptionQuantityGrid } from './groups';
|
|
4
|
-
export { ProductFormProvider, useProductForm, OPTION_FIELD_TYPES, } from './context';
|
|
5
|
-
export type { ProductFormContextValue, ProductFormProviderProps, FieldSelection, SubmitAction, FooterAction, GroupRow, } from './context';
|
|
6
|
-
export { ProductFormShell } from './shell';
|
|
7
|
-
export { ProductFormActions } from './ProductFormActions';
|
|
8
|
-
export { normalizeFooterActions, resolveFooterActions, footerActionsFromComponent, } from './footerActions';
|
|
1
|
+
export { Section, Stack, Card, Heading, Text, Divider, theme } from './layout.js';
|
|
2
|
+
export { Field } from './Field.js';
|
|
3
|
+
export { GroupRows, OptionQuantityGrid } from './groups.js';
|
|
4
|
+
export { ProductFormProvider, useProductForm, OPTION_FIELD_TYPES, } from './context.js';
|
|
5
|
+
export type { ProductFormContextValue, ProductFormProviderProps, FieldSelection, SubmitAction, FooterAction, GroupRow, } from './context.js';
|
|
6
|
+
export { ProductFormShell } from './shell.js';
|
|
7
|
+
export { ProductFormActions } from './ProductFormActions.js';
|
|
8
|
+
export { normalizeFooterActions, resolveFooterActions, footerActionsFromComponent, } from './footerActions.js';
|
package/dist/components/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { Section, Stack, Card, Heading, Text, Divider, theme } from './layout';
|
|
2
|
-
export { Field } from './Field';
|
|
3
|
-
export { GroupRows, OptionQuantityGrid } from './groups';
|
|
4
|
-
export { ProductFormProvider, useProductForm, OPTION_FIELD_TYPES, } from './context';
|
|
5
|
-
export { ProductFormShell } from './shell';
|
|
6
|
-
export { ProductFormActions } from './ProductFormActions';
|
|
7
|
-
export { normalizeFooterActions, resolveFooterActions, footerActionsFromComponent, } from './footerActions';
|
|
1
|
+
export { Section, Stack, Card, Heading, Text, Divider, theme } from './layout.js';
|
|
2
|
+
export { Field } from './Field.js';
|
|
3
|
+
export { GroupRows, OptionQuantityGrid } from './groups.js';
|
|
4
|
+
export { ProductFormProvider, useProductForm, OPTION_FIELD_TYPES, } from './context.js';
|
|
5
|
+
export { ProductFormShell } from './shell.js';
|
|
6
|
+
export { ProductFormActions } from './ProductFormActions.js';
|
|
7
|
+
export { normalizeFooterActions, resolveFooterActions, footerActionsFromComponent, } from './footerActions.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ProductFormProviderProps } from './context';
|
|
2
|
+
import { ProductFormProviderProps } from './context.js';
|
|
3
3
|
/**
|
|
4
4
|
* Wraps a custom form: provides the form context (state + live pricing) and
|
|
5
5
|
* renders a quantity control above and a total + submit footer below the form's
|
package/dist/components/shell.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { ProductFormProvider, useProductForm, } from './context';
|
|
4
|
-
import { theme } from './layout';
|
|
5
|
-
import { productHasGroups } from '../helpers/product';
|
|
6
|
-
import { footerActionsFromComponent, resolveFooterActions, } from './footerActions';
|
|
3
|
+
import { ProductFormProvider, useProductForm, } from './context.js';
|
|
4
|
+
import { theme } from './layout.js';
|
|
5
|
+
import { productHasGroups } from '../helpers/product.js';
|
|
6
|
+
import { footerActionsFromComponent, resolveFooterActions, } from './footerActions.js';
|
|
7
7
|
function QuantityControl() {
|
|
8
8
|
const { product, quantity, setQuantity } = useProductForm();
|
|
9
9
|
if (productHasGroups(product))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { JobJson } from '../types/job';
|
|
2
|
-
import { ProductJson } from '../types/product';
|
|
3
|
-
import { VariationJson } from '../types/variation';
|
|
4
|
-
import { FieldSelection } from '../components/context';
|
|
1
|
+
import { JobJson } from '../types/job.js';
|
|
2
|
+
import { ProductJson } from '../types/product.js';
|
|
3
|
+
import { VariationJson } from '../types/variation.js';
|
|
4
|
+
import { FieldSelection } from '../components/context.js';
|
|
5
5
|
export interface GroupRow {
|
|
6
6
|
quantity: number;
|
|
7
7
|
selections: Record<number, FieldSelection>;
|
package/dist/helpers/buildJob.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OPTION_FIELD_TYPES } from './constants';
|
|
2
|
-
import { groupFieldsOf, independentFieldsOf, isOptionQuantityGridProduct, productHasGroups, } from './product';
|
|
1
|
+
import { OPTION_FIELD_TYPES } from './constants.js';
|
|
2
|
+
import { groupFieldsOf, independentFieldsOf, isOptionQuantityGridProduct, productHasGroups, } from './product.js';
|
|
3
3
|
export function selectionsToVariations(selections) {
|
|
4
4
|
return Object.entries(selections).map(([fieldId, sel]) => {
|
|
5
5
|
const variation = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { JobJson } from '../types/job';
|
|
2
|
-
import { VariationsGroupJson } from '../types/variation';
|
|
1
|
+
import { JobJson } from '../types/job.js';
|
|
2
|
+
import { VariationsGroupJson } from '../types/variation.js';
|
|
3
3
|
/** Find the quoted variationsGroup row for a grid option (single group field). */
|
|
4
4
|
export declare function quoteGroupForOption(quote: JobJson | null | undefined, groupFieldId: number, optionId: number): VariationsGroupJson | undefined;
|
|
5
5
|
export interface InventoryStatusText {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ProductJson } from '../types/product';
|
|
2
|
-
import { VariationFieldJson } from '../types/variation';
|
|
1
|
+
import { ProductJson } from '../types/product.js';
|
|
2
|
+
import { VariationFieldJson } from '../types/variation.js';
|
|
3
3
|
export declare function groupFieldsOf(product: ProductJson): VariationFieldJson[];
|
|
4
4
|
export declare function independentFieldsOf(product: ProductJson): VariationFieldJson[];
|
|
5
5
|
export declare function productHasGroups(product: ProductJson): boolean;
|
package/dist/helpers/product.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { JobJson } from '../types/job';
|
|
2
|
-
import { VariationsGroupJson } from '../types/variation';
|
|
1
|
+
import { JobJson } from '../types/job.js';
|
|
2
|
+
import { VariationsGroupJson } from '../types/variation.js';
|
|
3
3
|
/** Return a deep-ish copy of the job with variations/groups cleaned for the API:
|
|
4
4
|
* form-only fields removed, zero-quantity groups dropped, and each remaining
|
|
5
5
|
* group's quantity defaulted to 0 when missing. Does not mutate the input
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export { SDK_VERSION, getProductFormSdkVersion } from './version';
|
|
2
|
-
export type { OptionJson, VariationFieldJson, VariationJson, VariationsGroupJson } from './types/variation';
|
|
3
|
-
export type { ProductJson } from './types/product';
|
|
4
|
-
export type { JobJson, QuoteFields } from './types/job';
|
|
5
|
-
export type { ProductFormProps, ProductFormComponent } from './types/form';
|
|
6
|
-
export { serializeJob, nonEmptyGroups } from './helpers/serialize';
|
|
7
|
-
export { formatCurrency, urlFor } from './helpers/format';
|
|
8
|
-
export { productHasGroups, groupFieldsOf, independentFieldsOf, isOptionQuantityGridProduct, } from './helpers/product';
|
|
9
|
-
export { buildProductFormJob, jobToFormState, selectionsToVariations, } from './helpers/buildJob';
|
|
10
|
-
export type { GroupRow, HydratedProductFormState, ProductFormJobState, } from './helpers/buildJob';
|
|
11
|
-
export { OPTION_FIELD_TYPES, COLOUR_EXTRACT, FILE_FIELD_TYPES, AREA, } from './helpers/constants';
|
|
12
|
-
export { createPricing } from './runtime/pricing';
|
|
13
|
-
export type { Pricing } from './runtime/pricing';
|
|
14
|
-
export { createProductFormRuntime } from './runtime/runtime';
|
|
15
|
-
export type { Actions, Helpers, ProductFormRuntime, ProductFormRuntimeConfig, } from './runtime/runtime';
|
|
16
|
-
export { Section, Stack, Card, Heading, Text, Divider, Field, GroupRows, OptionQuantityGrid, ProductFormProvider, ProductFormShell, ProductFormActions, useProductForm, theme, } from './components';
|
|
17
|
-
export type { ProductFormContextValue, ProductFormProviderProps, FieldSelection, SubmitAction, FooterAction, } from './components';
|
|
1
|
+
export { SDK_VERSION, getProductFormSdkVersion } from './version.js';
|
|
2
|
+
export type { OptionJson, VariationFieldJson, VariationJson, VariationsGroupJson } from './types/variation.js';
|
|
3
|
+
export type { ProductJson } from './types/product.js';
|
|
4
|
+
export type { JobJson, QuoteFields } from './types/job.js';
|
|
5
|
+
export type { ProductFormProps, ProductFormComponent } from './types/form.js';
|
|
6
|
+
export { serializeJob, nonEmptyGroups } from './helpers/serialize.js';
|
|
7
|
+
export { formatCurrency, urlFor } from './helpers/format.js';
|
|
8
|
+
export { productHasGroups, groupFieldsOf, independentFieldsOf, isOptionQuantityGridProduct, } from './helpers/product.js';
|
|
9
|
+
export { buildProductFormJob, jobToFormState, selectionsToVariations, } from './helpers/buildJob.js';
|
|
10
|
+
export type { GroupRow, HydratedProductFormState, ProductFormJobState, } from './helpers/buildJob.js';
|
|
11
|
+
export { OPTION_FIELD_TYPES, COLOUR_EXTRACT, FILE_FIELD_TYPES, AREA, } from './helpers/constants.js';
|
|
12
|
+
export { createPricing } from './runtime/pricing.js';
|
|
13
|
+
export type { Pricing } from './runtime/pricing.js';
|
|
14
|
+
export { createProductFormRuntime } from './runtime/runtime.js';
|
|
15
|
+
export type { Actions, Helpers, ProductFormRuntime, ProductFormRuntimeConfig, } from './runtime/runtime.js';
|
|
16
|
+
export { Section, Stack, Card, Heading, Text, Divider, Field, GroupRows, OptionQuantityGrid, ProductFormProvider, ProductFormShell, ProductFormActions, useProductForm, theme, } from './components/index.js';
|
|
17
|
+
export type { ProductFormContextValue, ProductFormProviderProps, FieldSelection, SubmitAction, FooterAction, } from './components/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { SDK_VERSION, getProductFormSdkVersion } from './version';
|
|
2
|
-
export { serializeJob, nonEmptyGroups } from './helpers/serialize';
|
|
3
|
-
export { formatCurrency, urlFor } from './helpers/format';
|
|
4
|
-
export { productHasGroups, groupFieldsOf, independentFieldsOf, isOptionQuantityGridProduct, } from './helpers/product';
|
|
5
|
-
export { buildProductFormJob, jobToFormState, selectionsToVariations, } from './helpers/buildJob';
|
|
6
|
-
export { OPTION_FIELD_TYPES, COLOUR_EXTRACT, FILE_FIELD_TYPES, AREA, } from './helpers/constants';
|
|
7
|
-
export { createPricing } from './runtime/pricing';
|
|
8
|
-
export { createProductFormRuntime } from './runtime/runtime';
|
|
1
|
+
export { SDK_VERSION, getProductFormSdkVersion } from './version.js';
|
|
2
|
+
export { serializeJob, nonEmptyGroups } from './helpers/serialize.js';
|
|
3
|
+
export { formatCurrency, urlFor } from './helpers/format.js';
|
|
4
|
+
export { productHasGroups, groupFieldsOf, independentFieldsOf, isOptionQuantityGridProduct, } from './helpers/product.js';
|
|
5
|
+
export { buildProductFormJob, jobToFormState, selectionsToVariations, } from './helpers/buildJob.js';
|
|
6
|
+
export { OPTION_FIELD_TYPES, COLOUR_EXTRACT, FILE_FIELD_TYPES, AREA, } from './helpers/constants.js';
|
|
7
|
+
export { createPricing } from './runtime/pricing.js';
|
|
8
|
+
export { createProductFormRuntime } from './runtime/runtime.js';
|
|
9
9
|
// UI component kit — the building blocks AI-built forms compose. Form authors
|
|
10
10
|
// import these from '@merchi/product-form-sdk' (the static gate allowlists it).
|
|
11
|
-
export { Section, Stack, Card, Heading, Text, Divider, Field, GroupRows, OptionQuantityGrid, ProductFormProvider, ProductFormShell, ProductFormActions, useProductForm, theme, } from './components';
|
|
11
|
+
export { Section, Stack, Card, Heading, Text, Divider, Field, GroupRows, OptionQuantityGrid, ProductFormProvider, ProductFormShell, ProductFormActions, useProductForm, theme, } from './components/index.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { JobJson } from '../types/job';
|
|
2
|
-
import { ProductJson } from '../types/product';
|
|
1
|
+
import { JobJson } from '../types/job.js';
|
|
2
|
+
import { ProductJson } from '../types/product.js';
|
|
3
3
|
export interface Pricing {
|
|
4
4
|
/** Request a quote for the given job; resolves to the job json with pricing
|
|
5
5
|
* fields (cost, totalCost, currency, ...) populated. Uses client-side
|
package/dist/runtime/pricing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Merchi } from '@merchi/sdk';
|
|
2
|
-
import { serializeJob } from '../helpers/serialize';
|
|
3
|
-
import { clientQuote } from './clientPricing';
|
|
2
|
+
import { serializeJob } from '../helpers/serialize.js';
|
|
3
|
+
import { clientQuote } from './clientPricing.js';
|
|
4
4
|
/** Build a pricing helper bound to a backend api url.
|
|
5
5
|
*
|
|
6
6
|
* When `product.clientSideCalculation` is set, getQuote computes the quote
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ProductJson } from '../types/product';
|
|
2
|
-
import { JobJson } from '../types/job';
|
|
3
|
-
import { Pricing } from './pricing';
|
|
4
|
-
import { serializeJob, nonEmptyGroups } from '../helpers/serialize';
|
|
5
|
-
import { formatCurrency, urlFor } from '../helpers/format';
|
|
1
|
+
import { ProductJson } from '../types/product.js';
|
|
2
|
+
import { JobJson } from '../types/job.js';
|
|
3
|
+
import { Pricing } from './pricing.js';
|
|
4
|
+
import { serializeJob, nonEmptyGroups } from '../helpers/serialize.js';
|
|
5
|
+
import { formatCurrency, urlFor } from '../helpers/format.js';
|
|
6
6
|
export interface Actions {
|
|
7
7
|
addToCart?: (job: JobJson) => void;
|
|
8
8
|
buyNow?: (job: JobJson) => void;
|
package/dist/runtime/runtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createPricing } from './pricing';
|
|
2
|
-
import { serializeJob, nonEmptyGroups } from '../helpers/serialize';
|
|
3
|
-
import { formatCurrency, urlFor } from '../helpers/format';
|
|
1
|
+
import { createPricing } from './pricing.js';
|
|
2
|
+
import { serializeJob, nonEmptyGroups } from '../helpers/serialize.js';
|
|
3
|
+
import { formatCurrency, urlFor } from '../helpers/format.js';
|
|
4
4
|
/** Build the runtime (pricing + actions + helpers) the embed passes into a
|
|
5
5
|
* custom form. Each action quotes the job first, then invokes the host callback
|
|
6
6
|
* (matching @merchi/product-form's provider behaviour). An action is omitted when
|
package/dist/types/form.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
|
-
import { ProductJson } from './product';
|
|
3
|
-
import { JobJson } from './job';
|
|
4
|
-
import { Pricing } from '../runtime/pricing';
|
|
5
|
-
import { Actions, Helpers } from '../runtime/runtime';
|
|
6
|
-
import type { FooterAction } from '../components/footerActions';
|
|
2
|
+
import { ProductJson } from './product.js';
|
|
3
|
+
import { JobJson } from './job.js';
|
|
4
|
+
import { Pricing } from '../runtime/pricing.js';
|
|
5
|
+
import { Actions, Helpers } from '../runtime/runtime.js';
|
|
6
|
+
import type { FooterAction } from '../components/footerActions.js';
|
|
7
7
|
/** Props every custom product form receives. This is the ONLY surface a form
|
|
8
8
|
* may rely on; the static-analysis gate (Plan 3) rejects anything else. */
|
|
9
9
|
export interface ProductFormProps {
|
package/dist/types/job.d.ts
CHANGED
package/dist/types/product.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { VariationFieldJson } from './variation';
|
|
1
|
+
import { VariationFieldJson } from './variation.js';
|
|
2
2
|
/** The product JSON a custom form receives. Fields are optional because the
|
|
3
3
|
* shape varies by product type; the commonly-used fields are documented here. */
|
|
4
4
|
export interface ProductJson {
|
package/dist/version.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Auto-synced from package.json — do not edit; run `npm run build`. */
|
|
2
2
|
export function getProductFormSdkVersion() {
|
|
3
|
-
return '1.0.
|
|
3
|
+
return '1.0.12';
|
|
4
4
|
}
|
|
5
5
|
/** @deprecated Prefer getProductFormSdkVersion(); kept for gate/export compatibility. */
|
|
6
6
|
export const SDK_VERSION = getProductFormSdkVersion();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merchi/product-form-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "Contract SDK for AI-built Merchi custom product forms.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"react": "^18.0.0 || ^19.0.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@merchi/sdk": "^1.42.
|
|
33
|
+
"@merchi/sdk": "^1.42.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/jest": "^29.0.0",
|