@riosst100/pwa-marketplace 2.8.7 → 2.8.8

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/i18n/en_US.json CHANGED
@@ -163,6 +163,14 @@
163
163
  "customerForm.defaultShipping": "Make this my default address",
164
164
  "customerForm.formMessage": "The shipping address you enter will be saved to your address book and set as your default for future purchases.",
165
165
  "customerForm.loading": "Fetching Customer Details...",
166
+ "deleteAccount.title": "Delete Account",
167
+ "deleteAccount.warning": "Warning: This action cannot be undone. All your data will be permanently deleted.",
168
+ "deleteAccount.agreementLabel": "I understand and agree to delete my account permanently.",
169
+ "deleteAccount.deleteButton": "Delete My Account",
170
+ "deleteAccount.confirm": "Are you sure you want to delete your account? This action is irreversible.",
171
+ "deleteAccount.confirmButton": "Yes, Delete My Account",
172
+ "deleteAccount.cancelButton": "Cancel",
173
+ "deleteAccount.success": "Your account has been deleted.",
166
174
  "discountSummary.lineItemLabel": "Applied discounts",
167
175
  "editModal.headerText": "Edit Item",
168
176
  "Email Signup": "Email Signup",
package/i18n/id_ID.json CHANGED
@@ -164,6 +164,14 @@
164
164
  "customerForm.defaultShipping": "Make this my default address",
165
165
  "customerForm.formMessage": "The shipping address you enter will be saved to your address book and set as your default for future purchases.",
166
166
  "customerForm.loading": "Fetching Customer Details...",
167
+ "deleteAccount.title": "Hapus Akun",
168
+ "deleteAccount.warning": "Peringatan: Tindakan ini tidak dapat dibatalkan. Semua data Anda akan dihapus secara permanen.",
169
+ "deleteAccount.agreementLabel": "Saya memahami dan setuju untuk menghapus akun saya secara permanen.",
170
+ "deleteAccount.deleteButton": "Hapus Akun Saya",
171
+ "deleteAccount.confirm": "Apakah Anda yakin ingin menghapus akun Anda? Tindakan ini tidak dapat dikembalikan.",
172
+ "deleteAccount.confirmButton": "Ya, Hapus Akun Saya",
173
+ "deleteAccount.cancelButton": "Batal",
174
+ "deleteAccount.success": "Akun Anda telah dihapus.",
167
175
  "discountSummary.lineItemLabel": "Applied discounts",
168
176
  "editModal.headerText": "Edit Item",
169
177
  "Email Signup": "Email Signup",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riosst100/pwa-marketplace",
3
3
  "author": "riosst100@gmail.com",
4
- "version": "2.8.7",
4
+ "version": "2.8.8",
5
5
  "main": "src/index.js",
