@alipay/ams-checkout 0.0.1746674797-dev.1 → 0.0.1746674797-dev.2

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.
@@ -1,3 +1,4 @@
1
+ import { getDefaultEasySafePayPageUrl } from "../foundation/utils/web_app_url_utils";
1
2
  export function getChannelBehavior(paymentSessionMetaData) {
2
3
  var _paymentSessionMetaDa;
3
4
  var allowSubmitPayCallAhead = false;
@@ -75,13 +76,6 @@ export function getDoubleFaUrl(params) {
75
76
  sdkVersion = params.sdkVersion;
76
77
  var isLandscapeOrientation = false; // Web 不含横屏
77
78
 
78
- var DOUBLE_FA_URL_MAPPING = {
79
- local: 'http://page.alipay.net/page/antom-web-checkout-v2/easysafepay/pages/double-fa/index-1.0.1.html',
80
- dev: 'http://page.alipay.net/page/antom-web-checkout-v2/easysafepay/pages/double-fa/index-1.0.1.html',
81
- sit: 'http://page.test.alipay.net/page/antom-web-checkout-v2/easysafepay/pages/double-fa/index.html',
82
- pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2/easysafepay/pages/double-fa/index.html',
83
- prod: 'https://checkout.antom.com/easysafepay/pages/double-fa/index.html'
84
- };
85
- var doubleFaBaseUrl = DOUBLE_FA_URL_MAPPING[env] || DOUBLE_FA_URL_MAPPING.prod;
86
- return "".concat(doubleFaBaseUrl, "?scene=cashierResultPage&instanceId=").concat(instanceId, "&paymentSessionData=").concat(encodeURIComponent(paymentSessionData), "&isLandscape=").concat(isLandscapeOrientation ? 'true' : '', "&pmt=").concat(paymentMethodType, "&locale=").concat(locale, "&sdkVersion=").concat(sdkVersion);
79
+ var defaultFaBaseUrl = getDefaultEasySafePayPageUrl("double-fa", env);
80
+ return "".concat(defaultFaBaseUrl, "?scene=cashierResultPage&instanceId=").concat(instanceId, "&paymentSessionData=").concat(encodeURIComponent(paymentSessionData), "&isLandscape=").concat(isLandscapeOrientation ? 'true' : '', "&pmt=").concat(paymentMethodType, "&locale=").concat(locale, "&sdkVersion=").concat(sdkVersion);
87
81
  }
@@ -81,11 +81,17 @@ export declare const saveLocalCheckoutUrl: (productScene: ProductSceneEnum, url:
81
81
  *
82
82
  * @param productScene - The product scene for which the checkout URL should be retrieved.
83
83
  */
84
- export declare const getLocalCheckoutUrl: (productScene: ProductSceneEnum) => string;
84
+ export declare const getLocalCheckoutUrl: (productScene: ProductSceneEnum, environment: string) => string;
85
85
  /**
86
86
  * Provide default checkout URL for the specified product scene.
87
87
  * Return URL for 'EASY_PAY' product scene, while for other product scenes, it returns an empty string as they are not currently in use
88
88
  *
89
89
  * @param productScene - The product scene for which the default checkout URL should be provided.
90
90
  */
91
- export declare const defaultCheckoutUrl: (productScene: ProductSceneEnum) => string;
91
+ export declare const defaultCheckoutUrl: (productScene: ProductSceneEnum, environment?: string) => string;
92
+ /**
93
+ * V2应用EasySafePay 热更新兜底URL构建规则
94
+ * 1. 兜底到初始版本v1.0.1
95
+ * 2. DEV环境下html新增版本前缀
96
+ **/
97
+ export declare const getDefaultEasySafePayPageUrl: (pageName: string, env: string) => string;
@@ -70,9 +70,10 @@ export var getWebAppV2Url = function getWebAppV2Url(params) {
70
70
  var productScene = params.productScene,
71
71
  isPreload = params.isPreload,
72
72
  mid = params.mid,
73
- extendInfo = params.extendInfo;
73
+ extendInfo = params.extendInfo,
74
+ environment = params.environment;
74
75
  var webAppUrlMatchConfig = parseWebAppUrlMatchConfig(extendInfo);
75
- var v2Url = isPreload ? getLocalCheckoutUrl(productScene) : getMatchedWebAppV2Url(productScene, mid, webAppUrlMatchConfig);
76
+ var v2Url = isPreload ? getLocalCheckoutUrl(productScene, environment) : getMatchedWebAppV2Url(productScene, mid, webAppUrlMatchConfig, environment);
76
77
  var info = getWebAppUrlInfo(_objectSpread(_objectSpread({}, params), {}, {
77
78
  v2Url: v2Url
78
79
  }));
@@ -117,7 +118,7 @@ var getAppPath = function getAppPath() {
117
118
  var webAppVersion = sdkMetaData.webAppVersion;
118
119
  switch (productScene) {
119
120
  case ProductSceneEnum.EASY_PAY:
120
- return v2Url !== null && v2Url !== void 0 ? v2Url : defaultCheckoutUrl(productScene);
121
+ return v2Url !== null && v2Url !== void 0 ? v2Url : defaultCheckoutUrl(productScene, environment);
121
122
  default:
122
123
  return "".concat(marmotMap[environment], "/").concat(productSceneWithPaymentMethodCategoryType, "/").concat(validProductSceneVersion, "/index.").concat(webAppVersion, ".html");
123
124
  }
@@ -179,10 +180,10 @@ export var saveLocalCheckoutUrl = function saveLocalCheckoutUrl(productScene, ur
179
180
  *
180
181
  * @param productScene - The product scene for which the checkout URL should be retrieved.
181
182
  */
182
- export var getLocalCheckoutUrl = function getLocalCheckoutUrl(productScene) {
183
+ export var getLocalCheckoutUrl = function getLocalCheckoutUrl(productScene, environment) {
183
184
  var key = KEY_CHECKOUT_URL + productScene;
184
185
  var previousCheckoutUrl = localStorage.getItem(key);
185
- return previousCheckoutUrl !== null && previousCheckoutUrl !== void 0 ? previousCheckoutUrl : defaultCheckoutUrl(productScene);
186
+ return previousCheckoutUrl !== null && previousCheckoutUrl !== void 0 ? previousCheckoutUrl : defaultCheckoutUrl(productScene, environment);
186
187
  };
187
188
 
188
189
  /**
@@ -192,11 +193,10 @@ export var getLocalCheckoutUrl = function getLocalCheckoutUrl(productScene) {
192
193
  * @param productScene - The product scene for which the default checkout URL should be provided.
193
194
  */
194
195
  export var defaultCheckoutUrl = function defaultCheckoutUrl(productScene) {
195
- var defaultEnvironment = 'prod';
196
- var defaultEasyPayVersion = '1.0.1';
196
+ var environment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "prod";
197
197
  switch (productScene) {
198
198
  case ProductSceneEnum.EASY_PAY:
199
- return "".concat(v2AppMarmotMap[defaultEnvironment], "/easysafepay/").concat(defaultEasyPayVersion, "/pages/sdk-portal/index.html");
199
+ return getDefaultEasySafePayPageUrl("api-portal", environment);
200
200
  default:
201
201
  return '';
202
202
  }
@@ -204,9 +204,10 @@ export var defaultCheckoutUrl = function defaultCheckoutUrl(productScene) {
204
204
  var getMatchedWebAppV2Url = function getMatchedWebAppV2Url(productScene) {
205
205
  var mid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
206
206
  var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
207
+ var environment = arguments.length > 3 ? arguments[3] : undefined;
207
208
  if (config.length === 0) {
208
209
  // Default checkout url
209
- return defaultCheckoutUrl(productScene);
210
+ return defaultCheckoutUrl(productScene, environment);
210
211
  }
211
212
  var sortedConfig = config.sort(function (a, b) {
212
213
  return parseFloat(b.version) - parseFloat(a.version);
@@ -231,5 +232,24 @@ var getMatchedWebAppV2Url = function getMatchedWebAppV2Url(productScene) {
231
232
  }
232
233
 
233
234
  // Default checkout url
234
- return defaultCheckoutUrl(productScene);
235
+ return defaultCheckoutUrl(productScene, environment);
236
+ };
237
+
238
+ /**
239
+ * V2应用EasySafePay 热更新兜底URL构建规则
240
+ * 1. 兜底到初始版本v1.0.1
241
+ * 2. DEV环境下html新增版本前缀
242
+ **/
243
+ export var getDefaultEasySafePayPageUrl = function getDefaultEasySafePayPageUrl(pageName, env) {
244
+ // 生成的URL EXAMPLE:
245
+ // const DEFAULT_DOUBLE_FA_URL_MAPPING = {
246
+ // local: 'http://page.alipay.net/page/antom-web-checkout-v2/easysafepay/1.0.1/pages/double-fa/index-1.0.1.html',
247
+ // dev: 'http://page.alipay.net/page/antom-web-checkout-v2/easysafepay/1.0.1/pages/double-fa/index-1.0.1.html',
248
+ // sit: 'http://page.test.alipay.net/page/antom-web-checkout-v2/easysafepay/1.0.1/pages/double-fa/index.html',
249
+ // pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2/easysafepay/1.0.1/pages/double-fa/index.html',
250
+ // prod: 'https://checkout.antom.com/easysafepay/1.0.1/pages/double-fa/index.html',
251
+ // };
252
+ var defaultEasyPayVersion = '1.0.1';
253
+ var environment = env || "prod";
254
+ if (environment === "dev") return "".concat(v2AppMarmotMap[environment], "/easysafepay/").concat(defaultEasyPayVersion, "/pages/").concat(pageName, "/index-").concat(defaultEasyPayVersion, ".html");else return "".concat(v2AppMarmotMap[environment], "/easysafepay/").concat(defaultEasyPayVersion, "/pages/").concat(pageName, "/index.html");
235
255
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1746674797-dev.1",
3
+ "version": "0.0.1746674797-dev.2",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",