@lightspeed/online-payments-sdk 0.1.4 → 0.1.5

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/dist/cjs/index.js CHANGED
@@ -38,10 +38,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.mountLightspeedPayments = void 0;
40
40
  var frameMessenger_1 = require("./frameMessenger");
41
- var getContentHostname = function () {
42
- var _a, _b;
43
- return ((_b = (_a = process.env.OVERRIDE_IFRAME_CONTENT_HOSTNAME) !== null && _a !== void 0 ? _a : process.env.IFRAME_CONTENT_HOSTNAME) !== null && _b !== void 0 ? _b : 'https://online-payment-widgets.lspay.lightspeed.app');
44
- };
41
+ var DefaultContentHostname = 'https://online-payment-widgets.lspay.lightspeed.app';
45
42
  function createOnlinePaymentsInterface(messenger) {
46
43
  var _this = this;
47
44
  return {
@@ -70,11 +67,13 @@ function createOnlinePaymentsInterface(messenger) {
70
67
  }); },
71
68
  };
72
69
  }
73
- function mountLightspeedPayments(mountPoint) {
70
+ function mountLightspeedPayments(mountPoint, configuration) {
71
+ var _a;
72
+ if (configuration === void 0) { configuration = {}; }
74
73
  return __awaiter(this, void 0, void 0, function () {
75
74
  var contentHostname, lspIframe, messenger, ready;
76
- return __generator(this, function (_a) {
77
- contentHostname = getContentHostname();
75
+ return __generator(this, function (_b) {
76
+ contentHostname = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.contentHostnameOverride) !== null && _a !== void 0 ? _a : DefaultContentHostname;
78
77
  lspIframe = window.document.createElement('iframe');
79
78
  lspIframe.height = '800px';
80
79
  lspIframe.width = '700px';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type Configuration = {
2
- payment_session: string;
2
+ contentHostnameOverride?: string;
3
3
  };
4
4
  export type CollectPaymentMethodResponse = {
5
5
  success: true;
@@ -8,4 +8,4 @@ export type CollectPaymentMethodResponse = {
8
8
  export type OnlinePaymentsInterface = {
9
9
  collectPaymentMethod(paymentSessionId: string): Promise<CollectPaymentMethodResponse>;
10
10
  };
11
- export declare function mountLightspeedPayments(mountPoint: HTMLElement): Promise<OnlinePaymentsInterface>;
11
+ export declare function mountLightspeedPayments(mountPoint: HTMLElement, configuration?: Configuration): Promise<OnlinePaymentsInterface>;
package/dist/index.js CHANGED
@@ -35,10 +35,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  }
36
36
  };
37
37
  import { FrameMessenger } from './frameMessenger';
38
- var getContentHostname = function () {
39
- var _a, _b;
40
- return ((_b = (_a = process.env.OVERRIDE_IFRAME_CONTENT_HOSTNAME) !== null && _a !== void 0 ? _a : process.env.IFRAME_CONTENT_HOSTNAME) !== null && _b !== void 0 ? _b : 'https://online-payment-widgets.lspay.lightspeed.app');
41
- };
38
+ var DefaultContentHostname = 'https://online-payment-widgets.lspay.lightspeed.app';
42
39
  function createOnlinePaymentsInterface(messenger) {
43
40
  var _this = this;
44
41
  return {
@@ -67,11 +64,13 @@ function createOnlinePaymentsInterface(messenger) {
67
64
  }); },
68
65
  };
69
66
  }
70
- export function mountLightspeedPayments(mountPoint) {
67
+ export function mountLightspeedPayments(mountPoint, configuration) {
68
+ var _a;
69
+ if (configuration === void 0) { configuration = {}; }
71
70
  return __awaiter(this, void 0, void 0, function () {
72
71
  var contentHostname, lspIframe, messenger, ready;
73
- return __generator(this, function (_a) {
74
- contentHostname = getContentHostname();
72
+ return __generator(this, function (_b) {
73
+ contentHostname = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.contentHostnameOverride) !== null && _a !== void 0 ? _a : DefaultContentHostname;
75
74
  lspIframe = window.document.createElement('iframe');
76
75
  lspIframe.height = '800px';
77
76
  lspIframe.width = '700px';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightspeed/online-payments-sdk",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Process online-payments with Lightspeed Payments",
5
5
  "author": "Lightspeed Commerce Inc.",
6
6
  "license": "SEE LICENSE IN LICENSE.md",