6
6
  "pwa-studio": {
7
7
  "targets": {
@@ -0,0 +1,131 @@
1
+ import React, { useState } from 'react';
2
+ import { FormattedMessage } from 'react-intl';
3
+ import Button from '@magento/venia-ui/lib/components/Button';
4
+ import { Message } from '@magento/venia-ui/lib/components/Field';
5
+
6
+ // Dummy mutation placeholder
7
+ const useDeleteAccount = () => {
8
+ const [loading, setLoading] = useState(false);
9
+ const [error, setError] = useState(null);
10
+ const [success, setSuccess] = useState(false);
11
+
12
+ const deleteAccount = async () => {
13
+ setLoading(true);
14
+ setError(null);
15
+ setSuccess(false);
16
+ // Simulate API call
17
+ setTimeout(() => {
18
+ setLoading(false);
19
+ setSuccess(true);
20
+ }, 1500);
21
+ };
22
+
23
+ return {
24
+ loading,
25
+ error,
26
+ success,
27
+ deleteAccount
28
+ };
29
+ };
30
+
31
+ const DeleteAccount = () => {
32
+ const [confirm, setConfirm] = useState(false);
33
+ const [agreement, setAgreement] = useState(false);
34
+ const { loading, error, success, deleteAccount } = useDeleteAccount();
35
+ const handleChange = (event) => {
36
+ setAgreement(event.target.checked);
37
+ }
38
+ if (success) {
39
+ return (
40
+ <Message type="success">
41
+ <FormattedMessage
42
+ id="deleteAccount.success"
43
+ defaultMessage="Your account has been deleted."
44
+ />
45
+ </Message>
46
+ );
47
+ }
48
+
49
+ return (
50
+ <div style={{ marginTop: 32, border: '1px solid #f87171', padding: 24, borderRadius: 8, background: '#fef2f2' }}>
51
+ <div style={{ color: '#b91c1c', fontWeight: 600, marginBottom: 8 }}>
52
+ <FormattedMessage
53
+ id="deleteAccount.title"
54
+ defaultMessage="Delete Account"
55
+ />
56
+ </div>
57
+ <div style={{ color: '#b91c1c', marginBottom: 16 }}>
58
+ <FormattedMessage
59
+ id="deleteAccount.warning"
60
+ defaultMessage="Warning: This action cannot be undone. All your data will be permanently deleted."
61
+ />
62
+ </div>
63
+ {error && (
64
+ <Message type="error">
65
+ {error}
66
+ </Message>
67
+ )}
68
+ <div style={{ marginBottom: 16, display: 'flex', alignItems: 'center' }}>
69
+ <input
70
+ type="checkbox"
71
+ id="agreement"
72
+ checked={agreement}
73
+ onChange={handleChange}
74
+ style={{ marginRight: 8 }}
75
+ />
76
+ <label htmlFor="agreement" style={{ fontWeight: 'normal', fontSize: 14 }}>
77
+ <FormattedMessage
78
+ id="deleteAccount.agreementLabel"
79
+ defaultMessage="I understand and agree to delete my account permanently."
80
+ />
81
+ </label>
82
+ </div>
83
+ {confirm ? (
84
+ <div>
85
+ <div style={{ marginBottom: 16 }}>
86
+ <FormattedMessage
87
+ id="deleteAccount.confirm"
88
+ defaultMessage="Are you sure you want to delete your account? This action is irreversible."
89
+ />
90
+ </div>
91
+ <Button
92
+ priority="high"
93
+ disabled={loading || !agreement}
94
+ onClick={deleteAccount}
95
+ style={{ marginRight: 8, textTransform: 'none' }}
96
+ >
97
+ <FormattedMessage
98
+ id="deleteAccount.confirmButton"
99
+ defaultMessage="Yes, Delete My Account"
100
+ />
101
+ </Button>
102
+ <Button
103
+ priority="normal"
104
+ disabled={loading}
105
+ onClick={() => setConfirm(false)}
106
+ style={{ textTransform: 'none' }}
107
+ >
108
+ <FormattedMessage
109
+ id="deleteAccount.cancelButton"
110
+ defaultMessage="Cancel"
111
+ />
112
+ </Button>
113
+ </div>
114
+ ) : (
115
+ <Button
116
+ priority="high"
117
+ disabled={loading || !agreement}
118
+ onClick={() => setConfirm(true)}
119
+ style={{ textTransform: 'none' }}
120
+ >
121
+ <FormattedMessage
122
+ id="deleteAccount.deleteButton"
123
+ defaultMessage="Delete My Account"
124
+ />
125
+ </Button>
126
+ )}
127
+ </div>
128
+ );
129
+ };
130
+
131
+ export default DeleteAccount;
@@ -11,6 +11,8 @@ import { fullPageLoadingIndicator } from '@magento/venia-ui/lib/components/Loadi
11
11
  import defaultClasses from './accountInformationPage.module.css';
12
12
  import AccountInformationPageOperations from './accountInformationPage.gql.js';
13
13
 
14
+ import DeleteAccount from './DeleteAccount';
15
+
14
16
  const EditModal = React.lazy(() => import('./editModal'));
15
17
 
16
18
  const AccountInformationPage = props => {
@@ -116,6 +118,7 @@ const AccountInformationPage = props => {
116
118
  setShouldShowNewPassword={setShouldShowNewPassword}
117
119
  />
118
120
  </Suspense>
121
+ <DeleteAccount />
119
122
  </Fragment>
120
123
  );
121
124
  }