disco_app 0.9.10 → 0.9.11
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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/disco_app/components/custom/rules-editor.es6.jsx +15 -0
- data/app/assets/javascripts/disco_app/components/ui-kit/forms/button.es6.jsx +4 -3
- data/app/assets/javascripts/disco_app/components/ui-kit/forms/input-checkbox.es6.jsx +30 -0
- data/app/assets/javascripts/disco_app/components/ui-kit/forms/input-text.es6.jsx +1 -1
- data/app/controllers/disco_app/webhooks_controller.rb +3 -3
- data/app/jobs/disco_app/concerns/app_uninstalled_job.rb +1 -1
- data/app/models/disco_app/concerns/can_be_liquified.rb +8 -5
- data/lib/disco_app/version.rb +1 -1
- data/lib/generators/disco_app/disco_app_generator.rb +5 -1
- data/test/fixtures/liquid/model.liquid +5 -4
- data/test/models/disco_app/can_be_liquified_test.rb +2 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0c6b01c549910c77034c7919306f6e56fa865539febeceabb830dafb962df79
|
4
|
+
data.tar.gz: b7d9a8d7fcd1c30edaa545ff5c90bf1fe52f7e9d9707d6ec627ac0865216bb3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ead80f00f63df3bda1d53c3e5a64c4677f6fe638b7b346435d19d649e81bb3d87bf9a4a7adc16216993bbf3705c2b2e2308698747e1cf34afcb54b4846f4f16a
|
7
|
+
data.tar.gz: 3b9cc45b96bf4a34a48a8b11369f70bbaf0b216c95c1447b951388c5ef68ee46d52f1bd5e23cd9a5a2579853790b02a074e2d5312f070960214de1441a1fcd99
|
@@ -270,16 +270,31 @@ RulesEditor.EQUALS_STRING = {
|
|
270
270
|
relation: 'is_equal_to',
|
271
271
|
type: 'text'
|
272
272
|
};
|
273
|
+
RulesEditor.NOT_EQUALS_STRING = {
|
274
|
+
label: 'is not equal to',
|
275
|
+
relation: 'is_not_equal_to',
|
276
|
+
type: 'text'
|
277
|
+
};
|
273
278
|
RulesEditor.EQUALS_COUNTRY_CODE = {
|
274
279
|
label: 'is equal to',
|
275
280
|
relation: 'is_equal_to',
|
276
281
|
type: 'country_code'
|
277
282
|
};
|
283
|
+
RulesEditor.NOT_EQUALS_COUNTRY_CODE = {
|
284
|
+
label: 'is not equal to',
|
285
|
+
relation: 'is_not_equal_to',
|
286
|
+
type: 'country_code'
|
287
|
+
};
|
278
288
|
RulesEditor.CONTAINS_STRING = {
|
279
289
|
label: 'contains',
|
280
290
|
relation: 'contains_string',
|
281
291
|
type: 'text'
|
282
292
|
};
|
293
|
+
RulesEditor.DOES_NOT_CONTAIN_STRING = {
|
294
|
+
label: 'does not contain',
|
295
|
+
relation: 'does_not_contain_string',
|
296
|
+
type: 'text'
|
297
|
+
};
|
283
298
|
RulesEditor.EQUALS_TAG = {
|
284
299
|
label: 'is equal to',
|
285
300
|
relation: 'find_in_set',
|
@@ -1,11 +1,12 @@
|
|
1
|
-
const Button = ({ children, disabled, onClick }) => {
|
1
|
+
const Button = ({ children, disabled, name=false, onClick = ()=>{}, primary = false, type = 'button' }) => {
|
2
2
|
|
3
3
|
const className = classNames({
|
4
|
-
'btn': true
|
4
|
+
'btn': true,
|
5
|
+
'btn-primary': primary
|
5
6
|
});
|
6
7
|
|
7
8
|
return(
|
8
|
-
<button type=
|
9
|
+
<button type={type} name={name} disabled={disabled} className={className} onClick={onClick}>
|
9
10
|
{children}
|
10
11
|
</button>
|
11
12
|
)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
const InputCheckbox = ({ label, name, value, checked, inline, isLast, onChange }) => {
|
2
|
+
|
3
|
+
const id = `${name}[${value}]`;
|
4
|
+
|
5
|
+
const wrapperClassName = classNames({
|
6
|
+
'next-input-wrapper': true,
|
7
|
+
'inline': inline,
|
8
|
+
'sr': !isLast
|
9
|
+
});
|
10
|
+
|
11
|
+
const labelClassName = classNames({
|
12
|
+
'next-label': true,
|
13
|
+
'next-label--switch': true,
|
14
|
+
'inline': inline,
|
15
|
+
'fw-normal': inline
|
16
|
+
});
|
17
|
+
|
18
|
+
const handleChange = (e) => {
|
19
|
+
onChange && onChange(e.target.value);
|
20
|
+
};
|
21
|
+
|
22
|
+
return(
|
23
|
+
<div className={wrapperClassName}>
|
24
|
+
<label htmlFor={id} className={labelClassName}>{label}</label>
|
25
|
+
<input id={id} className="next-checkbox" type="checkbox" value={value} name={name} checked={checked} onChange={handleChange} />
|
26
|
+
<span className="next-checkbox--styled" />
|
27
|
+
</div>
|
28
|
+
)
|
29
|
+
|
30
|
+
};
|
@@ -6,10 +6,10 @@ module DiscoApp
|
|
6
6
|
def process_webhook
|
7
7
|
# Get the topic and domain for this webhook.
|
8
8
|
topic = request.headers['HTTP_X_SHOPIFY_TOPIC']
|
9
|
-
|
9
|
+
shopify_domain = request.headers['HTTP_X_SHOPIFY_SHOP_DOMAIN']
|
10
10
|
|
11
11
|
# Ensure a domain was provided in the headers.
|
12
|
-
unless
|
12
|
+
unless shopify_domain
|
13
13
|
head :bad_request
|
14
14
|
end
|
15
15
|
|
@@ -23,7 +23,7 @@ module DiscoApp
|
|
23
23
|
|
24
24
|
# Decode the body data and enqueue the appropriate job.
|
25
25
|
data = ActiveSupport::JSON::decode(request.body.read).with_indifferent_access
|
26
|
-
job_class.perform_later(
|
26
|
+
job_class.perform_later(shopify_domain, data)
|
27
27
|
|
28
28
|
render nothing: true
|
29
29
|
end
|
@@ -12,7 +12,7 @@ module DiscoApp::Concerns::AppUninstalledJob
|
|
12
12
|
# - Mark any recurring application charges as cancelled.
|
13
13
|
# - Remove any stored sessions for the shop.
|
14
14
|
#
|
15
|
-
def perform(
|
15
|
+
def perform(shop, shop_data)
|
16
16
|
DiscoApp::ChargesService.cancel_recurring_charges(@shop)
|
17
17
|
@shop.sessions.delete_all
|
18
18
|
end
|
@@ -7,7 +7,7 @@ module DiscoApp::Concerns::CanBeLiquified
|
|
7
7
|
|
8
8
|
# Return this model as an array of Liquid {% assign %} statements.
|
9
9
|
def as_liquid
|
10
|
-
as_json.map { |k, v| "{% assign #{liquid_model_name}_#{k} = #{as_liquid_value(v)} %}" }
|
10
|
+
as_json.map { |k, v| "{% assign #{liquid_model_name}_#{k} = #{as_liquid_value(k, v)} %}" }
|
11
11
|
end
|
12
12
|
|
13
13
|
# Render this model as a series of concatenated Liquid {% assign %} statements.
|
@@ -24,17 +24,20 @@ module DiscoApp::Concerns::CanBeLiquified
|
|
24
24
|
private
|
25
25
|
|
26
26
|
# Return given value as a string expression that will be evaluated in Liquid to result in the correct value type.
|
27
|
-
def as_liquid_value(value)
|
27
|
+
def as_liquid_value(key, value)
|
28
28
|
if value.is_a? Numeric or (!!value == value)
|
29
29
|
return value.to_s
|
30
30
|
end
|
31
31
|
if value.nil?
|
32
|
-
return
|
32
|
+
return 'nil'
|
33
33
|
end
|
34
34
|
if value.is_a? Array
|
35
|
-
return "
|
35
|
+
return "'#{value.map { |e| (e.is_a? String) ? CGI::escapeHTML(e) : e }.join(SPLIT_ARRAY_SEPARATOR)}' | split: '#{SPLIT_ARRAY_SEPARATOR}'"
|
36
36
|
end
|
37
|
-
|
37
|
+
if value.is_a? String and key.end_with? '_html'
|
38
|
+
return "'#{value.to_s.gsub("'", "'")}'"
|
39
|
+
end
|
40
|
+
"'#{CGI::escapeHTML(value.to_s)}'"
|
38
41
|
end
|
39
42
|
|
40
43
|
end
|
data/lib/disco_app/version.rb
CHANGED
@@ -30,7 +30,7 @@ class DiscoAppGenerator < Rails::Generators::Base
|
|
30
30
|
gem 'shopify_app', '~> 6.4.1'
|
31
31
|
gem 'sidekiq', '~> 4.0.2'
|
32
32
|
gem 'puma', '~> 2.14.0'
|
33
|
-
gem 'activerecord-session_store', '~> 0.
|
33
|
+
gem 'activerecord-session_store', '~> 1.0.0'
|
34
34
|
gem 'activeresource', github: 'shopify/activeresource', tag: '4.2-threadsafe'
|
35
35
|
gem 'rails-bigint-pk', '~> 1.2.0'
|
36
36
|
gem 'acts_as_singleton', '~> 0.0.8'
|
@@ -80,6 +80,10 @@ class DiscoAppGenerator < Rails::Generators::Base
|
|
80
80
|
# Uncomment to ensure config.force_ssl = true in production.
|
81
81
|
uncomment_lines 'config/environments/production.rb', /force_ssl/
|
82
82
|
|
83
|
+
# Set time zone to UTC
|
84
|
+
application "config.time_zone = 'UTC'"
|
85
|
+
application "# Ensure UTC is the default timezone"
|
86
|
+
|
83
87
|
# Set server side rendereing for components.js
|
84
88
|
application "config.react.server_renderer_options = {\nfiles: ['components.js'], # files to load for prerendering\n}"
|
85
89
|
application "# Enable server side react rendering"
|
@@ -1,7 +1,8 @@
|
|
1
1
|
{% assign model_numeric = 42 %}
|
2
2
|
{% assign model_boolean = true %}
|
3
3
|
{% assign model_empty = nil %}
|
4
|
-
{% assign model_string =
|
5
|
-
{% assign
|
6
|
-
{% assign
|
7
|
-
{% assign
|
4
|
+
{% assign model_string = 'The cat's pyjamas are "great".' %}
|
5
|
+
{% assign model_string_html = 'The cat's pyjamas are <strong style="color: red;">great</strong>.' %}
|
6
|
+
{% assign model_array_of_numerics = '1@!@2@!@3' | split: '@!@' %}
|
7
|
+
{% assign model_array_of_strings = 'A@!@B@!@C' | split: '@!@' %}
|
8
|
+
{% assign model_hash = '{}' %}
|
@@ -25,6 +25,7 @@ class DiscoApp::CanBeLiquifiedTest < ActiveSupport::TestCase
|
|
25
25
|
boolean: true,
|
26
26
|
empty: nil,
|
27
27
|
string: "The cat's pyjamas are \"great\".",
|
28
|
+
string_html: "The cat's pyjamas are <strong style=\"color: red;\">great</strong>.",
|
28
29
|
array_of_numerics: [1, 2, 3],
|
29
30
|
array_of_strings: ['A', 'B', 'C'],
|
30
31
|
hash: {}
|
@@ -48,7 +49,7 @@ class DiscoApp::CanBeLiquifiedTest < ActiveSupport::TestCase
|
|
48
49
|
# Return an asset fixture as a string.
|
49
50
|
def liquid_fixture(path)
|
50
51
|
filename = File.join(File.dirname(File.dirname(File.dirname(__FILE__))), 'fixtures', 'liquid', "#{path}")
|
51
|
-
File.read(filename)
|
52
|
+
File.read(filename).strip
|
52
53
|
end
|
53
54
|
|
54
55
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: disco_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Ballard
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0.
|
145
|
+
version: 1.0.0
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0.
|
152
|
+
version: 1.0.0
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: omniauth-shopify-oauth2
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -360,6 +360,7 @@ files:
|
|
360
360
|
- app/assets/javascripts/disco_app/components/ui-kit/forms/base_form.es6.jsx
|
361
361
|
- app/assets/javascripts/disco_app/components/ui-kit/forms/base_input.es6.jsx
|
362
362
|
- app/assets/javascripts/disco_app/components/ui-kit/forms/button.es6.jsx
|
363
|
+
- app/assets/javascripts/disco_app/components/ui-kit/forms/input-checkbox.es6.jsx
|
363
364
|
- app/assets/javascripts/disco_app/components/ui-kit/forms/input-radio.es6.jsx
|
364
365
|
- app/assets/javascripts/disco_app/components/ui-kit/forms/input-select.es6.jsx
|
365
366
|
- app/assets/javascripts/disco_app/components/ui-kit/forms/input-text.es6.jsx
|