Checkout Gift Package

The CheckoutGiftPack component provides gift package functionality during the checkout process. It allows customers to mark their order as a gift and optionally include a gift note. The component supports both default and fully customized UI via customUIRender and customGiftNoteFormUIRender.

Installation Method

You can use the following command to install the extension with the latest plugins:

npx @akinon/projectzero@latest --plugins

Props

Prop
Type
Required
Description

useModal

boolean

Optional

Determines if the gift form is shown in a modal.

modalClassName

string

Optional

Custom class for the modal container.

modalTitle

string

Optional

Title text for the modal.

modalContentClassName

string

Optional

Custom class for the modal's content area.

maxNoteLength

number

Optional

Maximum allowed character length for the gift note.

customUIRender

function

Optional

Function to override the default UI logic.

customGiftNoteFormUIRender

function

Optional

Function to override the default gift note form layout.

CustomUIRender Parameters

Parameter
Type
Description

hasGiftPack

boolean

Whether a gift pack is currently selected.

hasNote

{ state: boolean }

Whether a note is being written.

note

string

Current note value.

onAddGiftPack

() => void

Callback to add a gift pack.

onRemoveGiftPack

() => void

Callback to remove the gift pack.

onAddNote

() => void

Callback to show note entry UI.

formContent

React.ReactNode

Rendered content of the gift note form.

translations

Record<string, string>

Translated texts for UI labels.

customGiftNoteFormUIRender Parameters

Parameter
Type
Description

register

any

React Hook Form register method.

errors

any

Validation errors.

note

string

Current note value.

textAreaCount

number

Current character count.

onSubmit

(data: any) => void

Form submit handler.

removeNote

() => void

Callback to remove the note.

handleSubmit

any

React Hook Form submit handler.

translations

Record<string, string>

Translation object for form labels and messages.

Default Translations

Usage Examples

Default Usage

Custom UI Usage

Last updated

Was this helpful?