@ozdao/prometheus-framework 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ozdao/prometheus-framework",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Web3 Framework focused on user experience and ease of development.",
5
5
  "author": "OZ DAO <hello@ozdao.dev>",
6
6
  "license": "GPL-3.0-or-later",
@@ -153,6 +153,7 @@
153
153
  "vue": "^3.2.25"
154
154
  },
155
155
  "devDependencies": {
156
+ "@babel/preset-flow": "^7.22.15",
156
157
  "@babel/runtime": "^7.21.5",
157
158
  "@rollup/plugin-babel": "^6.0.3",
158
159
  "@rollup/plugin-commonjs": "^25.0.4",
@@ -132,12 +132,12 @@ import { useI18n } from 'vue-i18n'
132
132
  import * as auth from '@pf/src/modules/auth/store/auth'
133
133
  // Import validation
134
134
  import * as inputsValidation from '@pf/src/modules/middlewares/client/inputs.validation'
135
-
135
+ // Init localization
136
136
  const { t } = useI18n({
137
137
  inheritLocale: true,
138
138
  useScope: 'local'
139
139
  })
140
-
140
+ // Init validation
141
141
  const phoneValidation = ref(null)
142
142
  const passswordValidation = ref(null)
143
143
  const emailValidation = ref(null)
@@ -146,46 +146,39 @@ const route = useRoute()
146
146
  const router = useRouter()
147
147
  // Accessing state
148
148
  const tabAuth = ref('phone')
149
- // Apple and Google Scripts
150
-
151
- const callOnSuccess = (data) => {
152
- // Ваш код обработки успешного входа
153
- console.log("Apple login success:", data);
154
- };
155
-
156
- const callOnFailure = (error) => {
157
- // Ваш код обработки неудачного входа
158
- console.log("Apple login failure:", error);
159
- };
160
-
149
+ // OUATH ENV
161
150
  const clientId = inject('APPLE_CLIENTID')
162
151
  const redirectURI = inject('APPLE_REDIRECT_URL')
163
152
 
164
- const initAppleSignIn = () => {
165
- if (!window.AppleID) {
166
- console.error('"https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js" needs to be included as a <script>');
167
- return;
168
- }
153
+ const appleSignIn = async () => {
169
154
 
170
- window.AppleID.auth.init({
171
- clientId: clientId,
172
- scope: 'name email',
173
- redirectURI: redirectURI,
174
- state: 'lilylsunisabigsb',
175
- usePopup: true,
176
- })
177
- document.addEventListener('AppleIDSignInOnSuccess', callOnSuccess);
178
- document.addEventListener('AppleIDSignInOnFailure', callOnFailure);
179
- };
180
-
181
-
182
-
183
- const appleSignIn = () => {
184
- try {
185
- window.AppleID.auth.signIn();
186
- } catch (error) {
187
- console.error("Error signing in with Apple:", error);
188
- }
155
+ window.AppleID.auth.init({
156
+ clientId: clientId,
157
+ scope: 'email name',
158
+ redirectURI: redirectURI,
159
+ usePopup: true,
160
+ });
161
+ /** Signin to appleID */
162
+ return window.AppleID.auth
163
+ .signIn()
164
+ .then((response) => {
165
+ /** This is only called in case usePopup is true */
166
+ if (onSuccess) {
167
+ onSuccess(response);
168
+ }
169
+ /** resolve with the reponse */
170
+ return response;
171
+ })
172
+ .catch((err) => {
173
+ if (onError) {
174
+ /** Call onError catching the error */
175
+ onError(err);
176
+ } else {
177
+ /** Log the error to help debug */
178
+ console.error(err);
179
+ }
180
+ return null;
181
+ });
189
182
  };
190
183
 
191
184
  const loadExternalScript = (src) => {
@@ -200,12 +193,7 @@ const loadExternalScript = (src) => {
200
193
  }
201
194
 
202
195
  onMounted(async () => {
203
- try {
204
- await loadExternalScript('https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js');
205
- initAppleSignIn();
206
- } catch (error) {
207
- console.error('Error loading AppleID script:', error);
208
- }
196
+ await loadExternalScript('https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js');
209
197
  });
210
198
  // Methods
211
199
  async function onSubmit() {