shoplazza-cli 0.0.1

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 (181) hide show
  1. package/.editorconfig +28 -0
  2. package/.prettierrc +9 -0
  3. package/LICENSE +21 -0
  4. package/README.md +208 -0
  5. package/bin/shoplazza +117 -0
  6. package/fixtures/assets/blog.scss +74 -0
  7. package/fixtures/assets/cart_modal.scss +450 -0
  8. package/fixtures/assets/collection_detail.js +234 -0
  9. package/fixtures/assets/collection_detail.scss +345 -0
  10. package/fixtures/assets/collection_list.scss +11 -0
  11. package/fixtures/assets/collection_slider.scss +169 -0
  12. package/fixtures/assets/feature_columns.scss +26 -0
  13. package/fixtures/assets/feature_product.scss +109 -0
  14. package/fixtures/assets/footer.js +58 -0
  15. package/fixtures/assets/footer.scss +337 -0
  16. package/fixtures/assets/four_images.scss +29 -0
  17. package/fixtures/assets/gallery.scss +55 -0
  18. package/fixtures/assets/header.js +178 -0
  19. package/fixtures/assets/header.scss +929 -0
  20. package/fixtures/assets/image_text.scss +72 -0
  21. package/fixtures/assets/logo_bar.scss +11 -0
  22. package/fixtures/assets/newsletter.scss +90 -0
  23. package/fixtures/assets/not_found.scss +39 -0
  24. package/fixtures/assets/page_detail.scss +16 -0
  25. package/fixtures/assets/pagination.scss +150 -0
  26. package/fixtures/assets/postcss.config.js +6 -0
  27. package/fixtures/assets/product_description.scss +88 -0
  28. package/fixtures/assets/product_detail.js +634 -0
  29. package/fixtures/assets/product_detail.scss +1106 -0
  30. package/fixtures/assets/relative_product.scss +45 -0
  31. package/fixtures/assets/reviews.scss +70 -0
  32. package/fixtures/assets/rich_text.scss +71 -0
  33. package/fixtures/assets/search.js +87 -0
  34. package/fixtures/assets/search.scss +67 -0
  35. package/fixtures/assets/slide.scss +51 -0
  36. package/fixtures/assets/slider.scss +141 -0
  37. package/fixtures/assets/theme.css +976 -0
  38. package/fixtures/assets/theme.scss +1100 -0
  39. package/fixtures/assets/three_images.scss +20 -0
  40. package/fixtures/assets/tools.scss +23 -0
  41. package/fixtures/assets/two_images.scss +24 -0
  42. package/fixtures/assets/video.scss +45 -0
  43. package/fixtures/assets/video_text.scss +63 -0
  44. package/fixtures/config/settings_data.json +107 -0
  45. package/fixtures/config/settings_schema.json +690 -0
  46. package/fixtures/layout/theme.liquid +76 -0
  47. package/fixtures/locales/ar-SA.json +212 -0
  48. package/fixtures/locales/de-DE.json +290 -0
  49. package/fixtures/locales/en-US.json +290 -0
  50. package/fixtures/locales/es-ES.json +290 -0
  51. package/fixtures/locales/fr-FR.json +290 -0
  52. package/fixtures/locales/id-ID.json +212 -0
  53. package/fixtures/locales/it-IT.json +212 -0
  54. package/fixtures/locales/ja-JP.json +289 -0
  55. package/fixtures/locales/ko-KR.json +290 -0
  56. package/fixtures/locales/nl-NL.json +290 -0
  57. package/fixtures/locales/pl-PL.json +290 -0
  58. package/fixtures/locales/pt-PT.json +212 -0
  59. package/fixtures/locales/ru-RU.json +212 -0
  60. package/fixtures/locales/th-TH.json +212 -0
  61. package/fixtures/locales/zh-CN.json +290 -0
  62. package/fixtures/locales/zh-TW.json +290 -0
  63. package/fixtures/sections/apps.liquid +47 -0
  64. package/fixtures/sections/blog.liquid +137 -0
  65. package/fixtures/sections/collection_desc.liquid +34 -0
  66. package/fixtures/sections/collection_detail.liquid +436 -0
  67. package/fixtures/sections/collection_image.liquid +104 -0
  68. package/fixtures/sections/collection_list.liquid +161 -0
  69. package/fixtures/sections/collection_name.liquid +34 -0
  70. package/fixtures/sections/collection_slider.liquid +330 -0
  71. package/fixtures/sections/feature_columns.liquid +275 -0
  72. package/fixtures/sections/feature_product.liquid +227 -0
  73. package/fixtures/sections/footer.liquid +488 -0
  74. package/fixtures/sections/four_images.liquid +160 -0
  75. package/fixtures/sections/gallery.liquid +258 -0
  76. package/fixtures/sections/header.liquid +1157 -0
  77. package/fixtures/sections/html.liquid +40 -0
  78. package/fixtures/sections/image_text.liquid +350 -0
  79. package/fixtures/sections/instagram_plus.liquid +393 -0
  80. package/fixtures/sections/logo_bar.liquid +183 -0
  81. package/fixtures/sections/newsletter.liquid +225 -0
  82. package/fixtures/sections/not_found.liquid +39 -0
  83. package/fixtures/sections/overlay_image.liquid +648 -0
  84. package/fixtures/sections/page_detail.liquid +39 -0
  85. package/fixtures/sections/photo_collection.liquid +433 -0
  86. package/fixtures/sections/product_description.liquid +208 -0
  87. package/fixtures/sections/product_detail.liquid +611 -0
  88. package/fixtures/sections/products.liquid +216 -0
  89. package/fixtures/sections/relative_product.liquid +121 -0
  90. package/fixtures/sections/reviews.liquid +115 -0
  91. package/fixtures/sections/rich_text.liquid +157 -0
  92. package/fixtures/sections/search.liquid +163 -0
  93. package/fixtures/sections/slide.liquid +719 -0
  94. package/fixtures/sections/three_images.liquid +157 -0
  95. package/fixtures/sections/two_images.liquid +125 -0
  96. package/fixtures/sections/video.liquid +95 -0
  97. package/fixtures/sections/video_text.liquid +128 -0
  98. package/fixtures/snippets/bgset.liquid +21 -0
  99. package/fixtures/snippets/card_title.liquid +8 -0
  100. package/fixtures/snippets/cart_modal.liquid +74 -0
  101. package/fixtures/snippets/collection.liquid +77 -0
  102. package/fixtures/snippets/collection_filter_modal.liquid +56 -0
  103. package/fixtures/snippets/default_image_4.liquid +14 -0
  104. package/fixtures/snippets/default_image_6.liquid +18 -0
  105. package/fixtures/snippets/default_image_8.liquid +23 -0
  106. package/fixtures/snippets/four_images_item.liquid +8 -0
  107. package/fixtures/snippets/header_ads.liquid +95 -0
  108. package/fixtures/snippets/hero_image.liquid +94 -0
  109. package/fixtures/snippets/icon_video_play_large.liquid +1 -0
  110. package/fixtures/snippets/icon_video_play_medium.liquid +4 -0
  111. package/fixtures/snippets/icon_video_play_small.liquid +4 -0
  112. package/fixtures/snippets/lazyimg.liquid +22 -0
  113. package/fixtures/snippets/lazyimg_art.liquid +36 -0
  114. package/fixtures/snippets/lazysizes.liquid +41 -0
  115. package/fixtures/snippets/link.liquid +2 -0
  116. package/fixtures/snippets/pagination.liquid +48 -0
  117. package/fixtures/snippets/product.liquid +126 -0
  118. package/fixtures/snippets/product_art_tpl.liquid +152 -0
  119. package/fixtures/snippets/product_info_body.liquid +337 -0
  120. package/fixtures/snippets/product_info_tpl.liquid +423 -0
  121. package/fixtures/snippets/product_label.liquid +46 -0
  122. package/fixtures/snippets/settings.liquid +295 -0
  123. package/fixtures/snippets/social-meta-tags.liquid +106 -0
  124. package/fixtures/snippets/video_html.liquid +11 -0
  125. package/fixtures/snippets/video_source.liquid +98 -0
  126. package/fixtures/snippets/video_thumb_icon.liquid +2 -0
  127. package/fixtures/templates/404.liquid +1 -0
  128. package/fixtures/templates/collection.liquid +92 -0
  129. package/fixtures/templates/index.liquid +206 -0
  130. package/fixtures/templates/page.liquid +1 -0
  131. package/fixtures/templates/product.liquid +99 -0
  132. package/fixtures/templates/search.liquid +1 -0
  133. package/jest.config.js +192 -0
  134. package/lib/__tests__/log.test.js +15 -0
  135. package/lib/__tests__/utils.test.js +69 -0
  136. package/lib/auth/__mocks__/getCode.js +7 -0
  137. package/lib/auth/__mocks__/index.js +0 -0
  138. package/lib/auth/child.js +23 -0
  139. package/lib/auth/getCode.js +35 -0
  140. package/lib/auth/index.js +91 -0
  141. package/lib/commands/__tests__/login.test.js +77 -0
  142. package/lib/commands/__tests__/logout.test.js +29 -0
  143. package/lib/commands/__tests__/store.test.js +44 -0
  144. package/lib/commands/__tests__/switch.test.js +45 -0
  145. package/lib/commands/login.js +99 -0
  146. package/lib/commands/logout.js +14 -0
  147. package/lib/commands/store.js +14 -0
  148. package/lib/commands/switch.js +52 -0
  149. package/lib/commands/theme/__tests__/delete.test.js +49 -0
  150. package/lib/commands/theme/__tests__/init.test.js +21 -0
  151. package/lib/commands/theme/__tests__/list.test.js +80 -0
  152. package/lib/commands/theme/__tests__/package.test.js +17 -0
  153. package/lib/commands/theme/__tests__/publish.test.js +61 -0
  154. package/lib/commands/theme/__tests__/pull.test.js +69 -0
  155. package/lib/commands/theme/__tests__/push.test.js +63 -0
  156. package/lib/commands/theme/__tests__/serve.test.js +107 -0
  157. package/lib/commands/theme/delete.js +64 -0
  158. package/lib/commands/theme/init.js +51 -0
  159. package/lib/commands/theme/list.js +28 -0
  160. package/lib/commands/theme/package.js +37 -0
  161. package/lib/commands/theme/publish.js +56 -0
  162. package/lib/commands/theme/pull.js +62 -0
  163. package/lib/commands/theme/push.js +106 -0
  164. package/lib/commands/theme/serve.js +153 -0
  165. package/lib/commands/theme/share.js +20 -0
  166. package/lib/commands/version.js +6 -0
  167. package/lib/config.js +5 -0
  168. package/lib/db/__mocks__/index.js +9 -0
  169. package/lib/db/__tests__/analytics.test.js +19 -0
  170. package/lib/db/__tests__/user.test.js +20 -0
  171. package/lib/db/analytics.js +48 -0
  172. package/lib/db/index.js +9 -0
  173. package/lib/db/user.js +68 -0
  174. package/lib/log.js +13 -0
  175. package/lib/openAPI/__mocks__/index.js +20 -0
  176. package/lib/openAPI/api.js +76 -0
  177. package/lib/openAPI/index.js +46 -0
  178. package/lib/report.js +37 -0
  179. package/lib/tracing.js +50 -0
  180. package/lib/utils.js +48 -0
  181. package/package.json +54 -0
