@rebilly/instruments 3.7.0-beta.0 → 3.7.1-beta.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebilly/instruments",
3
- "version": "3.7.0-beta.0",
3
+ "version": "3.7.1-beta.0",
4
4
  "author": "Rebilly",
5
5
  "main": "dist/index.js",
6
6
  "unpkg": "dist/index.min.js",
@@ -35,17 +35,27 @@ export default class BaseIframe {
35
35
  }
36
36
 
37
37
  async createComponent() {
38
+ // Use a fake container so we can capture the appendChild call
39
+ // and immediately apply the feature-policy flags to the iframe
40
+ // before Postmate tries to load the iframe. The feature policy
41
+ // would otherwise not apply until the frame was reloaded.
42
+ const container = {
43
+ appendChild: (iframe) => {
44
+ iframe.setAttribute('loading', 'lazy');
45
+ iframe.setAttribute('allow', 'payment');
46
+ iframe.setAttribute('allowPaymentRequest', true);
47
+ this.container.appendChild(iframe);
48
+ },
49
+ };
50
+
38
51
  const component = await new Postmate({
39
52
  name: this.name,
40
53
  url: this.url,
41
- container: this.container,
54
+ container,
42
55
  classListArray: this.classListArray,
43
56
  model: this.model
44
57
  });
45
58
 
46
- component.frame.setAttribute('allowpaymentrequest', true);
47
- component.frame.setAttribute('loading', 'lazy');
48
- component.frame.setAttribute('allow', 'payment');
49
59
  return component;
50
60
  }
51
61
  }