@razorpay/blade 9.5.1 → 9.5.3

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,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 01 Aug 2023 13:31:55 GMT
3
+ * Generated on Mon, 07 Aug 2023 12:25:50 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 01 Aug 2023 13:31:55 GMT
3
+ * Generated on Mon, 07 Aug 2023 12:25:50 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 01 Aug 2023 13:31:55 GMT
3
+ * Generated on Mon, 07 Aug 2023 12:25:50 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 01 Aug 2023 13:31:55 GMT
3
+ * Generated on Mon, 07 Aug 2023 12:25:50 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 01 Aug 2023 13:31:55 GMT
3
+ * Generated on Mon, 07 Aug 2023 12:25:50 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 01 Aug 2023 13:31:55 GMT
3
+ * Generated on Mon, 07 Aug 2023 12:25:50 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 01 Aug 2023 13:31:55 GMT
3
+ * Generated on Mon, 07 Aug 2023 12:25:50 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 01 Aug 2023 13:31:55 GMT
3
+ * Generated on Mon, 07 Aug 2023 12:25:50 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -8946,6 +8946,43 @@ var merge = createAssigner(function(object, source, srcIndex) {
8946
8946
 
8947
8947
  var merge_1 = merge;
8948
8948
 
8949
+ var PREFIX = '[Blade]:';
8950
+
8951
+ var throwBladeError = function throwBladeError(_ref) {
8952
+ var message = _ref.message,
8953
+ moduleName = _ref.moduleName;
8954
+
8955
+ {
8956
+ var prefix = moduleName ? "[Blade: ".concat(moduleName, "]:") : PREFIX;
8957
+ throw new Error("".concat(prefix, " ").concat(message));
8958
+ }
8959
+ };
8960
+
8961
+ var getCommonLogger = function getCommonLogger(type) {
8962
+ switch (type) {
8963
+ case 'error':
8964
+ return console.error;
8965
+
8966
+ case 'warn':
8967
+ return console.warn;
8968
+
8969
+ case 'log':
8970
+ default:
8971
+ return console.log;
8972
+ }
8973
+ };
8974
+
8975
+ var logger = function logger(_ref2) {
8976
+ var message = _ref2.message,
8977
+ moduleName = _ref2.moduleName,
8978
+ type = _ref2.type;
8979
+
8980
+ {
8981
+ var prefix = moduleName ? "[Blade: ".concat(moduleName, "]:") : PREFIX;
8982
+ getCommonLogger(type)("".concat(prefix, " ").concat(message));
8983
+ }
8984
+ };
8985
+
8949
8986
  var isPartialMatchObjectKeys = function isPartialMatchObjectKeys(_ref) {
8950
8987
  var objectToMatch = _ref.objectToMatch,
8951
8988
  objectToInspect = _ref.objectToInspect;
@@ -8967,7 +9004,11 @@ var isPartialMatchObjectKeys = function isPartialMatchObjectKeys(_ref) {
8967
9004
  !(valueToMatch instanceof Object) && _typeof(valueToMatch) !== _typeof(valueToInspect)) {
8968
9005
  {
8969
9006
  // this is an invalid case, so we log error
8970
- console.error("[isPartialMatchObjectKeys]: Unexpected value: ".concat(JSON.stringify(valueToMatch), " of type ").concat(_typeof(valueToMatch), " for key: ").concat(key));
9007
+ logger({
9008
+ message: "Unexpected value: ".concat(JSON.stringify(valueToMatch), " of type ").concat(_typeof(valueToMatch), " for key: ").concat(key),
9009
+ moduleName: 'isPartialMatchObjectKeys',
9010
+ type: 'error'
9011
+ });
8971
9012
  }
8972
9013
 
8973
9014
  matchResponses.push(false);
@@ -8988,7 +9029,11 @@ var isPartialMatchObjectKeys = function isPartialMatchObjectKeys(_ref) {
8988
9029
  } else {
8989
9030
  {
8990
9031
  // the key doesn't exist in the innerObjectToMatch, so we log error
8991
- console.error("[isPartialMatchObjectKeys]: ".concat(key, " doesn't exist in ").concat(JSON.stringify(innerObjectToInspect, null, 2)));
9032
+ logger({
9033
+ message: "".concat(key, " doesn't exist in ").concat(JSON.stringify(innerObjectToInspect, null, 2)),
9034
+ moduleName: 'isPartialMatchObjectKeys',
9035
+ type: 'error'
9036
+ });
8992
9037
  }
8993
9038
 
8994
9039
  matchResponses.push(false);
@@ -9035,14 +9080,20 @@ var overrideTheme = function overrideTheme(_ref) {
9035
9080
 
9036
9081
  {
9037
9082
  if (!isEqual_1(baseThemeTokens, paymentTheme) && !isEqual_1(baseThemeTokens, bankingTheme)) {
9038
- throw new Error('[@razorpay/blade:overrideTheme]: The base theme provided is not a valid Blade theme');
9083
+ throwBladeError({
9084
+ message: 'The base theme provided is not a valid Blade theme',
9085
+ moduleName: 'overrideTheme'
9086
+ });
9039
9087
  }
9040
9088
 
9041
9089
  if (!isPartialMatchObjectKeys({
9042
9090
  objectToMatch: overrides,
9043
9091
  objectToInspect: baseThemeTokens
9044
9092
  })) {
9045
- throw new Error('[@razorpay/blade:overrideTheme]: The overrides object is not valid');
9093
+ throwBladeError({
9094
+ message: 'The overrides object is not valid',
9095
+ moduleName: 'overrideTheme'
9096
+ });
9046
9097
  }
9047
9098
  } // Need to clone before merging since merge changes/mutates the actual object
9048
9099