workarea-flow_io 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.eslintignore +2 -0
- data/.eslintrc.json +37 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
- data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.github/workflows/ci.yml +90 -0
- data/.gitignore +21 -0
- data/.rubocop.yml +2 -0
- data/.ruby-version +1 -0
- data/.stylelintrc.json +12 -0
- data/CHANGELOG.md +200 -0
- data/Gemfile +19 -0
- data/LICENSE +52 -0
- data/README.md +200 -0
- data/Rakefile +59 -0
- data/app/assets/javascripts/workarea/storefront/flow_io/adapters/flow_io_adapter.js +61 -0
- data/app/assets/javascripts/workarea/storefront/flow_io/configuration.js.erb +10 -0
- data/app/assets/javascripts/workarea/storefront/flow_io/flow.js +91 -0
- data/app/assets/stylesheets/flow_io/storefront/country_picker.scss +189 -0
- data/app/controllers/workarea/admin/application_controller.decorator +5 -0
- data/app/controllers/workarea/admin/catalog_categories_controller.decorator +9 -0
- data/app/controllers/workarea/admin/flow_imports_controller.rb +9 -0
- data/app/controllers/workarea/admin/orders_controller.decorator +6 -0
- data/app/controllers/workarea/admin/pricing_skus_controller.decorator +7 -0
- data/app/controllers/workarea/admin/search_settings_controller.decorator +27 -0
- data/app/controllers/workarea/storefront/application_controller.decorator +80 -0
- data/app/controllers/workarea/storefront/checkouts_controller.decorator +38 -0
- data/app/controllers/workarea/storefront/flow_io_webhook_controller.rb +49 -0
- data/app/controllers/workarea/storefront/recent_views_controller.decorator +15 -0
- data/app/controllers/workarea/storefront/searches_controller.decorator +11 -0
- data/app/helpers/workarea/admin/flow_helper.rb +13 -0
- data/app/helpers/workarea/storefront/flow_analytics_helper.rb +23 -0
- data/app/helpers/workarea/storefront/flow_content_helper.rb +21 -0
- data/app/middleware/workarea/flow_io/session_middleware.rb +68 -0
- data/app/models/workarea/address.decorator +12 -0
- data/app/models/workarea/catalog/category.decorator +8 -0
- data/app/models/workarea/checkout.decorator +26 -0
- data/app/models/workarea/flow_io/experience_geo.rb +18 -0
- data/app/models/workarea/flow_io/experience_summary.rb +15 -0
- data/app/models/workarea/flow_io/import.rb +31 -0
- data/app/models/workarea/flow_io/imported_item.rb +124 -0
- data/app/models/workarea/flow_io/local_item.rb +28 -0
- data/app/models/workarea/flow_io/localized_price.rb +30 -0
- data/app/models/workarea/flow_io/price.rb +12 -0
- data/app/models/workarea/flow_io/price_with_base.rb +7 -0
- data/app/models/workarea/flow_io/webhook/shared_secret.rb +12 -0
- data/app/models/workarea/flow_price_adjustment_set.rb +80 -0
- data/app/models/workarea/fulfillment.decorator +63 -0
- data/app/models/workarea/order.decorator +39 -0
- data/app/models/workarea/order/item.decorator +43 -0
- data/app/models/workarea/payment.decorator +11 -0
- data/app/models/workarea/payment/authorize/flow_payment.rb +48 -0
- data/app/models/workarea/payment/capture/flow_payment.rb +35 -0
- data/app/models/workarea/payment/flow_payment_data.rb +25 -0
- data/app/models/workarea/payment/flow_payment_operation.rb +20 -0
- data/app/models/workarea/payment/purchase/flow_payment.rb +44 -0
- data/app/models/workarea/payment/refund/flow_payment.rb +42 -0
- data/app/models/workarea/payment/store_flow_credit_card.rb +34 -0
- data/app/models/workarea/payment/tender.decorator +8 -0
- data/app/models/workarea/payment/tender/flow_payment.rb +15 -0
- data/app/models/workarea/payment/transaction.decorator +12 -0
- data/app/models/workarea/pricing/calculators/flow_localization_calculator.rb +30 -0
- data/app/models/workarea/pricing/calculators/item_calculator.decorator +39 -0
- data/app/models/workarea/pricing/collection.decorator +113 -0
- data/app/models/workarea/pricing/order_totals.decorator +53 -0
- data/app/models/workarea/pricing/price.decorator +17 -0
- data/app/models/workarea/pricing/price_distributor.decorator +51 -0
- data/app/models/workarea/pricing/request.decorator +17 -0
- data/app/models/workarea/pricing/shipping_totals.decorator +24 -0
- data/app/models/workarea/pricing/sku.decorator +46 -0
- data/app/models/workarea/search/settings.decorator +8 -0
- data/app/models/workarea/search/storefront/product.decorator +25 -0
- data/app/models/workarea/shipping.decorator +28 -0
- data/app/queries/workarea/order_metrics.decorator +23 -0
- data/app/queries/workarea/search/product_search.decorator +14 -0
- data/app/queries/workarea/search/storefront_search/response.decorator +40 -0
- data/app/services/workarea/flow_io/checkout.rb +242 -0
- data/app/services/workarea/flow_io/checkout_token_form.rb +36 -0
- data/app/services/workarea/flow_io/countries.rb +14 -0
- data/app/services/workarea/flow_io/detailed_shipping_notification_form.rb +84 -0
- data/app/services/workarea/flow_io/experiences.rb +24 -0
- data/app/services/workarea/flow_io/fulfillment_cancellation_form.rb +40 -0
- data/app/services/workarea/flow_io/item.rb +122 -0
- data/app/services/workarea/flow_io/item_importer.rb +108 -0
- data/app/services/workarea/flow_io/line_item_form.rb +72 -0
- data/app/services/workarea/flow_io/order_put_form.rb +62 -0
- data/app/services/workarea/flow_io/price_applier.rb +81 -0
- data/app/services/workarea/flow_io/price_applier/item_applier.rb +157 -0
- data/app/services/workarea/flow_io/routing_contraints.rb +10 -0
- data/app/services/workarea/flow_io/session.rb +90 -0
- data/app/services/workarea/flow_io/webhook.rb +28 -0
- data/app/services/workarea/flow_io/webhook/experience_deleted_v2.rb +9 -0
- data/app/services/workarea/flow_io/webhook/experience_upserted_v2.rb +9 -0
- data/app/services/workarea/flow_io/webhook/order_upserted_v2.rb +36 -0
- data/app/services/workarea/flow_io/webhook_request_signature.rb +19 -0
- data/app/view_models/workarea/admin/flow_imports_view_model.rb +36 -0
- data/app/view_models/workarea/storefront/cart_view_model.decorator +27 -0
- data/app/view_models/workarea/storefront/content_blocks/category_summary_view_model.decorator +11 -0
- data/app/view_models/workarea/storefront/content_blocks/product_insights_view_model.decorator +11 -0
- data/app/view_models/workarea/storefront/content_blocks/product_list_view_model.decorator +13 -0
- data/app/view_models/workarea/storefront/order_item_view_model.decorator +35 -0
- data/app/view_models/workarea/storefront/order_view_model.decorator +51 -0
- data/app/view_models/workarea/storefront/product_templates/option_set_view_model.decorator +20 -0
- data/app/view_models/workarea/storefront/product_templates/package_view_model.decorator +14 -0
- data/app/view_models/workarea/storefront/product_view_model.decorator +15 -0
- data/app/view_models/workarea/storefront/product_view_model/cache_key.decorator +7 -0
- data/app/view_models/workarea/storefront/recommendations_view_model.decorator +20 -0
- data/app/view_models/workarea/storefront/user_activity_view_model.decorator +18 -0
- data/app/views/workarea/admin/catalog_categories/edit.html.haml +85 -0
- data/app/views/workarea/admin/facets/_price_inputs.html.haml +50 -0
- data/app/views/workarea/admin/flow_imports/index.html.haml +44 -0
- data/app/views/workarea/admin/orders/_flow.html.haml +22 -0
- data/app/views/workarea/admin/orders/_flow_aux_navigation.html.haml +2 -0
- data/app/views/workarea/admin/orders/flow.html.haml +109 -0
- data/app/views/workarea/admin/orders/tenders/_flow_payment.html.haml +3 -0
- data/app/views/workarea/admin/pricing_skus/_cards.html.haml +83 -0
- data/app/views/workarea/admin/pricing_skus/flow.html.haml +60 -0
- data/app/views/workarea/admin/search_settings/show.html.haml +55 -0
- data/app/views/workarea/admin/shared/_flow_imports_link.html.haml +1 -0
- data/app/views/workarea/storefront/_flow_io_country_picker.html.haml +2 -0
- data/app/views/workarea/storefront/_flow_io_country_picker_javascript.html.haml +1 -0
- data/app/views/workarea/storefront/order_mailer/tenders/_flow_payment.html.haml +2 -0
- data/app/views/workarea/storefront/order_mailer/tenders/_flow_payment.text.erb +1 -0
- data/app/views/workarea/storefront/orders/tenders/_flow_payment.html.haml +3 -0
- data/app/views/workarea/storefront/products/_pricing.html.haml +41 -0
- data/app/workers/workarea/flow_io/delete_items.rb +30 -0
- data/app/workers/workarea/flow_io/fetch_import.rb +34 -0
- data/app/workers/workarea/flow_io/fulfillment_cancellation.rb +14 -0
- data/app/workers/workarea/flow_io/item_exporter.rb +47 -0
- data/app/workers/workarea/flow_io/process_import.rb +28 -0
- data/app/workers/workarea/flow_io/shipping_notifications.rb +13 -0
- data/bin/rails +25 -0
- data/config/initializers/appends.rb +39 -0
- data/config/initializers/freedom_patches.rb +23 -0
- data/config/initializers/middleware.rb +11 -0
- data/config/initializers/payment_proxy.rb +5 -0
- data/config/initializers/rack_attack.rb +15 -0
- data/config/initializers/scheduled_jobs.rb +9 -0
- data/config/initializers/workarea.rb +101 -0
- data/config/initializers/workarea_i18n.rb +11 -0
- data/config/locales/en.yml +72 -0
- data/config/routes.rb +21 -0
- data/lib/active_merchant/billing/bogus_flow_gateway.rb +16 -0
- data/lib/active_merchant/billing/flow_gateway.rb +48 -0
- data/lib/tasks/flow_io.rake +117 -0
- data/lib/workarea/flow_io.rb +73 -0
- data/lib/workarea/flow_io/bogus_client.rb +57 -0
- data/lib/workarea/flow_io/bogus_client/checkout_tokens.rb +25 -0
- data/lib/workarea/flow_io/bogus_client/experiences.rb +152 -0
- data/lib/workarea/flow_io/bogus_client/fulfillments.rb +9 -0
- data/lib/workarea/flow_io/bogus_client/items.rb +11 -0
- data/lib/workarea/flow_io/bogus_client/orders.rb +499 -0
- data/lib/workarea/flow_io/bogus_client/organizations.rb +42 -0
- data/lib/workarea/flow_io/bogus_client/proxy_client.rb +29 -0
- data/lib/workarea/flow_io/bogus_client/sessions.rb +115 -0
- data/lib/workarea/flow_io/bogus_client/shipping_notifications.rb +10 -0
- data/lib/workarea/flow_io/bogus_client/webhook_settings.rb +11 -0
- data/lib/workarea/flow_io/bogus_client/webhooks.rb +11 -0
- data/lib/workarea/flow_io/controller_log_subscriber.rb +21 -0
- data/lib/workarea/flow_io/engine.rb +8 -0
- data/lib/workarea/flow_io/http_handler.rb +27 -0
- data/lib/workarea/flow_io/version.rb +5 -0
- data/lib/workarea/freedom_patches/flow_io.rb +53 -0
- data/package.json +9 -0
- data/script/admin_ci +9 -0
- data/script/ci +11 -0
- data/script/core_ci +9 -0
- data/script/plugins_ci +9 -0
- data/script/storefront_ci +9 -0
- data/test/dummy/.ruby-version +1 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +28 -0
- data/test/dummy/bin/update +28 -0
- data/test/dummy/bin/yarn +11 -0
- data/test/dummy/config.ru +5 -0
- data/test/dummy/config/application.rb +32 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/cable.yml +10 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +52 -0
- data/test/dummy/config/environments/production.rb +88 -0
- data/test/dummy/config/environments/test.rb +45 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/test/dummy/config/initializers/assets.rb +14 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/content_security_policy.rb +25 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/workarea.rb +5 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +9 -0
- data/test/dummy/config/locales/en.yml +33 -0
- data/test/dummy/config/puma.rb +34 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/db/seeds.rb +2 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/package.json +5 -0
- data/test/factories/workarea/flow_io.rb +136 -0
- data/test/factories/workarea/flow_io/euro_order_upserted_payload.rb +581 -0
- data/test/fixtures/files/example.csv +14 -0
- data/test/integration/workarea/admin/flow_imports_integration_test.rb +20 -0
- data/test/integration/workarea/admin/flow_order_integration_test.rb +37 -0
- data/test/integration/workarea/admin/search_settings_integration_test.decorator +44 -0
- data/test/integration/workarea/flow_locale_integration_test.rb +34 -0
- data/test/integration/workarea/storefront/copying_guest_order_integration_test.decorator +113 -0
- data/test/integration/workarea/storefront/flow_io_order_redirect_test.rb +55 -0
- data/test/integration/workarea/storefront/flow_io_session_integration_test.rb +122 -0
- data/test/integration/workarea/storefront/flow_io_webhooks/order_integration_test.rb +750 -0
- data/test/integration/workarea/storefront/flow_webhook_rack_attack_integration_test.rb +54 -0
- data/test/integration/workarea/storefront/search_integration_test.decorator +51 -0
- data/test/javascripts/flow_spec.js +39 -0
- data/test/javascripts/spec_helper.js +3 -0
- data/test/models/workarea/address_test.decorator +20 -0
- data/test/models/workarea/checkout_test.decorator +20 -0
- data/test/models/workarea/flow_io/imported_item_test.rb +50 -0
- data/test/models/workarea/fulfillment_test.decorator +12 -0
- data/test/models/workarea/oms_fulfillment_test.decorator +14 -0
- data/test/models/workarea/order/item_test.decorator +46 -0
- data/test/models/workarea/order_test.decorator +16 -0
- data/test/models/workarea/payment/flow_payment_integration_test.rb +163 -0
- data/test/models/workarea/price_adjustment_set_flow_test.rb +8 -0
- data/test/models/workarea/pricing/calculators/flow_localization_calculator_test.rb +152 -0
- data/test/models/workarea/pricing/calculators/item_calculator_test.decorator +59 -0
- data/test/models/workarea/pricing/collection_test.decorator +140 -0
- data/test/models/workarea/pricing/order_totals_test.rb +247 -0
- data/test/models/workarea/pricing/price_distributor_test.decorator +21 -0
- data/test/models/workarea/pricing/sku_test.decorator +113 -0
- data/test/models/workarea/shipping_test.decorator +70 -0
- data/test/queries/workarea/flow_order_metrics_test.rb +104 -0
- data/test/services/workarea/commit_shipments_test.decorator +14 -0
- data/test/services/workarea/flow_io/checkout_test.rb +43 -0
- data/test/services/workarea/flow_io/detailed_shipping_notification_form_test.rb +145 -0
- data/test/services/workarea/flow_io/experiences_test.rb +14 -0
- data/test/services/workarea/flow_io/fulfillment_cancellation_form_test.rb +46 -0
- data/test/services/workarea/flow_io/item_importer_test.rb +357 -0
- data/test/services/workarea/flow_io/item_test.rb +72 -0
- data/test/services/workarea/flow_io/line_item_form_test.rb +34 -0
- data/test/services/workarea/flow_io/order_put_form_test.rb +48 -0
- data/test/services/workarea/flow_io/price_applier_test.rb +916 -0
- data/test/support/flow_fixtures.rb +1362 -0
- data/test/support/webhook_integration_test.rb +43 -0
- data/test/support/workarea/flow_bogus_client_support.rb +18 -0
- data/test/support/workarea/flow_io_vcr_config.rb +22 -0
- data/test/system/workarea/admin/search_fulfillment_system_test.decorator +25 -0
- data/test/system/workarea/storefront/analytics_system_test.decorator +28 -0
- data/test/system/workarea/storefront/flow_cart_recommendations_system_test.rb +70 -0
- data/test/system/workarea/storefront/users_flow_orders_system_test.rb +25 -0
- data/test/teaspoon_env.rb +6 -0
- data/test/test_helper.rb +27 -0
- data/test/vcr_cassettes/payment/flow/auth_capture.yml +188 -0
- data/test/vcr_cassettes/payment/flow/auth_capture_refund.yml +249 -0
- data/test/vcr_cassettes/payment/flow/auth_void.yml +188 -0
- data/test/vcr_cassettes/payment/flow/purchase_refund.yml +249 -0
- data/test/vcr_cassettes/payment/flow/store_auth.yml +127 -0
- data/test/vcr_cassettes/payment/flow/store_purchase.yml +188 -0
- data/test/view_models/workarea/storefront/cart_view_model_test.decorator +19 -0
- data/test/view_models/workarea/storefront/order_item_view_model_test.decorator +24 -0
- data/test/view_models/workarea/storefront/order_view_model_test.decorator +41 -0
- data/test/view_models/workarea/storefront/package_view_model_test.decorator +11 -0
- data/test/workers/workarea/flow_io/delete_items_test.rb +37 -0
- data/test/workers/workarea/flow_io/fetch_import_test.rb +41 -0
- data/test/workers/workarea/flow_io/item_exporter_test.rb +47 -0
- data/test/workers/workarea/flow_io/process_import_test.rb +25 -0
- data/workarea-flow_io.gemspec +20 -0
- metadata +375 -0
@@ -0,0 +1,189 @@
|
|
1
|
+
.dropdown-container {
|
2
|
+
cursor: pointer;
|
3
|
+
}
|
4
|
+
|
5
|
+
.flow-country-picker-modal-trigger,
|
6
|
+
.flow-country-picker-dropdown-trigger {
|
7
|
+
border: 0;
|
8
|
+
cursor: pointer;
|
9
|
+
display: inline-block;
|
10
|
+
font-size: 14px;
|
11
|
+
margin-bottom: 3px;
|
12
|
+
padding: 4px 6px 0;
|
13
|
+
|
14
|
+
> img {
|
15
|
+
border-radius: 2px;
|
16
|
+
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, .10);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
.flow-country-picker-modal-trigger-text,
|
21
|
+
.flow-country-picker-dropdown-trigger-text {
|
22
|
+
bottom: 4px;
|
23
|
+
color: #191919;
|
24
|
+
position: relative;
|
25
|
+
}
|
26
|
+
|
27
|
+
.flow-country-picker-dropdown-backdrop {
|
28
|
+
background-color: rgba(0, 0, 0, 0);
|
29
|
+
height: 100%;
|
30
|
+
position: fixed;
|
31
|
+
top: 0;
|
32
|
+
width: 100%;
|
33
|
+
z-index: 10;
|
34
|
+
}
|
35
|
+
|
36
|
+
.flow-country-picker-instruction-txt {
|
37
|
+
border-bottom: 1px solid #e6e6e6;
|
38
|
+
color: black;
|
39
|
+
display: block;
|
40
|
+
line-height: 14px;
|
41
|
+
margin-bottom: 3px;
|
42
|
+
padding: 12px 10px;
|
43
|
+
}
|
44
|
+
|
45
|
+
.flow-country-picker-modal-trigger:hover,
|
46
|
+
.flow-country-picker-modal-trigger:focus,
|
47
|
+
.flow-country-picker-modal-trigger.flow-country-picker-open,
|
48
|
+
.flow-country-picker-dropdown-trigger:hover,
|
49
|
+
.flow-country-picker-dropdown-trigger:focus,
|
50
|
+
.flow-country-picker-dropdown-trigger.flow-country-picker-open {
|
51
|
+
background-color: #f3f3f3;
|
52
|
+
}
|
53
|
+
|
54
|
+
.flow-country-picker-country-logo {
|
55
|
+
display: inline-block;
|
56
|
+
padding-right: 10px;
|
57
|
+
|
58
|
+
> img {
|
59
|
+
border-radius: 2px;
|
60
|
+
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, .10);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
.flow-country-picker-show {
|
65
|
+
opacity: 1;
|
66
|
+
visibility: visible;
|
67
|
+
}
|
68
|
+
|
69
|
+
.flow-country-picker-open {
|
70
|
+
color: #191919;
|
71
|
+
}
|
72
|
+
|
73
|
+
.flow-country-picker-modal {
|
74
|
+
background-color: white;
|
75
|
+
border-radius: 4px;
|
76
|
+
box-shadow: 0 2px 24px 0 rgba(0, 0, 0, .15), 0 2px 4px 0 rgba(0, 0, 0, .15);
|
77
|
+
left: calc(50% - 375px);
|
78
|
+
max-height: 700px;
|
79
|
+
padding: 20px;
|
80
|
+
position: fixed;
|
81
|
+
top: 25vh;
|
82
|
+
width: 700px;
|
83
|
+
z-index: 99999;
|
84
|
+
}
|
85
|
+
|
86
|
+
.flow-country-picker-modal-item-container {
|
87
|
+
cursor: pointer;
|
88
|
+
display: inline-block;
|
89
|
+
font-size: 12px;
|
90
|
+
padding: 7px 5px 7px 0;
|
91
|
+
width: 100%;
|
92
|
+
|
93
|
+
&:hover {
|
94
|
+
background-color: #e6e6e6;
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
.flow-country-picker-modal-item {
|
99
|
+
align-content: center;
|
100
|
+
display: flex;
|
101
|
+
flex-direction: row;
|
102
|
+
}
|
103
|
+
|
104
|
+
.flow-country-picker-selected-modal-item {
|
105
|
+
background-color: #c0dfff;
|
106
|
+
cursor: initial;
|
107
|
+
}
|
108
|
+
|
109
|
+
.flow-country-picker-modal-backdrop {
|
110
|
+
background-color: rgba(0, 0, 0, .30);
|
111
|
+
height: 100%;
|
112
|
+
position: fixed;
|
113
|
+
top: 0;
|
114
|
+
width: 100%;
|
115
|
+
z-index: 10;
|
116
|
+
}
|
117
|
+
|
118
|
+
.flow-country-picker-modal-text {
|
119
|
+
align-self: center;
|
120
|
+
color: #191919;
|
121
|
+
line-height: 15px;
|
122
|
+
}
|
123
|
+
|
124
|
+
.flow-country-picker-modal-logo {
|
125
|
+
align-self: center;
|
126
|
+
border-radius: 2px;
|
127
|
+
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, .10);
|
128
|
+
height: 15px;
|
129
|
+
margin-left: 10px;
|
130
|
+
margin-right: 8px;
|
131
|
+
width: 21px;
|
132
|
+
}
|
133
|
+
|
134
|
+
.flow-country-picker-modal-header {
|
135
|
+
border-bottom: 1px #e6e6e6 solid;
|
136
|
+
margin-bottom: 16px;
|
137
|
+
padding-bottom: 16px;
|
138
|
+
padding-left: 5px;
|
139
|
+
}
|
140
|
+
|
141
|
+
.flow-country-picker-modal-title {
|
142
|
+
color: #191919;
|
143
|
+
display: inline-block;
|
144
|
+
}
|
145
|
+
|
146
|
+
.flow-country-picker-modal-close {
|
147
|
+
cursor: pointer;
|
148
|
+
display: inline-block;
|
149
|
+
float: right;
|
150
|
+
height: 10px;
|
151
|
+
margin-top: 7px;
|
152
|
+
stroke: #bfbfbf;
|
153
|
+
width: 10px;
|
154
|
+
|
155
|
+
&:hover {
|
156
|
+
stroke: #808080;
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
.flow-country-picker-modal-body {
|
161
|
+
max-height: 650px;
|
162
|
+
overflow-y: scroll;
|
163
|
+
}
|
164
|
+
|
165
|
+
.flow-country-picker-modal-body-content {
|
166
|
+
column-count: 4;
|
167
|
+
}
|
168
|
+
|
169
|
+
.flow-country-picker-current-experience-txt {
|
170
|
+
bottom: 6px;
|
171
|
+
display: inline-block;
|
172
|
+
padding-left: 7px;
|
173
|
+
position: relative;
|
174
|
+
}
|
175
|
+
|
176
|
+
.flow-country-picker-selected-logo {
|
177
|
+
display: inline-block;
|
178
|
+
}
|
179
|
+
|
180
|
+
@media (max-width: 768px) {
|
181
|
+
.flow-country-picker-modal {
|
182
|
+
left: 0;
|
183
|
+
width: 100%;
|
184
|
+
}
|
185
|
+
|
186
|
+
.flow-country-picker-modal-body-content {
|
187
|
+
column-count: unset;
|
188
|
+
}
|
189
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Workarea
|
2
|
+
decorate Admin::SearchSettingsController, with: :flow_io do
|
3
|
+
def update
|
4
|
+
clean_range_facets = CleanRangeFacets.new(params[:range_facets])
|
5
|
+
attributes = {
|
6
|
+
synonyms: params[:synonyms],
|
7
|
+
boosts: params[:boosts].to_h,
|
8
|
+
views_factor: params[:views_factor],
|
9
|
+
terms_facets_list: params[:terms_facets_list],
|
10
|
+
range_facets: clean_range_facets.result.presence,
|
11
|
+
currency_localized_facets: CleanRangeFacets.new(params[:currency_localized_facets]).result
|
12
|
+
}.merge(params[:settings] || {}).compact
|
13
|
+
|
14
|
+
Search::Settings.current.update_attributes!(attributes)
|
15
|
+
flash[:success] = t('workarea.admin.search_settings.flash_messages.saved')
|
16
|
+
redirect_to return_to.presence || search_settings_path
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def currency_localized_facets
|
22
|
+
params[:currency_localized_facets].to_h.map do |currency_code, facets|
|
23
|
+
[currency_code, CleanRangeFacets.new(facets).result]
|
24
|
+
end.to_h
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
module Workarea
|
2
|
+
decorate Storefront::ApplicationController, with: :flow_io do
|
3
|
+
decorated do
|
4
|
+
helper_method :flow_experience
|
5
|
+
helper Workarea::Storefront::FlowContentHelper
|
6
|
+
helper Workarea::Storefront::FlowAnalyticsHelper
|
7
|
+
|
8
|
+
etag { flow_experience&.key }
|
9
|
+
end
|
10
|
+
|
11
|
+
def flow_experience
|
12
|
+
@flow_experience ||=
|
13
|
+
if request.has_header?('flow.io.experience')
|
14
|
+
request.headers['flow.io.experience']
|
15
|
+
elsif cookies[:flow_experience] && experience = JSON.parse(cookies[:flow_experience], quirks_mode: true)
|
16
|
+
::Io::Flow::V0::Models::ExperienceGeo.new(experience)
|
17
|
+
else
|
18
|
+
nil
|
19
|
+
end
|
20
|
+
rescue
|
21
|
+
nil
|
22
|
+
end
|
23
|
+
|
24
|
+
def flow_country
|
25
|
+
@flow_country ||=
|
26
|
+
if request.has_header?('flow.io.country')
|
27
|
+
request.headers['flow.io.country']
|
28
|
+
elsif cookies[:flow_country]
|
29
|
+
cookies[:flow_country]
|
30
|
+
end&.downcase
|
31
|
+
end
|
32
|
+
|
33
|
+
def default_url_options(*)
|
34
|
+
return super unless flow_experience && flow_country.present?
|
35
|
+
|
36
|
+
super.merge(locale: flow_country)
|
37
|
+
end
|
38
|
+
|
39
|
+
def current_order
|
40
|
+
@current_order ||= super.tap do |order|
|
41
|
+
order.build_experience_from_flow_model(flow_experience)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def set_locale
|
48
|
+
I18n.locale =
|
49
|
+
if I18n.available_locales.include?(params[:locale])
|
50
|
+
params[:locale]
|
51
|
+
else
|
52
|
+
I18n.default_locale
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def set_site_locale
|
57
|
+
@previous_locale = I18n.locale
|
58
|
+
I18n.locale =
|
59
|
+
if I18n.available_locales.include?(params[:locale])
|
60
|
+
params[:locale]
|
61
|
+
else
|
62
|
+
current_site.try(:locale) || I18n.default_locale
|
63
|
+
end
|
64
|
+
yield
|
65
|
+
ensure
|
66
|
+
I18n.locale = @previous_locale
|
67
|
+
end
|
68
|
+
|
69
|
+
def view_model_options
|
70
|
+
super.merge(flow_experience: flow_experience)
|
71
|
+
end
|
72
|
+
|
73
|
+
def set_vary_headers
|
74
|
+
super
|
75
|
+
|
76
|
+
response.headers['X-Flow-Experience'] = flow_experience&.key
|
77
|
+
response.headers['Vary'] = [response.headers['Vary'], 'X-Flow-Experience'].compact.join(', ')
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Workarea
|
2
|
+
decorate Storefront::CheckoutsController, with: :flow_io do
|
3
|
+
decorated { before_action :route_flow_order, if: :send_to_flow? }
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
def route_flow_order
|
8
|
+
current_order.update_attributes(flow_checkout_token: checkout_token.id)
|
9
|
+
|
10
|
+
redirect_to "#{FlowIo.config.checkout_uri}/tokens/#{checkout_token.id}"
|
11
|
+
end
|
12
|
+
|
13
|
+
def flow_session
|
14
|
+
return unless cookies['_f60_session'].present?
|
15
|
+
|
16
|
+
@flow_session ||= FlowIo.client.sessions.get_by_session(cookies['_f60_session'])
|
17
|
+
end
|
18
|
+
|
19
|
+
def send_to_flow?
|
20
|
+
flow_experience.present?
|
21
|
+
end
|
22
|
+
|
23
|
+
def checkout_token
|
24
|
+
@checkout_token ||=
|
25
|
+
begin
|
26
|
+
checkout_token_form = FlowIo::CheckoutTokenForm.from(
|
27
|
+
order: current_order,
|
28
|
+
session_id: flow_session.id
|
29
|
+
)
|
30
|
+
|
31
|
+
FlowIo.client.checkout_tokens.post_checkout_and_tokens_by_organization(
|
32
|
+
FlowIo.organization_id,
|
33
|
+
checkout_token_form
|
34
|
+
)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Workarea
|
2
|
+
module Storefront
|
3
|
+
class FlowIoWebhookController < Storefront::ApplicationController
|
4
|
+
skip_before_action :verify_authenticity_token
|
5
|
+
before_action :verify_signature
|
6
|
+
|
7
|
+
def event
|
8
|
+
begin
|
9
|
+
event = Io::Flow::V0::Models::Event.from_json(params.to_unsafe_hash)
|
10
|
+
FlowIo::Webhook.process(event)
|
11
|
+
successful_response
|
12
|
+
|
13
|
+
rescue Mongoid::Errors::DocumentNotFound => error
|
14
|
+
not_found_response(params: error.params, problem: error.problem)
|
15
|
+
rescue FlowIo::Webhook::Error::NotFound, FlowIo::Webhook::Error::UnhandledWebhook => error
|
16
|
+
not_found_response(error: "UnhandledWebhook: #{error}")
|
17
|
+
rescue RuntimeError => error # raised when Event.from_json gets malformed data
|
18
|
+
error_response(error: error.to_s)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def verify_signature
|
25
|
+
request_valid = FlowIo::WebhookRequestSignature.valid?(
|
26
|
+
request_signature: request.headers['X-Flow-Signature'],
|
27
|
+
request_body: request.raw_post
|
28
|
+
)
|
29
|
+
unsuccessful_response unless request_valid
|
30
|
+
end
|
31
|
+
|
32
|
+
def successful_response
|
33
|
+
render json: { status: 200 }
|
34
|
+
end
|
35
|
+
|
36
|
+
def unsuccessful_response
|
37
|
+
head :bad_request
|
38
|
+
end
|
39
|
+
|
40
|
+
def error_response(payload)
|
41
|
+
render json: payload, status: :unprocessable_entity
|
42
|
+
end
|
43
|
+
|
44
|
+
def not_found_response(payload)
|
45
|
+
render json: payload, status: :not_found
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Workarea
|
2
|
+
decorate Storefront::RecentViewsController, with: :flow_io do
|
3
|
+
# TODO base bag product isn't passing view model options
|
4
|
+
def show
|
5
|
+
if stale?(
|
6
|
+
etag: user_activity,
|
7
|
+
last_modified: user_activity.updated_at,
|
8
|
+
public: true
|
9
|
+
)
|
10
|
+
@recent_views = Storefront::UserActivityViewModel.new(user_activity, view_model_options)
|
11
|
+
render params[:view].in?(allowed_alt_views) ? params[:view] : :show
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|