zz-shopify-components 0.6.0 → 0.8.0

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.
@@ -100,17 +100,6 @@
100
100
  "default": "#000000",
101
101
  "label": "标题颜色"
102
102
  },
103
- {
104
- "type": "richtext",
105
- "id": "slide_content",
106
- "label": "内容"
107
- },
108
- {
109
- "type": "color",
110
- "id": "slide_content_color",
111
- "default": "#170B01",
112
- "label": "内容颜色"
113
- },
114
103
  {
115
104
  "type": "text",
116
105
  "id": "btn_text",
@@ -320,7 +320,13 @@
320
320
  isValid = false;
321
321
  } else {
322
322
  fileInput.classList.remove('error');
323
+ if(!identityDocumentUrl) {
324
+ // 文件还在上传中,请等待文件上传成功
325
+ zzShowToast('File is still uploading, please wait for the file to be uploaded successfully')
326
+ return
327
+ }
323
328
  }
329
+
324
330
  }
325
331
 
326
332
 
@@ -456,7 +462,8 @@
456
462
  // 显示文件预览
457
463
  showFilePreview(file);
458
464
  const fileName = await getFileMD5Name(file);
459
- console.log('fileName', fileName)
465
+ const fileUploadLoading = block.querySelector('.zz-edu-form-file-upload-loading')
466
+ fileUploadLoading.classList.remove('tw-hidden')
460
467
 
461
468
  httpRequest
462
469
  .get(
@@ -477,26 +484,31 @@
477
484
  stsToken: data.SecurityToken,
478
485
  });
479
486
  const result = await client.put(fileName || file.name, file);
480
- console.log('result---------', result)
487
+ console.log('upload result---------', result)
481
488
  if(result.url) {
482
489
  identityDocumentUrl = result.url
490
+ fileUploadLoading.classList.add('tw-hidden')
483
491
  } else {
484
492
  removeEduVerifyFile()
493
+ fileUploadLoading.classList.add('tw-hidden')
485
494
  zzShowToast('File upload failed, please try again.')
486
495
  }
487
496
 
488
497
  } catch (error) {
489
498
  removeEduVerifyFile()
499
+ fileUploadLoading.classList.add('tw-hidden')
490
500
  zzShowToast('File upload failed, please try again.')
491
501
  }
492
502
 
493
503
  } else {
494
504
  removeEduVerifyFile()
505
+ fileUploadLoading.classList.add('tw-hidden')
495
506
  zzShowToast('File upload failed, please try again.')
496
507
  }
497
508
 
498
509
  }).catch((err) => {
499
510
  zzShowToast(EduErrorCodeConf[500].en)
511
+ fileUploadLoading.classList.add('tw-hidden')
500
512
  removeEduVerifyFile()
501
513
  });
502
514
  }
@@ -534,6 +546,7 @@
534
546
  <span class="zz-edu-form-file-name">${fileName}</span>
535
547
  <span class="zz-edu-form-file-size">${fileSize} MB</span>
536
548
  </div>
549
+ <span class='zz-edu-form-file-upload-loading tw-hidden tw-daisy-loading tw-daisy-loading-spinner ' ></span>
537
550
  <div class="zz-edu-form-file-remove-btn" onclick="removeEduVerifyFile{{ block.id }}()">
538
551
  <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
539
552
  <circle cx="12" cy="12" r="12" fill="#DD3B46"/>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zz-shopify-components",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "Reusable Shopify components for theme projects",
5
5
  "keywords": [
6
6
  "shopify",
@@ -0,0 +1,35 @@
1
+ {% comment %} Products {% endcomment %}
2
+ {% assign is_edu_product = false %}
3
+ {% if product.tags contains 'edu-product' %}
4
+ {% assign is_edu_product = true %}
5
+ {% endif %}
6
+
7
+ {% assign is_logged_in = false %}
8
+ {% assign is_edu_verified = false %}
9
+ {% if customer %}
10
+ {% assign is_logged_in = true %}
11
+ {% if customer.tags contains 'edu-verified' %}
12
+ {% assign is_edu_verified = true %}
13
+ {% endif %}
14
+ {% endif %}
15
+
16
+ <button class='tw-flex tw-items-center tw-justify-center tw-text-white tw-border-none tw-h-full tw-px-6 tw-py-4 tw-bg-[#FC6C0F] tw-rounded-full tw-font-semibold tw-text-[16px] {{ button_class }}'>
17
+ <span
18
+ class='buy-loading tw-hidden tw-daisy-loading tw-daisy-loading-spinner '
19
+ ></span>
20
+ <span class='buy-bottom-bar-btn-text'>
21
+ {% if is_edu_product %}
22
+ {% if is_logged_in %}
23
+ {% if is_edu_verified %}
24
+ {{ btn }}
25
+ {% else %}
26
+ {{ bar_btn_edu_not_verified }}
27
+ {% endif %}
28
+ {% else %}
29
+ {{ bar_btn_edu_not_logged_in }}
30
+ {% endif %}
31
+ {% else %}
32
+ {{ btn }}
33
+ {% endif %}
34
+ </span>
35
+ </button>