@gem-sdk/core 3.1.0-staging.1138 → 3.1.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.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";var shop=require("./shop.js");const shopifyPriceRounding=(e,a)=>parseFloat(`${e}`).toFixed(Number(a)),formatMoney=function(e,a){let o="",r=/\{\{\s*(\w+)\s*\}\}/,t=
|
|
2
|
+
"use strict";var shop=require("./shop.js");const shopifyPriceRounding=(e,a)=>parseFloat(`${e}`).toFixed(Number(a)),formatMoney=function(e,a){let o="",r=/\{\{\s*(\w+)\s*\}\}/,t=a||"${{amount}}";function s(e,a){return void 0===e?a:e}function n(e,a,o,r){if(a=s(a,2),o=s(o,","),r=s(r,"."),isNaN(e)||null==e)return 0;e=shopifyPriceRounding(e,Number(a));let t=e.split("."),n=t[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+o),i=t[1]?r+t[1]:"";return n+i}switch(t.match(r)[1]){case"amount":o=n(e,2);break;case"amount_no_decimals":o=n(e,0);break;case"amount_with_comma_separator":o=n(e,2,".",",");break;case"amount_no_decimals_with_comma_separator":o=n(e,0,".",",");break;case"amount_with_apostrophe_separator":o=n(e,2,"'",".");break;case"amount_no_decimals_with_space_separator":o=n(e,0," ");break;case"amount_with_space_separator":o=n(e,2," ",",");break;case"amount_with_period_and_space_separator":o=n(e,2," ",".")}return t.replace(r,o)},useFormatMoney=(e,a)=>{let{moneyFormat:o,moneyWithCurrencyFormat:r}=shop.useMoneyFormat();return a?formatMoney(`${e}`,r||o):formatMoney(`${e}`,o)};exports.formatMoney=formatMoney,exports.shopifyPriceRounding=shopifyPriceRounding,exports.useFormatMoney=useFormatMoney;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{useMoneyFormat as
|
|
2
|
+
import{useMoneyFormat as a}from"./shop.js";let shopifyPriceRounding=(a,e)=>parseFloat(`${a}`).toFixed(Number(e)),formatMoney=function(a,e){let o="",r=/\{\{\s*(\w+)\s*\}\}/,t=e||"${{amount}}";function n(a,e){return void 0===a?e:a}function s(a,e,o,r){if(e=n(e,2),o=n(o,","),r=n(r,"."),isNaN(a)||null==a)return 0;a=shopifyPriceRounding(a,Number(e));let t=a.split("."),s=t[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+o),i=t[1]?r+t[1]:"";return s+i}switch(t.match(r)[1]){case"amount":o=s(a,2);break;case"amount_no_decimals":o=s(a,0);break;case"amount_with_comma_separator":o=s(a,2,".",",");break;case"amount_no_decimals_with_comma_separator":o=s(a,0,".",",");break;case"amount_with_apostrophe_separator":o=s(a,2,"'",".");break;case"amount_no_decimals_with_space_separator":o=s(a,0," ");break;case"amount_with_space_separator":o=s(a,2," ",",");break;case"amount_with_period_and_space_separator":o=s(a,2," ",".")}return t.replace(r,o)},useFormatMoney=(e,o)=>{let{moneyFormat:r,moneyWithCurrencyFormat:t}=a();return o?formatMoney(`${e}`,t||r):formatMoney(`${e}`,r)};export{formatMoney,shopifyPriceRounding,useFormatMoney};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -35891,8 +35891,6 @@ type InputUnitControlType<T> = SharedControlType<T> & {
|
|
|
35891
35891
|
isNumber?: boolean;
|
|
35892
35892
|
fallbackValue?: string | number;
|
|
35893
35893
|
hasSpaceBeforeUnit?: boolean;
|
|
35894
|
-
inputType?: string;
|
|
35895
|
-
disableAutoValue?: boolean;
|
|
35896
35894
|
};
|
|
35897
35895
|
|
|
35898
35896
|
type MarginControlType<T> = SharedControlType<T> & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/core",
|
|
3
|
-
"version": "3.1.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"type-check": "yarn tsc --noEmit"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@gem-sdk/adapter-shopify": "3.1.0
|
|
31
|
-
"@gem-sdk/styles": "3.1.0
|
|
30
|
+
"@gem-sdk/adapter-shopify": "3.1.0",
|
|
31
|
+
"@gem-sdk/styles": "3.1.0",
|
|
32
32
|
"@types/classnames": "^2.3.1"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|