@akinon/pz-pay-on-delivery 1.91.0-rc.3 → 1.91.0-rc.5

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/package.json +1 -1
  3. package/readme.md +130 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @akinon/pz-pay-on-delivery
2
2
 
3
+ ## 1.91.0-rc.5
4
+
5
+ ## 1.91.0-rc.4
6
+
7
+ ### Minor Changes
8
+
9
+ - d0853b3: ZERO-2844 :Add README for PayOnDelivery component with installation and usage instructions
10
+ - 7eb51ca: ZERO-3424 :Update package versions
11
+
12
+ <<<<<<< HEAD
13
+
3
14
  ## 1.91.0-rc.3
4
15
 
5
16
  ### Minor Changes
@@ -20,7 +31,11 @@
20
31
  - 64699d3f: ZERO-2761: Fix invalid import for plugin module
21
32
  - e974d8e: ZERO-3406: Fix rc build
22
33
  - 7727ae55: ZERO-3073: Refactor basket page to use server-side data fetching and simplify component structure
23
- - 33377cfd: ZERO-3267: Refactor import statement for ROUTES in error-page component
34
+ - # 33377cfd: ZERO-3267: Refactor import statement for ROUTES in error-page component
35
+
36
+ ## 1.91.0
37
+
38
+ > > > > > > > origin/ZERO-3418
24
39
 
25
40
  ## 1.90.0
26
41
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/pz-pay-on-delivery",
3
- "version": "1.91.0-rc.3",
3
+ "version": "1.91.0-rc.5",
4
4
  "license": "MIT",
5
5
  "main": "src/index.tsx",
6
6
  "peerDependencies": {
package/readme.md ADDED
@@ -0,0 +1,130 @@
1
+ # @akinon/pz-pay-on-delivery
2
+
3
+ ## Installation method
4
+
5
+ You can use the following command to install the extension with the latest plugins:
6
+
7
+ ```bash
8
+ npx @akinon/projectzero@latest --plugins
9
+ ```
10
+
11
+ ## PayOnDelivery
12
+
13
+ A customizable React component that enables customers to select a "Pay on Delivery" payment method during checkout and confirm their agreement to terms before placing the order.
14
+
15
+ ---
16
+
17
+ ### Props
18
+
19
+ #### `PayOnDeliveryProps`
20
+
21
+ | Prop | Type | Required | Description |
22
+ | --- | --- | --- | --- |
23
+ | `translations` | `Record<string, PayOnDeliveryTranslationsProps>` | Optional | Localization texts for section titles, labels, and error messages |
24
+ | `agreementCheckbox` | `React.ReactElement` | Optional | A controlled checkbox React element (e.g., terms agreement checkbox) |
25
+ | `customUIRender` | `(props: RenderProps) => React.ReactNode` | Optional | Override default UI rendering with your own layout and logic |
26
+
27
+ ---
28
+
29
+ #### `PayOnDeliveryTranslationsProps`
30
+
31
+ | Key | Type | Description |
32
+ | ---------------------------- | -------- | ------------------------------ |
33
+ | `paymentInformationTitle` | `string` | Main section title |
34
+ | `paymentInformationSubtitle` | `string` | Subtitle for available options |
35
+ | `totalAmountText` | `string` | Label for total amount display |
36
+ | `serviceFeeText` | `string` | Label for service fee info |
37
+ | `returnInfoText` | `string` | Text about return process |
38
+ | `refundInfoText` | `string` | Text about refund process |
39
+ | `faqInfoText` | `string` | Link/label for FAQ section |
40
+ | `placeOrderText` | `string` | Button text |
41
+ | `errorMessageText` | `string` | API error display text |
42
+ | `requiredFieldMessage` | `string` | Field validation error message |
43
+
44
+ ---
45
+
46
+ #### RenderProps (for `customUIRender`)
47
+
48
+ | Prop | Type | Description |
49
+ | --- | --- | --- | --- |
50
+ | `handleSubmit` | `UseFormHandleSubmit` | Form submit handler |
51
+ | `onSubmit` | `SubmitHandler<PayOnDeliveryForm>` | Submit function |
52
+ | `register` | `UseFormRegister<PayOnDeliveryForm>` | Form field registrar |
53
+ | `control` | `Control<PayOnDeliveryForm>` | React Hook Form control instance |
54
+ | `errors` | `FieldErrors<PayOnDeliveryForm>` | Validation errors |
55
+ | `paymentChoices` | `any[]` | List of available payment choices |
56
+ | `preOrder` | `RootState['checkout']['preOrder']` | PreOrder data from Redux |
57
+ | `formError` | `string | null` | API error messages |
58
+ | `isLoading` | `boolean` | Loading state |
59
+ | `setPayOnDeliveryChoice` | `(value: string) => void` | Function to update payment selection |
60
+
61
+ ---
62
+
63
+ ## Usage
64
+
65
+ ```bash
66
+ src/views/checkout/steps/payment/options/pay-on-delivery/
67
+ ```
68
+
69
+ ---
70
+
71
+ ### Default Usage
72
+
73
+ ```tsx
74
+ <PluginModule
75
+ component={Component.PayOnDelivery}
76
+ props={{
77
+ agreementCheckbox: (
78
+ <CheckoutAgreements control={null} error={null} fieldId="agreement" />
79
+ )
80
+ }}
81
+ />
82
+ ```
83
+
84
+ ---
85
+
86
+ ### Customized Usage with `customUIRender`
87
+
88
+ ```tsx
89
+ <PluginModule
90
+ component={Component.PayOnDelivery}
91
+ props={{
92
+ customUIRender: ({
93
+ handleSubmit,
94
+ onSubmit,
95
+ control,
96
+ errors,
97
+ setPayOnDeliveryChoice,
98
+ paymentChoices,
99
+ preOrder,
100
+ formError
101
+ }) => (
102
+ <form
103
+ onSubmit={handleSubmit(onSubmit)}
104
+ className="p-6 bg-white rounded-lg space-y-6"
105
+ >
106
+ <h2 className="text-xl font-semibold">PAY ON DELIVERY</h2>
107
+ <div className="space-y-4">
108
+ {paymentChoices.map((choice) => (
109
+ <label key={choice.value} className="flex items-center space-x-4">
110
+ <Radio
111
+ type="radio"
112
+ value={choice.value}
113
+ checked={choice.value === preOrder.payment_choice?.value}
114
+ onChange={() => setPayOnDeliveryChoice(choice.value)}
115
+ />
116
+ <span>{choice.label}</span>
117
+ </label>
118
+ ))}
119
+ </div>
120
+ {formError && <p className="text-xs text-error mt-2">{formError}</p>}
121
+ <Button type="submit" className="w-full bg-black text-white">
122
+ Place Order
123
+ </Button>
124
+ </form>
125
+ )
126
+ }}
127
+ />
128
+ ```
129
+
130
+ ---