@@ -0,0 +1,157 @@
1
+ {% use 'three_images.css' %}
2
+ <div class="container container-gap">
3
+ {% assign text= section.settings.text %}
4
+ <div class="row three-image__row">
5
+ {% assign defaultImg = 'oss/operation/0910a006fb3101bcf913804c47bf3b13.png' %}
6
+ {% for i in (1..3) %}
7
+ {% if i == 1 %}
8
+ {% assign imgSrc = 'image_src_1' %}
9
+ {% assign linkUrl = 'url_1' %}
10
+ {% elsif i == 2 %}
11
+ {% assign imgSrc = 'image_src_2' %}
12
+ {% assign linkUrl = 'url_2' %}
13
+ {% else %}
14
+ {% assign imgSrc = 'image_src_3' %}
15
+ {% assign linkUrl = 'url_3' %}
16
+ {% endif %}
17
+ {% assign imageUrl = section.settings[imgSrc] %}
18
+ {% assign linkToUrl = section.settings[linkUrl].url %}
19
+ {% assign link_type = section.settings[linkUrl].type %}
20
+ <div class="col-sm-12 col-md-4 three-image__image">
21
+ <a class="common__img-wrapper_lazy {% if linkToUrl %}common__mask{% endif %} {%if shop.env == 1 and imageUrl == "" %}common__img-desc{% endif %}" data-title="Image-{{i}}"
22
+ style="padding-bottom:{{ images[imageUrl].height | image_padding_bottom : images[imageUrl].width, origin: 'unlimit'}}; width:100%"
23
+ {% if linkToUrl%}
24
+ href="{{ linkToUrl }}"
25
+ {% endif %}
26
+ {% if link_type == 'web' %}
27
+ target="_blank"
28
+ {% endif %}>
29
+ {% assign src = imageUrl | default: defaultImg %}
30
+ {% include 'lazyimg',
31
+ src: src,
32
+ class: 'img-full-width'
33
+ %}
34
+ </a>
35
+ </div>
36
+ {% endfor %}
37
+ </div>
38
+ </div>
39
+
40
+
41
+
42
+ {% schema %}
43
+ {
44
+ "name": "three_images",
45
+ "settings": [
46
+ {
47
+ "type": "header",
48
+ "content": {
49
+ "en-US": "Image 1",
50
+ "zh-CN": "图1"
51
+ }
52
+ },
53
+ {
54
+ "type": "image_picker",
55
+ "id": "image_src_1",
56
+ "label": {
57
+ "en-US": "Image",
58
+ "zh-CN": "图片"
59
+ },
60
+ "info": {
61
+ "zh-CN": "建议尺寸:宽度1000px,高度可自适应",
62
+ "en-US": "Recommended resolution: width 1000px,responsive height"
63
+ },
64
+ "default": ""
65
+ },
66
+ {
67
+ "type": "url",
68
+ "id": "url_1",
69
+ "label": {
70
+ "en-US": "Link",
71
+ "zh-CN": "链接"
72
+ },
73
+ "is_image_link": true,
74
+ "default": ""
75
+ },
76
+ {
77
+ "type": "header",
78
+ "content": {
79
+ "en-US": "Image 2",
80
+ "zh-CN": "图2"
81
+ }
82
+ },
83
+ {
84
+ "type": "image_picker",
85
+ "id": "image_src_2",
86
+ "label": {
87
+ "en-US": "Image",
88
+ "zh-CN": "图片"
89
+ },
90
+ "info": {
91
+ "zh-CN": "建议尺寸:宽度1000px,高度可自适应",
92
+ "en-US": "Recommended resolution: width 1000px,responsive height"
93
+ },
94
+ "default": ""
95
+ },
96
+ {
97
+ "type": "url",
98
+ "id": "url_2",
99
+ "label": {
100
+ "en-US": "Link",
101
+ "zh-CN": "链接"
102
+ },
103
+ "is_image_link": true,
104
+ "default": ""
105
+ },
106
+ {
107
+ "type": "header",
108
+ "content": {
109
+ "en-US": "Image 3",
110
+ "zh-CN": "图3"
111
+ }
112
+ },
113
+ {
114
+ "type": "image_picker",
115
+ "id": "image_src_3",
116
+ "label": {
117
+ "en-US": "Image",
118
+ "zh-CN": "图片"
119
+ },
120
+ "info": {
121
+ "zh-CN": "建议尺寸:宽度1000px,高度可自适应",
122
+ "en-US": "Recommended resolution: width 1000px, responsive height"
123
+ },
124
+ "default": ""
125
+ },
126
+ {
127
+ "type": "url",
128
+ "id": "url_3",
129
+ "label": {
130
+ "en-US": "Link",
131
+ "zh-CN": "链接"
132
+ },
133
+ "is_image_link": true,
134
+ "default": ""
135
+ }
136
+ ],
137
+ "presets": [
138
+ {
139
+ "name": "three_images",
140
+ "cname": {
141
+ "zh-CN": "多图-3",
142
+ "en-US": "Images 3"
143
+ },
144
+ "category": {
145
+ "en-US": "Material",
146
+ "zh-CN": "素材"
147
+ },
148
+ "ccategory": {
149
+ "en-US": "Material",
150
+ "zh-CN": "素材"
151
+ },
152
+ "display": true,
153
+ "blocks": []
154
+ }
155
+ ]
156
+ }
157
+ {% endschema %}
@@ -0,0 +1,125 @@
1
+ {% use 'two_images.css' %}
2
+ <div class="container container-gap">
3
+ {% assign text= section.settings.text %}
4
+ <div class="row two-image__row">
5
+ {% assign defaultImg = 'oss/operation/0910a006fb3101bcf913804c47bf3b13.png' %}
6
+
7
+ {% for i in (1..2) %}
8
+ {% if i == 1 %}
9
+ {% assign imgSrc = 'image_src_1' %}
10
+ {% assign linkUrl = 'url_1' %}
11
+ {% else %}
12
+ {% assign imgSrc = 'image_src_2' %}
13
+ {% assign linkUrl = 'url_2' %}
14
+ {% endif %}
15
+ {% assign imageUrl = section.settings[imgSrc] %}
16
+ {% assign linkToUrl = section.settings[linkUrl].url %}
17
+ {% assign link_type = section.settings[linkUrl].type %}
18
+ <div class="col-sm-12 col-md-6 two-image__image">
19
+ <a class="common__img-wrapper_lazy {% if linkToUrl %}common__mask{% endif %} {%if shop.env == 1 and imageUrl == "" %}common__img-desc{% endif %}" data-title="Image-{{i}}"
20
+ style="padding-bottom:{{ images[imageUrl].height | image_padding_bottom : images[imageUrl].width, origin: 'unlimit'}}; width:100%"
21
+ {% if linkToUrl%}
22
+ href="{{linkToUrl}}"
23
+ {% endif %}
24
+ {% if link_type == 'web' %}
25
+ target="_blank"
26
+ {% endif %}>
27
+ {% assign src = imageUrl | default: defaultImg %}
28
+ {% include 'lazyimg',
29
+ src: src,
30
+ class: 'img-full-width'
31
+ %}
32
+ </a>
33
+ </div>
34
+ {% endfor %}
35
+ </div>
36
+ </div>
37
+
38
+
39
+
40
+ {% schema %}
41
+ {
42
+ "name": "two_images",
43
+ "settings": [
44
+ {
45
+ "type": "header",
46
+ "content": {
47
+ "en-US": "Image 1",
48
+ "zh-CN": "图1"
49
+ }
50
+ },
51
+ {
52
+ "type": "image_picker",
53
+ "id": "image_src_1",
54
+ "label": {
55
+ "en-US": "Image",
56
+ "zh-CN": "图片"
57
+ },
58
+ "info": {
59
+ "zh-CN": "建议尺寸:宽度1000px,高度可自适应",
60
+ "en-US": "Recommended resolution:width 1000px,responsive height"
61
+ },
62
+ "default": ""
63
+ },
64
+ {
65
+ "type": "url",
66
+ "id": "url_1",
67
+ "label": {
68
+ "en-US": "Link",
69
+ "zh-CN": "链接"
70
+ },
71
+ "is_image_link": true,
72
+ "default": ""
73
+ },
74
+ {
75
+ "type": "header",
76
+ "content": {
77
+ "en-US": "Image 2",
78
+ "zh-CN": "图2"
79
+ }
80
+ },
81
+ {
82
+ "type": "image_picker",
83
+ "id": "image_src_2",
84
+ "label": {
85
+ "en-US": "Image",
86
+ "zh-CN": "图片"
87
+ },
88
+ "info": {
89
+ "zh-CN": "建议尺寸:宽度1000px,高度可自适应",
90
+ "en-US": "Recommended resolution:width 1000px,responsive height"
91
+ },
92
+ "default": ""
93
+ },
94
+ {
95
+ "type": "url",
96
+ "id": "url_2",
97
+ "label": {
98
+ "en-US": "Link",
99
+ "zh-CN": "链接"
100
+ },
101
+ "is_image_link": true,
102
+ "default": ""
103
+ }
104
+ ],
105
+ "presets": [
106
+ {
107
+ "name": "two_images",
108
+ "cname": {
109
+ "zh-CN": "多图-2",
110
+ "en-US": "Images 2"
111
+ },
112
+ "category": {
113
+ "en-US": "Material",
114
+ "zh-CN": "素材"
115
+ },
116
+ "ccategory": {
117
+ "en-US": "Material",
118
+ "zh-CN": "素材"
119
+ },
120
+ "display": true,
121
+ "blocks": []
122
+ }
123
+ ]
124
+ }
125
+ {% endschema %}
@@ -0,0 +1,95 @@
1
+ {% use 'video.css' %}
2
+ {% assign defaultImage = 'oss/operation/ee147ae7fe87ec16f50a5f17e57e6aa9.jpg' | img_url %}
3
+ <div class="container video-{{section.id}} container-gap">
4
+ <div class="row">
5
+ <div class="video">
6
+ {% if section.settings.video_title %}
7
+ <h1 class="video__title dj_skin_title text-truncate">{{section.settings.video_title}}</h1>
8
+ {% endif %}
9
+ <div class="video__wrapper">
10
+ <img class="video__wrappe_default" src="{{defaultImage}}"/>
11
+ </div>
12
+ </div>
13
+ </div>
14
+ </div>
15
+
16
+ {% javascript %}
17
+ $(function () {
18
+ var videoId = $.getYoutubeId('{{section.settings.video.url}}');
19
+ videoId && $('.video-{{section.id}} .video__wrapper').html('<iframe title="" src="https://www.youtube.com/embed/' + videoId + '?rel=0&modestbranding=1&autoplay='+ 0 + '" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>');
20
+ })
21
+ {% endjavascript %}
22
+
23
+ {% schema %}
24
+ {
25
+ "name": "video",
26
+ "settings": [
27
+ {
28
+ "type": "header",
29
+ "content": {
30
+ "en-US": "Text",
31
+ "zh-CN": "文本"
32
+ }
33
+ },
34
+ {
35
+ "type": "text",
36
+ "id": "video_title",
37
+ "label": {
38
+ "en-US": "Heading",
39
+ "zh-CN": "标题"
40
+ },
41
+ "placeholder": {
42
+ "zh-CN": "视频标题",
43
+ "en-US": "Video title"
44
+ },
45
+ "default": "Video"
46
+ },
47
+ {
48
+ "type": "header",
49
+ "content": {
50
+ "en-US": "Video",
51
+ "zh-CN": "视频"
52
+ }
53
+ },
54
+ {
55
+ "type": "popover",
56
+ "label": {
57
+ "zh-CN": "请复制视频链接到下方,当前仅支持Youtube视频",
58
+ "en-US": "Copy the video link to the below (only support Youtube video now)"
59
+ }
60
+ },
61
+ {
62
+ "type": "video_url",
63
+ "id": "video",
64
+ "placeholder": {
65
+ "en-US": "Paste Youtube video link",
66
+ "zh-CN": "粘贴Youtube视频链接"
67
+ },
68
+ "label": {
69
+ "zh-CN": "视频链接",
70
+ "en-US": "Video link"
71
+ },
72
+ "default": ""
73
+ }
74
+ ],
75
+ "presets": [
76
+ {
77
+ "name": "video",
78
+ "cname": {
79
+ "en-US": "Video",
80
+ "zh-CN": "视频"
81
+ },
82
+ "category": {
83
+ "en-US": "Material",
84
+ "zh-CN": "素材"
85
+ },
86
+ "ccategory": {
87
+ "en-US": "Material",
88
+ "zh-CN": "素材"
89
+ },
90
+ "display": true,
91
+ "blocks": []
92
+ }
93
+ ]
94
+ }
95
+ {% endschema %}
@@ -0,0 +1,128 @@
1
+ {% use 'video_text.css' %}
2
+ {% assign defaultImage = 'oss/operation/ee147ae7fe87ec16f50a5f17e57e6aa9.jpg' | img_url %}
3
+ <div class="video-text container container-gap">
4
+ <div class="row">
5
+ <div class="col-12 col-md-6 video-text__text d-flex flex-column justify-content-center">
6
+ {% for block in section.blocks %}
7
+ {% if block.type == 'heading' and block.settings.heading %}
8
+ <h1 class="dj_skin_title_font video-text__text_title">{{block.settings.heading | escape}}</h1>
9
+ {% endif %}
10
+ {% if block.type == 'desc' and block.settings.desc %}
11
+ <div class="dj-mce-view dj_skin_text video-text__text_desc">{{block.settings.desc}}</div>
12
+ {% endif %}
13
+ {% endfor %}
14
+ </div>
15
+ <div class="col-12 col-md-6 video-text__video d-flex align-items-center">
16
+ <div class="video-text__video_wrapper">
17
+ <img class="video-text__video_wrapper-default" src="{{defaultImage}}"/>
18
+ </div>
19
+ </div>
20
+ </div>
21
+ </div>
22
+
23
+
24
+ {% javascript %}
25
+
26
+ $(function () {
27
+ var videoId = $.getYoutubeId('{{section.settings.video_url.url}}');
28
+ videoId && $('[data-section-id="{{section.id}}"] .video-text__video_wrapper').html('<iframe title="" class="video-text__video_wrapper-iframe" src="https://www.youtube.com/embed/' + videoId + '?rel=0&modestbranding=1&autoplay='+ 0 + '" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>');
29
+ })
30
+ {% endjavascript %}
31
+
32
+ {% schema %}
33
+ {
34
+ "name": "video_text",
35
+ "max_blocks": 2,
36
+ "settings": [
37
+ {
38
+ "type": "video_url",
39
+ "id": "video_url",
40
+ "placeholder": {
41
+ "en-US": "Paste Youtube video link",
42
+ "zh-CN": "粘贴Youtube视频链接"
43
+ },
44
+ "label": {
45
+ "zh-CN": "视频背景链接",
46
+ "en-US": "Video link"
47
+ },
48
+ "default": ""
49
+ }
50
+ ],
51
+ "blocks": [
52
+ {
53
+ "type": "heading",
54
+ "name": {
55
+ "zh-CN": "标题",
56
+ "en-US": "Heading"
57
+ },
58
+ "limit": 1,
59
+ "settings": [
60
+ {
61
+ "type": "text",
62
+ "id": "heading",
63
+ "label": {
64
+ "en-US": "Heading",
65
+ "zh-CN": "标题"
66
+ },
67
+ "default": "Video hero"
68
+ }
69
+ ]
70
+ },
71
+ {
72
+ "type": "desc",
73
+ "name": {
74
+ "zh-CN": "文字",
75
+ "en-US": "Text"
76
+ },
77
+ "limit": 1,
78
+ "settings": [
79
+ {
80
+ "type": "richtext",
81
+ "id": "desc",
82
+ "label": {
83
+ "en-US": "Text",
84
+ "zh-CN": "正文"
85
+ },
86
+ "placeholder": {
87
+ "zh-CN": "输入文本内容",
88
+ "en-US": "Input text"
89
+ },
90
+ "default": "<p><span>Use this text to share information about your brand with your customers. Describe a product,share announcements,or welcome customers to your store.</span></p>"
91
+ }
92
+ ]
93
+ }
94
+ ],
95
+ "presets": [
96
+ {
97
+ "name": "video_text",
98
+ "cname": {
99
+ "en-US": "Text video",
100
+ "zh-CN": "文本视频"
101
+ },
102
+ "category": {
103
+ "en-US": "Material",
104
+ "zh-CN": "素材"
105
+ },
106
+ "ccategory": {
107
+ "en-US": "Material",
108
+ "zh-CN": "素材"
109
+ },
110
+ "display": true,
111
+ "blocks": [
112
+ {
113
+ "type": "heading",
114
+ "settings": {
115
+ "heading": "Video hero"
116
+ }
117
+ },
118
+ {
119
+ "type": "desc",
120
+ "settings": {
121
+ "desc": "<p><span>Use this text to share information about your brand with your customers. Describe a product,share announcements,or welcome customers to your store.</span></p>"
122
+ }
123
+ }
124
+ ]
125
+ }
126
+ ]
127
+ }
128
+ {% endschema %}
@@ -0,0 +1,21 @@
1
+ {% if image != blank %}
2
+ {% comment %} 默认图是从管理平台上传,没有width信息,返回 {% endcomment %}
3
+ {% if image.width == 0 or image.width == nil %}
4
+ {{ image.src | img_url: '180x' }} 180w,
5
+ {{ image.src | img_url: '540x' }} 540w,
6
+ {{ image.src | img_url: '900x' }} 900w,
7
+ {{ image.src | img_url: '1296x' }} 1296w,
8
+ {{ image.src | img_url: '1728x' }} 1728w
9
+ {% else %}
10
+ {% if image.width <= 180 %}{{ image.src | img_url: '180x' }} 180w,{% endif %}
11
+ {% if image.width > 180 %}{{ image.src | img_url: '180x' }} 180w,{% endif %}
12
+ {% if image.width > 360 %}{{ image.src | img_url: '360x' }} 360w,{% endif %}
13
+ {% if image.width > 540 %}{{ image.src | img_url: '540x' }} 540w,{% endif %}
14
+ {% if image.width > 720 %}{{ image.src | img_url: '720x' }} 720w,{% endif %}
15
+ {% if image.width > 900 %}{{ image.src | img_url: '900x' }} 900w,{% endif %}
16
+ {% if image.width > 1080 %}{{ image.src | img_url: '1080x' }} 1080w,{% endif %}
17
+ {% if image.width > 1296 %}{{ image.src | img_url: '1296x' }} 1296w,{% endif %}
18
+ {% if image.width > 1512 %}{{ image.src | img_url: '1512x' }} 1512w,{% endif %}
19
+ {% if image.width > 1728 %}{{ image.src | img_url: '1728x' }} 1728w{% endif %}
20
+ {% endif %}
21
+ {% endif %}
@@ -0,0 +1,8 @@
1
+ {% comment %}
2
+ Description: 卡片标题
3
+ Author: Pang
4
+ Params: title-卡片标题
5
+ {% endcomment %}
6
+ <div class="row">
7
+ <div class="dj_skin_title common-card-title col-12" data-theme-editor-setting="{{titlePath}}">{{title}}</div>
8
+ </div>
@@ -0,0 +1,74 @@
1
+ {% use 'cart_modal.css' %}
2
+ <script id="atc-modal-wrapper" type="text/html">
3
+ <div class="modal fade right" id="atc-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
4
+ <div class="modal-dialog">
5
+ <div class="modal-content">
6
+ <div class="modal-body">
7
+ <div class="sep-font sep-font-close close modal__close" data-dismiss="modal" aria-label="Close"></div>
8
+ <div id='atc_container'>
9
+ </div>
10
+ <div style="display:flex;align-items:center;justify-content:center;height: 2.5rem;">
11
+ <a href="/cart" class="atc-btn__link">{{ 'i18n.product.product_detail.view_cart' | t }}</a>
12
+ </div>
13
+ </div>
14
+ </div>
15
+ </div>
16
+ </div>
17
+ </script>
18
+
19
+ {% javascript %}
20
+ $(function () {
21
+ if ($('#atc-modal').length) return;
22
+ $(document.body).on("dj.addToCart", function (e, options) {
23
+ if (window.SHOP_PARAMS.template_type == '13') { $.toast.show({ content: window.SHOP_PARAMS.product_lang.added_to_cart_successfully }) };
24
+ if (window.SHOP_PARAMS.template_type === '13') return;
25
+ if (options.source == "drawer" || options.process != 'to_toast') return;
26
+ if ($.cart) { $(document).trigger("dj.cart.refresh"); $('#atc-modal').modal('show'); return; }
27
+ $.ajax({
28
+ type: 'GET',
29
+ dataType: 'html',
30
+ url: '/cart?' + $.toQuery($.params()),
31
+ success: function (res) {
32
+ if ($('#atc-modal').length) return;
33
+ console.log('options', options)
34
+ var modalTemplate = template('atc-modal-wrapper', options);
35
+ $('body').prepend(modalTemplate);
36
+ var bodyHTML = res.match(/(<body\b[^>]*>)([^<]*(?:(?!<\/body>)<[^<]*)*)(<\/body>)/gi)[0];
37
+ var bodyClass = (res.match(/\<body.+class="([^"]+)/) || ["",""])[1];
38
+ $('#atc-modal .modal-content').addClass(bodyClass);
39
+ console.log('bodyHTML', bodyHTML)
40
+ var $body = $(bodyHTML);
41
+ $body.find('[data-section-type^=header],[data-section-type^=footer]').attr({ 'data-section-id': '' }).remove();
42
+ $("#atc_container").html($body);
43
+ var $modal = $('#atc-modal');
44
+ $('.modal-backdrop').css({ display: 'none' })
45
+ $modal.modal('show').on('shown.bs.modal', function () {
46
+ $.loading.hide();
47
+ $('#product-select-modal').modal('hide');
48
+ if ($(window).width() < 768) {
49
+ $(document.body).addClass('cart_fixed-screen');
50
+ }
51
+ $(document.body).one("click", '.modal-backdrop', function () {
52
+ $modal.modal('hide')
53
+ })
54
+ })
55
+ $modal.on('hide.bs.modal hidden.bs.modal', function () {
56
+ $(document.body).removeClass('cart_fixed-screen');
57
+ })
58
+ cartObj && cartObj.line_items && cartObj.line_items.forEach(function(item, index) {
59
+ if (Number(item.image.width) >= Number(item.image.height)) {
60
+ $('#cart').before('<style> #cart_form .cart__item:nth-of-type(' + (index + 1) + ') .cart__img {height:90px!important;} </style>')
61
+ } else {
62
+ if ((110 / 90) * item.image.width < item.image.height) {
63
+ $('#cart').before('<style> #cart_form .cart__item:nth-of-type(' + (index + 1) + ') .cart__img {height:110px!important;} </style>')
64
+ } else {
65
+ $('#cart').before('<style> #cart_form .cart__item:nth-of-type(' + (index + 1) + ') .cart__img {width:90px;height:' + ((90 * item.image.height) / item.image.width) + 'px!important;} </style>')
66
+ }
67
+ }
68
+ });
69
+ $(document).trigger("dj.cart.refresh")
70
+ }
71
+ });
72
+ })
73
+ })
74
+ {% endjavascript %}
@@ -0,0 +1,77 @@
1
+ {% assign title = collection.title %}
2
+ {% assign type = collection.type %}
3
+ {% assign image = collection.image %}
4
+ {% assign url = collection.url %}
5
+ {% assign imgSize = imgSize | '600x' %}
6
+
7
+ {% assign isMock = collection.isMock %}
8
+ {% assign imageHeightMd = heightMd | default: "100%" %}
9
+ {% assign imageHeight = height | default: "100%" %}
10
+ {% assign defaultImg = defaultImage | default: 'oss/operation/5fa90cbdc7fbff1eac9c585b3b5caa0e.png' %}
11
+ {% assign src = image.src | default: defaultImg %}
12
+
13
+ {% comment %} 小图情况处理 {% endcomment %}
14
+ {% assign rate = image.height | image_padding_bottom : image.width, origin: 'unlimit' | abs %}
15
+ {% assign rate_gt = 'width: 100%;height: auto;max-width: unset;max-height: unset; right: 0; top: 50%; left: 50%; bottom: unset; transform: translate(-50%, -50%);' %}
16
+ {% assign rate_lt = 'height: 100%;max-width: unset;max-height: unset; bottom: 0; left: 50%; top: 100%; right: unset; transform: translate(-50%, -50%);' %}
17
+
18
+ {% comment %} 由于无法获取默认图宽高比例,需要手动设置 {% endcomment %}
19
+ {% if src == defaultImg %}
20
+ {% assign rate = '100' %}
21
+ {% endif %}
22
+
23
+ {% comment %} PC端 {% endcomment %}
24
+ <div data-track="item"
25
+ data-track-type="{{type|escape}}" data-track-name="{{title|escape}}" class="product-snippet">
26
+ {% if isMock %}
27
+ {% assign src = defaultImg %}
28
+ {% endif %}
29
+ {% assign wrapper_rate = imageHeightMd | abs %}
30
+ {% assign img_size = rate_lt %}
31
+ {% if rate > wrapper_rate %}
32
+ {% assign img_size = rate_gt %}
33
+ {% endif %}
34
+ {% assign wrapper_rate_mobile = imageHeight | abs %}
35
+ {% assign img_size_mobile = rate_lt %}
36
+ {% if rate > wrapper_rate_mobile %}
37
+ {% assign img_size_mobile = rate_gt %}
38
+ {% endif %}
39
+ <style>
40
+ @media (min-width: 768px) {
41
+ [data-section-id="{{section.id}}"] a.product-snippet__img-wrapper {
42
+ padding-bottom: {{imageHeightMd}};
43
+ }
44
+ [data-section-id="{{section.id}}"] a.product-snippet__img-wrapper img[id="{{src}}"] {
45
+ {{img_size}}
46
+ }
47
+ }
48
+ @media (max-width: 768px) {
49
+ [data-section-id="{{section.id}}"] a.product-snippet__img-wrapper {
50
+ padding-bottom: {{imageHeight}};
51
+ }
52
+ [data-section-id="{{section.id}}"] a.product-snippet__img-wrapper img[id="{{src}}"] {
53
+ {{img_size_mobile}}
54
+ }
55
+ }
56
+ </style>
57
+
58
+ <a {% if isMock != true and url %}href="{{url}}"{% endif %}
59
+ class="product-snippet__img-wrapper common__img-wrapper_lazy common__mask_title two_line_text_truncate d-flex align-items-center justify-content-center dj_skin_title_font_family"
60
+ title="{{title}}"
61
+ style="width: 100%; {% if isMock %}background: #f7f7f7;{% endif %}">
62
+ <img
63
+ id="{{src}}"
64
+ src="{{shop.default_img}}"
65
+ class="lazyload {{class}} imglazy"
66
+ {% if lazysize %}
67
+ data-src="{{src | img_url: lazysize}}"
68
+ {% else %}
69
+
70
+ data-src="{{src | img_url: '{width}x'}}"
71
+ data-sizes="auto"
72
+ {% endif %}
73
+ alt="{{image.alt | default: title | escape}}"
74
+ {{other}}
75
+ >
76
+ </a>
77
+ </div>