Commit f0978e14 authored by peterh-gr's avatar peterh-gr
Browse files

Use asseturl and relative paths for asset files

It wasn't working on staging because it lives in a sub-directory and
the asset paths were all absolute. This switches to use the asseturl
filter for all the assets in the template. There's one image asset for
the credit cards that's hardcoded in the JS, I don't have a good way to
use asseturl on that right now, so I've just hardcoded it to the path
asseturl would generate. In the future it would probably be best to
figure out how to do asseturl for images inside the Javascript.
parent d41305df
......@@ -774,7 +774,7 @@ module.exports={AF:["Badakhshan","Badghis","Baghlan","Balkh","Bamian","Farah","F
},{"react":"n8MK"}],"kmeX":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PayPalButton=c;var e=a(require("react")),r=a(require("react-dom")),t=require("./named_error"),n=require("./loading_dialog_react_pages");function a(e){return e&&e.__esModule?e:{default:e}}function o(e,r,t,n,a,o,i){try{var c=e[o](i),u=c.value}catch(s){return void t(s)}c.done?r(u):Promise.resolve(u).then(n,a)}function i(e){return function(){var r=this,t=arguments;return new Promise(function(n,a){var i=e.apply(r,t);function c(e){o(i,n,a,c,u,"next",e)}function u(e){o(i,n,a,c,u,"throw",e)}c(void 0)})}}function c(n){var a=n.paymentMethod,o=n.amount,c=(n.perk,n.frequency),u=(n.formData,n.noPerkCheckbox,n.fitsAndSizes,n.perkOption,n.requiredFields,n.addError),s=(n.givingFormError,n.textFields,n.priceOtherRef,n.isValidEmail,n.validateRequiredFieldsAndDonationAmount,n.preparePerkData),l=n.prepareFieldsData,d=n.createBillingAgreement,p=n.donateProccessorBaseUrl,f=n.successRedirectUrl,m=n.setLoading,y=paypal.Buttons.driver("react",{React:e.default,ReactDOM:r.default}),v=!1;"monthly"==c&&(v=!0);var h=l(),g=s(),x=function(){var e=i(regeneratorRuntime.mark(function e(r,n){var a,i,c,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return m(!0),a={credentials:"include",headers:{Accept:"application/json, text/html","Content-Type":"application/json"},method:"POST",body:JSON.stringify({PayerID:r.payerID,amount:o,fields:h,paymentMethod:{name:"paypal"},perk:g,recurring:v,token:r.orderID})},e.next=4,fetch("".concat(p,"/process-paypal"),a);case 4:return i=e.sent,e.next=7,i.json();case 7:if(!("errors"in(c=e.sent))){e.next=17;break}if(!(c.errors.length>0)){e.next=16;break}throw s=c.errors.join("\n"),u(new t.NamedError("paypalError",s)),m(!1),new Error(s);case 16:document.location=f;case 17:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}();return"paypal"==a?e.default.createElement(y,{onApprove:x,createBillingAgreement:d,onCancel:function(e,r){m(!1)}}):null}
},{"react":"n8MK","react-dom":"NKHc","./named_error":"H7H6","./loading_dialog_react_pages":"BxcR"}],"gQXm":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.StripeCreditCardForm=o;var e=n(require("react")),r=require("./named_error"),t=require("react-stripe-elements");function a(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return a=function(){return e},e}function n(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=a();if(r&&r.has(e))return r.get(e);var t={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var c=n?Object.getOwnPropertyDescriptor(e,l):null;c&&(c.get||c.set)?Object.defineProperty(t,l,c):t[l]=e[l]}return t.default=e,r&&r.set(e,t),t}function l(){return(l=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}var c=function(e,t,a){var n=["field",t];return null!=(0,r.findErrorByName)(a,{"card-number":"cardNumber","exp-date":"cardExpiry",cvc:"cardCvc"}[t])&&n.push("error"),{placeholder:e,classes:{base:n.join(" ")},style:{base:{fontSize:"16px",color:"#484848",letterSpacing:"0.025em","::placeholder":{fontFamily:'"Source Sans Pro", sans-serif'},fontFamily:'"Source Sans Pro", sans-serif'},invalid:{color:"#484848"}}}};function o(r){var a=r.onStripeFieldChange,n=r.errors;return e.default.createElement(e.default.Fragment,null,e.default.createElement("div",{className:"split-form stripe-elements"},e.default.createElement("div",{className:"field-row"},e.default.createElement(t.CardNumberElement,l({},c("Card Number","card-number",n),{onChange:a})),e.default.createElement("img",{className:"credit-cards",src:"/static/images/donate/credit-cards.png"})),e.default.createElement("div",{className:"field-row"},e.default.createElement(t.CardExpiryElement,l({},c("MM/YY","exp-date",n),{onChange:a})),e.default.createElement(t.CardCVCElement,l({},c("CVC","cvc",n),{onChange:a})))))}
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.StripeCreditCardForm=o;var e=n(require("react")),r=require("./named_error"),t=require("react-stripe-elements");function a(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return a=function(){return e},e}function n(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=a();if(r&&r.has(e))return r.get(e);var t={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var c=n?Object.getOwnPropertyDescriptor(e,l):null;c&&(c.get||c.set)?Object.defineProperty(t,l,c):t[l]=e[l]}return t.default=e,r&&r.set(e,t),t}function l(){return(l=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}var c=function(e,t,a){var n=["field",t];return null!=(0,r.findErrorByName)(a,{"card-number":"cardNumber","exp-date":"cardExpiry",cvc:"cardCvc"}[t])&&n.push("error"),{placeholder:e,classes:{base:n.join(" ")},style:{base:{fontSize:"16px",color:"#484848",letterSpacing:"0.025em","::placeholder":{fontFamily:'"Source Sans Pro", sans-serif'},fontFamily:'"Source Sans Pro", sans-serif'},invalid:{color:"#484848"}}}};function o(r){var a=r.onStripeFieldChange,n=r.errors;return e.default.createElement(e.default.Fragment,null,e.default.createElement("div",{className:"split-form stripe-elements"},e.default.createElement("div",{className:"field-row"},e.default.createElement(t.CardNumberElement,l({},c("Card Number","card-number",n),{onChange:a})),e.default.createElement("img",{className:"credit-cards",src:"../static/images/donate/credit-cards.png"})),e.default.createElement("div",{className:"field-row"},e.default.createElement(t.CardExpiryElement,l({},c("MM/YY","exp-date",n),{onChange:a})),e.default.createElement(t.CardCVCElement,l({},c("CVC","cvc",n),{onChange:a})))))}
},{"react":"n8MK","./named_error":"H7H6","react-stripe-elements":"VJkE"}],"d8fc":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DonationInformation=o;var e=n(require("react")),t=require("/number");function r(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return r=function(){return e},e}function n(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=r();if(t&&t.has(e))return t.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if(Object.prototype.hasOwnProperty.call(e,u)){var a=o?Object.getOwnPropertyDescriptor(e,u):null;a&&(a.get||a.set)?Object.defineProperty(n,u,a):n[u]=e[u]}return n.default=e,t&&t.set(e,n),n}function o(r){var n=r.selectedPrice,o=r.frequency,u=" $"+(0,t.showCommaForThousands)(n/100);return"monthly"==o&&(u+=" per month"),e.default.createElement("span",{id:"donate-submit-amount"},u)}
},{"react":"n8MK","/number":"l7mx"}],"NkYk":[function(require,module,exports) {
......
This diff is collapsed.
......@@ -48,7 +48,7 @@ export function StripeCreditCardForm(props) {
{...createOptions('Card Number', 'card-number', errors)}
onChange={onStripeFieldChange}
/>
<img className='credit-cards' src='/static/images/donate/credit-cards.png'/>
<img className='credit-cards' src='../static/images/donate/credit-cards.png'/>
</div>
<div className="field-row">
<CardExpiryElement
......
{
"systemParams": "linux-x64-64",
"systemParams": "linux-x64-72",
"modulesFolders": [
"node_modules"
],
......
......@@ -39,8 +39,8 @@
'monthly': `{{ this.sticker_perk_monthly_label }}`
},
'image': {
'single': `{{ this.sticker_perk_single_image }}`,
'monthly': `{{ this.sticker_perk_monthly_image }}`
'single': `{{ this.sticker_perk_single_image | asseturl }}`,
'monthly': `{{ this.sticker_perk_monthly_image | asseturl }}`
},
'description': {
'single': `{{ this.sticker_perk_single_description }}`,
......@@ -60,8 +60,8 @@
'monthly': `{{ this.tshirt_perk_monthly_label }}`
},
'image': {
'single': `{{ this.tshirt_perk_single_image }}`,
'monthly': `{{ this.tshirt_perk_monthly_image }}`
'single': `{{ this.tshirt_perk_single_image | asseturl }}`,
'monthly': `{{ this.tshirt_perk_monthly_image | asseturl }}`
},
'description': {
'single': `{{ this.tshirt_perk_single_description }}`,
......@@ -81,8 +81,8 @@
'monthly': `{{ this.tshirt_pack_perk_monthly_label }}`
},
'image': {
'single': `{{ this.tshirt_pack_perk_single_image }}`,
'monthly': `{{ this.tshirt_pack_perk_monthly_image }}`
'single': `{{ this.tshirt_pack_perk_single_image | asseturl }}`,
'monthly': `{{ this.tshirt_pack_perk_monthly_image | asseturl }}`
},
'description': {
'single': `{{ this.tshirt_pack_perk_single_description }}`,
......@@ -97,8 +97,8 @@
'name': 'strength-in-numbers',
'friendlyName': 'Strength in Numbers',
'image': {
'single': `{{ this.tshirt_pack_perk_single_image }}`,
'monthly': `{{ this.tshirt_pack_perk_monthly_image }}`
'single': `{{ this.tshirt_pack_perk_single_image | asseturl }}`,
'monthly': `{{ this.tshirt_pack_perk_monthly_image | asseturl }}`
}
},
],
......@@ -111,8 +111,8 @@
'monthly': `{{ this.sweatshirt_perk_monthly_label }}`
},
'image': {
'single': `{{ this.sweatshirt_perk_single_image }}`,
'monthly': `{{ this.sweatshirt_perk_monthly_image }}`
'single': `{{ this.sweatshirt_perk_single_image | asseturl }}`,
'monthly': `{{ this.sweatshirt_perk_monthly_image | asseturl }}`
},
'description': {
'single': `{{ this.sweatshirt_perk_single_description }}`,
......@@ -194,4 +194,4 @@
);
}
</script>
<script type="text/javascript" src="/static/gen/donate.js"></script>
<script type="text/javascript" src="{{ '/static/gen/donate.js' | asseturl }}"></script>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment